diff --git a/.gitattributes b/.gitattributes index 9de5882b60d7c08a9986a78204cc6fb8da98a021..6a0f88f21cc3f5ddec2179e4435d38f98499eb6d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ Changelog merge=union +*.pdf binary diff --git a/.gitignore b/.gitignore index 6d2e45b8e4e8e50b1cf4dcdbab4c4a80bfe1eb3c..2a31260fa62fb9b2136b74c036a9fd28216ff02a 100644 --- a/.gitignore +++ b/.gitignore @@ -144,12 +144,10 @@ autom4te.cache /src/plugins/*/doc/*/*.idx # WP/Coq Generated file -/*lia.cache +*lia.cache # generated ML files -/src/libraries/stdlib/FCDynlink.ml -/src/libraries/stdlib/integer.ml /src/libraries/utils/json.ml /src/kernel_internals/runtime/toplevel_boot.ml /src/kernel_internals/runtime/config.ml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9aa9561488b919ba08b3856e58d4d140c0973a08..e474c828e74bb37313845dc87ce3be1b119b619d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,34 +1,53 @@ +stages: + - frama_c_and_plugins + - distrib_and_compatibility + +frama-c-external: + stage: frama_c_and_plugins + script: + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c-external + tags: + except: + - tags + frama-c: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c tags: except: - tags frama-c-ocaml-4.03: + stage: distrib_and_compatibility script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --ocaml 4.03 --camlp4 4.03 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --ocaml 4.03 --camlp4 4.03 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c tags: except: - tags frama-c-ocaml-4.04: + stage: distrib_and_compatibility script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --ocaml 4.04 --camlp4 4.04 --lablgtk 4bbd5cf1990aa8b775cf247fbfe5be321e13cc61 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --ocaml 4.04 --camlp4 4.04 --lablgtk 4bbd5cf1990aa8b775cf247fbfe5be321e13cc61 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c tags: except: - tags -frama-c-external: +frama-c-ocaml-4.05: + stage: distrib_and_compatibility script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c-external + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --ocaml 4.05 --camlp4 4.05 --lablgtk 4bbd5cf1990aa8b775cf247fbfe5be321e13cc61 --camomile 3f4d657d50c17213f3338ca75efb30d728704df3 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c tags: except: - tags + allow_failure: true + frama-c-internal: + stage: distrib_and_compatibility script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c-internal + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c-internal tags: only: - master @@ -37,64 +56,108 @@ frama-c-internal: - tags frama-c-distrib: + stage: distrib_and_compatibility script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c-distrib + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME frama-c-distrib tags: except: - tags -E-ACSL: + +Genassigns: + stage: frama_c_and_plugins + script: + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Genassigns + tags: + except: + - tags + +Mthread: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME E-ACSL + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Mthread tags: except: - tags -Genassigns: +a3export: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Genassigns + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME a3export tags: except: - tags - -Mthread: + +PathCrawler: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Mthread + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME PathCrawler tags: except: - tags +Security: + stage: frama_c_and_plugins + script: + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Security + tags: + except: + - tags + +E-ACSL: + stage: frama_c_and_plugins + script: + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME E-ACSL + tags: + except: + - tags + allow_failure: true + context-from-precondition: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME context-from-precondition + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME context-from-precondition tags: except: - tags -a3export: +open-source-case-studies: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME a3export + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --url open-source-case-studies,git@git.frama-c.com:frama-c/open-source-case-studies.git --commit open-source-case-studies,master open-source-case-studies tags: except: - tags + when: manual -PathCrawler: +ACSL-importer: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME PathCrawler + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME ACSL-importer tags: except: - tags -Security: +Caveat-importer: + stage: frama_c_and_plugins script: - - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --rootfs 1 --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Security + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Caveat-importer tags: except: - tags -Oci-Test: +Volatile: + stage: frama_c_and_plugins script: - - "echo \"Parameters: commit is $CI_BUILD_REF, branch is $CI_BUILD_REF_NAME\"" + - ~oci/oci/bin/bf_client.native run --socket ~oci/data/oci-data/oci.socket --frama-c $CI_BUILD_REF --branch $CI_BUILD_REF_NAME Volatile tags: except: - - tags \ No newline at end of file + - tags + + +#Oci-Test: +# script: +# - "echo \"Parameters: commit is $CI_BUILD_REF, branch is $CI_BUILD_REF_NAME\"" +# tags: +# except: +# - tags diff --git a/ALL_VERSIONS b/ALL_VERSIONS index a9ea55e97ca8ea0caa32a629a68eb01eaab48e61..53867f75a9183c639740c4a421f08609582e1951 100644 --- a/ALL_VERSIONS +++ b/ALL_VERSIONS @@ -1,5 +1,7 @@ Version number Date of release Notes ============== =============== ===== +Phosphorus-20170501 2017, May 29 + Silicon-20161101 2016, December 2 Aluminium-20160502 2016, May 31 diff --git a/Changelog b/Changelog index 16440e21b4d194bf0bc30e091a3ae018f4ec534a..af679c55b0e64337a6e77bf27f40ad0377de9b84 100644 --- a/Changelog +++ b/Changelog @@ -13,19 +13,171 @@ # '#?nnn' : OLD-BTS entry #nnn # ############################################################################### -###################################### +################################## Open Source Release <next-release> -###################################### +################################## + +-! Callgraph [2017/09/01] Option -cg-init-roots replaced by -cg-service-roots + (almost equivalent); new options -cg-function-pointers (ignore + function pointers; unsound) and -cg-roots (compute subgraphs). +o! Eva [2017/09/01] In abstract domains, compute_using_specification is + replaced by logic_assign, that interprets one \assigns clause. + Complete specification are now interpreted through successive + calls to evaluate_predicate, reduce_by_predicate and logic_assign. +- Eva [2017/09/01] Various precision improvements in the interpretation + of the behaviors of a specification. +-* Kernel [2017/08/31] Fixes configure script on bytecode only architecture. + Initial version of the patch by Debian. Fixes #2325 +-* Kernel [2017/08/31] Fix various typos in source code and user messages. + Patch by Debian. Fixes #2323 +-! Sparecode [2017/08/31] Rename option -rm-unused-globals to + -sparecode-rm-unused-globals. +o! ACSL [2017/08/24] Refactor handling of logic labels in AST +-! Eva [2017/08/03] Fix soundness (resp. precision) bug on big-endian + (resp. little-endian) architectures. This bug triggered on + low-level code, typically when using bitfields +-* Kernel [2017/08/03] Strip bitfield attribute when performing integral + promotions on bitfields of size short or char. Fixes incorrect + attributes on the resulting expression. +-! ACSL [2017/08/03] Explicitely disallow /* and */ in ACSL annotations. + Allows to re-use logic parser for parsing annotations in external + files that can use /* ... */ as comments. As a consequence, + expressions like y/*p are thus rejected, but this was already the + case when -pp-annot is activated (default for .c files) and can + be fixed easily in y / *p (as it is pretty-printed) +-* Kernel [2017/07/29] Fix unmarshalling of save files that contain more + than 4Gb of uncompressed data. Patch from TIS-interpreter. +-* Eva [2017/07/27] Fix performance issue with the equality domain. +-! Kernel [2017/08/28] Fix invalid eids on code generated through loop + unrolling +-! Slicing [2017/08/28] Fix invalid eids on code generated through option + -slicing-level >= 2 +-! Eva [2017/07/28] Fixed memory leak with option + -val-subdivide-non-linear +o! Slicing [2017/08/01] Removing Db API for Slicing plug-in. Calls to + !Db.Slicing should be replaced by calls to Slicing.Api. +-o! Slicing [2017/07/27] Removing deprecated '-slice-option' and related + !Db.Slicing.Projet.print_exported_project. Minor changes into + !Db.Slicing.Projet.extract. +o! Scope [2017/07/27] Removing Db API for Scope plug-in. Calls to + !Db.Scope should be replaced by calls to Scope. +o! Report [2017/07/24] Removing Db API for Report plug-in. Calls to + !Db.Report.print should be replaced by calls to + Report.Register.print. +- RTE [2017/07/17] Emits overflow alarms on unsigned left shift when + -warn-unsigned-overflow is enabled. +- Eva [2017/07/17] Emits overflow alarms on unsigned left shift when + -warn-unsigned-overflow is enabled. +- Kernel [2017/07/10] Composite types are now required to have equal tags + as per the C standard; no more support for isomorphic structs. +- Eva [2017/07/01] In the GUI, the "Values" panel displays the values + computed by using the properties inferred by all enabled domains. +-! Eva [2017/06/30] Better handling of function alloca(), via builtin + Frama_C_alloca. +-* Eva [2017/06/28] The cvalue states saved after each statement are now + properly deleted when an Eva parameter is changed in the GUI. +o Eva [2017/06/26] New functor in domains/simple_memory.ml to build a + complete domain from a value abstraction. The abstract states link + each scalar variable of a program to an abstract value. +- Eva [2017/06/26] New sign domain for demonstration purposes only. +-* Kernel [2017/06/09] Parser now handle mixed concatenation of + string and wstring. Fixes #@1467 +- Eva [2017/06/07] The subdivision of the evaluation of non-linear + expressions (through the -val-subdivide-non-linear option) also + applies to the new evaluations requested by the equality domain. +-* Eva [2017/06/14] Fix a crash when downcasting pointer values with + the option -val-warn-signed-converted-downcast enabled. +-* Eva [2017/06/14] Fix missing alarms when downcasting pointer values. +-o Eva [2017/05/24] The argument ~with_alarms for functions of Db.Value + is now optional, and will be removed in a later version. +* Eva [2017/05/24] Fix soundness bug in string builtins where some + invalid offsets did not generate alarms. +- Eva [2017/05/22] Removes all effects of the special functions + Frama_C_[dump|show]_each on the analyses: no alarms are emitted + and the states are never reduced on these calls. +- Eva [2017/05/22] Frama_C_dump_each prints the state of each available + domain whose log category is enabled. +- Eva [2017/05/22] New directive Frama_C_domain_show_each prints the + internal properties about the arguments inferred by each available + domain whose log category is enabled. +o! Eva [2017/05/22] Abstract domains have to provide a log category and + a function show_expr that prints the internal properties inferred + about an expression. +- RTE [2017/05/12] add -warn-not-finite-float for checking + that infinite and NaN floats are not produced. +-! Kernel [2017/05/17] qualifiers are dropped from the return type of + functions, as they make no real sense +-* Kernel [2017/04/27] stop removing const attribute on local variables. + Fixes #@301 +o! Kernel [2017/04/27] Remove needless repetition of declared logic labels + in Tapp and Papp nodes. Fixes #@274 +o! Kernel [2017/04/27] Completely separate types between Cil_types and + Logic_ptree, removing needless polymorphism +- Kernel [2017/05/18] Added option -print-return to inline gotos to return +- Eva [2017/04/06] More precise evaluation of \initialized and + \dangling predicates. + +####################################### +Open Source Release Phosphorus-20170501 +####################################### +-* Eva [2017/05/08] Fix widening in the gauges domain, in particular with + nested loops and pointers that change base address through + iterations +-* Eva [2017/04/25] Perform widening in the symbolic locations domain. +-* Eva [2017/04/24] Fixes a crash when backward-propagating an imprecise + value on a 32-bits floating point addition. A non-single precision + value was erroneously returned. +-* Eva [2017/04/05] Fixes a crash with the -val-subdivide-non-linear + option, on subdivisions of evaluations involving pointer values. +-! Eva [2017/03/31] Renamed dynamic allocation builtins for + improved consistency. In particular, Frama_C_alloc_size + becomes Frama_C_malloc_fresh. +- Eva [2017/03/31] New option -val-builtins-list +-* Scope [2017/03/31] Fix bug in the functions of Db.Scope in presence of + alarms refering to volatile memory locations, or to variables + that leave scope. Also impacts Eva option -remove-redundant-alarms +- Eva [2017/03/31] Activate option -remove-redundant-alarms by default. +- Inout [2017/03/28] Option -inout-callwise is now always active, and will + be removed in a later version +-* Inout [2017/03/28] Prevent formal variables of functions with only a + specification from leaking into results +- Kernel [2017/03/28] Dynlink is now mandatory, no degraded static mode. +o! Eva [2017/03/17] Incompatible API changes in module Cvalue.Model. + Functions named 'unspecified' have been renamed into + 'indeterminate', and some arguments have been removed. +o! Gui [2017/03/10] Signature change for constructor + Pretty_source.PVDecl +-! Kernel [2017/03/10] Explicit AST nodes to mark local variables + initialization. +-! Kernel [2017/03/10] Better handling of VLA (use explicit function calls + to mark deallocation of VLA at appropriate program points) +-* Callgraph [2017/03/10] Fixes inverted callers/callee in indirect calls +-! Eva [2017/03/09] Option -val-show-progress is now unset by default +-* Eva [2017/03/08] Fix bug #2277. The initial state of the analysis + now depends on all relevant options, including kernel options + -warn-... +-! Variadic [2017/03/08] Change of command line argument names for the + plugin Variadic. The new names are more expressive and avoid + confusions with the plugin Value. Use -variadic-translation or + -variadic-no-translation instead of -va or -no-va. +-! Value [2017/03/07] Support for the legacy value analysis has been + abandoned, Eva is now always active. Option -no-eva has been + removed. +-* Eva [2017/03/07] Unsound support for recursion, through option + -val-ignore-recursive-calls. The support of recursion through + the use of 'assigns' clauses, previously available in Value, + was unsound and has been removed -! Kernel [2017/03/01] Zarith library is now required -* Kernel [2017/02/24] Fix crash when loading a saved file without a plug-in which has previously emitted a status with a tuning parameter. - Eva [2017/02/06] New (internal) mechanism to handle C functions' return values. Messages now mention \result<foo> for the value returned by 'foo'. -- Variadic [2017/02/08] The plugin is now enabled by default. Use -no-va - to keep the original behaviour. The specification generated for - the fprintf function family is now more accurate. +- Variadic [2017/02/08] The plugin is now enabled by default. Use the + option -variadic-no-translation to keep the original behaviour. + The specification generated for the fprintf function family is + now more accurate. - Kernel [2017/01/26] New option -print-libc, to expand include directives for files in the Frama-C stdlib (no longer expanded by default). -* Obfuscator [2017/01/19] Fix typo in help message (bts #2269). @@ -43,6 +195,7 @@ Open Source Release <next-release> -* Kernel [2016/11/17] Fixed some issues with #pragma pack() behavior, in both GCC and MSVC machdeps. Also fixed some related issues with __aligned__ and __packed__ attributes (including bts #2249). +-o Kernel [2016/11/17] Utility API for checking volatile attribute in Cil. - Metrics [2016/11/17] Programmatic API for some functions via Metrics.mli. - Kernel [2016/11/07] New option -no-autoload-plugins (equivalent to old -no-dynlink); mostly for internal use. diff --git a/INSTALL.md b/INSTALL.md index 58d7298a16f9d6ab926de0ffbcf005fcf53f4b29..3cf974bfc7d100af9c8613c2bb64ae62ec0102d9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -63,32 +63,38 @@ external provers for WP, such as `why3` and `coq`. To install `frama-c`, you may need to install Gtk, GtkSourceView and GnomeCanvas separately. These are C libraries with OCaml bindings used by the GUI. -To get the exact list of packages that are needed, use: +On many systems, OPAM can take care of these external dependencies through +its `depext` plug-in: issuing the two commands opam install depext opam depext frama-c -and install the packages listed as missing. +will install the appropriate system packages (this of course requires +to have administrator rights on the system). ### Installing Custom Versions of Frama-C via OPAM If you have a **non-standard** version of Frama-C available (with proprietary extensions, custom plugins, etc.), -you can install it through OPAM using these commands: +you can use OPAM to install Frama-C's dependencies and compile your +own sources directly: - # remove the previous version of frama-c + # optional: remove the standard frama-c package if it was installed opam remove --force frama-c frama-c-base - # optional packages, but recommended (for efficiency, and for the GUI) + # install Frama-C's dependencies opam install depext - opam depext zarith lablgtk conf-gtksourceview conf-gnomecanvas - opam install zarith lablgtk conf-gtksourceview conf-gnomecanvas + opam depext frama-c + opam install --deps-only frama-c # install custom version of frama-c opam pin add frama-c-base <dir> where `<dir>` is the root of your unpacked Frama-C archive. +If your extensions require other libraries than the ones already used +by Frama-C, they must of course be installed as well. + ### Installing Frama-C on Windows (via Cygwin + OPAM) Windows is not officially supported by the Frama-C team @@ -105,8 +111,6 @@ Frama-C wiki: https://bts.frama-c.com/dokuwiki/doku.php?id=mantis:frama-c:compiling_from_source -(*Note: Your browser may complain about the self-signed certificate.*) - Frama-C Windows releases are periodically made available on the non-official OPAM MinGW repository: @@ -197,7 +201,7 @@ If you are using Fedora >= 13 then a Frama-C package is provided: 6. Optionally, test your installation by running: frama-c -val tests/misc/CruiseControl*.c - frama-c-gui -val tests/misc/CruiseControl*.c (if frama-c-gui is available) + frama-c-gui -val tests/misc/CruiseControl*.c # if frama-c-gui is available ### Full Compilation Guide @@ -327,7 +331,7 @@ available: - `frama-c-config` displays Frama-C configuration paths - `frama-c.byte` bytecode version of frama-c - `frama-c-gui.byte` bytecode version of frama-c-gui, if available -- `ptests.opt` testing tools for Frama-c +- `ptests.opt` testing tool for Frama-c - `frama-c.toplevel` if 'make top' previously done ### Shared files: (in `/INSTALL_DIR/share/frama-c` and subdirectories) diff --git a/Makefile b/Makefile index ee8e8384ba4f5f7a09b9cbe406fe58f280a838c9..f8a432af7d15d4618480292cd1c889c0233fd889 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -58,8 +58,6 @@ FRAMAC_SHARE = share # for a correct behavior of += (see section 6.6 of GNU Make manual) PLUGIN_LIST := PLUGIN_GENERATED_LIST:= -PLUGIN_DYN_EXISTS:="no" -PLUGIN_DYN_LIST := PLUGIN_CMO_LIST := PLUGIN_CMX_LIST := PLUGIN_META_LIST := @@ -173,8 +171,7 @@ LIBC_DIR:= $(ROOT_LIBC_DIR) $(addprefix $(ROOT_LIBC_DIR)/,$(LIBC_SUBDIRS)) LIBC_FILES:= \ $(wildcard share/*.h share/*.c) \ $(wildcard $(addsuffix /*.h,$(LIBC_DIR))) \ - $(wildcard $(addsuffix /*.c,$(LIBC_DIR))) \ - $(ROOT_LIBC_DIR)/__fc_builtin_for_normalization.i + $(wildcard $(addsuffix /*.c,$(LIBC_DIR))) # Checks that all .h can be included multiple times. ALL_LIBC_HEADERS:=$(wildcard share/*.h $(addsuffix /*.h,$(LIBC_DIR))) @@ -212,9 +209,9 @@ clean-check-libc: # itself, rather than copied: otherwise, it could include references to # non-distributed plug-ins. DISTRIB_FILES:=\ - $(wildcard bin/*2*.sh) bin/local_export.sh \ + $(wildcard bin/migration_scripts/*2*.sh) bin/local_export.sh \ bin/frama-c bin/frama-c.byte bin/frama-c-gui bin/frama-c-gui.byte \ - share/frama-c.WIN32.rc share/frama-c.Unix.rc \ + bin/frama-c-config share/frama-c.WIN32.rc share/frama-c.Unix.rc \ $(ICONS) $(FEEDBACK_ICONS_DEFAULT) $(FEEDBACK_ICONS_COLORBLIND) \ man/frama-c.1 doc/README \ doc/code/docgen.ml \ @@ -230,7 +227,12 @@ DISTRIB_FILES:=\ Changelog config.h.in \ VERSION $(wildcard licenses/*) \ $(LIBC_FILES) \ + share/analysis-scripts/cmd-dep.sh \ + share/analysis-scripts/frama-c.mk \ + share/analysis-scripts/parse-coverage.sh \ + share/analysis-scripts/README.md \ $(wildcard share/emacs/*.el) share/autocomplete_frama-c \ + share/_frama-c \ share/configure.ac \ share/Makefile.config.in share/Makefile.common \ share/Makefile.generic \ @@ -241,8 +243,7 @@ DISTRIB_FILES:=\ $(wildcard src/kernel_internals/runtime/*.ml*)) \ $(wildcard src/kernel_services/abstract_interp/*.ml*) \ $(wildcard src/plugins/gui/*.ml*) \ - $(filter-out src/libraries/stdlib/FCDynlink.ml, \ - $(wildcard src/libraries/stdlib/*.ml*)) \ + $(wildcard src/libraries/stdlib/*.ml*) \ $(wildcard src/libraries/utils/*.ml*) \ $(wildcard src/libraries/utils/*.c) \ $(wildcard src/libraries/project/*.ml*) \ @@ -281,7 +282,7 @@ DOC_GEN_FILES:=$(addprefix doc/code/,\ # additional compilation targets for 'make all'. # cannot be delayed after 'make all' -EXTRAS = ptests bin/frama-c-config$(EXE) +EXTRAS = ptests bin/fc-config$(EXE) ifneq ($(ENABLE_GUI),no) ifeq ($(HAS_LABLGTK),yes) @@ -361,60 +362,6 @@ endif # Frama-C Kernel # ################## -# Dynlink library -################# - -GENERATED += src/libraries/stdlib/FCDynlink.ml - -ifeq ($(USABLE_NATIVE_DYNLINK),yes) # native dynlink works - -src/libraries/stdlib/FCDynlink.ml: \ - src/libraries/stdlib/dynlink_native_ok.ml share/Makefile.config - $(CP_IF_DIFF) $< $@ - $(CHMOD_RO) $@ - -else # native dynlink doesn't work - -ifeq ($(NATIVE_DYNLINK),yes) # native dynlink does exist but doesn't work -src/libraries/stdlib/lib/FCDynlink.ml: \ - src/libraries/stdlib/dynlink_native_ko.ml share/Makefile.config - $(CP_IF_DIFF) $< $@ - $(CHMOD_RO) $@ - -else # no dynlink at all (for instance no native compiler) - -# Just for ocamldep -src/libraries/stdlib/FCDynlink.ml: \ - src/libraries/stdlib/dynlink_native_ok.ml share/Makefile.config - $(CP_IF_DIFF) $< $@ - $(CHMOD_RO) $@ - -# Add two different rules for bytecode and native since -# the file FCDynlink.ml is not built from the same file in these cases. - -src/libraries/stdlib/FCDynlink.cmo: \ - src/libraries/stdlib/dynlink_native_ok.ml share/Makefile.config - $(CP_IF_DIFF) $< src/libraries/stdlib/FCDynlink.ml - $(CHMOD_RO) src/libraries/stdlib/FCDynlink.ml - $(PRINT_OCAMLC) $@ - $(OCAMLC) -c $(BFLAGS) src/libraries/stdlib/FCDynlink.ml - -src/libraries/stdlib/FCDynlink.cmx: \ - src/libraries/stdlib/dynlink_no_native.ml share/Makefile.config - $(CP_IF_DIFF) $< src/libraries/stdlib/FCDynlink.ml - $(CHMOD_RO) src/libraries/stdlib/FCDynlink.ml - $(PRINT_OCAMLOPT) $@ - $(OCAMLOPT) -c $(OFLAGS) src/libraries/stdlib/FCDynlink.ml - -# force dependency order between these two files in order to not generate them -# in parallel since each of them generates the same .ml file -src/libraries/stdlib/FCDynlink.cmx: src/libraries/stdlib/FCDynlink.cmo -src/libraries/stdlib/FCDynlink.o: src/libraries/stdlib/FCDynlink.cmx - -endif -endif - - # Libraries which could be compiled fully independently ####################################################### @@ -423,7 +370,6 @@ CMO += $(VERY_FIRST_CMO) LIB_CMO =\ src/libraries/stdlib/transitioning \ - src/libraries/stdlib/FCDynlink \ src/libraries/stdlib/FCSet \ src/libraries/stdlib/FCMap \ src/libraries/stdlib/FCBuffer \ @@ -531,6 +477,9 @@ KERNEL_CMO=\ src/kernel_services/ast_queries/ast_info.cmo \ src/kernel_services/ast_data/ast.cmo \ src/kernel_services/ast_data/globals.cmo \ + src/kernel_services/ast_printing/cprint.cmo \ + src/kernel_services/visitors/cabsvisit.cmo \ + src/kernel_internals/typing/cabs2cil.cmo \ src/kernel_internals/typing/cfg.cmo \ src/kernel_services/ast_data/kernel_function.cmo \ src/kernel_services/ast_data/property.cmo \ @@ -539,15 +488,12 @@ KERNEL_CMO=\ src/kernel_services/ast_printing/printer.cmo \ src/kernel_internals/typing/logic_builtin.cmo \ src/kernel_services/ast_printing/cabs_debug.cmo \ - src/kernel_services/ast_printing/cprint.cmo \ src/kernel_internals/parsing/lexerhack.cmo \ src/kernel_internals/parsing/clexer.cmo \ - src/kernel_services/visitors/cabsvisit.cmo \ src/kernel_internals/parsing/cparser.cmo \ src/kernel_internals/parsing/logic_preprocess.cmo \ src/kernel_internals/typing/mergecil.cmo \ src/kernel_internals/typing/rmtmps.cmo \ - src/kernel_internals/typing/cabs2cil.cmo \ src/kernel_internals/typing/oneret.cmo \ src/kernel_internals/typing/frontc.cmo \ src/kernel_services/ast_data/statuses_by_call.cmo \ @@ -559,6 +505,7 @@ KERNEL_CMO=\ src/kernel_services/analysis/stmts_graph.cmo \ src/kernel_services/analysis/dominators.cmo \ src/kernel_services/analysis/service_graph.cmo \ + src/kernel_services/analysis/undefined_sequence.cmo \ src/kernel_services/ast_printing/description.cmo \ src/kernel_services/ast_data/alarms.cmo \ src/kernel_services/abstract_interp/lattice_messages.cmo \ @@ -570,8 +517,7 @@ KERNEL_CMO=\ src/kernel_services/abstract_interp/ival.cmo \ src/kernel_services/abstract_interp/base.cmo \ src/kernel_services/abstract_interp/origin.cmo \ - src/kernel_services/abstract_interp/map_Lattice.cmo \ - src/kernel_services/abstract_interp/trace.cmo \ + src/kernel_services/abstract_interp/map_lattice.cmo \ src/kernel_services/abstract_interp/tr_offset.cmo \ src/kernel_services/abstract_interp/offsetmap.cmo \ src/kernel_services/abstract_interp/int_Intervals.cmo \ @@ -591,6 +537,7 @@ KERNEL_CMO=\ src/kernel_internals/typing/asm_contracts.cmo \ src/kernel_services/analysis/loop.cmo \ src/kernel_services/analysis/exn_flow.cmo \ + src/kernel_services/analysis/destructors.cmo \ src/kernel_services/analysis/logic_interp.cmo \ src/kernel_internals/typing/infer_annotations.cmo \ src/kernel_services/ast_transformations/clone.cmo \ @@ -613,8 +560,7 @@ MLI_ONLY+=\ src/kernel_services/abstract_interp/lmap_sig.mli \ src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli -NO_MLI+= src/kernel_services/abstract_interp/map_Lattice.mli \ - src/kernel_services/parsetree/cabs.mli \ +NO_MLI+= src/kernel_services/parsetree/cabs.mli \ src/kernel_internals/runtime/machdep_ppc_32.mli \ src/kernel_internals/runtime/machdep_x86_16.mli \ src/kernel_internals/runtime/machdep_x86_32.mli \ @@ -701,7 +647,6 @@ SINGLE_GUI_CMO:= $(patsubst %,src/plugins/gui/%.cmo,$(SINGLE_GUI_CMO)) ########### PLUGIN_ENABLE:=$(ENABLE_METRICS) -PLUGIN_DYNAMIC:=$(DYNAMIC_METRICS) PLUGIN_NAME:=Metrics PLUGIN_DISTRIBUTED:=yes PLUGIN_DIR:=src/plugins/metrics @@ -718,11 +663,10 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ############# PLUGIN_ENABLE:=$(ENABLE_CALLGRAPH) -PLUGIN_DYNAMIC:=$(DYNAMIC_CALLGRAPH) PLUGIN_NAME:=Callgraph PLUGIN_DISTRIBUTED:=yes PLUGIN_DIR:=src/plugins/callgraph -PLUGIN_CMO:= options journalize cg services uses register +PLUGIN_CMO:= options journalize subgraph cg services uses register PLUGIN_GUI_CMO:=cg_viewer PLUGIN_CMI:= callgraph_api PLUGIN_INTERNAL_TEST:=yes @@ -735,7 +679,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################## PLUGIN_ENABLE:=$(ENABLE_VALUE_ANALYSIS) -PLUGIN_DYNAMIC:=$(DYNAMIC_VALUE_ANALYSIS) PLUGIN_NAME:=Value PLUGIN_DIR:=src/plugins/value PLUGIN_EXTRA_DIRS:=engine values domains domains/cvalue domains/apron \ @@ -743,50 +686,49 @@ PLUGIN_EXTRA_DIRS:=engine values domains domains/cvalue domains/apron \ # General rules for ordering files within PLUGIN_CMO: # - try to keep the legacy Value before Eva PLUGIN_CMO:= slevel/split_strategy value_parameters \ - slevel/stop_at_nth \ - utils/value_perf legacy/state_set utils/value_util legacy/value_messages \ - utils/mark_noresults slevel/separate \ - legacy/state_imp utils/widen_hints_ext \ - legacy/valarms legacy/warn utils/eval_typ utils/backward_formals \ - legacy/eval_op \ - domains/cvalue/locals_scoping \ - domains/cvalue/builtins \ - domains/cvalue/builtins_malloc \ + utils/value_perf utils/value_util \ + utils/mark_noresults \ + utils/widen_hints_ext utils/widen \ + engine/split_return \ + slevel/per_stmt_slevel \ utils/library_functions \ - domains/cvalue/builtins_string \ - legacy/eval_terms legacy/eval_annots \ - legacy/eval_behaviors legacy/mem_exec \ - legacy/eval_exprs utils/widen \ - legacy/eval_non_linear legacy/initial_state \ - domains/cvalue/builtins_misc \ - utils/value_results \ - $(sort $(patsubst src/plugins/value/%.ml,%,\ - $(wildcard src/plugins/value/domains/cvalue/builtins_nonfree*.ml))) \ - utils/state_import \ - legacy/function_args legacy/split_return legacy/eval_stmt \ - slevel/per_stmt_slevel legacy/eval_slevel legacy/eval_funs \ + utils/eval_typ utils/backward_formals \ alarmset eval utils/structure \ - domains/powerset engine/transfer_logic \ values/value_product values/location_lift \ values/cvalue_forward values/cvalue_backward \ - values/main_values values/main_locations values/offsm_value \ + values/main_values values/main_locations \ + values/offsm_value values/sign_value \ + legacy/eval_op legacy/function_args \ domains/domain_store domains/domain_builder \ domains/domain_product domains/domain_lift domains/unit_domain \ + domains/simple_memory \ domains/gauges/gauges_domain \ domains/apron/apron_domain \ domains/hcexprs \ domains/equality/equality domains/equality/equality_domain \ domains/offsm_domain \ - domains/symbolic_locs\ + domains/symbolic_locs \ + domains/sign_domain \ + domains/cvalue/warn domains/cvalue/locals_scoping \ + domains/cvalue/builtins domains/cvalue/builtins_malloc \ + domains/cvalue/builtins_string domains/cvalue/builtins_misc \ + $(sort $(patsubst src/plugins/value/%.ml,%,\ + $(wildcard src/plugins/value/domains/cvalue/builtins_nonfree*.ml))) \ + domains/cvalue/builtins_float \ + domains/inout_domain \ + utils/value_results utils/state_import \ + legacy/eval_terms legacy/eval_annots \ + domains/powerset engine/transfer_logic \ domains/cvalue/cvalue_transfer domains/cvalue/cvalue_init \ domains/cvalue/cvalue_specification \ - domains/cvalue/cvalue_domain domains/cvalue/builtins_float \ - engine/evaluation engine/non_linear_evaluation engine/transfer_stmt \ - engine/partitioning engine/mem_exec2 engine/partitioned_dataflow \ + domains/cvalue/cvalue_domain \ + engine/subdivided_evaluation engine/evaluation \ + engine/recursion engine/transfer_stmt engine/transfer_specification \ + engine/partitioning engine/mem_exec engine/partitioned_dataflow \ engine/initialization engine/abstractions \ engine/compute_functions engine/analysis register -PLUGIN_CMI:= values/abstract_value values/abstract_location domains/abstract_domain \ - domains/equality/equality_sig +PLUGIN_CMI:= values/abstract_value values/abstract_location \ + domains/abstract_domain domains/simpler_domains domains/equality/equality_sig PLUGIN_DEPENDENCIES:=Callgraph LoopAnalysis RteGen ifeq ($(HAS_APRON),yes) @@ -806,7 +748,8 @@ GENERATED += src/plugins/value/domains/apron/apron_domain.ml PLUGIN_DISTRIB_EXTERNAL:=domains/apron/apron_domain.ok.ml domains/apron/apron_domain.ko.ml # These files are used by the GUI, but do not depend on Lablgtk -VALUE_GUI_AUX:=gui_files/gui_types gui_files/gui_eval gui_files/gui_callstacks_filters +VALUE_GUI_AUX:=gui_files/gui_types gui_files/gui_eval \ + gui_files/gui_callstacks_filters gui_files/gui_callstacks_manager PLUGIN_GUI_CMO:=$(VALUE_GUI_AUX) gui_files/register_gui PLUGIN_NO_TEST:=yes PLUGIN_DISTRIBUTED:=yes @@ -822,7 +765,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################## PLUGIN_ENABLE:=$(ENABLE_OCCURRENCE) -PLUGIN_DYNAMIC:=$(DYNAMIC_OCCURRENCE) PLUGIN_NAME:=Occurrence PLUGIN_DISTRIBUTED:=yes PLUGIN_DIR:=src/plugins/occurrence @@ -838,7 +780,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################################################ PLUGIN_ENABLE:=$(ENABLE_RTEGEN) -PLUGIN_DYNAMIC:=$(DYNAMIC_RTEGEN) PLUGIN_NAME:=RteGen PLUGIN_DIR:=src/plugins/rte PLUGIN_CMO:= options generator rte visit register @@ -852,7 +793,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################# PLUGIN_ENABLE:=$(ENABLE_FROM_ANALYSIS) -PLUGIN_DYNAMIC:=$(DYNAMIC_FROM_ANALYSIS) PLUGIN_NAME:=From PLUGIN_DIR:=src/plugins/from PLUGIN_CMO:= from_parameters from_compute \ @@ -873,7 +813,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################## PLUGIN_ENABLE:=$(ENABLE_USERS) -PLUGIN_DYNAMIC:=$(DYNAMIC_USERS) PLUGIN_NAME:=Users PLUGIN_DIR:=src/plugins/users PLUGIN_CMO:= users_register @@ -889,7 +828,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ######################## PLUGIN_ENABLE:=$(ENABLE_CONSTANT_PROPAGATION) -PLUGIN_DYNAMIC:=$(DYNAMIC_CONSTANT_PROPAGATION) PLUGIN_NAME:=Constant_Propagation PLUGIN_DIR:=src/plugins/constant_propagation PLUGIN_CMO:= propagationParameters \ @@ -905,7 +843,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################### PLUGIN_ENABLE:=$(ENABLE_POSTDOMINATORS) -PLUGIN_DYNAMIC:=$(DYNAMIC_POSTDOMINATORS) PLUGIN_NAME:=Postdominators PLUGIN_DIR:=src/plugins/postdominators PLUGIN_CMO:= postdominators_parameters print compute @@ -919,7 +856,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ######### PLUGIN_ENABLE:=$(ENABLE_INOUT) -PLUGIN_DYNAMIC:=$(DYNAMIC_INOUT) PLUGIN_NAME:=Inout PLUGIN_DIR:=src/plugins/inout PLUGIN_CMO:= inout_parameters cumulative_analysis \ @@ -930,7 +866,7 @@ PLUGIN_INTERNAL_TEST:=yes INOUT_TYPES:=src/plugins/value_types/inout_type PLUGIN_TYPES_CMO:=$(INOUT_TYPES) PLUGIN_TYPES_TODOC:=$(addsuffix .mli,$(INOUT_TYPES)) -PLUGIN_DEPENDENCIES:=Callgraph Value +PLUGIN_DEPENDENCIES:=Callgraph Value From $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) @@ -939,7 +875,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################### PLUGIN_ENABLE:=$(ENABLE_IMPACT) -PLUGIN_DYNAMIC:=$(DYNAMIC_IMPACT) PLUGIN_NAME:=Impact PLUGIN_DIR:=src/plugins/impact PLUGIN_CMO:= options pdg_aux reason_graph compute_impact register @@ -947,7 +882,7 @@ PLUGIN_GUI_CMO:= register_gui PLUGIN_DISTRIBUTED:=yes # PLUGIN_UNDOC:=impact_gui.ml PLUGIN_INTERNAL_TEST:=yes -PLUGIN_DEPENDENCIES:=Inout Value Pdg +PLUGIN_DEPENDENCIES:=Inout Value Pdg Slicing $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) @@ -956,7 +891,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################################## PLUGIN_ENABLE:=$(ENABLE_PDG) -PLUGIN_DYNAMIC:=$(DYNAMIC_PDG) PLUGIN_NAME:=Pdg PLUGIN_DIR:=src/plugins/pdg PLUGIN_CMO:= pdg_parameters \ @@ -985,12 +919,11 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ################################################ PLUGIN_ENABLE:=$(ENABLE_SCOPE) -PLUGIN_DYNAMIC:=$(DYNAMIC_SCOPE) PLUGIN_NAME:=Scope PLUGIN_DIR:=src/plugins/scope PLUGIN_CMO:= datascope zones defs PLUGIN_GUI_CMO:=dpds_gui -PLUGIN_DEPENDENCIES:=Value +PLUGIN_DEPENDENCIES:=Value Inout PLUGIN_INTRO:=doc/code/intro_scope.txt PLUGIN_DISTRIBUTED:=yes PLUGIN_INTERNAL_TEST:=yes @@ -1001,7 +934,6 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ##################################### PLUGIN_ENABLE:=$(ENABLE_SPARECODE) -PLUGIN_DYNAMIC:=$(DYNAMIC_SPARECODE) PLUGIN_NAME:=Sparecode PLUGIN_DIR:=src/plugins/sparecode PLUGIN_CMO:= sparecode_params globs spare_marks transform register @@ -1017,10 +949,10 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) ########### PLUGIN_ENABLE:=$(ENABLE_SLICING) -PLUGIN_DYNAMIC:=$(DYNAMIC_SLICING) PLUGIN_NAME:=Slicing PLUGIN_DIR:=src/plugins/slicing PLUGIN_CMO:= slicingParameters \ + slicingState \ slicingMacros \ slicingMarks \ slicingActions \ @@ -1028,8 +960,11 @@ PLUGIN_CMO:= slicingParameters \ printSlice \ slicingProject \ slicingTransform \ + slicingSelect \ slicingCmds \ + api \ register + SLICING_TYPES:=slicingInternals slicingTypes SLICING_TYPES:=$(addprefix src/plugins/slicing_types/,$(SLICING_TYPES)) PLUGIN_TYPES_CMO:=$(SLICING_TYPES) @@ -1101,9 +1036,6 @@ MODULES_TODOC+=$(filter-out $(MODULES_NODOC),\ ALL_BATCH_CMO= $(filter-out src/kernel_internals/runtime/gui_init.cmo,\ $(ALL_CMO)) -# ALL_BATCH_CMX is not a translation of ALL_BATCH_CMO with cmo -> cmx -# in case native dynlink is not available: dynamic plugin are linked -# dynamically in bytecode and statically in native code... ALL_BATCH_CMX= $(filter-out src/kernel_internals/runtime/gui_init.cmx,\ $(ALL_CMX)) @@ -1162,7 +1094,6 @@ $(PLUGIN_DYN_DEP_GUI_CMX_LIST): OFLAGS+= $(GUI_INCLUDES) gui:: bin/viewer.byte$(EXE) \ share/Makefile.dynamic_config \ - share/Makefile.kernel \ $(PLUGIN_META_LIST) ifeq ($(OCAMLBEST),opt) @@ -1227,11 +1158,6 @@ else OPTDOT=None endif -STATIC_PLUGINS=$(foreach p,$(PLUGIN_LIST),\"$(notdir $p)\"; ) - -STATIC_GUI_PLUGINS=\ - $(foreach p,$(CONFIG_PLUGIN_CMO),\"$(notdir $(patsubst %.cmo,%,$p))\"; ) - COMPILATION_UNITS=\ $(foreach p,$(CONFIG_CMO),\"$(notdir $(patsubst %.cmo,%,$p))\"; ) @@ -1298,7 +1224,7 @@ acsl_tests: byte find doc/speclang -name \*.c -exec ./bin/toplevel.byte$(EXE) {} \; > /dev/null # Non-plugin test directories containing some ML files to compile -TEST_DIRS_AS_PLUGIN=dynamic dynamic_plugin journal saveload spec misc syntax pretty_printing non-free libc value +TEST_DIRS_AS_PLUGIN=dynamic dynamic_plugin journal saveload spec misc syntax pretty_printing non-free libc value callgraph PLUGIN_TESTS_LIST += $(TEST_DIRS_AS_PLUGIN) LONELY_TESTS_ML_FILES=$(wildcard $(TEST_DIRS_AS_PLUGIN:%=tests/%/*.ml)) @@ -1498,20 +1424,16 @@ $(CHECK_API_DIR)/check_code.cmxs: $(CHECK_API_DIR)/check_code.ml $(OCAMLOPT) -o $@ -shared -I +ocamldoc \ str.cmxa $(CHECK_API_DIR)/check_code.ml -ifeq ("$(OCAMLDOC)","ocamldoc.opt") CHECK_CODE=$(CHECK_API_DIR)/check_code.cmxs -else -CHECK_CODE=$(CHECK_API_DIR)/check_code.cmo -endif .PHONY: check-devguide check-devguide: $(CHECK_CODE) $(DOC_DEPEND) $(DOC_DIR)/kernel-doc.ocamldoc $(PRINT) 'Checking developer guide consistency' $(MKDIR) $(CHECK_API_DIR)/html $(OCAMLDOC) $(DOC_FLAGS) -I $(OCAMLLIB) \ - -docdevpath `pwd`/$(CHECK_API_DIR) \ - -load $(DOC_DIR)/kernel-doc.ocamldoc \ -g $(CHECK_CODE) \ + -passopt -docdevpath -passopt "`pwd`/$(CHECK_API_DIR)" \ + -load $(DOC_DIR)/kernel-doc.ocamldoc \ -d $(CHECK_API_DIR)/html $(RM) -r $(CHECK_API_DIR)/html $(MAKE) --silent -C $(CHECK_API_DIR) main.idx @@ -1593,10 +1515,16 @@ install:: install-lib $(PRINT_INSTALL) shared files $(CP) \ $(wildcard share/*.c share/*.h) \ - share/Makefile.dynamic share/Makefile.plugin.template share/Makefile.kernel \ + share/Makefile.dynamic share/Makefile.plugin.template \ share/Makefile.config share/Makefile.common share/Makefile.generic \ - share/configure.ac share/autocomplete_frama-c \ + share/configure.ac share/autocomplete_frama-c share/_frama-c \ $(FRAMAC_DATADIR) + $(MKDIR) $(FRAMAC_DATADIR)/analysis-scripts + $(CP) share/analysis-scripts/cmd-dep.sh \ + share/analysis-scripts/frama-c.mk \ + share/analysis-scripts/parse-coverage.sh \ + share/analysis-scripts/README.md \ + $(FRAMAC_DATADIR)/analysis-scripts $(MKDIR) $(FRAMAC_DATADIR)/emacs $(CP) $(wildcard share/emacs/*.el) $(FRAMAC_DATADIR)/emacs $(CP) share/frama-c.rc $(ICONS) $(FRAMAC_DATADIR) @@ -1629,22 +1557,22 @@ install:: install-lib fi $(CP) bin/ptests.$(PTESTSBEST)$(EXE) \ $(BINDIR)/ptests.$(PTESTSBEST)$(EXE) - if [ -x bin/frama-c-config$(EXE) ] ; then \ - $(CP) bin/frama-c-config$(EXE) $(BINDIR); \ + if [ -x bin/fc-config$(EXE) ] ; then \ + $(CP) bin/fc-config$(EXE) $(BINDIR)/frama-c-config; \ fi $(PRINT_INSTALL) config files $(CP) $(addprefix ptests/,$(PTESTS_FILES)) $(FRAMAC_LIBDIR) $(PRINT_INSTALL) API documentation $(MKDIR) $(FRAMAC_DATADIR)/doc/code $(CP) $(wildcard $(DOC_GEN_FILES)) $(FRAMAC_DATADIR)/doc/code - $(PRINT_INSTALL) dynamic plug-ins - if [ -d "$(FRAMAC_PLUGIN)" -a "$(PLUGIN_DYN_EXISTS)" = "yes" ]; then \ + $(PRINT_INSTALL) plug-ins + if [ -d "$(FRAMAC_PLUGIN)" ]; then \ $(CP) $(PLUGIN_DYN_CMI_LIST) $(PLUGIN_META_LIST) \ $(FRAMAC_PLUGINDIR); \ $(CP) $(PLUGIN_DYN_CMO_LIST) $(PLUGIN_DYN_CMX_LIST) \ $(FRAMAC_PLUGINDIR)/top; \ fi - $(PRINT_INSTALL) dynamic gui plug-ins + $(PRINT_INSTALL) gui plug-ins if [ -d "$(FRAMAC_PLUGIN_GUI)" -a "$(PLUGIN_DYN_GUI_EXISTS)" = "yes" ]; \ then \ $(CP) $(patsubst %.cma,%.cmi,$(PLUGIN_DYN_GUI_CMO_LIST:.cmo=.cmi)) \ @@ -1718,6 +1646,7 @@ CURRENT_HEADERS?=open-source # inside HEADER_SPEC_FILE # 3. Checks that all these files are not under DISTRIB_PROPRIETARY_HEADERS # licences +# 4. Check that distributed files are not encoded in ISO-8859 .PHONY: check-headers check-headers: $(HDRCK) $(PRINT) "Checking $(DISTRIB_HEADERS) headers (OPEN_SOURCE=$(OPEN_SOURCE), CURRENT_HEADERS=$(CURRENT_HEADERS))..." @@ -1725,7 +1654,7 @@ check-headers: $(HDRCK) # using 'file' built-in, only available on make 4.0+ # for make 4.0+, using the 'file' function could be a better solution, # although it seems to segfault in 4.0 (but not in 4.1) - $(RM) file_list_to_check.tmp + $(RM) file_list_to_check.tmp file_list_exceptions.tmp @$(foreach file,$(DISTRIB_FILES),\ echo $(file) >> file_list_to_check.tmp$(NEWLINE)) @$(foreach file,$(HEADER_EXCEPTIONS),\ @@ -1737,7 +1666,14 @@ check-headers: $(HDRCK) -distrib-file file_list_to_check.tmp \ -header-except-file file_list_exceptions.tmp \ $(HEADER_SPEC_FILE) - $(RM) file_list_to_check.tmp + @if command -v file >/dev/null 2>/dev/null; then \ + echo "Checking that distributed files do not use iso-8859..."; \ + file --mime-encoding -f file_list_to_check.tmp | \ + grep "iso-8859" \ + | $(SED) "s/^/error: invalid encoding in /" || true; \ + else echo "command 'file' not found, skipping encoding checks"; \ + fi + $(RM) file_list_to_check.tmp file_list_exceptions.tmp ######################################################################## # Makefile is rebuilt whenever Makefile.in or configure.in is modified # @@ -1817,7 +1753,7 @@ clean-gui:: $(RM) src/*/*/*_gui.cm* src/*/*/*_gui.o \ src/plugins/gui/*.cm* src/plugins/gui/*.o -clean:: $(PLUGIN_LIST:=_CLEAN) $(PLUGIN_DYN_LIST:=_CLEAN) \ +clean:: $(PLUGIN_LIST:=_CLEAN) \ clean-tests clean-journal clean-check-libc $(PRINT_RM) lib/plugins $(RM) $(addprefix $(PLUGIN_LIB_DIR)/,*.mli *.cm* *.o META.*) @@ -1835,7 +1771,7 @@ clean:: $(PLUGIN_LIST:=_CLEAN) $(PLUGIN_DYN_LIST:=_CLEAN) \ $(PRINT_RM) binaries $(RM) bin/toplevel.byte$(EXE) bin/viewer.byte$(EXE) \ bin/ptests.byte$(EXE) bin/*.opt$(EXE) bin/toplevel.top$(EXE) - $(RM) bin/frama-c-config$(EXE) + $(RM) bin/fc-config$(EXE) smartclean: $(MAKE) -f share/Makefile.clean smartclean @@ -1844,8 +1780,7 @@ smartclean: # as the very last step performed by make (who'll otherwise try to regenerate # it in the middle of cleaning) dist-clean distclean: clean clean-doc \ - $(PLUGIN_LIST:=_DIST_CLEAN) \ - $(PLUGIN_DYN_LIST:=_DIST_CLEAN) + $(PLUGIN_LIST:=_DIST_CLEAN) $(PRINT_RM) config $(RM) share/Makefile.config $(RM) config.cache config.log config.h @@ -1876,12 +1811,11 @@ GENERATED+=share/frama-c.rc # Depend # ########## -PLUGIN_DEP_LIST:=$(PLUGIN_LIST) $(PLUGIN_DYN_LIST) +PLUGIN_DEP_LIST:=$(PLUGIN_LIST) .PHONY: depend -.depend depend:: $(GENERATED) \ - share/Makefile.dynamic_config share/Makefile.kernel +.depend depend:: $(GENERATED) share/Makefile.dynamic_config $(PRINT_MAKING) .depend $(RM) .depend $(OCAMLDEP) $(INCLUDES) $(FILES_FOR_OCAMLDEP) > .depend @@ -2039,6 +1973,11 @@ endif -headache-config-file ./headers/headache_config.txt \ $(HEADER_SPEC_FILE) $(PRINT_TAR) $(DISTRIB).tar.gz + # hdrck messes up timestamps, leading make to possibly consider that + # a configure file from a freshly extracted archive needs to be + # recomputed from configure.in (which would require autoconf on the + # host machine). + touch $(CLIENT_DIR)/configure (cd $(DISTRIB_DIR); $(TAR) zcf ../$(DISTRIB).tar.gz \ $(DISTRIB_EXCLUDE) \ --exclude "*autom4te.cache*" \ @@ -2060,13 +1999,11 @@ bin-distrib: depend configure Makefile create_lib_to_install_list = $(addprefix $(FRAMAC_LIB)/,$(call map,notdir,$(1))) -byte:: bin/toplevel.byte$(EXE) \ - share/Makefile.dynamic_config share/Makefile.kernel \ +byte:: bin/toplevel.byte$(EXE) share/Makefile.dynamic_config \ $(call create_lib_to_install_list,$(LIB_BYTE_TO_INSTALL)) \ $(PLUGIN_META_LIST) -opt:: bin/toplevel.opt$(EXE) \ - share/Makefile.dynamic_config share/Makefile.kernel \ +opt:: bin/toplevel.opt$(EXE) share/Makefile.dynamic_config \ $(call create_lib_to_install_list,$(LIB_OPT_TO_INSTALL)) \ $(filter %.o %.cmi,\ $(call create_lib_to_install_list,$(LIB_BYTE_TO_INSTALL))) \ diff --git a/Makefile.generating b/Makefile.generating index bf8b8ad3bfe7681da10b64b647352d4678a7b1bd..576ed8f1f3eae893a19faa0b0b56b2b3ba8f6da1 100644 --- a/Makefile.generating +++ b/Makefile.generating @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -24,10 +24,6 @@ ptests/ptests_config.ml: Makefile.generating share/Makefile.config $(PRINT_MAKING) $@ $(RM) $@ $(TOUCH) $@ - $(ECHO) \ - "let no_native_dynlink = " \ - $(subst yes,false,$(subst no,true,$(USABLE_NATIVE_DYNLINK))) ";;" \ - >> $@ $(CHMOD_RO) $@ tests/ptests_config: Makefile.generating share/Makefile.config @@ -44,32 +40,6 @@ tests/ptests_config: Makefile.generating share/Makefile.config $(ECHO) "FRAMAC_LIB=./lib/fc" >> $@ $(CHMOD_RO) $@ -share/Makefile.kernel: Makefile.generating share/Makefile.config share/Makefile.common - $(PRINT_MAKING) $@ - $(RM) $@ - $(ECHO) "# This makefile was automatically generated." > $@ - $(ECHO) "# Do not modify." >> $@ - $(ECHO) "ifeq (\$$(FRAMAC_INTERNAL),yes)" >> $@ - $(ECHO) "DYN_BLINKFLAGS=$(filter-out $(INCLUDES),$(BLINKFLAGS)) $(foreach d,$(INCLUDES:-I%=%),-I $(FRAMAC_ROOT_SRCDIR)/$(d))" >> $@ - $(ECHO) "DYN_GEN_BYTE_LIBS=$(addprefix $(FRAMAC_ROOT_SRCDIR)/,$(GEN_BYTE_LIBS))" >> $@ - $(ECHO) "DYN_BYTE_LIBS=$(filter-out $(GEN_BYTE_LIBS),$(BYTE_LIBS))" >> $@ - $(ECHO) "DYN_ALL_BATCH_CMO=$(addprefix $(FRAMAC_ROOT_SRCDIR)/,$(notdir $(ALL_BATCH_CMO)))" >> $@ - $(ECHO) "DYN_OLINKFLAGS=$(filter-out $(INCLUDES),$(OLINKFLAGS)) $(foreach d,$(INCLUDES:-I%=%),-I $(FRAMAC_ROOT_SRCDIR)/$(d))" >> $@ - $(ECHO) "DYN_GEN_OPT_LIBS=$(addprefix $(FRAMAC_ROOT_SRCDIR)/,$(GEN_OPT_LIBS))" >> $@ - $(ECHO) "DYN_OPT_LIBS=$(filter-out $(GEN_OPT_LIBS),$(OPT_LIBS))" >> $@ - $(ECHO) "DYN_ALL_BATCH_CMX=$(addprefix $(FRAMAC_ROOT_SRCDIR)/,$(ALL_BATCH_CMX))" >> $@ - $(ECHO) "else" >> $@ - $(ECHO) "DYN_BLINKFLAGS=$(filter-out $(INCLUDES),$(BLINKFLAGS)) $(addprefix -I ,$(filter +%,$(INCLUDES)))" >> $@ - $(ECHO) "DYN_GEN_BYTE_LIBS=$(addprefix $(FRAMAC_LIBDIR)/,$(notdir $(GEN_BYTE_LIBS)))" >> $@ - $(ECHO) "DYN_BYTE_LIBS=$(filter-out $(GEN_BYTE_LIBS),$(BYTE_LIBS))" >> $@ - $(ECHO) "DYN_ALL_BATCH_CMO=$(addprefix $(FRAMAC_LIBDIR)/,$(notdir $(ALL_BATCH_CMO)))" >> $@ - $(ECHO) "DYN_OLINKFLAGS=$(filter-out $(INCLUDES),$(OLINKFLAGS)) $(addprefix -I ,$(filter +%,$(INCLUDES)))" >> $@ - $(ECHO) "DYN_GEN_OPT_LIBS=$(addprefix $(FRAMAC_LIBDIR)/,$(notdir $(GEN_OPT_LIBS)))" >> $@ - $(ECHO) "DYN_OPT_LIBS=$(filter-out $(GEN_OPT_LIBS),$(OPT_LIBS))" >> $@ - $(ECHO) "DYN_ALL_BATCH_CMX=$(addprefix $(FRAMAC_LIBDIR)/,$(notdir $(ALL_BATCH_CMX)))" >> $@ - $(ECHO) "endif" >> $@ - $(CHMOD_RO) $@ - ALL_LIBRARY_NAMES=$(shell ocamlfind query -r -p-format $(LIBRARY_NAMES) $(LIBRARY_NAMES_GUI)) $(CONFIG_FILE): $(CONFIG_FILE).in VERSION share/Makefile.config Makefile.generating configure.in @@ -83,11 +53,10 @@ $(CONFIG_FILE): $(CONFIG_FILE).in VERSION share/Makefile.config Makefile.generat -e "s|@FRAMAC_ROOT_SRCDIR@|$(FRAMAC_ROOT_SRCDIR)|" \ -e "s|@FRAMAC_PLUGINDIR@|$(FRAMAC_PLUGINDIR)|" \ -e "s|@FRAMAC_DEFAULT_CPP@|$(FRAMAC_DEFAULT_CPP)|" \ + -e "s|@FRAMAC_DEFAULT_CPP_ARGS@|$(FRAMAC_DEFAULT_CPP_ARGS)|" \ -e "s|@FRAMAC_GNU_CPP@|$(FRAMAC_GNU_CPP)|" \ -e "s|@DEFAULT_CPP_KEEP_COMMENTS@|$(DEFAULT_CPP_KEEP_COMMENTS)|" \ -e "s|@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@|$(DEFAULT_CPP_SUPPORTED_ARCH_OPTS)|" \ - -e "s|@STATIC_PLUGINS@|$(STATIC_PLUGINS)|" \ - -e "s|@STATIC_GUI_PLUGINS@|$(STATIC_GUI_PLUGINS)|" \ -e "s|@COMPILATION_UNITS@|$(COMPILATION_UNITS)|" \ -e "s|@LIBRARY_NAMES@|$(foreach p,$(ALL_LIBRARY_NAMES),\"$p\";)|" \ -e "s|@OPTDOT@|$(OPTDOT)|" \ @@ -166,7 +135,7 @@ src/kernel_internals/runtime/frama_c_config.ml: src/kernel_internals/runtime/con GENERATED+= src/kernel_internals/runtime/frama_c_config.ml -bin/frama-c-config$(EXE): src/kernel_internals/runtime/frama_c_config.ml +bin/fc-config$(EXE): src/kernel_internals/runtime/frama_c_config.ml ifeq ($(OCAMLBEST),opt) $(OCAMLOPT) str.cmxa $< -o $@ else diff --git a/README.md b/README.md index b4ad6647094e44b341bba25a5b9faa6cd38941f6..cf010ab37501a8be15f665182eb340b5ba00eb5a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ plug-ins in the platform. Thanks to this approach, Frama-C provides sophisticated tools, including: - an analyzer based on abstract interpretation, aimed at verifying - the absence of run-time errors (**Value**); + the absence of run-time errors (**EVA**); - a program proof framework based on weakest precondition calculus (**WP**); - a program slicer (**Slicing**); - a tool for verification of temporal (LTL) properties (**Aoraï**); @@ -67,6 +67,11 @@ Each plug-in has a help command (`-<plugin>-help` or `-<plugin>-h`) that describes its several options. +Finally, the list of options governing the behavior of Frama-C's kernel itself +is available through + + frama-c -kernel-help + #### Complex scenarios For more complex usage scenarios (lots of files and directories, diff --git a/VERSION b/VERSION index 515faf39c17ac0dac1b7d51251ef7da3ad6685f2..a526e6b272466b7438041eef0def9bc30c1310b3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Silicon-20161101+dev \ No newline at end of file +Phosphorus-20170501+dev diff --git a/bin/.gitignore b/bin/.gitignore index 93a2d185fec27daa1229f881c2b2085b3d3dfadd..fc59a2e18284758529f119f352e7449d04c232f6 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -2,9 +2,8 @@ /viewer.byte /*.opt /toplevel.top -/frama-c-config +/fc-config *.byte *.opt toplevel.top -frama-c-config /machdep.exe diff --git a/bin/build-src-distrib.sh b/bin/build-src-distrib.sh index 2fe1338c0cdc1531e127f252fb7f68d8ae8a1853..171676101dfb7a9338febf0d6d427f0d832f1173 100755 --- a/bin/build-src-distrib.sh +++ b/bin/build-src-distrib.sh @@ -25,20 +25,55 @@ fi FRAMAC_VERSION=`cat VERSION` FRAMAC_TAG=`git describe --tag` +VERSION_MODIFIER=$(cat VERSION | sed -e s/[A-Za-z]*-[0-9]*\\\(.*\\\)/\\1/) + +if test -n "$VERSION_MODIFIER"; then FINAL_RELEASE=no; else FINAL_RELEASE=yes; fi + if test "$FRAMAC_VERSION" != "$FRAMAC_TAG"; then echo "WARNING: The current commit is not tagged with the current version:" echo "Frama-C Version: $FRAMAC_VERSION" echo "Frama-C Tag : $FRAMAC_TAG" fi -WEBSITE_DIR="./website" - -if test \! -d $WEBSITE_DIR/.git ; then - echo "ERROR: $WEBSITE_DIR/.git directory not found" - echo "The Frama-C website repository must linked at $WEBSITE_DIR (clone or symbolic link)" +EACSL_DIR="./src/plugins/e-acsl" +if test \! -d $EACSL_DIR/.git ; then + echo "ERROR: $EACSL_DIR/.git directory not found" + echo "The E-ACSL repository must linked at $EACSL_DIR (clone or symbolic link)" exit 1 fi -WEBSITE_BRANCH=`git --git-dir=$WEBSITE_DIR/.git rev-parse --abbrev-ref HEAD` +EACSL_BRANCH=`git --git-dir=$EACSL_DIR/.git rev-parse --abbrev-ref HEAD` + +GITHUB_DIR=./Frama-C-snapshot + +if test ! -d $GITHUB_DIR/.git; then + echo "ERROR: $GITHUB_DIR/.git directory not found" + echo "github's Frama-C-snapshot project must be linked at $GITHUB_DIR \ + (clone or symbolic link)" + exit 1; +fi +GITHUB_BRANCH=$(git --git-dir=$GITHUB_DIR/.git rev-parse --abbrev-ref HEAD) + +if test "$FINAL_RELEASE" = "yes" -a "$GITHUB_BRANCH" != "master"; then + echo "WARNING: your setup will commit a final release on a non-master branch of Frama-C-snapshot"; +fi + +if test "$FINAL_RELEASE" = "no" -a "$GITHUB_BRANCH" = "master"; +then + echo "WARNING: your setup will commit an intermediate release on the master branch of Frama-C-snapshot" +fi + +GITHUB_WIKI=./Frama-C-snapshot.wiki +if test ! -d $GITHUB_WIKI/.git; then + echo "ERROR: $GITHUB_WIKI/.git directory not found" + echo "Frama-C-snapshot's wiki must be linked at $GITHUB_WIKI \ + (clone or symbolic link)" + exit 1; +fi +GITHUB_WIKI_BRANCH=$(git --git-dir=$GITHUB_WIKI/.git rev-parse --abbrev-ref HEAD) + +if test "$GITHUB_WIKI_BRANCH" != "master"; then + echo "WARNING: Frama-C-snapshot's wiki is not on the master branch"; +fi MANUALS_DIR="./doc/manuals" if test \! -d $MANUALS_DIR/.git ; then @@ -48,15 +83,36 @@ if test \! -d $MANUALS_DIR/.git ; then fi MANUALS_BRANCH=`git --git-dir=$MANUALS_DIR/.git rev-parse --abbrev-ref HEAD` +# push on frama-c.com only for final releases +if test "$FINAL_RELEASE" = "yes"; then +WEBSITE_DIR="./website" +if test \! -d $WEBSITE_DIR/.git ; then + echo "ERROR: $WEBSITE_DIR/.git directory not found" + echo "The Frama-C website repository must linked at $WEBSITE_DIR (clone or symbolic link)" + exit 1 +fi +WEBSITE_BRANCH=`git --git-dir=$WEBSITE_DIR/.git rev-parse --abbrev-ref HEAD` +fi # FINAL_RELEASE == yes + BUILD_DIR_ROOT="/tmp/release" BUILD_DIR="$BUILD_DIR_ROOT/frama-c" -echo "Frama-C Version: $FRAMAC_VERSION" -echo "Frama-C Branch : $FRAMAC_BRANCH" -echo "Website Dir : $WEBSITE_DIR" -echo "Website Branch : $WEBSITE_BRANCH" -echo "Manuals Dir : $MANUALS_DIR" -echo "Manuals Branch : $MANUALS_BRANCH" +echo "Frama-C Version : $FRAMAC_VERSION" +echo "Frama-C Branch : $FRAMAC_BRANCH" +echo "Final release : $FINAL_RELEASE" +echo "E-ACSL Dir : $EACSL_DIR" +echo "E-ACSL Branch : $EACSL_BRANCH" +echo "Frama-C-snapshot dir : $GITHUB_DIR" +echo "Frama-C-snapshot branch : $GITHUB_BRANCH" +echo "Frama-C-snapshot wiki : $GITHUB_WIKI" +echo "Manuals Dir : $MANUALS_DIR" +echo "Manuals Branch : $MANUALS_BRANCH" +if test "$FINAL_RELEASE" = "yes"; then +echo "Website Dir : $WEBSITE_DIR" +echo "Website Branch : $WEBSITE_BRANCH" +else +echo "Intermediate release: website not updated" +fi echo "Build Dir : $BUILD_DIR" DOWNLOAD_DIR="www/download" @@ -79,6 +135,7 @@ export LC_CTYPE=en_US.UTF-8 echo -n "Steps are: N) previous information are wrong, I stop + 1) reset target repositories 3) building the source distribution 4) building the API bundle 5) copying and staging the distributed manuals @@ -90,61 +147,132 @@ case "${STEP}" in echo "Exiting without doing anything."; exit 0; ;& + 1) + run "git -C $GITHUB_DIR reset --hard" + run "git -C $GITHUB_WIKI reset --hard" + if test "$FINAL_RELEASE" = "yes"; then + run "git -C $WEBSITE_DIR reset --hard" + fi + ;& 3) step 3 "BUILDING THE SOURCE DISTRIBUTION" run "mkdir -p $BUILD_DIR_ROOT" run "rm -rf $BUILD_DIR" run "git worktree add --detach $BUILD_DIR $FRAMAC_BRANCH" + run "cd $EACSL_DIR; git worktree add --detach $BUILD_DIR/src/plugins/e-acsl $EACSL_BRANCH" run "cd $BUILD_DIR; autoconf" run "cd $BUILD_DIR; ./configure" run "cd $BUILD_DIR; make -j OPEN_SOURCE=yes src-distrib" - SPEC_FILE="$DOWNLOAD_DIR/frama-c-${FRAMAC_VERSION}.tar.gz" - run "rm -f $WEBSITE_DIR/$SPEC_FILE" - run "cp $BUILD_DIR/frama-c-${FRAMAC_VERSION}.tar.gz $WEBSITE_DIR/$SPEC_FILE" - run "git -C $WEBSITE_DIR annex add $SPEC_FILE" - run "cp Changelog $WEBSITE_DIR/src/last-release/Changelog" - run "cp src/plugins/wp/Changelog $WEBSITE_DIR/src/last-release/wpChangelog" + # cleanup Frama-C-snapshot + for file in $(git -C $GITHUB_DIR ls-files); do + run "rm $GITHUB_DIR/$file"; + done + run "git -C $GITHUB_DIR clean -fx" + run "cd $GITHUB_DIR; tar --strip-components=1 -xzvf $BUILD_DIR/frama-c-${FRAMAC_VERSION}.tar.gz" + run "git -C $GITHUB_DIR add -A" + run "mkdir -p $GITHUB_WIKI/downloads" + run "cp $BUILD_DIR/frama-c-${FRAMAC_VERSION}.tar.gz $GITHUB_WIKI/downloads/" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/frama-c-${FRAMAC_VERSION}.tar.gz" + run "rm -f $WEBSITE_DIR/$SPEC_FILE" + run "cp $BUILD_DIR/frama-c-${FRAMAC_VERSION}.tar.gz $WEBSITE_DIR/$SPEC_FILE" + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "cp Changelog $WEBSITE_DIR/src/last-release/Changelog" + run "cp src/plugins/wp/Changelog $WEBSITE_DIR/src/last-release/wpChangelog" + fi ;& 4) step 4 "BUILDING THE API BUNDLE" run "cd $BUILD_DIR; make -j doc-distrib" - SPEC_FILE="$DOWNLOAD_DIR/frama-c-${FRAMAC_VERSION}_api.tar.gz" - run "rm -f $WEBSITE_DIR/$SPEC_FILE" - run "cp $BUILD_DIR/frama-c-api.tar.gz $WEBSITE_DIR/$SPEC_FILE" - run "git -C $WEBSITE_DIR annex add $SPEC_FILE" - run "rm -rf $BUILD_DIR" - run "git worktree prune" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/frama-c-${FRAMAC_VERSION}_api.tar.gz" + run "rm -f $WEBSITE_DIR/$SPEC_FILE" + run "cp $BUILD_DIR/frama-c-api.tar.gz $WEBSITE_DIR/$SPEC_FILE" + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "rm -rf $BUILD_DIR" + run "git worktree prune" + fi ;& 5) step 5 "COPYING AND STAGING THE DISTRIBUTED MANUALS" + PAGE_NAME=Frama-C-$FRAMAC_VERSION.md + WIKI_PAGE=$GITHUB_WIKI/$PAGE_NAME + run "mkdir -p $GITHUB_WIKI/manuals" + run "sed -i -e '/<!-- LAST RELEASE -->/a \ +- [${FRAMAC_VERSION}](Frama-C-${FRAMAC_VERSION})' $GITHUB_WIKI/Home.md" + echo "# Frama-C release ${FRAMAC_VERSION}" > $WIKI_PAGE + echo "## Sources" >> $WIKI_PAGE + echo " - [frama-c-${FRAMAC_VERSION}.tar.gz](downloads/frama-c-${FRAMAC_VERSION}.tar.gz)" >> $WIKI_PAGE + echo "" >> $WIKI_PAGE + echo "## Manuals" >> $WIKI_PAGE for f in "user-manual" "acsl-implementation" "value-analysis" "plugin-development-guide" "rte-manual" "wp-manual" "metrics-manual" "aorai-manual"; do - SPEC_FILE="$DOWNLOAD_DIR/$f-${FRAMAC_VERSION}.pdf" - RELE_FILE="$DOWNLOAD_DIR/frama-c-$f.pdf" - run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" - run "cp $MANUALS_DIR/$f.pdf $WEBSITE_DIR/$SPEC_FILE"; - run "ln -s $f-${FRAMAC_VERSION}.pdf $WEBSITE_DIR/$RELE_FILE"; - run "git -C $WEBSITE_DIR annex add $SPEC_FILE" - run "git -C $WEBSITE_DIR add $RELE_FILE" + echo "- [$f](manuals/$f-${FRAMAC_VERSION}.pdf)" >> $WIKI_PAGE + run "cp $MANUALS_DIR/$f.pdf $GITHUB_WIKI/manuals/$f-${FRAMAC_VERSION}.pdf" + run "git -C $GITHUB_WIKI add manuals/$f-${FRAMAC_VERSION}.pdf" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/$f-${FRAMAC_VERSION}.pdf" + RELE_FILE="$DOWNLOAD_DIR/frama-c-$f.pdf" + run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" + run "cp $MANUALS_DIR/$f.pdf $WEBSITE_DIR/$SPEC_FILE"; + run "ln -s $f-${FRAMAC_VERSION}.pdf $WEBSITE_DIR/$RELE_FILE"; + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "git -C $WEBSITE_DIR add $RELE_FILE" + fi done for f in "aorai-example"; do - SPEC_FILE="$DOWNLOAD_DIR/$f-${FRAMAC_VERSION}.tgz" - RELE_FILE="$DOWNLOAD_DIR/frama-c-$f.tgz" - run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" - run "cp $MANUALS_DIR/$f.tgz $WEBSITE_DIR/$SPEC_FILE"; - run "ln -s $f-${FRAMAC_VERSION}.tgz $WEBSITE_DIR/$RELE_FILE"; - run "git -C $WEBSITE_DIR annex add $SPEC_FILE" - run "git -C $WEBSITE_DIR add $RELE_FILE" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/$f-${FRAMAC_VERSION}.tgz" + RELE_FILE="$DOWNLOAD_DIR/frama-c-$f.tgz" + run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" + run "cp $MANUALS_DIR/$f.tgz $WEBSITE_DIR/$SPEC_FILE"; + run "ln -s $f-${FRAMAC_VERSION}.tgz $WEBSITE_DIR/$RELE_FILE"; + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "git -C $WEBSITE_DIR add $RELE_FILE" + fi done + for f in "acsl"; do ACSL_VERSION=`cat doc/acsl/VERSION` - SPEC_FILE="$DOWNLOAD_DIR/${f}_${ACSL_VERSION}.pdf" - RELE_FILE="$DOWNLOAD_DIR/$f.pdf" - run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" - run "cp $MANUALS_DIR/$f.pdf $WEBSITE_DIR/$SPEC_FILE"; - run "ln -s ${f}_${ACSL_VERSION}.pdf $WEBSITE_DIR/$RELE_FILE"; - run "git -C $WEBSITE_DIR annex add $SPEC_FILE" - run "git -C $WEBSITE_DIR add $RELE_FILE" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/${f}_${ACSL_VERSION}.pdf" + RELE_FILE="$DOWNLOAD_DIR/$f.pdf" + run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" + run "cp $MANUALS_DIR/$f.pdf $WEBSITE_DIR/$SPEC_FILE"; + run "ln -s ${f}_${ACSL_VERSION}.pdf $WEBSITE_DIR/$RELE_FILE"; + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "git -C $WEBSITE_DIR add $RELE_FILE" + fi + done + for f in "e-acsl-manual" "e-acsl-implementation"; do + echo "- [$f](manuals/${f}_${FRAMAC_VERSION}.pdf)" >> $WIKI_PAGE + run "cp $EACSL_DIR/doc/manuals/$f.pdf $GITHUB_WIKI/manuals/${f}_${FRAMAC_VERSION}.pdf" + run "git -C $GITHUB_WIKI add manuals/${f}_${FRAMAC_VERSION}.pdf" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/e-acsl/${f}_${FRAMAC_VERSION}.pdf" + RELE_FILE="$DOWNLOAD_DIR/e-acsl/$f.pdf" + run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" + run "cp $EACSL_DIR/doc/manuals/$f.pdf $WEBSITE_DIR/$SPEC_FILE" + run "ln -s ${f}_${ACSL_VERSION}.pdf $WEBSITE_DIR/$RELE_FILE"; + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "git -C $WEBSITE_DIR add $RELE_FILE" + fi + done + # E-ACSL manuals based on ACSL version number + for f in "e-acsl"; do + echo "- [$f](manuals/${f}_${FRAMAC_VERSION}.pdf)" >> $WIKI_PAGE + run "cp $EACSL_DIR/doc/manuals/$f.pdf $GITHUB_WIKI/manuals/${f}_${FRAMAC_VERSION}.pdf" + run "git -C $GITHUB_WIKI add manuals/${f}_${FRAMAC_VERSION}.pdf" + if test "$FINAL_RELEASE" = "yes"; then + SPEC_FILE="$DOWNLOAD_DIR/e-acsl/${f}_${ACSL_VERSION}.pdf" + RELE_FILE="$DOWNLOAD_DIR/e-acsl/$f.pdf" + run "rm -f $WEBSITE_DIR/$SPEC_FILE $WEBSITE_DIR/$RELE_FILE" + run "cp $EACSL_DIR/doc/manuals/$f.pdf $WEBSITE_DIR/$SPEC_FILE" + run "ln -s ${f}_${ACSL_VERSION}.pdf $WEBSITE_DIR/$RELE_FILE"; + run "git -C $WEBSITE_DIR add $SPEC_FILE" + run "git -C $WEBSITE_DIR add $RELE_FILE" + fi done + run "git -C $GITHUB_WIKI add $PAGE_NAME" ;; *) echo "Bad entry: ${STEP}" diff --git a/bin/developers-by-files.sh b/bin/developers-by-files.sh index 10178f37a6b6694553bc7f9581742558d8d54f96..b76aa647b7cde36cdb9b29949f698ca2661665e6 100755 --- a/bin/developers-by-files.sh +++ b/bin/developers-by-files.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/frama-c b/bin/frama-c index bbad7b020cb46b52ee4264f31c4e9dc7ef0d1f0b..272f7528d60f52d9ef6a3502c00910b13bf0e164 100755 --- a/bin/frama-c +++ b/bin/frama-c @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/frama-c-config b/bin/frama-c-config new file mode 100755 index 0000000000000000000000000000000000000000..472bba81e05560cc2bdd0683ef23a1f60f0a6787 --- /dev/null +++ b/bin/frama-c-config @@ -0,0 +1,27 @@ +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2017 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +#!/bin/sh + +. $(dirname $0)/local_export.sh + +exec $BINDIR/fc-config "$@" diff --git a/bin/frama-c-gui b/bin/frama-c-gui index cd8f56ae7576391cd80fe911b4ecdfc51583a969..6fadddb69aeb05eca9ad4beedd3141171257b1a3 100755 --- a/bin/frama-c-gui +++ b/bin/frama-c-gui @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/frama-c-gui.byte b/bin/frama-c-gui.byte index 96a82efffe08b16d3fe3d36a2bba37c1d884a156..ea815b38099cb1ae3d2f807f39799a9a1286d983 100755 --- a/bin/frama-c-gui.byte +++ b/bin/frama-c-gui.byte @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/frama-c.byte b/bin/frama-c.byte index 9ee992b50d75d4ca5bdeb14495e9f07829e6c45f..fc6ac00e87b0d82f70f69370096d8fa5a2739eca 100755 --- a/bin/frama-c.byte +++ b/bin/frama-c.byte @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/frama-c.top b/bin/frama-c.top index ae31ffdb71a985b451703f322f2438ce7e5d2661..c67f1a4de3cd27f44e804306e9836bd7e9a0dbc8 100755 --- a/bin/frama-c.top +++ b/bin/frama-c.top @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/local_export.sh b/bin/local_export.sh index e0bf6d85b7ea33fd29c59b453acf23b1f28e83f3..28b870e2ab4856d5644e1ca06c7f5a4ca7f2d390 100644 --- a/bin/local_export.sh +++ b/bin/local_export.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/aluminium2silicon.sh b/bin/migration_scripts/aluminium2silicon.sh similarity index 98% rename from bin/aluminium2silicon.sh rename to bin/migration_scripts/aluminium2silicon.sh index d2a7ba6d8de796608d038bc77f7b794323bf5519..1cfce3b88560ee0e9e34d4c359027dde72304443 100755 --- a/bin/aluminium2silicon.sh +++ b/bin/migration_scripts/aluminium2silicon.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/boron2carbon.sh b/bin/migration_scripts/boron2carbon.sh similarity index 99% rename from bin/boron2carbon.sh rename to bin/migration_scripts/boron2carbon.sh index cd9d6510bdd936ca7d4f9a0766d9641007cdb6e5..69f4d5e9e33176d9e0f0efb48ae9f766df5303be 100755 --- a/bin/boron2carbon.sh +++ b/bin/migration_scripts/boron2carbon.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/carbon2nitrogen.sh b/bin/migration_scripts/carbon2nitrogen.sh similarity index 98% rename from bin/carbon2nitrogen.sh rename to bin/migration_scripts/carbon2nitrogen.sh index a2a44cf7540f38158323ff2d4ac3b3382416318f..a46effd7e879e27d39c65066f5b318154396d526 100755 --- a/bin/carbon2nitrogen.sh +++ b/bin/migration_scripts/carbon2nitrogen.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/fluorine2neon.sh b/bin/migration_scripts/fluorine2neon.sh similarity index 99% rename from bin/fluorine2neon.sh rename to bin/migration_scripts/fluorine2neon.sh index e04dcb5f007dbd6159402c48702f7885cb244abb..bba015fbebece7b0c4408ad00df97cc16e94dabc 100755 --- a/bin/fluorine2neon.sh +++ b/bin/migration_scripts/fluorine2neon.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/lithium2beryllium.sh b/bin/migration_scripts/lithium2beryllium.sh similarity index 98% rename from bin/lithium2beryllium.sh rename to bin/migration_scripts/lithium2beryllium.sh index b87e155e59fc219944f46264f0e230c5cb389b7a..fadaf57bcb51fa4d3f61482d39e702cb27dfedab 100755 --- a/bin/lithium2beryllium.sh +++ b/bin/migration_scripts/lithium2beryllium.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/magnesium2aluminium.sh b/bin/migration_scripts/magnesium2aluminium.sh similarity index 98% rename from bin/magnesium2aluminium.sh rename to bin/migration_scripts/magnesium2aluminium.sh index dae7e437c2232aeb84c3fb54056af23b659b8741..775630f012de26d910398d5e112b60342e48299f 100755 --- a/bin/magnesium2aluminium.sh +++ b/bin/migration_scripts/magnesium2aluminium.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/neon2sodium.sh b/bin/migration_scripts/neon2sodium.sh similarity index 98% rename from bin/neon2sodium.sh rename to bin/migration_scripts/neon2sodium.sh index 0b71c871812b8593601f4e64ebba1cc0c5b8fc18..be2d151ee4f19da9c2501947e542369d449b27be 100755 --- a/bin/neon2sodium.sh +++ b/bin/migration_scripts/neon2sodium.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/nitrogen2oxygen.sh b/bin/migration_scripts/nitrogen2oxygen.sh similarity index 98% rename from bin/nitrogen2oxygen.sh rename to bin/migration_scripts/nitrogen2oxygen.sh index f51d62356ee1751659d205b0f15aa5c31926827f..9656d02ea6437f44437b3a6f19b256696fcac1d5 100755 --- a/bin/nitrogen2oxygen.sh +++ b/bin/migration_scripts/nitrogen2oxygen.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/oxygen2fluorine.sh b/bin/migration_scripts/oxygen2fluorine.sh similarity index 99% rename from bin/oxygen2fluorine.sh rename to bin/migration_scripts/oxygen2fluorine.sh index 99340f5d429c97d88c476ed227e16ebec32c2f5e..484ab8f5f63860856ea5e9426a0d576ba7d84479 100755 --- a/bin/oxygen2fluorine.sh +++ b/bin/migration_scripts/oxygen2fluorine.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/migration_scripts/phosphorus2sulfur.sh b/bin/migration_scripts/phosphorus2sulfur.sh new file mode 100755 index 0000000000000000000000000000000000000000..f5b60594af40c7d7eeeda2248c70ddc334bdd92b --- /dev/null +++ b/bin/migration_scripts/phosphorus2sulfur.sh @@ -0,0 +1,174 @@ +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2017 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +#! /bin/sh +# +# convert a Frama-C plugin from Frama-C Phosphorus to Frama-C Sulfur +# as most as possible (no guarantee that the result is fully compatible) +# +# known missing features: +# - doesn't work if a directory name contains spaces +# - doesn't follow symbolic links to directories + +ARGS=$@ + +DIR= + +# verbosing on by default +VERBOSE="v" + +sedi () +{ + if [ -n "`sed --help 2> /dev/null | grep \"\\-i\" 2> /dev/null`" ]; then + sed -i "$@" + else + # option '-i' is not recognized by sed: use a tmp file + new_temp=`mktemp /tmp/frama-c.XXXXXXX` || exit 1 + sed "$@" > $new_temp + eval last=\${$#} + mv $new_temp $last + fi +} + +dirs () +{ + if [ -z "$DIR" ]; then + DIR=. + fi +} + +safe_goto () +{ + dir=$1 + cd $dir + $3 + cd $2 +} + +goto () +{ + if [ -d $1 ]; then + safe_goto $1 $2 $3 + else + echo "Directory '$1' does not exist. Omitted." + fi +} + +process_file () +{ + file=$1 + if [ "$VERBOSE" ]; then + echo "Processing file $file" + fi + sedi \ + -e "s/\<\(Cil_types\.\)\?identified_term\> *\<\(\(Cil_types\.\)\?\(from\|assigns\|allocation\|deps\)\)\>/\2/g" \ + -e "s/\<\(Cil_types\.\)\?term\> *\<\(\(Cil_types\.\)\?\(variant\|loop_pragma\|slice_pragma\|impact_pragma\|pragma\)\)\>/\2/g" \ + -e "s/\<\(Logic_ptree\.\)\?lexpr\> \<\(Cil_types\.\)\?\(from\|assigns\|allocation\|deps\)\>/\1\3/g" \ + -e "s/\<\(Logic_ptree\.\)\?lexpr\> \<\(Cil_types\.\)\?\(variant\|loop_pragma\|slice_pragma\|impact_pragma\|pragma\)\>/\1\3/g" \ + -e "s/!Db\.Slicing\./Slicing\.Api\./g" \ + -e "s/Db\.Slicing/Slicing\.Api/g" \ + -e "s/!Db\.Report\.print/Report\.Register\.print/g" \ + -e "s/!Db\.Scope\.get_defs/Scope\.Defs\.get_defs/g" \ + -e "s/!Db\.Scope\.get_defs_with_type/Scope\.Defs\.get_defs_with_type/g" \ + -e "s/!Db\.Scope\.get_data_scope_at_stmt/Scope\.Datascope\.get_data_scope_at_stmt/g" \ + -e "s/!Db\.Scope\.get_prop_scope_at_stmt/Scope\.Datascope\.get_prop_scope_at_stmt/g" \ + -e "s/!Db\.Scope\.check_asserts/Scope\.Datascope\.check_asserts/g" \ + -e "s/!Db\.Scope\.rm_asserts/Scope\.Datascope\.rm_asserts/g" \ + -e "s/Db\.Scope\.t_zones/Scope\.Zones\.t_zones/g" \ + -e "s/!Db\.Scope\.build_zones/Scope\.Zones\.build_zones/g" \ + -e "s/!Db\.Scope\.pretty_zones/Scope\.Zones\.pretty_zones/g" \ + -e "s/!Db\.Scope\.get_zones/Scope\.Zones\.get_zones/g" \ + -e "s/Ival\.inject_top/Ival\.inject_interval/g" + -e "s/[^e]-rm-unused-globals/-sparecode-rm-unused-globals/g" \ + $file +} + +apply_one_dir () +{ + if [ "$VERBOSE" ]; then + echo "Processing directory `pwd`" + fi + for f in `ls -p1 *.ml* 2> /dev/null`; do + process_file $f + done +} + +apply_recursively () +{ + apply_one_dir + for d in `ls -p1 | grep \/`; do + safe_goto $d .. apply_recursively + done +} + +applying_to_list () +{ + dirs + tmpdir=`pwd` + for d in $DIR; do + goto $d $tmpdir $1 + done +} + +help () +{ + echo "Usage: $0 [options | directories] + +Options are: + -r | --recursive Check subdirectories recursively + -h | --help Display help message + -q | --quiet Quiet mode (i.e. non-verbose mode) + -v | --verbose Verbose mode (default)" + exit 0 +} + +error () +{ + echo "$1. +Do \"$0 -h\" for help." + exit 1 +} + +FN="apply_one_dir" + +parse_arg () +{ + case $1 in + -r | --recursive) FN="apply_recursively";; + -h | -help ) help; exit 0;; + -q | --quiet ) VERBOSE=;; + -v | --verbose ) VERBOSE="v";; + -* ) error "Invalid option $1";; + * ) DIR="$DIR $1";; + esac +} + +cmd_line () +{ + for s in $ARGS; do + parse_arg $s + done + applying_to_list $FN +} + +cmd_line +exit 0 diff --git a/bin/silicon2phosphorus.sh b/bin/migration_scripts/silicon2phosphorus.sh similarity index 97% rename from bin/silicon2phosphorus.sh rename to bin/migration_scripts/silicon2phosphorus.sh index f7dc44e5869042eece3d5b61ce29502ce2f9a2e2..cfffa8c30139b30f248e07f6bf801976608c6307 100755 --- a/bin/silicon2phosphorus.sh +++ b/bin/migration_scripts/silicon2phosphorus.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -81,6 +81,7 @@ process_file () fi sedi \ -e "\"s/Cabs2cil.compatibleTypesp/Cabs2cil.areCompatibleTypes/g\"" \ + -e "\"s/FCDynlink/Dynlink/g\"" \ $file } diff --git a/bin/sodium2magnesium.sh b/bin/migration_scripts/sodium2magnesium.sh similarity index 98% rename from bin/sodium2magnesium.sh rename to bin/migration_scripts/sodium2magnesium.sh index 27976a9db2622e4b15f7dcf1b368f7fb542459cf..76a32cc49b3d15f554fcd4220a942692712702c2 100755 --- a/bin/sodium2magnesium.sh +++ b/bin/migration_scripts/sodium2magnesium.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/rebuild.sh b/bin/rebuild.sh index 5e646e8abae6decf1e15b05777eeb48c943a234d..675472e8891117a455db236daecd114330bc648b 100755 --- a/bin/rebuild.sh +++ b/bin/rebuild.sh @@ -1,4 +1,5 @@ make -k clean +find src -name "*.cm*" -delete -print rm -fr config.status autom4te.cache/ autoconf -f ./configure diff --git a/bin/shift_oracles.sh b/bin/shift_oracles.sh new file mode 100755 index 0000000000000000000000000000000000000000..1a8cba4f5da6526ab0a05fd6050b8ac3afb0efc9 --- /dev/null +++ b/bin/shift_oracles.sh @@ -0,0 +1,156 @@ +#!/bin/bash -eu + +# [shift_oracles.sh [commit] source.c -- test1.oracle test2.oracle ...] +# modifies the set of oracles w.r.t. [source.c], using `git diff` to +# estimate how many lines were added/removed and then replacing line numbers +# accordingly, to reduce noise when diffing files. +# Note: the oracles must be pristine, because calling multiple times this +# script will modify the oracles at each call. +# Also, because the script uses `git diff`, the modified source must not be +# in the index. + +###### Command-line parsing-related code ###### + +function usage_error { + echo "usage: $0 [--dry-run] [commit [commit]] modified_source -- oracles" + echo "" + echo " example:" + echo " $0 tests/my_test/test.c -- tests/**/*.oracle" + echo "" + echo " --dry-run: do not run sed, instead print command line" + echo " commit numbers/names: optional, passed to 'git diff'" + echo " modified_source: a single file that has been modified" + echo " oracles: 1 or more ptests .oracle files" + exit 1 +} + +if [ $# -lt 3 ]; then usage_error; fi + +if [ "$1" = "--dry-run" ]; then + dry_run=1 + shift +else + dry_run=0 +fi + +file="" +git_diff_args="" +oracles= +for i in $(seq $#); do + if [ ${!i} = "--" ]; then + # found '--', use it to determine other arguments + if [ $i -eq 1 -o $i -eq $# ]; then + usage_error + fi + file_i=$((i-1)) + file="${!file_i}" + echo "file = $file" + if [ ! -f "$file" ]; then + echo "$file is not a file" + exit 1 + fi + git_diff_args=${@:1:$((i-1))} + oracles=("${@:$((i+1))}") + break + fi +done +if [ "$file" = "" ]; then # no '--' found, or no file before '--' + usage_error +fi + +###### Actual script code ###### + +lines=$(wc -l "$file" | cut -d' ' -f1) +line_shift= #empty array +# initialize all lines to "no shift" +for i in $(seq $lines); do + line_shift[$i]=0 +done + +# compute the amount to be shifted for each line, using `git diff -U0 source.c` +# the regex is complex because some elements are optional +# (e.g., when the number of modified lines is 1, ",1" is omitted) +start_line=1 +first_hunk=1 +shift_amount=0 +while read -r hunk +do + IFS=' ' read a b c d e f < <(echo "$hunk") + first_line1=$a + #echo "a=$a -- b=$b -- c=$c -- d=$d -- e=$e -- f=$f" + if [[ $b =~ ^, ]]; then + n_lines1=$c + first_line2=$d + if [[ $e =~ ^, ]]; then n_lines2=$f; else n_lines2=1; fi + else + n_lines1=1 + first_line2=$b + if [[ $c =~ ^, ]]; then n_lines2=$d; else n_lines2=1; fi + fi + #echo "first_line1=$first_line1 -- n_lines1=$n_lines1 -- first_line2=$first_line2 -- n_lines2=$n_lines2" + if [ $first_hunk -eq 1 ]; then + first_hunk=0 + start_line=$first_line1 + hunk_diff=$((n_lines2 - n_lines1)) + shift_amount=$hunk_diff + echo "processing hunk: $first_line1,$n_lines1 $first_line2,$n_lines2 (shift amount: $shift_amount)" + else + end_line=$first_line1 + for i in $(seq $start_line $((end_line - 1))); do + line_shift[$i]=$shift_amount + done + start_line=$end_line + hunk_diff=$((n_lines2 - n_lines1)) + shift_amount=$((shift_amount + hunk_diff)) + echo "processing hunk: $first_line1,$n_lines1 $first_line2,$n_lines2 (shift amount: $shift_amount)" + fi +done < <(git diff --unified=0 $git_diff_args | grep -P '^@@.*@@' | sed -r -e 's/@@ [+-]([0-9]+)(,([0-9]+))? [+-]([0-9]+)(,([0-9]+))? @@.*$/\1 \2 \3 \4 \5 \6/') + +if [ $first_hunk -eq 1 ]; then + echo "error: no hunks found in git diff: git diff $git_diff_args" + exit 1 +fi + +# after finishing all hunks, shift until end of file +end_line=$lines +for i in $(seq $start_line $((end_line - 1))); do + line_shift[$i]=$shift_amount +done + +# Note: sources in the Frama-C libc may be printed in two ways, either with +# "share/libc/..." or "FRAMAC_SHARE/libc/...", so we must account for them. +# This may be fixed in a later Frama-C version. +source_in_libc=0 +if [[ $file =~ share/libc/(.*) ]]; then + source_in_libc=1 + source="share/libc/${BASH_REMATCH[1]}" + source2="FRAMAC_SHARE/libc/${BASH_REMATCH[1]}" + echo "replacing expressions: \"$source\" or \"$source2\"" +else + source="$file" + echo "replacing expressions: \"$source\"" +fi + +# build the large regex that will be given to sed +sed_regex="" +for n in $(seq $lines); do + if [ ${line_shift[$n]} -ne 0 ]; then + shifted_n=$((n+line_shift[$n])) + sed_regex+="s|$source:$n\b|$source:$shifted_n|g; t ;" + if [ $source_in_libc -ne 0 ]; then + sed_regex+="s|$source2:$n\b|$source2:$shifted_n|g; t ;" + fi + fi +done + +if [ $dry_run -eq 1 ] ; then + echo "dry run: will not run sed" + echo "final command: sed -i '$sed_regex' ${oracles[@]}" +else + echo "modifying ${#oracles[@]} oracle(s) in-place..." + if [ ${#oracles[@]} -gt 500 ]; then + echo "(this may take a few minutes)" + fi + sed -i "$sed_regex" ${oracles[@]} + echo "done." +fi diff --git a/bin/test_all_plugins.sh b/bin/test_all_plugins.sh index 5a4c7123aac07379c11a316b2444417f0dab4679..ab7a8e51cbe03b8dae93928ec7e36ff3c2f6adc0 100755 --- a/bin/test_all_plugins.sh +++ b/bin/test_all_plugins.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/bin/update_api_doc.sh b/bin/update_api_doc.sh index a615b92f44e66577e298cca05a3164649656e4b6..164a4d95714b6c60b04a6eeb9152d216d313255e 100755 --- a/bin/update_api_doc.sh +++ b/bin/update_api_doc.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh next=$1 @@ -7,5 +7,5 @@ if test -z "$next"; then echo "\$ ./bin/update_api_doc.sh <NEXT>" echo "See the Release Management Documentation for an example." else - sed -i -e "s/Frama-C+dev/${next}/g" src/**/*.ml* + find src -name '*.ml*' -exec sed -i -e "s/Frama-C+dev/${next}/g" '{}' ';' fi diff --git a/config.h.in b/config.h.in index 197040b2b5e2b1716194643a17cd2e9c43d48308..90f1468ef2f7e3c75c687412bc18c17357b0e183 100644 --- a/config.h.in +++ b/config.h.in @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/configure.in b/configure.in index da93b28d2b51d63c0098dd5e43f8c526d2880112..d96da67449f14bdb18b429ea7f8a604c6371788d 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # INRIA (Institut National de Recherche en Informatique et en # @@ -138,11 +138,32 @@ else fi fi +# In case we have a native compiler, check that native dynlink works. +# Otherwise, fall back to bytecode-only compilation + +if test "$OCAMLBEST" = opt; then + echo "let f x y =" > test_dynlink.ml + echo " Dynlink.loadfile \"foo\"; " >> test_dynlink.ml + echo " ignore (Dynlink.is_native);" >> test_dynlink.ml + echo " abs_float (x -. y)" >> test_dynlink.ml + if ($OCAMLOPT -shared -linkall -o test_dynlink.cmxs test_dynlink.ml) \ + 2> /dev/null ; \ +then + AC_MSG_RESULT([native dynlink works fine. Great.]) +else + AC_MSG_WARN([Native dynlink does not work, disabling native compilation.]) + OCAMLBEST=byte +fi +rm -f test_dynlink.* +fi + if test "$OCAMLBEST" = "opt"; then LIB_SUFFIX=cmxa + DYN_SUFFIX=cmxs OBJ_SUFFIX=cmx; else LIB_SUFFIX=cma + DYN_SUFFIX=cma OBJ_SUFFIX=cmo; fi @@ -286,7 +307,7 @@ AC_CHECK_PROG(OTAGS,otags,otags,) AC_MSG_CHECKING(for Apron) APRON_PATH=$($OCAMLFIND query apron 2>/dev/null | tr -d '\r\n') -if test -f "$APRON_PATH/apron.cmxs"; then +if test -f "$APRON_PATH/apron.$DYN_SUFFIX"; then HAS_APRON="yes"; AC_MSG_RESULT(found) else @@ -307,7 +328,7 @@ if test "$ENABLE_LANDMARKS" = yes ; then AC_MSG_CHECKING(for Landmarks) LANDMARKS_PATH=$($OCAMLFIND query landmarks 2>/dev/null | tr -d '\r\n') LANDMARKS_PPX_PATH=$($OCAMLFIND query landmarks.ppx 2>/dev/null | tr -d '\r\n') - if test -f "$LANDMARKS_PATH/landmarks.cmxs" -a -f "$LANDMARKS_PPX_PATH/ppx_landmarks"; then + if test -f "$LANDMARKS_PATH/landmarks.$DYN_SUFFIX" -a -f "$LANDMARKS_PPX_PATH/ppx_landmarks"; then HAS_LANDMARKS="yes"; AC_MSG_RESULT(found) else @@ -349,19 +370,23 @@ else EXE= fi - # OCaml native threads - AC_MSG_CHECKING([OCaml native threads]) - echo "let f = Thread.create (fun () -> ())" > test_native_threads.ml - if ($OCAMLOPT -thread -o test_native_threads unix.cmxa threads.cmxa \ - test_native_threads.ml) 2> /dev/null ; \ - then - HAS_NATIVE_THREADS=yes - AC_MSG_RESULT([ok.]) + if test "$OCAMLBEST" = opt; then + # OCaml native threads + AC_MSG_CHECKING([OCaml native threads]) + echo "let f = Thread.create (fun () -> ())" > test_native_threads.ml + if ($OCAMLOPT -thread -o test_native_threads unix.cmxa threads.cmxa \ + test_native_threads.ml) 2> /dev/null ; + then + HAS_NATIVE_THREADS=yes + AC_MSG_RESULT([ok.]); + else + HAS_NATIVE_THREADS=no + AC_MSG_WARN([unsupported.]); + fi + rm -f test_native_threads*; else - HAS_NATIVE_THREADS=no - AC_MSG_WARN([unsupported.]) + HAS_NATIVE_THREADS=no; # no native compilation anyway fi - rm -f test_native_threads* fi # C and POSIX standard headers used by C bindings. @@ -530,6 +555,7 @@ AC_ARG_WITH( AC_MSG_RESULT(Default preprocessor is '$FRAMAC_DEFAULT_CPP'.) +FRAMAC_DEFAULT_CPP_ARGS=$CPPFLAGS # Test if preprocessor supports options such as -m16/-m32/-m64 @@ -574,14 +600,6 @@ AC_MSG_RESULT(Default preprocessor supported architecture-related options: $DEFA new_section "wished frama-c plug-ins" -# Option -with-all-static -####################### - -define([ALL_STATIC_HELP], - AC_HELP_STRING([--with-all-static], - [link all plug-ins statically (default: no)])) -AC_ARG_WITH(all-static,ALL_STATIC_HELP,IS_ALL_STATIC=$withval) - # Option -with-no-plugin ####################### @@ -602,10 +620,6 @@ REQUIRE_LABLGTK= USE_LABLGTK= HAS_LABLGTK= -REQUIRE_NATIVE_DYNLINK= -USE_NATIVE_DYNLINK= -HAS_NATIVE_DYNLINK=uncheck - # Tool declarations #################### @@ -633,7 +647,7 @@ PLUGINS_FORCE_LIST= ########### check_plugin(callgraph, src/plugins/callgraph, - [support for callgraph plugin], yes, yes) + [support for callgraph plugin], yes) plugin_use_external(callgraph,dot) plugin_use(callgraph,gui) @@ -643,14 +657,14 @@ plugin_use(callgraph,value_analysis) ###################### check_plugin(semantic_constant_folding, src/plugins/constant_propagation, - [support for constant propagation plugin],yes,yes) + [support for constant propagation plugin],yes) plugin_require(semantic_constant_folding,value_analysis) # from ###### -check_plugin(from_analysis,src/plugins/from,[support for from analysis],yes,yes) +check_plugin(from_analysis,src/plugins/from,[support for from analysis],yes) plugin_require(from_analysis,value_analysis) plugin_require(from_analysis,callgraph) @@ -658,7 +672,7 @@ plugin_require(from_analysis,callgraph) # gui ##### -check_plugin(gui,src/plugins/gui,[support for gui],yes,no) +check_plugin(gui,src/plugins/gui,[support for gui],yes) plugin_require_external(gui,lablgtk) plugin_require_external(gui,gnomecanvas) @@ -668,7 +682,7 @@ plugin_use_external(gui,dot) # impact ######## -check_plugin(impact,src/plugins/impact,[support for impact plugin],yes,yes) +check_plugin(impact,src/plugins/impact,[support for impact plugin],yes) plugin_use(impact,gui) plugin_use(impact,slicing) @@ -679,7 +693,7 @@ plugin_require(impact,inout) # inout ####### -check_plugin(inout,src/plugins/inout,[support for inout analysis],yes,yes) +check_plugin(inout,src/plugins/inout,[support for inout analysis],yes) plugin_require(inout,from_analysis) plugin_require(inout,value_analysis) plugin_require(inout,callgraph) @@ -687,7 +701,7 @@ plugin_require(inout,callgraph) # metrics ######### -check_plugin(metrics,src/plugins/metrics,[support for metrics analysis],yes,yes) +check_plugin(metrics,src/plugins/metrics,[support for metrics analysis],yes) plugin_use(metrics,value_analysis) plugin_use(metrics,gui) @@ -695,14 +709,14 @@ plugin_use(metrics,gui) ############ check_plugin(occurrence,src/plugins/occurrence, - [support for occurrence analysis],yes,yes) + [support for occurrence analysis],yes) plugin_use(occurrence,gui) plugin_require(occurrence,value_analysis) # pdg ##### -check_plugin(pdg,src/plugins/pdg,[support for pdg plugin],yes,yes,pdg_types) +check_plugin(pdg,src/plugins/pdg,[support for pdg plugin],yes,pdg_types) plugin_require(pdg,from_analysis) plugin_require(pdg,value_analysis) plugin_require(pdg,callgraph) @@ -711,18 +725,18 @@ plugin_require(pdg,callgraph) ################ check_plugin(postdominators,src/plugins/postdominators, - [support for postdominators plugin],yes,yes) + [support for postdominators plugin],yes) # rte ##### check_plugin(rtegen,src/plugins/rte, - [support for runtime error annotation],yes,yes) + [support for runtime error annotation],yes) # scope ############ -check_plugin(scope,src/plugins/scope,[support for scope plugin],yes,yes) +check_plugin(scope,src/plugins/scope,[support for scope plugin],yes) plugin_require(scope,postdominators) plugin_require(scope,value_analysis) plugin_require(scope,from_analysis) @@ -732,7 +746,7 @@ plugin_use(scope,gui) # slicing ######### -check_plugin(slicing,src/plugins/slicing,[support for slicing plugin],yes,yes, +check_plugin(slicing,src/plugins/slicing,[support for slicing plugin],yes, src/slicing_types) plugin_require(slicing,from_analysis) plugin_require(slicing,pdg) @@ -744,14 +758,14 @@ plugin_use(slicing,gui) ############ check_plugin(sparecode,src/plugins/sparecode, - [support for sparecode plugin],yes,yes) + [support for sparecode plugin],yes) plugin_require(sparecode,pdg) plugin_require(sparecode,value_analysis) # users ####### -check_plugin(users,src/plugins/users,[support for users analysis],yes,yes) +check_plugin(users,src/plugins/users,[support for users analysis],yes) plugin_require(users,value_analysis) plugin_use(users,callgraph) @@ -759,7 +773,7 @@ plugin_use(users,callgraph) ####### check_plugin(value_analysis,src/plugins/value, - [support for value analysis],yes,yes) + [support for value analysis],yes) plugin_use(value_analysis,gui) plugin_use(value_analysis,scope) plugin_use(value_analysis,callgraph) @@ -816,7 +830,7 @@ AC_FOREACH([__plugin],m4_esyscmd([ls src/plugins]), ) m4_if(m4_sysval,[0],, [ check_plugin(__plugin,plugin_dir, - [support for __plugin plug-in],yes,yes) + [support for __plugin plug-in],yes) if test "$[ENABLE_]tovarname(__plugin)" != "no"; then EXTERNAL_PLUGINS="$EXTERNAL_PLUGINS plugin_dir"; fi])])], @@ -875,81 +889,16 @@ configure_library([LABLGTK], configure_tool([DOT],[dot],[dot not found: you should install GraphViz],no) -# Native dynlink -################ - -define([force_static_plugins], - [# compile statically all dynamic plug-ins - # except contrary instructions - [USE_NATIVE_DYNLINK]=""; - for plugin in m4_flatten(PLUGINS_LIST); do - n=NAME_$plugin - d=DYNAMIC_$plugin - s=STATIC_$plugin - eval np=\$$n - eval dp=\$$d - eval sp=\$$s - if test "$dp" = "yes"; then - if test "$sp" = "no"; then - # force to be dynamic - USE_NATIVE_DYNLINK="${USE_NATIVE_DYNLINK} $np"; - else - eval STATIC_$plugin=yes; - eval DYNAMIC_$plugin=no; - fi - fi - done]) - -configure_library([NATIVE_DYNLINK], - [$OCAMLLIB/dynlink.cmxa], - [native dynlink unavailable], - yes, - [force_static_plugins]) - # Checking some other things which cannot be done too early ########################################################### -# Usable native dynlink - -# Checking internal invariant -if test "$HAS_NATIVE_DYNLINK" = "uncheck"; then - AC_MSG_ERROR([Internal error with check of native dynlink. Please report.]) -fi - -HAS_USABLE_NATIVE_DYNLINK=no - -if test "$HAS_NATIVE_DYNLINK" != "no" ; then - echo "let f x y = Dynlink.loadfile \"foo\"; ignore (Dynlink.is_native); abs_float (x -. y)" > test_dynlink.ml - if ($OCAMLOPT -shared -linkall -o test_dynlink.cmxs test_dynlink.ml) \ - 2> /dev/null ; \ - then - HAS_USABLE_NATIVE_DYNLINK=yes - AC_MSG_RESULT([native dynlink works fine. Great.]) - else - REQUIRE_USABLE_NATIVE_DYNLINK=$REQUIRE_NATIVE_DYNLINK - USE_USABLE_NATIVE_DYNLINK=$USE_NATIVE_DYNLINK - HAS_USABLE_NATIVE_DYNLINK=no -# we know that dynlink does not work: -# configure a dummy library "dynlink" in order to -# configure plug-ins depending on dynlink in a proper way - configure_library([USABLE_NATIVE_DYNLINK], - [dynlink], - [native dynlink unsupported on this platform], - yes, - [force_static_plugins]) - fi - rm -f test_dynlink.* -fi - # Native version of ptests can be used only if # - a native compiler exists -# - native dynlink is usable # - native threads are usable PTESTSBEST=byte if test \ "$OCAMLBEST" = "opt" -a \ - "$HAS_USABLE_NATIVE_DYNLINK" = "yes" -a \ "$HAS_NATIVE_THREADS" = "yes"; \ then PTESTSBEST=opt; @@ -992,6 +941,7 @@ AC_SUBST(CYCLES_PER_USEC) AC_SUBST(LOCAL_MACHDEP) AC_SUBST(datarootdir) AC_SUBST(FRAMAC_DEFAULT_CPP) +AC_SUBST(FRAMAC_DEFAULT_CPP_ARGS) AC_SUBST(DEFAULT_CPP_SUPPORTED_ARCH_OPTS) AC_SUBST(FRAMAC_GNU_CPP) AC_SUBST(DEFAULT_CPP_KEEP_COMMENTS) @@ -999,7 +949,6 @@ AC_SUBST(CC) AC_SUBST(EXTERNAL_PLUGINS) -AC_SUBST(HAS_USABLE_NATIVE_DYNLINK) AC_SUBST(HAS_NATIVE_THREADS) AC_SUBST(PTESTSBEST) AC_SUBST(LABLGTK_PATH) @@ -1008,7 +957,6 @@ AC_SUBST(LABLGTK_PATH) # Sadly AC_FOREACH is deprecated now... AC_FOREACH([p],PLUGINS_LIST, [AC_SUBST([ENABLE_]p) - AC_SUBST([DYNAMIC_]p) ]) ################################################ @@ -1030,24 +978,11 @@ new_section "summary: plug-ins available" for plugin in m4_flatten(PLUGINS_LIST); do n=NAME_$plugin e=ENABLE_$plugin - d=DYNAMIC_$plugin - s=STATIC_$plugin i=INFO_$plugin eval nv=\$$n eval ev=\$$e - eval dv=\$$d - eval sv=\$$s eval iv=\$$i - if test "$ev" = "no"; then - res=$ev; - elif test "$dv" = "yes"; then - res="$ev, dynamic"; - elif test "$sv" = "yes"; then - res="$ev, static"; - else - res=$ev; - fi - AC_MSG_NOTICE([$nv: $res$iv]) + AC_MSG_NOTICE([$nv: $ev$iv]) done if test "$EXTRA_EXTERNAL_PLUGINS" != ""; then diff --git a/devel_tools/size_states.ml b/devel_tools/size_states.ml new file mode 100644 index 0000000000000000000000000000000000000000..36bd41b32ca057fa5d9d3866d5406ffc5bc638e7 --- /dev/null +++ b/devel_tools/size_states.ml @@ -0,0 +1,112 @@ +(**************************************************************************) +(* *) +(* Copyright (C) Jean-Christophe Filliatre *) +(* *) +(* This software is free software; you can redistribute it and/or *) +(* modify it under the terms of the GNU Library General Public *) +(* License version 2, with the special exception on linking *) +(* described in file LICENSE. *) +(* *) +(* This software is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *) +(* *) +(**************************************************************************) + +(* Modified by CEA *) + +open Obj + +(* Pointers already visited are stored in a hash-table, where + comparisons are done using physical equality. *) + +external address_of_value: 'a -> int = "address_of_value" + +module H = Hashtbl.Make( + struct + type t = Obj.t + let equal = (==) + let hash = address_of_value + end) + +let node_table = (H.create 257 : unit H.t) + +(* Addresses that will be skipped *) +let except_table = (H.create 257 : unit H.t) + +let in_table o = H.mem node_table o || H.mem except_table o + +let add_in_table o = H.add node_table o () + +let mark_as_skipped () = + H.iter (fun addr () -> H.add except_table addr ()) node_table + +let reset_table () = H.clear node_table + +(*s Objects are traversed recursively, as soon as their tags are less than + [no_scan_tag]. [count] records the numbers of words already visited. *) + +let size_of_double = size (repr 1.0) + +let count = ref 0 + +let rec traverse t = + if not (in_table t) then begin + add_in_table t; + if is_block t then begin + let n = size t in + let tag = tag t in + if tag < no_scan_tag then begin + count := !count + 1 + n; + for i = 0 to n - 1 do + let f = field t i in + if is_block f then traverse f + done + end else if tag = string_tag then + count := !count + 1 + n + else if tag = double_tag then + count := !count + size_of_double + else if tag = double_array_tag then + count := !count + 1 + size_of_double * n + else + incr count + end + end + +let res () = + let r = !count in + reset_table (); + count := 0; + r + +(* CEA *) + +let all_sizes () = + Gc.compact (); + Gc.set { (Gc.get ()) with + Gc.max_overhead = 1000000; allocation_policy = 1 } (* disable compaction *); + let states = + State_builder.States.fold (fun name _ v _ acc -> (name, Obj.repr v) :: acc) [] + in + let ast = List.assoc "AST" states in + let add acc name = + let size : int = (res ()) / 1000 in + if size <> 0 then (size, name) :: acc else acc + in + (* Compute the size of the AST, and mark the entire AST as skipped *) + traverse ast; + mark_as_skipped (); + let res = add [] "AST" in + (* Now traverse the other states, but implicitly excluding the AST *) + let aux acc (state, v) = + traverse v; + add acc state + in + let res = List.fold_left aux res states in + (* Sort by increasing size *) + let res = List.sort (fun (s1, _) (s2, _) -> compare s1 s2) res in + let pp fmt (size, name) = Format.fprintf fmt "@[%d kW, %s@]" size name in + Kernel.result "## Sizes ##@.%a" + (Pretty_utils.pp_list ~pre:"@[<v>" ~suf:"@]" ~sep:"@ " pp) res + +let () = Db.Main.extend all_sizes diff --git a/doc/Makefile b/doc/Makefile index 14e091e2375a7000219798aa05b1df474312e02d..a29fe1ca1d014262a34e97433c96aaf8441acc3d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/doc/build-manuals.sh b/doc/build-manuals.sh index 48bae4580078ed0ce401e3f8170ccfc0cc36264e..34ed7db7d6581cf925513a2892991e253c196884 100755 --- a/doc/build-manuals.sh +++ b/doc/build-manuals.sh @@ -5,10 +5,10 @@ cd $(dirname $0) set -e build () { - if test -z "$2" ; then export NAME=$1; else export NAME=$2; fi + if test -z "$2" ; then export NAME="$1"; else export NAME="$2"; fi echo "##### Building $NAME" cd $1 - make || (echo "######### $NAME failed" ; exit 1) + make $3 || (echo "######### $NAME failed" ; exit 1) make install echo "##### $NAME done" cd .. @@ -23,10 +23,16 @@ build rte build aorai build metrics build value -build acsl +build acsl "ACSL manuals" all cd ../src/plugins/wp/doc/ build manual WP -cd ../ +cd ../../e-acsl/doc + +build userman "E-ACSL userman" + +build refman "E-ACSL reference" + +cd ../../../.. diff --git a/doc/code/docgen.ml b/doc/code/docgen.ml index 153a96efad400160d4e9473b2d8cbad3025e82df..348c87aebe38c0822aa13bf4e6fa023415e86c6b 100644 --- a/doc/code/docgen.ml +++ b/doc/code/docgen.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/doc/code/intro_kernel_plugin.txt b/doc/code/intro_kernel_plugin.txt index a9982d4079fb1081b4f975da1059bbd80f2ac63e..d7dfa3473fc3c4c982a3547c75fd5f293758810d 100644 --- a/doc/code/intro_kernel_plugin.txt +++ b/doc/code/intro_kernel_plugin.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_occurrence.txt b/doc/code/intro_occurrence.txt index 33a4b39cf7eb3e30da4cfaf652a130504b2aaeb7..677af7ae7a8c4f23349b1710f247af812aa87711 100644 --- a/doc/code/intro_occurrence.txt +++ b/doc/code/intro_occurrence.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_pdg.txt b/doc/code/intro_pdg.txt index 9b86fcc14d2fce4bd6eeec9f077bcad6a526d810..d34c0ad7b616f2999eb177a983fb99741999d8d9 100644 --- a/doc/code/intro_pdg.txt +++ b/doc/code/intro_pdg.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_plugin.txt b/doc/code/intro_plugin.txt index 6ff29c7b6e9bf7a3cf4ef36d009f28101e0becc4..e0cabc354b9336d8d70d1f209b6fdbf6e1bce241 100644 --- a/doc/code/intro_plugin.txt +++ b/doc/code/intro_plugin.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_plugin_D_and_S.txt b/doc/code/intro_plugin_D_and_S.txt index bd73e1996be0b0cb8a15a9c31e6080172f5562c7..8b9637e9b20f5f3ebdee4ab5afd3da4f49cbf191 100644 --- a/doc/code/intro_plugin_D_and_S.txt +++ b/doc/code/intro_plugin_D_and_S.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_plugin_default.txt b/doc/code/intro_plugin_default.txt index 490245a28df4142f7d32323d1e26468039d8cad3..443b2d5c620089d241258304f005436df9361c18 100644 --- a/doc/code/intro_plugin_default.txt +++ b/doc/code/intro_plugin_default.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_scope.txt b/doc/code/intro_scope.txt index 13cbfc549e8c38abe4973d263746beb8b924aed0..9763f04ea7492e41296356dc6bec6392be5aa674 100644 --- a/doc/code/intro_scope.txt +++ b/doc/code/intro_scope.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_slicing.txt b/doc/code/intro_slicing.txt index 91d69812dc8d7bdab2c7d7806c81cccffff71879..73d90281bf7189fca9a0e37c91fbc28bae52b5a9 100644 --- a/doc/code/intro_slicing.txt +++ b/doc/code/intro_slicing.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/intro_sparecode.txt b/doc/code/intro_sparecode.txt index 337585f39536a5921fd4668c24b0b4549874907f..cd15e5a1cc02ada43bd047724af0dd0a77833a09 100644 --- a/doc/code/intro_sparecode.txt +++ b/doc/code/intro_sparecode.txt @@ -2,7 +2,7 @@ #* # #* This file is part of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat à l'énergie atomique et aux énergies # #* alternatives) # #* # diff --git a/doc/code/style.css b/doc/code/style.css index 1c3a237ae739ef0ce2d62171324dd3a8bc76283f..f915b3a6d8201e53097bb40e5412f93f09543777 100644 --- a/doc/code/style.css +++ b/doc/code/style.css @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/doc/code/toc_head.htm b/doc/code/toc_head.htm index 5ba826fd8d02c7cb4f96e35b57d6ad6454625775..1bb7eb319ea17ec2b6c4db88e2018114d846a007 100644 --- a/doc/code/toc_head.htm +++ b/doc/code/toc_head.htm @@ -2,7 +2,7 @@ <!-- --> <!-- This file is part of Frama-C. --> <!-- --> -<!-- Copyright (C) 2007-2016 --> +<!-- Copyright (C) 2007-2017 --> <!-- CEA (Commissariat à l'énergie atomique et aux énergies --> <!-- alternatives) --> <!-- --> diff --git a/doc/code/toc_tail.htm b/doc/code/toc_tail.htm index b685033647126427f41c05b86f1e28e25edd1659..1c69e1372a691a8a97288f225b428e337dc90630 100644 --- a/doc/code/toc_tail.htm +++ b/doc/code/toc_tail.htm @@ -2,7 +2,7 @@ <!-- --> <!-- This file is part of Frama-C. --> <!-- --> -<!-- Copyright (C) 2007-2016 --> +<!-- Copyright (C) 2007-2017 --> <!-- CEA (Commissariat à l'énergie atomique et aux énergies --> <!-- alternatives) --> <!-- --> @@ -23,7 +23,7 @@ </ul> <div class="copyright"> <a href="http://frama-c.com">frama-c.com</a><br> -© 2007-2012 CEA-LIST +© 2007-2017 CEA-LIST </div> </body> </html> diff --git a/doc/developer/Makefile b/doc/developer/Makefile index 430e3c1ffcf67da9a318b149cc4aa8f79a61d7eb..4ef8d163f9be16e4ec10bc95145b40bd1cd95d40 100644 --- a/doc/developer/Makefile +++ b/doc/developer/Makefile @@ -11,8 +11,6 @@ # # ########################################################################## -# mlpost > 0.8 (i.e. git repository) is required - include ./Makefile.config SRC = developer \ @@ -29,9 +27,7 @@ GENERATED= tutorial/viewcfg/generated tutorial/hello/generated \ examples/generated/callstack.ml \ examples/generated/use_callstack.ml \ examples/generated/syntactic_check.ml -DEPENDENCIES= $(FRAMAC_MODERN) $(GENERATED) \ - plugin_mpost.mps integrated_plugin.mps architecture.mps makefiles.mps \ - frama-c-book.cls +DEPENDENCIES= $(FRAMAC_MODERN) $(GENERATED) frama-c-book.cls .PHONY: all check @@ -69,14 +65,7 @@ check-all: developer.pdf include ../MakeLaTeXModern developer.pdf: $(SRC) ../../VERSION $(DEPENDENCIES) - # not currently useful; substitute '`' which is interpreted by - # lstlistings (and occurs e.g. in polymorphic variants), by µ - # $(ISED) -e "s/\`/µ/g" hello_world/hello_world.ml - # [JS] latexmk and rubber crash on my computer - #latexmk -pdf developer.tex - #rubber developer.tex - texi2pdf developer.tex - pdflatex developer.tex + $(MAKEPDF) developer.tex install: rm -f ../manuals/plugin-development-guide.pdf @@ -99,20 +88,6 @@ examples/generated/%.ml: examples/%.ml include $(MAKECONFIG_DIR)/Makefile.generic -.SUFFIXES: .fig .pdf .eps .mll .ml .mps - -#MLPOST is a conditional variable. -ifneq ($(MLPOST),) -.ml.mps: - $(MLPOST) -mps $< - $(RM) $(<:.ml=.cm*) - -else - -$(info Warning: Mlpost is not installed so we use the one versionned. If you want to modify them. Please install the git version of mlpost before generating the manual) - -endif - ########### clean: @@ -120,7 +95,6 @@ clean: rm -rf _whizzy* *.raux *.wdvi *.out rm -f *.haux *.htoc rm -rf $(GENERATED) - rm -f _mlpost* *.cm* distclean dist-clean: clean rm -f $(filter-out mecanism.pdf, $(wildcard *.pdf)) diff --git a/doc/developer/Makefile.config b/doc/developer/Makefile.config index 71c607586c5ebd83e7573895bd3b7b676cc18c97..3554aba0cc6eb7bbd749f8060ca8c2c9d60a53a2 100644 --- a/doc/developer/Makefile.config +++ b/doc/developer/Makefile.config @@ -1,7 +1,4 @@ MAKECONFIG_DIR=../../share include $(MAKECONFIG_DIR)/Makefile.common -MLPOST_EXEC:=$(shell which mlpost) -MLPOST ?= $(MLPOST_EXEC) -# mlpost is available at http://mlpost.lri.fr. -# The git version is required +MAKEPDF ?= latexmk -pdf -quiet FRAMAC_VERSION=$(shell $(SED) -e 's/\\(.*\\)/\\1/' ../../VERSION) diff --git a/doc/developer/advance.tex b/doc/developer/advance.tex index 80069ced15695542ba885ea90e0b044c2ad9559c..bf508601b770a837672f8f9172d8cdb52f77ed19 100644 --- a/doc/developer/advance.tex +++ b/doc/developer/advance.tex @@ -1,6 +1,5 @@ -%; whizzy-master "developpeur.tex" %%% Local Variables: -%%% TeX-master: "main" +%%% TeX-master: "developer.tex" %%% ispell-local-dictionary: "english" %%% End: @@ -423,102 +422,8 @@ If you wish the exact command line, you have to set variable \texttt{VERBOSEMAKE}\codeidxdef{VERBOSEMAKE} to \texttt{yes} like below. \begin{shell} \$ make VERBOSEMAKE=yes src/kernel_services/plugin_entry_points/db.cmo -ocamlc.opt -c -w +a-3-4-6-9-41-44-45-48 -annot -bin-annot -warn-error -+a-3-32-33-34-35-36-37-38-39 -g -I src/plugins/slicing_types --I src/plugins/pdg_types -I src/libraries/stdlib -I src/libraries/utils --I src/libraries/project -I src/libraries/datatype --I src/kernel_internals/src2cabs -I src/kernel_internals/cabs2cil --I src/kernel_internals/runtime -I src/kernel_services/ast --I src/kernel_services/untyped_ast -I src/kernel_services/ast_printing --I src/kernel_services/cmdline_parameters --I src/kernel_services/plugin_entry_points --I src/kernel_services/abstract_interp -I src/kernel_services/memory_state --I src/kernel_services/visitors -I src/kernel_services/analysis --I src/plugins/gui -I /localhome/virgile/Frama-C-rearchitecture/lib/plugins --I lib -I /opt/opam/4.02.1/lib/ocamlgraph --I /opt/opam/4.02.1/lib/zarith src/kernel_services/plugin_entry_points/db.ml \end{shell} -By default, warnings are considered as errors, but some of the new warnings of -\ocaml 4.00 are not. If you wish to make them errors as well, set variable -\texttt{WARN\_ERROR\_ALL}\codeidxdef{WARN\_ERROR\_ALL} to -yes\footnote{this has no effect if you use \ocaml 3.12.1} - -In order to integrate a new plug-in, you have to extend section -``Plug-ins''. For this purpose, you have to include -\texttt{share/Makefile.plugin} -for each new plug-in (hence there are as many lines -\texttt{include share/Makefile.plugin} as -plug-ins). \texttt{Makefile.plugin}\codeidxdef{Makefile.plugin} is a generic -makefile dedicated to plug-in compilation. Before its inclusion, a plug-in -developer can set some variables in order to customize its behavior. These -variables are fully described in Section~\ref{make:plugin}. - -\begin{important} - These variables must not be used anywhere else in - \texttt{Makefile}. Moreover, for setting them, you must use \texttt{:=} - and not \texttt{=}\footnotemark. -\end{important} -\footnotetext{Using \texttt{:=} only sets the variable value - from the affectation point (as usual in most programming languages) whereas - using \texttt{=} would redefine the variable value for each of its - occurrences in the makefile (see Section 6.2 ``The Two Flavors of - Variables'' of the GNU Make Manual~\cite{make}).} - -In addition, the results of the \texttt{configure} script must be -exported in \codeidx{Makefile.config.in}\texttt{share/Makefile.config.in} (see -section~\ref{make:sections}). You must in particular add a line of the -form -\codeidx{ENABLE\_$plugin$} -\begin{alltt} -ENABLE_\(plugin\)=@ENABLE_\(plugin\)@ -\end{alltt} -so that \texttt{make} will know whether the plug-in is supposed to -compiled or not. Other variables may be exported there as well -(\texttt{DYNAMIC\_$plugin$}, \texttt{HAS\_$library$}) if the -corresponding information is needed during compilation. - -\begin{example} - For compiling the plug-in \texttt{Rte}\index{Rte}, the following lines are - added into \texttt{Makefile}. - \codeidx{PLUGIN\_ENABLE} - \codeidx{PLUGIN\_NAME} - \codeidx{PLUGIN\_DIR} - \codeidx{PLUGIN\_CMO} - \codeidx{PLUGIN\_DISTRIBUTED} - \codeidx{PLUGIN\_INTERNAL\_TEST} - \codeidx{Makefile.plugin} -\begin{makefilecode} -################ -# RTE analysis # -################ -PLUGIN_ENABLE:=$(ENABLE_RTE_ANNOTATION) -PLUGIN_NAME:=RteGen -PLUGIN_DIR:=src/plugins/rte -PLUGIN_CMO:= rte_parameters rte register -PLUGIN_DISTRIBUTED:=yes -PLUGIN_INTERNAL_TEST:=yes -include share/Makefile.plugin -\end{makefilecode} -\end{example} -%$ Auctex is lost otherwise - -As said above, you cannot use the parameters of \texttt{Makefile.plugin} -anywhere in \texttt{Makefile}. You can yet use some plugin-in specific -variables once \texttt{Makefile.plugin} has been included. These variables are -detailed in Section~\ref{make:plugin}. - -One other variable has to be modified by a plug-in developer if he uses files -which do not belong to the plug-in directory (that is if variable -\texttt{PLUGIN\_TYPES\_CMO}\codeidx{PLUGIN\_TYPES\_CMO} is -set). This variable is -\texttt{FRAMAC\_SRC\_DIRS}\codeidxdef{FRAMAC\_SRC\_DIRS} and -corresponds to the list of non plug-in directories containing source files. - -\begin{important} -A plug-in developer should not have to modify any other part of any \framac -Makefile. -\end{important} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -604,7 +509,6 @@ the specific features of \texttt{Makefile.dynamic}. %% \begin{makefilecode} %% PLUGIN_ENABLE :=@ENABLE_LTL_TO_ACSL@ %% PLUGIN_DIR :=src/ltl_to_acsl -%% PLUGIN_DYNAMIC :=@DYNAMIC_LTL_TO_ACSL@ %% DISTRIB_FILES += $(PLUGIN_DIR)/Makefile %% include $(PLUGIN_DIR)/Makefile %% \end{makefilecode} @@ -640,8 +544,8 @@ In the second case, the plug-in is added to the list of external plug-ins at configure time. If the plug-in has its own configure, it is run as well. -Provided it properly uses the variables set by \texttt{Makefile.dynamic} and -\texttt{Makefile.plugin}, the plug-in's \texttt{Makefile} does not require +Provided it properly uses the variables set by \texttt{Makefile.dynamic}, +the plug-in's \texttt{Makefile} does not require specific adaptations depending on whether it is compiled together with the kernel or with respect to an already-existing \framac installation. It is however possible to check the compilation mode with the @@ -821,6 +725,27 @@ occurs currently in the following cases: \end{itemize} \end{important} +\begin{important} + \textbf{Concurrency issues:} + tests using compiled modules ({\tt -load-script} or {\tt -load-module}) may + lead to concurrency issues when the same module is used in different test + files, or in different test cases within the same file. One way to avoid + issues is to serialize tests via \texttt{EXECNOW} directives, e.g. by using + \texttt{make} to compile a \texttt{.cmxs} from the \texttt{.ml} file, and + then loading the \texttt{.cmxs} in the test cases, as in the example below. + + \begin{listing-nonumber} + EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs + STDOPT: #"-load-module @PTEST_DIR@/@PTEST_NAME.cmxs" ... + STDOPT: #"-load-module @PTEST_DIR@/@PTEST_NAME.cmxs" ... + \end{listing-nonumber} + + In addition, if the same script {\tt tests/suite/script.ml} + is shared by several test files, the {\tt EXECNOW} directive should be put + into {\tt tests/suite/test\_config}. + +\end{important} + \begin{example} Test \texttt{tests/sparecode/calls.c} declares the following directives. \sscodeidx{Test}{Directive}{OPT} @@ -1150,6 +1075,27 @@ or configuration file. \end{itemize} +\begin{important} + \textbf{Summary: ordering of test executions} + + There is no total ordering between the tests in a test file header. + The only guaranteed order between test executions is the following: + + \begin{enumerate} + \item \texttt{EXEC} and \texttt{EXECNOW} commands are executed sequentially, + from top to bottom. + \item Then, all \texttt{OPT}/\texttt{STDOPT} commands execute in an + unspecified order (possibly simultaneously). + \end{enumerate} + + A consequence of this ordering is that, if you need a test to produce output + that will be consumed by another test, the producer \emph{must} be defined via + \texttt{EXEC}/\texttt{EXECNOW} (e.g. using \texttt{@frama-c@} and explicitly + giving its arguments), while the consumer can be either in a later + \texttt{EXEC}/\texttt{EXECNOW}, or in a \texttt{OPT}/\texttt{STDOPT} + directive. +\end{important} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Plug-in General Services}\label{adv:plugin-services} @@ -3592,15 +3538,16 @@ preserved, and the mapping between the old nodes and their copy can be manipulated explicitly through the following functions: \begin{itemize} \item - \verb+reset_behavior_+\emph{name}\scodeidxdef{Cil}{reset\_behavior\_$name$} + \verb+reset_behavior_+\emph{name} + \scodeidxdef{Cil}{reset\_behavior\_varinfo} resets the mapping corresponding to the type \emph{name}. -\item \verb+get_original_+\emph{name}\scodeidxdef{Cil}{get\_original\_$name$} +\item \verb+get_original_+\emph{name}\scodeidxdef{Cil}{get\_original\_varinfo} gets the original value corresponding to a copy (and behaves as the identity if the given value is not known). -\item \verb+get_+\emph{name}\scodeidxdef{Cil}{get\_$name$} gets the copy +\item \verb+get_+\emph{name}\scodeidxdef{Cil}{get\_varinfo} gets the copy corresponding to an old value. If the given value is not known, it behaves as the identity. -\item \verb+set_+\emph{name}\scodeidxdef{Cil}{set\_$name$} sets a copy for a +\item \verb+set_+\emph{name}\scodeidxdef{Cil}{set\_varinfo} sets a copy for a given value. Be sure to use it before any occurrence of the old value has been copied, or sharing will be lost. \end{itemize} @@ -3761,17 +3708,17 @@ directly stored in the AST. These modules and functions are the following. \framac supports the possibility of adding specific ACSL annotations in the form of special clauses. Such clauses can be found in two places: in a contract, where they are -stored in the \texttt{b\_extended}\codeidx{b\_extended} field of +stored in the \texttt{b\_extended}\sscodeidx{Cil\_types}{behavior}{b\_extended} field of \texttt{Cil\_types.behavior}\scodeidx{Cil\_types.behavior}, or in a loop annotation, a special form of -\texttt{code\_annotation}\codeidx{code\_annotation} introduced by the +\texttt{code\_annotation}\scodeidx{Cil\_types}{code\_annotation} introduced by the \texttt{AExtended} constructor. Such annotations must be introduced by a keyword \texttt{kw} (or \texttt{loop kw} for loop annotations) that will be used to identify them -in the AST. An \texttt{acsl\_extension}\codeidx{acsl\_extension} is a pair +in the AST. An \texttt{acsl\_extension}\scodeidx{Cil\_types}{acsl\_extension} is a pair \texttt{(kw, ext)} where \texttt{kw} identifies the extension and ext is an -\texttt{acsl\_extension\_kind}\codeidx{acsl\_extension\_kind} and can take -three forms: +\texttt{acsl\_extension\_kind}\scodeidx{Cil\_types}{acsl\_extension\_kind} +and can take three forms: \begin{itemize} \item \texttt{Ext\_id id} with \texttt{id} an \texttt{int} that the plugin can use to refer to the annotation in its internal state. @@ -3885,7 +3832,7 @@ locations are also provided. Section~\ref{memory:map} introduces them. There are four different representations of \C locations. Actually only three are really relevant. All of them are defined in module \texttt{Locations}\codeidxdef{Locations}. They are introduced below. See the -documentation of \texttt{src/kernel\_services/memory\_state/locations.mli} +documentation of \texttt{src/kernel\_services/abstract\_interp/locations.mli} for details about the provided operations on these types. \begin{itemize} diff --git a/doc/developer/architecture.ml b/doc/developer/architecture.ml deleted file mode 100644 index f59bdd1b82a30337ec49171883b2b4f30d73c2f7..0000000000000000000000000000000000000000 --- a/doc/developer/architecture.ml +++ /dev/null @@ -1,148 +0,0 @@ -open Mlpost -open Box - -(* Some custom values *) - -let padding = Num.bp 15. -let big_padding = Num.bp 30. -let delta = Num.bp 5. -let big_delta = Num.bp 10. - -let big_title s = tex ("\\textbf{\\Large{" ^ s ^ "}}") -let small_title s = tex ("\\textbf{\\emph{\\large{" ^ s ^ "}}}") - -let external_color = Color.rgb8 255 165 0 -let framac_color = Color.rgb8 50 205 50 -let cil_color = Color.lightcyan -let plugin_color = Color.rgb8 250 128 114 -let libraries_color = Color.orange - -let std_box ?stroke ?color s = rect ~name:s ?stroke ?fill:color (tex s) -let mk_services ?(big=false) ?color title b = - round_rect - ?fill:color - ~name:title - ~dx:padding ~dy:(if big then big_delta else delta) - (vbox ~padding:(if big then Num.multn big_delta (Num.pt 1.5) else big_delta) - [ (if big then big_title else small_title) title; b ]) - -(* Internals *) - -let kernel_internals = - mk_services ~big:true ~color:cil_color - "Kernel Internals" - (hbox ~padding - [ std_box "parsing"; - std_box "typing"; - std_box "runtime" ]) - -(* Services *) - -let kernel_ast = - mk_services "ASTs" - (vbox ~padding - [ std_box "ast\\_data"; std_box "ast\\_queries"; std_box "parsetree" ]) - -let kernel_ai = - mk_services "AI" - (vbox ~padding [ std_box "memory\\_states"; std_box "abstract\\_interp" ]) - -let kernel_services = - mk_services "Plug-in Interactions" - (vbox ~padding - [ std_box "cmdline\\_parameters"; - std_box "plugin\\_entry\\_points" ]) - -let kernel_trip_name = "AST Traversal" - -let kernel_trip = - mk_services kernel_trip_name - (vbox ~padding - [ std_box "visitor"; - hbox ~padding [ std_box "analysis"; - std_box "ast\\_transformations" ] ]) - -let kernel_services = - mk_services ~big:true "Kernel Services" ~color:framac_color - (hbox ~padding - [ vbox ~padding [ kernel_trip; kernel_ai ]; - vbox ~padding [ kernel_ast; kernel_services ] ]) - -(* Plugins *) - -let plugins = - mk_services ~big:true "Plug-ins" ~color:plugin_color - (hbox ~padding:big_padding - [ std_box "plug-in 1"; - std_box "plug-in 2"; - std_box ~stroke:None "\\dots"; - std_box "plug-in $n$" ]) - -(* Libraries *) - -let libraries = - mk_services ~big:true "Libraries" ~color:libraries_color - (vbox ~padding:big_padding - [ std_box "stdlib"; - hbox ~padding [ std_box "datatype"; std_box "project" ]; - std_box "utils" ]) - -(* Global figure *) - -let figure = - vbox ~padding:big_padding - [ plugins; - hbox ~padding:big_padding [ kernel_services; libraries ]; - kernel_internals ] - -let arrow ?(big=false) ?ind ?style src dst = - let getf s = get s figure in - let src = getf src in - let dst = getf dst in - if big then - Helpers.box_arrow ?ind ?style ~color:Color.red ~pen:Pen.circle src dst - else - Helpers.box_arrow ?ind ?style src dst - -let cmds = - let style = Path.jTension 2.5 2.5 in - let up = Path.vec Point.up in - let down = Path.vec Point.down in - let left = Path.vec Point.left in - Command.seq - [ - draw figure; - arrow "ast\\_queries" "ast\\_data"; - arrow "memory\\_states" "abstract\\_interp"; - arrow "analysis" "visitor"; - arrow "ast\\_transformations" "visitor"; - arrow ~ind:left ~style:(Path.jTension 0.8 0.8) "utils" "stdlib"; - arrow "project" "stdlib"; - arrow "datatype" "stdlib"; - arrow "project" "datatype"; - arrow "datatype" "utils"; - arrow "project" "utils"; - arrow "utils" "datatype"; - arrow "stdlib" "datatype"; - arrow ~ind:down ~style "plug-in 1" "plug-in 2"; - arrow ~ind:down ~style "plug-in 2" "\\dots"; - arrow ~ind:down ~style "\\dots" "plug-in $n$"; - arrow ~ind:up ~style "plug-in 2" "plug-in 1"; - arrow ~ind:up ~style "plug-in $n$" "\\dots"; - arrow ~ind:up ~style "\\dots" "plug-in 2"; - arrow ~big:true "AI" "ASTs"; - arrow ~big:true "AI" "Plug-in Interactions"; - arrow ~big:true "Plug-in Interactions" "ASTs"; - arrow ~big:true "ASTs" "Plug-in Interactions"; - arrow ~big:true kernel_trip_name "Plug-in Interactions"; - arrow ~big:true kernel_trip_name "ASTs"; - (* inter-services arrow *) - arrow ~big:true "Plug-ins" "Kernel Services"; - arrow ~big:true "Kernel Internals" "Kernel Services" ; - arrow ~big:true "Kernel Services" "Kernel Internals" ; - arrow ~ind:(Path.vec Point.up) ~big:true "Kernel Internals" "Libraries"; - arrow ~big:true "Kernel Services" "Libraries"; - arrow ~ind:(Path.vec Point.down) ~big:true "Plug-ins" "Libraries"; - ] - -let _ = Metapost.emit "architecture" cmds diff --git a/doc/developer/architecture.mps b/doc/developer/architecture.mps deleted file mode 100644 index d6b0ccf191af3975af4f900343f35a2709133d72..0000000000000000000000000000000000000000 --- a/doc/developer/architecture.mps +++ /dev/null @@ -1,106 +0,0 @@ -%!PS -%%BoundingBox: -243.000000 -430.000000 300.000000 23.000000 -%%HiResBoundingBox: -242.136051 -429.357807 299.876014 22.212605 -%%Creator: Mlpost current -%%Pages: 1 -%*Font: cmbx12 12.000000 14.346167 2d:8 -%*Font: cmbxti10 10.000000 11.955144 2d:8 -%*Font: cmmi10 10.000000 9.962620 6e:8 -%*Font: cmr10 10.000000 9.962620 2d:cc -%%BeginProlog -%%EndProlog -%%Page: 1 1 -0 0.5 dtransform truncate idtransform setlinewidth pop 1 setlinecap 1 setlinejoin gsave 0.9804 0.502 0.4471 setrgbcolor newpath -105.5 21.96 moveto -15.6 21.96 73.34 21.96 163.3 21.96 curveto 167.1 21.96 170.1 18.89 170.1 15.11 curveto 170.1 -3.506 170.1 -21.12 170.1 -39.73 curveto 170.1 -43.52 167.1 -46.59 163.3 -46.59 curveto 73.34 -46.59 -15.6 -46.59 -105.5 -46.59 curveto -109.3 -46.59 -112.4 -43.52 -112.4 -39.73 curveto -112.4 -21.12 -112.4 -3.506 -112.4 15.11 curveto -112.4 18.89 -109.3 21.96 -105.5 21.96 curveto close_path fill - grestore gsave 0 setgray 0 0 moveto (\120\154\165\147\055\151\156\163) cmbx12 14.35 fshow grestore gsave [1 0 0 1 -93.39 -30.65] concat 0 setgray 33.76 0 moveto (\061) cmr10 9.963 fshow grestore gsave [1 0 0 1 -93.39 -30.65] concat 0 setgray 0 0 moveto (\160\154\165\147\055\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -50.64 -36.59 moveto -50.64 -30.64 -50.64 -25.69 -50.64 -19.73 curveto -66.56 -19.73 -81.47 -19.73 -97.39 -19.73 curveto -97.39 -25.69 -97.39 -30.64 -97.39 -36.59 curveto -81.47 -36.59 -66.56 -36.59 -50.64 -36.59 curveto close_path stroke - grestore gsave [1 0 0 1 -16.64 -30.65] concat 0 setgray 33.76 0 moveto (\062) cmr10 9.963 fshow grestore gsave [1 0 0 1 -16.64 -30.65] concat 0 setgray 0 0 moveto (\160\154\165\147\055\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 26.1 -36.59 moveto 26.1 -30.64 26.1 -25.69 26.1 -19.73 curveto 10.19 -19.73 -4.728 -19.73 -20.64 -19.73 curveto -20.64 -25.69 -20.64 -30.64 -20.64 -36.59 curveto -4.728 -36.59 10.19 -36.59 26.1 -36.59 curveto close_path stroke - grestore gsave [1 0 0 1 60.1 -28.69] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 60.1 -28.69] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 60.1 -28.69] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 111.4 -30.65] concat 0 setgray 33.76 0 moveto (\156) cmmi10 9.963 fshow grestore gsave [1 0 0 1 111.4 -30.65] concat 0 setgray 0 0 moveto (\160\154\165\147\055\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 155.1 -36.59 moveto 155.1 -30.64 155.1 -25.69 155.1 -19.73 curveto 138.9 -19.73 123.6 -19.73 107.4 -19.73 curveto 107.4 -25.69 107.4 -30.64 107.4 -36.59 curveto 123.6 -36.59 138.9 -36.59 155.1 -36.59 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -105.5 21.96 moveto -15.6 21.96 73.34 21.96 163.3 21.96 curveto 167.1 21.96 170.1 18.89 170.1 15.11 curveto 170.1 -3.506 170.1 -21.12 170.1 -39.73 curveto 170.1 -43.52 167.1 -46.59 163.3 -46.59 curveto 73.34 -46.59 -15.6 -46.59 -105.5 -46.59 curveto -109.3 -46.59 -112.4 -43.52 -112.4 -39.73 curveto -112.4 -21.12 -112.4 -3.506 -112.4 15.11 curveto -112.4 18.89 -109.3 21.96 -105.5 21.96 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath -216.2 -76.59 moveto -105.9 -76.59 3.413 -76.59 113.7 -76.59 curveto 127.9 -76.59 139.4 -88.1 139.4 -102.3 curveto 139.4 -171.2 139.4 -239 139.4 -307.9 curveto 139.4 -322.1 127.9 -333.6 113.7 -333.6 curveto 3.413 -333.6 -105.9 -333.6 -216.2 -333.6 curveto -230.4 -333.6 -241.9 -322.1 -241.9 -307.9 curveto -241.9 -239 -241.9 -171.2 -241.9 -102.3 curveto -241.9 -88.1 -230.4 -76.59 -216.2 -76.59 curveto close_path fill - grestore gsave [1 0 0 1 -106 -98.55] concat 0 setgray 52.79 0 moveto (\123\145\162\166\151\143\145\163) cmbx12 14.35 fshow grestore gsave [1 0 0 1 -106 -98.55] concat 0 setgray 0 0 moveto (\113\145\162\156\145\154) cmbx12 14.35 fshow grestore gsave [1 0 0 1 -181.8 -147.9] concat 0 setgray 46.35 0 moveto (\141\166\145\162\163\141\154) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -181.8 -147.9] concat 0 setgray 41.05 0 moveto (\162) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -181.8 -147.9] concat 0 setgray 32.59 0 moveto (\124) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -181.8 -147.9] concat 0 setgray 0 0 moveto (\101\123\124) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -150.6 -170.5] concat 0 setgray 0 0 moveto (\166\151\163\151\164\157\162) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -119.1 -174.5 moveto -119.1 -169.3 -119.1 -165.1 -119.1 -159.9 curveto -131.3 -159.9 -142.4 -159.9 -154.6 -159.9 curveto -154.6 -165.1 -154.6 -169.3 -154.6 -174.5 curveto -142.4 -174.5 -131.3 -174.5 -119.1 -174.5 curveto close_path stroke - grestore gsave [1 0 0 1 -207.9 -200.5] concat 0 setgray 0 0 moveto (\141\156\141\154\171\163\151\163) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -169.7 -206.4 moveto -169.7 -200.4 -169.7 -195.5 -169.7 -189.5 curveto -184.1 -189.5 -197.5 -189.5 -211.9 -189.5 curveto -211.9 -195.5 -211.9 -200.4 -211.9 -206.4 curveto -197.5 -206.4 -184.1 -206.4 -169.7 -206.4 curveto close_path stroke - grestore gsave [1 0 0 1 -150.7 -201.4] concat 0 setgray 16.37 0 moveto (\164\162\141\156\163\146\157\162\155\141\164\151\157\156\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 -150.7 -201.4] concat 0 setgray newpath 13.38 0.3985 moveto 16.37 0.3985 lineto 16.37 0.797 lineto 13.38 0.797 lineto close_path fill grestore gsave [1 0 0 1 -150.7 -201.4] concat 0 setgray 0 0 moveto (\141\163\164) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -61.84 -205.4 moveto -61.84 -200.1 -61.84 -195.8 -61.84 -190.5 curveto -93.14 -190.5 -123.4 -190.5 -154.7 -190.5 curveto -154.7 -195.8 -154.7 -200.1 -154.7 -205.4 curveto -123.4 -205.4 -93.14 -205.4 -61.84 -205.4 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -219 -132.6 moveto -163.9 -132.6 -109.8 -132.6 -54.72 -132.6 curveto -50.37 -132.6 -46.84 -136.1 -46.84 -140.5 curveto -46.84 -161.8 -46.84 -182.2 -46.84 -203.5 curveto -46.84 -207.9 -50.37 -211.4 -54.72 -211.4 curveto -109.8 -211.4 -163.9 -211.4 -219 -211.4 curveto -223.4 -211.4 -226.9 -207.9 -226.9 -203.5 curveto -226.9 -182.2 -226.9 -161.8 -226.9 -140.5 curveto -226.9 -136.1 -223.4 -132.6 -219 -132.6 curveto close_path stroke - grestore gsave [1 0 0 1 -145.8 -241.6] concat 0 setgray 0 0 moveto (\101\111) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -168.8 -263.7] concat 0 setgray 38.76 0 moveto (\163\164\141\164\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 -168.8 -263.7] concat 0 setgray newpath 35.77 0.3985 moveto 38.76 0.3985 lineto 38.76 0.797 lineto 35.77 0.797 lineto close_path fill grestore gsave [1 0 0 1 -168.8 -263.7] concat 0 setgray 0 0 moveto (\155\145\155\157\162\171) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -101 -269.7 moveto -101 -264 -101 -259.3 -101 -253.6 curveto -125.2 -253.6 -148.5 -253.6 -172.8 -253.6 curveto -172.8 -259.3 -172.8 -264 -172.8 -269.7 curveto -148.5 -269.7 -125.2 -269.7 -101 -269.7 curveto close_path stroke - grestore gsave [1 0 0 1 -169.3 -295.6] concat 0 setgray 47.12 0 moveto (\164\145\162\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 -169.3 -295.6] concat 0 setgray 39.09 0 moveto (\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 -169.3 -295.6] concat 0 setgray newpath 36.1 0.3985 moveto 39.09 0.3985 lineto 39.09 0.797 lineto 36.1 0.797 lineto close_path fill grestore gsave [1 0 0 1 -169.3 -295.6] concat 0 setgray 0 0 moveto (\141\142\163\164\162\141\143\164) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -100.4 -301.5 moveto -100.4 -295.6 -100.4 -290.6 -100.4 -284.7 curveto -125.1 -284.7 -148.7 -284.7 -173.3 -284.7 curveto -173.3 -290.6 -173.3 -295.6 -173.3 -301.5 curveto -148.7 -301.5 -125.1 -301.5 -100.4 -301.5 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -180.3 -226.4 moveto -151 -226.4 -122.7 -226.4 -93.45 -226.4 curveto -89.02 -226.4 -85.44 -230 -85.44 -234.4 curveto -85.44 -256.1 -85.44 -276.8 -85.44 -298.5 curveto -85.44 -302.9 -89.02 -306.5 -93.45 -306.5 curveto -122.7 -306.5 -151 -306.5 -180.3 -306.5 curveto -184.7 -306.5 -188.3 -302.9 -188.3 -298.5 curveto -188.3 -276.8 -188.3 -256.1 -188.3 -234.4 curveto -188.3 -230 -184.7 -226.4 -180.3 -226.4 curveto close_path stroke - grestore gsave [1 0 0 1 29.07 -130.7] concat 0 setgray 0 0 moveto (\101\123\124\163) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 28.41 -153.6] concat 0 setgray 16.37 0 moveto (\144\141\164\141) cmr10 9.963 fshow grestore gsave [1 0 0 1 28.41 -153.6] concat 0 setgray newpath 13.38 0.3985 moveto 16.37 0.3985 lineto 16.37 0.797 lineto 13.38 0.797 lineto close_path fill grestore gsave [1 0 0 1 28.41 -153.6] concat 0 setgray 0 0 moveto (\141\163\164) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 68.16 -157.6 moveto 68.16 -152.3 68.16 -148 68.16 -142.7 curveto 53.24 -142.7 39.33 -142.7 24.41 -142.7 curveto 24.41 -148 24.41 -152.3 24.41 -157.6 curveto 39.33 -157.6 53.24 -157.6 68.16 -157.6 curveto close_path stroke - grestore gsave [1 0 0 1 22.98 -183.3] concat 0 setgray 16.37 0 moveto (\161\165\145\162\151\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 22.98 -183.3] concat 0 setgray newpath 13.38 0.3985 moveto 16.37 0.3985 lineto 16.37 0.797 lineto 13.38 0.797 lineto close_path fill grestore gsave [1 0 0 1 22.98 -183.3] concat 0 setgray 0 0 moveto (\141\163\164) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 73.59 -189.2 moveto 73.59 -183.3 73.59 -178.5 73.59 -172.6 curveto 55.05 -172.6 37.51 -172.6 18.98 -172.6 curveto 18.98 -178.5 18.98 -183.3 18.98 -189.2 curveto 37.51 -189.2 55.05 -189.2 73.59 -189.2 curveto close_path stroke - grestore gsave [1 0 0 1 26.58 -214.3] concat 0 setgray 0 0 moveto (\160\141\162\163\145\164\162\145\145) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 69.99 -220.3 moveto 69.99 -214.6 69.99 -209.9 69.99 -204.2 curveto 53.85 -204.2 38.72 -204.2 22.58 -204.2 curveto 22.58 -209.9 22.58 -214.6 22.58 -220.3 curveto 38.72 -220.3 53.85 -220.3 69.99 -220.3 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 12.44 -115.5 moveto 35.34 -115.5 57.23 -115.5 80.13 -115.5 curveto 84.81 -115.5 88.59 -119.3 88.59 -124 curveto 88.59 -155.2 88.59 -185.5 88.59 -216.8 curveto 88.59 -221.5 84.81 -225.3 80.13 -225.3 curveto 57.23 -225.3 35.34 -225.3 12.44 -225.3 curveto 7.764 -225.3 3.975 -221.5 3.975 -216.8 curveto 3.975 -185.5 3.975 -155.2 3.975 -124 curveto 3.975 -119.3 7.764 -115.5 12.44 -115.5 curveto close_path stroke - grestore gsave [1 0 0 1 -14.84 -255.6] concat 0 setgray 78.34 0 moveto (\141\143\164\151\157\156\163) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -14.84 -255.6] concat 0 setgray 48.67 0 moveto (\111\156\164\145\162) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 -14.84 -255.6] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbxti10 11.96 fshow grestore gsave [1 0 0 1 3.479 -280.8] concat 0 setgray 37.35 0 moveto (\160\141\162\141\155\145\164\145\162\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 3.479 -280.8] concat 0 setgray newpath 34.36 0.3985 moveto 37.35 0.3985 lineto 37.35 0.797 lineto 34.36 0.797 lineto close_path fill grestore gsave [1 0 0 1 3.479 -280.8] concat 0 setgray 0 0 moveto (\143\155\144\154\151\156\145) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 93.09 -286.8 moveto 93.09 -280.8 93.09 -275.9 93.09 -269.9 curveto 61.55 -269.9 31.02 -269.9 -0.5212 -269.9 curveto -0.5212 -275.9 -0.5212 -280.8 -0.5212 -286.8 curveto 31.02 -286.8 61.55 -286.8 93.09 -286.8 curveto close_path stroke - grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray 75.83 0 moveto (\164\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray 62.83 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray 57.01 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray newpath 54.03 0.3985 moveto 57.01 0.3985 lineto 57.01 0.797 lineto 54.03 0.797 lineto close_path fill grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray 40.39 0 moveto (\164\162\171) cmr10 9.963 fshow grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray 30.71 0 moveto (\145\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray newpath 27.72 0.3985 moveto 30.71 0.3985 lineto 30.71 0.797 lineto 27.72 0.797 lineto close_path fill grestore gsave [1 0 0 1 4.467 -312.7] concat 0 setgray 0 0 moveto (\160\154\165\147\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 92.1 -318.6 moveto 92.1 -312.7 92.1 -307.7 92.1 -301.8 curveto 61.22 -301.8 31.35 -301.8 0.4667 -301.8 curveto 0.4667 -307.7 0.4667 -312.7 0.4667 -318.6 curveto 31.35 -318.6 61.22 -318.6 92.1 -318.6 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -23.51 -240.3 moveto 23.35 -240.3 69.22 -240.3 116.1 -240.3 curveto 120.7 -240.3 124.4 -244 124.4 -248.6 curveto 124.4 -271.2 124.4 -292.7 124.4 -315.3 curveto 124.4 -319.9 120.7 -323.6 116.1 -323.6 curveto 69.22 -323.6 23.35 -323.6 -23.51 -323.6 curveto -28.11 -323.6 -31.84 -319.9 -31.84 -315.3 curveto -31.84 -292.7 -31.84 -271.2 -31.84 -248.6 curveto -31.84 -244 -28.11 -240.3 -23.51 -240.3 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -216.2 -76.59 moveto -105.9 -76.59 3.413 -76.59 113.7 -76.59 curveto 127.9 -76.59 139.4 -88.1 139.4 -102.3 curveto 139.4 -171.2 139.4 -239 139.4 -307.9 curveto 139.4 -322.1 127.9 -333.6 113.7 -333.6 curveto 3.413 -333.6 -105.9 -333.6 -216.2 -333.6 curveto -230.4 -333.6 -241.9 -322.1 -241.9 -307.9 curveto -241.9 -239 -241.9 -171.2 -241.9 -102.3 curveto -241.9 -88.1 -230.4 -76.59 -216.2 -76.59 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 182.4 -127.3 moveto 217.5 -127.3 251.5 -127.3 286.6 -127.3 curveto 293.8 -127.3 299.6 -133.1 299.6 -140.3 curveto 299.6 -183.8 299.6 -226.4 299.6 -269.9 curveto 299.6 -277.1 293.8 -282.9 286.6 -282.9 curveto 251.5 -282.9 217.5 -282.9 182.4 -282.9 curveto 175.2 -282.9 169.4 -277.1 169.4 -269.9 curveto 169.4 -226.4 169.4 -183.8 169.4 -140.3 curveto 169.4 -133.1 175.2 -127.3 182.4 -127.3 curveto close_path fill - grestore gsave [1 0 0 1 203.3 -149.3] concat 0 setgray 0 0 moveto (\114\151\142\162\141\162\151\145\163) cmbx12 14.35 fshow grestore gsave [1 0 0 1 222.3 -177.1] concat 0 setgray 0 0 moveto (\163\164\144\154\151\142) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 250.7 -181.1 moveto 250.7 -175.8 250.7 -171.5 250.7 -166.2 curveto 239.6 -166.2 229.5 -166.2 218.3 -166.2 curveto 218.3 -171.5 218.3 -175.8 218.3 -181.1 curveto 229.5 -181.1 239.6 -181.1 250.7 -181.1 curveto close_path stroke - grestore gsave [1 0 0 1 188.4 -222] concat 0 setgray 34.04 0 moveto (\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 188.4 -222] concat 0 setgray 22.97 0 moveto (\171\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 188.4 -222] concat 0 setgray 0 0 moveto (\144\141\164\141\164) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 230.9 -228 moveto 230.9 -222 230.9 -217.1 230.9 -211.1 curveto 215.1 -211.1 200.2 -211.1 184.4 -211.1 curveto 184.4 -217.1 184.4 -222 184.4 -228 curveto 200.2 -228 215.1 -228 230.9 -228 curveto close_path stroke - grestore gsave [1 0 0 1 249.9 -221.9] concat 0 setgray 14.97 0 moveto (\152\145\143\164) cmr10 9.963 fshow grestore gsave [1 0 0 1 249.9 -221.9] concat 0 setgray 0 0 moveto (\160\162\157) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 284.6 -227.8 moveto 284.6 -222 284.6 -217.1 284.6 -211.3 curveto 271.4 -211.3 259.1 -211.3 245.9 -211.3 curveto 245.9 -217.1 245.9 -222 245.9 -227.8 curveto 259.1 -227.8 271.4 -227.8 284.6 -227.8 curveto close_path stroke - grestore gsave [1 0 0 1 225.1 -268.9] concat 0 setgray 0 0 moveto (\165\164\151\154\163) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 248 -272.9 moveto 248 -267.6 248 -263.3 248 -258 curveto 238.7 -258 230.4 -258 221.1 -258 curveto 221.1 -263.3 221.1 -267.6 221.1 -272.9 curveto 230.4 -272.9 238.7 -272.9 248 -272.9 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 182.4 -127.3 moveto 217.5 -127.3 251.5 -127.3 286.6 -127.3 curveto 293.8 -127.3 299.6 -133.1 299.6 -140.3 curveto 299.6 -183.8 299.6 -226.4 299.6 -269.9 curveto 299.6 -277.1 293.8 -282.9 286.6 -282.9 curveto 251.5 -282.9 217.5 -282.9 182.4 -282.9 curveto 175.2 -282.9 169.4 -277.1 169.4 -269.9 curveto 169.4 -226.4 169.4 -183.8 169.4 -140.3 curveto 169.4 -133.1 175.2 -127.3 182.4 -127.3 curveto close_path stroke - grestore gsave 0.8784 1 1 setrgbcolor newpath -53.27 -363.6 moveto 1.825 -363.6 55.92 -363.6 111 -363.6 curveto 114.6 -363.6 117.6 -366.5 117.6 -370.2 curveto 117.6 -388 117.6 -404.8 117.6 -422.6 curveto 117.6 -426.2 114.6 -429.1 111 -429.1 curveto 55.92 -429.1 1.825 -429.1 -53.27 -429.1 curveto -56.88 -429.1 -59.82 -426.2 -59.82 -422.6 curveto -59.82 -404.8 -59.82 -388 -59.82 -370.2 curveto -59.82 -366.5 -56.88 -363.6 -53.27 -363.6 curveto close_path fill - grestore gsave [1 0 0 1 -28.73 -385.6] concat 0 setgray 67.31 0 moveto (\164\145\162\156\141\154\163) cmbx12 14.35 fshow grestore gsave [1 0 0 1 -28.73 -385.6] concat 0 setgray 52.79 0 moveto (\111\156) cmbx12 14.35 fshow grestore gsave [1 0 0 1 -28.73 -385.6] concat 0 setgray 0 0 moveto (\113\145\162\156\145\154) cmbx12 14.35 fshow grestore gsave [1 0 0 1 -40.82 -413.2] concat 0 setgray 0 0 moveto (\160\141\162\163\151\156\147) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -5.185 -419.1 moveto -5.185 -413.2 -5.185 -408.4 -5.185 -402.5 curveto -18.73 -402.5 -31.27 -402.5 -44.82 -402.5 curveto -44.82 -408.4 -44.82 -413.2 -44.82 -419.1 curveto -31.27 -419.1 -18.73 -419.1 -5.185 -419.1 curveto close_path stroke - grestore gsave [1 0 0 1 13.82 -413.2] concat 0 setgray 3.598 0 moveto (\171\160\151\156\147) cmr10 9.963 fshow grestore gsave [1 0 0 1 13.82 -413.2] concat 0 setgray 0 0 moveto (\164) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 45.49 -419.1 moveto 45.49 -413.2 45.49 -408.4 45.49 -402.5 curveto 33.26 -402.5 22.04 -402.5 9.815 -402.5 curveto 9.815 -408.4 9.815 -413.2 9.815 -419.1 curveto 22.04 -419.1 33.26 -419.1 45.49 -419.1 curveto close_path stroke - grestore gsave [1 0 0 1 64.49 -414.1] concat 0 setgray 14.69 0 moveto (\164\151\155\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 64.49 -414.1] concat 0 setgray 0 0 moveto (\162\165\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 102.6 -418.1 moveto 102.6 -412.9 102.6 -408.7 102.6 -403.5 curveto 88.2 -403.5 74.84 -403.5 60.49 -403.5 curveto 60.49 -408.7 60.49 -412.9 60.49 -418.1 curveto 74.84 -418.1 88.2 -418.1 102.6 -418.1 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -53.27 -363.6 moveto 1.825 -363.6 55.92 -363.6 111 -363.6 curveto 114.6 -363.6 117.6 -366.5 117.6 -370.2 curveto 117.6 -388 117.6 -404.8 117.6 -422.6 curveto 117.6 -426.2 114.6 -429.1 111 -429.1 curveto 55.92 -429.1 1.825 -429.1 -53.27 -429.1 curveto -56.88 -429.1 -59.82 -426.2 -59.82 -422.6 curveto -59.82 -404.8 -59.82 -388 -59.82 -370.2 curveto -59.82 -366.5 -56.88 -363.6 -53.27 -363.6 curveto close_path stroke - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 46.28 -172.6 moveto 46.28 -168.7 46.28 -164.9 46.28 -161.1 curveto stroke - grestore gsave newpath 48.28 -161.1 moveto 47.28 -159.6 47.28 -159.1 46.28 -157.6 curveto 45.28 -159.1 45.28 -159.6 44.28 -161.1 curveto 45.95 -161.1 46.62 -161.1 48.28 -161.1 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -136.9 -269.7 moveto -136.9 -273.5 -136.9 -277.4 -136.9 -281.2 curveto stroke - grestore gsave newpath -138.9 -281.2 moveto -137.9 -282.7 -137.9 -283.2 -136.9 -284.7 curveto -135.9 -283.2 -135.9 -282.7 -134.9 -281.2 curveto -136.5 -281.2 -137.2 -281.2 -138.9 -281.2 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -176.1 -189.5 moveto -168.3 -185.1 -160.5 -180.7 -152.7 -176.3 curveto stroke - grestore gsave newpath -151.7 -178 moveto -150.7 -176.5 -150.7 -176 -149.6 -174.5 curveto -151.3 -174.2 -152 -174.9 -153.6 -174.5 curveto -152.7 -176 -152.7 -176.5 -151.7 -178 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -115.2 -190.5 moveto -119.4 -186 -123.5 -181.6 -127.7 -177.1 curveto stroke - grestore gsave newpath -126.2 -175.7 moveto -127.8 -175 -128.4 -175.3 -130.1 -174.5 curveto -129.4 -176.2 -129.8 -176.8 -129.2 -178.4 curveto -127.8 -177.2 -127.5 -177 -126.2 -175.7 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 248 -264.4 moveto 304.4 -255.3 306.4 -189.2 254.1 -176 curveto stroke - grestore gsave newpath 254.5 -173.9 moveto 252.9 -174.7 252.3 -174.4 250.7 -175.2 curveto 252.1 -176.4 252.4 -176.6 253.7 -177.8 curveto 254.3 -176.2 253.9 -175.6 254.5 -173.9 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 259.7 -211.3 moveto 253.5 -202.1 247.6 -193.1 241.5 -184 curveto stroke - grestore gsave newpath 243.1 -182.9 moveto 241.6 -182 241.1 -182 239.5 -181.1 curveto 240 -182.8 239.4 -183.5 239.8 -185.1 curveto 241.3 -184 241.7 -184 243.1 -182.9 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 212.6 -211.1 moveto 218 -202 223.1 -193.2 228.4 -184.1 curveto stroke - grestore gsave newpath 230.1 -185.1 moveto 230.4 -183.5 229.8 -182.8 230.1 -181.1 curveto 228.6 -182.1 228.1 -182.1 226.6 -183.1 curveto 228.1 -184.1 228.6 -184.1 230.1 -185.1 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 245.9 -219.6 moveto 242 -219.6 238.2 -219.6 234.3 -219.6 curveto stroke - grestore gsave newpath 234.3 -217.6 moveto 232.9 -218.6 232.4 -218.6 230.9 -219.6 curveto 232.4 -220.6 232.9 -220.6 234.3 -221.6 curveto 234.3 -219.9 234.3 -219.2 234.3 -217.6 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 212.6 -228 moveto 218 -237.1 223.1 -245.9 228.4 -255 curveto stroke - grestore gsave newpath 226.6 -256 moveto 228.1 -257 228.6 -257 230.1 -258 curveto 229.8 -256.3 230.4 -255.6 230.1 -254 curveto 228.6 -255 228.1 -255 226.6 -256 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 259.7 -227.8 moveto 253.5 -237 247.6 -246 241.5 -255.1 curveto stroke - grestore gsave newpath 239.8 -254 moveto 239.4 -255.7 240 -256.3 239.5 -258 curveto 241.1 -257.1 241.6 -257.1 243.1 -256.2 curveto 241.7 -255.1 241.3 -255.1 239.8 -254 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 230.1 -258 moveto 224.8 -248.9 219.7 -240 214.4 -231 curveto stroke - grestore gsave newpath 216.1 -230 moveto 214.6 -229 214.1 -229 212.6 -228 curveto 213 -229.6 212.3 -230.3 212.6 -232 curveto 214.1 -231 214.6 -231 216.1 -230 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 230.1 -181.1 moveto 224.8 -190.2 219.7 -199.1 214.4 -208.1 curveto stroke - grestore gsave newpath 212.6 -207.1 moveto 212.3 -208.8 213 -209.5 212.6 -211.1 curveto 214.1 -210.1 214.6 -210.1 216.1 -209.1 curveto 214.6 -208.1 214.1 -208.1 212.6 -207.1 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -68.48 -19.73 moveto -55.25 -11.1 -21.7 -10.54 -5.832 -18.06 curveto stroke - grestore gsave newpath -6.797 -19.52 moveto -5.132 -19.92 -4.468 -19.33 -2.803 -19.73 curveto -3.739 -18.21 -3.676 -17.69 -4.612 -16.17 curveto -5.674 -17.62 -5.735 -18.07 -6.797 -19.52 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 9.867 -19.73 moveto 23.2 -13.42 51.53 -13.94 62.39 -21.3 curveto stroke - grestore gsave newpath 61.27 -22.23 moveto 62.85 -23.03 63.44 -22.83 65.02 -23.64 curveto 64.47 -21.99 64.91 -21.34 64.36 -19.69 curveto 63 -20.87 62.63 -21.05 61.27 -22.23 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 68.45 -23.64 moveto 75.81 -14.62 105.2 -12.88 121 -18.42 curveto stroke - grestore gsave newpath 120.2 -20.03 moveto 121.9 -19.6 122.5 -20.17 124.2 -19.73 curveto 123.1 -18.3 123 -17.86 121.9 -16.43 curveto 121 -17.97 121.1 -18.5 120.2 -20.03 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -2.803 -36.59 moveto -16.03 -45.22 -49.59 -45.78 -65.45 -38.27 curveto stroke - grestore gsave newpath -64.49 -36.81 moveto -66.15 -36.4 -66.82 -37 -68.48 -36.59 curveto -67.55 -38.11 -67.61 -38.63 -66.67 -40.16 curveto -65.61 -38.71 -65.55 -38.26 -64.49 -36.81 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 124.2 -36.59 moveto 110.8 -43.04 82 -42.52 71.07 -35.03 curveto stroke - grestore gsave newpath 72.19 -34.11 moveto 70.61 -33.3 70.03 -33.49 68.45 -32.69 curveto 69 -34.34 68.54 -34.99 69.09 -36.64 curveto 70.46 -35.46 70.82 -35.28 72.19 -34.11 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 65.02 -32.69 moveto 57.7 -41.57 28.8 -43.3 13.07 -37.88 curveto stroke - grestore gsave newpath 13.85 -36.26 moveto 12.19 -36.71 11.53 -36.15 9.867 -36.59 curveto 10.96 -38.02 11.05 -38.45 12.14 -39.88 curveto 13.05 -38.34 12.95 -37.8 13.85 -36.26 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath -85.44 -239.4 moveto -56.63 -224.3 -27.92 -209.3 0.9075 -194.2 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 1.836 -196 moveto 2.882 -194.5 2.929 -194.1 3.975 -192.6 curveto 2.31 -192.2 1.644 -192.8 -0.02154 -192.5 curveto 0.931 -194 0.8836 -194.5 1.836 -196 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath -85.44 -270.9 moveto -68.7 -272.3 -52 -273.6 -35.29 -275 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath -35.46 -277 moveto -33.92 -276.1 -33.38 -276.2 -31.84 -275.3 curveto -33.27 -274.2 -33.7 -274.1 -35.13 -273 curveto -35.57 -274.7 -35.02 -275.4 -35.46 -277 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 46.28 -240.3 moveto 46.28 -236.4 46.28 -232.6 46.28 -228.7 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 48.28 -228.7 moveto 47.28 -227.2 47.28 -226.8 46.28 -225.3 curveto 45.28 -226.8 45.28 -227.2 44.28 -228.7 curveto 45.95 -228.7 46.62 -228.7 48.28 -228.7 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 46.28 -225.3 moveto 46.28 -229.1 46.28 -233 46.28 -236.8 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 44.28 -236.8 moveto 45.28 -238.3 45.28 -238.8 46.28 -240.3 curveto 47.28 -238.8 47.28 -238.3 48.28 -236.8 curveto 46.62 -236.8 45.95 -236.8 44.28 -236.8 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath -71.27 -211.4 moveto -56.19 -220.4 -41.13 -229.5 -26.06 -238.5 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath -27.09 -240.2 moveto -25.42 -240.6 -24.75 -239.9 -23.09 -240.3 curveto -24.07 -238.8 -24.05 -238.3 -25.03 -236.8 curveto -26.05 -238.3 -26.07 -238.7 -27.09 -240.2 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath -46.84 -171.2 moveto -31.07 -171.1 -15.29 -171 0.5121 -170.9 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 0.5292 -172.9 moveto 2.012 -171.9 2.494 -171.9 3.976 -170.9 curveto 2.483 -169.9 1.989 -169.9 0.4955 -168.9 curveto 0.8401 -170.5 0.1846 -171.2 0.5292 -172.9 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 14.57 -46.59 moveto 10.85 -55.53 7.146 -64.46 3.446 -73.39 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 1.598 -72.62 moveto 2.105 -74.28 1.612 -74.93 2.119 -76.59 curveto 3.51 -75.44 3.902 -75.3 5.293 -74.15 curveto 3.728 -73.31 3.163 -73.47 1.598 -72.62 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 15.1 -363.6 moveto 11.35 -354.7 7.611 -345.7 3.881 -336.8 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 5.726 -336 moveto 4.333 -334.9 3.939 -334.8 2.545 -333.6 curveto 2.042 -335.3 2.539 -335.9 2.036 -337.6 curveto 3.599 -336.7 4.163 -336.9 5.726 -336 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 2.545 -333.6 moveto 6.275 -342.5 10.01 -351.5 13.76 -360.4 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 11.92 -361.2 moveto 13.31 -362.3 13.71 -362.5 15.1 -363.6 curveto 15.6 -362 15.1 -361.3 15.6 -359.6 curveto 14.04 -360.5 13.48 -360.3 11.92 -361.2 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 117.6 -381.7 moveto 161.1 -363.2 196.6 -329.1 216.7 -286.1 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 218.5 -286.9 moveto 218 -285.2 218.6 -284.6 218.1 -282.9 curveto 216.7 -284 216.3 -284.1 214.9 -285.3 curveto 216.4 -286.1 217 -286 218.5 -286.9 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 139.4 -205.1 moveto 148.3 -205.1 157.1 -205.1 165.9 -205.1 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 165.9 -207.1 moveto 167.4 -206.1 167.9 -206.1 169.4 -205.1 curveto 167.9 -204.1 167.4 -204.1 165.9 -203.1 curveto 165.9 -204.8 165.9 -205.4 165.9 -207.1 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 151.8 -46.59 moveto 179.7 -66.09 202.3 -92.82 216.8 -124.1 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 215 -124.9 moveto 216.4 -126.1 216.8 -126.2 218.2 -127.3 curveto 218.7 -125.6 218.2 -125 218.7 -123.3 curveto 217.1 -124.2 216.6 -124.1 215 -124.9 curveto close_path fill - grestore showpage -%%EOF diff --git a/doc/developer/architecture.tex b/doc/developer/architecture.tex index 2df3d83a5dc1f5be4b46891e2d7ed895dbcb189e..0d01872a0df55208285caa53556e82c823c2e33c 100644 --- a/doc/developer/architecture.tex +++ b/doc/developer/architecture.tex @@ -44,10 +44,141 @@ small square boxes represents a subdirectory in one subdirectory \texttt{src/$d$}. The remaining sections will explain the goal of each of these boxes. They do not detail each module of each directory: use the API documentation generated by \texttt{make doc} for that purpose. + \begin{figure}[htbp] \begin{center} -%\includegraphics[viewport=108 221 440 843]{archi} -\includegraphics[scale=0.9]{architecture.mps} + +\begin{tikzpicture}[remember picture,scale=0.9, every node/.style={transform shape}] +% kernel internals +\node[structural] (internals) { + \tikztitleboxbig{Kernel Internals}{LightCyan}{ + \begin{tikz-hbox}{internals} + \node[on chain,draw,plain]{parsing}; + \node[on chain,draw,plain]{typing}; + \node[on chain,draw,plain]{runtime}; + \end{tikz-hbox} + } +}; + +\node[structural, above=\bigpadding] at (internals.north) (middle) { + \begin{tikz-hbox}[node distance=\bigpadding] + {middle} + % kernel services + \node[on chain, structural] (services) { + \tikztitleboxbig{Kernel Services}{darkgreen}{ + \begin{tikz-hbox}{services} + \node[on chain,structural]{ + \begin{tikz-vbox}{services-left} + \node[on chain,structural] (traversal){ + \tikztitlebox{AST Traversal}{% + \begin{tikz-vbox}{traversal} + \node[on chain,draw,plain] (visitor) {visitor}; + \node[on chain,structural] { + \begin{tikz-hbox}{traversal-1} + \node[on chain,draw,plain] (analysis) {analysis}; + \node[on chain,draw,plain] (transfo) {ast\_transformations}; + \end{tikz-hbox} + }; + \draw[-Latex] (analysis) -- (visitor); + \draw[-Latex] (transfo) -- (visitor); + \end{tikz-vbox} + } + }; + \node[on chain,structural] (ai) { + \tikztitlebox{AI}{ + \begin{tikz-vbox}{ai} + \node[on chain,draw,plain] {abstract\_interp}; + \end{tikz-vbox} + } + }; + \end{tikz-vbox} + }; + \node[on chain,structural] { + \begin{tikz-vbox}{services-right} + \node[on chain,structural](ast){ + \tikztitlebox{ASTs}{% + \begin{tikz-vbox}{ast} + \node[on chain,draw,plain] (data) {ast\_data}; + \node[on chain,draw,plain] (queries) {ast\_queries}; + \node[on chain,draw,plain] (parsetree) {parsetree}; + \draw[-Latex] (queries) -- (data); + \end{tikz-vbox} + } + }; + \node[on chain,structural] (interactions) { + \tikztitlebox{Plug-in Interactions}{ + \begin{tikz-vbox}{plugin-api} + \node[on chain,draw,plain] {cmdline\_parameters}; + \node[on chain,draw,plain] {plugin\_entry\_points}; + \end{tikz-vbox} + } + }; + \draw[bigarrow,<->] (ast.south) -- (interactions.north); + \end{tikz-vbox} + }; + \end{tikz-hbox} + \begin{tikzpicture}[overlay] + \coordinate (ai2) at ($(ai.north east)!.75!(ai.south east)$); + \coordinate (traversal1) at + ($(traversal.south east)!0.2!(traversal.south west)$); + \coordinate (interactions1) at + ($(interactions.north west)!0.2!(interactions.south west)$); + \draw[bigarrow,->] (traversal.east) -- (ast.west); + \draw[bigarrow,->] (traversal1) -- (interactions1); + \draw[bigarrow,bend right,->] (ai.east) to[in=170] (ast.west); + \draw[bigarrow,->] (ai.east) -- (interactions.west); + \end{tikzpicture} + } + }; + %libraries + \node[on chain, structural] (libraries) {% + \tikztitleboxbig{Libraries}{Orange}{ + \begin{tikz-vbox}[node distance=\bigpadding]{libraries} + \node[on chain,draw,plain] (stdlib){stdlib}; + \node[on chain,structural]{ + \begin{tikz-hbox}{lib-middle} + \node[on chain,draw,plain] (datatype) {datatype}; + \node[on chain,draw,plain] (project) {project}; + \end{tikz-hbox} + }; + \node[on chain,draw,plain] (utils) {utils}; + \end{tikz-vbox}% + } + }; + \draw[bigarrow,->] (services.east) -- (libraries.west); + \end{tikz-hbox} +\begin{tikzpicture}[overlay] + \draw[Latex-Latex] (stdlib.south) -- (datatype); + \draw[Latex-Latex] (datatype) -- (utils); + \draw[-Latex] (project) -- (stdlib); + \draw[-Latex] (project.west) -- (datatype.east); + \draw[-Latex] (project) -- (utils); + \draw[-Latex,looseness=1.7,in=-20,out=20] (utils.east) to (stdlib.east); +\end{tikzpicture} +}; + +%plugins +\node[above=\bigpadding,structural] at (middle.north) (plugins) { + \tikztitleboxbig{Plug-ins}{palered}{ + \begin{tikz-hbox}{plugins} + \node[on chain,draw,plain] (pi1) {plug-in 1}; + \node[on chain,draw,plain] (pi2) {plug-in 2}; + \node[on chain,plain,minimum height=1ex] (dots) {...}; + \node[on chain,draw,plain] (pin) {plug-in $n$}; + \draw[-Latex,bend left] (pi1.north) to (pi2.north); + \draw[-Latex,bend left] (pi2.north) to (dots.north); + \draw[-Latex,bend left] (dots.north) to (pin.north); + \draw[-Latex,bend left] (pin.south) to (dots.south); + \draw[-Latex,bend left] (dots.south) to (pi2.south); + \draw[-Latex,bend left] (pi2.south) to (pi1.south); + \end{tikz-hbox} + } +}; + \draw[bigarrow,<->] (services.south) -- (internals.north); + %TODO: understand why remembered nodes are not accurate. + \draw[bigarrow,->] (plugins.south) -- ($(services.north)+(0,-28pt)$); + \draw[bigarrow,->,bend right] (internals.east) to ($(libraries.south west)+(0,-5pt)$); +\end{tikzpicture} \caption{Frama-C Architecture Design.}\label{fig:architecture} \end{center} \end{figure} @@ -148,14 +279,13 @@ with the \framac kernel or other plug-ins. Next, \framac provides predefined ways to visit the ASTs, in particular through object-oriented visitors defined in directory \texttt{src/kernel\_services/visitor} (see Section~\ref{adv:visitors}). -Some predefined analyzers, such as a generic dataflow analysis +Some predefined analyzers, such as a multiple generic dataflow analysis are provided in directory \texttt{src/kernel\_services/analysis}, while some predefined program transformation, such as cloning a function, are provided in directory \texttt{src/kernel\_services/ast\_transformations}. Finally, \framac provides an abstract interpretation toolbox\index{Abstract Interpretation} -with generic lattices in directory \texttt{abstract\_interp} -and memory model lattices in directory \texttt{memory\_states}. +with various lattices in directory \texttt{abstract\_interp}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/developer/changes.tex b/doc/developer/changes.tex index e1b76849c93d947e8be7fbb7e754c653a2e68434..4fac854fab9e2ce3d9954d8aebb611389adad6c1 100644 --- a/doc/developer/changes.tex +++ b/doc/developer/changes.tex @@ -7,6 +7,15 @@ This chapter summarizes the major changes in this documentation between each \section*{\framacversion} \begin{itemize} +\item \textbf{Testing}: Explain the appropriate way to handle compilation +of \texttt{.ml} scripts during tests +\item \textbf{Makefiles}: Remove any reference to obsolete +\texttt{Makefile.plugin} file +\end{itemize} + +\section*{Phosphorus-20170501} +\begin{itemize} +\item \textbf{Makefiles}: Update overview of Makefiles. \item\textbf{ACSL Extensions}: Update documentation after refactoring of ACSL extensions. \item\textbf{Machine model}: fully new section. diff --git a/doc/developer/check_api/check_code.ml b/doc/developer/check_api/check_code.ml index c386a7450d7c4eb94d98d8e1c8ade390562e0cd1..2851f035c05ffb67caa4fa6bcfbec0b263642472 100644 --- a/doc/developer/check_api/check_code.ml +++ b/doc/developer/check_api/check_code.ml @@ -123,9 +123,6 @@ module Generator (G : Odoc_html.Html_generator) = struct method html_of_type_expr b m_name t = last_type <- string_of_type_expr t - method html_of_type_expr_list ?par b m_name sep l = - last_type <- string_of_type_list ?par sep l - method html_of_class_type_param_expr_list b m_name l = last_type <- string_of_class_type_param_list l @@ -220,9 +217,31 @@ module Generator (G : Odoc_html.Html_generator) = struct method html_of_exception b e = last_name <- e.Exception.ex_name; - last_type <- string_of_type_list " " e.Exception.ex_args; + last_type <- + (match e.Exception.ex_args with + | Odoc_type.Cstr_tuple t -> Odoc_info.string_of_type_list " " t + | Odoc_type.Cstr_record r -> Odoc_info.string_of_record r + ); super#html_of_exception b e + method private print_record b father l = + last_type <- last_type ^ "{"; + let print_one r = + if last_type <> "" && + String.get last_type ((String.length last_type) -1) = '{' + then begin + if r.Type.rf_mutable then last_type <- last_type ^ "mutable " + end else begin + if r.Type.rf_mutable then last_type <- last_type ^ "; mutable " + else last_type <- last_type ^ "; " + end; + last_type <- last_type ^ r.Type.rf_name ; + self#html_of_type_expr_3 b father r.Type.rf_type; + self#html_of_info b r.Type.rf_text + in + print_concat b "\n" print_one l; + last_type <- last_type ^ "}" + method html_of_type b t = last_name <- t.Type.ty_name; last_type <- ""; @@ -235,27 +254,17 @@ module Generator (G : Odoc_html.Html_generator) = struct let print_one constr = last_type <- last_type ^ " | " ^ constr.Type.vc_name ; (match constr.Type.vc_args with - | [] -> () - | l -> self#html_of_type_expr_list_2 ~par: false b father " * " l); + | Odoc_type.Cstr_tuple [] -> () + | Odoc_type.Cstr_tuple l -> + self#html_of_type_expr_list_2 ~par: false b father " * " l + | Odoc_type.Cstr_record r -> + self#print_record b father r + ); self#html_of_info b constr.Type.vc_text in print_concat b "\n" print_one l; - | Type.Type_record l -> - last_type <- last_type ^ "{"; - let print_one r = - if String.get last_type ((String.length last_type) -1) = '{' - then begin - if r.Type.rf_mutable then last_type <- last_type ^ "mutable " - end else begin - if r.Type.rf_mutable then last_type <- last_type ^ "; mutable " - else last_type <- last_type ^ "; " - end; - last_type <- last_type ^ r.Type.rf_name ; - self#html_of_type_expr_3 b father r.Type.rf_type; - self#html_of_info b r.Type.rf_text - in - print_concat b "\n" print_one l; - last_type <- last_type ^ "}"); + | Type.Type_record l -> self#print_record b father l + | _ -> ()); self#html_of_info b t.Type.ty_info; method html_of_attribute b a = @@ -327,6 +336,6 @@ end let () = Odoc_args.extend_html_generator (module Generator : Odoc_gen.Html_functor); Odoc_args.add_option - ("-docdevpath", - Arg.Set_string doc_dev_path, - "Frama-C documentation directory"); + ("-docdevpath", + Arg.Set_string doc_dev_path, + "Frama-C documentation directory") diff --git a/doc/developer/check_api/check_index_grammar.mly b/doc/developer/check_api/check_index_grammar.mly index f10fbdc01d0f5f7782a524ff67bf4e71d4cfedb4..b43b92fd4533a082e41f2e83fa674a34388d3377 100644 --- a/doc/developer/check_api/check_index_grammar.mly +++ b/doc/developer/check_api/check_index_grammar.mly @@ -24,20 +24,23 @@ %token <string> STRING %start main %type <string> main +%nonassoc lowest +%nonassoc EOL WORD KWD_WITH_DOUBLE_ARGS +%nonassoc highest %% -main: file mult_eol EOF { $1 } +main: | file EOF { $1 } | filtered_string EOF { $1 } filtered_string: STRING { $1 } - | filtered_string filtered_string { $1 ^ $2 } + | STRING filtered_string { $1 ^ $2 } mult_eol: EOL { "" } - | mult_eol EOL { "" } + | EOL mult_eol %prec highest { "" } mult_word: - | WORD { $1 } - | WORD mult_word { $1 ^ " " ^ $2 } - | KWD_WITH_DOUBLE_ARGS LPAR WORD RPAR LPAR WORD RPAR mult_word + | WORD %prec lowest { $1 } + | WORD mult_word %prec highest { $1 ^ " " ^ $2 } + | KWD_WITH_DOUBLE_ARGS LPAR WORD RPAR LPAR WORD RPAR mult_word %prec highest { (* the keyword and the 2 integer arguments are ignored *) $8 } @@ -50,8 +53,8 @@ string_with_bracket: mult_word { $1 } | LPAR RPAR { "" } file: line { $1 } - | file mult_eol { $1 } - | file mult_eol file { $1 ^ $3 } + | file mult_eol %prec lowest { $1 } + | file mult_eol file %prec lowest { $1 ^ $3 } piece: mult_word KWD_WITH_ARG bracket_word { $1 } diff --git a/doc/developer/check_api/run.oracle b/doc/developer/check_api/run.oracle index 7196c28e347d7544fd56ce6ffabdc015c31ac596..769847618c69cf2f9ca6f482711374dd559b3953 100644 --- a/doc/developer/check_api/run.oracle +++ b/doc/developer/check_api/run.oracle @@ -14,7 +14,8 @@ Cil/Cil_types.stmt -> Cil_types.stmt * Cil_types.stmtend /CIL main API. CIL orig Cil_types.logic_ctor_info/{ctor_name: string; ctor_type: Cil_types.logic_type_info; ctor_params: Cil_types.logic_type list}/Description of a constructor of a logic sum-type./ Cil.cilVisitor.vlogic_var_use/Cil_types.logic_var -> Cil_types.logic_var Cil.visitAction// Cmdline.nop/Cmdline.exit// -Cil.register_behavior_extension/string -> (Cil.cilVisitor -> int * Cil_types.identified_predicate list -> (int * Cil_types.identified_predicate list) Cil.visitAction) -> unit/Indicates how an extended behavior clause is supposed to be visited. The default behavior is DoChildren, which ends up visiting each identified predicate in the list and leave the id as is./ +State_selection.t//Type of a state selection./ +Cil.register_behavior_extension/string -> (Cil.cilVisitor -> Cil_types.acsl_extension_kind -> Cil_types.acsl_extension_kind Cil.visitAction) -> unit/Indicates how an extended behavior clause is supposed to be visited. The default behavior is DoChildren, which ends up visiting each identified predicate in the list and leave the id as is./ Datatype.unit/unit Type.t/Add sets, maps and hashtables modules to an existing datatype, provided the equal, compare and hash functions are not Datatype.undefined./ Globals/(Cil_types.stmt -> Cil_types.block) Pervasives.refend /Operations on globals./ Db.Main/(unit -> unit) Pervasives.refend /Frama-C main interface./ @@ -26,20 +27,20 @@ Datatype.string/string Type.t// Locations.Location/Datatype.S with type t = location/Misc/ Parameter_sig.Builder.Int/int end ) -> Parameter_sig.Int/To be used by the plugin to output the results of the option in a controlled way. See set_output_dependencies details./ Db.Main.extend/(unit -> unit) -> unit/Register a function to be called by the Frama-C main entry point./ -Annotations/(Emitter.Usable_emitter.t -> Cil_types.stmt -> Cil_types.code_annotation -> unit) Pervasives.refend /Annotations in the AST. The AST should be computed before calling functions of this module./ +Annotations/State.tend /Annotations in the AST. The AST should be computed before calling functions of this module./ Gtk_helper.graph_window/parent:GWindow.window -> title:string -> (packing:(GObj.widget -> unit) -> unit -> < adapt_zoom : unit -> unit; .. >) -> unit/Create a new window displaying a graph./ Cmdline.run_after_exiting_stage/(unit -> Cmdline.exit) -> unit/Register an action to be executed at the end of the exiting stage. The guarded action must finish by exit n./ Cil.cilVisitor.vvrbl/Cil_types.varinfo -> Cil_types.varinfo Cil.visitAction/Invoked on each variable use. Here only the SkipChildren and ChangeTo actions make sense since there are no subtrees. Note that the type and attributes of the variable are not traversed for a variable use./ Cil_types.varinfo/{mutable vname: string; vorig_name: string; mutable vtype: Cil_types.typ; mutable vattr: Cil_types.attributes; mutable vstorage: Cil_types.storage; mutable vglob: bool; mutable vdefined: bool; mutable vformal: bool; mutable vinline: bool; mutable vdecl: Cil_types.location; mutable vid: int; mutable vaddrof: bool; mutable vreferenced: bool; vtemp: bool; mutable vdescr: string option; mutable vdescrpure: bool; mutable vghost: bool; vsource: bool; mutable vlogic_var_assoc: Cil_types.logic_var option}/Information about a variable./ Lmap_bitwise/functor (V : Lmap_bitwise.With_default ) -> Lmap_bitwise.Location_map_bitwise with type v = V.tend /Functors making map indexed by zone./ Cil.cilVisitor.behavior/Cil.visitor_behavior/the kind of behavior expected for the behavior./ -Datatype.Serializable_undefined/Datatype.Undefined/Same as Datatype.Undefined, but the type is supposed to be marshalable by the standard OCaml way (in particular, no hash-consing or projects inside the type)./ +Datatype.Serializable_undefined/Datatype.Undefined/Same as Datatype.Undefined, but the type is supposed to be marshallable by the standard OCaml way (in particular, no hash-consing or projects inside the type)./ Log.Messages.feedback/?ontty:Log.ontty -> ?level:int -> ?dkey:Log.category -> 'a Log.pretty_printer/Progress and feedback. Level is tested against the verbosity level./ Log.set_echo/?plugin:string -> ?kind:Log.kind list -> bool -> unit/Turns echo on or off. Applies to all channel unless specified, and all kind of messages unless specified./ Db.Value.self/State.t/Internal state of the value analysis from projects viewpoint./ Log.new_channel/string -> Log.channel/Send an event over the associated listeners./ Log.Messages.warning/'a Log.pretty_printer/Hypothesis and restrictions./ -Cil.get_stmt/Cil.visitor_behavior -> Cil_types.stmt -> Cil_types.stmt/retrieve the representative of a given varinfo in the current state of the visitor/ +Cil.get_stmt/Cil.visitor_behavior -> Cil_types.stmt -> Cil_types.stmt// Datatype.Undefined/Datatype.Undefined/Sub-signature of Datatype.S./ Cil_types.fieldinfo/{mutable fcomp: Cil_types.compinfo; forig_name: string; mutable fname: string; mutable ftype: Cil_types.typ; mutable fbitfield: int option; mutable fattr: Cil_types.attributes; mutable floc: Cil_types.location; mutable faddrof: bool; mutable fsize_in_bits: int option; mutable foffset_in_bits: int option; mutable fpadding_in_bits: int option}/Information about a struct/union field./ Cmdline.is_going_to_load/unit -> unit/To be call if one action is going to run after the loading stage. It is not necessary to call this function if the running action is set by an option put on the command line./ @@ -50,7 +51,7 @@ Kernel.CodeOutput/(Format.formatter -> unit) -> unitend /Behavior of option "-oc Datatype.int/int Type.t// Log.Messages.fatal/('a, 'b) Log.pretty_aborter/internal error of the plug-in. raised exception: AbortFatal./ Cil.cilVisitor.vexpr/Cil_types.exp -> Cil_types.exp Cil.visitAction/Invoked on each expression occurrence. The subtrees are the subexpressions, the types (for a Cast or SizeOf expression) or the variable use./ -Parameter_customize/bool Pervasives.refend /Configuration of command line options. You can apply the below functions juste before applying one of the functors provided by the functor Plugin.Register and generating a new parameter./ +Parameter_customize/(string -> Cil_datatype.Kf.Set.t) -> unitend /Configuration of command line options. You can apply the functions below just before applying one of the functors provided by the functor Plugin.Register and generating a new parameter./ Cmdline.run_during_extending_stage/(unit -> unit) -> unit/Register an action to be executed during the extending stage./ File.init_project_from_cil_file/Project.t -> Cil_types.file -> unit/Initialize the cil file representation with the given file for the given project from the current one. Should be called at most once per project. raised exception: File_types.Bad_Initialization./ Datatype.func2/?label1:string * (unit -> 'a) option -> 'a Type.t -> ?label2:string * (unit -> 'b) option -> 'b Type.t -> 'c Type.t -> ('a -> 'b -> 'c) Type.t/optlabel_func lab dft ty1 ty2 is equivalent to func ~label:(lab, Some dft) ty1 ty2/ @@ -69,29 +70,32 @@ Kernel_function/State.tend /Operations to get info from a kernel function. This Datatype.String/Datatype.S_with_collections with type t = string/Deep copy: no possible sharing between x and copy x./ File.init_from_cmdline/unit -> unit/Initialize the cil file representation with the file given on the command line. Should be called at most once per project. raised exception: File_types.Bad_Initialization./ File.init_from_c_files/t list -> unit/Initialize the cil file representation of the current project. Should be called at most once per project. raised exception: File_types.Bad_Initialization./ +Cil_types.mach/{sizeof_short: int; sizeof_int: int; sizeof_long: int; sizeof_longlong: int; sizeof_ptr: int; sizeof_float: int; sizeof_double: int; sizeof_longdouble: int; sizeof_void: int; sizeof_fun: int; size_t: string; wchar_t: string; ptrdiff_t: string; alignof_short: int; alignof_int: int; alignof_long: int; alignof_longlong: int; alignof_ptr: int; alignof_float: int; alignof_double: int; alignof_longdouble: int; alignof_str: int; alignof_fun: int; char_is_unsigned: bool; underscore_name: bool; const_string_literals: bool; little_endian: bool; alignof_aligned: int; has__builtin_va_list: bool; __thread_is_keyword: bool; compiler: string; cpp_arch_flags: string list; version: string}/Definition of a machine model (architecture + compiler)./ Ast.mark_as_grown/unit -> unit/call this function whenever you have added something to the AST, without modifying the existing nodes/ Globals.set_entry_point/string -> bool -> unit/set_entry_point name lib sets Kernel.MainFunction to name and Kernel.LibEntry to lib. Moreover, clear the results of all the analysis which depend on Kernel.MainFunction or Kernel.LibEntry./ -Cmdline/?memo:bool -> plugin:string -> string -> Cmdline.Group.t * boolend end /Command line parsing./ +Cmdline/Cmdline.Group.t -> stringend end /Command line parsing./ Design.main_window_extension_points.register_source_selector/(GMenu.menu GMenu.factory -> Design.main_window_extension_points -> button:int -> Pretty_source.localizable -> unit) -> unit/register an action to perform when button is released on a given localizable. If the button 3 is released, the first argument is popped as a contextual menu./ Frontc.add_syntactic_transformation/(Cabs.file -> Cabs.file) -> unit/add a syntactic transformation that will be applied to all freshly parsed C files./ Project/unit -> unitend end /Projects management. A project groups together all the internal states of Frama-C. An internal state is roughly the result of a computation which depends of an AST. It is possible to have many projects at the same time. For registering a new state in the Frama-C projects, apply the functor State_builder.Register./ Visitor.frama_c_visitor.current_kf/Cil_types.kernel_function option/link to the kernel function currently being visited. NB: for copy visitors, the link is to the original kf (anyway, the new kf is created only after the visit is over)./ Datatype.undefined/'a -> 'b/Must be used if you don't want to implement a required function./ Log.Messages.failure/'a Log.pretty_printer/internal error of the plug-in./ -Logic_const.prel/?loc:Cil_types.location -> Cil_types.relation * Cil_types.term * Cil_types.term -> Cil_types.predicate Cil_types.named/Binary relation./ +Logic_const.prel/?loc:Cil_types.location -> Cil_types.relation * Cil_types.term * Cil_types.term -> Cil_types.predicate/Binary relation./ Locations.Zone/Locations.Zone.map_t -> Int_Intervals.t Hptmap.Shape(Base.Base).tend /Association between bases and ranges of bits./ Cil.cilVisitor.get_filling_actions/(unit -> unit) Queue.t/get the queue of actions to be performed at the end of a full copy./ Locations.location/{loc: Locations.Location_Bits.t; size: Int_Base.t}/A Location_Bits.t and a size in bits./ -Cil_types/{sizeof_short: int; sizeof_int: int; sizeof_long: int; sizeof_longlong: int; sizeof_ptr: int; sizeof_float: int; sizeof_double: int; sizeof_longdouble: int; sizeof_void: int; sizeof_fun: int; size_t: string; wchar_t: string; ptrdiff_t: string; alignof_short: int; alignof_int: int; alignof_long: int; alignof_longlong: int; alignof_ptr: int; alignof_float: int; alignof_double: int; alignof_longdouble: int; alignof_str: int; alignof_fun: int; char_is_unsigned: bool; underscore_name: bool; const_string_literals: bool; little_endian: bool; alignof_aligned: int; has__builtin_va_list: bool; __thread_is_keyword: bool; compiler: string; version: string}end /The Abstract Syntax of CIL./ +Cil_types/end /The Abstract Syntax of CIL./ Visitor.frama_c_visitor.vstmt_aux/Cil_types.stmt -> Cil_types.stmt Cil.visitAction/Replacement of vstmt./ File.init_project_from_visitor/?reorder:bool -> Project.t -> Visitor.frama_c_visitor -> unit/init_project_from_visitor prj vis initialize the cil file representation of prj. prj must be essentially empty: it can have some options set, but not an existing cil file; proj is filled using vis, which must be a copy visitor that puts its results in prj. if reorder is true (default is false) the new AST in prj will be reordered./ +Datatype.Polymorphic4/((Project_skeleton.t -> bool) -> 'a -> bool) -> ((Project_skeleton.t -> bool) -> 'b -> bool) -> ((Project_skeleton.t -> bool) -> 'c -> bool) -> ((Project_skeleton.t -> bool) -> 'd -> bool) -> (Project_skeleton.t -> bool) -> ('a, 'b, 'c, 'd) Datatype.t -> bool end ) -> Datatype.Polymorphic4 with type ('a, 'b, 'c, 'd) poly = ('a, 'b, 'c, 'd) P.t/Functor for polymorphic types with 4 type variables./ Datatype.List/functor (T : Datatype.S ) -> Datatype.S with type t = T.t list/Deep copy: no possible sharing between x and copy x./ Structural_descr.pack/Structural_descr.t -> Structural_descr.pack/Pack a structural descriptor in order to embed it inside another one./ -Datatype.Polymorphic4/((Project_skeleton.t -> bool) -> 'a -> bool) -> ((Project_skeleton.t -> bool) -> 'b -> bool) -> ((Project_skeleton.t -> bool) -> 'c -> bool) -> ((Project_skeleton.t -> bool) -> 'd -> bool) -> (Project_skeleton.t -> bool) -> ('a, 'b, 'c, 'd) Datatype.t -> bool end ) -> Datatype.Polymorphic4 with type ('a, 'b, 'c, 'd) poly = ('a, 'b, 'c, 'd) P.t/Functor for polymorphic types with 4 type variables./ Log.set_output/?isatty:bool -> (string -> int -> int -> unit) -> (unit -> unit) -> unit/This function has the same parameters as Format.make_formatter./ +Cil.reset_behavior_varinfo/Cil.visitor_behavior -> unit/resets the internal tables used by the given visitor_behavior. If you use fresh instances of visitor for each round of transformation, this should not be needed. In place modifications do not need that at all./ Logic_utils.expr_to_term/cast:bool -> Cil_types.exp -> Cil_types.term/translates a C expression into an "equivalent" logical term. cast specifies how C arithmetic operators are translated. When cast is true, the translation returns a logic term having the same semantics of the C expr by introducing casts (i.e. the C expr a+b can be translated as (char)(((char)a)+(char)b) to preserve the modulo feature of the C addition). Otherwise, no such casts are introduced and the C arithmetic operators are translated into perfect mathematical operators (i.e. a floating point addition is translated into an addition of real numbers)./ Journal/(string -> string) Pervasives.refend /Journalization of functions./ Cil.cilVisitor.vstmt/Cil_types.stmt -> Cil_types.stmt Cil.visitAction/Control-flow statement. The default DoChildren action does not create a new statement when the components change. Instead it updates the contents of the original statement. This is done to preserve the sharing with Goto and Case statements that point to the original statement. If you use the ChangeTo action then you should take care of preserving that sharing yourself./ +Cil.get_varinfo/Cil.visitor_behavior -> Cil_types.varinfo -> Cil_types.varinfo/retrieve the representative of a given varinfo in the current state of the visitor/ Db.Value.is_computed/unit -> bool/Return true iff the value analysis has been done./ Kernel.Unicode/('a -> 'b) -> 'a -> 'bend /Behavior of option "-unicode"./ Design.register_extension/(Design.main_window_extension_points -> unit) -> unit/Register an extension to the main GUI. It will be invoked at initialization time./ @@ -102,7 +106,7 @@ Cil.cilVisitor//A visitor interface for traversing CIL trees. Create instantiati Cil.lzero/?loc:Cil_types.location -> unit -> Cil_types.term/The constant logic term zero./ Db.Value.is_reachable/Db.Value.state -> bool/add_formals_to_state state kf exps evaluates exps in state and binds them to the formal arguments of kf in the resulting state/ Cil_types.compinfo/{mutable cstruct: bool; corig_name: string; mutable cname: string; mutable ckey: int; mutable cfields: Cil_types.fieldinfo list; mutable cattr: Cil_types.attributes; mutable cdefined: bool; mutable creferenced: bool}/The definition of a structure or union type. Use Cil.mkCompInfo to make one and use Cil.copyCompInfo to copy one (this ensures that a new key is assigned and that the fields have the right pointers to parents.)./ -Cil_types.logic_type_info/{lt_name: string; lt_params: string list; mutable lt_def: Cil_types.logic_type_def option}/Description of a logic type./ +Cil_types.logic_type_info/{lt_name: string; lt_params: string list; mutable lt_def: Cil_types.logic_type_def option; mutable lt_attr: Cil_types.attributes}/Description of a logic type./ Cmdline.run_after_loading_stage/(unit -> unit) -> unit/Register an action to be executed at the end of the loading stage./ Locations/Base.t -> Cil_types.typ -> Cil_types.offset -> Locations.locationend /Memory locations./ File.must_recompute_cfg/Cil_types.fundec -> unit/must_recompute_cfg f must be called by code transformation hooks when they modify statements in function f. This will trigger a recomputation of the cfg of f after the transformation./ @@ -113,17 +117,18 @@ File.create_project_from_visitor/?reorder:bool -> ?last:bool -> string -> (Proje Parameter_sig.Bool/Parameter_sig.Bool/Signature for a boolean parameter./ Visitor.generic_frama_c_visitor/Cil.visitor_behavior -> /Generic class that abstracts over frama_c_inplace and frama_c_copy./ Db.Value.get_stmt_state/Cil_types.stmt -> Db.Value.state/Initial state used by the analysis/ +Logic_typing.typing_context/{is_loop: unit -> bool; anonCompFieldName: string; conditionalConversion: Cil_types.typ -> Cil_types.typ -> Cil_types.typ; find_macro: string -> Logic_ptree.lexpr; find_var: string -> Cil_types.logic_var; find_enum_tag: string -> Cil_types.exp * Cil_types.typ; find_comp_field: Cil_types.compinfo -> string -> Cil_types.offset; find_type: Logic_typing.type_namespace -> string -> Cil_types.typ; find_label: string -> Cil_types.stmt Pervasives.ref; remove_logic_function: string -> unit; remove_logic_type: string -> unit; remove_logic_ctor: string -> unit; add_logic_function: Cil_types.logic_info -> unit; add_logic_type: string -> Cil_types.logic_type_info -> unit; add_logic_ctor: string -> Cil_types.logic_ctor_info -> unit; find_all_logic_functions: string -> Cil_types.logic_info list; find_logic_type: string -> Cil_types.logic_type_info; find_logic_ctor: string -> Cil_types.logic_ctor_info; pre_state: Logic_typing.Lenv.t; post_state: Cil_types.termination_kind list -> Logic_typing.Lenv.t; assigns_env: Logic_typing.Lenv.t; silent: bool; type_predicate: Logic_typing.typing_context -> Logic_typing.Lenv.t -> Logic_ptree.lexpr -> Cil_types.predicate/typechecks a predicate. Note that the first argument is itself a typing_context, which allows for open recursion. Namely, it is possible for the extension to change the type-checking functions for the sub-nodes of the parsed tree, and not only for the toplevel lexpr./ Parameter_sig.Builder.False/functor (X : Parameter_sig.Input ) -> Parameter_sig.Bool/Set the boolean to false./ Cil.cilVisitor.vglob/Cil_types.global -> Cil_types.global list Cil.visitAction/Global (vars, types, etc.)/ Parameter_sig.Builder.String/string end ) -> Parameter_sig.String/What is the possible range of values for this parameter./ State/t -> unitend /A state is a project-compliant mutable value./ Type.name/'a Type.t -> string/Apply this functor to access to the abstract type of the given name./ Log.Messages.debug/?level:int -> ?dkey:Log.category -> 'a Log.pretty_printer/Debugging information dedicated to Plugin developers. Default level is 1. The debugging key is used in message headers. See also set_debug_keys and set_debug_keyset./ -Cil_state_builder/functor (Data : Datatype.S ) -> functor (Info : State_builder.Info_with_size ) -> State_builder.Hashtbl with type key = Cil_types.varinfo and type data = Data.tend /Functors for building computations which use kernel datatypes./ -Cil_printer.register_behavior_extension/string -> (Printer_api.extensible_printer_type -> Format.formatter -> int * Cil_types.identified_predicate list -> unit) -> unit/Register a pretty-printer used for behavior extension./ +Cil_state_builder/functor (Data : Datatype.S ) -> functor (Info : State_builder.Info_with_size ) -> State_builder.Hashtbl with type key = Cil_types.kernel_function and type data = Data.tend /Functors for building computations which use kernel datatypes./ +Cil_printer.register_behavior_extension/string -> (Printer_api.extensible_printer_type -> Format.formatter -> Cil_types.acsl_extension_kind -> unit) -> unit/Register a pretty-printer used for behavior extension./ Structural_descr.p_int/Structural_descr.pack/Equivalent to pack Abstract/ -Lmap/[ `Bottom | `Constant of V.t | `Other | `Top ] end ) -> module type of Lmap_sig with type v = V.t and type widen_hint_base = V.generic_widen_hint and type offsetmap = Offsetmap.tend /Maps from bases to memory maps. The memory maps are those of the Offsetmap module./ -Dynamic/string -> unitend /Value accesses through dynamic typing./ +Lmap/V.t Lmap.default_contents end ) -> module type of Lmap_sig with type v = V.t and type widen_hint_base = V.generic_widen_hint and type offsetmap = Offsetmap.tend /Maps from bases to memory maps. The memory maps are those of the Offsetmap module./ +Dynamic/string list -> unitend /Value accesses through dynamic typing./ Kernel_function.dummy/unit -> t/callsites f collect the statements where f is called. Same complexity as find_from_sid./ Design/GSourceView2.source_buffer -> offset:int -> Property_status.Feedback.t -> unitend end /The extensible GUI./ Datatype.list/'a Type.t -> 'a list Type.t/Functor for polymorphic types with 4 type variables./ @@ -134,12 +139,13 @@ Type.AlreadyExists/string/May be raised by Type.register./ Property_status/Property.t -> boolend /Status of properties./ Datatype.never_any_project/(Project_skeleton.t -> bool) -> 'a -> bool/Must be used for mem_project if values of your type does never contain any project./ Property/string -> stringend end /ACSL comparable property./ -Cil_datatype/(Cil_types.typ -> Cil_types.typ) Pervasives.refend /Datatypes of some useful CIL types./ +Cil_datatype/unit -> unitend /Datatypes of some useful CIL types./ Datatype.Int/Datatype.S_with_collections with type t = int/Deep copy: no possible sharing between x and copy x./ Datatype.Make/functor (X : Datatype.Make_input ) -> Datatype.S with type t = X.t/Generic datatype builder./ +Cil.set_varinfo/Cil.visitor_behavior -> Cil_types.varinfo -> Cil_types.varinfo -> unit/change the representative of a given varinfo in the current state of the visitor. Use with care (i.e. makes sure that the old one is not referenced anywhere in the AST, or sharing will be lost./ Cmdline.run_after_setting_files/(string list -> unit) -> unit/Register an action to be executed just after setting the files put on the command line. The argument of the function is the list of files./ Dynamic.register/?comment:string -> plugin:string -> string -> 'a Type.t -> journalize:bool -> 'a -> 'a/register ~plugin name ty v registers v with the name name, the type ty and the plug-in plugin. raised exception: Type.AlreadyExists./ -Kernel/Parameter_sig.Stringend /Provided services for kernel developers./ +Kernel/Parameter_sig.Boolend /Provided services for kernel developers./ Emitter.create/string -> Emitter.kind list -> correctness:Typed_parameter.t list -> tuning:Typed_parameter.t list -> t/Emitter.create name kind ~correctness ~tuning creates a new emitter with the given name. The given parameters are the ones which impact the generated annotations/status. A "correctness" parameter may fully change a generated element when its value changes (for instance, a valid status may become invalid and conversely). A "tuning" parameter may improve a generated element when its value changes (for instance, a "dont_know" status may become valid or invalid, but a valid status cannot become invalid). The given name must be unique. raised exception: Invalid_argument./ Plugin.Register/string end ) -> Plugin.General_services/Functors for registering a new plug-in. It provides access to several services./ Cil.cilVisitor.vlogic_type_info_decl/Cil_types.logic_type_info -> Cil_types.logic_type_info Cil.visitAction// @@ -150,31 +156,35 @@ Cabs2cil.convFile/Cabs.file -> Cil_types.file/new hook that will be called when Datatype.Pair/functor (T1 : Datatype.S ) -> functor (T2 : Datatype.S ) -> Datatype.S with type t = T1.t * T2.t/Deep copy: no possible sharing between x and copy x./ Dynamic.get/plugin:string -> string -> 'a Type.t -> 'a/get ~plugin name ty returns the value registered with the name name, the type ty and the plug-in plugin. This plug-in will be loaded if required. raised exceptions: , if the name is not registered, if the name is not registered with a compatible type, _ in the -no-obj mode/ Locations.Location_Bits/ module type of Location_Bytes/Association between bases and offsets in bits./ -Annotations.add_assert/Emitter.t -> ?kf:Cil_types.kernel_function -> Cil_types.stmt -> Cil_types.predicate Cil_types.named -> unit/Add an assertion attached to the given statement. If kf is provided, the function runs faster./ +Annotations.add_assert/Emitter.t -> ?kf:Cil_types.kernel_function -> Cil_types.stmt -> Cil_types.predicate -> unit/Add an assertion attached to the given statement. If kf is provided, the function runs faster./ Cil.visitCilFileCopy/Cil.cilVisitor -> Cil_types.file -> Cil_types.file/Visit a file. This will re-cons all globals TWICE (so that it is tail-recursive). Use Cil.visitCilFileSameGlobals if your visitor will not change the list of globals./ Parameter_sig.Kernel_function_set/Parameter_sig.Set with type elt = Cil_types.kernel_function and type t = Cil_datatype.Kf.Set.t/Set of defined kernel functions. If you want to also include pure prototype, use Parameter_customize.argument_may_be_fundecl./ Parameter_sig.Builder.Empty_string/functor (X : Parameter_sig.Input_with_arg ) -> Parameter_sig.String/always return the argument, even if the argument is not a function name./ Ast.mark_as_changed/unit -> unit/call this function whenever you've made some changes in place inside the AST/ Log.Messages.result/?level:int -> ?dkey:Log.category -> 'a Log.pretty_printer/Results of analysis. Default level is 1./ +Kernel.SafeArrays/Parameter_sig.Bool/Behavior of option "-safe-arrays"./ Cil_types.stmt/{mutable labels: Cil_types.label list; mutable skind: Cil_types.stmtkind; mutable sid: int; mutable succs: Cil_types.stmt list; mutable preds: Cil_types.stmt list; mutable ghost: bool}/Statements./ Cil.visitCilFileSameGlobals/Cil.cilVisitor -> Cil_types.file -> unit/A visitor for the whole file that does not change the globals (but maybe changes things inside the globals). Use this function instead of Cil.visitCilFile whenever appropriate because it is more efficient for long files./ Cmdline.run_after_extended_stage/(unit -> unit) -> unit/Register an action to be executed at the end of the extended stage./ Db.Value.compute/(unit -> unit) Pervasives.ref/Compute the value analysis using the entry point of the current project. You may set it with Globals.set_entry_point. raised exceptions: , if the entry point is incorrect, if some arguments are specified for the entry point using Db.Value.fun_set_args, and an incorrect number of them is given./ Cil_types.logic_info/{mutable l_var_info: Cil_types.logic_var; mutable l_labels: Cil_types.logic_label list; mutable l_tparams: string list; mutable l_type: Cil_types.logic_type option; mutable l_profile: Cil_types.logic_var list; mutable l_body: Cil_types.logic_body}/description of a logic function or predicate./ Cil_types.fundec/{mutable svar: Cil_types.varinfo; mutable sformals: Cil_types.varinfo list; mutable slocals: Cil_types.varinfo list; mutable smaxid: int; mutable sbody: Cil_types.block; mutable smaxstmtid: int option; mutable sallstmts: Cil_types.stmt list; mutable sspec: Cil_types.funspec}/Function definitions./ -Locations.Location_Bytes/Base.t -> Locations.Location_Bytes.t -> boolend /Association between bases and offsets in byte./ +Locations.Location_Bytes/bool -> unitend /Association between bases and offsets in byte./ Project.on/?selection:State_selection.t -> t -> ('a -> 'b) -> 'a -> 'b/on p f x sets the current project to p, computes f x then restores the current project. You should use this function if you use a project different of current ()./ +Cabs/end /Untyped AST./ Design.main_window_extension_points//This is the type of extension points for the GUI./ -Pretty_utils/'a Pretty_utils.formatter -> 'a Pretty_utils.formatterend /Pretty-printer utilities./ +Pretty_utils/?align:Pretty_utils.align -> ?pp:string Pretty_utils.formatter -> Pretty_utils.marger -> string Pretty_utils.formatterend /Pretty-printer utilities./ Dynamic.Parameter/string -> (string -> unit) -> unitend end /Module to use for accessing parameters of plug-ins. Assume that the plug-in is already loaded./ Datatype.Polymorphic2/((Project_skeleton.t -> bool) -> 'a -> bool) -> ((Project_skeleton.t -> bool) -> 'b -> bool) -> (Project_skeleton.t -> bool) -> ('a, 'b) Datatype.t -> bool end ) -> Datatype.Polymorphic2 with type ('a, 'b) poly = ('a, 'b) P.t/Functor for polymorphic types with 2 type variables./ Parameter_customize.set_negative_option_name/string -> unit/For boolean parameters, set the name of the negative option generating automatically from the positive one (the given option name). The default used value prefixes the given option name by "-no". Assume that the given string is a valid option name or empty. If it is empty, no negative option is created./ Parameter_state.get_selection/?is_set:bool -> unit -> State_selection.t/Selection of all the settable parameters. is_set is true by default (for backward compatibility): in such a case, for each option, the extra internal state indicating whether it is set also belongs to the selection./ Cil.cilVisitor.vlogic_ctor_info_decl/Cil_types.logic_ctor_info -> Cil_types.logic_ctor_info Cil.visitAction// Project.save/?selection:State_selection.t -> ?project:t -> string -> unit/Save a given project in a file. Default project is current (). raised exception: IOError./ -Plugin/(unit -> string) Pervasives.refend /Provided plug-general services for plug-ins./ +Plugin/(Plugin.plugin -> unit) -> unitend /Provided plug-general services for plug-ins./ +Cil.get_original_varinfo/Cil.visitor_behavior -> Cil_types.varinfo -> Cil_types.varinfo/retrieve the original representative of a given copy of a varinfo in the current state of the visitor./ +Cil_types.acsl_extension_kind/ | Ext_id of int | Ext_terms of Cil_types.term list | Ext_preds of Cil_types.predicate list/a list of predicates, the most common case of for extensions/ Cabs.file//the string is a file name, and then the list of toplevel forms./ -Cil_datatype.Varinfo/(Type.precedence -> Format.formatter -> t -> unit) Pervasives.refend /Identity of a key. Must verify id k >= 0 and equal k1 k2 ==> id k1 = id k2/ +Cil_datatype.Varinfo/tend /Identity of a key. Must verify id k >= 0 and equal k1 k2 ==> id k1 = id k2/ Cil.cilVisitor.vfile/Cil_types.file -> Cil_types.file Cil.visitAction/visit a whole file./ Cil.copy_visit/Project.t -> Cil.visitor_behavior/Makes fresh copies of the mutable structures.- preserves sharing for varinfo.- makes fresh copy of varinfo only for declarations. Variables that are only used in the visited AST are thus still shared with the original AST. This allows for instance to copy a function with its formals and local variables, and to keep the references to other globals in the function's body./ Log.print_delayed/(Format.formatter -> unit) -> unit/Direct printing on output. Same as print_on_output, except that message echo is not delayed until text material is actually written. This gives an chance for formatters to emit messages before actual pretty printing. Can not be recursively invoked./ @@ -187,34 +197,36 @@ Locations.enumerate_valid_bits/for_writing:bool -> Locations.location -> Locatio File.add_code_transformation_after_cleanup/?deps:(module Parameter_sig.S) list -> ?before:File.code_transformation_category list -> ?after:File.code_transformation_category list -> File.code_transformation_category -> (Cil_types.file -> unit) -> unit/Same as above, but the hook is applied after clean up. At this level, globals and ACSL annotations have been registered. If the hook adds some new globals or annotations, it must take care of adding them in the appropriate tables. Note that it is the responsibility of the hook to use Ast.mark_as_changed or Ast.mark_as_grown whenever it is the case./ Cil_types.file/{mutable fileName: string; mutable globals: Cil_types.global list; mutable globinit: Cil_types.fundec option; mutable globinitcalled: bool}/The top-level representation of a CIL source file (and the result of the parsing and elaboration). Its main contents is the list of global declarations and definitions. You can iterate over the globals in a Cil_types.file using the following iterators: Cil.mapGlobals, Cil.iterGlobals and Cil.foldGlobals. You can also use the Cil.dummyFile when you need a Cil_types.file as a placeholder. For each global item CIL stores the source location where it appears (using the type Cil_types.location)/ Type.par/Type.precedence -> Type.precedence -> Format.formatter -> (Format.formatter -> unit) -> unit/par context myself fmt pp puts parenthesis around the verbatim prints by pp according to the precedence myself of the verbatim and to the precedence context of the caller of the pretty printer. fmt is the output formatter. The typical use is the following: let pretty_print p_caller fmt x = let pp fmt = Format.fprintf "..." ... x ... in let myself = Call in par p_caller myself fmt pp/ -Logic_typing.register_behavior_extension/string -> (typing_context:Logic_typing.typing_context -> loc:Cil_types.location -> Cil_types.funbehavior -> Logic_ptree.lexpr list -> unit) -> unit/register_behavior_extension name f registers a typing function f to be used to type clause with name name. This function may change the funbehavior in place. Here is a basic example: let foo_typer ~typing_context ~loc bhv ps = match ps with p::[] -> bhv.b_extended <- ("FOO",42, Logic_const.new_predicate (typing_context.type_predicate (typing_context.post_state [Normal]) p)) ::bhv.b_extended | _ -> typing_context.error loc "expecting a predicate after keyword FOO" let () = register_behavior_extension "FOO" foo_typer/ +Logic_typing.register_behavior_extension/string -> (typing_context:Logic_typing.typing_context -> loc:Cil_types.location -> Logic_ptree.lexpr list -> Cil_types.acsl_extension_kind) -> unit/register_behavior_extension name f registers a typing function f to be used to type clause with name name. Here is a basic example: let count = ref 0 in let foo_typer ~typing_context ~loc ps = match ps with p::[] -> Ext_preds (typing_context.type_predicate typing_context (typing_context.post_state [Normal]) p)) | [] -> let id = !count in incr count; Ext_id id | _ -> typing_context.error loc "expecting a predicate after keyword FOO" let () = register_behavior_extension "FOO" foo_typer/ Datatype.bool/bool Type.t// Datatype.pp_fail/Type.precedence -> Format.formatter -> 'a -> unit/Must be used for internal_pretty_code if this pretty-printer must fail only when called./ Visitor.visitFramacFileSameGlobals/Visitor.frama_c_visitor -> Cil_types.file -> unit/A visitor for the whole file that does not change the globals (but maybe changes things inside the globals). Use this function instead of Visitor.visitFramacFile whenever appropriate because it is more efficient for long files./ Log.Messages.with_log/(Log.event -> 'b) -> ?kind:Log.kind -> ('a, 'b) Log.pretty_aborter// Cil.visitor_behavior//Visitor behaviorHow the visitor should behave in front of mutable fields: in place modification or copy of the structure. This type is abstract. Use one of the two values below in your classes./ Cmdline.run_after_early_stage/(unit -> unit) -> unit/Register an action to be executed at the end of the early stage./ -Cil_types.logic_var/{mutable lv_name: string; mutable lv_id: int; mutable lv_type: Cil_types.logic_type; mutable lv_kind: Cil_types.logic_var_kind; mutable lv_origin: Cil_types.varinfo option}/description of a logic variable/ +Cil_types.logic_var/{mutable lv_name: string; mutable lv_id: int; mutable lv_type: Cil_types.logic_type; mutable lv_kind: Cil_types.logic_var_kind; mutable lv_origin: Cil_types.varinfo option; mutable lv_attr: Cil_types.attributes}/description of a logic variable/ Dataflow/Cil_types.fundec -> Cil_types.stmt list * Cil_types.stmt listend /Deprecated: use Dataflows instead. A framework for implementing data flow analysis./ Log.log_channel/Log.channel -> ?kind:Log.kind -> ?prefix:Log.prefix -> 'a Log.pretty_printer/logging function to user-created channel./ +Db.progress/(unit -> unit) Pervasives.ref/This function should be called from time to time by all analysers taking time. In GUI mode, this will make the interface reactive./ Kernel_function.get_definition/t -> Cil_types.fundec/For functions with a declaration and a definition, returns the definition. raised exception: No_Definition./ Datatype.char/char Type.t// Cil.cilVisitor.vlogic_info_decl/Cil_types.logic_info -> Cil_types.logic_info Cil.visitAction/link to the current function being visited. NB: for copy visitors, the fundec is the original one./ +Cil_types.acsl_extension//extension to standard ACSL clause. Each extension is associated to a keyword. An extension can be registered through the following functions:- Logic_typing.register_behavior_extension for parsing and type-checking- Cil_printer.register_behavior_extension for pretty-printing an extended clause- Cil.register_behavior_extension for visiting an extended clause/ Cil_types.offset/ | NoOffset | Field of Cil_types.fieldinfo * Cil_types.offset | Index of Cil_types.exp * Cil_types.offset/The offset part of an Cil_types.lval. Each offset can be applied to certain kinds of lvalues and its effect is that it advances the starting address of the lvalue and changes the denoted type, essentially focussing to some smaller lvalue that is contained in the original one./ Datatype.Bool/Datatype.S_with_collections with type t = bool/Deep copy: no possible sharing between x and copy x./ Cil.cilVisitor.vlogic_info_use/Cil_types.logic_info -> Cil_types.logic_info Cil.visitAction// File.new_file_type/string -> (string -> Cil_types.file * Cabs.file) -> unit/new_file_type suffix func funcname registers a new type of files (with corresponding suffix) as recognized by Frama-C through func./ Log.Messages.log/?kind:Log.kind -> ?verbose:int -> ?debug:int -> 'a Log.pretty_printer/Generic log routine. The default kind is Result. Use cases (with n,m > 0):- log ~verbose:n: emit the message only when verbosity level is at least n.- log ~debug:n: emit the message only when debugging level is at least n.- log ~verbose:n ~debug:m: any debugging or verbosity level is sufficient./ -Type/('a, Format.formatter, unit, string) Pervasives.format4 -> 'aend /Type value. A type value is a value representing a static ML monomorphic type. This API is quite low level. Prefer to use module Datatype instead whenever possible./ +Type/'b Type.Obj_tbl.t -> ('a Type.ty -> 'a -> 'b -> unit) -> unitend end /Type value. A type value is a value representing a static ML monomorphic type. This API is quite low level. Prefer to use module Datatype instead whenever possible./ Datatype.identity/'a -> 'a/Must be used if you want to implement a required function by fun x -> x. Only useful for implementing rehash and copy./ State_selection/end /A state selection is a set of states with operations for easy handling of state dependencies./ Project.set_current/?on:bool -> ?selection:State_selection.t -> t -> unit/Set the current project with the given one. The flag on is not for casual users. raised exception: Invalid_argument./ -Logic_const/Cil_types.term_offset -> Cil_types.term_lval -> Cil_types.term_lvalend /Smart contructors for logic annotations./ +Logic_const/Cil_types.term_offset -> Cil_types.term_lval -> Cil_types.term_lvalend /Smart constructors for logic annotations./ Cil.cilVisitor.vlogic_type_info_use/Cil_types.logic_type_info -> Cil_types.logic_type_info Cil.visitAction// Kernel_function.Make_Table/functor (Data : Datatype.S ) -> functor (Info : State_builder.Info_with_size ) -> State_builder.Hashtbl with type key = t and type data = Data.t/Hashtable indexed by kernel functions and dealing with project./ State_builder.Ref/unit -> Data.t end ) -> State_builder.Ref with type data = Data.t/Deep copy: no possible sharing between x and copy x./ File.add_code_transformation_before_cleanup/?deps:(module Parameter_sig.S) list -> ?before:File.code_transformation_category list -> ?after:File.code_transformation_category list -> File.code_transformation_category -> (Cil_types.file -> unit) -> unit/add_code_transformation_before_cleanup name hook adds an hook in the corresponding category that will be called during the normalization of a linked file, before clean up and removal of temps and unused declarations. If this transformation involves changing statements of a function f, f must be flagged with File.must_recompute_cfg. The optional before (resp after) categories indicates that current transformation must be executed before (resp after) the corresponding ones, if they exist. In case of dependencies cycle, an arbitrary order will be chosen for the transformations involved in the cycle. The optional deps argument gives the list of options whose change (e.g. after a -then) will trigger the transformation over the already computed AST. If several transformations are triggered by the same option, their relative order is preserved. At this level, globals and ACSL annotations have not been registered./ -Db/(?stmt:Cil_types.stmt -> Cil_types.kernel_function -> Inout_type.t) Pervasives.refend end /Database in which static plugins are registered./ +Db/end /Database in which static plugins are registered./ Type.Abstract/Type.Abstract.t Type.tyend /Apply this functor to access to the abstract type of the given name. raised exception: No_abstract_type./ Logic_utils/unit -> boolend /Utilities for ACSL constructs./ Cil.cilVisitor.voffs/Cil_types.offset -> Cil_types.offset Cil.visitAction/Invoked on each offset occurrence that is *not* as part of an initializer list specification, i.e. in an lval or recursively inside an offset./ @@ -226,6 +238,7 @@ Project.current/unit -> t/The current project. raised exception: NoProject./ State.dummy/t/A dummy state./ Project_skeleton.t/{pid: int; mutable name: string; mutable unique_name: string}/No function is exported. Extension of the GUI in order to support project switching./ Cil.get_kernel_function/Cil.visitor_behavior -> Cil_types.kernel_function -> Cil_types.kernel_function// +File.new_machdep/string -> Cil_types.mach -> unit/new_machdep name module registers a new machdep name as recognized by Frama-C through The usual uses is Cmdline.run_after_loading_stage (fun () -> File.new_machdep "my_machdep" my_machdep_implem) raised exception: Invalid_argument./ State_builder/?prj:Project.t -> string -> 'a Type.t -> 'a * boolend end /State builders. Provide ways to implement signature State_builder.S. Depending on the builder, also provide some additional useful information./ Cil.cilVisitor.current_kinstr/Cil_types.kinstr/Kstmt stmt when visiting statement stmt, Kglobal when called outside of a statement./ -Parameter_sig.Int/Parameter_sig.Int/Signature for an integer parameter./ +Parameter_sig.Int/Parameter_sig.Int/Signature for an integer parameter./ \ No newline at end of file diff --git a/doc/developer/developer.tex b/doc/developer/developer.tex index ec6ba33da4e1f96dc5428d6627fd0351baa97368..9fe1c2603ea5428bed744c290b925277fc70c8d8 100644 --- a/doc/developer/developer.tex +++ b/doc/developer/developer.tex @@ -2,7 +2,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%MODERN \documentclass[a4paper,11pt,twoside,openright]{report} -\documentclass[web]{frama-c-book} +\documentclass[web,svgnames]{frama-c-book} \usepackage{xspace,alltt,calc,multirow,tabularx,bigdelim} \usepackage{amsmath} @@ -16,6 +16,15 @@ \usepackage{makeidx} \usepackage{graphicx} \usepackage{enumerate} +\usepackage{varwidth} +\usepackage{tikz} +\usetikzlibrary{fit} +\usetikzlibrary{backgrounds} +\usetikzlibrary{chains} +\usetikzlibrary{arrows.meta} +\usetikzlibrary{calc} +\usetikzlibrary{matrix} +\usetikzlibrary{scopes} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -97,8 +106,8 @@ Pierre-Loïc Garoche, Philippe Herrmann, Boris Hollas, Nikolaï Kosmatov, Jean-Christophe Léchenet, André Maroneze, Benjamin Monate, Yannick Moy, Anne Pacalet, Armand Puccetti, Muriel Roger and Boris Yakobowski. We also thank Johannes Kanig for his \langage{Mlpost} -support\footnote{\url{http://mlpost.lri.fr}}, the tool used for making figures -of this document. +support\footnote{\url{http://mlpost.lri.fr}}, the tool formerly used for +making figures of this document. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/developer/integrated_plugin.ml b/doc/developer/integrated_plugin.ml deleted file mode 100644 index df1990d1d14b2d58ca57c395aa49a2429282c961..0000000000000000000000000000000000000000 --- a/doc/developer/integrated_plugin.ml +++ /dev/null @@ -1,256 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* All rights reserved. *) -(* Contact CEA LIST for licensing. *) -(* *) -(**************************************************************************) - -open Mlpost -open Box - -(* Some custom values *) - -let padding = Num.bp 15. -let delta = Num.bp 10. - -let unused = "$^\\star$" -let big_title s = "\\textbf{\\Large{" ^ s ^ "}}" -let small_title s = "\\textbf{\\large{" ^ s ^ "}}" - -let external_color = Color.rgb8 255 165 0 -let internal_color = Color.rgb8 50 205 50 -let plugin_color = Color.lightcyan -let make_color = Color.rgb8 250 128 114 -let intf_color = Color.rgb8 46 139 97 - -(* Some very useful functions. - [TODO] Should be in some way in the mlpost API? *) - -let box_width ?name ?style ?fill ?dy w b = - box ?name ?style ?fill ?dy ~dx:(Num.divf (Num.subn w (width b)) 2.) b - -let box_height ?name ?style ?fill ?dx h b = - box ?name ?style ?fill ?dx ~dy:(Num.divf (Num.subn h (height b)) 2.) b - -let box_hw ?name ?style ?fill h b = - box ?name ?style ?fill - ~dx:(Num.divf (Num.subn h (width b)) 2.) - ~dy:(Num.divf (Num.subn h (height b)) 2.) b - -let vbox_same_width ?name ?padding ~style l = - let max = List.fold_left (fun acc b -> Num.maxn acc (width b)) Num.zero l in - vbox ?name ?padding - (List.map - (fun b -> box_width max - ~style - ?fill:(get_fill b) - ~dy:Num.zero - (clear_stroke b)) - l) - -let simulate_box ?name b = empty ?name ~width:(width b) ~height:(height b) () - -let xmed ?(coef=0.5) p1 p2 = - Num.multf coef (Num.addn (Point.xpart p1) (Point.xpart p2)) -let ymed ?(coef=0.5) p1 p2 = - Num.multf coef (Num.addn (Point.ypart p1) (Point.ypart p2)) -let med ?xcoef ?ycoef p1 p2 = - Point.pt (xmed ?coef:xcoef p1 p2, ymed ?coef:ycoef p1 p2) - -(* Some special functions for this figure *) - -let modul ?(color=external_color) ?same_height ?same_width s = - let t = tex s in - match same_height, same_width with - | None, None -> box ~name:s ~fill:color ~style:Rect t - | Some h, None -> box_height ~name:s ~fill:color ~style:Rect h t - | None, Some w -> box_width ~name:s ~fill:color ~style:Rect w t - | Some h, Some w -> - assert (h = w); - box_hw ~name:s ~fill:color ~style:Rect w t - -(* The figure itself *) - -let fig = - - (* special external modules: Makefile + Design *) - let design = - rect ~fill:external_color ~name:"design" - (vbox [ tex ("Design" ^ unused); tex "(GUI extension point)" ]) - in - let std_modul = modul ~same_height:(height design) in - - (* empty modules *) - let empty_modules ?(color=internal_color) () = - let empty_module = std_modul ~color ~same_width:(height design) "" in - let points = tex "\\dots" in - hbox ~padding [ empty_module; points; empty_module ] - in - - let makein = std_modul ~color:make_color "Makefile" in - let configurein = std_modul ~color:make_color "configure.in" in - let autotools = hbox ~padding [ makein; configurein ] in - - let tests = - round_rect ~name:"tests" ~fill:plugin_color ~dx:padding ~dy:delta - (vbox ~padding:delta - [ tex (small_title "Plug-in tests suite"); - empty_modules ~color:plugin_color () ]) - in - - let types = - round_rect ~fill:intf_color ~dx:padding ~dy:delta - (vbox ~padding:delta - [ tex (small_title ("Plug-in types" ^ unused)); - empty_modules ~color:intf_color () ]) - in - - (* Plug-in implem *) - let title = tex (small_title "Plug-in implementation") in - let register = std_modul ~color:internal_color "Register" in - let options = std_modul ~color:internal_color "Options" in - let b = vbox_same_width ~padding:delta ~style:Rect [ register; options ] in - let b = vbox ~padding:delta [ title; b; empty_modules () ] in - let implem = - round_rect ~name:"implem" ~fill:internal_color ~dx:delta ~dy:delta b - in - - (* Plug-in GUI *) - let gui = tex (small_title "Plug-in GUI$^\\star$") in - let gui = - round_rect ~name:"gui" ~dx:delta ~dy:(Num.addn delta (Num.divf padding 2.)) - ~fill:internal_color - (vbox ~padding:delta [ gui; empty_modules () ]) - in - - (* Makefile *) - let makefile = - let t = tex (small_title "Empty plug-in interface") in - box_height - ~name:"makefile" - ~style:RoundRect - ~fill:intf_color - (Num.subn (height implem) (Num.addn (height gui) padding)) - t - in - - (* Makefile + Plug-in GUI *) - let right_box = - vbox_same_width ~name:"right" ~padding ~style:RoundRect [ makefile; gui ] - in - - (* left column *) - let db_main = std_modul "Db.Main" in - let db = std_modul "Db" in - let journal = std_modul ("Journal" ^ unused) in - let plugin = std_modul "Plugin" in - let prj = std_modul ("Project" ^ unused) in - let typ = std_modul ("Type" ^ unused) in - let left_box = - vbox_same_width ~padding ~style:Rect - [ db; db_main; plugin; typ; journal; prj ] - in - - (* setting the components as a matrix *) - let figure = - hbox ~padding:(Num.multf 3. padding) - [ - left_box; - tabularl ~hpadding:padding ~vpadding:(Num.multf 3. padding) - [ - [ tests; autotools ]; - [ simulate_box ~name:"ei" implem; - simulate_box ~name:"er" right_box ]; - [ types; design ] - ] - ] - in - let getf s = get s figure in - - (* add the Plug-in directory and merge it in the matrix *) - let nwp = north_west (getf "ei") in - let sep = south_east (getf "er") in - let main_box = hbox ~padding [ implem; right_box ] in - let title = tex (big_title "Plug-in directory") in - let b = vbox ~padding:delta [ title; main_box ] in - let directory_box = - let r = round_rect ~fill:plugin_color ~dx:padding ~dy:delta b in - center (med nwp sep) r - in - - (* caption *) - let caption = - tabularl ~pos:`Right ~hpadding:delta - [ - [ tex "\\textbf{Caption:}"; empty () ]; - [ tex "$\\star$"; tex "part not covered in this tutorial" ]; - [ hbox ~padding [ empty ~name:"c1" (); empty ~name:"c2" () ]; - tex "registration points through hooks" ]; - [ hbox ~padding [ empty ~name:"c3" (); empty ~name:"c4" () ]; - tex "insertion points directly into the pointed file" ] - ] - in - - let full_box = vbox ~padding ~pos:` Right [ figure; caption ] in - - let draw_arrow ?(insert=false) l = - let p = Path.pathp ~style:Path.jLine l in - if insert then Arrow.simple ~color:Color.red ~pen:Pen.circle p - else Arrow.simple p - in - let arrow ?insert pos src dst = - let p1, p2 = match pos with - | `West -> - let p2 = west dst in - Point.pt (Point.xpart (east src), Point.ypart p2), p2 - | `East -> - let p2 = east dst in - Point.pt (Point.xpart (west src), Point.ypart p2), p2 - | `South -> - let p2 = south dst in - Point.pt (Point.xpart p2, Point.ypart (north src)), p2 - | `North -> - let p2 = north dst in - Point.pt (Point.xpart p2, Point.ypart (south src)), p2 - in - draw_arrow ?insert [ p1; p2 ] - in - let third_arrow coef ?insert ?(yscale=1.) src dst = - let p1 = Point.yscale (Num.bp yscale) (west src) in - let p4 = (*east dst*) (* [TODO] Don't know why it doesn't work *) - Point.pt (Point.xpart (east left_box), Point.ypart (east dst)) - in - let x = xmed ~coef p1 p4 in - let p2 = Point.pt (x, Point.ypart p1) in - let p3 = Point.pt (x, Point.ypart p4) in - (* [TODO] Why [Arrow.draw] does not provide the same result? *) - draw_arrow ?insert [ p1; p2; p3; p4 ] - in - let getf s = get s full_box in - Command.seq - [ - draw full_box; - draw directory_box; - arrow `East (getf "c1") (getf "c2"); - arrow ~insert:true `East (getf "c3") (getf "c4"); - arrow `North (get "gui" directory_box) (getf "design"); - arrow ~insert:true `West (getf "tests") (getf "Makefile"); - arrow ~insert:true `South directory_box (getf "Makefile"); - arrow ~insert:true `South directory_box (getf "configure.in"); - third_arrow ~insert:true 0.5 ~yscale:0.3 directory_box (getf "Db"); - third_arrow 0.29 (get "Options" directory_box) (getf "Plugin"); - third_arrow 0.32 (get "Register" directory_box) (getf "Db.Main"); - third_arrow 0.4 ~yscale:1.23 - (get "implem" directory_box) (getf ("Journal" ^ unused)); - third_arrow 0.4 ~yscale:1.23 - (get "implem" directory_box) (getf ("Type" ^ unused)); - third_arrow 0.55 ~yscale:1.5 directory_box (getf ("Project" ^ unused)); - ] - -let _ = Metapost.emit "integrated_plugin" fig diff --git a/doc/developer/integrated_plugin.mps b/doc/developer/integrated_plugin.mps deleted file mode 100644 index 894b42d05bb901dd17bca05160b68ffc9026bd42..0000000000000000000000000000000000000000 --- a/doc/developer/integrated_plugin.mps +++ /dev/null @@ -1,100 +0,0 @@ -%!PS -%%BoundingBox: -17.000000 -375.000000 416.000000 89.000000 -%%HiResBoundingBox: -16.841680 -374.203123 415.926348 88.149374 -%%Creator: Mlpost current -%%Pages: 1 -%*Font: cmbx10 10.000000 9.962620 3a:8 -%*Font: cmbx12 12.000000 11.955144 2d:8 -%*Font: cmmi10 10.000000 9.962620 3f:8 -%*Font: cmmi7 7.000000 6.973834 3f:8 -%*Font: cmmi8 8.000000 7.970096 3f:8 -%*Font: cmr10 10.000000 9.962620 c:8 -%%BeginProlog -%%EndProlog -%%Page: 1 1 -0 0.5 dtransform truncate idtransform setlinewidth pop 1 setlinecap 1 setlinejoin gsave 1 0.6471 0 setrgbcolor newpath 29.74 -11.92 moveto 29.74 -1.334 29.74 8.253 29.74 18.84 curveto 13.96 18.84 -0.8155 18.84 -16.59 18.84 curveto -16.59 8.253 -16.59 -1.334 -16.59 -11.92 curveto -0.8155 -11.92 13.96 -11.92 29.74 -11.92 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 17.15 -11.92 moveto 17.15 -1.334 17.15 8.253 17.15 18.84 curveto 9.763 18.84 3.382 18.84 -4 18.84 curveto -4 8.253 -4 -1.334 -4 -11.92 curveto 3.382 -11.92 9.763 -11.92 17.15 -11.92 curveto close_path fill - grestore gsave [1 0 0 1 0 0] concat 0 setgray 0 0 moveto (\104\142) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 29.74 -11.92 moveto 29.74 -1.334 29.74 8.253 29.74 18.84 curveto 13.96 18.84 -0.8155 18.84 -16.59 18.84 curveto -16.59 8.253 -16.59 -1.334 -16.59 -11.92 curveto -0.8155 -11.92 13.96 -11.92 29.74 -11.92 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.74 -57.68 moveto 29.74 -47.09 29.74 -37.51 29.74 -26.92 curveto 13.96 -26.92 -0.8155 -26.92 -16.59 -26.92 curveto -16.59 -37.51 -16.59 -47.09 -16.59 -57.68 curveto -0.8155 -57.68 13.96 -57.68 29.74 -57.68 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.74 -57.68 moveto 29.74 -47.09 29.74 -37.51 29.74 -26.92 curveto 13.96 -26.92 -0.8155 -26.92 -16.59 -26.92 curveto -16.59 -37.51 -16.59 -47.09 -16.59 -57.68 curveto -0.8155 -57.68 13.96 -57.68 29.74 -57.68 curveto close_path fill - grestore gsave [1 0 0 1 -12.59 -45.76] concat 0 setgray 0 0 moveto (\104\142\056\115\141\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 29.74 -57.68 moveto 29.74 -47.09 29.74 -37.51 29.74 -26.92 curveto 13.96 -26.92 -0.8155 -26.92 -16.59 -26.92 curveto -16.59 -37.51 -16.59 -47.09 -16.59 -57.68 curveto -0.8155 -57.68 13.96 -57.68 29.74 -57.68 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.74 -103.4 moveto 29.74 -92.85 29.74 -83.27 29.74 -72.68 curveto 13.96 -72.68 -0.8155 -72.68 -16.59 -72.68 curveto -16.59 -83.27 -16.59 -92.85 -16.59 -103.4 curveto -0.8155 -103.4 13.96 -103.4 29.74 -103.4 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 24.76 -103.4 moveto 24.76 -92.85 24.76 -83.27 24.76 -72.68 curveto 12.3 -72.68 0.8449 -72.68 -11.61 -72.68 curveto -11.61 -83.27 -11.61 -92.85 -11.61 -103.4 curveto 0.8449 -103.4 12.3 -103.4 24.76 -103.4 curveto close_path fill - grestore gsave [1 0 0 1 -7.61 -90.55] concat 0 setgray 0 0 moveto (\120\154\165\147\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 29.74 -103.4 moveto 29.74 -92.85 29.74 -83.27 29.74 -72.68 curveto 13.96 -72.68 -0.8155 -72.68 -16.59 -72.68 curveto -16.59 -83.27 -16.59 -92.85 -16.59 -103.4 curveto -0.8155 -103.4 13.96 -103.4 29.74 -103.4 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.74 -149.2 moveto 29.74 -138.6 29.74 -129 29.74 -118.4 curveto 13.96 -118.4 -0.8155 -118.4 -16.59 -118.4 curveto -16.59 -129 -16.59 -138.6 -16.59 -149.2 curveto -0.8155 -149.2 13.96 -149.2 29.74 -149.2 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 24.07 -149.2 moveto 24.07 -138.6 24.07 -129 24.07 -118.4 curveto 12.07 -118.4 1.073 -118.4 -10.93 -118.4 curveto -10.93 -129 -10.93 -138.6 -10.93 -149.2 curveto 1.073 -149.2 12.07 -149.2 24.07 -149.2 curveto close_path fill - grestore gsave [1 0 0 1 -6.925 -136.3] concat 0 setgray 22.42 3.615 moveto (\077) cmmi7 6.974 fshow grestore gsave [1 0 0 1 -6.925 -136.3] concat 0 setgray 17.99 0 moveto (\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 -6.925 -136.3] concat 0 setgray 6.918 0 moveto (\171\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 -6.925 -136.3] concat 0 setgray 0 0 moveto (\124) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 29.74 -149.2 moveto 29.74 -138.6 29.74 -129 29.74 -118.4 curveto 13.96 -118.4 -0.8155 -118.4 -16.59 -118.4 curveto -16.59 -129 -16.59 -138.6 -16.59 -149.2 curveto -0.8155 -149.2 13.96 -149.2 29.74 -149.2 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.74 -195 moveto 29.74 -184.4 29.74 -174.8 29.74 -164.2 curveto 13.96 -164.2 -0.8155 -164.2 -16.59 -164.2 curveto -16.59 -174.8 -16.59 -184.4 -16.59 -195 curveto -0.8155 -195 13.96 -195 29.74 -195 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.27 -195 moveto 29.27 -184.4 29.27 -174.8 29.27 -164.2 curveto 13.81 -164.2 -0.661 -164.2 -16.13 -164.2 curveto -16.13 -174.8 -16.13 -184.4 -16.13 -195 curveto -0.661 -195 13.81 -195 29.27 -195 curveto close_path fill - grestore gsave [1 0 0 1 -12.13 -183] concat 0 setgray 32.82 3.615 moveto (\077) cmmi7 6.974 fshow grestore gsave [1 0 0 1 -12.13 -183] concat 0 setgray 0 0 moveto (\112\157\165\162\156\141\154) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 29.74 -195 moveto 29.74 -184.4 29.74 -174.8 29.74 -164.2 curveto 13.96 -164.2 -0.8155 -164.2 -16.59 -164.2 curveto -16.59 -174.8 -16.59 -184.4 -16.59 -195 curveto -0.8155 -195 13.96 -195 29.74 -195 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 29.74 -240.7 moveto 29.74 -230.1 29.74 -220.5 29.74 -210 curveto 13.96 -210 -0.8155 -210 -16.59 -210 curveto -16.59 -220.5 -16.59 -230.1 -16.59 -240.7 curveto -0.8155 -240.7 13.96 -240.7 29.74 -240.7 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 28.86 -240.7 moveto 28.86 -230.1 28.86 -220.5 28.86 -210 curveto 13.67 -210 -0.5226 -210 -15.71 -210 curveto -15.71 -220.5 -15.71 -230.1 -15.71 -240.7 curveto -0.5226 -240.7 13.67 -240.7 28.86 -240.7 curveto close_path fill - grestore gsave [1 0 0 1 -11.71 -227.8] concat 0 setgray 31.99 3.615 moveto (\077) cmmi7 6.974 fshow grestore gsave [1 0 0 1 -11.71 -227.8] concat 0 setgray 16.22 0 moveto (\152\145\143\164) cmr10 9.963 fshow grestore gsave [1 0 0 1 -11.71 -227.8] concat 0 setgray 0 0 moveto (\120\162\157) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 29.74 -240.7 moveto 29.74 -230.1 29.74 -220.5 29.74 -210 curveto 13.96 -210 -0.8155 -210 -16.59 -210 curveto -16.59 -220.5 -16.59 -230.1 -16.59 -240.7 curveto -0.8155 -240.7 13.96 -240.7 29.74 -240.7 curveto close_path stroke - grestore gsave 0.8784 1 1 setrgbcolor newpath 93.32 87.9 moveto 135.6 87.9 176.8 87.9 219.1 87.9 curveto 223.3 87.9 226.6 84.52 226.6 80.36 curveto 226.6 59.92 226.6 40.49 226.6 20.05 curveto 226.6 15.89 223.3 12.51 219.1 12.51 curveto 176.8 12.51 135.6 12.51 93.32 12.51 curveto 89.16 12.51 85.78 15.89 85.78 20.05 curveto 85.78 40.49 85.78 59.92 85.78 80.36 curveto 85.78 84.52 89.16 87.9 93.32 87.9 curveto close_path fill - grestore gsave [1 0 0 1 102.8 67.6] concat 0 setgray 78.99 0 moveto (\163\165\151\164\145) cmbx12 11.96 fshow grestore gsave [1 0 0 1 102.8 67.6] concat 0 setgray 47.29 0 moveto (\164\145\163\164\163) cmbx12 11.96 fshow grestore gsave [1 0 0 1 102.8 67.6] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.8784 1 1 setrgbcolor newpath 132.6 22.51 moveto 132.6 33.1 132.6 42.69 132.6 53.27 curveto 122 53.27 112.4 53.27 101.8 53.27 curveto 101.8 42.69 101.8 33.1 101.8 22.51 curveto 112.4 22.51 122 22.51 132.6 22.51 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 132.6 22.51 moveto 132.6 33.1 132.6 42.69 132.6 53.27 curveto 122 53.27 112.4 53.27 101.8 53.27 curveto 101.8 42.69 101.8 33.1 101.8 22.51 curveto 112.4 22.51 122 22.51 132.6 22.51 curveto close_path stroke - grestore gsave [1 0 0 1 149.6 37.37] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 149.6 37.37] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 149.6 37.37] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave 0.8784 1 1 setrgbcolor newpath 210.6 22.51 moveto 210.6 33.1 210.6 42.69 210.6 53.27 curveto 200 53.27 190.4 53.27 179.9 53.27 curveto 179.9 42.69 179.9 33.1 179.9 22.51 curveto 190.4 22.51 200 22.51 210.6 22.51 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 210.6 22.51 moveto 210.6 33.1 210.6 42.69 210.6 53.27 curveto 200 53.27 190.4 53.27 179.9 53.27 curveto 179.9 42.69 179.9 33.1 179.9 22.51 curveto 190.4 22.51 200 22.51 210.6 22.51 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 93.32 87.9 moveto 135.6 87.9 176.8 87.9 219.1 87.9 curveto 223.3 87.9 226.6 84.52 226.6 80.36 curveto 226.6 59.92 226.6 40.49 226.6 20.05 curveto 226.6 15.89 223.3 12.51 219.1 12.51 curveto 176.8 12.51 135.6 12.51 93.32 12.51 curveto 89.16 12.51 85.78 15.89 85.78 20.05 curveto 85.78 40.49 85.78 59.92 85.78 80.36 curveto 85.78 84.52 89.16 87.9 93.32 87.9 curveto close_path stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 312.1 34.83 moveto 312.1 45.41 312.1 55 312.1 65.59 curveto 297 65.59 282.9 65.59 267.9 65.59 curveto 267.9 55 267.9 45.41 267.9 34.83 curveto 282.9 34.83 297 34.83 312.1 34.83 curveto close_path fill - grestore gsave [1 0 0 1 271.9 46.75] concat 0 setgray 19.1 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 271.9 46.75] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 312.1 34.83 moveto 312.1 45.41 312.1 55 312.1 65.59 curveto 297 65.59 282.9 65.59 267.9 65.59 curveto 267.9 55 267.9 45.41 267.9 34.83 curveto 282.9 34.83 297 34.83 312.1 34.83 curveto close_path stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 385.5 34.83 moveto 385.5 45.41 385.5 55 385.5 65.59 curveto 365.7 65.59 346.9 65.59 327.1 65.59 curveto 327.1 55 327.1 45.41 327.1 34.83 curveto 346.9 34.83 365.7 34.83 385.5 34.83 curveto close_path fill - grestore gsave [1 0 0 1 331.1 47.72] concat 0 setgray 0 0 moveto (\143\157\156\014\147\165\162\145\056\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 385.5 34.83 moveto 385.5 45.41 385.5 55 385.5 65.59 curveto 365.7 65.59 346.9 65.59 327.1 65.59 curveto 327.1 55 327.1 45.41 327.1 34.83 curveto 346.9 34.83 365.7 34.83 385.5 34.83 curveto close_path stroke - grestore gsave 0.1804 0.5451 0.3804 setrgbcolor newpath 94.35 -234.4 moveto 135.9 -234.4 176.5 -234.4 218.1 -234.4 curveto 222.2 -234.4 225.6 -237.8 225.6 -241.9 curveto 225.6 -262.4 225.6 -281.8 225.6 -302.2 curveto 225.6 -306.4 222.2 -309.8 218.1 -309.8 curveto 176.5 -309.8 135.9 -309.8 94.35 -309.8 curveto 90.19 -309.8 86.81 -306.4 86.81 -302.2 curveto 86.81 -281.8 86.81 -262.4 86.81 -241.9 curveto 86.81 -237.8 90.19 -234.4 94.35 -234.4 curveto close_path fill - grestore gsave [1 0 0 1 114.6 -254.7] concat 0 setgray 78.54 4.338 moveto (\077) cmmi8 7.97 fshow grestore gsave [1 0 0 1 114.6 -254.7] concat 0 setgray 67.1 0 moveto (\145\163) cmbx12 11.96 fshow grestore gsave [1 0 0 1 114.6 -254.7] concat 0 setgray 52.15 0 moveto (\171\160) cmbx12 11.96 fshow grestore gsave [1 0 0 1 114.6 -254.7] concat 0 setgray 47.29 0 moveto (\164) cmbx12 11.96 fshow grestore gsave [1 0 0 1 114.6 -254.7] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1804 0.5451 0.3804 setrgbcolor newpath 132.6 -299.8 moveto 132.6 -289.2 132.6 -279.6 132.6 -269 curveto 122 -269 112.4 -269 101.8 -269 curveto 101.8 -279.6 101.8 -289.2 101.8 -299.8 curveto 112.4 -299.8 122 -299.8 132.6 -299.8 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 132.6 -299.8 moveto 132.6 -289.2 132.6 -279.6 132.6 -269 curveto 122 -269 112.4 -269 101.8 -269 curveto 101.8 -279.6 101.8 -289.2 101.8 -299.8 curveto 112.4 -299.8 122 -299.8 132.6 -299.8 curveto close_path stroke - grestore gsave [1 0 0 1 149.6 -284.9] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 149.6 -284.9] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 149.6 -284.9] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave 0.1804 0.5451 0.3804 setrgbcolor newpath 210.6 -299.8 moveto 210.6 -289.2 210.6 -279.6 210.6 -269 curveto 200 -269 190.4 -269 179.9 -269 curveto 179.9 -279.6 179.9 -289.2 179.9 -299.8 curveto 190.4 -299.8 200 -299.8 210.6 -299.8 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 210.6 -299.8 moveto 210.6 -289.2 210.6 -279.6 210.6 -269 curveto 200 -269 190.4 -269 179.9 -269 curveto 179.9 -279.6 179.9 -289.2 179.9 -299.8 curveto 190.4 -299.8 200 -299.8 210.6 -299.8 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 94.35 -234.4 moveto 135.9 -234.4 176.5 -234.4 218.1 -234.4 curveto 222.2 -234.4 225.6 -237.8 225.6 -241.9 curveto 225.6 -262.4 225.6 -281.8 225.6 -302.2 curveto 225.6 -306.4 222.2 -309.8 218.1 -309.8 curveto 176.5 -309.8 135.9 -309.8 94.35 -309.8 curveto 90.19 -309.8 86.81 -306.4 86.81 -302.2 curveto 86.81 -281.8 86.81 -262.4 86.81 -241.9 curveto 86.81 -237.8 90.19 -234.4 94.35 -234.4 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 379 -287.5 moveto 379 -276.9 379 -267.3 379 -256.7 curveto 343.8 -256.7 309.6 -256.7 274.3 -256.7 curveto 274.3 -267.3 274.3 -276.9 274.3 -287.5 curveto 309.6 -287.5 343.8 -287.5 379 -287.5 curveto close_path fill - grestore gsave [1 0 0 1 309.8 -267.6] concat 0 setgray 29.25 3.615 moveto (\077) cmmi7 6.974 fshow grestore gsave [1 0 0 1 309.8 -267.6] concat 0 setgray 0 0 moveto (\104\145\163\151\147\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 278.3 -281] concat 0 setgray 88.96 0 moveto (\164\051) cmr10 9.963 fshow grestore gsave [1 0 0 1 278.3 -281] concat 0 setgray 75.95 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 278.3 -281] concat 0 setgray 70.14 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 278.3 -281] concat 0 setgray 26.08 0 moveto (\145\170\164\145\156\163\151\157\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 278.3 -281] concat 0 setgray 0 0 moveto (\050\107\125\111) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 379 -287.5 moveto 379 -276.9 379 -267.3 379 -256.7 curveto 343.8 -256.7 309.6 -256.7 274.3 -256.7 curveto 274.3 -267.3 274.3 -276.9 274.3 -287.5 curveto 309.6 -287.5 343.8 -287.5 379 -287.5 curveto close_path stroke - grestore gsave [1 0 0 1 148.2 -333.7] concat 0 setgray 0 0 moveto (\103\141\160\164\151\157\156\072) cmbx10 9.963 fshow grestore gsave [1 0 0 1 186.4 -346.4] concat 0 setgray 0 0 moveto (\077) cmmi10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 106.1 0 moveto (\164\165\164\157\162\151\141\154) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 86.67 0 moveto (\164\150\151\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 75.05 0 moveto (\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 53.44 0 moveto (\145\162\145\144) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 48.46 0 moveto (\166) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 39.32 0 moveto (\143\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 21.61 0 moveto (\156\157\164) cmr10 9.963 fshow grestore gsave [1 0 0 1 259.9 -346.6] concat 0 setgray 0 0 moveto (\160\141\162\164) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 131.6 0 moveto (\157\153\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 120.9 0 moveto (\150\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 83.19 0 moveto (\164\150\162\157\165\147\150) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 72.06 0 moveto (\164\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 59.06 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 53.24 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 252.9 -359.4] concat 0 setgray 0 0 moveto (\162\145\147\151\163\164\162\141\164\151\157\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 180.6 0 moveto (\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 163.4 0 moveto (\164\145\144) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 150.4 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 144.6 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 127.5 0 moveto (\164\150\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 115.3 0 moveto (\164\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 107.3 0 moveto (\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 70.98 0 moveto (\144\151\162\145\143\164\154\171) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 59.86 0 moveto (\164\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 46.85 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 41.04 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.3 -372.3] concat 0 setgray 0 0 moveto (\151\156\163\145\162\164\151\157\156) cmr10 9.963 fshow grestore gsave 0.8784 1 1 setrgbcolor newpath 80.1 -9.111 moveto 185.5 -9.111 289.9 -9.111 395.3 -9.111 curveto 406.6 -9.111 415.7 -18.23 415.7 -29.48 curveto 415.7 -84.12 415.7 -137.8 415.7 -192.4 curveto 415.7 -203.7 406.6 -212.8 395.3 -212.8 curveto 289.9 -212.8 185.5 -212.8 80.1 -212.8 curveto 68.85 -212.8 59.74 -203.7 59.74 -192.4 curveto 59.74 -137.8 59.74 -84.12 59.74 -29.48 curveto 59.74 -18.23 68.85 -9.111 80.1 -9.111 curveto close_path fill - grestore gsave [1 0 0 1 177.2 -31.07] concat 0 setgray 48.19 0 moveto (\144\151\162\145\143\164\157\162\171) cmbx12 11.96 fshow grestore gsave [1 0 0 1 177.2 -31.07] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 90.43 -45.86 moveto 134.6 -45.86 177.8 -45.86 222 -45.86 curveto 230.7 -45.86 237.7 -52.89 237.7 -61.55 curveto 237.7 -103.7 237.7 -144.9 237.7 -187.1 curveto 237.7 -195.7 230.7 -202.8 222 -202.8 curveto 177.8 -202.8 134.6 -202.8 90.43 -202.8 curveto 81.76 -202.8 74.74 -195.7 74.74 -187.1 curveto 74.74 -144.9 74.74 -103.7 74.74 -61.55 curveto 74.74 -52.89 81.76 -45.86 90.43 -45.86 curveto close_path fill - grestore gsave [1 0 0 1 86.74 -66.17] concat 0 setgray 104 0 moveto (\164\141\164\151\157\156) cmbx12 11.96 fshow grestore gsave [1 0 0 1 86.74 -66.17] concat 0 setgray 47.29 0 moveto (\151\155\160\154\145\155\145\156) cmbx12 11.96 fshow grestore gsave [1 0 0 1 86.74 -66.17] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 178 -111.3 moveto 178 -100.7 178 -91.08 178 -80.49 curveto 163.2 -80.49 149.3 -80.49 134.4 -80.49 curveto 134.4 -91.08 134.4 -100.7 134.4 -111.3 curveto 149.3 -111.3 163.2 -111.3 178 -111.3 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 178 -111.3 moveto 178 -100.7 178 -91.08 178 -80.49 curveto 163.2 -80.49 149.3 -80.49 134.4 -80.49 curveto 134.4 -91.08 134.4 -100.7 134.4 -111.3 curveto 149.3 -111.3 163.2 -111.3 178 -111.3 curveto close_path fill - grestore gsave [1 0 0 1 138.4 -98.31] concat 0 setgray 0 0 moveto (\122\145\147\151\163\164\145\162) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 178 -111.3 moveto 178 -100.7 178 -91.08 178 -80.49 curveto 163.2 -80.49 149.3 -80.49 134.4 -80.49 curveto 134.4 -91.08 134.4 -100.7 134.4 -111.3 curveto 149.3 -111.3 163.2 -111.3 178 -111.3 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 178 -152 moveto 178 -141.4 178 -131.8 178 -121.3 curveto 163.2 -121.3 149.3 -121.3 134.4 -121.3 curveto 134.4 -131.8 134.4 -141.4 134.4 -152 curveto 149.3 -152 163.2 -152 178 -152 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 177.4 -152 moveto 177.4 -141.4 177.4 -131.8 177.4 -121.3 curveto 162.9 -121.3 149.5 -121.3 135 -121.3 curveto 135 -131.8 135 -141.4 135 -152 curveto 149.5 -152 162.9 -152 177.4 -152 curveto close_path fill - grestore gsave [1 0 0 1 139 -139.1] concat 0 setgray 0 0 moveto (\117\160\164\151\157\156\163) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 178 -152 moveto 178 -141.4 178 -131.8 178 -121.3 curveto 163.2 -121.3 149.3 -121.3 134.4 -121.3 curveto 134.4 -131.8 134.4 -141.4 134.4 -152 curveto 149.3 -152 163.2 -152 178 -152 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 132.6 -192.8 moveto 132.6 -182.2 132.6 -172.6 132.6 -162 curveto 122 -162 112.4 -162 101.8 -162 curveto 101.8 -172.6 101.8 -182.2 101.8 -192.8 curveto 112.4 -192.8 122 -192.8 132.6 -192.8 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 132.6 -192.8 moveto 132.6 -182.2 132.6 -172.6 132.6 -162 curveto 122 -162 112.4 -162 101.8 -162 curveto 101.8 -172.6 101.8 -182.2 101.8 -192.8 curveto 112.4 -192.8 122 -192.8 132.6 -192.8 curveto close_path stroke - grestore gsave [1 0 0 1 149.6 -177.9] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 149.6 -177.9] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 149.6 -177.9] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 210.6 -192.8 moveto 210.6 -182.2 210.6 -172.6 210.6 -162 curveto 200 -162 190.4 -162 179.9 -162 curveto 179.9 -172.6 179.9 -182.2 179.9 -192.8 curveto 190.4 -192.8 200 -192.8 210.6 -192.8 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 210.6 -192.8 moveto 210.6 -182.2 210.6 -172.6 210.6 -162 curveto 200 -162 190.4 -162 179.9 -162 curveto 179.9 -172.6 179.9 -182.2 179.9 -192.8 curveto 190.4 -192.8 200 -192.8 210.6 -192.8 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 90.43 -45.86 moveto 134.6 -45.86 177.8 -45.86 222 -45.86 curveto 230.7 -45.86 237.7 -52.89 237.7 -61.55 curveto 237.7 -103.7 237.7 -144.9 237.7 -187.1 curveto 237.7 -195.7 230.7 -202.8 222 -202.8 curveto 177.8 -202.8 134.6 -202.8 90.43 -202.8 curveto 81.76 -202.8 74.74 -195.7 74.74 -187.1 curveto 74.74 -144.9 74.74 -103.7 74.74 -61.55 curveto 74.74 -52.89 81.76 -45.86 90.43 -45.86 curveto close_path stroke - grestore gsave 0.1804 0.5451 0.3804 setrgbcolor newpath 257.8 -45.86 moveto 304.1 -45.86 349.3 -45.86 395.5 -45.86 curveto 398.4 -45.86 400.7 -48.17 400.7 -51.02 curveto 400.7 -65.09 400.7 -78.16 400.7 -92.23 curveto 400.7 -95.08 398.4 -97.38 395.5 -97.38 curveto 349.3 -97.38 304.1 -97.38 257.8 -97.38 curveto 255 -97.38 252.7 -95.08 252.7 -92.23 curveto 252.7 -78.16 252.7 -65.09 252.7 -51.02 curveto 252.7 -48.17 255 -45.86 257.8 -45.86 curveto close_path fill - grestore gsave 0.1804 0.5451 0.3804 setrgbcolor newpath 257.8 -45.86 moveto 304.1 -45.86 349.3 -45.86 395.5 -45.86 curveto 398.4 -45.86 400.7 -48.17 400.7 -51.02 curveto 400.7 -65.09 400.7 -78.16 400.7 -92.23 curveto 400.7 -95.08 398.4 -97.38 395.5 -97.38 curveto 349.3 -97.38 304.1 -97.38 257.8 -97.38 curveto 255 -97.38 252.7 -95.08 252.7 -92.23 curveto 252.7 -78.16 252.7 -65.09 252.7 -51.02 curveto 252.7 -48.17 255 -45.86 257.8 -45.86 curveto close_path fill - grestore gsave [1 0 0 1 256.7 -74.61] concat 0 setgray 100.4 0 moveto (\164\145\162\146\141\143\145) cmbx12 11.96 fshow grestore gsave [1 0 0 1 256.7 -74.61] concat 0 setgray 89.53 0 moveto (\151\156) cmbx12 11.96 fshow grestore gsave [1 0 0 1 256.7 -74.61] concat 0 setgray 43.95 0 moveto (\160\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave [1 0 0 1 256.7 -74.61] concat 0 setgray 32.36 0 moveto (\171) cmbx12 11.96 fshow grestore gsave [1 0 0 1 256.7 -74.61] concat 0 setgray 0 0 moveto (\105\155\160\164) cmbx12 11.96 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 257.8 -45.86 moveto 304.1 -45.86 349.3 -45.86 395.5 -45.86 curveto 398.4 -45.86 400.7 -48.17 400.7 -51.02 curveto 400.7 -65.09 400.7 -78.16 400.7 -92.23 curveto 400.7 -95.08 398.4 -97.38 395.5 -97.38 curveto 349.3 -97.38 304.1 -97.38 257.8 -97.38 curveto 255 -97.38 252.7 -95.08 252.7 -92.23 curveto 252.7 -78.16 252.7 -65.09 252.7 -51.02 curveto 252.7 -48.17 255 -45.86 257.8 -45.86 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 261.7 -112.4 moveto 305.4 -112.4 348 -112.4 391.6 -112.4 curveto 396.6 -112.4 400.7 -116.4 400.7 -121.4 curveto 400.7 -145.9 400.7 -169.3 400.7 -193.7 curveto 400.7 -198.7 396.6 -202.8 391.6 -202.8 curveto 348 -202.8 305.4 -202.8 261.7 -202.8 curveto 256.7 -202.8 252.7 -198.7 252.7 -193.7 curveto 252.7 -169.3 252.7 -145.9 252.7 -121.4 curveto 252.7 -116.4 256.7 -112.4 261.7 -112.4 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 271.3 -112.4 moveto 308.6 -112.4 344.8 -112.4 382 -112.4 curveto 387 -112.4 391.1 -116.4 391.1 -121.4 curveto 391.1 -145.9 391.1 -169.3 391.1 -193.7 curveto 391.1 -198.7 387 -202.8 382 -202.8 curveto 344.8 -202.8 308.6 -202.8 271.3 -202.8 curveto 266.3 -202.8 262.3 -198.7 262.3 -193.7 curveto 262.3 -169.3 262.3 -145.9 262.3 -121.4 curveto 262.3 -116.4 266.3 -112.4 271.3 -112.4 curveto close_path fill - grestore gsave [1 0 0 1 287.7 -140.2] concat 0 setgray 73.21 4.338 moveto (\077) cmmi8 7.97 fshow grestore gsave [1 0 0 1 287.7 -140.2] concat 0 setgray 47.29 0 moveto (\107\125\111) cmbx12 11.96 fshow grestore gsave [1 0 0 1 287.7 -140.2] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 303 -185.3 moveto 303 -174.7 303 -165.1 303 -154.5 curveto 292.5 -154.5 282.9 -154.5 272.3 -154.5 curveto 272.3 -165.1 272.3 -174.7 272.3 -185.3 curveto 282.9 -185.3 292.5 -185.3 303 -185.3 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 303 -185.3 moveto 303 -174.7 303 -165.1 303 -154.5 curveto 292.5 -154.5 282.9 -154.5 272.3 -154.5 curveto 272.3 -165.1 272.3 -174.7 272.3 -185.3 curveto 282.9 -185.3 292.5 -185.3 303 -185.3 curveto close_path stroke - grestore gsave [1 0 0 1 320 -170.4] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 320 -170.4] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 320 -170.4] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 381.1 -185.3 moveto 381.1 -174.7 381.1 -165.1 381.1 -154.5 curveto 370.5 -154.5 360.9 -154.5 350.3 -154.5 curveto 350.3 -165.1 350.3 -174.7 350.3 -185.3 curveto 360.9 -185.3 370.5 -185.3 381.1 -185.3 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 381.1 -185.3 moveto 381.1 -174.7 381.1 -165.1 381.1 -154.5 curveto 370.5 -154.5 360.9 -154.5 350.3 -154.5 curveto 350.3 -165.1 350.3 -174.7 350.3 -185.3 curveto 360.9 -185.3 370.5 -185.3 381.1 -185.3 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 261.7 -112.4 moveto 305.4 -112.4 348 -112.4 391.6 -112.4 curveto 396.6 -112.4 400.7 -116.4 400.7 -121.4 curveto 400.7 -145.9 400.7 -169.3 400.7 -193.7 curveto 400.7 -198.7 396.6 -202.8 391.6 -202.8 curveto 348 -202.8 305.4 -202.8 261.7 -202.8 curveto 256.7 -202.8 252.7 -198.7 252.7 -193.7 curveto 252.7 -169.3 252.7 -145.9 252.7 -121.4 curveto 252.7 -116.4 256.7 -112.4 261.7 -112.4 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 80.1 -9.111 moveto 185.5 -9.111 289.9 -9.111 395.3 -9.111 curveto 406.6 -9.111 415.7 -18.23 415.7 -29.48 curveto 415.7 -84.12 415.7 -137.8 415.7 -192.4 curveto 415.7 -203.7 406.6 -212.8 395.3 -212.8 curveto 289.9 -212.8 185.5 -212.8 80.1 -212.8 curveto 68.85 -212.8 59.74 -203.7 59.74 -192.4 curveto 59.74 -137.8 59.74 -84.12 59.74 -29.48 curveto 59.74 -18.23 68.85 -9.111 80.1 -9.111 curveto close_path stroke - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 178.3 -356.9 moveto 182.5 -356.9 186 -356.9 189.9 -356.9 curveto stroke - grestore gsave newpath 189.9 -358.9 moveto 191.4 -357.9 191.9 -357.9 193.3 -356.9 curveto 191.9 -355.9 191.4 -355.9 189.9 -354.9 curveto 189.9 -356.6 189.9 -357.3 189.9 -358.9 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 178.3 -369.8 moveto 182.5 -369.8 186 -369.8 189.9 -369.8 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 189.9 -371.8 moveto 191.4 -370.8 191.9 -370.8 193.3 -369.8 curveto 191.9 -368.8 191.4 -368.8 189.9 -367.8 curveto 189.9 -369.4 189.9 -370.1 189.9 -371.8 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 326.7 -202.8 moveto 326.7 -219.9 326.7 -236.2 326.7 -253.2 curveto stroke - grestore gsave newpath 324.7 -253.2 moveto 325.7 -254.7 325.7 -255.2 326.7 -256.7 curveto 327.7 -255.2 327.7 -254.7 328.7 -253.2 curveto 327 -253.2 326.4 -253.2 324.7 -253.2 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 226.6 50.21 moveto 239.6 50.21 251.6 50.21 264.4 50.21 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 264.4 48.21 moveto 265.9 49.21 266.4 49.21 267.9 50.21 curveto 266.4 51.21 265.9 51.21 264.4 52.21 curveto 264.4 50.54 264.4 49.87 264.4 48.21 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 290 -9.111 moveto 290 4.707 290 17.68 290 31.36 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 292 31.36 moveto 291 32.85 291 33.34 290 34.83 curveto 289 33.34 289 32.85 288 31.36 curveto 289.7 31.36 290.3 31.36 292 31.36 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 356.3 -9.111 moveto 356.3 4.707 356.3 17.68 356.3 31.36 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 358.3 31.36 moveto 357.3 32.85 357.3 33.34 356.3 34.83 curveto 355.3 33.34 355.3 32.85 354.3 31.36 curveto 356 31.36 356.6 31.36 358.3 31.36 curveto close_path fill - grestore gsave 1 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 59.74 -33.28 moveto 54.4 -33.28 50.07 -33.28 44.74 -33.28 curveto 44.74 -20.7 44.74 -9.121 44.74 3.459 curveto 40.6 3.459 37.07 3.459 33.2 3.459 curveto stroke - grestore gsave 1 0 0 setrgbcolor newpath 33.2 5.459 moveto 31.71 4.459 31.22 4.459 29.74 3.459 curveto 31.22 2.459 31.71 2.459 33.2 1.459 curveto 33.2 3.126 33.2 3.793 33.2 5.459 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 135 -136.6 moveto 105.6 -136.6 77.2 -136.6 47.78 -136.6 curveto 47.78 -120.1 47.78 -104.6 47.78 -88.06 curveto 42.62 -88.06 38.12 -88.06 33.2 -88.06 curveto stroke - grestore gsave newpath 33.2 -86.06 moveto 31.71 -87.06 31.22 -87.06 29.74 -88.06 curveto 31.22 -89.06 31.71 -89.06 33.2 -90.06 curveto 33.2 -88.39 33.2 -87.73 33.2 -86.06 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 134.4 -95.87 moveto 106.8 -95.87 80.15 -95.87 52.52 -95.87 curveto 52.52 -77.68 52.52 -60.49 52.52 -42.3 curveto 45.77 -42.3 39.74 -42.3 33.2 -42.3 curveto stroke - grestore gsave newpath 33.2 -40.3 moveto 31.71 -41.3 31.22 -41.3 29.74 -42.3 curveto 31.22 -43.3 31.71 -43.3 33.2 -44.3 curveto 33.2 -42.63 33.2 -41.97 33.2 -40.3 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 74.74 -152.9 moveto 63.42 -152.9 53.11 -152.9 41.79 -152.9 curveto 41.79 -162.1 41.79 -170.4 41.79 -179.6 curveto 38.66 -179.6 36.04 -179.6 33.2 -179.6 curveto stroke - grestore gsave newpath 33.2 -177.6 moveto 31.71 -178.6 31.22 -178.6 29.74 -179.6 curveto 31.22 -180.6 31.71 -180.6 33.2 -181.6 curveto 33.2 -179.9 33.2 -179.2 33.2 -177.6 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 74.74 -152.9 moveto 63.42 -152.9 53.11 -152.9 41.79 -152.9 curveto 41.79 -146.2 41.79 -140.5 41.79 -133.8 curveto 38.66 -133.8 36.04 -133.8 33.2 -133.8 curveto stroke - grestore gsave newpath 33.2 -131.8 moveto 31.71 -132.8 31.22 -132.8 29.74 -133.8 curveto 31.22 -134.8 31.71 -134.8 33.2 -135.8 curveto 33.2 -134.2 33.2 -133.5 33.2 -131.8 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 59.74 -166.4 moveto 55.89 -166.4 53.05 -166.4 49.21 -166.4 curveto 49.21 -186.4 49.21 -205.4 49.21 -225.3 curveto 43.57 -225.3 38.61 -225.3 33.2 -225.3 curveto stroke - grestore gsave newpath 33.2 -223.3 moveto 31.71 -224.3 31.22 -224.3 29.74 -225.3 curveto 31.22 -226.3 31.71 -226.3 33.2 -227.3 curveto 33.2 -225.7 33.2 -225 33.2 -223.3 curveto close_path fill - grestore showpage -%%EOF diff --git a/doc/developer/macros.sty b/doc/developer/macros.sty index 406eff9b9f8cda8450951de66b66befb2d41be23..406bba952e4813b4693cc367a70297273dc8fd1a 100644 --- a/doc/developer/macros.sty +++ b/doc/developer/macros.sty @@ -176,3 +176,85 @@ {\par\unskip\endMakeFramed\everyhbox{}} \newenvironment{code}{\begin{gencode}\begin{alltt}}{\end{alltt}\end{gencode}} + +% Tikz utilities. + +\definecolor{external}{rgb}{1,0.65,0} +\definecolor{darkgreen}{rgb}{0.2,0.8,0.2} +\definecolor{palered}{rgb}{0.98,0.5,0.45} +\definecolor{palegreen}{rgb}{0.78,1,0.59} + +\newlength{\padding}\setlength{\padding}{15bp} +\newlength{\bigpadding}\setlength{\bigpadding}{30bp} +\newlength{\largepadding}\setlength{\largepadding}{50bp} +\newlength{\paddelta}\setlength{\paddelta}{5bp} +\newlength{\bigpaddelta}\setlength{\bigpaddelta}{10bp} + +\tikzset{ +big-title/.style={font=\bfseries\Large}, +small-title/.style={font=\bfseries\itshape\large}, +st/.style={transform shape}, +structural/.style={inner sep=0pt}, +plain/.style={inner sep=0.333em,scale=0.9}, +bigarrow/.style={thick,>=Latex,red} +} + +\newenvironment{tikz-vbox}[2][] +{\begin{tikzpicture}[ + inner sep=0pt, + every node/.style={transform shape}, + start chain=#2 going below, + node distance=\padding, + every on chain/.style={rectangle}, + #1] +} +{\end{tikzpicture}} + +\newenvironment{tikz-hbox}[2][] +{\begin{tikzpicture}[ + inner sep=0pt, + every node/.style={transform shape}, + start chain=#2 going right, + node distance=\padding, + every on chain/.style={rectangle},#1] +} +{\end{tikzpicture}} + +\newcommand{\tikztitlebox}[3][]{% +\begin{tikzpicture}[every node/.style={transform shape},#1,inner sep=0pt] +\node[structural] (#2-content) {#3}; +\node[structural,above=\bigpaddelta,small-title] at (#2-content.north) (#2-title) {#2}; +\node[fit=(#2-content) (#2-title), + inner xsep=\padding, inner ysep=\paddelta, draw, rounded corners=10pt,outer sep=0pt] {}; +\end{tikzpicture}% +} +\newcommand{\tikztitleboxbig}[4][]{% +\begin{tikzpicture}[inner sep=0pt,every node/.style={transform shape},#1] +\node[structural] (#2-content) {#4}; +\node[above=1.5\bigpaddelta,big-title,structural] at (#2-content.north) (#2-title) {#2}; +\begin{scope}[on background layer] +\node[fit=(#2-content) (#2-title), fill=#3, + inner xsep=\padding, inner ysep=\bigpaddelta, draw, rounded corners=20pt, + outer sep=0pt] {}; +\end{scope} +\end{tikzpicture}% +} + +\newlength{\tikzvboxmaxwidth} +\newlength{\tikzvboxtmpwidth} +\newcommand{\tikzvboxsamewidth}[1]{% + \setlength{\tikzvboxmaxwidth}{0pt} + \tikz[inner sep=0pt]{ + \foreach \mynode in { #1 } + { + \settowidth{\tikzvboxtmpwidth}{\tikz{\mynode;}} + \ifdim\tikzvboxtmpwidth>\tikzvboxmaxwidth + \setlength{\tikzvboxmaxwidth}{\tikzvboxtmpwidth} + \fi + } + \setlength{\tikzvboxmaxwidth}{0} + \begin{scope}[every node/.style={minimum text width=\tikzvboxmaxwidth}] + \foreach \mynode in { #1 } { \mynode; } + \end{scope} + } +} diff --git a/doc/developer/makefiles.ml b/doc/developer/makefiles.ml deleted file mode 100644 index 0dc2187fb126ac466d24c0d247e6539b95e8a4a7..0000000000000000000000000000000000000000 --- a/doc/developer/makefiles.ml +++ /dev/null @@ -1,168 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* All rights reserved. *) -(* Contact CEA LIST for licensing. *) -(* *) -(**************************************************************************) - -open Mlpost -open Box - -(* Some custom values *) - -let tiny_padding = Num.bp 10. -let small_padding = Num.bp 15. -let padding = Num.bp 50. -let delta = Num.bp 5. - -let big_title s = tex ("\\textbf{\\Large{" ^ s ^ "}}") -let small_title s = tex ("\\textbf{\\emph{\\large{" ^ s ^ "}}}") - -let plugin_color = Color.rgb8 255 165 0 -let framac_color = Color.rgb8 50 205 50 -let opt_color = Color.rgb8 200 255 150 -(*let plugin_color = Color.lightcyan*) -let generated_color = Color.rgb8 250 128 114 - -let std_box color name s = - round_rect ~name ~fill:color ~dx:delta ~dy:delta (tex s) - -let config = std_box framac_color "config" "Makefile.config.in" -let common = std_box framac_color "common" "Makefile.common" -let generic = std_box framac_color "generic" "Makefile.generic" -let kernel = std_box generated_color "kernel" "Makefile.kernel" -let int_config = - std_box framac_color "int_config" "Makefile.dynamic\\_config.internal" -let ext_config = - std_box framac_color "ext_config" "Makefile.dynamic\\_config.external" -let dyn_config = - std_box generated_color "dyn_config" "Makefile.dynamic\\_config" -let framac = std_box framac_color "framac" "Makefile" -let generating = std_box framac_color "generating" "Makefile.generating" -let plugin = std_box framac_color "plugin" "Makefile.plugin" -let dynamic = std_box framac_color "dynamic" "Makefile.dynamic" - -let user = std_box opt_color "user" ".Makefile.user" - -let spec1 = std_box plugin_color "spec1" "specific Makefile for plug-in 1" -let dots = tex ~name:"dots" "$\\dots$" -let specn = std_box plugin_color "specn" "specific Makefile for plug-in $n$" - -let config_box = hbox ~padding:tiny_padding [ config; int_config; ext_config ] -let common_box = vbox ~padding:small_padding [ common; generic; kernel ] -let spec_box = hbox ~padding:small_padding [ spec1; dots; specn ] -let gen_box = hbox ~padding [ common_box; dyn_config ] - -let fc_box0 = hbox ~padding:small_padding [ generating; framac; dots; plugin ] -let fc_box1 = hbox ~padding [ fc_box0; dynamic ] -let user_box = place `South ~padding:small_padding (get "framac" fc_box1) user -let fc_box2 = group [fc_box1; user_box] -let caption = - tabularl ~pos:`Left ~hpadding:delta - [ - [ tex "\\textbf{Caption:}"; empty () ]; - [ hbox ~padding:small_padding - [ tex ~name:"m1" "$m1$"; tex ~name:"m2" "$m2$" ]; - tex "Makefile $m1$ is included into Makefile $m2$" ]; - [ hbox ~padding:small_padding - [ tex ~name:"m1d" "$m1$"; tex ~name:"m2d" "$m2$" ]; - tex "Makefile $m2$ is generated from Makefile $m1$" ]; - [ tex ~fill:plugin_color "orange boxes"; tex "Plug-in Makefiles" ]; - [ tex ~fill:generated_color "red boxes"; tex "Generated Makefiles" ]; - [ tex ~fill:framac_color "green boxes"; tex "Other kernel Makefiles" ]; - [ tex ~fill:opt_color "light green boxes"; - tex "Optional kernel Makefile" ] - ] - -let make_box = vbox ~padding [ config_box; gen_box; fc_box2; spec_box ] - -let full_box = vbox ~padding:small_padding ~pos:`Right [ make_box; caption ] - -let arrow ?ind ?outd ?style ?color ?(dash=false) ?anchor src dst = - let getf s = get s full_box in - let src = getf src in - let dst = getf dst in - let dashed = if dash then Some Dash.evenly else None in - Helpers.box_arrow ?ind ?outd ?style ?color ?dashed ~pen:Pen.circle src dst - -let plugin_fc scale = - let p1 = west (get "plugin" full_box) in - let p2 = east (get "framac" full_box) in - let p3 = Point.segment 0.33 p1 p2 in - let p4 = Point.segment 0.66 p1 p2 in - let p3 = Point.yscale (Num.bp scale) p3 in - let p4 = Point.yscale (Num.bp scale) p4 in - arrow -(* ~outd:(Path.vec p3 p4)*) - ~style:(Path.jControls p3 p4) - ~color:plugin_color - "plugin" - "framac" - -let bend ?(scale=0.2) ~above ~color p1 p2 = - let scale = if above then scale else -.scale in - let perp = - Point.sub (Point.rotate_around p1 (-.90.) p2) p1 - in - let c1 = - Point.add (Point.segment 0.33 p1 p2) - (Point.mult (Num.of_float scale) perp) - in - let c2 = - Point.add (Point.segment 0.66 p1 p2) - (Point.mult (Num.of_float scale) perp) - in - let style = Path.jControls c1 c2 in - Helpers.draw_simple_arrow ~style ~pen:Pen.circle ~color p1 p2 - -let cmds = - let p1 = west (get "common" full_box) in - let p21 = north_west (get "framac" full_box) in - let p22 = north (get "framac" full_box) in - let p2 = Point.segment 0.5 p21 p22 in - let p3 = west (get "generic" full_box) in - let p4 = Point.segment 0.6 p21 p22 in - Command.seq - [ - draw full_box; - arrow ~color:framac_color "config" "common"; - bend ~above:true ~color:framac_color p1 p2; - bend ~above:true ~color:framac_color p3 p4; - begin - let p11 = south_east (get "common" full_box) in - let p12 = south (get "common" full_box) in - let p1 = Point.segment 0.5 p11 p12 in - let p21 = north_west (get "dynamic" full_box) in - let p22 = north (get "dynamic" full_box) in - let p2 = Point.segment 0.8 p21 p22 in - bend ~above:false ~scale:0.04 ~color:framac_color p1 p2 - end; - arrow ~color:framac_color "generating" "framac"; - arrow - ~outd:(Path.vec (Point.pt (0.15,-.0.5))) - ~color:framac_color "int_config" "framac"; - arrow ~color:framac_color "generic" "dynamic"; - arrow ~color:framac_color "dyn_config" "dynamic"; - arrow ~color:generated_color ~dash:true "int_config" "dyn_config"; - arrow ~color:generated_color ~dash:true "ext_config" "dyn_config"; - arrow ~color:framac_color "plugin" "dynamic"; - arrow ~color:framac_color "kernel" "dynamic"; - arrow ~color:generated_color ~dash:true "framac" "kernel"; - arrow ~color:plugin_color "dynamic" "spec1"; - (* arrow "dynamic" "dots";*) - arrow ~color:plugin_color "dynamic" "specn"; - (* arrow plugin_color "plugin" "framac";*) - plugin_fc 0.9; - plugin_fc 1.1; - arrow "m1" "m2"; - arrow ~dash:true "m1d" "m2d"; - arrow ~color:opt_color "user" "framac"; - ] - -let _ = Metapost.emit "makefiles" cmds diff --git a/doc/developer/makefiles.mps b/doc/developer/makefiles.mps deleted file mode 100644 index 19a55b5c06ec67e6890651ac3de3ef2caac43aeb..0000000000000000000000000000000000000000 --- a/doc/developer/makefiles.mps +++ /dev/null @@ -1,85 +0,0 @@ -%!PS -%%BoundingBox: -12.000000 -436.000000 419.000000 15.000000 -%%HiResBoundingBox: -11.129205 -435.406282 418.647812 14.168485 -%%Creator: Mlpost current -%%Pages: 1 -%*Font: cmbx10 10.000000 9.962620 3a:8 -%*Font: cmmi10 10.000000 9.962620 3a:8 -%*Font: cmr10 10.000000 9.962620 c:8 -%%BeginProlog -%%EndProlog -%%Page: 1 1 -0 0.5 dtransform truncate idtransform setlinewidth pop 1 setlinecap 1 setlinejoin gsave 0.1961 0.8039 0.1961 setrgbcolor newpath -4.714 13.92 moveto 23.95 13.92 51.6 13.92 80.26 13.92 curveto 81.53 13.92 82.55 12.9 82.55 11.63 curveto 82.55 5.205 82.55 -0.2234 82.55 -6.652 curveto 82.55 -7.914 81.53 -8.937 80.26 -8.937 curveto 51.6 -8.937 23.95 -8.937 -4.714 -8.937 curveto -5.977 -8.937 -7 -7.914 -7 -6.652 curveto -7 -0.2234 -7 5.205 -7 11.63 curveto -7 12.9 -5.977 13.92 -4.714 13.92 curveto close_path fill - grestore gsave 0 setgray 19.1 0 moveto (\145\014\154\145\056\143\157\156\014\147\056\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -4.714 13.92 moveto 23.95 13.92 51.6 13.92 80.26 13.92 curveto 81.53 13.92 82.55 12.9 82.55 11.63 curveto 82.55 5.205 82.55 -0.2234 82.55 -6.652 curveto 82.55 -7.914 81.53 -8.937 80.26 -8.937 curveto 51.6 -8.937 23.95 -8.937 -4.714 -8.937 curveto -5.977 -8.937 -7 -7.914 -7 -6.652 curveto -7 -0.2234 -7 5.205 -7 11.63 curveto -7 12.9 -5.977 13.92 -4.714 13.92 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 94.84 13.92 moveto 145.4 13.92 194.9 13.92 245.4 13.92 curveto 246.7 13.92 247.7 12.9 247.7 11.63 curveto 247.7 5.205 247.7 -0.2234 247.7 -6.652 curveto 247.7 -7.914 246.7 -8.937 245.4 -8.937 curveto 194.9 -8.937 145.4 -8.937 94.84 -8.937 curveto 93.57 -8.937 92.55 -7.914 92.55 -6.652 curveto 92.55 -0.2234 92.55 5.205 92.55 11.63 curveto 92.55 12.9 93.57 13.92 94.84 13.92 curveto close_path fill - grestore gsave [1 0 0 1 99.55 0] concat 0 setgray 115.7 0 moveto (\164\145\162\156\141\154) cmr10 9.963 fshow grestore gsave [1 0 0 1 99.55 0] concat 0 setgray 79.41 0 moveto (\143\157\156\014\147\056\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 99.55 0] concat 0 setgray newpath 76.42 0.3985 moveto 79.41 0.3985 lineto 79.41 0.797 lineto 76.42 0.797 lineto close_path fill grestore gsave [1 0 0 1 99.55 0] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\144\171\156\141\155\151\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 99.55 0] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 94.84 13.92 moveto 145.4 13.92 194.9 13.92 245.4 13.92 curveto 246.7 13.92 247.7 12.9 247.7 11.63 curveto 247.7 5.205 247.7 -0.2234 247.7 -6.652 curveto 247.7 -7.914 246.7 -8.937 245.4 -8.937 curveto 194.9 -8.937 145.4 -8.937 94.84 -8.937 curveto 93.57 -8.937 92.55 -7.914 92.55 -6.652 curveto 92.55 -0.2234 92.55 5.205 92.55 11.63 curveto 92.55 12.9 93.57 13.92 94.84 13.92 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 260 13.92 moveto 311.1 13.92 361.2 13.92 412.2 13.92 curveto 413.5 13.92 414.5 12.9 414.5 11.63 curveto 414.5 5.205 414.5 -0.2234 414.5 -6.652 curveto 414.5 -7.914 413.5 -8.937 412.2 -8.937 curveto 361.2 -8.937 311.1 -8.937 260 -8.937 curveto 258.7 -8.937 257.7 -7.914 257.7 -6.652 curveto 257.7 -0.2234 257.7 5.205 257.7 11.63 curveto 257.7 12.9 258.7 13.92 260 13.92 curveto close_path fill - grestore gsave [1 0 0 1 264.7 0] concat 0 setgray 79.41 0 moveto (\143\157\156\014\147\056\145\170\164\145\162\156\141\154) cmr10 9.963 fshow grestore gsave [1 0 0 1 264.7 0] concat 0 setgray newpath 76.42 0.3985 moveto 79.41 0.3985 lineto 79.41 0.797 lineto 76.42 0.797 lineto close_path fill grestore gsave [1 0 0 1 264.7 0] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\144\171\156\141\155\151\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 264.7 0] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 260 13.92 moveto 311.1 13.92 361.2 13.92 412.2 13.92 curveto 413.5 13.92 414.5 12.9 414.5 11.63 curveto 414.5 5.205 414.5 -0.2234 414.5 -6.652 curveto 414.5 -7.914 413.5 -8.937 412.2 -8.937 curveto 361.2 -8.937 311.1 -8.937 260 -8.937 curveto 258.7 -8.937 257.7 -7.914 257.7 -6.652 curveto 257.7 -0.2234 257.7 5.205 257.7 11.63 curveto 257.7 12.9 258.7 13.92 260 13.92 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 76.64 -58.94 moveto 105.4 -58.94 133.2 -58.94 162 -58.94 curveto 163.2 -58.94 164.1 -59.87 164.1 -61.03 curveto 164.1 -66.94 164.1 -71.85 164.1 -77.76 curveto 164.1 -78.92 163.2 -79.86 162 -79.86 curveto 133.2 -79.86 105.4 -79.86 76.64 -79.86 curveto 75.48 -79.86 74.55 -78.92 74.55 -77.76 curveto 74.55 -71.85 74.55 -66.94 74.55 -61.03 curveto 74.55 -59.87 75.48 -58.94 76.64 -58.94 curveto close_path fill - grestore gsave [1 0 0 1 81.55 -72.86] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\143\157\155\155\157\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 81.55 -72.86] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 76.64 -58.94 moveto 105.4 -58.94 133.2 -58.94 162 -58.94 curveto 163.2 -58.94 164.1 -59.87 164.1 -61.03 curveto 164.1 -66.94 164.1 -71.85 164.1 -77.76 curveto 164.1 -78.92 163.2 -79.86 162 -79.86 curveto 133.2 -79.86 105.4 -79.86 76.64 -79.86 curveto 75.48 -79.86 74.55 -78.92 74.55 -77.76 curveto 74.55 -71.85 74.55 -66.94 74.55 -61.03 curveto 74.55 -59.87 75.48 -58.94 76.64 -58.94 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 79.86 -94.86 moveto 106.5 -94.86 132.1 -94.86 158.8 -94.86 curveto 160 -94.86 161.1 -95.88 161.1 -97.14 curveto 161.1 -103.6 161.1 -109 161.1 -115.4 curveto 161.1 -116.7 160 -117.7 158.8 -117.7 curveto 132.1 -117.7 106.5 -117.7 79.86 -117.7 curveto 78.6 -117.7 77.58 -116.7 77.58 -115.4 curveto 77.58 -109 77.58 -103.6 77.58 -97.14 curveto 77.58 -95.88 78.6 -94.86 79.86 -94.86 curveto close_path fill - grestore gsave [1 0 0 1 84.58 -108.8] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\147\145\156\145\162\151\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 84.58 -108.8] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 79.86 -94.86 moveto 106.5 -94.86 132.1 -94.86 158.8 -94.86 curveto 160 -94.86 161.1 -95.88 161.1 -97.14 curveto 161.1 -103.6 161.1 -109 161.1 -115.4 curveto 161.1 -116.7 160 -117.7 158.8 -117.7 curveto 132.1 -117.7 106.5 -117.7 79.86 -117.7 curveto 78.6 -117.7 77.58 -116.7 77.58 -115.4 curveto 77.58 -109 77.58 -103.6 77.58 -97.14 curveto 77.58 -95.88 78.6 -94.86 79.86 -94.86 curveto close_path stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 81.88 -132.7 moveto 107.2 -132.7 131.5 -132.7 156.8 -132.7 curveto 157.9 -132.7 158.9 -133.6 158.9 -134.8 curveto 158.9 -140.7 158.9 -145.6 158.9 -151.5 curveto 158.9 -152.7 157.9 -153.6 156.8 -153.6 curveto 131.5 -153.6 107.2 -153.6 81.88 -153.6 curveto 80.73 -153.6 79.79 -152.7 79.79 -151.5 curveto 79.79 -145.6 79.79 -140.7 79.79 -134.8 curveto 79.79 -133.6 80.73 -132.7 81.88 -132.7 curveto close_path fill - grestore gsave [1 0 0 1 86.79 -146.6] concat 0 setgray 44 0 moveto (\145\162\156\145\154) cmr10 9.963 fshow grestore gsave [1 0 0 1 86.79 -146.6] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 86.79 -146.6] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 81.88 -132.7 moveto 107.2 -132.7 131.5 -132.7 156.8 -132.7 curveto 157.9 -132.7 158.9 -133.6 158.9 -134.8 curveto 158.9 -140.7 158.9 -145.6 158.9 -151.5 curveto 158.9 -152.7 157.9 -153.6 156.8 -153.6 curveto 131.5 -153.6 107.2 -153.6 81.88 -153.6 curveto 80.73 -153.6 79.79 -152.7 79.79 -151.5 curveto 79.79 -145.6 79.79 -140.7 79.79 -134.8 curveto 79.79 -133.6 80.73 -132.7 81.88 -132.7 curveto close_path stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 216.4 -94.86 moveto 254.8 -94.86 292.3 -94.86 330.7 -94.86 curveto 331.9 -94.86 333 -95.88 333 -97.14 curveto 333 -103.6 333 -109 333 -115.4 curveto 333 -116.7 331.9 -117.7 330.7 -117.7 curveto 292.3 -117.7 254.8 -117.7 216.4 -117.7 curveto 215.1 -117.7 214.1 -116.7 214.1 -115.4 curveto 214.1 -109 214.1 -103.6 214.1 -97.14 curveto 214.1 -95.88 215.1 -94.86 216.4 -94.86 curveto close_path fill - grestore gsave [1 0 0 1 221.1 -108.8] concat 0 setgray 79.41 0 moveto (\143\157\156\014\147) cmr10 9.963 fshow grestore gsave [1 0 0 1 221.1 -108.8] concat 0 setgray newpath 76.42 0.3985 moveto 79.41 0.3985 lineto 79.41 0.797 lineto 76.42 0.797 lineto close_path fill grestore gsave [1 0 0 1 221.1 -108.8] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\144\171\156\141\155\151\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 221.1 -108.8] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 216.4 -94.86 moveto 254.8 -94.86 292.3 -94.86 330.7 -94.86 curveto 331.9 -94.86 333 -95.88 333 -97.14 curveto 333 -103.6 333 -109 333 -115.4 curveto 333 -116.7 331.9 -117.7 330.7 -117.7 curveto 292.3 -117.7 254.8 -117.7 216.4 -117.7 curveto 215.1 -117.7 214.1 -116.7 214.1 -115.4 curveto 214.1 -109 214.1 -103.6 214.1 -97.14 curveto 214.1 -95.88 215.1 -94.86 216.4 -94.86 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath -8.594 -203.6 moveto 23.03 -203.6 53.65 -203.6 85.27 -203.6 curveto 86.53 -203.6 87.55 -204.7 87.55 -205.9 curveto 87.55 -212.3 87.55 -217.8 87.55 -224.2 curveto 87.55 -225.5 86.53 -226.5 85.27 -226.5 curveto 53.65 -226.5 23.03 -226.5 -8.594 -226.5 curveto -9.856 -226.5 -10.88 -225.5 -10.88 -224.2 curveto -10.88 -217.8 -10.88 -212.3 -10.88 -205.9 curveto -10.88 -204.7 -9.856 -203.6 -8.594 -203.6 curveto close_path fill - grestore gsave [1 0 0 1 -3.879 -217.5] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\147\145\156\145\162\141\164\151\156\147) cmr10 9.963 fshow grestore gsave [1 0 0 1 -3.879 -217.5] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath -8.594 -203.6 moveto 23.03 -203.6 53.65 -203.6 85.27 -203.6 curveto 86.53 -203.6 87.55 -204.7 87.55 -205.9 curveto 87.55 -212.3 87.55 -217.8 87.55 -224.2 curveto 87.55 -225.5 86.53 -226.5 85.27 -226.5 curveto 53.65 -226.5 23.03 -226.5 -8.594 -226.5 curveto -9.856 -226.5 -10.88 -225.5 -10.88 -224.2 curveto -10.88 -217.8 -10.88 -212.3 -10.88 -205.9 curveto -10.88 -204.7 -9.856 -203.6 -8.594 -203.6 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 104.6 -204.6 moveto 120.3 -204.6 135 -204.6 150.7 -204.6 curveto 151.9 -204.6 152.8 -205.5 152.8 -206.7 curveto 152.8 -212.6 152.8 -217.5 152.8 -223.4 curveto 152.8 -224.6 151.9 -225.5 150.7 -225.5 curveto 135 -225.5 120.3 -225.5 104.6 -225.5 curveto 103.5 -225.5 102.6 -224.6 102.6 -223.4 curveto 102.6 -217.5 102.6 -212.6 102.6 -206.7 curveto 102.6 -205.5 103.5 -204.6 104.6 -204.6 curveto close_path fill - grestore gsave [1 0 0 1 109.6 -218.5] concat 0 setgray 19.1 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 109.6 -218.5] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 104.6 -204.6 moveto 120.3 -204.6 135 -204.6 150.7 -204.6 curveto 151.9 -204.6 152.8 -205.5 152.8 -206.7 curveto 152.8 -212.6 152.8 -217.5 152.8 -223.4 curveto 152.8 -224.6 151.9 -225.5 150.7 -225.5 curveto 135 -225.5 120.3 -225.5 104.6 -225.5 curveto 103.5 -225.5 102.6 -224.6 102.6 -223.4 curveto 102.6 -217.5 102.6 -212.6 102.6 -206.7 curveto 102.6 -205.5 103.5 -204.6 104.6 -204.6 curveto close_path stroke - grestore gsave [1 0 0 1 169.8 -215.6] concat 0 setgray 8.856 0 moveto (\072) cmmi10 9.963 fshow grestore gsave [1 0 0 1 169.8 -215.6] concat 0 setgray 4.428 0 moveto (\072) cmmi10 9.963 fshow grestore gsave [1 0 0 1 169.8 -215.6] concat 0 setgray 0 0 moveto (\072) cmmi10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 200.7 -203.6 moveto 226.2 -203.6 250.8 -203.6 276.3 -203.6 curveto 277.5 -203.6 278.6 -204.7 278.6 -205.9 curveto 278.6 -212.3 278.6 -217.8 278.6 -224.2 curveto 278.6 -225.5 277.5 -226.5 276.3 -226.5 curveto 250.8 -226.5 226.2 -226.5 200.7 -226.5 curveto 199.5 -226.5 198.4 -225.5 198.4 -224.2 curveto 198.4 -217.8 198.4 -212.3 198.4 -205.9 curveto 198.4 -204.7 199.5 -203.6 200.7 -203.6 curveto close_path fill - grestore gsave [1 0 0 1 205.4 -217.5] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\160\154\165\147\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 205.4 -217.5] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 200.7 -203.6 moveto 226.2 -203.6 250.8 -203.6 276.3 -203.6 curveto 277.5 -203.6 278.6 -204.7 278.6 -205.9 curveto 278.6 -212.3 278.6 -217.8 278.6 -224.2 curveto 278.6 -225.5 277.5 -226.5 276.3 -226.5 curveto 250.8 -226.5 226.2 -226.5 200.7 -226.5 curveto 199.5 -226.5 198.4 -225.5 198.4 -224.2 curveto 198.4 -217.8 198.4 -212.3 198.4 -205.9 curveto 198.4 -204.7 199.5 -203.6 200.7 -203.6 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 330.9 -203.6 moveto 359.6 -203.6 387.4 -203.6 416.1 -203.6 curveto 417.4 -203.6 418.4 -204.7 418.4 -205.9 curveto 418.4 -212.3 418.4 -217.8 418.4 -224.2 curveto 418.4 -225.5 417.4 -226.5 416.1 -226.5 curveto 387.4 -226.5 359.6 -226.5 330.9 -226.5 curveto 329.6 -226.5 328.6 -225.5 328.6 -224.2 curveto 328.6 -217.8 328.6 -212.3 328.6 -205.9 curveto 328.6 -204.7 329.6 -203.6 330.9 -203.6 curveto close_path fill - grestore gsave [1 0 0 1 335.6 -217.5] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\144\171\156\141\155\151\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 335.6 -217.5] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 330.9 -203.6 moveto 359.6 -203.6 387.4 -203.6 416.1 -203.6 curveto 417.4 -203.6 418.4 -204.7 418.4 -205.9 curveto 418.4 -212.3 418.4 -217.8 418.4 -224.2 curveto 418.4 -225.5 417.4 -226.5 416.1 -226.5 curveto 387.4 -226.5 359.6 -226.5 330.9 -226.5 curveto 329.6 -226.5 328.6 -225.5 328.6 -224.2 curveto 328.6 -217.8 328.6 -212.3 328.6 -205.9 curveto 328.6 -204.7 329.6 -203.6 330.9 -203.6 curveto close_path stroke - grestore gsave 0.7843 1 0.5882 setrgbcolor newpath 92.98 -240.5 moveto 116.4 -240.5 138.9 -240.5 162.4 -240.5 curveto 163.5 -240.5 164.5 -241.5 164.5 -242.6 curveto 164.5 -248.5 164.5 -253.4 164.5 -259.3 curveto 164.5 -260.5 163.5 -261.4 162.4 -261.4 curveto 138.9 -261.4 116.4 -261.4 92.98 -261.4 curveto 91.83 -261.4 90.89 -260.5 90.89 -259.3 curveto 90.89 -253.4 90.89 -248.5 90.89 -242.6 curveto 90.89 -241.5 91.83 -240.5 92.98 -240.5 curveto close_path fill - grestore gsave [1 0 0 1 97.89 -254.4] concat 0 setgray 21.86 0 moveto (\145\014\154\145\056\165\163\145\162) cmr10 9.963 fshow grestore gsave [1 0 0 1 97.89 -254.4] concat 0 setgray 0 0 moveto (\056\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 92.98 -240.5 moveto 116.4 -240.5 138.9 -240.5 162.4 -240.5 curveto 163.5 -240.5 164.5 -241.5 164.5 -242.6 curveto 164.5 -248.5 164.5 -253.4 164.5 -259.3 curveto 164.5 -260.5 163.5 -261.4 162.4 -261.4 curveto 138.9 -261.4 116.4 -261.4 92.98 -261.4 curveto 91.83 -261.4 90.89 -260.5 90.89 -259.3 curveto 90.89 -253.4 90.89 -248.5 90.89 -242.6 curveto 90.89 -241.5 91.83 -240.5 92.98 -240.5 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 40.52 -311.4 moveto 86.73 -311.4 131.9 -311.4 178.2 -311.4 curveto 179.4 -311.4 180.4 -312.5 180.4 -313.7 curveto 180.4 -320.1 180.4 -325.6 180.4 -332 curveto 180.4 -333.3 179.4 -334.3 178.2 -334.3 curveto 131.9 -334.3 86.73 -334.3 40.52 -334.3 curveto 39.26 -334.3 38.23 -333.3 38.23 -332 curveto 38.23 -325.6 38.23 -320.1 38.23 -313.7 curveto 38.23 -312.5 39.26 -311.4 40.52 -311.4 curveto close_path fill - grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 123.2 0 moveto (\061) cmr10 9.963 fshow grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 89.47 0 moveto (\160\154\165\147\055\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 74.22 0 moveto (\146\157\162) cmr10 9.963 fshow grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 53.74 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 34.65 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 9.741 0 moveto (\145\143\151\014\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 45.23 -325.4] concat 0 setgray 0 0 moveto (\163\160) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 40.52 -311.4 moveto 86.73 -311.4 131.9 -311.4 178.2 -311.4 curveto 179.4 -311.4 180.4 -312.5 180.4 -313.7 curveto 180.4 -320.1 180.4 -325.6 180.4 -332 curveto 180.4 -333.3 179.4 -334.3 178.2 -334.3 curveto 131.9 -334.3 86.73 -334.3 40.52 -334.3 curveto 39.26 -334.3 38.23 -333.3 38.23 -332 curveto 38.23 -325.6 38.23 -320.1 38.23 -313.7 curveto 38.23 -312.5 39.26 -311.4 40.52 -311.4 curveto close_path stroke - grestore gsave [1 0 0 1 197.4 -323.4] concat 0 setgray 8.856 0 moveto (\072) cmmi10 9.963 fshow grestore gsave [1 0 0 1 197.4 -323.4] concat 0 setgray 4.428 0 moveto (\072) cmmi10 9.963 fshow grestore gsave [1 0 0 1 197.4 -323.4] concat 0 setgray 0 0 moveto (\072) cmmi10 9.963 fshow grestore gsave 1 0.6471 0 setrgbcolor newpath 228.4 -311.4 moveto 274.9 -311.4 320.5 -311.4 367 -311.4 curveto 368.3 -311.4 369.3 -312.5 369.3 -313.7 curveto 369.3 -320.1 369.3 -325.6 369.3 -332 curveto 369.3 -333.3 368.3 -334.3 367 -334.3 curveto 320.5 -334.3 274.9 -334.3 228.4 -334.3 curveto 227.1 -334.3 226.1 -333.3 226.1 -332 curveto 226.1 -325.6 226.1 -320.1 226.1 -313.7 curveto 226.1 -312.5 227.1 -311.4 228.4 -311.4 curveto close_path fill - grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 123.2 0 moveto (\156) cmmi10 9.963 fshow grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 89.47 0 moveto (\160\154\165\147\055\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 74.22 0 moveto (\146\157\162) cmr10 9.963 fshow grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 53.74 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 34.65 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 9.741 0 moveto (\145\143\151\014\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 233.1 -325.4] concat 0 setgray 0 0 moveto (\163\160) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 228.4 -311.4 moveto 274.9 -311.4 320.5 -311.4 367 -311.4 curveto 368.3 -311.4 369.3 -312.5 369.3 -313.7 curveto 369.3 -320.1 369.3 -325.6 369.3 -332 curveto 369.3 -333.3 368.3 -334.3 367 -334.3 curveto 320.5 -334.3 274.9 -334.3 228.4 -334.3 curveto 227.1 -334.3 226.1 -333.3 226.1 -332 curveto 226.1 -325.6 226.1 -320.1 226.1 -313.7 curveto 226.1 -312.5 227.1 -311.4 228.4 -311.4 curveto close_path stroke - grestore gsave [1 0 0 1 144.8 -358.2] concat 0 setgray 0 0 moveto (\103\141\160\164\151\157\156\072) cmbx10 9.963 fshow grestore gsave [1 0 0 1 144.8 -370.8] concat 0 setgray 8.747 0 moveto (\061) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -370.8] concat 0 setgray 0 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 177.5 -370.8] concat 0 setgray 8.747 0 moveto (\062) cmr10 9.963 fshow grestore gsave [1 0 0 1 177.5 -370.8] concat 0 setgray 0 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 175 0 moveto (\062) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 166.3 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 145.8 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 126.7 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 114.5 0 moveto (\164\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 106.5 0 moveto (\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 66.64 0 moveto (\151\156\143\154\165\144\145\144) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 56.62 0 moveto (\151\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 48.32 0 moveto (\061) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 39.57 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 19.1 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -371.1] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -382.7] concat 0 setgray 8.747 0 moveto (\061) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -382.7] concat 0 setgray 0 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 177.5 -382.7] concat 0 setgray 8.747 0 moveto (\062) cmr10 9.963 fshow grestore gsave [1 0 0 1 177.5 -382.7] concat 0 setgray 0 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 183.9 0 moveto (\061) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 175.2 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 154.7 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 135.6 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 112.1 0 moveto (\146\162\157\155) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 66.64 0 moveto (\147\145\156\145\162\141\164\145\144) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 56.62 0 moveto (\151\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 48.32 0 moveto (\062) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 39.57 0 moveto (\155) cmmi10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 19.1 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -382] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 1 0.6471 0 setrgbcolor newpath 203.1 -398.8 moveto 203.1 -394.2 203.1 -390.5 203.1 -385.9 curveto 182.6 -385.9 163.2 -385.9 142.8 -385.9 curveto 142.8 -390.5 142.8 -394.2 142.8 -398.8 curveto 163.2 -398.8 182.6 -398.8 203.1 -398.8 curveto close_path fill - grestore gsave [1 0 0 1 144.8 -394.8] concat 0 setgray 42.65 0 moveto (\170\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -394.8] concat 0 setgray 37.94 0 moveto (\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -394.8] concat 0 setgray 32.13 0 moveto (\142) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -394.8] concat 0 setgray 0 0 moveto (\157\162\141\156\147\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -394.8] concat 0 setgray 54.1 0 moveto (\145\014\154\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -394.8] concat 0 setgray 35.01 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -394.8] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmr10 9.963 fshow grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 188.1 -409.7 moveto 188.1 -405.7 188.1 -402.7 188.1 -398.8 curveto 172.7 -398.8 158.2 -398.8 142.8 -398.8 curveto 142.8 -402.7 142.8 -405.7 142.8 -409.7 curveto 158.2 -409.7 172.7 -409.7 188.1 -409.7 curveto close_path fill - grestore gsave [1 0 0 1 144.8 -407.7] concat 0 setgray 27.7 0 moveto (\170\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -407.7] concat 0 setgray 23 0 moveto (\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -407.7] concat 0 setgray 17.19 0 moveto (\142) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -407.7] concat 0 setgray 0 0 moveto (\162\145\144) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -407.7] concat 0 setgray 67.34 0 moveto (\145\014\154\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -407.7] concat 0 setgray 48.25 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -407.7] concat 0 setgray 0 0 moveto (\107\145\156\145\162\141\164\145\144) cmr10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 197.5 -422.6 moveto 197.5 -417.9 197.5 -414.3 197.5 -409.7 curveto 178.9 -409.7 161.4 -409.7 142.8 -409.7 curveto 142.8 -414.3 142.8 -417.9 142.8 -422.6 curveto 161.4 -422.6 178.9 -422.6 197.5 -422.6 curveto close_path fill - grestore gsave [1 0 0 1 144.8 -418.6] concat 0 setgray 37.11 0 moveto (\170\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -418.6] concat 0 setgray 32.41 0 moveto (\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -418.6] concat 0 setgray 26.59 0 moveto (\142) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -418.6] concat 0 setgray 0 0 moveto (\147\162\145\145\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -419.6] concat 0 setgray 77.27 0 moveto (\145\014\154\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -419.6] concat 0 setgray 58.17 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -419.6] concat 0 setgray 33.79 0 moveto (\145\162\156\145\154) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -419.6] concat 0 setgray 28.81 0 moveto (\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -419.6] concat 0 setgray 0 0 moveto (\117\164\150\145\162) cmr10 9.963 fshow grestore gsave 0.7843 1 0.5882 setrgbcolor newpath 220.5 -435.4 moveto 220.5 -430.8 220.5 -427.2 220.5 -422.6 curveto 194.3 -422.6 169 -422.6 142.8 -422.6 curveto 142.8 -427.2 142.8 -430.8 142.8 -435.4 curveto 169 -435.4 194.3 -435.4 220.5 -435.4 curveto close_path fill - grestore gsave [1 0 0 1 144.8 -431.5] concat 0 setgray 60.08 0 moveto (\170\145\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -431.5] concat 0 setgray 55.38 0 moveto (\157) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -431.5] concat 0 setgray 49.56 0 moveto (\142) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -431.5] concat 0 setgray 22.97 0 moveto (\147\162\145\145\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -431.5] concat 0 setgray 15.77 0 moveto (\164) cmr10 9.963 fshow grestore gsave [1 0 0 1 144.8 -431.5] concat 0 setgray 0 0 moveto (\154\151\147\150) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -431.5] concat 0 setgray 89.97 0 moveto (\145\014\154\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -431.5] concat 0 setgray 70.87 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -431.5] concat 0 setgray 46.49 0 moveto (\145\162\156\145\154) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -431.5] concat 0 setgray 41.51 0 moveto (\153) cmr10 9.963 fshow grestore gsave [1 0 0 1 227.5 -431.5] concat 0 setgray 0 0 moveto (\117\160\164\151\157\156\141\154) cmr10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 50.73 -8.937 moveto 68.88 -24.95 86.73 -40.65 104.9 -56.65 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 103.5 -58.15 moveto 105.2 -58.74 105.8 -58.34 107.5 -58.94 curveto 106.7 -57.34 107 -56.74 106.2 -55.15 curveto 105 -56.48 104.8 -56.81 103.5 -58.15 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 74.55 -69.4 moveto 61.18 -121 73.74 -164.9 112.6 -202.2 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 111.2 -203.7 moveto 112.9 -204.3 113.5 -204 115.1 -204.6 curveto 114.4 -203 114.7 -202.4 113.9 -200.8 curveto 112.7 -202.1 112.5 -202.4 111.2 -203.7 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 77.58 -106.3 moveto 71.31 -145.6 83.63 -177.4 114.9 -202.5 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 113.7 -204.1 moveto 115.3 -204.6 116 -204.1 117.6 -204.6 curveto 116.8 -203 116.9 -202.5 116.1 -200.9 curveto 114.9 -202.3 114.8 -202.7 113.7 -204.1 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 141.7 -79.86 moveto 219.1 -111.4 291.8 -151.6 361.7 -201.6 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 360.5 -203.2 moveto 362.2 -203.7 362.8 -203.2 364.5 -203.6 curveto 363.6 -202.1 363.7 -201.5 362.9 -200 curveto 361.7 -201.4 361.6 -201.8 360.5 -203.2 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 87.55 -215.1 moveto 91.4 -215.1 95.24 -215.1 99.09 -215.1 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 99.09 -217.1 moveto 100.6 -216.1 101.1 -216.1 102.6 -215.1 curveto 101.1 -214.1 100.6 -214.1 99.09 -213.1 curveto 99.09 -214.7 99.09 -215.4 99.09 -217.1 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 173.2 -8.934 moveto 189.6 -75.4 176.6 -145.7 137.6 -201.8 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 136 -200.6 moveto 135.5 -202.3 136.1 -202.9 135.6 -204.6 curveto 137.2 -203.7 137.7 -203.8 139.3 -203 curveto 137.8 -201.8 137.4 -201.7 136 -200.6 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 145.9 -117.7 moveto 212 -146.1 277.6 -173.9 343.7 -202.3 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 342.9 -204.1 moveto 344.6 -203.6 345.2 -204.1 346.9 -203.6 curveto 345.8 -202.2 345.6 -201.8 344.5 -200.4 curveto 343.6 -202 343.8 -202.5 342.9 -204.1 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 284 -117.7 moveto 309.7 -145.7 335 -173.2 360.6 -201.1 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 359.2 -202.4 moveto 360.8 -203.2 361.4 -202.9 363 -203.6 curveto 362.4 -202 362.7 -201.4 362.1 -199.7 curveto 360.8 -201 360.5 -201.2 359.2 -202.4 curveto close_path fill - grestore gsave 0.9804 0.502 0.4471 setrgbcolor [3 3 ] 0 setdash 0 1 dtransform truncate idtransform setlinewidth pop newpath 181 -8.938 moveto 207.6 -36.91 233.7 -64.41 260.3 -92.35 curveto stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 258.8 -93.72 moveto 260.4 -94.44 261.1 -94.15 262.7 -94.86 curveto 262 -93.23 262.4 -92.6 261.7 -90.97 curveto 260.4 -92.22 260.1 -92.47 258.8 -93.72 curveto close_path fill - grestore gsave 0.9804 0.502 0.4471 setrgbcolor [3 3 ] 0 setdash 0 1 dtransform truncate idtransform setlinewidth pop newpath 329.5 -8.938 moveto 313.5 -36.74 297.9 -64.08 281.9 -91.86 curveto stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 280.1 -90.86 moveto 280.5 -92.52 279.8 -93.19 280.1 -94.86 curveto 281.6 -93.86 282.1 -93.86 283.6 -92.86 curveto 282.1 -91.86 281.6 -91.86 280.1 -90.86 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 278.6 -215.1 moveto 294.1 -215.1 309.6 -215.1 325.1 -215.1 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 325.1 -217.1 moveto 326.6 -216.1 327.1 -216.1 328.6 -215.1 curveto 327.1 -214.1 326.6 -214.1 325.1 -213.1 curveto 325.1 -214.7 325.1 -215.4 325.1 -217.1 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 156.1 -153.6 moveto 214.2 -170.1 271.9 -186.2 330 -202.7 curveto stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 329.4 -204.6 moveto 331.1 -204 331.7 -204.3 333.3 -203.6 curveto 332.1 -202.3 331.8 -202.1 330.5 -200.8 curveto 329.8 -202.4 330.1 -203 329.4 -204.6 curveto close_path fill - grestore gsave 0.9804 0.502 0.4471 setrgbcolor [3 3 ] 0 setdash 0 1 dtransform truncate idtransform setlinewidth pop newpath 126.4 -204.6 moveto 124.5 -188.6 122.9 -173 121 -157.1 curveto stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 123 -156.8 moveto 121.9 -155.4 121.7 -155 120.6 -153.6 curveto 119.8 -155.2 119.9 -155.7 119 -157.3 curveto 120.7 -156.8 121.4 -157.3 123 -156.8 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 345.6 -226.5 moveto 277 -254.5 209 -282.1 140.4 -310.1 curveto stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 139.7 -308.3 moveto 138.5 -309.7 138.4 -310 137.2 -311.4 curveto 138.9 -311.9 139.5 -311.5 141.2 -312 curveto 140.4 -310.4 140.5 -309.8 139.7 -308.3 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 365.4 -226.5 moveto 346 -254 327.1 -281.1 307.7 -308.6 curveto stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 306.1 -307.5 moveto 305.6 -309.1 306.2 -309.8 305.7 -311.4 curveto 307.3 -310.5 307.8 -310.6 309.4 -309.8 curveto 307.9 -308.7 307.5 -308.6 306.1 -307.5 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 206 -203.6 moveto 184.6 -197.4 170.3 -197.4 153.1 -203.4 curveto stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 152.4 -201.5 moveto 151.2 -202.9 151 -203.2 149.9 -204.6 curveto 151.5 -205.1 152.2 -204.7 153.8 -205.2 curveto 153 -203.6 153.2 -203.1 152.4 -201.5 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 206 -226.5 moveto 184.6 -232.7 170.3 -232.8 153.1 -226.7 curveto stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 153.8 -224.9 moveto 152.2 -225.4 151.5 -225 149.9 -225.5 curveto 151 -226.9 151.2 -227.3 152.4 -228.6 curveto 153.2 -227.1 153 -226.5 153.8 -224.9 curveto close_path fill - grestore gsave 0 1 dtransform truncate idtransform setlinewidth pop newpath 160.5 -367.6 moveto 164.4 -367.6 168.2 -367.6 172.1 -367.6 curveto stroke - grestore gsave newpath 172.1 -369.6 moveto 173.5 -368.6 174 -368.6 175.5 -367.6 curveto 174 -366.6 173.5 -366.6 172.1 -365.6 curveto 172.1 -367.3 172.1 -367.9 172.1 -369.6 curveto close_path fill - grestore gsave [3 3 ] 0 setdash 0 1 dtransform truncate idtransform setlinewidth pop newpath 160.5 -379.5 moveto 164.4 -379.5 168.2 -379.5 172.1 -379.5 curveto stroke - grestore gsave newpath 172.1 -381.5 moveto 173.5 -380.5 174 -380.5 175.5 -379.5 curveto 174 -378.5 173.5 -378.5 172.1 -377.5 curveto 172.1 -379.2 172.1 -379.8 172.1 -381.5 curveto close_path fill - grestore gsave 0.7843 1 0.5882 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth pop newpath 127.7 -240.5 moveto 127.7 -236.6 127.7 -232.8 127.7 -229 curveto stroke - grestore gsave 0.7843 1 0.5882 setrgbcolor newpath 129.7 -229 moveto 128.7 -227.5 128.7 -227 127.7 -225.5 curveto 126.7 -227 126.7 -227.5 125.7 -229 curveto 127.3 -229.3 128 -228.6 129.7 -229 curveto close_path fill - grestore showpage -%%EOF diff --git a/doc/developer/plugin_mpost.ml b/doc/developer/plugin_mpost.ml deleted file mode 100644 index b199489efc4b3cbbf7f05392eda084d9c34312d6..0000000000000000000000000000000000000000 --- a/doc/developer/plugin_mpost.ml +++ /dev/null @@ -1,215 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* All rights reserved. *) -(* Contact CEA LIST for licensing. *) -(* *) -(**************************************************************************) - -open Mlpost -open Box - -(* Some custom values *) - -let padding = Num.bp 15. -let delta = Num.bp 10. - -let unused = (*"$^\\star$"*)"" -let big_title s = "\\textbf{\\Large{" ^ s ^ "}}" -let small_title s = "\\textbf{\\large{" ^ s ^ "}}" - -let external_color = Color.rgb8 255 165 0 -let internal_color = Color.rgb8 50 205 50 -let plugin_color = Color.lightcyan -let make_color = (*Color.rgb8 46 139 97*) Color.rgb8 250 128 114 - -(* Some very useful functions. - [TODO] Should be in some way in the mlpost API? *) - -let box_width ?name ?style ?fill ?dy w b = - box ?name ?style ?fill ?dy ~dx:(Num.divf (Num.subn w (width b)) 2.) b - -let box_height ?name ?style ?fill ?dx h b = - box ?name ?style ?fill ?dx ~dy:(Num.divf (Num.subn h (height b)) 2.) b - -let box_hw ?name ?style ?fill h b = - box ?name ?style ?fill - ~dx:(Num.divf (Num.subn h (width b)) 2.) - ~dy:(Num.divf (Num.subn h (height b)) 2.) b - -let vbox_same_width ?name ?padding ~style l = - let max = List.fold_left (fun acc b -> Num.maxn acc (width b)) Num.zero l in - vbox ?name ?padding - (List.map - (fun b -> box_width max - ~style - ?fill:(get_fill b) - ~dy:Num.zero - (clear_stroke b)) - l) - -let simulate_box ?name b = empty ?name ~width:(width b) ~height:(height b) () - -let xmed ?(coef=0.5) p1 p2 = - Num.multf coef (Num.addn (Point.xpart p1) (Point.xpart p2)) -let ymed ?(coef=0.5) p1 p2 = - Num.multf coef (Num.addn (Point.ypart p1) (Point.ypart p2)) -let med ?xcoef ?ycoef p1 p2 = - Point.pt (xmed ?coef:xcoef p1 p2, ymed ?coef:ycoef p1 p2) - -(* Some special functions for this figure *) - -let modul ?(color=external_color) ?same_height ?same_width s = - let t = tex s in - match same_height, same_width with - | None, None -> box ~name:s ~fill:color ~style:Rect t - | Some h, None -> box_height ~name:s ~fill:color ~style:Rect h t - | None, Some w -> box_width ~name:s ~fill:color ~style:Rect w t - | Some h, Some w -> - assert (h = w); - box_hw ~name:s ~fill:color ~style:Rect w t - -(* The figure itself *) - -let fig = - - (* special external modules: Makefile.dynamic + Design *) - let design = - rect ~fill:external_color ~name:"design" - (vbox [ tex ("Design" ^ unused); tex "(GUI extension point)" ]) - in - let std_modul = modul ~same_height:(height design) in - let dynmake = std_modul ~color:make_color "Makefile.dynamic" in - - (* empty modules *) - let empty_modules = - let empty_module = - std_modul ~color:internal_color ~same_width:(height design) "" - in - let points = tex "\\dots" in - hbox ~padding [ empty_module; points; empty_module ] - in - - (* Plug-in implem *) - let title = tex (small_title "Plug-in implementation") in - let register = std_modul ~color:internal_color "Register" in - let options = std_modul ~color:internal_color "Options" in - let b = vbox_same_width ~padding:delta ~style:Rect [ register; options ] in - let b = vbox ~padding:delta [ title; b; empty_modules ] in - let implem = - round_rect ~name:"implem" ~fill:internal_color ~dx:delta ~dy:delta b - in - - (* Plug-in GUI *) - let gui = tex (small_title "Plug-in GUI$^\\star$") in - let gui = - round_rect ~name:"gui" ~dx:delta ~dy:(Num.addn delta (Num.divf padding 2.)) - ~fill:internal_color - (vbox ~padding:delta [ gui; empty_modules ]) - in - - (* Makefile *) - let makefile = - let t = tex "\\large{Makefile}" in - box_height - ~name:"makefile" - ~style:RoundRect - ~fill:make_color - (Num.subn (height implem) (Num.addn (height gui) padding)) - t - in - - (* Makefile + Plug-in GUI *) - let right_box = - vbox_same_width ~name:"right" ~padding ~style:RoundRect [ makefile; gui ] - in - - (* left column *) - let db = std_modul "Db.Main" in - let dyn = std_modul ("Dynamic" ^ unused) in - let journal = std_modul ("Journal" ^ unused) in - let plugin = std_modul "Plugin" in - let prj = std_modul ("Project" ^ unused) in - let typ = std_modul ("Type" ^ unused) in - let left_box = - vbox_same_width ~padding ~style:Rect - [ db; dyn; plugin; typ; journal; prj ] - in - - (* setting the components as a matrix *) - let figure = - hbox ~padding:(Num.multf 3. padding) - [ - left_box; - tabularl ~hpadding:padding ~vpadding:(Num.multf 3. padding) - [ - [ empty (); dynmake ]; - [ simulate_box ~name:"ei" implem; - simulate_box ~name:"er" right_box ]; - [ empty (); design ] - ] - ] - in - let getf s = get s figure in - - (* add the Plug-in directory and merge it in the matrix *) - let nwp = north_west (getf "ei") in - let sep = south_east (getf "er") in - let main_box = hbox ~padding [ implem; right_box ] in - let title = tex (big_title "Plug-in directory") in - let b = vbox ~padding:delta [ title; main_box ] in - let directory_box = - let r = round_rect ~fill:plugin_color ~dx:padding ~dy:delta b in - center (med nwp sep) r - in - - (* caption *) - let caption = - tabularl ~pos:`Right ~hpadding:delta - [ - [ tex "\\textbf{Caption:}"; empty () ]; -(* [ tex "$\\star$"; tex "part not covered in this chapter (tutorial)" ];*) - [ hbox ~padding [ empty ~name:"c1" (); empty ~name:"c2" () ]; - tex "registration points" ] - ] - in - - let full_box = vbox ~padding ~pos:` Right [ figure; caption ] in - - let arrow src dst = Helpers.box_arrow src dst in - let third_arrow coef ?(yscale=1.) src dst = - let p1 = Point.yscale (Num.bp yscale) (west src) in - let p4 = (*east dst*) (* [TODO] Don't know why it doesn't work *) - Point.pt (Point.xpart (east left_box), Point.ypart (east dst)) - in - let x = xmed ~coef p1 p4 in - let p2 = Point.pt (x, Point.ypart p1) in - let p3 = Point.pt (x, Point.ypart p4) in - (* [TODO] Why [Arrow.draw] does not provide the same result? *) - Arrow.simple (Path.pathp ~style:Path.jLine [ p1; p2; p3; p4 ]) - in - let getf s = get s full_box in - Command.seq - [ - draw full_box; - draw directory_box; - arrow (getf "c1") (getf "c2"); - arrow (get "gui" directory_box) (getf "design"); - arrow (get "makefile" directory_box) (getf "Makefile.dynamic"); - third_arrow 0.32 (get "Options" directory_box) (getf "Plugin"); - third_arrow - 0.35 (get "Register" directory_box) (getf ("Dynamic" ^ unused)); - third_arrow 0.35 (get "Register" directory_box) (getf "Db.Main"); - third_arrow 0.4 ~yscale:1.23 - (get "implem" directory_box) (getf ("Journal" ^ unused)); - third_arrow 0.4 ~yscale:1.23 - (get "implem" directory_box) (getf ("Type" ^ unused)); - third_arrow 0.55 ~yscale:1.5 directory_box (getf ("Project" ^ unused)); - ] - -let _ = Metapost.emit "plugin_mpost" fig diff --git a/doc/developer/plugin_mpost.mps b/doc/developer/plugin_mpost.mps deleted file mode 100644 index 06413ed5aa2b7b0bd4a2dcdd156dbe0ae4363106..0000000000000000000000000000000000000000 --- a/doc/developer/plugin_mpost.mps +++ /dev/null @@ -1,79 +0,0 @@ -%!PS -%%BoundingBox: -5.000000 -304.000000 410.000000 44.000000 -%%HiResBoundingBox: -4.526740 -303.338417 409.511656 43.522619 -%%Creator: Mlpost current -%%Pages: 1 -%*Font: cmbx10 10.000000 9.962620 3a:8 -%*Font: cmbx12 12.000000 11.955144 2d:8 -%*Font: cmmi8 8.000000 7.970096 3f:8 -%*Font: cmr10 10.000000 9.962620 c:8 -%*Font: cmr12 12.000000 11.955144 c:8 -%%BeginProlog -%%EndProlog -%%Page: 1 1 -0 0.5 dtransform truncate idtransform setlinewidth pop 1 setlinecap 1 setlinejoin gsave 1 0.6471 0 setrgbcolor newpath 42.61 -11.89 moveto 42.61 -1.325 42.61 8.244 42.61 18.81 curveto 26.64 18.81 11.68 18.81 -4.277 18.81 curveto -4.277 8.244 -4.277 -1.325 -4.277 -11.89 curveto 11.68 -11.89 26.64 -11.89 42.61 -11.89 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.33 -11.89 moveto 42.33 -1.325 42.33 8.244 42.33 18.81 curveto 26.55 18.81 11.78 18.81 -4 18.81 curveto -4 8.244 -4 -1.325 -4 -11.89 curveto 11.78 -11.89 26.55 -11.89 42.33 -11.89 curveto close_path fill - grestore gsave [1 0 0 1 0 0] concat 0 setgray 0 0 moveto (\104\142\056\115\141\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 42.61 -11.89 moveto 42.61 -1.325 42.61 8.244 42.61 18.81 curveto 26.64 18.81 11.68 18.81 -4.277 18.81 curveto -4.277 8.244 -4.277 -1.325 -4.277 -11.89 curveto 11.68 -11.89 26.64 -11.89 42.61 -11.89 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.61 -57.6 moveto 42.61 -47.03 42.61 -37.46 42.61 -26.89 curveto 26.64 -26.89 11.68 -26.89 -4.277 -26.89 curveto -4.277 -37.46 -4.277 -47.03 -4.277 -57.6 curveto 11.68 -57.6 26.64 -57.6 42.61 -57.6 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.61 -57.6 moveto 42.61 -47.03 42.61 -37.46 42.61 -26.89 curveto 26.64 -26.89 11.68 -26.89 -4.277 -26.89 curveto -4.277 -37.46 -4.277 -47.03 -4.277 -57.6 curveto 11.68 -57.6 26.64 -57.6 42.61 -57.6 curveto close_path fill - grestore gsave [1 0 0 1 -0.2767 -44.68] concat 0 setgray 0 0 moveto (\104\171\156\141\155\151\143) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 42.61 -57.6 moveto 42.61 -47.03 42.61 -37.46 42.61 -26.89 curveto 26.64 -26.89 11.68 -26.89 -4.277 -26.89 curveto -4.277 -37.46 -4.277 -47.03 -4.277 -57.6 curveto 11.68 -57.6 26.64 -57.6 42.61 -57.6 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.61 -103.3 moveto 42.61 -92.74 42.61 -83.17 42.61 -72.6 curveto 26.64 -72.6 11.68 -72.6 -4.277 -72.6 curveto -4.277 -83.17 -4.277 -92.74 -4.277 -103.3 curveto 11.68 -103.3 26.64 -103.3 42.61 -103.3 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 37.35 -103.3 moveto 37.35 -92.74 37.35 -83.17 37.35 -72.6 curveto 24.89 -72.6 13.44 -72.6 0.9813 -72.6 curveto 0.9813 -83.17 0.9813 -92.74 0.9813 -103.3 curveto 13.44 -103.3 24.89 -103.3 37.35 -103.3 curveto close_path fill - grestore gsave [1 0 0 1 4.981 -90.45] concat 0 setgray 0 0 moveto (\120\154\165\147\151\156) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 42.61 -103.3 moveto 42.61 -92.74 42.61 -83.17 42.61 -72.6 curveto 26.64 -72.6 11.68 -72.6 -4.277 -72.6 curveto -4.277 -83.17 -4.277 -92.74 -4.277 -103.3 curveto 11.68 -103.3 26.64 -103.3 42.61 -103.3 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.61 -149 moveto 42.61 -138.4 42.61 -128.9 42.61 -118.3 curveto 26.64 -118.3 11.68 -118.3 -4.277 -118.3 curveto -4.277 -128.9 -4.277 -138.4 -4.277 -149 curveto 11.68 -149 26.64 -149 42.61 -149 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 34.37 -149 moveto 34.37 -138.4 34.37 -128.9 34.37 -118.3 curveto 23.9 -118.3 14.43 -118.3 3.956 -118.3 curveto 3.956 -128.9 3.956 -138.4 3.956 -149 curveto 14.43 -149 23.9 -149 34.37 -149 curveto close_path fill - grestore gsave [1 0 0 1 7.956 -136.1] concat 0 setgray 17.99 0 moveto (\145) cmr10 9.963 fshow grestore gsave [1 0 0 1 7.956 -136.1] concat 0 setgray 6.918 0 moveto (\171\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 7.956 -136.1] concat 0 setgray 0 0 moveto (\124) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 42.61 -149 moveto 42.61 -138.4 42.61 -128.9 42.61 -118.3 curveto 26.64 -118.3 11.68 -118.3 -4.277 -118.3 curveto -4.277 -128.9 -4.277 -138.4 -4.277 -149 curveto 11.68 -149 26.64 -149 42.61 -149 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.61 -194.7 moveto 42.61 -184.2 42.61 -174.6 42.61 -164 curveto 26.64 -164 11.68 -164 -4.277 -164 curveto -4.277 -174.6 -4.277 -184.2 -4.277 -194.7 curveto 11.68 -194.7 26.64 -194.7 42.61 -194.7 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 39.57 -194.7 moveto 39.57 -184.2 39.57 -174.6 39.57 -164 curveto 25.63 -164 12.69 -164 -1.246 -164 curveto -1.246 -174.6 -1.246 -184.2 -1.246 -194.7 curveto 12.69 -194.7 25.63 -194.7 39.57 -194.7 curveto close_path fill - grestore gsave [1 0 0 1 2.754 -182.8] concat 0 setgray 0 0 moveto (\112\157\165\162\156\141\154) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 42.61 -194.7 moveto 42.61 -184.2 42.61 -174.6 42.61 -164 curveto 26.64 -164 11.68 -164 -4.277 -164 curveto -4.277 -174.6 -4.277 -184.2 -4.277 -194.7 curveto 11.68 -194.7 26.64 -194.7 42.61 -194.7 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 42.61 -240.4 moveto 42.61 -229.9 42.61 -220.3 42.61 -209.7 curveto 26.64 -209.7 11.68 -209.7 -4.277 -209.7 curveto -4.277 -220.3 -4.277 -229.9 -4.277 -240.4 curveto 11.68 -240.4 26.64 -240.4 42.61 -240.4 curveto close_path fill - grestore gsave 1 0.6471 0 setrgbcolor newpath 39.16 -240.4 moveto 39.16 -229.9 39.16 -220.3 39.16 -209.7 curveto 25.5 -209.7 12.83 -209.7 -0.8313 -209.7 curveto -0.8313 -220.3 -0.8313 -229.9 -0.8313 -240.4 curveto 12.83 -240.4 25.5 -240.4 39.16 -240.4 curveto close_path fill - grestore gsave [1 0 0 1 3.169 -227.5] concat 0 setgray 16.22 0 moveto (\152\145\143\164) cmr10 9.963 fshow grestore gsave [1 0 0 1 3.169 -227.5] concat 0 setgray 0 0 moveto (\120\162\157) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 42.61 -240.4 moveto 42.61 -229.9 42.61 -220.3 42.61 -209.7 curveto 26.64 -209.7 11.68 -209.7 -4.277 -209.7 curveto -4.277 -220.3 -4.277 -229.9 -4.277 -240.4 curveto 11.68 -240.4 26.64 -240.4 42.61 -240.4 curveto close_path stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 371.8 12.57 moveto 371.8 23.13 371.8 32.7 371.8 43.27 curveto 343.6 43.27 316.3 43.27 288 43.27 curveto 288 32.7 288 23.13 288 12.57 curveto 316.3 12.57 343.6 12.57 371.8 12.57 curveto close_path fill - grestore gsave [1 0 0 1 292 25.43] concat 0 setgray 19.1 0 moveto (\145\014\154\145\056\144\171\156\141\155\151\143) cmr10 9.963 fshow grestore gsave [1 0 0 1 292 25.43] concat 0 setgray 0 0 moveto (\115\141\153) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 371.8 12.57 moveto 371.8 23.13 371.8 32.7 371.8 43.27 curveto 343.6 43.27 316.3 43.27 288 43.27 curveto 288 32.7 288 23.13 288 12.57 curveto 316.3 12.57 343.6 12.57 371.8 12.57 curveto close_path stroke - grestore gsave 1 0.6471 0 setrgbcolor newpath 382.3 -264.9 moveto 382.3 -254.3 382.3 -244.8 382.3 -234.2 curveto 347 -234.2 312.8 -234.2 277.6 -234.2 curveto 277.6 -244.8 277.6 -254.3 277.6 -264.9 curveto 312.8 -264.9 347 -264.9 382.3 -264.9 curveto close_path fill - grestore gsave [1 0 0 1 315.3 -245] concat 0 setgray 0 0 moveto (\104\145\163\151\147\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 281.6 -258.4] concat 0 setgray 88.96 0 moveto (\164\051) cmr10 9.963 fshow grestore gsave [1 0 0 1 281.6 -258.4] concat 0 setgray 75.95 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 281.6 -258.4] concat 0 setgray 70.14 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 281.6 -258.4] concat 0 setgray 26.08 0 moveto (\145\170\164\145\156\163\151\157\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 281.6 -258.4] concat 0 setgray 0 0 moveto (\050\107\125\111) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 382.3 -264.9 moveto 382.3 -254.3 382.3 -244.8 382.3 -234.2 curveto 347 -234.2 312.8 -234.2 277.6 -234.2 curveto 277.6 -244.8 277.6 -254.3 277.6 -264.9 curveto 312.8 -264.9 347 -264.9 382.3 -264.9 curveto close_path stroke - grestore gsave [1 0 0 1 255.3 -288.8] concat 0 setgray 0 0 moveto (\103\141\160\164\151\157\156\072) cmbx10 9.963 fshow grestore gsave [1 0 0 1 312.4 -301.4] concat 0 setgray 72.06 0 moveto (\164\163) cmr10 9.963 fshow grestore gsave [1 0 0 1 312.4 -301.4] concat 0 setgray 59.06 0 moveto (\157\151\156) cmr10 9.963 fshow grestore gsave [1 0 0 1 312.4 -301.4] concat 0 setgray 53.24 0 moveto (\160) cmr10 9.963 fshow grestore gsave [1 0 0 1 312.4 -301.4] concat 0 setgray 0 0 moveto (\162\145\147\151\163\164\162\141\164\151\157\156) cmr10 9.963 fshow grestore gsave 0.8784 1 1 setrgbcolor newpath 92.96 -9.059 moveto 191.9 -9.059 289.9 -9.059 388.9 -9.059 curveto 400.2 -9.059 409.3 -18.17 409.3 -29.41 curveto 409.3 -84.01 409.3 -137.6 409.3 -192.2 curveto 409.3 -203.4 400.2 -212.6 388.9 -212.6 curveto 289.9 -212.6 191.9 -212.6 92.96 -212.6 curveto 81.72 -212.6 72.61 -203.4 72.61 -192.2 curveto 72.61 -137.6 72.61 -84.01 72.61 -29.41 curveto 72.61 -18.17 81.72 -9.059 92.96 -9.059 curveto close_path fill - grestore gsave [1 0 0 1 180.4 -31.02] concat 0 setgray 48.19 0 moveto (\144\151\162\145\143\164\157\162\171) cmbx12 11.96 fshow grestore gsave [1 0 0 1 180.4 -31.02] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 103.3 -45.81 moveto 147.5 -45.81 190.7 -45.81 234.9 -45.81 curveto 243.5 -45.81 250.6 -52.83 250.6 -61.49 curveto 250.6 -103.6 250.6 -144.8 250.6 -186.9 curveto 250.6 -195.5 243.5 -202.6 234.9 -202.6 curveto 190.7 -202.6 147.5 -202.6 103.3 -202.6 curveto 94.62 -202.6 87.61 -195.5 87.61 -186.9 curveto 87.61 -144.8 87.61 -103.6 87.61 -61.49 curveto 87.61 -52.83 94.62 -45.81 103.3 -45.81 curveto close_path fill - grestore gsave [1 0 0 1 99.61 -66.11] concat 0 setgray 104 0 moveto (\164\141\164\151\157\156) cmbx12 11.96 fshow grestore gsave [1 0 0 1 99.61 -66.11] concat 0 setgray 47.29 0 moveto (\151\155\160\154\145\155\145\156) cmbx12 11.96 fshow grestore gsave [1 0 0 1 99.61 -66.11] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 190.9 -111.1 moveto 190.9 -100.6 190.9 -91.01 190.9 -80.44 curveto 176 -80.44 162.1 -80.44 147.3 -80.44 curveto 147.3 -91.01 147.3 -100.6 147.3 -111.1 curveto 162.1 -111.1 176 -111.1 190.9 -111.1 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 190.9 -111.1 moveto 190.9 -100.6 190.9 -91.01 190.9 -80.44 curveto 176 -80.44 162.1 -80.44 147.3 -80.44 curveto 147.3 -91.01 147.3 -100.6 147.3 -111.1 curveto 162.1 -111.1 176 -111.1 190.9 -111.1 curveto close_path fill - grestore gsave [1 0 0 1 151.3 -98.23] concat 0 setgray 0 0 moveto (\122\145\147\151\163\164\145\162) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 190.9 -111.1 moveto 190.9 -100.6 190.9 -91.01 190.9 -80.44 curveto 176 -80.44 162.1 -80.44 147.3 -80.44 curveto 147.3 -91.01 147.3 -100.6 147.3 -111.1 curveto 162.1 -111.1 176 -111.1 190.9 -111.1 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 190.9 -151.9 moveto 190.9 -141.3 190.9 -131.7 190.9 -121.1 curveto 176 -121.1 162.1 -121.1 147.3 -121.1 curveto 147.3 -131.7 147.3 -141.3 147.3 -151.9 curveto 162.1 -151.9 176 -151.9 190.9 -151.9 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 190.3 -151.9 moveto 190.3 -141.3 190.3 -131.7 190.3 -121.1 curveto 175.8 -121.1 162.4 -121.1 147.9 -121.1 curveto 147.9 -131.7 147.9 -141.3 147.9 -151.9 curveto 162.4 -151.9 175.8 -151.9 190.3 -151.9 curveto close_path fill - grestore gsave [1 0 0 1 151.9 -138.9] concat 0 setgray 0 0 moveto (\117\160\164\151\157\156\163) cmr10 9.963 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 190.9 -151.9 moveto 190.9 -141.3 190.9 -131.7 190.9 -121.1 curveto 176 -121.1 162.1 -121.1 147.3 -121.1 curveto 147.3 -131.7 147.3 -141.3 147.3 -151.9 curveto 162.1 -151.9 176 -151.9 190.9 -151.9 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 145.4 -192.6 moveto 145.4 -182 145.4 -172.4 145.4 -161.9 curveto 134.9 -161.9 125.3 -161.9 114.7 -161.9 curveto 114.7 -172.4 114.7 -182 114.7 -192.6 curveto 125.3 -192.6 134.9 -192.6 145.4 -192.6 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 145.4 -192.6 moveto 145.4 -182 145.4 -172.4 145.4 -161.9 curveto 134.9 -161.9 125.3 -161.9 114.7 -161.9 curveto 114.7 -172.4 114.7 -182 114.7 -192.6 curveto 125.3 -192.6 134.9 -192.6 145.4 -192.6 curveto close_path stroke - grestore gsave [1 0 0 1 162.4 -177.7] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 162.4 -177.7] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 162.4 -177.7] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 223.4 -192.6 moveto 223.4 -182 223.4 -172.4 223.4 -161.9 curveto 212.9 -161.9 203.3 -161.9 192.7 -161.9 curveto 192.7 -172.4 192.7 -182 192.7 -192.6 curveto 203.3 -192.6 212.9 -192.6 223.4 -192.6 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 223.4 -192.6 moveto 223.4 -182 223.4 -172.4 223.4 -161.9 curveto 212.9 -161.9 203.3 -161.9 192.7 -161.9 curveto 192.7 -172.4 192.7 -182 192.7 -192.6 curveto 203.3 -192.6 212.9 -192.6 223.4 -192.6 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 103.3 -45.81 moveto 147.5 -45.81 190.7 -45.81 234.9 -45.81 curveto 243.5 -45.81 250.6 -52.83 250.6 -61.49 curveto 250.6 -103.6 250.6 -144.8 250.6 -186.9 curveto 250.6 -195.5 243.5 -202.6 234.9 -202.6 curveto 190.7 -202.6 147.5 -202.6 103.3 -202.6 curveto 94.62 -202.6 87.61 -195.5 87.61 -186.9 curveto 87.61 -144.8 87.61 -103.6 87.61 -61.49 curveto 87.61 -52.83 94.62 -45.81 103.3 -45.81 curveto close_path stroke - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 270.7 -45.81 moveto 310.5 -45.81 349.3 -45.81 389.1 -45.81 curveto 392 -45.81 394.3 -48.11 394.3 -50.95 curveto 394.3 -65 394.3 -78.04 394.3 -92.08 curveto 394.3 -94.92 392 -97.23 389.1 -97.23 curveto 349.3 -97.23 310.5 -97.23 270.7 -97.23 curveto 267.9 -97.23 265.6 -94.92 265.6 -92.08 curveto 265.6 -78.04 265.6 -65 265.6 -50.95 curveto 265.6 -48.11 267.9 -45.81 270.7 -45.81 curveto close_path fill - grestore gsave 0.9804 0.502 0.4471 setrgbcolor newpath 309.7 -45.81 moveto 323.5 -45.81 336.3 -45.81 350.1 -45.81 curveto 352.9 -45.81 355.2 -48.08 355.2 -50.87 curveto 355.2 -64.97 355.2 -78.07 355.2 -92.17 curveto 355.2 -94.96 352.9 -97.23 350.1 -97.23 curveto 336.3 -97.23 323.5 -97.23 309.7 -97.23 curveto 306.9 -97.23 304.6 -94.96 304.6 -92.17 curveto 304.6 -78.07 304.6 -64.97 304.6 -50.87 curveto 304.6 -48.08 306.9 -45.81 309.7 -45.81 curveto close_path fill - grestore gsave [1 0 0 1 308.6 -75.67] concat 0 setgray 22.43 0 moveto (\145\014\154\145) cmr12 11.96 fshow grestore gsave [1 0 0 1 308.6 -75.67] concat 0 setgray 0 0 moveto (\115\141\153) cmr12 11.96 fshow grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 270.7 -45.81 moveto 310.5 -45.81 349.3 -45.81 389.1 -45.81 curveto 392 -45.81 394.3 -48.11 394.3 -50.95 curveto 394.3 -65 394.3 -78.04 394.3 -92.08 curveto 394.3 -94.92 392 -97.23 389.1 -97.23 curveto 349.3 -97.23 310.5 -97.23 270.7 -97.23 curveto 267.9 -97.23 265.6 -94.92 265.6 -92.08 curveto 265.6 -78.04 265.6 -65 265.6 -50.95 curveto 265.6 -48.11 267.9 -45.81 270.7 -45.81 curveto close_path stroke - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 274.6 -112.2 moveto 311.8 -112.2 348 -112.2 385.2 -112.2 curveto 390.2 -112.2 394.3 -116.3 394.3 -121.3 curveto 394.3 -145.7 394.3 -169.1 394.3 -193.5 curveto 394.3 -198.5 390.2 -202.6 385.2 -202.6 curveto 348 -202.6 311.8 -202.6 274.6 -202.6 curveto 269.6 -202.6 265.6 -198.5 265.6 -193.5 curveto 265.6 -169.1 265.6 -145.7 265.6 -121.3 curveto 265.6 -116.3 269.6 -112.2 274.6 -112.2 curveto close_path fill - grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 274.6 -112.2 moveto 311.8 -112.2 348 -112.2 385.2 -112.2 curveto 390.2 -112.2 394.3 -116.3 394.3 -121.3 curveto 394.3 -145.7 394.3 -169.1 394.3 -193.5 curveto 394.3 -198.5 390.2 -202.6 385.2 -202.6 curveto 348 -202.6 311.8 -202.6 274.6 -202.6 curveto 269.6 -202.6 265.6 -198.5 265.6 -193.5 curveto 265.6 -169.1 265.6 -145.7 265.6 -121.3 curveto 265.6 -116.3 269.6 -112.2 274.6 -112.2 curveto close_path fill - grestore gsave [1 0 0 1 290.9 -140] concat 0 setgray 73.21 4.338 moveto (\077) cmmi8 7.97 fshow grestore gsave [1 0 0 1 290.9 -140] concat 0 setgray 47.29 0 moveto (\107\125\111) cmbx12 11.96 fshow grestore gsave [1 0 0 1 290.9 -140] concat 0 setgray 0 0 moveto (\120\154\165\147\055\151\156) cmbx12 11.96 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 306.3 -185.1 moveto 306.3 -174.5 306.3 -164.9 306.3 -154.4 curveto 295.7 -154.4 286.1 -154.4 275.6 -154.4 curveto 275.6 -164.9 275.6 -174.5 275.6 -185.1 curveto 286.1 -185.1 295.7 -185.1 306.3 -185.1 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 306.3 -185.1 moveto 306.3 -174.5 306.3 -164.9 306.3 -154.4 curveto 295.7 -154.4 286.1 -154.4 275.6 -154.4 curveto 275.6 -164.9 275.6 -174.5 275.6 -185.1 curveto 286.1 -185.1 295.7 -185.1 306.3 -185.1 curveto close_path stroke - grestore gsave [1 0 0 1 323.3 -170.2] concat 0 setgray 8.856 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 323.3 -170.2] concat 0 setgray 4.428 0 moveto (\056) cmr10 9.963 fshow grestore gsave [1 0 0 1 323.3 -170.2] concat 0 setgray 0 0 moveto (\056) cmr10 9.963 fshow grestore gsave 0.1961 0.8039 0.1961 setrgbcolor newpath 384.3 -185.1 moveto 384.3 -174.5 384.3 -164.9 384.3 -154.4 curveto 373.7 -154.4 364.1 -154.4 353.6 -154.4 curveto 353.6 -164.9 353.6 -174.5 353.6 -185.1 curveto 364.1 -185.1 373.7 -185.1 384.3 -185.1 curveto close_path fill - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 384.3 -185.1 moveto 384.3 -174.5 384.3 -164.9 384.3 -154.4 curveto 373.7 -154.4 364.1 -154.4 353.6 -154.4 curveto 353.6 -164.9 353.6 -174.5 353.6 -185.1 curveto 364.1 -185.1 373.7 -185.1 384.3 -185.1 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 274.6 -112.2 moveto 311.8 -112.2 348 -112.2 385.2 -112.2 curveto 390.2 -112.2 394.3 -116.3 394.3 -121.3 curveto 394.3 -145.7 394.3 -169.1 394.3 -193.5 curveto 394.3 -198.5 390.2 -202.6 385.2 -202.6 curveto 348 -202.6 311.8 -202.6 274.6 -202.6 curveto 269.6 -202.6 265.6 -198.5 265.6 -193.5 curveto 265.6 -169.1 265.6 -145.7 265.6 -121.3 curveto 265.6 -116.3 269.6 -112.2 274.6 -112.2 curveto close_path stroke - grestore gsave 0 setgray 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 92.96 -9.059 moveto 191.9 -9.059 289.9 -9.059 388.9 -9.059 curveto 400.2 -9.059 409.3 -18.17 409.3 -29.41 curveto 409.3 -84.01 409.3 -137.6 409.3 -192.2 curveto 409.3 -203.4 400.2 -212.6 388.9 -212.6 curveto 289.9 -212.6 191.9 -212.6 92.96 -212.6 curveto 81.72 -212.6 72.61 -203.4 72.61 -192.2 curveto 72.61 -137.6 72.61 -84.01 72.61 -29.41 curveto 72.61 -18.17 81.72 -9.059 92.96 -9.059 curveto close_path stroke - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 285.4 -299 moveto 289.5 -299 293.1 -299 296.9 -299 curveto stroke - grestore gsave newpath 296.9 -301 moveto 298.4 -300 298.9 -300 300.4 -299 curveto 298.9 -298 298.4 -298 296.9 -297 curveto 296.6 -298.7 297.3 -299.4 296.9 -301 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 329.9 -202.6 moveto 329.9 -211.9 329.9 -221.3 329.9 -230.7 curveto stroke - grestore gsave newpath 327.9 -230.7 moveto 328.9 -232.2 328.9 -232.7 329.9 -234.2 curveto 330.9 -232.7 330.9 -232.2 331.9 -230.7 curveto 330.2 -230.7 329.6 -230.7 327.9 -230.7 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 329.9 -45.81 moveto 329.9 -27.47 329.9 -9.282 329.9 9.1 curveto stroke - grestore gsave newpath 331.9 9.1 moveto 330.9 10.59 330.9 11.08 329.9 12.56 curveto 328.9 11.08 328.9 10.59 327.9 9.1 curveto 329.6 8.767 330.2 9.433 331.9 9.1 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 147.9 -136.5 moveto 118.6 -136.5 90.27 -136.5 60.96 -136.5 curveto 60.96 -120 60.96 -104.5 60.96 -87.96 curveto 55.69 -87.96 51.09 -87.96 46.07 -87.96 curveto stroke - grestore gsave newpath 46.07 -85.96 moveto 44.58 -86.96 44.09 -86.96 42.61 -87.96 curveto 44.09 -88.96 44.58 -88.96 46.07 -89.96 curveto 46.07 -88.29 46.07 -87.62 46.07 -85.96 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 147.3 -95.79 moveto 120 -95.79 93.72 -95.79 66.45 -95.79 curveto 66.45 -77.61 66.45 -60.43 66.45 -42.25 curveto 59.34 -42.25 52.97 -42.25 46.07 -42.25 curveto stroke - grestore gsave newpath 46.07 -40.25 moveto 44.58 -41.25 44.09 -41.25 42.61 -42.25 curveto 44.09 -43.25 44.58 -43.25 46.07 -44.25 curveto 46.07 -42.58 46.07 -41.91 46.07 -40.25 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 147.3 -95.79 moveto 120 -95.79 93.72 -95.79 66.45 -95.79 curveto 66.45 -62.37 66.45 -29.96 66.45 3.459 curveto 59.34 3.459 52.97 3.459 46.07 3.459 curveto stroke - grestore gsave newpath 46.07 5.459 moveto 44.58 4.459 44.09 4.459 42.61 3.459 curveto 44.09 2.459 44.58 2.459 46.07 1.459 curveto 46.07 3.126 46.07 3.793 46.07 5.459 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 87.61 -152.7 moveto 75.43 -152.7 64.26 -152.7 52.08 -152.7 curveto 52.08 -162 52.08 -170.2 52.08 -179.4 curveto 49.84 -179.4 48.01 -179.4 46.07 -179.4 curveto stroke - grestore gsave newpath 46.07 -177.4 moveto 44.58 -178.4 44.09 -178.4 42.61 -179.4 curveto 44.09 -180.4 44.58 -180.4 46.07 -181.4 curveto 46.07 -179.7 46.07 -179 46.07 -177.4 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 87.61 -152.7 moveto 75.43 -152.7 64.26 -152.7 52.08 -152.7 curveto 52.08 -146.1 52.08 -140.4 52.08 -133.7 curveto 49.84 -133.7 48.01 -133.7 46.07 -133.7 curveto stroke - grestore gsave newpath 46.07 -131.7 moveto 44.58 -132.7 44.09 -132.7 42.61 -133.7 curveto 44.09 -134.7 44.58 -134.7 46.07 -135.7 curveto 46.07 -134 46.07 -133.3 46.07 -131.7 curveto close_path fill - grestore gsave 0 0.5 dtransform truncate idtransform setlinewidth pop newpath 72.61 -166.2 moveto 69.19 -166.2 66.78 -166.2 63.37 -166.2 curveto 63.37 -186.2 63.37 -205.1 63.37 -225.1 curveto 57.29 -225.1 51.92 -225.1 46.07 -225.1 curveto stroke - grestore gsave newpath 46.07 -223.1 moveto 44.58 -224.1 44.09 -224.1 42.61 -225.1 curveto 44.09 -226.1 44.58 -226.1 46.07 -227.1 curveto 46.07 -225.4 46.07 -224.7 46.07 -223.1 curveto close_path fill - grestore showpage -%%EOF diff --git a/doc/developer/refman.tex b/doc/developer/refman.tex index 3d2254979cb2027118e22749951ba86b8cbbe274..6b473e0832fd6e079d876767400ae3c7cbdf3522 100644 --- a/doc/developer/refman.tex +++ b/doc/developer/refman.tex @@ -11,316 +11,6 @@ completing the previous chapters. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% \section{File Tree}\label{refman:files} - -%% This Section introduces the main parts of \framac in order to quickly find -%% useful information inside sources. Our goal is \emph{not} to introduce the -%% \framac software architecture (that is the purpose of Chapter~\ref{chap:archi}) -%% nor to detail each module (that is the purpose of the source documentation -%% generated by \texttt{make doc}). The directory containing the \cil -%% implementation is detailed in Section~\ref{file:cil} while the directory -%% containing the \framac implementation itself is presented in -%% Section~\ref{file:src}. - -%% Figure~\ref{fig:directories} shows all directories useful to plug-in -%% developers. More details are provided below. -%% \begin{figure}[htbp] -%% \begin{center} -%% \begin{tabular}{|c|c|l|c|} -%% \hline -%% \textbf{Kind} & \textbf{Name} & \textbf{Specification} & \textbf{Reference} \\ -%% \hline \hline -%% & \texttt{.}& \framac root directory & \\ -%% \hline \multirow{5}{30mm}{\centering{Sources}} -%% & \texttt{src/kernel\_services}& \framac kernel front-end & Section~\ref{file:frontend}\\ -%% & \texttt{src/kernel\_internals}& \framac kernel back-end & \\ -%% & \texttt{src/libraries}& \framac libraries & Section~\ref{file:libraries} \\ -%% & \texttt{src/plugins}& \framac plugins & \\ -%% & \texttt{ocamlgraph}& \ocamlgraph source files &\\ -%% \hline \multirow{2}{30mm}{\centering{Tests}} -%% & \texttt{tests}& \framac test suites & Section~\ref{adv:ptests}\\ -%% & \texttt{ptests}& \ptests implementation& \\ -%% \hline \multirow{2}{30mm}{\centering{Generated Files}} -%% & \texttt{bin}& Binaries & \\ -%% & \texttt{lib}& Some compiled files & \\ -%% \hline \multirow{4}{30mm}{\centering{Documentations}} -%% & \texttt{doc}& Documentation directory & \\ -%% & \texttt{headers}& Headers of source files & Section~\ref{adv:copyright}\\ -%% & \texttt{licenses}& Licenses used by plug-ins and kernel -%% & Section~\ref{adv:copyright} \\ -%% & \texttt{man}& Man pages& \\ -%% \hline \multirow{1}{30mm}{\centering{Shared libraries}} -%% & \texttt{share}& Shared files &\\ -%% \hline -%% \end{tabular} -%% \end{center} -%% \caption{\framac directories.}\label{fig:directories} -%% \end{figure} -%% \begin{itemize} -%% \item The \framac root directory contains the configuration files, the main -%% \texttt{Makefile}\codeidx{Makefile} and some information files (in -%% uppercase). -%% \item \framac sources are split in four directories: \texttt{src}\codeidx{src} -%% (described in Section~\ref{file:src}) contains the core of the implementation -%% while \texttt{cil}\codeidx{cil} (described in Section~\ref{file:cil}), -%% \texttt{ocamlgraph}\codeidxdef{ocamlgraph} and -%% \texttt{external}\codeidxdef{external} respectively contains the -%% implementation of \cil\index{CIL} (extended with \acsl\index{ACSL}), a -%% version of the \ocamlgraph library~\cite{ocamlgraph} compatible within -%% \framac, and external libraries\index{Library} included in the \framac -%% distribution. -%% \item The directory \texttt{tests}\codeidxdef{tests} contains the \framac test -%% suite\index{Test!Suite} which is used by the \texttt{ptests} tool (see -%% Section~\ref{adv:ptests}). -%% \item Directories \texttt{bin}\codeidxdef{bin} and \texttt{lib}\codeidxdef{lib} -%% contain binary files\index{Binary} mainly produced by \framac -%% compilation. \framac executables belong to the directory \texttt{bin}, -%% the directories \texttt{lib/plugins}\scodeidxdef{lib}{plugins} and -%% \texttt{lib/gui}\scodeidxdef{lib}{gui} receive the compiled -%% plug-ins\index{Plug-in!Compiled}, and the directory \texttt{lib/fc} receives the -%% compiled kernel interface\scodeidxdef{lib}{fc}. You should never add yourself -%% any file in these directories. -%% \item Documentation\index{Documentation} (including plug-in specific, source -%% code and \acsl documentations) is provided in directory -%% \texttt{doc}\codeidxdef{doc}. Directories -%% \texttt{headers}\codeidxdef{headers} and -%% \texttt{licenses}\codeidxdef{licenses} contains files useful for copyright -%% notification (see Section~\ref{adv:copyright}). -%% \item Directory \texttt{share}\codeidxdef{share} contains useful -%% libraries\index{Library} for \framac users such as the \framac~\C library -%% (\emph{e.g.} ad-hoc libraries such as \texttt{libc} and \texttt{malloc} for \framac), -%% as well as user-oriented Makefiles. -%% \end{itemize} - -%% \subsection{The \texttt{src/kernel\_services} -%% directory}\label{file:frontend}\codeidxdef{Kernel!Front-end} - -%% \subsection{The \texttt{src/libraries} -%% directory}\label{file:libraries} - -%% \subsection{The \texttt{cil} directory}\label{file:cil}\codeidxdef{cil} - -%% The source files of \cil\index{CIL} belong to the five directories shown in -%% Figure~\ref{fig:cil-directories}. More details are provided below. -%% \begin{figure}[htbp] -%% \begin{center} -%% \begin{tabular}{|c|l|} -%% \hline -%% \textbf{Name} & \textbf{Specification} \\ -%% \hline \hline -%% \texttt{src} & Main \cil files \\ -%% \texttt{src/ext} & Syntactic analysis provided by \cil \\ -%% \texttt{src/frontc} & \C frontend \\ -%% \texttt{src/logic} & \acsl frontend \\ -%% \hline -%% \end{tabular} -%% \end{center} -%% \caption{\cil directories.}\label{fig:cil-directories} -%% \end{figure} -%% \begin{itemize} -%% \item \texttt{src}\scodeidxdef{cil}{src} contains the main files of \cil. The most -%% important modules are \texttt{Cil\_types}\codeidxdef{Cil\_types} and -%% \texttt{Cil}\codeidxdef{Cil}. The first one contains type declarations of the -%% \cil AST \index{AST} while the second one contains useful operations -%% over this AST. -%% \item \texttt{src/ext}\sscodeidxdef{cil}{src}{ext} contains syntactic analysis -%% provided by \cil\index{CIL!Syntactic Analysis}. For example, module -%% \texttt{Cfg}\codeidxdef{Cfg} provides control flow graph, module -%% \texttt{Callgraph}\codeidxdef{Callgraph} provides a syntactic callgraph and -%% module \texttt{Dataflow2}\codeidxdef{Dataflow} provides parameterized -%% forward/backward data flow analysis\index{Dataflow analysis}. -%% \item \texttt{src/frontc}\sscodeidxdef{cil}{src}{frontc} is the \C frontend -%% which converts \C code to the corresponding \cil AST. It should not be used -%% by a \framac plug-in developer. -%% \item \texttt{src/logic}\sscodeidxdef{cil}{src}{logic} is the \acsl frontend -%% which converts logic code\index{ACSL!Frontend} to the corresponding \cil -%% AST. The only useful modules for a \framac plug-in developer are -%% \texttt{Logic\_const}\codeidxdef{Logic\_const} which provides some predefined -%% logic constructs (terms, predicates, \dots) and -%% \texttt{Logic\_typing}\codeidxdef{Logic\_typing} which allows to dynamically -%% extend the logic type system\index{Logic Type System}. -%% \end{itemize} - -%% \subsection{The \texttt{src} directory}\label{file:src}\codeidxdef{src} - -%% The source files of \framac are split into different sub-directories inside -%% \texttt{src}. Each sub-directory contains either a plug-in -%% implementation\index{Plug-in!Implementation} or some specific parts of the \framac -%% kernel\index{Kernel}. - -%% Each plug-in implementation can be split into two different sub-directories, one -%% for exported type declarations\index{Plug-in!Types} and related implementations -%% visible from \texttt{Db}\codeidx{Db} (see Chapter~\ref{chap:archi} and -%% Section~\ref{adv:static-registration}) and another for the implementation provided in -%% \texttt{Db}. - -%% Kernel directories are shown Figure~\ref{fig:src-directories}. More details are -%% provided below. -%% \begin{figure}[htbp] -%% \begin{center} -%% \begin{tabular}{|c|c|l|c|} -%% \hline -%% \textbf{Kind} & \textbf{Name} & \textbf{Specification} & \textbf{Reference} \\ -%% \hline \hline \multirow{4}{24mm}{\centering{Toolboxes}} -%% & \texttt{kernel} & Kernel toolbox & \\ -%% & \texttt{logic} & Logic toolbox & \\ -%% & \texttt{ai} & Abstract interpretation toolbox & Section~\ref{adv:memory} \\ -%% & \texttt{memory\_states} & Memory-state toolbox & Section~\ref{adv:memory} \\ -%% \hline \multirow{4}{24mm}{\centering{Libraries}} -%% & \texttt{type} & Datatype library & Section~\ref{adv:datatype} \\ -%% & \texttt{project} & Project library & Section~\ref{adv:project} \\ -%% & \texttt{printer} & AST printer library & \\ -%% & \texttt{lib} & Miscellaneous libraries & \\ -%% & \texttt{misc} & Additional useful operations & \\ -%% \hline \multirow{1}{24mm}{\centering{Entry points}} -%% & \texttt{gui} & Graphical User Interface & Section~\ref{adv:gui} \\ -%% \hline -%% \end{tabular} -%% \end{center} -%% \caption{Kernel directories.}\label{fig:src-directories} -%% \end{figure} -%% \begin{itemize} -%% \item Directory \texttt{kernel}\codeidxdef{kernel} contains the kernel -%% toolbox\index{Kernel!Toolbox} over \cil. Main kernel modules are shown in -%% Figure~\ref{fig:kernel-modules}. -%% \begin{figure}[htbp] -%% \begin{center} -%% \begin{tabular}{|c|c|p{50mm}|c|} -%% \hline -%% \textbf{Kind} & \textbf{Name} & \textbf{Specification} & \textbf{Reference} \\ -%% \hline -%% % -%% \hline \multirow{2}{18mm}{\centering{AST}} -%% & \texttt{Ast}\codeidxdef{Ast} -%% & The \cil AST\index{AST} for \framac & \\ -%% & \texttt{Ast\_info}\codeidxdef{Ast\_info} -%% & Operations over the \cil AST & \\ -%% % -%% \hline \multirow{5}{18mm}{\centering{Global tables}} -%% & \texttt{File}\codeidxdef{File} -%% & AST creation\index{AST!Initializer} and access to \C files & \\ -%% & \texttt{Globals}\codeidxdef{Globals} & Operations on globals & \\ -%% & \texttt{Kernel\_function}\codeidxdef{Kernel\_function} -%% & Operations on functions & \\ -%% & \texttt{Emitter}\codeidxdef{Emitter} & Emitter of property statuses & -%% Section~\ref{adv:annotations}\\ -%% & \texttt{Loop}\codeidxdef{Loop} & Operations on loops & \\ -%% % -%% \hline \multirow{3}{18mm}{\centering{Logic}} -%% & \texttt{Annotations}\codeidxdef{Annotations} -%% & Operations on \acsl annotations\index{Annotation} -%% & Section~\ref{adv:annotations}\\ -%% & \texttt{Property}\codeidxdef{Property} -%% & Logical properties\index{Property} -%% & Section~\ref{adv:annotations}\\ -%% & \texttt{Property\_status}\codeidxdef{Property\_status} -%% & Status of properties\index{Property!Status} -%% & Section~\ref{adv:annotations}\\ -%% % -%% \hline \multirow{2}{18mm}{\centering{Plug-in APIs}} -%% & \texttt{Db}\codeidxdef{Db} & Static plug-in database & -%% Section~\ref{adv:static-registration} \\ -%% & \texttt{Dynamic}\codeidxdef{Dynamic} & Interface for dynamic plug-ins & -%% Section~\ref{adv:dynamic-registration} \\ -%% % -%% \hline \multirow{4}{18mm}{\centering{Command Line Options}} -%% & \texttt{Parameter\_sig}\codeidxdef{Parameter\_sig} & Signatures of command -%% line options -%% & Section~\ref{adv:cmdline}\\ -%% & \texttt{Parameter\_customize}\codeidxdef{Parameter\_customize} -%% & Customize behavior of command line options -%% & Section~\ref{adv:cmdline}\\ -%% & \texttt{Typed\_parameter}\codeidxdef{Typed\_parameter} & Parameter as command line options -%% & Section~\ref{adv:cmdline}\\ -%% & \texttt{Cmdline}\codeidxdef{Cmdline} -%% & Command line parsing & Section~\ref{adv:cmdline} \\ -%% % -%% \hline \multirow{8}{18mm}{\centering{Base Modules}} -%% & \texttt{Config}\codeidxdef{Config} & Information about \framac version & \\ -%% & \texttt{Plugin}\codeidxdef{Plugin} & General services for plug-ins -%% & Section~\ref{adv:plugin-services} \\ -%% & \texttt{Kernel}\codeidxdef{Kernel} & Kernel as a plug-in -%% & Section~\ref{adv:cmdline} \\ -%% & \texttt{Log}\codeidxdef{Log} & Printing messages & -%% Section~\ref{adv:log} \\ -%% & \texttt{Journal}\codeidxdef{Journal} & Journalization & -%% Section~\ref{adv:journalization} \\ -%% & \texttt{CilE}\codeidxdef{CilE} & Useful \cil extensions & \\ -%% & \texttt{Alarms}\codeidxdef{Alarms} & Alarm management & \\ -%% & \texttt{Stmts\_graph}\codeidxdef{Stmts\_graph} -%% & Accessibility checks using CFG% -%% \index{CFG}\index{Control Flow Graph|see{CFG}} & \\ -%% & \texttt{Floating\_point}\codeidxdef{Floating\_point} -%% & Floating-point operations & \\ -%% % -%% \hline \multirow{1}{18mm}{\centering{Visitor}} -%% & \texttt{Visitor}\codeidxdef{Visitor} -%% & \framac visitors (subsume \cil ones)\index{CIL!Visitor} & -%% Section~\ref{adv:visitors} \\ -%% % -%% \hline \multirow{2}{18mm}{\centering{Printer}} -%% & \texttt{Printer\_api}\codeidxdef{Printer\_api} -%% & Signature of AST printers -%% & \\ -%% & \texttt{Printer}\codeidxdef{Printer} -%% & AST printer -%% & \\ -%% % -%% \hline \multirow{2}{18mm}{\centering{System}} -%% & \texttt{Command}\codeidxdef{Command} & System operations & \\ -%% & \texttt{Task}\codeidxdef{Task} & Higher-level API than \texttt{Command} & \\ -%% % -%% \hline \multirow{3}{18mm}{\centering{Initializer}} -%% & \texttt{Boot}\codeidxdef{Boot} & Last linked module -%% & Section~\ref{adv:init} \\ -%% & \texttt{Gui\_init}\codeidxdef{Gui\_init} -%% & Very early initialization of the GUI -%% & Section~\ref{adv:init} \\ -%% & \texttt{Special\_hooks}\codeidxdef{Special\_hooks} -%% & Registration of some kernel hooks -%% & \\ -%% \hline -%% \end{tabular} -%% \end{center} -%% \caption{Main kernel modules.}\label{fig:kernel-modules} -%% \end{figure} -%% \item Directory \texttt{logic}\codeidxdef{logic} is the logic toolbox. It -%% contains modules helping to handle logical annotations and their status. -%% \item Directories \texttt{ai}\codeidxdef{ai} and -%% \texttt{memory\_states}\codeidxdef{memory\_states} are the abstract -%% interpretation and memory-state toolboxes% -%% \index{Abstract Interpretation!Toolbox}\index{Memory States!Toolbox} (see -%% section~\ref{adv:memory}). In particular, in \texttt{ai}, module -%% \texttt{Abstract\_interp}\codeidxdef{Abstract\_interp} defines useful generic -%% lattices\index{Lattice} and module \texttt{Ival}\codeidxdef{Ival} defines -%% some pre-instantiated arithmetic lattices while, in \texttt{memory\_states}, -%% module \texttt{Locations}\codeidxdef{Locations} provides several -%% representations of \C locations\index{Location} and modules -%% \texttt{Lmap}\codeidxdef{Lmap} and -%% \texttt{Lmap\_bitwise}\codeidxdef{Lmap\_bitwise} provide maps indexed by such -%% locations. -%% \item Directories \texttt{type}\codeidxdef{type} and -%% \texttt{project}\codeidxdef{project} contain the type -%% library\index{Datatype} and the project library\index{Project} respectively -%% described in details in Sections~\ref{adv:datatype} -%% and~\ref{adv:project}, while directory \texttt{printer}\codeidxdef{printer} -%% contain the modules defining the printer of the AST. -%% \item Directories \texttt{lib}\codeidxdef{lib} and -%% \texttt{misc}\codeidxdef{misc} contain datastructures and operations used in -%% \framac. In particular, module \texttt{Extlib}\codeidxdef{Extlib} is the -%% \framac extension of the \caml standard library whereas module -%% \texttt{Type}\codeidxdef{Type} is the interface for type values (the \caml -%% values representing \caml types)\index{Type value} required by dynamic -%% plug-in registrations and uses and journalization (see -%% Section~\ref{adv:datatype}). -%% \item Directory \texttt{gui}\footnote{From the outside, the GUI may be seen as -%% a plug-in with some exceptions.}\codeidxdef{gui} contains the \texttt{gui} -%% implementation part common to all plug-ins\index{GUI}. See -%% Section~\ref{adv:gui} for more details. -%% \end{itemize} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \section{Configure.in} \label{refman:configure}\codeidxdef{configure.in} Figure~\ref{fig:configure-sections} presents the different parts of @@ -394,7 +84,7 @@ Section~\ref{make:sections} details the different sections of \texttt{Makefile.config.in}, \texttt{Makefile.common}, \texttt{Makefile.generic}, \texttt{Makefile.generating} and \texttt{Makefile}. Next Section~\ref{make:plugin} introduces the variables -customizing \texttt{Makefile.plugin} and \texttt{Makefile.dynamic}. Finally +customizing \texttt{Makefile.dynamic}. Finally Section~\ref{make:dynamic} shows specific details of \texttt{Makefile.dynamic}. \subsection{Overview}\label{make:overview} @@ -414,8 +104,11 @@ Section~\ref{make:dynamic} shows specific details of \texttt{Makefile.dynamic}. providing some other general variables; \item \texttt{Makefile.generic}\codeidxdef{Makefile.generic}: the Makefile providing generic rules for compiling source files -\item \texttt{Makefile.plugin}\codeidxdef{Makefile.plugin}: the Makefile - introducing specific stuff for plug-in compilation; +\item + \texttt{.Makefile.plugin.generated}\codeidxdef{.Makefile.plugin.generated}: + the Makefile introducing specific stuff for plug-in compilation which is + generated from + \texttt{Makefile.plugin.template}\codeidxdef{Makefile.plugin.template}; \item \texttt{Makefile.dynamic}\codeidxdef{Makefile.dynamic}: the Makefile usable by plug-in specific Makefiles. \item \texttt{Makefile.dynamic\_config}\codeidxdef{Makefile.dynamic\_config}: @@ -425,9 +118,9 @@ Section~\ref{make:dynamic} shows specific details of \texttt{Makefile.dynamic}. \texttt{Makefile.dynamic\_config.external}% \codeidxdef{Makefile.dynamic\_config.external}. It sets variables which automatically configure \texttt{Makefile.dynamic}. -\item \texttt{Makefile.kernel}\codeidxdef{Makefile.kernel} is automatically - generated from \texttt{Makefile}. It contains several variables useful for - linking a plug-in against the \framac kernel\index{Kernel}. +\item \texttt{Makefile.clean}\codeidxdef{Makefile.clean} contains specific + targets for cleaning which are separated from \texttt{Makefile} for + performance reasons. \item \texttt{.Makefile.user}\codeidxdef{.Makefile.user} is a per-user Makefile that can be used to override some variables. If it is not present, the default values of \texttt{Makefile} variables will be used. @@ -442,11 +135,101 @@ shows these relationships. \codeidx{Makefile} \codeidx{Makefile.generating} \codeidx{Makefile.config.in} -\codeidx{Makefile.plugin} +\codeidx{Makefile.plugin.generated} \codeidx{Makefile.dynamic} -\begin{center} -\includegraphics{makefiles.mps} -\end{center} +\begin{tikzpicture}[ +plugin/.style={fill=Orange,draw=Orange}, +generated/.style={fill=palered,draw=palered}, +kernel/.style={fill=darkgreen,draw=darkgreen}, +other/.style={fill=palered,draw=darkgreen}, +opt/.style={fill=palegreen,draw=palegreen}, +include/.style={-Latex,very thick,fill=none}, +generation/.style={-Latex,very thick,dashed,fill=none}, +] +\begin{scope}[every node/.style={rounded corners,node font=\small}] + {[start chain=going right, node distance=\bigpaddelta] + \node[on chain,kernel,draw=black] (config) + { Makefile.config.in }; + \node[on chain,kernel,draw=black] (dyn-internal) + { Makefile.dynamic\_config.internal}; + \node[on chain,kernel,draw=black] (dyn-external) + { Makefile.dynamic\_config.external}; + } + \coordinate[yshift=-\largepadding] + (common-basept) at ($(config.south west)!0.5!(dyn-internal.south east)$); + {[start chain=kernel-chain going below, node distance=\bigpaddelta] + \node[on chain,kernel,draw=black,anchor=north] at (common-basept) + (common) {Makefile.common}; + \node[on chain,kernel,draw=black] (generic) {Makefile.generic}; + } + + \node[generated,draw=black,right=\largepadding] + at ($(kernel-chain-begin.north east)!0.5!(kernel-chain-end.south east)$) + (dyn) { Makefile.dynamic\_config }; + + {[start chain=main going right,node distance=\padding] + \node[on chain,kernel,draw=black, + below left=\largepadding and \padding] + at (kernel-chain-end.south west) (generating) { Makefile.generating }; + \node[on chain,kernel,draw=black] (makefile) { Makefile }; + \node[on chain] {\ldots}; + \node[on chain,generated,draw=black] + (generated) {.Makefile.plugin.generated }; + \node[on chain,kernel,draw=black,node distance=\bigpadding] + (dynamic) {Makefile.dynamic}; + } + {[start chain=opt going left,node distance=\bigpaddelta] + \node[on chain,kernel,draw=black,anchor=north east,yshift=-\bigpadding] + at (generated.south east) (template) {Makefile.plugin.template}; + \node[on chain,opt,draw=black] (clean) {Makefile.clean}; + \node[on chain,opt,draw=black] (user) {.Makefile.user}; + } + {[start chain=specific going right,node distance=\bigpaddelta] + \node[on chain,plugin,draw=black,anchor=north east,yshift=-\largepadding] + at (opt-begin.south east) { specific Makefile for plug-in 1 }; + \node[on chain] {\ldots}; + \node[on chain,plugin,draw=black] {specific Makefile for plugin $n$}; + } +\end{scope} +\matrix[anchor=north east,yshift=-\bigpadding,matrix of nodes, +every node/.style={node font=\small,right}] at (specific-end.south east) { +\textbf{Caption:} \\ +\node at(0,0) (m1) {$m_1$}; +\node at (\largepadding,0) (m2) {$m_2$}; +\draw[include] (m1) -- (m2); +& +Makefile $m_1$ is included in Makefile $m_2$ +\\ +\node at(0,0) (gm1) {$m_1$}; +\node at (\largepadding,0) (gm2) {$m_2$}; +\draw[generation] (gm1) -- (gm2); +& + Makefile $m_2$ is generated from Makefile $m_1$ \\ +|[plugin,draw=none]| orange boxes & Plug-in Makefiles \\ +|[generated,draw=none]| red boxes & Generated Makefiles \\ +|[kernel,draw=none]| green boxes & Other kernel Makefiles \\ +|[opt,draw=none]| light green boxes & Optional kernel Makefiles \\ +}; +\draw[kernel,include] (config) -- (common); +\draw[kernel,include] (dyn-internal) to[out=-60,in=20] (node cs:name=makefile,angle=60); +\draw[generated,generation] (dyn-internal) -- (dyn); +\draw [generated,generation] (dyn-external) -- (dyn); +\draw[kernel,include] (common.west) to[out=200,in=135] (node cs:name=makefile,angle=170); +\draw[kernel,include] (generic.west) to[out=200,in=120] + (node cs:name=makefile,angle=130); +\draw[kernel,include] (common) -- (node cs:name=dynamic,angle=50); +\draw[kernel,include] (generic) -- (node cs:name=dynamic,angle=120); +\draw[kernel,include] (dyn) -- (node cs:name=dynamic,angle=20); +\draw[kernel,include] (generating) -- (makefile); +\draw[plugin,include,bend left] (generated.south west) to (makefile.south east); +\draw[plugin,include,bend right] (generated.north west) to (makefile.north east); +\draw[generated,generation] (template) -- (generated); +\draw[kernel,include] (generated) -- (dynamic); +\draw[plugin,include] (dynamic) -- (node cs:name=specific-begin,angle=10); +\draw[plugin,include] (dynamic) -- (specific-end); +\draw[opt,include] (user) -- (makefile); +\draw[opt,include] (clean) -- (makefile); +\end{tikzpicture} \caption{Relationship between the Makefiles}\label{fig:makefiles} \end{figure} \texttt{Makefile} and \texttt{Makefile.dynamic} are independent: the first one @@ -455,9 +238,12 @@ the \framac plug-ins. Their common variables are defined in \texttt{Makefile.common} (which includes \texttt{Makefile.config.in}). They also include \texttt{Makefile.generic}, that defines default compilation rules for various kinds of source files. -\texttt{Makefile.plugin} defines generic rules -and variables for compiling plug-ins. It is used both by \texttt{Makefile} for -kernel-specific plug-ins integrated compiled from the \framac Makefile and by +\texttt{Makefile.plugin.template} defines generic rules +and variables for compiling plug-ins. It is used to generate +\texttt{.Makefile.plugin.generated} for each plugin. +\texttt{.Makefile.plugin.generated} is included either +by \texttt{Makefile} for +kernel-specific plug-ins integrated in \framac Makefile and by \texttt{Makefile.dynamic} for plug-ins with their own Makefiles. \texttt{.Makefile.user}\codeidxdef{.Makefile.user} is included by \texttt{Makefile} when the former exists. It is only used when compiling @@ -654,15 +440,13 @@ expected. \framac. \end{enumerate} -\subsection{Variables of \texttt{Makefile.dynamic} and - \texttt{Makefile.plugin}} +\subsection{Variables of \texttt{Makefile.dynamic}} \label{make:plugin} -\codeidxdef{Makefile.plugin}\codeidxdef{Makefile.dynamic} +\codeidxdef{Makefile.dynamic} Figures~\ref{fig:make-parameters} and~\ref{fig:special-parameters} presents all the variables that can be set before including -\texttt{Makefile.plugin} or \texttt{Makefile.dynamic} (see -Sections~\ref{adv:make} and~\ref{adv:dynamic-make}). +\texttt{Makefile.dynamic} (see Section~\ref{adv:dynamic-make}). Details are provided below. \begin{figure}[htbp] \begin{center} @@ -702,8 +486,7 @@ with \texttt{ocamlopt} \\ \hline \end{tabularx} \end{center} -\caption{Standard parameters of \texttt{Makefile.dynamic} and - \texttt{Makefile.plugin}.}\label{fig:make-parameters} +\caption{Standard parameters of \texttt{Makefile.dynamic}.}\label{fig:make-parameters} \end{figure} \begin{itemize} \item Variable \texttt{PLUGIN\_NAME}\codeidxdef{PLUGIN\_NAME} @@ -820,8 +603,7 @@ in the distribution & no \\ \hline \end{tabularx} \end{center} -\caption{Special parameters of \texttt{Makefile.dynamic} and - \texttt{Makefile.plugin}.}\label{fig:special-parameters} +\caption{Special parameters of \texttt{Makefile.dynamic}.}\label{fig:special-parameters} \end{figure} \begin{itemize} \item Variable @@ -902,8 +684,7 @@ in the distribution & no \\ (see~\ref{make:sections}\textsection\ref{make:sec:tests}). For instance, \verb|PLUGIN_PTESTS_OPTS:=-j 1| will deactivate parallelization of tests in case - the plugin does not support concurrent runs. It is only used by - \texttt{Makefile.dynamic}. + the plugin does not support concurrent runs. % \item Variable \texttt{PLUGIN\_DISTRIB\_BIN}% @@ -923,9 +704,9 @@ distribution for this plug-in. They will be put at their proper place for a release.\index{Plug-in!Distribution} \end{itemize} As previously said, the above variables are set before including -\texttt{Makefile.plugin} in order to customize its behavior. They +\texttt{Makefile.dynamic} in order to customize its behavior. They must not be use anywhere else in the Makefile. In order to deal with this -issue, for each plug-in $p$, \texttt{Makefile.plugin} provides some variables +issue, for each plug-in $p$, \texttt{Makefile.dynamic} provides some variables which may be used after its inclusion defining $p$. These variables are listed in Figure~\ref{fig:make-defvars}. For each variable of the form \texttt{$p$\_VAR}, its behavior is exactly equivalent to the value of the @@ -1013,7 +794,7 @@ parameter \texttt{PLUGIN\_VAR} for the plug-in $p$\footnote{Variables of the \hline \end{tabularx} \end{center} -\caption{Variables defined by \texttt{Makefile.plugin}.}\label{fig:make-defvars} +\caption{Variables defined by \texttt{Makefile.dynamic}.}\label{fig:make-defvars} \end{figure} \footnotetext{$plugin$ is the module name of the considered plug-in (\emph{i.e.} as set by diff --git a/doc/developer/tutorial.tex b/doc/developer/tutorial.tex index e83f5e0175aa4bb540b70a0a93ce056dfb9cb027..d141bca2d29c5d0ccc663c9b4066ab3c1c91e645 100644 --- a/doc/developer/tutorial.tex +++ b/doc/developer/tutorial.tex @@ -98,10 +98,115 @@ further documentation. Figure~\ref{fig:overview} shows how a plug-in can integrate with the \framac platform. This tutorial focuses on specific parts of this figure. + \begin{figure}[ht] \begin{center} -%\includegraphics[viewport=15 636 454 843]{dynamic.pdf} -\includegraphics{plugin_mpost.mps} +\newsavebox{\designbox} +\savebox{\designbox}{\begin{varwidth}{\textwidth}\centering Design\\(GUI extension point)\end{varwidth}} +\newlength{\designheight} +\setlength{\designheight}{\totalheightof{\usebox\designbox}} +\newsavebox{\captionbox}\savebox{\captionbox}{\textbf{Caption:}} +\newlength{\captionheight}\settototalheight{\captionheight}{\captionbox} +\begin{tikzpicture}[remember picture,txt/.style={inner xsep=3pt}] + \node[inner sep=0pt] (implem) { + \tikztitleboxbig{Plug-in implementation}{darkgreen}{ + \begin{tikz-vbox}{plugin-text} + \node[on chain, draw, txt,minimum height=\designheight](register){Register}; + \node[on chain, draw, txt,minimum height=\designheight](options){Options}; + \node[on chain]{ + \begin{tikz-hbox}[every node/.style={minimum height=\designheight,minimum width=\designheight}]{etc-text} + \node[draw, on chain]{}; + \node[on chain] {\ldots}; + \node[draw, on chain] {}; + \end{tikz-hbox} + }; + \end{tikz-vbox} + } + }; + \node[anchor=south west,inner sep=0pt,xshift=\padding] + at (implem.south east) (gui){ + \tikztitleboxbig{Plug-in GUI}{darkgreen}{ + \begin{tikz-hbox}{pluginguicontent} + \begin{scope}[ + every node/.style={ + on chain, + minimum width=\designheight, + minimum height=\designheight}] + \node[draw] {}; \node {\ldots}; \node[draw] {}; + \end{scope} + \end{tikz-hbox} + } + }; + + \coordinate[yshift=\padding] (makefile-se) at (gui.north east); + \coordinate (makefile-nw) at (gui.west |- implem.north); + \node[fill=palered, rounded corners=5pt,node font=\large, + fit=(makefile-nw) (makefile-se), + inner sep=0pt,draw] + (makefile) + {Makefile}; + + \node[node font={\Large\bfseries},yshift=\padding,anchor=south] + at ($(implem.north west)!0.5!(makefile.north east)$) + (plugin-title) + {Plug-in directory}; + \begin{scope}[on background layer] + \node[fill=LightCyan, rounded corners=7pt,draw, + fit=(implem) (gui) (makefile) (plugin-title), inner sep=\padding] + (plugin-dir) + {}; + \end{scope} + + \node[anchor=north,yshift=-\bigpadding,fill=Orange,draw] + at (gui.south|-plugin-dir.south) (design) {\usebox\designbox}; + + \node[anchor=north east, + yshift=-\bigpadding-\captionheight] + at (plugin-dir.east |- design.south) (registration) {registration points}; + \draw[Latex-] ($(registration.west)+(-\padding,0)$) -- +(-\bigpadding,0); + + \node[anchor=south east,xshift=-\padding] at (registration.north west) + {\usebox{\captionbox}}; + + \node[anchor=south,yshift=\bigpadding,fill=palered,draw, + minimum height=1.5\designheight] + at (plugin-dir.north -| gui.north) (makefile-dynamic) {Makefile.dynamic}; + + \newlength{\kernelwidth} + \setlength{\kernelwidth}{\widthof{Dynamic}}%TODO:compute dynamically + \node[xshift=-\bigpadding,anchor=east] at (plugin-dir.west) { + \begin{tikz-vbox}[every node/.style= + {on chain,draw,fill=Orange,minimum height=\designheight,txt, + minimum width=\kernelwidth}] + {kernel} + \node (db-main) {Db.Main}; + \node (dynamic) {Dynamic}; + \node (plugin) {Plugin}; + \node (type) {Type}; + \node (journal) {Journal}; + \node (project) {Project}; + \end{tikz-vbox} + }; + + \draw[-Latex] (makefile.north) -- (makefile-dynamic.south); + \draw[-Latex] (gui.south) -- (design.north); + \coordinate (main-pt) at ($(db-main.east)+(0.9\bigpadding,0)$); + \draw (register.west) -| (main-pt); + \draw[-Latex] (main-pt) -- (db-main.east); + \draw[-Latex] (main-pt |- dynamic.east) -- (dynamic.east); + + \draw[-Latex] (options.west) -- (options.west -| main-pt) + -- +(-0.2\bigpadding,0) |- (plugin.east); + + \coordinate (implem-pt) at + ($(options.west -| main-pt)+(-0.4\bigpadding,-\padding)$); + \draw (implem-pt -| implem.west) -- (implem-pt); + \draw[-Latex] (implem-pt) |- (type.east); + \draw[-Latex] (implem-pt) |- (journal.east); + \draw[-Latex] ($(plugin-dir.west |- implem-pt)+(0,-\padding)$) + -- ($(implem-pt)+(0.2\bigpadding,-\padding)$) |- (project.east); + + \end{tikzpicture} \end{center} \scodeidx{Db}{Main}\codeidx{Dynamic}\codeidx{Plugin} \codeidx{Project}\codeidx{Type}\codeidx{Journal} @@ -424,24 +529,25 @@ for us, as it will recursively print substatements of compound statements current statement: substatements will be represented by other nodes. Thus we will use the following small function: \ocamlinput{./tutorial/viewcfg/src/print_stmt.ml} -\scodeidx{Cil\_types}{Instr} -\scodeidx{Cil\_types}{Return} -\scodeidx{Cil\_types}{Goto} -\scodeidx{Cil\_types}{Break} -\scodeidx{Cil\_types}{Continue} -\scodeidx{Cil\_types}{If} -\scodeidx{Cil\_types}{Switch} -\scodeidx{Cil\_types}{Loop} -\scodeidx{Cil\_types}{Block} -\scodeidx{Cil\_types}{UnspecifiedSequence} -\scodeidx{Cil\_types}{TryFinally} -\scodeidx{Cil\_types}{TryExcept} +\sscodeidx{Cil\_types}{stmtkind}{Instr} +\sscodeidx{Cil\_types}{stmtkind}{Return} +\sscodeidx{Cil\_types}{stmtkind}{Goto} +\sscodeidx{Cil\_types}{stmtkind}{Break} +\sscodeidx{Cil\_types}{stmtkind}{Continue} +\sscodeidx{Cil\_types}{stmtkind}{If} +\sscodeidx{Cil\_types}{stmtkind}{Switch} +\sscodeidx{Cil\_types}{stmtkind}{Loop} +\sscodeidx{Cil\_types}{stmtkind}{Block} +\sscodeidx{Cil\_types}{stmtkind}{UnspecifiedSequence} +\sscodeidx{Cil\_types}{stmtkind}{TryFinally} +\sscodeidx{Cil\_types}{stmtkind}{TryExcept} \scodeidx{Printer\_api}{S.pp\_instr} \scodeidx{Printer\_api}{S.pp\_exp} The \texttt{Cil\_types} module contains the definition of the AST of a \C program, like constructors \texttt{Cil\_types.Instr}, \texttt{Cil\_types.Return} -and so on of type \texttt{Cil\_types.stmt}. The \texttt{Printer} module contains +and so on of type \texttt{Cil\_types.stmtkind}. +The \texttt{Printer} module contains functions that prints the different Cil types. The documentation of these module is available on the \framac website\footnote{From \url{http://frama-c.com/download.html}.}, or by typing \texttt{make doc} in @@ -469,7 +575,7 @@ There are three kinds of nodes where we have something to do. First, at the file level, we create the whole graph structure. \ocamlinput{./tutorial/viewcfg/src/print_cfg_vfile.ml} -\scodeidx{Cil}{DoChildrenPost} +\sscodeidx{Cil}{visitAction}{DoChildrenPost} \sscodeidx{Cil}{cilVisitor}{vfile} \texttt{Cil.DoChildrenPost} is one of the possible @@ -482,21 +588,22 @@ Then, for each function, we encapsulate the CFG in a subgraph, and do nothing for the other globals. \ocamlinput{./tutorial/viewcfg/src/print_cfg_vglob.ml} -\scodeidx{Cil}{DoChildrenPost} -\scodeidx{Cil}{SkipChildren} +\sscodeidx{Cil}{visitAction}{DoChildrenPost} +\sscodeidx{Cil}{visitAction}{SkipChildren} \sscodeidx{Visitor}{frama\_c\_visitor}{vglob\_aux} \scodeidx{Cil\_types}{GFun} \scodeidx{Printer\_api}{S.pp\_varinfo} \texttt{Cil.SkipChildren} tells the visitor not to visit the children nodes, which makes it more efficient\footnote{In a copying visitor, -\texttt{Cil.JustCopy}\scodeidx{Cil}{JustCopy} should have been used instead.}. +\texttt{Cil.JustCopy}\sscodeidx{Cil}{visitAction}{JustCopy} +should have been used instead.}. Last, for each statement, we create a node in the graph, and create the edges toward its successors: \ocamlinput{./tutorial/viewcfg/src/print_cfg_vstmt_aux_novalue.ml} -\scodeidx{Cil}{DoChildren} +\sscodeidx{Cil}{visitAction}{DoChildren} \sscodeidx{Visitor}{frama\_c\_visitor}{vstmt\_aux} This code could be optimized, for instance by replacing the final @@ -617,7 +724,7 @@ be unreachable by the value analysis. For this purpose, we change the \sscodeidx{Db}{Value}{is\_computed} \sscodeidx{Db}{Value}{get\_stmt\_state} \sscodeidx{Db}{Value}{is\_reachable} -\scodeidx{Cil}{DoChildren} +\sscodeidx{Cil}{visitAction}{DoChildren} \sscodeidx{Visitor}{frama\_c\_visitor}{vstmt\_aux} This code fills the nodes with green if the node may be diff --git a/doc/developer/tutorial/viewcfg/src/gui.ml b/doc/developer/tutorial/viewcfg/src/gui.ml index 787c5cdd4fbd3f392181d18e06c69d7479f3492c..b702c928436bdc4abf331937f52564e60617eb15 100644 --- a/doc/developer/tutorial/viewcfg/src/gui.ml +++ b/doc/developer/tutorial/viewcfg/src/gui.ml @@ -2,7 +2,7 @@ let cfg_selector (popup_factory:GMenu.menu GMenu.factory) main_ui ~button:_ localizable = match localizable with (* Matches global declarations that are functions. *) - | Pretty_source.PVDecl(_, ({vtype = TFun(_,_,_,_)} as vi)) -> + | Pretty_source.PVDecl(_, _, ({vtype = TFun(_,_,_,_)} as vi)) -> let callback () = let kf = Globals.Functions.get vi in let fundec = Kernel_function.get_definition kf in diff --git a/doc/download_manuals.sh b/doc/download_manuals.sh deleted file mode 100644 index 212143aadbb863af480fd41b383008450864a036..0000000000000000000000000000000000000000 --- a/doc/download_manuals.sh +++ /dev/null @@ -1,19 +0,0 @@ -########################################################################## -# # -# This file is part of Frama-C. # -# # -# Copyright (C) 2007-2016 # -# CEA (Commissariat à l'énergie atomique et aux énergies # -# alternatives) # -# # -# All rights reserved. # -# Contact CEA LIST for licensing. # -# # -########################################################################## - -#!/bin/sh - -MANUALS=acsl-implementation \ - aorai-manual.pdf rte-manual.pdf wp-manual.pdf -acsl.pdf metrics-manual.pdf user-manual.pdf -aorai-example.tgz plugin-development-guide.pdf value-analysis.pdf diff --git a/doc/jessie/pp.mll b/doc/jessie/pp.mll index a85d425c8ec86c8364ed5f730667c328a0b8b52b..9e9a585dd81f14515f48e88337ec8262fa7a96e5 100644 --- a/doc/jessie/pp.mll +++ b/doc/jessie/pp.mll @@ -260,17 +260,17 @@ and pp = parse | "\\begin{c}" (c_files as s) "\n" { c_output s; begin_tt (); ctt lexbuf; end_tt (); close_c_output(); pp lexbuf } - | "é" { print_string "\\'e"; pp lexbuf } - | "è" { print_string "\\`e"; pp lexbuf } - | "à" { print_string "\\`a"; pp lexbuf } - | "â" { print_string "\\^a"; pp lexbuf } - | "ê" { print_string "\\^e"; pp lexbuf } - | "î" { print_string "\\^{\\i}"; pp lexbuf } - | "ï" { print_string "\\\"{\\i}"; pp lexbuf } - | "û" { print_string "\\^u"; pp lexbuf } - | "ù" { print_string "\\`u"; pp lexbuf } - | "ö" { print_string "\\\"o"; pp lexbuf } - | "ô" { print_string "\\^o"; pp lexbuf } + | "é" { print_string "\\'e"; pp lexbuf } + | "è" { print_string "\\`e"; pp lexbuf } + | "à " { print_string "\\`a"; pp lexbuf } + | "â" { print_string "\\^a"; pp lexbuf } + | "ê" { print_string "\\^e"; pp lexbuf } + | "î" { print_string "\\^{\\i}"; pp lexbuf } + | "ï" { print_string "\\\"{\\i}"; pp lexbuf } + | "û" { print_string "\\^u"; pp lexbuf } + | "ù" { print_string "\\`u"; pp lexbuf } + | "ö" { print_string "\\\"o"; pp lexbuf } + | "ô" { print_string "\\^o"; pp lexbuf } | eof { () } | _ diff --git a/doc/pdg/algoH.mli b/doc/pdg/algoH.mli index 25260c2dd6144595aa7b2645e75b27304e32e435..432872ba999a4cfbc1fb1479fbedbef2254c9111 100644 --- a/doc/pdg/algoH.mli +++ b/doc/pdg/algoH.mli @@ -4,7 +4,7 @@ type t_program_point ;; (* Instruction *) type t_stmt ;; -(* l'instruction située à un point de contrôle (après) *) +(* l'instruction située à un point de contrôle (après) *) val get_pp_stmt : t_program_point -> t_stmt ;; (* CFG : control flow graph *) @@ -18,7 +18,7 @@ val get_cfg_prev : t_cfg -> t_stmt -> t_stmt list ;; type t_pdg ;; (* element composant le PDG *) type t_elem ;; -(* donne la liste des dépendances directes de l'élément dans le PDG *) +(* donne la liste des dépendances directes de l'élément dans le PDG *) val get_dpds : t_elem -> t_pdg -> t_elem list ;; val get_all_dpds : t_pdg -> t_elem -> t_elem list ;; val get_list_all_dpds : t_pdg -> t_elem list -> t_elem list ;; @@ -28,14 +28,14 @@ val merge : t_elem list -> t_elem list -> t_elem list ;; val get_pp_elems : t_pdg -> t_program_point -> t_elem list ;; -(* correspondance entre les instructions et les éléments du PDG *) +(* correspondance entre les instructions et les éléments du PDG *) type t_stmt_elems ;; -(* retrouver l'instruction correspondant à un élément *) +(* retrouver l'instruction correspondant à un élément *) val get_stmt : t_elem -> t_stmt_elems -> t_stmt ;; -(* retrouver les instructions correspondant aux éléments *) +(* retrouver les instructions correspondant aux éléments *) val get_stmts : t_elem list -> t_stmt_elems -> t_stmt list ;; -(* retrouver les éléments correspondant à une instruction *) +(* retrouver les éléments correspondant à une instruction *) val get_elems : t_stmt -> t_stmt_elems -> t_elem list ;; type t_state @@ -46,15 +46,15 @@ val get_state : t_program_point -> t_state ;; val get_defs_data : t_state -> t_data -> t_elem list ;; (* type des marques *) type t_mark ;; -(* la marque correspondant à mS : superflu. *) +(* la marque correspondant à mS : superflu. *) val spare_mark : t_mark ;; (* combinaison de deux marques *) val combine_mark : t_mark -> t_mark -> t_mark ;; (* type correspondant au marquage des instructions d'une fonction. *) type t_ff ;; -(* lire la marque associée à une instruction dans le marquage *) +(* lire la marque associée à une instruction dans le marquage *) val get_stmt_mark : t_stmt -> t_ff -> t_mark ;; -(* remplacer la marque associée à une instruction dans le marquage *) +(* remplacer la marque associée à une instruction dans le marquage *) val replace_stmt_mark : t_ff -> t_stmt -> t_mark -> t_ff ;; diff --git a/doc/pdg/sets.ml b/doc/pdg/sets.ml index a95fa5118d2282a8934f929733be0bdad4acee82..481ae5b867c3ad1ca3e68f8f02c99f733fe15ed3 100644 --- a/doc/pdg/sets.ml +++ b/doc/pdg/sets.ml @@ -1,4 +1,4 @@ -(* On nomme H le module des hypothèses. *) +(* On nomme H le module des hypothèses. *) module H = AlgoH ;; (* ensemble des points depuis lesquels [l] est atteignable. *) @@ -13,7 +13,7 @@ let set_0 cfg l = add_paths (H.get_cfg_prev cfg l) [] ;; -(* ensemble d'éléments qui conditionnent le passage en [l] *) +(* ensemble d'éléments qui conditionnent le passage en [l] *) let set_l0 pdg l = let elems = H.get_pp_elems pdg l in let ctrl = H.get_list_control_dpds pdg elems in @@ -21,32 +21,32 @@ let set_l0 pdg l = H.merge ctrl dpds ;; -(* ensemble d'éléments qui définissent la valeur de [v] en [l]. *) +(* ensemble d'éléments qui définissent la valeur de [v] en [l]. *) let set_dv0 pdg l v = let state = H.get_state l in H.get_defs_data state v ;; -(* ensemble d'éléments qui participent à la valeur de [v] en [l]. *) +(* ensemble d'éléments qui participent à la valeur de [v] en [l]. *) let set_v0 pdg l v = let dv0 = set_dv0 pdg l v in let dpds = H.get_list_all_dpds pdg dv0 in H.merge dv0 dpds ;; -(* ensemble des éléments correspondant à des points +(* ensemble des éléments correspondant à des points * depuis lesquels on peut atteindre [l], -* et tels que [v] n'est pas modifié entre ce point et [l]. *) +* et tels que [v] n'est pas modifié entre ce point et [l]. *) let set_p0 cfg pdg stmt_elems l v = let dv0 = set_dv0 pdg l v in let ctrl = H.get_list_all_control_dpds pdg dv0 in - (* les dépendances de contrôle des définitions - * doivent être considérées également comme définissant [v]. *) + (* les dépendances de contrôle des définitions + * doivent être considérées également comme définissant [v]. *) let defs = H.merge dv0 ctrl in let is_in set elem = List.exists (fun e -> e = elem) set in let rec elems_path stmts_to_explore elem_set = let explore_stmt set stmt = - (* on arrête si l'un des éléments définit [v] ou a déjà été vu *) + (* on arrête si l'un des éléments définit [v] ou a déjà été vu *) let rec stop elems = match elems with | [] -> false | e :: others -> (is_in defs e) || (is_in set e) diff --git a/doc/projects/OpenTC/opentc-implementation/pp.mll b/doc/projects/OpenTC/opentc-implementation/pp.mll index fde86a5e408bffc48b30d5bc250ab08fde64bf02..25ba43aec9bb3f01d11e9e839bf15a844013abe1 100644 --- a/doc/projects/OpenTC/opentc-implementation/pp.mll +++ b/doc/projects/OpenTC/opentc-implementation/pp.mll @@ -251,17 +251,17 @@ and pp = parse | "\\begin{c}" (c_files as s) "\n" { c_output s; begin_tt (); ctt lexbuf; end_tt (); close_c_output(); pp lexbuf } - | "é" { print_string "\\'e"; pp lexbuf } - | "è" { print_string "\\`e"; pp lexbuf } - | "à" { print_string "\\`a"; pp lexbuf } - | "â" { print_string "\\^a"; pp lexbuf } - | "ê" { print_string "\\^e"; pp lexbuf } - | "î" { print_string "\\^{\\i}"; pp lexbuf } - | "ï" { print_string "\\\"{\\i}"; pp lexbuf } - | "û" { print_string "\\^u"; pp lexbuf } - | "ù" { print_string "\\`u"; pp lexbuf } - | "ö" { print_string "\\\"o"; pp lexbuf } - | "ô" { print_string "\\^o"; pp lexbuf } + | "é" { print_string "\\'e"; pp lexbuf } + | "è" { print_string "\\`e"; pp lexbuf } + | "à " { print_string "\\`a"; pp lexbuf } + | "â" { print_string "\\^a"; pp lexbuf } + | "ê" { print_string "\\^e"; pp lexbuf } + | "î" { print_string "\\^{\\i}"; pp lexbuf } + | "ï" { print_string "\\\"{\\i}"; pp lexbuf } + | "û" { print_string "\\^u"; pp lexbuf } + | "ù" { print_string "\\`u"; pp lexbuf } + | "ö" { print_string "\\\"o"; pp lexbuf } + | "ô" { print_string "\\^o"; pp lexbuf } | eof { () } | _ diff --git a/doc/projects/cat/pp.mll b/doc/projects/cat/pp.mll index 5bf94ef415263e5b9229f08b28277c2ed02cdc71..4cec3921e7c9d230c81992a1b76d170e9fede200 100644 --- a/doc/projects/cat/pp.mll +++ b/doc/projects/cat/pp.mll @@ -281,17 +281,17 @@ and pp = parse { c_output s; begin_tt (); ctt lexbuf; end_tt (); close_c_output(); pp lexbuf } | "\\pp{" { begin_inline (); ctt lexbuf; end_inline(); pp lexbuf} - | "é" { print_string "\\'e"; pp lexbuf } - | "è" { print_string "\\`e"; pp lexbuf } - | "à" { print_string "\\`a"; pp lexbuf } - | "â" { print_string "\\^a"; pp lexbuf } - | "ê" { print_string "\\^e"; pp lexbuf } - | "î" { print_string "\\^{\\i}"; pp lexbuf } - | "ï" { print_string "\\\"{\\i}"; pp lexbuf } - | "û" { print_string "\\^u"; pp lexbuf } - | "ù" { print_string "\\`u"; pp lexbuf } - | "ö" { print_string "\\\"o"; pp lexbuf } - | "ô" { print_string "\\^o"; pp lexbuf } + | "é" { print_string "\\'e"; pp lexbuf } + | "è" { print_string "\\`e"; pp lexbuf } + | "à " { print_string "\\`a"; pp lexbuf } + | "â" { print_string "\\^a"; pp lexbuf } + | "ê" { print_string "\\^e"; pp lexbuf } + | "î" { print_string "\\^{\\i}"; pp lexbuf } + | "ï" { print_string "\\\"{\\i}"; pp lexbuf } + | "û" { print_string "\\^u"; pp lexbuf } + | "ù" { print_string "\\`u"; pp lexbuf } + | "ö" { print_string "\\\"o"; pp lexbuf } + | "ô" { print_string "\\^o"; pp lexbuf } | eof { () } | _ diff --git a/doc/release/branch.tex b/doc/release/branch.tex index 0d5391c728d9592084b91b3ab586f58ec3e3bddc..b169aaee6dfc953a72020834e19ec5fe853562d5 100644 --- a/doc/release/branch.tex +++ b/doc/release/branch.tex @@ -37,23 +37,25 @@ the Changelog. \begin{itemize} \item Add the following in the Changelog, in \texttt{stable/element} \begin{verbatim} - ###################################### - Open Source Release <next-release> - ###################################### + ############################# + Open Source Release <element> + ############################# \end{verbatim} -\item Merge this branch in \texttt{master} - -\item On top of the just-added header, add this (in \texttt{master}) - +This should go directly below \begin{verbatim} - ###################################### - Open Source Release <next-next-release> - ###################################### + ################################## + Open Source Release <next-release> + ################################## \end{verbatim} +\item Merge this branch in \texttt{master} \end{itemize} +From now on, Changelog items corresponding to MR merged into \texttt{master} +must be placed between these two banners. This should minimize conflicts when +merging back \texttt{stable/element} into \texttt{master} + \todo{Do the same thing in the manuals that contain a Changelog?} \todo{Can we simplify this?} diff --git a/doc/release/build.tex b/doc/release/build.tex index 4a9ec4436c39a13794d4800c4e115fb2e398794e..15ae6f1341b42af0d71b30effc3fa791de437a63 100644 --- a/doc/release/build.tex +++ b/doc/release/build.tex @@ -19,7 +19,8 @@ The procedure for creating the source distribution. \item Check the contents of \texttt{INSTALL} \todo{Should always be up to date} \item Check the contents of \texttt{README} \todo{Should always be up to date} - +\item Check the contents of \texttt{Changelog} + \todo{Should always be up to date} \item Check the list of distributed files in the Makefile, or by inspecting the contents of the \texttt{tar.gz}. \todo{What should be checked?} @@ -28,14 +29,19 @@ The procedure for creating the source distribution. \end{itemize} -\section{Update the Sources} +\section{Update the Sources}\label{sec:update-sources} There are many administrative steps, coordinated by the release manager. \begin{enumerate} +\item Ensure that you have a clone of \texttt{e-acsl} + (\texttt{git@git.frama-c.com:frama-c/e-acsl}) in the \texttt{src/plugins} + directory \item Set \texttt{VERSION} file. \item Update file \texttt{ALL\_VERSIONS}. \todo{Cannot be done with RC releases. Must be put somewhere else in the file} -\item Update file \texttt{Changelog}, as well as - \texttt{src/plugins/wp/Changelog}, to add the header corresponding to the +\item Update files + \texttt{src/plugins/wp/Changelog} and + \texttt{src/plugins/e-acsl/doc/Changelog}, + to add the header corresponding to the new version. % For the final release, use the script % \texttt{doc/changelog/generate} to check that the HTML page can be built, % and check its contents. @@ -130,8 +136,21 @@ make install The result is installed in doc/manuals/. +Finally, E-ACSL manuals must also be generated and installed: in both +directories \texttt{src/plugins/e-acsl/doc/refman}\footnote{If you followed +instructions from section~\ref{sec:update-sources}, you have already cloned +the E-ACSL repository under \texttt{src/plugins/e-acsl}. +Otherwise, it's time to do it} +and +\texttt{src/plugins/e-acsl/doc/userman}, do +\begin{shell} +make +make install +\end{shell} + + The script \texttt{doc/build-manuals.sh} performs this for all the current -manuals. +manuals (including E-ACSL). \begin{shell} ./doc/build-manuals.sh @@ -175,21 +194,28 @@ check consistency of API documentation. (the plug-in development guide (\texttt{make check-devguide}) doesn't work anymore)} \section{Build the Source Distribution} +\label{sec:build-source-distr} This steps creates the tarball of Frama-C, the tarball of the API and copy them to the website. It also copies the manuals. \expertise{release manager} Use the script \texttt{build-src-distrib.sh} for this purpose (\texttt{bash version - 4} required) after cloning the repository -\texttt{website} (\texttt{git@git.frama-c.com:frama-c/website}) in -the root directory of Frama-C. You can create a specific branch in this -repository in order to later do the merge request. - -If you have problem with UTF-8 encoded filenames: -\begin{shell} -export LC_TYPE=en_US.UTF-8 -\end{shell} + 4} required) after cloning the following repositories +\begin{itemize} +\item \texttt{Frama-C-snapshot} (\texttt{git@github.com:Frama-C/Frama-C-snapshot}), +\item \texttt{Frama-C-snapshot.wiki} (\texttt{git@github.com:Frama-C/Frama-C-snapshot.wiki}), and +\item \texttt{website} (\texttt{git@git.frama-c.com:frama-c/website}) +\end{itemize} +in the root directory of Frama-C. The last one is only needed when creating a +final release. Release candidates are only put on github and require only +\texttt{Frama-C-snapshot} and its associated wiki. Branch on +\texttt{Frama-C-snapshot} should be \texttt{master} for a final release and +\texttt{release-candidates} for a release candidate. For \texttt{website}, +a new branch should be created over \texttt{online}. + +Finally, ensure that locale \verb+en_US.UTF-8+ is available on your system, +as it is used by the script to ensure a proper encoding of the generated files. Now, run the script: \begin{shell} diff --git a/doc/release/checktar.sh b/doc/release/checktar.sh index 293bcaedd6d366ccfd18fb04b810fcaea7232cd4..de6afe995a35fc69459e6cff6ed2ef1757c799d9 100755 --- a/doc/release/checktar.sh +++ b/doc/release/checktar.sh @@ -8,7 +8,6 @@ find . -name '*nonfree*' -o -name '*non_free*' -o -name '*non-free*' PLUGINS=( genassigns studia mthread volatile acsl-importer caveat-translator e-acsl cfp security pathcrawler a3export) echo -e "\n## Normal hits:" -echo "./share/libc/__fc_builtin_for_normalization.i" echo "tests/non-free (but empty)" echo -e "\n" diff --git a/doc/release/website.tex b/doc/release/website.tex index 3f6e75d34dc213882b7ccec83aa61d521029f34d..6d5151bc9aa5d74cd55c8586a0e0ab49c112fe88 100644 --- a/doc/release/website.tex +++ b/doc/release/website.tex @@ -135,18 +135,15 @@ You'll need a GitHub account to create a pull request. \section{Updating Frama-C-snapshot} You'll need a GitHub account with commit rights to Frama-C/Frama-C-snapshot. +The release script \texttt{bin/build-src-distrib.sh} has prepared both the +repository and the associated wiki (see section~\ref{sec:build-source-distr}). \begin{itemize} -\item Clone \texttt{Frama-C-snapshot}: \texttt{git clone https://github.com/Frama-C/Frama-C-snapshot.git} -\item Make sure you are on \texttt{master} and your branch is up-to-date -\item Erase all files to ensure a clean update - \begin{itemize} - \item Do not forget hidden files, but do not erase \texttt{.git} - \end{itemize} -\item Extract the release .tar.gz, move everything from the subdirectory - to its parent, then remove the .tar.gz itself -\item Update everything (\texttt{git add -A}) -\item Push the new commit +\item ensure that the sources in \texttt{Frama-C-snapshot} compile (\texttt{./configure --prefix=/tmp/frama-c \&\& make \&\& make install} must work). +\item commit and push the changes +\item in \texttt{Frama-C-snapshot.wiki}, update the new +\texttt{Frama-C-VERSION.md} page with the list of main changes. +\item Add your changes, commit and push \end{itemize} \section{Updating the BTS} @@ -174,3 +171,8 @@ resolved in the next release. Just update the \texttt{VERSION} file in \texttt{trunk}, by adding \texttt{"+dev"}. Do not add any newline at the end of the \texttt{VERSION} file. + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "release" +%%% End: diff --git a/doc/slicing/algo.ml b/doc/slicing/algo.ml index 36fb1f257f9977ac6cc5eb83c501108da8f820d4..ae0c3a85c510dab5a416252826d38ed41a8bea11 100644 --- a/doc/slicing/algo.ml +++ b/doc/slicing/algo.ml @@ -1,14 +1,14 @@ -(* On nomme H le module des hypothèses. *) +(* On nomme H le module des hypothèses. *) module H = AlgoH ;; -(* produit une nouvelle fonction spécialisée en partant de [ff] en marquant l'élément [e] et toutes ses dépendances avec la marque [m]. *) +(* produit une nouvelle fonction spécialisée en partant de [ff] en marquant l'élément [e] et toutes ses dépendances avec la marque [m]. *) let rec mark_rec_pdg_elem pdg stmt_elems m e ff = let new_ff = add_elem_mark pdg stmt_elems m e ff in let dpds = H.get_dpds e pdg in List.fold_right (mark_rec_pdg_elem pdg stmt_elems m) dpds new_ff (* ;; *) and -(* [add_elem_mark] ajoute la marque [m] à l'instruction correspondant à l'élément [e] et marque les autres éléments éventuels comme superflus. *) +(* [add_elem_mark] ajoute la marque [m] à l'instruction correspondant à l'élément [e] et marque les autres éléments éventuels comme superflus. *) add_elem_mark pdg stmt_elems m e ff = let stmt = H.get_stmt e stmt_elems in let old_m = H.get_stmt_mark stmt ff in diff --git a/doc/slicing/algoH.mli b/doc/slicing/algoH.mli index 25260c2dd6144595aa7b2645e75b27304e32e435..432872ba999a4cfbc1fb1479fbedbef2254c9111 100644 --- a/doc/slicing/algoH.mli +++ b/doc/slicing/algoH.mli @@ -4,7 +4,7 @@ type t_program_point ;; (* Instruction *) type t_stmt ;; -(* l'instruction située à un point de contrôle (après) *) +(* l'instruction située à un point de contrôle (après) *) val get_pp_stmt : t_program_point -> t_stmt ;; (* CFG : control flow graph *) @@ -18,7 +18,7 @@ val get_cfg_prev : t_cfg -> t_stmt -> t_stmt list ;; type t_pdg ;; (* element composant le PDG *) type t_elem ;; -(* donne la liste des dépendances directes de l'élément dans le PDG *) +(* donne la liste des dépendances directes de l'élément dans le PDG *) val get_dpds : t_elem -> t_pdg -> t_elem list ;; val get_all_dpds : t_pdg -> t_elem -> t_elem list ;; val get_list_all_dpds : t_pdg -> t_elem list -> t_elem list ;; @@ -28,14 +28,14 @@ val merge : t_elem list -> t_elem list -> t_elem list ;; val get_pp_elems : t_pdg -> t_program_point -> t_elem list ;; -(* correspondance entre les instructions et les éléments du PDG *) +(* correspondance entre les instructions et les éléments du PDG *) type t_stmt_elems ;; -(* retrouver l'instruction correspondant à un élément *) +(* retrouver l'instruction correspondant à un élément *) val get_stmt : t_elem -> t_stmt_elems -> t_stmt ;; -(* retrouver les instructions correspondant aux éléments *) +(* retrouver les instructions correspondant aux éléments *) val get_stmts : t_elem list -> t_stmt_elems -> t_stmt list ;; -(* retrouver les éléments correspondant à une instruction *) +(* retrouver les éléments correspondant à une instruction *) val get_elems : t_stmt -> t_stmt_elems -> t_elem list ;; type t_state @@ -46,15 +46,15 @@ val get_state : t_program_point -> t_state ;; val get_defs_data : t_state -> t_data -> t_elem list ;; (* type des marques *) type t_mark ;; -(* la marque correspondant à mS : superflu. *) +(* la marque correspondant à mS : superflu. *) val spare_mark : t_mark ;; (* combinaison de deux marques *) val combine_mark : t_mark -> t_mark -> t_mark ;; (* type correspondant au marquage des instructions d'une fonction. *) type t_ff ;; -(* lire la marque associée à une instruction dans le marquage *) +(* lire la marque associée à une instruction dans le marquage *) val get_stmt_mark : t_stmt -> t_ff -> t_mark ;; -(* remplacer la marque associée à une instruction dans le marquage *) +(* remplacer la marque associée à une instruction dans le marquage *) val replace_stmt_mark : t_ff -> t_stmt -> t_mark -> t_ff ;; diff --git a/doc/training/CoqSummerSchool/pp.mll b/doc/training/CoqSummerSchool/pp.mll index 4b611d6652398d689ec5e8d8f4e4b29af9e71272..6100b22011a36c73fb995e22696c5c6c13df08e5 100644 --- a/doc/training/CoqSummerSchool/pp.mll +++ b/doc/training/CoqSummerSchool/pp.mll @@ -352,17 +352,17 @@ and pp = parse { c_output s; begin_tt (); ctt is_why_keyword lexbuf; end_tt (); close_c_output(); pp lexbuf } | "\\pp{" { begin_inline (); ctt is_c_keyword lexbuf; end_inline(); pp lexbuf} - | "é" { print_string "\\'e"; pp lexbuf } - | "è" { print_string "\\`e"; pp lexbuf } - | "à" { print_string "\\`a"; pp lexbuf } - | "â" { print_string "\\^a"; pp lexbuf } - | "ê" { print_string "\\^e"; pp lexbuf } - | "î" { print_string "\\^{\\i}"; pp lexbuf } - | "ï" { print_string "\\\"{\\i}"; pp lexbuf } - | "û" { print_string "\\^u"; pp lexbuf } - | "ù" { print_string "\\`u"; pp lexbuf } - | "ö" { print_string "\\\"o"; pp lexbuf } - | "ô" { print_string "\\^o"; pp lexbuf } + | "é" { print_string "\\'e"; pp lexbuf } + | "è" { print_string "\\`e"; pp lexbuf } + | "à " { print_string "\\`a"; pp lexbuf } + | "â" { print_string "\\^a"; pp lexbuf } + | "ê" { print_string "\\^e"; pp lexbuf } + | "î" { print_string "\\^{\\i}"; pp lexbuf } + | "ï" { print_string "\\\"{\\i}"; pp lexbuf } + | "û" { print_string "\\^u"; pp lexbuf } + | "ù" { print_string "\\`u"; pp lexbuf } + | "ö" { print_string "\\\"o"; pp lexbuf } + | "ô" { print_string "\\^o"; pp lexbuf } | eof { () } | _ diff --git a/doc/training/developer/sources/const_violation.ml b/doc/training/developer/sources/const_violation.ml index ac185468ff0fafdae147cfd1e8a3cb1f971983b0..e057b7fbf7701f7492ff6aebc14db153cfec0c57 100644 --- a/doc/training/developer/sources/const_violation.ml +++ b/doc/training/developer/sources/const_violation.ml @@ -8,13 +8,8 @@ let run () = let init_state = Db.Value.get_stmt_state init_stmt in let end_stmt = Kernel_function.find_return main in let end_state = Db.Value.get_stmt_state end_stmt in - let with_alarms = CilE.warn_none_mode in - let init_binding = - !Db.Value.eval_expr ~with_alarms init_state glob_expr - in - let end_binding = - !Db.Value.eval_expr ~with_alarms end_state glob_expr - in + let init_binding = !Db.Value.eval_expr init_state glob_expr in + let end_binding = !Db.Value.eval_expr end_state glob_expr in let init_val = Cvalue.V.project_ival init_binding in let end_val = Cvalue.V.project_ival end_binding in if Ival.is_singleton_int init_val && Ival.is_singleton_int end_val then begin diff --git a/doc/training/jessie/pp.mll b/doc/training/jessie/pp.mll index 5bf94ef415263e5b9229f08b28277c2ed02cdc71..4cec3921e7c9d230c81992a1b76d170e9fede200 100644 --- a/doc/training/jessie/pp.mll +++ b/doc/training/jessie/pp.mll @@ -281,17 +281,17 @@ and pp = parse { c_output s; begin_tt (); ctt lexbuf; end_tt (); close_c_output(); pp lexbuf } | "\\pp{" { begin_inline (); ctt lexbuf; end_inline(); pp lexbuf} - | "é" { print_string "\\'e"; pp lexbuf } - | "è" { print_string "\\`e"; pp lexbuf } - | "à" { print_string "\\`a"; pp lexbuf } - | "â" { print_string "\\^a"; pp lexbuf } - | "ê" { print_string "\\^e"; pp lexbuf } - | "î" { print_string "\\^{\\i}"; pp lexbuf } - | "ï" { print_string "\\\"{\\i}"; pp lexbuf } - | "û" { print_string "\\^u"; pp lexbuf } - | "ù" { print_string "\\`u"; pp lexbuf } - | "ö" { print_string "\\\"o"; pp lexbuf } - | "ô" { print_string "\\^o"; pp lexbuf } + | "é" { print_string "\\'e"; pp lexbuf } + | "è" { print_string "\\`e"; pp lexbuf } + | "à " { print_string "\\`a"; pp lexbuf } + | "â" { print_string "\\^a"; pp lexbuf } + | "ê" { print_string "\\^e"; pp lexbuf } + | "î" { print_string "\\^{\\i}"; pp lexbuf } + | "ï" { print_string "\\\"{\\i}"; pp lexbuf } + | "û" { print_string "\\^u"; pp lexbuf } + | "ù" { print_string "\\`u"; pp lexbuf } + | "ö" { print_string "\\\"o"; pp lexbuf } + | "ô" { print_string "\\^o"; pp lexbuf } | eof { () } | _ diff --git a/doc/training/semantic_browsing/main.tex b/doc/training/semantic_browsing/main.tex index addd71026d09bbae910c482ee17fff3d60d28523..9b66f58c4f4a963724e24a04422ea8c862cadb44 100644 --- a/doc/training/semantic_browsing/main.tex +++ b/doc/training/semantic_browsing/main.tex @@ -933,7 +933,7 @@ \begin{howtouse} \item \code{-sparecode-analysis} removes statements and functions that are not useful to compute the result of the program -\item \code{-rm-unused-globals} removes unused types and global variables +\item \code{-sparecode-rm-unused-globals} removes unused types and global variables \item \code{-sparecode-no-annot} may remove some useless code even if it changes the validity of some ACSL properties \end{howtouse} diff --git a/doc/userman/Makefile.config b/doc/userman/Makefile.config index 6976426ca9c735a666f702773bf87cab8363c779..b1c187535803f92702c052d5b49f58f212ccfeca 100644 --- a/doc/userman/Makefile.config +++ b/doc/userman/Makefile.config @@ -1,5 +1,3 @@ MAKECONFIG_DIR=../../share include ../../share/Makefile.common -FIG2PDF =fig2pdf --nogv -MLPOST = mlpost # mlpost is available at http://mlpost.lri.fr FRAMAC_VERSION=$(shell $(SED) -e 's/\\(.*\\)/\\1/' ../../VERSION) diff --git a/doc/userman/user-changes.tex b/doc/userman/user-changes.tex index e4ed69c9b4ae8afa4828a196dc7f8cac82f5032a..d040fe0ce78252ba0c177a5de810f4370c393ed0 100644 --- a/doc/userman/user-changes.tex +++ b/doc/userman/user-changes.tex @@ -5,6 +5,15 @@ release. First we list changes of the last release. \section*{\nextframacversion} +\section*{\framacversion} + +\begin{itemize} +\item \textbf{Preparing the Sources:} removed option + \texttt{-force-rl-arg-eval}. +\end{itemize} + +\section*{Phosphorus-20170501} + \begin{itemize} \item \textbf{Getting Started:} \tool{Zarith} package is now mandatory. \item \textbf{Setting Up Plug-ins:} added option \texttt{-autoload-plugins}. @@ -14,8 +23,6 @@ release. First we list changes of the last release. \item \textbf{Getting Started:} added option \texttt{-print-libc}. \end{itemize} -\section*{\framacversion} - \section*{Silicon-20161101} \begin{itemize} diff --git a/doc/userman/user-plugins.tex b/doc/userman/user-plugins.tex index 036b3a47f7099cd722715168ebb879db328d0386..e84d9e1021d955f8297e3df4d278b0cd8430f07a 100644 --- a/doc/userman/user-plugins.tex +++ b/doc/userman/user-plugins.tex @@ -24,8 +24,7 @@ Sections~\ref{sec:install-internal} and~\ref{sec:install-external}). dynamic}:]\index{Plug-in!Static|bfit}\index{Plug-in!Dynamic|bfit} static plug-ins are statically linked into a \FramaC executable (see Section~\ref{sec:modes}) while dynamic plug-ins are loaded by an executable - when it is run. Despite only being available on some environments (see - Section~\ref{sec:install}), dynamic plug-ins are more flexible as explained + when it is run. Dynamic plug-ins are more flexible as explained in Section~\ref{sec:use-plugins}. \end{description} @@ -46,8 +45,7 @@ entire \FramaC configuration to fail. You can also use the option Internal dynamic plug-ins may be linked statically. This is achieved by passing {\tt configure} the option \texttt{-{}-with-<plug-in name>-static}. It is also possible to force all dynamic plug-ins to be linked statically with the option -\optiondef{-{}-}{with-all-static}. This option is set by default on systems -that do not support native dynamic loading. +\optiondef{-{}-}{with-all-static}. \section{Installing External Plug-ins}\label{sec:install-external} \index{Plug-in!External} @@ -65,15 +63,7 @@ sequence of commands \texttt{make \&\& make install}, possibly preceded by plug-in's documentation for installation instructions. External plug-ins are always dynamic plug-ins\index{Plug-in!Dynamic} by -default. On systems where native dynamic linking is not supported, a new -executable, called \texttt{frama-c-<plug-in name>}\footnote{With the extension - \texttt{.exe} on Windows OS}, is automatically generated when an external -plug-in is compiled. This executable contains the \FramaC kernel, all the -static plug-ins\index{Plug-in!Static} previously installed and the external -plug-in. On systems where native dynamic linking is available, this executable -is not necessary for normal use. -% but it may be generated with the command \texttt{make static}. - +default. External dynamic plug-ins may be configured and compiled at the same time as the \FramaC kernel by using the option \texttt{-{}-enable-external=<path-to-plugin>} diff --git a/doc/userman/user-sources.tex b/doc/userman/user-sources.tex index 8c17e5a628bd23ca9dfc22b262e2f3fe38c8621c..5f8856172fca9e0898a148b7bee502d9affd1fa3 100644 --- a/doc/userman/user-sources.tex +++ b/doc/userman/user-sources.tex @@ -195,10 +195,6 @@ a negative value, and choose the smallest rank possible starting from \texttt{char} (\gcc's \texttt{-fshortenums} option) \end{itemize} -\item \optiondef{-}{force-rl-arg-eval} forces right to left evaluation - order of function arguments. The C standard does not enforce any - evaluation order, and the default is thus to leave it unspecified. - \item \optiondef{-}{initialized-padding-locals} forces to initialize padding bits of locals to 0. If false, padding bits are left uninitialized. This option is set by default. diff --git a/doc/userman/user-start.tex b/doc/userman/user-start.tex index dde8a043c8fafaf55a94261271fc7ac0a2409c13..ea67dda29a73d7892daf71e03a1896e514535abf 100644 --- a/doc/userman/user-start.tex +++ b/doc/userman/user-start.tex @@ -45,8 +45,7 @@ may be found in the file \texttt{INSTALL} of the source distribution. Support for some plug-ins in native compilation mode (see Section~\ref{sec:modes})\index{Native-compiled} requires the so-called - \emph{native dynamic linking} feature of \caml. It is not available in all - supported platforms. + \emph{native dynamic linking} feature of \caml. \item[\tool{Gtk}-related packages:]\codeidx{GTK+}\codeidx{Lablgtk}\codeidx{GtkSourceView} \tool{\sc gtk+}\footnote{\url{http://www.gtk.org}} version 2.4 or higher, diff --git a/doc/userman/userman.tex b/doc/userman/userman.tex index 39e7d7e9b9f64fbf0e1a0411cac35039503c5901..c3d5170572e192d917c671feb0451ca999559022 100644 --- a/doc/userman/userman.tex +++ b/doc/userman/userman.tex @@ -26,7 +26,7 @@ CEA LIST, Software Safety Laboratory, Saclay, F-91191 \\ \end{tabular} \vfill \begin{flushleft} - \textcopyright 2009-2016 CEA LIST + \textcopyright 2009-2017 CEA LIST This work has been supported by the ANR project CAT (ANR-05-RNTL-00301) and by the ANR project U3CAT (08-SEGI-021-01). diff --git a/doc/value/biblio.bib b/doc/value/biblio.bib new file mode 100644 index 0000000000000000000000000000000000000000..719fde82a6218e784a3f9e262b9c611fcbc079f8 --- /dev/null +++ b/doc/value/biblio.bib @@ -0,0 +1,67 @@ +@inproceedings{DBLP:conf/cav/Venet12, + author = {Arnaud Venet}, + title = {The Gauge Domain: Scalable Analysis of Linear Inequality Invariants}, + booktitle = {Computer Aided Verification - 24th International Conference, {CAV} + 2012, Berkeley, CA, USA, July 7-13, 2012 Proceedings}, + pages = {139--154}, + year = {2012}, + crossref = {DBLP:conf/cav/2012}, + url = {http://dx.doi.org/10.1007/978-3-642-31424-7_15}, + doi = {10.1007/978-3-642-31424-7_15}, + timestamp = {Tue, 03 Jul 2012 08:52:37 +0200}, + biburl = {http://dblp.uni-trier.de/rec/bib/conf/cav/Venet12}, + bibsource = {dblp computer science bibliography, http://dblp.org} +} + +@proceedings{DBLP:conf/cav/2012, + editor = {P. Madhusudan and + Sanjit A. Seshia}, + title = {Computer Aided Verification - 24th International Conference, {CAV} + 2012, Berkeley, CA, USA, July 7-13, 2012 Proceedings}, + series = {Lecture Notes in Computer Science}, + volume = {7358}, + publisher = {Springer}, + year = {2012}, + url = {http://dx.doi.org/10.1007/978-3-642-31424-7}, + doi = {10.1007/978-3-642-31424-7}, + isbn = {978-3-642-31423-0}, + timestamp = {Tue, 03 Jul 2012 08:38:09 +0200}, + biburl = {http://dblp.uni-trier.de/rec/bib/conf/cav/2012}, + bibsource = {dblp computer science bibliography, http://dblp.org} +} + + + +@inproceedings{DBLP:conf/cav/JeannetM09, + author = {Bertrand Jeannet and + Antoine Min{\'{e}}}, + title = {Apron: {A} Library of Numerical Abstract Domains for Static Analysis}, + booktitle = {Computer Aided Verification, 21st International Conference, {CAV} + 2009, Grenoble, France, June 26 - July 2, 2009. Proceedings}, + pages = {661--667}, + year = {2009}, + crossref = {DBLP:conf/cav/2009}, + url = {http://dx.doi.org/10.1007/978-3-642-02658-4_52}, + doi = {10.1007/978-3-642-02658-4_52}, + timestamp = {Thu, 25 Jun 2009 12:22:34 +0200}, + biburl = {http://dblp.uni-trier.de/rec/bib/conf/cav/JeannetM09}, + bibsource = {dblp computer science bibliography, http://dblp.org} +} + +@proceedings{DBLP:conf/cav/2009, + editor = {Ahmed Bouajjani and + Oded Maler}, + title = {Computer Aided Verification, 21st International Conference, {CAV} + 2009, Grenoble, France, June 26 - July 2, 2009. Proceedings}, + series = {Lecture Notes in Computer Science}, + volume = {5643}, + publisher = {Springer}, + year = {2009}, + url = {http://dx.doi.org/10.1007/978-3-642-02658-4}, + doi = {10.1007/978-3-642-02658-4}, + isbn = {978-3-642-02657-7}, + timestamp = {Thu, 25 Jun 2009 12:21:10 +0200}, + biburl = {http://dblp.uni-trier.de/rec/bib/conf/cav/2009}, + bibsource = {dblp computer science bibliography, http://dblp.org} +} + diff --git a/doc/value/eva/function-call.pdf b/doc/value/eva/function-call.pdf index a616c7f57cabe98c6366282fd8f6a97182c8cf0e..e143247e876fecf20a60d0908ab6cd928e0955b6 100644 Binary files a/doc/value/eva/function-call.pdf and b/doc/value/eva/function-call.pdf differ diff --git a/doc/value/eva/function-call.tex b/doc/value/eva/function-call.tex index fbbd570fc254fc8c13c086a9ff6abc698e97b193..202c3e56674e5a6ff4d3e9da5f791198d5b0f78b 100644 --- a/doc/value/eva/function-call.tex +++ b/doc/value/eva/function-call.tex @@ -5,6 +5,7 @@ \usepackage[latin9]{inputenc} \usepackage{color} \usepackage{babel} +\usepackage[a4paper]{geometry} \usepackage[unicode=true,pdfusetitle, bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] @@ -39,16 +40,34 @@ frameround=ftff} \begin{document} -\section*{Interpretation of a Function Call within EVA} +\newgeometry{left=2cm,right=2cm} \begin{figure} \begin{centering} -\input{tikz_call.tex} +\resizebox{\textwidth}{!}{\input{tikz_call.tex}} \par\end{centering} +\vspace{1cm} \caption{Interpretation of the call\label{fig:call-interpretation}} \end{figure} +\restoregeometry + +\begin{lstlisting}[caption={Call to a function $f$},language=C,float,numbers=left,stepnumber=5] +int f (args) { + [...] + return return_expr; +} + +int main () { + ... + v = f (exprs); + ... +} + +\end{lstlisting} +\section*{Interpretation of a Function Call within EVA} + \subsubsection*{Step by Step} Figure~\ref{fig:call-interpretation} outlines each stage of the @@ -90,19 +109,6 @@ $f$. of the value of $\mathit{RET}$. \item The special variable $\mathit{RET}$ leaves the scope. \end{enumerate} -% -\begin{lstlisting}[caption={Call to a function $f$},language=C,float,numbers=left,stepnumber=5] -int f (args) { - [...] - return return_expr; -} -int main () { - ... - v = f (exprs); - ... -} - -\end{lstlisting} \end{document} diff --git a/doc/value/eva/tikz_call.tex b/doc/value/eva/tikz_call.tex index 799cc04c1ef468df9856c0eb1d108b7bd56bafce..0f228ed04951328566c2838a23b492492f6140c9 100644 --- a/doc/value/eva/tikz_call.tex +++ b/doc/value/eva/tikz_call.tex @@ -1,7 +1,8 @@ -\def\d{0.6} +\def\d{0.6} % vertical distance between nodes. +\def\g{2.25} % horizontal gap between the two functions. -\begin{tikzpicture} +\begin{tikzpicture}[] \tikzstyle{state}=[circle, align=center,draw,very thin, inner sep = 0.5mm] \tikzstyle{edge}=[->,>=latex, thin] @@ -9,20 +10,24 @@ \tikzstyle{legend}=[align=left, anchor=west,font=\small] \tikzstyle{dataflow}=[color=purple] \tikzstyle{stmt}=[color=teal] -\tikzstyle{hl}=[color=magenta] +\tikzstyle{dom}=[color=magenta] +\tikzstyle{computefun}=[color=orange] \coordinate (Init) at (-1,0); +\node[point] (Caller) at ($ (Init) + (0, 2.5 * \d) $ ) {caller}; +\node[point] (Called) at ($ (Init) + (\g, 2.5 * \d) $ ) {called}; + \node[state] (S00) at (Init) {.}; \node[state] (S0) at ($ (S00) - (0, 2 * \d) $) {.}; -\node[state] (S1) at ($ (S0) + (1.5, - 2 * \d) $) {.}; +\node[state] (S1) at ($ (S0) + (\g, - 2 * \d) $) {.}; \node[state] (S11) at ($ (S1) - (0, 2 * \d) $) {.}; \node[state] (S20) at ($ (S11) - (0, 4 * \d) $) {.}; \node[state] (S2) at ($ (S20) - (0, 2 * \d) $) {.}; \node[state] (S30) at ($ (S2) - (0, 2 * \d) $) {.}; \node[state] (S3) at ($ (S30) - (0, 2 * \d) $) {.}; \node[state] (S4) at ($ (S3) - (0, 2 * \d) $) {.}; -\node[state] (S50) at ($ (S4) - (1.5, 2 * \d) $) {.}; +\node[state] (S50) at ($ (S4) - (\g, 2 * \d) $) {.}; \node[state] (S5) at ($ (S50) - (0, 2 * \d) $) {.}; \node[state] (S6) at ($ (S5) - (0, 2 * \d) $) {.}; \node[state] (S7) at ($ (S6) - (0, 2 * \d) $) {.}; @@ -57,14 +62,14 @@ {State after the call site}; \node[legend] (L00) at ($ (S00) + (2.5, -\d)$) {1. evaluation of the arguments $\mathit{exprs}$}; -\node[legend, hl] (L0) at ($ (S0) + (2.5, -\d)$) {2. $\mathtt{start\_call}(S_0) = \mathrm{Compute}(S_1)$}; +\node[legend, dom] (L0) at ($ (S0) + (2.5, -\d)$) {2. $\mathtt{start\_call}(S_0) = \mathrm{Compute}(S_1)$}; \node[legend] (L1) at ($ (S1) + (1,- \d)$) {3. $\mathtt{enter\_scope}(f_{locals})$}; \node[legend] (L11) at ($ (S11) + (1, -2 * \d)$) {4. analysis of f}; \node[legend] (L20) at ($ (S20) + (1, -\d)$) {5. $\mathtt{enter\_scope}(RET)$}; \node[legend] (L2) at ($ (S2) + (1, -\d)$) {6. $\mathit{RET} = \mathit{return\_expr} ;$}; \node[legend] (L30) at ($ (S30) + (1, -\d)$) {7. evaluation of the formal arguments $\mathit{args}$}; \node[legend] (L3) at ($ (S3) + (1, -\d)$) {8. $\mathtt{leave\_scope}(f_{\mathit{formals}} \cup f_{\mathit{locals}})$}; -\node[legend, hl] (L4) at ($ (S4) + (1, -\d)$) {9. $\mathtt{finalize\_call}(S_0,S_n)$}; +\node[legend, dom] (L4) at ($ (S4) + (1, -\d)$) {9. $\mathtt{finalize\_call}(S_0,S_n)$}; \node[legend] (L50) at ($ (S50) + (2.5, -\d)$) {10. reduction of the concrete arguments,\\ assuming $\mathit{exprs} = \mathit{args}$ at the end of $f$}; \node[legend] (L5) at ($ (S5) + (2.5, -\d)$) {11. $v = \mathit{RET} ;$}; \node[legend] (L6) at ($ (S6) + (2.5, -\d)$) {12. $\mathtt{leave\_scope}(RET)$}; @@ -73,13 +78,29 @@ \draw[edge] (S0) to[bend right = 80] -node[legend, hl, midway, anchor=east] +node[legend, dom, midway, anchor=east] {$\mathtt{start\_call}(S_0) = \mathrm{Result}(S_n)$ \\ $\mathtt{approximate\_call}(S_0) = S_n$} (S4); -\draw[edge] (S1) to[bend right = 26] -node[legend, midway, sloped, anchor=north]{$\mathtt{memexec}$} -(S30); +\draw[edge, computefun] (S1) to[bend right = 26] +node[legend, midway, sloped, anchor=north]{ +$ \begin{array}{c} +\color{black} \mathtt{mem\_exec} \\ +\color{magenta} \mathtt{compute\_using\_spec} +\end{array} $} (S30); + +% Legend + +\coordinate (N1) at ($ (Init) - (8, 0) $); +\coordinate (N2) at ($ (N1) - (0, 1 * \d) $); +\coordinate (N3) at ($ (N2) - (0, 0.5 * \d) $); +\coordinate (N4) at ($ (N3) - (0, 1 * \d) $); +\coordinate (N5) at ($ (N4) - (0, 0.5 * \d) $); +\coordinate (N6) at ($ (N5) - (0, 1 * \d) $); + +\draw[edge, stmt] (N1) -- node[legend,point]{in transfer\_stmt} (N2); +\draw[edge, dataflow] (N3) -- node[legend,point]{in partitioned\_dataflow} (N4); +\draw[edge, computefun] (N5) -- node[legend,point]{in compute\_function} (N6); \end{tikzpicture} diff --git a/doc/value/examples/parametrizing/context-depth.1.log b/doc/value/examples/parametrizing/context-depth.1.log index 0c70deb2016e564a7c25d86ce7c2ee48a44018a5..9e6e7392399b0f3582264593baedaa2546956e1e 100644 --- a/doc/value/examples/parametrizing/context-depth.1.log +++ b/doc/value/examples/parametrizing/context-depth.1.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing context-depth.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/context-depth.2.log b/doc/value/examples/parametrizing/context-depth.2.log index 459b27f75ec198d4a0fe55d0a9ab82f1e523feb8..e07139ddb890ddab5e0b4374424afb9065caf6b5 100644 --- a/doc/value/examples/parametrizing/context-depth.2.log +++ b/doc/value/examples/parametrizing/context-depth.2.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing context-depth.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/context-depth.3.log b/doc/value/examples/parametrizing/context-depth.3.log index b1f2e0315d5665dccee537e026fb5654414c8ce3..42accb342e6f5ef03146b5c0be69c011d95b87b4 100644 --- a/doc/value/examples/parametrizing/context-depth.3.log +++ b/doc/value/examples/parametrizing/context-depth.3.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing context-depth.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/context-width.log b/doc/value/examples/parametrizing/context-width.log index 83b63d561b1cfd4e6d14645b66f02b4b75e94da8..10cbdc4a728b83db06d3afebada8d0bcc58be329 100644 --- a/doc/value/examples/parametrizing/context-width.log +++ b/doc/value/examples/parametrizing/context-width.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing context-width.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/global-initial-values.log b/doc/value/examples/parametrizing/global-initial-values.log index 13bb06a483a26e9c0905ec2989a340ad677ebb27..d2adc0cb4371927ddafaf69e2482f772f9a91664 100644 --- a/doc/value/examples/parametrizing/global-initial-values.log +++ b/doc/value/examples/parametrizing/global-initial-values.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing global-initial-values.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/ilevel.1.log b/doc/value/examples/parametrizing/ilevel.1.log index f7f4545dd0f32ae794b6281fd4eaf09a755476ba..22fb68c066d64df8ce7d4527797edf3489ee9204 100644 --- a/doc/value/examples/parametrizing/ilevel.1.log +++ b/doc/value/examples/parametrizing/ilevel.1.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing ilevel.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/ilevel.2.log b/doc/value/examples/parametrizing/ilevel.2.log index 54960b8be3ac53d54394e6af3a0e9eebd1f467da..602d5fbffe8bf7f083dd918bf406082be0945f68 100644 --- a/doc/value/examples/parametrizing/ilevel.2.log +++ b/doc/value/examples/parametrizing/ilevel.2.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing ilevel.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/nor.1.log b/doc/value/examples/parametrizing/nor.1.log index 522ffd4c0cb0b917f6f2c35e9860b93a6f27512c..d5c74d7bee81da0cb01468630c74817905ceb060 100644 --- a/doc/value/examples/parametrizing/nor.1.log +++ b/doc/value/examples/parametrizing/nor.1.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing nor.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/nor.2.log b/doc/value/examples/parametrizing/nor.2.log index 5bf74f5a93f89543cc5821b2cfced916502d9177..ed27ea556f97efb04f0887466f9c788d5a21311e 100644 --- a/doc/value/examples/parametrizing/nor.2.log +++ b/doc/value/examples/parametrizing/nor.2.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing nor.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/out-of-bound.log b/doc/value/examples/parametrizing/out-of-bound.log index 77876ef78b9e5ea1779f6db19336c4d054cdc17c..c1f36ff5958f923dab86e05cb70ae85c29acb50e 100644 --- a/doc/value/examples/parametrizing/out-of-bound.log +++ b/doc/value/examples/parametrizing/out-of-bound.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing out-of-bound.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/simple-main.log b/doc/value/examples/parametrizing/simple-main.log index aaf52031e6fb6f6706229ad8e194924bafaf842e..5b648abf0e905c6fddd6f8f38bed8fd7e3abb85e 100644 --- a/doc/value/examples/parametrizing/simple-main.log +++ b/doc/value/examples/parametrizing/simple-main.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing simple-main.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/slevel.1.log b/doc/value/examples/parametrizing/slevel.1.log index 36d75c3c8edc3416b5c9843b98cb16d95b3bee25..bfdcbf380ad646a6d887eda0154556262ee834f4 100644 --- a/doc/value/examples/parametrizing/slevel.1.log +++ b/doc/value/examples/parametrizing/slevel.1.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing slevel.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/slevel.2.log b/doc/value/examples/parametrizing/slevel.2.log index 570d7bb9c1975b81ace7217aa9542f19f4d98d09..c0da12b59f83edbe957469cc516d5d864b21cae6 100644 --- a/doc/value/examples/parametrizing/slevel.2.log +++ b/doc/value/examples/parametrizing/slevel.2.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing slevel.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/examples/parametrizing/widen-hints.log b/doc/value/examples/parametrizing/widen-hints.log index e170d38e00500a33878faf972330b3778e3d0ea2..36982f044ef6797f6c62919a06be8804b9937509 100644 --- a/doc/value/examples/parametrizing/widen-hints.log +++ b/doc/value/examples/parametrizing/widen-hints.log @@ -1,4 +1,3 @@ -[kernel] Parsing ../../../../bin/../share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing widen-hints.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/doc/value/main.tex b/doc/value/main.tex index 5a99248d6d715039d1daf0dbbe290a0a849b947f..d1c1decff6588e155851a5c21d7ac5a36b659f2a 100644 --- a/doc/value/main.tex +++ b/doc/value/main.tex @@ -2,6 +2,7 @@ \usepackage{microtype} \usepackage{lmodern} +\usepackage{booktabs} % Commandes pour mettre des ref dans l'index : \newcommand{\idb}[1]{\textbf{#1}} @@ -57,7 +58,7 @@ CEA LIST, Software Reliability Laboratory, Saclay, F-91191 \\ \end{tabular} \vfill \begin{flushleft} - \textcopyright 2011-2013 CEA LIST + \textcopyright 2011-\the\year{} CEA LIST This work has been supported by the ANR project U3CAT (ANR-08-SEGI-021-01). @@ -581,12 +582,9 @@ prefixed by \verb|__fc_|, \verb|__FC_| and \verb|S___fc_|. These are all variables coming from ACSL specifications in the Frama-C standard library. -Next in the log are a lot of entries that simply indicate -EVA's progression. When the analysis -takes too long, these messages -help the user understand where time is spent. -We can ignore these messages now. The following line -is also, in the current context, a progression message: +The next line in the log is a progression message, that indicates +that EVA has encountered a loop and is performing an approximations. +Those messages can be ignored for now. \begin{logs} lib.c:17:[value] entering loop for the first time \end{logs} @@ -705,15 +703,15 @@ are true alarms that indicate an actual problem or false alarms that don't. The most important information is that the analysis did not take an unreasonable time. -The second most important information is that the analysis -seems to have explored all the paths we intended for it to -explore, as seen in the list of functions for which values are -printed or in the log entries such as: -\begin{logs} -[value] computing for function RotL_64 <- Skein_256_Process_Block - <- Skein_256_Final <- main. - Called from skein_block.c:100. -\end{logs} +% The second most important information is that the analysis +% seems to have explored all the paths we intended for it to +% explore, as seen in the list of functions for which values are +% printed or in the log entries such as: +% \begin{logs} +% [value] computing for function RotL_64 <- Skein_256_Process_Block +% <- Skein_256_Final <- main. +% Called from skein_block.c:100. +% \end{logs} The GUI allows to inspect the sets of values obtained during the analysis and to get @@ -1218,6 +1216,7 @@ This chapter categorizes and describes the outputs of EVA.} \vspace{2cm} \section{Values} +\label{sec:values} The EVA plug-in accepts queries for the value of a variable \lstinline|x| at a given program point. It answers such a @@ -1922,25 +1921,6 @@ alloc.c:20: ... all target addresses were invalid. origin.i:86: ... local escaping the scope of local_escape_1 through esc2 \end{logs} -\subsection{Progress messages} - -Some messages are only intended to inform the user of the progress of -the analysis. Here are examples of such messages: -\begin{logs} -[kernel] preprocessing with "gcc -C -E -I. skein.c" - -[value] computing for function memset <-Skein_256_Init <-main. - Called from skein.c:83. - -[value] Recording results for RotL_64 - -[value] Done for function Skein_256_Init -\end{logs} - -Progress messages -are informational only. If the analysis is fast enough, there is no -reason to read them at all. If it seems too slow, these messages can help -find where the analyzer spends its time. \section{About these alarms the user is supposed to check\ldots} @@ -2743,6 +2723,17 @@ frama-c -val -deps -out -save result file1.c file2.c frama-c-gui -load result \end{shell} +\subsection{Controlling the output} + +By default, EVA emits all the alarms it finds (section +\ref{obligations}) as both ACSL assertions and textual messages in the +log. For big analyses, the log can become quite large. Since ACSL +assertions are stored by the Frama-C kernel, and can be output using +plugins such as Report, the textual output is partly redundant. Thus, +the textual emission of alarms can be inhibited using the combination of +options \verb+-no-val-warn-on-alarms -value-msg-key=-alarm+. + + \section{Describing the analysis context} \label{context} @@ -3547,7 +3538,224 @@ analysis result then becomes: \section{Advanced analyses} \label{sec:eva} -\emph{To be written} + +Starting from \FramaC Silicon, new analysis \emph{domains} are +available to improve the precision on specific code constructs. Theses +analyses are all experimental. We expect their exact perimeter to evolve +from one \FramaC version to the other. + +The currently implemented domains offer no option other than the one +meant to activate them. They can (and probably should) be enabled at +the beginning of the analysis. Their only downside is that they +increase the analysis time. + +\emph{Restrictions:} +\begin{itemize} +\item the results of theses analyses cannot currently be viewed in the GUI; +\item adding a new analysis may unfortunately change previous results in + unpredictable ways, and new alarms may sometimes + appear.\footnote{Adding now domains may reduce the convergence + speed, and/or lead to more \lstinline+-slevel+ being consumed. + Sometimes, those changes snowball into additional alarms.} + +\end{itemize} + + +\subsection{Symbolic equalities} +\label{sec:symbolic-equalities} + + +\emph{This analysis is experimental.} + +Activating option \texttt{-eva-equality-domain} instructs +EVA to perform a special analysis that stores information +about equalities found in the code. Those equalities may stem either +from conditions (e.g. \texttt{if (x == y+1)}), or assignments +\texttt{y = x+2;}. Once an equality has been inferred, it will +be used when one of the expressions involved occurs later in the program. + + +\begin{lstlisting} + int y = x+1; + // the equality y == x + 1 is inferred + if (y <= 2) { + // Thanks to the equality, x <= 1 is deduced + } +} +\end{lstlisting} + +This domain should be activated by default. Indeed, the normalisation +done by \FramaC for expressions with side-effects introduces temporary +variables, for which the equality domain is useful to regain +precision. + +Currently, the analysis is partially inter-procedural. The information +known in the caller is not propagated in the callee. On the other hand, +the information inferred in the callee is propagated back to the caller. + + +\subsection{Reused left-values} +\label{sec:reuse} + + +\emph{This analysis is experimental.} + +Activating option \texttt{-eva-symbolic-locations-domain} instructs +EVA to perform a special analysis for \emph{reused left-values}. + +\begin{lstlisting} +int t[10]; + +extern unsigned int u[10]; + +//@ requires i < 10; +void main(unsigned int i) { + if (u[i] < 8) { + t[u[i]] = 2; + } +} +\end{lstlisting} +On this code, EVA cannot represent precisely \lstinline+u[i]+, and +``learns'' nothing from the condition \lstinline+u[i] < 8+. Hence, EVA +emits an alarm on the line \lstinline|t[u[i]] = 2|, as it cannot prove +that \lstinline+u[i]+ is less than 10. + +To allow learning information from such conditionals, +the new analysis stores information especially for \texttt{u[i]} itself. +This analysis is of course correct in presence of pointers, in particular +when the left-value is written through an alias between two read accesses. +All ``compound'' left-values such as \texttt{u[i]}, \texttt{*p} or +\texttt{q->t[i].v} are handled. + +Currently, the analysis is intra-procedural. The information known +in the caller is not propagated in the callee. + +\subsection{Gauges} +\label{sec:gauges} + +\emph{This analysis is experimental.} + +Activating option \texttt{-eva-gauges-domain} instructs EVA to +store relations between integer (or pointer) variables modified by a +loop, and the number of elapsed loop iterations. It is based on the +paper \emph{``The Gauge Domain: Scalable Analysis of Linear +Inequality Invariants''} +\cite{DBLP:conf/cav/Venet12}. + + +\begin{lstlisting} +int y = 3; +int t[100]; +int *p = &t[0]; + +for (int i=0; i<100; i++) { + y += 2; // y == 2*i + 5 holds. In particular, y <= 203 + *p++ = i; // all accesses are in bound +} +\end{lstlisting} + +This domain should be activated for programs in which finite loops +increase multiple variables simultaneously, in an affine way. It +is \emph{not} useful if the loop is fully unrolled by syntactic or +semantic means, or if the relation between +variables is not affine (e.g. computing a square). + +\begin{lstlisting} + if (x++ <= 10) { ... } + +// Transformed into + + int tmp = x; + x++; + if (tmp <= 10) { // Nothing is learnt on x without the + // domain of equalities } +\end{lstlisting} + +Currently, the analysis is intra-procedural only: no information +flows from the caller to the callee, or in the reverse direction. +The relations inferred can only involve variables that are: +\begin{itemize} +\item local to a function (e.g. not a global), and not \texttt{static}; +\item scalar (not a field of a struct, or a cell in an array). +\end{itemize} + +Beware that the analysis works better when arithmetic overflows +are reported as an alarm. With the default options of \FramaC, +this means that gauges can be inferred easily for \emph{signed} +variables, but less so for \emph{unsigned} ones. Indeed, the affine +relations inferred by the domain are no longer true once the +variable exceeds e.g. \texttt{INT\_MAX} and wraps. Code such as +\begin{lstlisting} +unsigned int x = ...; +int y = ...; + +while (--x > 0) { + y++; + [...] +} +\end{lstlisting} + cannot be analyzed precisely, because the relation between \texttt{x} +and \texttt{y} is not affine. + +\subsection{Bitwise values} +\label{sec:bitwise} + +\emph{This analysis is experimental.} + +Activating option \texttt{-eva-bitwise-domain} instructs EVA to store +bitwise information in complement to the usual, interval-based, information. +This is mostly useful for programs that use bitwise operators: \verb+&+, +\verb+|+, \verb+^+ and \verb+~+, especially with bit-masks constants. +The following program is analyzed more precisely thanks to the bitwise +domain (with \lstinline+-slevel 2+). +\begin{lstlisting} +int isTopBit(unsigned something) +{ + //@ assert something >= 0x80000000 || something < 0x80000000; + unsigned topBitOnly = something & 0x80000000; + something ^= topBitOnly; + if (something & 0x80000000) // More precision on this conditional { ... } +} +\end{lstlisting} + +The current analysis is fully inter-procedural. All variables (including +aggregates and arrays) are handled. However, for conciseness, the domain tries +not to track information which is redundant with the intervals-based domain. In +some cases, the domain is able to infer precise information on the bits of a +pointer address. + +\subsection{Binding to APRON} +\label{sec:apron} + +\emph{These bindings are proofs-of-concept.} + +EVA features a very experimental binding to the numerical domains of +the APRON library \cite{DBLP:conf/cav/JeannetM09}. Assuming Frama-C has been +compiled with support for Apron, the corresponding options are: + +\begin{description} +\item[-eva-apron-box]: boxes/intervals +\item[-eva-apron-oct]: octagons +\item[-eva-polka-equalities]: linear equalities +\item[-eva-polka-loose]: loose polyhedra +\item[-eva-polka-strict]: strict polyhedra +\end{description} + +The analysis is fully interprocedural. However, the binding is +currently intended as a proof-of-concept, and should probably be used +on small examples--not on full-scale programs. In particular, the +following restrictions apply to the current implementation: +\begin{itemize} +\item only integer variables are tracked (pointers, floating-point values, + and array cells or aggregate fields are ignored); + +\item variables are \emph{not} packed, which may result in a very large +number of tracked variables. Since relational domains are usually costly +(cubic complexity for octagons, exponential for polyhedra), this may result +in very long analyses and/or massive memory usage. + +\end{itemize} + \section{Non-termination} @@ -4252,14 +4460,12 @@ from the \mbox{POSIX} interface. It would however be possible to model other system interfaces. Existing primitives are described in the rest of this section. -The easiest way to enable builtins is to use option -\lstinline|-val-builtins-auto|\footnote{This option will be enabled by default -in a future \FramaC release.}. This will activate all available \FramaC -builtins for the standard C library functions, which include some -string functions (e.g. \lstinline|strlen| and \lstinline|strnlen|), +Builtins are enabled by default. The currently available builtins include +some string functions (e.g. \lstinline|strlen| and \lstinline|strnlen|), some floating-point mathematical functions (e.g. \lstinline|sin| and \lstinline|pow|), and functions for dynamic memory allocation -(\lstinline|malloc|, \lstinline|realloc| and \lstinline|free|)% +(\lstinline|malloc|, \lstinline|calloc|, \lstinline|realloc| and +\lstinline|free|). The complete list of builtins for EVA (including builtins unrelated to the standard C library) is presented in section~\ref{builtins-list}. @@ -4268,17 +4474,22 @@ You can also manually specify each builtin to be used with option \lstinline|-val-builtin|, which takes pairs of functions: the function to be replaced, and the name of the builtin that replaces it. For instance, option -\lstinline|-val-builtin malloc:Frama_C_alloc_size,free:Frama_C_free| enables +\lstinline|-val-builtin malloc:Frama_C_malloc_fresh,free:Frama_C_free| enables builtins for the \lstinline|malloc| and \lstinline|free| functions of the standard library. Note that even if a builtin is specified this way, the function still needs to be declared to be used. Also, note that existing specifications and implementations are ignored -for functions replaced with builtins. +for functions replaced with builtins. If you want EVA to use your own definition +of a function such as \lstinline|strlen|, for instance, you need to use option +\lstinline|-no-val-builtins-auto|. You can then manually enable +\lstinline|-val-builtin| for each builtin that you do wish to activate. If you specify a non-existing builtin in the command line, the error message will list all available builtins in your \FramaC installation. +You can also use option \lstinline|-val-builtins-list| to obtain the list of +function names mapped to builtins, as well as the list of all builtins. -\subsection{{\tt malloc}, {\tt realloc} and {\tt free} functions} +\subsection{{\tt malloc}, {\tt calloc}, {\tt realloc} and {\tt free} functions} \label{malloc} Several builtins for modeling dynamic allocation are available in \FramaC. @@ -4293,7 +4504,8 @@ explained in section~\ref{dyn-alloc}. \hline C library function & Weak (always terminates) & Strong (more precise) \\ \hline - malloc & \lstinline|Frama_C_alloc_by_stack| & \lstinline|Frama_C_alloc_size| \\ + malloc & \lstinline|Frama_C_malloc_by_stack| & \lstinline|Frama_C_malloc_fresh| \\ + calloc & \lstinline|Frama_C_calloc_by_stack| & \lstinline|Frama_C_calloc_fresh| \\ realloc & \lstinline|Frama_C_realloc| & \lstinline|Frama_C_realloc_multiple| \\ free & \multicolumn{2}{c|}{\lstinline|Frama_C_free|} \\ \hline @@ -4317,13 +4529,13 @@ form: This indicates that new bases are being created. The analysis will then have to be manually interrupted. +You will then need to either entirely unroll the loop ({\it e.g.} giving +the analysis enough \lstinline|slevel|), or use a weak variant. -Option \lstinline|-val-builtins-auto| follows this philosophy and uses -\emph{weak} builtins by default. However, option -\lstinline|-val-builtin| takes precedence, and can be used to choose -\emph{strong} builtins. Another possibility is to call -e.g. \lstinline|Frama_C_alloc_size| manually, for the allocations that -are guaranteed to occur a finite number of times. +By default, \emph{weak} builtins are used, but usage of +\lstinline|-val-builtin| takes precedence over preexisting associations. +Another possibility is to call e.g. \lstinline|Frama_C_malloc_fresh| manually, +for the allocations that are guaranteed to occur a finite number of times. \paragraph{Multiple locations per callstack} @@ -4346,7 +4558,6 @@ value. To change this behavior (supposing that these functions never fail), use option \lstinline|-no-val-malloc-returns-null|. - \section{Parameterizing the analysis} \subsection{Adding non-determinism} @@ -4401,50 +4612,96 @@ In addition to using the graphical user interface, it is also possible to obtain information about the value of variables at a particular point of the program in log files. This is done by inserting at the relevant points in the source code calls to the functions described below. - -Currently, functions displaying intermediate results all have an -immediate effect, {\it i.e} their effect is to display the -state that the analyzer is propagating at the time it reaches -the call. Thus, these functions might expose some undocumented aspects -of the behavior of the analyzer. This is especially visible when -they are used together with semantic unrolling (see -section~\ref{slevel}). Displayed results may be -counter-intuitive to the user. It is recommended to attach a greater -importance to the union of the values displayed during the whole -analysis than to the particular order during which the subsets -composing these unions are propagated by the analyzer. - -\subsection{Displaying the entire memory state} - -The current memory state each time the analyzer reaches a -given point of the program can be displayed with a call -to the function \lstinline|Frama_C_dump_each()|. +These functions have no effect on the results of the analysis; in particular, +no alarm is ever emitted on their calls, even when the evaluation of an +argument could fail. + +Currently, these functions all have an immediate effect, {\it i.e} they display +the state that the analyzer is propagating at the time it reaches the +call. Thus, these functions might expose some undocumented aspects of the +behavior of the analyzer. This is especially visible when they are used together +with semantic unrolling (see section~\ref{slevel}). Displayed results may be +counter-intuitive to the user. It is recommended to attach a greater importance +to the union of the values displayed during the whole analysis than to the +particular order during which the subsets composing these unions are propagated +by the analyzer. \subsection{Displaying the value of an expression} -Displaying the values of an expression \lstinline|expr| each time the -analyzer reaches a given point of the program is done with a call to -the function \lstinline|Frama_C_show_each_name(expr)|. +The values of some expressions \lstinline|expr1|, \lstinline|expr2|… during the +analysis can be displayed with a call to the function +\lstinline|Frama_C_show_each_name(expr1, expr2...)|. They are displayed each +time the analyzer reaches the call. -The place-holder ``\lstinline|name|'' can be replaced by an -arbitrary identifier. -This identifier will appear in the output of the analyzer -along with the value of the argument. It -is recommended to use different identifiers for each use of these -functions, as shown in the following example: +The place-holder ``\lstinline|_name|'' can be removed or replaced by an arbitrary +identifier. This identifier will appear in the output of the analyzer along +with the value of the argument. Different identifiers can be used to +differentiate each call of these functions, as shown in the following example: \begin{listing-nonumber} void f(int x) { int y; y = x; - Frama_C_show_each_x(x); + Frama_C_show_each(x); Frama_C_show_each_y(y); Frama_C_show_each_delta(y-x); ... } \end{listing-nonumber} +\subsection{Displaying the entire memory state} + +The memory states inferred at a program point can be displayed with a call to +the function \lstinline|Frama_C_dump_each()|. The current state is displayed +each time the analyzer reaches the call. + +The internal states of each additional domain described in Section~\ref{sec:eva} +are also displayed if the domain's log category has been enabled through the +option \verb+-value-msg-key category+, where \verb+category+ is the log category +of the domain, shown in Figure~\ref{fig:log-category}. + +\begin{figure} + \begin{centering} + \begin{tabular}{lll} + Domain & Log category & Ref\tabularnewline + \midrule + \midrule + Symbolic equalities & \lstinline|d-eqs| & \ref{sec:symbolic-equalities} + \tabularnewline + \midrule + Symbolic locations & \lstinline|d-symblocs| & \ref{sec:reuse} + \tabularnewline + \midrule + Gauges & \lstinline|d-gauges| & \ref{sec:gauges} + \tabularnewline + \midrule + Bitwise & \lstinline|d-bitwise| & \ref{sec:bitwise} + \tabularnewline + \midrule + Apron binding & \lstinline|d-apron| & \ref{sec:apron} + \tabularnewline + \bottomrule + \end{tabular} + \par\end{centering} + \caption{Log category of the additional domain \label{fig:log-category}} + +\end{figure} + +\subsection{Displaying internal properties about expressions} + +The internal properties inferred by each domain about some expressions +\lstinline|expr1|, \lstinline|expr2|… can be displayed with a call to +\lstinline|Frama_C_domain_show_each(expr1, expr2...)|. They are displayed each +time the analyzer reaches the call. + +By default, only the internal representation of variables by the main domain +(see Section~\ref{sec:values}) are shown. The properties inferred by each +additional domain are also printed if the domain's log category has been enabled +through the option \verb+-value-msg-key category+, where \verb+category+ is the +log category of the domain, shown in Figure~\ref{fig:log-category}. The +information printed by the additional domains is currently very limited. + \section{Table of builtins} \label{builtins-list} @@ -4527,10 +4784,6 @@ These builtins allow to perform queries over the current abstract memory state. These builtins perform operations on the abstract memory. They usually correspond to the standard C library function of the same name. \begin{itemize} -\item \lstinline|Frama_C_copy_block(p,s,l)| will copy the content of - \lstinline|p[0..s-1]| to \lstinline|p[s..s*(l+1)-1]|. - \lstinline|s| must be precise. - Used for internal purposes, not supposed to be tied to user-defined functions. \item \lstinline|Frama_C_memcpy| \item \lstinline|Frama_C_memset| \end{itemize} @@ -4552,26 +4805,23 @@ They are listed here for completeness. \begin{table}[!ht] \centering - \begin{tabular}{ccc} + \begin{tabular}{cccc} \multicolumn{3}{c}{Dynamic memory allocation builtins} \\ \hline \lstinline|Frama_C_alloc_by_stack| & - \lstinline|Frama_C_alloc_size| & + \lstinline|Frama_C_vla_alloc_by_stack| & + \lstinline|Frama_C_malloc_fresh| \\ + \lstinline|Frama_C_calloc_by_stack| & + \lstinline|Frama_C_calloc_fresh| & \lstinline|Frama_C_free| \\ \lstinline|Frama_C_realloc| & - \lstinline|Frama_C_realloc_multiple| + \lstinline|Frama_C_realloc_multiple| & + \lstinline|Frama_C_vla_free| \end{tabular} \end{table} \ifdefstring{\OPENSOURCE}{no}{ % These builtins are not available in the open-source release -\subsection{Misc} - -\begin{itemize} -\item \lstinline|fscanf(file,fmt,...)| provides minimal support for - \lstinline|fscanf|, by injecting an unknown value of the appropriate - size in each pointer argument after \lstinline|fmt|. -\end{itemize} \subsection{Operations on the abstract state} @@ -4817,6 +5067,10 @@ at \url{http://bts.frama-c.com/main_page.php}. % \url{http://www.flickr.com/photos/85941395@N00/1198814469} \\ %\end{tabular} +\bibliographystyle{alpha} +\bibliography{biblio.bib} + + \end{document} % Local Variables: diff --git a/doc/value/makefile b/doc/value/makefile index 7a35d23f0e41389167126bc64d0a008a3fe9f042..7fba4bf9774ab6e58e56b86a391902e455fd34ed 100644 --- a/doc/value/makefile +++ b/doc/value/makefile @@ -12,7 +12,7 @@ export OPENSOURCE main: ../../VERSION *.c $(MAKE) $(FRAMAC_MODERN) - rubber --warn all --pdf main.tex + latexmk -silent -pdf main.tex ifeq ($(OPENSOURCE),no) @echo "Generated CLOSED-SOURCE Value manual (OPENSOURCE=$(OPENSOURCE))" else @@ -24,4 +24,4 @@ clean: install: rm -f ../manuals/value-analysis.pdf - install -D main.pdf ../manuals/value-analysis.pdf + cp main.pdf ../manuals/value-analysis.pdf diff --git a/doc/value/value-interval.org b/doc/value/value-interval.org deleted file mode 100644 index f7be7612be40b5598dd99ad22bd8e7dd0679441c..0000000000000000000000000000000000000000 --- a/doc/value/value-interval.org +++ /dev/null @@ -1,729 +0,0 @@ -Documentation de value - -* Les treillis et grosses structures de donnees de value, et l'evaluation C, et leurs relations -#+latex_header: \usepackage{tikz} \usepackage{amsfonts} \usepackage[final]{pdfpages} - - -Ce document ne présente pas ce qu'est un treillis etc. ni une -introduction à la théorie de l'interprétation abstraite, supposés -connus; il s'agit plus d'un document haut-niveau expliquant les -structures de données et modules principaux du plugin Value. - -# XXX: Je dis l'approximation d'une valeur ou "domaine des valeurs" pour -# l'ensemble des valeurs possibles (collecting semantics). J'utilise -# "ensemble" pour les ensembles non-approximes (e.g. dans la logique, -# pour une zone mémoire, etc). -# -# TODO: Une figure avec les relations entre tous les domaines (heritage -# quand on fait un include, "use",etc). Ou de manière semitextuelle -# (i.e. pour chaque noeud, dire module Toto = struct include Map_Functor(Mod1,Mod2) end; module CValue.Model = struct include LMap ... end) -# + juste rajouter les fleches pour dire "depend de" de manière générique. -# + regrouper -# -# + des fleches indiquant pour la relation si c'est "use", "extends", "contains" etc. -# -# : #+header: :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 400 - -#+header: :headers '("\\usepackage{tikz}") - #+begin_src latex :exports none :file teste.pdf - \hspace{-1cm}\scalebox{0.9}{ - \begin{tikzpicture}[yscale=3, xscale=8] - \tikzstyle{module}=[draw, rectangle, rounded corners, fill=black!15, align=left, above right]; - \tikzstyle{lattice}=[draw, rectangle, rounded corners, fill=yellow!25, align=left, above right]; - - % TODO: Faire differents groupes: Le groupe avec les CValues (utiles pour l'interpretation); le groupe avec - % les adresses (locations); le groupe avec les contenus (offsetmap et lmap); les treillis generiques auxilaires. - % Je vais mettre les groupes dans des scopes. - - - - \begin{scope}[shift={(0,4.5)}] - \draw[fill=gray!60] (-0.05,-0.05) rectangle (2.6,1.1) node[below left,align=right] {\textbf{Evaluation}\\Evaluation du C et de la logique ACSL}; - - % DONE - \node[module] (op) at (2.25,0.3) {Eval\_op}; - \node[module] (expr) at (1.5,0.35) {Eval\_expr}; - \node[module] (funs) at (0,0.8) {Eval\_funs}; - \node[module] (slevel) at (0,0) {Eval\_slevel}; - -% \node[module] (annot) at (0.3,0.3) {Eval\_annot}; - \node[module] (annot) at (0.6,0.4) {Eval\_annot}; - - \node[module] (stmt) at (1.2,0) {Eval\_stmt}; -% - \node[module] (terms) at (1.2,0.8) {Eval\_terms}; - - \tikzstyle{arrow}=[->,shorten >=1pt] - - % DONE - \draw[arrow] (annot) -- (terms); - \draw[arrow] (expr) -- (op); - - \draw[arrow] (funs) + (-0.18,0) -- (funs); - \draw[arrow] (funs) -- (slevel); - %\draw[arrow] (funs) -- (stmt); % Not an important dependency - % TODO: also, dependency from stmt to funs via a reference. - \draw[arrow] (funs) -- (annot); - \draw[arrow] (funs) -- (terms); - - \draw[arrow] (slevel) -- (annot); - \draw[arrow] (slevel) -- (expr); - \draw[arrow] (slevel) -- (stmt); - - \draw[arrow] (stmt) -- (expr); - \draw[arrow] (stmt) -- (op); - -% \draw[arrow] (terms) -- (expr); % Not an important dependency - \draw[arrow] (terms) -- (op); - - \end{scope} - - \begin{scope}[shift={(0,1)}] - \draw[fill=gray!60] (-0.05,-0.05) rectangle (0.85,3.3) node[below left,align=right] {\textbf{CValue}\\Treillis utilisés pour l'évaluation du C}; - - \node[lattice] at (0,2.2) { module \textbf{CValue.Model} \\ - \textit{Etat de la mémoire d'un programme C}\\ - $\approx$ LMap(V\_OffsetMap)}; - \node[lattice] at (0,1.5) { module \textbf{CValue.V\_Offsetmap} \\ - \textit{Zone mémoire contig\"ue de valeurs C} \\ - = Offsetmap.Make(V\_Or\_Uninitialized)}; - \node[lattice] at (0,0.8) { module \textbf{CValue.V\_Or\_Uninitialized} \\ - \textit{Valeur C eventuellement ``indeterminate''} \\ - $\approx$ CValue.V $\times$ \\ \quad has\_uninitialized? $\times$ has\_escaping? }; - \node[lattice] at (0,0.1) { module \textbf{CValue.V} \\ \textit{Valeur d'une lvalue C non indeterminate} \\ include Location\_Bytes}; - - \end{scope} - - \begin{scope}[shift={(1.75,0.2)}] - \draw[fill=gray!60] (-0.05,-0.1) rectangle (0.85,4.1) node[below left,align=right] {\textbf{Locations}\\Représentation d'adresses mémoires\\Clés d'accès aux offsetmaps}; - - \node[lattice] at (0,2.8) { module \textbf{Zone} \\ - \textit{Ensemble de locations de taille 1 bit} \\ - $\approx$ Map of Base $\to$ Int\_Intervals | $\top$ }; - - \node[lattice] at (0,1.8) { type \textbf{location} = \\ \textit{Adresse + taille} \\ - \textit{Clé d'accès au contenu de la mémoire} \\ - \{ loc : Location\_Bits.t;\\ \ \ size: $\mathbb{N} \cup \top$ \}}; - - \node[lattice] at (0,1) { module \textbf{Location\_Bits} \\ \textit{Adresse en bits, ou valeur numérique} \\ = Location\_Bytes }; - - - - \node[lattice] at (0,0) {module \textbf{Location\_Bytes} \\ - \textit{Adresse en octet, ou valeur numérique} \\ - type t = Map\_Lattice.Make(...).t = \\ - | Top of Base.SetLattice.t * Origin.t \\ - | Map of Base $\to$ Ival }; - - - \end{scope} - - \begin{scope}[shift={(0,-1.7)}] - \draw[fill=gray!60] (-0.05,-0.05) rectangle (0.85,2.1) node[below left,align=right] {\textbf{LMap/Offsetmap}\\Contenu de la mémoire}; - - \node[lattice] at (0,0.7) { module \textbf{LMap}(OffsetMap)\\ - \textit{Contenu de toute la mémoire}\\ - = (Map Base $\to$ OffsetMap) $\cup \top \cup \bot $ \\ - $\approx$ (Map location $\to$ V) $\cup \top \cup \bot $}; - - \node[lattice] at (0,0) { module \textbf{OffsetMap}(V) \\ - \textit{Zone mémoire contig\"ue, bit-adressable} \\ - $\approx$ Arbre d'intervalles de bits $\to$ V}; - - \end{scope} - - \begin{scope}[shift={(1,-2.7)}] - \draw[fill=gray!60] (-0.05,-0.05) rectangle (1.6,2.6) node[below left,align=right] {\textbf{Base}\\Treillis et modules de base}; - - \node[lattice] at (0,1.4) { module \textbf{Ival} \\ - \textit{Valeurs numériques} \\ - type t = \\ | Set of $\mathbb{N}$ array \\ - | Float(min,max) \\ - | Top(min:$\mathbb{N} \cup -\infty$,max:$\mathbb{N} \cup +\infty$,\\\qquad \ \ \,rest:$\mathbb{N}$,modulo:$\mathbb{N}$) }; - - - \end{scope} - - - \node[module] at (1.8,-1.5) { module \textbf{Base} \\ \textit{Adresse de base d'une zone mémoire} \\ - type base $\approx$ \\ - | Var(varinfo)\\ - | Null\\ - | String}; - - - \node[lattice] at (1,-2) { Map\_Lattice; SetLattice; Int\_Intervals ... }; - - - \end{tikzpicture}} -#+end_src - - #+RESULTS: - #+BEGIN_LaTeX - [[file:teste.pdf]] - #+END_LaTeX - - #+BEGIN_LaTeX - \includepdf[page=1]{teste.pdf} - #+END_LaTeX - - -** Les treillis de value - - -*** TODO Notion de treillis - -Un treillis est - - -=is_included=, join/surapproximation du least-upper-bound, et transfer functions. - -*** Les domaines numériques - -**** TODO Ival - -Domaine des valeurs numériques (Flottant ou Entier). - -**** DONE =Int_Base= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-20 jeu. 17:05] -:END: - -Un domaine simple où on a soit un entier connu de manière exact, soit -Top (un entier inconnu). - -Ce domaine est utilisé pour modéliser des tailles de zones mémoire -(généralement connues statiquement). Top est rarement rencontré, car -il ne peut être obtenu qu'en le créant explicitement: il correspond -notamment aux tailles des structures inconnues, ou offset de -structures contenant des structures inconnue. - -*** TODO Bases.ml - -L'état mémoire du programme est constituée d'un ensemble de plages -d'adresses contigues (ou storages). Une =base= est un identifiant (un -nom)q pour une de ces plages d'adresse (de manière équivalente, une -=base= identifie l'adresse de base de cette plage d'adresse). - -Les différentes bases correspondent donc aux manières dont de la -mémoire est allouée en C. En première approximation, on peut dire que: -- =Var= correspond au storage associé aux variables globales, locales, - et formelles -- =Initialized_Var= au storage alloué dynamiquement ou spécialement (les puits) -- =CLogic_Var= permet de donner un storage pour l'évaluation des variables logiques -- =String= donne un storage aux chaines de caractère -- =Null= correspond aux adresses absolues, e.g. (int *) 0x123. Notons - que =CValue.V= = =Location_Bytes= represente les valeurs comme des - couples (Base,offset), et que la base Null correspond également aux - valeurs non-pointeurs (e.g. les valeurs de type =int=). - -Note: en réalité, la différence entre Var et Initialized_var est leur -utilisation dans les lmap. Pour diminuer la taille de l'état mémoire, -on ne stocke pas d'offsetmap pour les bases qui ont une "valeur par -défaut". La valeur par défaut des Var est un offsetmap rempli de la -valeur "uninitialized". Pour les Initialized_var, on peut changer -cette valeur par défaut. - -# XXX: En explicant ca, on se rend compte que ce mecanisme est -# pas top... On pourrait fusionner Var et Initialized_var, et utiliser -# seulement le champs vlogic. - -*** DONE Locations.ml - -Les différentes locations representent les adresses et plages -d'adresses, avec ou sans information de taille. Elles ne representent -pas ce qui est contenu dans les adresses. - -**** DONE =Locations.Locations_Bytes= - -Est le domaine abstrait des "adresses ou valeur numérique", -i.e. represente l'approximation d'une adresse ou valeur numérique. Est -un type somme (hérité de =Map_Lattice=): - -: type t = -: | Top of Base.SetLattice.t * Origin.t -: | Map of M.t - -M.t est un Map des Bases vers Ival. Dit pour chaque Base, a quel -offset possible cela correspond. Par exemple, si on a la map - -: { &a -> {8}; &b -> {4;8} } - -Cela signifie qu'on a une adresse, contenue dans l'approximation - -: { (void *) ((char *) &a + 8) -: U (void *) ((char *) &b + 4) -: U (void *) ((char *) &b + 8) -: } - -La base NULL signifie une valeur numerique (pas une adresse). Ainsi - -: { NULL -> [8-16] } - -Signifie qu'on a une valeur numerique entiere entre 8 et 16. - -Top représente un garbled mix: i.e. un mélange de pointeurs. Ils -garbled mix sont obtenus en faisant des opérations numériques sur des -adresses. - -Notes: - - =Locations_Bytes= veut dire Location en Bytes, car l'unité - d'adressage est l'octet. Par opposition dans =Locations_Bits=, - l'unité d'adressage est le bit. - -- Le type =Location_Bytes= est le meme que =CValue.V=: ainsi les - lvalues du C sont interpretees comme des =Locations_Bytes=. - -- Le type =Location_Bytes= n'a pas de notion de taille. Ainsi, il est - possible d'avoir une lvalue qui s'evalue à 2^137 dans une adresse - qui correspond en fait à un char. La troncature est faite au niveau - supérieur: c'est décidé par Offsetmap, en appellant - =V.anisotropic_cast=. - -**** DONE =Locations.Locations_Bits= - -Représente le domaine des "adresses en bits, ou valeur numérique". Est -similaire à =Location_Bytes=, sauf que les adresses sont convertis en -bits, ce qui permet de traiter les bitfields. En interne, les -offsetmaps etc. sont adressés au niveau du bit. - -Il y a deux modules (=Locations_Bytes= et =Locations_Bits=) pour -éviter toute confusion (notamment, les types sont différents). Il y a -des fonctions de conversion entre les deux. - -**** DONE =Locations.location= = =Locations.Location.t= - -Les locations représentent une approximation des adresses (en bits, -i.e. de type =Location_Bits=) avec une taille ( =Int_Base=, i.e. un -entier précis ou top). - -Les locations sont utilisées comme clés pour accéder à la mémoire. La -mémoire est représentée par le module =CValue.Model = LMap=. Le -déreférencement en lecture se fait par l'appel à la fonction -=CValue.Model.find state loc=, où =state= représente toute la mémoire, -et =loc= est de type =Locations.location=. Le déréférencement en -écriture se fait avec =CValue.Model.add_binding state loc v=. - -L'information de taille permet, par exemple, de retourner des valeurs -différentes que l'on lise un =char= ou un =long= à la même adresse. - -Note: si une location est précise (i.e. le domaine comprend une seule -base avec un seul offset), les écritures peut faire un "strong -update", i.e. remplacer l'ancienne valeur par une nouvelle, car on est -sûr de l'endroit où on écrit. Sinon, on fait un "weak update", i.e. on -rajoute la nouvelle valeur à l'ensemble des valeurs possibles pour la -case. Par exemple, à la fin du code C suivant: - -#+begin_src c -int a[3] = {0;0;0}; - -void main(void) { -int *p0 = &a[0]; -int *p12; -if(rand()) { p12 = &a[1]; } else { p12 = &a[2];} -*p0 = 1; // p0 est précis, on fait un strong update -*p12 = 1; // p12 est imprécis, on fait un weak update -} -#+end_src - -La mémoire contiendra: - -: a[0] = 1 -: a[1] = {0;1} -: a[2] = {0;1} - -**** DONE =Locations.Zone= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-25 mar. 15:46] -:END: - -Les zones représentent une sur-approximation d'un ensemble de -locations de taille un bit, le bit étant la plus petite unité de -stockage de l'information et donc indivisible. Les zones permettent la -représentation d'emplacements dans la mémoire, sans considérer la -taille des accès. - -On peut ainsi voir les zones comme une approximation des locations, où -on a perdu l'information de taille. Notamment, si on prend les deux -locations suivantes: - -: {&a->{0;1;2;3}} taille 1 et -: {&a->{0}} taille 4 - -La première location est un ensemble imprécis de locations de taille 1 -tandis que l'autre est une location de taille 4 précise. Mais à ces -deux locations correspondra la même zone. - -L'intérêt des zones est justement d'avoir oublié cette information de -taille, ce qui permet notamment de faire des /joins/ sur des ensembles -de locations de tailles différentes. - -Au niveau de l'implémentation, les Zones sont des Maps des bases vers -une union d'intervalle d'entiers disjoints; la valeur =Top= représente -un garbled mix, comme pour les =Location_Bytes=, mais n'est -actuellement pas utilisée. - -Note: Les zones sont également utilisées comme clés pour les -=OffsetMap_bitwise= et =LMap_Bitwise=. Comme leur nom l'indique, ces -dernières structures permettent de stocker des informations relatives -à chaque bit de la mémoire, sans information de taille d'accès. - -*** DONE =Lmap= et =OffsetMap= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-28 ven. 15:43] -- State "DONE" from "TODO" [2013-06-27 jeu. 17:55] -:END: - -Ces structures de données représentent le contenu de la mémoire. Une -=OffsetMap= représente le contenu d'une zone contig\"ue de mémoire; par -exemple à une définition de variable globale correspond une =OffsetMap= -représentant la mémoire allouée par cette définition. Les appels à -malloc créent également de nouvelles =OffsetMaps=. - -Les =LMap= représentent le contenu de toute la mémoire; il s'agit -d'une =Map= associant à chaque =Base= une =OffsetMap=. Ainsi, pour -chaque variable globale C est créée une nouvelle base, à laquelle est -associée une unique =OffsetMap=. Les appels à =malloc= ou =alloca=, la -rentrée dans un nouveau scope avec des variables locales, les chaines -de caractères ..., créent également de nouvelles bases qui sont -ajoutées au contenu de la mémoire. - -**** DONE =OffsetMap= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-27 jeu. 17:55] -:END: - -Les =OffsetMap= sont une structure de donnée générique permettant -d'associer à un intervalle d'entiers une valeur de =V=, le module -passé en paramètre. - -Dans leur utilisation par =CValue.V_OffsetMap=, le début de -l'intervalle correspond à l'offset (en bits) de la donnée par rapport -à l'adresse de base, et la fin à l'offset de la donnée plus sa taille. - -Par exemple, si on considère la définition d'une variable globale C: - -: struct { int x; int y; int z; } point; - -avec les =int= de taille 32 bits. Dans ce programme, une =OffsetMap= -de taille 96 bits est associée à =point=; =point.x= correspond à -l'intervalle [0;31] de cette intervalle, =point.y= à [32;63], et -=point.z= à [64;95]. - -Le grand intérêt des =OffsetMap= est de pouvoir représenter la mémoire -malgré les accès non-typés; e.g. un appel à =bzero= dans une -structure, suivie d'une lecture du champs sera correctement -effectuée. - -Son autre intérêt est algorithmique: l'opération =OffsetMap.find= -prend en argument une surapproximation des intervalles d'offsets -possibles (exprimé par un =Ival=), ce qui conduit à faire des =V.join= -sur toutes les valeurs qui peuvent être retournées à ces offsets. Les -=OffsetMap= permettent de réaliser cette opération plus efficacement. - -Le paramètre =V= de l'OffsetMap est un treillis qui doit fournir des -fonctions de transferts supplémentaires, permettant de ne regarder -qu'une partie des bits d'une valeur, ou de "recoller" des valeurs -contig\"ues. - -Le paramètre =V= de l'=OffsetMap= est un treillis avec -/isotropie/. Une valeur est dite isotrope si tous ses bits ont même -valeur, preservée par concaténation des bits. Par exemple, -=CValue.V.Top= (garbled mix) ou =Ival.zero= sont des valeurs -isotropes. Ces valeurs sont représentées de manière optimisée dans -l'offsetmap. - -Note: - - L'OffsetMap tel qu'implémenté n'a pas une structure de treillis. En - particulier, certaines valeurs ont plusieurs représentations - (e.g. 0x22 peut être représenté comme "0x22" sur 8 bits ou comme - "0x2" sur 4 bits, répétés deux fois) et la structure n'essaye pas - de normaliser. De fait l'opération =join= ne calcule pas le _least_ - upper bound de deux offsetmaps. Néanmoins, le =join= devrait être - commutatif, idempotent, associatif et surtout monotone, ce qui - permet aux itérations de Kleene de converger. - - - Les offsetmaps effectuent les opérations de découpe et de recollage - des données du treillis donné en paramètre =V= de manière - paresseuse. Pour cela, l'implémentation maintient, pour chaque - écriture: - - l'offset de début et l'offset de fin. On définit la longueur - comme étant (=offset_fin= - =offset_debut= + 1). - - la taille (égal à la longueur lors de l'écriture initiale) - - le décalage, qui explicite quelle partie de la valeur initiale - reste. - Par exemple, si initialement, on stocke une valeur =v= entre les - offsets 16 et 31; la longueur de l'intervalle est de 16 bits, la - taille de =v= est également de 16 bits, et le décalage est de 0. Si - on écris par la suite une autre valeur =w= entre les offsets 16 et - 23, alors l'offsetmap contiendra =w= entre 16 et 23; et entre =24 - et 31=, il contiendra un =v= de taille =16= sur un intervalle de - longueur =8=, décalé de =8= (puisqu'on n'a pas pris les 8 bits de - poids fort). - -# -# XXX: Isotropie. -# -# -# Maps d'ensembles d'adresses vers des cvalues? I.e. de locations vers des cvalues. -# -# Lmap: map de base vers offsetmap = CValue.Model. Etat complet du -# systeme. Les cles des lmap/cmodel sont des locations. -# - - -***** COMMENT offsetmap n'est pas un treillis, mais un quasi-treillis? - -il y a plusieurs representations possibles pour une meme -valeur. Est-ce un problème? - -e.g. si on fait un - -: memset(0xFE,4,&int) -> représentation: 0xFE x 4 -: *int = 0xFEFEFEFE -> représentation: 0xFEFEFEFE x 1 - -Si on prend les définitions du papier: abstract interpretation over -non-lattice abstract domain. Pour avoir un treillis, il suffit d'avoir -des opérations =join= et =is_included= correctes. - -Le test d'inclusion $\sqsubseteq$ (=is_included=) est un ordre partiel: - -1. reflexivité: OK -2. transitivité: OK -3. antysymettrie ($x \sqsubseteq y \land y \sqsubseteq x - \ \Rightarrow \ x = y$): OK si on renvoie faux pour au moins un des sens - de $\sqsubseteq$ - -L'autre opérateur est le join, qui doit être un least upper bound des -deux éléments. i.e.: - -1. $x \sqsubseteq (x \sqcup y)$ -2. $y \sqsubseteq (x \sqcup y)$ -3. $\forall z, x \sqsubseteq z \ \land \ y \sqsubseteq z \quad\Rightarrow\quad (x \sqcup y) \sqsubseteq z$ - -Comme on a (0xFE x 4) $\sqcup$ (0xFEFEFEFE x 1) qui est égal à l'un -des deux, il faut qu'un des deux soit plus petit que l'autre. - -Conclusion: il faut s'accorder sur lequel de (0xFE x 4) ou de -(0xFEFEFEFE x 1) est le plus petit, que $\sqcup$ renvoie le plus grand -des deux, que $\sqsubseteq$ renvoie vrai dans le bon sens et faux dans -l'autre sens, et les offsetmaps seront (sont déjà ?) un vrai treillis. - -# XXX: OK, nos opérations $\sqcup$ ne sont pas un least upper bound, -# mais juste un upper bound. Par contre, ils sont monotone, idempotents, -# commutatifs et associatifs. -# -# Knapster-Tarki marche si l'opérateur est monotone. $\sqcup$ Monotone veut dire que -# -# $\forall x,y:\quad x \sqsubseteq y \ \Rightarrow\ \forall z, x \sqcup z \sqsubseteq y \sqcup z$ -# -# XXX: Treillis intéressant à étudier: Ival avec recollement. -# -# Des valeurs de ce treillis sont "{x congrus a 3 mod 17} sur 32 bits, -# répété deux fois" et "{x congrus a 3 mod 17} sur 64 bits, répété une -# fois". Le least upper bound de ce treillis est complexe à calculer, en -# particulier avec les ivals qui peuvent se transformer en énumération, -# mais si on y arrive on peut faire des offsetmaps une vraie structure -# de treillis. -# - - -**** DONE =Lmap= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-28 ven. 15:43] -:END: - -Si LMap est implémenté comme étant une map des bases vers des -offsetmaps, il est plus destiné à être utilisé comme une map de -=location= vers =V=, le paramètre passé en argument de l'offsetmap -(d'où le nom LMap signifiant LocationMap). - -Comme dans toute =Map=, les deux opérations les plus importantes sont -(en ignorant les paramètres optionels) =find: t -> location -> v= et -=add_binding: t -> location -> v -> t=, qui associent aux locations -utilisées comme clés des valeurs du treillis =V=. Une =Location= -représentant un triplet (base,offset,taille), on utilise la base pour -retrouver l'offsetmap correspondante, et l'offset et la taille pour -écrire à l'intérieur de l'offsetmap. - -=Cvalue.Model= est une instantiation de =LMap= qui permet de -représenter toute la mémoire. Dans cette utilisation, =find= -correspond au déréférencement d'une adresse en lecture, et -=add_binding= au déréférencement d'une adresse en écriture. - -Note: Le foncteur de =LMap=, =Lmap.Make_LOffset= prend en argument le -module d'offsetmap, un module =Default_offsetmap=, et le module =V= -également passé en argument à =OffsetMap.Make=. =Default_offsetmap= -permet de définir l'état initial de la lmap. On aurait pu éviter de -passer =V= en ayant incluant =V= dans la structure définie par -=OffsetMap.Make(V)=, mais le système de type de OCaml ne sait pas -toujours traquer les alias de types dans différents modules, aussi -est-il plus simple de repasser =V= en argument. - -# XXX: C'est lié au fait que le système de module de OCaml est -# applicatif, et non génfératif, également. - -*** CValue - -**** TODO =CValue.V= - -C'est =Location_Bytes=, avec des operations en plus (e.g. additions, -etc). En première approximation, il s'agit des valeurs qui peuvent -être contenues dans un mot mémoire ou un registre en C (pas exactement -vrai, car les CValue.V peuvent contenir des entiers de taille infinie; -voir la section sur les casts pour voir comment ce problème est réglé.) - -Open question: est-ce que la signature (ou une partie) ne devrait pas -être commune avec les ival? - -**** DONE =CValue.V_Or_Uninitialized= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-25 mar. 18:19] -:END: - -L'idée de ce domaine est que si =CValue.V= correspond à un ensemble -des valeurs possibles d'un mot mémoire, =CValue.V_Or_Uninitialized= -correspond au même ensemble auxquels ont peut rajouter les valeurs -spéciales "Uninitialized" (la valeur n'a jamais été initialisée), ou -"Escaping" (dangling pointeur, i.e. pointe sur un bloc mémoire qui a -été libéré). - -Ainsi, la valeur "toujours non-initializé" est représenté par -: C_uninit_noesc of V.bottom - -Notes: - -- Plutôt que d'utiliser un type produit =CValue.V= $\times$ - has\_uninitialized? $\times$ has\_escaping?, les bits sont encodés - dans le tag du type somme, pour gagner une indirection. - -- La représentation permet une réduction simple d'une valeur - possiblement indeterminate vers une valeur qui ne l'est pas - (=CValue.V=), ce qui est une opération très courante. - -- Dans la norme C, "uninitialized or escaping" se dit "indeterminate"; - certaines fonctions de l'API utilisent ce nom là . - -**** TODO =CValue.V_Offsetmap= - -Tout simplement l'instantiation des offsetmap sur -V_Or_Uninitialized. Peu utilisé directement, contrairement à LMap. - -**** TODO =CValue.Model= - -Instantiation des LMap avec V_OffsetMap et V. - -La mémoire associe à chaque base, i.e. chaque zone de mémoire allouée -statiquement représentant une variable globale, une =Offsetmap=, -i.e. une zone mémoire contigue de taille fixe. - -Dans cette instantiation, "find" correspond au déréférencement en -lecture, et add_binding au déréférnecement en écriture. - -Une des fonctions les plus importantes est =CValue.Model.find=, qui -permet un déréférencement en lecture. Un déréférencement ne récupère -pas toute l'offsetmap associée à une base, mais seulement une partie; -cette fonction prend donc comme clé une =Locations.location=, i.e. une -adresse avec une taille, qu'elle utilise pour extraire la partie utile -en regardant d'abord quel est la base de la location, puis en -extrayant l'intervalle utile dans l'offsetmap associé à cette base. - -De manière similaire, =CValue.Model.add_binding= permet un -déréferencement en écriture. - - -Représente l'ensemble de la mémoire. Est implémenté par le module -=LMap=. - - -** Domaines basiques -*** DONE =Map_Lattice= -:LOGBOOK: -- State "DONE" from "TODO" [2013-06-25 mar. 17:45] -:END: - -Ce module définit le treillis des maps d'un ensemble de clés -(isomorphe à un sous-ensemble de $\mathbb{Z}$), et sans structure de -treillis) vers un treillis de valeurs. Les opérations sur le treillis -sont interprétée de manière naturelle; ainsi - -\[ (m1 \sqcup_m m2)[k] = \left\{ \begin{array}{rclcl} - m1[k] \sqcup_v m2[k] & \mathrm{ si } & k \in K(m1) &\cap& K(m2) \\ - m1[k] & \mathrm{ si } & k \in K(m1) &\backslash& K(m2) \\ - m2[k] & \mathrm{ si } & k \in K(m2) &\backslash& K(m1) - \end{array} \right. \] - - -Notons qu'une map $m$ est isomorphe à l'ensemble partitionné de -couples (clés,valeurs): - -\[ \bigcup_{k \in K(m)} (k, m[k]) \] - -Ainsi le domaine des adresses est représenté par une Map des bases -vers des offsets, et doit être vu comme l'ensemble des "base+offset" -comme dans le couple ci-dessus. - -Additionellement: - - Une des clés, =null= est différenciée. - - - La Map peut être dégradée en =Top=. =Top= est représenté par un - ensemble de clés, et doit être interprété ainsi: - - \[ \top_m(K) = \bigcup_{k \in \top_m(K)} (k, \top_v) \] - - L'intérêt du constructeur =Top= est de pourvoir traquer l'origine - de la dégradation vers =Top=, avec l'argument de type =Origin.t=. - - - On peut voir =Top= comme étant le "mélange" entre les différentes - clés (ceci peut être obtenu par exemple en effectuant un "xor" ou - un "add" entre deux adresses précises). Dans ce cas, $\bigcup_{k - \in \top_m(K)} (k, \top_v)$ n'est pas égal à $\top_m(K)$, mais est - obtenu par réduction de $\top_m(K)$. - - - =Top(top_set)= n'est actuellement pas utilisé (il ne peut être - obtenu que par lecture de =CValue.Model.top=, qui ne devrait - jamais être créé). - -** Treillis hors value -*** TODO =Lmap_bitwise= et =OffsetMap_bitwise= - -Voir [[file:bucket-work.org::*offsetmap%20bitwise%20vs%20offsetmap][offsetmap bitwise vs offsetmap]] - -Contrairement aux offsetmaps, les bitwises n'associent pas des données -aux intervalles, mais à chaque bit. C' est comme si toutes les données -étaient isotropes. - -** TODO L'évaluation et la réduction - -Eval slevel: l'endroit où est paramétré le dataflow de cil. - -** DONE Note sur le fonctionnement des casts aux différents niveaux. - -Dans les différents niveaux, on a les connaissances suivantes: - -- Niveau evaluation (=eval_expr=): on connait les types C (on peut - faire des casts par rapport au type, et on en fait pour toutes les - valeurs récupérées). I.e. c'est là que le + est interprété comme un - "+ modulo taille". - -- Niveau =LMap/Offsetmap=: on ne connait plus les types C, mais on - connait la taille des données (on peut faire des casts par rapport à - la taille). - -- =CValue.V= et en dessous: on ne connait plus ni la taille, ni le - type C. -# (mais il y a la distinction Float/Int du domaine abstrait) - -En théorie, on pourrait ne faire les casts qu'au niveau -=eval_expr/C=. On le fait dans les offsetmap non pas pour diminuer les -intervalles des valeurs stoquees, mais surtout pour la raison -suivante; si on fait un cast de "Null $\to [-128 - 127]$" ou de "Null -$\to [0-255]$" pour 8 bits, on peut le remplacer en un -=Top(None,None,0,1)=, qui permet aux offsetmaps contigus de se -recoller. C'est la raison pour laquelle dans les offsetmap, on fait -des casts au moment de leur écriture. - -** TODO Explication sur le rangement des modules dans les differents repertoires - -ai,value,=memory_state=... - diff --git a/headers/check-headers.sh b/headers/check-headers.sh index f8e1237bcb314f30646febbe109e789ff180350c..7222fcc57e81a21403cde1da221a42514f119696 100755 --- a/headers/check-headers.sh +++ b/headers/check-headers.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/headers/headache.sh b/headers/headache.sh index 6f53d3cdf37cb405af71a4f672b9ecb0bf4123bd..5feb361171791af2a3fff2c1ffc76444b2e323fe 100755 --- a/headers/headache.sh +++ b/headers/headache.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/headers/headache_config.txt b/headers/headache_config.txt index 6582d030537c66c63c539b2b77f99905a5c2032b..cc4ae4918b72d74447f56ad68b86e88b9592378f 100644 --- a/headers/headache_config.txt +++ b/headers/headache_config.txt @@ -12,7 +12,6 @@ | ".*\.c" -> frame open:"/*" line:"*" close:"*/" | ".*\.ast" -> frame open:"//" line:" " close:" " | ".*\.cc" -> frame open:"/*" line:"*" close:"*/" -| "perfcount.c.in" -> frame open: "/*" line: "*" close: "*/" ####### # Asm # @@ -29,12 +28,15 @@ # Makefile # ############ | ".*Make.*" -> frame open:"#" line:"#" close:"#" +| ".*\.mk" -> frame open:"#" line:"#" close:"#" ################# # Shell scripts # ################# | ".*\.sh" -> frame open:"#" line:"#" close:"#" | "autocomplete_frama-c" -> frame open: "#" line: "#" close: "#" +| "_frama-c" -> frame open: "#" line: "#" close: "#" +| ".*_frama-c" -> skip match:"#compdef.*" ################ # Perl scripts # @@ -115,6 +117,7 @@ | "make_release" -> frame open:"#" line:"#" close:"#" | "FAQ" -> frame open:"#" line:"#" close:"#" | "frama-c" -> frame open:"#" line:"#" close:"#" +| "frama-c-config" -> frame open:"#" line:"#" close:"#" | "frama-c-gui" -> frame open:"#" line:"#" close:"#" | "frama-c-gui.byte" -> frame open:"#" line:"#" close:"#" | "frama-c.byte" -> frame open:"#" line:"#" close:"#" diff --git a/headers/header_spec.txt b/headers/header_spec.txt index e344879840855460b369d531c87bd2fbc152426e..1b38283bb74228ce47ee248a0ee858e0297c4792 100644 --- a/headers/header_spec.txt +++ b/headers/header_spec.txt @@ -14,28 +14,30 @@ Makefile.generating: CEA_LGPL README.md: .ignore VERSION: .ignore bin/.gitignore: .ignore -bin/aluminium2silicon.sh: CEA_LGPL -bin/boron2carbon.sh: CEA_LGPL bin/build-src-distrib.sh: .ignore -bin/carbon2nitrogen.sh: CEA_LGPL bin/developers-by-files.sh: CEA_PROPRIETARY -bin/fluorine2neon.sh: CEA_LGPL bin/frama-c: CEA_LGPL +bin/frama-c-config: CEA_LGPL bin/frama-c-gui: CEA_LGPL bin/frama-c-gui.byte: CEA_LGPL bin/frama-c.byte: CEA_LGPL bin/frama-c.top: CEA_LGPL -bin/lithium2beryllium.sh: CEA_LGPL bin/local_export.sh: CEA_LGPL -bin/magnesium2aluminium.sh: CEA_LGPL -bin/neon2sodium.sh: CEA_LGPL -bin/nitrogen2oxygen.sh: CEA_LGPL -bin/oxygen2fluorine.sh: CEA_LGPL +bin/migration_scripts/aluminium2silicon.sh: CEA_LGPL +bin/migration_scripts/boron2carbon.sh: CEA_LGPL +bin/migration_scripts/carbon2nitrogen.sh: CEA_LGPL +bin/migration_scripts/fluorine2neon.sh: CEA_LGPL +bin/migration_scripts/lithium2beryllium.sh: CEA_LGPL +bin/migration_scripts/magnesium2aluminium.sh: CEA_LGPL +bin/migration_scripts/neon2sodium.sh: CEA_LGPL +bin/migration_scripts/nitrogen2oxygen.sh: CEA_LGPL +bin/migration_scripts/oxygen2fluorine.sh: CEA_LGPL +bin/migration_scripts/phosphorus2sulfur.sh: CEA_LGPL +bin/migration_scripts/silicon2phosphorus.sh: CEA_LGPL +bin/migration_scripts/sodium2magnesium.sh: CEA_LGPL bin/sed_get_binutils_version: .ignore bin/sed_get_make_major: .ignore bin/sed_get_make_minor: .ignore -bin/silicon2phosphorus.sh: CEA_LGPL -bin/sodium2magnesium.sh: CEA_LGPL bin/test_all_plugins.sh: CEA_PROPRIETARY config.h.in: CEA_LGPL configure.in: CEA_INRIA_LGPL @@ -108,6 +110,11 @@ opam/opam: .ignore ptests/.gitignore: .ignore ptests/.merlin: .ignore ptests/ptests.ml: CEA_LGPL +share/_frama-c: CEA_LGPL +share/analysis-scripts/frama-c.mk: CEA_LGPL +share/analysis-scripts/README.md: .ignore +share/analysis-scripts/cmd-dep.sh: .ignore +share/analysis-scripts/parse-coverage.sh: .ignore share/autocomplete_frama-c: CEA_LGPL share/Makefile.clean: CEA_LGPL share/Makefile.common: CEA_LGPL @@ -132,7 +139,6 @@ share/framac.vim: .ignore share/libc.c: CEA_LGPL share/libc/__fc_builtin.c: CEA_LGPL share/libc/__fc_builtin.h: CEA_LGPL -share/libc/__fc_builtin_for_normalization.i: CEA_LGPL share/libc/__fc_define_blkcnt_t.h: CEA_LGPL share/libc/__fc_define_blksize_t.h: CEA_LGPL share/libc/__fc_define_dev_t.h: CEA_LGPL @@ -144,11 +150,13 @@ share/libc/__fc_define_id_t.h: CEA_LGPL share/libc/__fc_define_ino_t.h: CEA_LGPL share/libc/__fc_define_intptr_t.h: CEA_LGPL share/libc/__fc_define_iovec.h: CEA_LGPL +share/libc/__fc_define_key_t.h: CEA_LGPL share/libc/__fc_define_mode_t.h: CEA_LGPL share/libc/__fc_define_nlink_t.h: CEA_LGPL share/libc/__fc_define_null.h: CEA_LGPL share/libc/__fc_define_off_t.h: CEA_LGPL share/libc/__fc_define_pid_t.h: CEA_LGPL +share/libc/__fc_define_pthread_types.h: CEA_LGPL share/libc/__fc_define_sa_family_t.h: CEA_LGPL share/libc/__fc_define_seek_macros.h: CEA_LGPL share/libc/__fc_define_sigset_t.h: CEA_LGPL @@ -167,6 +175,7 @@ share/libc/__fc_machdep.h: CEA_LGPL share/libc/__fc_machdep_linux_gcc_shared.h: CEA_LGPL share/libc/__fc_select.h: CEA_LGPL share/libc/__fc_string_axiomatic.h: CEA_LGPL +share/libc/alloca.h: CEA_LGPL share/libc/arpa/inet.h: CEA_LGPL share/libc/assert.c: CEA_LGPL share/libc/assert.h: CEA_LGPL @@ -184,6 +193,7 @@ share/libc/fcntl.h: CEA_LGPL share/libc/features.h: CEA_LGPL share/libc/fenv.h: CEA_LGPL share/libc/float.h: CEA_LGPL +share/libc/fnmatch.h: CEA_LGPL share/libc/getopt.c: CEA_LGPL share/libc/getopt.h: CEA_LGPL share/libc/glob.h: CEA_LGPL @@ -205,6 +215,7 @@ share/libc/locale.c: CEA_LGPL share/libc/locale.h: CEA_LGPL share/libc/math.c: CEA_LGPL share/libc/math.h: CEA_LGPL +share/libc/memory.h: CEA_LGPL share/libc/n1336.pdf: .ignore share/libc/n1362.pdf: .ignore share/libc/net/if.h: CEA_LGPL @@ -215,8 +226,12 @@ share/libc/netinet/ip.h: CEA_LGPL share/libc/netinet/ip_icmp.h: CEA_LGPL share/libc/netinet/tcp.h: CEA_LGPL share/libc/nl_types.h: CEA_LGPL +share/libc/poll.h: CEA_LGPL +share/libc/pthread.h: CEA_LGPL share/libc/pwd.h: CEA_LGPL share/libc/regex.h: CEA_LGPL +share/libc/sched.h: CEA_LGPL +share/libc/semaphore.h: CEA_LGPL share/libc/setjmp.h: CEA_LGPL share/libc/signal.h: CEA_LGPL share/libc/stdarg.h: CEA_LGPL @@ -230,10 +245,15 @@ share/libc/stdlib.h: CEA_LGPL share/libc/string.c: CEA_LGPL share/libc/string.h: CEA_LGPL share/libc/strings.h: CEA_LGPL +share/libc/stropts.h: CEA_LGPL +share/libc/sys/file.h: CEA_LGPL share/libc/sys/ioctl.h: CEA_LGPL +share/libc/sys/ipc.h: CEA_LGPL +share/libc/sys/mman.h: CEA_LGPL share/libc/sys/param.h: CEA_LGPL share/libc/sys/resource.h: CEA_LGPL share/libc/sys/select.h: CEA_LGPL +share/libc/sys/shm.h: CEA_LGPL share/libc/sys/socket.h: CEA_LGPL share/libc/sys/stat.h: CEA_LGPL share/libc/sys/sysctl.h: CEA_LGPL @@ -242,6 +262,7 @@ share/libc/sys/times.h: CEA_LGPL share/libc/sys/types.h: CEA_LGPL share/libc/sys/uio.h: CEA_LGPL share/libc/sys/un.h: CEA_LGPL +share/libc/sys/utsname.h: CEA_LGPL share/libc/sys/wait.h: CEA_LGPL share/libc/syslog.h: CEA_LGPL share/libc/termios.h: CEA_LGPL @@ -249,6 +270,8 @@ share/libc/tgmath.h: CEA_LGPL share/libc/time.h: CEA_LGPL share/libc/uchar.h: CEA_LGPL share/libc/unistd.h: CEA_LGPL +share/libc/utime.h: CEA_LGPL +share/libc/utmpx.h: CEA_LGPL share/libc/wchar.c: CEA_LGPL share/libc/wchar.h: CEA_LGPL share/libc/wctype.h: CEA_LGPL @@ -364,7 +387,8 @@ src/kernel_services/abstract_interp/lmap_bitwise.mli: CEA_LGPL src/kernel_services/abstract_interp/lmap_sig.mli: CEA_LGPL src/kernel_services/abstract_interp/locations.ml: CEA_LGPL src/kernel_services/abstract_interp/locations.mli: CEA_LGPL -src/kernel_services/abstract_interp/map_Lattice.ml: CEA_LGPL +src/kernel_services/abstract_interp/map_lattice.ml: CEA_LGPL +src/kernel_services/abstract_interp/map_lattice.mli: CEA_LGPL src/kernel_services/abstract_interp/offsetmap.ml: CEA_LGPL src/kernel_services/abstract_interp/offsetmap.mli: CEA_LGPL src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli: CEA_LGPL @@ -374,8 +398,6 @@ src/kernel_services/abstract_interp/origin.ml: CEA_LGPL src/kernel_services/abstract_interp/origin.mli: CEA_LGPL src/kernel_services/abstract_interp/tr_offset.ml: CEA_LGPL src/kernel_services/abstract_interp/tr_offset.mli: CEA_LGPL -src/kernel_services/abstract_interp/trace.ml: CEA_LGPL -src/kernel_services/abstract_interp/trace.mli: CEA_LGPL src/kernel_services/analysis/README.md: .ignore src/kernel_services/analysis/bit_utils.ml: CEA_LGPL src/kernel_services/analysis/bit_utils.mli: CEA_LGPL @@ -385,6 +407,8 @@ src/kernel_services/analysis/dataflow2.ml: CEA_LGPL src/kernel_services/analysis/dataflow2.mli: CEA_LGPL src/kernel_services/analysis/dataflows.ml: CIL src/kernel_services/analysis/dataflows.mli: CIL +src/kernel_services/analysis/destructors.ml: CEA_LGPL +src/kernel_services/analysis/destructors.mli: CEA_LGPL src/kernel_services/analysis/dominators.ml: CEA_LGPL src/kernel_services/analysis/dominators.mli: CEA_LGPL src/kernel_services/analysis/exn_flow.ml: CEA_LGPL @@ -399,6 +423,8 @@ src/kernel_services/analysis/service_graph.ml: CEA_LGPL src/kernel_services/analysis/service_graph.mli: CEA_LGPL src/kernel_services/analysis/stmts_graph.ml: CEA_LGPL src/kernel_services/analysis/stmts_graph.mli: CEA_LGPL +src/kernel_services/analysis/undefined_sequence.ml: CEA_LGPL +src/kernel_services/analysis/undefined_sequence.mli: CEA_LGPL src/kernel_services/analysis/wto_statement.ml: CEA_LGPL src/kernel_services/analysis/wto_statement.mli: CEA_LGPL src/kernel_services/ast_data/README.md: .ignore @@ -538,7 +564,6 @@ src/libraries/project/state_topological.ml: MODIFIED_OCAMLGRAPH src/libraries/project/state_topological.mli: MODIFIED_OCAMLGRAPH src/libraries/stdlib/FCBuffer.ml: OCAML_STDLIB src/libraries/stdlib/FCBuffer.mli: OCAML_STDLIB -src/libraries/stdlib/FCDynlink.mli: CEA_LGPL src/libraries/stdlib/FCHashtbl.ml: CEA_LGPL src/libraries/stdlib/FCHashtbl.mli: CEA_LGPL src/libraries/stdlib/FCMap.ml: OCAML_STDLIB @@ -546,9 +571,6 @@ src/libraries/stdlib/FCMap.mli: OCAML_STDLIB src/libraries/stdlib/FCSet.ml: OCAML_STDLIB src/libraries/stdlib/FCSet.mli: OCAML_STDLIB src/libraries/stdlib/README.md: .ignore -src/libraries/stdlib/dynlink_native_ko.ml: CEA_LGPL -src/libraries/stdlib/dynlink_native_ok.ml: CEA_LGPL -src/libraries/stdlib/dynlink_no_native.ml: CEA_LGPL src/libraries/stdlib/extlib.ml: CEA_LGPL src/libraries/stdlib/extlib.mli: CEA_LGPL src/libraries/stdlib/integer.ml: CEA_LGPL @@ -654,6 +676,8 @@ src/plugins/callgraph/options.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/callgraph/register.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/callgraph/services.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/callgraph/services.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/callgraph/subgraph.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/callgraph/subgraph.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/callgraph/uses.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/callgraph/uses.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/constant_propagation/Constant_Propagation.mli: CEA_LGPL_OR_PROPRIETARY @@ -890,13 +914,13 @@ src/plugins/security_slicing/register_gui.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/security_slicing/security_slicing_parameters.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/security_slicing/security_slicing_parameters.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/Slicing.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/slicing/api.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/bts336.c: .ignore src/plugins/slicing/fct_slice.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/fct_slice.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/printSlice.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/printSlice.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/register.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/slicing/register.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/register_gui.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/register_gui.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/slicingActions.ml: CEA_LGPL_OR_PROPRIETARY @@ -911,6 +935,9 @@ src/plugins/slicing/slicingParameters.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/slicingParameters.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/slicingProject.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/slicingProject.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/slicing/slicingSelect.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/slicing/slicingState.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/slicing/slicingState.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/slicingTransform.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing/slicingTransform.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/slicing_types/slicingInternals.ml: CEA_LGPL_OR_PROPRIETARY @@ -930,6 +957,7 @@ src/plugins/value/Value.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/alarmset.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/alarmset.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/abstract_domain.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/simpler_domains.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/apron/apron_domain.ko.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/apron/apron_domain.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/apron/apron_domain.mli: CEA_LGPL_OR_PROPRIETARY @@ -960,6 +988,8 @@ src/plugins/value/domains/cvalue/cvalue_transfer.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/cvalue/cvalue_transfer.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/cvalue/locals_scoping.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/cvalue/locals_scoping.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/cvalue/warn.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/cvalue/warn.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/domain_builder.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/domain_builder.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/domain_lift.ml: CEA_LGPL_OR_PROPRIETARY @@ -977,10 +1007,16 @@ src/plugins/value/domains/gauges/gauges_domain.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/gauges/gauges_domain.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/hcexprs.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/hcexprs.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/inout_domain.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/inout_domain.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/offsm_domain.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/offsm_domain.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/powerset.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/powerset.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/sign_domain.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/sign_domain.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/simple_memory.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/domains/simple_memory.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/symbolic_locs.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/symbolic_locs.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/domains/unit_domain.ml: CEA_LGPL_OR_PROPRIETARY @@ -995,70 +1031,50 @@ src/plugins/value/engine/evaluation.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/evaluation.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/initialization.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/initialization.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/mem_exec2.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/mem_exec2.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/non_linear_evaluation.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/engine/non_linear_evaluation.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/mem_exec.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/mem_exec.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/partitioned_dataflow.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/partitioned_dataflow.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/partitioning.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/partitioning.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/recursion.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/recursion.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/split_return.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/split_return.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/subdivided_evaluation.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/subdivided_evaluation.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/transfer_logic.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/transfer_logic.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/transfer_specification.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/engine/transfer_specification.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/transfer_stmt.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/engine/transfer_stmt.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/eval.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/eval.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/gui_callstacks_filters.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/gui_callstacks_filters.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/gui_files/gui_callstacks_manager.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/gui_files/gui_callstacks_manager.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/gui_eval.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/gui_eval.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/gui_types.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/gui_files/gui_types.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/register_gui.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/gui_files/register_gui.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/legacy/eval_annots.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_behaviors.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_behaviors.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_exprs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_exprs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_funs.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_funs.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_non_linear.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_non_linear.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/legacy/eval_annots.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/legacy/eval_op.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/legacy/eval_op.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_slevel.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_slevel.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_stmt.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/eval_stmt.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/legacy/eval_terms.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/legacy/eval_terms.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/legacy/function_args.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/initial_state.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/initial_state.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/mem_exec.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/mem_exec.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/split_return.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/split_return.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/state_imp.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/state_imp.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/state_set.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/state_set.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/valarms.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/valarms.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/value_messages.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/warn.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/legacy/warn.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/legacy/function_args.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/register.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/register.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/slevel/per_stmt_slevel.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/slevel/per_stmt_slevel.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/slevel/separate.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/slevel/separate.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/slevel/split_strategy.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/slevel/split_strategy.mli: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/slevel/stop_at_nth.ml: CEA_LGPL_OR_PROPRIETARY -src/plugins/value/slevel/stop_at_nth.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/test.assert.sh: .ignore src/plugins/value/test.sh: .ignore src/plugins/value/utils/backward_formals.ml: CEA_LGPL_OR_PROPRIETARY @@ -1098,6 +1114,8 @@ src/plugins/value/values/main_values.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/values/main_values.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/values/offsm_value.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/values/offsm_value.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/values/sign_value.ml: CEA_LGPL_OR_PROPRIETARY +src/plugins/value/values/sign_value.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value/values/value_product.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/value/values/value_product.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/value_types/README.md: .ignore @@ -1126,6 +1144,7 @@ src/plugins/variadic/format_parser.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/variadic/format_parser.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/variadic/format_pprint.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/variadic/format_pprint.mli: CEA_LGPL_OR_PROPRIETARY +src/plugins/variadic/format_string.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/variadic/format_typer.ml: CEA_LGPL_OR_PROPRIETARY src/plugins/variadic/format_typer.mli: CEA_LGPL_OR_PROPRIETARY src/plugins/variadic/format_types.mli: CEA_LGPL_OR_PROPRIETARY @@ -1190,7 +1209,6 @@ src/plugins/wp/GuiSource.ml: CEA_WP src/plugins/wp/GuiSource.mli: CEA_WP src/plugins/wp/GuiTactic.ml: CEA_WP src/plugins/wp/GuiTactic.mli: CEA_WP -src/plugins/wp/INSTALL: .ignore src/plugins/wp/Lang.ml: CEA_WP src/plugins/wp/Lang.mli: CEA_WP src/plugins/wp/Letify.ml: CEA_WP @@ -1276,6 +1294,10 @@ src/plugins/wp/Tactical.ml: CEA_WP src/plugins/wp/Tactical.mli: CEA_WP src/plugins/wp/TacArray.ml: CEA_WP src/plugins/wp/TacArray.mli: CEA_WP +src/plugins/wp/TacBitwised.ml: CEA_WP +src/plugins/wp/TacBitwised.mli: CEA_WP +src/plugins/wp/TacBitrange.ml: CEA_WP +src/plugins/wp/TacBitrange.mli: CEA_WP src/plugins/wp/TacChoice.ml: CEA_WP src/plugins/wp/TacChoice.mli: CEA_WP src/plugins/wp/TacCompound.ml: CEA_WP @@ -1292,10 +1314,16 @@ src/plugins/wp/TacLemma.ml: CEA_WP src/plugins/wp/TacLemma.mli: CEA_WP src/plugins/wp/TacNormalForm.ml: CEA_WP src/plugins/wp/TacNormalForm.mli: CEA_WP +src/plugins/wp/TacOverflow.ml: CEA_WP +src/plugins/wp/TacOverflow.mli: CEA_WP src/plugins/wp/TacRange.ml: CEA_WP src/plugins/wp/TacRange.mli: CEA_WP src/plugins/wp/TacRewrite.ml: CEA_WP src/plugins/wp/TacRewrite.mli: CEA_WP +src/plugins/wp/TacRatio.ml: CEA_WP +src/plugins/wp/TacRatio.mli: CEA_WP +src/plugins/wp/TacShift.ml: CEA_WP +src/plugins/wp/TacShift.mli: CEA_WP src/plugins/wp/TacSplit.ml: CEA_WP src/plugins/wp/TacSplit.mli: CEA_WP src/plugins/wp/TacUnfold.ml: CEA_WP @@ -1575,7 +1603,6 @@ src/plugins/wp/proof.mli: CEA_WP src/plugins/wp/prover.ml: CEA_WP src/plugins/wp/prover.mli: CEA_WP src/plugins/wp/qed/.gitignore: .ignore -src/plugins/wp/qed/.ocp-indent: .ignore src/plugins/wp/qed/Makefile: .ignore src/plugins/wp/qed/README.txt: .ignore src/plugins/wp/qed/old/action.ml: .ignore @@ -1614,7 +1641,6 @@ src/plugins/wp/qed/old/why_parser.ml: .ignore src/plugins/wp/qed/old/why_parser.mli: .ignore src/plugins/wp/qed/src/.feedback: .ignore src/plugins/wp/qed/src/.gitignore: .ignore -src/plugins/wp/qed/src/.ocp-indent: .ignore src/plugins/wp/qed/src/MakeOcaml: CEA_WP src/plugins/wp/qed/src/Makefile: CEA_WP src/plugins/wp/qed/src/Makefile.src: CEA_WP diff --git a/headers/open-source/ACSL_EL b/headers/open-source/ACSL_EL index 85ca50595e079867262844d33316202aaf6aae5c..715f219451c92b4d2b966f1674237bf1f6e9689e 100644 --- a/headers/open-source/ACSL_EL +++ b/headers/open-source/ACSL_EL @@ -4,7 +4,7 @@ This file is part of Frama-C. Copyright (C) 2008-2011 Pierre Roux -Copyright (C) 2009-2016 +Copyright (C) 2009-2017 CEA LIST you can redistribute it and/or modify it under the terms of the GNU diff --git a/headers/open-source/AORAI_LGPL b/headers/open-source/AORAI_LGPL index 4b75f30a9f2a1615cd125e84ff90e13fc9bdb97c..5cae2efbc9e7b543014724f68d1214ae231b5a60 100644 --- a/headers/open-source/AORAI_LGPL +++ b/headers/open-source/AORAI_LGPL @@ -1,7 +1,7 @@ This file is part of Aorai plug-in of Frama-C. -Copyright (C) 2007-2016 +Copyright (C) 2007-2017 CEA (Commissariat à l'énergie atomique et aux énergies alternatives) INRIA (Institut National de Recherche en Informatique et en diff --git a/headers/open-source/CEA_INRIA_LGPL b/headers/open-source/CEA_INRIA_LGPL index 1b46a0c5f26172283379b2bcbc2594b43dcfa888..e3a81856762cbbfb06101280f7838d788a74ba03 100644 --- a/headers/open-source/CEA_INRIA_LGPL +++ b/headers/open-source/CEA_INRIA_LGPL @@ -1,7 +1,7 @@ This file is part of Frama-C. -Copyright (C) 2007-2016 +Copyright (C) 2007-2017 CEA (Commissariat à l'énergie atomique et aux énergies alternatives) INRIA (Institut National de Recherche en Informatique et en diff --git a/headers/open-source/CEA_LGPL b/headers/open-source/CEA_LGPL index beaba80833b5e88b65422b921ecd7e55d1496c31..f153eca74f86a0bc8cac403a87b00933f6bc7adf 100644 --- a/headers/open-source/CEA_LGPL +++ b/headers/open-source/CEA_LGPL @@ -1,7 +1,7 @@ This file is part of Frama-C. -Copyright (C) 2007-2016 +Copyright (C) 2007-2017 CEA (Commissariat à l'énergie atomique et aux énergies alternatives) diff --git a/headers/open-source/CEA_LGPL_OR_PROPRIETARY b/headers/open-source/CEA_LGPL_OR_PROPRIETARY index beaba80833b5e88b65422b921ecd7e55d1496c31..f153eca74f86a0bc8cac403a87b00933f6bc7adf 100644 --- a/headers/open-source/CEA_LGPL_OR_PROPRIETARY +++ b/headers/open-source/CEA_LGPL_OR_PROPRIETARY @@ -1,7 +1,7 @@ This file is part of Frama-C. -Copyright (C) 2007-2016 +Copyright (C) 2007-2017 CEA (Commissariat à l'énergie atomique et aux énergies alternatives) diff --git a/headers/open-source/CEA_PROPRIETARY b/headers/open-source/CEA_PROPRIETARY index 082fc7f17d07fe7ea165996707fc9aca42ab4fd9..865bf3bee2e885c797fc5dfe9b47b7ca08b06ab5 100644 --- a/headers/open-source/CEA_PROPRIETARY +++ b/headers/open-source/CEA_PROPRIETARY @@ -1,7 +1,7 @@ This file is part of Frama-C. -Copyright (C) 2007-2016 +Copyright (C) 2007-2017 CEA (Commissariat à l'énergie atomique et aux énergies alternatives) diff --git a/headers/open-source/CEA_WP b/headers/open-source/CEA_WP index 0fa9a29f85a0f428613b4c4bfad302d749a328d8..07dbe68a1cbd90ec6610f1cc1d660b131ee9690c 100644 --- a/headers/open-source/CEA_WP +++ b/headers/open-source/CEA_WP @@ -1,7 +1,7 @@ This file is part of WP plug-in of Frama-C. -Copyright (C) 2007-2016 +Copyright (C) 2007-2017 CEA (Commissariat a l'energie atomique et aux energies alternatives) diff --git a/headers/updates-headers.sh b/headers/updates-headers.sh index 539a2ec69e0ab31dc18eb885a2cdc92e33f5ca33..d37bfcacd26d5bf751ea5be77083cb6ff48c6287 100755 --- a/headers/updates-headers.sh +++ b/headers/updates-headers.sh @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/man/frama-c.1 b/man/frama-c.1 index 8c6821a9dd5a66c8b59da3d28b7304d0ecdce805..4ca04305c7d12123efaec1c341cc0c91418b202d 100644 --- a/man/frama-c.1 +++ b/man/frama-c.1 @@ -2,7 +2,7 @@ .\" .\" This file is part of Frama-C. .\" -.\" Copyright (C) 2007-2016 +.\" Copyright (C) 2007-2017 .\" CEA (Commissariat à l'énergie atomique et aux énergies .\" alternatives) .\" @@ -251,11 +251,6 @@ display floats with the standard OCaml routine. display float intervals as [ .IR lower_bound ++ width\ ]. .TP -.B [-no]-force-rl-arg-eval -forces right-to-left evaluation order for arguments of function calls. Otherwise -the evaluation order is left unspecified, as in the C standard. Defaults -to no. -.TP .B [-no]-frama-c-stdlib .RB adds\ -I $FRAMAC_SHARE /libc to the options given to the cpp command. @@ -404,14 +399,14 @@ alias of .TP .B -print-plugin-path outputs the directory where Frama-C searches its plugins -(can be overidden by the +(can be overridden by the .B FRAMAC_PLUGIN variable and the .B -add-path option) .TP .B -print-share-path -outputs the directory where Frama-C stores its data (can be overidden by the +outputs the directory where Frama-C stores its data (can be overridden by the .B FRAMAC_SHARE variable) .TP diff --git a/opam/descr b/opam/descr index 896ebc5f7589501e44cc799a431e8e6bbef29fce..20fd9d74930cc52b17fc44a5805718d059fe850d 100644 --- a/opam/descr +++ b/opam/descr @@ -8,6 +8,7 @@ Thanks to this approach, Frama-C provides sophisticated tools, including: - a program proof framework based on weakest precondition calculus (WP plug-in); - a program slicer (Slicing plug-in); - a tool for verification of temporal (LTL) properties (Aoraï plug-in); +- a runtime verification tool (E-ACSL plug-in); - several tools for code base exploration and dependency analysis (plug-ins From, Impact, Metrics, Occurrence, Scope, etc.). These plug-ins communicate between each other via the Frama-C API diff --git a/opam/frama-c/descr b/opam/frama-c/descr index b0cfb60f666475bf2c631a55d02a48794c7a33dc..3151521a21cf8dfaef0cb001d9eb937cdaced15d 100644 --- a/opam/frama-c/descr +++ b/opam/frama-c/descr @@ -8,6 +8,7 @@ Thanks to this approach, Frama-C provides sophisticated tools, including: - a program proof framework based on weakest precondition calculus (WP plug-in); - a program slicer (Slicing plug-in); - a tool for verification of temporal (LTL) properties (Aoraï plug-in); +- a runtime verification tool (E-ACSL plug-in); - several tools for code base exploration and dependency analysis (plug-ins From, Impact, Metrics, Occurrence, Scope, etc.). These plug-ins communicate between each other via the Frama-C API diff --git a/opam/frama-c/opam b/opam/frama-c/opam index c8a75027626bfb85a7f0afb692bfe34f8c079036..fc77af319bb57fb81103768f972c0415d0211209 100644 --- a/opam/frama-c/opam +++ b/opam/frama-c/opam @@ -1,8 +1,10 @@ opam-version: "1.2" name: "frama-c" -version: "20161101" +version: "20170501" maintainer: "francois.bobot@cea.fr" authors: [ + "Michele Alberti" + "Gergö Barany" "Patrick Baudin" "François Bobot" "Richard Bonichon" @@ -14,6 +16,8 @@ authors: [ "Jean-Christophe Filliâtre" "Philippe Herrmann" "Florent Kirchner" + "Tristan Le Gall" + "Jean-Christophe Léchenet" "Matthieu Lemerre" "David Maison" "Claude Marché" @@ -27,12 +31,13 @@ authors: [ "Armand Puccetti" "Muriel Roger" "Julien Signoles" + "Kostyantyn Vorobyov" "Boris Yakobowski" ] homepage: "http://frama-c.com/" license: "GNU Lesser General Public License version 2.1" dev-repo: "https://github.com/Frama-C/Frama-C-snapshot.git" -doc: ["http://frama-c.com/download/user-manual-Silicon-20161101.pdf"] +doc: ["http://frama-c.com/download/user-manual-Phosphorus-20170501.pdf"] bug-reports: "https://bts.frama-c.com/" tags: [ "deductive" @@ -50,7 +55,7 @@ tags: [ ] depends: [ - "frama-c-base" { = "20161101" } + "frama-c-base" { = "20170501" } "lablgtk" { >= "2.18.2" } #for ocaml >= 4.02.1 "conf-gtksourceview" "conf-gnomecanvas" diff --git a/opam/opam b/opam/opam index 3204e3db04bd38989966ed45b3da5b59dd166602..a7a66e3fe2449698819c39319e838913f03aad12 100644 --- a/opam/opam +++ b/opam/opam @@ -1,8 +1,10 @@ opam-version: "1.2" name: "frama-c-base" -version: "20161101" +version: "20170501" maintainer: "francois.bobot@cea.fr" authors: [ + "Michele Alberti" + "Gergö Barany" "Patrick Baudin" "François Bobot" "Richard Bonichon" @@ -14,6 +16,8 @@ authors: [ "Jean-Christophe Filliâtre" "Philippe Herrmann" "Florent Kirchner" + "Tristan Le Gall" + "Jean-Christophe Léchenet" "Matthieu Lemerre" "David Maison" "Claude Marché" @@ -27,12 +31,13 @@ authors: [ "Armand Puccetti" "Muriel Roger" "Julien Signoles" + "Kostyantyn Vorobyov" "Boris Yakobowski" ] homepage: "http://frama-c.com/" license: "GNU Lesser General Public License version 2.1" dev-repo: "https://github.com/Frama-C/Frama-C-snapshot.git" -doc: ["http://frama-c.com/download/user-manual-Silicon-20161101.pdf"] +doc: ["http://frama-c.com/download/user-manual-Phosphorus-20170501.pdf"] bug-reports: "https://bts.frama-c.com/" tags: [ "deductive" @@ -47,6 +52,7 @@ tags: [ "weakest precondition" "ACSL" "dataflow analysis" + "runtime verification" ] build: [ @@ -89,6 +95,7 @@ depends: [ "ocamlgraph" { >= "1.8.5" & < "1.9~" } "ocamlfind" "zarith" + "conf-autoconf" ] depopts: [ @@ -108,6 +115,8 @@ conflicts: [ "why3-base" { < "0.86" } #for WP plug-in "coq" { < "8.4.6" } #for WP plug-in "lablgtk" { < "2.18.2" } #for ocaml >= 4.02.1 + "frama-c-e-acsl" #avoid mixing old releases of E-ACSL, it is already + #distributed with this version of Frama-C ] available: [ ocaml-version >= "4.02.3" ] diff --git a/ptests/ptests.ml b/ptests/ptests.ml index 4949cb7a2b9623df84b762530f46c90c76d7b124..80853bb74f848302e1f5d13ecd12284632e8bae6 100644 --- a/ptests/ptests.ml +++ b/ptests/ptests.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -133,18 +133,6 @@ let opt_to_byte toplevel = let opt_to_byte_options options = str_global_replace regex_cmxs "\\1.cmo\\2" options -let needs_byte = - let load_something = Str.regexp ".*-load-\\(\\(script\\)\\|\\(module\\)\\)" in - fun options -> - Ptests_config.no_native_dynlink && - str_string_match load_something options 0 - -let execnow_needs_byte = - let make_cmxs = Str.regexp ".*make.*[.]cmxs" in - fun cmd -> - Ptests_config.no_native_dynlink && - str_string_match make_cmxs cmd 0 - let execnow_opt_to_byte cmd = let cmd = opt_to_byte cmd in opt_to_byte_options cmd @@ -924,8 +912,7 @@ let basic_command_string = command.log_files <- logfiles; let has_ptest_file_t, toplevel = replace_macros macros command.toplevel in let has_ptest_file_o, options = replace_macros macros command.options in - let needs_byte = !use_byte || needs_byte options in - let toplevel = if needs_byte then opt_to_byte toplevel else toplevel in + let toplevel = if !use_byte then opt_to_byte toplevel else toplevel in let options = if str_string_match contains_toplevel_or_frama_c command.toplevel 0 then begin @@ -934,7 +921,7 @@ let basic_command_string = "-check " ^ opt_pre ^ " " ^ options ^ " " ^ opt_post end else options in - let options = if needs_byte then opt_to_byte_options options else options in + let options = if !use_byte then opt_to_byte_options options else options in if has_ptest_file_t || has_ptest_file_o || command.execnow then toplevel ^ " " ^ options else @@ -1173,9 +1160,11 @@ let do_command command = ignore (launch basic_command_string) end else begin + (* command string also replaces macros in logfiles names, which + is useful for Examine as well. *) + let command_string = command_string command in if !behavior <> Examine then begin - let command_string = command_string command in if !verbosity >= 1 then lock_printf "%% launch %s@." command_string ; let launch_result = launch command_string in @@ -1245,7 +1234,7 @@ let do_command command = then begin remove_execnow_results execnow; let cmd = - if !use_byte || execnow_needs_byte execnow.ex_cmd then + if !use_byte then execnow_opt_to_byte execnow.ex_cmd else execnow.ex_cmd diff --git a/share/Makefile.clean b/share/Makefile.clean index 6dcc204c38f4a60715c1869ac7c2ecb72d73adff..05157067fe3ded15b098cf8f1c8f43d8152530aa 100644 --- a/share/Makefile.clean +++ b/share/Makefile.clean @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/Makefile.common b/share/Makefile.common index 1db84ce3a7b2c230bb32d72745ff059cdc20d53e..e768789e4e44e6c6fb66e070232ff57f9ac01d19 100644 --- a/share/Makefile.common +++ b/share/Makefile.common @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -76,13 +76,44 @@ endif # warnings -warn-error has effect only for warnings that are # explicitly set using '-w'. ifeq ($(DEVELOPMENT),yes) -# Most warnings are activated by default. The few that are deactivated are -# impossible to silence with the current Frama-C. Those settings are inherited +# Most warnings are activated by default. Those settings are inherited # in the compilation of external plugins. +# - 4 (fragile pattern-matching) only make sense when adding a node to a type. +# OCaml GPR #1071 will make it usable +# - 6 (omit label in application) would make code clearer, but requires +# refactoring before being enabled. +# - 9 (missing field in record pattern) is much too heavy. Most of the time +# not all fields are relevant in patter-matching Frama-C's AST. +# - 41 (ambiguous constructor or label name) prevents type-based +# disambiguation, a feature which is seen as a good thing by many developers +# - 44 (open shadows an identifier) +# - 45 (open shadows a label or constructor): While the use of open directives +# is supposed to stay small, it should still be possible to open modules +# that share common names, barring some mechanism to open only parts of a +# module. +# - 48 (implicit elimination of optional arguments): makes use of functions +# with optional arguments heavier in higher-order context + WARNINGS ?= -w +a-4-6-9-41-44-45-48-50 -WARN_ERROR ?= -warn-error +a-3-32-33-34-35-36-37-38-39-58 + +# - 3 (deprecated feature) cannot always be avoided for OCaml stdlib when +# supporting several OCaml versions +# - 4 (fragile pattern matching) will be activated when adding a node (see +# above), in order to let the developer decide whether a case should be +# added on relevant fragile pattern or not: a matching might very well stay +# fragile without triggering an error. +# - 3x (various categories of unused identifiers) it is sometimes useful to +# let code compile despite such warnings when in the middle of a development. +# On the other hand, a completed feature should not trigger such warnings. +# - 58 (missing cmx) is triggered by some versions of external libraries. +# Situation should probably improve as these libraries get updated, leading +# to treat this warning as error. +WARN_ERROR ?= -warn-error +a-3-4-32-33-34-35-36-37-38-39-58 + else + WARNINGS ?= -w -a + endif #DEVELOPMENT FLAGS = $(WARNINGS) $(WARN_ERROR) $(OCAML_ANNOT_OPTION) -strict-sequence \ diff --git a/share/Makefile.config.in b/share/Makefile.config.in index afac49c37413cca4feb149e058a187c02620fbe1..f97c849ba2c810169b481f718f02e142d1aaf01b 100644 --- a/share/Makefile.config.in +++ b/share/Makefile.config.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -48,6 +48,7 @@ FRAMAC_PLUGINDIR ?=$(FRAMAC_LIBDIR)/plugins FRAMAC_DATADIR ?=$(DATADIR)/frama-c EMACS_DATADIR ?=$(DATADIR)/emacs/site-lisp FRAMAC_DEFAULT_CPP ?=@FRAMAC_DEFAULT_CPP@ +FRAMAC_DEFAULT_CPP_ARGS ?= @FRAMAC_DEFAULT_CPP_ARGS@ FRAMAC_GNU_CPP ?=@FRAMAC_GNU_CPP@ DEFAULT_CPP_KEEP_COMMENTS?=@DEFAULT_CPP_KEEP_COMMENTS@ DEFAULT_CPP_SUPPORTED_ARCH_OPTS?=@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@ @@ -76,8 +77,6 @@ OCAMLLIB ?=@OCAMLLIB@ # either opt or byte OCAMLBEST ?=@OCAMLBEST@ OCAMLVERSION ?=@OCAMLVERSION@ -NATIVE_DYNLINK ?=@HAS_NATIVE_DYNLINK@ -USABLE_NATIVE_DYNLINK ?=@HAS_USABLE_NATIVE_DYNLINK@ NATIVE_THREADS ?=@HAS_NATIVE_THREADS@ OCAMLWIN32 ?=@OCAMLWIN32@ PTESTSBEST ?=@PTESTSBEST@ @@ -152,23 +151,6 @@ ENABLE_SPARECODE ?=@ENABLE_SPARECODE@ ENABLE_USERS ?=@ENABLE_USERS@ ENABLE_VALUE_ANALYSIS ?=@ENABLE_VALUE_ANALYSIS@ -DYNAMIC_CALLGRAPH ?=@DYNAMIC_CALLGRAPH@ -DYNAMIC_CONSTANT_PROPAGATION ?=@DYNAMIC_SEMANTIC_CONSTANT_FOLDING@ -DYNAMIC_FROM_ANALYSIS ?=@DYNAMIC_FROM_ANALYSIS@ -#DYNAMIC_GUI: never dynamic -DYNAMIC_IMPACT ?=@DYNAMIC_IMPACT@ -DYNAMIC_INOUT ?=@DYNAMIC_INOUT@ -DYNAMIC_METRICS ?=@DYNAMIC_METRICS@ -DYNAMIC_OCCURRENCE ?=@DYNAMIC_OCCURRENCE@ -DYNAMIC_PDG ?=@DYNAMIC_PDG@ -DYNAMIC_POSTDOMINATORS ?=@DYNAMIC_POSTDOMINATORS@ -DYNAMIC_RTEGEN ?=@DYNAMIC_RTEGEN@ -DYNAMIC_SCOPE ?=@DYNAMIC_SCOPE@ -DYNAMIC_SLICING ?=@DYNAMIC_SLICING@ -DYNAMIC_SPARECODE ?=@DYNAMIC_SPARECODE@ -DYNAMIC_USERS ?=@DYNAMIC_USERS@ -DYNAMIC_VALUE_ANALYSIS ?=@DYNAMIC_VALUE_ANALYSIS@ - #bytes is part of the stdlib, but is used as a transitional package. LIBRARY_NAMES := findlib ocamlgraph num unix str dynlink bytes zarith diff --git a/share/Makefile.dynamic b/share/Makefile.dynamic index 96552203d29dffda6bbc379c237b01acbf72c34f..d09f4673faf026e611761abcdae11bf478e4a4dd 100644 --- a/share/Makefile.dynamic +++ b/share/Makefile.dynamic @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -33,14 +33,6 @@ ifndef MAKECONFIG_DIR MAKECONFIG_DIR :=$(FRAMAC_SHARE) endif -ifndef PLUGIN_DYNAMIC -PLUGIN_DYNAMIC :=yes -endif - -ifeq ($(NATIVE_DYNLINK),no) -USABLE_NATIVE_DYNLINK ?=no -endif - #Do not generate documentation for this. PLUGIN_UNDOC:=$(PLUGIN_UNDOC) @@ -135,12 +127,7 @@ $(PLUGIN_DIR)/tests/ptests_config: $(PTESTS_DEP) $(MKDIR) tests $(RM) $$@ $(ECHO) "DEFAULT_SUITES=" $(PLUGIN_TESTS_DIRS) > $$@ - if test "$(USABLE_NATIVE_DYNLINK)" = "yes" \ - -o "$(FRAMAC_INTERNAL)" = "yes"; then \ - $(ECHO) "TOPLEVEL_PATH=$(FRAMAC_OPT)" >> $$@; \ - else \ - $(ECHO) "TOPLEVEL_PATH=./frama-c-$(PLUGIN_NAME).$(OCAMLBEST)$(EXE)\";;" >> $$@; \ - fi + $(ECHO) "TOPLEVEL_PATH=$(FRAMAC_OPT)" >> $$@; $(ECHO) "FRAMAC_SHARE=$(FRAMAC_SHARE)" >> $$@ $(ECHO) "FRAMAC_LIB=$(FRAMAC_LIB)" >> $$@ if test "$(FRAMAC_INTERNAL)" = "no"; then \ @@ -197,67 +184,31 @@ $(eval $(call include_generic_plugin_Makefile,$(PLUGIN_NAME))) TARGETS := $(TARGET_META) $(TARGET_CMI) TARGETS_TOP := $(TARGET_TOP_CMO) $(TARGET_TOP_CMX) \ $(TARGET_TOP_CMA) $(TARGET_TOP_CMXS) -TARGETS_GUI := $(TARGET_GUI_CMI) $(TARGET_GUI_CMO) \ - $(TARGET_GUI_CMX) $(TARGET_GUI_CMXS) +TARGETS_GUI_BYTE := $(TARGET_GUI_CMI) $(TARGET_GUI_CMO) +TARGETS_GUI := $(TARGETS_GUI_BYTE) $(TARGET_GUI_CMX) $(TARGET_GUI_CMXS) TARGETS_BYTE:= $(TARGET_META) $(TARGET_CMI) $(TARGET_TOP_CMO) $(TARGET_TOP_CMA) TARGETS_OPT:= $(TARGET_META) $(TARGET_CMI) $(TARGET_TOP_CMX) $(TARGET_TOP_CMXS) -include $(MAKECONFIG_DIR)/Makefile.kernel - byte:: $(TARGETS_BYTE) opt:: $(TARGETS_OPT) +ifeq ($(OCAMLBEST),byte) +gui:: $(TARGETS_GUI_BYTE) +else gui:: $(TARGETS_GUI) +endif # do not define additional targets if you come from the Frama-C Makefile ifneq ($(FRAMAC_INTERNAL),yes) -################## -# Static Linking # -################## - -$(PLUGIN_DIR)/frama-c-$(PLUGIN_NAME).byte$(EXE): $(TARGET_TOP_CMO) - $(PRINT_LINKING) $@ - $(OCAMLC) $(PLUGIN_LINK_BFLAGS) $(DYN_BLINKFLAGS) \ - -o $@ $(DYN_BYTE_LIBS) $(DYN_GEN_BYTE_LIBS) \ - $(patsubst %boot.cmo,\ - $(PLUGIN_EXTRA_BYTE) $(TARGET_TOP_CMO) %boot.cmo,\ - $(DYN_ALL_BATCH_CMO)) - -$(PLUGIN_DIR)/frama-c-$(PLUGIN_NAME).opt$(EXE): $(TARGET_TOP_CMX) - $(PRINT_LINKING) $@ - $(OCAMLOPT) $(PLUGIN_LINK_OFLAGS) $(DYN_OLINKFLAGS) \ - -o $@ $(DYN_OPT_LIBS) $(DYN_GEN_OPT_LIBS) \ - $(patsubst %boot.cmx,\ - $(PLUGIN_EXTRA_OPT) $(TARGET_TOP_CMX) %boot.cmx,\ - $(DYN_ALL_BATCH_CMX)) - -static.byte:: $(PLUGIN_DIR)/frama-c-$(PLUGIN_NAME).byte$(EXE) -static.opt:: $(PLUGIN_DIR)/frama-c-$(PLUGIN_NAME).opt$(EXE) -static:: $(PLUGIN_DIR)/frama-c-$(PLUGIN_NAME).byte$(EXE) \ - $(PLUGIN_DIR)/frama-c-$(PLUGIN_NAME).$(OCAMLBEST)$(EXE) - ################### # Clean & Install # ################### -.PHONY: tests all install uninstall clean depend $(PLUGIN_NAME)_CLEAN_DYNAMIC - -clean:: $(PLUGIN_NAME)_CLEAN_DYNAMIC - -$(PLUGIN_NAME)_CLEAN_DYNAMIC: - $(RM) $($(patsubst %_CLEAN_DYNAMIC,%_DIR,$@))/tests/ptests_config - $(RM) frama-c-$($(patsubst %_CLEAN_DYNAMIC,,$@)) \ - frama-c-$($(patsubst %_CLEAN_DYNAMIC,,$@)).byte +.PHONY: tests all install uninstall clean depend dist-clean distclean: $(PLUGIN_DIR)/$(PLUGIN_NAME)_DIST_CLEAN -ifeq ($(USABLE_NATIVE_DYNLINK),no) -STATIC=static -else -STATIC= -endif - -all:: $(PLUGIN_DIR)/.depend byte $(OCAMLBEST) gui $(STATIC) plugins_ptests_config +all:: $(PLUGIN_DIR)/.depend byte $(OCAMLBEST) gui plugins_ptests_config ifneq ($(PLUGIN_ENABLE),no) diff --git a/share/Makefile.dynamic_config.external b/share/Makefile.dynamic_config.external index 4557245c4c74f59f704a984c8c1aa130262dd349..dd0940f7370617aa486ea8b46460fd4b6e0bff27 100644 --- a/share/Makefile.dynamic_config.external +++ b/share/Makefile.dynamic_config.external @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/Makefile.dynamic_config.internal b/share/Makefile.dynamic_config.internal index 78594bf371298514c65e9cc359522ae7057c8c0f..e9af9592e5c00ab15327fa6979af6df20d9e2cc2 100644 --- a/share/Makefile.dynamic_config.internal +++ b/share/Makefile.dynamic_config.internal @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/Makefile.generic b/share/Makefile.generic index e3143273c6ce300d375ac9ca696fe67f49beca6d..f97bb357a1b29c9649a14f5ceaeeda1d966058ed 100644 --- a/share/Makefile.generic +++ b/share/Makefile.generic @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/Makefile.plugin.template b/share/Makefile.plugin.template index c1517f8ff86c630182a71b3658713fdaf5fea74f..4dfe3a5adfdf096d67a723892ee2bd0cb687d2d6 100644 --- a/share/Makefile.plugin.template +++ b/share/Makefile.plugin.template @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -39,8 +39,6 @@ endif PLUGIN_DIR?= PLUGIN_ENABLE?= # Whether the plugin is enabled PLUGIN_DEPENDS?= # Deprecated (static plug-in dependencies, Frama-C only) -PLUGIN_DYNAMIC?= # Set it to yes if the plugin is only - # dynamically linked with Frama-C. # META file # --------- @@ -177,10 +175,15 @@ PLUGIN_RESET?=yes # Set it to no in order to NOT reset plug-in variable. # Where the other plug-ins to load are already installed ifeq ($(FRAMAC_INTERNAL),yes) INSTALLED_PLUGIN_DIR:=$(FRAMAC_ROOT_SRCDIR)/lib/plugins +# Also inform the main Makefile that there's another plug-in to be +# considered +PLUGIN_LIST+=$(PLUGIN_DIR)/@PLUGIN_NAME@ + else + INSTALLED_PLUGIN_DIR:=$(PLUGIN_INSTALL_DIR) -endif +endif # The plugin types .cm* files PLUGIN_TYPES_CMO:=$(addsuffix .cmo,$(PLUGIN_TYPES_CMO)) @@ -318,11 +321,7 @@ else TARGET_TOP_CMXA:= endif -ifeq ("$(USABLE_NATIVE_DYNLINK) $(PLUGIN_DYNAMIC)","yes yes") TARGET_TOP_CMXS:= $(TARGET_TOP_CMX:.cmx=.cmxs) -else -TARGET_TOP_CMXS:= -endif # The packed files for GUI mode (in directory 'gui') ifeq ($(HAS_GUI),yes) @@ -332,12 +331,8 @@ TARGET_GUI_CMI:= $(TARGET_GUI_CMO:.cmo=.cmi) TARGET_GUI_CMX:= $(TARGET_GUI_CMO:.cmo=.cmx) TARGET_GUI_CMA:= $(TARGET_GUI_CMO:.cmo=.cma) TARGET_GUI_CMXA:= $(TARGET_GUI_CMX:.cmx=.cmxa) -ifeq ("$(USABLE_NATIVE_DYNLINK) $(PLUGIN_DYNAMIC)","yes yes") TARGET_GUI_CMXS:= $(TARGET_GUI_CMO:.cmo=.cmxs) else -TARGET_GUI_CMXS:= -endif -else TARGET_GUI_MLI:= TARGET_GUI_CMO:= TARGET_GUI_CMI:= @@ -467,9 +462,7 @@ META.$(PLUGIN_PKG).NATIVE :=@PLUGIN_NAME@.cmxa else META.$(PLUGIN_PKG).NATIVE :=@PLUGIN_NAME@.cmx endif -ifeq ("$(USABLE_NATIVE_DYNLINK) $(PLUGIN_DYNAMIC)","yes yes") META.$(PLUGIN_PKG).PLUGIN :=@PLUGIN_NAME@.cmxs -endif ifeq ($(FRAMAC_INTERNAL),yes) # In internal mode, we depend on the main Makefile for plugins that do not @@ -573,14 +566,12 @@ $(TARGET_TOP_CMX): $(PLUGIN_CMX) \ $(@PLUGIN_NAME@_TARGET_OFLAGS) \ $(@PLUGIN_NAME@_CMI_ONLY) $(@PLUGIN_NAME@_CMX) -ifeq ("$(USABLE_NATIVE_DYNLINK) $(PLUGIN_DYNAMIC)","yes yes") $(TARGET_TOP_CMXS): $(TARGET_TOP_CMX) $(PLUGIN_EXTRA_OPT) $(PRINT_PACKING) $@ $(OCAMLOPT) -o $(call winpath,$@) -shared \ $(@PLUGIN_NAME@_OFLAGS) \ $(@PLUGIN_NAME@_EXTRA_OPT) \ $(@:.cmxs=.cmx) -endif ifdef PLUGIN_EXTRA_BYTE $(TARGET_TOP_CMA): $(PLUGIN_EXTRA_BYTE) $(TARGET_TOP_CMO) @@ -631,7 +622,6 @@ $(TARGET_GUI_CMX): $(PLUGIN_GUI_CMX) $(TARGET_CMI) $(TARGET_GUI_CMI) $(@PLUGIN_NAME@_GUI_CMI_ONLY) \ $(@PLUGIN_NAME@_GUI_CMX) -ifeq ("$(USABLE_NATIVE_DYNLINK) $(PLUGIN_DYNAMIC)","yes yes") $(TARGET_GUI_CMXS): $(TARGET_GUI_CMX) $(PRINT_PACKING) $@ $(MKDIR) $(PLUGIN_LIB_DIR)/gui @@ -640,7 +630,6 @@ $(TARGET_GUI_CMXS): $(TARGET_GUI_CMX) $(@PLUGIN_NAME@_GUI_TARGET_OFLAGS) \ $(@PLUGIN_NAME@_EXTRA_OPT) \ $^ -endif ifdef PLUGIN_EXTRA_BYTE $(TARGET_GUI_CMA): $(PLUGIN_EXTRA_BYTE) $(TARGET_GUI_CMO) @@ -752,25 +741,24 @@ endif $(PLUGIN_DOC_DIR)/@PLUGIN_NAME@.txt \ $(PLUGIN_DOC_DIR)/modules.svg \ $(DOC_PLUGIN) - $(PRINT_DOC) $(patsubst %_DOC,%,$@) - $(MKDIR) $($@_DIR) - $(RM) $($@_DIR)/*.html + $(PRINT_DOC) @PLUGIN_NAME@ + $(MKDIR) $(@PLUGIN_NAME@_DOC_DIR) + $(RM) $(@PLUGIN_NAME@_DOC_DIR)/*.html # Only generate toc for kernel's documentation if we are in Frama-C's main # Makefile ifeq ($(FRAMAC_INTERNAL),yes) - $(ECHO) '<li><a href="$(subst $(DOC_DIR)/,,$($@_DIR))/index.html">$(subst _, ,$(patsubst %_DOC,%,$@))</a></li>' > $(DOC_DIR)/$(patsubst %_DOC,%,$@).toc + $(ECHO) '<li><a href="$(subst $(DOC_DIR)/,,$(@PLUGIN_NAME@_DOC_DIR))/index.html">$(subst _, ,@PLUGIN_NAME@)</a></li>' > $(DOC_DIR)/@PLUGIN_NAME@.toc endif - $(OCAMLDOC) $($@FLAGS) \ - -t "$(patsubst %_DOC,%,$@) plugin" \ - -intro $($@_DIR)/$(patsubst %_DOC,%,$@).txt \ + $(OCAMLDOC) $(@PLUGIN_NAME@_DOCFLAGS) \ + -t "@PLUGIN_NAME@ plugin" \ -css-style ../style.css \ - -d $($@_DIR) -g $(DOC_PLUGIN) -passopt -docpath $(DOC_DIR)/html \ + -d $(@PLUGIN_NAME@_DOC_DIR) -g $(DOC_PLUGIN) -passopt -docpath $(DOC_DIR)/html \ $(addprefix -load ,$(wildcard $(DOC_DIR)/kernel-doc.ocamldoc)) \ - $(wildcard $($@_SRC)) + $(wildcard $(@PLUGIN_NAME@_DOC_SRC)) # [rb+js] 20090619 # pwd is required to avoid "bad directory" message on OpenBSD # don't know why - cd `pwd`/$($(patsubst %_DOC,%_DOC_DIR,$@)); \ + cd `pwd`/$(@PLUGIN_NAME@_DOC_DIR); \ for f in $(foreach f,$(@PLUGIN_NAME@_TYPES_TODOC),\ $(basename $(notdir $f))); do \ for g in \ @@ -958,11 +946,7 @@ $(PLUGIN_DIR)/@PLUGIN_NAME@_CLEAN_DOC: $(@PLUGIN_NAME@_DOC_DIR) PLUGIN_GENERATED_LIST += $(PLUGIN_GENERATED) -ifeq ($(PLUGIN_DYNAMIC),yes) -#dynamic plugin PLUGIN_META_LIST += $(TARGET_META) -PLUGIN_DYN_EXISTS:=yes -PLUGIN_DYN_LIST += $(PLUGIN_DIR)/@PLUGIN_NAME@ PLUGIN_DYN_CMI_LIST += $(TARGET_CMI) ifdef PLUGIN_EXTRA_BYTE .PRECIOUS: $(TARGET_TOP_CMO) @@ -980,7 +964,6 @@ PLUGIN_DYN_GUI_CMO_LIST += $(TARGET_GUI_CMO) endif #EXTRA_BYTE endif #HAS_GUI -ifeq ($(USABLE_NATIVE_DYNLINK),yes) PLUGIN_DYN_DEP_GUI_CMX_LIST += $(PLUGIN_GUI_CMX) PLUGIN_DYN_CMX_LIST += $(TARGET_TOP_CMXS) $(TARGET_TOP_CMX) # If P1 depends on P2, then dynamically link P1.cmxs requires to have @@ -990,38 +973,7 @@ PLUGIN_DYN_CMX_LIST += $(TARGET_TOP_CMXA) endif #EXTRA_OPT ifeq ($(HAS_GUI),yes) PLUGIN_DYN_GUI_CMX_LIST += $(TARGET_GUI_CMXS) -endif -else # No native dynlink: use a static version -PLUGIN_CMX_LIST += $(TARGET_TOP_CMX) -ifdef PLUGIN_EXTRA_OPT -EXTRA_OPT_LIBS+= $(PLUGIN_EXTRA_OPT) -endif -ifeq ($(HAS_GUI),yes) -PLUGIN_GUI_CMX_LIST += $(TARGET_GUI_CMX) endif # HAS_GUI -endif # USABLE_NATIVE_DYNLINK - -else # Normal plugin -PLUGIN_LIST += $(PLUGIN_DIR)/@PLUGIN_NAME@ -ifdef PLUGIN_EXTRA_BYTE -.PRECIOUS: $(TARGET_TOP_CMO) $(TARGET_GUI_CMO) -PLUGIN_CMO_LIST += $(TARGET_TOP_CMA) -PLUGIN_GUI_CMO_LIST += $(TARGET_GUI_CMA) -else -PLUGIN_CMO_LIST += $(TARGET_TOP_CMO) -PLUGIN_GUI_CMO_LIST += $(TARGET_GUI_CMO) -endif -ifdef PLUGIN_EXTRA_OPT -.PRECIOUS: $(TARGET_TOP_CMX) $(TARGET_GUI_CMX) -PLUGIN_CMX_LIST += $(TARGET_TOP_CMXA) -PLUGIN_GUI_CMX_LIST += $(TARGET_GUI_CMXA) -DEP_CMXS=$(TARGET_TOP_CMXA) -else -PLUGIN_CMX_LIST += $(TARGET_TOP_CMX) -PLUGIN_GUI_CMX_LIST += $(TARGET_GUI_CMX) -DEP_CMXS=$(TARGET_TOP_CMX) -endif -endif PLUGIN_INTERNAL_CMO_LIST += $(PLUGIN_CMO) PLUGIN_INTERNAL_CMX_LIST += $(PLUGIN_CMX) @@ -1055,7 +1007,6 @@ PLUGIN_OFLAGS:= PLUGIN_DEPFLAGS:= PLUGIN_DOCFLAGS:= PLUGIN_GENERATED:= -PLUGIN_DYNAMIC:= PLUGIN_TYPES_CMO:= PLUGIN_GUI_CMO:= PLUGIN_GUI_CMX:= diff --git a/share/_frama-c b/share/_frama-c index 9ae7aae8e22a73956bacc29136048a19daae1e28..51ac788669e9b56fb1aab86996a02cc53df5eb2f 100644 --- a/share/_frama-c +++ b/share/_frama-c @@ -1,4 +1,25 @@ #compdef frama-c frama-c-gui frama-c.byte frama-c-gui.byte +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2017 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## # zsh completion for Frama-C # ========================== diff --git a/share/_frama-c.zsh b/share/_frama-c.zsh index 1bcece61d2f08a3b888ac69f7323062a3e13981d..8dda747e2e0f3e1d551c5cc0654e0aec1446eec3 100644 --- a/share/_frama-c.zsh +++ b/share/_frama-c.zsh @@ -81,7 +81,7 @@ kernel_arguments=( _value_msg_key () { _values -s , 'value keys' \ - "\*" "callbacks" "cardinal" "d-eq" "experimental-ok" "imprecision" \ + "\*" "callbacks" "cardinal" "d-eqs" "experimental-ok" "imprecision" \ "initial_state" "malloc" "nonlin" "restart" "strlen" } @@ -92,7 +92,6 @@ value_builtins=( "memset:b:(Frama_C_memset)" "strchr:b:(Frama_C_strchr)" "strlen:b:(Frama_C_strlen)" "strnlen:b:(Frama_C_strnlen)" - "bzero:b:(Frama_C_bzero)" "floor:b:(Frama_C_floor)" "floorf:b:(Frama_C_floorf)" "round:b:(Frama_C_round)" "roundf:b:(Frama_C_roundf)" "atan2:b:(Frama_C_atan2)" @@ -106,7 +105,8 @@ value_builtins=( "printf:b:(Frama_C_printf)" "sprintf:b:(Frama_C_sprintf)" "snprintf:b:(Frama_C_snprintf)" "free:b:(Frama_C_free)" - "malloc:b:(Frama_C_alloc_by_stack Frama_C_alloc_size Frama_C_alloc_size_weak)" + "malloc:b:(Frama_C_malloc_by_stack Frama_C_malloc_fresh Frama_C_malloc_fresh_weak)" + "calloc:b:(Frama_C_calloc_by_stack Frama_C_calloc_fresh)" "realloc:b:(Frama_C_realloc Frama_C_realloc_multiple)" ) diff --git a/share/analysis-scripts/README.md b/share/analysis-scripts/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2ac6195a0703a8f074d1d3e30d828a93e2b8803e --- /dev/null +++ b/share/analysis-scripts/README.md @@ -0,0 +1,203 @@ +This directory contains a set of a Makefile and several bash scripts which +can be used to simplify non-trivial analyses with Frama-C and some of its +plugins, in particular EVA. +This Makefile can be included in your own Makefile for the following advantages. + +1. It ensures that no unnecessary work is done. If you change the Makefile, + targets that have their command line affected will be rebuilt, but any + target for which the command line doesn't change won't be rebuilt. +2. It provides commonly used default parameters for the analysis. Note that + you can still append new parameters or completely redefine them. +3. It splits between parsing and analysis, storing outputs in separate + repositories: <target>.parse for parsing-related outputs, and + <target>.eva for EVA-related outputs. +4. It produces several additional outputs after parsing and after an EVA + analysis: + * `<target>.parse/parse.log`, or `<target>.eva/eva.log`: + contain the entire output of the parsing/analysis command, + * `warnings.log`: only the warnings emitted by Frama-C/EVA, + * `alarms.csv`: list of emitted alarms in csv form, + * `metrics.log`: various metrics about the analysis, + * `stats.txt`: stats about the analysis, such as user time, + memory consumption, the date of the analysis, coverage of the analysis, + number of warnings and alarms, and the command line arguments. +5. It keeps copies of all previous analyses you have done in timestamped + directories. + + +Getting started +=============== + +There is a ready-to-use Makefile skeleton at the end of this section. If you +want explanations about this Makefile, read this entire section. + +Other usage examples are available in Frama-C's Github open-source-case-studies +repository: https://github.com/Frama-C/open-source-case-studies + +(If you have access to Frama-C's development repositories, you can also use +the examples in `analysis-scripts/examples`.) + +Including fcscripts +------------------- + +This folder contains several shell scripts and, most importantly, +the `frama-c.mk` file. This file is intended to be included at the top of your +`Makefile`: + +```` +include fcscripts/frama-c.mk +```` + +By default, the scripts use the frama-c binaries located in your `$PATH` +environment variable. You may want to specify different binaries, but, if you +want to version your analysis, this path will depend on the computer it is run +on. So, we recommend you use an unversioned file `frama-c-path.mk`. Add this +file to your `.gitignore` and define the `FRAMAC`, `FRAMAC_GUI` and +`FRAMAC_CONFIG` variables there. For instance: + +```` +FRAMAC_DIR=frama-c/bin +FRAMAC=$(FRAMAC_DIR)/frama-c +FRAMAC_GUI=$(FRAMAC_DIR)/frama-c-gui +FRAMAC_CONFIG=$(FRAMAC_DIR)/frama-c-config +```` + +And include this file before `frama-c.mk` in your Makefile. As this file +is computer dependent and unversioned, it will not always be present. Prefix +the include command with a minus sign `-` to tell `make` to ignore missing +files: + +```` +-include frama-c-path.mk +```` + +Then, to handle both cases when Frama-C is in the path, and when it is not, +use the following conditional definition of `FRAMAC_CONFIG` followed by the +inclusion of `frama-c.mk`: + +``` +FRAMAC_CONFIG ?= frama-c-config +include $(shell $(FRAMAC_CONFIG) -print-share-path)/analysis-scripts/frama-c.mk +``` + + +Defining analysis global parameters +----------------------------------- + +Once `frama-c.mk` is included, you may change default values of variables. +Most usual variables you may want to change are `CPPFLAGS`, `FCFLAGS` +and `EVAFLAGS`. For example: + +```` +CPPFLAGS = -D__I586__ +FCFLAGS += -verbose 0 +EVAFLAGS += -plevel 100 +```` + +Some arguments are passed to Frama-C from the environment. This is the +case of the `FRAMA_C_MEMORY_FOOTPRINT` variable. You can set it in your +Makefile with the following line: + +```` +export FRAMA_C_MEMORY_FOOTPRINT = 8 +```` + +The two steps of the analysis +----------------------------- + +Parsing might be long on some analyses. The analysis scripts save the result +of the parsing phase so that it is not redone when modifying only analysis +parameters but not parsing parameters. + +The parsing result is saved in a `<target>.parse` directory while the result +of the analysis is saved in a `<target>.eva` directory. +The second automatically depends on the first. +Thus, each time you require that make build the `.eva` target, +it will build the `.parse` one first. + +```` +all: example.eva +```` + + +Defining analysis sources +------------------------- + +To define the set of sources to analyze, you must define them as dependencies +of your `.parse` target. + +```` +example.parse: file1.c file2.c file3.c ... +```` + +As they are dependencies, parsing will be remade if the sources change. + + +Defining project-specific parameters +------------------------------------ + +You can describe several analyses with the same Makefile. We call these +analyses "projects". Projects are not likely to share the exact same +parameters. Thus, it is useful to define these parameters project wise. +`make` allows this by putting the variable definition after the target. For +instance: + +```` +example.parse: CPPFLAGS += -D__FRAMAC__ +example.eva: FCFLAGS += -main my_main +example.eva: EVAFLAGS += -slevel 500 +```` + + +Full example +------------ + +### `Makefile` + +```` +# optional include, in case frama-c-path.mk does not exist (frama-c in the PATH) +-include frama-c-path.mk +# frama-c-config is used to find the analysis scripts and frama-c.mk +FRAMAC_CONFIG ?= frama-c-config +include $(shell $(FRAMAC_CONFIG) -print-share-path)/analysis-scripts/frama-c.mk + +# Global parameters +CPPFLAGS = -D__I586__ +FCFLAGS += -verbose 0 +EVAFLAGS += -plevel 100 + +export FRAMA_C_MEMORY_FOOTPRINT = 8 + +# Default targets +all: example.eva + +# Input files +example.parse: example.c + +# Project-specific parameters +example.parse: CPPFLAGS += -D__FRAMAC__ +example.eva: FCFLAGS += -main my_main +example.eva: EVAFLAGS += -slevel 500 +```` + +### `frama-c-path.mk` + +```` +FRAMAC_DIR=frama-c/bin +FRAMAC=$(FRAMAC_DIR)/frama-c +FRAMAC_GUI=$(FRAMAC_DIR)/frama-c-gui +FRAMAC_CONFIG=$(FRAMAC_DIR)/frama-c-config +```` + +### `.gitignore` + +```` +*.parse* +*.eva* +*.crash +command +parse.log +eva.log +stats.txt +frama-c-path.mk +```` diff --git a/share/analysis-scripts/bench-sqlite.sh b/share/analysis-scripts/bench-sqlite.sh new file mode 100755 index 0000000000000000000000000000000000000000..954cb0e9f84226309f3a60a98b542cffd5373fff --- /dev/null +++ b/share/analysis-scripts/bench-sqlite.sh @@ -0,0 +1,124 @@ +#!/bin/bash -eu + +database="benchmark-results.db" +stats="$1" + +function query +{ + sqlite3 $database "$@" +} + + +# --- Database Creation --- + +if [ ! -e $database ] +then + query <<SQL + CREATE TABLE benchmark_results ( + id ROWID, + target TEXT NOT NULL, + timestamp TEXT NOT NULL, + hash_fc TEXT NOT NULL, + hash_case TEXT NOT NULL, + comment TEXT NOT NULL, + user_time REAL NOT NULL, + memory INTEGER NOT NULL, + alarms INTEGER NOT NULL, + warnings INTEGER NOT NULL, + sem_reach_fun INTEGER NOT NULL, + syn_reach_fun INTEGER NOT NULL, + total_fun INTEGER NOT NULL, + sem_reach_stmt INTEGER NOT NULL, + syn_reach_stmt INTEGER NOT NULL, + command_line TEXT NOT NULL + ); +SQL +fi + + +# --- Adding record --- + +source $stats + +query <<SQL + INSERT INTO benchmark_results( + target, timestamp, hash_fc, hash_case, comment, user_time, memory, + alarms, warnings, sem_reach_fun, syn_reach_fun, total_fun, + sem_reach_stmt, syn_reach_stmt, command_line) + VALUES( + "$target", "$timestamp", "$git_hash", "$case_git_hash", "$comment", + "$user_time", "$memory", "$alarms", "$warnings", "$sem_reach_fun", + "$syn_reach_fun", "$total_fun", "$sem_reach_stmt", "$syn_reach_stmt", + "$cmd_args"); +SQL + + +# --- Comparison --- + +result=`sqlite3 benchmark-results.db <<SQL + SELECT + printf("%+.1f", 100*$user_time/avg(user_time) - 100), + printf("%+d", $warnings - min(warnings)), + printf("%+d", $alarms - min(alarms)) + FROM benchmark_results + WHERE target='$target'; +SQL` +IFS='|' read -r diff_user_time diff_warnings diff_alarms <<< "$result" + + +# --- Print summary --- + +function bold +{ + echo -e "$(tput bold)$*$(tput sgr0)" +} + +function red +{ + echo -e "$(tput setaf 1)$*$(tput sgr0)" +} + +function green +{ + echo -e "$(tput setaf 2)$*$(tput sgr0)" +} + +function positive +{ + if [ ${1:0:2} -ge 0 ] + then + echo $(green $1) + else + echo $(red $1) + fi +} + +function negative +{ + if [ ${1:0:2} -le 0 ] + then + echo $(green $1) + else + echo $(red $1) + fi +} + +stmt_coverage=`bc <<<"scale=1; 100 * $sem_reach_stmt / $syn_reach_stmt"` +fun_coverage=`bc <<<"scale=1; 100 * $sem_reach_fun / $syn_reach_fun"` + + +printf "\n" +printf "$(bold '%12s') %s\n" "Target:" "$target" +printf "$(bold '%12s') %'d kB\n" "Memory:" "$memory" +printf "$(bold '%12s') %s s (%s from average)\n" "Time:" "$user_time" \ + "$(negative $diff_user_time%)" +printf "$(bold '%12s') %s (%s from min)\n" "Warnings:" "$warnings" \ + "$(negative $diff_warnings)" +printf "$(bold '%12s') %s (%s from min)\n" "Alarms:" "$alarms" \ + "$(negative $diff_alarms)" +printf "$(bold '%12s') %s / %s stmt (%s%%)\n" "Coverage:" \ + "$sem_reach_stmt" "$syn_reach_stmt" "$stmt_coverage" +printf "$(bold '%12s') %s / %s / %s functions (%s%%)\n\n" "" \ + "$sem_reach_fun" "$syn_reach_fun" "$total_fun" "$fun_coverage" +printf "\n" + diff --git a/share/analysis-scripts/benchmark.sh b/share/analysis-scripts/benchmark.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b94892cd32f197cd0c5597e277ebafcd0395b58 --- /dev/null +++ b/share/analysis-scripts/benchmark.sh @@ -0,0 +1,199 @@ +#!/bin/bash -eu + +# -------------------------------------------------------------------------- +# --- Command Line Parsing --- +# -------------------------------------------------------------------------- + +targets="" +git_hash="master" +clone_dir="frama-c-clones" +comment="" +show_usage="" +repository_path="" +makefile_path="." +output_file="benchmark-results.csv" + +while [[ $# > 0 ]] +do + case $1 in + -b|--hash|--branch) + git_hash="$2" + shift + ;; + + -d|--clone-dir) + clone_dir="$2" + shift + ;; + + -c|--comment) + comment="$2" + shift + ;; + + -p|--repository-path) + repository_path="$2" + shift + ;; + + -m|--makefile-path) + makefile_path="$2" + shift + ;; + + -o|--output) + output_file="$2" + shift + ;; + + -h|--help) + show_usage="yes" + ;; + + *) + targets="$targets $1" + ;; + esac + shift +done + +if [ -z "$targets" -o -n "$show_usage" ] +then + echo "Usage: $0 TARGET ..." + echo "Run benchmark for the specified targets." + echo "" + echo "The following arguments can be given:" + echo " -b, --hash HASH, selects HASH or BRANCH in the frama-c repository" + echo " --branch BRANCH" + echo " -d, --clone-dir path to the directory where frama-c versions are" + echo " cloned" + echo " -c, --comment COMMENT a comment associated to results for better" + echo " readability of the results; if omitted," + echo " defaults to the Frama-C branch name" + echo " -p, --repository-path PATH do not clone frama-c, use this repository instead" + echo " -m, --makefile-path FILE path to the makefile which can build the target" + echo " -o, --output FILE path to the output CSV file to be filled" + echo " -h, --help prints this help and quits" + exit 1 +fi + +if [ -z "$comment" ] +then + # Note: if the user gave us a commit hash instead of a branch name, + # we do not retrieve the branch name (which may not exist anyway) + comment="$git_hash" +fi + + +# -------------------------------------------------------------------------- +# --- Frama-C repository --- +# -------------------------------------------------------------------------- + +if [ -z "$repository_path" ] +then + # git_hash and comment cannot be parsed yet: + # we need the git clone to dereference it, in case it's a tag/branch name + + ##### Preparation of git clones/checkouts ##### + + bare="$clone_dir/frama-c.git" + + # Check if bench clone exists + if [ ! -d "$bare" ] + then + echo "Cloning Frama-C..." + git clone --bare --quiet git@git.frama-c.com:frama-c/frama-c "$bare" + sed --in-place '/bare = true/d' $bare/config + fi + + # Fetch all refs + ( + cd $bare + git fetch origin '+refs/heads/*:refs/heads/*' --prune + ) + + # Now we can parse the other arguments + + # Resolve branch name if given + git_hash=`git --git-dir="$bare" rev-parse "$git_hash"` + + # repository_path must be an absolute path + repository_path="$(readlink -f "$clone_dir/$git_hash")" + + # Checkout and build the branch if necessary + if [ ! -e "$clone_dir/$git_hash" ] + then + echo "Building Frama-C for git commit: $git_hash" + # The workdir cmd can extract a working tree of the desired hash + # without cloning once more + workdir_cmd=`locate git-new-workdir --limit 1` + if [ -z "$workdir_cmd" ] + then + git --git-dir="$bare" worktree add "$repository_path" "$git_hash" + else + bash "$workdir_cmd" "$bare" "$repository_path" "$git_hash" + fi + # Build Frama-C + ( + cd "$repository_path"; + autoconf; + ./configure --disable-wp; + make -j; + ) + fi +fi + +# In case building has failed for some reason, we check if the actual binary +# exists and report an error otherwise, indicating which directory should be +# deleted. +FRAMAC="$repository_path/bin/frama-c" + +if [ ! -e "$FRAMAC" ] +then + echo "Error: could not find Frama-C binary: $FRAMAC" + echo "You may try erasing the directory to force a recompilation." + exit 2 +fi + + +# -------------------------------------------------------------------------- +# --- Benchmark execution and output --- +# -------------------------------------------------------------------------- + +header="target\ttimestamp\tFrama-C hash\tcomment\tcpu_time\tmaxmem\talarms\t\ +warnings\tsem reach fun\tsyn reach fun\ttotal fun\tsem reach stmt\t\ +syn reach stmt\tcommand args\tcase study git hash" + +if [ ! -e "$output_file" ] +then + echo "output file does not exist, creating: $output_file" + printf "$header\n" > "$output_file" +fi + +for target in $targets +do + pushd $makefile_path > /dev/null + make --no-print-directory $target BENCHMARK=y FRAMAC="$FRAMAC" + + case_git_hash=`git rev-parse HEAD` + . $target/stats.txt + popd > /dev/null + + printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" \ + "$target" "$timestamp" $git_hash "$comment" \ + $user_time $memory $alarms $warnings \ + $sem_reach_fun $syn_reach_fun $total_fun $sem_reach_stmt $syn_reach_stmt \ + "$cmd_args" $case_git_hash \ + >> "$output_file" + + if command -v sqlite3 2>&1 >/dev/null + then + export comment + export git_hash + export case_git_hash + export target + "${BASH_SOURCE%/*}/bench-sqlite.sh" "$makefile_path/$target/stats.txt" + else + echo "command 'sqlite3' not found, cannot update the database" + fi +done diff --git a/share/analysis-scripts/cmd-dep.sh b/share/analysis-scripts/cmd-dep.sh new file mode 100755 index 0000000000000000000000000000000000000000..305aa8d625f3c1dbdfa3e3627b2897f16d1a4c98 --- /dev/null +++ b/share/analysis-scripts/cmd-dep.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -eu + +if [ $# -lt 1 ] +then + ( + echo "usage: $0 FILE STRING" + echo "Test whether the contents of FILE are different from STRING." \ + "If it does, FILE is updated to match STRING. The file" \ + "name is always printed." + ) >&2 + exit 1 +fi + +FILE=$1 +shift +STRING=$* + +if + [ ! -e $FILE ] || + ! (diff --brief --ignore-space-change $FILE - <<< "$STRING") +then + mkdir --parent $(dirname "$FILE") + echo $STRING > "$FILE" +fi + +echo $FILE diff --git a/share/analysis-scripts/concat-csv.sh b/share/analysis-scripts/concat-csv.sh new file mode 100755 index 0000000000000000000000000000000000000000..8079d3004553a63ca9b20b93e8330016993bc2dc --- /dev/null +++ b/share/analysis-scripts/concat-csv.sh @@ -0,0 +1,103 @@ +#!/bin/bash -eu + +set -o pipefail + +header_column="" +delete_first="" +sort="" +files="" +show_usage="" + +while [[ $# > 0 ]] +do + case $1 in + --add-header-column) + header_column="yes" + ;; + + --delete-first) + delete_first="$2" + shift + ;; + + --sort) + sort="yes" + ;; + + -h|--help) + show_usage="yes" + ;; + + *) + files="$files $1" + ;; + esac + shift +done + +target="" +sources="" +read target sources <<<$files + +if [ -z "$sources" -o -n "$show_usage" ] +then + echo "Usage: $0 TARGET SOURCE1 ..." + echo "Concat and/or transform CSV files." + echo "" + echo "The following arguments can be given:" + echo " --add-header-column, add a header column consisting of the base name of" + echo " the CSV file" + echo " --delete-first N delete the first N columns" + echo " --sort sort the CSV file" + echo " -h, --help prints this help and quits" + exit 1 +fi + + +# Read header line +read first rest <<<$sources +header=$(head --quiet --lines 1 $first) +if [ -n "$header_column" ] +then + header="project $header" +fi +if [ -n "$delete_first" ] +then + header=$(cut -f1-$delete_first --complement <<<"$header") +fi +# Read sources +{ + for f in $sources + do + if [ -n "$header_column" ] + then + base=$(basename "$f") + project="${base%%.*}" + sed -e '1d' -e "s/^/$project\t/" "$f"; + else + sed -e '1d' "$f"; + fi + done +} | +# Remove first columns +{ + if [ -n "$delete_first" ] + then + cut -f1-$delete_first --complement + else + cat + fi +} | +# Remove blanks +sed '/^$/d' | +# Sort the file +{ + echo "$header" + if [ -n $sort ] + then + sort -u + else + cat + fi +} > "$target" + diff --git a/share/analysis-scripts/examples/Makefile b/share/analysis-scripts/examples/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..5aca1b8993332028c06307a15a9a5ff74e4eef2e --- /dev/null +++ b/share/analysis-scripts/examples/Makefile @@ -0,0 +1,18 @@ +TARGETS=example example-multi example-slevel + +.PHONY: all update-submodules clean $(TARGETS) + +all: $(TARGETS) + +update-submodules: + git submodule update --init --recursive --remote + +clean: + @for f in $(TARGETS); \ + do \ + $(MAKE) --no-print-directory --file $$f.mk clean; \ + done + +$(TARGETS): %: %.mk + @$(MAKE) --no-print-directory --file $< + diff --git a/share/analysis-scripts/examples/example-multi.mk b/share/analysis-scripts/examples/example-multi.mk new file mode 100644 index 0000000000000000000000000000000000000000..3c6758f68a6ae94ba0b860e882a0c143a1172855 --- /dev/null +++ b/share/analysis-scripts/examples/example-multi.mk @@ -0,0 +1,23 @@ +-include frama-c-path.mk +FRAMAC_CONFIG ?= frama-c-config +-include $(shell $(FRAMAC_CONFIG) -print-share-path)/analysis-scripts/frama-c.mk + +# Global parameters +CPPFLAGS = -D__I586__ +FCFLAGS += -verbose 0 +EVAFLAGS += -plevel 100 +EVABUILTINS += memset:Frama_C_memset memcpy:Frama_C_memcpy + +export FRAMA_C_MEMORY_FOOTPRINT = 8 + +# Default targets +all: example1.val example2.val + +# Input files +example1.parse example2.parse: example.c + +# Project specific parameters +example1.parse: CPPFLAGS += -D__FRAMAC__ +example1.val: FCFLAGS += -main my_main +example2.val: EVAFLAGS += -slevel 500 +example2.val: FCFLAGS += -main main diff --git a/share/analysis-scripts/examples/example-slevel.mk b/share/analysis-scripts/examples/example-slevel.mk new file mode 100644 index 0000000000000000000000000000000000000000..4d50809cfe520d7939476496a76a5be7a6dc70cc --- /dev/null +++ b/share/analysis-scripts/examples/example-slevel.mk @@ -0,0 +1,37 @@ +# This example is the same as example-multi.mk but pay attention to the +# following changes : +# 1. slevel is set inside SLEVEL variable instead of EVAFLAGS to allow +# overriding when testing specific slevels +# 2. A percent (%) is used in example1.% and example2.% so that +# options are used also for instance for example1.5000.val which +# is the same target as example1.val but with 5000 slevel. +# 3. The all rule invoke the script + +-include frama-c-path.mk +FRAMAC_CONFIG ?= frama-c-config +-include $(shell $(FRAMAC_CONFIG) -print-share-path)/analysis-scripts/frama-c.mk + +# Global parameters +CPPFLAGS = -D__I586__ +FCFLAGS += -verbose 0 +EVAFLAGS += -plevel 100 +EVABUILTINS += memset:Frama_C_memset memcpy:Frama_C_memcpy + +export FRAMA_C_MEMORY_FOOTPRINT = 8 + +# Default targets +all: + $(shell $(FRAMAC_CONFIG) -print-share-path)/analysis-scripts/slevel-tweaker.sh -f example-slevel.mk example1 example2 + +# Clean +clean:: + $(RM) slevel-tweaker.log + +# Input files +example1.parse example2.parse: example.c + +# Project specific parameters +example1.parse: CPPFLAGS += -D__FRAMAC__ +example1.%: FCFLAGS += -main my_main +example2.%: SLEVEL += -slevel 500 +example2.%: FCFLAGS += -main main diff --git a/share/analysis-scripts/examples/example.c b/share/analysis-scripts/examples/example.c new file mode 100644 index 0000000000000000000000000000000000000000..ed7983016f1d3b02737c6f9a909fbd7a8ce29867 --- /dev/null +++ b/share/analysis-scripts/examples/example.c @@ -0,0 +1,25 @@ +#include <string.h> + +char s[10], t[10]; + +int f() +{ + memset(s, 0, 10); + memcpy(t, s, 10); + return 42; +} + +void main(void) +{ + f(); +} + + +#ifdef __FRAMAC__ + +int my_main(void) +{ + return f(); +} + +#endif diff --git a/share/analysis-scripts/examples/example.mk b/share/analysis-scripts/examples/example.mk new file mode 100644 index 0000000000000000000000000000000000000000..01854b37faf71ac2ad03849b6d90d69aab58226a --- /dev/null +++ b/share/analysis-scripts/examples/example.mk @@ -0,0 +1,26 @@ +# frama-c-path.mk contains variables which are specific to each +# user and should not be versioned, such as the path to the +# frama-c binaries (e.g. FRAMAC and FRAMAC_GUI). +# It is an optional include, unnecessary if frama-c is in the PATH +-include frama-c-path.mk +# FRAMAC_CONFIG is defined in frama-c-path.mk when it is included, so the +# line below will be safely ignored if this is the case +FRAMAC_CONFIG ?= frama-c-config +# frama-c.mk should be included at the top of your Makefile, right below +# the inclusion of frama-c-path.mk +-include $(shell $(FRAMAC_CONFIG) -print-share-path)/analysis-scripts/frama-c.mk + +# Define global parameters +CPPFLAGS += -D__I586__ -D__FRAMAC__ +FCFLAGS += -verbose 0 -main my_main +EVAFLAGS += -plevel 611 +EVABUILTINS += memset:Frama_C_memset memcpy:Frama_C_memcpy + +# Export environment variable for Frama-C +export FRAMA_C_MEMORY_FOOTPRINT = 8 + +# Default target +all: example.val + +# List input files +example.parse: example.c diff --git a/share/analysis-scripts/frama-c.mk b/share/analysis-scripts/frama-c.mk new file mode 100644 index 0000000000000000000000000000000000000000..c3db2a751624ae1e29d81082b24a6930ee07d403 --- /dev/null +++ b/share/analysis-scripts/frama-c.mk @@ -0,0 +1,211 @@ +########################################################################## +# # +# This file is part of Frama-C. # +# # +# Copyright (C) 2007-2017 # +# CEA (Commissariat à l'énergie atomique et aux énergies # +# alternatives) # +# # +# you can redistribute it and/or modify it under the terms of the GNU # +# Lesser General Public License as published by the Free Software # +# Foundation, version 2.1. # +# # +# It is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Lesser General Public License for more details. # +# # +# See the GNU Lesser General Public License version 2.1 # +# for more details (enclosed in the file licenses/LGPLv2.1). # +# # +########################################################################## + +# This file is intended to be included by a classic Makefile when doing +# non-trivial analyses with Frama-C and its EVA plugin. For instance, you +# can start your Makefile with the following line: +# +# include path/to/frama-c.mk +# +# This Makefile uses the following variables. +# +# FRAMAC the frama-c binary +# FRAMAC_GUI the frama-c gui binary +# CPPFLAGS preprocessing flags +# FCFLAGS general flags to use with frama-c +# FCGUIFLAGS flags to use with frama-c-gui +# EVAFLAGS flags to use with the EVA plugin +# SLEVEL the part of the frama-c command line concerning slevel +# (you can use EVAFLAGS for this, if you don't intend +# to use slevel-tweaker.sh) +# EVABUILTINS EVA builtins to be set (via -val-builtin) +# EVAUSESPECS EVA functions to be overridden by specs (-val-use-spec) +# +# There are several ways to define or change these variables. +# +# With an environment variable: +# export FRAMAC=~/bin/frama-c +# make +# +# With command line arguments: +# make FRAMAC=~/bin/frama-c +# +# In your Makefile, when you want to change a parameter for all analyses : +# FCFLAGS += -verbose 2 +# +# In your Makefile, for a single target : +# target.eva: FCFLAGS += -main my_main +# +# In order to define an analysis target named target, you must in addition +# give the list of source files containing the code to be analyzed by adding +# them as dependencies of target.parse, a in +# +# target.parse: file1.c file2.c file3.c... +# + +# Test if Makefile is > 4.0 +ifneq (4.0,$(firstword $(sort $(MAKE_VERSION) 4.0))) + $(error This Makefile requires Make >= 4.0 - available at http://ftp.gnu.org/gnu/make/) +endif + + +# --- Utilities --- + +define display_command = + $(info ) + $(info $(shell tput setaf 4)Command: $(1)$(shell tput sgr0)) + $(info ) +endef + +space := +space += +comma := , + +fc_list = $(subst $(space),$(comma),$(strip $1)) + + +# --- Default configuration --- + +FRAMAC ?= frama-c +FRAMAC_GUI ?= frama-c-gui +SLEVEL ?= +EVAFLAGS ?= \ + -no-val-print -no-val-show-progress -value-msg-key=-initial-state \ + -val-print-callstacks -no-val-warn-on-alarms \ + -no-deps-print -no-calldeps-print \ + -memexec-all -calldeps -permissive -from-verbose 0 \ + $(SLEVEL) \ + $(if $(EVABUILTINS), -val-builtin=$(call fc_list,$(EVABUILTINS)),) \ + $(if $(EVAUSESPECS), -val-use-spec $(call fc_list,$(EVAUSESPECS)),) +FCFLAGS ?= +FCGUIFLAGS ?= + +export LIBOVERLAY_SCROLLBAR=0 + + +# --- Cleaning --- + +.PHONY: clean +clean:: + $(RM) -r *.parse *.eva + +clean-backups: + find . -regextype posix-extended \ + -regex '^.*_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}\.eva(\.(log|stats|alarms|warnings|metrics))?' \ + -delete + + +# --- Generic rules --- + +TIMESTAMP := $(shell date +"%Y-%m-%d_%H-%M-%S") +HR_TIMESTAMP := $(shell date +"%H:%M:%S %d/%m/%Y")# Human readable +DIR := $(dir $(lastword $(MAKEFILE_LIST))) +SHELL := /bin/bash +.SHELLFLAGS := -eu -o pipefail -c + +TIME_FORMAT := user_time=%U\nmemory=%M + +.ONESHELL: +.SECONDEXPANSION: +.FORCE: +.SUFFIXES: # Disable make builtins + +%.parse/command %.eva/command: + @# + +%.parse: SOURCES = $(filter-out %/command,$^) +%.parse: PARSE = $(FRAMAC) $(FCFLAGS) -cpp-extra-args="$(CPPFLAGS)" $(SOURCES) +%.parse: $$(if $$^,,.IMPOSSIBLE) $$(shell $(DIR)cmd-dep.sh $$@/command $$(PARSE)) + @$(call display_command,$(PARSE)) + mkdir --parent $@ + mv --force $@/{command,running} + { + /usr/bin/time --format='$(TIME_FORMAT)' --output="$@/stats.txt" \ + $(PARSE) \ + -kernel-log w:$@/warnings.log \ + -variadic-log w:$@/warnings.log \ + -save $@/framac.sav \ + -print -ocode $@/framac.ast -then -no-print \ + || ($(RM) $@/stats.txt && false) # Prevents having error code reporting in stats.txt + } 2>&1 | + tee $@/parse.log + { + printf 'timestamp=%q\n' "$(HR_TIMESTAMP)"; + printf 'warnings=%s\n' "`cat $@/warnings.log | grep ':\[kernel\]' | wc --lines`"; + printf 'cmd_args=%q\n' "$(subst ",\",$(wordlist 2,999,$(PARSE)))" + } >> $@/stats.txt + mv $@/{running,command} + touch $@ # Update timestamp and prevents remake if nothing changes + +%.slevel.eva: SLEVEL = -slevel $(word 2,$(subst ., ,$*)) +%.eva: EVA = $(FRAMAC) $(FCFLAGS) -val $(EVAFLAGS) +%.eva: PARSE_RESULT = $(word 1,$(subst ., ,$*)).parse +%.eva: $$(PARSE_RESULT) $$(shell $(DIR)cmd-dep.sh $$@/command $$(EVA)) $(if $(BENCHMARK),.FORCE,) + @$(call display_command,$(EVA)) + mkdir --parent $@ + mv --force $@/{command,running} + { + /usr/bin/time --format='$(TIME_FORMAT)' --output="$@/stats.txt" \ + $(EVA) \ + -load $(PARSE_RESULT)/framac.sav -save $@/framac.sav \ + -report-csv $@/alarms.csv -report-no-proven \ + -kernel-log w:$@/warnings.log \ + -from-log w:$@/warnings.log \ + -inout-log w:$@/warnings.log \ + -report-log w:$@/warnings.log \ + -scope-log w:$@/warnings.log \ + -value-log w:$@/warnings.log \ + -metrics-log a:$@/metrics.log \ + -metrics-value-cover \ + || ($(RM) $@/stats.txt && false) # Prevents having error code reporting in stats.txt + } 2>&1 | + sed --unbuffered '/\[value\] Values at end of function/,999999d' | + tee $@/eva.log + $(DIR)parse-coverage.sh $@/eva.log $@/stats.txt + { + printf 'timestamp=%q\n' "$(HR_TIMESTAMP)"; + printf 'warnings=%s\n' "`cat $@/warnings.log | grep ':\[\(value\|kernel\|from\)\]' | wc --lines`"; + printf 'alarms=%s\n' "`expr $$(cat $@/alarms.csv | wc --lines) - 1`"; + printf 'cmd_args=%q\n' "$(subst ",\",$(wordlist 2,999,$(EVA)))" + } >> $@/stats.txt + mv $@/{running,command} + touch $@ # Update timestamp and prevents remake if nothing changes + cp -r $@ $*_$(TIMESTAMP).eva + +%.gui: % + $(FRAMAC_GUI) $(FCGUIFLAGS) -load $</framac.sav & + +# Run loop bound analysis plug-in and store result in *.loop +%.loop: % + @ + { + $(FRAMAC) $(FCFLAGS) -load $^/framac.sav -loop -loop-no-branches | + /bin/sed -e '1,/Add this to your command line:/d' + } > $@ + + +# clean is generally not the default goal, but if there is no default +# rule when including this file, it would be. + +ifeq ($(.DEFAULT_GOAL),clean) + .DEFAULT_GOAL := +endif diff --git a/share/analysis-scripts/parse-coverage.sh b/share/analysis-scripts/parse-coverage.sh new file mode 100755 index 0000000000000000000000000000000000000000..13ef4141765c34b099f2d8ae7409f562c788feed --- /dev/null +++ b/share/analysis-scripts/parse-coverage.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +log_file=$1 +stats_file=$2 + +read syn_reach_fun total_fun \ + <<<`sed -n 's/^[[:blank:]]*Syntactically reachable functions = \([[:digit:]]*\) (out of \([[:digit:]]*\))$/\1 \2/p' $log_file` +read sem_reach_fun \ + <<<`sed -n 's/^[[:blank:]]*Semantically reached functions = \([[:digit:]]*\)$/\1/p' $log_file` +read reach_fun_percent \ + <<<`sed -n 's/^[[:blank:]]*Coverage estimation = \([[:digit:].]*\)%/\1/p' $log_file` +read syn_reach_stmt sem_reach_stmt reach_stmt_percent \ + <<<`sed -n 's/^[[:blank:]]*\([[:digit:]]*\) stmts in analyzed functions, \([[:digit:]]*\) stmts analyzed (\([[:digit:].]*\)%)$/\1 \2 \3/p' $log_file` + +( + printf 'sem_reach_fun=%s\n' $sem_reach_fun; + printf 'syn_reach_fun=%s\n' $syn_reach_fun; + printf 'total_fun=%s\n' $total_fun; + printf 'sem_reach_stmt=%s\n' $sem_reach_stmt; + printf 'syn_reach_stmt=%s\n' $syn_reach_stmt; +) >> $stats_file + diff --git a/share/analysis-scripts/plot.sh b/share/analysis-scripts/plot.sh new file mode 100755 index 0000000000000000000000000000000000000000..0db4d1ba284bbdfa2e0ef26e8f6180e231cd2b1c --- /dev/null +++ b/share/analysis-scripts/plot.sh @@ -0,0 +1,16 @@ +target=$1 + +{ + echo -e "#slevel\talarms\ttime" + + for f in $target.*.eva + do + slevel=`sed -n 's/^[^.]\+.\([0-9]\+\).eva$/\1/p' <<<$f` + + if [ -n "$slevel" ] + then + echo -n -e "$slevel\t" + tail --lines 1 $f.stats | cut --fields 1,2 + fi + done +} > $target.dat diff --git a/share/analysis-scripts/slevel-tweaker.sh b/share/analysis-scripts/slevel-tweaker.sh new file mode 100755 index 0000000000000000000000000000000000000000..f67979a1ebe319e6aed9eb2a7037e74dc115e955 --- /dev/null +++ b/share/analysis-scripts/slevel-tweaker.sh @@ -0,0 +1,118 @@ +#!/bin/bash -u + +declare -A alarms +declare -A utimes + + +function print_results() +{ + local s + local t + + if [ -z "$quiet" ] + then + echo -e '\e\0143' + printf "%24s" 'file / slevel' + for s in $slevels + do + printf "%8s" $s + done + printf "\n" + for t in $targets + do + printf "\n" + printf "%18s%6s" $t '#alrm' + for s in $slevels + do + printf "%8s" ${alarms["$t,$s"]-} + done + printf "\n" + printf "%18s%6s" '' 'time' + for s in $slevels + do + printf "%8s" ${utimes["$t,$s"]-} + done + printf "\n" + done + printf "\n" + fi +} + +function poll_results() +{ + for s in $slevels + do + for t in $targets + do + base=$t.$s.slevel.eva + if [ -f $base/stats.txt ] + then + read alarms["$t,$s"] utimes["$t,$s"] <<< $( + source $base/stats.txt + echo ${alarms:-x} ${user_time:- } + ) + fi + done + done +} + + +# Parse command Line + +slevels="0 10 20 50 100 200 500 1000 2000 5000 10000 20000 50000" +run="make --jobs 9" +targets="" +quiet="" + +while [[ $# > 0 ]] +do + case $1 in + -f|--file|--makefile) + run="$run $1 $2" + shift + ;; + + -B|--always-make) + run="$run $1" + ;; + + -q|--quiet) + quiet="yes" + ;; + + *) + targets="$targets $1" + ;; + esac + shift +done + + +# List make targets + +for s in $slevels +do + for t in $targets + do + run="$run $t.$s.slevel.eva" + done +done + + +# Run and display + +{ + $run > /dev/null & + pid=$! + + print_results + + while ps -p $pid >/dev/null + do + sleep 1 + poll_results + print_results + done +} 2> slevel-tweaker.log + +cat slevel-tweaker.log >&2 diff --git a/share/analysis-scripts/summary.sh b/share/analysis-scripts/summary.sh new file mode 100755 index 0000000000000000000000000000000000000000..061053e33e20d25cbda3b6535c1982f8b61c3507 --- /dev/null +++ b/share/analysis-scripts/summary.sh @@ -0,0 +1,109 @@ +#!/bin/bash -u + +declare -A stats + +function pretty_size() +{ + [[ $# -lt 1 ]] && break + KB=$1 + [ $KB -lt 4096 ] && echo ${KB} kiB && break + MB=$(((KB+512)/1024)) + [ $MB -lt 4096 ] && echo ${MB} MiB && break + GB=$(((MB+512)/1024)) + echo $GB +} + + +function print_results() +{ + local s + local t + + if [ -z "$quiet" ] + then + echo -e '\e\0143' + printf "%20s %10s %10s %10s %10s\n" 'target' 'alarms' 'warnings' 'time' 'memory' + printf "%s\n" " ---------------------------------------------------------------" + for t in $targets + do + printf "%20s %10s %10s %10s %10s\n" $t \ + "${stats["$t,alarms"]-}" "${stats["$t,warnings"]-}" \ + "${stats["$t,user_time"]-}" \ + "$(pretty_size ${stats["$t,memory"]-})" + done + printf "\n" + fi +} + +function poll_results() +{ + for t in $targets + do + if [ -f "$t/stats.txt" ] + then + read stats["$t,alarms"] stats["$t,warnings"] \ + stats["$t,user_time"] stats["$t,memory"] <<< $( + source $t/stats.txt + echo ${alarms:-x} ${warnings:-x} ${user_time:-x} ${memory:- } + ) + fi + done +} + + +# Parse command Line + +run="make" +targets="" +quiet="" + +while [[ $# > 0 ]] +do + case $1 in + -f|--file|--makefile) + run="$run $1 $2" + shift + ;; + + -B|--always-make) + run="$run $1" + ;; + + -q|--quiet) + quiet="yes" + ;; + + *) + targets="$targets $1" + ;; + esac + shift +done + + +# List make targets + +for t in $targets +do + run="$run $t" +done + + +# Run and display + +{ + $run > /dev/null & + pid=$! + + poll_results + print_results + + while ps -p $pid >/dev/null + do + sleep 1 + poll_results + print_results + done +} 2> synthesis.log + +cat synthesis.log >&2 diff --git a/share/autocomplete_frama-c b/share/autocomplete_frama-c index 9fb858042a857146259a408f73e5cfde73d961af..574d99a243a8922a9a7f9f2d5f3e639c908cc42b 100644 --- a/share/autocomplete_frama-c +++ b/share/autocomplete_frama-c @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/builtin.h b/share/builtin.h index ba1d6d5f2c8284486450e9ad425b1c4df663540c..af6214e352992c6653e40478480d3a6bfcb66a25 100644 --- a/share/builtin.h +++ b/share/builtin.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/configure.ac b/share/configure.ac index 078cf571783e71969e76302f7d85175930062831..a529a92a5d7b867171937faa96c7393efa7c8ce9 100644 --- a/share/configure.ac +++ b/share/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -87,8 +87,7 @@ define([PLUGIN_NAME],$1) define([PLUGIN_FILE],$2) define([PLUGIN_MSG],$3) define([PLUGIN_DEFAULT],$4) -define([PLUGIN_DYNAMIC],$5) -define([PLUGIN_ADDITIONAL_DIR],$6) +define([PLUGIN_ADDITIONAL_DIR],$5) AC_CHECK_FILE(PLUGIN_FILE, default=PLUGIN_DEFAULT;plugin_present=yes, plugin_present=no;default=no) @@ -110,21 +109,6 @@ fi define([KNOWN_SRC_DIRS],KNOWN_SRC_DIRS PLUGIN_FILE PLUGIN_ADDITIONAL_DIR) -# Test to change for static plugin, dynamic option -#default_dyn=no -#define([PLUGIN_HELP_DYN], -# AC_HELP_STRING([--enable-PLUGIN_NAME-dynamic], -# [PLUGIN_MSG (default: static)]) -#define([PLUGIN_NAME_DYN],[PLUGIN_NAME]-dynamic) -#AC_ARG_ENABLE( -# [PLUGIN_NAME_DYN], -# PLUGIN_HELP_DYN, -# ENABLE=$enableval; -# FORCE=$enableval -# ENABLE=$default_dyn -#) -#eval ENABLE_DYNAMIC_$up=\$ENABLE - if test "$plugin_present" = "no" -a "$FORCE" = "yes"; then AC_MSG_ERROR([PLUGIN_NAME is not available]) fi @@ -138,30 +122,7 @@ if test "$default" = "no" -a "$FORCE" = "no"; then [INFO_]UP=" (not available by default)" fi -# Dynamic plug-ins configuration -m4_if("PLUGIN_DYNAMIC","yes", - [define([STATIC_HELP], - AC_HELP_STRING([--with-PLUGIN_NAME-static], - [link PLUGIN_NAME statically (default: no)])) - AC_ARG_WITH(PLUGIN_NAME[-static],STATIC_HELP, - [is_static=$withval], - [is_static=$IS_ALL_STATIC]) - undefine([STATIC_HELP]) - # is_static = "yes" iff the user forces the plug-in to be static - # is_static = "no" iff the user forces the plug-in to be dynamic - # is_static = "" in others cases (no special instruction) - [STATIC_]UP=$is_static - if test "$is_static" != "yes"; then - USE_NATIVE_DYNLINK="${USE_NATIVE_DYNLINK} PLUGIN_NAME" - [DYNAMIC_]UP=yes - else - [DYNAMIC_]UP=no - fi], - # static plug-in - [[DYNAMIC_]UP=no]) - AC_SUBST([ENABLE_]UP) -AC_SUBST([DYNAMIC_]UP) echo "PLUGIN_NAME... $ENABLE" # kept defined for write_plugin_config. A bit ugly, but not more than # usual autoconf stuff. @@ -169,7 +130,6 @@ echo "PLUGIN_NAME... $ENABLE" m4_undefine([PLUGIN_FILE]) m4_undefine([PLUGIN_MSG]) m4_undefine([PLUGIN_DEFAULT]) -m4_undefine([PLUGIN_DYNAMIC]) m4_undefine([PLUGIN_ADDITIONAL_DIR]) m4_undefine([UP]) ]) # end of check_plugin diff --git a/share/emacs/acsl.el b/share/emacs/acsl.el index 5b831d40bef7e0745cf632de93321fe974a0f973..4138b962f592723199b5cefb0f9a12f8d89aaec1 100644 --- a/share/emacs/acsl.el +++ b/share/emacs/acsl.el @@ -5,7 +5,7 @@ ; Copyright (C) 2008-2011 ; ; Pierre Roux ; ; ; -; Copyright (C) 2009-2016 ; +; Copyright (C) 2009-2017 ; ; CEA LIST ; ; ; ; you can redistribute it and/or modify it under the terms of the GNU ; diff --git a/share/emacs/frama-c-dev.el b/share/emacs/frama-c-dev.el index b919c2855a6d0a18e754606e263bda3f4c12b423..4a1d0e05e19b49fe2ed7192d401aebc09108b38b 100644 --- a/share/emacs/frama-c-dev.el +++ b/share/emacs/frama-c-dev.el @@ -2,7 +2,7 @@ ; ; ; This file is part of Frama-C. ; ; ; -; Copyright (C) 2007-2016 ; +; Copyright (C) 2007-2017 ; ; CEA (Commissariat à l'énergie atomique et aux énergies ; ; alternatives) ; ; ; diff --git a/share/emacs/frama-c-init.el b/share/emacs/frama-c-init.el index 65de9761b828c7ef529726a60213a1cc0f36d9b0..5a49c70475b50e5359212ff6c0f1f9213a199cfe 100644 --- a/share/emacs/frama-c-init.el +++ b/share/emacs/frama-c-init.el @@ -2,7 +2,7 @@ ; ; ; This file is part of Frama-C. ; ; ; -; Copyright (C) 2007-2016 ; +; Copyright (C) 2007-2017 ; ; CEA (Commissariat à l'énergie atomique et aux énergies ; ; alternatives) ; ; ; diff --git a/share/emacs/frama-c-recommended.el b/share/emacs/frama-c-recommended.el index f2eff05ad03d4ae46a982477bc4ba6ab55ee4f7f..e19719251f6500d5bae698f3e672ae78c9eeaceb 100644 --- a/share/emacs/frama-c-recommended.el +++ b/share/emacs/frama-c-recommended.el @@ -2,7 +2,7 @@ ; ; ; This file is part of Frama-C. ; ; ; -; Copyright (C) 2007-2016 ; +; Copyright (C) 2007-2017 ; ; CEA (Commissariat à l'énergie atomique et aux énergies ; ; alternatives) ; ; ; diff --git a/share/frama-c.Unix.rc b/share/frama-c.Unix.rc index 1c4e3dfa316239c582627677717bc09c1cf3e907..1bb7e9eb0bc95142e8adabd44644c413e7f90290 100644 --- a/share/frama-c.Unix.rc +++ b/share/frama-c.Unix.rc @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/frama-c.WIN32.rc b/share/frama-c.WIN32.rc index 9955219d117dbbb6915de2543dca2969bb6946ba..e86cd09631a6e1ba2becd09a80eb612570bf7ed8 100644 --- a/share/frama-c.WIN32.rc +++ b/share/frama-c.WIN32.rc @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/share/libc.c b/share/libc.c index cfc7fc987c428100675de78125dc353b449bccef..c3b080284726e88029bedc89d954e8cbb20f378d 100644 --- a/share/libc.c +++ b/share/libc.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_builtin.c b/share/libc/__fc_builtin.c index 3c9bd64023b35a5fc400d816b6cfd6ae87781a67..3b58047f650bf582a81fb53e21605cfccde1629a 100644 --- a/share/libc/__fc_builtin.c +++ b/share/libc/__fc_builtin.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_builtin.h b/share/libc/__fc_builtin.h index 004578d65f2e138ce6282352cfc84a0faf0804aa..bfde1bc25c84ecca7a845b3a186851dff3412ae9 100644 --- a/share/libc/__fc_builtin.h +++ b/share/libc/__fc_builtin.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -139,6 +139,12 @@ extern unsigned long long Frama_C_unsigned_long_long_interval */ extern long long Frama_C_long_long_interval(long long min, long long max); +/*@ requires min <= max; + assigns \result \from min, max, Frama_C_entropy_source; + assigns Frama_C_entropy_source \from Frama_C_entropy_source; + ensures min <= \result <= max ; + */ +extern size_t Frama_C_size_t_interval(size_t min, size_t max); /*@ requires \is_finite(min) && \is_finite(max); requires min <= max; @@ -174,7 +180,7 @@ extern void Frama_C_abort(void) __attribute__ ((noreturn)); /*@ assigns \result \from p; */ extern size_t Frama_C_offset(const void* p); -extern void *Frama_C_alloc_size(size_t size); +extern void *Frama_C_malloc_fresh(size_t size); __END_DECLS __POP_FC_STDLIB diff --git a/share/libc/__fc_define_blkcnt_t.h b/share/libc/__fc_define_blkcnt_t.h index 2f7254b08f225af86a4d94f14f841ae7ff0ecd1d..69940962f01941aaa96a92c20da42b1e8df09f55 100644 --- a/share/libc/__fc_define_blkcnt_t.h +++ b/share/libc/__fc_define_blkcnt_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,6 +22,11 @@ #ifndef __FC_DEFINE_BLKCNT_T #define __FC_DEFINE_BLKCNT_T +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS typedef unsigned int blkcnt_t; +__END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/__fc_define_blksize_t.h b/share/libc/__fc_define_blksize_t.h index 3e2cb01b10a8c4018b299d2d6cfcec48ed64f81a..450886d3590a96bf605f3d13772e793d565c001c 100644 --- a/share/libc/__fc_define_blksize_t.h +++ b/share/libc/__fc_define_blksize_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_dev_t.h b/share/libc/__fc_define_dev_t.h index d004b1402b2c91775870109ba169d2e9604e291b..af114e640f469acce765fa17cb5f4196e16162a5 100644 --- a/share/libc/__fc_define_dev_t.h +++ b/share/libc/__fc_define_dev_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_eof.h b/share/libc/__fc_define_eof.h index 4c0fde76b1c8b869b135f5348c4bd40ca84105a3..c5dd5d8de9943dfc4b5cfe0d37485526941781ce 100644 --- a/share/libc/__fc_define_eof.h +++ b/share/libc/__fc_define_eof.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_fd_set_t.h b/share/libc/__fc_define_fd_set_t.h index e2a6ab5a77ac4ee12c71550ed4c2123caed3a525..eca01daa100f143045852fe35a16849ae4938df1 100644 --- a/share/libc/__fc_define_fd_set_t.h +++ b/share/libc/__fc_define_fd_set_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -26,14 +26,40 @@ __PUSH_FC_STDLIB __BEGIN_DECLS typedef struct {char __fc_fd_set;} fd_set; -//@ assigns *fdset \from *fdset, fd; + +/*@ + requires \valid(fdset); + requires \initialized(fdset); + assigns *fdset \from *fdset, indirect:fd; +*/ extern void FD_CLR(int fd, fd_set *fdset); -//@ assigns \nothing ; -extern int FD_ISSET(int fd, fd_set *fdset); -//@ assigns *fdset \from *fdset, fd; +#define FD_CLR FD_CLR + +// Note: the 2nd argument in FD_ISSET is not const in some implementations +// due to historical and compatibility reasons. +/*@ + requires \valid_read(fdset); + requires \initialized(fdset); + assigns \result \from indirect:*fdset, indirect:fd; +*/ +extern int FD_ISSET(int fd, const fd_set *fdset); +#define FD_ISSET FD_ISSET + +/*@ + requires \valid(fdset); + requires \initialized(fdset); + assigns *fdset \from *fdset, indirect:fd; +*/ extern void FD_SET(int fd, fd_set *fdset); -//@ assigns *fdset \from \nothing; +#define FD_SET FD_SET + +/*@ + assigns *fdset \from \nothing; + ensures \initialized(fdset); +*/ extern void FD_ZERO(fd_set *fdset); +#define FD_ZERO FD_ZERO + __END_DECLS #define FD_SETSIZE 255 __POP_FC_STDLIB diff --git a/share/libc/__fc_define_file.h b/share/libc/__fc_define_file.h index 9dfedf1063b4bf708cc94bfabe9927336c1f5804..2901d0e1defba9dbb76c09d0e9c1d079f8e543c0 100644 --- a/share/libc/__fc_define_file.h +++ b/share/libc/__fc_define_file.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_fpos_t.h b/share/libc/__fc_define_fpos_t.h index 6e0caee4e0a4c93ced29d8b5994df6c3a3282753..6418baddf19b33345e0f6b8aa7749db8f7025a14 100644 --- a/share/libc/__fc_define_fpos_t.h +++ b/share/libc/__fc_define_fpos_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_id_t.h b/share/libc/__fc_define_id_t.h index c0af95da5dc4d6dd11b4ad0b2e1734e8b83d3264..ab495850e80345dcf3f1e853baa4399f8b260719 100644 --- a/share/libc/__fc_define_id_t.h +++ b/share/libc/__fc_define_id_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_ino_t.h b/share/libc/__fc_define_ino_t.h index 3bb74b18621952ed239f28d88e62c6ef02361948..def2c41bbbfe8871ff73972883c90406286c4848 100644 --- a/share/libc/__fc_define_ino_t.h +++ b/share/libc/__fc_define_ino_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_intptr_t.h b/share/libc/__fc_define_intptr_t.h index a08550a7ad538cd45cabb57767444512c4699803..f70ab35e5fecf7e4d5c797051e206351921ca46c 100644 --- a/share/libc/__fc_define_intptr_t.h +++ b/share/libc/__fc_define_intptr_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_iovec.h b/share/libc/__fc_define_iovec.h index 040c1e6b065a6fca14f71b41f96c04bff62768fd..333069e552a791726c67705ce4b5720fada18bab 100644 --- a/share/libc/__fc_define_iovec.h +++ b/share/libc/__fc_define_iovec.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_key_t.h b/share/libc/__fc_define_key_t.h new file mode 100644 index 0000000000000000000000000000000000000000..e581a91bb805bcaa67c503ace0d57c519f3a9032 --- /dev/null +++ b/share/libc/__fc_define_key_t.h @@ -0,0 +1,31 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_DEFINE_KEY_T +#define __FC_DEFINE_KEY_T +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS +typedef unsigned int key_t; +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/__fc_define_mode_t.h b/share/libc/__fc_define_mode_t.h index ac40302cf16a99c5b6b5e5527a4d32603a9fb59d..bc063e632041895428772f48278e8b233bcee5ed 100644 --- a/share/libc/__fc_define_mode_t.h +++ b/share/libc/__fc_define_mode_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_nlink_t.h b/share/libc/__fc_define_nlink_t.h index b6f0aa6eaf75bd349a01af2d773ec391121c27f4..25a5ee0f2b019830416b8651a6d6fe0542ad68f5 100644 --- a/share/libc/__fc_define_nlink_t.h +++ b/share/libc/__fc_define_nlink_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_null.h b/share/libc/__fc_define_null.h index 47575f28dd9f319bcb559e2d203f5ddc950d3d2f..7b4333ac16e591089cf515b47137227a9ac57993 100644 --- a/share/libc/__fc_define_null.h +++ b/share/libc/__fc_define_null.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_off_t.h b/share/libc/__fc_define_off_t.h index 1e22a3e6f846eb5152fd3846abacaa35be50b30d..33d94e6738b8d0c2f6fe2613f39f696e49cf3329 100644 --- a/share/libc/__fc_define_off_t.h +++ b/share/libc/__fc_define_off_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_pid_t.h b/share/libc/__fc_define_pid_t.h index 521d489f53b34d5cea57b007f2425caea3d32be6..f5b2426d557d3c8bf13af6883bd76d5f2d5a3814 100644 --- a/share/libc/__fc_define_pid_t.h +++ b/share/libc/__fc_define_pid_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_pthread_types.h b/share/libc/__fc_define_pthread_types.h new file mode 100644 index 0000000000000000000000000000000000000000..d26391a5983995edc1823fee7575dee35b9a34bc --- /dev/null +++ b/share/libc/__fc_define_pthread_types.h @@ -0,0 +1,45 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_DEFINE_PTHREAD_TYPES_T +#define __FC_DEFINE_PTHREAD_TYPES_T +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS +// These types are defined as structs with a meaningless field just to provide +// stronger typing constraints +typedef struct { int _fc; } pthread_attr_t; +typedef struct { int _fc; } pthread_barrier_t; +typedef struct { int _fc; } pthread_barrierattr_t; +typedef struct { int _fc; } pthread_cond_t; +typedef struct { int _fc; } pthread_condattr_t; +typedef struct { int _fc; } pthread_key_t; +typedef struct { int _fc; } pthread_mutex_t; +typedef struct { int _fc; } pthread_mutexattr_t; +typedef struct { int _fc; } pthread_once_t; +typedef struct { int _fc; } pthread_rwlock_t; +typedef struct { int _fc; } pthread_rwlockattr_t; +typedef struct { int _fc; } pthread_spinlock_t; +typedef struct { int _fc; } pthread_t; +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/__fc_define_sa_family_t.h b/share/libc/__fc_define_sa_family_t.h index b38d535082a0c59a030aadba3cc0892a679f1e42..eb9a0782c8c5c0e3d92de839ccad9ce7d4a4f510 100644 --- a/share/libc/__fc_define_sa_family_t.h +++ b/share/libc/__fc_define_sa_family_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_seek_macros.h b/share/libc/__fc_define_seek_macros.h index 386863915fb928e9b94557b300f88c7bdd09993a..847fa4361f3f88d4f3e2931b7827559d0bd951df 100644 --- a/share/libc/__fc_define_seek_macros.h +++ b/share/libc/__fc_define_seek_macros.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_sigset_t.h b/share/libc/__fc_define_sigset_t.h index ad44bed2cfe3f9cdbfc4420cb9d87a499bf267d3..94e12d239c38da504b62e78a920c64449fcda3bb 100644 --- a/share/libc/__fc_define_sigset_t.h +++ b/share/libc/__fc_define_sigset_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_size_t.h b/share/libc/__fc_define_size_t.h index a0e34c3f144cbfaef27334905d697dc87c8fa9f7..b8e4fe9448e45af654bb3736247689c2ea07544a 100644 --- a/share/libc/__fc_define_size_t.h +++ b/share/libc/__fc_define_size_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_sockaddr.h b/share/libc/__fc_define_sockaddr.h index 7432537301d069575b1c03fff28ea5a6f8cce31d..6643586311b19f5660f27f94c37013a4ef82c2a9 100644 --- a/share/libc/__fc_define_sockaddr.h +++ b/share/libc/__fc_define_sockaddr.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_ssize_t.h b/share/libc/__fc_define_ssize_t.h index 56529481da41760c1c066c4260d63046204121fa..decc87313be4bf6d2ecabd4839328ee9f5d3e0b6 100644 --- a/share/libc/__fc_define_ssize_t.h +++ b/share/libc/__fc_define_ssize_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_stat.h b/share/libc/__fc_define_stat.h index a379398a8cb2236c7b4bd5f8aca84c0589c9921d..fa57dd3fd1a3970614a475e163fafaa212ddca38 100644 --- a/share/libc/__fc_define_stat.h +++ b/share/libc/__fc_define_stat.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_suseconds_t.h b/share/libc/__fc_define_suseconds_t.h index ef50da0a5e9ba9d061c6da70f9702d45cc21d91b..1e6bd49d8192aa04f17a3bfef182f5ea6830c7db 100644 --- a/share/libc/__fc_define_suseconds_t.h +++ b/share/libc/__fc_define_suseconds_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_time_t.h b/share/libc/__fc_define_time_t.h index 36fa98a77658e27a1cd6b379993613b816829f7c..fcc9cf10753100eff05d069950aab9364ea785b3 100644 --- a/share/libc/__fc_define_time_t.h +++ b/share/libc/__fc_define_time_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -24,8 +24,9 @@ #define __FC_DEFINE_TIME_T #include "features.h" __PUSH_FC_STDLIB +#include "__fc_machdep.h" __BEGIN_DECLS -typedef long int time_t; +typedef __FC_TIME_T time_t; __END_DECLS __POP_FC_STDLIB #endif diff --git a/share/libc/__fc_define_timespec.h b/share/libc/__fc_define_timespec.h index 80f09b7616d16de153d6466f5eb3b37fe120275e..255c1c81b743be6229fe218103324ed40661820a 100644 --- a/share/libc/__fc_define_timespec.h +++ b/share/libc/__fc_define_timespec.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_uid_and_gid.h b/share/libc/__fc_define_uid_and_gid.h index fece9a22650bdb012f55b0b2b44dfc38042f8bf8..6b50f7e6da0750d677a8058c292b3a288e6cc1aa 100644 --- a/share/libc/__fc_define_uid_and_gid.h +++ b/share/libc/__fc_define_uid_and_gid.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_useconds_t.h b/share/libc/__fc_define_useconds_t.h index 8e26d19953faaa763e0dba16b6e554cec2a8c300..71138fc5cba4c64243e2c4c88744781b97118405 100644 --- a/share/libc/__fc_define_useconds_t.h +++ b/share/libc/__fc_define_useconds_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_define_wchar_t.h b/share/libc/__fc_define_wchar_t.h index c4b8da31bd4e817646b2db37dc1e5f2dacf73ae0..7f59db827696061532fc037d59acc7b282e813d8 100644 --- a/share/libc/__fc_define_wchar_t.h +++ b/share/libc/__fc_define_wchar_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,6 +22,9 @@ #ifndef __FC_DEFINE_WCHAR_T #define __FC_DEFINE_WCHAR_T +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS #include "__fc_machdep.h" #if !defined(__cplusplus) /* wchar_t is a keyword in C++ and shall not be a typedef. */ @@ -29,4 +32,6 @@ typedef __WCHAR_T wchar_t; #else typedef __WCHAR_T fc_wchar_t; #endif +__END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/__fc_define_wint_t.h b/share/libc/__fc_define_wint_t.h index 8463fc8e22c4fffe3ca0bde598be5f6925705228..123319a1923c79304e379f78f3d683353736f58a 100644 --- a/share/libc/__fc_define_wint_t.h +++ b/share/libc/__fc_define_wint_t.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/__fc_machdep.h b/share/libc/__fc_machdep.h index 095d972bb8ec45b5870dd38fdfdd1087a7528c6e..a7cb15cd5ba82e34bc54b045868bbd6bb20cfaf2 100644 --- a/share/libc/__fc_machdep.h +++ b/share/libc/__fc_machdep.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -38,6 +38,9 @@ #define __CHAR_BIT 8 #define __PTRDIFF_T int #define __SIZE_T unsigned int +#define __FC_INT_MIN (-2147483647 - 1) +#define __FC_INT_MAX 2147483647 +#define __FC_UINT_MAX 4294967295U #define __FC_LONG_MAX 2147483647L #define __FC_ULONG_MAX 4294967295UL #define __FC_SIZE_MAX __FC_UINT_MAX @@ -61,7 +64,13 @@ /* stdint.h */ #define __FC_PTRDIFF_MIN __FC_INT_MIN #define __FC_PTRDIFF_MAX __FC_INT_MAX +/* wchar.h */ +#define __WINT_T unsigned int +#define __FC_WEOF (0xFFFFFFFFU) +#define __FC_WINT_MIN 0 +#define __FC_WINT_MAX __FC_UINT_MAX +// End of X86_32 #else #ifdef __FC_MACHDEP_X86_64 #define __FC_FORCE_INCLUDE_MACHDEP__ @@ -78,6 +87,9 @@ #define __CHAR_BIT 8 #define __PTRDIFF_T long #define __SIZE_T unsigned long +#define __FC_INT_MIN (-2147483647 - 1) +#define __FC_INT_MAX 2147483647 +#define __FC_UINT_MAX 4294967295U #define __FC_LONG_MAX 9223372036854775807L #define __FC_ULONG_MAX 18446744073709551615UL #define __FC_SIZE_MAX __FC_ULONG_MAX @@ -101,6 +113,13 @@ /* stdint.h */ #define __FC_PTRDIFF_MIN __FC_LONG_MIN #define __FC_PTRDIFF_MAX __FC_LONG_MAX +/* wchar.h */ +#define __WINT_T unsigned int +#define __FC_WEOF (0xFFFFFFFFU) +#define __FC_WINT_MIN 0 +#define __FC_WINT_MAX __FC_UINT_MAX + +// End of X86_64 #else #ifdef __FC_MACHDEP_X86_16 #define __FC_FORCE_INCLUDE_MACHDEP__ @@ -116,10 +135,13 @@ #define __SIZEOF_LONGLONG 8 #define __CHAR_BIT 8 #define __PTRDIFF_T long -#define __SIZE_T unsigned long +#define __SIZE_T unsigned int +#define __FC_INT_MIN (-32768) +#define __FC_INT_MAX 32767 +#define __FC_UINT_MAX 65535U #define __FC_LONG_MAX 2147483647L #define __FC_ULONG_MAX 4294967295UL -#define __FC_SIZE_MAX __FC_ULONG_MAX +#define __FC_SIZE_MAX 65535U /* Optional */ #define __INTPTR_T signed long @@ -140,6 +162,14 @@ /* stdint.h */ #define __FC_PTRDIFF_MIN __FC_LONG_MIN #define __FC_PTRDIFF_MAX __FC_LONG_MAX + +/* wchar.h */ +#define __WINT_T unsigned long +#define __FC_WEOF (0xFFFFFFFFUL) +#define __FC_WINT_MIN 0 +#define __FC_WINT_MAX __FC_ULONG_MAX + +// End of X86_16 #else #ifdef __FC_MACHDEP_PPC_32 #define __FC_FORCE_INCLUDE_MACHDEP__ @@ -156,6 +186,9 @@ #define __CHAR_BIT 8 #define __PTRDIFF_T int #define __SIZE_T unsigned int +#define __FC_INT_MIN (-2147483647 - 1) +#define __FC_INT_MAX 2147483647 +#define __FC_UINT_MAX 4294967295U #define __FC_LONG_MAX 2147483647L #define __FC_ULONG_MAX 4294967295UL #define __FC_SIZE_MAX __FC_UINT_MAX @@ -179,10 +212,22 @@ /* stdint.h */ #define __FC_PTRDIFF_MIN __FC_INT_MIN #define __FC_PTRDIFF_MAX __FC_INT_MAX +#define __FC_INTMAX_MIN (-9223372036854775807LL -1LL) +#define __FC_INTMAX_MAX 9223372036854775807LL +#define __FC_UINTMAX_MAX 18446744073709551615ULL +/* time.h */ +#define __FC_TIME_T long +/* wchar.h */ +#define __WINT_T unsigned int +#define __FC_WEOF (0xFFFFFFFFU) +#define __FC_WINT_MIN 0 +#define __FC_WINT_MAX __FC_UINT_MAX +// End of PPC_32 #else #ifdef __FC_MACHDEP_MSVC_X86_64 #define __FC_BYTE_ORDER __LITTLE_ENDIAN + /* Required */ #undef __CHAR_UNSIGNED__ #define __WORDSIZE 64 @@ -206,13 +251,13 @@ #define __FC_SHRT_MIN (-32768) #define __FC_SHRT_MAX 32767 #define __FC_USHRT_MAX 65535 -#define __FC_INT_MIN (-INT_MAX - 1) +#define __FC_INT_MIN (-2147483647 - 1) #define __FC_INT_MAX 2147483647 #define __FC_UINT_MAX 4294967295U -#define __FC_LONG_MIN (-LONG_MAX -1L) +#define __FC_LONG_MIN (-2147483647L -1L) #define __FC_LONG_MAX 2147483647L #define __FC_ULONG_MAX 4294967295UL -#define __FC_LLONG_MIN (-LLONG_MAX -1LL) +#define __FC_LLONG_MIN (-9223372036854775807LL -1LL) #define __FC_LLONG_MAX 9223372036854775807LL #define __FC_ULLONG_MAX 18446744073709551615ULL #define __FC_PATH_MAX 256 @@ -257,21 +302,62 @@ /* POSIX */ #define __SSIZE_T signed long long /* stdint.h */ +#define __FC_WCHAR_MIN 0 +#define __FC_WCHAR_MAX __FC_USHRT_MAX #define __FC_PTRDIFF_MIN __FC_LLONG_MIN #define __FC_PTRDIFF_MAX __FC_LLONG_MAX +#define __FC_INTMAX_MIN (-9223372036854775807LL -1LL) +#define __FC_INTMAX_MAX 9223372036854775807LL +#define __FC_UINTMAX_MAX 18446744073709551615ULL +/* time.h */ +#define __FC_TIME_T __int64 /* for stdarg.h */ #define __FC_VA_LIST_T char* +/* wchar.h */ +// note: wint_t should contain all values of wchar_t plus WEOF; but this version +// of MSVC does not necessarily respect the standard +#define __WINT_T unsigned short +#define __FC_WEOF (0xFFFFU) +#define __FC_WINT_MIN 0 +#define __FC_WINT_MAX __FC_USHRT_MAX + /* The following macros are defined to correspond to the version of MSVC used during the definition of some MSVC-specific features: Visual Studio 2010. They also help detecting, in some tests, whether we are in MSVC mode. */ #define _MSC_FULL_VER 160040219 #define _MSC_VER 1600 -// __ptr64 is MSVC-specific and needs to be undefined for us to parse it + +// MSVC-specific definitions; necessary when parsing MSVC libraries using +// non-MSVC preprocessors and compilers #undef __ptr64 #define __ptr64 - +#undef __ptr32 +#define __ptr32 +#undef __unaligned +#define __unaligned +#undef __cdecl +#define __cdecl +#undef __possibly_notnullterminated +#define __possibly_notnullterminated +#ifndef errno_t +# define errno_t int +# define _ERRNO_T_DEFINED +#endif +#ifndef _WIN64 +# define _WIN64 1 +#endif +#ifndef _AMD64_ +# define _AMD64_ 1 +#endif +#ifndef _M_AMD64 +# define _M_AMD64 1 +#endif +#ifndef _M_X64 +# define _M_X64 1 +#endif +// End of MSVC_X86_64 #else #error Must define __FC_MACHDEP_<M>, where <M> is one of the \ following: X86_32, X86_64, X86_16, PPC_32, MSVC_X86_64. \ diff --git a/share/libc/__fc_machdep_linux_gcc_shared.h b/share/libc/__fc_machdep_linux_gcc_shared.h index 38be4519e00105ee3af3000a8145594b926fcf60..14852604b6b416b539c15f51ca1dd2c1ca233b01 100644 --- a/share/libc/__fc_machdep_linux_gcc_shared.h +++ b/share/libc/__fc_machdep_linux_gcc_shared.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -62,11 +62,8 @@ #define __FC_SHRT_MIN (-32768) #define __FC_SHRT_MAX 32767 #define __FC_USHRT_MAX 65535 -#define __FC_INT_MIN (-INT_MAX - 1) -#define __FC_INT_MAX 2147483647 -#define __FC_UINT_MAX 4294967295U -#define __FC_LONG_MIN (-LONG_MAX -1L) -#define __FC_LLONG_MIN (-LLONG_MAX -1LL) +#define __FC_LONG_MIN (-2147483647L -1L) +#define __FC_LLONG_MIN (-9223372036854775807LL -1LL) #define __FC_LLONG_MAX 9223372036854775807LL #define __FC_ULLONG_MAX 18446744073709551615ULL #define __FC_PATH_MAX 256 @@ -74,25 +71,18 @@ /* for stdarg.h */ #define __FC_VA_LIST_T __builtin_va_list -/* Unused at this time */ -#define __FC_umax(n) ((uint##n##_t)(-1)) -#define __FC_smin(n) (2*(-(1ll << (sizeof(int##n##_t)*__CHAR_BIT - 2)))) -#define __FC_smax(n) ((1ll<<(sizeof(int##n##_t)*__CHAR_BIT - 2))-1+(1ll<<(sizeof(int##n##_t)*__CHAR_BIT - 2))) - /* stdint.h */ /* NB: in signal.h, sig_atomic_t is hardwired to int. */ #define __FC_SIG_ATOMIC_MIN __FC_INT_MIN #define __FC_SIG_ATOMIC_MAX __FC_INT_MAX #define __FC_WCHAR_MIN __FC_INT_MIN #define __FC_WCHAR_MAX __FC_INT_MAX +#define __FC_INTMAX_MIN (-9223372036854775807LL -1LL) +#define __FC_INTMAX_MAX 9223372036854775807LL +#define __FC_UINTMAX_MAX 18446744073709551615ULL -// To be defined in coordination with wchar.h which is currently unsupported +// Linux/GCC usually defines wchar_t as a signed int, but this is not required #define __WCHAR_T int -#define __FC_WINT_MIN __FC_INT_MIN -#define __FC_WINT_MAX __FC_INT_MAX -// 7.25 mandates that WINT_T can handle at least one character in addition -// to those that are in the extended character set (to account for EOF) -#define __WINT_T long long int /* stdio.h */ #define __FC_BUFSIZ 8192 @@ -232,7 +222,7 @@ #define __FC_EOWNERDEAD 165 #define __FC_ENOTRECOVERABLE 166 -/* sys/un.h */ -#define __FC_SOCKADDR_SUN_SUN_PATH 108 +/* time.h */ +#define __FC_TIME_T long #endif diff --git a/share/libc/__fc_select.h b/share/libc/__fc_select.h index 51b198e86b751855d41ce1320b90b0c4536a4c1a..0df267ada6a138625bb626cd5fc978995ba6d2c2 100644 --- a/share/libc/__fc_select.h +++ b/share/libc/__fc_select.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -40,7 +40,41 @@ extern int pselect(int nfds, fd_set * readfds, const struct timespec * timeout, const sigset_t * sigmask); -/* assigns \result \from nfds, *readfds, *writefds,*errorfds,*timeout ;*/ +// __fc_fds_state is a very coarse model for the state of all +// file descriptor sets; it is sound, but very imprecise. +//@ ghost volatile int __fc_fds_state; + +/*@ + requires nfds >= 0; + requires readfds == \null || \valid(readfds); + requires writefds == \null || \valid(writefds); + requires errorfds == \null || \valid(errorfds); + requires timeout == \null || \valid(timeout); + assigns __fc_fds_state \from __fc_fds_state; + assigns readfds == \null ? \empty : *readfds, + writefds == \null ? \empty : *writefds, + errorfds == \null ? \empty : *errorfds, + timeout == \null ? \empty : *timeout, + \result + \from indirect:nfds, + indirect:readfds, indirect:*readfds, + indirect:writefds, indirect:*writefds, + indirect:errorfds, indirect:*errorfds, + indirect:timeout, indirect:*timeout, + __fc_fds_state; + behavior read_notnull: + assumes readfds != \null; + ensures \initialized(readfds); + behavior write_notnull: + assumes writefds != \null; + ensures \initialized(writefds); + behavior error_notnull: + assumes errorfds != \null; + ensures \initialized(errorfds); + behavior timeout_notnull: + assumes timeout != \null; + ensures \initialized(timeout); + */ extern int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); diff --git a/share/libc/__fc_string_axiomatic.h b/share/libc/__fc_string_axiomatic.h index 73c2db2ca7e20eaadeecc8065409761fbe8d938c..58d3fa5205bc2d7f453a25b03c291330db89d637 100644 --- a/share/libc/__fc_string_axiomatic.h +++ b/share/libc/__fc_string_axiomatic.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -248,12 +248,21 @@ __BEGIN_DECLS @ predicate valid_read_string{L}(char *s) = @ 0 <= strlen(s) && \valid_read(s+(0..strlen(s))); @ + @ predicate valid_read_nstring{L}(char *s, ℤ n) = + @ \valid_read(s+(0..n-1)) || valid_read_string{L}(s); + @ @ predicate valid_string_or_null{L}(char *s) = @ s == \null || valid_string(s); @ @ predicate valid_wstring{L}(wchar_t *s) = @ 0 <= wcslen(s) && \valid(s+(0..wcslen(s))); @ + @ predicate valid_read_wstring{L}(wchar_t *s) = + @ 0 <= wcslen(s) && \valid_read(s+(0..wcslen(s))); + @ + @ predicate valid_read_nwstring{L}(wchar_t *s, ℤ n) = + @ \valid_read(s+(0..n-1)) || valid_read_wstring{L}(s); + @ @ predicate valid_wstring_or_null{L}(wchar_t *s) = @ s == \null || valid_wstring(s); @*/ diff --git a/share/libc/__fc_builtin_for_normalization.i b/share/libc/alloca.h similarity index 60% rename from share/libc/__fc_builtin_for_normalization.i rename to share/libc/alloca.h index 2d06d9ab6955c99e437e294693285b435df57a30..f410c394fa95de43fc0fe965b04550b8e9e79dc2 100644 --- a/share/libc/__fc_builtin_for_normalization.i +++ b/share/libc/alloca.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -20,26 +20,28 @@ /* */ /**************************************************************************/ -// Functions used internally by the normalization phase. -// This file is systematically included by Frama-C's kernel. -// FC's code normalization can use some of the functions declared here. -// If you add something here, be sure to use the FC_BUILTIN attribute, -// that will ensure that the builtin is printed iff it is actually used -// in the normalized code. +#ifndef __FC_ALLOCA +#define __FC_ALLOCA +#include "features.h" +__PUSH_FC_STDLIB +#include <stdlib.h> -/*@ requires \valid(dest+(0..n-1)); - assigns dest[0..n-1] \from \nothing; - ensures \forall integer i; 0<= i < n ==> dest[i] == 0; - */ -extern void Frama_C_bzero(unsigned char* dest, unsigned long n) - __attribute__((FC_BUILTIN)) ; +__BEGIN_DECLS -/*@ requires \valid(dest+(0..(size*n-1))); - requires n >= 1; - assigns dest[size..(size*n -1)] \from dest[0..size-1]; - ensures \forall integer i,j; 0<=i<size && 1<=j<n ==> - dest[i+j*size] == dest[i]; +/*@ ghost extern int __fc_stack_status __attribute__((FRAMA_C_MODEL)); */ + +// Note: alloca is considered to never fail, unlike malloc +// Currently, ACSL does not allow specifying that the memory allocated by +// alloca must be freed at the end of the execution of its caller, +// therefore this responsibility is given to the user of this function. +/*@ + allocates \result; + assigns __fc_stack_status \from size, __fc_stack_status; + assigns \result \from indirect:size, indirect:__fc_stack_status; + ensures \fresh(\result,size); */ -extern void Frama_C_copy_block(unsigned char* dest, - unsigned long size, unsigned long n) - __attribute__((FC_BUILTIN)) ; +void *alloca(size_t size); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/arpa/inet.h b/share/libc/arpa/inet.h index e1d09ca095f835aef80df0eb5c720e7551bc5b81..ce35dc151dae6cb722f94a62ec31ce2af47ca8a2 100644 --- a/share/libc/arpa/inet.h +++ b/share/libc/arpa/inet.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/assert.c b/share/libc/assert.c index c8c0c180f19946d3e4077cf4739d320904fb1fdb..60edb127e5eb203a9b98b673d18113331263b18c 100644 --- a/share/libc/assert.c +++ b/share/libc/assert.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/assert.h b/share/libc/assert.h index de64e4d807e7bd1dbd35c7a4a022bfa7907bef80..846d850b5fbe5cfb9fc5979a40666ce1ee2c4c36 100644 --- a/share/libc/assert.h +++ b/share/libc/assert.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/byteswap.h b/share/libc/byteswap.h index 568e602f7aecb99be0a8691ecfc14fd23b3103d6..be3ef3450d28303dd9ff0f47b200e8b3717e9322 100644 --- a/share/libc/byteswap.h +++ b/share/libc/byteswap.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/complex.h b/share/libc/complex.h index 1224596a14cd7e179518e7564a9b78abb0a7f397..97fb7e76c029a60a29563f7ac38f4fda035509ad 100644 --- a/share/libc/complex.h +++ b/share/libc/complex.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/ctype.c b/share/libc/ctype.c index e1744bb74bc9305335b671a06cabde785e85d792..cbeed915d2f36813addc5363e86cb62a397755ba 100644 --- a/share/libc/ctype.c +++ b/share/libc/ctype.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/ctype.h b/share/libc/ctype.h index ab94bbccae1c92c7727fb9d3225104e2bdd84bfd..b8694b62329e5803141cf521dd844cbc93ddc3e2 100644 --- a/share/libc/ctype.h +++ b/share/libc/ctype.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/dirent.h b/share/libc/dirent.h index 868c29cc301a12689c0176f41f05e92d4bce3bc5..f3f3c2ea00b0a7a983b876c1a39fcfbe3d716769 100644 --- a/share/libc/dirent.h +++ b/share/libc/dirent.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/dlfcn.h b/share/libc/dlfcn.h index 8372d9eabc7745e7c5b91f73bbd1840e0bb50b1f..730949bdca710fcc81e7fc1ce57c020e9cea4d94 100644 --- a/share/libc/dlfcn.h +++ b/share/libc/dlfcn.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/endian.h b/share/libc/endian.h index a05e4d884c536a6e4bf843458429a23600bf3fb5..8eea3cc64ff2f596e9d393f7f4dda39be0a58f34 100644 --- a/share/libc/endian.h +++ b/share/libc/endian.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/errno.c b/share/libc/errno.c index f17711bfdaab3e0bec3b1608f5efa696d7b75ab9..7168e690bcba14fba458f873ea3f3c22d1a4dc93 100644 --- a/share/libc/errno.c +++ b/share/libc/errno.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/errno.h b/share/libc/errno.h index dad340997a30e4fe04af4e05b36a0efc09a1aa15..8ed6d63ed103e30c0f4e0ada0fa4cc202c737d07 100644 --- a/share/libc/errno.h +++ b/share/libc/errno.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/fc_runtime.c b/share/libc/fc_runtime.c index e330c7e35e18fdfb3078c9d2a7587d1afeb14736..4af03d6e4a8e731436bd206a9c6fd54747201c73 100644 --- a/share/libc/fc_runtime.c +++ b/share/libc/fc_runtime.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/fcntl.h b/share/libc/fcntl.h index cde4c0592c42d2f5fde3660166917a95ae64b50f..aacb76830c388cfebcb192de21219d0237005ae3 100644 --- a/share/libc/fcntl.h +++ b/share/libc/fcntl.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -29,14 +29,68 @@ __PUSH_FC_STDLIB #include "__fc_define_pid_t.h" #include "__fc_define_mode_t.h" -/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ -#define F_RDLCK 0 /* Read lock. */ -#define F_WRLCK 1 /* Write lock. */ -#define F_UNLCK 2 /* Remove lock. */ +// The values for the constants below are based on an x86 Linux, +// declared in the order given by POSIX.1-2008. +// Macros which are not defined in such Linux are commented out. +#define F_DUPFD 0 +#define F_DUPFD_CLOEXEC 0x406 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#define F_GETOWN 9 +#define F_SETOWN 8 -/* For old implementation of bsd flock(). */ -#define F_EXLCK 4 /* or 3 */ -#define F_SHLCK 8 /* or 4 */ +#define FD_CLOEXEC 1 + +#define F_RDLCK 0 +#define F_UNLCK 2 +#define F_WRLCK 1 + +#include "__fc_define_seek_macros.h" + +#define O_CLOEXEC 0x80000 +#define O_CREAT 0x40 +#define O_DIRECTORY 0x10000 +#define O_EXCL 0x80 +#define O_NOCTTY 0x100 +#define O_NOFOLLOW 0x20000 +#define O_TRUNC 0x200 +//#define O_TTY_INIT + +#define O_APPEND 0x400 +#define O_DSYNC 0x1000 +#define O_NONBLOCK 0x800 +#define O_RSYNC 0x101000 +#define O_SYNC 0x101000 + +#define O_ACCMODE 3 + +//#define O_EXEC +#define O_RDONLY 0 +#define O_RDWR 2 +//#define O_SEARCH +#define O_WRONLY 1 + +#define AT_FDCWD -100 + +#define AT_EACCESS 0x200 + +#define AT_SYMLINK_NOFOLLOW 0x100 + +#define AT_SYMLINK_FOLLOW 0x400 + +#define AT_REMOVEDIR 0x200 + +#define POSIX_FADV_DONTNEED 4 +#define POSIX_FADV_NOREUSE 5 +#define POSIX_FADV_NORMAL 0 +#define POSIX_FADV_RANDOM 1 +#define POSIX_FADV_SEQUENTIAL 2 +#define POSIX_FADV_WILLNEED 3 __BEGIN_DECLS @@ -49,67 +103,6 @@ struct flock pid_t l_pid; /* Process holding the lock. */ }; -#define F_DUPFD 1 -#define F_GETFD 2 -#define F_SETFD 3 -#define F_GETFL 4 -#define F_SETFL 5 -#define F_GETLK 6 -#define F_SETLK 7 -#define F_SETLKW 8 -#define F_GETOWN 9 -#define F_SETOWN 10 - -#define FD_CLOEXEC 1 - -#include "__fc_define_seek_macros.h" - -# define AT_FDCWD -100 /* Special value used to indicate - the *at functions should use the - current working directory. */ -# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ -# define AT_REMOVEDIR 0x200 /* Remove directory instead of - unlinking file. */ -# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ -# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount - traversal. */ -# define AT_EACCESS 0x200 /* Test access permitted for - effective IDs, not real IDs. */ - - -#define O_RDONLY 0x0000 /* open for reading only */ -#define O_WRONLY 0x0001 /* open for writing only */ -#define O_RDWR 0x0002 /* open for reading and writing */ -#define O_ACCMODE 0x0003 /* mask for above modes */ -#define O_NONBLOCK 0x0004 /* no delay */ -#define O_APPEND 0x0008 /* set append mode */ -#define O_CREAT 0x0200 /* create if nonexistent */ -#define O_TRUNC 0x0400 /* truncate to zero length */ -#define O_EXCL 0x0800 /* error if already exists */ - -#define O_NDELAY O_NONBLOCK -#define O_SYNC 04010000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 - -# define O_DIRECTORY 0200000 /* Must be a directory. */ -# define O_NOFOLLOW 0400000 /* Do not follow links. */ -# define O_CLOEXEC 02000000 /* Set close_on_exec. */ - -# define O_DIRECT 040000 /* Direct disk access. */ -# define O_NOATIME 01000000 /* Do not set atime. */ - -/* Advise to `posix_fadvise'. */ -# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ -# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ - -/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */ -#define O_NOCTTY 0x8000 /* don't assign controlling terminal */ - /*@ assigns \result \from filename[0..], mode ; */ extern int creat(const char *filename, mode_t mode); /*@ assigns \result \from fd, cmd ; */ @@ -119,8 +112,6 @@ extern int open(const char *filename, int flags, ...); /*@ assigns \result \from dirfd, filename[0..], flags ; */ extern int openat(int dirfd, const char *filename, int flags, ...); - - /* The following functions are "fixed-argument" versions of open/fcntl. They are used when the translation of variadic function to fixed-adic is enabled */ @@ -149,6 +140,15 @@ extern int __va_openat_void(int dirfd, const char *filename, int flags); /*@ assigns \result \from dirfd, filename[0..], flags, mode ; */ extern int __va_openat_mode_t(int dirfd, const char *filename, int flags, mode_t mode); +// The constants below are not in POSIX-1.2008, but are kept for compatibility + +#define O_NDELAY O_NONBLOCK +#define O_FSYNC O_SYNC +#define O_ASYNC 0x2000 + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 +#define F_SHLCK 8 __END_DECLS diff --git a/share/libc/features.h b/share/libc/features.h index ff77f7c042fa34a49ef2144cfa98129321da3cd7..2d70295d7e611c6a96a8f8d31c3d3ad9940a39da 100644 --- a/share/libc/features.h +++ b/share/libc/features.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -26,9 +26,6 @@ // *** Definitions to improve compatibility with GCC-specific built-ins // and GNU-based code *** -# define __LEAF -# define __LEAF_ATTR - #ifdef __FRAMAC__ #define __PUSH_FC_STDLIB #pragma fc_stdlib(push,__FILE__) #define __POP_FC_STDLIB #pragma fc_stdlib(pop) @@ -45,10 +42,18 @@ # define __END_DECLS #endif +#undef __LEAF +#define __LEAF +#undef __LEAF_ATTR +#define __LEAF_ATTR + +#undef __THROW +#undef __THROWNL +#undef __NTH #if defined __cplusplus # define __THROW throw () # define __THROWNL throw () -# define __NTH(fct) __LEAF_ATTR fct throw () +# define __NTH(fct) fct throw () #else # define __THROW # define __THROWNL @@ -61,18 +66,23 @@ // the compiler were unable to statically determine // the object size (we only consider the cases where type // is either 0 or 1). +// Note that for some built-ins, we force them to our definition, +// while others we leave unmodified if they exist +#undef __builtin_object_size #define __builtin_object_size (ptr, type) ((size_t)-1) +#undef __bos #define __bos(ptr) __builtin_object_size (ptr, 0) +#undef __bos0 #define __bos0(ptr) __builtin_object_size (ptr, 0) +#undef __warndecl #define __warndecl(name, msg) extern void name (void) +#undef __warnattr #define __warnattr(msg) +#undef __errordecl #define __errordecl(name, msg) extern void name (void) -// Protection against pre-processor built-ins -#if defined __nonnull -# undef __nonnull -#endif +#undef __nonnull #define __nonnull(args...) #ifndef __attribute_deprecated__ @@ -91,6 +101,7 @@ # define __attribute_artificial__ /* Ignore */ #endif +#undef __attribute_warn_unused_result__ #define __attribute_warn_unused_result__ /* empty */ #ifndef __wur # define __wur /* Ignore */ diff --git a/share/libc/fenv.h b/share/libc/fenv.h index 3873a7f93c35985552e0e40120034d297fec873b..118c3a0e11f2c78529378a24fc8a3951ed0c8262 100644 --- a/share/libc/fenv.h +++ b/share/libc/fenv.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/float.h b/share/libc/float.h index 1ca6a92e1221de88f94746bfa4bcf29f82824d55..01312f673f6f21c15a03e6fe069a3f95341c440a 100644 --- a/share/libc/float.h +++ b/share/libc/float.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/fnmatch.h b/share/libc/fnmatch.h new file mode 100644 index 0000000000000000000000000000000000000000..2442bb754a2cf8eae896d632863857ef9a6271c8 --- /dev/null +++ b/share/libc/fnmatch.h @@ -0,0 +1,40 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_FNMATCH +#define __FC_FNMATCH +#include "features.h" +__PUSH_FC_STDLIB + +// The values for the constants below are based on those +// of the glibc, declared in the order given by POSIX.1-2008. + +#define FNM_NOMATCH 1 +#define FNM_PATHNAME (1 << 0) +#define FNM_PERIOD (1 << 2) +#define FNM_NOESCAPE (1 << 1) + +extern int fnmatch(const char *, const char *, int); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/getopt.c b/share/libc/getopt.c index ecb2d94a7d3959d745cbe762f64f2329d4ea3e0f..794d39b48377123526c7f30eca565fa8798170a9 100644 --- a/share/libc/getopt.c +++ b/share/libc/getopt.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/getopt.h b/share/libc/getopt.h index 46c39a0953980c85cc053565f79f646b84276a21..1be1ac2551b9faa57a23fa95c5eeffcf775f57e5 100644 --- a/share/libc/getopt.h +++ b/share/libc/getopt.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/glob.h b/share/libc/glob.h index f24dd96fb08bb4de5d4a214c02404dfb0471e9aa..2c52f97f68261683c2765e75769378560b10ce26 100644 --- a/share/libc/glob.h +++ b/share/libc/glob.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/grp.h b/share/libc/grp.h index 80e784bc4725b5aad07cdac8fde634df94b2291b..065f940353e059e61046a5171d9fdc50d27fae93 100644 --- a/share/libc/grp.h +++ b/share/libc/grp.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/iconv.h b/share/libc/iconv.h index cd0773be04ab72a0abdc467e3fd8e7a9fc2fd9bf..c4260a261f46e8602e3461f20903cc6ebc0c28b5 100644 --- a/share/libc/iconv.h +++ b/share/libc/iconv.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/ifaddrs.h b/share/libc/ifaddrs.h index 27ea56c134ec2e410d7980ae469176a61e9bba00..d9d0f2a41047001cec98d58292938649c70a4946 100644 --- a/share/libc/ifaddrs.h +++ b/share/libc/ifaddrs.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -31,13 +31,23 @@ __BEGIN_DECLS /* Linux header */ struct ifaddrs { - struct ifaddrs *ifa_next; - char *ifa_name; - unsigned int ifa_flags; - struct sockaddr *ifa_addr; - struct sockaddr *ifa_netmask; - struct sockaddr *ifa_dstaddr; - void *ifa_data; + struct ifaddrs *ifa_next; + char *ifa_name; + unsigned int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + union { + struct sockaddr *ifu_broadaddr; + struct sockaddr *ifu_dstaddr; + } ifa_ifu; +# ifndef ifa_broadaddr +# define ifa_broadaddr ifa_ifu.ifu_broadaddr +# endif +# ifndef ifa_dstaddr +# define ifa_dstaddr ifa_ifu.ifu_dstaddr +# endif + void *ifa_data; }; struct ifmaddrs { diff --git a/share/libc/inttypes.c b/share/libc/inttypes.c index 4805f0a2437f0273df498dbf7399c42789cfee60..835cdeefbd22696f108adf4b31f69e93c861b0d4 100644 --- a/share/libc/inttypes.c +++ b/share/libc/inttypes.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/inttypes.h b/share/libc/inttypes.h index b3ea6fe39b580b73157be50eb15ca31975868e04..e52fc08890c74a871c280de06bb5b56314b515d9 100644 --- a/share/libc/inttypes.h +++ b/share/libc/inttypes.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/iso646.h b/share/libc/iso646.h index 233b83fc2fabae4bd747782b595837f46d98e170..67bcb25f964b847e521787f2ae7cacb0b83c1a2d 100644 --- a/share/libc/iso646.h +++ b/share/libc/iso646.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/libgen.h b/share/libc/libgen.h index cfc7fc987c428100675de78125dc353b449bccef..98ff31cc01b50732afb797f4441e5b889032647b 100644 --- a/share/libc/libgen.h +++ b/share/libc/libgen.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -20,3 +20,15 @@ /* */ /**************************************************************************/ +#ifndef __FC_LIBGEN +#define __FC_LIBGEN +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS + +extern char *basename(char *path); +extern char *dirname(char *path); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/libintl.h b/share/libc/libintl.h index 1c05d4f6b2c54e601d41aca550976aaa6d629a97..0d9a19c33bf5ef44ac920ce1f18c46a50bea3c90 100644 --- a/share/libc/libintl.h +++ b/share/libc/libintl.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/limits.h b/share/libc/limits.h index 6b51c2ce6aa6ca7a801e4ebbf48a567fae3f9d14..2266dfc2e4dfee24d96767366460eccb4ee22540 100644 --- a/share/libc/limits.h +++ b/share/libc/limits.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/linux/fs.h b/share/libc/linux/fs.h index 51f706e00c04849703324380b64a99363441c703..2d3fe2cb44502bee3e591c89d2b452fd97551b15 100644 --- a/share/libc/linux/fs.h +++ b/share/libc/linux/fs.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/linux/if_addr.h b/share/libc/linux/if_addr.h index 5f2fc9a36a98e8d83155d447576943918e571474..f0dd1b2b76221aa465b834c55c5bf94a53525ac7 100644 --- a/share/libc/linux/if_addr.h +++ b/share/libc/linux/if_addr.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/linux/if_netlink.h b/share/libc/linux/if_netlink.h index d70ddaae9fd06c20ee81e84c0587ab9b2947416d..429dfc988f701aa9ff4c0e735c3d8acebf6c81dd 100644 --- a/share/libc/linux/if_netlink.h +++ b/share/libc/linux/if_netlink.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/linux/netlink.h b/share/libc/linux/netlink.h index c919ec9a282f9e069551ea87a95cdb1cf42f5ae2..f8ff8ce38bdaf3041b91da805cb9e0e815d0bcb4 100644 --- a/share/libc/linux/netlink.h +++ b/share/libc/linux/netlink.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/linux/rtnetlink.h b/share/libc/linux/rtnetlink.h index 7d0c549a89a211b0ad530ceb3a10b14d2db77587..7104aed8f20e0f54ed1d67cf497635838bbaf4c6 100644 --- a/share/libc/linux/rtnetlink.h +++ b/share/libc/linux/rtnetlink.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/locale.c b/share/libc/locale.c index 94e3872da83d29f5a3b91eb55359a42408c0df88..7973f14b6b5baaa43bfbfdd29e504917297de1ba 100644 --- a/share/libc/locale.c +++ b/share/libc/locale.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/locale.h b/share/libc/locale.h index 36910e85c18d34853741acfeca1c204b504300b8..bc456c5b61ce7dedabbda2c9987e959507c5f0c3 100644 --- a/share/libc/locale.h +++ b/share/libc/locale.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/math.c b/share/libc/math.c index a218850b4cbe5062dbce0e3280bd22cfa51c5578..03a5731a1981133832c3b0e97c13275456d28455 100644 --- a/share/libc/math.c +++ b/share/libc/math.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/math.h b/share/libc/math.h index bee4cb8047b7cc359c680ceca2b9128dd71c84a2..9e3ac31877579c233a398cd4eddb0f704ad44c7f 100644 --- a/share/libc/math.h +++ b/share/libc/math.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/memory.h b/share/libc/memory.h new file mode 100644 index 0000000000000000000000000000000000000000..85a04435d3e0fa38de7d2807669c1fa70e9de029 --- /dev/null +++ b/share/libc/memory.h @@ -0,0 +1,24 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +// This file is not in the C standard; it exists for compatibility purposes +#include <string.h> diff --git a/share/libc/net/if.h b/share/libc/net/if.h index 1b3cf8e1ddde3a3bc1d9ad926127d936b80ad8cd..c11e9ab0a800b96b12aab92981e6b393cafb47e3 100644 --- a/share/libc/net/if.h +++ b/share/libc/net/if.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,12 +22,12 @@ #ifndef FC_NET_IF #define FC_NET_IF - #include "../features.h" -#include "sys/socket.h" - +__PUSH_FC_STDLIB __BEGIN_DECLS +#include "sys/socket.h" + struct if_nameidx {unsigned if_index; char *if_name;}; #define IF_NAMESIZE 255 extern unsigned if_nametoindex(const char * name); @@ -164,5 +164,6 @@ struct ifconf # define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ __END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/netdb.h b/share/libc/netdb.h index c96377cc39444303aaad25f237dd521eaa1c81d9..924afe34184384c90be12e95f28c502e2ce4a3fa 100644 --- a/share/libc/netdb.h +++ b/share/libc/netdb.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/netinet/in.h b/share/libc/netinet/in.h index edbb6a3777aab970b231ea614a2e21280e9e2720..3e4c7119cb1e151174cb9d3ea4cbdd9505dae722 100644 --- a/share/libc/netinet/in.h +++ b/share/libc/netinet/in.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,13 +22,13 @@ #ifndef __FC_NETINET_IN_H__ #define __FC_NETINET_IN_H__ - #include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS + #include "inttypes.h" #include "sys/socket.h" -__BEGIN_DECLS - typedef uint16_t in_port_t; typedef uint32_t in_addr_t; @@ -56,9 +56,11 @@ struct sockaddr_in6 { #define INADDR_ANY 0 #define INADDR_BROADCAST 0XFFFFFFFFUL +#define INET_ADDRSTRLEN 16 #define IN6ADDR_ANY 0 #define IN6ADDR_BROADCAST 0XFFFFFFFFFFFFFFFFULL +#define INET6_ADDRSTRLEN 46 const struct in6_addr in6addr_any={{0}}; const struct in6_addr in6addr_loopback= @@ -316,5 +318,5 @@ struct in_pktinfo #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ __END_DECLS - +__POP_FC_STDLIB #endif diff --git a/share/libc/netinet/in_systm.h b/share/libc/netinet/in_systm.h index 5ae8588b62e8bcf726256ec496e78c187ada96a3..d478850331c11629f1473782c4de28e7742129fa 100644 --- a/share/libc/netinet/in_systm.h +++ b/share/libc/netinet/in_systm.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/netinet/ip.h b/share/libc/netinet/ip.h index 0e188b77a3838cf98e469a8fd77d75ed9ef16ffb..5e018f0954cd745c7b90968e37d5ccfcb61c4c9f 100644 --- a/share/libc/netinet/ip.h +++ b/share/libc/netinet/ip.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/netinet/ip_icmp.h b/share/libc/netinet/ip_icmp.h index a368b966e486c31aceaf4d058b88959eeb0204fd..567420fbeb6f9189dfd9be67c38768fe088ebeac 100644 --- a/share/libc/netinet/ip_icmp.h +++ b/share/libc/netinet/ip_icmp.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/netinet/tcp.h b/share/libc/netinet/tcp.h index b0378813b6e1688aabd865cd91a262b078e4b259..5a3669d59b559d1ddef77396f410d2bcada5bc70 100644 --- a/share/libc/netinet/tcp.h +++ b/share/libc/netinet/tcp.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -97,6 +97,17 @@ __PUSH_FC_STDLIB # include <sys/types.h> # include <sys/socket.h> +// typedefs to compensate for the non-standard types used here +#ifndef u_int8_t +typedef uint8_t u_int8_t; +#endif +#ifndef u_int16_t +typedef uint16_t u_int16_t; +#endif +#ifndef u_int32_t +typedef uint32_t u_int32_t; +#endif + typedef u_int32_t tcp_seq; /* * TCP header. diff --git a/share/libc/nl_types.h b/share/libc/nl_types.h index af80e65bd967be505391dd277e1a52248a59f863..47357e8657aef437ea052b9d3eac3c02073af1ad 100644 --- a/share/libc/nl_types.h +++ b/share/libc/nl_types.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/poll.h b/share/libc/poll.h new file mode 100644 index 0000000000000000000000000000000000000000..ff453a6c3826487b0f058d1e4564f0bfa338e2aa --- /dev/null +++ b/share/libc/poll.h @@ -0,0 +1,68 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_POLL +#define __FC_POLL +#include "features.h" +__PUSH_FC_STDLIB + +struct pollfd { + int fd; // input parameter in poll() + short events; // input parameter in poll() + short revents; // output parameter in poll() +}; + +typedef unsigned long nfds_t; + +extern volatile int Frama_C_entropy_source; + +// The values used below are based on Linux. +#define POLLIN 0x001 +#define POLLPRI 0x002 +#define POLLOUT 0x004 +#define POLLERR 0x008 +#define POLLHUP 0x010 +#define POLLNVAL 0x020 +#define POLLRDNORM 0x040 +#define POLLRDBAND 0x080 +#define POLLWRNORM 0x100 +#define POLLWRBAND 0x200 + +/*@ + requires \valid(fds+(0 .. nfds-1)); + assigns fds[0 .. nfds-1].revents \from indirect:fds[0 .. nfds-1].fd, + fds[0 .. nfds-1].events, + indirect:nfds, indirect:timeout, + indirect:Frama_C_entropy_source; + assigns \result \from indirect:fds[0 .. nfds-1].fd, + indirect:fds[0 .. nfds-1].events, + indirect:nfds, indirect:timeout, + indirect:Frama_C_entropy_source; + ensures -1 <= \result <= nfds; + ensures \initialized(&fds[0 .. nfds-1].revents); + */ +extern int poll (struct pollfd *fds, nfds_t nfds, int timeout); + +__END_DECLS + +__POP_FC_STDLIB +#endif diff --git a/share/libc/pthread.h b/share/libc/pthread.h new file mode 100644 index 0000000000000000000000000000000000000000..df14947a11a02e2003b9741b3ac5d9b116dbbedb --- /dev/null +++ b/share/libc/pthread.h @@ -0,0 +1,271 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_PTHREAD_H__ +#define __FC_PTHREAD_H__ + +#include "features.h" +__PUSH_FC_STDLIB + +// The values for the constants below are based on an x86 Linux, +// declared in the order given by POSIX.1-2008. + +enum +{ + PTHREAD_CANCEL_ENABLE, + PTHREAD_CANCEL_DISABLE +}; + +enum +{ + PTHREAD_CANCEL_DEFERRED, + PTHREAD_CANCEL_ASYNCHRONOUS +}; + +enum +{ + PTHREAD_CREATE_JOINABLE, + PTHREAD_CREATE_DETACHED +}; + +enum +{ + PTHREAD_INHERIT_SCHED, + PTHREAD_EXPLICIT_SCHED +}; + + +/* Scope handling. */ +enum +{ + PTHREAD_SCOPE_SYSTEM, + PTHREAD_SCOPE_PROCESS +}; + +enum +{ + PTHREAD_MUTEX_NORMAL, + PTHREAD_MUTEX_RECURSIVE, + PTHREAD_MUTEX_ERRORCHECK, + PTHREAD_MUTEX_DEFAULT +}; + +enum +{ + PTHREAD_MUTEX_STALLED, + PTHREAD_MUTEX_ROBUST +}; + +enum +{ + PTHREAD_PRIO_NONE, + PTHREAD_PRIO_INHERIT, + PTHREAD_PRIO_PROTECT +}; + +enum +{ + PTHREAD_PROCESS_PRIVATE, + PTHREAD_PROCESS_SHARED +}; + +#define PTHREAD_BARRIER_SERIAL_THREAD (-1) +#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS +#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE +#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED +#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE +#define PTHREAD_CANCELED ((void *) -1) +#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED +#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE + +#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED +#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED + +#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_DEFAULT +#define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK +#define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_NORMAL +#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE +#define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST +#define PTHREAD_MUTEX_STALLED PTHREAD_MUTEX_STALLED +#define PTHREAD_ONCE_INIT 0 + +#define PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT + +#define PTHREAD_PRIO_NONE PTHREAD_PRIO_NONE + +#define PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT + +#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED +#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE + +#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS +#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM + +#define PTHREAD_COND_INITIALIZER { 0 } +#define PTHREAD_MUTEX_INITIALIZER { 0 } +#define PTHREAD_RWLOCK_INITIALIZER { 0 } + +// Include pthread-related types +#include "__fc_define_pthread_types.h" +#include "__fc_define_size_t.h" + +extern int pthread_atfork(void (*)(void), void (*)(void), void(*)(void)); +extern int pthread_attr_destroy(pthread_attr_t *); +extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *); +extern int pthread_attr_getguardsize(const pthread_attr_t *restrict, + size_t *restrict); +extern int pthread_attr_getinheritsched(const pthread_attr_t *restrict, + int *restrict); +extern int pthread_attr_getschedparam(const pthread_attr_t *restrict, + struct sched_param *restrict); +extern int pthread_attr_getschedpolicy(const pthread_attr_t *restrict, + int *restrict); +extern int pthread_attr_getscope(const pthread_attr_t *restrict, + int *restrict); +extern int pthread_attr_getstack(const pthread_attr_t *restrict, + void **restrict, size_t *restrict); +extern int pthread_attr_getstacksize(const pthread_attr_t *restrict, + size_t *restrict); +extern int pthread_attr_init(pthread_attr_t *); +extern int pthread_attr_setdetachstate(pthread_attr_t *, int); +extern int pthread_attr_setguardsize(pthread_attr_t *, size_t); +extern int pthread_attr_setinheritsched(pthread_attr_t *, int); +extern int pthread_attr_setschedparam(pthread_attr_t *restrict, + const struct sched_param *restrict); +extern int pthread_attr_setschedpolicy(pthread_attr_t *, int); +extern int pthread_attr_setscope(pthread_attr_t *, int); +extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t); +extern int pthread_attr_setstacksize(pthread_attr_t *, size_t); +extern int pthread_barrier_destroy(pthread_barrier_t *); +extern int pthread_barrier_init(pthread_barrier_t *restrict, + const pthread_barrierattr_t *restrict, + unsigned); +extern int pthread_barrier_wait(pthread_barrier_t *); +extern int pthread_barrierattr_destroy(pthread_barrierattr_t *); +extern int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict, + int *restrict); +extern int pthread_barrierattr_init(pthread_barrierattr_t *); +extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); +extern int pthread_cancel(pthread_t); +extern int pthread_cond_broadcast(pthread_cond_t *); +extern int pthread_cond_destroy(pthread_cond_t *); +extern int pthread_cond_init(pthread_cond_t *restrict, + const pthread_condattr_t *restrict); +extern int pthread_cond_signal(pthread_cond_t *); +extern int pthread_cond_timedwait(pthread_cond_t *restrict, + pthread_mutex_t *restrict, + const struct timespec *restrict); +extern int pthread_cond_wait(pthread_cond_t *restrict, + pthread_mutex_t *restrict); +extern int pthread_condattr_destroy(pthread_condattr_t *); +//clockid_t not available yet +//extern int pthread_condattr_getclock(const pthread_condattr_t *restrict, +// clockid_t *restrict); +extern int pthread_condattr_getpshared(const pthread_condattr_t *restrict, + int *restrict); +extern int pthread_condattr_init(pthread_condattr_t *); +//clockid_t not available yet +//extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); +extern int pthread_condattr_setpshared(pthread_condattr_t *, int); +extern int pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, + void *(*)(void*), void *restrict); +extern int pthread_detach(pthread_t); +extern int pthread_equal(pthread_t, pthread_t); +extern void pthread_exit(void *); +extern int pthread_getconcurrency(void); +//clockid_t not available yet +//extern int pthread_getcpuclockid(pthread_t, clockid_t *); +extern int pthread_getschedparam(pthread_t, int *restrict, + struct sched_param *restrict); +extern void *pthread_getspecific(pthread_key_t); +extern int pthread_join(pthread_t, void **); +extern int pthread_key_create(pthread_key_t *, void (*)(void*)); +extern int pthread_key_delete(pthread_key_t); +extern int pthread_mutex_consistent(pthread_mutex_t *); +extern int pthread_mutex_destroy(pthread_mutex_t *); +extern int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict, + int *restrict); +extern int pthread_mutex_init(pthread_mutex_t *restrict, + const pthread_mutexattr_t *restrict); +extern int pthread_mutex_lock(pthread_mutex_t *); +extern int pthread_mutex_setprioceiling(pthread_mutex_t *restrict, int, + int *restrict); +extern int pthread_mutex_timedlock(pthread_mutex_t *restrict, + const struct timespec *restrict); +extern int pthread_mutex_trylock(pthread_mutex_t *); +extern int pthread_mutex_unlock(pthread_mutex_t *); +extern int pthread_mutexattr_destroy(pthread_mutexattr_t *); +extern int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *restrict, + int *restrict); +extern int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict, + int *restrict); +extern int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict, + int *restrict); +extern int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict, + int *restrict); +extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict, + int *restrict); +extern int pthread_mutexattr_init(pthread_mutexattr_t *); +extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); +extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int); +extern int pthread_once(pthread_once_t *, void (*)(void)); +extern int pthread_rwlock_destroy(pthread_rwlock_t *); +extern int pthread_rwlock_init(pthread_rwlock_t *restrict, + const pthread_rwlockattr_t *restrict); +extern int pthread_rwlock_rdlock(pthread_rwlock_t *); +extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict, + const struct timespec *restrict); +extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict, + const struct timespec *restrict); +extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *); +extern int pthread_rwlock_trywrlock(pthread_rwlock_t *); +extern int pthread_rwlock_unlock(pthread_rwlock_t *); +extern int pthread_rwlock_wrlock(pthread_rwlock_t *); +extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +extern int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict, + int *restrict); +extern int pthread_rwlockattr_init(pthread_rwlockattr_t *); +extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +extern pthread_t pthread_self(void); +extern int pthread_setcancelstate(int, int *); +extern int pthread_setcanceltype(int, int *); +extern int pthread_setconcurrency(int); +extern int pthread_setschedparam(pthread_t, int, const struct sched_param *); +extern int pthread_setschedprio(pthread_t, int); +extern int pthread_setspecific(pthread_key_t, const void *); +extern int pthread_spin_destroy(pthread_spinlock_t *); +extern int pthread_spin_init(pthread_spinlock_t *, int); +extern int pthread_spin_lock(pthread_spinlock_t *); +extern int pthread_spin_trylock(pthread_spinlock_t *); +extern int pthread_spin_unlock(pthread_spinlock_t *); +extern void pthread_testcancel(void); + +// From POSIX: "Inclusion of the <pthread.h> header shall make symbols defined +// in the headers <sched.h> and <time.h> visible." +#include <sched.h> +#include <time.h> + +__POP_FC_STDLIB +#endif diff --git a/share/libc/pwd.h b/share/libc/pwd.h index 62c4bc0ba97d922d25afdab1b17eea947ab979a1..84d0b5b5d143427e580fcd5252904df15e098bec 100644 --- a/share/libc/pwd.h +++ b/share/libc/pwd.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -34,6 +34,7 @@ __BEGIN_DECLS struct passwd { char *pw_name; + char *pw_passwd; // not POSIX, but allowed by it, and present in glibc uid_t pw_uid; gid_t pw_gid; char *pw_dir; diff --git a/share/libc/regex.h b/share/libc/regex.h index 353c5c77638c796573c5112842c6f642b81b5892..45fc406f9a23c256ce68cd811b9406576769d7f9 100644 --- a/share/libc/regex.h +++ b/share/libc/regex.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/sched.h b/share/libc/sched.h new file mode 100644 index 0000000000000000000000000000000000000000..2e2cceb3969d3b3226e678d714f97e5f2cfa6a9a --- /dev/null +++ b/share/libc/sched.h @@ -0,0 +1,53 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_SCHED +#define __FC_SCHED +#include "features.h" +__PUSH_FC_STDLIB + +#include "__fc_define_timespec.h" +#include "__fc_define_pid_t.h" + +__BEGIN_DECLS + +struct sched_param { + int sched_priority; +}; + +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#define SCHED_SPORADIC 6 + +extern int sched_get_priority_max(int); +extern int sched_get_priority_min(int); +extern int sched_getparam(pid_t, struct sched_param *); +extern int sched_getscheduler(pid_t); +extern int sched_rr_get_interval(pid_t, struct timespec *); +extern int sched_setparam(pid_t, const struct sched_param *); +extern int sched_setscheduler(pid_t, int, const struct sched_param *); +extern int sched_yield(void); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/semaphore.h b/share/libc/semaphore.h new file mode 100644 index 0000000000000000000000000000000000000000..28d407d79c6388fcca0d2dbc8d02962a5fb2b7d1 --- /dev/null +++ b/share/libc/semaphore.h @@ -0,0 +1,50 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +// POSIX-compatible minimalist interface for sched.h + +#ifndef __FC_SEMAPHORE +#define __FC_SEMAPHORE +#include "features.h" +__PUSH_FC_STDLIB +#include <time.h> + +typedef union { + char __size[16]; +} sem_t; + +#define SEM_FAILED ((sem_t *) 0) + +extern int sem_close(sem_t *); +extern int sem_destroy(sem_t *); +extern int sem_getvalue(sem_t *restrict, int *restrict); +extern int sem_init(sem_t *, int, unsigned); +extern sem_t *sem_open(const char *, int, ...); +extern int sem_post(sem_t *); +extern int sem_timedwait(sem_t *restrict, const struct timespec *restrict); +extern int sem_trywait(sem_t *); +extern int sem_unlink(const char *); +extern int sem_wait(sem_t *); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/setjmp.h b/share/libc/setjmp.h index a9ebf0709b7e1aa5c93ea690da5f370a12b05b35..d7648a3ad8ca20bfbe8a6bfc06e33558d2cd8d28 100644 --- a/share/libc/setjmp.h +++ b/share/libc/setjmp.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/signal.h b/share/libc/signal.h index d5179ff6adf5f43243a77af0cab8d19aa8df8c9e..c98912561edb080eb0f0fd5e27598e6dc8d6ba98 100644 --- a/share/libc/signal.h +++ b/share/libc/signal.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -36,6 +36,8 @@ __BEGIN_DECLS typedef volatile int sig_atomic_t; typedef void (*__fc_sighandler_t) (int); +#define sighandler_t __fc_sighandler_t + /* for BSD 4.4 */ #ifdef __USE_MISC typedef __fc_sighandler_t sig_t; diff --git a/share/libc/stdarg.h b/share/libc/stdarg.h index 0123b2b62cfc11bedad350c09cd1b3cbc8cfc107..2763a06f83fe72f82da5659ce0c18585fd869a5b 100644 --- a/share/libc/stdarg.h +++ b/share/libc/stdarg.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/stdbool.h b/share/libc/stdbool.h index ed443eb9b3caa70117d50b2b8cc5f22c7e7fcb15..b0870f6ad37b2b9109ec4918aa3c405e2c6a6f1e 100644 --- a/share/libc/stdbool.h +++ b/share/libc/stdbool.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/stddef.h b/share/libc/stddef.h index f3542fe5d6f9a1c44aa4e79f2642ce6d3aee662e..2eabc33f2a03903fb248bfd0f56e68e4947ae754 100644 --- a/share/libc/stddef.h +++ b/share/libc/stddef.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/stdint.h b/share/libc/stdint.h index 2f247dfc3f8737434c7ee9bfb7b7906c5d1ce712..7d3ac37ea86337f524dd491257170948f3c498ba 100644 --- a/share/libc/stdint.h +++ b/share/libc/stdint.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -100,7 +100,12 @@ typedef __UINT_MAX_T uintmax_t; #define INT64_MAX 9223372036854775807LL #define UINT64_MAX 18446744073709551615ULL -/* ISO C: 7.18.2.3-5 : TODO */ +/* ISO C: 7.18.2.3-4 : TODO */ + +/* ISO C: 7.18.2.5 */ +#define INTMAX_MIN __FC_INTMAX_MIN +#define INTMAX_MAX __FC_INTMAX_MAX +#define UINTMAX_MAX __FC_UINTMAX_MAX /* ISO C: 7.18.3 */ diff --git a/share/libc/stdio.c b/share/libc/stdio.c index 3f5643734931401ee40cdc6eccee3785b95f0fe8..36e208a88003e3e494a9f49ebded711e149a73a9 100644 --- a/share/libc/stdio.c +++ b/share/libc/stdio.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/stdio.h b/share/libc/stdio.h index 15fcfa6223ac25793a55d60b3349d9c9f29333f4..915d90efcd7c30e50a896edbb1b901f9afa6e571 100644 --- a/share/libc/stdio.h +++ b/share/libc/stdio.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -132,6 +132,15 @@ extern int setvbuf(FILE * restrict stream, char * restrict buf, int mode, size_t size); +/*@ + // Axiomatic used by the Variadic plugin to generate specifications + // for some functions, e.g. snprintf(). + axiomatic format_length { + //TODO: this logic function will be extended to handle variadic formats + logic integer format_length{L}(char *format); + } +*/ + // Direct specifications for variadic functions are unsupported; // use the Variadic plug-in instead. extern int fprintf(FILE * restrict stream, @@ -254,8 +263,12 @@ extern size_t fwrite(const void * restrict ptr, extern int fgetpos(FILE * restrict stream, fpos_t * restrict pos); -/*@ assigns *stream \from offset, whence ; - assigns __fc_errno ; */ +/*@ + requires \valid(stream); + requires whence == SEEK_SET || whence == SEEK_CUR || whence == SEEK_END; + assigns *stream \from *stream, indirect:offset, indirect:whence; + assigns \result, __fc_errno \from indirect:*stream, indirect:offset, + indirect:whence; */ extern int fseek(FILE *stream, long int offset, int whence); /*@ assigns *stream \from *pos; */ @@ -319,6 +332,8 @@ extern size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, extern char *fgets_unlocked(char *s, int n, FILE *stream); extern int fputs_unlocked(const char *s, FILE *stream); +extern int dprintf(int fd, const char *restrict format, ...); + __END_DECLS #define IOV_MAX 1024 diff --git a/share/libc/stdlib.c b/share/libc/stdlib.c index a58dc827a2dbd2c19cee08fa8b793742332fb842..d98ffad873ce5745085b4b9e64a8ad70e8e411f8 100644 --- a/share/libc/stdlib.c +++ b/share/libc/stdlib.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -68,20 +68,20 @@ int atoi(const char *p) /* This malloc must not be used if the analyzer cannot determine that there is only a finite number of calls to malloc. */ -extern void *Frama_C_alloc_size(size_t size); +extern void *Frama_C_malloc_fresh(size_t size); void *malloc(size_t size) { - return Frama_C_alloc_size(size); + return Frama_C_malloc_fresh(size); } #else #ifdef FRAMA_C_MALLOC_STACK -extern void * Frama_C_alloc_by_stack(size_t size); +extern void * Frama_C_malloc_by_stack(size_t size); void *malloc(size_t size) { - return Frama_C_alloc_by_stack(size); + return Frama_C_malloc_by_stack(size); } #else @@ -97,7 +97,11 @@ void free(void *p) { void *calloc(size_t nmemb, size_t size) { size_t l = nmemb * size; + // test overflow, and fail if detected + if (size != 0 && l / size != nmemb) { + return 0; + } char *p = malloc(l); - Frama_C_memset(p, 0, l); + if (p) Frama_C_memset(p, 0, l); return p; } diff --git a/share/libc/stdlib.h b/share/libc/stdlib.h index 72a4bd75ce4f3461ac14d0ed6f25c63e09609826..c3766fb23c00597340ab27ee88937ccc77e3a6d2 100644 --- a/share/libc/stdlib.h +++ b/share/libc/stdlib.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -25,6 +25,7 @@ #define __FC_STDLIB #include "features.h" __PUSH_FC_STDLIB +#include "__fc_machdep.h" #include "__fc_define_size_t.h" #include "__fc_define_wchar_t.h" @@ -247,7 +248,7 @@ extern unsigned long long int strtoull( char ** restrict endptr, int base); -//@ ghost int __fc_random_counter __attribute__((unused)) __attribute__((FRAMA_C_MODEL)); +//@ ghost extern int __fc_random_counter __attribute__((unused)) __attribute__((FRAMA_C_MODEL)); const unsigned long __fc_rand_max = __FC_RAND_MAX; /* ISO C: 7.20.2 */ /*@ assigns \result \from __fc_random_counter ; @@ -272,17 +273,42 @@ extern void srand48 (long int seed); /*@ assigns __fc_random_counter \from seed ; */ extern void srand(unsigned int seed); -/* ISO C: 7.20.3.1 */ -//@ requires nmemb * size <= __FC_SIZE_MAX; -extern void *calloc(size_t nmemb, size_t size); /*@ ghost extern int __fc_heap_status __attribute__((FRAMA_C_MODEL)); */ /*@ axiomatic dynamic_allocation { - @ predicate is_allocable(size_t n) // Can a block of n bytes be allocated? - @ reads __fc_heap_status; + @ predicate is_allocable{L}(integer n) // Can a block of n bytes be allocated? + @ reads __fc_heap_status; + @ // The logic label L is not used, but it must be present because the + @ // predicate depends on the memory state + @ axiom never_allocable{L}: + @ \forall integer i; + @ i < 0 || i > __FC_SIZE_MAX ==> !is_allocable(i); @ } */ + +/* ISO C: 7.20.3.1 */ +/*@ + allocates \result; + assigns __fc_heap_status \from indirect:nmemb, indirect:size, __fc_heap_status; + assigns \result \from indirect:nmemb, indirect:size, + indirect:__fc_heap_status; + + behavior allocation: + assumes is_allocable(nmemb * size); + ensures \fresh(\result, nmemb * size); + ensures \initialized(((char *)\result)+(0..nmemb*size-1)); + ensures \subset(((char *)\result)[0..nmemb*size-1], {0}); + + behavior no_allocation: + assumes !is_allocable(nmemb * size); + assigns \result \from \nothing; + allocates \nothing; + ensures \result == \null; + + complete behaviors; + disjoint behaviors; */ +extern void *calloc(size_t nmemb, size_t size); /*@ allocates \result; @ assigns __fc_heap_status \from size, __fc_heap_status; @@ -430,20 +456,46 @@ extern void qsort(void *base, size_t nmemb, size_t size, /* ISO C: 7.20.6 */ -/*@ - requires abs_representable:(int)(-j) == -j ; - assigns \result \from j ; -*/ +/*@ + requires abs_representable: j > INT_MIN; + assigns \result \from j; + behavior neg: + assumes j < 0; + ensures \result == -j; + behavior nonneg: + assumes j >= 0; + ensures \result == j; + complete behaviors; + disjoint behaviors; + */ extern int abs(int j); -/*@ - requires abs_representable:(long)(-j) == -j ; - assigns \result \from j ; */ +/*@ + requires abs_representable: j > LONG_MIN ; + assigns \result \from j; + behavior neg: + assumes j < 0; + ensures \result == -j; + behavior nonneg: + assumes j >= 0; + ensures \result == j; + complete behaviors; + disjoint behaviors; + */ extern long int labs(long int j); /*@ - requires abs_representable:(long long)(-j) == -j ; - assigns \result \from j ; */ + requires abs_representable: j > LLONG_MIN ; + assigns \result \from j; + behavior neg: + assumes j < 0; + ensures \result == -j; + behavior nonneg: + assumes j >= 0; + ensures \result == j; + complete behaviors; + disjoint behaviors; + */ extern long long int llabs(long long int j); /*@ assigns \result \from numer,denom ; */ @@ -455,13 +507,13 @@ extern lldiv_t lldiv(long long int numer, long long int denom); /* ISO C: 7.20.7 */ -//@ ghost int __fc_mblen_state; +//@ ghost extern int __fc_mblen_state; /*@ assigns \result, __fc_mblen_state \from indirect:s, indirect:s[0 ..], indirect:n, __fc_mblen_state; */ extern int mblen(const char *s, size_t n); -//@ ghost int __fc_mbtowc_state; +//@ ghost extern int __fc_mbtowc_state; /*@ requires \separated(pwc, s); @@ -475,7 +527,7 @@ extern int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n); -//@ ghost int __fc_wctomb_state; +//@ ghost extern int __fc_wctomb_state; /*@ assigns \result \from indirect:wc, __fc_wctomb_state; diff --git a/share/libc/string.c b/share/libc/string.c index ba413e4292e50daf956c063445661bfd8318a1f5..90fa4a09b1929cf5a6b737aa251f3a2f863081fb 100644 --- a/share/libc/string.c +++ b/share/libc/string.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -23,6 +23,7 @@ #include <string.h> #include <stdint.h> // for uintptr_t #include <stdlib.h> // for malloc() +__PUSH_FC_STDLIB void* memcpy(void* restrict dest, const void* restrict src, size_t n) { @@ -261,3 +262,5 @@ char *strndup(const char *s, size_t n) p[l] = 0; return p; } + +__POP_FC_STDLIB diff --git a/share/libc/string.h b/share/libc/string.h index 9fcafd68e935938a93a15f2377ea9240c640f5f1..6933b4fe72d0ff0e55852edc2c56d373810d9f5d 100644 --- a/share/libc/string.h +++ b/share/libc/string.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -220,6 +220,8 @@ extern char *strerror(int errnum); /*@ requires valid_string_src: valid_read_string(src); @ requires room_string: \valid(dest+(0..strlen(src))); + @ requires separated_strings: + @ \separated(dest+(0..strlen(src)), src+(0..strlen(src))); @ assigns dest[0..strlen(src)] \from src[0..strlen(src)]; @ assigns \result \from dest; @ ensures strcmp(dest,src) == 0; @@ -273,18 +275,19 @@ extern char *strcat(char *restrict dest, const char *restrict src); /*@ // missing: separation @ requires valid_string_src: valid_read_string(src) || \valid_read(src+(0..n-1)); @ requires valid_string_dst: valid_string(dest); - @ requires room_string: \valid(dest + (strlen(dest) .. strlen(dest) + n)) ; @ assigns dest[strlen(dest) .. strlen(dest) + n] \from src[0..n]; @ assigns \result \from dest; @ ensures \result == dest; @ behavior complete: @ assumes valid_read_string(src) && strlen(src) <= n; + @ requires room_string: \valid(dest + strlen(dest) + (0 .. strlen(src))); @ assigns dest[strlen(dest)..strlen(dest) + strlen(src)] @ \from src[0..strlen(src)]; @ assigns \result \from dest; @ ensures strlen(dest) == \old(strlen(dest) + strlen(src)); @ behavior partial: @ assumes ! (valid_read_string(src) && strlen(src) <= n); + @ requires room_string: \valid(dest + strlen(dest) + (0 .. n)); @ assigns dest[strlen(dest)..strlen(dest) + n] @ \from src[0..strlen(src)]; @ assigns \result \from dest; @@ -316,6 +319,19 @@ extern char *strdup (const char *s); @*/ extern char *strndup (const char *s, size_t n); +// More POSIX, non-C99 functions +#ifdef _POSIX_C_SOURCE +extern char *stpncpy(char *restrict dest, const char *restrict src, size_t n); +//extern int strcoll_l(const char *s1, const char *s2, locale_t locale); +//extern char *strerror_l(int errnum, locale_t locale); +extern int strerror_r(int errnum, char *strerrbuf, size_t buflen); +extern char *strsignal(int sig); +extern char *strtok_r(char *restrict s, const char *restrict sep, + char **restrict state); +//extern size_t strxfrm_l(char *restrict s1, const char *restrict s2, size_t n, +// locale_t locale); +#endif + __END_DECLS /* Include strings.h: this is what BSD does, and glibc does something diff --git a/share/libc/strings.h b/share/libc/strings.h index b94c01db86f873a5802fcc5caf2c97c208d2f08b..28f968fd83b17e6ef6e9832dc808b4fd401c2420 100644 --- a/share/libc/strings.h +++ b/share/libc/strings.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -33,7 +33,8 @@ extern void bcopy(const void *, void *, size_t); /*@ requires \valid (((char*) s)+(0 .. n-1)); - assigns ((char*) s)[0 .. n-1] \from \nothing; */ + assigns ((char*) s)[0 .. n-1] \from \nothing; + ensures \subset(((char*) s)[0 .. n-1], {0}); */ extern void bzero(void *s, size_t n); extern int ffs(int); extern char *index(const char *, int); diff --git a/share/libc/stropts.h b/share/libc/stropts.h new file mode 100644 index 0000000000000000000000000000000000000000..c6b4375fc0a443e3234ee6642d840412c531d1ce --- /dev/null +++ b/share/libc/stropts.h @@ -0,0 +1,179 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_STROPTS_H__ +#define __FC_STROPTS_H__ +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS + +#include "__fc_define_uid_and_gid.h" +#include "__fc_machdep.h" + +typedef __INT32_T t_scalar_t; +typedef __UINT32_T t_uscalar_t; + +struct bandinfo { + int bi_flag; + unsigned char bi_pri; +}; + +struct strbuf { + char *buf; + int len; + int maxlen; +}; + +struct strpeek { + struct strbuf ctlbuf; + struct strbuf databuf; + t_uscalar_t flags; +}; + +struct strfdinsert { + struct strbuf ctlbuf; + struct strbuf databuf; + int fildes; + t_uscalar_t flags; + int offset; +}; + +struct strioctl { + int ic_cmd; + char *ic_dp; + int ic_len; + int ic_timout; +}; + +struct strrecvfd { + int fd; + gid_t gid; + uid_t uid; +}; + +#define FMNAMESZ 8 + +struct str_mlist { + char l_name[FMNAMESZ+1]; +}; + +struct str_list { + struct str_mlist *sl_modlist; + int sl_nmods; +}; + +// The values for the constants below are based on those of the glibc, +// declared in the order given by POSIX.1-2008. + +#define I_ATMARK (__SID |31) +#define I_CANPUT (__SID |34) +#define I_CKBAND (__SID |29) +#define I_FDINSERT (__SID |16) +#define I_FIND (__SID |11) +#define I_FLUSH (__SID | 5) +#define I_FLUSHBAND (__SID |28) +#define I_FLUSHBAND (__SID |28) +#define I_GETBAND (__SID |30) +#define I_GETCLTIME (__SID |33) +#define I_GETSIG (__SID |10) +#define I_GRDOPT (__SID | 7) +#define I_GWROPT (__SID |20) +#define I_LINK (__SID |12) +#define I_LIST (__SID |21) +#define I_LOOK (__SID | 4) +#define I_NREAD (__SID | 1) +#define I_PEEK (__SID |15) +#define I_PLINK (__SID |22) +#define I_POP (__SID | 3) +#define I_PUNLINK (__SID |23) +#define I_PUSH (__SID | 2) +#define I_RECVFD (__SID |14) +#define I_SENDFD (__SID |17) +#define I_SETCLTIME (__SID |32) +#define I_SETSIG (__SID | 9) +#define I_SRDOPT (__SID | 6) +#define I_STR (__SID | 8) +#define I_SWROPT (__SID |19) +#define I_UNLINK (__SID |13) + +#define FLUSHR 0x01 +#define FLUSHRW 0x03 +#define FLUSHRW 0x03 +#define FLUSHW 0x02 + +#define S_BANDURG 0x0200 +#define S_ERROR 0x0010 +#define S_HANGUP 0x0020 +#define S_HIPRI 0x0002 +#define S_INPUT 0x0001 +#define S_MSG 0x0008 +#define S_OUTPUT 0x0004 +#define S_RDBAND 0x0080 +#define S_RDNORM 0x0040 +#define S_WRBAND 0x0100 +#define S_WRNORM S_OUTPUT + +#define RS_HIPRI 0x01 + +#define RMSGD 0x0001 +#define RMSGN 0x0002 +#define RNORM 0x0000 +#define RPROTDAT 0x0004 +#define RPROTDIS 0x0008 +#define RPROTNORM 0x0010 + +#define SNDZERO 0x001 + +#define ANYMARK 0x01 +#define LASTMARK 0x02 + +#define MUXID_ALL (-1) + +#define MORECTL 1 +#define MOREDATA 2 +#define MSG_ANY 0x02 +#define MSG_BAND 0x04 +#define MSG_HIPRI 0x01 + +extern int fattach(int, const char *); +extern int fdetach(const char *); +extern int getmsg(int, struct strbuf *restrict, struct strbuf *restrict, + int *restrict); +extern int getpmsg(int, struct strbuf *restrict, struct strbuf *restrict, + int *restrict, int *restrict); + +extern int ioctl(int, int, ...); + +// for Variadic +/*@ assigns \result \from fd, request; */ +extern int __va_ioctl_void(int fd, int request); +/*@ assigns \result \from fd, request, argp[0..]; */ +extern int __va_ioctl_ptr(int fd, int request, char* argp); + +extern int isastream(int); +extern int putmsg(int, const struct strbuf *, const struct strbuf *, int); +extern int putpmsg(int, const struct strbuf *, const struct strbuf *, int, + int); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/file.h b/share/libc/sys/file.h new file mode 100644 index 0000000000000000000000000000000000000000..cb02a043e30bcf2df36d4e9266534d73422bd361 --- /dev/null +++ b/share/libc/sys/file.h @@ -0,0 +1,45 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_SYS_FILE_H__ +#define __FC_SYS_FILE_H__ + +#include "../features.h" +__PUSH_FC_STDLIB + +// Note: this file is not C11 nor POSIX, but Linux-specific. +// The values for the constants below are based on the glibc. + +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_UN 8 + +#define LOCK_NB 4 + +extern int flock(int fd, int operation); + +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/ioctl.h b/share/libc/sys/ioctl.h index 38d77c0f65afbe8ae9b40d496bf9957adc7104f7..94deaf0c9897dc6245ac9237d6a6d9f8cb71ac94 100644 --- a/share/libc/sys/ioctl.h +++ b/share/libc/sys/ioctl.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -23,6 +23,11 @@ #ifndef FC_IOCTL #define FC_IOCTL +// This file is neither in the C standard nor POSIX; it is here for +// compatibility reasons. + +// For the ioctl() prototype +#include "../stropts.h" /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ diff --git a/share/libc/sys/ipc.h b/share/libc/sys/ipc.h new file mode 100644 index 0000000000000000000000000000000000000000..cda799cc3f92623e3277285064e70ca760a41f7e --- /dev/null +++ b/share/libc/sys/ipc.h @@ -0,0 +1,58 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_SYS_IPC_H__ +#define __FC_SYS_IPC_H__ +#include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS + +#include "../__fc_define_mode_t.h" +#include "../__fc_define_uid_and_gid.h" +#include "../__fc_define_key_t.h" + +struct ipc_perm { + uid_t uid; + gid_t gid; + uid_t cuid; + gid_t cgid; + mode_t mode; +}; + +// The values for the constants below are based on an x86 Linux, +// declared in the order given by POSIX.1-2008. + +#define IPC_CREAT 01000 +#define IPC_EXCL 02000 +#define IPC_NOWAIT 04000 + +#define IPC_PRIVATE ((key_t) 0) + +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_STAT 2 + +extern key_t ftok(const char *, int); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/mman.h b/share/libc/sys/mman.h new file mode 100644 index 0000000000000000000000000000000000000000..50ce1eca9a21d1320df5755a035df7ae93f2ef6e --- /dev/null +++ b/share/libc/sys/mman.h @@ -0,0 +1,91 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_SYS_MMAN_H__ +#define __FC_SYS_MMAN_H__ + +#include "../features.h" +#include "../__fc_define_mode_t.h" +#include "../__fc_define_off_t.h" +#include "../__fc_define_size_t.h" +__PUSH_FC_STDLIB + +// The values for the constants below are based on an x86 Linux, +// declared in the order given by POSIX.1-2008. + +#define PROT_EXEC 0x4 +#define PROT_NONE 0x0 +#define PROT_READ 0x1 +#define PROT_WRITE 0x2 + +#define MAP_FIXED 0x10 +#define MAP_PRIVATE 0x02 +#define MAP_SHARED 0x01 + +#define MAP_FAILED ((void*) -1) + +#define MS_ASYNC 1 +#define MS_INVALIDATE 2 +#define MS_SYNC 4 + +#define MCL_CURRENT 1 +#define MCL_FUTURE 2 + +#define POSIX_MADV_DONTNEED 4 +#define POSIX_MADV_NORMAL 0 +#define POSIX_MADV_RANDOM 1 +#define POSIX_MADV_SEQUENTIAL 2 +#define POSIX_MADV_WILLNEED 3 + +// Not currently defined in any Linux header +//#define POSIX_TYPED_MEM_ALLOCATE +//#define POSIX_TYPED_MEM_ALLOCATE_CONTIG +//#define POSIX_TYPED_MEM_MAP_ALLOCATABLE +// +//struct posix_typed_mem_info { +// size_t posix_tmi_length; +//} + +extern int mlock (const void *addr, size_t len); +extern int mlockall (int __flags); + +extern void *mmap(void *addr, size_t len, int prot, int flags, + int fildes, off_t off); + +extern int mprotect (void *__addr, size_t __len, int __prot); +extern int msync (void *__addr, size_t __len, int __flags); +extern int munlock (const void *__addr, size_t __len); +extern int munlockall (void); +extern int munmap (void *__addr, size_t __len); +extern int posix_madvise (void *__addr, size_t __len, int __advice); + +// Not currently defined in any Linux header +//int posix_mem_offset(const void *restrict, size_t, off_t *restrict, +// size_t *restrict, int *restrict); +//int posix_typed_mem_get_info(int, struct posix_typed_mem_info *); +//int posix_typed_mem_open(const char *, int, int); + +extern int shm_open (const char *__name, int __oflag, mode_t __mode); +extern int shm_unlink (const char *__name); + +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/param.h b/share/libc/sys/param.h index 190b7eb79723e30c6e560e9bd2e34db3c7d40e23..800f80a836bece33403e2f1e9d417a13e8fe7658 100644 --- a/share/libc/sys/param.h +++ b/share/libc/sys/param.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/sys/resource.h b/share/libc/sys/resource.h index f6d7cdfff00fa330a2900f95d52239085d6a0355..804be3b68687095c9d15fee953e9f7dd47906ee8 100644 --- a/share/libc/sys/resource.h +++ b/share/libc/sys/resource.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/sys/select.h b/share/libc/sys/select.h index 50a4e3478ad59f198d7784fdc8e89ce598f115cb..ff3b3324f01f3ce6c24f3119e617852be58c6847 100644 --- a/share/libc/sys/select.h +++ b/share/libc/sys/select.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,7 +22,12 @@ #ifndef __FC_SYS_SELECT_H__ #define __FC_SYS_SELECT_H__ +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS #include "__fc_select.h" +__END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/sys/shm.h b/share/libc/sys/shm.h new file mode 100644 index 0000000000000000000000000000000000000000..502d0482345b02baddf062e89ff841c4dad16900 --- /dev/null +++ b/share/libc/sys/shm.h @@ -0,0 +1,66 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_SYS_SHM_H__ +#define __FC_SYS_SHM_H__ +#include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS + +#include "../__fc_define_pid_t.h" +#include "../__fc_define_size_t.h" +#include "../__fc_define_time_t.h" + +// POSIX: "the <sys/shm.h> header shall include the <sys/ipc.h> header." +#include <sys/shm.h> + +// The values for the constants below are based on an x86 Linux, +// declared in the order given by POSIX.1-2008. + +#define SHM_RDONLY 010000 +#define SHM_RND 020000 + +// TODO: parametrize the page size according to the machdep? +#define __FC_PAGE_SIZE 4096 +#define SHMLBA __FC_PAGE_SIZE + +typedef unsigned long shmatt_t; + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + pid_t shm_lpid; + pid_t shm_cpid; + shmatt_t shm_nattch; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; +}; + +extern void *shmat(int, const void *, int); +extern int shmctl(int, int, struct shmid_ds *); +extern int shmdt(const void *); +extern int shmget(key_t, size_t, int); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/socket.h b/share/libc/sys/socket.h index 308e466b3f9a79a617b8e3d524a49868fef527f8..c3605ad3c82a24360444add979e348f531e5f29e 100644 --- a/share/libc/sys/socket.h +++ b/share/libc/sys/socket.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,6 +22,9 @@ #ifndef __FC_SOCKET_H__ #define __FC_SOCKET_H__ +#include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS #include "../__fc_machdep.h" typedef __UINT_LEAST32_T socklen_t; @@ -112,6 +115,7 @@ struct msghdr { #define PF_HYLINK AF_HYLINK #define PF_APPLETALK AF_APPLETALK #define PF_NETBIOS AF_NETBIOS +#define PF_INET6 AF_INET6 #define PF_MAX AF_MAX @@ -262,10 +266,27 @@ extern int getsockopt(int sockfd, int level, int optname, extern int listen(int sockfd, int backlog); /* Flags for passing to recv() and others */ -#define MSG_OOB 1 -#define MSG_PEEK 2 -#define MSG_DONTROUTE 4 -#define MSG_DONTWAIT 64 +#define MSG_OOB 0x1 +#define MSG_PEEK 0x2 +#define MSG_DONTROUTE 0x4 +#define MSG_CTRUNC 0x8 +#define MSG_PROXY 0x10 +#define MSG_TRUNC 0x20 +#define MSG_DONTWAIT 0x40 +#define MSG_EOR 0x80 +#define MSG_WAITALL 0x100 +#define MSG_FIN 0x200 +#define MSG_SYN 0x400 +#define MSG_CONFIRM 0x800 +#define MSG_RST 0x1000 +#define MSG_RSTERRQUEUE 0x2000 +#define MSG_NOSIGNAL 0x4000 +#define MSG_MORE 0x8000 +#define MSG_WAITFORONE 0x10000 +#define MSG_BATCH 0x40000 +#define MSG_FASTOPEN 0x20000000 +#define MSG_CMSG_CLOEXEC 0x40000000 + /*@ requires 0 <= sockfd < __FC_MAX_OPEN_SOCKETS; @@ -342,4 +363,7 @@ extern int sockatmark(int); @ ensures 0 <= socket_vector[1] < __FC_MAX_OPEN_SOCKETS; @*/ extern int socketpair(int domain, int type, int protocol, int socket_vector[2]); + +__END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/sys/stat.h b/share/libc/sys/stat.h index 1d10cbf08054144c922a7aa1a6f5fd2a62f3edb5..12681a311a5c84278c7bf3513d98890c25905fd1 100644 --- a/share/libc/sys/stat.h +++ b/share/libc/sys/stat.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,6 +22,9 @@ #ifndef __FC_SYS_STAT_H #define __FC_SYS_STAT_H +#include "features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS #include "../__fc_define_stat.h" @@ -35,4 +38,6 @@ extern int mknod(const char *, mode_t, dev_t); extern int stat(const char *, struct stat *); extern mode_t umask(mode_t); +__END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/sys/sysctl.h b/share/libc/sys/sysctl.h index cfc7fc987c428100675de78125dc353b449bccef..c3b080284726e88029bedc89d954e8cbb20f378d 100644 --- a/share/libc/sys/sysctl.h +++ b/share/libc/sys/sysctl.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/sys/time.h b/share/libc/sys/time.h index e636bfaa767a6d75f7f541d13da55e491623f5c5..df47f10bc76f595b6f49d99c7f09010a8923cabc 100644 --- a/share/libc/sys/time.h +++ b/share/libc/sys/time.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,6 +22,9 @@ #ifndef __FC_SYS_TIME_H__ #define __FC_SYS_TIME_H__ +#include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS #include "../__fc_define_time_t.h" #include "../__fc_define_suseconds_t.h" @@ -78,4 +81,117 @@ extern int gettimeofday(struct timeval *tv, struct timezone *tz); @*/ extern int settimeofday(const struct timeval *tv, const struct timezone *tz); +#if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE) >= 200112L) || \ + (defined _XOPEN_SOURCE && (_XOPEN_SOURCE) >= 600) +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* Abstract representation of interval timers. */ +//@ ghost volatile struct itimerval __fc_itimer_real __attribute__((FRAMA_C_MODEL)); +//@ ghost volatile struct itimerval __fc_itimer_virtual __attribute__((FRAMA_C_MODEL)); +//@ ghost volatile struct itimerval __fc_itimer_prof __attribute__((FRAMA_C_MODEL)); + +// NOTE: for functions setitimer/getitimer, we do not currently model +// the signals generated by the timers when they reach zero. + +/*@ + requires \valid(curr_value); + assigns \result \from indirect:which; + assigns *curr_value \from __fc_itimer_real, __fc_itimer_virtual, + __fc_itimer_prof; + ensures \initialized(curr_value); + behavior real: + assumes which == ITIMER_REAL; + assigns \result \from \nothing; + assigns *curr_value \from __fc_itimer_real; + ensures \result == 0; + behavior virtual: + assumes which == ITIMER_VIRTUAL; + assigns \result \from \nothing; + assigns *curr_value \from __fc_itimer_virtual; + ensures \result == 0; + behavior prof: + assumes which == ITIMER_PROF; + assigns \result \from \nothing; + assigns *curr_value \from __fc_itimer_prof; + ensures \result == 0; + behavior invalid: + assumes which != ITIMER_REAL && which != ITIMER_VIRTUAL && which != ITIMER_PROF; + assigns \result \from \nothing; + ensures \result == -1; + complete behaviors; + disjoint behaviors; +*/ +extern int getitimer(int which, struct itimerval *curr_value); + +// TODO: replace with a predicate, when Value will be able to evalute it +// precisely +#define __VALID_ITIMERVAL(tv) (0 <= (tv)->it_value.tv_usec <= 999999 && \ + 0 <= (tv)->it_interval.tv_usec <= 999999) + +// Note: this specification is more strict than POSIX, since we forbid new_value +// from being NULL. +// Note: old_value depends on new_value because e.g. if new_value contains +// an invalid tv_usec field, the function may fail. +/*@ + requires \valid_read(new_value); + requires old_value == \null || \valid(old_value); + assigns old_value != \null ? *old_value : \empty \from + indirect:which, indirect:old_value, indirect:new_value, + __fc_itimer_real, __fc_itimer_virtual, __fc_itimer_prof; + assigns \result \from indirect:which, indirect:new_value, indirect:*new_value; + ensures \result == 0 || \result == -1; + behavior real: + assumes which == ITIMER_REAL && __VALID_ITIMERVAL(new_value); + assigns \result \from \nothing; + assigns old_value != \null ? *old_value : \empty \from __fc_itimer_real; + assigns __fc_itimer_real \from *new_value; + ensures \result == 0; + ensures \initialized(old_value); + behavior virtual: + assumes which == ITIMER_VIRTUAL && __VALID_ITIMERVAL(new_value); + assigns \result \from \nothing; + assigns old_value != \null ? *old_value : \empty \from __fc_itimer_virtual; + ensures \result == 0; + ensures \initialized(old_value); + behavior prof: + assumes which == ITIMER_PROF && __VALID_ITIMERVAL(new_value); + assigns \result \from \nothing; + assigns old_value != \null ? *old_value : \empty \from __fc_itimer_prof; + ensures \result == 0; + ensures \initialized(old_value); + behavior invalid: + assumes (which != ITIMER_REAL && which != ITIMER_VIRTUAL && which != ITIMER_PROF) || + !__VALID_ITIMERVAL(new_value); + assigns \result \from \nothing; + ensures \result == -1; + disjoint behaviors; +*/ +extern int setitimer (int which, + const struct itimerval *restrict new_value, + struct itimerval *restrict old_value); +#endif + +// Non-POSIX, non-C99 functions (present in Linux and most BSDs) +extern void timeradd(struct timeval *a, struct timeval *b, + struct timeval *res); + +extern void timersub(struct timeval *a, struct timeval *b, + struct timeval *res); + +extern void timerclear(struct timeval *tvp); + +extern int timerisset(struct timeval *tvp); + +#define timercmp(a, b, _CMP) _timercmp(a, b) +extern int _timercmp(struct timeval *a, struct timeval *b); + +__END_DECLS +__POP_FC_STDLIB #endif diff --git a/share/libc/sys/times.h b/share/libc/sys/times.h index f4f942bb0f31f3f7689b2cd05ee7465032713b20..338cf72d1717cff8378d42671df84c51f9253100 100644 --- a/share/libc/sys/times.h +++ b/share/libc/sys/times.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/sys/types.h b/share/libc/sys/types.h index 507e7be108646db026e17cc70aaf9e5cfd297a81..e59ffad3cc21221640432c2e29843af5e7f7b25a 100644 --- a/share/libc/sys/types.h +++ b/share/libc/sys/types.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -22,8 +22,10 @@ #ifndef __FC_SYS_TYPES_H__ #define __FC_SYS_TYPES_H__ - #include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS + #include "../__fc_machdep.h" #include "../__fc_define_id_t.h" #include "../__fc_define_pid_t.h" @@ -38,13 +40,15 @@ #include "../__fc_define_mode_t.h" #include "../__fc_define_nlink_t.h" #include "../__fc_define_off_t.h" +#include "../__fc_define_pthread_types.h" +#include "../__fc_define_key_t.h" -__BEGIN_DECLS - +typedef unsigned long u_long; typedef unsigned int u_int; +typedef unsigned short u_short; typedef unsigned char u_char; extern dev_t makedev(int maj, int min); __END_DECLS - +__POP_FC_STDLIB #endif diff --git a/share/libc/sys/uio.h b/share/libc/sys/uio.h index c24eae1891b958212bc0187bf0ba194e1f039deb..2c37e3e2e8a63fc8d5caabddf5797a6766a3dd0c 100644 --- a/share/libc/sys/uio.h +++ b/share/libc/sys/uio.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/sys/un.h b/share/libc/sys/un.h index 6d20938dd565bc792079e6c905c400de552f6b86..63b79b9f7cbb86b5521d09f2b9e28a91fc855d0c 100644 --- a/share/libc/sys/un.h +++ b/share/libc/sys/un.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -23,16 +23,18 @@ #ifndef FC_UN #define FC_UN #include "../features.h" -#include "../__fc_define_sa_family_t.h" - +__PUSH_FC_STDLIB __BEGIN_DECLS +#include "../__fc_define_sa_family_t.h" struct sockaddr_un { sa_family_t sun_family; - char sun_path[__FC_SOCKADDR_SUN_SUN_PATH]; /* Path name. */ + // Note: the length has been hard-coded to the value typically found in + // Linux. Move it to the machdep to support other implementations. + char sun_path[108]; /* Path name. */ }; __END_DECLS - +__POP_FC_STDLIB #endif diff --git a/share/libc/sys/utsname.h b/share/libc/sys/utsname.h new file mode 100644 index 0000000000000000000000000000000000000000..5a1f54598cbdd74ffc2cb85bb94a92a3d39c0cf5 --- /dev/null +++ b/share/libc/sys/utsname.h @@ -0,0 +1,44 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_SYS_UTSNAME_H__ +#define __FC_SYS_UTSNAME_H__ + +#include "../features.h" +__PUSH_FC_STDLIB + +// Arbitrary length, based on the one used in Linux +#define _FC_UTSNAME_LENGTH 65 + +struct utsname +{ + char sysname[_FC_UTSNAME_LENGTH]; + char nodename[_FC_UTSNAME_LENGTH]; + char release[_FC_UTSNAME_LENGTH]; + char version[_FC_UTSNAME_LENGTH]; + char machine[_FC_UTSNAME_LENGTH]; +}; + +extern int uname (struct utsname *name); + +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/wait.h b/share/libc/sys/wait.h index bbfca33ce6557978a5c2f78dd96b3a7237a28e45..520c615732390a754a364852a9921c7e04a43076 100644 --- a/share/libc/sys/wait.h +++ b/share/libc/sys/wait.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -20,32 +20,47 @@ /* */ /**************************************************************************/ -#ifndef __FC_WAIT_H__ -#define __FC_WAIT_H__ +#ifndef __FC_SYS_WAIT_H__ +#define __FC_SYS_WAIT_H__ +#include "../features.h" +__PUSH_FC_STDLIB +__BEGIN_DECLS -#define WNOHANG 0 -#define WUNTRACED 1 -#define WEXITED 2 -#define WSTOPPED 3 -#define WCONTINUED 4 -#define WNOWAIT 5 +// The values for the constants/macros below are based on the glibc on +// an x86 Linux, declared in the order given by POSIX.1-2008. -#include "../features.h" +#define WNOHANG 1 +#define WCONTINUED 8 +#define WUNTRACED 2 + +#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) +#define WIFCONTINUED(status) ((status) == 0xffff) +#define WIFEXITED(status) (((status) & 0x7f) == 0) +#define WIFSIGNALED(status) (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) +#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) +#define WSTOPSIG(status) WEXITSTATUS(status) +#define WTERMSIG(status) ((status) & 0x7f) + +#define WEXITED 4 +#define WNOWAIT 0x01000000 +#define WSTOPPED 2 + +#include "../__fc_define_id_t.h" #include "../__fc_define_pid_t.h" #include "../__fc_define_uid_and_gid.h" #include "../signal.h" -#include "resource.h" - -__BEGIN_DECLS typedef enum __FC_IDTYPE_T { P_ALL, P_PID, P_PGID } idtype_t; extern pid_t wait(int *stat_loc); -extern pid_t wait3(int *, int, struct rusage *); extern int waitid(idtype_t idt, id_t id, siginfo_t * sig, int options); extern pid_t waitpid(pid_t pid, int *stat_loc, int options); -__END_DECLS +#include "resource.h" +// non-POSIX +extern pid_t wait3(int *, int, struct rusage *); -#endif +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/syslog.h b/share/libc/syslog.h index 9a0d860ed564e7125da1cbc15e02b1e00526b4ac..2b2ffc2bae053b45b94e046b48bc3031e34b10fc 100644 --- a/share/libc/syslog.h +++ b/share/libc/syslog.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/termios.h b/share/libc/termios.h index bd32c1c2296ec98585c5cdac7de118519e847135..2cd12f86c209c3a5814260da29737153c04907ad 100644 --- a/share/libc/termios.h +++ b/share/libc/termios.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -29,7 +29,7 @@ __PUSH_FC_STDLIB #include "__fc_define_pid_t.h" -extern int Frama_C_entropy_source; +extern volatile int Frama_C_entropy_source; #define IGNBRK 0000001 #define BRKINT 0000002 diff --git a/share/libc/tgmath.h b/share/libc/tgmath.h index cdd104828fc291bf318058c1e0e377f4c2c30923..843569f426f7ea89493457ea15cfa95b084c388b 100644 --- a/share/libc/tgmath.h +++ b/share/libc/tgmath.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/time.h b/share/libc/time.h index f7ce97590599b06e714033eb495c4efb4de01acf..0ca0759cbdbff9820dff12b24b7a7f0b925e7691 100644 --- a/share/libc/time.h +++ b/share/libc/time.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -118,7 +118,33 @@ extern size_t strftime(char * restrict s, const struct tm * restrict timeptr); /* POSIX */ -extern int nanosleep(const struct timespec *, struct timespec *); +extern char *asctime_r(const struct tm *restrict, char *restrict); +//Note: uncomment functions below when the necessary types will be defined: +// clockid_t, locale_t, timer_t +//extern int clock_getres(clockid_t, struct timespec *); +//extern int clock_gettime(clockid_t, struct timespec *); +//extern int clock_nanosleep(clockid_t, int, const struct timespec *, +// struct timespec *); +//extern int clock_settime(clockid_t, const struct timespec *); +extern char *ctime_r(const time_t *timep, char *buf); +extern struct tm *getdate(const char *string); +extern struct tm *gmtime_r(const time_t *restrict timer, + struct tm *restrict result); +extern struct tm *localtime_r(const time_t *restrict timep, + struct tm *restrict result); +extern int nanosleep(const struct timespec *req, struct timespec *rem); +//extern size_t strftime_l(char *restrict, size_t, const char *restrict, +// const struct tm *restrict, locale_t); +extern char *strptime(const char *restrict s, const char *restrict format, + struct tm *restrict tm); +//extern int timer_create(clockid_t, struct sigevent *restrict, +// timer_t *restrict); +//extern int timer_delete(timer_t); +//extern int timer_getoverrun(timer_t); +//extern int timer_gettime(timer_t, struct itimerspec *); +//extern int timer_settime(timer_t, int, const struct itimerspec *restrict, +// struct itimerspec *restrict); +extern void tzset(void); extern int daylight; extern long timezone; diff --git a/share/libc/uchar.h b/share/libc/uchar.h index aad67b04d3ed5496d138f7a6db353bb5248db8b5..85becffc959bfa27bbb83b787fe2aedf71a2b261 100644 --- a/share/libc/uchar.h +++ b/share/libc/uchar.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/share/libc/unistd.h b/share/libc/unistd.h index 9cfc2e406ee504b3a0f9ae924d8bfc3690628049..6340a6f8875a0bf17704011d25e9751f7de6af69 100644 --- a/share/libc/unistd.h +++ b/share/libc/unistd.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -38,7 +38,7 @@ __PUSH_FC_STDLIB #include <getopt.h> -extern int Frama_C_entropy_source; +extern volatile int Frama_C_entropy_source; /* Values for the second argument to access. These may be OR'd together. */ diff --git a/share/libc/utime.h b/share/libc/utime.h new file mode 100644 index 0000000000000000000000000000000000000000..7213d0b428cc1963e48708957569f67cbc408e91 --- /dev/null +++ b/share/libc/utime.h @@ -0,0 +1,40 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_UTIME_H +#define __FC_UTIME_H +#include "features.h" +__PUSH_FC_STDLIB +#include "sys/time.h" + +__BEGIN_DECLS + +struct utimbuf { + time_t actime; /* access time */ + time_t modtime; /* modification time */ +}; + +extern int utime(const char *filename, const struct utimbuf *times); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/utmpx.h b/share/libc/utmpx.h new file mode 100644 index 0000000000000000000000000000000000000000..dbdc31082cf16c7bb455d8daa3c3d8f853ed221c --- /dev/null +++ b/share/libc/utmpx.h @@ -0,0 +1,62 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2017 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#ifndef __FC_UTMPX +#define __FC_UTMPX +#include "features.h" +__PUSH_FC_STDLIB + +#include "__fc_define_pid_t.h" +#include <sys/time.h> + +// The sizes of arrays and values for the constants below are based on those +// of the glibc, declared in the order given by POSIX.1-2008. + +struct utmpx { + char ut_user[32]; + char ut_id[4]; + char ut_line[32]; + char ut_host[256]; // not POSIX, but allowed by it, and present in glibc + pid_t ut_pid; + short ut_type; + struct timeval ut_tv; +}; + +#define EMPTY 0 +#define BOOT_TIME 2 +#define OLD_TIME 4 +#define NEW_TIME 3 +#define USER_PROCESS 7 +#define INIT_PROCESS 5 +#define LOGIN_PROCESS 6 +#define DEAD_PROCESS 8 + +extern void endutxent(void); +extern struct utmpx *getutxent(void); +extern struct utmpx *getutxid(const struct utmpx *); +extern struct utmpx *getutxline(const struct utmpx *); +extern struct utmpx *pututxline(const struct utmpx *); +extern void setutxent(void); + +__END_DECLS +__POP_FC_STDLIB +#endif diff --git a/share/libc/wchar.c b/share/libc/wchar.c index d5ca24557f42617435ebfb0dbc179af79002fcf6..406cc4ca1959e316193047d158c39eae3871d710 100644 --- a/share/libc/wchar.c +++ b/share/libc/wchar.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -23,65 +23,59 @@ /* ISO C: 7.25 */ #include "wchar.h" -wchar_t* wmemcpy(wchar_t * region1, const wchar_t * region2, size_t n) +wchar_t* wmemcpy(wchar_t *dest, const wchar_t *src, size_t n) { - const wchar_t* first = (const wchar_t*)region2; - const wchar_t* last = ((const wchar_t*)region2) + n; - wchar_t* result = (wchar_t*)region1; - wchar_t* dest = result; - while (first != last) - *dest++ = *first++; - return result; + for (size_t i = 0; i < n; i++) { + dest[i] = src[i]; + } + return dest; } wchar_t * wmemset(wchar_t *dest, wchar_t val, size_t len) { - wchar_t *ptr = dest; - while (len-- > 0) - *ptr++ = val; + for (size_t i = 0; i < len; i++) { + dest[i] = val; + } return dest; } - -wchar_t* wcscpy(wchar_t * s1, const wchar_t * s2) +wchar_t* wcscpy(wchar_t *dest, const wchar_t *src) { - wchar_t *os1 = s1; - - while (*s1++ = *s2++) - ; - return (os1); + size_t i; + for (i = 0; src[i] != L'\0'; i++) + dest[i] = src[i]; + dest[i] = L'\0'; + return dest; } size_t wcslen(const wchar_t * str) { - const wchar_t *s =str; - for (s = str; *s; ++s); - return(s - str); + size_t i; + for (i = 0; str[i] != L'\0'; i++); + return i; } -wchar_t * wcsncpy(wchar_t * s1, const wchar_t * s2, size_t n) +wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n) { - wchar_t *os1 = s1; - - n++; - while ((--n != 0) && ((*s1++ = *s2++) != L'\0')) - ; - if (n != 0) - while (--n != 0) - *s1++ = L'\0'; - return (os1); + size_t i; + for (i = 0; i < n; i++) { + dest[i] = src[i]; + if (src[i] == L'\0') break; + } + for (; i < n; i++) + dest[i] = L'\0'; + return dest; } -wchar_t * wcscat(wchar_t * s1, const wchar_t * s2) +wchar_t * wcscat(wchar_t *dest, const wchar_t *src) { - wchar_t *os1 = s1; - - while (*s1++) - ; - --s1; - while (*s1++ = *s2++) - ; - return (os1); + size_t i; + size_t n = wcslen(dest); + for (i = 0; src[i] != L'\0'; i++) { + dest[n+i] = src[i]; + } + dest[n+i] = L'\0'; + return dest; } wchar_t* wcsncat(wchar_t *dest, const wchar_t *src, size_t n) diff --git a/share/libc/wchar.h b/share/libc/wchar.h index 9f099307afbb15133220972df24210b911ab6c1e..2935c20ad581c0cd54bfb54eb6cf99d9b7f53cd1 100644 --- a/share/libc/wchar.h +++ b/share/libc/wchar.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -27,11 +27,25 @@ #include "features.h" __PUSH_FC_STDLIB #include "__fc_define_wchar_t.h" +#include "__fc_define_wint_t.h" #include "__fc_define_size_t.h" #include "__fc_define_file.h" +// Include <stdint.h> to retrieve definitions such as WCHAR_MIN and WINT_MAX, +// required by ISO C (and not necessarily respected by the glibc). +// Note that POSIX does not specify that all symbols in <stdint.h> can be +// made visible in wchar.h, but in practice this should be fine. +#include <stdint.h> + +// ISO C requires the tag 'struct tm' (as declared in <time.h>) to be declared. +#include <time.h> + __BEGIN_DECLS +#ifndef WEOF +#define WEOF __FC_WEOF +#endif + /*@ assigns \result \from s, indirect:s[0 .. n-1], indirect:c, indirect:n; ensures \result == \null || \subset (\result, s+(0 .. n-1)); @@ -60,6 +74,8 @@ extern wchar_t * wmemmove(wchar_t *dest, const wchar_t *src, size_t n); assigns wcs[0 .. n-1] \from wc, indirect:n; assigns \result \from wcs; ensures \result == wcs; + ensures \initialized(wcs + (0 .. n-1)); + ensures \subset(wcs[0 .. n-1], wc); */ extern wchar_t * wmemset(wchar_t *wcs, wchar_t wc, size_t n); @@ -146,6 +162,14 @@ extern size_t wcsspn(const wchar_t *wcs, const wchar_t *accept); */ extern wchar_t * wcsstr(const wchar_t *haystack, const wchar_t *needle); +/*@ + // Axiomatic used by the Variadic plugin to generate specifications + // for some functions, e.g. swprintf(). + axiomatic wformat_length { + //TODO: this logic function will be extended to handle variadic formats + logic integer wformat_length{L}(wchar_t *format); + } +*/ /* It is unclear whether these are more often in wchar.h or stdio.h */ diff --git a/share/libc/wctype.h b/share/libc/wctype.h index 457243dd19aa19718e76801a75cade4c93c86ed2..33c4e5555a6191d34d95f71929173cc15c2cc2d5 100644 --- a/share/libc/wctype.h +++ b/share/libc/wctype.h @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/src/kernel_internals/parsing/check_logic_parser.ml b/src/kernel_internals/parsing/check_logic_parser.ml index e7267e614c7fd19ae06bee7025d827d065e3c8d0..1f26500fd040f3ab88738db688b1a4b00f9710f7 100644 --- a/src/kernel_internals/parsing/check_logic_parser.ml +++ b/src/kernel_internals/parsing/check_logic_parser.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/parsing/clexer.mll b/src/kernel_internals/parsing/clexer.mll index ebf9d3ab836fc8e8dd231755a2c2d76b8fad1ca4..c7477a62f4bdeea68d060a35a4dc693872dfb6d7 100644 --- a/src/kernel_internals/parsing/clexer.mll +++ b/src/kernel_internals/parsing/clexer.mll @@ -43,7 +43,7 @@ (* FrontC -- lexical analyzer ** -** 1.0 3.22.99 Hugues Cassé First version. +** 1.0 3.22.99 Hugues Cassé First version. ** 2.0 George Necula 12/12/00: Many extensions *) { @@ -51,7 +51,7 @@ open Cparser module H = Hashtbl module E = Errorloc -let currentLoc () = Errorloc.currentLoc () +let currentLoc () = E.currentLoc () let one_line_ghost = ref false let is_oneline_ghost () = !one_line_ghost @@ -379,8 +379,9 @@ let () = Kernel.ReadAnnot.add_set_hook (fun _ x -> (* prevent the C lexer interpretation of comments *) - annot_char := if x then '@' else '\000'); - Kernel.CustomAnnot.add_set_hook (fun _ s -> annot_char:=s.[0]) + annot_char := if x then '@' else '\000') +(* ; + Kernel.CustomAnnot.add_set_hook (fun _ s -> annot_char:=s.[0]) *) let annot_start_pos = ref Cabshelper.cabslu let buf = Buffer.create 1024 @@ -465,16 +466,10 @@ let no_parse_pragma = rule initial = parse -| "/*" | "/*@{" | "/*@}" (* Skip special doxygen comments. Use of '@' instead - of '!annot_char' is intentional *) +| "/*" ("" | "@{" | "@}" as suf) (* Skip special doxygen comments. Use of '@' + instead of '!annot_char' is intentional *) { - let s = Lexing.lexeme lexbuf in - let first_string = - if String.length s > 2 then - String.sub s 2 (String.length s - 2) - else "" - in - do_lex_comment ~first_string comment lexbuf ; + do_lex_comment ~first_string:suf comment lexbuf ; initial lexbuf } @@ -495,15 +490,9 @@ rule initial = parse end } -| "//" | "//@{" | "//@}" (* See comment for "/*@{" above *) +| "//" ("" | "@{" | "@}" as suf) (* See comment for "/*@{" above *) { - let s = Lexing.lexeme lexbuf in - let first_string = - if String.length s > 2 then - String.sub s 2 (String.length s - 2) - else "" - in - do_lex_comment ~first_string onelinecomment lexbuf ; + do_lex_comment ~first_string:suf onelinecomment lexbuf ; E.newline(); if is_oneline_ghost () then begin exit_oneline_ghost (); @@ -559,17 +548,30 @@ rule initial = parse | '#' { hash lexbuf} | "%:" { hash lexbuf} | "_Pragma" { PRAGMA (currentLoc ()) } -| '\'' { CST_CHAR (chr lexbuf, currentLoc ())} -| "L'" { CST_WCHAR (chr lexbuf, currentLoc ()) } -| '"' { -(* matth: BUG: this could be either a regular string or a wide string. - * e.g. if it's the "world" in - * L"Hello, " "world" - * then it should be treated as wide even though there's no L immediately - * preceding it. See test/small1/wchar5.c for a failure case. *) - CST_STRING (str lexbuf, currentLoc())} -| "L\"" { (* weimer: wchar_t string literal *) - CST_WSTRING(str lexbuf, currentLoc())} +| '\'' { + let start = Lexing.lexeme_start_p lexbuf in + let content = chr lexbuf in + let last = Lexing.lexeme_end_p lexbuf in + CST_CHAR (content, (start,last)) + } +| "L'" { + let start = Lexing.lexeme_start_p lexbuf in + let content = chr lexbuf in + let last = Lexing.lexeme_end_p lexbuf in + CST_WCHAR (content, (start,last)) + } +| '"' { + let start = Lexing.lexeme_start_p lexbuf in + let content = str lexbuf in + let last = Lexing.lexeme_end_p lexbuf in + CST_STRING (content, (start,last)) + } +| "L\"" { + let start = Lexing.lexeme_start_p lexbuf in + let content = str lexbuf in + let last = Lexing.lexeme_end_p lexbuf in + CST_WSTRING(content, (start,last)) + } | floatnum {CST_FLOAT (Lexing.lexeme lexbuf, currentLoc ())} | binarynum { (* GCC Extension for binary numbers *) CST_INT (Lexing.lexeme lexbuf, currentLoc ())} @@ -715,16 +717,11 @@ and file = parse | blank {file lexbuf} (* The //-ending file directive is a GCC extension that provides the CWD of the preprocessor when the file was preprocessed. *) -| '"' [^ '\012' '\t' '"']* '/' '/' '"' { - let n = Lexing.lexeme lexbuf in - let n1 = String.sub n 1 ((String.length n) - 4) in - E.setCurrentWorkingDirectory n1; +| '"' ([^ '\012' '\t' '"']* as d) "//\"" { + E.setCurrentWorkingDirectory d; endline lexbuf } -| '"' [^ '\012' '\t' '"']* '"' { (* '"' *) - let n = Lexing.lexeme lexbuf in - let n1 = String.sub n 1 - ((String.length n) - 2) in - E.setCurrentFile n1; +| '"' ([^ '\012' '\t' '"']* as f) '"' { + E.setCurrentFile f; endline lexbuf} | _ {endline lexbuf} diff --git a/src/kernel_internals/parsing/cparser.mly b/src/kernel_internals/parsing/cparser.mly index a75ec71f3455f9c41493debd1d30c840d5562075..a9244c605bf714b42784967809fbef79b8d9b5e5 100644 --- a/src/kernel_internals/parsing/cparser.mly +++ b/src/kernel_internals/parsing/cparser.mly @@ -66,6 +66,8 @@ let smooth_expression lst = let end_loc = snd (Extlib.last lst).expr_loc in { expr_loc = (beg_loc,end_loc); expr_node = COMMA (lst) } +let merge_string (c1,(b1,_)) (c2,(_,e2)) = c1 @ c2, (b1,e2) + (* To be called only inside a grammar rule. *) let make_expr e = { expr_loc = symbol_start_pos (), symbol_end_pos (); @@ -201,12 +203,13 @@ let int64_to_char value = Char.chr (Int64.to_int value) (* takes a not-nul-terminated list, and converts it to a string. *) -let rec intlist_to_string (str: int64 list):string = - match str with - [] -> "" (* add nul-termination *) - | value::rest -> - let this_char = int64_to_char value in - (String.make 1 this_char) ^ (intlist_to_string rest) +let intlist_to_string (str: int64 list):string = + let buffer = Buffer.create (List.length str) in + let add_char c = + Buffer.add_char buffer (int64_to_char c) + in + List.iter add_char str ; + Buffer.contents buffer let fst3 (result, _, _) = result let trd3 (_, _, result) = result @@ -395,7 +398,7 @@ let in_block l = %type <Cabs.expression list> paren_comma_expression %type <Cabs.expression list> arguments %type <Cabs.expression list> bracket_comma_expression -%type <int64 list Queue.t * cabsloc> string_list +%type <int64 list * cabsloc> string_list %type <int64 list * cabsloc> wstring_list %type <Cabs.initwhat * Cabs.init_expression> initializer_single @@ -513,7 +516,8 @@ maybecomma: primary_expression: /*(* 6.5.1. *)*/ | IDENT { make_expr (VARIABLE $1) } -| constant { make_expr (CONSTANT (fst $1)) } +| constant { + let (v,expr_loc) = $1 in { expr_loc; expr_node = CONSTANT v } } | paren_comma_expression { make_expr (PAREN (smooth_expression $1)) } | LPAREN block RPAREN { make_expr (GNU_BODY (fst3 $2)) } @@ -733,40 +737,23 @@ constant: string_constant: /* Now that we know this constant isn't part of a wstring, convert it back to a string for easy viewing. */ - string_list { - let queue, location = $1 in - let buffer = Buffer.create (Queue.length queue) in - Queue.iter - (List.iter - (fun value -> - let char = int64_to_char value in - Buffer.add_char buffer char)) - queue; - Buffer.contents buffer, location - } + string_list { intlist_to_string (fst $1), snd $1 } ; one_string_constant: /* Don't concat multiple strings. For asm templates. */ - CST_STRING {intlist_to_string (fst $1) } + CST_STRING { intlist_to_string (fst $1) } ; string_list: - one_string { - let queue = Queue.create () in - Queue.add (fst $1) queue; - queue, snd $1 - } -| string_list one_string { - Queue.add (fst $2) (fst $1); - $1 - } + one_string { fst $1, snd $1 } +| string_list one_string { merge_string $1 $2 } ; wstring_list: CST_WSTRING { $1 } -| wstring_list one_string { (fst $1) @ (fst $2), snd $1 } -| wstring_list CST_WSTRING { (fst $1) @ (fst $2), snd $1 } -/* Only the first string in the list needs an L, so L"a" "b" is the same - * as L"ab" or L"a" L"b". */ +| wstring_list one_string { merge_string $1 $2 } +| wstring_list CST_WSTRING { merge_string $1 $2 } +| string_list CST_WSTRING { merge_string $1 $2 } +/* If a wstring is present anywhere in the list, the whole is a wstring */ one_string: CST_STRING {$1} @@ -958,9 +945,9 @@ statement: | CASE expression ELLIPSIS expression COLON annotated_statement { let loc = Parsing.symbol_start_pos (), Parsing.rhs_end_pos 5 in no_ghost [CASERANGE ($2, $4, in_block $6, loc)]} -| DEFAULT COLON - { let loc = Parsing.symbol_start_pos(), Parsing.symbol_end_pos () in - no_ghost [DEFAULT (no_ghost_stmt (NOP loc), loc)]} +| DEFAULT COLON annotated_statement + { let loc = Parsing.symbol_start_pos(), Parsing.symbol_end_pos () in + no_ghost [DEFAULT (in_block $3, loc)]} | RETURN SEMICOLON { let loc = Parsing.symbol_start_pos (), Parsing.symbol_end_pos () in no_ghost [RETURN ({ expr_loc = loc; expr_node = NOTHING}, loc)] @@ -1518,6 +1505,7 @@ var_attr: basic_attr: | CST_INT { make_expr (CONSTANT(CONST_INT (fst $1))) } +| CST_FLOAT { make_expr (CONSTANT(CONST_FLOAT(fst $1))) } | var_attr { $1 } ; basic_attr_list_ne: @@ -1660,17 +1648,22 @@ conditional_attr: | logical_or_attr QUEST attr_test conditional_attr COLON2 conditional_attr { make_expr (QUESTION($1, $4, $6)) } +assign_attr: + conditional_attr { $1 } +| conditional_attr EQ conditional_attr { make_expr (BINARY(ASSIGN,$1,$3)) } + /* hack to avoid shift reduce conflict in attribute parsing. */ attr_test: | /* empty */ { Cabshelper.push_attr_test () } -attr: conditional_attr { $1 } +attr: assign_attr { $1 } ; attr_list_ne: | attr { [$1] } | attr COMMA attr_list_ne { $1 :: $3 } ; + attr_list: /* empty */ { [] } | attr_list_ne { $1 } diff --git a/src/kernel_internals/parsing/errorloc.ml b/src/kernel_internals/parsing/errorloc.ml index 42fc3d220230e897aeb1d69709b06a0618bb00c6..c52da45955b712c4364ddbde5f6803d82b38c361 100644 --- a/src/kernel_internals/parsing/errorloc.ml +++ b/src/kernel_internals/parsing/errorloc.ml @@ -121,53 +121,122 @@ let setCurrentFile ?(normalize=true) (n: string) = plus up to [ctx] lines before and after [pos.pos_lnum] (if they exist), similar to 'grep -C<ctx>'. The first line is numbered 1. Most exceptions are silently caught and printing is stopped if they occur. *) -let pp_context_from_file ?(ctx=2) fmt pos = +let pp_context_from_file ?(ctx=2) ?start_line fmt pos = try let in_ch = open_in pos.Lexing.pos_fname in try begin - let n = pos.Lexing.pos_lnum in - let first_to_print = max (n-ctx) 1 in - let last_to_print = n+ctx in + let first_error_line, last_error_line = + match start_line with + | None -> pos.Lexing.pos_lnum, pos.Lexing.pos_lnum + | Some l -> min l pos.Lexing.pos_lnum, max l pos.Lexing.pos_lnum + in + let first_to_print = max (first_error_line-ctx) 1 in + let last_to_print = last_error_line+ctx in let i = ref 1 in + let error_line_len = ref 0 in try (* advance to line *) while !i < first_to_print do ignore (input_line in_ch); incr i done; - (* print context and target line *) + (* print context before first error line *) + while !i < first_error_line do + let line = input_line in_ch in + Format.fprintf fmt "%-6d%s\n" !i line; + incr i + done; + (* if more than one line of context, print blank line *) + if last_error_line <> first_error_line then + Format.fprintf fmt "\n"; + (* print error lines *) + while !i <= last_error_line do + let line = input_line in_ch in + error_line_len := String.length line; + Format.fprintf fmt "%-6d%s\n" !i line; + incr i + done; + (* if more than one line of context, print blank line, + otherwise print arrows *) + if last_error_line <> first_error_line then + Format.fprintf fmt "\n" + else begin + let cursor = + String.make 6 ' ' ^ + String.make !error_line_len '^' + in + Format.fprintf fmt "%s\n" cursor + end; while !i <= last_to_print do let line = input_line in_ch in - if !i = n then begin - Format.fprintf fmt "%-6d%s\n" !i line; - let cursor = - String.make 6 ' ' ^ - String.make (String.length line) '^' - in - Format.fprintf fmt "%s\n" cursor - end - else - Format.fprintf fmt "%-6d%s\n" !i line; + Format.fprintf fmt "%-6d%s\n" !i line; incr i done; with End_of_file -> - if !i <= n then (* could not reach line, print warning *) - Kernel.warning "end of file reached before line %d" n + if !i <= last_error_line then (* could not reach line, print warning *) + Kernel.warning "end of file reached before line %d" last_error_line else (* context after line n, no warning *) () end; close_in in_ch with _ -> close_in_noerr in_ch with _ -> () +let pretty_pos fmt pos = + if pos = Lexing.dummy_pos then Format.fprintf fmt "<unknown>" + else Format.fprintf fmt "%d:%d" pos.Lexing.pos_lnum + (pos.Lexing.pos_cnum - pos.Lexing.pos_bol) + +let pretty_pos_between fmt (pos_start, pos_end) = + if pos_start.Lexing.pos_fname = pos_end.Lexing.pos_fname then + if pos_start.Lexing.pos_lnum = pos_end.Lexing.pos_lnum then + (* single file, single line *) + Format.fprintf fmt "at %s:%d:%d-%d" + (Filepath.pretty pos_start.Lexing.pos_fname) pos_start.Lexing.pos_lnum + (pos_start.Lexing.pos_cnum - pos_start.Lexing.pos_bol) + (pos_end.Lexing.pos_cnum - pos_end.Lexing.pos_bol) + else + (* single file, multiple lines *) + Format.fprintf fmt "at %s, between lines %d and %d" + (Filepath.pretty pos_start.Lexing.pos_fname) + pos_start.Lexing.pos_lnum pos_end.Lexing.pos_lnum + else (* multiple files (very rare) *) + Format.fprintf fmt "between %a and %a" + pretty_pos pos_start pretty_pos pos_end + let parse_error ?(source=Lexing.lexeme_start_p !current.lexbuf) msg = - Pretty_utils.ksfprintf (fun str -> - Kernel.feedback "%s" str ~append:(fun fmt -> - Format.fprintf fmt " at %s:%d:\n" - (Filepath.pretty source.Lexing.pos_fname) source.Lexing.pos_lnum; - Format.fprintf fmt "%a@." (pp_context_from_file ~ctx:2) source); - raise (Log.AbortError "kernel")) - msg + let start_pos = try Some (Parsing.symbol_start_pos ()) with | _ -> None in + let pretty_token fmt token = + (* prints more detailed information around the erroneous token; + due to the fact that some tokens are normalized (e.g. single-line ACSL + comments), we blacklist them to avoid confusing the user *) + let blacklist = ["*/"] in + if List.mem token blacklist then () + else + Format.fprintf fmt ", before or at token: %s" token + in + match start_pos with + | None -> + Pretty_utils.ksfprintf (fun str -> + Kernel.feedback "%s" str ~append:(fun fmt -> + Format.fprintf fmt " at %s:%d%a\n" + (Filepath.pretty source.Lexing.pos_fname) source.Lexing.pos_lnum + pretty_token (Lexing.lexeme !current.lexbuf); + Format.fprintf fmt "%a@." + (pp_context_from_file ?start_line:None ~ctx:2) source); + raise (Log.AbortError "kernel")) + msg + | Some start_pos -> + Pretty_utils.ksfprintf (fun str -> + Kernel.feedback "%s" str ~append:(fun fmt -> + Format.fprintf fmt " %a%a\n" + pretty_pos_between (start_pos, source) + pretty_token (Lexing.lexeme !current.lexbuf); + Format.fprintf fmt "%a@." + (pp_context_from_file ~start_line:start_pos.Lexing.pos_lnum ~ctx:2) source); + raise (Log.AbortError "kernel")) + msg + (* More parsing support functions: line, file, char count *) let currentLoc () : Lexing.position * Lexing.position = diff --git a/src/kernel_internals/parsing/errorloc.mli b/src/kernel_internals/parsing/errorloc.mli index ffa16fee584a16a3f0db56ae691dc3b4c232606b..1495b574dfc00129d0da016004f970ffdea526eb 100644 --- a/src/kernel_internals/parsing/errorloc.mli +++ b/src/kernel_internals/parsing/errorloc.mli @@ -74,11 +74,18 @@ val finishParsing: unit -> unit (** Call this function to finish parsing and close the input channel *) +(** prints the line identified by the position, together with [ctx] lines + of context before and after. [ctx] defaults to 2. + If [start_line] is specified, then all lines between [start_line] and + [pos.pos_lnum] are considered part of the error. + *) +val pp_context_from_file: + ?ctx:int -> ?start_line:int -> Format.formatter -> Lexing.position -> unit + (** Parse errors are usually fatal, but their reporting is sometimes delayed until the end of the current parsing phase. Functions that intend to ultimately fail should call {!clear_errors} when they start, and check {!had_errors} when they end. *) - val parse_error: ?source:Lexing.position -> ('a, Format.formatter, unit, 'b) format4 -> 'a diff --git a/src/kernel_internals/parsing/logic_lexer.mli b/src/kernel_internals/parsing/logic_lexer.mli index decd32d1fa131ce937629f145ee71c8a88e93c90..09e9234808bcdc9475c29a62b60808ca0c5c3133 100644 --- a/src/kernel_internals/parsing/logic_lexer.mli +++ b/src/kernel_internals/parsing/logic_lexer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -40,4 +40,9 @@ type 'a parse = Lexing.position * string -> Lexing.position * 'a val lexpr : Logic_ptree.lexpr parse val annot : Logic_ptree.annot parse val spec : Logic_ptree.spec parse -val ext_spec : Logic_ptree.ext_spec parse + +val ext_spec : Lexing.lexbuf -> Logic_ptree.ext_spec +(** ACSL extension for parsing external spec file. + Here, the tokens "/*" and "*/" are accepted by the lexer + as unnested C comments into the external ACSL specifications. + @modified Frama-C+dev to accept /* */ as C comments. *) diff --git a/src/kernel_internals/parsing/logic_lexer.mll b/src/kernel_internals/parsing/logic_lexer.mll index dd4f9bf6f20e55cbeedfbbc6005ddf800837777b..0401e545e26dc03ed750d23a24ab0ace60de7cb6 100644 --- a/src/kernel_internals/parsing/logic_lexer.mll +++ b/src/kernel_internals/parsing/logic_lexer.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -231,6 +231,8 @@ let pos = lexbuf.Lexing.lex_curr_p in lexbuf.Lexing.lex_curr_p <- { pos with Lexing.pos_fname = file } + let accept_c_comments_into_acsl_spec = ref false + } let space = [' ' '\t' '\012' '\r' '@' ] @@ -260,6 +262,11 @@ rule token = parse | '\n' { update_newline_loc lexbuf; token lexbuf } | comment_line '\n' { update_newline_loc lexbuf; token lexbuf } | comment_line eof { token lexbuf } + | "*/" { lex_error lexbuf "unexpected block-comment closing" } + | "/*" { if !accept_c_comments_into_acsl_spec + then comment lexbuf + else lex_error lexbuf "unexpected block-comment opening" + } | '\\' rL (rL | rD)* { bs_identifier lexbuf } | rL (rL | rD)* { let s = lexeme lexbuf in identifier s } @@ -433,6 +440,12 @@ and endline = parse | eof { EOF } | _ { endline lexbuf} +and comment = parse + '\n' { update_newline_loc lexbuf; comment lexbuf} + | "*/" { token lexbuf} + | eof { lex_error lexbuf "non-terminating block-comment" } + | _ { comment lexbuf} + { let set_initial_location dest_lexbuf src_loc = Lexing.( @@ -478,8 +491,14 @@ and endline = parse let spec = parse_from_location Logic_parser.spec - (* ACSL extension for external spec file *) - let ext_spec = parse_from_location Logic_parser.ext_spec + let ext_spec lexbuf = try + accept_c_comments_into_acsl_spec := true ; + let r = Logic_parser.ext_spec token lexbuf in + accept_c_comments_into_acsl_spec := false ; + r + with exn -> + accept_c_comments_into_acsl_spec := false ; + raise exn type 'a parse = Lexing.position * string -> Lexing.position * 'a diff --git a/src/kernel_internals/parsing/logic_parser.mly b/src/kernel_internals/parsing/logic_parser.mly index 2bff5edfa1c7742ad9b7f4006efed2820487743a..cdd06d2b91a63ceefc9a279c8ce6aadd358bdbf9 100644 --- a/src/kernel_internals/parsing/logic_parser.mly +++ b/src/kernel_internals/parsing/logic_parser.mly @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* INRIA (Institut National de Recherche en Informatique et en */ diff --git a/src/kernel_internals/parsing/logic_preprocess.mli b/src/kernel_internals/parsing/logic_preprocess.mli index 4568808af6fa5917eaaacadec00f7721767f8dcb..27a11fa74f859a4bdf128f7a5353ca0b6f8fed11 100644 --- a/src/kernel_internals/parsing/logic_preprocess.mli +++ b/src/kernel_internals/parsing/logic_preprocess.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/kernel_internals/parsing/logic_preprocess.mll b/src/kernel_internals/parsing/logic_preprocess.mll index 785dc11e65178094bdbc1a3480ec473a7d09d6b5..cd949591065a4ccf4a65177917ffc769e3e238af 100644 --- a/src/kernel_internals/parsing/logic_preprocess.mll +++ b/src/kernel_internals/parsing/logic_preprocess.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -172,6 +172,14 @@ preprocess_buffer "# %d %s \n" !curr_line !curr_file let make_newline () = incr curr_line + + let process_annot_start () = + is_newline := CHAR; + has_annot := true; + Buffer.add_string output_buffer annot_content; + Buffer.add_string preprocess_buffer annot_beg; + Buffer.add_char preprocess_buffer '\n'; + add_preprocess_line_info() } rule main = parse @@ -198,12 +206,7 @@ rule main = parse comment c lexbuf;} | "/*" (_ as c) { if c = !Clexer.annot_char then begin - is_newline:=CHAR; - has_annot := true; - Buffer.add_string output_buffer annot_content; - Buffer.add_string preprocess_buffer annot_beg; - Buffer.add_char preprocess_buffer '\n'; - add_preprocess_line_info(); + process_annot_start (); annot lexbuf end else begin if c = '\n' then make_newline(); @@ -216,12 +219,7 @@ rule main = parse } | "//" (_ as c) { if c = !Clexer.annot_char then begin - is_newline:=CHAR; - has_annot:=true; - Buffer.add_string output_buffer annot_content; - Buffer.add_string preprocess_buffer annot_beg; - Buffer.add_char preprocess_buffer '\n'; - add_preprocess_line_info(); + process_annot_start (); oneline_annot lexbuf end else if c = '\n' then begin @@ -326,6 +324,7 @@ and macro_char blacklisted = parse | _ as c { if not blacklisted then Buffer.add_char preprocess_buffer c; macro_char blacklisted lexbuf } and c_string = parse +| eof { abort_preprocess "unterminated string" } | "\\\"" { Buffer.add_string output_buffer (lexeme lexbuf); c_string lexbuf } | "\"" { Buffer.add_char output_buffer '"'; main lexbuf } | '\n' { make_newline (); @@ -336,6 +335,7 @@ and c_string = parse | _ as c { Buffer.add_char output_buffer c; c_string lexbuf } (* C syntax allows for multiple char character constants *) and c_char = parse +| eof { abort_preprocess "unterminated char" } | "\\\'" { Buffer.add_string output_buffer (lexeme lexbuf); c_char lexbuf } | "'" { Buffer.add_char output_buffer '\''; main lexbuf } diff --git a/src/kernel_internals/runtime/boot.ml b/src/kernel_internals/runtime/boot.ml index 961b496843d7f39122495393527e53846d463aac..e5bd3e3e9abf0cdaa1be6b58cfe5a186128e4eae 100644 --- a/src/kernel_internals/runtime/boot.ml +++ b/src/kernel_internals/runtime/boot.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/config.ml.in b/src/kernel_internals/runtime/config.ml.in index a44de6874d79e78c43a3d49281c0de1d430341a5..8e48cc5c2d58cded16edc864a3fc53119ca060e6 100644 --- a/src/kernel_internals/runtime/config.ml.in +++ b/src/kernel_internals/runtime/config.ml.in @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -52,20 +52,27 @@ let () = match plugin_dir with Filepath.add_symbolic_dir path d) (Array.of_list ds) -let preprocessor = - try Sys.getenv "CPP" with Not_found -> "@FRAMAC_DEFAULT_CPP@" +let default_cpp = "@FRAMAC_DEFAULT_CPP@" + +let default_cpp_args = " @FRAMAC_DEFAULT_CPP_ARGS@" + +let env_or_default f vdefault = + try + let env = Sys.getenv "CPP" ^ default_cpp_args in + if env=default_cpp then vdefault else f env + with Not_found -> vdefault + +let preprocessor = env_or_default (fun x -> x) default_cpp + +let using_default_cpp = env_or_default (fun _ -> false) true let preprocessor_is_gnu_like = - try ignore (Sys.getenv "CPP"); false with Not_found -> @FRAMAC_GNU_CPP@ + env_or_default (fun _ -> false) @FRAMAC_GNU_CPP@ let preprocessor_supported_arch_options = [@DEFAULT_CPP_SUPPORTED_ARCH_OPTS@] let preprocessor_keep_comments = - try (ignore (Sys.getenv "CPP"); true) - with Not_found -> @DEFAULT_CPP_KEEP_COMMENTS@ - -let static_plugins = [@STATIC_PLUGINS@] -let static_gui_plugins = [@STATIC_GUI_PLUGINS@] + env_or_default (fun _ -> true) @DEFAULT_CPP_KEEP_COMMENTS@ let compilation_unit_names = [@COMPILATION_UNITS@] let library_names = [@LIBRARY_NAMES@] diff --git a/src/kernel_internals/runtime/config.mli b/src/kernel_internals/runtime/config.mli index 95a80251b1d252491cfd57dc95743cc29a2a5bba..fdde468502144c848d53cd3408dcdab4ca24c11a 100644 --- a/src/kernel_internals/runtime/config.mli +++ b/src/kernel_internals/runtime/config.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -53,12 +53,6 @@ val plugin_path: string (** The coma-separated concatenation of [plugin_dir]. @since Magnesium-20151001 *) -val static_plugins: string list - (** Plug-ins statically linked within Frama-C. *) - -val static_gui_plugins: string list - (** GUI of plug-ins statically linked within Frama-C. *) - val compilation_unit_names: string list (** List of names of all kernel compilation units. @since Boron-20100401 *) @@ -74,6 +68,13 @@ val preprocessor: string "gcc -C -E -I." @since Oxygen-20120901 *) +val using_default_cpp: bool + (** whether the preprocessor command is the one defined at configure time + or the result of taking a CPP environment variable, in case it differs + from the configure-time command. + + @since Phosphorus-20170501-beta1 *) + val preprocessor_is_gnu_like: bool (** whether the default preprocessor accepts the same options as gcc (i.e. is either gcc or clang), when this is the case, the default @@ -85,7 +86,7 @@ val preprocessor_supported_arch_options: string list (** architecture-related options (e.g. -m32) known to be supported by the default preprocessor. Used to match preprocessor commands to selected machdeps. - @since Frama-C+dev + @since Phosphorus-20170501-beta1 *) val preprocessor_keep_comments: bool diff --git a/src/kernel_internals/runtime/frama_c_config.ml.in b/src/kernel_internals/runtime/frama_c_config.ml.in index ab8f4262ee293d6f549e452c4a88a0e825781cc1..9868204af3a10fa25597b6d52a0d7e1855ffd30e 100644 --- a/src/kernel_internals/runtime/frama_c_config.ml.in +++ b/src/kernel_internals/runtime/frama_c_config.ml.in @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/frama_c_init.ml b/src/kernel_internals/runtime/frama_c_init.ml index fd555c444081f6554da66d3334752a21c914168c..228e633522c3e5083fe96abe4649a6ab3fab192e 100644 --- a/src/kernel_internals/runtime/frama_c_init.ml +++ b/src/kernel_internals/runtime/frama_c_init.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/frama_c_init.mli b/src/kernel_internals/runtime/frama_c_init.mli index 57a5713c82106da9551803df8d5b527c0f0322ad..c35dcb4270f3e2b934e2c4e02fdc59a23abb5784 100644 --- a/src/kernel_internals/runtime/frama_c_init.mli +++ b/src/kernel_internals/runtime/frama_c_init.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/gui_init.ml b/src/kernel_internals/runtime/gui_init.ml index 27d128e43042b95a7635cda80764ff165ee9dba7..97792ce9e7eb5d211562f4f2d634fd1cde719a69 100644 --- a/src/kernel_internals/runtime/gui_init.ml +++ b/src/kernel_internals/runtime/gui_init.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/gui_init.mli b/src/kernel_internals/runtime/gui_init.mli index c20114cf4f6549eef066fe33ebe13558ef8c067f..91c8616c5de03034390a73e54a016566935a6587 100644 --- a/src/kernel_internals/runtime/gui_init.mli +++ b/src/kernel_internals/runtime/gui_init.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/messages.ml b/src/kernel_internals/runtime/messages.ml index 5d0637adecfd4fe6d07054b0ed55115fdaa91b20..26c267e5323bd7b6c8ae57b3800017648fcd4d45 100644 --- a/src/kernel_internals/runtime/messages.ml +++ b/src/kernel_internals/runtime/messages.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -43,7 +43,7 @@ module Messages = State_builder.List_ref (DatatypeMessages) (struct - let name = "message_table" + let name = "Messages.message_table" let dependencies = [ Ast.self ] end) let () = Ast.add_monotonic_state Messages.self @@ -92,7 +92,7 @@ module OnceTable = (struct let size = 37 let dependencies = [ Ast.self ] - let name = "Message.OnceTable" + let name = "Messages.OnceTable" end) let check_not_yet evt = diff --git a/src/kernel_internals/runtime/messages.mli b/src/kernel_internals/runtime/messages.mli index a03ac8d4bf5a9b9820052c783f6297e27aa6b883..c9a6201efdeb2df68759c444425eaa219b8a3564 100644 --- a/src/kernel_internals/runtime/messages.mli +++ b/src/kernel_internals/runtime/messages.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/special_hooks.ml b/src/kernel_internals/runtime/special_hooks.ml index 32a1d5b7dd77c646ea7751d09f9099cf5bdd02b7..c0fc781f8d8c518a4609104f6cefbf91a7a2dcbf 100644 --- a/src/kernel_internals/runtime/special_hooks.ml +++ b/src/kernel_internals/runtime/special_hooks.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/special_hooks.mli b/src/kernel_internals/runtime/special_hooks.mli index 5dbe6b9ab36d7552d77c7faebbb9ff90911a206f..bf2ceb20f1ee6ab0d3d11f4f9fdca56a14ca9919 100644 --- a/src/kernel_internals/runtime/special_hooks.mli +++ b/src/kernel_internals/runtime/special_hooks.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/runtime/toplevel_config.ml b/src/kernel_internals/runtime/toplevel_config.ml index 22851eb715392020fef9167176ec4860b85e07ca..1f09ac3441dc0e2f5ed8043a62cd30322046444b 100644 --- a/src/kernel_internals/runtime/toplevel_config.ml +++ b/src/kernel_internals/runtime/toplevel_config.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/typing/allocates.ml b/src/kernel_internals/typing/allocates.ml index e610a1939561fef98cebc4c4f449af850f0ce21a..f342bb95edbd1143c7952e24f322b41efb252360 100644 --- a/src/kernel_internals/typing/allocates.ml +++ b/src/kernel_internals/typing/allocates.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/typing/allocates.mli b/src/kernel_internals/typing/allocates.mli index 7fcfa6667f6ea24f3fd5eaa4cace97fa7c56cb32..acf332961aaac7034633764b210e0038b0c9ba53 100644 --- a/src/kernel_internals/typing/allocates.mli +++ b/src/kernel_internals/typing/allocates.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/typing/asm_contracts.ml b/src/kernel_internals/typing/asm_contracts.ml index c30fa220e018a2c683423810a499ec5913d0ef71..dab157a0d5ad0358a5bf5f53c151f0787936cdfa 100644 --- a/src/kernel_internals/typing/asm_contracts.ml +++ b/src/kernel_internals/typing/asm_contracts.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -133,11 +133,15 @@ object(self) Annotations.add_code_annot emitter ~kf stmt ca; if not mem_clobbered && Kernel.AsmContractsAutoValidate.get() then begin - let ips = Property.ip_of_code_annot kf stmt ca in + let active = [] in + let ip_assigns = + Property.ip_assigns_of_behavior kf (Kstmt stmt) ~active bhv in + let ip_from = + Property.ip_from_of_behavior kf (Kstmt stmt) ~active bhv in List.iter Property_status.( fun x -> emit emitter ~hyps:[] x True) - ips + (Extlib.list_of_opt ip_assigns @ ip_from) end | [ { annot_content = AStmtSpec ([], spec) } ] -> (* Already existing contracts. Just add assigns clause for diff --git a/src/kernel_internals/typing/asm_contracts.mli b/src/kernel_internals/typing/asm_contracts.mli index e9265f25d86ed6b41773e9d9e9def309f2d96d06..770b513b3bcf47dcaaba24ba7593d8567a52d49a 100644 --- a/src/kernel_internals/typing/asm_contracts.mli +++ b/src/kernel_internals/typing/asm_contracts.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/typing/cabs2cil.ml b/src/kernel_internals/typing/cabs2cil.ml index 4597c8bbeb6c507dc07ee2ea971c7fd5df38cb18..20ea41740e4873b2872cb4779dde6abf854a9ac3 100644 --- a/src/kernel_internals/typing/cabs2cil.ml +++ b/src/kernel_internals/typing/cabs2cil.ml @@ -56,6 +56,9 @@ open Pretty_utils open Cabs open Cabshelper open Cil +let valid_sid = false +(* All statements generated here must have an invalid sid. Use this variable + for the valid_sid label of Cil.mkStmt*. *) open Cil_types open Cil_datatype open Lexing @@ -71,6 +74,10 @@ let frama_c_keep_block = "FRAMA_C_KEEP_BLOCK" let () = Cil_printer.register_shallow_attribute frama_c_keep_block let () = Cil_printer.register_shallow_attribute "fc_stdlib" +let () = Cil_printer.register_shallow_attribute "fc_stdlib_generated" + +let frama_c_destructor = "__fc_destructor" +let () = Cil_printer.register_shallow_attribute frama_c_destructor (** A hook into the code that creates temporary local vars. By default this is the identity function, but you can overwrite it if you need to change the @@ -86,6 +93,14 @@ let typeForInsertedCast: let cabs_exp loc node = { expr_loc = loc; expr_node = node } +let abort_context msg = + let pos = fst (Cil.CurrentLoc.get ()) in + let append fmt = + Format.pp_print_newline fmt (); + Errorloc.pp_context_from_file fmt pos + in + Kernel.abort ~current:true ~append msg + module IgnorePureExpHook = Hook.Build (struct type t = string * Cil_types.exp end) @@ -437,7 +452,7 @@ let eval_aligned_attrparams aps = let warn_invalid_align_attribute aps = Kernel.warning ~current:true ~once:true "ignoring invalid aligned attribute: %a" - Printer.pp_attribute (Attr("aligned", aps)) + Cil_printer.pp_attribute (Attr("aligned", aps)) (* If there is more than one 'aligned' attribute, GCC's behavior is to consider the maximum among them. This function computes this value @@ -604,7 +619,7 @@ let isTransparentUnion (t: typ) : fieldinfo option = if typeHasAttribute "transparent_union" t then begin match comp.cfields with | [] -> - Kernel.abort ~current:true + abort_context "Empty transparent union: %s" (compFullName comp) | f :: _ -> Some f end else @@ -684,14 +699,7 @@ let initGlobals () = Cil_datatype.Varinfo.Hashtbl.clear theFileVars; ;; -let required_builtins = [ "Frama_C_bzero"; "Frama_C_copy_block" ] - let cabsPushGlobal (g: global) = - (match g with - | GFun({ svar = v},_) | GFunDecl(_,v,_) - when List.mem v.vname required_builtins -> - ignore (Cil.Frama_c_builtins.memo (fun _ -> v) v.vname) - | _ -> ()); pushGlobal g ~types:theFileTypes ~variables:theFile; (match g with | GVar (vi, _, _) | GVarDecl (vi, _) @@ -1019,7 +1027,7 @@ let alphaConvertVarAndAddToEnv (addtoenv: bool) (vi: varinfo) : varinfo = (* And continue using the last name *) vi with Not_found -> - Kernel.abort ~current:true + abort_context "It seems that we would need to rename global %s (to %s) \ because of previous occurrence at %a" vi.vname newname Cil_printer.pp_location oldloc; @@ -1080,8 +1088,7 @@ let newTempVar descr (descrpure:bool) typ = (* physical equality used on purpose here *) if !currentFunctionFDEC == dummy_function then Kernel.fatal ~current:true "newTempVar called outside a function" ; - (* ignore (E.log "stripConstLocalType(%a) for temporary\n" d_type typ); *) - let t' = (!typeForInsertedVar) (Cil.stripConstLocalType typ) in + let t' = (!typeForInsertedVar) typ in let name = get_temp_name () in let vi = makeVarinfo ~temp:true false false name t' in vi.vdescr <- Some descr; @@ -1270,7 +1277,7 @@ let rec castTo ?(fromsource=false) Cil.mkCastT ~force:true ~e ~oldt:ot ~newt:nt' else e) in let error s = - (if fromsource then Kernel.abort else Kernel.fatal) ~current:true s + if fromsource then abort_context s else Kernel.fatal ~current:true s in (* [BM] uncomment the following line to enable attributes static typing ignore (check_strict_attributes true ot nt && check_strict_attributes false nt ot);*) @@ -1480,6 +1487,14 @@ struct (Pretty_utils.pp_list ~sep:";@\n" d_stmt_chunk) (List.rev c.stmts) + let loc_of_chunk c = + match c.stmts with + | [] -> + (match c.locals with + | [] -> Cabshelper.cabslu + | v :: _ -> v.vdecl) + | (s,_,_,_,_) :: _ -> Cil_datatype.Stmt.loc s + let empty = { stmts = []; cases = []; locals = []; unspecified_order = false; } @@ -1501,7 +1516,7 @@ struct let i2c (i,m,w,r) = let c = match i.skind with - | Instr(Call _) -> [ref i] + | Instr(Call _ | Local_init(_, ConsInit _, _)) -> [ref i] | _ -> [] in { empty with stmts = [i,m,w,r,c]; } @@ -1566,7 +1581,13 @@ struct try ref (H.find labels s) with Not_found when List.mem s !label_current -> - let my_ref = ref (mkEmptyStmt ~loc:(cabslu "_find_label") ()) in + let my_ref = + ref + (mkEmptyStmt + (* just a placeholder that will never be used. no need to + check for ghost status here. *) + ~ghost:false ~valid_sid ~loc:(cabslu "_find_label") ()) + in addGoto s my_ref; my_ref end @@ -1581,37 +1602,39 @@ struct directly, unless collapse_block is set to false. *) let c2block ~ghost ?(collapse_block=true) (c: chunk) : block = - if c.unspecified_order then - { battrs = []; - blocals = c.locals; - bstmts = - [mkStmt ~ghost (UnspecifiedSequence (List.rev c.stmts))]; } - else + if c.unspecified_order then begin + let b = + Cil.mkBlock + [mkStmt ~ghost ~valid_sid (UnspecifiedSequence (List.rev c.stmts))] + in + b.blocals <- c.locals; + b + end else match c.stmts with | [{ skind = Block b } as s,_,_,_,_] when collapse_block && s.labels = [] -> b.blocals <- c.locals @ b.blocals; b | stmts -> - (* block has no locals by itself. We must add them now *) - { blocals = c.locals; - battrs = []; - bstmts = List.rev_map (fun (s,_,_,_,_) -> s) stmts; - } + let stmts = List.rev_map (fun (s,_,_,_,_) -> s) stmts in + let b = Cil.mkBlock stmts in + b.blocals <- c.locals; + b (* converts a chunk into a statement. *) let c2stmt ~ghost c = let kind = if c.unspecified_order then let kind = UnspecifiedSequence (List.rev c.stmts) in - if c.locals <> [] then - Block { battrs = []; blocals = c.locals; - bstmts = [mkStmt ~ghost kind] } - else kind + if c.locals <> [] then begin + let b = Cil.mkBlock [mkStmt ~ghost ~valid_sid kind] in + b.blocals <- c.locals; + Block b + end else kind else let block = c2block ~ghost c in Block block in - mkStmt ~ghost kind + mkStmt ~ghost ~valid_sid kind let merge_effects (m1,w1,r1,c1) (m2,w2,r2,c2) = let add_uniq l x = @@ -1643,7 +1666,7 @@ struct * after you call this *) let (+++) (c: chunk) (i,m,w,r) = let call = match i.skind with - | Instr (Call _) -> [ref i] + | Instr (Call _ | Local_init (_, ConsInit _, _)) -> [ref i] | _ -> [] in {c with stmts = (i,m,w,r,call) :: c.stmts; } @@ -1724,7 +1747,7 @@ struct (* return can be ghost but only in ghost functions *) let returnChunk ~ghost e (l: location) : chunk = - { stmts = [ mkStmt ~ghost (Return(e, l)),[],[],[],[] ]; + { stmts = [ mkStmt ~ghost ~valid_sid (Return(e, l)),[],[],[],[] ]; cases = []; locals = []; unspecified_order = false; @@ -1735,7 +1758,7 @@ struct let effects_e = get_chunk_effects e in let (m,r,w,c) = merge_effects effects_t effects_e in let stmt = - mkStmt ~ghost (If(be, c2block ~ghost t, c2block ~ghost e, l)) + mkStmt ~ghost ~valid_sid (If(be, c2block ~ghost t, c2block ~ghost e, l)) in { stmts = [ stmt ,m,r,w,c ]; cases = t.cases @ e.cases; @@ -1780,7 +1803,7 @@ struct * that, I think *) let s' = { s with sid = s.sid} in let c = match s.skind with - | Instr (Call _) -> [ref s'] + | Instr (Call _ | Local_init (_, ConsInit _, _)) -> [ref s'] | Instr _ | TryExcept _ | TryFinally _ | TryCatch _ | Throw _ | UnspecifiedSequence _| Block _| Loop (_, _, _, _, _) | Switch (_, _, _, _)| If (_, _, _, _)| Continue _| Break _ @@ -1800,7 +1823,7 @@ struct let loopChunk ~ghost a (body: chunk) : chunk = (* Make the statement *) let loop = - mkStmt ~ghost + mkStmt ~ghost ~valid_sid (Loop (a,c2block ~ghost body, CurrentLoc.get (), None, None)) in { stmts = [ loop,[],[],[],[] ]; @@ -1811,7 +1834,7 @@ struct (* can be ghost inside a ghost loop *) let breakChunk ~ghost (l: location) : chunk = - { stmts = [ mkStmt ~ghost (Break l),[],[],[],[] ]; + { stmts = [ mkStmt ~ghost ~valid_sid (Break l),[],[],[],[] ]; cases = []; unspecified_order = false; locals = []; @@ -1819,7 +1842,7 @@ struct (* can be ghost inside a ghost loop *) let continueChunk ~ghost (l: location) : chunk = - { stmts = [ mkStmt ~ghost (Continue l),[],[],[],[] ]; + { stmts = [ mkStmt ~ghost ~valid_sid (Continue l),[],[],[],[] ]; cases = []; unspecified_order = false; locals = []; @@ -1831,7 +1854,7 @@ struct (* Get the first statement and add the label to it *) match c.stmts with | [] -> (* Add a statement *) - let n = mkEmptyStmt ~ghost ~loc () in + let n = mkEmptyStmt ~ghost ~valid_sid ~loc () in n, [n,[],[],[],[]] | s -> let (st,_,_,_,_) = Extlib.last s in st,s @@ -1848,7 +1871,7 @@ struct let gotoChunk ~ghost (ln: string) (l: location) : chunk = let gref = ref dummyStmt in addGoto ln gref; - { stmts = [ mkStmt ~ghost (Goto (gref, l)),[],[],[],[] ]; + { stmts = [ mkStmt ~ghost ~valid_sid (Goto (gref, l)),[],[],[],[] ]; cases = []; locals = []; unspecified_order = false; @@ -1913,7 +1936,7 @@ struct body.cases [] in - let switch = mkStmt ~ghost (Switch (e, block, cases, l)) in + let switch = mkStmt ~ghost ~valid_sid (Switch (e, block, cases, l)) in { stmts = [ switch,[],[],[],[] ]; cases = []; locals = []; @@ -1970,6 +1993,7 @@ struct DoChildren method! vstmt s = + let ghost = s.ghost in let change_label_stmt s s' = List.iter (function @@ -1983,7 +2007,7 @@ struct change_label_stmt s s'; ChangeDoChildrenPost(s', fun x -> x) | UnspecifiedSequence [] -> - let s' = mkEmptyStmt ~loc:(cabslu "_useq") () in + let s' = mkEmptyStmt ~ghost ~valid_sid ~loc:(cabslu "_useq") () in change_label_stmt s s'; ChangeTo s'; | UnspecifiedSequence _ -> self#push true s @@ -2024,9 +2048,9 @@ struct let res = visitCilBlock (new cleanUnspecified) (c2block ~ghost c) in H.iter (find_stmt res) labelStmt; resolveGotos (); initLabels (); res - let add_reads loc r c = match r with + let add_reads ~ghost loc r c = match r with | [] -> c - | _ :: _ -> c +++ (mkEmptyStmt ~loc (), [],[], r) + | _ :: _ -> c +++ (mkEmptyStmt ~ghost ~valid_sid ~loc (), [],[], r) end @@ -2061,7 +2085,7 @@ let newLabelName (base: string) = fst (newAlphaName false "label" base) let continueOrLabelChunk ~ghost (l: location) : chunk = match !continues with - | [] -> Kernel.abort ~current:true "continue not in a loop" + | [] -> abort_context "continue not in a loop" | While lr :: _ -> if !doTransformWhile then begin @@ -2084,7 +2108,7 @@ let enter_break_env () = Stack.push () break_env let breakChunk ~ghost l = if Stack.is_empty break_env then - Kernel.abort ~current:true "break outside of a loop or switch"; + abort_context "break outside of a loop or switch"; breakChunk ~ghost l let exit_break_env () = @@ -2252,8 +2276,34 @@ let cabsAddAttributes al0 (al: attributes) : attributes = al al0 +type combineWhat = + CombineFundef of bool + (* The new definition is for a function definition. The old + * is for a prototype. arg is [true] for an old-style declaration *) + | CombineFunarg of bool + (* Comparing a function argument type with an old prototype argument. + arg is [true] for an old-style declaration, which + triggers some ad hoc treatment in GCC mode. *) + | CombineFunret (* Comparing the return of a function with that from an old + * prototype *) + | CombineOther + +(* [combineAttributes what olda a] combines the attributes in [olda] and [a] + according to [what]: + - if [what == CombineFunarg], then override old attributes; + this is used to ensure that attributes from formal argument types in a + function definition are not mixed with attributes from arguments in other + (compatible, but with different qualifiers) declarations; + - else, perform the union of old and new attributes. *) +let combineAttributes what olda a = + match what with + | CombineFunarg _ -> a (* override old attributes with new ones *) + | _ -> cabsAddAttributes olda a (* union of attributes *) + (* BY: nothing cabs here, plus seems to duplicate most of Cil.typeAddAttributes *) -let rec cabsTypeAddAttributes a0 t = +(* see [combineAttributes] above for details about the [what] argument *) +let rec cabsTypeCombineAttributes what a0 t = + let combine = combineAttributes what in begin match a0 with | [] -> @@ -2261,7 +2311,7 @@ let rec cabsTypeAddAttributes a0 t = t | _ -> (* anything else: add a0 to existing attributes *) - let add (a: attributes) = cabsAddAttributes a0 a in + let add (a: attributes) = combine a0 a in match t with | TVoid a -> TVoid (add a) | TInt (ik, a) -> @@ -2315,7 +2365,7 @@ let rec cabsTypeAddAttributes a0 t = (ik, []) a0 in - TInt (ik', cabsAddAttributes a0' a) + TInt (ik', combine a0' a) | TFloat (fk, a) -> TFloat (fk, add a) | TEnum (enum, a) -> TEnum (enum, add a) @@ -2326,38 +2376,29 @@ let rec cabsTypeAddAttributes a0 t = | TBuiltin_va_list a -> TBuiltin_va_list (add a) | TArray (t, l, s, a) -> let att_elt, att_typ = Cil.splitArrayAttributes a0 in - TArray (cabsArrayPushAttributes att_elt t, l, s, - cabsAddAttributes att_typ a) + TArray (cabsArrayPushAttributes what att_elt t, l, s, + combineAttributes what att_typ a) end -and cabsArrayPushAttributes al = function +and cabsArrayPushAttributes what al = function | TArray (bt, l, s, a) -> - TArray (cabsArrayPushAttributes al bt, l, s, a) - | t -> cabsTypeAddAttributes al t + TArray (cabsArrayPushAttributes what al bt, l, s, a) + | t -> cabsTypeCombineAttributes what al t +let cabsTypeAddAttributes = + cabsTypeCombineAttributes CombineOther -(* Do types *) -(* Combine the types. Raises the Failure exception with an error message. - * isdef says whether the new type is for a definition *) -type combineWhat = - CombineFundef of bool - (* The new definition is for a function definition. The old - * is for a prototype. arg is [true] for an old-style declaration *) - | CombineFunarg of bool - (* Comparing a function argument type with an old prototype argument. - arg is [true] for an old-style declaration, which - triggers some ad hoc treatment in GCC mode. *) - | CombineFunret (* Comparing the return of a function with that from an old - * prototype *) - | CombineOther - -(* We sometimes want to succeed in combining two structure types that are - * identical except for the names of the structs. We keep a list of types - * that are known to be equal *) -let isomorphicStructs : (string * string, bool) H.t = H.create 15 +exception Cannot_combine of string +(* Do types *) +(* Combine the types. Raises the Cannot_combine exception with an error message. + [what] is used to recursively deal with function return types and function + arguments in special ways. + Note: we cannot force the qualifiers of oldt and t to be the same here, + because in some cases (e.g. string literals and char pointers) it is + allowed to have differences, while in others we want to be more strict. *) let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = match oldt, t with - | TVoid olda, TVoid a -> TVoid (cabsAddAttributes olda a) + | TVoid olda, TVoid a -> TVoid (combineAttributes what olda a) | TInt (oldik, olda), TInt (ik, a) -> let combineIK oldk k = if oldk = k then oldk else @@ -2369,12 +2410,12 @@ let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = * type than a prototype that says "int" *) k | _ -> - raise (Failure + raise (Cannot_combine (Format.asprintf "different integer types:@ '%a' and '%a'" Cil_printer.pp_ikind oldk Cil_printer.pp_ikind k))) in - TInt (combineIK oldik ik, cabsAddAttributes olda a) + TInt (combineIK oldik ik, combineAttributes what olda a) | TFloat (oldfk, olda), TFloat (fk, a) -> let combineFK oldk k = if oldk = k then oldk else @@ -2385,75 +2426,28 @@ let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = * type than a prototype that says "double" *) k | _ -> - raise (Failure "different floating point types")) + raise (Cannot_combine "different floating point types")) in - TFloat (combineFK oldfk fk, cabsAddAttributes olda a) + TFloat (combineFK oldfk fk, combineAttributes what olda a) | TEnum (_, olda), TEnum (ei, a) -> - TEnum (ei, cabsAddAttributes olda a) + TEnum (ei, combineAttributes what olda a) (* Strange one. But seems to be handled by GCC *) | TEnum (oldei, olda) , TInt(IInt, a) -> TEnum(oldei, - cabsAddAttributes olda a) + combineAttributes what olda a) (* Strange one. But seems to be handled by GCC *) - | TInt(IInt, olda), TEnum (ei, a) -> TEnum(ei, cabsAddAttributes olda a) + | TInt(IInt, olda), TEnum (ei, a) -> TEnum(ei, combineAttributes what olda a) | TComp (oldci, _, olda) , TComp (ci, _, a) -> if oldci.cstruct <> ci.cstruct then - raise (Failure "different struct/union types"); - let comb_a = cabsAddAttributes olda a in + raise (Cannot_combine "different struct/union types"); + let comb_a = combineAttributes what olda a in if oldci.cname = ci.cname then TComp (oldci, empty_size_cache (), comb_a) else - (* Now maybe they are actually the same *) - if H.mem isomorphicStructs (oldci.cname, ci.cname) then - (* We know they are the same *) - TComp (oldci, empty_size_cache (), comb_a) - else begin - (* If one has 0 fields (undefined) while the other has some fields - * we accept it *) - let oldci_nrfields = List.length oldci.cfields in - let ci_nrfields = List.length ci.cfields in - if oldci_nrfields = 0 then - TComp (ci, empty_size_cache (), comb_a) - else if ci_nrfields = 0 then - TComp (oldci, empty_size_cache (), comb_a) - else begin - (* Make sure that at least they have the same number of fields *) - if oldci_nrfields <> ci_nrfields then begin -(* - ignore (E.log "different number of fields: %s had %d and %s had %d\n" - oldci.cname oldci_nrfields - ci.cname ci_nrfields); -*) - raise (Failure "different structs(number of fields)"); - end; - (* Assume they are the same *) - H.add isomorphicStructs (oldci.cname, ci.cname) true; - H.add isomorphicStructs (ci.cname, oldci.cname) true; - (* Check that the fields are isomorphic and watch for Failure *) - (try - List.iter2 (fun oldf f -> - if oldf.fbitfield <> f.fbitfield then - raise (Failure "different structs(bitfield info)"); - if oldf.fattr <> f.fattr then - raise (Failure "different structs(field attributes)"); - (* Make sure the types are compatible *) - ignore (combineTypes CombineOther oldf.ftype f.ftype); - ) oldci.cfields ci.cfields - with Failure _ as e -> begin - (* Our assumption was wrong. Forget the isomorphism *) - Kernel.debug ~level:2 - "Failed in our assumption that %s and %s are isomorphic" - oldci.cname ci.cname ; - H.remove isomorphicStructs (oldci.cname, ci.cname); - H.remove isomorphicStructs (ci.cname, oldci.cname); - raise e - end); - (* We get here if we succeeded *) - TComp (oldci, empty_size_cache (), comb_a) - end - end + raise (Cannot_combine (Format.sprintf "%ss with different tags" + (if oldci.cstruct then "struct" else "union"))) | TArray (oldbt, oldsz, _, olda), TArray (bt, sz, _, a) -> let newbt = combineTypes CombineOther oldbt bt in @@ -2479,13 +2473,13 @@ let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = Cil_printer.pp_exp oldsz' Cil_printer.pp_exp sz' ; oldsz end else - raise (Failure "different array lengths") + raise (Cannot_combine "different array lengths") in - TArray (newbt, newsz, empty_size_cache (), cabsAddAttributes olda a) + TArray (newbt, newsz, empty_size_cache (), combineAttributes what olda a) | TPtr (oldbt, olda), TPtr (bt, a) -> - TPtr (combineTypes CombineOther oldbt bt, cabsAddAttributes olda a) + TPtr (combineTypes CombineOther oldbt bt, combineAttributes what olda a) | TFun (oldrt, oldargs, oldva, olda), TFun (rt, args, va, a) -> let rt_what = @@ -2495,7 +2489,7 @@ let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = in let newrt = combineTypes rt_what oldrt rt in if oldva != va then - raise (Failure "different vararg specifiers"); + raise (Cannot_combine "different vararg specifiers"); (* If one does not have arguments, believe the one with the * arguments *) let newargs, olda' = @@ -2504,7 +2498,7 @@ let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = let oldargslist = argsToList oldargs in let argslist = argsToList args in if List.length oldargslist <> List.length argslist then - raise (Failure "different number of arguments") + raise (Cannot_combine "different number of arguments") else begin (* Construct a mapping between old and new argument names. *) let map = H.create 5 in @@ -2544,52 +2538,72 @@ let rec combineTypes (what: combineWhat) (oldt: typ) (t: typ) : typ = Cil.dropAttribute "missingproto" a else a in - TFun (newrt, newargs, oldva, cabsAddAttributes olda a) + TFun (newrt, newargs, oldva, combineAttributes what olda a) | TNamed (oldt, olda), TNamed (t, a) when oldt.tname = t.tname -> - TNamed (oldt, cabsAddAttributes olda a) + TNamed (oldt, combineAttributes what olda a) | TBuiltin_va_list olda, TBuiltin_va_list a -> - TBuiltin_va_list (cabsAddAttributes olda a) + TBuiltin_va_list (combineAttributes what olda a) (* Unroll first the new type *) | _, TNamed (t, a) -> let res = combineTypes what oldt t.ttype in - cabsTypeAddAttributes a res + cabsTypeCombineAttributes what a res (* And unroll the old type as well if necessary *) | TNamed (oldt, a), _ -> let res = combineTypes what oldt.ttype t in - cabsTypeAddAttributes a res + cabsTypeCombineAttributes what a res - | _ -> raise (Failure + | _ -> raise (Cannot_combine (Format.asprintf "different type constructors:@ %a and %a" Cil_printer.pp_typ oldt Cil_printer.pp_typ t)) -let cleanup_isomorphicStructs () = H.clear isomorphicStructs - -let same_qualifiers t1 t2 = - let attrs1 = Cil.filter_qualifier_attributes (Cil.typeAttrs t1) in - let attrs2 = Cil.filter_qualifier_attributes (Cil.typeAttrs t2) in - attrs1 = attrs2 +let get_qualifiers t = Cil.filter_qualifier_attributes (Cil.typeAttrs t) + +let equal_qualifiers a1 a2 = + Cil_datatype.Attributes.equal + (Cil.filter_qualifier_attributes a1) (Cil.filter_qualifier_attributes a2) + +(* precondition: t1 and t2 must be "compatible" as per combineTypes, i.e. + you must have called [combineTypes t1 t2] before calling this function. + When [relaxed] is true, qualifier differences are ignored; this is + an internal parameter used during recursive calls. + The qualifier compatibility algorithm is: + - by default, type qualifiers are ignored (e.g. for basic types); + - when entering a pointer type, stop ignoring type qualifiers; + - when entering a function type, resume ignoring type qualifiers. *) +let rec have_compatible_qualifiers_deep ?(relaxed=false) t1 t2 = + match unrollType t1, unrollType t2 with + | TFun (tres1, Some args1, _, _), TFun (tres2, Some args2, _, _) -> + have_compatible_qualifiers_deep ~relaxed:true tres1 tres2 && + List.for_all2 (fun (_, t1', a1) (_, t2', a2) -> + have_compatible_qualifiers_deep ~relaxed:true t1' t2' && + equal_qualifiers a1 a2) + args1 args2 + | TPtr (t1', a1), TPtr (t2', a2) + | TArray (t1', _, _, a1), TArray (t2', _, _, a2) -> + have_compatible_qualifiers_deep ~relaxed:false t1' t2' && + (relaxed || equal_qualifiers a1 a2) + | _, _ -> relaxed || equal_qualifiers (Cil.typeAttrs t1) (Cil.typeAttrs t2) let compatibleTypes t1 t2 = try let r = combineTypes CombineOther t1 t2 in (* C99, 6.7.3 §9: "... to be compatible, both shall have the identically qualified version of a compatible type;" *) - if not (same_qualifiers t1 t2) then raise (Failure "different qualifiers"); + if not (have_compatible_qualifiers_deep t1 t2) then + raise (Cannot_combine "different qualifiers"); (* Note: different non-qualifier attributes will be silently dropped. *) - cleanup_isomorphicStructs (); r - with Failure _ as e -> - cleanup_isomorphicStructs (); + with Cannot_combine _ as e -> raise e let areCompatibleTypes t1 t2 = try ignore (compatibleTypes t1 t2); true - with Failure _ -> false + with Cannot_combine _ -> false (* Create and cache varinfo's for globals. Starts with a varinfo but if the * global has been declared already it might come back with another varinfo. @@ -2638,10 +2652,20 @@ let makeGlobalVarinfo (isadef: bool) (vi: varinfo) : varinfo * bool = * required to compile the Linux kernel properly. *) if hasAttribute "section" vi.vattr then oldvi.vattr <- dropAttribute "section" oldvi.vattr; - (* Union the attributes *) - oldvi.vattr <- cabsAddAttributes oldvi.vattr vi.vattr; + (* Before combining attributes, we need to check compatibility between + qualifiers *) begin try + let oldquals = get_qualifiers oldvi.vtype in + let quals = get_qualifiers vi.vtype in + if not (Cil_datatype.Attributes.equal oldquals quals) then + raise (Cannot_combine + (Format.asprintf + "different qualifiers:@ '%a' and '%a'" + Cil_printer.pp_attributes oldquals + Cil_printer.pp_attributes quals)); + (* Union the attributes *) + oldvi.vattr <- cabsAddAttributes oldvi.vattr vi.vattr; let what = if isadef then CombineFundef (hasAttribute "FC_OLDSTYLEPROTO" vi.vattr) @@ -2649,9 +2673,18 @@ let makeGlobalVarinfo (isadef: bool) (vi: varinfo) : varinfo * bool = in let mytype = combineTypes what oldvi.vtype vi.vtype in if not (Cil_datatype.Typ.equal oldvi.vtype vi.vtype) - then DifferentDeclHook.apply (oldvi,vi); + then begin + DifferentDeclHook.apply (oldvi,vi); + (* note: combineTypes is (purposedly) not very strict, so we + use compatibleTypes here to perform more strict checks and + raise Cannot_combine if necessary. However, due to old-style + prototypes in GCC machdeps, we must support eccentric cases, + for which we perform no such additional verification. *) + if not (hasAttribute "FC_OLDSTYLEPROTO" vi.vattr) then + ignore (compatibleTypes oldvi.vtype vi.vtype) + end; Cil.update_var_type oldvi mytype; - with Failure reason -> + with Cannot_combine reason -> Kernel.debug ~dkey:category_global "old type = %a\nnew type = %a\n" Cil_printer.pp_typ oldvi.vtype Cil_printer.pp_typ vi.vtype ; @@ -2682,8 +2715,10 @@ let makeGlobalVarinfo (isadef: bool) (vi: varinfo) : varinfo * bool = Kernel.debug ~dkey:category_global "replacing formal %s with %s" old.vname name; old.vname <- name; - Cil.update_var_type old typ; - old.vattr <- attr; + if not oldvi.vdefined || isadef then begin + Cil.update_var_type old typ; + old.vattr <- attr; + end; (match old.vlogic_var_assoc with | None -> () | Some old_lv -> old_lv.lv_name <- name) @@ -2692,7 +2727,7 @@ let makeGlobalVarinfo (isadef: bool) (vi: varinfo) : varinfo * bool = formals; with | Invalid_argument _ -> - Kernel.abort "Inconsistent formals" ; + abort_context "Inconsistent formals" ; | Not_found -> Cil.setFormalsDecl oldvi vi.vtype) | _ -> () @@ -2723,9 +2758,8 @@ let makeGlobalVarinfo (isadef: bool) (vi: varinfo) : varinfo * bool = NewGlobalHook.apply res; res - (* Register a builtin function *) -let setupBuiltin name (resTyp, argTypes, isva) = +let setupBuiltin ?(force_keep=false) name (resTyp, argTypes, isva) = let args = Some (List.map (fun at -> ("", at, [])) argTypes) in let typ = TFun(resTyp, args, isva, []) in let v = makeGlobalVar name typ in @@ -2733,23 +2767,20 @@ let setupBuiltin name (resTyp, argTypes, isva) = (* Add it to the file as well *) cabsPushGlobal (GFunDecl (empty_funspec (), v, Cil.builtinLoc)); Cil.setFormalsDecl v v.vtype; + if force_keep then + v.vattr <- Cil.addAttribute (Attr ("FC_BUILTIN",[])) v.vattr; v ;; -(** ALLOCA ***) -let allocaFun () = - if not (Cil.gccMode ()) then begin - try - let alloca, _ = lookupGlobalVar "alloca" in - alloca - with Not_found -> - setupBuiltin "alloca" (voidPtrType, [theMachine.typeOfSizeOf], false) - end - else - (* Use __builtin_alloca where possible, because this can be used - even when gcc is invoked with -fno-builtin *) - let alloca, _ = lookupGlobalVar "__builtin_alloca" in - alloca +let memoBuiltin ?force_keep name proto = + try fst (lookupGlobalVar name) + with Not_found -> setupBuiltin ?force_keep name proto + +let vla_alloc_fun () = + memoBuiltin "__fc_vla_alloc" (voidPtrType, [theMachine.typeOfSizeOf], false) + +let vla_free_fun () = + memoBuiltin ~force_keep:true "__fc_vla_free" (voidType, [voidPtrType], false) let conditionalConversion (t2: typ) (t3: typ) : typ = let tresult = (* ISO 6.5.15 *) @@ -2769,7 +2800,7 @@ let conditionalConversion (t2: typ) (t3: typ) : typ = * a global *) | (TPtr _) as t2', (TPtr _ as t3') -> begin try combineTypes CombineOther t2' t3' - with Failure msg -> begin + with Cannot_combine msg -> begin Kernel.warning ~current:true "A.QUESTION: %a does not match %a (%s)" Cil_printer.pp_typ (unrollType t2) Cil_printer.pp_typ (unrollType t3) msg; t2 (* Just pick one *) @@ -2792,14 +2823,14 @@ let logicConditionalConversion t1 t2 = type preInit = | NoInitPre - | SinglePre of exp + | SinglePre of exp * Cil_datatype.Lval.Set.t (* lval reads by the expression*) | CompoundPre of int ref (* the maximum used index *) * preInit array ref (* an array with initializers *) (* internal pretty-printing function for debugging purposes *) let rec _pp_preInit fmt = function | NoInitPre -> Format.fprintf fmt "NoInitPre" - | SinglePre e -> Format.fprintf fmt "SinglePre(%a)" Cil_printer.pp_exp e + | SinglePre (e,_) -> Format.fprintf fmt "SinglePre(%a)" Cil_printer.pp_exp e | CompoundPre (int_ref, preInit_a_ref) -> Format.fprintf fmt "CompoundPre(%d,@[%a@])" !int_ref (Pretty_utils.pp_array ~sep:",@ " @@ -2810,7 +2841,7 @@ let rec _pp_preInit fmt = function let empty_preinit() = if Cil.gccMode () || Cil.msvcMode () then CompoundPre (ref (-1), ref [| |]) - else Kernel.abort ~current:true "empty initializers only allowed for GCC/MSVC" + else abort_context "empty initializers only allowed for GCC/MSVC" (* Set an initializer *) let rec setOneInit this o preinit = @@ -2836,7 +2867,7 @@ let rec setOneInit this o preinit = | _ :: restf -> loop (idx + 1) restf in loop 0 f.fcomp.cfields, off - | _ -> Kernel.abort ~current:true "setOneInit: non-constant index" + | _ -> abort_context "setOneInit: non-constant index" in let pMaxIdx, pArray = match this with @@ -2867,10 +2898,15 @@ let rec setOneInit this o preinit = (* collect a CIL initializer, given the original syntactic initializer * 'preInit'; this returns a type too, since initialization of an array * with unspecified size actually changes the array's type - * (ANSI C, 6.7.8, para 22) *) + * (ANSI C, 6.7.8, para 22). + * Finally, we return the set of lvals that are read for the evaluation of + * the initializer (for unspecified sequences) + *) let rec collectInitializer + reads (* lval already read by the rest of the initializer. *) (this: preInit) - (thistype: typ) ~(parenttype: typ) : (init * typ) = + (thistype: typ) ~(parenttype: typ) : + (init * typ * Cil_datatype.Lval.Set.t) = (* parenttype is used to identify a tentative flexible array member initialization *) let dkey = category_initializer in @@ -2878,13 +2914,13 @@ let rec collectInitializer if this = NoInitPre then begin Kernel.debug ~dkey "zero-initializing object of type %a" Cil_printer.pp_typ thistype; - (makeZeroInit ~loc thistype), thistype + (makeZeroInit ~loc thistype), thistype, reads end else match unrollType thistype, this with - | _ , SinglePre e -> + | _ , SinglePre (e, r) -> Kernel.debug ~dkey "Initializing object of type %a to %a" Cil_printer.pp_typ thistype Cil_printer.pp_exp e; - SingleInit e, thistype + SingleInit e, thistype, Cil_datatype.Lval.Set.union r reads | TArray (bt, leno, _, at), CompoundPre (pMaxIdx, pArray) -> Kernel.debug ~dkey "Initialization of an array object of type %a with index max %d" @@ -2906,7 +2942,7 @@ let rec collectInitializer (!pMaxIdx + 1), true in if !pMaxIdx >= len then - Kernel.abort ~current:true + abort_context "collectInitializer: too many initializers(%d >= %d)" (!pMaxIdx+1) len; (* @@ -2932,22 +2968,25 @@ let rec collectInitializer collect ((Index(integer ~loc idx,NoOffset), thisi) :: acc) (idx - 1) in *) - let collect_one_init v (idx,init,typ,len_used) = + let collect_one_init v (idx,init,typ,reads,len_used) = match v with - | NoInitPre -> (idx-1,init,typ,len_used) - | _ -> - let (vinit,typ') = collectInitializer v typ ~parenttype:typ in + | NoInitPre -> (idx-1,init,typ,reads,len_used) + | _ -> + let (vinit,typ', reads') = + collectInitializer reads v typ ~parenttype:typ + in let len_used = len_used || not (Cil_datatype.Typ.equal typ typ') in (idx-1, (Index (integer ~loc idx,NoOffset), vinit)::init, typ', + Cil_datatype.Lval.Set.union reads' reads, len_used) in - let (_,init,typ, len_used) = + let (_,init,typ, reads, len_used) = Array.fold_right collect_one_init - !pArray (Array.length !pArray - 1, [], bt, initializer_len_used) + !pArray (Array.length !pArray - 1, [], bt, reads,initializer_len_used) in let newtype = (* detect flexible array member initialization *) @@ -2975,27 +3014,31 @@ let rec collectInitializer (* If the sizes of the initializers have not been used anywhere, we can fold back an eventual typedef. Otherwise, push the attributes to the elements of the array *) - (if len_used then newtype else thistype) + (if len_used then newtype else thistype), + reads | TComp (comp, _, _), CompoundPre (pMaxIdx, pArray) when comp.cstruct -> Kernel.debug ~dkey "Initialization of an object of type %a with at least %d components" Cil_printer.pp_typ thistype !pMaxIdx; - let rec collect (idx: int) = function - [] -> [] + let rec collect (idx: int) reads = function + [] -> [], reads | f :: restf -> if f.fname = missingFieldName then - collect (idx + 1) restf + collect (idx + 1) reads restf else - let thisi = + let thisi, reads' = if idx > !pMaxIdx then - makeZeroInit ~loc f.ftype + makeZeroInit ~loc f.ftype, reads else - collectFieldInitializer !pArray.(idx) f ~parenttype:thistype + collectFieldInitializer + reads !pArray.(idx) f ~parenttype:thistype in - (Field(f, NoOffset), thisi) :: collect (idx + 1) restf + let rest, reads' = collect (idx+1) reads' restf in + (Field(f, NoOffset), thisi) :: rest, reads' in - CompoundInit (thistype, collect 0 comp.cfields), thistype + let init, reads = collect 0 reads comp.cfields in + CompoundInit (thistype, init), thistype, reads | TComp (comp, _, _), CompoundPre (pMaxIdx, pArray) when not comp.cstruct -> Kernel.debug ~dkey @@ -3003,30 +3046,36 @@ let rec collectInitializer Cil_printer.pp_typ thistype !pMaxIdx; (* Find the field to initialize *) let rec findField (idx: int) = function - | [] -> Kernel.abort ~current:true "collectInitializer: union" + | [] -> abort_context "collectInitializer: union" | _ :: rest when idx < !pMaxIdx && !pArray.(idx) = NoInitPre -> findField (idx + 1) rest | f :: _ when idx = !pMaxIdx -> - Field(f, NoOffset), - collectFieldInitializer !pArray.(idx) f ~parenttype:thistype + let init, reads = + collectFieldInitializer reads !pArray.(idx) f ~parenttype:thistype + in + (Field(f, NoOffset), init), reads + | _ -> Kernel.fatal ~current:true "Can initialize only one field for union" in if Cil.msvcMode () && !pMaxIdx != 0 then Kernel.warning ~current:true "On MSVC we can initialize only the first field of a union"; - CompoundInit (thistype, [ findField 0 comp.cfields ]), thistype + let init, reads = findField 0 comp.cfields in + CompoundInit (thistype, [ init ]), thistype, reads | _ -> Kernel.fatal ~current:true "collectInitializer" and collectFieldInitializer + reads (this: preInit) - (f: fieldinfo) ~(parenttype: typ) : init = + (f: fieldinfo) ~(parenttype: typ) = (* collect, and rewrite type *) - let init,newtype = (collectInitializer this f.ftype ~parenttype) in + let init,newtype,reads = + (collectInitializer reads this f.ftype ~parenttype) + in f.ftype <- newtype; - init - + init, reads type stackElem = InArray of offset * typ * int * int ref (* offset of parent, base type, @@ -3116,7 +3165,7 @@ and normalSubobj (so: subobj) : unit = (* Advance to the next subobject. Always apply to a normalized object *) and advanceSubobj (so: subobj) : unit = - if so.eof then Kernel.abort ~current:true "advanceSubobj past end"; + if so.eof then abort_context "advanceSubobj past end"; match so.stack with | [] -> Kernel.debug ~dkey:category_initializer "Setting eof to true"; @@ -3134,7 +3183,7 @@ and advanceSubobj (so: subobj) : unit = "Advancing past .%s" (List.hd nextflds).fname; let flds' = try List.tl nextflds - with Failure _ -> Kernel.abort ~current:true "advanceSubobj" + with Failure _ -> abort_context "advanceSubobj" in so.stack <- InComp(parOff, comp, flds') :: rest; normalSubobj so @@ -3195,7 +3244,7 @@ let find_field_offset cond (fidlist: fieldinfo list) : offset = (try let off = search ci.cfields in Field(fid,off) with Not_found -> search rest (* Continue searching *)) | _ -> - Kernel.abort ~current:true "unnamed field type is not a struct/union" + abort_context "unnamed field type is not a struct/union" end | _ :: rest -> search rest in @@ -3205,8 +3254,7 @@ let findField n comp = try find_field_offset (fun x -> x.fname = n) comp.cfields with Not_found -> - Kernel.abort - ~current:true "Cannot find field %s in type %s" n (Cil.compFullName comp) + abort_context "Cannot find field %s in type %s" n (Cil.compFullName comp) (* Utility ***) let rec replaceLastInList @@ -3257,54 +3305,71 @@ let allow_return_collapse ~tlv ~tf = | _, _ -> false ) +let tcallres f = + match unrollType (typeOf f) with + | TFun (rt, _, _, _) -> rt + | _ -> abort_context "Function call to a non-function" + +let can_collapse vi vi' destlv cast f = + let tf = tcallres f in + not vi.vglob && vi' == vi && + String.length vi.vname >= 3 && + (* Watch out for the possibility that we have an implied cast in + * the call *) + IH.mem callTempVars vi.vid && + Cil_datatype.Typ.equal cast (typeOfLval destlv) && + (* Depending on circumstances, temp var might either have the type of + the destination variable or the returned type of f. We collapse in both + cases. *) + (Cil_datatype.Typ.equal vi.vtype cast || + Cil_datatype.Typ.equal vi.vtype tf) + && + allow_return_collapse ~tf ~tlv:cast + +let collapseCallCast (s1,s2) = match s1.skind, s2.skind with + | Instr (Call(Some(Var vi, NoOffset), f, args, l)), + Instr (Set(destlv, + {enode = CastE (newt, + {enode = Lval(Var vi', NoOffset)})}, _)) -> + if can_collapse vi vi' destlv newt f then begin + s1.skind <- Instr(Call(Some destlv, f, args, l)); + Some [ s1 ] + end + else None + | Instr (Call(Some(Var vi, NoOffset), f, args, l)), + Instr (Set(destlv, {enode = Lval(Var vi', NoOffset)}, _)) -> + if can_collapse vi vi' destlv (typeOfLval destlv) f then begin + s1.skind <- Instr(Call(Some destlv, f, args, l)); + Some [ s1 ] + end else None + | Instr (Call (Some (Var vi, NoOffset), + ({ enode = Lval (Var f, NoOffset)} as ef), args, l)), + Instr ( + Local_init( + destv, + AssignInit( + SingleInit + { enode = CastE(newt, { enode = Lval(Var vi', NoOffset)})}),_))-> + if can_collapse vi vi' (Cil.var destv) newt ef then begin + s1.skind <- Instr(Local_init(destv, ConsInit(f,args,Plain_func),l)); + Some [s1] + end else None + | Instr (Call (Some (Var v1, NoOffset), + ({ enode = Lval (Var f, NoOffset)} as ef), args, l)), + Instr ( + Local_init( + v2, AssignInit(SingleInit { enode = Lval (Var v1', NoOffset) }),_)) -> + if can_collapse v1 v1' (Cil.var v2) v2.vtype ef then begin + s1.skind <- Instr(Local_init(v2, ConsInit(f,args,Plain_func),l)); + Some [ s1 ]; + end else None + | _ -> None let afterConversion ~ghost (c: chunk) : chunk = (* Now scan the statements and find Instr blocks *) (** We want to collapse sequences of the form "tmp = f(); v = tmp". This * will help significantly with the handling of calls to malloc, where it * is important to have the cast at the same place as the call *) - let tcallres f = - match unrollType (typeOf f) with - | TFun (rt, _, _, _) -> rt - | _ -> Kernel.abort ~current:true "Function call to a non-function" - in - let collapseCallCast (s1,s2) = match s1.skind, s2.skind with - | Instr (Call(Some(Var vi, NoOffset), f, args, l)), - Instr (Set(destlv, - {enode = CastE (newt, - {enode = Lval(Var vi', NoOffset)})}, _)) -> - if (not vi.vglob && - vi' == vi && - String.length vi.vname >= 3 && - (* Watch out for the possibility that we have an implied cast in - * the call *) - (let tcallres = tcallres f in - Cil_datatype.Typ.equal tcallres vi.vtype && - Cil_datatype.Typ.equal newt (typeOfLval destlv) && - allow_return_collapse ~tf:tcallres ~tlv:newt) && - IH.mem callTempVars vi.vid) - then begin - s1.skind <- Instr(Call(Some destlv, f, args, l)); - Some [ s1 ] - end - else None - | Instr (Call(Some(Var vi, NoOffset), f, args, l)), - Instr (Set(destlv, {enode = Lval(Var vi', NoOffset)}, _)) -> - if (not vi.vglob && - vi' == vi && - String.length vi.vname >= 3 && - (* Watch out for the possibility that we have an implied cast in - * the call *) - IH.mem callTempVars vi.vid && - Cil_datatype.Typ.equal vi.vtype (typeOfLval destlv) && - allow_return_collapse ~tf:(tcallres f) ~tlv:vi.vtype - ) - then begin - s1.skind <- Instr(Call(Some destlv, f, args, l)); - Some [ s1 ] - end else None - | _ -> None - in let block = c2block ~ghost ~collapse_block:false c in let sl = if Kernel.DoCollapseCallCast.get () then @@ -3501,6 +3566,7 @@ let rec compute_from_root f = function | _ :: rest -> compute_from_root f rest let instrFallsThrough (i : instr) = match i with + | Local_init _ -> true | Set _ -> true | Call (None, {enode = Lval (Var e, NoOffset)}, _, _) -> (* See if this is exit, or if it has the noreturn attribute *) @@ -3600,6 +3666,12 @@ let chunkFallsThrough c = let stmts = List.rev_map get_stmt c.stmts in stmtListFallsThrough stmts +let has_local_init chunk = + List.exists + (fun (s,_,_,_,_) -> + match s.skind with Instr (Local_init _) -> true | _ -> false) + chunk.stmts + let append_chunk_to_annot ~ghost annot_chunk current_chunk = match current_chunk.stmts with | [] -> annot_chunk @@ (current_chunk, ghost) @@ -3614,278 +3686,58 @@ let append_chunk_to_annot ~ghost annot_chunk current_chunk = on the block itself, so as to respect scoping rules for \at in further annotations. *) | _ -> - let b = c2block ~ghost current_chunk in - (* The statement may contain some local variable - declarations coming from userland. We have to shift - them from the inner block, otherwise they will not - be accessible in the next statements. - *) - let locals = b.blocals in - b.blocals <- []; - b.battrs <- - addAttributes [Attr(frama_c_keep_block,[])] b.battrs; - let block = mkStmt ~ghost (Block b) in - let chunk = s2c block in - let chunk = { chunk with cases = current_chunk.cases } in - annot_chunk @@ (List.fold_left - local_var_chunk chunk (List.rev locals), ghost) - -let ensures_init vi off ini = - let cast = false in - let lv = Cil.cvar_to_lvar vi in - let lo = Logic_utils.offset_to_term_offset ~cast off in - let lini = Logic_utils.expr_to_term ~cast ini in - let loc = lini.term_loc in - let base = (TVar lv, lo) in - let lval = Logic_const.term ~loc (TLval base) (Cil.typeOfTermLval base) in - Logic_const.prel ~loc (Req,lval,lini) - -let zero_enum ~loc e = - try - let ei = List.find (fun e -> Cil.isZero e.eival) e.eitems in - Cil.new_exp ~loc (Const (CEnum ei)) - with Not_found -> Cil.kinteger ~loc e.ekind 0 - -(* memset to 0 an entire array. *) -let set_to_zero ~ghost vi off typ = - let loc = vi.vdecl in - let bzero = - try - Cil.Frama_c_builtins.find "Frama_C_bzero" - with Not_found -> - Kernel.fatal - "Incorrect Cil initialization: cannot find Frama_C_bzero builtin" - in - let zone = - Cil.new_exp ~loc - (CastE(TPtr(TInt (IUChar,[]),[]), - Cil.new_exp ~loc (StartOf(Var vi,off)))) - in - let size = - Cil.new_exp ~loc - (CastE (TInt(IULong,[]), - Cil.new_exp ~loc (SizeOf typ))) - in - Cil.mkStmt ~ghost - (Instr - (Call - (None,Cil.evar ~loc bzero, - [zone; size], loc))) - - -(* Initialize the first cell of an array, and call Frama_C_copy_block to - propagate this initialization to the rest of the array. - Array is located at vi.off, of length len, and cells are of type base_type. -*) -let rec zero_init ~ghost vi off len base_typ = - let loc = vi.vdecl in - let copy = - try - Cil.Frama_c_builtins.find "Frama_C_copy_block" - with Not_found -> - Kernel.fatal - "Incorrect Cil initialization: cannot find Frama_C_copy_block builtin" - in - let zone = - Cil.new_exp ~loc - (CastE(TPtr(TInt (IUChar,[]),[]), - Cil.new_exp ~loc (StartOf(Var vi,off)))) - in - let size = - Cil.new_exp ~loc - (CastE (TInt(IULong,[]), - Cil.new_exp ~loc (SizeOf base_typ))) - in - let len = Cil.kinteger ~loc IULong len in - let off = Cil.addOffset (Index (Cil.integer ~loc 0, NoOffset)) off in - let zero_init = zero_init_cell ~ghost vi off base_typ in - zero_init +++ - (Cil.mkStmt ~ghost - (Instr - (Call - (None, Cil.evar ~loc copy, [zone; size; len], loc))), - [],[], [(Var vi,off)]) - -and zero_init_cell ~ghost vi off typ = - let loc = vi.vdecl in - match Cil.unrollType typ with - | TVoid _ -> empty - | TInt(ikind,_) -> - let lv = (Var vi,off) in - s2c - (Cil.mkStmt ~ghost (Instr (Set (lv, (Cil.kinteger ~loc ikind 0),loc)))) - - | TFloat (fkind,_) -> - let lv = (Var vi,off) in - s2c (Cil.mkStmt ~ghost (Instr (Set (lv, (Cil.kfloat ~loc fkind 0.),loc)))) - - | TPtr _ -> - let lv = (Var vi,off) in - let exp = Cil.new_exp ~loc (CastE(typ,Cil.zero ~loc)) in - s2c (Cil.mkStmt ~ghost (Instr (Set (lv, exp,loc)))) - - | TArray(_,None,_,_) -> - Kernel.fatal ~source:(fst loc) - "Trying to zero-initialize variable with incomplete type" - - | TArray(typ,Some e,_,_) -> - let len = - match Cil.constFoldToInt e with - | Some i -> Integer.to_int i - | _ -> - Kernel.fatal ~source:(fst loc) - "Trying to zero-initialize variable with incomplete type" - in - zero_init ~ghost vi off len typ - - | TFun _ -> Kernel.fatal "Trying to zero-initialize a function" - - | TNamed _ -> assert false (* guarded by unrollType *) - - | TComp (ci,_,_) -> - let treat_one_field acc fi = - let off = Cil.addOffset (Field (fi,NoOffset)) off in - acc @@ - (zero_init_cell ~ghost vi off fi.ftype, ghost) - in - if ci.cstruct then - List.fold_left treat_one_field empty ci.cfields - else begin - (* Standard says that zero initializing an union is done by setting - its first field to 0 + if has_local_init current_chunk then begin + (* See if we can collapse the statements of the chunk into a single one. + Otherwise, we can't handle the combination, as putting the Local_init + into a new block would change the scope of the local variable, at + least in the pretty-printed code. Furthermore, the usefulness of + such annotations is dubious at best. *) - match ci.cfields with - | [] -> Kernel.fatal "Union type without fields" - | fst :: _ -> treat_one_field empty fst - end - - | TEnum (ei,_) -> - let lv = (Var vi,off) in - let zero = zero_enum ~loc ei in - s2c (mkStmt ~ghost (Instr (Set (lv,zero,loc)))) - - | TBuiltin_va_list _ -> - Kernel.fatal "Found builtin varargs in zero-initialization" - -let get_implicit_indexes loc vi len known_idx = - let split_itv i itvs = - let i = Integer.to_int i in - let rec aux processed remaining = - match remaining with - | [] -> - Kernel.warning ~current:true - "Unexpected index in array initialization (bad computed length?)"; - List.rev processed - | (low,high) as itv :: tl -> - if i < low then begin - (* should have been captured by earlier interval*) - Kernel.warning ~current:true - "Unexpected index in array initialization \ - (double initialization?)"; - List.rev_append processed remaining - end - else if i > high then aux (itv::processed) tl - else (* split the interval *) - if i = low then - if high = low then (* interval is a singleton, just remove it*) - List.rev_append processed tl - else (* remove first elt of interval *) - List.rev_append processed ((low+1,high)::tl) - else if i = high then (* remove last elt of interval, - which is not singleton *) - List.rev_append processed ((low,high-1)::tl) - else (* split interval in two, non empty intervals. *) - List.rev_append processed ((low,i-1)::(i+1,high)::tl) - in - aux [] itvs - in - let unknown_idx = - Datatype.Integer.Set.fold split_itv known_idx [0,pred len] - in - let one_range acc (low,high) = - Logic_const.pand ~loc - (acc,Logic_const.pand ~loc - (Logic_const.prel ~loc - (Rle, Logic_const.tinteger ~loc low, Logic_const.tvar vi), - Logic_const.prel ~loc - (Rle, Logic_const.tvar vi, Logic_const.tinteger ~loc high))) - in - List.fold_left one_range Logic_const.ptrue unknown_idx - -let ensures_is_zero_offset loc term typ = - let rec aux nb_idx term typ = - let mk_term () = - Logic_const.term ~loc (TLval term) (Cil.typeOfTermLval term) - in - match Cil.unrollType typ with - | TVoid _ -> - Kernel.warning "trying to zero-initialize a void value"; Logic_const.ptrue - | TInt _ -> - Logic_const.prel(Req,mk_term (),Logic_const.tinteger ~loc 0) - | TFloat _ -> - Logic_const.prel (Req,mk_term (),Logic_const.treal ~loc 0.) - | TPtr _ -> - Logic_const.prel (Req, mk_term (), Logic_const.term ~loc Tnull (Ctype typ)) - | TArray (t,e,_,_) -> - let name = "__i" ^ string_of_int nb_idx in - let vi = Cil_const.make_logic_var_quant name Linteger in - let idx = Logic_const.tvar ~loc vi in - let max = - match e with - | None -> Logic_const.ptrue - | Some e -> - Logic_const.prel ~loc - (Rlt, idx, Logic_utils.expr_to_term ~cast:false e) - in - let pre = - Logic_const.pand ~loc - (Logic_const.prel ~loc (Rle, Logic_const.tinteger ~loc 0, idx),max) - in - let subterm = - Logic_const.addTermOffsetLval (TIndex (idx,TNoOffset)) term - in - let cond = aux (nb_idx + 1) subterm t in - Logic_const.pforall ~loc ([vi], Logic_const.pimplies ~loc (pre, cond)) - | TFun _ -> Kernel.fatal "Trying to zero-initialize a function" - | TNamed _ -> assert false (* protected by unrollType *) - | TComp (c,_,_) -> - let treat_one_field acc fi = - let subterm = - Logic_const.addTermOffsetLval (TField (fi,TNoOffset)) term - in - let cond = aux nb_idx subterm fi.ftype in - Logic_const.pand ~loc (acc,cond) + let res = + match current_chunk.stmts with + | [(s1, m1, w1, r1, c1); (s2, m2, w2, r2, c2)] -> + Extlib.swap + Extlib.opt_bind + (collapseCallCast (s2,s1)) (* the chunk list is reversed.*) + (function + | [ s1' ] -> Some (s1', m1 @ m2, w1 @ w2, r1 @ r2, c1 @ c2) + | _ -> None (* should not happen. *)) + | _ -> None in - if c.cstruct then - List.fold_left treat_one_field Logic_const.ptrue c.cfields - else - (match c.cfields with - | [] -> Kernel.fatal "zero-initialize a union with no members" - | f :: _ -> treat_one_field Logic_const.ptrue f) - | TEnum (e,_) -> - let zero = Logic_utils.expr_to_term ~cast:false (zero_enum ~loc e) in - Logic_const.prel ~loc (Req,mk_term (),zero) - | TBuiltin_va_list _ -> - Kernel.fatal "Trying to zero-initialize a vararg list" - in - aux 0 term typ - -(* Make a contract for a block that performs partial initialization of a local, - relying on bzero for implicit zero-initialization. -*) -let make_implicit_ensures vi off base_typ len known_idx = - let loc = vi.vdecl in - let i = Cil_const.make_logic_var_quant "__i" Linteger in - let pre = get_implicit_indexes loc i len known_idx in - let lv = Cil.cvar_to_lvar vi in - let lo = Logic_utils.offset_to_term_offset ~cast:false off in - let base = (TVar lv, lo) in - let term = - Logic_const.addTermOffsetLval (TIndex (Logic_const.tvar i, TNoOffset)) base - in - let res = ensures_is_zero_offset loc term base_typ in - let cond = Logic_const.pimplies ~loc (pre, res) in - Logic_const.pforall ~loc ([i],cond) + match res with + | Some s -> annot_chunk @@ ({current_chunk with stmts = [s]}, ghost) + | None -> + if Kernel.ContinueOnAnnotError.get() then begin + Kernel.warning + "Statement contract and ACSL pragmas over a local definition \ + are not implemented. Ignoring annotation"; + current_chunk + end else begin + Format.eprintf "Chunk is:@\n%a@." d_chunk current_chunk; + (* more accurate context if possible *) + if not (isEmpty annot_chunk) then + CurrentLoc.set (loc_of_chunk annot_chunk); + abort_context + "Statement contract and ACSL pragmas over a local definition \ + are not implemented." + end + end else begin + let b = c2block ~ghost current_chunk in + (* The statement may contain some local variable + declarations (but no definitions) coming from userland. + We have to shift them from the inner block, otherwise they will not + be accessible in the next statements. + *) + let locals = b.blocals in + b.blocals <- []; + b.battrs <- + addAttributes [Attr(frama_c_keep_block,[])] b.battrs; + let block = mkStmt ~ghost ~valid_sid (Block b) in + let chunk = s2c block in + let chunk = { chunk with cases = current_chunk.cases } in + annot_chunk @@ (List.fold_left + local_var_chunk chunk (List.rev locals), ghost) + end let default_argument_promotion idx exp = let name = "x_" ^ string_of_int idx in @@ -3904,9 +3756,8 @@ let default_argument_promotion idx exp = | (TFun _) as t -> TPtr(t,[]) | TComp(ci,_,_) -> TComp(ci,{ scache = Not_Computed },[]) | TEnum(ei,_) -> TEnum(ei,[]) - | TBuiltin_va_list _ -> - Kernel.abort ~current:true - "implicit prototype cannot have variadic arguments" + | TBuiltin_va_list _ -> + abort_context "implicit prototype cannot have variadic arguments" | TNamed _ -> assert false (* unrollType *) in (* if we make a promotion, take it explicitly @@ -4021,6 +3872,33 @@ let checkTypedefSize name typ = Not_found -> () end +(* Checks for invalid 'restrict' qualifiers, + and reports [Kernel.error] if they are found. *) +let rec checkRestrictQualifierDeep t = + if typeHasQualifier "restrict" t then + match unrollType t with + | TArray (bt, _, _, _) | TPtr (bt, _) -> + if isFunctionType bt then + Kernel.error ~once:true ~current:true + "function pointer type does not allow 'restrict' qualifier" + else + checkRestrictQualifierDeep bt + | _ -> Kernel.error ~once:true ~current:true + "invalid usage of 'restrict' qualifier" + else + match unrollType t with + | TArray (bt, _, _, _) | TPtr (bt, _) -> + checkRestrictQualifierDeep bt + | TFun (rt, args, _, _) -> + checkRestrictQualifierDeep rt; + begin + match args with + | None -> () + | Some args -> + List.iter (fun (_, t, _) -> checkRestrictQualifierDeep t) args + end + | _ -> () + let rec doSpecList ghost (suggestedAnonName: string) (* This string will be part of * the names for anonymous @@ -4066,8 +3944,7 @@ let rec doSpecList ghost (suggestedAnonName: string) | A.SpecCV cv -> cvattrs := cv :: !cvattrs; acc | A.SpecAttr a -> attrs := a :: !attrs; acc | A.SpecType ts -> ts :: acc - | A.SpecPattern _ -> - Kernel.abort ~current:true "SpecPattern in cabs2cil input" + | A.SpecPattern _ -> abort_context "SpecPattern in cabs2cil input" in (* Now scan the list and collect the type specifiers. Preserve the order *) let tspecs = List.fold_right doSpecElem specs [] in @@ -4227,7 +4104,7 @@ let rec doSpecList ghost (suggestedAnonName: string) * forward reference *) let enum, _ = createEnumInfo n'' ~norig:n in let a = extraAttrs @ (getTypeAttrs ()) in - enum.eattr <- doAttributes ghost a; + enum.eattr <- enum.eattr @ (doAttributes ghost a); let res = TEnum (enum, []) in let smallest = ref Integer.zero in let largest = ref Integer.zero in @@ -4355,9 +4232,7 @@ let rec doSpecList ghost (suggestedAnonName: string) Some (new_exp ~loc:e'.eloc (SizeOfStr s)), empty_size_cache (), []) - | _ -> - Kernel.abort ~current:true - "The typeOf a string is not a pointer type" + | _ -> abort_context "The typeOf a string is not a pointer type" end | _ -> t in @@ -4405,19 +4280,9 @@ and makeVarInfoCabs if inline && not (isFunctionType vtype) then Kernel.error ~once:true ~current:true "inline for a non-function: %s" n; - let t = - if not isglobal && not isformal then begin - (* Sometimes we call this on the formal argument of a function with no - - * arguments. Don't call stripConstLocalType in that case *) - (* ignore (E.log "stripConstLocalType(%a) for %s\n" d_type vtype n); *) - stripConstLocalType vtype - end else - vtype - in + checkRestrictQualifierDeep vtype; (* log "Looking at %s(%b): (%a)@." n isformal d_attrlist nattr;*) - - let vi = makeVarinfo ~temp:isgenerated isglobal isformal n t in + let vi = makeVarinfo ~temp:isgenerated isglobal isformal n vtype in vi.vstorage <- sto; vi.vattr <- nattr; vi.vdecl <- ldecl; @@ -4503,6 +4368,8 @@ and doAttr ghost (a: A.attribute) : attribute list = | _ -> Kernel.fatal ~current:true "Invalid attribute constant: %s" str end + | A.CONSTANT (A.CONST_FLOAT str) -> + ACons ("__fc_float", [AStr str]) | A.CALL({expr_node = A.VARIABLE n}, args) -> begin let n' = if strip then stripUnderscore n else n in let ae' = List.map ae args in @@ -4516,6 +4383,9 @@ and doAttr ghost (a: A.attribute) : attribute list = ABinOp(LAnd, ae aa1, ae aa2) | A.BINARY(A.OR, aa1, aa2) -> ABinOp(LOr, ae aa1, ae aa2) + | A.BINARY(A.ASSIGN,aa1,aa2) -> + (* Bit of a hack to account for OSX specific syntax. *) + ACons ("__fc_assign", [ae aa1; ae aa2]) | A.BINARY(abop, aa1, aa2) -> ABinOp (convBinOp abop, ae aa1, ae aa2) | A.UNARY(A.PLUS, aa) -> ae aa @@ -4597,7 +4467,9 @@ and doType (ghost:bool) isFuncArg (* Now do the declarator type. But remember that the structure of the * declarator type is as printed, meaning that it is the reverse of the * right one *) - let rec doDeclType (bt: typ) (acc: attribute list) = function + let rec doDeclType (bt: typ) (acc: attribute list) decl_type = + checkRestrictQualifierDeep bt; + match decl_type with | A.JUSTBASE -> bt, acc | A.PARENTYPE (a1, d, a2) -> let a1' = doAttributes ghost a1 in @@ -4846,8 +4718,12 @@ and doType (ghost:bool) isFuncArg | TArray(t,lo,_,attr) -> turnArrayIntoPointer t lo attr | _ -> bt in + (* Drop qualifiers on the return type. They are meaningless (qualifiers + make sense only on l-values), and they make life more complicated: + the return type of the function is used e.g. for the type of retres, + and probably in many other places. *) + let tres = Cil.type_remove_qualifier_attributes tres in doDeclType (TFun (tres, args, isva', [])) acc d - in doDeclType bt [] dt @@ -4858,9 +4734,16 @@ and isVariableSizedArray ghost (dt: A.decl_type) let res = ref None in let rec findArray = function ARRAY (JUSTBASE, al, lo) when lo.expr_node != A.NOTHING -> - (* Try to compile the expression to a constant *) + (* Checks whether the expression is an integer constant expression, + that is: + - it contains no side-effect + - it can be evaluated at compile-time + Note that we should not pass true as asconst argument for doExp, + since we are precisely trying to determine whether the expression + is a constant or not. + *) let (_, se, e', _) = - doExp (ghost_local_env ghost) true lo (AExp (Some intType)) in + doExp (ghost_local_env ghost) false lo (AExp (Some intType)) in if isNotEmpty se || not (isConstant e') then begin res := Some (se, e'); PTR (al, JUSTBASE) @@ -5194,7 +5077,7 @@ and doExp local_env ([], (* the reads are incorporated in the chunk. *) ((unspecified_chunk empty) @@ (remove_reads lv se, ghost)) +++ - (mkStmtOneInstr ~ghost (Set(lv, e'', CurrentLoc.get ())), + (mkStmtOneInstr ~ghost ~valid_sid (Set(lv, e'', CurrentLoc.get ())), writes,writes, List.filter (fun x -> not (LvalStructEq.equal x lv)) r @ reads), e'', t'') @@ -5494,7 +5377,7 @@ and doExp local_env finishExp [] (unspecified_chunk empty) (new_exp ~loc (SizeOfStr s)) theMachine.typeOfSizeOf - | _ -> Kernel.abort ~current:true "cabs2cil: sizeOfStr" + | _ -> abort_context "cabs2cil: sizeOfStr" end | A.EXPR_SIZEOF e -> @@ -5828,7 +5711,7 @@ and doExp local_env in finishExp [] (se' +++ - (mkStmtOneInstr ~ghost:local_env.is_ghost + (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set(lv, makeCastT result tresult t, CurrentLoc.get ())),[],[lv],r')) e' @@ -5893,7 +5776,7 @@ and doExp local_env let tmp = newTempVar descr true t in ([var tmp], local_var_chunk se' tmp +++ - (mkStmtOneInstr ~ghost:local_env.is_ghost + (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set(var tmp, e', CurrentLoc.get ())),[],[],[]), (* the tmp variable should not be investigated for unspecified writes: it occurs at the right place in @@ -5905,7 +5788,7 @@ and doExp local_env in finishExp reads (se' +++ - (mkStmtOneInstr ~ghost:local_env.is_ghost + (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set(lv, makeCastT opresult tresult (typeOfLval lv), CurrentLoc.get ())), @@ -5995,7 +5878,7 @@ and doExp local_env let tmp = newTempVar descr true lvt in let chunk = i2c - (mkStmtOneInstr ~ghost:local_env.is_ghost + (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set(lv, new_exp ~loc:e1'.eloc (Lval(var tmp)), loc)), [lv],[lv], r1') in @@ -6096,7 +5979,7 @@ and doExp local_env finishExp [] (se0 @@ (empty @@ (se1' @@ se2) +++ - (mkStmtOneInstr ~ghost:local_env.is_ghost + (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set(lv1, result', loc)), [lv1],[lv1], r1' @ r2))) e1' @@ -6134,10 +6017,10 @@ and doExp local_env let condChunk = compileCondExp ~ghost ce (empty +++ - (mkStmtOneInstr ~ghost + (mkStmtOneInstr ~ghost ~valid_sid (Set(var tmp, integer ~loc 1,loc)),[],[],[])) (empty +++ - (mkStmtOneInstr ~ghost + (mkStmtOneInstr ~ghost ~valid_sid (Set(var tmp, integer ~loc 0,loc)),[],[],[])) in finishExp [] @@ -6261,35 +6144,7 @@ and doExp local_env | Lval (Var fv, NoOffset) -> Cil.is_special_builtin fv.vname | _ -> false in - - let force_rlarg_eval = Kernel.ForceRLArgEval.get () in - (** If [force_rlarg_eval], make sure we evaluate args right-to-left. *) - let force_right_to_left_evaluation (r,c, e, t) = - (* If chunk is empty then it is not already evaluated *) - (* constants don't need to be pulled out *) - if force_rlarg_eval && (not (isConstant e)) && not isSpecialBuiltin - then - (* create a temporary *) - let tmp = - newTempVar - (Format.asprintf "%a" Cil_descriptive_printer.pp_exp e) - true - t - in - let c = local_var_chunk c tmp in - (* create an instruction to give the e to the temporary *) - let i = mkStmtOneInstr ~ghost:local_env.is_ghost - (Set(var tmp, e, loc)) - in - (* add the instruction to the chunk *) - (* change the expression to be the temporary *) - (c +++ (i,[],[],[]), new_exp ~loc (Lval(var tmp)), t) - else - (add_reads loc r c, e, t) - in - let init_chunk = - if force_rlarg_eval then empty else unspecified_chunk empty - in + let init_chunk = unspecified_chunk empty in (* Do the arguments. In REVERSE order !!! Both GCC and MSVC do this *) let rec loopArgs = function | ([], []) -> (init_chunk, []) @@ -6306,8 +6161,10 @@ and doExp local_env * the castTo do this work. This was necessary for * test/small1/union5, in which a transparent union is passed * as an argument *) - let (sa, a', att) = force_right_to_left_evaluation - (doExp local_env false a (AExp None)) in + let (sa, a', att) = + let (r, c, e, t) = doExp local_env false a (AExp None) in + (add_reads ~ghost:local_env.is_ghost loc r c, e, t) + in let (_, a'') = castTo att at a' in (ss @@ (sa, ghost), a'' :: args') @@ -6321,8 +6178,8 @@ and doExp local_env | a :: args -> let (ss, args') = loop args in let (sa, a', _) = - force_right_to_left_evaluation - (doExp local_env false a (AExp None)) + let (r, c, e, t) = doExp local_env false a (AExp None) in + (add_reads ~ghost:local_env.is_ghost loc r c, e, t) in (ss @@ (sa, ghost), a' :: args') in @@ -6403,8 +6260,8 @@ and doExp local_env (* Try to intercept some builtins *) (match (!pf).enode with | Lval(Var fv, NoOffset) -> begin - match fv.vname with - | "__builtin_va_arg" -> + match fv.vname with + | "__builtin_va_arg" -> begin match !pargs with | marker :: ({enode = SizeOf resTyp} as size) :: _ -> begin @@ -6426,8 +6283,52 @@ and doExp local_env end | _ -> Kernel.warning ~current:true "Invalid call to %s\n" fv.vname; - end - | "__builtin_stdarg_start" | "__builtin_va_start" -> + end + + | "__builtin_va_start" -> + let variad = match (!currentFunctionFDEC).svar.vtype with + | TFun(_,_,t,_) -> t + | _ -> assert false + in + let name = + (!currentFunctionFDEC).svar.vname + in + begin + match !pargs with + | marker :: last :: [] -> begin + let isOk = + match (dropCasts last).enode with + | Lval (Var lastv, NoOffset) -> + lastv.vname = getNameLastFormal () + | _ -> false + in + if not isOk && variad then + Kernel.warning ~current:true + "The last argument in call to __builtin_va_start \ + should be the last formal argument of %s" name; + + if not isOk && not variad then + Kernel.error ~current:true + "Invalid call to __builtin_va_start \ + in non-variadic function %s" + name; + + (* Check that "lastv" is indeed the last variable in the + * prototype and then drop it *) + pargs := [ marker ] + end + | _ -> + Kernel.warning ~current:true "Invalid call to %s\n" name; + + (* We have to turn uses of __builtin_varargs_start into uses + * of __builtin_stdarg_start (because we have dropped the + * __builtin_va_alist argument from this function) *) + end + + | "__builtin_stdarg_start" -> + let name = + (!currentFunctionFDEC).svar.vname + in begin match !pargs with | marker :: last :: [] -> begin @@ -6439,15 +6340,15 @@ and doExp local_env in if not isOk then Kernel.warning ~current:true - "The second argument in call to %s \ - should be the last formal argument" fv.vname; + "The last argument in call to __builtin_stdarg_start \ + should be the last formal argument of %s" name; (* Check that "lastv" is indeed the last variable in the * prototype and then drop it *) pargs := [ marker ] end | _ -> - Kernel.warning ~current:true "Invalid call to %s\n" fv.vname; + Kernel.warning ~current:true "Invalid call to %s\n" name; (* We have to turn uses of __builtin_varargs_start into uses * of __builtin_stdarg_start (because we have dropped the @@ -6460,7 +6361,7 @@ and doExp local_env let v, _ = try lookupGlobalVar "__builtin_stdarg_start" with Not_found -> - Kernel.abort ~current:true + abort_context "Cannot find __builtin_stdarg_start to replace %s" fv.vname in @@ -6500,9 +6401,32 @@ and doExp local_env end | "__builtin_constant_p" -> begin + (* Before emptying the chunk, we remove the corresponding + generated labels from the tables. Otherwise, they will + be dangling when we iterate over the tables to fix + forward gotos, leading to errors. *) + let remove_label s = + let vis = object + inherit Cil.nopCilVisitor + method! vstmt { labels } = + List.iter + (function + | Label (l, _, _) -> + H.remove labelStmt l; + H.remove backPatchGotos l + | _ -> ()) + labels; + DoChildren + end + in + ignore (Cil.visitCilStmt vis s) + in + List.iter + (fun (stmt, _, _, _, _) -> + remove_label stmt + ) !prechunk.stmts; (* Drop the side-effects *) prechunk := empty; - (* Constant-fold the argument and see if it is a constant *) (match !pargs with | [ arg ] -> begin @@ -6529,7 +6453,7 @@ and doExp local_env piscall := false; let compatible = try ignore(combineTypes CombineOther t1 t2); true - with Failure _ -> false + with Cannot_combine _ -> false in if compatible then pres := integer ~loc 1 else @@ -6591,7 +6515,7 @@ and doExp local_env at this point.*) begin piscall := false; - Kernel.abort + abort_context "Call to %a in constant." Cil_printer.pp_varinfo fv; end end @@ -6608,7 +6532,7 @@ and doExp local_env in prechunk := (empty @@ (!prechunk, ghost)) +++ - (mkStmtOneInstr ~ghost:local_env.is_ghost + (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Call(calldest,!pf,!pargs,loc)), [],my_write, rf); pres := res; @@ -6933,8 +6857,7 @@ and doExp local_env match !data with | None when isvoidbody -> finishExp [] se (zero ~loc:e.expr_loc) voidType - | None -> - Kernel.abort ~current:true "Cannot find COMPUTATION in GNU.body" + | None -> abort_context "Cannot find COMPUTATION in GNU.body" | Some (e, t) -> let se, e = match se.stmts with @@ -6942,7 +6865,7 @@ and doExp local_env let vi = newTempVar "GNU.body" true t in b.bstmts <- b.bstmts @ - [Cil.mkStmtOneInstr ~ghost:local_env.is_ghost + [Cil.mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set (Cil.var vi, e,loc))]; (local_var_chunk se vi,Cil.new_exp ~loc (Lval (Cil.var vi))) | _ -> se,e @@ -6965,8 +6888,7 @@ and doExp local_env (makeCast (integer ~loc addrval) voidPtrType) voidPtrType end - | A.EXPR_PATTERN _ -> - Kernel.abort ~current:true "EXPR_PATTERN in cabs2cil input" + | A.EXPR_PATTERN _ -> abort_context "EXPR_PATTERN in cabs2cil input" in (*let (_a,b,_c,_d) = result in @@ -7003,7 +6925,7 @@ and doBinOp loc (bop: binop) (e1: exp) (t1: typ) (e2: exp) (t2: typ) = (makeCastT e1 t1 tres) (makeCastT e2 t2 tres) tres | _ -> Kernel.fatal ~current:true "%a operator on non-integer type %a" - Cil_printer.pp_binop bop Printer.pp_typ tres + Cil_printer.pp_binop bop Cil_printer.pp_typ tres in (* Invariant: t1 and t2 are pointers types *) let pointerComparison e1 t1 e2 t2 = @@ -7059,13 +6981,12 @@ and doBinOp loc (bop: binop) (e1: exp) (t1: typ) (e2: exp) (t2: typ) = (makeCastT e2 t2 (integralPromotion t2)) t1 | MinusA when isPointerType t1 && isPointerType t2 -> if areCompatibleTypes (* C99 6.5.6:3 *) - (Cil.type_remove_qualifier_attributes t1) - (Cil.type_remove_qualifier_attributes t2) + (Cil.type_remove_qualifier_attributes_deep t1) + (Cil.type_remove_qualifier_attributes_deep t2) then theMachine.ptrdiffType, optConstFoldBinOp loc false MinusPP e1 e2 theMachine.ptrdiffType - else Kernel.abort ~once:true ~current:true - "incompatible types in pointer subtraction" + else abort_context "incompatible types in pointer subtraction" (* Two special cases for comparisons with the NULL pointer. We are a bit more permissive. *) @@ -7184,7 +7105,7 @@ and doCondExp local_env (asconst: bool) | Some orig -> ConditionalSideEffectHook.apply (orig,e)); ignore (checkBool t e'); - CEExp (add_reads e.expr_loc r se, + CEExp (add_reads ~ghost e.expr_loc r se, if asconst || theMachine.lowerConstants then constFold asconst e' else e') @@ -7307,14 +7228,16 @@ and doPureExp local_env (e : A.expression) : exp = and doFullExp local_env const e what = let (r, se,e,t) = doExp local_env const e what in - let se' = add_reads e.eloc r se in + let se' = add_reads ~ghost:local_env.is_ghost e.eloc r se in (* there is a sequence point after a full exp *) empty @@ (se', local_env.is_ghost),e,t and doInitializer local_env (vi: varinfo) (inite: A.init_expression) (* Return the accumulated chunk, the initializer and the new type (might be - * different for arrays) *) - : chunk * init * typ = + * different for arrays), together with the lvals read during evaluation of + * the initializer (for local intialization) + *) + : chunk * init * typ * Cil_datatype.Lval.Set.t = Kernel.debug ~dkey:category_initializer "@\nStarting a new initializer for %s : %a@\n" @@ -7332,15 +7255,13 @@ and doInitializer local_env (vi: varinfo) (inite: A.init_expression) let typ' = vi.vtype in Kernel.debug ~dkey:category_initializer "Collecting the initializer for %s@\n" vi.vname; - let (init, typ'') = collectInitializer preinit typ' typ' in + let (init, typ'', reads) = + collectInitializer Cil_datatype.Lval.Set.empty preinit typ' typ' + in Kernel.debug ~dkey:category_initializer "Finished the initializer for %s@\n init=%a@\n typ=%a@\n acc=%a@\n" vi.vname Cil_printer.pp_init init Cil_printer.pp_typ typ' d_chunk acc; - empty @@ (acc, local_env.is_ghost), init, typ'' - -and blockInitializer local_env vi inite = - let ghost = local_env.is_ghost in - let c,init,ty = doInitializer local_env vi inite in c2block ~ghost c, init, ty + empty @@ (acc, local_env.is_ghost), init, typ'', reads (* Consume some initializers. This is used by both global and local variables initialization. @@ -7362,12 +7283,13 @@ doInit returns a triple: - the list of unused initializers if any (should be empty most of the time) *) and doInit local_env isconst add_implicit_ensures preinit so acc initl = + let ghost = local_env.is_ghost in let whoami fmt = Cil_printer.pp_lval fmt (Var so.host, so.soOff) in let initl1 = match initl with | (A.NEXT_INIT, A.SINGLE_INIT ({ expr_node = A.CAST ((s, dt), ie)} as e)) :: rest -> - let s', dt', ie' = preprocessCast local_env.is_ghost s dt ie in + let s', dt', ie' = preprocessCast ghost s dt ie in (A.NEXT_INIT, A.SINGLE_INIT ({expr_node = A.CAST ((s', dt'), ie'); expr_loc = e.expr_loc})) @@ -7381,9 +7303,8 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = | (what, A.SINGLE_INIT ({expr_node = A.CAST ((specs, dt), A.COMPOUND_INIT ci)})) :: rest -> - let s', dt', _ie' = - preprocessCast local_env.is_ghost specs dt (A.COMPOUND_INIT ci) in - let typ = doOnlyType local_env.is_ghost s' dt' in + let s', dt', _ie' = preprocessCast ghost specs dt (A.COMPOUND_INIT ci) in + let typ = doOnlyType ghost s' dt' in if Typ.equal (Cil.typeDeepDropAllAttributes typ) (Cil.typeDeepDropAllAttributes so.soTyp) @@ -7569,16 +7490,16 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = let r,se, oneinit', t' = doExp local_env isconst oneinit (AExp None) in - let se = add_reads oneinit'.eloc r se in + let r = Cil_datatype.Lval.Set.of_list r in if (match unrollType t' with | TComp (comp', _, _) when comp'.ckey = comp.ckey -> true | _ -> false) then begin (* Initialize the whole struct *) - let preinit = setOneInit preinit so.soOff (SinglePre oneinit') in + let preinit = setOneInit preinit so.soOff (SinglePre (oneinit', r)) in (* Advance to the next subobject *) advanceSubobj so; - let se = acc @@ (se, local_env.is_ghost) in + let se = acc @@ (se, ghost) in doInit local_env isconst add_implicit_ensures preinit so se restil end else begin (* Try to initialize fields *) let toinit = fieldsToInit comp None in @@ -7591,7 +7512,7 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = | _, (A.NEXT_INIT, A.SINGLE_INIT oneinit) :: restil -> let r, se, oneinit', t' = doExp local_env isconst oneinit (AExp(Some so.soTyp)) in - let se = add_reads oneinit'.eloc r se in + let r = Cil_datatype.Lval.Set.of_list r in Kernel.debug ~dkey:category_initializer "oneinit'=%a, t'=%a, so.soTyp=%a" Cil_printer.pp_exp oneinit' Cil_printer.pp_typ t' Cil_printer.pp_typ so.soTyp; @@ -7599,10 +7520,10 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = if theMachine.insertImplicitCasts then snd (castTo t' so.soTyp oneinit') else oneinit' in - let preinit' = setOneInit preinit so.soOff (SinglePre init_expr) in + let preinit' = setOneInit preinit so.soOff (SinglePre (init_expr,r)) in (* Move on *) advanceSubobj so; - let se = acc @@ (se,local_env.is_ghost) in + let se = acc @@ (se,ghost) in doInit local_env isconst add_implicit_ensures preinit' so se restil (* An array with a compound initializer. The initializer is for the * array elements *) @@ -7703,15 +7624,15 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = let r,se, oneinit', t' = doExp local_env isconst oneinit (AExp(Some so.soTyp)) in - let se = add_reads oneinit'.eloc r se in + let r = Cil_datatype.Lval.Set.of_list r in let init_expr = makeCastT oneinit' t' so.soTyp in - let preinit' = setOneInit preinit so.soOff (SinglePre init_expr) in + let preinit' = setOneInit preinit so.soOff (SinglePre (init_expr, r)) in (* Move on *) advanceSubobj so; - let se = acc @@ (se, local_env.is_ghost) in + let se = acc @@ (se, ghost) in doInit local_env isconst add_implicit_ensures preinit' so se restil with Not_found -> - Kernel.abort ~current:true + abort_context "scalar value (of type %a) initialized by compound initializer" Cil_printer.pp_typ t end @@ -7748,27 +7669,24 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = let (r,doidx, idxe', _) = doExp local_env true idx (AExp(Some intType)) in - let doidx = add_reads idxe'.eloc r doidx in + let doidx = add_reads ~ghost idxe'.eloc r doidx in match constFoldToInt idxe', isNotEmpty doidx with | Some x, false -> Integer.to_int x, doidx | _ -> - Kernel.abort ~current:true + abort_context "INDEX initialization designator is not a constant" in if nextidx' < 0 || nextidx' >= ilen then - Kernel.abort ~current:true - "INDEX designator is outside bounds"; + abort_context "INDEX designator is outside bounds"; so.stack <- InArray(so.soOff, bt, ilen, ref nextidx') :: so.stack; normalSubobj so; - address whatnext (acc @@ (doidx, local_env.is_ghost)) + address whatnext (acc @@ (doidx, ghost)) - | _ -> - Kernel.abort ~current:true "INDEX designator for a non-array" + | _ -> abort_context "INDEX designator for a non-array" end - | A.ATINDEXRANGE_INIT _ -> - Kernel.abort ~current:true "addressSubobj: INDEXRANGE" + | A.ATINDEXRANGE_INIT _ -> abort_context "addressSubobj: INDEXRANGE" in address what acc in @@ -7778,14 +7696,13 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = expandRange (fun what -> top (A.INFIELD_INIT(fn, what))) whatnext | A.ATINDEX_INIT (idx, whatnext) -> expandRange (fun what -> top (A.ATINDEX_INIT(idx, what))) whatnext - | A.ATINDEXRANGE_INIT (idxs, idxe) -> let (rs, doidxs, idxs', _) = doExp local_env true idxs (AExp(Some intType)) in let (re, doidxe, idxe', _) = doExp local_env true idxe (AExp(Some intType)) in - let doidxs = add_reads idxs'.eloc rs doidxs in - let doidxe = add_reads idxe'.eloc re doidxe in + let doidxs = add_reads ~ghost idxs'.eloc rs doidxs in + let doidxe = add_reads ~ghost idxe'.eloc re doidxe in if isNotEmpty doidxs || isNotEmpty doidxe then Kernel.fatal ~current:true "Range designators are not constants"; let first, last = @@ -7817,7 +7734,7 @@ and doInit local_env isconst add_implicit_ensures preinit so acc initl = in expandRange (fun x -> x) what | t, (_what, _ie) :: _ -> - Kernel.abort ~current:true "doInit: cases for t=%a" Cil_printer.pp_typ t + abort_context "doInit: cases for t=%a" Cil_printer.pp_typ t (* Create and add to the file (if not already added) a global. Return the * varinfo *) @@ -7864,7 +7781,7 @@ and createGlobal ghost logic_spec ((t,s,b,attr_list) : (typ * storage * bool * A if inite = A.NO_INIT then None else - let se, ie', et = doInitializer (ghost_local_env ghost) vi inite in + let se, ie', et, _ = doInitializer (ghost_local_env ghost) vi inite in (* Maybe we now have a better type? Use the type of the * initializer only if it really differs from the type of * the variable. *) @@ -8013,6 +7930,59 @@ and createGlobal ghost logic_spec ((t,s,b,attr_list) : (typ * storage * bool * A n docAlphaTable) *) +(* it can happen that the variable to be initialized appears in the + auxiliary statements that contribute to its initialization (and thus + are meant to occur before the corresponding Local_init statement. In + that case, this function creates an auxiliary variable that is never + defined as a placeholder. + Note that in any case, if the execution attempts to evaluate + the variable (either original or placeholder), the behavior is undefined. + There are some cases where the evaluation will succeed, though, e.g. with + size_t x = sizeof(x) > 6 ? sizeof(x): 6; +*) +and cleanup_autoreference vi chunk = + let temp = ref None in + let calls = ref [] in + let extract_calls () = + let res = !calls in + calls := []; + res + in + let vis = + object(self) + inherit Cil.nopCilVisitor + + method! vinst = function + | Call _ | Local_init(_,ConsInit _,_) -> + calls := ref (Extlib.the self#current_stmt) :: !calls; + DoChildren + | _ -> DoChildren + + method! vvrbl v = + if Cil_datatype.Varinfo.equal v vi then begin + match !temp with + | Some v' -> ChangeTo v' + | None -> + let v' = newTempVar (vi.vname ^ " initialization") true vi.vtype in + temp := Some v'; + ChangeTo v' + end else SkipChildren + end + in + let transform_lvals l = List.map (visitCilLval vis) l in + let treat_one (s, m, w, r, _) = + let s' = visitCilStmt vis s in + let m' = transform_lvals m in + let w' = transform_lvals w in + let r' = transform_lvals r in + let c' = extract_calls () in + (s', m', w', r', c') + in + let stmts = List.map treat_one chunk.stmts in + match !temp with + | None -> chunk + | Some v -> local_var_chunk { chunk with stmts } v + (* Must catch the Static local variables. Make them global *) and createLocal ghost ((_, sto, _, _) as specs) ((((n, ndt, a, cloc) : A.name), @@ -8066,7 +8036,7 @@ and createLocal ghost ((_, sto, _, _) as specs) if inite = A.NO_INIT then None else begin - let se, ie', et = doInitializer (ghost_local_env ghost) vi inite in + let se, ie', et, _ = doInitializer (ghost_local_env ghost) vi inite in (* Maybe we now have a better type? Use the type of the * initializer only if it really differs from the type of * the variable. *) @@ -8104,10 +8074,15 @@ and createLocal ghost ((_, sto, _, _) as specs) makeVarSizeVarInfo ghost loc specs (n, ndt, a) in let vi = alphaConvertVarAndAddToEnv true vi in (* Replace vi *) + if isvarsize then begin + let free = vla_free_fun () in + let destructor = AStr free.vname in + let attr = Attr (frama_c_destructor, [destructor]) in + vi.vdefined <- true; + vi.vattr <- Cil.addAttribute attr vi.vattr; + end; let se1 = if isvarsize then begin (* Variable-sized array *) - Kernel.warning ~current:true - "Variable-sized local variable %s" vi.vname; (* Make a local variable to keep the length *) let savelen = makeVarInfoCabs @@ -8122,13 +8097,7 @@ and createLocal ghost ((_, sto, _, _) as specs) let savelen = alphaConvertVarAndAddToEnv true savelen in let se0 = local_var_chunk se0 savelen in (* Compute the allocation size *) - let elt_size = new_exp ~loc - (SizeOfE - (new_exp ~loc - (Lval - (Mem(new_exp ~loc (Lval(var vi))), - NoOffset)))) - in + let elt_size = new_exp ~loc (SizeOf (Cil.typeOf_pointed vi.vtype)) in let alloca_size = new_exp ~loc (BinOp(Mult, @@ -8167,24 +8136,23 @@ and createLocal ghost ((_, sto, _, _) as specs) let annot = Logic_const.new_code_annotation (AAssert ([], alloca_bounds)) in - (mkStmtOneInstr ~ghost + (mkStmtOneInstr ~ghost ~valid_sid (Code_annot (annot, castloc)), [],[],[]))) in let setlen = se0 +++ - (mkStmtOneInstr ~ghost + (mkStmtOneInstr ~ghost ~valid_sid (Set(var savelen, makeCast len savelen.vtype, CurrentLoc.get ())), [],[],[]) in (* Initialize the variable *) - let alloca: varinfo = allocaFun () in + let alloca: varinfo = vla_alloc_fun () in if Kernel.DoCollapseCallCast.get () then (* do it in one step *) setlen +++ - (mkStmtOneInstr ~ghost - (Call(Some(var vi), new_exp ~loc (Lval(var alloca)), - [ alloca_size ], loc)), + (mkStmtOneInstr ~ghost ~valid_sid + (Local_init (vi, ConsInit(alloca,[ alloca_size ],Plain_func),loc)), [],[var vi],[]) else begin (* do it in two *) @@ -8194,14 +8162,18 @@ and createLocal ghost ((_, sto, _, _) as specs) (Format.asprintf "alloca(%a)" Cil_printer.pp_exp alloca_size) false rt in + tmp.vdefined <- true; (local_var_chunk setlen tmp) - +++ (mkStmtOneInstr ~ghost - (Call(Some(var tmp), new_exp ~loc (Lval(var alloca)), - [ alloca_size ], CurrentLoc.get ())),[],[],[]) - +++ (mkStmtOneInstr ~ghost - (Set((var vi), - makeCast (new_exp ~loc (Lval(var tmp))) vi.vtype, - CurrentLoc.get ())), + +++ (mkStmtOneInstr ~ghost ~valid_sid + (Local_init + (tmp,ConsInit(alloca,[alloca_size],Plain_func),loc)), + [],[],[]) + +++ (mkStmtOneInstr ~ghost ~valid_sid + (Local_init + (vi,AssignInit + (SingleInit + (makeCast (new_exp ~loc (Lval(var tmp))) vi.vtype)), + CurrentLoc.get ())), [],[var vi],[var tmp]) end end else empty @@ -8210,11 +8182,14 @@ and createLocal ghost ((_, sto, _, _) as specs) if inite = A.NO_INIT then se1 (* skipChunk *) else begin - let se4, ie', et = doInitializer (ghost_local_env ghost) vi inite in + (* TODO: if vi occurs in se4, this is not a real initialization. *) + vi.vdefined <- true; + let se4, ie', et, r = doInitializer (ghost_local_env ghost) vi inite in + let se4 = cleanup_autoreference vi se4 in (* Fix the length *) (match vi.vtype, ie', et with (* We have a length now *) - | TArray(_,None, _, _), _, TArray(_, Some _, _, _) -> + | TArray(_,None, _, _), _, TArray(_, Some _, _, _) -> Cil.update_var_type vi et (* Initializing a local array *) | TArray(TInt((IChar|IUChar|ISChar), _) as bt, None, l, a), @@ -8227,7 +8202,11 @@ and createLocal ghost ((_, sto, _, _) as specs) (* Now create assignments instead of the initialization *) (se1 @@ (se4, ghost)) - @@ (assignInit ~ghost (Var vi, NoOffset) ie' et empty, ghost) + @@ + (i2c + (Cil.mkStmtOneInstr + ~ghost ~valid_sid (Local_init(vi,AssignInit ie',loc)), + [], [(Var vi,NoOffset)], Cil_datatype.Lval.Set.elements r), ghost) end and doAliasFun vtype (thisname:string) (othername:string) @@ -8254,7 +8233,7 @@ and doAliasFun vtype (thisname:string) (othername:string) (* get the new function *) let v,_ = try lookupGlobalVar thisname - with Not_found -> Kernel.abort ~current:true "error in doDecl" + with Not_found -> abort_context "error in doDecl" in v.vattr <- dropAttribute "alias" v.vattr @@ -8313,8 +8292,7 @@ and doDecl local_env (isglobal: bool) : A.definition -> chunk = function in append_chunk_to_annot ~ghost (s2c - (mkStmtOneInstr - ~ghost:local_env.is_ghost (Code_annot (spec,loc')))) + (mkStmtOneInstr ~ghost ~valid_sid (Code_annot (spec,loc')))) res with LogicTypeError ((source,_),msg) -> Kernel.warning ~source @@ -8595,7 +8573,7 @@ and doDecl local_env (isglobal: bool) : A.definition -> chunk = function let default = defaultChunk ~ghost loc - (i2c (mkStmtOneInstr ~ghost:local_env.is_ghost + (i2c (mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set ((Mem (makeCast (integer ~loc 0) intPtrType), NoOffset), integer ~loc 0, loc)),[],[],[])) @@ -8660,7 +8638,7 @@ and doDecl local_env (isglobal: bool) : A.definition -> chunk = function in (* Now replace it with the current formal. *) (shadow :: accform, - mkStmtOneInstr ~ghost:local_env.is_ghost + mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Set ((Var f, Field(fstfield, NoOffset)), new_exp ~loc (Lval (var shadow)), loc)) :: accbody)) @@ -8684,7 +8662,7 @@ and doDecl local_env (isglobal: bool) : A.definition -> chunk = function let annot = Logic_const.new_code_annotation (AAssert ([], pfalse)) in - Cil.mkStmt ~ghost:local_env.is_ghost (Instr(Code_annot(annot,loc))) + Cil.mkStmt ~ghost ~valid_sid (Instr(Code_annot(annot,loc))) in match unrollType !currentReturnType with | TVoid _ -> [], None @@ -8716,7 +8694,7 @@ and doDecl local_env (isglobal: bool) : A.definition -> chunk = function !currentFunctionFDEC.sbody.bstmts <- !currentFunctionFDEC.sbody.bstmts @ protect_return @ - [mkStmt ~ghost:local_env.is_ghost (Return(retval, endloc))] + [mkStmt ~ghost ~valid_sid (Return(retval, endloc))] end; (* ignore (E.log "The env after finishing the body of %s:\n%t\n" @@ -8738,8 +8716,7 @@ and doDecl local_env (isglobal: bool) : A.definition -> chunk = function (fun d -> let s = doDecl local_env isglobal d in if isNotEmpty s then - Kernel.abort ~current:true - "doDecl returns non-empty statement for global") + abort_context "doDecl returns non-empty statement for global") dl; empty @@ -8791,6 +8768,7 @@ and doTypedef ghost ((specs, nl): A.name_group) = checkTypedefSize n newTyp; let tattr = fc_stdlib_attribute tattr in let newTyp' = cabsTypeAddAttributes tattr newTyp in + checkRestrictQualifierDeep newTyp'; if H.mem typedefs n && H.mem env n then (* check if type redefinition is allowed (C11 only); in all cases, do not create a new type. @@ -8915,205 +8893,6 @@ and doOnlyTypedef ghost (specs: A.spec_elem list) : unit = "Ignoring un-named typedef that does not introduce a struct or \ enumeration type" -and assignInit ~ghost (lv: lval) - ?(has_implicit_init=false) - ?(explicit_init=(fun _ _ -> ())) - ?(add_implicit_ensures=(fun _ -> ())) - (ie: init) - (iet: typ) - (acc: chunk) : chunk = - match ie with - | SingleInit e -> - let (_, e'') = castTo iet (typeOfLval lv) e in - explicit_init lv e''; - acc +++ (mkStmtOneInstr ~ghost - (Set(lv, e'', CurrentLoc.get ())),[],[lv],[]) - | CompoundInit (t, initl) -> - (match t with - | TArray(bt,len,_,_) -> - let l = integerArrayLength len in - if List.length initl < l then begin - (* For big arrays in local variables, - the implicit initialization to 0 is not done - completely. We'll do that ourselves, with - - a bzero to 0 - - a contract for plugins that do not want to rely on bzero. - All that is done at the toplevel occurrence of implicit - initialization. - *) - let (curr_host,curr_off) = lv in - let vi = - match curr_host with - | Var vi -> vi - | _ -> Kernel.fatal "Trying to initialize a anonymous block" - in - let ensures = ref [] in - let known_idx = ref Datatype.Integer.Set.empty in - let explicit_init (_,off as lv) v = - if not has_implicit_init then begin - (* just add ensures at the toplevel init *) - let pred = ensures_init vi off v in - let post_cond = (Normal, Logic_const.new_predicate pred) in - ensures:= post_cond :: !ensures - end; - (* find which index is initialized. - This is not necessarily the last one in case of array of - complex structures. - *) - let rec aux off = - let my_off, last_off = Cil.removeOffset off in - if Cil_datatype.Offset.equal curr_off my_off then begin - match last_off with - | Index(i,_) -> - (match Cil.constFoldToInt i with - | Some v -> - known_idx := Datatype.Integer.Set.add v !known_idx - | _ -> - Kernel.abort ~current:true - "Non constant index in designator for array \ - initialization: %a" - Cil_printer.pp_exp i) - | NoOffset | Field _ -> - assert false - (* We are supposed to have an array here. *) - end else - match last_off with - | NoOffset -> () - | _ -> aux my_off - in - aux off; - explicit_init lv v - in - let add_implicit_ensures = - if has_implicit_init then add_implicit_ensures - else - fun e -> - ensures:= (Normal, Logic_const.new_predicate e) :: !ensures - in - (* do the initialization of the array only. *) - let my_init = - foldLeftCompound - ~implicit:false - ~doinit:(fun off i it acc -> - assignInit ~ghost (addOffsetLval off lv) - ~has_implicit_init:true - ~explicit_init - ~add_implicit_ensures - i it acc) - ~ct:t - ~initl:initl - ~acc:empty - in - let base_init = - if has_implicit_init then - empty - (* this location has already been zero-initialized by - toplevel implicit init. *) - else if Kernel.InitializedPaddingLocals.get () then - s2c (set_to_zero ~ghost vi curr_off t) - (* use bzero to clear whole region*) - else - zero_init ~ghost vi curr_off l bt - (* zero-init each field, so as to leave padding bits - uninitialized. *) - in - let init_block = base_init @@ (my_init, ghost) in - (* lift at toplevel contract implicit zero-initialization. *) - let my_ensures = - make_implicit_ensures vi curr_off bt l !known_idx - in - add_implicit_ensures my_ensures; - let annot_chunk = - if has_implicit_init then empty - else begin - let tlv = Logic_utils.lval_to_term_lval ~cast:false lv in - let loc = vi.vdecl in - let rec all_zone tlv = - match Logic_utils.unroll_type (Cil.typeOfTermLval tlv) with - | Ctype (TArray (_,len,_,_)) - | Ltype ({ lt_name = "set"},[Ctype(TArray (_,len,_,_))])-> - let tlen = - Extlib.opt_map - (Logic_utils.expr_to_term ~cast:false) len - in - let upper = - Extlib.opt_map - (fun tlen -> - Logic_const.term ~loc - (TBinOp(MinusA,tlen,Logic_const.tinteger ~loc 1)) - Linteger) - tlen - in - let all_range = - Logic_const.trange ~loc - (Some (Logic_const.tinteger ~loc 0), upper) - in - all_zone (Logic_const.addTermOffsetLval - (TIndex (all_range, TNoOffset)) tlv) - | t -> Logic_const.term ~loc (TLval tlv) t - in - let tlocs = all_zone tlv in - let assigns = - Writes [Logic_const.new_identified_term tlocs,FromAny] - in - let post_cond = List.rev !ensures in - let contract = - { spec_behavior = - [Cil.mk_behavior - ~name:"Frama_C_implicit_init" - ~assigns - ~post_cond - () - ]; - spec_variant = None; - spec_terminates = None; - spec_complete_behaviors = []; - spec_disjoint_behaviors = []; - } - in - let code_annot = - Logic_const.new_code_annotation (AStmtSpec ([],contract)) - in - s2c (Cil.mkStmt ~ghost - (Instr - (Code_annot (code_annot,Errorloc.currentLoc())))) - end - in - let init_chunk = - append_chunk_to_annot ~ghost annot_chunk init_block - in - acc @@ (init_chunk, ghost) - end else begin - foldLeftCompound - ~implicit:false - ~doinit: - (fun off i it acc -> - assignInit ~ghost (addOffsetLval off lv) - ~has_implicit_init - ~explicit_init - ~add_implicit_ensures - i it acc) - ~ct:t - ~initl:initl - ~acc:acc - end - | _ -> - foldLeftCompound - ~implicit:false - ~doinit: - (fun off i it acc -> - assignInit ~ghost (addOffsetLval off lv) - ~has_implicit_init - ~explicit_init - ~add_implicit_ensures - i it acc) - ~ct:t - ~initl:initl - ~acc:acc) - -and blockInit ~ghost (lv: lval) (ie: init) (iet: typ) : block = - c2block ~ghost (assignInit ~ghost lv ie iet empty) - (* Now define the processors for body and statement *) and doBody local_env (blk: A.block) : chunk = let ghost = local_env.is_ghost in @@ -9136,22 +8915,26 @@ and doBody local_env (blk: A.block) : chunk = in (* Format.eprintf "Considering statement: %a@." Cprint.print_statement s; *) - let res = doStatement local_env s in (* Keeps stmts originating from the same source statement in a single block when the statement follows a code annotation, so that the annotation will be attached to the whole result and - not to the first Cil statement + not to the first Cil statement. This is only needed + for statement contracts and pragmas. Other (non-loop, as + they have special treatment) annotations operate purely + at current point and do not care about what happens to the + next statement. *) let new_behaviors, keep_next = match s.stmt_node with - | CODE_ANNOT _ -> [], true + | CODE_ANNOT(Logic_ptree.AStmtSpec (_,s),_) | CODE_SPEC (s,_) -> List.map (fun x -> x.Logic_ptree.b_name) s.Logic_ptree.spec_behavior, true + | CODE_ANNOT(Logic_ptree.APragma _,_) -> [], true | _ -> [], false in (* Format.eprintf "Done statement %a@." d_chunk res; *) @@ -9174,7 +8957,7 @@ and doBody local_env (blk: A.block) : chunk = else begin let b = c2block ~ghost bodychunk in b.battrs <- battrs; - let res = s2c (mkStmt ~ghost (Block b)) in + let res = s2c (mkStmt ~ghost ~valid_sid (Block b)) in { res with cases = bodychunk.cases } end @@ -9191,8 +8974,9 @@ and doStatement local_env (s : A.statement) : chunk = let ghost = s.stmt_ghost in let local_env = { local_env with is_ghost = ghost } in match s.stmt_node with - | A.NOP loc -> { empty - with stmts = [mkEmptyStmt ~ghost ~loc (), [],[],[],[]]} + | A.NOP loc -> + { empty + with stmts = [mkEmptyStmt ~ghost ~valid_sid ~loc (), [],[],[],[]]} | A.COMPUTATION (e, loc) -> CurrentLoc.set (convLoc loc); let (lasts, data) = !gnu_body_result in @@ -9222,7 +9006,7 @@ and doStatement local_env (s : A.statement) : chunk = let c = doBody local_env b in let b = c2block ~ghost c in b.battrs <- addAttributes [Attr(frama_c_keep_block,[])] b.battrs; - let res = s2c (mkStmt ~ghost (Block b)) in + let res = s2c (mkStmt ~ghost ~valid_sid (Block b)) in { res with cases = c.cases } | A.SEQUENCE (s1, s2, _) -> @@ -9319,7 +9103,7 @@ and doStatement local_env (s : A.statement) : chunk = in exitScope (); if has_decl then begin - let chunk = s2c (mkStmt ~ghost (Block (c2block ~ghost res))) + let chunk = s2c (mkStmt ~ghost ~valid_sid (Block (c2block ~ghost res))) in { chunk with cases = res.cases } end else res @@ -9444,10 +9228,10 @@ and doStatement local_env (s : A.statement) : chunk = match !gotoTargetData with | Some (switchv, switch) -> (* We have already generated this one *) (se - @@ (i2c(mkStmtOneInstr ~ghost + @@ (i2c(mkStmtOneInstr ~ghost ~valid_sid (Set (var switchv, makeCast e' intType, loc')), [],[],[]), ghost)) - @@ (s2c(mkStmt ~ghost (Goto (ref switch, loc'))), ghost) + @@ (s2c(mkStmt ~ghost ~valid_sid (Goto (ref switch, loc'))), ghost) | None -> begin (* Make a temporary variable *) @@ -9461,13 +9245,12 @@ and doStatement local_env (s : A.statement) : chunk = "Non-empty chunk in creating temporary for goto *"; let switchv, _ = try lookupVar "__compgoto" - with Not_found -> - Kernel.abort ~current:true "Cannot find temporary for goto *"; + with Not_found -> abort_context "Cannot find temporary for goto *"; in (* Make a switch statement. We'll fill in the statements at the * end of the function *) let switch = - mkStmt ~ghost + mkStmt ~ghost ~valid_sid (Switch (new_exp ~loc (Lval(var switchv)), mkBlock [], [], loc')) in @@ -9476,7 +9259,7 @@ and doStatement local_env (s : A.statement) : chunk = gotoTargetData := Some (switchv, switch); (se @@ (i2c - (mkStmtOneInstr ~ghost + (mkStmtOneInstr ~ghost ~valid_sid (Set (var switchv, makeCast e' intType, loc')),[],[],[]), ghost)) @@ (s2c switch, ghost) @@ -9529,7 +9312,7 @@ and doStatement local_env (s : A.statement) : chunk = let (r, se, e', _) = doExp local_env false e (AExp None) in - let se = add_reads e'.eloc r se in + let se = add_reads ~ghost e'.eloc r se in if not (isEmpty se) then stmts := !stmts @@ (se, ghost); (id, c, e')) @@ -9548,18 +9331,18 @@ and doStatement local_env (s : A.statement) : chunk = (tmpls, Some { asm_outputs; asm_inputs; asm_clobbers; asm_gotos }) in !stmts @@ - (i2c(mkStmtOneInstr ~ghost:local_env.is_ghost + (i2c(mkStmtOneInstr ~ghost:local_env.is_ghost ~valid_sid (Asm(attr', tmpls', ext_asm, loc')),[],[],[]), ghost) | THROW (e,loc) -> let loc' = convLoc loc in CurrentLoc.set loc'; (match e with - | None -> s2c (mkStmt ~ghost (Throw (None,loc'))) + | None -> s2c (mkStmt ~ghost ~valid_sid (Throw (None,loc'))) | Some e -> let se,e,t = doFullExp local_env false e (AExp None) in se @@ - (s2c (mkStmt ~ghost (Throw (Some (e,t),loc'))),ghost)) + (s2c (mkStmt ~ghost ~valid_sid (Throw (Some (e,t),loc'))),ghost)) | TRY_CATCH(stry,l,loc) -> let loc' = convLoc loc in CurrentLoc.set loc'; @@ -9584,7 +9367,9 @@ and doStatement local_env (s : A.statement) : chunk = (vi,c2block ~ghost chunk_catch) in let catches = List.map type_one_catch l in - s2c (mkStmt ~ghost (TryCatch(c2block ~ghost chunk_try,catches,loc'))) + s2c + (mkStmt + ~ghost ~valid_sid (TryCatch(c2block ~ghost chunk_try,catches,loc'))) | TRY_FINALLY (b, h, loc) -> let loc' = convLoc loc in CurrentLoc.set loc'; @@ -9593,7 +9378,7 @@ and doStatement local_env (s : A.statement) : chunk = if b'.cases <> [] || h'.cases <> [] then Kernel.error ~once:true ~current:true "Try statements cannot contain switch cases"; - s2c (mkStmt ~ghost + s2c (mkStmt ~ghost ~valid_sid (TryFinally (c2block ~ghost b', c2block ~ghost h', loc'))) | TRY_EXCEPT (b, e, h, loc) -> @@ -9619,7 +9404,7 @@ and doStatement local_env (s : A.statement) : chunk = s in let il' = stmt_to_instrs se.stmts in - s2c (mkStmt ~ghost + s2c (mkStmt ~ghost ~valid_sid (TryExcept (c2block ~ghost b',(il', e'), c2block ~ghost h', loc'))) | CODE_ANNOT (a, loc) -> @@ -9630,7 +9415,7 @@ and doStatement local_env (s : A.statement) : chunk = Ltyping.code_annot loc' local_env.known_behaviors (Ctype !currentReturnType) a in - s2c (mkStmtOneInstr ~ghost (Code_annot (typed_annot,loc'))) + s2c (mkStmtOneInstr ~ghost ~valid_sid (Code_annot (typed_annot,loc'))) with LogicTypeError ((source,_),msg) -> Kernel.warning ~source "%s. Ignoring code annotation" msg; BlockChunk.empty @@ -9644,7 +9429,7 @@ and doStatement local_env (s : A.statement) : chunk = Ltyping.code_annot loc' local_env.known_behaviors (Ctype !currentReturnType) (Logic_ptree.AStmtSpec ([],a)) in - s2c (mkStmtOneInstr ~ghost (Code_annot (spec,loc'))) + s2c (mkStmtOneInstr ~ghost ~valid_sid (Code_annot (spec,loc'))) with LogicTypeError ((source,_),msg) -> Kernel.warning ~source "%s. Ignoring code annotation" msg; BlockChunk.empty @@ -9728,7 +9513,6 @@ let convFile (f : A.file) : Cil_types.file = H.clear alreadyDefined; H.clear staticLocals; H.clear typedefs; - cleanup_isomorphicStructs (); H.clear alpha_renaming; Stack.clear packing_pragma_stack; current_packing_pragma := None; @@ -9744,8 +9528,7 @@ let convFile (f : A.file) : Cil_types.file = let local_env = ghost_local_env ghost in let s = doDecl local_env true d in if isNotEmpty s then - Kernel.abort ~current:true - "doDecl returns non-empty statement for global"; + abort_context "doDecl returns non-empty statement for global"; in List.iter doOneGlobal dl; let globals = fileGlobals () in @@ -9758,7 +9541,6 @@ let convFile (f : A.file) : Cil_types.file = H.clear alreadyDefined; H.clear compInfoNameEnv; H.clear enumInfoNameEnv; - cleanup_isomorphicStructs (); H.clear staticLocals; H.clear typedefs; H.clear env; diff --git a/src/kernel_internals/typing/cabs2cil.mli b/src/kernel_internals/typing/cabs2cil.mli index 129621b02ca0e2a6d0b65cf94b032f6a8389c84d..3b8242ed4c4f0ec2d90a30cb1049510d2e709954 100644 --- a/src/kernel_internals/typing/cabs2cil.mli +++ b/src/kernel_internals/typing/cabs2cil.mli @@ -145,6 +145,10 @@ val convFile: Cabs.file -> Cil_types.file processed. *) val frama_c_keep_block: string +(** Name of the attribute used to store the function that should be called + when the corresponding variable exits its scope. *) +val frama_c_destructor: string + (** A hook into the code that creates temporary local vars. By default this is the identity function, but you can overwrite it if you need to change the types of cabs2cil-introduced temp variables. *) @@ -215,19 +219,6 @@ val empty_local_env: local_env *) val ghost_local_env: bool -> local_env -(* [VP] Jessie plug-in needs this function to be exported - for semi-good reasons. *) -val blockInitializer : - local_env -> - Cil_types.varinfo -> Cabs.init_expression -> - Cil_types.block * Cil_types.init * Cil_types.typ - -(** Returns a block of statements equivalent to the initialization [init] - applied to lvalue [lval] of type [typ]. *) -val blockInit: - ghost:bool -> - Cil_types.lval -> Cil_types.init -> Cil_types.typ -> Cil_types.block - (** Applies [mkAddrOf] after marking variable whose address is taken. *) val mkAddrOfAndMark : Cil_types.location -> Cil_types.lval -> Cil_types.exp @@ -255,21 +246,20 @@ val integral_cast: Cil_types.typ -> Cil_types.term -> Cil_types.term *) val allow_return_collapse: tlv:Cil_types.typ -> tf:Cil_types.typ -> bool -val compatibleTypes: Cil_types.typ -> Cil_types.typ -> Cil_types.typ -(** Check that the two given types are compatible (C99, 6.2.7), and - return their composite type. Raise [Failure] with an explanation - if the two types are not compatible - - @since Oxygen-20120901 -*) - val areCompatibleTypes: Cil_types.typ -> Cil_types.typ -> bool (** Check that the two given types are compatible (C99, 6.2.7) @since Neon-20140301 - @modify Frama-C+dev + @modify Phosphorus-20170501-beta1 *) +val stmtFallsThrough: Cil_types.stmt -> bool +(** returns [true] if the given statement can fall through the next + syntactical one. + + @since Phosphorus-20170501-beta1 exported + *) + (* Local Variables: compile-command: "make -C ../../.." diff --git a/src/kernel_internals/typing/cfg.ml b/src/kernel_internals/typing/cfg.ml index 7bb00b18a2bf40f3069be0a750f27fd823c167f2..7b8bd459dae87178dff2eabf0d0c886a90e36b52 100644 --- a/src/kernel_internals/typing/cfg.ml +++ b/src/kernel_internals/typing/cfg.ml @@ -76,13 +76,57 @@ let findCaseLabeledStmts (b : block) : stmt list = ignore(visitCilBlock vis b); !slr +(* we might need to add a Skip statement at the end of a block in order + to avoid that a break close too many blocks, in particular when one + of such blocks is the scope of a VLA. +*) +type cfg_env = + { parent_block: block; + (* either the main function block or the innermost block containing a VLA.*) + is_last: bool list; (* is the current statement the last of the block? + we actually keep a stack indicating, for each block + containing the VLA, if the statement is the last of + that block. *) } + +let init_env parent_block = + { parent_block; is_last = [false] } + +let is_last env = List.fold_left (&&) true env.is_last + +let innermost_last env = + match env.is_last with + | [] -> assert false (* we always have at least one element. *) + | _ :: tl -> { env with is_last = true :: tl } + +let innermost_nonlast env = + match env.is_last with + | [] -> assert false (* we always have at least one element. *) + | _ :: tl -> { env with is_last = false :: tl } + +let update_env env block = + if List.exists + (fun v -> Cil.hasAttribute Cabs2cil.frama_c_destructor v.vattr) + block.blocals + then init_env block + else { env with is_last = false :: env.is_last } + +let requires_new_stmt env = + is_last env && + List.exists + (fun v -> Cil.hasAttribute Cabs2cil.frama_c_destructor v.vattr) + env.parent_block.blocals + +let make_break_stmt loc env next = + if requires_new_stmt env then + Some (Cil.mkStmtOneInstr ~valid_sid:false (Skip loc)) + else next (** Compute a control flow graph for fd. All the stmts in fd have their preds and succs fields filled in. The summary fields of fundec are also filled. *) let rec cfgFun (fd : fundec) = nodeList := []; - cfgBlock fd.sbody None None None; + cfgBlock (init_env fd.sbody) fd.sbody None None None; fd.smaxstmtid <- Some(Cil.Sid.next ()); fd.sallstmts <- List.rev !nodeList; nodeList := [] @@ -96,13 +140,13 @@ let rec cfgFun (fd : fundec) = No predecessors means it is the start of the function 3) We use the fact that initially all the succs and preds are assigned [] *) -and cfgStmts (ss: stmt list) next break cont = +and cfgStmts env (ss: stmt list) next break cont = match ss with [] -> (); - | [s] -> cfgStmt s next break cont + | [s] -> cfgStmt (innermost_last env) s next break cont | hd::tl -> - cfgStmt hd (Some (List.hd tl)) break cont; - cfgStmts tl next break cont + cfgStmt env hd (Some (List.hd tl)) break cont; + cfgStmts env tl next break cont (* Fill in the CFG info for the stmts in a block next = succ of the last stmt in this block @@ -111,12 +155,12 @@ and cfgStmts (ss: stmt list) next break cont = None means the succ is the function return. It does not mean the break/cont is invalid. We assume the validity has already been checked. *) -and cfgBlock (blk: block) next break cont = - cfgStmts blk.bstmts next break cont +and cfgBlock env (blk: block) next break cont = + cfgStmts (update_env env blk) blk.bstmts next break cont (* Fill in the CFG info for a stmt Meaning of next, break, cont should be clear from earlier comment *) -and cfgStmt (s: stmt) next break cont = +and cfgStmt env (s: stmt) next break cont = if s.sid = -1 then s.sid <- Cil.Sid.next (); nodeList := s :: !nodeList; if s.succs <> [] then @@ -147,13 +191,28 @@ and cfgStmt (s: stmt) next break cont = [] -> addSucc next | hd::_ -> addSucc hd in - let cfgCatch c next break cont = + let cfgCatch env c next break cont = match c with | Catch_all -> () | Catch_exn(_,l) -> - let cfg_aux_clause (_,b) = cfgBlock b next break cont in + let cfg_aux_clause (_,b) = cfgBlock env b next break cont in List.iter cfg_aux_clause l in + let add_stmt_if_needed env s = + if requires_new_stmt env then begin + match s with + | None -> assert false + (* we have explicitly created a statement as target of break *) + | Some stmt -> + match stmt.preds with + | [] -> () + | _ -> + (* we have used this statement as target of a break. Let's add it + properly in the block. *) + env.parent_block.bstmts <- env.parent_block.bstmts @ [ stmt ]; + cfgStmt env stmt next break cont + end + in let instrFallsThrough (i : instr) : bool = match i with Call (_, {enode = Lval (Var vf, NoOffset)}, _, _) -> (* See if this has the noreturn attribute *) @@ -177,18 +236,19 @@ and cfgStmt (s: stmt) next break cont = first. *) addBlockSucc blk2; addBlockSucc blk1; - cfgBlock blk1 next break cont; - cfgBlock blk2 next break cont + cfgBlock env blk1 next break cont; + cfgBlock env blk2 next break cont | UnspecifiedSequence seq -> addBlockSucc (block_from_unspecified_sequence seq); - cfgBlock (block_from_unspecified_sequence seq) next break cont + cfgBlock env (block_from_unspecified_sequence seq) next break cont | Block b -> addBlockSucc b; - cfgBlock b next break cont + cfgBlock env b next break cont - | Switch(_,blk,_l,_) -> - let bl = findCaseLabeledStmts blk in + | Switch(_,blk,_l,loc) -> + let break = make_break_stmt loc env next in + let bl = findCaseLabeledStmts blk in (* if there's no default, need to connect s->next *) if not (List.exists (fun stmt -> List.exists @@ -199,10 +259,17 @@ and cfgStmt (s: stmt) next break cont = (* Then add cases, that will come first in final 'succs' list. bl is already reversed, so the order is ok. *) List.iter addSucc bl; - cfgBlock blk next next cont - | Loop(_,blk,_,_,_) -> - addBlockSuccFull s blk; - cfgBlock blk (Some s) next (Some s) + (* we are ready to add a statement when needed. Hence we're not the + last statement of a block with VLA scope. + *) + cfgBlock (innermost_nonlast env) blk next break cont; + add_stmt_if_needed env break; + | Loop(_,blk,loc,_,_) -> + let break = make_break_stmt loc env next in + addBlockSuccFull s blk; + (* see above. *) + cfgBlock (innermost_nonlast env) blk (Some s) break (Some s); + add_stmt_if_needed env break (* Since all loops have terminating condition true, we don't put any direct successor to stmt following the loop *) @@ -213,7 +280,7 @@ and cfgStmt (s: stmt) next break cont = if there is a throw directly in the function. See cil_types.mli for more information. *) addBlockSucc t; - cfgBlock t next break cont; + cfgBlock env t next break cont; (* If there are some auxiliary types caught by the clause, the cfg goes from the conversion block to the main block of the catch clause *) List.iter @@ -223,7 +290,7 @@ and cfgStmt (s: stmt) next break cont = | [] -> next | s::_ -> Some s in - cfgCatch c n break cont; cfgBlock b next break cont) c; + cfgCatch env c n break cont; cfgBlock env b next break cont) c; | TryExcept _ | TryFinally _ -> Kernel.fatal "try/except/finally" @@ -492,7 +559,7 @@ let xform_switch_block ?(keepSwitch=false) b = (Printf.sprintf "switch_%d_break" label_index), l, false)] ; (* The default case, if present, must be used only if *all* - non-default cases fail [ISO/IEC 9899:1999, §6.8.4.2, ¶5]. As a + non-default cases fail [ISO/IEC 9899:1999, §6.8.4.2, ¶5]. As a result, we sort the order in which we handle the labels (but not the order in which we print out the statements, so fall-through still works as expected). *) diff --git a/src/kernel_internals/typing/infer_annotations.ml b/src/kernel_internals/typing/infer_annotations.ml index 0cc78b649ac6d0c1c0e26cdc46528917ce01343c..8409f8e2b176ec9ee3621a8e154ba889b1e6a4b9 100644 --- a/src/kernel_internals/typing/infer_annotations.ml +++ b/src/kernel_internals/typing/infer_annotations.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_internals/typing/infer_annotations.mli b/src/kernel_internals/typing/infer_annotations.mli index ca875dbe9d9bd1a98f496009d1fb1b5654291360..fbcba6380edb1d31a8855678a12025c6f1d4848f 100644 --- a/src/kernel_internals/typing/infer_annotations.mli +++ b/src/kernel_internals/typing/infer_annotations.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -22,5 +22,4 @@ (** Generation of possible assigns from the C prototype of a function. *) -val assigns_from_prototype: - Kernel_function.t -> Cil_types.identified_term Cil_types.from list +val assigns_from_prototype: Kernel_function.t -> Cil_types.from list diff --git a/src/kernel_internals/typing/logic_builtin.ml b/src/kernel_internals/typing/logic_builtin.ml index b937d6b16ba370e739635dc593cfc2cdb722894f..5b2688c707475cf54532b0146bf77e9e46d6b4ba 100644 --- a/src/kernel_internals/typing/logic_builtin.ml +++ b/src/kernel_internals/typing/logic_builtin.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -121,50 +121,50 @@ let init = let _list_of_integer = Ltype (list, [Linteger]) in (* predicates *) List.iter - (fun (f,tparams,params) -> + (fun (f,tparams,labels,params) -> add { bl_name = f; bl_params = tparams; bl_profile = params; - bl_type = None; bl_labels = []}) - [ "\\is_finite", [], ["x", float_type] ; - "\\is_finite", [], ["x", double_type] ; - "\\is_finite", [], ["x", long_double_type] ; - "\\is_infinite", [], ["x", float_type] ; - "\\is_infinite", [], ["x", double_type] ; - "\\is_infinite", [], ["x", long_double_type] ; - "\\is_NaN", [], ["x", float_type] ; - "\\is_NaN", [], ["x", double_type] ; - "\\is_NaN", [], ["x", long_double_type] ; - "\\is_minus_infinity", [], ["x", float_type] ; - "\\is_minus_infinity", [], ["x", double_type] ; - "\\is_minus_infinity", [], ["x", long_double_type] ; - "\\is_plus_infinity", [], ["x", float_type] ; - "\\is_plus_infinity", [], ["x", double_type] ; - "\\is_plus_infinity", [], ["x", long_double_type] ; - "\\le_float", [], ["x", float_type; "y", float_type]; - "\\lt_float", [], ["x", float_type; "y", float_type]; - "\\ge_float", [], ["x", float_type; "y", float_type]; - "\\gt_float", [], ["x", float_type; "y", float_type]; - "\\eq_float", [], ["x", float_type; "y", float_type]; - "\\ne_float", [], ["x", float_type; "y", float_type]; - "\\le_float", [], ["x", double_type; "y", double_type]; - "\\lt_float", [], ["x", double_type; "y", double_type]; - "\\ge_float", [], ["x", double_type; "y", double_type]; - "\\gt_float", [], ["x", double_type; "y", double_type]; - "\\eq_float", [], ["x", double_type; "y", double_type]; - "\\ne_float", [], ["x", double_type; "y", double_type]; - "\\no_overflow_single", [], ["m", rounding_mode; "x", Lreal] ; - "\\no_overflow_double", [], ["m", rounding_mode; "x", Lreal] ; - "\\subset", [a_name], ["s1", set_of_a_type; + bl_type = None; bl_labels = labels}) + [ "\\is_finite", [], [], ["x", float_type] ; + "\\is_finite", [], [], ["x", double_type] ; + "\\is_finite", [], [], ["x", long_double_type] ; + "\\is_infinite", [], [], ["x", float_type] ; + "\\is_infinite", [], [], ["x", double_type] ; + "\\is_infinite", [], [], ["x", long_double_type] ; + "\\is_NaN", [], [], ["x", float_type] ; + "\\is_NaN", [], [], ["x", double_type] ; + "\\is_NaN", [], [], ["x", long_double_type] ; + "\\is_minus_infinity", [], [], ["x", float_type] ; + "\\is_minus_infinity", [], [], ["x", double_type] ; + "\\is_minus_infinity", [], [], ["x", long_double_type] ; + "\\is_plus_infinity", [], [], ["x", float_type] ; + "\\is_plus_infinity", [], [], ["x", double_type] ; + "\\is_plus_infinity", [], [], ["x", long_double_type] ; + "\\le_float", [], [], ["x", float_type; "y", float_type]; + "\\lt_float", [], [], ["x", float_type; "y", float_type]; + "\\ge_float", [], [], ["x", float_type; "y", float_type]; + "\\gt_float", [], [], ["x", float_type; "y", float_type]; + "\\eq_float", [], [], ["x", float_type; "y", float_type]; + "\\ne_float", [], [], ["x", float_type; "y", float_type]; + "\\le_float", [], [], ["x", double_type; "y", double_type]; + "\\lt_float", [], [], ["x", double_type; "y", double_type]; + "\\ge_float", [], [], ["x", double_type; "y", double_type]; + "\\gt_float", [], [], ["x", double_type; "y", double_type]; + "\\eq_float", [], [], ["x", double_type; "y", double_type]; + "\\ne_float", [], [], ["x", double_type; "y", double_type]; + "\\no_overflow_single", [], [], ["m", rounding_mode; "x", Lreal] ; + "\\no_overflow_double", [], [], ["m", rounding_mode; "x", Lreal] ; + "\\subset", [a_name], [], ["s1", set_of_a_type; "s2", set_of_a_type]; - "\\pointer_comparable", [], [("p1", object_ptr); + "\\pointer_comparable", [], [], [("p1", object_ptr); ("p2", object_ptr)]; - "\\pointer_comparable", [], [("p1", fun_ptr); + "\\pointer_comparable", [], [], [("p1", fun_ptr); ("p2", fun_ptr)]; - "\\pointer_comparable", [], [("p1", fun_ptr); + "\\pointer_comparable", [], [], [("p1", fun_ptr); ("p2", object_ptr)]; - "\\pointer_comparable", [], [("p1", object_ptr); + "\\pointer_comparable", [], [], [("p1", object_ptr); ("p2", fun_ptr)]; - "\\points_to_valid_string", [], ["p", object_ptr]; - "\\warning", [], [("str", string_type)]; + "\\points_to_valid_string", [], [], ["p", object_ptr]; + "\\warning", [], [FormalLabel "L"], [("str", string_type)]; ]; (* functions *) List.iter diff --git a/src/kernel_internals/typing/logic_builtin.mli b/src/kernel_internals/typing/logic_builtin.mli index 4baaa688c62cfba079c54517824363424b7df2a7..00f99e5f098e44859629422594b60d4f5a96fa0a 100644 --- a/src/kernel_internals/typing/logic_builtin.mli +++ b/src/kernel_internals/typing/logic_builtin.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/kernel_internals/typing/mergecil.ml b/src/kernel_internals/typing/mergecil.ml index 32309304478982173f7e0fb7ef3335f348e78182..dc09d1580bec2d6c559fcb17f5fc1ecdc5fdf722 100644 --- a/src/kernel_internals/typing/mergecil.ml +++ b/src/kernel_internals/typing/mergecil.ml @@ -405,6 +405,39 @@ module PlainMerging = let output = Format.pp_print_string end) +module LogicMerging = + Merging + (struct + type t = logic_info + let hash li = + Hashtbl.hash li.l_var_info.lv_name + 3 * List.length li.l_profile + let equal li1 li2 = + Datatype.String.equal li1.l_var_info.lv_name li2.l_var_info.lv_name + && + Logic_utils.is_same_logic_profile li1 li2 + let compare li1 li2 = + let res = + String.compare li1.l_var_info.lv_name li2.l_var_info.lv_name + in + if res <> 0 then res + else + let rec aux l1 l2 = + match l1, l2 with + | [], [] -> 0 + | _, [] -> 1 + | [], _ -> -1 + | h1::t1, h2::t2 -> + let res = + Cil_datatype.Logic_type_ByName.compare h1.lv_type h2.lv_type + in + if res <> 0 then res + else aux t1 t2 + in + aux li1.l_profile li2.l_profile + let merge_synonym _ = true + let output = Cil_datatype.Logic_info.pretty + end) + type volatile_kind = R | W let equal_volatile_kind v1 v2 = @@ -558,7 +591,7 @@ let eEq = EnumMerging.create_eq_table 111 (* Enums *) let tEq = PlainMerging.create_eq_table 111 (* Type names*) let iEq = PlainMerging.create_eq_table 111 (* Inlines *) -let lfEq = PlainMerging.create_eq_table 111 (* Logic functions *) +let lfEq = LogicMerging.create_eq_table 111 (* Logic functions *) let ltEq = PlainMerging.create_eq_table 111 (* Logic types *) let lcEq = PlainMerging.create_eq_table 111 (* Logic constructors *) @@ -576,7 +609,7 @@ let iSyn = PlainMerging.create_syn_table 111 let sSyn = PlainMerging.create_syn_table 111 let eSyn = EnumMerging.create_syn_table 111 let tSyn = PlainMerging.create_syn_table 111 -let lfSyn = PlainMerging.create_syn_table 111 +let lfSyn = LogicMerging.create_syn_table 111 let ltSyn = PlainMerging.create_syn_table 111 let lcSyn = PlainMerging.create_syn_table 111 let laSyn = PlainMerging.create_syn_table 111 @@ -711,7 +744,7 @@ let init ?(all=true) () = PlainMerging.clear_eq tEq; PlainMerging.clear_eq iEq; - PlainMerging.clear_eq lfEq; + LogicMerging.clear_eq lfEq; PlainMerging.clear_eq ltEq; PlainMerging.clear_eq lcEq; PlainMerging.clear_eq laEq; @@ -725,7 +758,7 @@ let init ?(all=true) () = PlainMerging.clear_syn tSyn; PlainMerging.clear_syn iSyn; - PlainMerging.clear_syn lfSyn; + LogicMerging.clear_syn lfSyn; PlainMerging.clear_syn ltSyn; PlainMerging.clear_syn lcSyn; PlainMerging.clear_syn laSyn; @@ -812,18 +845,18 @@ let rec global_annot_pass1 g = match g with | Dfun_or_pred (li,l) -> CurrentLoc.set l; let mynode = - PlainMerging.getNode - lfEq lfSyn !currentFidx li.l_var_info.lv_name li None + LogicMerging.getNode + lfEq lfSyn !currentFidx li li None in (* NB: in case of mix decl/def it is the decl location that is taken. *) if mynode.nloc = None then ignore - (PlainMerging.getNode lfEq lfSyn !currentFidx li.l_var_info.lv_name li + (LogicMerging.getNode lfEq lfSyn !currentFidx li li (Some (l, !currentDeclIdx))) | Dtype_annot (pi,l) -> CurrentLoc.set l; - ignore (PlainMerging.getNode - lfEq lfSyn !currentFidx pi.l_var_info.lv_name pi + ignore (LogicMerging.getNode + lfEq lfSyn !currentFidx pi pi (Some (l, !currentDeclIdx))) | Dmodel_annot (mfi,l) -> CurrentLoc.set l; @@ -838,8 +871,8 @@ let rec global_annot_pass1 g = match g with (Some (l, !currentDeclIdx))) | Dinvariant (pi,l) -> CurrentLoc.set l; - ignore (PlainMerging.getNode - lfEq lfSyn !currentFidx pi.l_var_info.lv_name pi + ignore (LogicMerging.getNode + lfEq lfSyn !currentFidx pi pi (Some (l, !currentDeclIdx))) | Dtype (info,l) -> CurrentLoc.set l; @@ -1323,10 +1356,10 @@ let has_static_ref_logic_function lf_info = let matchLogicInfo oldfidx oldpi fidx pi = let oldtnode = - PlainMerging.getNode lfEq lfSyn oldfidx oldpi.l_var_info.lv_name oldpi None + LogicMerging.getNode lfEq lfSyn oldfidx oldpi oldpi None in let tnode = - PlainMerging.getNode lfEq lfSyn fidx pi.l_var_info.lv_name pi None + LogicMerging.getNode lfEq lfSyn fidx pi pi None in if oldtnode == tnode then (* We already know they are the same *) () @@ -1542,14 +1575,15 @@ let oneFilePass1 (f:file) : unit = Cil.update_var_type newrep.ndata (typeRemoveAttributes ["const"] newtype); end else Cil.update_var_type newrep.ndata newtype; - (* clean up the storage. *) - let newstorage = + (* clean up the storage. also update the location of the variable + declaration, but only if the new one should be preferred. *) + let newstorage, newdecl = match oldvi.vstorage, vi.vstorage with - | Static, (Static | Extern) -> Static - | NoStorage, NoStorage -> NoStorage - | NoStorage, Extern -> if oldvi.vdefined then NoStorage else Extern - | Extern, NoStorage when vi.vdefined -> NoStorage - | Extern, (Extern | NoStorage) -> Extern + | Static, (Static | Extern) -> Static, oldvi.vdecl + | NoStorage, NoStorage -> NoStorage, oldvi.vdecl + | NoStorage, Extern -> (if oldvi.vdefined then NoStorage else Extern), oldvi.vdecl + | Extern, NoStorage when vi.vdefined -> NoStorage, vi.vdecl + | Extern, (Extern | NoStorage) -> Extern, vi.vdecl | _ -> Kernel.abort ~current:true "Inconsistent storage specification for %s. \ @@ -1560,7 +1594,8 @@ let oneFilePass1 (f:file) : unit = Cil_printer.pp_location oldloc in newrep.ndata.vstorage <- newstorage; - newrep.ndata.vattr <- addAttributes oldvi.vattr vi.vattr + newrep.ndata.vattr <- addAttributes oldvi.vattr vi.vattr; + newrep.ndata.vdecl <- newdecl with Not_found -> (* Not present in the previous files. Remember it for later *) H.add vEnv vi.vname vinode @@ -1684,34 +1719,61 @@ let pp_profiles fmt li = fmt (List.map (fun v -> v.lv_type) li.l_profile) +let logic_info_of_logic_var lv = + let rec extract_tparams tparams = function + | Ctype _ | Linteger | Lreal -> tparams + | Ltype (_,l) -> List.fold_left extract_tparams tparams l + | Lvar s -> Datatype.String.Set.add s tparams + | Larrow (l,t) -> + List.fold_left extract_tparams (extract_tparams tparams t) l + in + let tparams = extract_tparams Datatype.String.Set.empty lv.lv_type in + let rt, args = + match lv.lv_type with + | Larrow (l, Ctype (TVoid _)) -> None, l + | Larrow(l,t) -> Some t, l + | Ctype (TVoid _) -> None, [] + | t -> Some t, [] + in + { l_var_info = lv; + l_labels = []; + l_tparams = Datatype.String.Set.elements tparams; + l_type = rt; + l_profile = List.map (Cil_const.make_logic_var_formal "") args; + l_body = LBnone + } + (** A visitor that renames uses of variables and types *) class renameVisitorClass = let rename_associated_logic_var lv = - match lv.lv_origin with - None -> - (match PlainMerging.findReplacement true lfEq !currentFidx lv.lv_name + match lv.lv_kind with + | LVGlobal -> + let li = logic_info_of_logic_var lv in + (match LogicMerging.findReplacement true lfEq !currentFidx li with | None -> DoChildren | Some (li,_) -> let lv' = li.l_var_info in if lv == lv' then DoChildren (* Replacement already done... *) else ChangeTo lv') - | Some vi -> - if not vi.vglob then DoChildren - else begin - match PlainMerging.findReplacement true vEq !currentFidx vi.vname - with - | None -> DoChildren - | Some (vi',_) -> - vi'.vreferenced <- true; - if vi == vi' then DoChildren (* replacement was done already*) - else begin - (match vi'.vlogic_var_assoc with - None -> - vi'.vlogic_var_assoc <- Some lv; DoChildren - | Some lv' -> ChangeTo lv') - end - end + | LVC -> + let vi = Extlib.the lv.lv_origin in + if not vi.vglob then DoChildren + else begin + match PlainMerging.findReplacement true vEq !currentFidx vi.vname + with + | None -> DoChildren + | Some (vi',_) -> + vi'.vreferenced <- true; + if vi == vi' then DoChildren (* replacement was done already*) + else begin + (match vi'.vlogic_var_assoc with + None -> + vi'.vlogic_var_assoc <- Some lv; DoChildren + | Some lv' -> ChangeTo lv') + end + end + | LVFormal | LVQuant | LVLocal -> DoChildren in let find_enumitem_replacement ei = match EnumMerging.findReplacement true eEq !currentFidx ei.eihost with @@ -1762,10 +1824,8 @@ object (self) method! vlogic_var_use lv = rename_associated_logic_var lv method! vlogic_info_use li = - match - PlainMerging.findReplacement true lfEq !currentFidx li.l_var_info.lv_name - with - None -> + match LogicMerging.findReplacement true lfEq !currentFidx li with + | None -> Kernel.debug ~level:2 ~dkey "Using logic function %s(%a)(%d)" li.l_var_info.lv_name (Pretty_utils.pp_list ~sep:",@ " Cil_printer.pp_logic_type) @@ -1780,10 +1840,7 @@ object (self) ChangeTo li' method! vlogic_info_decl li = - match - PlainMerging.findReplacement - true lfEq !currentFidx li.l_var_info.lv_name - with + match LogicMerging.findReplacement true lfEq !currentFidx li with None -> Kernel.debug ~level:2 ~dkey "Using logic function %s(%a)(%d)" li.l_var_info.lv_name pp_profiles li !currentFidx; @@ -2048,10 +2105,7 @@ let rec logic_annot_pass2 ~in_axiomatic g a = | Dfun_or_pred (li,l) -> begin CurrentLoc.set l; - match - PlainMerging.findReplacement - true lfEq !currentFidx li.l_var_info.lv_name - with + match LogicMerging.findReplacement true lfEq !currentFidx li with | None -> if not in_axiomatic then mergePushGlobals (visitCilGlobal renameVisitor g); @@ -2067,37 +2121,40 @@ let rec logic_annot_pass2 ~in_axiomatic g a = | None -> if not in_axiomatic then mergePushGlobals (visitCilGlobal renameVisitor g); - Logic_env.add_logic_type - t.lt_name + let def = (PlainMerging.find_eq_table ltEq (!currentFidx,t.lt_name)).ndata + in + Logic_env.add_logic_type t.lt_name def; + (match def.lt_def with + | Some (LTsum l) -> + List.iter (fun c -> Logic_env.add_logic_ctor c.ctor_name c) l + | Some (LTsyn _) + | None -> () + ) | Some _ -> () end - | Dinvariant ({l_var_info = {lv_name = n}},l) -> + | Dinvariant (li,l) -> begin CurrentLoc.set l; - match PlainMerging.findReplacement true lfEq !currentFidx n with + match LogicMerging.findReplacement true lfEq !currentFidx li with | None -> if in_axiomatic then Kernel.abort ~current:true "nested axiomatics are not allowed in ACSL"; mergePushGlobals (visitCilGlobal renameVisitor g); Logic_utils.add_logic_function - (PlainMerging.find_eq_table lfEq (!currentFidx,n)).ndata + (LogicMerging.find_eq_table lfEq (!currentFidx,li)).ndata | Some _ -> () end | Dtype_annot (n,l) -> begin CurrentLoc.set l; - match - PlainMerging.findReplacement - true lfEq !currentFidx n.l_var_info.lv_name - with + match LogicMerging.findReplacement true lfEq !currentFidx n with | None -> let g = visitCilGlobal renameVisitor g in if not in_axiomatic then mergePushGlobals g; Logic_utils.add_logic_function - (PlainMerging.find_eq_table - lfEq (!currentFidx,n.l_var_info.lv_name)).ndata + (LogicMerging.find_eq_table lfEq (!currentFidx,n)).ndata | Some _ -> () end | Dmodel_annot (mf,l) -> @@ -3097,7 +3154,7 @@ let merge (files: file list) (newname: string) : file = EnumMerging.doMergeSynonyms eSyn matchEnumInfo; doMergeSynonyms tSyn matchTypeInfo; - doMergeSynonyms lfSyn matchLogicInfo; + LogicMerging.doMergeSynonyms lfSyn matchLogicInfo; doMergeSynonyms ltSyn matchLogicType; doMergeSynonyms lcSyn matchLogicCtor; doMergeSynonyms laSyn matchLogicAxiomatic; diff --git a/src/kernel_internals/typing/oneret.ml b/src/kernel_internals/typing/oneret.ml index 0bebcd17f6646d53604d25f44fd875386501e4d8..7f2887414b80ed3d7d6138c0c35bf896499cfdfc 100644 --- a/src/kernel_internals/typing/oneret.ml +++ b/src/kernel_internals/typing/oneret.ml @@ -97,7 +97,29 @@ let adjust_assigns_clause loc var code_annot = | AStmtSpec (_,s) -> List.iter adjust_clause s.spec_behavior | _ -> () -let oneret (f: fundec) : unit = +type returns_clause = + Cil_types.stmt * Cil_types.behavior * Cil_types.identified_predicate + +type goto_annot = + Cil_types.stmt * Cil_types.code_annotation + +type callback = returns_clause -> goto_annot list -> unit + +let collect_returns (ca : Cil_types.code_annotation) = + match ca.annot_content with + | AStmtSpec(_bhvs,spec) -> + List.fold_left + (fun acc bhv -> + List.fold_left + (fun acc (kind,predicate) -> + match kind with + | Returns -> (bhv,predicate) :: acc + | _ -> acc + ) acc bhv.b_post_cond + ) [] spec.spec_behavior + | _ -> [] + +let oneret ?(callback: callback option) (f: fundec) : unit = let fname = f.svar.vname in (* Get the return type *) let retTyp = @@ -197,15 +219,19 @@ let oneret (f: fundec) : unit = TODO: split that into behaviors and generates for foo,bar: assert instead of plain assert. *) - let returns_clause_stack = Stack.create () in - let stmt_contract_stack = Stack.create () in - let rec popn n = - if n > 0 then begin - assert (not (Stack.is_empty returns_clause_stack)); - ignore (Stack.pop returns_clause_stack); - ignore (Stack.pop stmt_contract_stack); - popn (n-1) - end + let returns_stack : + (Cil_types.predicate * Cil_types.stmt * Cil_types.code_annotation) Stack.t + = Stack.create () in + let popn n = + try for _ = 1 to n do ignore (Stack.pop returns_stack) done + with Stack.Empty -> assert false + in + let to_callback = Hashtbl.create 8 in + let do_callback cb = Hashtbl.iter (fun _ (ca,gs) -> cb ca gs) to_callback in + let register_goto (ca : returns_clause) (gc : goto_annot) = + let (_,_, { ip_id }) = ca in + let gs = try snd (Hashtbl.find to_callback ip_id) with Not_found -> [] in + Hashtbl.replace to_callback ip_id (ca,gc::gs) in (* Now scan all the statements. Know if you are the main body of the * function and be prepared to add new statements at the end. @@ -254,14 +280,16 @@ let oneret (f: fundec) : unit = | None -> Instr (Skip loc) end; let returns_assert = ref ptrue in - Stack.iter (fun p -> returns_assert := pand ~loc (p, !returns_assert)) - returns_clause_stack; + Stack.iter + (fun (p,_,_) -> returns_assert := pand ~loc (p, !returns_assert)) + returns_stack; (match retval with - | Some _ -> - Stack.iter - (adjust_assigns_clause loc (Cil.cvar_to_lvar (getRetVar()))) - stmt_contract_stack; - | None -> () (* There's no \result: no need to adjust it *) + | Some _ -> + let lvar = Cil.cvar_to_lvar (getRetVar()) in + Stack.iter + (fun (_,_,ca) -> adjust_assigns_clause loc lvar ca.annot_content) + returns_stack + | None -> () (* There's no \result: no need to adjust it *) ); (* See if this is the last statement in function, and we don't have a statement contract above us. In that last case, it is best @@ -289,6 +317,14 @@ let oneret (f: fundec) : unit = | p -> let a = Logic_const.new_code_annotation (AAssert ([],p)) in let sta = mkStmt (Instr (Code_annot (a,loc))) in + if callback<>None then + ( let gclause = sta , a in + Stack.iter + (fun (_,str,ca) -> + List.iter + (fun (bhv,ret) -> register_goto (str,bhv,ret) gclause) + (collect_returns ca) + ) returns_stack ) ; [ s; sta; sg ] in let s = mkStmt (Block (mkBlock b_stmts)) in @@ -353,8 +389,7 @@ let oneret (f: fundec) : unit = :: rests -> let returns = assert_of_returns ca in let returns = Logic_utils.translate_old_label s returns in - Stack.push returns returns_clause_stack; - Stack.push ca.annot_content stmt_contract_stack; + Stack.push (returns,s,ca) returns_stack; scanStmts (s::acc) mainbody (popstack + 1) rests | { skind = Instr (Code_annot _) } as s :: rests -> scanStmts (s::acc) mainbody popstack rests @@ -379,7 +414,8 @@ let oneret (f: fundec) : unit = ignore (visitCilBlock dummyVisitor f.sbody) ; *)(* sets CurrentLoc *) (*CEA so, [scanBlock] will set [lastloc] when necessary lastloc := !currentLoc ; *) (* last location in the function *) - f.sbody <- scanBlock true f.sbody + f.sbody <- scanBlock true f.sbody ; + Extlib.may do_callback callback (* Local Variables: diff --git a/src/kernel_internals/typing/oneret.mli b/src/kernel_internals/typing/oneret.mli index f887b231b517d3804d90b68e0851e50780a5f9b3..4398db04a69876172e3157b2d6df70d4cb5481ae 100644 --- a/src/kernel_internals/typing/oneret.mli +++ b/src/kernel_internals/typing/oneret.mli @@ -79,9 +79,20 @@ *) +type returns_clause = + Cil_types.stmt * Cil_types.behavior * Cil_types.identified_predicate + +type goto_annot = + Cil_types.stmt * Cil_types.code_annotation + +type callback = returns_clause -> goto_annot list -> unit + (** Make sure that there is only one Return statement in the whole body. Replace all the other returns with Goto. Make sure that there is a return if the function is supposed to return something, and it is not declared to - not return. *) -val oneret: Cil_types.fundec -> unit + not return. + @modify Phosphorus-20170501+dev The [~callback], when provided, + is invoked with all the original returns clauses and their associated + annotation on inserted gotos. *) +val oneret: ?callback:callback -> Cil_types.fundec -> unit diff --git a/src/kernel_internals/typing/rmtmps.ml b/src/kernel_internals/typing/rmtmps.ml index c9b524172d45e0b2276a289afc2c027561a21126..3012fcd3f50dfeec12288de35751b76e49285c3c 100644 --- a/src/kernel_internals/typing/rmtmps.ml +++ b/src/kernel_internals/typing/rmtmps.ml @@ -624,8 +624,9 @@ class markUsedLabels is_removable (labelMap: (string, unit) H.t) = (* Mark it as used *) H.replace labelMap ln () in -let keep_label_logic = - function LogicLabel _ -> () | StmtLabel dest -> keep_label dest +let keep_label_logic = function + | FormalLabel _ | BuiltinLabel _ -> () + | StmtLabel dest -> keep_label dest in object inherit nopCilVisitor @@ -640,7 +641,7 @@ object match t with | Tat (_,lab) -> keep_label_logic lab | Tapp(_,labs,_) -> - let labs = snd (List.split labs) in List.iter keep_label_logic labs + List.iter keep_label_logic labs | _ -> () end; DoChildren @@ -650,7 +651,7 @@ object match t with | Pat (_,lab) -> keep_label_logic lab | Papp(_,labs,_) -> - let labs = snd (List.split labs) in List.iter keep_label_logic labs + List.iter keep_label_logic labs | _ -> () end; DoChildren diff --git a/src/kernel_internals/typing/translate_lightweight.ml b/src/kernel_internals/typing/translate_lightweight.ml index 6f5788ad9729eafd0f27781cee068628c987590c..868ba4a9e0a46bdd6c2ddcf3f2e223398d43bf3f 100644 --- a/src/kernel_internals/typing/translate_lightweight.ml +++ b/src/kernel_internals/typing/translate_lightweight.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -117,7 +117,7 @@ class annotateFunFromDeclspec = let labels = match p.l_labels with | [] -> [] - | [l] -> [ l, Logic_const.here_label ] + | [_] -> [ Logic_const.here_label ] | _ -> assert false in let args = term_of_var v :: args in diff --git a/src/kernel_internals/typing/translate_lightweight.mli b/src/kernel_internals/typing/translate_lightweight.mli index 4c5b88b2c161e1e6e019f5307526a3a1f078bef0..4e8c010551ce514fecff0c31e67706efa1d13588 100644 --- a/src/kernel_internals/typing/translate_lightweight.mli +++ b/src/kernel_internals/typing/translate_lightweight.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/kernel_internals/typing/unroll_loops.ml b/src/kernel_internals/typing/unroll_loops.ml index be6b4166d9191dcf08cdc839552496e094a2e772..1e60dc82d5444f0f6248f6e910b32cc3fc83f826 100644 --- a/src/kernel_internals/typing/unroll_loops.ml +++ b/src/kernel_internals/typing/unroll_loops.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -123,6 +123,16 @@ let refresh_vars old_var new_var = method! vvrbl vi = try ChangeTo (snd (List.find (fun (x,_) -> x.vid = vi.vid) assoc)) with Not_found -> SkipChildren + + method! vexpr e = + (* Since we are not using a refresh or copy visitor, we must refresh + eids ourselves *) + let do_post e' = + if e'.enode != e.enode then + Cil.new_exp ~loc:e.eloc e'.enode + else e + in + DoChildrenPost do_post end in fun b -> ignore (Visitor.visitFramacBlock visit b) @@ -193,8 +203,8 @@ let copy_annotations kf assoc labelled_stmt_tbl (break_continue_must_change, stm let new_stmt = Cil_datatype.Stmt.Map.find !stmt labelled_stmt_tbl in ChangeTo (StmtLabel (ref new_stmt)) with Not_found -> SkipChildren) ; - | LogicLabel (None, _str) -> SkipChildren - | LogicLabel (Some _stmt, str) -> ChangeTo (LogicLabel (None, str)) + | BuiltinLabel (None, _) | FormalLabel _ -> SkipChildren + | BuiltinLabel (Some _stmt, l) -> ChangeTo (BuiltinLabel (None, l)) end in visitCilCodeAnnotation (visitor:>cilVisitor) (Logic_const.refresh_code_annotation a) in @@ -255,8 +265,8 @@ let update_loop_current kf loop_current block = initializer self#set_current_kf kf method! vlogic_label = function - | LogicLabel(_,"LoopCurrent") -> ChangeTo (StmtLabel (ref loop_current)) - | _ -> DoChildren + | BuiltinLabel (_, LoopCurrent) -> ChangeTo (StmtLabel (ref loop_current)) + | BuiltinLabel _ | FormalLabel _ | StmtLabel _ -> DoChildren method! vstmt_aux s = match s.skind with | Loop _ -> SkipChildren (* loop init and current are not the same here. *) @@ -270,8 +280,8 @@ let update_loop_entry kf loop_entry stmt = initializer self#set_current_kf kf method! vlogic_label = function - | LogicLabel(_,"LoopEntry") -> ChangeTo (StmtLabel (ref loop_entry)) - | _ -> DoChildren + | BuiltinLabel (_, LoopEntry) -> ChangeTo (StmtLabel (ref loop_entry)) + | BuiltinLabel _ | FormalLabel _ | StmtLabel _ -> DoChildren method! vstmt_aux s = match s.skind with | Loop _ -> SkipChildren (* loop init and current are not the same here. *) @@ -279,9 +289,24 @@ let update_loop_entry kf loop_entry stmt = end in ignore (Visitor.visitFramacStmt vis stmt) -(* Deep copy of a block taking care of local gotos and labels into C code and - annotations. *) -let copy_block kf break_continue_must_change bl = + +(* Action to be performed when copying switch labels (Case and Default): + - Copy: if we are copying the entire switch statement, then copy the labels + as they are. + - Move: if we had not copied the switch statement, then avoid duplicating + the switch labels. For the first copy, move the label into the copied + statement (the first copy in the AST order is done by the last iteration). + - Ignore: For the other copies, ignore the switch label. *) +type switch_label_action = Ignore | Copy | Move + +let is_case_stmt s = List.exists Cil.is_case_label s.labels + +(* Deep copy of a block taking care of local gotos and labels into C code and + annotations. Also returns the statements with a switch label that have been + created to replace original switch cases. They must be set in the englobing + switch (outside the copy). *) +let copy_block kf switch_label_action break_continue_must_change bl = + let new_switch_cases = ref [] in let assoc = ref [] in let fundec = try Kernel_function.get_definition kf @@ -290,8 +315,8 @@ let copy_block kf break_continue_must_change bl = and labelled_stmt_tbl = Cil_datatype.Stmt.Map.empty and calls_tbl = Cil_datatype.Stmt.Map.empty in - let rec copy_stmt - break_continue_must_change labelled_stmt_tbl calls_tbl stmt = + let rec copy_stmt switch_label_action break_continue_must_change + labelled_stmt_tbl calls_tbl stmt = let result = { labels = []; sid = Sid.next (); @@ -300,35 +325,48 @@ let copy_block kf break_continue_must_change bl = skind = stmt.skind; ghost = stmt.ghost} in - let new_labels,labelled_stmt_tbl = + let labelled_stmt_tbl = if stmt.labels = [] then - [], labelled_stmt_tbl + labelled_stmt_tbl else let new_tbl = Cil_datatype.Stmt.Map.add stmt result labelled_stmt_tbl and new_labels = List.fold_left - (fun lbls -> function + (fun new_lbls -> function | Label (s, loc, gen) -> (if gen then fresh_label ~label_name:s () else fresh_label ~label_name:s ~loc () - ) :: lbls - - | Case _ | Default _ as lbl -> lbl :: lbls + ) :: new_lbls + | Case _ | Default _ as lbl -> + if switch_label_action = Ignore + then new_lbls + else lbl :: new_lbls ) [] stmt.labels - in new_labels, new_tbl + in + let () = + if switch_label_action = Move && is_case_stmt stmt then + (* Removes the switch label from the original statement. *) + let old_labels = + List.filter (fun l -> not (Cil.is_case_label l)) stmt.labels + in + stmt.labels <- old_labels; + new_switch_cases := result :: !new_switch_cases; + in + result.labels <- new_labels; + new_tbl in let new_calls_tbl = match stmt.skind with - | Instr(Call _) -> Cil_datatype.Stmt.Map.add stmt result calls_tbl + | Instr(Call _ | Local_init(_,ConsInit _,_)) -> + Cil_datatype.Stmt.Map.add stmt result calls_tbl | _ -> calls_tbl in let new_stmkind,new_labelled_stmt_tbl, new_calls_tbl = - copy_stmtkind + copy_stmtkind switch_label_action break_continue_must_change labelled_stmt_tbl new_calls_tbl stmt.skind in - if stmt.labels <> [] then result.labels <- new_labels; result.skind <- new_stmkind; if Annotations.has_code_annot stmt then begin @@ -339,8 +377,14 @@ let copy_block kf break_continue_must_change bl = end; result, new_labelled_stmt_tbl, new_calls_tbl - and copy_stmtkind - break_continue_must_change labelled_stmt_tbl calls_tbl stkind = + and copy_stmtkind + switch_label_action break_continue_must_change + labelled_stmt_tbl calls_tbl stkind = + let copy_block + ?(switch_label_action = switch_label_action) + ?(break_continue_must_change = break_continue_must_change) = + copy_block ~switch_label_action ~break_continue_must_change + in match stkind with | (Instr _ | Return _ | Throw _) as keep -> keep,labelled_stmt_tbl,calls_tbl @@ -348,17 +392,18 @@ let copy_block kf break_continue_must_change bl = | If (exp,bl1,bl2,loc) -> CurrentLoc.set loc; let new_block1,labelled_stmt_tbl,calls_tbl = - copy_block break_continue_must_change labelled_stmt_tbl calls_tbl bl1 + copy_block labelled_stmt_tbl calls_tbl bl1 in let new_block2,labelled_stmt_tbl,calls_tbl = - copy_block break_continue_must_change labelled_stmt_tbl calls_tbl bl2 + copy_block labelled_stmt_tbl calls_tbl bl2 in If(exp,new_block1,new_block2,loc),labelled_stmt_tbl,calls_tbl | Loop (a,bl,loc,_,_) -> CurrentLoc.set loc; let new_block,labelled_stmt_tbl,calls_tbl = copy_block - (None, None) (* from now on break and continue can be kept *) + (* from now on break and continue can be kept *) + ~break_continue_must_change:(None, None) labelled_stmt_tbl calls_tbl bl @@ -366,7 +411,7 @@ let copy_block kf break_continue_must_change bl = Loop (a,new_block,loc,None,None),labelled_stmt_tbl,calls_tbl | Block bl -> let new_block,labelled_stmt_tbl,calls_tbl = - copy_block break_continue_must_change labelled_stmt_tbl calls_tbl bl + copy_block labelled_stmt_tbl calls_tbl bl in Block (new_block),labelled_stmt_tbl,calls_tbl | UnspecifiedSequence seq -> @@ -378,8 +423,8 @@ let copy_block kf break_continue_must_change bl = List.fold_left (fun (seq,labelled_stmt_tbl,calls_tbl) (stmt,modified,writes,reads,calls) -> let stmt,labelled_stmt_tbl,calls_tbl = - copy_stmt - break_continue_must_change labelled_stmt_tbl calls_tbl stmt + copy_stmt switch_label_action break_continue_must_change + labelled_stmt_tbl calls_tbl stmt in (stmt,modified,writes,reads,change_calls calls calls_tbl)::seq, labelled_stmt_tbl,calls_tbl) @@ -403,7 +448,11 @@ let copy_block kf break_continue_must_change bl = | Switch (e,block,stmts,loc) -> (* from now on break only can be kept *) let new_block,new_labelled_stmt_tbl,calls_tbl = - copy_block (None, (snd break_continue_must_change)) labelled_stmt_tbl calls_tbl block + copy_block + (* Copy the switch labels, as the englobing switch is in the copy. *) + ~switch_label_action:Copy + ~break_continue_must_change:(None, (snd break_continue_must_change)) + labelled_stmt_tbl calls_tbl block in let stmts' = List.map @@ -411,15 +460,11 @@ let copy_block kf break_continue_must_change bl = in Switch(e,new_block,stmts',loc),new_labelled_stmt_tbl,calls_tbl | TryCatch(t,c,loc) -> - let t', labs, calls = - copy_block break_continue_must_change labelled_stmt_tbl calls_tbl t - in + let t', labs, calls = copy_block labelled_stmt_tbl calls_tbl t in let treat_one_extra_binding mv mv' (bindings, labs, calls) (v,b) = let v' = copy_var () v in assoc := (v,v')::!assoc; - let b', labs', calls' = - copy_block break_continue_must_change labs calls b - in + let b', labs', calls' = copy_block labs calls b in refresh_vars [mv; v] [mv'; v'] b'; (v',b')::bindings, labs', calls' in @@ -436,9 +481,7 @@ let copy_block kf break_continue_must_change bl = in Catch_exn(v', List.rev l'), [v], [v'], labs', calls' in - let (b', labs', calls') = - copy_block break_continue_must_change labs' calls' b - in + let (b', labs', calls') = copy_block labs' calls' b in refresh_vars vorig vnew b'; (v', b')::catches, labs', calls' in @@ -448,12 +491,15 @@ let copy_block kf break_continue_must_change bl = TryCatch(t',List.rev c',loc), labs', calls' | TryFinally _ | TryExcept _ -> assert false - and copy_block break_continue_must_change labelled_stmt_tbl calls_tbl bl = + and copy_block + ~switch_label_action ~break_continue_must_change + labelled_stmt_tbl calls_tbl bl = let new_stmts,labelled_stmt_tbl,calls_tbl = List.fold_left (fun (block_l,labelled_stmt_tbl,calls_tbl) v -> let new_block,labelled_stmt_tbl,calls_tbl = - copy_stmt break_continue_must_change labelled_stmt_tbl calls_tbl v + copy_stmt switch_label_action break_continue_must_change + labelled_stmt_tbl calls_tbl v in new_block::block_l, labelled_stmt_tbl,calls_tbl) ([],labelled_stmt_tbl,calls_tbl) @@ -471,10 +517,11 @@ let copy_block kf break_continue_must_change bl = in let new_block, labelled_stmt_tbl, _calls_tbl = (* [calls_tbl] is internal. No need to fix references afterwards here. *) - copy_block break_continue_must_change labelled_stmt_tbl calls_tbl bl + copy_block ~switch_label_action ~break_continue_must_change + labelled_stmt_tbl calls_tbl bl in List.iter (copy_annotations kf !assoc labelled_stmt_tbl) !annotated_stmts ; - update_gotos labelled_stmt_tbl new_block + update_gotos labelled_stmt_tbl new_block, !new_switch_cases let ast_has_changed = ref false @@ -484,7 +531,11 @@ class do_it global_find_init ((force:bool),(times:int)) = object(self) initializer ast_has_changed := false; (* We sometimes need to move labels between statements. This table maps the old statement to the new one *) - val moved_labels = Cil_datatype.Stmt.Hashtbl.create 17 + val moved_labels = Cil_datatype.Stmt.Hashtbl.create 17 + (* The statements with a switch label that have been created in the copy. + They must be added in the englobing switch, and the original statements + must be removed (their switch labels have been removed by [copy_block]. *) + val mutable cases = [] ; val mutable gotos = [] ; val mutable has_unrolled_loop = false ; @@ -496,7 +547,7 @@ class do_it global_find_init ((force:bool),(times:int)) = object(self) assert (gotos = []) ; assert (not has_unrolled_loop) ; let post_goto_updater = - (fun id -> + (fun id -> if has_unrolled_loop then begin List.iter (fun s -> match s.skind with Goto(sref,_loc) -> @@ -525,17 +576,29 @@ class do_it global_find_init ((force:bool),(times:int)) = object(self) let update s = if has_unrolled_loop then (match s.skind with - | Switch (e', b', lbls', loc') -> + | Switch (e', b', lbls', loc') -> let labels_moved = ref false in let update_label s = try let s = Cil_datatype.Stmt.Hashtbl.find moved_labels s in labels_moved := true ; s with Not_found -> s - in let moved_lbls = List.map update_label lbls' in - if !labels_moved then - s.skind <- Switch (e', b', moved_lbls, loc'); - | _ -> ()); + in let moved_lbls = List.map update_label lbls' in + let new_lbls = + if cases = [] + then moved_lbls + else + (* Removes the statements that have no more switch labels. *) + let lbls = List.filter is_case_stmt moved_lbls in + (* Adds the new statement with switch labels. *) + cases @ lbls + in + if !labels_moved || cases <> [] then begin + s.skind <- Switch (e', b', new_lbls, loc'); + (* Resets the statement to be added to the englobing switch. *) + cases <- []; + end + | _ -> ()); s in ChangeDoChildrenPost (s, update) @@ -576,14 +639,17 @@ class do_it global_find_init ((force:bool),(times:int)) = object(self) in let current_continue = ref (mk_continue ()) in let new_stmts = ref [sloop] in - for _i=0 to number-1 do + for i=0 to number-1 do new_stmts:=!current_continue::!new_stmts; - let new_block = - copy_block + let switch_label_action = if i = number-1 then Move else Ignore in + let new_block, new_switch_cases = + copy_block (Extlib.the self#current_kf) + switch_label_action ((Some break_lbl_stmt),(Some !current_continue)) block in + cases <- new_switch_cases @ cases; current_continue := mk_continue (); update_loop_current (Extlib.the self#current_kf) !current_continue new_block; (match new_block.blocals with @@ -605,7 +671,8 @@ class do_it global_find_init ((force:bool),(times:int)) = object(self) snew.labels <- sloop.labels; sloop.labels <- []; snew; - in new_stmt + in + new_stmt | _ -> assert false in let g sloop new_stmts = (* Adds "loop invariant \false;" to the remaining diff --git a/src/kernel_internals/typing/unroll_loops.mli b/src/kernel_internals/typing/unroll_loops.mli index 82c250f07c555503d0879f5216c60f484bffa3ce..d0ca1b80328c0161f1f1637b576ec85c1fa85c5c 100644 --- a/src/kernel_internals/typing/unroll_loops.mli +++ b/src/kernel_internals/typing/unroll_loops.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/abstract_interp.ml b/src/kernel_services/abstract_interp/abstract_interp.ml index a2cac39ea1525ff0f2ea1a4be437ac1c6f16d007..d054f6660c3366a7be15483d19d0950f60c2c754 100644 --- a/src/kernel_services/abstract_interp/abstract_interp.ml +++ b/src/kernel_services/abstract_interp/abstract_interp.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +exception Error_Top +exception Error_Bottom exception Not_less_than exception Can_not_subdiv @@ -63,191 +65,155 @@ module Comp = struct end -module Make_Lattice_Set(V:Lattice_Value): Lattice_Set with type O.elt = V.t = -struct - exception Error_Top - module O = struct - include Datatype.Set - (FCSet.Make(V)) - (V) - (struct let module_name = "Make_lattice_set" end) - end +module Make_Generic_Lattice_Set + (V: Datatype.S) + (Set: Lattice_type.Set with type elt = V.t) += struct - type t = Set of O.t | Top + type t = Set of Set.t | Top type set = t - type widen_hint = O.t + type widen_hint = Set.t - let bottom = Set O.empty + let bottom = Set Set.empty let top = Top - let hash c = match c with + let hash = function | Top -> 12373 | Set s -> - let f v acc = - 67 * acc + (V.hash v) - in - O.fold f s 17 + let f v acc = 67 * acc + (V.hash v) in + Set.fold f s 17 - let compare = - if O.compare == Datatype.undefined then ( - Kernel.debug "%s lattice_set, missing comparison function" - V.name; - Datatype.undefined - ) else - fun e1 e2 -> - if e1 == e2 then 0 - else - match e1,e2 with - | Top,_ -> 1 - | _, Top -> -1 - | Set e1,Set e2 -> O.compare e1 e2 + let equal e1 e2 = + e1 == e2 || + match e1, e2 with + | Top, Top -> true + | Set e1, Set e2 -> Set.equal e1 e2 + | Top, Set _ | Set _, Top -> false - let equal v1 v2 = - if v1 == v2 then true - else - match v1, v2 with - | Top, Top -> true - | Set e1, Set e2 -> O.equal e1 e2 - | Top, Set _ | Set _, Top -> false + let compare e1 e2 = + if e1 == e2 then 0 + else match e1, e2 with + | Top, _ -> 1 + | _, Top -> -1 + | Set e1, Set e2 -> Set.compare e1 e2 + + let widen _wh _t1 t2 = t2 + + (** This is exact *) + let join e1 e2 = + if e1 == e2 then e1 + else match e1, e2 with + | Top, _ | _, Top -> Top + | Set s1 , Set s2 -> Set (Set.union s1 s2) - let widen _wh _t1 t2 = (* [wh] isn't used *) - t2 + (** This is exact *) + let link = join (** This is exact *) let meet v1 v2 = if v1 == v2 then v1 - else - match v1,v2 with + else match v1,v2 with | Top, v | v, Top -> v - | Set s1 , Set s2 -> Set (O.inter s1 s2) + | Set s1 , Set s2 -> Set (Set.inter s1 s2) (** This is exact *) let narrow = meet - (** This is exact *) - let join v1 v2 = - if v1 == v2 then v1 - else - match v1,v2 with - | Top, _ | _, Top -> Top - | Set s1 , Set s2 -> - let u = O.union s1 s2 in - Set u + let is_included e1 e2 = + (e1 == e2) || + match e1,e2 with + | _, Top -> true + | Top, _ -> false + | Set s1, Set s2 -> Set.subset s1 s2 - (** This is exact *) - let link = join + let intersects e1 e2 = + match e1, e2 with + | _, Top | Top, _ -> true + | Set s1 , Set s2 -> Set.exists (fun e -> Set.mem e s2) s1 let cardinal_less_than s n = match s with | Top -> raise Not_less_than | Set s -> - let c = O.cardinal s in - if c > n - then raise Not_less_than; - c + let c = Set.cardinal s in + if c > n then raise Not_less_than; + c let cardinal_zero_or_one s = try ignore (cardinal_less_than s 1) ; true with Not_less_than -> false let inject s = Set s - let inject_singleton e = inject (O.singleton e) - let empty = inject O.empty + let inject_singleton e = inject (Set.singleton e) + let empty = inject Set.empty - let transform f = fun t1 t2 -> - match t1,t2 with + let project = function + | Top -> raise Error_Top + | Set s -> s + + let filter f = function + | Top -> Top + | Set s -> Set (Set.filter f s) + + let transform f e1 e2 = + match e1, e2 with | Top, _ | _, Top -> Top - | Set v1, Set v2 -> Set (f v1 v2) + | Set s1 , Set s2 -> Set (f s1 s2) - let map_set f s = - O.fold - (fun v -> O.add (f v)) - s - O.empty + let map_set f s = Set.fold (fun v -> Set.add (f v)) s Set.empty + + let fold f e init = match e with + | Top -> raise Error_Top + | Set s -> Set.fold f s init + + let iter f = function + | Top -> raise Error_Top + | Set s -> Set.iter f s + + let exists f = function + | Top -> true + | Set s -> Set.exists f s + + let for_all f = function + | Top -> false + | Set s -> Set.for_all f s + + let mem v = function + | Top -> true + | Set s -> Set.mem v s let apply2 f s1 s2 = let distribute_on_elements f s1 s2 = - O.fold - (fun v -> O.union (map_set (f v) s2)) - s1 - O.empty + Set.fold (fun v -> Set.union (map_set (f v) s2)) s1 Set.empty in transform (distribute_on_elements f) s1 s2 - let apply1 f s = match s with + let apply1 f = function | Top -> top - | Set s -> Set(map_set f s) + | Set s -> Set (map_set f s) - let pretty fmt t = - match t with + let pretty fmt = function | Top -> Format.fprintf fmt "TopSet" | Set s -> - if O.is_empty s then Format.fprintf fmt "BottomSet" + if Set.is_empty s then Format.fprintf fmt "BottomSet" else Pretty_utils.pp_iter - ~pre:"{" - ~suf:"}" + ~pre:"@[<hov 1>{" + ~suf:"}@]" ~sep:";@ " - O.iter + Set.iter (fun fmt v -> Format.fprintf fmt "@[%a@]" V.pretty v) - fmt s - - let is_included t1 t2 = - (t1 == t2) || - match t1,t2 with - | _,Top -> true - | Top,_ -> false - | Set s1,Set s2 -> O.subset s1 s2 - - let join_and_is_included t1 t2 = - let t12 = join t1 t2 in - (t12, equal t12 t2) - - let intersects t1 t2 = - let b = match t1,t2 with - | _,Top | Top,_ -> true - | Set s1,Set s2 -> - O.exists (fun e -> O.mem e s2) s1 - in - (* Format.printf - "[Lattice_Set]%a intersects %a: %b @\n" - pretty t1 pretty t2 b;*) - b - - let fold f elt init = match elt with - | Top -> raise Error_Top - | Set v -> O.fold f v init - - - let iter f elt = match elt with - | Top -> raise Error_Top - | Set v -> O.iter f v - - let exists f = function - | Top -> true - | Set s -> O.exists f s - - let for_all f = function - | Top -> false - | Set s -> O.for_all f s - - let project o = match o with - | Top -> raise Error_Top - | Set v -> v - - let mem v s = match s with - | Top -> true - | Set s -> O.mem v s + fmt s include (Datatype.Make - (struct + (struct type t = set let name = V.name ^ " lattice_set" let structural_descr = - Structural_descr.t_sum [| [| O.packed_descr |] |] - let reprs = Top :: List.map (fun o -> Set o) O.reprs + Structural_descr.t_sum [| [| Set.packed_descr |] |] + let reprs = Top :: List.map (fun o -> Set o) Set.reprs let equal = equal let compare = compare let hash = hash @@ -258,194 +224,34 @@ struct let varname = Datatype.undefined let mem_project = Datatype.never_any_project end) : - Datatype.S with type t := t) - + Datatype.S with type t := t) end -module Make_Hashconsed_Lattice_Set(V: Hptmap.Id_Datatype)(O: Hptset.S with type elt = V.t) - : Lattice_Hashconsed_Set with module O = O = -struct - - exception Error_Top - - module O = O - - type t = Set of O.t | Top - type set = t - type widen_hint = O.t - - let bottom = Set O.empty - let top = Top - - let hash c = match c with - | Top -> 12373 - | Set s -> - let f v acc = - 67 * acc + (V.id v) - in - O.fold f s 17 - - let equal e1 e2 = - if e1==e2 then true - else - match e1,e2 with - | Top,_ | _, Top -> false - | Set e1,Set e2 -> O.equal e1 e2 - - let compare = - if O.compare == Datatype.undefined then ( - Kernel.debug "%s hashconsed_lattice_set, missing comparison function" - V.name; - Datatype.undefined - ) else - fun e1 e2 -> - if e1 == e2 then 0 - else - match e1,e2 with - | Top,_ -> 1 - | _, Top -> -1 - | Set e1,Set e2 -> O.compare e1 e2 - - - let widen _wh _t1 t2 = (* [wh] isn't used *) - t2 - - (** This is exact *) - let meet v1 v2 = - if v1 == v2 then v1 else - match v1,v2 with - | Top, v | v, Top -> v - | Set s1 , Set s2 -> Set (O.inter s1 s2) - - (** This is exact *) - let narrow = meet - - (** This is exact *) - let join v1 v2 = - if v1 == v2 then v1 else - match v1,v2 with - | Top, _ | _, Top -> Top - | Set s1 , Set s2 -> - let u = O.union s1 s2 in - Set u - - (** This is exact *) - let link = join - - let cardinal_less_than s n = - match s with - Top -> raise Not_less_than - | Set s -> - let c = O.cardinal s in - if c > n - then raise Not_less_than; - c - - let cardinal_zero_or_one s = - try - ignore (cardinal_less_than s 1) ; true - with Not_less_than -> false - - let inject s = Set s - let inject_singleton e = inject (O.singleton e) - let empty = inject O.empty - - let transform f = fun t1 t2 -> - match t1,t2 with - | Top, _ | _, Top -> Top - | Set v1, Set v2 -> Set (f v1 v2) - - let map_set f s = - O.fold - (fun v -> O.add (f v)) - s - O.empty - - let apply2 f s1 s2 = - let distribute_on_elements f s1 s2 = - O.fold - (fun v -> O.union (map_set (f v) s2)) - s1 - O.empty - in - transform (distribute_on_elements f) s1 s2 - - let apply1 f s = match s with - | Top -> top - | Set s -> Set(map_set f s) - - let pretty fmt t = match t with - | Top -> Format.fprintf fmt "TopSet" - | Set s -> - if O.is_empty s then Format.fprintf fmt "BottomSet" - else - Pretty_utils.pp_iter - ~pre:"@[<hov 1>{" - ~suf:"}@]" - ~sep:";@ " - O.iter - (fun fmt v -> Format.fprintf fmt "@[%a@]" V.pretty v) - fmt s - - let is_included t1 t2 = - (t1 == t2) || - match t1,t2 with - | _,Top -> true - | Top,_ -> false - | Set s1,Set s2 -> O.subset s1 s2 - - let join_and_is_included t1 t2 = - let t = join t1 t2 in - (t, t == t2) - - let intersects t1 t2 = - match t1,t2 with - | _,Top | Top,_ -> true - | Set s1,Set s2 -> O.intersects s1 s2 - - let fold f elt init = match elt with - | Top -> raise Error_Top - | Set v -> O.fold f v init - - let iter f elt = match elt with - | Top -> raise Error_Top - | Set v -> O.iter f v - - let exists f = function - | Top -> true - | Set s -> O.exists f s +module Make_Lattice_Set + (V: Datatype.S) + (Set: Lattice_type.Set with type elt = V.t) + : Lattice_type.Lattice_Set with module O = Set += struct + module O = Set + include Make_Generic_Lattice_Set (V) (Set) +end - let for_all f = function - | Top -> false - | Set s -> O.for_all f s - let project o = match o with - | Top -> raise Error_Top - | Set v -> v +module Make_Hashconsed_Lattice_Set + (V: Hptmap.Id_Datatype) + (Set: Hptset.S with type elt = V.t) + : Lattice_type.Lattice_Set with module O = Set += struct - let mem v s = match s with - | Top -> true - | Set s -> O.mem v s + module O = Set - include (Datatype.Make - (struct - type t = set - let name = V.name ^ " hashconsed_lattice_set" - let structural_descr = Structural_descr.t_sum [| [| O.packed_descr |] |] - let reprs = Top :: List.map (fun o -> Set o) O.reprs - let equal = equal - let compare = compare - let hash = hash - let rehash = Datatype.identity - let copy = Datatype.undefined - let internal_pretty_code = Datatype.undefined - let pretty = pretty - let varname = Datatype.undefined - let mem_project = Datatype.never_any_project - end) : - Datatype.S with type t := t) + include Make_Generic_Lattice_Set (V) (Set) let () = Type.set_ml_name ty None + let intersects e1 e2 = match e1, e2 with + | _, Top | Top, _ -> true + | Set s1 , Set s2 -> Set.intersects s1 s2 + end module Make_Lattice_Base (V:Lattice_Value):(Lattice_Base with type l = V.t) = struct @@ -458,8 +264,6 @@ module Make_Lattice_Base (V:Lattice_Value):(Lattice_Base with type l = V.t) = st let bottom = Bottom let top = Top - exception Error_Top - exception Error_Bottom let project v = match v with | Top -> raise Error_Top | Bottom -> raise Error_Bottom @@ -532,7 +336,7 @@ module Make_Lattice_Base (V:Lattice_Value):(Lattice_Base with type l = V.t) = st match t with | Top -> Format.fprintf fmt "Top" | Bottom -> Format.fprintf fmt "Bottom" - | Value v -> Format.fprintf fmt "<%a>" V.pretty v + | Value v -> Format.fprintf fmt "{%a}" V.pretty v let is_included t1 t2 = let b = (t1 == t2) || @@ -543,10 +347,6 @@ module Make_Lattice_Base (V:Lattice_Value):(Lattice_Base with type l = V.t) = st pretty t1 pretty t2 b;*) b - let join_and_is_included t1 t2 = - let t = join t1 t2 in - (t, equal t t2);; - let intersects t1 t2 = not (equal (meet t1 t2) Bottom) include @@ -663,7 +463,6 @@ module Bool = struct | Top, Top -> Top let link = join let meet = narrow - let join_and_is_included b1 b2 = join b1 b2, is_included b1 b2 type widen_hint = unit let widen () = join let cardinal_zero_or_one b = not (equal b top) @@ -720,8 +519,6 @@ module Bool = struct let mem_project = Datatype.never_any_project end) : Datatype.S with type t := t) - - exception Error_Top (* for With_Error_Top *) end @@ -858,9 +655,6 @@ struct | Product (l1,ll1), Product (l2,ll2) -> (L1.is_included l1 l2) && (L2.is_included ll1 ll2) - let join_and_is_included x1 x2 = - let x12 = join x1 x2 in (x12, equal x12 x2) - include (Datatype.Make (struct type t = product (*= Product of t1*t2 | Bottom*) @@ -960,13 +754,6 @@ struct | (l1,ll1), (l2,ll2) -> (L1.is_included l1 l2) && (L2.is_included ll1 ll2) - let join_and_is_included (l1,ll1) (l2,ll2) = - let (l,b) = L1.join_and_is_included l1 l2 in - if b then - let (ll,bb) = L2.join_and_is_included ll1 ll2 in - ((l,ll),bb) - else ((l, L2.join ll1 ll2), false);; - include (Datatype.Make (struct @@ -1142,9 +929,6 @@ struct "[Lattice_Sum]%a is included in %a: %b @\n" pretty u pretty v b;*) b - let join_and_is_included a b = - let ab = join a b in (ab, equal a b) - include Datatype.Make (struct diff --git a/src/kernel_services/abstract_interp/abstract_interp.mli b/src/kernel_services/abstract_interp/abstract_interp.mli index 212ee51ebd8233b0315de429cf35549eb9f14015..d8969a73c40284e47c54306ad9caeb294084553f 100644 --- a/src/kernel_services/abstract_interp/abstract_interp.mli +++ b/src/kernel_services/abstract_interp/abstract_interp.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,9 +20,15 @@ (* *) (**************************************************************************) -(** Functors for generic lattices implementations. +(** Functors for generic lattices implementations. @plugin developer guide *) +exception Error_Top +(** Raised by some functions when encountering a top value. *) + +exception Error_Bottom +(** Raised by Lattice_Base.project. *) + exception Not_less_than (** Raised by {!Lattice.cardinal_less_than}. *) @@ -90,12 +96,16 @@ module Bool : sig end module Make_Lattice_Base (V : Lattice_Value) : Lattice_Base with type l = V.t -module Make_Lattice_Set (V : Lattice_Value) : Lattice_Set with type O.elt=V.t + +module Make_Lattice_Set + (V : Datatype.S) + (Set: Lattice_type.Set with type elt = V.t) + : Lattice_type.Lattice_Set with module O = Set module Make_Hashconsed_Lattice_Set - (V : Hptmap.Id_Datatype) - (O: Hptset.S with type elt = V.t) - : Lattice_Hashconsed_Set with module O = O + (V: Hptmap.Id_Datatype) + (Set: Hptset.S with type elt = V.t) + : Lattice_type.Lattice_Set with module O = Set (** See e.g. base.ml and locations.ml to see how this functor should be applied. The [O] module passed as argument is the same as [O] in the result. It is passed here to avoid having multiple modules calling diff --git a/src/kernel_services/abstract_interp/base.ml b/src/kernel_services/abstract_interp/base.ml index 7d6606e9951992ff1a667d557512e52e5f1ed9f1..c6362437a5a24cdc1653cdcbe9ca2489d17940d9 100644 --- a/src/kernel_services/abstract_interp/base.ml +++ b/src/kernel_services/abstract_interp/base.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -107,15 +107,17 @@ module Validity = Datatype.Make type cstring = CSString of string | CSWstring of Escape.wstring +type deallocation = Malloc | VLA | Alloca + type base = | Var of varinfo * validity | CLogic_Var of logic_var * typ * validity | Null (** base for addresses like [(int* )0x123] *) | String of int * cstring (** String constants *) - | Allocated of varinfo * validity + | Allocated of varinfo * deallocation * validity let id = function - | Var (vi,_) | Allocated (vi,_) -> vi.vid + | Var (vi,_) | Allocated (vi,_,_) -> vi.vid | CLogic_Var (lvi, _, _) -> lvi.lv_id | Null -> 0 | String (id,_) -> id @@ -131,7 +133,7 @@ let pretty fmt t = | String (_, CSString s) -> Format.fprintf fmt "%S" s | String (_, CSWstring s) -> Format.fprintf fmt "L\"%s\"" (Escape.escape_wstring s) - | Var (t,_) | Allocated (t,_) -> Printer.pp_varinfo fmt t + | Var (t,_) | Allocated (t,_,_) -> Printer.pp_varinfo fmt t | CLogic_Var (lvi, _, _) -> Printer.pp_logic_var fmt lvi | Null -> Format.pp_print_string fmt "NULL" @@ -150,7 +152,7 @@ let typeof v = | String (_,_) -> Some charConstPtrType | CLogic_Var (_, ty, _) -> Some ty | Null -> None - | Var (v,_) | Allocated(v,_) -> Some (unrollType v.vtype) + | Var (v,_) | Allocated(v,_,_) -> Some (unrollType v.vtype) let cstring_bitlength s = let u, l = @@ -167,7 +169,7 @@ let bits_sizeof v = | String (_,e) -> Int_Base.inject (cstring_bitlength e) | Null -> Int_Base.top - | Var (v,_) | Allocated (v,_) -> + | Var (v,_) | Allocated (v,_,_) -> Bit_utils.sizeof_vid v | CLogic_Var (_, ty, _) -> Bit_utils.sizeof ty @@ -225,7 +227,7 @@ let validity_from_known_size size = let validity b = match b with - | Var (_,v) | CLogic_Var (_, _, v) | Allocated (_,v) -> v + | Var (_,v) | CLogic_Var (_, _, v) | Allocated (_,_,v) -> v | Null -> let mn = min_valid_absolute_address ()in let mx = max_valid_absolute_address () in @@ -237,8 +239,6 @@ let validity b = let size = bits_sizeof b in validity_from_known_size size -exception Not_valid_offset - let is_read_only base = match base with | String _ -> true @@ -247,44 +247,37 @@ let is_read_only base = (* Minor optimization compared to [is_weak (validity b)] *) let is_weak = function - | Allocated (_, Variable { weak }) -> weak + | Allocated (_, _, Variable { weak }) -> weak | _ -> false let is_valid_offset ~for_writing size base offset = - let wrap_inf = function - | None -> raise Not_valid_offset - | Some v -> v + let (>>) i f = match i with + | None, _ + | _, None -> false + | Some min, Some max -> f min max in - if for_writing && (is_read_only base) - then raise Not_valid_offset; - match validity base with - | Empty -> - if not (Int.(equal zero size) && Ival.(equal offset zero)) then - raise Not_valid_offset - | Invalid -> - (* Special case. We stretch the truth and say that the address of the - base itself is valid for a size of 0. We use a size of 0 to emulate - the semantics of "past-one" pointers. *) - if not (Int.(equal zero size) && Ival.(equal offset zero)) then - raise Not_valid_offset - | Known (min_valid,max_valid) - | Unknown (min_valid, Some max_valid, _) -> - (* valid between min_valid .. max_valid inclusive *) - if not (Ival.is_bottom offset) then - let min = wrap_inf (Ival.min_int offset) in - if Int.lt min min_valid then raise Not_valid_offset; - let max = wrap_inf (Ival.max_int offset) in - if Int.gt (Int.pred (Int.add max size)) max_valid then - raise Not_valid_offset - | Variable {min_alloc = min_valid} -> - (* valid between 0 .. min_valid inclusive *) - if not (Ival.is_bottom offset) then - let min = wrap_inf (Ival.min_int offset) in - if Int.lt min Int.zero then raise Not_valid_offset; - let max = wrap_inf (Ival.max_int offset) in - if Int.gt (Int.pred (Int.add max size)) min_valid then - raise Not_valid_offset - | Unknown (_, None, _) -> raise Not_valid_offset + Ival.is_bottom offset || + not (for_writing && (is_read_only base)) && + ((* Special case. We stretch the truth and say that the address of the + base itself is valid for a size of 0. A size of 0 appears for: + - empty structs + - memory operations on a 0 size (e.g. memcpy (_, _ 0)) + - internally, to emulate the semantics of "past-one" pointers (in + Cvalue_forward.are_comparable). *) + (Int.(equal zero size) && Ival.(equal offset zero)) || + match validity base with + | Empty | Invalid -> false + | Known (min_valid,max_valid) + | Unknown (min_valid, Some max_valid, _) -> + Ival.min_and_max offset >> fun min max -> + (* valid between min_valid .. max_valid inclusive *) + Int.ge min min_valid && Int.le (Int.pred (Int.add max size)) max_valid + | Variable {min_alloc = min_valid} -> + (* valid between 0 .. min_valid inclusive *) + Ival.min_and_max offset >> fun min max -> + Int.ge min Int.zero && Int.le (Int.pred (Int.add max size)) min_valid + | Unknown (_, None, _) -> false + ) let is_function base = match base with @@ -299,7 +292,7 @@ let is_aligned_by b alignment = then false else match b with - | Var (v,_) | Allocated(v,_) -> + | Var (v,_) | Allocated(v,_,_) -> Int.is_zero (Int.rem (Int.of_int (Cil.bytesAlignOf v.vtype)) alignment) | CLogic_Var (_, ty, _) -> Int.is_zero (Int.rem (Int.of_int (Cil.bytesAlignOf ty)) alignment) @@ -449,9 +442,9 @@ let register_memory_var varinfo validity = VarinfoNotSource.add varinfo base; base -let register_allocated_var varinfo validity = +let register_allocated_var varinfo deallocation validity = assert (not varinfo.vsource); - let base = Allocated (varinfo,validity) in + let base = Allocated (varinfo,deallocation,validity) in VarinfoNotSource.add varinfo base; base @@ -473,7 +466,7 @@ let of_varinfo varinfo = exception Not_a_C_variable let to_varinfo t = match t with - | Var (t,_) | Allocated (t,_) -> t + | Var (t,_) | Allocated (t,_,_) -> t | CLogic_Var _ | Null | String _ -> raise Not_a_C_variable diff --git a/src/kernel_services/abstract_interp/base.mli b/src/kernel_services/abstract_interp/base.mli index fed956fefd857d8520bfd20eef62ab5f066c1088..a6bb6874bae531b60a1289038589bcbf0b5a62f8 100644 --- a/src/kernel_services/abstract_interp/base.mli +++ b/src/kernel_services/abstract_interp/base.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -38,6 +38,11 @@ type variable_validity = private { max_allocable: Int.t (** Maximum valid bit after size increase *); } +(** Whether the allocated base has been obtained via calls to + malloc/calloc/realloc ([Malloc]), alloca ([Alloca]), or is related to a + variable-length array ([VLA]). *) +type deallocation = Malloc | VLA | Alloca + type base = private | Var of Cil_types.varinfo * validity (** Base for a standard C variable. *) @@ -46,8 +51,8 @@ type base = private | Null (** Base for an address like [(int* )0x123] *) | String of int (** unique id of the constant string (one per code location)*) * cstring (** contents of the constant string *) - | Allocated of Cil_types.varinfo * validity - (** Base for a variable dynamically allocated via malloc/calloc/realloc *) + | Allocated of Cil_types.varinfo * deallocation * validity + (** Base for a variable dynamically allocated via malloc/calloc/realloc/alloca *) and validity = | Empty (** For 0-sized bases *) @@ -81,7 +86,7 @@ module Hptset: Hptset.S with type elt = t and type 'a shape = 'a Hptmap.Shape(Base).t -module SetLattice: Lattice_type.Lattice_Hashconsed_Set with module O = Hptset +module SetLattice: Lattice_type.Lattice_Set with module O = Hptset module Validity: Datatype.S with type t = validity @@ -172,11 +177,9 @@ val max_valid_absolute_address: unit -> Int.t val bits_sizeof : t -> Int_Base.t -exception Not_valid_offset -val is_valid_offset : for_writing:bool -> Int.t -> t -> Ival.t -> unit +val is_valid_offset : for_writing:bool -> Int.t -> t -> Ival.t -> bool (** [is_valid_offset ~for_writing size b offset] checks that [offset] - (expressed in bits) plus [size] bits is valid in [b]. It does nothing - in this case, and raises [Not_valid_offset] if the offset may be invalid. *) + (expressed in bits) plus [size] bits is valid in [b]. *) (** {2 Misc} *) @@ -197,7 +200,7 @@ val is_aligned_by : t -> Int.t -> bool This is only useful to create an initial memory state for analysis, and is never needed for normal users. *) -val register_allocated_var: Cil_types.varinfo -> validity -> t +val register_allocated_var: Cil_types.varinfo -> deallocation -> validity -> t (** Allocated variables are variables not present in the source of the program, but instead created through dynamic allocation. Their field [vsource] is set to false. *) diff --git a/src/kernel_services/abstract_interp/bottom.ml b/src/kernel_services/abstract_interp/bottom.ml index 3b2e21b8a5d06d158860ec5ac90910dd048d5e0c..f1a4b9e694f0815c291a1392ac41f44f21c934c3 100644 --- a/src/kernel_services/abstract_interp/bottom.ml +++ b/src/kernel_services/abstract_interp/bottom.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -122,12 +122,6 @@ module Bound_Lattice let bottom = `Bottom let join = join Lattice.join let is_included = is_included Lattice.is_included - let join_and_is_included a b = match a, b with - | `Bottom, _ -> b, true - | _, `Bottom -> a, false - | `Value a, `Value b -> - let joined, is_included = Lattice.join_and_is_included a b in - `Value joined, is_included end diff --git a/src/kernel_services/abstract_interp/bottom.mli b/src/kernel_services/abstract_interp/bottom.mli index 54718fd395c9265bea5eef199dc4bf0b8438e179..3bc5cd159414883263e33e2bf6628f8cd37bdf13 100644 --- a/src/kernel_services/abstract_interp/bottom.mli +++ b/src/kernel_services/abstract_interp/bottom.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/fval.ml b/src/kernel_services/abstract_interp/fval.ml index 7123f40a4b2b446cd1d2d710336a4537014840c0..73a51c691d420dc439166bcb11577a5aa292a54b 100644 --- a/src/kernel_services/abstract_interp/fval.ml +++ b/src/kernel_services/abstract_interp/fval.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -200,8 +200,6 @@ module F = struct let ff = 4.5 let minus_ff = -4.5 - let of_int = float_of_int - let widen_up f = if f <= zero then zero else if f <= one then one @@ -473,20 +471,6 @@ let contains_minus_zero = is_included minus_zero (* Returns true if [f] is certainly a zero (positive, negative or both). *) let is_a_zero f = is_included f zeros -let fold_split n f (FRange.I(b, e)) acc = - let bound = ref b in - let acc = ref acc in - begin - for i = n downto 2 do - let new_bound = F.add !bound (F.div (F.sub e !bound) (F.of_int i)) in - acc := f (inject !bound new_bound) !acc; - bound := new_bound - done; - end; - (* Format.printf "float fold_split %a@." - pretty (!bound, e); *) - f (inject !bound e) !acc - let contains_a_zero (FRange.I(b, e)) = F.le_ieee b F.zero && F.le_ieee F.zero e @@ -1340,39 +1324,33 @@ let froundf = exact_aux Float32 F.fround let subdiv_float_interval ~size (FRange.I(l, u) as i) = let midpoint = F.avg l u in let midpointl, midpointu = - if size <> 32 && size <> 64 - then midpoint, midpoint - else + match size with + | None (* all rounding modes *) -> midpoint, midpoint + | Some Float32 -> + if F.equal l F.minus_zero && F.equal u F.zero then l, u + else begin + let smidpoint = F.next_float midpoint in + Floating_point.set_round_upward (); + let midpointu = + Floating_point.round_to_single_precision_float smidpoint + in + Floating_point.set_round_downward (); + let midpointl = + Floating_point.round_to_single_precision_float midpoint + in + Floating_point.set_round_nearest_even (); + midpointl, midpointu + end + | Some Float64 -> let smidpoint = F.next_float midpoint in - if size = 64 + if F.le smidpoint u then - if F.le smidpoint u + if F.next_float l = u then - if F.next_float l = u - then - l, u - else - midpoint, smidpoint - else midpoint, u - else begin (* 32 *) - let i1 = Int64.bits_of_float l in - if i1 = Int64.min_int && - (Int64.bits_of_float u) = Int64.zero - then - l ,u - else begin - Floating_point.set_round_upward (); - let midpointu = - Floating_point.round_to_single_precision_float smidpoint - in - Floating_point.set_round_downward (); - let midpointl = - Floating_point.round_to_single_precision_float midpoint - in - Floating_point.set_round_nearest_even (); - midpointl, midpointu - end - end + l, u + else + midpoint, smidpoint + else midpoint, u in if F.le midpointu l || F.le u midpointl then raise Can_not_subdiv; @@ -1398,7 +1376,9 @@ let cast_float_to_double_inverse (FRange.I(min, max)) = let enlarge_1ulp fk (FRange.I(b, e)) = let b' = next_after fk b (-. infinity) in let e' = next_after fk e infinity in - inject b' e' + let ib, ie, r = inject_r_f fk b' e' in + if ib || ie then raise Non_finite; + r (* diff --git a/src/kernel_services/abstract_interp/fval.mli b/src/kernel_services/abstract_interp/fval.mli index abd1cbb4dba2b1b0d3cb56795b104ee8e7a514bc..1630a32e975d8251807968b51ba57993c0189fce 100644 --- a/src/kernel_services/abstract_interp/fval.mli +++ b/src/kernel_services/abstract_interp/fval.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -129,9 +129,6 @@ val div : rounding_mode -> t -> t -> bool * t val is_a_zero : t -> bool (** [is_a_zero f] returns true iff f ⊆ [-0.0,+0.0] *) -val fold_split : int -> (t -> 'a -> 'a) -> t -> 'a -> 'a -(** no splitting occurs if the integer argument is less than 2 *) - val contains_zero : t -> bool val compare : t -> t -> int @@ -164,7 +161,7 @@ val project_float: t -> F.t val minus_one_one : t -val subdiv_float_interval : size:int -> t -> t * t +val subdiv_float_interval : size:float_kind option -> t -> t * t val neg : t -> t @@ -244,4 +241,6 @@ val cast_float_to_double_inverse: t -> t discarded. *) val enlarge_1ulp: float_kind -> t -> t -(** enlarge the bounds of the interval by one ulp. *) +(** enlarge the bounds of the interval by one ulp. + @raise Non_finite if the result is not fully finite. +*) diff --git a/src/kernel_services/abstract_interp/int_Base.ml b/src/kernel_services/abstract_interp/int_Base.ml index 9feec10455414a813e97efb45658053478f189fa..f1796f6b718f9d124073bc7267c48c15a52751e2 100644 --- a/src/kernel_services/abstract_interp/int_Base.ml +++ b/src/kernel_services/abstract_interp/int_Base.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -73,8 +73,6 @@ let neg x = | Top -> x let inject i = Value i -exception Error_Top - let project = function | Top -> raise Error_Top | Value i -> i diff --git a/src/kernel_services/abstract_interp/int_Base.mli b/src/kernel_services/abstract_interp/int_Base.mli index e4b53effb145155c755c671974f95c98f5f508f3..ce178e666360a20b45d9dfe5d63229ccebb2941a 100644 --- a/src/kernel_services/abstract_interp/int_Base.mli +++ b/src/kernel_services/abstract_interp/int_Base.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -35,8 +35,6 @@ val neg: t -> t val is_zero: t -> bool val is_top: t -> bool -exception Error_Top - val inject: Integer.t -> t val project: t -> Integer.t (** @raise Error_Top if the argument is {!Top}. *) diff --git a/src/kernel_services/abstract_interp/int_Intervals.ml b/src/kernel_services/abstract_interp/int_Intervals.ml index c73b2379931bc0c03564c17db64e2a94277ba28f..6963a029281ccb71f938f942f084a464537b2f9b 100644 --- a/src/kernel_services/abstract_interp/int_Intervals.ml +++ b/src/kernel_services/abstract_interp/int_Intervals.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/int_Intervals.mli b/src/kernel_services/abstract_interp/int_Intervals.mli index 9e4cda737391025766ad59b66b21e54aacc81eef..1bc456db345963c279bfbd36aaabff29e2cfea11 100644 --- a/src/kernel_services/abstract_interp/int_Intervals.mli +++ b/src/kernel_services/abstract_interp/int_Intervals.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/int_Intervals_sig.mli b/src/kernel_services/abstract_interp/int_Intervals_sig.mli index 23a9963ceaf40815e91ddb9a68df6904d21bdcb3..a1dc21c6476347f6711e7d12c419b1b3c5b30a7a 100644 --- a/src/kernel_services/abstract_interp/int_Intervals_sig.mli +++ b/src/kernel_services/abstract_interp/int_Intervals_sig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,7 +28,6 @@ open Abstract_interp type itv = Int.t * Int.t include Lattice_type.Full_Lattice -include Lattice_type.With_Error_Top val is_top: t -> bool diff --git a/src/kernel_services/abstract_interp/ival.ml b/src/kernel_services/abstract_interp/ival.ml index f65fd0961afa14193ba984076b5836d9a737c212..a59d29dabac455c24c8e1589542db3ec2146cf7c 100644 --- a/src/kernel_services/abstract_interp/ival.ml +++ b/src/kernel_services/abstract_interp/ival.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -86,9 +86,6 @@ let opt1 f m = None -> None | Some m -> Some (f m) -exception Error_Top -exception Error_Bottom - module O = FCSet.Make(Integer) type pre_set = @@ -233,10 +230,6 @@ let fail min max r modu = let is_safe_modulo r modu = (Int.ge r Int.zero ) && (Int.ge modu Int.one) && (Int.lt r modu) -let check_modulo min max r modu = - if not (is_safe_modulo r modu) - then fail min max r modu - let is_safe_bound bound r modu = match bound with | None -> true | Some m -> Int.equal (Int.pos_rem m modu) r @@ -459,9 +452,13 @@ let inject_top min max rem modu = make ~min ~max ~rem ~modu let inject_interval ~min ~max ~rem:r ~modu = - check_modulo min max r modu; - let min = Extlib.opt_map (fun min -> Int.round_up_to_r ~min ~r ~modu) min - and max = Extlib.opt_map (fun max -> Int.round_down_to_r ~max ~r ~modu) max in + assert (is_safe_modulo r modu); + let fix_bound fix bound = match bound with + | None -> None + | Some b -> Some (if Int.equal b (Int.pos_rem r modu) then b else fix b) + in + let min = fix_bound (fun min -> Int.round_up_to_r ~min ~r ~modu) min + and max = fix_bound (fun max -> Int.round_down_to_r ~max ~r ~modu) max in make ~min ~max ~rem:r ~modu @@ -478,13 +475,11 @@ let subdiv_int v = let hi = Array.sub arr m lenhi in share_array lo m, share_array hi lenhi - | Top (Some lo, Some hi, r, modu) -> + | Top (Some lo, Some hi, rem, modu) -> let mean = Int.native_div (Int.add lo hi) Int.two in let succmean = Int.succ mean in - let hilo = Integer.round_down_to_r ~max:mean ~r ~modu in - let lohi = Integer.round_up_to_r ~min:succmean ~r ~modu in - inject_top (Some lo) (Some hilo) r modu, - inject_top (Some lohi) (Some hi) r modu + inject_interval ~min:(Some lo) ~max:(Some mean) ~rem ~modu, + inject_interval ~min:(Some succmean) ~max:(Some hi) ~rem ~modu | Top _ -> raise Can_not_subdiv let inject_range min max = inject_top min max Int.zero Int.one @@ -1155,20 +1150,6 @@ let fold_enum f v acc = | Float _ -> raise Error_Top | Set _ | Top _ -> fold_int (fun x acc -> f (inject_singleton x) acc) v acc -let fold_split ~split f v acc = - match v with - | Float (fl) when Fval.is_singleton fl -> - f v acc - | Float (fl) -> - Fval.fold_split - split - (fun fl acc -> f (inject_float fl) acc) - fl - acc - | Top(_,_,_,_) | Set _ -> - fold_int (fun x acc -> f (inject_singleton x) acc) v acc - - (** [min_is_lower mn1 mn2] is true iff mn1 is a lower min than mn2 *) let min_is_lower mn1 mn2 = match mn1, mn2 with @@ -1237,9 +1218,6 @@ let is_included t1 t2 = | Float _, _ -> equal t2 top | _, Float (f) -> is_zero t1 && (Fval.contains_zero f) -let join_and_is_included a b = - let ab = join a b in (ab, equal a b) - let partially_overlaps ~size t1 t2 = match t1, t2 with Set s1, Set s2 -> @@ -2300,6 +2278,29 @@ let diff value rem = log_imprecision "Ival.diff"; diff_if_one value rem +(* This function is an iterator, but it needs [diff_if_one] just above. *) +let fold_int_bounds f v acc = + match v with + | Float _ -> f v acc + | Set _ | Top _ -> + if cardinal_zero_or_one v then f v acc + else + (* apply [f] to [b] and reduce [v] if [b] is finite, + or return [v] and [acc] unchanged *) + let on_bound b v acc = match b with + | None -> v, acc + | Some b -> + let b = inject_singleton b in + diff_if_one v b, f b acc + in + let min, max = min_and_max v in + (* [v] has cardinal at least 2, so [min] and [max] are distinct *) + let v, acc = on_bound min v acc in + let v, acc = on_bound max v acc in + (* but if the cardinal was 2, then this [v] may be bottom *) + if equal v bottom then acc else f v acc + + let backward_comp_int_left op l r = let open Comp in try diff --git a/src/kernel_services/abstract_interp/ival.mli b/src/kernel_services/abstract_interp/ival.mli index 856b58ffbd4afd9f333b24e9ecfed6c3a0fd2868..0d3ac127725b5a544550734a1da901f678b8507a 100644 --- a/src/kernel_services/abstract_interp/ival.mli +++ b/src/kernel_services/abstract_interp/ival.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -59,8 +59,6 @@ module Widen_Hints : sig val default_widen_hints: t end -exception Error_Bottom - type size_widen_hint = Integer.t type generic_widen_hint = Widen_Hints.t @@ -167,18 +165,6 @@ val inject_interval: infinity. Checks that [modu] > 0 and 0 <= [rest] < [modu], and fails otherwise. *) -val inject_top : - Integer.t option -> Integer.t option -> Integer.t -> Integer.t -> t -(** [inject_top min max r m] checks [min], [max], [r] and [m] for consistency - as arguments of the [Top] constructor - and returns the lattice element of integers equal to [r] modulo [m] - between [min] and [max] (which may be a Set if there are few of these). - For [min] and [max], [None] means unbounded. - - @deprecated {!inject_interval} offers a better API, and normalizes the - [min] and [max] bounds. -*) - (** Cardinality *) @@ -222,13 +208,18 @@ val fold_enum : (t -> 'a -> 'a) -> t -> 'a -> 'a (** Iterate on every value of the ival. Raise {!Error_Top} if the argument is a non-singleton float or a potentially infinite integer. *) -val fold_split : split:int -> (t -> 'a -> 'a) -> t -> 'a -> 'a +val fold_int_bounds: (t -> 'a -> 'a) -> t -> 'a -> 'a +(** Given [i] an integer abstraction [min..max], [fold_int_bounds f i acc] + tries to apply [f] to [min], [max], and [i'] successively, where [i'] + is [i] from which [min] and [max] have been removed. If [min] and/or + [max] are infinite, [f] is called with an argument [i'] unreduced + in the corresponding direction(s). *) val apply_set: (Integer.t -> Integer.t -> Integer.t ) -> t -> t -> t val apply_set_unary: (Integer.t -> Integer.t ) -> t -> t -val subdiv_float_interval : size:int -> t -> t * t +val subdiv_float_interval : size:Fval.float_kind option -> t -> t * t val subdiv_int: t -> t * t diff --git a/src/kernel_services/abstract_interp/lattice_messages.ml b/src/kernel_services/abstract_interp/lattice_messages.ml index 22315b1db8a1cdb54e14345f199e69e5498cf8dd..7cf43a5b72c34cd52d8fcb3e68a81b1fb6d6abf0 100644 --- a/src/kernel_services/abstract_interp/lattice_messages.ml +++ b/src/kernel_services/abstract_interp/lattice_messages.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/lattice_messages.mli b/src/kernel_services/abstract_interp/lattice_messages.mli index 0a13baaa8a179edfeb2d494695f9ec1d6a6383ad..38b6ce93f80f99fd9f5531a23592d6b01c893648 100644 --- a/src/kernel_services/abstract_interp/lattice_messages.mli +++ b/src/kernel_services/abstract_interp/lattice_messages.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/lattice_type.mli b/src/kernel_services/abstract_interp/lattice_type.mli index bbb8197ec6d9ba94f62fdf8a053a599b015cba6a..fe3eec5f24b390b909603a69f4a124e8a874695c 100644 --- a/src/kernel_services/abstract_interp/lattice_type.mli +++ b/src/kernel_services/abstract_interp/lattice_type.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,7 +28,6 @@ module type Join_Semi_Lattice = sig val join: t -> t -> t (** over-approximation of union *) val is_included: t -> t -> bool (**is first argument included in the second?*) - val join_and_is_included: t -> t -> (t * bool) (**Do both ops simultaneously*) end module type Bounded_Join_Semi_Lattice = sig @@ -46,19 +45,6 @@ module type With_Top_Opt = sig val top_opt: t option (** optional largest element *) end -module type With_Error_Top = sig - exception Error_Top -end - -module type With_Error_Bottom = sig - exception Error_Bottom -end - -module type With_Errors = sig - include With_Error_Top - include With_Error_Bottom -end - module type With_Narrow = sig type t val narrow: t -> t -> t (** over-approximation of intersection *) @@ -170,7 +156,6 @@ module type Full_AI_Lattice_with_cardinality = sig include With_Diff with type t := t include With_Diff_One with type t := t include With_Enumeration with type t := t - include With_Error_Top end @@ -214,20 +199,22 @@ end module type Lattice_Base = sig type l type t = private Top | Bottom | Value of l - exception Error_Top - exception Error_Bottom include AI_Lattice_with_cardinal_one with type t := t val project : t -> l val inject: l -> t val transform: (l -> l -> l) -> t -> t -> t end +module type Set = sig + include FCSet.S_Basic_Compare + include Datatype.S with type t := t +end + (** Signatures for a lattice over a set (see {!Abstract_interp.Make_Lattice_Set} or {!Abstract_interp.Make_Hashconsed_Lattice_Set}). *) -module type Lattice_Set_Generic = sig - module O: sig type t type elt end - exception Error_Top +module type Lattice_Set = sig + module O: Set type t = private Set of O.t | Top include AI_Lattice_with_cardinal_one with type t := t @@ -241,24 +228,11 @@ module type Lattice_Set_Generic = sig val iter: ( O.elt -> unit) -> t -> unit val exists: (O.elt -> bool) -> t -> bool val for_all: (O.elt -> bool) -> t -> bool + val filter: (O.elt -> bool) -> t -> t val project : t -> O.t val mem : O.elt -> t -> bool end - -module type Lattice_Set = sig - module O: Datatype.Set - include Lattice_Set_Generic with module O := O -end - -module type Lattice_Hashconsed_Set = sig - module O: sig - include FCSet.S_Basic_Compare - include Datatype.S with type t := t - end - include Lattice_Set_Generic with module O := O -end - (* Local Variables: compile-command: "make -C ../../.." diff --git a/src/kernel_services/abstract_interp/lmap.ml b/src/kernel_services/abstract_interp/lmap.ml index e3147cf59ad6ae00ca5c63e703db52396ba90002..4f1ff19871cb9f10972730a9433e466aa9b8a3ee 100644 --- a/src/kernel_services/abstract_interp/lmap.ml +++ b/src/kernel_services/abstract_interp/lmap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,15 +25,6 @@ open Locations let msg_emitter = Lattice_messages.register "Lmap";; -(* Reduce validity for read-only bases on which we want to write *) -let for_writing_validity ~reducing b = - (* If we are reducing, we do not need - to exclude readonly base. *) - if not reducing && Base.is_read_only b then - Base.Invalid - else - Base.validity b - type 'a default_contents = | Bottom | Top of 'a @@ -61,8 +52,6 @@ struct type widen_hint_base = V.generic_widen_hint - exception Error_Top - open Default_offsetmap (* to be used only when we are sure that the base is not Invalid, for @@ -174,32 +163,29 @@ struct Zone.fold_topset_ok filter zfilter (); Format.fprintf fmt "@]" - let add_new_base base ~size v ~size_v m = + let add_base_value base ~size v ~size_v m = add base (Offsetmap.create ~size v ~size_v) m exception Result_is_top - let add_binding ~reducing ~exact mem {loc; size} v = - let alarm = ref false in + let add_binding ~exact mem {loc; size} v = let had_non_bottom = ref false in let result = ref mem in let aux origin b offsets = - let validity = for_writing_validity ~reducing b in + let validity = Base.validity b in match find_or_default b mem with - | `Bottom -> alarm := true + | `Bottom -> () | `Value offm -> let offm' = match size with | Int_Base.Top -> let orig = Origin.current Origin.K_Arith in - alarm := true; Offsetmap.update_imprecise_everywhere ~validity orig v offm | Int_Base.Value size -> assert (Int.ge size Int.zero); - let this_alarm, r = + let _, r = Offsetmap.update ?origin ~validity ~exact ~offsets ~size v offm in - if this_alarm then alarm := true; r in match offm' with @@ -216,52 +202,42 @@ struct raise Result_is_top | Location_Bits.Top (Base.SetLattice.Set set, origin) -> Base.Hptset.iter (fun b -> aux (Some origin) b Ival.top) set; - true, !had_non_bottom, !result + !had_non_bottom, !result | Location_Bits.Map loc_map -> Location_Bits.M.iter (fun b off -> aux None b off) loc_map; - !alarm, !had_non_bottom, !result + !had_non_bottom, !result (* may raise Error_Top in the case Top Top. Make sure to annotate callers *) let find ?(conflate_bottom=true) mem {loc ; size} = - let alarm = ref false in let handle_imprecise_base base acc = match find_or_default base mem with | `Bottom -> acc | `Value offsetmap -> V.join (Offsetmap.find_imprecise_everywhere offsetmap) acc in - let v = match loc with - | Location_Bits.Top (Base.SetLattice.Top, _) -> - alarm := true; - vtop () - | Location_Bits.Top (Base.SetLattice.Set s, _) -> - alarm := true; - Base.SetLattice.O.fold handle_imprecise_base s V.bottom - | Location_Bits.Map loc_map -> begin - match size with - | Int_Base.Top -> - alarm := true; - let aux base _ acc = handle_imprecise_base base acc in - Location_Bits.M.fold aux loc_map V.bottom - | Int_Base.Value size -> - let aux_base base offsets acc_v = - let validity = Base.validity base in - match find_or_default base mem with - | `Bottom -> - alarm := true; - acc_v - | `Value offsetmap -> - let alarm_o, new_v = - Offsetmap.find - ~conflate_bottom ~validity ~offsets ~size offsetmap - in - if alarm_o then alarm := true; - V.join new_v acc_v - in - Location_Bits.M.fold aux_base loc_map V.bottom - end - in - !alarm, v + match loc with + | Location_Bits.Top (Base.SetLattice.Top, _) -> vtop () + | Location_Bits.Top (Base.SetLattice.Set s, _) -> + Base.SetLattice.O.fold handle_imprecise_base s V.bottom + | Location_Bits.Map loc_map -> begin + match size with + | Int_Base.Top -> + let aux base _ acc = handle_imprecise_base base acc in + Location_Bits.M.fold aux loc_map V.bottom + | Int_Base.Value size -> + let aux_base base offsets acc_v = + let validity = Base.validity base in + match find_or_default base mem with + | `Bottom -> acc_v + | `Value offsetmap -> + let _alarm_o, new_v = + Offsetmap.find + ~conflate_bottom ~validity ~offsets ~size offsetmap + in + V.join new_v acc_v + in + Location_Bits.M.fold aux_base loc_map V.bottom + end (* Internal function for join and widen, that handles efficiently the values bound by default in maps. *) @@ -482,26 +458,22 @@ struct else join_widen (`Widen wh_hints) m1 m2 - let paste_offsetmap ~reducing ~from ~dst_loc ~size ~exact m = + let paste_offsetmap ~from ~dst_loc ~size ~exact m = let loc_dst = make_loc dst_loc (Int_Base.inject size) in assert (Int.le Int.zero size); let exact = exact && cardinal_zero_or_one loc_dst in (* TODO: do we want to alter exact here? *) let had_non_bottom = ref false in - let alarm = ref false in let treat_dst base_dst i_dst acc = - let validity = for_writing_validity ~reducing base_dst in + let validity = Base.validity base_dst in let offsetmap_dst = find_or_default base_dst m in match offsetmap_dst with - | `Bottom -> - alarm := true; - acc + | `Bottom -> acc | `Value offsetmap_dst -> - let this_alarm, new_offsetmap = + let _this_alarm, new_offsetmap = Offsetmap.paste_slice ~validity ~exact ~from ~size ~offsets:i_dst offsetmap_dst in - alarm := !alarm || this_alarm; had_non_bottom := true; match new_offsetmap with | `Bottom -> acc @@ -513,7 +485,7 @@ struct match dst_loc with | Location_Bits.Map _ -> let result = Location_Bits.fold_i treat_dst dst_loc m in - !alarm, !had_non_bottom, result + !had_non_bottom, result | Location_Bits.Top (top, orig) -> if not (Base.SetLattice.equal top Base.SetLattice.top) then Lattice_messages.emit_approximation msg_emitter @@ -522,7 +494,7 @@ struct Origin.pretty_as_reason orig; let validity = Base.validity_from_size size in let v = Offsetmap.find_imprecise ~validity from in - add_binding ~reducing:false ~exact:false m loc_dst v + add_binding ~exact:false m loc_dst v let top_offsetmap size = let top = vtop () in @@ -530,24 +502,20 @@ struct (* may raise Error_Top in the case Top Top *) let copy_offsetmap src_loc size m = - let alarm = ref false in let treat_src k_src i_src acc = let validity = Base.validity k_src in match find_or_default k_src m with - | `Bottom -> - alarm := true; - acc + | `Bottom -> acc | `Value offsetmap_src -> - let alarm_copy, copy = Offsetmap.copy_slice ~validity + let _alarm_copy, copy = + Offsetmap.copy_slice ~validity ~offsets:i_src ~size offsetmap_src in - if alarm_copy then alarm := true; Bottom.join Offsetmap.join acc copy in try - let r = Location_Bits.fold_topset_ok treat_src src_loc `Bottom in - !alarm, r - with Location_Bits.Error_Top -> true, top_offsetmap size + Location_Bits.fold_topset_ok treat_src src_loc `Bottom + with Error_Top -> top_offsetmap size end @@ -679,28 +647,28 @@ struct | Top -> Format.fprintf fmt "@[NO INFORMATION@]" | Map m -> M.pretty_filter fmt m zfilter - let add_new_base base ~size v ~size_v = function + let add_base_value base ~size v ~size_v = function | Bottom -> Bottom | Top -> Top - | Map m -> Map (M.add_new_base base ~size v ~size_v m) + | Map m -> Map (M.add_base_value base ~size v ~size_v m) - let add_binding ~reducing ~exact m loc v = + let add_binding ~exact m loc v = (* TODO: this should depend on bottom being strict. *) - if V.equal v V.bottom then false, Bottom + if V.equal v V.bottom then Bottom else match m with - | Top -> (Locations.is_valid ~for_writing:true loc), Top - | Bottom -> false, Bottom + | Top -> Top + | Bottom -> Bottom | Map m -> try - let alarm, non_bottom, r = M.add_binding ~reducing ~exact m loc v in - alarm, (if non_bottom then Map r else Bottom) - with M.Result_is_top -> true, Top + let non_bottom, r = M.add_binding ~exact m loc v in + if non_bottom then Map r else Bottom + with M.Result_is_top -> Top let find ?(conflate_bottom=true) m loc = match m with - | Bottom -> false, V.bottom - | Top -> (Locations.is_valid ~for_writing:true loc), vtop () + | Bottom -> V.bottom + | Top -> vtop () | Map m -> M.find ~conflate_bottom m loc let join mm1 mm2 = match mm1, mm2 with @@ -753,26 +721,20 @@ struct | Bottom, m -> m | Map m1,Map m2 -> Map (M.widen wh m1 m2) - let paste_offsetmap ~reducing ~from ~dst_loc ~size ~exact m = + let paste_offsetmap ~from ~dst_loc ~size ~exact m = match m with - | Bottom -> false, m - | Top -> - let loc = make_loc dst_loc (Int_Base.inject size) in - (Locations.is_valid ~for_writing:true loc), m + | Bottom -> m + | Top -> m | Map m -> try - let alarm, non_bottom, r = - M.paste_offsetmap ~reducing ~from ~dst_loc ~size ~exact m - in - alarm, (if non_bottom then Map r else Bottom) - with M.Result_is_top -> true, Top + let non_bottom, r = M.paste_offsetmap ~from ~dst_loc ~size ~exact m in + if non_bottom then Map r else Bottom + with M.Result_is_top -> Top let copy_offsetmap src_loc size m = match m with - | Bottom -> false, `Bottom - | Top -> - let loc = make_loc src_loc (Int_Base.inject size) in - (Locations.is_valid ~for_writing:false loc), (M.top_offsetmap size) + | Bottom -> `Bottom + | Top -> M.top_offsetmap size | Map m -> M.copy_offsetmap src_loc size m let fold = M.fold diff --git a/src/kernel_services/abstract_interp/lmap.mli b/src/kernel_services/abstract_interp/lmap.mli index 406c2cc5a0e7964b237e88e54cdda61675479301..6d95d4206242aab18785e8c225a4ed1d38983b0b 100644 --- a/src/kernel_services/abstract_interp/lmap.mli +++ b/src/kernel_services/abstract_interp/lmap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/lmap_bitwise.ml b/src/kernel_services/abstract_interp/lmap_bitwise.ml index bb7fde6185a5ae27f5917d4705832a846475cdd4..a6b5cd5a28ce15408e7a7be9bd4ae8861e551253 100644 --- a/src/kernel_services/abstract_interp/lmap_bitwise.ml +++ b/src/kernel_services/abstract_interp/lmap_bitwise.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -55,8 +55,8 @@ module type Location_map_bitwise = sig val pretty_debug: t Pretty_utils.formatter - val add_binding : reducing:bool -> exact:bool -> t -> Zone.t -> v -> t - val add_binding_loc: reducing:bool -> exact:bool -> t -> location -> v -> t + val add_binding : exact:bool -> t -> Zone.t -> v -> t + val add_binding_loc: exact:bool -> t -> location -> v -> t val add_base: Base.t -> LOffset.t -> t -> t val remove_base: Base.t -> t -> t @@ -266,14 +266,9 @@ struct in fold_base f' m acc - let for_writing_validity ~reducing b = - if not reducing && Base.is_read_only b - then Base.Invalid - else Base.validity b - - let add_binding ~reducing ~exact m (loc:Zone.t) v = + let add_binding ~exact m (loc:Zone.t) v = let aux_base_offset base offs m = - let validity = for_writing_validity ~reducing base in + let validity = Base.validity base in try let offsm = find_or_default base m in match LOffset.add_binding_intervals ~validity ~exact offs v offsm with @@ -286,9 +281,9 @@ struct | _, Bottom -> Bottom | _, Map m -> Map (Zone.fold_topset_ok aux_base_offset loc m) - let add_binding_loc ~reducing ~exact m loc v = + let add_binding_loc ~exact m loc v = let aux_base_offset base offs m = - let validity = for_writing_validity ~reducing base in + let validity = Base.validity base in try let offsm = find_or_default base m in let new_offsetmap = @@ -377,15 +372,6 @@ struct | _, Bottom -> false | Map m1, Map m2 -> is_included_map m1 m2 - let join_and_is_included m1 m2 = match (m1,m2) with - | _, Top -> (Top, true) - | Top, _ -> (Top, false) - | Bottom, m2 -> (m2, true) - | m1, Bottom -> (m1, false) - | Map mm1, Map mm2 -> - let m = join_on_map mm1 mm2 in - if LBase.equal m mm2 then m2, true else Map m, false - let filter_base f m = match m with | Top -> Top diff --git a/src/kernel_services/abstract_interp/lmap_bitwise.mli b/src/kernel_services/abstract_interp/lmap_bitwise.mli index 90cba0abf740e446f53d58074984105cf495e705..f7c8c11cfa844df338e65b70d88f7d030368dfa4 100644 --- a/src/kernel_services/abstract_interp/lmap_bitwise.mli +++ b/src/kernel_services/abstract_interp/lmap_bitwise.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -58,8 +58,8 @@ module type Location_map_bitwise = sig val pretty_debug: t Pretty_utils.formatter - val add_binding : reducing:bool -> exact:bool -> t -> Zone.t -> v -> t - val add_binding_loc: reducing:bool -> exact:bool -> t -> location -> v -> t + val add_binding : exact:bool -> t -> Zone.t -> v -> t + val add_binding_loc: exact:bool -> t -> location -> v -> t val add_base: Base.t -> LOffset.t -> t -> t val remove_base: Base.t -> t -> t diff --git a/src/kernel_services/abstract_interp/lmap_sig.mli b/src/kernel_services/abstract_interp/lmap_sig.mli index 70e647bb95be0a992783e4d736574b7e69fbf242..ffd722585a6e7ebb1172406bbfe7f38bf76b1758 100644 --- a/src/kernel_services/abstract_interp/lmap_sig.mli +++ b/src/kernel_services/abstract_interp/lmap_sig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,8 +34,6 @@ type lmap = private Bottom | Top | Map of map include Datatype.S_with_collections with type t = lmap -include Lattice_type.With_Error_Top - val pretty: Format.formatter -> t -> unit val pretty_debug: Format.formatter -> t -> unit val pretty_filter: Format.formatter -> t -> Zone.t -> unit @@ -81,18 +79,16 @@ val widen : widen_hint-> t -> t -> t (** {2 Finding values} *) -val find: - ?conflate_bottom:bool -> t -> location -> bool * v +val find: ?conflate_bottom:bool -> t -> location -> v (** @raise Error_Top when the location or the state are Top, and there is no Top value in the type {!v}. *) val copy_offsetmap : - Location_Bits.t -> Integer.t -> t -> - bool * offsetmap Bottom.or_bottom + Location_Bits.t -> Integer.t -> t -> offsetmap Bottom.or_bottom (** [copy_offsetmap alarms loc size m] returns the superposition of the - ranges of [size] bits starting at [loc] within [m]. [size] must be strictly - greater than zero. Return [None] if all pointed addresses are invalid in [m]. - The boolean returned indicates that the location may be invalid. + ranges of [size] bits starting at [loc] within [m]. [size] must be + strictly greater than zero. Return [None] if all pointed addresses are + invalid in [m]. @raise Error_Top when the location or the state are Top, and there is no Top value in the type {!v}. *) @@ -108,41 +104,33 @@ val find_base_or_default : Base.t -> t -> offsetmap Bottom.Top.or_top_bottom (** {2 Binding variables} *) -(** [add_binding ~reducing ~exact initial_mem loc v] simulates the effect of +(** [add_binding ~exact initial_mem loc v] simulates the effect of writing [v] at location [loc], in the initial memory state given by [initial_mem]. If [loc] is not writable, {!bottom} is returned. If [exact] is true, and [loc] is a precise location, a strong update is performed. - If [reducing] is true, read-only locations are also updated; - this should only be used to build an initial state, - or to refine an existing state by a condition. - Returns [(alarm, offsm)], where [alarm] indicates that it may be invalid - to write at the location [loc]. [offsm] is the resulting memory after - the write. *) -val add_binding: - reducing:bool -> exact:bool -> t -> location -> v -> bool * t - -(** [paste_offsetmap ~reducing ~from ~dst_loc ~size ~exact m] + Only locations that may be valid are written. + Returns the resulting memory after the write. *) +val add_binding: exact:bool -> t -> location -> v -> t + +(** [paste_offsetmap ~from ~dst_loc ~size ~exact m] copies [from], which is supposed to be exactly [size] bits, and pastes them at [dst_loc] in [m]. The copy is exact if and only if - [dst_loc] is exact, and [exact] is true. The returned boolean indicates - that the destination location may be invalid. Passing [~reducing:true] - allows writing to location that are read-only. It should only be used - when creating an initial state, or when reducing an existing value. *) + [dst_loc] is exact, and [exact] is true. Only the locations that + may be valid are written. *) val paste_offsetmap : - reducing:bool -> from:offsetmap -> dst_loc:Location_Bits.t -> size:Integer.t -> exact:bool -> - t -> bool * t + t -> t val add_base : Base.t -> offsetmap -> t -> t (** [add_base b o m] adds base [b] bound to [o], replacing any previous bindings of [b]. No effect on [Top] or [Bottom]. *) -val add_new_base: +val add_base_value: Base.t -> size:Integer.t -> v -> size_v:Integer.t -> t -> t (** Creates the offsetmap described by [size], [v] and [size_v], and binds it to the base. No effect on [Top] or [Bottom]. *) diff --git a/src/kernel_services/abstract_interp/locations.ml b/src/kernel_services/abstract_interp/locations.ml index 4b585f3de48afb54b2bc7f0e73f8366f347916e3..67ae49339598f87ad7f7a06d42413d4713524a65 100644 --- a/src/kernel_services/abstract_interp/locations.ml +++ b/src/kernel_services/abstract_interp/locations.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -56,18 +56,44 @@ module Comp_exact = struct a t least cardinal two. *) end -module MapLatticeIval = - Map_Lattice.Make - (Base.Base)(Base.SetLattice)(Ival)(Comp_exact)(Initial_Values) + module Location_Bytes = struct - include MapLatticeIval + module M = + Hptmap.Make + (Base.Base) (Ival) (Comp_exact) (Initial_Values) + (struct let l = [ Ast.self ] end) + let () = Ast.add_monotonic_state M.self + let clear_caches = M.clear_caches + + module MapLattice = struct + include Map_lattice.Make_Map_Lattice (Base) (Ival) (M) + include With_Cardinality (Ival) + end + + module MapSetLattice = struct + include Map_lattice.Make_MapSet_Lattice + (Base.Base) (Base.SetLattice) (Ival) (MapLattice) + include With_Cardinality (MapLattice) + end + + include MapSetLattice (* Invariant : [Top (s, _) must always contain NULL, _and_ at least another base. Top ({Null}, _) is replaced by Top_int]. See inject_top_origin_internal below. *) + let find_or_bottom = MapLattice.find_or_bottom + let is_bottom = equal bottom + + let filter_base = filter_keys + let fold_bases = fold_keys + let fold_i f t acc = match t with + | Top _ -> raise Error_Top + | Map m -> MapLattice.fold f m acc + let fold_topset_ok = fold + let inject_ival i = inject Base.null i let inject_float f = @@ -88,21 +114,15 @@ module Location_Bytes = struct (* [shift offset l] is the location [l] shifted by [offset] *) let shift offset l = - if Ival.is_bottom offset then bottom else - try - map_offsets (Ival.add_int offset) l - with Error_Top -> l + if Ival.is_bottom offset then bottom + else map (Ival.add_int offset) l (* [shift_under offset l] is the location [l] (an under-approximation) shifted by [offset] (another under-approximation); returns an underapproximation. *) let shift_under offset l = - if Ival.is_bottom offset then bottom else - try - map_offsets (Ival.add_int_under offset) l - (* Note: having an under-approximation at top is probably - wrong. *) - with Error_Top -> assert false + if Ival.is_bottom offset then bottom + else map (Ival.add_int_under offset) l let sub_pointwise ?factor l1 l2 = let factor = match factor with @@ -155,15 +175,15 @@ module Location_Bytes = struct the creation order (except it is reversed), while the set is used to test inclusion efficiently so far. Only "original" garbled mix are tracked, i.e. operations that _transform a garbled mix are not tracked. *) - module ListGarbledMix = State_builder.List_ref(MapLatticeIval) + module ListGarbledMix = State_builder.List_ref(MapSetLattice) (struct let name = "Locations.ListGarbledMix" - let dependencies = [MapLatticeIval.M.self] + let dependencies = [M.self] end) - module SetGarbledMix = State_builder.Set_ref(MapLatticeIval.Set) + module SetGarbledMix = State_builder.Set_ref(MapSetLattice.Set) (struct let name = "Locations.SetGarbledMix" - let dependencies = [MapLatticeIval.M.self] + let dependencies = [M.self] end) let get_garbled_mix () = List.rev (ListGarbledMix.get ()) @@ -191,7 +211,7 @@ module Location_Bytes = struct let track_garbled_mix gm = if !ref_track_garbled_mix && is_gm_to_log gm && not (SetGarbledMix.mem gm) then begin - SetGarbledMix.set (MapLatticeIval.Set.add gm (SetGarbledMix.get ())); + SetGarbledMix.set (MapSetLattice.Set.add gm (SetGarbledMix.get ())); ListGarbledMix.set (gm :: ListGarbledMix.get ()); end; gm @@ -227,20 +247,21 @@ module Location_Bytes = struct let topify_with_origin o v = match v with | Top (s,a) -> - Top (s, Origin.join a o) + Top (s, Origin.join a o) | v when is_zero v -> v - | Map m -> - if is_bottom v then v - else inject_top_origin o (get_bases m) + | Map _ -> + if equal v bottom then v + else + match get_keys v with + | Base.SetLattice.Top -> top_with_origin o + | Base.SetLattice.Set b -> + track_garbled_mix (inject_top_origin_internal o b) let topify_with_origin_kind ok v = let o = Origin.current ok in topify_with_origin o v - let get_bases m = - match m with - | Top(top_param,_) -> top_param - | Map m -> Base.SetLattice.inject (get_bases m) + let get_bases = get_keys let is_relationable m = try @@ -317,23 +338,22 @@ module Location_Bytes = struct | Map m -> M.exists (fun b _ -> is_local b) m - let remove_escaping_locals is_local v = - match v with - | Top (Base.SetLattice.Top as t,_) -> t, v - | Top (Base.SetLattice.Set garble, orig) -> - let locals, nonlocals = Base.Hptset.partition is_local garble in - Base.SetLattice.inject locals, inject_top_origin_internal orig nonlocals - | Map m -> - let locals, clean_map = - M.fold - (fun base _ (locals, m as acc) -> - if is_local base - then (Base.Hptset.add base locals), (M.remove base m) - else acc) - m - (Base.Hptset.empty, m) - in - (Base.SetLattice.inject locals), Map clean_map + let remove_escaping_locals is_local v = + let non_local b = not (is_local b) in + match v with + | Top (Base.SetLattice.Top,_) -> true, v + | Top (Base.SetLattice.Set garble, orig) -> + let nonlocals = Base.Hptset.filter non_local garble in + if Base.Hptset.equal garble nonlocals then + false, v + else + true, inject_top_origin_internal orig nonlocals + | Map m -> + let nonlocals = M.filter non_local m in + if M.equal nonlocals m then + false, v + else + true, Map nonlocals let contains_addresses_of_any_locals = let f base _offsets = Base.is_any_formal_or_local base in @@ -397,7 +417,12 @@ module Location_Bytes = struct in map_partially_overlaps m1 m2 - let widen (size, wh) = + + type size_widen_hint = Ival.size_widen_hint + type generic_widen_hint = Base.t -> Ival.generic_widen_hint + type widen_hint = size_widen_hint * generic_widen_hint + + let widen (size, wh) = let widen_map = let decide k v1 v2 = (* Do not perform size-based widening for pointers. This will only @@ -412,10 +437,9 @@ module Location_Bytes = struct in fun m1 m2 -> match m1, m2 with - | _ , Top _ -> m2 - | Top _, _ -> assert false (* m2 should be larger than m1 *) - | Map m1, Map m2 -> - Map (widen_map m1 m2) + | _ , Top _ -> m2 + | Top _, _ -> assert false (* m2 should be larger than m1 *) + | Map m1, Map m2 -> Map (widen_map m1 m2) end @@ -425,12 +449,30 @@ module Zone = struct module Initial_Values = struct let v = [ ] end - include Map_Lattice.Make_without_cardinal - (Base.Base) - (Base.SetLattice) - (Int_Intervals) - (Hptmap.Comp_unused) - (Initial_Values) + module M = + Hptmap.Make + (Base.Base) (Int_Intervals) (Hptmap.Comp_unused) (Initial_Values) + (struct let l = [ Ast.self ] end) + let () = Ast.add_monotonic_state M.self + let clear_caches = M.clear_caches + + module MapLattice = + Map_lattice.Make_Map_Lattice (Base) (Int_Intervals) (M) + + type map_t = MapLattice.t + let find_or_bottom = MapLattice.find_or_bottom + + include Map_lattice.Make_MapSet_Lattice + (Base.Base) (Base.SetLattice) (Int_Intervals) (MapLattice) + + let is_bottom = equal bottom + + let filter_base = filter_keys + let fold_bases = fold_keys + let fold_i f t acc = match t with + | Top _ -> raise Error_Top + | Map m -> MapLattice.fold f m acc + let fold_topset_ok = fold let pretty fmt m = match m with @@ -498,7 +540,8 @@ exception Found_two (* Reduce [offsets] so that reading [size] from [offsets] fits within the validity of [base]. If [aligned] is set to true, make the offset - congruent to 0 modulo 8. *) + congruent to 0 modulo 8. + Maintain synchronized with Precise_locs.reduce_offset_by_validity. *) let reduce_offset_by_validity ~for_writing ?(bitfield=true) base offsets size = if for_writing && Base.is_read_only base then Ival.bottom @@ -510,7 +553,10 @@ let reduce_offset_by_validity ~for_writing ?(bitfield=true) base offsets size = | _, Int_Base.Top -> offsets | (Base.Known (minv,maxv) | Base.Unknown (minv,_,maxv)), Int_Base.Value size -> - let maxv = Int.succ (Int.sub maxv size) in + (* The maximum offset is maxv - (size - 1), except if size = 0, + in which case the maximum offset is exactly maxv. *) + let pred_size = Int.max Int.zero (Int.pred size) in + let maxv = Int.sub maxv pred_size in let range = if bitfield then Ival.inject_range (Some minv) (Some maxv) @@ -518,7 +564,8 @@ let reduce_offset_by_validity ~for_writing ?(bitfield=true) base offsets size = in Ival.narrow range offsets | Base.Variable variable_v, Int_Base.Value size -> - let maxv = Int.succ (Int.sub variable_v.Base.max_alloc size) in + let pred_size = Int.max Int.zero (Int.pred size) in + let maxv = Int.sub variable_v.Base.max_alloc pred_size in let range = Ival.inject_range (Some Int.zero) (Some maxv) in @@ -554,30 +601,17 @@ let valid_cardinal_zero_or_one ~for_writing {loc=loc;size=size} = true end with - | Int_Base.Error_Top | Found_two -> false + | Abstract_interp.Error_Top | Found_two -> false let loc_bytes_to_loc_bits x = - match x with - | Location_Bytes.Map _ -> - Location_Bytes.map_offsets - (Ival.scale (Bit_utils.sizeofchar())) - x - | Location_Bytes.Top _ -> x + Location_Bytes.map (Ival.scale (Bit_utils.sizeofchar())) x let loc_bits_to_loc_bytes x = - match x with - | Location_Bits.Map _ -> - Location_Bits.map_offsets - (Ival.scale_div ~pos:true (Bit_utils.sizeofchar())) x - | Location_Bits.Top _ -> x + Location_Bits.map (Ival.scale_div ~pos:true (Bit_utils.sizeofchar())) x let loc_bits_to_loc_bytes_under x = - match x with - | Location_Bits.Map _ -> - Location_Bits.map_offsets - (Ival.scale_div_under ~pos:true (Bit_utils.sizeofchar())) x - | Location_Bits.Top _ -> x + Location_Bits.map (Ival.scale_div_under ~pos:true (Bit_utils.sizeofchar())) x let loc_to_loc_without_size {loc = loc} = loc_bits_to_loc_bytes loc @@ -586,16 +620,13 @@ let loc_size { size = size } = size let make_loc loc_bits size = { loc = loc_bits; size = size } let is_valid ~for_writing {loc; size} = - try - let size = Int_Base.project size in + match size with + | Int_Base.Top -> false + | Int_Base.Value size -> let is_valid_offset b o = Base.is_valid_offset ~for_writing size b o in match loc with - | Location_Bits.Top _ -> false - | Location_Bits.Map m -> - Location_Bits.M.iter is_valid_offset m; - true - with - | Int_Base.Error_Top | Base.Not_valid_offset -> false + | Location_Bits.Top _ -> false + | Location_Bits.Map m -> Location_Bits.M.for_all is_valid_offset m let filter_base f loc = @@ -627,7 +658,7 @@ let loc_of_typoffset b typ offset = make_loc (Location_Bits.inject b Ival.top) Int_Base.top let loc_bottom = make_loc Location_Bits.bottom Int_Base.top -let is_bottom_loc l = Location_Bits.is_bottom l.loc +let is_bottom_loc l = Location_Bits.(equal l.loc bottom) let cardinal_zero_or_one { loc = loc ; size = size } = Location_Bits.cardinal_zero_or_one loc && @@ -660,7 +691,7 @@ let pretty_english ~prefix fmt { loc = m ; size = size } = Format.fprintf fmt "somewhere in %a (origin:%a)" Base.SetLattice.pretty s Origin.pretty a - | Location_Bits.Map _ when Location_Bits.is_bottom m -> + | Location_Bits.Map _ when Location_Bits.(equal m bottom) -> Format.fprintf fmt "nowhere" | Location_Bits.Map off -> let print_binding fmt (k, v) = @@ -734,8 +765,8 @@ let valid_part ~for_writing ?(bitfield=true) {loc = loc; size = size } = | Location_Bits.Top (Base.SetLattice.Set _, _) -> Location_Bits.(Map (fold_topset_ok compute_loc loc M.empty)) | Location_Bits.Map m -> - Location_Bits.inject_map - (Location_Bits.M.fold compute_loc m Location_Bits.M.empty) + Location_Bits.Map + (Location_Bits.M.fold compute_loc m Location_Bits.M.empty) in make_loc locbits size @@ -764,32 +795,6 @@ let zone_of_varinfo var = enumerate_bits (loc_of_varinfo var) of the location [l] *) let invalid_part l = l (* TODO (but rarely useful) *) - -let filter_loc ({loc = loc; size = size } as initial) zone = - try - let result = Location_Bits.fold_i - (fun base ival acc -> - let result_ival = - match zone,size with - | Zone.Top _, _ | _, Int_Base.Top -> ival - | Zone.Map zone_m,Int_Base.Value size -> - Int_Intervals.fold - (fun (bi,ei) acc -> - let width = Int.length bi ei in - if Int.lt width size - then acc - else - Ival.inject_range (Some bi) (Some (Int.length size ei))) - (Zone.find_or_bottom base zone_m) - Ival.bottom - in - Location_Bits.join acc (Location_Bits.inject base result_ival)) - loc - Location_Bits.bottom - in - make_loc result size - with Location_Bits.Error_Top -> initial - module Location = Datatype.Make (struct diff --git a/src/kernel_services/abstract_interp/locations.mli b/src/kernel_services/abstract_interp/locations.mli index 9b7858beeb8c1dfb18f928970cd518a8285fa1b6..af10238a95cb567fe53657de4eccddf0a7598c40 100644 --- a/src/kernel_services/abstract_interp/locations.mli +++ b/src/kernel_services/abstract_interp/locations.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -56,8 +56,7 @@ module Location_Bytes : sig such as [join], [narrow], etc. *) include Lattice_type.AI_Lattice_with_cardinal_one with type t := t - and type widen_hint := widen_hint - include Lattice_type.With_Error_Top + and type widen_hint := widen_hint include Datatype.S_with_collections with type t := t @@ -141,6 +140,9 @@ module Location_Bytes : sig joiner:('a -> 'a -> 'a) -> empty:'a -> t -> 'a (** Cached version of [fold_i], for advanced users *) + val for_all: (Base.t -> Ival.t -> bool) -> t -> bool + val exists: (Base.t -> Ival.t -> bool) -> t -> bool + val filter_base : (Base.t -> bool) -> t -> t @@ -180,10 +182,10 @@ module Location_Bytes : sig if [loc] contains the address of a variable for which [is_local] returns [true] *) - val remove_escaping_locals : (M.key -> bool) -> t -> Base.SetLattice.t * t - (** TODO: merge with above function - [remove_escaping_locals is_local v] removes from [v] information - associated with bases for which [is_local] returns [true]. *) + val remove_escaping_locals : (M.key -> bool) -> t -> bool * t + (** [remove_escaping_locals is_local v] removes from [v] the information + associated with bases for which [is_local] returns [true]. The + returned boolean indicates that [v] contained some locals. *) val contains_addresses_of_any_locals : t -> bool (** [contains_addresses_of_any_locals loc] returns [true] iff [loc] contains @@ -247,10 +249,6 @@ module Zone : sig val is_bottom: t -> bool val inject : Base.t -> Int_Intervals.t -> t - exception Error_Top - - val map_i : (Base.t -> Int_Intervals.t -> t) -> t -> t - val find_lonely_key : t -> Base.t * Int_Intervals.t val find_or_bottom : Base.t -> map_t -> Int_Intervals.t val find: Base.t -> t -> Int_Intervals.t @@ -357,7 +355,6 @@ val valid_cardinal_zero_or_one : for_writing:bool -> location -> bool (** Is the valid part of the location bottom or a singleton? *) val filter_base: (Base.t -> bool) -> location -> location -val filter_loc : location -> Zone.t -> location val pretty : Format.formatter -> location -> unit val pretty_english : prefix:bool -> Format.formatter -> location -> unit diff --git a/src/kernel_services/abstract_interp/map_Lattice.ml b/src/kernel_services/abstract_interp/map_Lattice.ml deleted file mode 100644 index 02d2dc6659bbe4386c26b33dffc60c3bd054b9a5..0000000000000000000000000000000000000000 --- a/src/kernel_services/abstract_interp/map_Lattice.ml +++ /dev/null @@ -1,574 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Map from a set of keys to values (a [Lattice_With_Diff]), equipped - with the natural lattice interpretation. Keys must be mappable to - integers in an unique way, and one of its elements ([null]) is - singled out. *) - -open Abstract_interp - -module type Key = sig - include Datatype.S - val id : t -> int -end - -module Make_without_cardinal - (K : Key) - (Top_Param : Lattice_type.Lattice_Hashconsed_Set with type O.elt=K.t) - (V : sig - include Lattice_type.Full_Lattice - val pretty_debug: t Pretty_utils.formatter - end) - (Comp: sig (** See {!Hptmap} for the documentation of this option *) - val e: bool - val f : K.t -> V.t -> bool - val compose : bool -> bool -> bool - end) - (L: sig val v : (K.t * V.t) list list end) - = -struct - - module M = - Hptmap.Make - (K) - (V) - (Comp) - (struct let v = [] :: L.v end) - (struct let l = [ Ast.self ] end) (* TODO: this should be an argument of the functor *) - let () = Ast.add_monotonic_state M.self - - - module Top_Param = Top_Param - - type map_t = M.t - - type t = Top of Top_Param.t * Origin.t | Map of map_t - (** No function of this module creates a [Top] out of a [Map]. [Top] are - always derived from an existing [Top] value. *) - - let top = Top(Top_Param.top, Origin.top) - - let hash v = - match v with - Map m -> - (* let f k v acc = - (V.hash v) + 11 * acc + 54971 * K.hash k in - M.fold f m 3647 *) - M.hash m - | Top (bases, orig) -> - Origin.hash orig + (299 * (Top_Param.hash bases)) - - let add_or_bottom k v m = - if V.equal v V.bottom - then M.remove k m - else M.add k v m - - let add k v m = match m with - | Top (Top_Param.Top, _) -> m - | Top (Top_Param.Set s, o) -> Top (Top_Param.(inject (O.add k s)), o) - | Map m -> Map (add_or_bottom k v m) - - let bottom = Map M.empty - - let inject k v = - Map (add_or_bottom k v M.empty) - - let pretty fmt m = - match m with - | Top (t, a) -> - Format.fprintf fmt "@[<hov 2>{{ mix of %a.@ Origin: %a}}@]" - Top_Param.pretty t - Origin.pretty a - | Map m -> - Pretty_utils.pp_iter - ~pre:"@[<hv 3>{{ " - ~suf:" }}@]" - ~sep:";@ " - (fun pp map -> M.iter (fun k v -> pp (k, v)) map) - (fun fmt (k, v) -> Format.fprintf fmt "%a -> %a" K.pretty k V.pretty v) - fmt m - - let pretty_debug fmt m = - match m with - | Top (t, a) -> - Format.fprintf fmt "@[<hov 2>{{ mix of %a.@ Origin: %a}}@]" - Top_Param.pretty t - Origin.pretty a - | Map m -> - M.pretty_debug fmt m - - - let find_or_bottom k m = - try - M.find_check_missing k m (* locations are usually small, so the difference - between [M.find] and [M.find_check_missing] is usually unimportant. - However, [find_check_missing] is more efficient when we query NULL, - which is a very common case. *) - with - Not_found -> V.bottom - - let split k m = - match m with - | Top (t,_) -> - if Top_Param.is_included (Top_Param.inject_singleton k) t - then V.top, m - else V.bottom, m - | Map m -> - find_or_bottom k m, - Map (M.remove k m) - - let inject_map m = Map m - - let get_bases map = - (M.fold (fun k _ acc -> Top_Param.O.add k acc) map Top_Param.O.empty) - - exception Error_Top - - let equal m1 m2 = - m1 == m2 || - match m1, m2 with - | Top (s, a), Top (s', a') -> - Top_Param.equal s s' && Origin.equal a a' - | Map m1, Map m2 -> - M.equal m1 m2 - | _ -> false - - let compare = - if M.compare == Datatype.undefined || - Top_Param.compare == Datatype.undefined || - Origin.compare == Datatype.undefined - then (Kernel.debug "%s map_lattice, missing comparison function: %b %b %b" - M.name - (M.compare == Datatype.undefined) - (Top_Param.compare == Datatype.undefined) - (Origin.compare == Datatype.undefined); - Datatype.undefined) - else - fun m1 m2 -> - if m1 == m2 then 0 - else match m1, m2 with - | Top _, Map _ -> -1 - | Map _, Top _ -> 1 - | Map m1, Map m2 -> M.compare m1 m2 - | Top (s, a), Top (s', a') -> - let r = Top_Param.compare s s' in - if r = 0 then Origin.compare a a' - else r - - - let is_bottom b = equal b bottom - - let check_join_assert = ref 0 - - let join = - let decide _ v1 v2 = V.join v1 v2 in - let name = Printf.sprintf "Map_Lattice(%s).join" V.name in - let symmetric_merge = - M.join ~cache:(Hptmap_sig.PersistentCache name) - ~symmetric:true ~idempotent:true ~decide - in - fun m1 m2 -> - if m1 == m2 then m1 else - match m1, m2 with - | Top(x1,a1), Top(x2,a2) -> - Top(Top_Param.join x1 x2, Origin.join a1 a2) - | Top (Top_Param.Top,_) as x, Map _ - | Map _, (Top (Top_Param.Top,_) as x) -> - x - | Top (Top_Param.Set t, o), Map m | Map m, Top (Top_Param.Set t, o) -> - let s = M.fold (fun k _ acc -> Top_Param.O.add k acc) m t in - Top (Top_Param.inject s, o) - | Map mm1, Map mm2 -> - let mresult = symmetric_merge mm1 mm2 in - assert (true || - let n = succ !check_join_assert in - check_join_assert := n; - n land 63 <> 0 || - let merge_key k v acc = - M.add k (V.join v (find_or_bottom k mm2)) acc - in - let mr' = M.fold merge_key mm1 mm2 in - if M.equal mresult mr' then - true - else begin - let pp_one fmt mm = - Format.fprintf fmt "%a (%d;%x)@." - M.pretty_debug mm (M.hash mm) - (Extlib.address_of_value mm) - in - Format.printf "Map_Lattice.join incorrect@. %a+%a->@. %a/%a" - pp_one mm1 pp_one mm2 pp_one mresult pp_one mr'; - false; - end); - Map mresult - - let cached_fold ~cache_name ~temporary ~f ~projection ~joiner ~empty = - let folded_f = M.cached_fold ~cache_name ~temporary ~f ~joiner ~empty in - function m -> - match m with - Top (Top_Param.Top, _) -> raise Error_Top - | Top (Top_Param.Set s, _) -> - let f_base base acc = - let total_itvs = projection base in - joiner (f base total_itvs) acc - in - Top_Param.O.fold f_base s empty - | Map mm -> - folded_f mm - - let map_offsets f m = - match m with - | Top _ -> raise Error_Top - | Map m -> Map (M.map f m) - - (** Over-approximation of the filter (in the case [Top Top])*) - let filter_base f m = - match m with - | Top (t, o) -> begin - try - let add v acc = if f v then Top_Param.O.add v acc else acc in - let s = Top_Param.fold add t Top_Param.O.empty in - Top (Top_Param.inject s, o) - with Top_Param.Error_Top -> top - end - | Map m -> - Map (M.fold (fun k _ acc -> if f k then acc else M.remove k acc) m m) - - let meet = - let decide _k v1 v2 = - let r = V.meet v1 v2 in - if V.equal V.bottom r then None else Some r - in - let name = Printf.sprintf "Map_Lattice(%s).meet" V.name in - let merge = - M.inter ~cache:(Hptmap_sig.PersistentCache name) - ~symmetric:true ~idempotent:true ~decide - in - fun m1 m2 -> - match m1, m2 with - | Top (x1, a1), Top (x2, a2) -> - let meet_topparam = Top_Param.meet x1 x2 in - Top (meet_topparam, Origin.meet a1 a2) - | Top (Top_Param.Top, _), (Map _ as x) - | (Map _ as x),Top (Top_Param.Top, _) -> x - | Top (Top_Param.Set set, _), (Map _ as x) - | (Map _ as x), Top (Top_Param.Set set, _) -> - filter_base (fun v -> Top_Param.O.mem v set) x - | Map m1, Map m2 -> Map (merge m1 m2) - - let narrow = - let compute_origin_narrow x1 a1 x2 a2 = - if Top_Param.equal x1 x2 then Origin.narrow a1 a2 (* equals a1 currently*) - else if Top_Param.is_included x1 x2 then a1 - else if Top_Param.is_included x2 x1 then a2 - else Origin.top - in - let decide _k v1 v2 = - let r = V.narrow v1 v2 in - if V.equal V.bottom r then None else Some r - in - let name = Printf.sprintf "Map_Lattice(%s).narrow" V.name in - let merge = - M.inter ~cache:(Hptmap_sig.PersistentCache name) - ~symmetric:true ~idempotent:true ~decide - in - fun m1 m2 -> - match m1, m2 with - | Top (x1, a1), Top (x2, a2) -> - Top (Top_Param.narrow x1 x2, - compute_origin_narrow x1 a1 x2 a2) - | Top (Top_Param.Top, _), (Map _ as x) - | (Map _ as x),Top (Top_Param.Top, _) -> x - | Top (Top_Param.Set set, _), (Map _ as x) - | (Map _ as x), Top (Top_Param.Set set, _) -> - filter_base (fun v -> Top_Param.O.mem v set) x - | Map m1, Map m2 -> Map (merge m1 m2) - - let is_included = - let name = - Format.asprintf "Map_Lattice(%s)(%s).is_included" K.name V.name - in - let decide_fst _ _ = false in - let decide_snd _ _ = true in - let decide_both _ v1 v2 = V.is_included v1 v2 in - let decide_fast = M.decide_fast_inclusion in - let map_is_included = - M.binary_predicate (Hptmap_sig.PersistentCache name) M.UniversalPredicate - ~decide_fast ~decide_fst ~decide_snd ~decide_both - in - fun m1 m2 -> - (match m1,m2 with - | Top (s,a), Top (s',a') -> - Top_Param.is_included s s' && - Origin.is_included a a' - | Map _, Top (Top_Param.Top, _) -> true - | Map m, Top (Top_Param.Set set, _) -> - M.for_all (fun k _ -> Top_Param.O.mem k set) m - | Top _, Map _ -> false - | Map m1, Map m2 -> map_is_included m1 m2) - - let join_and_is_included a b = - let ab = join a b in (ab, equal a b) - - (* under-approximation of union *) - let link = - let decide _k v1 v2 = V.link v1 v2 in - let name = Printf.sprintf "Map_Lattice(%s).link" V.name in - let merge = - M.join ~cache:(Hptmap_sig.PersistentCache name) - ~symmetric:true ~idempotent:true ~decide - in - fun m1 m2 -> match m1, m2 with - | Top _, Map _ -> m1 (* may be approximated *) - | Map _, Top _ -> m2 (* may be approximated *) - | Top (s,_), Top (s',_) -> - if Top_Param.is_included s s' then m2 (* may be approximated *) - else if Top_Param.is_included s' s then m1 (* may be approximated *) - else m1 (* very approximated *) - | Map mm1, Map mm2 -> Map (merge mm1 mm2) - - let intersects = - let name = - Format.asprintf "Map_Lattice(%s)(%s).intersects" K.name V.name - in - let map_intersects = - M.symmetric_binary_predicate - (Hptmap_sig.PersistentCache name) M.ExistentialPredicate - ~decide_fast:M.decide_fast_intersection - ~decide_one:(fun _ _ -> false) - ~decide_both:(fun _ x y -> V.intersects x y) - in - fun mm1 mm2 -> - match mm1, mm2 with - | Top (s1, _), Top (s2, _) -> - Top_Param.intersects s1 s2 - | Top (Top_Param.Top, _), Map m | Map m, Top (Top_Param.Top, _) -> - not (M.equal m M.empty) - | Top (Top_Param.Set s, _), Map m | Map m, Top (Top_Param.Set s, _) -> - M.exists (fun b _ -> Top_Param.O.mem b s) m - | Map m1, Map m2 -> map_intersects m1 m2 - - let find k v = - match v with - | Top (s, _) -> - if Top_Param.mem k s then V.top else V.bottom - | Map m -> find_or_bottom k m - - (** if there is only one key [k] in map [m], then returns the pair [k,v] - where [v] is the value associated to [k]. - @raise Not_found otherwise. *) - let find_lonely_key m = - match m with - | Top _ -> raise Not_found - | Map m -> - match M.is_singleton m with - | Some p -> p - | _ -> raise Not_found - - let diff m1 m2 = - match m1, m2 with - | Top _, _ | _, Top _ -> m1 - | Map mm1, Map mm2 -> - let result = - M.fold - (fun k v1 acc -> - let dif = - try - let v2 = M.find k mm2 in - (V.diff v1 v2) - with Not_found -> v1 - in - add_or_bottom k dif acc) - mm1 - M.empty - in - Map result - - let map_i f m = - match m with - | Top _ -> top - | Map m -> - M.fold - (fun k vl acc -> - join acc (f k vl)) - m - bottom - - let fold_bases f m acc = - match m with - | Top(Top_Param.Set t, _) -> - Top_Param.O.fold f t acc - | Top(Top_Param.Top, _) -> - raise Error_Top - | Map m -> - M.fold (fun k _ acc -> f k acc) m acc - - (** [fold_i f m acc] folds [f] on the bindings in [m]. - @raise Error_Top if [m] is too imprecise for folding. *) - let fold_i f m acc = - match m with - Top(Top_Param.Set _, _) -> - (* In this function, - we refuse to iterate on the bases of a value Top(Top_Param.Set _,_) - *) - raise Error_Top - | Top(Top_Param.Top, _) -> - raise Error_Top - | Map m -> - M.fold f m acc - - let fold_topset_ok f m acc = - match m with - | Top(Top_Param.Set t, _) -> - Top_Param.O.fold (fun x acc -> f x V.top acc) t acc - | Top(Top_Param.Top, _) -> - raise Error_Top - | Map m -> - M.fold f m acc - - include (Datatype.Make_with_collections - (struct - type map = t - type t = map - let name = M.name ^ " map_lattice" - let structural_descr = - Structural_descr.t_sum - [| [| Top_Param.packed_descr; Structural_descr.p_abstract |]; - [| M.packed_descr |] |] - let reprs = List.map (fun m -> Map m) M.reprs - let equal = equal - let compare = compare - let hash = hash - let rehash = Datatype.identity - let copy = Datatype.undefined - let internal_pretty_code = Datatype.pp_fail - let pretty = pretty - let mem_project = Datatype.never_any_project - let varname = Datatype.undefined - end): Datatype.S_with_collections with type t := t) - - let clear_caches = M.clear_caches - -end - - -module Make - (K : Key) - (Top_Param : Lattice_type.Lattice_Hashconsed_Set with type O.elt=K.t) - (V : sig - type generic_widen_hint - type size_widen_hint - include Lattice_type.Full_AI_Lattice_with_cardinality - with type widen_hint = size_widen_hint * generic_widen_hint - val pretty_debug: t Pretty_utils.formatter - end) - (Comp: sig (** See {!Hptmap} for the documentation of this option *) - val e: bool - val f : K.t -> V.t -> bool - val compose : bool -> bool -> bool - end) - (L: sig val v : (K.t * V.t) list list end) - = -struct - include Make_without_cardinal(K)(Top_Param)(V)(Comp)(L) - - type size_widen_hint = V.size_widen_hint - type generic_widen_hint = K.t -> V.generic_widen_hint - type widen_hint = size_widen_hint * generic_widen_hint - - let widen (size,wh) = - let widen_map = - let decide k v1 v2 = V.widen (size,wh k) v1 v2 in - M.join - ~cache:Hptmap_sig.NoCache (* No cache, because of wh *) - ~symmetric:false ~idempotent:true ~decide - in - fun m1 m2 -> - match m1, m2 with - | _ , Top _ -> m2 - | Top _, _ -> assert false (* m2 should be larger than m1 *) - | Map m1, Map m2 -> - Map (widen_map m1 m2) - - (** if there is only one binding [k -> v] in map [m] (that is, only one key - [k] and [cardinal_zero_or_one v]), returns the pair [k,v]. - @raise Not_found otherwise *) - let find_lonely_binding m = - let _,v as pair = find_lonely_key m in - if not (V.cardinal_zero_or_one v) - then raise Not_found - else pair - - let cardinal_zero_or_one m = - equal m bottom || - try - let _,_ = find_lonely_binding m - in true - with Not_found -> false - - (** the cardinal of a map [m] is the sum of the cardinals of the - values bound to a key in [m] *) - let cardinal_less_than m n = - match m with - | Top _ -> raise Not_less_than - | Map m -> - M.fold - (fun _base v card -> card + V.cardinal_less_than v (n-card)) - m - 0 - - let fold_enum f m acc = - match m with - | Top _ -> raise Error_Top - | Map m -> - try - M.fold - (fun k vl acc -> - let g one_ival acc = - let one_loc = inject k one_ival in - f one_loc acc - in - V.fold_enum g vl acc) - m - acc - with V.Error_Top -> raise Error_Top - - let diff_if_one m1 m2 = - match m1 with - | Top _ -> m1 - | Map mm1 -> - try - let k2,v2 = find_lonely_binding m2 in - let v1 = find_or_bottom k2 mm1 in - let v = V.diff_if_one v1 v2 in - Map (add_or_bottom k2 v mm1) - with Not_found -> m1 - -end - - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/kernel_services/abstract_interp/map_lattice.ml b/src/kernel_services/abstract_interp/map_lattice.ml new file mode 100644 index 0000000000000000000000000000000000000000..6e14bd3ff00b60446a215f9c00f92d229714796d --- /dev/null +++ b/src/kernel_services/abstract_interp/map_lattice.ml @@ -0,0 +1,531 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + + +(* --------------------------- Module Types --------------------------------- *) + +module type Value = sig + include Datatype.S + val top: t + val bottom: t +end + +module type Lattice = sig + include Lattice_type.Bounded_Join_Semi_Lattice + include Lattice_type.With_Narrow with type t := t + include Lattice_type.With_Under_Approximation with type t := t + include Lattice_type.With_Intersects with type t := t + include Lattice_type.With_Diff with type t := t +end + +module type Lattice_with_cardinality = sig + include Lattice_type.With_Cardinal_One + include Lattice_type.With_Diff_One with type t := t + include Lattice_type.With_Enumeration with type t := t +end + +module type Map_Lattice = sig + include Hptmap_sig.S + include Lattice with type t := t + val find_or_bottom: key -> t -> v + val find_lonely_key: t -> key * v +end + +module type Map_Lattice_with_cardinality = sig + include Lattice_with_cardinality + type key + type v + val find_lonely_binding: t -> key * v +end + +module type MapSet_Lattice = sig + type set + type map + type t = Top of set * Origin.t | Map of map + include Datatype.S_with_collections with type t := t + include Lattice with type t := t + + val bottom: t + val top: t + type key + type v + val add: key -> v -> t -> t + val find: key -> t -> v + val find_lonely_key: t -> key * v + val split : key -> t -> v * t + val inject : key -> v -> t + val get_keys : t -> set + val filter_keys : (key -> bool) -> t -> t + val map: (v -> v) -> t -> t + val fold_keys : (key -> 'a -> 'a) -> t -> 'a -> 'a + val fold : (key -> v -> 'a -> 'a) -> t -> 'a -> 'a + val cached_fold: + cache_name:string -> temporary:bool -> + f:(key -> v -> 'a) -> + projection:(key -> v) -> joiner:('a -> 'a -> 'a) -> empty:'a -> t -> 'a + val for_all: (key -> v -> bool) -> t -> bool + val exists: (key -> v -> bool) -> t -> bool + val pretty_debug : Format.formatter -> t -> unit +end + +module type MapSet_Lattice_with_cardinality = sig + include Lattice_with_cardinality + type key + type v + val find_lonely_binding: t -> key * v +end + + +(* --------------------------- Map Lattice ---------------------------------- *) + +module Make_Map_Lattice + (Key: Hptmap.Id_Datatype) + (Value : Lattice_type.Full_Lattice) + (KVMap : Hptmap_sig.S with type key = Key.t + and type v = Value.t) += struct + + include KVMap + + let bottom = KVMap.empty + + let add_or_bottom k v m = + if Value.equal v Value.bottom + then KVMap.remove k m + else KVMap.add k v m + + let find_or_bottom k m = + (* locations are usually small, so the difference between [M.find] and + [M.find_check_missing] is usually unimportant. However, + [find_check_missing] is more efficient when we query NULL, which is a + very common case. *) + try KVMap.find_check_missing k m + with Not_found -> Value.bottom + + let join = + let decide _ v1 v2 = Value.join v1 v2 + and name = Printf.sprintf "Map_Lattice(%s).join" Value.name in + KVMap.join ~cache:(Hptmap_sig.PersistentCache name) + ~symmetric:true ~idempotent:true ~decide + + let link = + let decide _k v1 v2 = Value.link v1 v2 in + let name = Printf.sprintf "Map_Lattice(%s).link" Value.name in + KVMap.join ~cache:(Hptmap_sig.PersistentCache name) + ~symmetric:true ~idempotent:true ~decide + + let check_join_assert = ref 0 + + let _debug_join m1 m2 = + let result = join m1 m2 in + assert (true || + let n = succ !check_join_assert in + check_join_assert := n; + n land 63 <> 0 || + let merge_key k v acc = + KVMap.add k (Value.join v (find_or_bottom k m2)) acc + in + let mr' = KVMap.fold merge_key m1 m2 in + if KVMap.equal result mr' then + true + else begin + let pp_one fmt mm = + Format.fprintf fmt "%a (%d;%x)@." + KVMap.pretty_debug mm (KVMap.hash mm) + (Extlib.address_of_value mm) + in + Format.printf "Map_Lattice.join incorrect@. %a+%a->@. %a/%a" + pp_one m1 pp_one m2 pp_one result pp_one mr'; + false; + end); + result + + let narrow = + let decide _k v1 v2 = + let r = Value.narrow v1 v2 in + if Value.equal Value.bottom r then None else Some r + in + let name = Printf.sprintf "Map_Lattice(%s).narrow" Value.name in + KVMap.inter ~cache:(Hptmap_sig.PersistentCache name) + ~symmetric:true ~idempotent:true ~decide + + let meet = + let decide _k v1 v2 = + let r = Value.meet v1 v2 in + if Value.equal Value.bottom r then None else Some r + in + let name = Printf.sprintf "Map_Lattice(%s).meet" Value.name in + KVMap.inter ~cache:(Hptmap_sig.PersistentCache name) + ~symmetric:true ~idempotent:true ~decide + + let is_included = + let name = Format.asprintf "Map_Lattice(%s).is_included" Value.name in + let decide_fst _ _ = false in + let decide_snd _ _ = true in + let decide_both _ v1 v2 = Value.is_included v1 v2 in + let decide_fast = KVMap.decide_fast_inclusion in + KVMap.binary_predicate + (Hptmap_sig.PersistentCache name) KVMap.UniversalPredicate + ~decide_fast ~decide_fst ~decide_snd ~decide_both + + let intersects = + let name = Format.asprintf "Map_Lattice(%s).intersects" Value.name in + KVMap.symmetric_binary_predicate + (Hptmap_sig.PersistentCache name) + KVMap.ExistentialPredicate + ~decide_fast:KVMap.decide_fast_intersection + ~decide_one:(fun _ _ -> false) + ~decide_both:(fun _ x y -> Value.intersects x y) + + let diff = + let name = Format.asprintf "Map_Lattice(%s).diff" Value.name in + let decide_both _key v1 v2 = + let v = Value.diff v1 v2 in + if Value.(equal bottom v) then None else Some v + in + KVMap.merge + ~cache:(Hptmap_sig.PersistentCache name) + ~symmetric:false + ~idempotent:false + ~decide_left:KVMap.Neutral + ~decide_right:KVMap.Absorbing + ~decide_both + + (** if there is only one key [k] in map [m], then returns the pair [k,v] + where [v] is the value associated to [k]. + @raise Not_found otherwise. *) + let find_lonely_key m = + match KVMap.is_singleton m with + | Some p -> p + | None -> raise Not_found + + + module With_Cardinality + (Value : + Lattice_type.Full_AI_Lattice_with_cardinality with type t := Value.t) + = struct + + (** if there is only one binding [k -> v] in map [m] (that is, only one key + [k] and [cardinal_zero_or_one v]), returns the pair [k,v]. + @raise Not_found otherwise *) + let find_lonely_binding m = + let _, v as pair = find_lonely_key m in + if not (Value.cardinal_zero_or_one v) + then raise Not_found + else pair + + let cardinal_zero_or_one m = + equal m bottom || + try ignore (find_lonely_binding m); true + with Not_found -> false + + (** the cardinal of a map [m] is the sum of the cardinals of the + values bound to a key in [m] *) + let cardinal_less_than m n = + KVMap.fold + (fun _b v card -> card + Value.cardinal_less_than v (n - card)) + m + 0 + + let fold_enum f m acc = + KVMap.fold + (fun k vl acc -> + let g one_ival acc = + let one_loc = add_or_bottom k one_ival empty in + f one_loc acc + in + Value.fold_enum g vl acc) + m + acc + + let diff_if_one m1 m2 = + try + let k2, v2 = find_lonely_binding m2 in + let v1 = find_or_bottom k2 m1 in + let v = Value.diff_if_one v1 v2 in + add_or_bottom k2 v m1 + with Not_found -> m1 + end +end + + +(* ------------------------- Map/Set Lattice -------------------------------- *) + +module Make_MapSet_Lattice + (Key: Hptmap.Id_Datatype) + (KSet: Lattice_type.Lattice_Set with type O.elt = Key.t) + (Value : Value) + (KVMap : Map_Lattice with type key = Key.t + and type v = Value.t) += struct + + type t = Top of KSet.t * Origin.t | Map of KVMap.t + + let top = Top (KSet.top, Origin.top) + + let bottom = Map KVMap.empty + + let hash = function + | Map m -> KVMap.hash m + | Top (s, orig) -> Origin.hash orig + (299 * (KSet.hash s)) + + let remove k = function + | Top (KSet.Top, _) as t -> t + | Top (KSet.Set s, o) -> Top (KSet.(inject (O.remove k s)), o) + | Map m -> Map (KVMap.remove k m) + + let add k v = function + | Top (KSet.Top, _) as t -> t + | Top (KSet.Set s, o) -> Top (KSet.(inject (O.add k s)), o) + | Map m -> Map (KVMap.add k v m) + + let add k v t = + if Value.equal v Value.bottom + then remove k t + else add k v t + + let inject k v = + if Value.equal v Value.bottom + then bottom + else Map (KVMap.singleton k v) + + + let split k = function + | Top (set, _) as t -> + if KSet.mem k set + then Value.top, remove k t + else Value.bottom, t + | Map m -> KVMap.find_or_bottom k m, Map (KVMap.remove k m) + + + let get_keys = function + | Top (set, _) -> set + | Map m -> + KSet.inject (KVMap.fold (fun k _ acc -> KSet.O.add k acc) m KSet.O.empty) + + + let equal t t' = + t == t' || + match t, t' with + | Top (s, a), Top (s', a') -> KSet.equal s s' && Origin.equal a a' + | Map m, Map m' -> KVMap.equal m m' + | _ -> false + + let compare t t' = + if t == t' then 0 + else match t, t' with + | Top _, Map _ -> -1 + | Map _, Top _ -> 1 + | Map m, Map m' -> KVMap.compare m m' + | Top (s, a), Top (s', a') -> + let r = KSet.compare s s' in + if r = 0 then Origin.compare a a' else r + + let filter_keys f = function + | Top (s, o) -> Top (KSet.filter f s, o) + | Map m -> Map (KVMap.filter f m) + + + let join t1 t2 = + if t1 == t2 then t1 else + match t1, t2 with + | Top (s1, o1), Top (s2, o2) -> Top (KSet.join s1 s2, Origin.join o1 o2) + | Top (KSet.Top, _) as x, Map _ + | Map _, (Top (KSet.Top, _) as x) -> x + | Top (KSet.Set s, o), Map m | Map m, Top (KSet.Set s, o) -> + let s = KVMap.fold (fun k _ acc -> KSet.O.add k acc) m s in + Top (KSet.inject s, o) + | Map m1, Map m2 -> Map (KVMap.join m1 m2) + + let link t1 t2 = + match t1, t2 with + | Top _ as x, Map _ + | Map _, (Top _ as x) -> x (* arbitrary, may be approximated *) + | Top (s1, o1), Top (s2, o2) -> Top (KSet.link s1 s2, Origin.link o1 o2) + | Map m1, Map m2 -> Map (KVMap.link m1 m2) + + let meet t1 t2 = + match t1, t2 with + | Top (s1, o1), Top (s2, o2) -> Top (KSet.meet s1 s2, Origin.meet o1 o2) + | Top (KSet.Top, _), (Map _ as m) + | (Map _ as m), Top (KSet.Top, _) -> m + | Top (KSet.Set s, _), (Map m) + | (Map m), Top (KSet.Set s, _) -> + Map (KVMap.filter (fun v -> KSet.O.mem v s) m) + | Map m1, Map m2 -> Map (KVMap.meet m1 m2) + + let narrow t1 t2 = + match t1, t2 with + | Top (s1, o1), Top (s2, o2) -> + Top (KSet.narrow s1 s2, Origin.narrow o1 o2) + | Top (KSet.Top, _), (Map _ as m) + | (Map _ as m), Top (KSet.Top, _) -> m + | Top (KSet.Set set, _), (Map m) + | (Map m), Top (KSet.Set set, _) -> + Map (KVMap.filter (fun v -> KSet.O.mem v set) m) + | Map m1, Map m2 -> Map (KVMap.narrow m1 m2) + + let is_included t1 t2 = + match t1, t2 with + | Top (s1, o1), Top (s2, o2) -> + KSet.is_included s1 s2 && Origin.is_included o1 o2 + | Map _, Top (KSet.Top, _) -> true + | Map m, Top (KSet.Set s, _) -> KVMap.for_all (fun k _ -> KSet.O.mem k s) m + | Top _, Map _ -> false + | Map m1, Map m2 -> KVMap.is_included m1 m2 + + let intersects t1 t2 = + match t1, t2 with + | Top (s1, _), Top (s2, _) -> KSet.intersects s1 s2 + | Top (KSet.Top, _), Map m | Map m, Top (KSet.Top, _) -> + not (KVMap.equal m KVMap.empty) + | Top (KSet.Set s, _), Map m | Map m, Top (KSet.Set s, _) -> + KVMap.exists (fun b _ -> KSet.O.mem b s) m + | Map m1, Map m2 -> KVMap.intersects m1 m2 + + let diff t1 t2 = + match t1, t2 with + | Top _, _ | _, Top _ -> t1 + | Map m1, Map m2 -> Map (KVMap.diff m1 m2) + + + let find k = function + | Top (s, _) -> if KSet.mem k s then Value.top else Value.bottom + | Map m -> KVMap.find_or_bottom k m + + let find_lonely_key = function + | Top _ -> raise Not_found + | Map m -> KVMap.find_lonely_key m + + + let map f = function + | Top _ as t -> t + | Map m -> Map (KVMap.map f m) + + let fold_keys f t acc = + match t with + | Top (s, _) -> KSet.fold f s acc + | Map m -> KVMap.fold (fun k _ acc -> f k acc) m acc + + let fold f m acc = + match m with + | Top (s, _) -> KSet.fold (fun x acc -> f x Value.top acc) s acc + | Map m -> KVMap.fold f m acc + + let cached_fold ~cache_name ~temporary ~f ~projection ~joiner ~empty = + let folded_f = KVMap.cached_fold ~cache_name ~temporary ~f ~joiner ~empty in + function + | Top (KSet.Top, _) -> raise Abstract_interp.Error_Top + | Top (KSet.Set s, _) -> + let f_base base acc = + let total_itvs = projection base in + joiner (f base total_itvs) acc + in + KSet.O.fold f_base s empty + | Map m -> folded_f m + + + let for_all f = function + | Map m -> KVMap.for_all f m + | Top (KSet.Set t, _) -> KSet.O.for_all (fun x -> f x Value.top) t + | Top (KSet.Top, _) -> false + + let exists f = function + | Map m -> KVMap.exists f m + | Top (KSet.Set t, _) -> KSet.O.exists (fun x -> f x Value.top) t + | Top (KSet.Top, _) -> true + + + let pretty fmt = function + | Top (t, a) -> + Format.fprintf fmt "@[<hov 2>{{ mix of %a.@ Origin: %a}}@]" + KSet.pretty t Origin.pretty a + | Map m -> + Pretty_utils.pp_iter + ~pre:"@[<hv 3>{{ " + ~suf:" }}@]" + ~sep:";@ " + (fun pp map -> KVMap.iter (fun k v -> pp (k, v)) map) + (fun fmt (k, v) -> + Format.fprintf fmt "%a -> %a" Key.pretty k Value.pretty v) + fmt m + + let pretty_debug fmt = function + | Top (t, a) -> + Format.fprintf fmt "@[<hov 2>{{ mix of %a.@ Origin: %a}}@]" + KSet.pretty t Origin.pretty a + | Map m -> KVMap.pretty_debug fmt m + + + include + (Datatype.Make_with_collections + (struct + type tt = t + type t = tt + let name = KVMap.name ^ " mapset_lattice" + let structural_descr = + Structural_descr.t_sum + [| [| KSet.packed_descr; Structural_descr.p_abstract |]; + [| KVMap.packed_descr |] |] + let reprs = List.map (fun m -> Map m) KVMap.reprs + let equal = equal + let compare = compare + let hash = hash + let rehash = Datatype.identity + let copy = Datatype.undefined + let internal_pretty_code = Datatype.pp_fail + let pretty = pretty + let mem_project = Datatype.never_any_project + let varname = Datatype.undefined + end): Datatype.S_with_collections with type t := t) + + + module With_Cardinality + (KVMap : Map_Lattice_with_cardinality with type t := KVMap.t + and type key := Key.t + and type v := Value.t) + = struct + + let find_lonely_binding = function + | Top _ -> raise Not_found + | Map m -> KVMap.find_lonely_binding m + + let cardinal_zero_or_one = function + | Top _ -> false + | Map m -> KVMap.cardinal_zero_or_one m + + let cardinal_less_than t n = + match t with + | Top _ -> raise Abstract_interp.Not_less_than + | Map m -> KVMap.cardinal_less_than m n + + let fold_enum f m acc = + match m with + | Top _ -> raise Abstract_interp.Error_Top + | Map m -> KVMap.fold_enum (fun m acc -> f (Map m) acc) m acc + + let diff_if_one t1 t2 = + match t1, t2 with + | Map m1, Map m2 -> Map (KVMap.diff_if_one m1 m2) + | _, _ -> t1 + end +end diff --git a/src/kernel_services/abstract_interp/map_lattice.mli b/src/kernel_services/abstract_interp/map_lattice.mli new file mode 100644 index 0000000000000000000000000000000000000000..f77051eb38f01c546b6ef6c11dfc070b3e02e175 --- /dev/null +++ b/src/kernel_services/abstract_interp/map_lattice.mli @@ -0,0 +1,199 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Maps equipped with a lattice structure. *) + +module type Value = sig + include Datatype.S + val top: t + val bottom: t +end + +(** Complete semi-bounded lattice with over- and under-approximation, + intersection and difference. No top value. *) +module type Lattice = sig + include Lattice_type.Bounded_Join_Semi_Lattice + include Lattice_type.With_Narrow with type t := t + include Lattice_type.With_Under_Approximation with type t := t + include Lattice_type.With_Intersects with type t := t + include Lattice_type.With_Diff with type t := t +end + +(** Complete lattice as above, plus a notion of cardinality on the values. *) +module type Lattice_with_cardinality = sig + include Lattice_type.With_Cardinal_One + include Lattice_type.With_Diff_One with type t := t + include Lattice_type.With_Enumeration with type t := t +end + +(** A map with a complete lattice structure. *) +module type Map_Lattice = sig + include Hptmap_sig.S + include Lattice with type t := t + + (** [find key t] returns the value bound to [key] in [t], or Value.bottom if + [key] does not belong to [t]. *) + val find_or_bottom: key -> t -> v + + (** If [t] is a singleton map binding [k] to [v], then returns the pair (k,v). + @raise Not_found otherwise. *) + val find_lonely_key: t -> key * v +end + +(** A notion of cardinality for maps with a complete lattice structure. *) +module type Map_Lattice_with_cardinality = sig + include Lattice_with_cardinality + type key + type v + + (** If [t] is a singleton map binding [k] to [v], and if + [cardinal_zero_or_one v] holds, returns the pair (k,v). + @raise Not_found otherwise. *) + val find_lonely_binding: t -> key * v +end + +(** A lattice structure on top of maps from keys to values and sets of keys. + The maps and the sets have their own lattice structure (see + abstract_interp.ml for the lattice of sets). The sets are implicitly + considered as maps binding all their keys to top. Any map is included + in the set of its keys (and in any larger set). *) +module type MapSet_Lattice = sig + type set + type map + type t = Top of set * Origin.t | Map of map + include Datatype.S_with_collections with type t := t + include Lattice with type t := t + + val bottom: t + val top: t + + type key + type v + + (** [add key v t] binds the value [v] to [key] in [t]. If [t] is a set, it + adds [key] to the set. If [v] is bottom, then it removes the [key] from + [t] instead. *) + val add: key -> v -> t -> t + + (** [find key t] returns the value bound to [key] in [t]. It returns Value.top + if [t] is a set that contains [key]. It returns Value.bottom if [key] does + not belong to [t]. *) + val find: key -> t -> v + + (** If [t] is a singleton map binding [k] to [v], then returns the pair (k,v). + @raise Not_found otherwise. *) + val find_lonely_key: t -> key * v + + (** [split key t] is equivalent to [find key t], [add key bottom t]. *) + val split : key -> t -> v * t + + (** Returns the singleton map binding [key] to [v]. *) + val inject : key -> v -> t + + (** Returns the set of keys in [t]. *) + val get_keys : t -> set + + val filter_keys : (key -> bool) -> t -> t + + val map: (v -> v) -> t -> t + + val fold_keys : (key -> 'a -> 'a) -> t -> 'a -> 'a + val fold : (key -> v -> 'a -> 'a) -> t -> 'a -> 'a + + val cached_fold: + cache_name:string -> temporary:bool -> + f:(key -> v -> 'a) -> + projection:(key -> v) -> joiner:('a -> 'a -> 'a) -> empty:'a -> t -> 'a + + (** [for_all p t] checks if all binding of [t] satisfy [p] . Always false if + [t] is top. *) + val for_all: (key -> v -> bool) -> t -> bool + + (** [exists p t] checks if one binding of [t] satisfies [p]. Always true if + [t] is top. *) + val exists: (key -> v -> bool) -> t -> bool + + val pretty_debug : Format.formatter -> t -> unit +end + + +(** A notion of cardinality for mapset lattice. *) +module type MapSet_Lattice_with_cardinality = sig + include Lattice_with_cardinality + type key + type v + + (** If [t] is a singleton map binding [k] to [v], and if + [cardinal_zero_or_one v] holds, returns the pair (k,v). + @raise Not_found otherwise. *) + val find_lonely_binding: t -> key * v +end + + +(** Equips an Hptmap with a lattice structure, provided that the values + have a lattice structure. *) +module Make_Map_Lattice + (Key: Hptmap.Id_Datatype) + (Value : Lattice_type.Full_Lattice) + (KVMap : Hptmap_sig.S with type key = Key.t + and type v = Value.t) + : sig + + include Map_Lattice with type t = KVMap.t + and type key = Key.t + and type v = Value.t + + module With_Cardinality + (Value : + Lattice_type.Full_AI_Lattice_with_cardinality with type t := Value.t) + : Map_Lattice_with_cardinality with type t := t + and type key := key + and type v := v + + end + + +(** Builds a lattice mixing maps and sets, provided that each one has a lattice + structure. *) +module Make_MapSet_Lattice + (Key: Hptmap.Id_Datatype) + (KSet: Lattice_type.Lattice_Set with type O.elt = Key.t) + (Value : Value) + (KVMap : Map_Lattice with type key = Key.t + and type v = Value.t) + : sig + + include MapSet_Lattice with type set := KSet.t + and type map := KVMap.t + and type key := Key.t + and type v := Value.t + + module With_Cardinality + (KVMap : Map_Lattice_with_cardinality with type t := KVMap.t + and type key := Key.t + and type v := Value.t) + : MapSet_Lattice_with_cardinality with type t := t + and type key := Key.t + and type v := Value.t + + end + diff --git a/src/kernel_services/abstract_interp/offsetmap.ml b/src/kernel_services/abstract_interp/offsetmap.ml index 24115a3dd7c7210548701dbb31b8ab2491c1e72a..2f1d8717f1166af848b79f8899afd733631b1f3b 100644 --- a/src/kernel_services/abstract_interp/offsetmap.ml +++ b/src/kernel_services/abstract_interp/offsetmap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -32,7 +32,7 @@ let ( <=~ ) = Integer.le let ( >=~ ) = Integer.ge let ( +~ ) = Integer.add let ( -~ ) = Integer.sub -(*let ( *~ ) = Integer.mul*) +(* let ( *~ ) = Integer.mul *) let ( /~ ) = Integer.pos_div let ( %~ ) = Integer.pos_rem let succ = Integer.succ @@ -84,6 +84,14 @@ type 'a offsetmap = (** tag: hash-consing id of the node, plus an additional boolean. Not related to the contents of the tree. *) + +(* In a node, the alignment of the value is relative to the start of the + interval of the node. When splitting or merging nodes, this relative + alignment must be recomputed wrt the offset of the new interval. The new + alignment should be consistent with the size of the value. *) +let realign ~offset ~new_offset rem modu = + Rel.pos_rem (Rel.add (Rel.sub_abs offset new_offset) rem) modu + (** plevel-related operation: value + hooks to call when the value is modified*) let plevel = ref 200 let plevel_hook = ref [] @@ -336,16 +344,10 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let clear_caches_ref = ref [] - let equal_vv (rem1, modu1, v1) (rem2, modu2, v2) = - rem1 =~ rem2 && modu1 =~ modu2 && V.equal v1 v2 - ;; - - let get_vv node curr_off = + let get_vv node = match node with | Empty -> assert false - | Node (_, _, _, _, _, remrel, modu, v, _) -> - let rem = (Rel.add_abs curr_off remrel) %~ modu in - rem, modu, v + | Node (_, _, _, _, _, rem, modu, v, _) -> rem, modu, v ;; let _get_v = function @@ -376,10 +378,10 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct ;; - type 'a zipper = + type zipper = | End - | Right of Integer.t * 'a offsetmap * 'a zipper - | Left of Integer.t * 'a offsetmap * 'a zipper;; + | Right of Integer.t * t * zipper + | Left of Integer.t * t * zipper;; (** Zippers : Offset of a node * Node * continuation of the zipper *) exception End_reached;; @@ -459,10 +461,10 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct | Empty -> assert false ;; - type 'a imp_zipper = { + type imp_zipper = { mutable offset: Integer.t; - mutable node: 'a offsetmap; - mutable zipper: 'a zipper; + mutable node: t; + mutable zipper: zipper; };; let imp_move_right imp_z = @@ -558,7 +560,27 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct | Empty -> acc | Node (_, _, left, _, right, _, _, v, _) -> fold_on_values f right (f v ((fold_on_values f left acc))) -;; + ;; + + (* Two adjacent nodes can be merged into one when: + - they contains the same value of the same size (thus repeated with the + same modulo) and the same alignment wrt the offset of the left node + (thus the alignment of the value in the right node must be converted + wrt the left offset). + - and the offset of the right node is aligned with the repeated value: + the separation does not cut the value, and can safely be removed. + Otherwise, a separation that cuts a value can only be removed if the + concretization of the value is a singleton, ensuring that the two parts + of the value are always consistent. *) + let are_mergeable_nodes ~left_offset ~left ~right_offset ~right = + let lrem, lmodu, lv = left + and rrem, rmodu, rv = right in + V.equal lv rv && lmodu =~ rmodu && + let new_rrem = + realign ~offset:right_offset ~new_offset:left_offset rrem rmodu + in + Rel.equal new_rrem lrem && + (Rel.is_zero rrem || V.cardinal_zero_or_one lv) (** Smart constructor for nodes: it glues the node being allocated to potential candidates if needed @@ -567,20 +589,19 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let make_node curr_off max offl subl offr subr rem modu v = let rem, modu = if V.is_isotropic v - then Integer.zero, Integer.one + then Rel.zero, Integer.one else rem, modu in let curr_vv = (rem, modu, v) in let max, offr, subr = try - let offset, nr, zr = - leftmost_child (curr_off +~ offr) End subr in + let offset, nr, zr = leftmost_child (curr_off +~ offr) End subr in match nr with - | Node (nmax, _, nsubl , noffr, nsubr, nrelrem, nmodu, nv, _) -> + | Node (nmax, _, nsubl , noffr, nsubr, nrem, nmodu, nv, _) -> assert (is_empty nsubl); - let nrem = (Rel.add_abs offset nrelrem) %~ nmodu in - if equal_vv (nrem, nmodu, nv) curr_vv && - (V.cardinal_zero_or_one v || (offset %~ modu =~ rem)) + let right = nrem, nmodu, nv in + if are_mergeable_nodes + ~left_offset:curr_off ~left:curr_vv ~right_offset:offset ~right then begin let curr_offr, new_subr = rezip zr (offset +~ noffr) nsubr in @@ -594,16 +615,16 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct with Empty_tree -> max, offr, subr in if debug then assert (Integer.ge max Integer.zero); - let curr_off, max, offl, subl, offr = + let curr_off, max, rem, offl, subl, offr = try let offset, nl, zl = rightmost_child (curr_off +~ offl) End subl in match nl with - | Node (nmax, noffl, nsubl , _, noffr, nrelrem, nmodu, nv, _) -> + | Node (nmax, noffl, nsubl , _, noffr, nrem, nmodu, nv, _) -> assert (is_empty noffr); - let nrem = (Rel.add_abs offset nrelrem) %~ nmodu in - if equal_vv (nrem, nmodu, nv) curr_vv && - (V.cardinal_zero_or_one v || (curr_off %~ modu =~ rem)) + let left = nrem, nmodu, nv in + if are_mergeable_nodes + ~left_offset:offset ~left ~right_offset:curr_off ~right:curr_vv then ( let new_curr_offl, new_subl = rezip zl (offset +~ noffl) nsubl in let succ_nmax = succ nmax in @@ -611,26 +632,24 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let new_offl = new_curr_offl -~ offset in let new_offr = offr +~ succ_nmax in let new_coff = curr_off -~ succ_nmax in + let rem = realign ~offset:curr_off ~new_offset:offset rem modu in (*assert (new_coff =~ offset);*) - new_coff, lmax, new_offl, new_subl, new_offr) - else curr_off, max, offl, subl, offr + new_coff, lmax, rem, new_offl, new_subl, new_offr) + else curr_off, max, rem, offl, subl, offr |Empty -> assert false - with Empty_tree -> curr_off, max, offl, subl, offr + with Empty_tree -> curr_off, max, rem, offl, subl, offr in - let remrel = Rel.pos_rem (Rel.sub_abs rem curr_off) modu in - curr_off, nNode max offl subl offr subr remrel modu v + curr_off, nNode max offl subl offr subr rem modu v ;; - (* Creates the tree representing the interval [curr_off..cur_off+span], - bound to [v] *) - let interval_aux curr_off span rem modu v = - let remrel, modu = + (* Creates the tree representing the interval [O..span], bound to [v] *) + let interval_aux span rem modu v = + let rem, modu = if V.is_isotropic v then Rel.zero, Integer.one - else Rel.pos_rem (Rel.sub_abs rem curr_off) modu, modu + else rem, modu in - curr_off, - nNode span Integer.zero m_empty (succ span) m_empty remrel modu v + nNode span Integer.zero m_empty (succ span) m_empty rem modu v (* creates a fresh tree that binds [0..size-1] to the isotropic value [v]. if [size] if 0, returns [Empty]. *) @@ -651,10 +670,8 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct if debug then assert (min <=~ max); let rec aux_add curr_off tree = match tree with - | Empty -> - interval_aux min (max -~ min) rem modu v - | Node (nmax, noffl, nsubl, noffr, nsubr, nremrel, nmodu, nv, _) -> - let nrem = (Rel.add_abs curr_off nremrel) %~ nmodu in + | Empty -> min, interval_aux (max -~ min) rem modu v + | Node (nmax, noffl, nsubl, noffr, nsubr, nrem, nmodu, nv, _) -> let abs_min = curr_off and abs_max = nmax +~ curr_off in if max <~ abs_min then @@ -708,12 +725,11 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct a single value (unless [v] is isotropic) *) let append_basic_itv ~min ~max ~v m = if V.is_isotropic v then - snd (add_node ~min ~max Integer.zero Integer.one v Integer.zero(*co*) m) + snd (add_node ~min ~max Rel.zero Integer.one v Integer.zero(*co*) m) else let size = Integer.length min max in let v = V.anisotropic_cast ~size v in - let rem = min %~ size in - snd (add_node ~min ~max rem size v Integer.zero(*co*) m) + snd (add_node ~min ~max Rel.zero size v Integer.zero(*co*) m) (** Checks that [tree] is sanely built *) let rec check_aux curr_off tree = @@ -889,15 +905,13 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct t1_curr_off, t1 | Empty, Node _ -> t2_curr_off, t2 | Node _, Empty -> t1_curr_off, t1 - | Node (lmax, loffl, lsubl, loffr, lsubr, lremrel, lmodu, lv, _), - Node (rmax, roffl, rsubl, roffr, rsubr, rremrel, rmodu, rv, _) -> + | Node (lmax, loffl, lsubl, loffr, lsubr, lrem, lmodu, lv, _), + Node (rmax, roffl, rsubl, roffr, rsubr, rrem, rmodu, rv, _) -> let labs_min = t1_curr_off and labs_max = lmax +~ t1_curr_off and rabs_min = t2_curr_off and rabs_max = rmax +~ t2_curr_off in - let lrem = (Rel.add_abs t1_curr_off lremrel) %~ lmodu in - let rrem = (Rel.add_abs t2_curr_off rremrel) %~ rmodu in if is_above labs_min labs_max rabs_min rabs_max then (* t2 is on the right of t1 *) @@ -932,40 +946,46 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct | Empty, Empty -> o1, t1 | Node _, Empty -> assert false | Empty, Node _ -> assert false - | Node (max1, offl1, subl1, offr1, subr1, rem1rel, modu1, v1, _), - Node (max2, offl2, subl2, offr2, subr2, rem2rel, modu2, v2, _) -> + | Node (max1, offl1, subl1, offr1, subr1, rem1, modu1, v1, _), + Node (max2, offl2, subl2, offr2, subr2, rem2, modu2, v2, _) -> let abs_min1 = o1 and abs_max1 = max1 +~ o1 and abs_min2 = o2 and abs_max2 = max2 +~ o2 - and rem1 = (Rel.add_abs o1 rem1rel) %~ modu1 - and rem2 = (Rel.add_abs o2 rem2rel) %~ modu2 in if debug then assert (abs_min2 <=~ abs_max1 && abs_min1 <=~ abs_max2); (* here n1 \inter n2 <> \emptyset, given the invariants on offsetmaps shape and the fact that both trees cover the same range. - -compute the intersection interval: middle_abs_min, middle_abs_max + - compute the intersection interval: middle_abs_min, middle_abs_max + - recompute the alignment of the values wrt middle_abs_min + (named middle_rem1 and middle_rem2) - add the rest of the nodes to their left/right subtree depending on the size of the node - add the new node in the merged left subtree and plug the merged right tree in *) - let (curr_offl, left_t), middle_abs_min = + let (curr_offl, left_t), middle_abs_min, middle_rem1, middle_rem2 = let abs_offl1 = o1 +~ offl1 and abs_offl2 = o2 +~ offl2 in if abs_min1 =~ abs_min2 then - cache (abs_offl1, subl1) (abs_offl2, subl2), abs_min1 + cache (abs_offl1, subl1) (abs_offl2, subl2), abs_min1, rem1, rem2 else if abs_min1 <~ abs_min2 then let new_offl1, new_subl1 = add_node ~min:abs_min1 ~max:(pred abs_min2) rem1 modu1 v1 abs_offl1 subl1 - in cache (new_offl1, new_subl1) (abs_offl2, subl2), abs_min2 + in + let new_rem1 = realign ~offset:o1 ~new_offset:o2 rem1 modu1 in + cache (new_offl1, new_subl1) (abs_offl2, subl2), + abs_min2, new_rem1, rem2 else begin (* abs_min1 >~ abs_min2 *) let new_offl2, new_subl2 = add_node ~min:abs_min2 ~max:(pred abs_min1) rem2 modu2 v2 abs_offl2 subl2 - in cache (abs_offl1, subl1) (new_offl2, new_subl2), abs_min1 + in + let new_rem2 = realign ~offset:o2 ~new_offset:o1 rem2 modu2 in + cache (abs_offl1, subl1) (new_offl2, new_subl2), + abs_min1, rem1, new_rem2 end in let (curr_offr, right_t), middle_abs_max = @@ -974,15 +994,16 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct if abs_max1 =~ abs_max2 then cache (abs_offr1, subr1) (abs_offr2, subr2), abs_max1 else if abs_max1 <~ abs_max2 then + let min = succ abs_max1 in + let rem2 = realign ~offset:o2 ~new_offset:min rem2 modu2 in let new_offr2, new_subr2 = - add_node - ~min:(succ abs_max1) ~max:abs_max2 - rem2 modu2 v2 abs_offr2 subr2 + add_node ~min ~max:abs_max2 rem2 modu2 v2 abs_offr2 subr2 in cache (abs_offr1, subr1) (new_offr2, new_subr2), abs_max1 else begin (* abs_max1 >~ abs_max2 *) - let min = (succ abs_max2) in + let min = succ abs_max2 in + let rem1 = Rel.pos_rem (Rel.add (Rel.sub_abs o1 min) rem1) modu1 in let new_offr1, new_subr1 = add_node ~min ~max:abs_max1 rem1 modu1 v1 abs_offr1 subr1 in @@ -990,7 +1011,8 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct end in let rem, modu, v = - f_aux middle_abs_min middle_abs_max rem1 modu1 v1 rem2 modu2 v2 + f_aux middle_abs_min + middle_abs_max middle_rem1 modu1 v1 middle_rem2 modu2 v2 in let curr_offl, left_t = add_node ~min:middle_abs_min ~max:middle_abs_max @@ -1001,14 +1023,13 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let rec map_on_values_aux f curr_off t = match t with | Empty -> curr_off, t - | Node (max, offl, subl, offr, subr, relrem, modu, v, _) -> + | Node (max, offl, subl, offr, subr, rem, modu, v, _) -> let v' = f v in let offl', l' = map_on_values_aux f (curr_off +~ offl) subl in let offr', r' = map_on_values_aux f (curr_off +~ offr) subr in if l' == subl && r' == subr && V.equal v v' then curr_off, t else - let rem = (Rel.add_abs curr_off relrem) %~ modu in make_node curr_off max (offl' -~ curr_off) l' (offr' -~ curr_off) r' rem modu v' ;; @@ -1030,7 +1051,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let merge_bits ~topify ~conflate_bottom ~offset ~length ~value ~total_length acc = assert (length +~ offset <=~ Integer.of_int total_length); if Cil.theMachine.Cil.theMachine.Cil_types.little_endian then - V.little_endian_merge_bits ~topify ~conflate_bottom ~offset ~value acc + V.little_endian_merge_bits ~topify ~conflate_bottom ~offset ~length ~value acc else V.big_endian_merge_bits ~topify ~conflate_bottom ~offset ~value ~total_length ~length acc @@ -1043,17 +1064,16 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct [acc] is the current state of accumulated reads. *) let extract_bits_and_stitch ~topify ~conflate_bottom ~offset ~size curr_off (rem, modu, v) max acc = + let rem = (Rel.add_abs curr_off rem) %~ modu in let r = let abs_max = curr_off +~ max in (* last bit to be read, be it in the current node or one of its successors *) let max_bit = pred (offset +~ size) in + (* for this function, [min >= offset && min >= curr_off] holds *) let extract_single_step min acc = assert (not (V.is_isotropic v)); let interval_offset = min -~ offset in - let merge_offset = - if interval_offset >=~ Integer.zero then interval_offset else Integer.zero - in let start = (min -~ rem) %~ modu in let modu_end = if rem =~ Integer.zero then pred modu else pred rem in (* where do we stop reading ? @@ -1066,10 +1086,10 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct max_bit in let stop = (read_end -~ rem) %~ modu in -(* Format.printf "Single step: merge offset %a length %a \ +(* Format.printf "Single step: interval offset %a length %a \ start %a stop %a total length %a offset %a max bit %a\ @\n current offset %a Rem %a modu %a V %a@." - pretty_int merge_offset pretty_int (Integer.length start stop) + pretty_int interval_offset pretty_int (Integer.length start stop) pretty_int start pretty_int stop pretty_int size pretty_int offset pretty_int max_bit pretty_int curr_off pretty_int rem pretty_int modu V.pretty v ; *) @@ -1080,7 +1100,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct (* Format.printf "After single step: read bits %a@." V.pretty read_bits; *) let result = merge_bits ~topify ~conflate_bottom - ~offset:merge_offset ~length:(Integer.length start stop) + ~offset:interval_offset ~length:(Integer.length start stop) ~value:read_bits ~total_length:(Integer.to_int size) acc in (* Format.printf "After merge_bits: result %a@." V.pretty result; *) @@ -1089,18 +1109,13 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let start = Integer.max offset curr_off and stop = Integer.min max_bit abs_max in if V.is_isotropic v then - let interval_offset = rem -~ start (* ? *) in - let merge_offset = - if interval_offset <~ Integer.zero - then Integer.zero - else interval_offset - in merge_bits ~topify ~conflate_bottom ~offset:merge_offset - ~length:(Integer.length start stop) - ~value:v ~total_length:(Integer.to_int size) acc + let offset = start -~ offset in + merge_bits ~topify ~conflate_bottom + ~offset ~length:(Integer.length start stop) + ~value:v ~total_length:(Integer.to_int size) acc else let start_point = ref start in let acc = ref acc in - while !start_point <=~ stop do let read_end, result = extract_single_step !start_point !acc in acc := result; @@ -1124,7 +1139,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct enough -- or that {!V.narrow} handles differences in representations soundly. *) let f_aux_merge_generic merge_v abs_min abs_max rem1 modu1 v1 rem2 modu2 v2 = - if rem1 =~ rem2 && modu1 =~ modu2 + if Rel.equal rem1 rem2 && modu1 =~ modu2 then rem1, modu1, V.anisotropic_cast modu1 (merge_v modu1 v1 v2) (* Format.printf "f_aux_merge: [%a, %a]@.(%a %a %a)@.(%a %a %a)@." @@ -1134,19 +1149,22 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let topify = Origin.K_Merge in let offset = abs_min in let size = Integer.length abs_min abs_max in - let rem = abs_min %~ size in - let v1' = - if modu1 =~ size && ((rem1 %~ size) =~ rem) - then v1 - else extract_bits_and_stitch ~topify ~conflate_bottom:false - ~offset ~size offset (rem1, modu1, v1) abs_max V.merge_neutral_element - in - let v2' = - if modu2 =~ size && ((rem2 %~ size) =~ rem) - then v2 - else extract_bits_and_stitch ~topify ~conflate_bottom:false - ~offset ~size offset (rem2, modu2, v2) abs_max V.merge_neutral_element + let v1_fit = modu1 =~ size && Rel.is_zero rem1 + and v2_fit = modu2 =~ size && Rel.is_zero rem2 in + let v1', v2' = + if (V.is_isotropic v1 || v1_fit) && (V.is_isotropic v2 || v2_fit) + then v1, v2 + else + let reinterpret_bits x = + extract_bits_and_stitch ~topify ~conflate_bottom:false + ~offset ~size offset x abs_max V.merge_neutral_element + in + reinterpret_bits (rem1, modu1, v1), + reinterpret_bits (rem2, modu2, v2) in + (* The values were already aligned with the offset or have been + reinterpreted, so the alignment is always zero here. *) + let rem = Rel.zero in (* Format.printf "1: (%a, %a, %a);@.2: (%a, %a, %a);@.[%a--%a] -> %a/%a@." pretty_int rem1 pretty_int modu1 V.pretty v1 pretty_int rem2 pretty_int modu2 V.pretty v2 @@ -1155,6 +1173,24 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct rem, size, merge_v size v1' v2' ;; + (* similar to [f_aux_merge_generic], but we perform a reinterpretation in + all cases. This is to ensure that [V.narrow] can be applied soundly. *) + let f_aux_merge_narrow merge_v abs_min abs_max rem1 modu1 v1 rem2 modu2 v2 = + let topify = Origin.K_Merge in + let offset = abs_min in + let size = Integer.length abs_min abs_max in + let v1' = + extract_bits_and_stitch ~topify ~conflate_bottom:false + ~offset ~size offset (rem1, modu1, v1) abs_max V.merge_neutral_element + in + let v2' = + extract_bits_and_stitch ~topify ~conflate_bottom:false + ~offset ~size offset (rem2, modu2, v2) abs_max V.merge_neutral_element + in + Rel.zero, size, (merge_v size v1' v2': v) + ;; + + (** More efficient version of {!f_aux_merge_generic}, specialized for join-like functions. When one of the values is isotropic, we do not concretize the other one with {!extract_stitch_and_bits}. Instead, @@ -1194,7 +1230,10 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct struct module NarrowCache = Binary_cache.Symmetric_Binary(Cacheable)(Cacheable) - let () = clear_caches_ref := NarrowCache.clear :: !clear_caches_ref;; + module NarrowReinterpretCache = + Binary_cache.Symmetric_Binary(Cacheable)(Cacheable) + let () = clear_caches_ref := + NarrowReinterpretCache.clear :: NarrowCache.clear :: !clear_caches_ref;; let is_top = function | Node (_, _, Empty, _, Empty, _ , _, v, _) -> V.equal v X.top @@ -1211,10 +1250,19 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let _, r = aux_cache (Integer.zero, t1) (Integer.zero, t2) in r ;; - end - let join_and_is_included t1 t2 = - let r = join t1 t2 in r, equal r t2 + let narrow_reinterpret t1 t2 = + let f_join = f_aux_merge_narrow (fun _size v1 v2 -> X.narrow v1 v2) in + let rec aux_cache t1 t2 = + if Cacheable.equal t1 t2 || is_top (snd t2) then t1 + else if is_top (snd t1) then t2 + else NarrowReinterpretCache.merge (merge aux_cache f_join) t1 t2 + in + let _, r = aux_cache (Integer.zero, t1) (Integer.zero, t2) in + r + ;; + + end let widen wh t1 t2 = (* Due to the way f_aux_merge is designed, we can obtain intervals on which @@ -1252,7 +1300,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct | Hptmap_sig.NoCache -> fun f x y -> f x y in let f' _abs_min _abs_max _rem1 _modu1 v1 _rem2 _modu2 v2 = - Int.zero, Int.one, f v1 v2 + Rel.zero, Int.one, f v1 v2 in (* See the invariants a the top of {!merge}: [bounds o1 n1 = bounds o2 n2] holds *) @@ -1268,7 +1316,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct end else begin (* build an interval mapped to [v], of the same width as t1 and t2 *) let ib1, ie1 = bounds_offset o1 n1 in - interval_aux ib1 (ie1 -~ ib1) Int.zero Int.one v + ib1, interval_aux (ie1 -~ ib1) Rel.zero Int.one v end in aux @@ -1313,7 +1361,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let rec aux tree_offset tree = match tree with | Empty -> V.bottom - | Node (max, offl, subl, offr, subr, _rrel, _m, v, _) -> + | Node (max, offl, subl, offr, subr, _rem, _m, v, _) -> let abs_max = max +~ tree_offset in let subl_value = if first_bit <~ tree_offset then @@ -1341,49 +1389,75 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct in aux Integer.zero tree + (* Reads the interval [start, start + size - 1], which is supposed to start + in the node [node]. [offset] is the offset of [node] in the offsetmap, and + [zipper] is a zipper to navigate from the root of [node]. It is used to + read the next nodes of the offsetmap if needed. *) + let read_nodes ~conflate_bottom offset node zipper start size = + let read_ending = pred (start +~ size) in + let topify = Origin.K_Misalign_read in + let rec read_one_node offset node zipper acc = + let v = + extract_bits_and_stitch ~topify ~conflate_bottom + ~offset:start ~size + offset (get_vv node) (get_max node) + acc + in + (* If the end of the current node is beyond the end of the read, + then return the value. Otherwise, read the next node. *) + if offset +~ (get_max node) >=~ read_ending + then v + else + let offset, node, zipper = move_right offset node zipper in + read_one_node offset node zipper v + in + read_one_node offset node zipper V.merge_neutral_element + (* Query the offsetmap for the interval [start, start + size - 1], which is supposed to fit in the offsetmap. Assumes the offsetmap is rooted at - offset 0 *) - let find_itv ~conflate_bottom ~start ~size tree period_read_ahead = - let z, cur_off, root = find_bit start tree in - let topify = Origin.K_Misalign_read in + offset 0. + In case of a periodic read, [since_and_period] contains the first offset + read through iterations of this function, and the period of the reads. *) + let find_itv ?since_and_period ~conflate_bottom ~start ~size tree = + let zipper, cur_off, root = find_bit start tree in match root with - | Empty -> - (* Bit_Not_found has been raised by find_bit in this case *) - assert false - | Node (max, _, _, _, _subr, rrel, m, v, _) -> - let r = (Rel.add_abs cur_off rrel) %~ m in - let isize = pred (start +~ size) in - let nsize = cur_off +~ max in - let isotropic = V.is_isotropic v in - if isize <=~ nsize && (isotropic || (m =~ size && start %~ m =~ r)) - then begin - let read_ahead = - if isotropic || (Integer.is_zero (period_read_ahead %~ m)) - then Some nsize - else None - in - read_ahead, v - end + | Empty -> assert false + | Node (max, _, _, _, _subr, rrel, m, v, _) -> + let r = (Rel.add_abs cur_off rrel) %~ m in + let read_ending = pred (start +~ size) in + let node_ending = cur_off +~ max in + let isotropic = V.is_isotropic v in + let read_fit_in_node = read_ending <=~ node_ending in + let value = + if read_fit_in_node && (isotropic || (m =~ size && start %~ m =~ r)) + then v + else read_nodes ~conflate_bottom cur_off root zipper start size + in + (* Could a series of periodic reads jump ahead in the offsetmap (for + performance issue)? *) + let read_ahead = match since_and_period with + | None -> None + | Some (since, period) -> + (* If the reads exceeds the current node, the following reasonnings + (applied on this node only) do not hold. Moreover, jumping ahead + should not be necessary for performance. *) + if not read_fit_in_node + then None + (* If the value of the node is isotropic, or if the size of the + repeated value divides the period, then all reads in this node + are equivalent: jump to the next node. *) + else if isotropic || (Int.is_zero (period %~ m)) + then Some node_ending else - let acc = ref V.merge_neutral_element in - let impz = { node = root; offset = cur_off; zipper = z; } in - while impz.offset <=~ isize do - let v = - extract_bits_and_stitch ~topify ~conflate_bottom - ~offset:start ~size - impz.offset (get_vv impz.node impz.offset) (get_max impz.node) - !acc - in - acc := v; - if impz.offset +~ (get_max impz.node) >=~ isize - then impz.offset <- succ isize (* end the loop *) - else - (* Nominal behavior: do next binding *) - imp_move_right impz - done; - None, !acc - ;; + let since = Int.max since cur_off in + (* The value in the node is repeated every [m] bits, and we read + every [period] bits. Once we have read [lcm period m] bits, + we will have read all possible combinations. *) + if start -~ since >= Int.ppcm period m + then Some node_ending + else None + in + read_ahead, value (* Finds the value associated to some offsets represented as an ival. *) let find ~validity ?(conflate_bottom=true) ~offsets ~size tree = @@ -1392,14 +1466,15 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct in let r = try match filtered_by_bound with - | Tr_offset.Interval(mn, mx, m) -> - let r = mn %~ m in - let mn = ref mn in + | Tr_offset.Interval(min, mx, m) -> + let r = min %~ m in + let mn = ref min in let acc = ref V.bottom in let pred_size = pred size in while !mn <=~ mx do let read_ahead, v = - find_itv ~conflate_bottom ~start:!mn ~size tree m + find_itv ~since_and_period:(min, m) + ~conflate_bottom ~start:!mn ~size tree in acc := V.join v !acc; let naive_next = !mn +~ m in @@ -1416,7 +1491,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct List.fold_left (fun acc offset -> let _, new_value = - find_itv ~conflate_bottom ~start:offset ~size tree Int.zero + find_itv ~conflate_bottom ~start:offset ~size tree in V.join acc new_value ) V.bottom s @@ -1433,7 +1508,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let rec keep_below ~offset curr_off tree = match tree with | Empty -> offset, tree - | Node (max, offl, subl, offr, subr, rrel, m, v, _) -> + | Node (max, offl, subl, offr, subr, rem, m, v, _) -> let new_offl = offl +~ curr_off in if offset <~ curr_off then keep_below offset new_offl subl @@ -1444,12 +1519,12 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct if offset >~ sup then let new_offr, new_subr = keep_below offset (curr_off +~ offr) subr in curr_off, - nNode max offl subl (new_offr -~ curr_off) new_subr rrel m v + nNode max offl subl (new_offr -~ curr_off) new_subr rem m v else let new_max = pred (offset -~ curr_off) in add_node ~min:curr_off ~max:(new_max +~ curr_off) - ((Rel.add_abs curr_off rrel) %~ m) m v + rem m v (curr_off +~ offl ) subl ;; @@ -1458,7 +1533,7 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct let rec keep_above ~offset curr_off tree = match tree with | Empty -> (succ offset), tree - | Node (max, offl, subl, offr, subr, rrel, m, v, _) -> + | Node (max, offl, subl, offr, subr, rem, m, v, _) -> let new_offr = offr +~ curr_off in let abs_max = curr_off +~ max in if offset >~ abs_max then @@ -1478,22 +1553,22 @@ module Make (V : module type of Offsetmap_lattice_with_isotropy) = struct keep_above offset (curr_off +~ offl) subl in curr_off, - nNode max (new_offl -~ curr_off) new_subl offr subr rrel m v + nNode max (new_offl -~ curr_off) new_subl offr subr rem m v else (* the cut happens somewhere in this node it should be cut accordingly and reinjected into its right subtree *) - let new_reml = (Rel.add_abs curr_off rrel) %~ m in - add_node ~min:(succ offset) ~max:abs_max new_reml m v new_offr subr + let min = succ offset in + let new_reml = realign ~offset:curr_off ~new_offset:min rem m in + add_node ~min ~max:abs_max new_reml m v new_offr subr ;; let update_itv_with_rem ~exact ~offset ~abs_max ~size ~rem v curr_off tree = if Int.(equal size zero) then curr_off, tree else let off1, t1 = keep_above abs_max curr_off tree in let off2, t2 = keep_below offset curr_off tree in - let rabs = (Rel.add_abs offset rem) %~ size in if exact then let off_add, t_add = - add_node ~min:offset ~max:abs_max rabs size v off1 t1 + add_node ~min:offset ~max:abs_max rem size v off1 t1 in union off2 t2 off_add t_add else @@ -1505,26 +1580,20 @@ let update_itv_with_rem ~exact ~offset ~abs_max ~size ~rem v curr_off tree = while impz.offset <=~ abs_max do match impz.node with | Empty -> assert false - | Node (max, _offl, _subl, _offr, _subr, rrel, m_node, v_node, _) -> - let rabs_node = (Rel.add_abs impz.offset rrel) %~ m_node in + | Node (max, _offl, _subl, _offr, _subr, r_node, m_node, v_node, _) -> + let new_offset = Integer.max offset impz.offset in + let rem = realign ~offset ~new_offset rem size in + let r_node = realign ~offset:impz.offset ~new_offset r_node m_node in let new_r, new_m, new_v = - if V.is_isotropic v_node || v_is_isotropic || - (rabs =~ rabs_node && m_node =~ size) - then - let new_r, new_m = - if v_is_isotropic - then rabs_node, m_node - else rabs, size - in - let cast_v = - V.anisotropic_cast ~size:new_m (V.join v_node v) - in - new_r, new_m, cast_v - + let joined_value = V.join v_node v in + if v_is_isotropic || (Rel.equal rem r_node && m_node =~ size) + then r_node, m_node, V.anisotropic_cast ~size:m_node joined_value + else if V.is_isotropic v_node + then rem, size, V.anisotropic_cast ~size joined_value else let origin = Origin.(current K_Merge) in - let new_value = V.topify_with_origin origin (V.join v_node v) in - let new_rem = Integer.zero and new_modu = Integer.one in + let new_value = V.topify_with_origin origin joined_value in + let new_rem = Rel.zero and new_modu = Integer.one in new_rem, new_modu, new_value in let node_abs_max = impz.offset +~ max in @@ -1535,8 +1604,9 @@ let update_itv_with_rem ~exact ~offset ~abs_max ~size ~rem v curr_off tree = in let new_left_offset, new_left_tree = add_node - ~min:(Integer.max impz.offset offset) ~max:write_max - new_r new_m new_v !left_offset !left_tree in + ~min:new_offset ~max:write_max + new_r new_m new_v !left_offset !left_tree + in left_tree := new_left_tree; left_offset := new_left_offset; if not end_reached then imp_move_right impz @@ -1645,8 +1715,7 @@ let update_itv_with_rem ~exact ~offset ~abs_max ~size ~rem v curr_off tree = let o, t = add_node ~min:curr_off ~max:(curr_off +~ max) - ((Rel.add_abs curr_off r_node) %~ m_node) - m_node v_node new_offl new_subl + r_node m_node v_node new_offl new_subl in let curr_off, tree = union o t new_offr new_subr in match undone_left, undone_right with @@ -1785,7 +1854,6 @@ let update_under ~validity ~exact ~offsets ~size v t = alarm, `Value t with Update_Result_is_bottom -> true, `Bottom - let copy_single offset tree size period_read_ahead = let z, cur_off, root = find_bit offset tree in let cur_copy_offset = ref offset (* different from cur_off, as we may @@ -1807,17 +1875,18 @@ let update_under ~validity ~exact ~offsets ~size v t = (match impz.node with | Empty -> assert false - | Node (max, _, _, _, _subr, rrel, m, v, _) -> + | Node (max, _, _, _, _subr, rem, m, v, _) -> let next_end = impz.offset +~ max in let nend = Integer.min iend next_end in let new_rel_end = nend -~ offset in let nbeg = !cur_copy_offset -~ offset in - let abs_rem = - (Rel.add_abs nbeg - (Rel.sub rrel (Rel.sub_abs !cur_copy_offset impz.offset))) %~ m + (* Realignment of the value wrt the offset of the read, not wrt the + offset of the node in the new offsetmap. *) + let new_rem = + realign ~offset:impz.offset ~new_offset:!cur_copy_offset rem m in let o, t = - add_node ~min:nbeg ~max:new_rel_end abs_rem m v Integer.zero !acc + add_node ~min:nbeg ~max:new_rel_end new_rem m v Integer.zero !acc in assert (o =~ Integer.zero); acc := t; @@ -2093,7 +2162,7 @@ let update_under ~validity ~exact ~offsets ~size v t = let create ~size v ~size_v = assert (Int.ge size Int.zero); if Int.(equal size zero) then Empty - else snd (interval_aux Int.zero (pred size) Int.zero size_v v) + else snd (Int.zero, interval_aux (pred size) Rel.zero size_v v) let cardinal_zero_or_one offsetmap = (singleton_tag offsetmap) <> 0 @@ -2143,7 +2212,7 @@ module FullyIsotropic = struct let topify_with_origin _o v = v let extract_bits ~topify:_ ~start:_ ~stop:_ ~size:_ m = false, m - let little_endian_merge_bits ~topify:_ ~conflate_bottom:_ ~value:_ ~offset:_ v = v + let little_endian_merge_bits ~topify:_ ~conflate_bottom:_ ~length:_ ~value:_ ~offset:_ v = v let big_endian_merge_bits ~topify:_ ~conflate_bottom:_ ~total_length:_ ~length:_ ~value:_ ~offset:_ v = v let cardinal_zero_or_one _ = false @@ -2167,7 +2236,6 @@ module Int_Intervals_Map = struct let bottom = false let join = (||) let is_included b1 b2 = b2 || not b1 - let join_and_is_included b1 b2 = let r = b1 || b2 in r, r = b2 let merge_neutral_element = bottom let pretty_typ _ fmt v = pretty fmt v @@ -2241,7 +2309,7 @@ module Int_Intervals_Map = struct (* Auxiliary function that binds [b] to the interval [min..max], which is assumed not to be bound in [m] *) let add_itv ~min ~max b co m : itvs = - add_node ~min ~max Int.zero Int.one b co m + add_node ~min ~max Rel.zero Int.one b co m (* enlarges the offsetmap [m] from range [prev_min..prev_max] to [new_min..new_max], by adding an interval bound to [false] at the left @@ -2311,7 +2379,7 @@ module Int_Intervals_Map = struct let curr_off', node' = make_node curr_off max offl subl (new_rcurr_off -~ curr_off) new_rtree - Integer.zero Integer.one v + Rel.zero Integer.one v in curr_off', node', rbit @@ -2337,7 +2405,7 @@ module Int_Intervals_Map = struct let curr_off', node' = make_node curr_off max (new_lcurr_off -~ curr_off) new_ltree offr subr - Integer.zero Integer.one v + Rel.zero Integer.one v in curr_off', node', lbit @@ -2345,8 +2413,6 @@ end module Int_Intervals = struct - exception Error_Top - type itv = Int.t * Int.t type intervals = @@ -2481,9 +2547,6 @@ module Int_Intervals = struct let link = join (* all constructors but Top, which is never returned, are exact. *) - let join_and_is_included t1 t2 = - let r = join t1 t2 in r, equal r t2 - (* Drop the leftmost and rightmost intervals if they are equal to [false], and detect if the result is [Bottom] *) let normalize_itv curr_off m = @@ -2776,7 +2839,7 @@ end) = struct else m in `Value (Int_Intervals.fold aux_itv itvs m) - with Int_Intervals.Error_Top -> + with Error_Top -> update_imprecise_everywhere ~validity Origin.top v m let add_binding_ival ~validity ~exact offsets ~size v m = @@ -2796,7 +2859,7 @@ end) = struct try let aux_itv i acc = V.join acc (find i m) in Int_Intervals.fold aux_itv itvs V.bottom - with Int_Intervals.Error_Top -> find_imprecise ~validity m + with Error_Top -> find_imprecise ~validity m module V_Hashtbl = FCHashtbl.Make(V) diff --git a/src/kernel_services/abstract_interp/offsetmap.mli b/src/kernel_services/abstract_interp/offsetmap.mli index cbe2e4ee37b771c18af3356cc708321ec3c4b00e..8d909c7c214895ecd18aa9ea628c3cf3e7bca764 100644 --- a/src/kernel_services/abstract_interp/offsetmap.mli +++ b/src/kernel_services/abstract_interp/offsetmap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli b/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli index cf88292b62b263ee54672515e81b2f2f34108e19..f2910c2d34eec9790caf3b650b09dd196e88d76e 100644 --- a/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli +++ b/src/kernel_services/abstract_interp/offsetmap_bitwise_sig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli b/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli index ce2d22d66b54c32648e22e70a0de0fcfa680df14..98dc549ac572425efb4bd244cbb6c852a7e8a2bc 100644 --- a/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli +++ b/src/kernel_services/abstract_interp/offsetmap_lattice_with_isotropy.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -50,7 +50,7 @@ val extract_bits : val little_endian_merge_bits : topify:Origin.kind -> conflate_bottom:bool -> - value:t -> offset:Integer.t -> t -> t + length:Integer.t -> value:t -> offset:Integer.t -> t -> t val big_endian_merge_bits : topify:Origin.kind -> diff --git a/src/kernel_services/abstract_interp/offsetmap_sig.mli b/src/kernel_services/abstract_interp/offsetmap_sig.mli index 12b9eece32990cef98fe6fa1888281f23dae8136..3855fdbf04103c5e631376684f7262d29a5f76e7 100644 --- a/src/kernel_services/abstract_interp/offsetmap_sig.mli +++ b/src/kernel_services/abstract_interp/offsetmap_sig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -160,7 +160,19 @@ module Make_Narrow (X: sig include Lattice_type.With_Top with type t := v include Lattice_type.With_Narrow with type t := v end) : sig - include Lattice_type.With_Narrow with type t := t + val narrow: t -> t -> t + (** Over-approximation of the intersection of abstract values, without + considering (bitwise) reinterpretations. In particular, values with + equivalent representations (e.g. [-1] and [0xFF] on 8 bits) may be + considered different, leading to empty intersections. + This may result in unsound results; the function {!narrow_reinterpret} + below should be preferred in general. *) + + val narrow_reinterpret: t -> t -> t + (** Variant of the function above that bitwise-reinterprets values before + performing the intersection (in order to get normal forms). This may + lead to situations where the result is not included in the arguments, + but this function should be preferred to {!narrow}. *) end diff --git a/src/kernel_services/abstract_interp/origin.ml b/src/kernel_services/abstract_interp/origin.ml index 1ecc3d735c9b1238d6494285235836c2bb4ea495..bb4defb63d66c22454b698548454e1777bd17eb7 100644 --- a/src/kernel_services/abstract_interp/origin.ml +++ b/src/kernel_services/abstract_interp/origin.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,39 +26,32 @@ type kind = | K_Merge | K_Arith -module LocationSetLattice = struct - include Abstract_interp.Make_Lattice_Set(Cil_datatype.Location) - let currentloc_singleton () = inject_singleton (Cil.CurrentLoc.get ()) - - (* Do not let garbled mix locations grow. We stop at cardinal one. *) - let join o1 o2 = match o1, o2 with - | Top, _ | _, Top -> top - | Set s1, Set s2 -> - (* use the fact that [s1] and [s2] are never empty. *) - if O.equal s1 s2 then o1 else top +module LocationLattice = struct + include Abstract_interp.Make_Lattice_Base (Cil_datatype.Location) + let current_loc () = inject (Cil.CurrentLoc.get ()) end type origin = - | Misalign_read of LocationSetLattice.t - | Leaf of LocationSetLattice.t - | Merge of LocationSetLattice.t - | Arith of LocationSetLattice.t + | Misalign_read of LocationLattice.t + | Leaf of LocationLattice.t + | Merge of LocationLattice.t + | Arith of LocationLattice.t | Well | Unknown let current = function - | K_Misalign_read -> Misalign_read (LocationSetLattice.currentloc_singleton()) - | K_Leaf -> Leaf (LocationSetLattice.currentloc_singleton()) - | K_Merge -> Merge (LocationSetLattice.currentloc_singleton()) - | K_Arith -> Arith (LocationSetLattice.currentloc_singleton()) + | K_Misalign_read -> Misalign_read (LocationLattice.current_loc ()) + | K_Leaf -> Leaf (LocationLattice.current_loc ()) + | K_Merge -> Merge (LocationLattice.current_loc ()) + | K_Arith -> Arith (LocationLattice.current_loc ()) let equal o1 o2 = match o1, o2 with | Well, Well | Unknown, Unknown -> true | Leaf o1, Leaf o2 | Arith o1, Arith o2 | Merge o1, Merge o2 | Misalign_read o1, Misalign_read o2 -> - LocationSetLattice.equal o1 o2 + LocationLattice.equal o1 o2 | Misalign_read _, _ -> false | _, Misalign_read _ -> false | Leaf _, _ -> false @@ -74,7 +67,7 @@ let compare o1 o2 = match o1, o2 with | Leaf s1, Leaf s2 | Merge s1, Merge s2 | Arith s1, Arith s2 -> - LocationSetLattice.compare s1 s2 + LocationLattice.compare s1 s2 | Well, Well | Unknown, Unknown -> 0 @@ -97,9 +90,9 @@ let is_top x = equal top x let pretty_source fmt = function - | LocationSetLattice.Top -> () (* Hide unhelpful 'TopSet' *) - | LocationSetLattice.Set _ as s -> - Format.fprintf fmt "@ %a" LocationSetLattice.pretty s + | LocationLattice.Top -> () (* Hide unhelpful 'TopSet' *) + | LocationLattice.Value _ | LocationLattice.Bottom as s -> + Format.fprintf fmt "@ %a" LocationLattice.pretty s let pretty fmt o = match o with | Unknown -> @@ -121,13 +114,13 @@ let pretty_as_reason fmt org = let hash o = match o with | Misalign_read o -> - 2001 + (LocationSetLattice.hash o) + 2001 + (LocationLattice.hash o) | Leaf o -> - 2501 + (LocationSetLattice.hash o) + 2501 + (LocationLattice.hash o) | Merge o -> - 3001 + (LocationSetLattice.hash o) + 3001 + (LocationLattice.hash o) | Arith o -> - 3557 + (LocationSetLattice.hash o) + 3557 + (LocationLattice.hash o) | Well -> 17 | Unknown -> 97 @@ -148,7 +141,7 @@ include Datatype.Make let mem_project = Datatype.never_any_project end) -let bottom = Arith(LocationSetLattice.bottom) +let bottom = Arith(LocationLattice.bottom) let join o1 o2 = let result = @@ -159,45 +152,58 @@ let join o1 o2 = | Unknown,_ | _, Unknown -> Unknown | Well,_ | _ , Well -> Well | Misalign_read o1, Misalign_read o2 -> - Misalign_read(LocationSetLattice.join o1 o2) + Misalign_read(LocationLattice.join o1 o2) | _, (Misalign_read _ as m) | (Misalign_read _ as m), _ -> m | Leaf o1, Leaf o2 -> - Leaf(LocationSetLattice.join o1 o2) + Leaf(LocationLattice.join o1 o2) | (Leaf _ as m), _ | _, (Leaf _ as m) -> m | Merge o1, Merge o2 -> - Merge(LocationSetLattice.join o1 o2) + Merge(LocationLattice.join o1 o2) | (Merge _ as m), _ | _, (Merge _ as m) -> m | Arith o1, Arith o2 -> - Arith(LocationSetLattice.join o1 o2) + Arith(LocationLattice.join o1 o2) (* | (Arith _ as m), _ | _, (Arith _ as m) -> m *) in (* Format.printf "Origin.join %a %a -> %a@." pretty o1 pretty o2 pretty result; *) result +let link = join + let meet o1 o2 = if o1 == o2 then o1 else match o1, o2 with | Arith o1, Arith o2 -> - Arith(LocationSetLattice.meet o1 o2) + Arith(LocationLattice.meet o1 o2) | (Arith _ as m), _ | _, (Arith _ as m) -> m | Merge o1, Merge o2 -> - Merge(LocationSetLattice.meet o1 o2) + Merge(LocationLattice.meet o1 o2) | (Merge _ as m), _ | _, (Merge _ as m) -> m | Leaf o1, Leaf o2 -> - Leaf(LocationSetLattice.meet o1 o2) + Leaf(LocationLattice.meet o1 o2) | (Leaf _ as m), _ | _, (Leaf _ as m) -> m | Misalign_read o1, Misalign_read o2 -> - Misalign_read(LocationSetLattice.meet o1 o2) + Misalign_read(LocationLattice.meet o1 o2) | _, (Misalign_read _ as m) | (Misalign_read _ as m), _ -> m | Well, Well -> Well | Well,m | m, Well -> m | Unknown, Unknown -> Unknown -let narrow x _y = x (* TODO *) - +let narrow o1 o2 = + if o1 == o2 + then o1 + else + match o1, o2 with + | Arith o1, Arith o2 -> Arith (LocationLattice.narrow o1 o2) + | Merge o1, Merge o2 -> Merge (LocationLattice.narrow o1 o2) + | Leaf o1, Leaf o2 -> Leaf (LocationLattice.narrow o1 o2) + | Misalign_read o1, Misalign_read o2 -> + Misalign_read (LocationLattice.narrow o1 o2) + | Well, Well -> Well + | Unknown, m | m, Unknown -> m + | _, _ -> Unknown let is_included o1 o2 = (equal o1 (meet o1 o2)) diff --git a/src/kernel_services/abstract_interp/origin.mli b/src/kernel_services/abstract_interp/origin.mli index 537bcbf8dd1e447e91c85282a77bdca5e9ffb3d2..a169aba951dc83c3810b7cf8564afcab9f2bf46f 100644 --- a/src/kernel_services/abstract_interp/origin.mli +++ b/src/kernel_services/abstract_interp/origin.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,21 +29,20 @@ pointer, and that are not the result of a translation *) -(** Sets of source locations *) -module LocationSetLattice : sig - include Lattice_type.Lattice_Set with type O.elt = Cil_types.location - val currentloc_singleton : unit -> t - val compare:t -> t -> int +(** Lattice of source locations. *) +module LocationLattice : sig + include Lattice_type.Lattice_Base with type l = Cil_types.location + val current_loc : unit -> t end (** List of possible origins. Most of them also include the set of source locations where the operation took place. *) type origin = - | Misalign_read of LocationSetLattice.t (** Read of not all the bits of a + | Misalign_read of LocationLattice.t (** Read of not all the bits of a pointer, typically through a pointer cast *) - | Leaf of LocationSetLattice.t (** Result of a function without a body *) - | Merge of LocationSetLattice.t (** Join between two control-flows *) - | Arith of LocationSetLattice.t (** Arithmetic operation that cannot be + | Leaf of LocationLattice.t (** Result of a function without a body *) + | Merge of LocationLattice.t (** Join between two control-flows *) + | Arith of LocationLattice.t (** Arithmetic operation that cannot be represented, eg. ['&x * 2'] *) | Well (** Imprecise variables of the initial state *) | Unknown @@ -70,6 +69,7 @@ val is_top: t -> bool val bottom: t val join: t -> t -> t +val link: t -> t -> t val meet: t -> t -> t val narrow: t -> t -> t diff --git a/src/kernel_services/abstract_interp/tr_offset.ml b/src/kernel_services/abstract_interp/tr_offset.ml index 7b52a7ac137322f52b232cefaac9dccd17685991..7f1eecc46cae7538faa03518af084d8efec82a1b 100644 --- a/src/kernel_services/abstract_interp/tr_offset.ml +++ b/src/kernel_services/abstract_interp/tr_offset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -39,7 +39,7 @@ let pretty fmt = function (* Returns (alarm, reduced_ival)] *) let trim_by_validity ?(origin=Origin.Unknown) ival size validity = - let pred_size = Int.pred size in + let pred_size = Int.max Int.zero (Int.pred size) in (* reduce [ival] so that all accesses fit within [min_valid] and [max_maybe_valid]; uses [opt_max_sure_valid] to generate alarms *) let reduce_for_bounds min_valid opt_max_sure_valid max_maybe_valid = diff --git a/src/kernel_services/abstract_interp/tr_offset.mli b/src/kernel_services/abstract_interp/tr_offset.mli index c12b723c64de17a9fd644fcda34941f9e98ffeef..61f7a96cb751757d84064b98c70492de8e109bcc 100644 --- a/src/kernel_services/abstract_interp/tr_offset.mli +++ b/src/kernel_services/abstract_interp/tr_offset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -21,7 +21,8 @@ (**************************************************************************) (** Reduction of a location (expressed as an Ival.t and a size) - by a base validity. Only the locations in the trimmed result are valid. *) + by a base validity. Only the locations in the trimmed result are valid. + All offsets are expressed in bits. *) type t = private | Invalid (** No location is valid *) @@ -38,9 +39,10 @@ val pretty: t Pretty_utils.formatter (** [trim_by_validity ?origin offsets size validity] reduces [offsets] so that all accesses to [offsets+(0..size-1)] are valid according to [validity]. + For a size of 0, consider the offsets up to the validity past-one valid. The returned boolean indicates that at least one of the offsets does not comply with [validity]. If the valid offsets cannot be represented - precisely, the [Imprecise] constructor is returned. When specified, + precisely, the [Overlap] constructor is returned. When specified, the [origin] argument is used as the source of this imprecision . *) val trim_by_validity : ?origin:Origin.t -> diff --git a/src/kernel_services/abstract_interp/trace.ml b/src/kernel_services/abstract_interp/trace.ml deleted file mode 100644 index 7e2e65c2fa0f21cfb1a58584dd75a0e5d2a95f22..0000000000000000000000000000000000000000 --- a/src/kernel_services/abstract_interp/trace.ml +++ /dev/null @@ -1,467 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types;; - -(* An interval lattice describing the number of times a basic_block - has been executed. *) -type execution_count = int * int;; -let empty_execution_count = (0,0);; - - -(* Nodes in the intra-procedural trace graph. They are identified by - the stmt that begin them, together with an approximation of the - number of times the block has been executed. The execution count - allows to differentiate multiple executions of the same basic - block, which helps maintaining precise traces. - - The start of the trace is identified with a special element - Initial. This is necessary for the evaluation of functions without - a body. - - TODO: Add more elements, such as widen hint. -*) -type trace_node = -| In_basic_block of stmt * execution_count -| Disjunction of Property.t * predicate * execution_count -| Initial - -(* Note: this could be generalized as a functor put in AI, - representing an abstract domain of paths in a graph. *) -module Ordered_Trace_Node = struct - type t = trace_node - let compare = Pervasives.compare -end;; - -module Trace_Node_Set = FCSet.Make(Ordered_Trace_Node);; -module Trace_Node_Map = FCMap.Make(Ordered_Trace_Node);; - -(* TODO: stmt is used only for verification during propagation, and - execution_count is also used only during propagation. Structuring - things differently could allow to save some space. *) - -(* Represents an over-approximation of a set of intra-procedural traces. *) -type intra = { - (* A DAG representing a set of traces, stored as a map "from block - -> set of to blocks". *) - dag: Trace_Node_Set.t Trace_Node_Map.t; - - (* The current function we're in. Useful to iterate on a trace from - the beginning. TODO: replace by "called_by". *) - (* called_by: call_stack *) - current_kf: kernel_function; - - (* The current basic block we are in. *) - current_node: trace_node; - - (* The current statement. Used only for verification. *) - current_stmt: stmt option; - - (* Number of times each statement at the beginning of a basic block - has been executed. *) - execution_count: execution_count Cil_datatype.Stmt.Map.t -} - -(* The current function, the instruction that called it, - and the trace leading to that instruction. (instr,trace) is None - for the caller of the entry point. *) -and _call_stack = (kernel_function * (instr * intra) option);; - -type t = -| Bottom -| Traces of intra -| Top - -let bottom = Bottom;; -let top = Bottom;; - -(****************************************************************) -(* Pretty-printing of traces. *) - -module G = struct - type t = Trace_Node_Set.t Trace_Node_Map.t - module V = struct - type t = trace_node - let compare = Pervasives.compare - let hash = Hashtbl.hash - let equal = (==) - end - let iter_succ f graph node = - let set = - try Trace_Node_Map.find node graph - with Not_found -> Trace_Node_Set.empty (* assert false *) - in Trace_Node_Set.iter f set - let iter_vertex f graph = - Trace_Node_Map.iter (fun vertex _succs -> f vertex) graph;; -end - -module Sorted = Graph.Topological.Make(G);; - -let pretty_trace_node fmt = function - | In_basic_block(stmt,(mincount,maxcount)) -> - let strstmt = (string_of_int stmt.sid) in - Format.fprintf fmt "%s[%d-%d]" strstmt mincount maxcount - | Initial -> Format.fprintf fmt "initial" - | Disjunction (ip,pred,(start,end_)) -> - let name = match pred.pred_name with - | a::_ -> a - | _ -> "unnamed" - in - Format.fprintf fmt "%a disjunction( %s)[%d-%d]" - Property.short_pretty ip name start end_ -;; - -(* TODO: Factorize repeats introduced by loops. *) -let pretty_graph pp_elt fmt graph = - let list = Sorted.fold (fun x l -> x::l) graph [] in - let list = List.rev list in - - (* Compute the set of nodes with more than one incoming edge. *) - let (_,join_nodes) = List.fold_left (fun (seen,seen_twice) x -> - let set = (try Trace_Node_Map.find x graph with Not_found -> assert false) in - Trace_Node_Set.fold (fun x (seen,seen_twice) -> - if Trace_Node_Set.mem x seen - then (seen, Trace_Node_Set.add x seen_twice) - else (Trace_Node_Set.add x seen, seen_twice)) set (seen,seen_twice)) - (Trace_Node_Set.empty, Trace_Node_Set.empty) list - in - - (* Display the string, until the element has two outgoing edges, or two incoming edges. *) - let has_two_incoming_edges x = Trace_Node_Set.mem x join_nodes in - - (* A "string" is a linear list of blocks, in which all elements - (except the first and last) have one outgoing edge and one - incoming edge. Strings are displayed on the same lines; "\n" is - used to "cut" strings. *) - let rec display_string = function - | [] -> [] - | [x] when - let set = - try Trace_Node_Map.find x graph - with Not_found -> assert false - in Trace_Node_Set.cardinal set = 1 -> - let set = Trace_Node_Map.find x graph in - let elt = Trace_Node_Set.choose set in - Format.fprintf fmt "%a -> %a@." pp_elt x pp_elt elt; [] - | x::((y::_) as rest) when - not (has_two_incoming_edges x) && - let set = - try Trace_Node_Map.find x graph - with Not_found -> assert false - in Trace_Node_Set.cardinal set = 1 && Trace_Node_Set.mem y set - -> Format.fprintf fmt "%a -> " pp_elt x; display_string rest - | x::_ as l (* x has two outgoing or incoming edges. *) - -> Format.fprintf fmt "%a@." pp_elt x; l - in - let rec loop = function - | [] -> () - | l -> loop (display_string l) - in - loop list; -;; - - -let pretty_intra fmt trace = - match trace.current_stmt with - | None -> Format.fprintf fmt "stmt null " - | Some(stmt) -> Format.fprintf fmt "stmt %d " stmt.sid; - Format.fprintf fmt "current bb: %a" pretty_trace_node trace.current_node; - Format.fprintf fmt "dag: @. %a" (pretty_graph pretty_trace_node) trace.dag -;; - -let pretty fmt = function - | Bottom -> Format.fprintf fmt "bottom" - | Top -> Format.fprintf fmt "top" - | Traces(t) -> pretty_intra fmt t -;; - -(****************************************************************) -(* Joining two traces. *) - -(* Two trace nodes are compatible if they can be joined. The only - requirement is that they point to the same location in the program. *) -let compatible_trace_node bb1 bb2 = match (bb1,bb2) with -| In_basic_block(s1,_o1), In_basic_block(s2,_o2) -> s1.sid == s2.sid -| Disjunction(ip1,_p1,_o1), Disjunction(ip2,_p2,_o2) -> Property.equal ip1 ip2 -| Initial, Initial -> true -| _ -> false -;; - -(* Note: join is an over approximation; when joining 0 -> 1 -> 2 -> 3 - with 0 -> 4 -> 2 -> 5, we get 0 -> (1 | 4) -> 2 -> (3 | 5), but the - path 0 -> 1 -> 2 -> 5 may not exist. *) -let join_intra t1 t2 = - (* Kernel.debug "joining %a@. with %a@." pretty_intra t1 pretty_intra t2; *) - assert (t1.current_kf == t2.current_kf); - assert (match t1.current_stmt,t2.current_stmt with - | Some({sid=sid1}), Some { sid = sid2 } when sid1 == sid2 -> true - | _ -> false); - assert (compatible_trace_node t1.current_node t2.current_node); - let merged_dag = - let merge_fun _key set1 set2 = match set1, set2 with - | Some set1, Some set2 -> Some (Trace_Node_Set.union set1 set2) - | None, a | a, None -> a - in - Trace_Node_Map.merge merge_fun t1.dag t2.dag - in - let merged_execution_count = - let join_execution_count (a1,b1) (a2,b2) = (min a1 a2, max b1 b2) in - let merge_fun _key iv1 iv2 = match iv1, iv2 with - | Some iv1, Some iv2 -> Some (join_execution_count iv1 iv2) - | None, a | a, None -> a - in - Cil_datatype.Stmt.Map.merge merge_fun t1.execution_count t2.execution_count - in - { dag = merged_dag; - current_kf = t1.current_kf; current_stmt = t1.current_stmt; - current_node = t1.current_node; - execution_count = merged_execution_count - } -;; - -let join t1 t2 = match t1,t2 with - | Top, _ | _, Top -> Top - | Bottom, t | t, Bottom -> t - | Traces t1, Traces t2 -> Traces (join_intra t1 t2) -;; - -(* Note: mechanically translated from join_intra. *) -let narrow_intra t1 t2 = - (* Kernel.debug "narrowing %a@. with %a@." pretty_intra t1 pretty_intra t2; *) - assert (t1.current_kf == t2.current_kf); - assert (match t1.current_stmt,t2.current_stmt with - | Some({sid=sid1}), Some { sid = sid2 } when sid1 == sid2 -> true - | _ -> false); - assert (compatible_trace_node t1.current_node t2.current_node); - let merged_dag = - let merge_fun _key set1 set2 = match set1, set2 with - | Some set1, Some set2 -> Some (Trace_Node_Set.inter set1 set2) - | None, _ | _, None -> None - in - Trace_Node_Map.merge merge_fun t1.dag t2.dag - in - let merged_execution_count = - let narrow_execution_count (a1,b1) (a2,b2) = (max a1 a2, min b1 b2) in - let merge_fun _key iv1 iv2 = match iv1, iv2 with - | Some iv1, Some iv2 -> Some (narrow_execution_count iv1 iv2) - | None, _ | _, None -> None - in - Cil_datatype.Stmt.Map.merge merge_fun t1.execution_count t2.execution_count - in - { dag = merged_dag; - current_kf = t1.current_kf; current_stmt = t1.current_stmt; - current_node = t1.current_node; - execution_count = merged_execution_count - } -;; - -let narrow t1 t2 = match t1,t2 with - | Top, t | t, Top -> t - | Bottom, _ | _, Bottom -> Bottom - | Traces t1, Traces t2 -> Traces (narrow_intra t1 t2) -;; - - -(****************************************************************) -(* Precedence. *) - -(* Intersection of two graphs (the graph with the nodes and vertices - present in both graphs) *) -let inter dag1 dag2 = - let f from t1_tos cur_inter_dag = - try - let t2_tos = Trace_Node_Map.find from dag2 in - let inter_tos = Trace_Node_Set.inter t1_tos t2_tos in - if Trace_Node_Set.is_empty (inter_tos) - then cur_inter_dag - else Trace_Node_Map.add from inter_tos cur_inter_dag - with Not_found -> cur_inter_dag - in - Trace_Node_Map.fold f dag1 Trace_Node_Map.empty -;; - - -(* Use OCaml graph path checker. From the description it uses - Dijkstra's algorithm, while we would prefer to perform an early - exit when the path is found (e.g. interrupting a depth-first - search). On the other hand, the results are cached, and we reuse it - for the precedence test.*) -module PathChecker = Graph.Path.Check(struct - type t = Trace_Node_Set.t Trace_Node_Map.t;; - module V = struct - type t = trace_node - let compare = Pervasives.compare - let hash = Hashtbl.hash - let equal = (=) - end - let iter_succ f g v = - try - let set = Trace_Node_Map.find v g in - Trace_Node_Set.iter f set - with Not_found -> () -end) - -(* [precedes t1 t2] returns a pair of booleans: - - - the first is true iff an event whose trace is in [t1] may have - happened before an event whose trace is in [t2]. This is possible - only if there is a path in both [t1] and [t2] that leads to the - current block of [t1]. - - - the second is true iff an event whose trace is in [t2] may have - happened before an event whose trace is in [t1]. - - Note: because of the overapproximation, we cannot answer - definitively that t1 indeed happened before t2. We can only answer - definitively when it could not. - - The presence of common path is computed by first computing the - intersection of the dags, and then checking if there is a path from - the root to s1 or s2. If for instance there is no path to s1, it - means that one of the traces never went to s1 with the same path. -*) -let _precedes t1 t2 = - assert (t1.current_kf == t2.current_kf); - (* TODO: Early check: is the current basic block of t1 in t2 at all? - If no, we can early exit. Else, expensive check. *) - let intersection_dag = inter t1.dag t2.dag in - let from = - let first_stmt = Kernel_function.find_first_stmt t1.current_kf in - In_basic_block (first_stmt, empty_execution_count) - in - let checker = PathChecker.create intersection_dag in - (PathChecker.check_path checker from t1.current_node, - PathChecker.check_path checker from t2.current_node) - - -(* TODO: compute the shortest of two traces. Useful to sort traces - that lead to an alarm. *) - -(****************************************************************) -(* Updating the trace during the abstract interpretation. *) - -let incr_execution_count stmt execution_count = - let incr (a,b) = - if b = max_int - then Kernel.fatal "Too many executions per basicblock" - else (a+1,b+1) - in - let old = - try Cil_datatype.Stmt.Map.find stmt execution_count - with Not_found -> empty_execution_count - in - (old, Cil_datatype.Stmt.Map.add stmt (incr old) execution_count) -;; - -(* Returns the dag with a link added from the current node to the [node] *) -let add_node node trace = - let dag = trace.dag in - let current_bb = trace.current_node in - let set = - try Trace_Node_Set.add node (Trace_Node_Map.find current_bb dag) - with Not_found -> Trace_Node_Set.singleton node - in - let newdag = Trace_Node_Map.add current_bb set dag in - newdag -;; - -let add_basic_block stmt trace = - let count, exec_count = incr_execution_count stmt trace.execution_count in - let node = In_basic_block(stmt,count) in - let newdag = add_node node trace in - { trace with dag = newdag; - current_node = node; - execution_count = exec_count; - current_stmt = Some stmt - } -;; - -(* A statement with several predecessors is at the beginning of a basic block. - A statement with several successors is at the end of a basic block. - Two consecutive statements are in the same basic block iff the first is not - at the end of a basic block, and the second not at the beginning.*) -let has_one_pred_and_pred_has_one_succ stmt = match stmt.preds with - | [pred] -> (match pred.succs with - | [_] -> true - | _ -> false) - | _ -> false - -(* Map on pointed sets. *) -let map_pointed f = function - | Bottom -> Bottom - | Top -> Top - | Traces(t) -> Traces(f t) -;; - -(* A basic block start with a statement with two predecessors, or zero - for the function entry point. *) -let add_statement stmt = map_pointed (fun trace -> - (* Kernel.debug "Adding statement %d preds %d" *) - (* stmt.sid (List.length stmt.preds); *) - if has_one_pred_and_pred_has_one_succ stmt - then { trace with current_stmt = Some stmt } - else add_basic_block stmt trace) -;; - -(* The execution count of the current node. *) -let get_current_execution_count trace = - match trace.current_node with - | In_basic_block (_,count) -> count - | Disjunction (_,_,count) -> count - | Initial -> empty_execution_count -;; - - -let add_disjunction ip named_pred = map_pointed (fun trace -> - let count = get_current_execution_count trace in - let node = Disjunction (ip, named_pred, count) in - let newdag = add_node node trace in - { trace with dag = newdag; current_node = node } -) -;; - -(* Should be synchronized with the default value for val-show-trace. *) -let compute_trace = ref false;; -let set_compute_trace b = compute_trace := b;; - -(* Initial intra-procedural trace for a given function. - - TODO: Update to keep an inter-procedural trace. *) -let initial kf = - if not !compute_trace - then Top - else - let stmt = None in - Traces - { dag = Trace_Node_Map.empty; - current_kf = kf; - current_stmt = stmt; - current_node = Initial; - execution_count = Cil_datatype.Stmt.Map.empty - } -;; - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/kernel_services/analysis/bit_utils.ml b/src/kernel_services/analysis/bit_utils.ml index a61a9d5b76fa18ad467b7076e45b89c36d63df70..92fd99d0d6c7743d179c05778debc2f1ed5f8d3b 100644 --- a/src/kernel_services/analysis/bit_utils.ml +++ b/src/kernel_services/analysis/bit_utils.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/bit_utils.mli b/src/kernel_services/analysis/bit_utils.mli index 99e641769bf2c1721db1efeb765c48c355b2542e..b1cd77547bea4c6c7bcbf9458c350e6bda0c3b13 100644 --- a/src/kernel_services/analysis/bit_utils.mli +++ b/src/kernel_services/analysis/bit_utils.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -78,7 +78,7 @@ val max_byte_address : unit -> Integer.t @since Aluminium-20160501 *) val max_byte_size : unit -> Integer.t - (** @return the maximal possible size in bits of a memory base. + (** @return the maximal possible size in bytes of a memory base. @since Aluminium-20160501 *) (** {2 Pretty printing} *) diff --git a/src/kernel_services/analysis/dataflow.ml b/src/kernel_services/analysis/dataflow.ml index d65f32ff4c0cc00ee944af5af3690dd8320e25f7..516cd3f7e37f430c0a42b73d867625defdd6b97f 100644 --- a/src/kernel_services/analysis/dataflow.ml +++ b/src/kernel_services/analysis/dataflow.ml @@ -83,7 +83,7 @@ end module StartData(X: sig type t val size: int end) = struct type data = X.t open Cil_datatype.Stmt.Hashtbl - let stmtStartData = create X.size + let stmtStartData: data Cil_datatype.Stmt.Hashtbl.t = create X.size let clear () = clear stmtStartData let mem = mem stmtStartData let find = find stmtStartData diff --git a/src/kernel_services/analysis/dataflow2.ml b/src/kernel_services/analysis/dataflow2.ml index 5fbca66581c1092810a61c6d2cd328c78751a10c..f56ee4eab6304d674768f4f1a661a3762cdf3f4e 100644 --- a/src/kernel_services/analysis/dataflow2.ml +++ b/src/kernel_services/analysis/dataflow2.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -60,7 +60,7 @@ end module StartData(X: sig type t val size: int end) = struct type data = X.t open Cil_datatype.Stmt.Hashtbl - let stmtStartData = create X.size + let stmtStartData: data Cil_datatype.Stmt.Hashtbl.t = create X.size let clear () = clear stmtStartData let mem = mem stmtStartData let find = find stmtStartData diff --git a/src/kernel_services/analysis/dataflow2.mli b/src/kernel_services/analysis/dataflow2.mli index afe2a006914f28bdec926e6aa8cb2d5ad8d15f80..967c4a2bb154628045f30bdb3b38f8e6148f7644 100644 --- a/src/kernel_services/analysis/dataflow2.mli +++ b/src/kernel_services/analysis/dataflow2.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/destructors.ml b/src/kernel_services/analysis/destructors.ml new file mode 100644 index 0000000000000000000000000000000000000000..fb7e7ef82b850b563fa739907c163aaa133ec39d --- /dev/null +++ b/src/kernel_services/analysis/destructors.ml @@ -0,0 +1,268 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types + +let add_destructor (_, l as acc) var = + let loc = var.vdecl in + match Cil.findAttribute Cabs2cil.frama_c_destructor var.vattr with + | [] -> acc + | [ attr ] -> + let mk_call f e args = + let kf = Globals.Functions.find_by_name f in + let e = + match Globals.Functions.get_params kf with + | vi :: _ -> + if Cil.need_cast (Cil.typeOf e) vi.vtype then Cil.mkCast e vi.vtype + else e + | [] -> + Kernel.fatal + "Destructor function %a should take at least one argument" + Kernel_function.pretty kf + in + let vf = Kernel_function.get_vi kf in + vf.vreferenced <- true; + let s = + Cil.mkStmtOneInstr ~valid_sid:true + (Call(None,Cil.evar ~loc vf,e::args,loc)) + in (true, s :: l) + in + let rec aux e a = + match a with + | AAddrOf a -> aux (Cil.mkAddrOfVi var) a + | AStr f -> mk_call f e [] + | ACons (f, [n]) -> + (match Cil.intOfAttrparam n with + | Some n -> + mk_call f e [Cil.kinteger ~loc Cil.(theMachine.kindOfSizeOf) n] + | None -> + Kernel.fatal + "unexpected argument of attribute %s: %a" + Cabs2cil.frama_c_destructor + Printer.pp_attrparam a) + | _ -> + Kernel.fatal + "unexpected argument of attribute %s: %a" + Cabs2cil.frama_c_destructor + Printer.pp_attrparam a + in aux (Cil.evar ~loc var) attr + | _ -> + Kernel.fatal + "attribute %s expects exactly one argument" Cabs2cil.frama_c_destructor + +(* we expect the variables from oldest to newest. Hence the fold_left will + call the destructors in the reverse order, starting with the newest ones. *) +let add_destructors vars = List.fold_left add_destructor (false,[]) vars + +(* insert the destructors before the given jump statement. *) +let insert_destructors destructors s stmts = + let rec aux previous tl = + match tl with + | [] -> false, [] + | hd :: _ when Cil_datatype.Stmt.equal hd s -> + true, List.rev_append previous destructors @ tl + | { skind = UnspecifiedSequence l } as s :: tl -> + let (has_inserted, res) = aux_seq [] l in + if has_inserted then + true, + List.rev_append previous ({s with skind = UnspecifiedSequence res}:: tl) + else + aux (s::previous) tl + | hd :: tl -> aux (hd :: previous) tl + and aux_seq previous tl = + match tl with + | [] -> false, [] + | (s', _, _, _, _) :: _ when Cil_datatype.Stmt.equal s s' -> + let destructors = List.map (fun s -> s,[],[],[],[]) destructors in + true, List.rev_append previous destructors @ tl + (* There can't be a block here, since we are by definition in the + innermost block containing the statement. *) + | hd :: tl -> aux_seq (hd :: previous) tl + in + let (has_inserted, res) = aux [] stmts in + if has_inserted then res + else + Kernel.fatal ~current:true + "Statement %a not found in the current block" Printer.pp_stmt s + +class vis flag = object(self) + inherit Visitor.frama_c_inplace + + val blocks = Stack.create () + + (* We sometimes move labels between statements. This table maps the old + statements to the new ones. *) + val moved_labels = Cil_datatype.Stmt.Hashtbl.create 17 + + (* List of goto statements encountered in a function. If their target label + has been moved, they need to be updated afterwards. *) + val mutable gotos = [] + + (* Updates the goto statements whose target has been changed after the + introduction of the vla destructors. No destructor can have been added + between a switch statement and its cases, so no need to update switches. *) + method! vfunc _fundec = + let update_target sref = + try + let new_target = Cil_datatype.Stmt.Hashtbl.find moved_labels !sref in + sref := new_target + with Not_found -> () + in + let update_goto stmt = match stmt.skind with + | Goto (sref, _loc) -> update_target sref + | _ -> assert false + in + let post_goto_updater id = + List.iter update_goto gotos; + gotos <- []; + Cil_datatype.Stmt.Hashtbl.clear moved_labels; + id + in + Cil.DoChildrenPost post_goto_updater + + method! vblock b = + Stack.push b.bstmts blocks; + let post b = + let stmts = Stack.pop blocks in + let has_destructors, my_destructors = add_destructors b.blocals in + let stmts = + if has_destructors then begin + flag := true; + if stmts = [] then my_destructors + else begin + let stmt = Extlib.last stmts in + if Cabs2cil.stmtFallsThrough stmt then stmts @ my_destructors + else stmts + end + end + else stmts + in + if stmts != b.bstmts then b.bstmts <- stmts; + b + in + Cil.DoChildrenPost post + + method! vstmt_aux s = + let inspect_closed_blocks b = + (* blocks are sorted from innermost to outermost. The fold_left + will give us the list in appropriate order for add_destructors + which expects variable from oldest to newest. + *) + let vars = List.fold_left (fun acc b -> b.blocals @ acc) [] b in + let has_destructors, stmts = add_destructors vars in + if has_destructors then begin + flag:=true; + let curr_block = Stack.pop blocks in + (* Moves the labels of [s] into the first destructor, as any goto + jumping to [s] must also apply the destructors. *) + let first_destructor = List.hd stmts in + first_destructor.labels <- s.labels; + s.labels <- []; + (* Retains the move of labels to update later the gotos jumping to s. *) + Cil_datatype.Stmt.Hashtbl.add moved_labels s first_destructor; + let curr_block = insert_destructors stmts s curr_block in + Stack.push curr_block blocks; + end; + Cil.SkipChildren + in + let abort_if_non_trivial_type kind v = + if Cil.hasAttribute Cabs2cil.frama_c_destructor v.vattr then + Kernel.abort + "%a, cannot jump from %s statement \ + bypassing initialization of variable %a, declared at %a" + Printer.pp_location (Cil_datatype.Stmt.loc s) kind + Printer.pp_varinfo v Printer.pp_location v.vdecl + in + let check_def_domination kind b s v = + if v.vdefined then begin + let def = Cil.find_def_stmt b v in + if not (Dominators.dominates s def) then + (* if the jump's target [s] dominates the definition [def], + jumping to it from outside the block will not prevent the + initialization, hence is permitted: technically, the scope only + begins at the end of the declaration part of [def]. + See C11, 6.2.1§7 and C++11, stmt.dcl§3. + *) + abort_if_non_trivial_type kind v + end else abort_if_non_trivial_type kind v + in + let inspect_local_vars kind b s lv = + List.iter (check_def_domination kind b s) lv + in + let treat_jump_close s = + match s.succs with + | [ succ ] -> + inspect_closed_blocks (Kernel_function.blocks_closed_by_edge s succ) + | _ -> + Kernel.fatal ~current:true + "%a in function %a is expected to have a single successor" + Printer.pp_stmt s + Kernel_function.pretty (Extlib.the self#current_kf) + in + let treat_succ_open kind s succ = + let blocks = Kernel_function.blocks_opened_by_edge s succ in + List.iter (fun b -> inspect_local_vars kind b succ b.blocals) blocks + in + let treat_jump_open k s = List.iter (treat_succ_open k s) s.succs in + match s.skind with + (* jump to a statement inside the function. + *) + | Break _ | Continue _ -> treat_jump_close s + (* For goto, we must verify in addition that we do not enter the scope + of VLA or similar non trivial types (C++). See 6.8.6.1§1 of C11 and + stmt.dcl§3 of C++11 + *) + | Goto _ -> + gotos <- s :: gotos; + treat_jump_open "goto" s; treat_jump_close s + (* Ensures that there's no VLA declared between the switch and the case + label. See 6.8.4§2 of C11 and stmt.dcl§3 and footnote 88 of C++11. *) + | Switch _ -> treat_jump_open "switch" s; Cil.DoChildren + (* jump outside of the function: all currently opened blocks are closed. *) + | Return _ | Throw _ -> + inspect_closed_blocks (Kernel_function.find_all_enclosing_blocks s) + (* no jump yet, visit children *) + | _ -> Cil.DoChildren + +end + +let treat_one_function flag kf = + let my_flag = ref false in + let vis = new vis my_flag in + ignore (Visitor.visitFramacKf vis kf); + if !my_flag then begin + flag := true; + File.must_recompute_cfg (Kernel_function.get_definition kf) + end + +let add_destructor _ast = + let has_grown = ref false in + Globals.Functions.iter (treat_one_function has_grown); + if !has_grown then Ast.mark_as_grown () + +let transform_category = + File.register_code_transformation_category "expand_destructors" + +let () = + let after = [Exn_flow.transform_category] in + File.add_code_transformation_after_cleanup + ~after transform_category add_destructor diff --git a/src/kernel_services/abstract_interp/trace.mli b/src/kernel_services/analysis/destructors.mli similarity index 61% rename from src/kernel_services/abstract_interp/trace.mli rename to src/kernel_services/analysis/destructors.mli index 3e89da4419533178f8d20b461ba567f60c4fadbd..d011666e66422cacf7e9fcf2f52f2a017f1d5fed 100644 --- a/src/kernel_services/abstract_interp/trace.mli +++ b/src/kernel_services/analysis/destructors.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,36 +20,22 @@ (* *) (**************************************************************************) -(** Traces. *) - -(* [JS 2015/01/27] would be nice to better define what lattice this module - defines. *) - -open Cil_types - -(** Type of traces. *) -type t;; -val pretty : Format.formatter -> t -> unit;; - -(** No trace. Should be used only as a base case for a no-op join. *) -val bottom: t;; - -(** Unknown trace. Should be used only to forget a trace. *) -val top: t;; - -val join: t -> t -> t;; -val narrow: t -> t -> t;; - -(** Create a trace, or add an element at the end of a trace. *) -val initial: kernel_function -> t;; -val add_disjunction: Property.t -> predicate -> t -> t;; -val add_statement: stmt -> t -> t;; - -(** Set to false to set all traces to top. *) -val set_compute_trace: bool -> unit;; +(** retrieve local variables with [__fc_destructor] attribute and add + the appropriate calls to the corresponding destructor function when we + exit the scope of the variable. + + Argument of the attribute can take the following forms: + - [AStr f], where [f] is the name of the function to call. + - [ACons (f, [AInt n])], where [f] is the name of the function to call and + n an argument that will be passed to f in addition to the variable. + Will be used for destructing local C++ arrays. + - [AAddrOf a] where [a] is of the form above, to indicate that the + destructor should be given the address of the variable and not the + variable directly +*) -(* -Local Variables: -compile-command: "make -C ../../.." -End: +(** category of the transformation. Should be done after any transformation + susceptible to change the CFG of the program (e.g. + {!Exn_flow.transform_category}) *) +val transform_category: File.code_transformation_category diff --git a/src/kernel_services/analysis/dominators.ml b/src/kernel_services/analysis/dominators.ml index cfdfdaeb9cbbd217bccf2601f27864796364a9ca..bdd98a8f05f6dcdc14d20e88599668734386aa3c 100644 --- a/src/kernel_services/analysis/dominators.ml +++ b/src/kernel_services/analysis/dominators.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,7 +31,7 @@ module Dom_tree = State_builder.Hashtbl (Cil_datatype.Stmt.Hashtbl) (Datatype.Option(Cil_datatype.Stmt)) (struct - let name = "dominators.dom_tree" + let name = "Dominators.dom_tree" let dependencies = [ Ast.self ] let size = 197 end) diff --git a/src/kernel_services/analysis/dominators.mli b/src/kernel_services/analysis/dominators.mli index fdf3cc2833f8e699cb105d547aa79ac0f0d51619..cdf6f21c5011fc4c8f743669f762e5cd486b7f43 100644 --- a/src/kernel_services/analysis/dominators.mli +++ b/src/kernel_services/analysis/dominators.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/exn_flow.ml b/src/kernel_services/analysis/exn_flow.ml index a32c483244d1f058536ed49d615f6ddf5d673737..5ddd8b1f8433eba2ad199970c5a9cb067371b29f 100644 --- a/src/kernel_services/analysis/exn_flow.ml +++ b/src/kernel_services/analysis/exn_flow.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -191,7 +191,8 @@ object (self) method! vinst = function - | Call(_,{ enode = Lval(Var f,NoOffset) },_,_) -> + | Call(_,{ enode = Lval(Var f,NoOffset) },_,_) + | Local_init(_, ConsInit(f, _, _), _) -> let kf = Globals.Functions.get f in if self#recursive_call kf then begin let module Found = @@ -392,11 +393,13 @@ let make_init_assign loc v init = in List.rev (aux (Var v, NoOffset) [] init) +let find_exns_func v = + try Exns.find (Globals.Functions.get v) + with Not_found -> Cil_datatype.Typ.Set.empty + let find_exns e = match e.enode with - | Lval(Var v, NoOffset) -> - (try Exns.find (Globals.Functions.get v) - with Not_found -> Cil_datatype.Typ.Set.empty) + | Lval(Var v, NoOffset) -> find_exns_func v | _ -> all_exn () class erase_exn = @@ -695,49 +698,53 @@ object(self) else (Catch_exn (v,caught), b) :: acc method! vstmt_aux s = - match s.skind with - | Instr (Call (_,f,_,loc) as instr) -> - let my_exns = find_exns f in - if Cil_datatype.Typ.Set.is_empty my_exns then SkipChildren - else begin - self#modify_current (); - let make_jump t (stmts, uncaught) = - let t = purify t in - if Cil_datatype.Typ.Hashtbl.mem exn_labels t then begin - let e = self#exn_kind t in - let e = Cil.new_exp ~loc (Const (CEnum e)) in - let b = self#jumps_to_handler loc t in - let s = Cil.mkStmt (Block (Cil.mkBlock b)) in - s.labels <- [Case (e,loc)]; - s::stmts, uncaught - end else stmts, true - in - let stmts, uncaught = - Cil_datatype.Typ.Set.fold make_jump my_exns ([],false) - in - let stmts = - if uncaught then begin - let default = + let generate_jumps instr exns loc = + if Cil_datatype.Typ.Set.is_empty exns then SkipChildren + else begin + self#modify_current (); + let make_jump t (stmts, uncaught) = + let t = purify t in + if Cil_datatype.Typ.Hashtbl.mem exn_labels t then begin + let e = self#exn_kind t in + let e = Cil.new_exp ~loc (Const (CEnum e)) in + let b = self#jumps_to_handler loc t in + let s = Cil.mkStmt (Block (Cil.mkBlock b)) in + s.labels <- [Case (e,loc)]; + s::stmts, uncaught + end else stmts, true + in + let stmts, uncaught = + Cil_datatype.Typ.Set.fold make_jump exns ([],false) + in + let stmts = + if uncaught then begin + let default = Cil.mkStmt ( Block (Cil.mkBlock (self#jumps_to_default_handler loc))) - in - default.labels <- [Default loc]; - List.rev_append stmts [default] - end else List.rev stmts - in - let test = self#test_uncaught_flag loc true in - let cases = Cil.new_exp ~loc (Lval self#exn_kind_field) in - let switch = Cil.mkStmt (Switch(cases,Cil.mkBlock stmts,stmts,loc)) in - let handler = - Cil.mkStmt (If(test,Cil.mkBlock [switch],Cil.mkBlock [],loc)) - in - let instr = - Visitor.visitFramacInstr (self:>Visitor.frama_c_visitor) instr - in - let call = Cil.mkStmtOneInstr (List.hd instr) in - s.skind <- Block (Cil.mkBlock [call;handler]); - SkipChildren - end + in + default.labels <- [Default loc]; + List.rev_append stmts [default] + end else List.rev stmts + in + let test = self#test_uncaught_flag loc true in + let cases = Cil.new_exp ~loc (Lval self#exn_kind_field) in + let switch = Cil.mkStmt (Switch(cases,Cil.mkBlock stmts,stmts,loc)) in + let handler = + Cil.mkStmt (If(test,Cil.mkBlock [switch],Cil.mkBlock [],loc)) + in + let instr = + Visitor.visitFramacInstr (self:>Visitor.frama_c_visitor) instr + in + let call = Cil.mkStmtOneInstr (List.hd instr) in + s.skind <- Block (Cil.mkBlockNonScoping [call;handler]); + SkipChildren + end + in + match s.skind with + | Instr (Call (_,f,_,loc) as instr) -> + generate_jumps instr (find_exns f) loc + | Instr (Local_init(_, ConsInit(f,_,_), loc) as instr) -> + generate_jumps instr (find_exns_func f) loc | Throw _ when not can_throw -> Kernel.fatal "Unexpected Throw statement" | Throw(Some(e,t),loc) -> diff --git a/src/kernel_services/analysis/exn_flow.mli b/src/kernel_services/analysis/exn_flow.mli index eb4c2af0ae82fe751821942c1a8828a32d29cb05..20b1f0c3a3c11bd3a69a685f6695a3de697c80d5 100644 --- a/src/kernel_services/analysis/exn_flow.mli +++ b/src/kernel_services/analysis/exn_flow.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/logic_interp.ml b/src/kernel_services/analysis/logic_interp.ml index dfba0166100d1aece627f3372ea6b628d94cbf14..7fc5ff8f45b2b2ed4686f1d54d1b4c24b25e52b4 100644 --- a/src/kernel_services/analysis/logic_interp.ml +++ b/src/kernel_services/analysis/logic_interp.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -321,16 +321,16 @@ let loc_to_offset ~result loc = Some h, loc_offset_to_offset ~result o | Some _ -> error_lval() ) - | Tat ({ term_node = TLval(TResult _,_)} as lv,LogicLabel (_,"Post")) -> - aux h lv.term_node + | Tat ({ term_node = TLval(TResult _,_)} as lv, BuiltinLabel (_, Post)) -> + aux h lv.term_node | Tunion locs -> List.fold_left (fun (b,l) x -> let (b,l') = aux b x.term_node in b, l @ l') (h,[]) locs | Tempty_set -> h,[] - | Trange _ | TAddrOf _ + | Trange _ | TAddrOf _ | Tat _ | TSizeOfE _ | TAlignOfE _ | TUnOp _ | TBinOp _ | TSizeOfStr _ | TConst _ | TCastE _ | TAlignOf _ | TSizeOf _ | Tapp _ | Tif _ - | Tat _ | Toffset _ | Tbase_addr _ | Tblock_length _ | Tnull + | Toffset _ | Tbase_addr _ | Tblock_length _ | Tnull | TCoerce _ | TCoerceE _ | TDataCons _ | TUpdate _ | Tlambda _ | Ttypeof _ | Ttype _ | Tcomprehension _ | Tinter _ | Tlet _ | TLogic_coerce _ @@ -563,15 +563,21 @@ struct type abs_label = | AbsLabel_here | AbsLabel_pre | AbsLabel_post + | AbsLabel_init + | AbsLabel_loop_entry + | AbsLabel_loop_current | AbsLabel_stmt of stmt let is_same_label absl l = match absl, l with | AbsLabel_stmt s1, StmtLabel s2 -> Cil_datatype.Stmt.equal s1 !s2 - | AbsLabel_here, LogicLabel (_, "Here") -> true - | AbsLabel_pre, LogicLabel (_, "Pre") -> true - | AbsLabel_post, LogicLabel (_, "Post") -> true - | _ -> false + | AbsLabel_here, BuiltinLabel (_, Here) -> true + | AbsLabel_pre, BuiltinLabel (_, Pre) -> true + | AbsLabel_post, BuiltinLabel (_, Post) -> true + | AbsLabel_init, BuiltinLabel (_, Init) -> true + | AbsLabel_loop_entry, BuiltinLabel (_, LoopEntry) -> true + | AbsLabel_loop_current, BuiltinLabel (_, LoopCurrent) -> true + | _, (StmtLabel _ | FormalLabel _ | BuiltinLabel _) -> false class populate_zone before_opt ki_opt kf = @@ -613,6 +619,11 @@ struct | AbsLabel_pre -> get_fct_entry_point () | AbsLabel_here -> get_ctrl_point true | AbsLabel_post -> get_ctrl_point false + | AbsLabel_init -> raise (NYI "[logic_interp] Init label") + | AbsLabel_loop_current -> + raise (NYI "[logic_interp] LoopCurrent label") + | AbsLabel_loop_entry -> + raise (NYI "[logic_interp] LoopEntry label") in (* TODO: the method should be able to return result directly *) match result with | current_before, Some current_stmt -> current_before, current_stmt @@ -691,6 +702,9 @@ contracts." (* refers to the pre-state of the function contract. *) self#change_label AbsLabel_pre x + method private change_label_aux: 'a. _ -> 'a -> 'a visitAction = + fun lbl x -> self#change_label lbl x + method private change_label_to_stmt: 'a.stmt -> 'a -> 'a visitAction = fun stmt x -> match ki_opt with @@ -711,14 +725,19 @@ to function contracts." "[logic_interp] %a" Printer.pp_predicate_node p)) in match p with - | Pat (_, LogicLabel (_,"Old")) -> self#change_label_to_old p - | Pat (_, LogicLabel (_,"Here")) -> self#change_label_to_here p - | Pat (_, LogicLabel (_,"Pre")) -> self#change_label_to_pre p - | Pat (_, LogicLabel (_,"Post")) -> self#change_label_to_post p + | Pat (_, BuiltinLabel (_, Old)) -> self#change_label_to_old p + | Pat (_, BuiltinLabel (_, Here)) -> self#change_label_to_here p + | Pat (_, BuiltinLabel (_, Pre)) -> self#change_label_to_pre p + | Pat (_, BuiltinLabel (_, Post)) -> self#change_label_to_post p + | Pat (_, BuiltinLabel (_, Init)) -> + self#change_label_aux AbsLabel_init p + | Pat (_, BuiltinLabel (_, LoopCurrent)) -> + self#change_label_aux AbsLabel_loop_current p + | Pat (_, BuiltinLabel (_, LoopEntry)) -> + self#change_label_aux AbsLabel_loop_entry p + | Pat (_, FormalLabel s) -> + failwith ("unknown logic label" ^ s) | Pat (_, StmtLabel st) -> self#change_label_to_stmt !st p - | Pat (_, LogicLabel (_,s)) -> - failwith ("unknown logic label" ^ s) - | Pfalse | Ptrue | Prel _ | Pand _ | Por _ | Pxor _ | Pimplies _ | Piff _ | Pnot _ | Pif _ | Plet _ | Pforall _ | Pexists _ | Papp (_, [], _) (* No label, thus cannot access memory *) @@ -755,7 +774,7 @@ to function contracts." try let deps = !Db.From.find_deps_term_no_transitivity_state state t in (* TODO: what we should we do with other program points? *) - let z = Logic_label.Map.find (LogicLabel (None,"Here")) deps in + let z = Logic_label.Map.find (BuiltinLabel (None, Here)) deps in let z = Locations.Zone.filter_base (function Base.CLogic_Var _ -> false | _ -> true) @@ -771,12 +790,18 @@ to function contracts." | TLval(TVar {lv_origin = Some _},_) | TStartOf _ -> self#do_term_lval t; SkipChildren - | Tat (_, LogicLabel (_,"Old")) -> self#change_label_to_old t - | Tat (_, LogicLabel (_,"Here")) -> self#change_label_to_here t - | Tat (_, LogicLabel (_,"Pre")) -> self#change_label_to_pre t - | Tat (_, LogicLabel (_,"Post")) -> self#change_label_to_post t + | Tat (_, BuiltinLabel (_, Old)) -> self#change_label_to_old t + | Tat (_, BuiltinLabel (_, Here)) -> self#change_label_to_here t + | Tat (_, BuiltinLabel (_, Pre)) -> self#change_label_to_pre t + | Tat (_, BuiltinLabel (_, Post)) -> self#change_label_to_post t + | Tat (_, BuiltinLabel (_, Init)) -> + self#change_label_aux AbsLabel_init t + | Tat (_, BuiltinLabel (_, LoopCurrent)) -> + self#change_label_aux AbsLabel_loop_current t + | Tat (_, BuiltinLabel (_, LoopEntry)) -> + self#change_label_aux AbsLabel_loop_entry t | Tat (_, StmtLabel st) -> self#change_label_to_stmt !st t - | Tat (_, LogicLabel (_,s)) -> + | Tat (_, FormalLabel s) -> failwith ("unknown logic label" ^ s) | TSizeOf _ | TSizeOfE _ | TSizeOfStr _ | TAlignOf _ | TAlignOfE _ -> (* These are static constructors, there are no dependencies here *) diff --git a/src/kernel_services/analysis/logic_interp.mli b/src/kernel_services/analysis/logic_interp.mli index a036f5ef6cc4ad0a6d107850e617bd0d4bc1a312..325df7cfc6ffb61cd4a689ccce7274966a043a11 100644 --- a/src/kernel_services/analysis/logic_interp.mli +++ b/src/kernel_services/analysis/logic_interp.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/loop.ml b/src/kernel_services/analysis/loop.ml index 5a774ef161c32f36586bb90197dcde1bdcfd35e3..7c8c1da873fad82568cbfc677c0d21550ddfbd29 100644 --- a/src/kernel_services/analysis/loop.ml +++ b/src/kernel_services/analysis/loop.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/loop.mli b/src/kernel_services/analysis/loop.mli index c7413c2b9f58b1c0ed60c5c7570c224eca1cbef7..c6eb0acc6d741491f1625251539aa8d5c1a77396 100644 --- a/src/kernel_services/analysis/loop.mli +++ b/src/kernel_services/analysis/loop.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/ordered_stmt.ml b/src/kernel_services/analysis/ordered_stmt.ml index 5911aef40cff189ed06d14ef4041fc734e1d406e..01e6d0858b97f61fd94e7f5d63faee0df8d30f87 100644 --- a/src/kernel_services/analysis/ordered_stmt.ml +++ b/src/kernel_services/analysis/ordered_stmt.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/ordered_stmt.mli b/src/kernel_services/analysis/ordered_stmt.mli index cab45617cfe599bbf3c937da95b726c1843bc83d..59b0d1e3176034f4bbe98bf2097b352b68cd3e16 100644 --- a/src/kernel_services/analysis/ordered_stmt.mli +++ b/src/kernel_services/analysis/ordered_stmt.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/service_graph.ml b/src/kernel_services/analysis/service_graph.ml index 015d546135faeaff66bd3e38c687c05c549a185f..2a11198794279e7d305b45c7881af227c2616954 100644 --- a/src/kernel_services/analysis/service_graph.ml +++ b/src/kernel_services/analysis/service_graph.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,9 +30,10 @@ module type S = sig type node type graph module Service_graph: sig - include Graph.Sig.G with type V.t = node vertex and type E.label = edge + include Graph.Sig.I with type V.t = node vertex and type E.label = edge module Datatype: Datatype.S with type t = t end + val vertex: node -> node vertex val compute: graph -> Datatype.String.Set.t -> Service_graph.t val output_graph: out_channel -> Service_graph.t -> unit val entry_point: unit -> Service_graph.V.t option @@ -116,6 +117,10 @@ struct let replace = HVertex.replace vertices let clear () = HVertex.clear vertices end + let vertex n = + try fst (Vertices.find n) + with Not_found -> + Kernel.fatal "[service_graph] node %s not found" (G.V.name n) let edge_invariant src dst = function | Inter_functions -> @@ -277,13 +282,13 @@ Src root:%s in %s (is_root:%b) Dst:%s in %s (is_root:%b) [2d case]" let compute g initial_roots = entry_point_ref := None; + Vertices.clear (); let module Go = Graph.Topological.Make(G) in let callg = Service_graph.create () in Go.iter (make_vertex g callg initial_roots) g; Go.iter (update_vertex g) g; add_edges g callg; check_invariant callg; - Vertices.clear (); callg let entry_point () = !entry_point_ref diff --git a/src/kernel_services/analysis/service_graph.mli b/src/kernel_services/analysis/service_graph.mli index f88909cea5d14847e93a1f689ffc0ce3614a9717..b060779b29aacbbea65e80a15e51d5df18a2c3b9 100644 --- a/src/kernel_services/analysis/service_graph.mli +++ b/src/kernel_services/analysis/service_graph.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -39,10 +39,11 @@ module type S = sig type graph module Service_graph: sig - include Graph.Sig.G with type V.t = node vertex and type E.label = edge + include Graph.Sig.I with type V.t = node vertex and type E.label = edge module Datatype: Datatype.S with type t = t end + val vertex: node -> node vertex val compute: graph -> Datatype.String.Set.t -> Service_graph.t val output_graph: out_channel -> Service_graph.t -> unit diff --git a/src/kernel_services/analysis/stmts_graph.ml b/src/kernel_services/analysis/stmts_graph.ml index 1bcf5685456196e869e87672c0d42cc4b49725c3..0f499f9d14970b5cc5f2fc0751862276c58bbb1f 100644 --- a/src/kernel_services/analysis/stmts_graph.ml +++ b/src/kernel_services/analysis/stmts_graph.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -210,7 +210,7 @@ module StmtsGraphTbl= (struct include Datatype.Serializable_undefined type t = SG.t - let name = "Stmts_Graph.SG.t" + let name = "Stmts_Graph.StmtsGraphTbl" let reprs = [ SG.create () ] let mem_project = Datatype.never_any_project end)) @@ -257,7 +257,7 @@ module StmtStmts = Cil_state_builder.Stmt_hashtbl (Stmt.Set) (struct - let name = "StmtStmts" + let name = "Stmts_graph.StmtStmts" let size = 142 let dependencies = [ Ast.self ] end) @@ -322,7 +322,7 @@ module WaysOutDatatype = module StmtWaysOut = Cil_state_builder.Stmt_hashtbl (WaysOutDatatype) (struct - let name = "StmtWaysOut" + let name = "Stmts_graphs.StmtWaysOut" let size = 142 let dependencies = [ StmtStmts.self ] end) @@ -404,7 +404,7 @@ module StmtWaysIn = Cil_state_builder.Stmt_hashtbl (Datatype.List (EdgeDatatype)) (struct - let name = "StmtWaysIn" + let name = "Stmts_graphs.StmtWaysIn" let size = 142 let dependencies = [ StmtStmts.self ] end) diff --git a/src/kernel_services/analysis/stmts_graph.mli b/src/kernel_services/analysis/stmts_graph.mli index 0d2e5af1916d5064e50ff12f470b65845bffbfe6..53970ef8329e3cf613a58bfd3ba53bd22fb40188 100644 --- a/src/kernel_services/analysis/stmts_graph.mli +++ b/src/kernel_services/analysis/stmts_graph.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/undefined_sequence.ml b/src/kernel_services/analysis/undefined_sequence.ml new file mode 100644 index 0000000000000000000000000000000000000000..1f6e45adf173ecd7f2d0d4e564bbbce4976bf7d3 --- /dev/null +++ b/src/kernel_services/analysis/undefined_sequence.ml @@ -0,0 +1,148 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types + +(* Print a warning message when an undefined behavior may occurs in an + unspecified sequence, i.e. two writes or a write and a read. See full + doc in .mli. *) +let check_sequences file = + (* checks whether offsets starting from the same base might overlap *) + let rec may_overlap_offset offs1 offs2 = + match offs1, offs2 with + | NoOffset,_ | _, NoOffset -> true + | Field (f1,offs1), Field(f2,offs2) -> + (* it's probably a bit overkill to check if any of the field is in + an union, as the types of offs1 and offs2 are very probably + identical, but I don't have a Coq proof of that fact at the moment. *) + (not f1.fcomp.cstruct || not f2.fcomp.cstruct) || + (f1.fname = f2.fname && + f1.fcomp.ckey = f2.fcomp.ckey && + may_overlap_offset offs1 offs2) + | Index(i1,offs1), Index(i2,offs2) -> + (match Cil.constFoldToInt i1, Cil.constFoldToInt i2 with + | Some c1, Some c2 -> + Integer.equal c1 c2 && + may_overlap_offset offs1 offs2 + | None, _ | _, None -> + may_overlap_offset offs1 offs2 + ) + | (Index _|Field _), (Index _|Field _) -> + (* A bit strange, but we're not immune against some ugly cast. + Let's play safe here. *) + true + in + (* checks whether two lval may overlap *) + let may_overlap_lval (base1,offs1)(base2,offs2) = + match (base1,offs1), (base2,offs2) with + | (Mem _,_),(Mem _,_) -> true + | (Var v,_),(Mem _,_) | (Mem _,_), (Var v,_)-> + v.vaddrof (* if the address of v is not taken, + it cannot be aliased*) + | (Var v1,offs1),(Var v2,offs2) -> + v1.vid = v2.vid && may_overlap_offset offs1 offs2 + in + (* checks whether some element of the first list may overlap with some + element of the second one. *) + let may_overlap l1 l2 = + Extlib.product_fold (fun f e1 e2 -> f || may_overlap_lval e1 e2) + false l1 l2 + in + let check_unspec = object + inherit Cil.nopCilVisitor + method! vstmt s = + (match s.skind with + | UnspecifiedSequence [] | UnspecifiedSequence [ _ ] -> () + | UnspecifiedSequence seq -> + (* We have more than one side-effect in an unspecified sequence. + For each statement, we check whether its side effects may overlap + with the others, or with the reads. *) + let my_stmt_print = object(self) + inherit Cil_printer.extensible_printer () as super + method! stmt fmt = function + | {skind = UnspecifiedSequence seq } -> + Pretty_utils.pp_list ~sep:"@\n" + (fun fmt (s,m,w,r,_) -> + Format.fprintf fmt + "/*@ %t%a@ <-@ %a@ */@\n%a" + (fun fmt -> if (Kernel.debug_atleast 2) then + Pretty_utils.pp_list + ~pre:"@[(" + ~suf:")@]" + ~sep:"@ " + self#lval fmt m) + (Pretty_utils.pp_list ~sep:"@ " self#lval) w + (Pretty_utils.pp_list ~sep:"@ " self#lval) r + self#stmt s) + fmt + seq + | s -> super#stmt fmt s + end in + (* when checking for overlaps, we do not consider temporaries + introduced by the normalization. In other words, + we assume that the normalization itself is correct. *) + let remove_mod m l = + List.filter + (fun x -> not (List.exists (Cil_datatype.Lval.equal x) m)) l + in + (* l1 contains two lists: the first one is the temporaries we + do not want to consider, the second one are locations that + are read by a given statement. l2 contains locations that are + written by another statement. *) + let may_overlap_modified l1 l2 = + List.fold_left + (fun flag (m,r) -> flag || may_overlap (remove_mod m l2) r) + false l1 + in + let warn,_,_ = + List.fold_left + (fun ((warn,writes,reads) as res) (_,m,w,r,_) -> + (* the accumulator contains the lists of written + and read locations from the previous statements. + We check for overlapping between the following pairs: + - w vs writes + - r vs writes (modulo temporaries m as explained above). + - reads vs w (id. ) + As soon as we have identified a potential overlap, we + output the whole unspecified sequence. + *) + if warn then res else begin + let new_writes = w @ writes in + let new_reads = (m,r)::reads in + let new_warn = + warn || may_overlap writes w || + may_overlap (remove_mod m writes) r || + may_overlap_modified reads w + in + new_warn,new_writes,new_reads + end) + (false, [], []) seq + in + if warn then + Kernel.warning ~current:true ~once:true + "Unspecified sequence with side effect:@\n%a@\n" + (my_stmt_print#without_annot my_stmt_print#stmt) s + | _ -> ()); + Cil.DoChildren + end + in + Cil.visitCilFileSameGlobals check_unspec file diff --git a/src/plugins/value/legacy/eval_behaviors.mli b/src/kernel_services/analysis/undefined_sequence.mli similarity index 75% rename from src/plugins/value/legacy/eval_behaviors.mli rename to src/kernel_services/analysis/undefined_sequence.mli index 59180a0f8fa22d365ad718e07a8d04c9592996b5..03fa7e9f974dc36ddf6c0659392bf0fa5b5a318d 100644 --- a/src/plugins/value/legacy/eval_behaviors.mli +++ b/src/kernel_services/analysis/undefined_sequence.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,14 +20,11 @@ (* *) (**************************************************************************) -(** Evaluation of functions using their specification *) - -(** Evaluate [kf] in state [with_formals], first by reducing by the - preconditions, then by evaluating the assigns, then by reducing - by the post-conditions. *) -val compute_using_specification: - Kernel_function.t -> - Cil_types.funspec -> - call_kinstr:Cil_types.kinstr -> - with_formals:Cvalue.Model.t -> - Value_types.call_result +(* Print a warning message when an undefined behavior may occurs in an + unspecified sequence, i.e. two writes or a write and a read (not used + for determining the value to write, Cf. C99 6.5§2). We compute an + over-approximation here but under the assumption that + it is not possible to access two distinct fields by overflowing + an index, i.e. s.f[i] is always distinct from s.g[j] +*) +val check_sequences: Cil_types.file -> unit diff --git a/src/kernel_services/analysis/wto_statement.ml b/src/kernel_services/analysis/wto_statement.ml index bf427da9e7139406a61e804dfb2000f8e448591b..cbe45d589bf5d87fbb7353a2b3608ff7e07b2e7c 100644 --- a/src/kernel_services/analysis/wto_statement.ml +++ b/src/kernel_services/analysis/wto_statement.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/analysis/wto_statement.mli b/src/kernel_services/analysis/wto_statement.mli index 18abbb73b04f6aa1c06211d77927a005f96f32b7..3750a29b7625d65bbc6fa8bc93ea16ccd2c1952d 100644 --- a/src/kernel_services/analysis/wto_statement.mli +++ b/src/kernel_services/analysis/wto_statement.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/alarms.ml b/src/kernel_services/ast_data/alarms.ml index 16c3e1322617aa3dcc5df25083bcc65ff1b67f0b..2e2ee6678e889159e93dc9ccc652212a48ce7982 100644 --- a/src/kernel_services/ast_data/alarms.ml +++ b/src/kernel_services/ast_data/alarms.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/alarms.mli b/src/kernel_services/ast_data/alarms.mli index d201c618c12a7869faf82f9a69ebd3264c003825..8f9dc211aaa58b3ed1e6534a2d2f3f5f963b2b52 100644 --- a/src/kernel_services/ast_data/alarms.mli +++ b/src/kernel_services/ast_data/alarms.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/annotations.ml b/src/kernel_services/ast_data/annotations.ml index 78f1c02e4fe0eaa8ce73da33d143d9338a00c8f9..7417e10ed73d516bdb081375cf6f2e67976a4e24 100644 --- a/src/kernel_services/ast_data/annotations.ml +++ b/src/kernel_services/ast_data/annotations.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -1327,13 +1327,13 @@ let insert_global_in_ast annot = | GEnumTag _ | GEnumTagDecl _ as g) :: l -> insert_after deps (g :: acc) l | g :: l -> - let c_vars, logic_vars as deps = - remove_declared_global c_vars logic_vars g - in if Cil_datatype.Varinfo.Set.is_empty c_vars && Cil_datatype.Logic_info.Set.is_empty logic_vars - then List.rev acc @ g :: glob :: l - else insert_after deps (g :: acc) l + then List.rev acc @ glob :: g :: l + else begin + let deps = remove_declared_global c_vars logic_vars g in + insert_after deps (g :: acc) l + end in let globs = insert_after deps [] file.globals in file.globals <- globs diff --git a/src/kernel_services/ast_data/annotations.mli b/src/kernel_services/ast_data/annotations.mli index 2702f47caaf4b084e7a58efa69f0076f2ae242a3..fe6cea6345f3cd88635a6f3e2f2f7ee7a227df38 100644 --- a/src/kernel_services/ast_data/annotations.mli +++ b/src/kernel_services/ast_data/annotations.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -74,7 +74,7 @@ val behaviors: @raise No_funspec whenever the given function has no specification *) val decreases: - ?emitter:Emitter.t -> ?populate:bool -> kernel_function -> term variant option + ?emitter:Emitter.t -> ?populate:bool -> kernel_function -> variant option (** If any, get the decrease clause of the contract associated to the given function. Meaning of [emitter] and [populate] is similar to {!funspec}. @raise No_funspec whenever the given function has no specification *) @@ -181,24 +181,24 @@ val fold_ensures: (** Fold on the ensures of the corresponding behavior. *) val iter_assigns: - (Emitter.t -> identified_term assigns -> unit) -> + (Emitter.t -> assigns -> unit) -> kernel_function -> string -> unit (** Iter on the assigns of the corresponding behavior. @since Fluorine-20130401 *) val fold_assigns: - (Emitter.t -> identified_term assigns -> 'a -> 'a) -> + (Emitter.t -> assigns -> 'a -> 'a) -> kernel_function -> string -> 'a -> 'a (** Fold on the assigns of the corresponding behavior. *) val iter_allocates: - (Emitter.t -> identified_term allocation -> unit) -> + (Emitter.t -> allocation -> unit) -> kernel_function -> string -> unit (** Iter on the allocates of the corresponding behavior. @since Fluorine-20130401 *) val fold_allocates: - (Emitter.t -> identified_term allocation -> 'a -> 'a) -> + (Emitter.t -> allocation -> 'a -> 'a) -> kernel_function -> string -> 'a -> 'a (** Fold on the allocates of the corresponding behavior. *) @@ -248,12 +248,12 @@ val fold_terminates: (** apply f to the terminates predicate if any. *) val iter_decreases: - (Emitter.t -> term variant -> unit) -> kernel_function -> unit + (Emitter.t -> variant -> unit) -> kernel_function -> unit (** apply f to the decreases term if any. @since Fluorine-20130401 *) val fold_decreases: - (Emitter.t -> term variant -> 'a -> 'a) -> kernel_function -> 'a -> 'a + (Emitter.t -> variant -> 'a -> 'a) -> kernel_function -> 'a -> 'a (** apply f to the decreases term if any. *) (**************************************************************************) @@ -319,7 +319,7 @@ val add_behaviors: @modify Aluminium-20160501 restructuration of annotations management *) -val add_decreases: Emitter.t -> kernel_function -> term variant -> unit +val add_decreases: Emitter.t -> kernel_function -> variant -> unit (** Add a decrease clause into the contract of the given function. No decrease clause must previously be attached to this function. @@ -378,7 +378,7 @@ val add_ensures: *) val add_assigns: - keep_empty:bool -> identified_term assigns behavior_component_addition + keep_empty:bool -> assigns behavior_component_addition (** Add new assigns into the given behavior. If [keep_empty] is [true] and the assigns clause were empty, then @@ -389,7 +389,7 @@ val add_assigns: @modify Aluminium-20160501 restructuration of annotations management *) -val add_allocates: identified_term allocation behavior_component_addition +val add_allocates: allocation behavior_component_addition (** Add new allocates into the given behavior. *) val add_extended: acsl_extension behavior_component_addition @@ -469,12 +469,12 @@ val remove_ensures: by the given emitter. *) val remove_allocates: - Emitter.t -> kernel_function -> identified_term allocation -> unit + Emitter.t -> kernel_function -> allocation -> unit (** Remove the corresponding allocation clause. Do nothing if the clause does not exist or was not emitted by the given emitter. *) val remove_assigns: - Emitter.t -> kernel_function -> identified_term assigns -> unit + Emitter.t -> kernel_function -> assigns -> unit (** Remove the corresponding assigns clause. Do nothing if the clause does not exist or was not emitted by the given emitter. *) diff --git a/src/kernel_services/ast_data/ast.ml b/src/kernel_services/ast_data/ast.ml index 43f745b8a907557d02bd9e42c4a11ff537e804b5..0e76a07802c3435bfea3b3bf778ef3c040d35b8a 100644 --- a/src/kernel_services/ast_data/ast.ml +++ b/src/kernel_services/ast_data/ast.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/ast.mli b/src/kernel_services/ast_data/ast.mli index 7c5bc55b42d55045cea1823cffde3bf4f12a7e3c..fe08b7b0273d70f48a9a1701269e28f22847fb3c 100644 --- a/src/kernel_services/ast_data/ast.mli +++ b/src/kernel_services/ast_data/ast.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/cil_types.mli b/src/kernel_services/ast_data/cil_types.mli index c2584a3bbc29ef03bdd99e618ae166259a45a29d..f3d01687d31b93e72db1ca3efb8e3a4741cf35de 100644 --- a/src/kernel_services/ast_data/cil_types.mli +++ b/src/kernel_services/ast_data/cil_types.mli @@ -296,10 +296,22 @@ and attributes = attribute list and attrparam = | AInt of Integer.t (** An integer constant *) | AStr of string (** A string constant *) - | ACons of string * attrparam list + | ACons of string * attrparam list (** Constructed attributes. These are printed [foo(a1,a2,...,an)]. The list of parameters can be empty and in that case the parentheses are not - printed. *) + printed. + + There are some Frama-C builtins that are used to account for OSX's + peculiarities: + - __fc_assign takes two arguments and emulate [a1=a2] syntax + - __fc_float takes one string argument and indicates a floating point + constant, that will be printed as such. + See https://clang.llvm.org/docs/AttributeReference.html#availability + for more information. Proper attributes node might be added if really + needed, i.e. if some plug-in wants to interpret the availability + attribute. + *) + | ASizeOf of typ (** A way to talk about types *) | ASizeOfE of attrparam | AAlignOf of typ @@ -540,9 +552,13 @@ and varinfo = { (** True if this is a global variable*) mutable vdefined: bool; - (** True if the variable or function is defined in the file. Only relevant - for functions and global variables. Not used in particular for local - variables and logic variables. *) + (** + - For global variables, true iff the variable or function + is defined in the file. + - For local variables, true iff the variable is explicitly initialized + at declaration time. + - Unused for formals variables and logic variables. + *) mutable vformal: bool; (** True if the variable is a formal parameter of a function. *) @@ -898,6 +914,26 @@ and init = define it as a mutable field *) and initinfo = { mutable init : init option } +(** kind of constructor for initializing a local variable through a function + call. + @since Phosphorus-20170501-beta1. *) + +and constructor_kind = + | Plain_func (** plain function call, whose result is used for initializing + the variable. *) + | Constructor (** C++-like constructor: the function takes as first argument + the address of the variable to be initialized, and + returns [void]. *) + +(** Initializers for local variables. + @since Phosphorus-20170501-beta1 +*) +and local_init = + | AssignInit of init (** normal initialization *) + | ConsInit of varinfo * exp list * constructor_kind + (** [ConsInit(f,args,kind)] indicates that the corresponding + local is initialized via a call to [f], of kind [kind] + with the given [args]. *) (* ************************************************************************* *) (** {2 Function definitions} *) (* ************************************************************************* *) @@ -918,7 +954,7 @@ and initinfo = { mutable init : init option } (** Function definitions. @plugin development guide *) -and fundec = { +and fundec = { mutable svar: varinfo; (** Holds the name and type as a variable, so we can refer to it easily from the program. All references to this function either in a function @@ -930,7 +966,7 @@ and fundec = { {!Cil.setFormals} or {!Cil.setFunctionType} to set these formals and ensure that they are reflected in the function type. Do not make copies of these because the body refers to them. *) - + mutable slocals: varinfo list; (** Locals. Does NOT include the sformals. Do not make copies of these because the body refers to them. *) @@ -948,7 +984,7 @@ and fundec = { computed it. range = 0 ... (smaxstmtid-1). This is computed by {!Cfg.computeCFGInfo}. *) - mutable sallstmts: stmt list; + mutable sallstmts: stmt list; (** After you call {!Cfg.computeCFGInfo} this field is set to contain all statements in the function. *) @@ -956,11 +992,23 @@ and fundec = { } (** A block is a sequence of statements with the control falling through from - one element to the next *) -and block = { + one element to the next. In addition, blocks are used to determine the scope + of variables, through the blocals field. Variables in [blocals] that have + their [vdefined] field set to [true] must appear as the target of a + [Local_init] instruction directly in the [bstmts], with two exceptions: the + [Local_init] instruction can be part of an [UnspecifiedSequence], or of + a block that has [bscoping] set to [false]. Such block _must not_ + itself have local variables: it denotes a simple list of statements grouped + together (e.g. to stay in scope of an annotation extending to the + whole list). +*) +and block = { mutable battrs: attributes; (** Attributes for the block *) - mutable blocals: varinfo list; + mutable bscoping: bool; + (** Whether the block is used to determine the scope of local variables. *) + + mutable blocals: varinfo list; (** variables that are local to the block. It is a subset of the slocals of the enclosing function. *) @@ -1184,6 +1232,14 @@ and instr = If the type of the result variable is not the same as the declared type of the function result then an implicit cast exists. *) + | Local_init of varinfo * local_init * location + (** initialization of a local variable. The corresponding varinfo must + belong to the [blocals] list of the innermost enclosing block that does + not have attribute {!Cil.block_no_scope_attr}. Such blocks are purely + here for grouping statements and do not play a role for scoping + variables. See {!Cil_types.block} definition for more information + @since Phosphorus-20170501-beta1 + *) (* See the GCC specification for the meaning of ASM. If the source is MS VC then only the templates @@ -1207,7 +1263,6 @@ and instr = | Code_annot of code_annotation * location - (** GNU extended-asm information: - a list of outputs, each of which is an lvalue with optional names and constraints. @@ -1270,8 +1325,18 @@ and identified_term = { (** logic label referring to a particular program point. *) and logic_label = | StmtLabel of stmt ref (** label of a C statement. *) - | LogicLabel of (stmt option * string) (* [JS 2011/05/13] why a tuple here? *) -(** builtin logic label ({t Here, Pre}, ...) *) + | FormalLabel of string (** label of global annotation. *) + | BuiltinLabel of stmt option * logic_builtin_label + +(** builtin logic labels defined in ACSL. *) +and logic_builtin_label = + | Here + | Old + | Pre + | Post + | LoopEntry + | LoopCurrent + | Init (* ************************************************************************* *) (** {2 Terms} *) @@ -1309,7 +1374,7 @@ and term_node = | TStartOf of term_lval (** beginning of an array. *) (* additional constructs *) - | Tapp of logic_info * (logic_label * logic_label) list * term list + | Tapp of logic_info * logic_label list * term list (** application of a logic function. *) | Tlambda of quantifiers * term (** lambda abstraction. *) | TDataCons of logic_ctor_info * term list @@ -1362,7 +1427,7 @@ and model_info = { mi_decl: location; (** where the field has been declared. *) mutable mi_attr: attributes; (** attributes tied to the field. - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) } (** offset of an lvalue. *) @@ -1417,7 +1482,7 @@ and logic_type_info = { (** definition of the type. None for abstract types. *) mutable lt_attr: attributes; (** attributes associated to the logic type. - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) } (* will be expanded when dealing with concrete types *) @@ -1446,7 +1511,7 @@ and logic_var = { variable. *) mutable lv_attr: attributes (** attributes tied to the logic variable - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) } (** Description of a constructor of a logic sum-type. @@ -1479,7 +1544,7 @@ and relation = and predicate_node = | Pfalse (** always-false predicate. *) | Ptrue (** always-true predicate. *) - | Papp of logic_info * (logic_label * logic_label) list * term list + | Papp of logic_info * logic_label list * term list (** application of a predicate. *) | Pseparated of term list | Prel of relation * term * term (** comparison of two terms. *) @@ -1524,28 +1589,27 @@ and predicate = { pred_content : predicate_node;(** content *) } -(* Polymorphic types shared with parsed trees (Logic_ptree) *) -(** variant of a loop or a recursive function. Type shared with Logic_ptree. *) -and 'term variant = 'term * string option +(** variant of a loop or a recursive function. *) +and variant = term * string option (** allocates and frees. @since Oxygen-20120901 *) -and 'locs allocation = - | FreeAlloc of 'locs list * 'locs list (** tsets. Empty list means \nothing. *) +and allocation = + | FreeAlloc of identified_term list * identified_term list (** tsets. Empty list means \nothing. *) | FreeAllocAny (** Nothing specified. Semantics depends on where it is written. *) -(** dependencies of an assigned location. Shared with Logic_ptree. *) -and 'locs deps = - | From of 'locs list (** tsets. Empty list means \nothing. *) +(** dependencies of an assigned location. *) +and deps = + | From of identified_term list (** tsets. Empty list means \nothing. *) | FromAny (** Nothing specified. Any location can be involved. *) -and 'locs from = ('locs * 'locs deps) +and from = identified_term * deps -(** zone assigned with its dependencies. Type shared with Logic_ptree. *) -and 'locs assigns = +(** zone assigned with its dependencies. *) +and assigns = | WritesAny (** Nothing specified. Anything can be written. *) - | Writes of 'locs from list + | Writes of from list (** list of locations that can be written. Empty list means \nothing. *) (** Function or statement contract. This type shares the name of its @@ -1554,7 +1618,7 @@ and spec = { mutable spec_behavior : behavior list; (** behaviors *) - mutable spec_variant : term variant option; + mutable spec_variant : variant option; (** variant for recursive functions. *) mutable spec_terminates: identified_predicate option; @@ -1581,6 +1645,7 @@ and spec = { @plugin development guide *) and acsl_extension = string * acsl_extension_kind +(** @plugin development guide *) and acsl_extension_kind = | Ext_id of int (** id used internally by the extension itself. *) | Ext_terms of term list @@ -1592,44 +1657,46 @@ and acsl_extension_kind = @since Oxygen-20120901 [b_allocation] has been added. @since Carbon-20101201 [b_requires] has been added. @modify Boron-20100401 [b_ensures] is replaced by [b_post_cond]. - Old [b_ensures] represent the [Normal] case of [b_post_cond]. *) + Old [b_ensures] represent the [Normal] case of [b_post_cond]. + *) and behavior = { mutable b_name : string; (** name of the behavior. *) mutable b_requires : identified_predicate list; (** require clauses. *) mutable b_assumes : identified_predicate list; (** assume clauses. *) mutable b_post_cond : (termination_kind * identified_predicate) list (** post-condition. *); - mutable b_assigns : identified_term assigns; (** assignments. *) - mutable b_allocation : identified_term allocation; (** frees, allocates. *) - mutable b_extended : acsl_extension list (** extensions *) + mutable b_assigns : assigns; (** assignments. *) + mutable b_allocation : allocation; (** frees, allocates. *) + mutable b_extended : acsl_extension list + (** extensions + @plugin development guide *) } (** kind of termination a post-condition applies to. See ACSL manual. *) and termination_kind = Normal | Exits | Breaks | Continues | Returns -(** Pragmas for the value analysis plugin of Frama-C. - Type shared with Logic_ptree.*) -and 'term loop_pragma = - | Unroll_specs of 'term list - | Widen_hints of 'term list - | Widen_variables of 'term list +(** Pragmas for the value analysis plugin of Frama-C. *) +and loop_pragma = + | Unroll_specs of term list + | Widen_hints of term list + | Widen_variables of term list -(** Pragmas for the slicing plugin of Frama-C. Type shared with Logic_ptree.*) -and 'term slice_pragma = - | SPexpr of 'term +(** Pragmas for the slicing plugin of Frama-C. *) +and slice_pragma = + | SPexpr of term | SPctrl | SPstmt -(** Pragmas for the impact plugin of Frama-C. Type shared with Logic_ptree.*) -and 'term impact_pragma = - | IPexpr of 'term +(** Pragmas for the impact plugin of Frama-C. *) +and impact_pragma = + | IPexpr of term | IPstmt -(** The various kinds of pragmas. Type shared with Logic_ptree. *) -and 'term pragma = - | Loop_pragma of 'term loop_pragma - | Slice_pragma of 'term slice_pragma - | Impact_pragma of 'term impact_pragma +(** The various kinds of pragmas. *) +and pragma = + | Loop_pragma of loop_pragma + | Slice_pragma of slice_pragma + | Impact_pragma of impact_pragma (** all annotations that can be found in the code. This type shares the name of its constructors with @@ -1648,21 +1715,21 @@ and code_annotation_node = this invariant applies. The boolean flag is true for normal loop invariants and false for invariant-as-assertions. *) - | AVariant of term variant + | AVariant of variant (** loop variant. Note that there can be at most one variant associated to a given statement *) - | AAssigns of string list * identified_term assigns + | AAssigns of string list * assigns (** loop assigns. (see [b_assigns] in the behaviors for other assigns). At most one clause associated to a given (statement, behavior) couple. *) - | AAllocation of string list * identified_term allocation + | AAllocation of string list * allocation (** loop allocation clause. (see [b_allocation] in the behaviors for other allocation clauses). At most one clause associated to a given (statement, behavior) couple. @since Oxygen-20120901 when [b_allocation] has been added. *) - | APragma of term pragma (** pragma. *) + | APragma of pragma (** pragma. *) | AExtended of string list * acsl_extension (** extension in a loop annotation. @since Silicon-20161101 *) diff --git a/src/kernel_services/ast_data/globals.ml b/src/kernel_services/ast_data/globals.ml index ce9e69ee92917d332aa4cc02653b4d895d56aa35..770d4d6d441da1f6f63a63a462c0047a35f22fe1 100644 --- a/src/kernel_services/ast_data/globals.ml +++ b/src/kernel_services/ast_data/globals.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -137,7 +137,7 @@ module Functions = struct Cil_state_builder.Varinfo_hashtbl (Cil_datatype.Kf) (struct - let name = "Functions" + let name = "Globals.Functions" let dependencies = [ Ast.self ] let size = 17 end) @@ -162,7 +162,7 @@ module Functions = struct module State = State_builder.Ref (Datatype.String.Map.Make(VarinfoAlphaOrderSet.Elts)) (struct - let name = "FunctionsOrder" + let name = "Globals.FunctionsOrder.Iterator" let dependencies = [ State.self ] let default () = Datatype.String.Map.empty end) @@ -426,14 +426,12 @@ end module FileIndex = struct - let name = "FileIndex" - module S = State_builder.Hashtbl (Datatype.String.Hashtbl) (Datatype.Pair(Datatype.String)(Datatype.List(Global))) (struct - let name = name + let name = "Globals.FileIndex" let dependencies = [ Ast.self ] let size = 7 end) @@ -450,7 +448,7 @@ module FileIndex = struct (S.memo ~change:(fun (f,l) -> f, glob:: l) (fun _ -> f,[ glob ]) f)) in - State_builder.apply_once "FileIndex.compute" [ S.self ] compute + State_builder.apply_once "Globals.FileIndex.compute" [ S.self ] compute let remove_global_annotations a = let f = (fst (Global_annotation.loc a)).Lexing.pos_fname in @@ -719,7 +717,7 @@ module Comments_global_cache = (Cil_datatype.Global.Hashtbl) (Datatype.List(Datatype.String)) (struct - let name = "Comments_global_cache" + let name = "Globals.Comments_global_cache" let dependencies = [ Cabshelper.Comments.self; FileIndex.self ] let size = 17 @@ -730,7 +728,7 @@ module Comments_stmt_cache = (Cil_datatype.Stmt.Hashtbl) (Datatype.List(Datatype.String)) (struct - let name = "Comments_stmt_cache" + let name = "Globals.Comments_stmt_cache" let dependencies = [ Cabshelper.Comments.self; FileIndex.self ] let size = 17 end) diff --git a/src/kernel_services/ast_data/globals.mli b/src/kernel_services/ast_data/globals.mli index 9fbb52626ea8abd7b0416172c6fa3bb9b89fae34..f4901a523315ed0e68a1f26f5a8bccc8095a891a 100644 --- a/src/kernel_services/ast_data/globals.mli +++ b/src/kernel_services/ast_data/globals.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/kernel_function.ml b/src/kernel_services/ast_data/kernel_function.ml index 34ca22c7aaead9793a5509a9d34057a91211624a..9623f74ab7dacd16315e93a0460293c7fae0a829 100644 --- a/src/kernel_services/ast_data/kernel_function.ml +++ b/src/kernel_services/ast_data/kernel_function.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,6 +23,8 @@ open Cil_types open Cil_datatype +let cat_blocks = Kernel.register_category "kf:blocks" + (* ************************************************************************* *) (** {2 Getters} *) (* ************************************************************************* *) @@ -71,7 +73,7 @@ module Kf = State_builder.Option_ref (Datatype.Int.Hashtbl.Make(Datatype.Triple(Kf)(Stmt)(Datatype.List(Block)))) (struct - let name = "KF" + let name = "Kernel_function.Kf" let dependencies = [ Ast.self ] end) @@ -124,20 +126,23 @@ let find_englobing_kf stmt = snd (find_from_sid stmt.sid) let blocks_closed_by_edge_aux s1 s2 = let table = compute () in try - let _,_,b1 = Datatype.Int.Hashtbl.find table s1.sid in - let _,_,b2 = Datatype.Int.Hashtbl.find table s2.sid in -(* Kernel.debug ~level:2 - "Blocks opened for stmt %a@\n%a@\nblocks opened for stmt %a@\n%a" - Printer.pp_stmt s1 - (Pretty_utils.pp_list ~sep:Pretty_utils.nl_sep Printer.pp_block) b1 - Printer.pp_stmt s2 - (Pretty_utils.pp_list ~sep:Pretty_utils.nl_sep Printer.pp_block) b2;*) - let rec aux acc = function - [] -> acc - | inner_block::others -> + let _,_,b1 = Datatype.Int.Hashtbl.find table s1.sid in + let _,_,b2 = Datatype.Int.Hashtbl.find table s2.sid in + let pp_block fmt b = + Pretty_utils.pp_list ~sep:"@\n" Cil_printer.pp_block fmt b + in + Kernel.debug ~dkey:cat_blocks + "Blocks opened for stmt %a@\n%a@\nblocks opened for stmt %a@\n%a" + Cil_printer.pp_stmt s1 pp_block b1 Cil_printer.pp_stmt s2 pp_block b2; + let rec aux acc = function + [] -> acc + | inner_block::others -> if List.memq inner_block b2 then acc else aux (inner_block::acc) others - in aux [] b1 + in + let res = aux [] b1 in + Kernel.debug ~dkey:cat_blocks "Result:@\n%a" pp_block res; + res with Not_found -> (* Invalid statement, or incorrectly filled table 'Kf' *) Kernel.fatal "Unknown statement sid:%d or sid:%d" s1.sid s2.sid @@ -307,7 +312,7 @@ module CallSites = Cil_datatype.Kf.Hashtbl module KfCallers = State_builder.Option_ref(CallSites.Make(Datatype.List(CallSite))) (struct - let name = "Kf.CallSites" + let name = "Kernel_function.KfCallers" let dependencies = [ Ast.self ] end) @@ -331,19 +336,15 @@ class callsite_visitor hmap = object (self) (* Inspect stmt calls *) method! vstmt stmt = + let add_call callee = + let sites = try CallSites.find hmap callee with Not_found -> [] in + CallSites.replace hmap callee ((self#kf,stmt)::sites) + in match stmt.skind with | Instr(Call(_,fct,_,_)) -> - begin - match called_kernel_function fct with - | None -> Cil.SkipChildren - | Some ckf -> - let sites = - try CallSites.find hmap ckf - with Not_found -> [] - in - CallSites.replace hmap ckf ((self#kf,stmt)::sites) ; - Cil.SkipChildren - end + Extlib.may add_call (called_kernel_function fct); Cil.SkipChildren + | Instr (Local_init (_, ConsInit(f,_,_),_)) -> + add_call (Globals.Functions.get f); Cil.SkipChildren | Instr _ -> Cil.SkipChildren | _ -> Cil.DoChildren diff --git a/src/kernel_services/ast_data/kernel_function.mli b/src/kernel_services/ast_data/kernel_function.mli index 052509798a0599474b72f094b5a6bbbec08b679b..8e60aad11b178356f3f6d06fd55029140317f260 100644 --- a/src/kernel_services/ast_data/kernel_function.mli +++ b/src/kernel_services/ast_data/kernel_function.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/property.ml b/src/kernel_services/ast_data/property.ml index 6d4f25e3bad671251ea28a6b1c7e8dc8e5796eb7..43e435b4d474cccc3aef19ec62d2f1b23f08978c 100644 --- a/src/kernel_services/ast_data/property.ml +++ b/src/kernel_services/ast_data/property.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -43,16 +43,16 @@ type identified_assigns = kernel_function * kinstr * behavior_or_loop - * identified_term from list + * from list type identified_from = kernel_function * kinstr * behavior_or_loop - * (identified_term from (* * identified_term list *) ) + * from type identified_decrease = - kernel_function * kinstr * code_annotation option * term variant + kernel_function * kinstr * code_annotation option * variant type identified_behavior = kernel_function * kinstr * Datatype.String.Set.t * funbehavior diff --git a/src/kernel_services/ast_data/property.mli b/src/kernel_services/ast_data/property.mli index 60f4a9daa59632fc0f39690b1a11d1bf76fbeebb..14f4a4dd205b4583e94928a6957b39c055ae080f 100644 --- a/src/kernel_services/ast_data/property.mli +++ b/src/kernel_services/ast_data/property.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -52,7 +52,7 @@ type behavior_or_loop = (* private *) type identified_code_annotation = kernel_function * stmt * code_annotation type identified_assigns = - kernel_function * kinstr * behavior_or_loop * identified_term from list + kernel_function * kinstr * behavior_or_loop * from list type identified_allocation = kernel_function * kinstr * behavior_or_loop * (identified_term list * identified_term list) @@ -61,10 +61,10 @@ type identified_from = kernel_function * kinstr * behavior_or_loop - * (identified_term from (* identified_term list *) ) + * from type identified_decrease = - kernel_function * kinstr * code_annotation option * term variant + kernel_function * kinstr * code_annotation option * variant (** code_annotation is None for decreases and [Some { AVariant }] for loop variant. *) @@ -196,7 +196,7 @@ val ip_ensures_of_behavior: @since Oxygen-20120901 *) val ip_of_allocation: kernel_function -> kinstr -> behavior_or_loop - -> identified_term allocation -> identified_property option + -> allocation -> identified_property option (** [ip_allocation_of_behavior kf ki active bhv] builds IPAllocation for behavior [bhv], in the spec in function [kf], at statement [ki], under @@ -212,7 +212,7 @@ val ip_allocation_of_behavior: @since Carbon-20110201 *) val ip_of_assigns: kernel_function -> kinstr -> - behavior_or_loop -> identified_term assigns -> identified_property option + behavior_or_loop -> assigns -> identified_property option (** [ip_assigns_of_behavior kf ki active bhv] builds IPAssigns for a contract (if not WritesAny). @@ -229,7 +229,7 @@ val ip_assigns_of_behavior: @modify Aluminium-20160501 returns an option. *) val ip_of_from: kernel_function -> kinstr -> - behavior_or_loop -> identified_term from -> identified_property option + behavior_or_loop -> from -> identified_property option (** [ip_from_of_behavior kf ki active bhv] builds IPFrom for a behavior (if not ReadsAny). @@ -329,7 +329,7 @@ val ip_terminates_of_spec: (** Builds IPDecrease @since Carbon-20110201 *) val ip_of_decreases: - kernel_function -> kinstr -> term variant -> identified_property + kernel_function -> kinstr -> variant -> identified_property (** Builds IPDecrease of a given spec. @since Carbon-20110201 *) diff --git a/src/kernel_services/ast_data/property_status.ml b/src/kernel_services/ast_data/property_status.ml index ab80d403a84962ad18becdbe827ebaafd7cd05e2..b7e996323d8cee4414506b49bca2191dd3286c00 100644 --- a/src/kernel_services/ast_data/property_status.ml +++ b/src/kernel_services/ast_data/property_status.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -164,7 +164,7 @@ module Status = end) (Emitted_status) (struct - let name = "Property_status" + let name = "Property_status.Status" let dependencies = [ Ast.self ] let kinds = [ Emitter.Property_status ] let size = 97 @@ -845,7 +845,7 @@ Check your axiomatics and implicit hypotheses." (Property.Hashtbl) (D) (struct - let name = "Consolidated_status" + let name = "Property_status.Consolidated_status" let dependencies = [ Status.self ] let size = 97 end) @@ -1401,7 +1401,7 @@ module Consolidation_graph = struct (Datatype.Make (struct type t = G.t - let name = "consolidation graph" + let name = "Property_status.Graph_by_property" let reprs = [ G.empty ] include Datatype.Serializable_undefined end)) diff --git a/src/kernel_services/ast_data/property_status.mli b/src/kernel_services/ast_data/property_status.mli index 8e8bb08ea3f7e4c530537840bdb4593cc53ac63a..20914042c55857b2f4539804ec10a5e3437f9493 100644 --- a/src/kernel_services/ast_data/property_status.mli +++ b/src/kernel_services/ast_data/property_status.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_data/statuses_by_call.ml b/src/kernel_services/ast_data/statuses_by_call.ml index 72b37f0fc9fb1a955ae9688472446d8fa760dac3..b8ae38c78b384388624fa91751fcf82d643a8ee0 100644 --- a/src/kernel_services/ast_data/statuses_by_call.ml +++ b/src/kernel_services/ast_data/statuses_by_call.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -63,7 +63,8 @@ let add_called_function stmt kf = let all_functions_with_preconditions stmt = match stmt with - | { skind=Instr (Call(_,{enode = Lval (Var vkf, NoOffset)},_,_)) } -> + | { skind=Instr (Call(_,{enode = Lval (Var vkf, NoOffset)},_,_) + |Local_init(_,ConsInit(vkf,_,_),_)) } -> let kf = Globals.Functions.get vkf in Kernel_function.Hptset.singleton kf | _ -> @@ -102,6 +103,9 @@ let rec precondition_at_call kf pid stmt = add_called_function stmt kf; add_call_precondition pid p ) + | Instr (Local_init(_, ConsInit(vkf,_,_),_)) -> + assert + (Cil_datatype.Varinfo.equal vkf (Kernel_function.get_vi kf)) | _ -> assert false (* meaningless on a non-call statement *) ); p diff --git a/src/kernel_services/ast_data/statuses_by_call.mli b/src/kernel_services/ast_data/statuses_by_call.mli index 443261b359a86957b8c335134cb9010b6683ff36..f16fc2fa62dc1312ebca343ebe39fc4cf2427b2c 100644 --- a/src/kernel_services/ast_data/statuses_by_call.mli +++ b/src/kernel_services/ast_data/statuses_by_call.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/cabs_debug.ml b/src/kernel_services/ast_printing/cabs_debug.ml index 11dc8e8ccb5e5c210f077dbbdf0f230de852e284..452ac07a0dce74417759dae0c24c95e50938b1a3 100644 --- a/src/kernel_services/ast_printing/cabs_debug.ml +++ b/src/kernel_services/ast_printing/cabs_debug.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/cabs_debug.mli b/src/kernel_services/ast_printing/cabs_debug.mli index 9fc2b9c927fc7239f139a2d60a79e41e3b3c289f..4c77b73df3bb766aff1d95b6050b448753336717 100644 --- a/src/kernel_services/ast_printing/cabs_debug.mli +++ b/src/kernel_services/ast_printing/cabs_debug.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/cil_descriptive_printer.ml b/src/kernel_services/ast_printing/cil_descriptive_printer.ml index b421ce1b88ba57649a5fe1f1689cd55a0617659f..6312c86083be198c3519820b349cec40e3ab80e6 100644 --- a/src/kernel_services/ast_printing/cil_descriptive_printer.ml +++ b/src/kernel_services/ast_printing/cil_descriptive_printer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/cil_descriptive_printer.mli b/src/kernel_services/ast_printing/cil_descriptive_printer.mli index 8f8941a3b0119491128b05993c31afbff347120d..7ff0cce42dc7a381b731e318eb2fa57257a76977 100644 --- a/src/kernel_services/ast_printing/cil_descriptive_printer.mli +++ b/src/kernel_services/ast_printing/cil_descriptive_printer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/cil_printer.ml b/src/kernel_services/ast_printing/cil_printer.ml index 2b9d94d4d776ddacbdcaf46e8dc1c453aafcaaf6..e8e7c3b2465fff1f006c1d520987ddce002643bf 100644 --- a/src/kernel_services/ast_printing/cil_printer.ml +++ b/src/kernel_services/ast_printing/cil_printer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -32,6 +32,7 @@ let debug_logic_coercions = Kernel.register_category "printer:logic-coercions" let debug_builtins = Kernel.register_category "printer:builtins" let debug_sid = Kernel.register_category "printer:sid" let debug_unspecified = Kernel.register_category "printer:unspecified" +let debug_bitfields = Kernel.register_category "printer:bitfields" module Behavior_extensions = struct @@ -63,6 +64,12 @@ let register_behavior_extension = Behavior_extensions.register let reserved_attributes = ref [] let register_shallow_attribute s = reserved_attributes:=s::!reserved_attributes +let keep_attr = function + | Attr (s,_) -> not (List.mem s !reserved_attributes) + | AttrAnnot _ -> true + +let filter_printing_attributes l = List.filter keep_attr l + let needs_quote = let regex = Str.regexp "^[A-Za-z0-9_]+$" in fun s -> not (Str.string_match regex s 0) @@ -74,8 +81,7 @@ let print_as_source source = || not (Str.string_match (Str.regexp "^-?[0-9]+$") source 0)) let print_global g = - (* This function decides whether to hide Frama-C's own builtins (in - fc_builtin_for_normalization). *) + (* This function decides whether to hide functions in Frama-C's libc. *) let attrs = Cil_datatype.Global.attr g in let printable = not (Cil.hasAttribute "fc_stdlib" attrs) || Kernel.PrintLibc.get() @@ -282,6 +288,8 @@ module Precedence = struct (* Create an expression of the same shape, and use {!getParenthLevel} *) let getParenthLevelAttrParam = function + | ACons ("__fc_assign", [_;_]) -> upperLevel + | ACons ("__fc_float", [_]) -> 0 | AInt _ | AStr _ | ACons _ -> 0 | ASizeOf _ | ASizeOfE _ -> 20 | AAlignOf _ | AAlignOfE _ -> 20 @@ -392,6 +400,9 @@ let extract_acsl_list t = in aux [] t +let is_cfg_block = + function Stmt_block _ -> false | Then_with_else | Other | Body -> true + class cil_printer () = object (self) val mutable logic_printer_enabled = true @@ -458,6 +469,8 @@ class cil_printer () = object (self) val mutable has_annot = false method private has_annot = has_annot && logic_printer_enabled + method private stmt_has_annot _ = false + method private push_stmt s = Stack.push s current_stmt method private pop_stmt s = ignore (Stack.pop current_stmt); @@ -596,6 +609,7 @@ class cil_printer () = object (self) let non_decay = parent_non_decay in parent_non_decay <- false; let level = Precedence.getParenthLevel e in + (* fprintf fmt "/* eid:%d */" e.eid; *) match (Cil.stripInfo e).enode with | Info _ -> assert false | Const(c) -> self#constant fmt c @@ -747,6 +761,26 @@ class cil_printer () = object (self) method instr fmt (i:instr) = (* imperative instruction *) fprintf fmt "%a" (self#line_directive ~forcefile:false) (Cil_datatype.Instr.loc i); + let pp_call dest e fmt args = + (match dest with + | None -> () + | Some lv -> + fprintf fmt "%a = " self#lval lv; + (* Maybe we need to print a cast *) + (let destt = Cil.typeOfLval lv in + match Cil.unrollType (Cil.typeOf e) with + | TFun(rt, _, _, _) when (Cil.need_cast rt destt) -> + fprintf fmt "(%a)" (self#typ None) destt + | _ -> ())); + (* Now the function name *) + (match e.enode with + | Lval(Var _, _) -> self#exp fmt e + | _ -> fprintf fmt "(%a)" self#exp e); + (* Now the arguments *) + Pretty_utils.pp_flowlist ~left:"(" ~sep:"," ~right:")" self#exp fmt args; + (* Now the terminator *) + fprintf fmt "%s" instr_terminator + in match i with | Skip _ -> fprintf fmt ";" | Set(lv,e,_) -> begin @@ -794,6 +828,16 @@ class cil_printer () = object (self) instr_terminator end + | Local_init(vi, AssignInit i, _) -> + Format.fprintf fmt "@[<2>%a =@ %a%s@]" + self#vdecl vi self#init i instr_terminator + | Local_init(vi, ConsInit(f, args, Constructor), _) -> + let args = Cil.mkAddrOfVi vi :: args in + Format.fprintf fmt "@[<2>%a%s@]@\n" self#vdecl vi instr_terminator; + pp_call None (Cil.evar f) fmt args + | Local_init(vi, ConsInit(f, args, Plain_func), _) -> + Format.fprintf fmt "@[<2>%a =@ %a@]" self#vdecl vi + (pp_call None (Cil.evar f)) args; (* In cabs2cil we have turned the call to builtin_va_arg into a three-argument call: the last argument is the address of the destination *) @@ -861,25 +905,7 @@ class cil_printer () = object (self) "__builtin_types_compatible_p: cabs2cil should have added sizeof to \ the arguments." - | Call(dest,e,args,_) -> - (match dest with - | None -> () - | Some lv -> - fprintf fmt "%a = " self#lval lv; - (* Maybe we need to print a cast *) - (let destt = Cil.typeOfLval lv in - match Cil.unrollType (Cil.typeOf e) with - | TFun(rt, _, _, _) when (Cil.need_cast rt destt) -> - fprintf fmt "(%a)" (self#typ None) destt - | _ -> ())); - (* Now the function name *) - (match e.enode with - | Lval(Var _, _) -> self#exp fmt e - | _ -> fprintf fmt "(%a)" self#exp e); - (* Now the arguments *) - Pretty_utils.pp_flowlist ~left:"(" ~sep:"," ~right:")" self#exp fmt args; - (* Now the terminator *) - fprintf fmt "%s" instr_terminator + | Call(dest,e,args,_) -> pp_call dest e fmt args | Asm(attrs, tmpls, ext_asm, l) -> self#line_directive fmt l; @@ -982,7 +1008,8 @@ class cil_printer () = object (self) method stmt_labels fmt (s:stmt) = if s.labels <> [] then - Pretty_utils.pp_list ~sep:"@ " ~suf:"@]@ " self#label fmt s.labels + Pretty_utils.pp_list + ~pre:"@[<hov>" ~sep:"@ " ~suf:"@]@ " self#label fmt s.labels method label fmt = function | Label (s, _, b) when b || not verbose -> fprintf fmt "@[%s:@]" s @@ -995,9 +1022,8 @@ class cil_printer () = object (self) method private display_comment () = not is_ghost || verbose method annotated_stmt (next: stmt) fmt (s: stmt) = - pp_open_hvbox fmt 2; - self#stmt_labels fmt s; pp_open_hvbox fmt 0; + self#stmt_labels fmt s; (* print the statement. *) if Cil.is_skip s.skind && not s.ghost then begin if verbose || s.labels <> [] then fprintf fmt ";" @@ -1015,44 +1041,61 @@ class cil_printer () = object (self) self#pp_close_annotation fmt end end; - pp_close_box fmt (); pp_close_box fmt () - method private require_braces ?(has_annot=self#has_annot) blk = + method private require_braces ctxt blk = force_brace || verbose || Kernel.is_debug_key_enabled debug_sid (* If one the of condition above is true, /* sid:... */ will be printed on its own line before s. Braces are needed *) + || ctxt = Body (* function body is always between braces. *) || - match blk.bstmts, blk.battrs, blk.blocals with - | _ :: _ :: _, _, _ | _, _, _ :: _ | _, _ :: _, _ -> true - | [ { skind = Block b } ], _, _ -> has_annot || self#require_braces b - | _, _, _ -> has_annot - - method private has_multiple_stmts b = - match b.bstmts with - | [] -> false - | [ { skind = Block blk } as s ] -> - (* checks whether we will inline the block. This requires a little - dance, as it depends on whether we have a code_annot attached to - it, the detection of which in turn depends on whether we are printing - a pure AST or a an AST whose annotations are in external tables... *) - self#push_stmt s; - let res = self#require_braces blk in - self#pop_stmt (); - if res then self#has_multiple_stmts blk else false - | [ _ ] -> false - | _ -> true - - method private inline_block ?has_annot blk = match blk.bstmts with + (let attrs = filter_printing_attributes blk.battrs in + match blk.bstmts, attrs, blk.blocals, ctxt with + | _, _, _ :: _,_ | _, _ :: _, _, _ -> true + | _::_::_,[],[],Stmt_block s -> + not (Cil.has_extern_local_init blk) && self#stmt_has_annot s + (* Do not put braces around a Local_init statement if we are not + in the appropriate block. This trumps the presence of a binding + annotation, in case of something like: + { /* start of scoping block */ + //@ slicing pragma stmt; + /* { */ /* start of non-scoping block + int x = 42; + x++; + ... + /* } */ /* end of non-scoping block + x++; + } /* end of scoping block */ + In such case, the pretty-printer can't satisfy the scope of the + annotation and the scope of x at the same time. We favor x, which + gives us at least a correct, compilable, C code. + *) + | _::_::_,[],[],_ -> is_cfg_block ctxt + | [ { skind = Block b } as s' ], [], [], Stmt_block _ -> + b.bscoping && self#require_braces ctxt b && + not (self#require_braces (Stmt_block s') b) + (* If b wants braces in current context but not in subcontext, put + braces directly there. Otherwise, wait for children to do it. *) + | [ { skind = Block b } ], [], [], _ -> self#require_braces ctxt b + | [ { skind = UnspecifiedSequence s } ], [], [], _ -> + self#require_braces ctxt (Cil.block_from_unspecified_sequence s) + | [_],[],[], Then_with_else -> self#block_has_dangling_else blk + | [ _ ], [], [], _ -> false + | [],[],[],_ -> false) + + method private inline_block ctxt blk = match blk.bstmts with | [] | [ { skind = (Instr _ | Return _ | Goto _ | Break _ | Continue _ ) } ] -> - not (self#require_braces ?has_annot blk) - | [ { skind = Block blk } ] -> self#inline_block blk + not (self#require_braces ctxt blk) + | [ { skind = Block blk } ] -> self#inline_block ctxt blk | _ -> false method private block_is_function blk = match blk.bstmts with | [ { skind = Instr (Call _) } ] -> true + | [ { skind = Instr (Local_init (_, ConsInit _, _)) } ] -> true + (* NB: a block consisting solely of an initializer is pretty useless, + but who knows? *) | [ { skind = Block blk } ] -> self#block_is_function blk | _ -> false @@ -1081,24 +1124,24 @@ class cil_printer () = object (self) else ignore) (* no box around the block *) - method private unboxed_block ?(cut=true) ?braces ?has_annot fmt blk = - let braces = match braces with - | None -> self#require_braces ?has_annot blk - | Some b -> b - in - let inline = not braces && self#inline_block ?has_annot blk in + method private unboxed_block + ?(cut=true) ctxt fmt blk = + let braces = self#require_braces ctxt blk in + let inline = not braces && self#inline_block ctxt blk in if braces then pp_print_char fmt '{'; if braces && not inline then pp_print_space fmt (); if blk.blocals <> [] && verbose then fprintf fmt "@[/* Locals: %a */@]@ " (Pretty_utils.pp_list ~sep:",@ " self#varinfo) blk.blocals; + if verbose && not blk.bscoping then fprintf fmt "/* non-scoping */@\n"; if blk.battrs <> [] then (* [JS 2012/12/07] could directly call self#attributesGen whenever we are sure than it puts its printing material inside a box *) fprintf fmt "@[%a@]" (self#attributesGen true) blk.battrs; - if blk.blocals <> [] then + let locals_decl = List.filter (fun v -> not v.vdefined) blk.blocals in + if locals_decl <> [] then Pretty_utils.pp_list ~pre:"@[<v>" ~sep:"@;" ~suf:"@]@ " - self#vdecl_complete fmt blk.blocals; + self#vdecl_complete fmt locals_decl; let rec iterblock ~cut fmt = function | [] -> () | [ s ] -> @@ -1115,19 +1158,11 @@ class cil_printer () = object (self) else fprintf fmt "%a" (iterblock ~cut) stmts; if braces then Format.fprintf fmt "@;<1 -2>}" - (* no box around the block *) - method block ?braces fmt (blk: block) = - let braces = - match braces with None -> self#require_braces blk | Some b -> b - in - let open_box = - if self#inline_block blk then pp_open_hvbox else pp_open_vbox - in - open_box fmt (if braces then 2 else 0); - if verbose then Pretty_utils.pp_open_block fmt "/*block:begin*/@ "; - self#unboxed_block ~cut:false ~braces fmt blk; - if verbose then Pretty_utils.pp_close_block fmt "/*block:end*/"; - pp_close_box fmt () + (* wrapper for unboxed_block. Mainly for keeping a method per type in + Cil_types. All internal calls are directed to unboxed_block. + *) + method block fmt (blk: block) = + fprintf fmt "@[<v 2>%a@]" (self#unboxed_block Other) blk (* Store here the name of the last file printed in a line number. This is private to the object *) @@ -1163,6 +1198,12 @@ class cil_printer () = object (self) method stmtkind (next: stmt) fmt = function | UnspecifiedSequence seq -> + let ctxt = + match self#current_stmt with None -> Other | Some s -> Stmt_block s + in + let as_block = Cil.block_from_unspecified_sequence seq in + let require_braces = self#require_braces ctxt as_block in + let inline_block = self#inline_block ctxt as_block in let print_stmt pstmt fmt (stmt, modifies, writes, reads,_) = pstmt fmt stmt; if verbose || Kernel.is_debug_key_enabled debug_unspecified then @@ -1174,18 +1215,21 @@ class cil_printer () = object (self) let rec iterblock fmt = function | [] -> () | [ srw ] -> - fprintf fmt "@ " ; print_stmt (self#next_stmt Cil.invalidStmt) fmt srw | srw_first :: ((s_next,_,_,_,_) :: _ as tail) -> - fprintf fmt "@ " ; - print_stmt (self#next_stmt s_next) fmt srw_first ; + print_stmt (self#next_stmt s_next) fmt srw_first ; + pp_print_space fmt (); iterblock fmt tail in - fprintf fmt "@[<v 2>{%t%a@;<1 -2>}@]" - (if self#display_comment () then - fun fmt -> fprintf fmt " @[/* sequence */@]" - else ignore) - iterblock seq; + fprintf fmt "%t%a%t" + (fun fmt -> + if require_braces then + fprintf fmt "@[<v 0>@[<v 2>{ /* sequence */@;" + else if inline_block then fprintf fmt "@[<hv 0>" + else fprintf fmt "@[<v 0>") + iterblock seq + (if require_braces then fun fmt -> fprintf fmt "@]@;}@]" + else fun fmt -> pp_close_box fmt ()) | Return(None, l) -> fprintf fmt "@[%a%a;@]" @@ -1230,7 +1274,7 @@ class cil_printer () = object (self) (fun fmt -> self#line_directive ~forcefile:false fmt) l self#pp_keyword "if" self#exp be - (fun fmt -> self#unboxed_block ~has_annot:false fmt) t + (self#unboxed_block Other) t | If(be,t,{bstmts=[{skind=Goto(gref,_);labels=[]}]; battrs=[]},l) when !gref == next && not state.print_cil_as_is -> @@ -1238,7 +1282,7 @@ class cil_printer () = object (self) (fun fmt -> self#line_directive ~forcefile:false fmt) l self#pp_keyword "if" self#exp be - (fun fmt -> self#unboxed_block ~has_annot:false fmt) t + (self#unboxed_block Other) t | If(be,{bstmts=[];battrs=[]},e,l) when not state.print_cil_as_is -> @@ -1246,7 +1290,7 @@ class cil_printer () = object (self) (fun fmt -> self#line_directive ~forcefile:false fmt) l self#pp_keyword "if" self#exp (Cil.dummy_exp(UnOp(LNot,be,Cil.intType))) - (fun fmt -> self#unboxed_block ~has_annot:false fmt) e + (self#unboxed_block Other) e | If(be,{bstmts=[{skind=Goto(gref,_);labels=[]}]; battrs=[]},e,l) when !gref == next && not state.print_cil_as_is -> @@ -1254,30 +1298,26 @@ class cil_printer () = object (self) (fun fmt -> self#line_directive ~forcefile:false fmt) l self#pp_keyword "if" self#exp (Cil.dummy_exp(UnOp(LNot,be,Cil.intType))) - (fun fmt -> self#unboxed_block ~has_annot:false fmt) e; + (self#unboxed_block Other) e; | If(be,t,e,l) -> pp_open_hvbox fmt 0; self#line_directive fmt l; - let braces_then = - self#require_braces ~has_annot:false t || self#block_has_dangling_else t - in - let else_at_newline = - braces_then - || not (self#inline_block ~has_annot:false t) - || not (self#inline_block ~has_annot:false e) + let else_at_newline = + (self#require_braces Then_with_else t) + || not (self#inline_block Then_with_else t) + || not (self#inline_block Other e) || (* call to a function in both branches (for GUI' status bullets) *) (force_brace && self#block_is_function t && self#block_is_function e) in fprintf fmt "@[<v 2>%a (%a) %a@]" self#pp_keyword "if" self#exp be - (fun fmt -> self#unboxed_block ~has_annot:false ~braces:braces_then fmt) - t; + (self#unboxed_block Then_with_else) t; if else_at_newline then fprintf fmt "@\n" else fprintf fmt "@ "; fprintf fmt "@[<v 2>%a %a@]" self#pp_keyword "else" - (fun fmt -> self#unboxed_block ~has_annot:false fmt) e; + (self#unboxed_block Other) e; pp_close_box fmt () | Switch(e,b,_,l) -> @@ -1285,7 +1325,7 @@ class cil_printer () = object (self) (fun fmt -> self#line_directive ~forcefile:false fmt) l self#pp_keyword "switch" self#exp e - (fun fmt -> self#unboxed_block ~has_annot:false fmt) b + (self#unboxed_block Other) b | Loop(a, b, l, _, _) -> Format.pp_open_hvbox fmt 0; @@ -1333,45 +1373,49 @@ class cil_printer () = object (self) (fun fmt -> self#line_directive fmt) l self#pp_keyword "while" self#exp term - (fun fmt -> self#unboxed_block ~has_annot:false fmt) b; + (self#unboxed_block Other) b; with Not_found -> Format.fprintf fmt "%a@[<v 2>%a (1) %a@]" (fun fmt -> self#line_directive fmt) l self#pp_keyword "while" - (fun fmt -> self#unboxed_block ~has_annot:false fmt) b); + (self#unboxed_block Other) b); Format.pp_close_box fmt () | Block b -> + let ctxt = + match self#current_stmt with None -> Other | Some s -> Stmt_block s + in (* We do not want to put extra braces in presence of blocks included in another block (that's often the case). So the following line specifically limits the number of braces in that case. But that assumes that the required braces have already been put before by the callers *) - let braces = - b.blocals <> [] || b.battrs <> [] || - (Kernel.is_debug_key_enabled debug_sid) || verbose - || (self#has_annot - && logic_printer_enabled - && self#has_multiple_stmts b) + let braces = self#require_braces ctxt b in + let open_box = + if self#inline_block ctxt b then pp_open_hvbox else pp_open_vbox in - self#block fmt ~braces b + open_box fmt (if braces then 2 else 0); + if verbose then Pretty_utils.pp_open_block fmt "/*block:begin*/@ "; + self#unboxed_block ~cut:false ctxt fmt b; + if verbose then Pretty_utils.pp_close_block fmt "/*block:end*/"; + pp_close_box fmt () | TryFinally (b, h, l) -> fprintf fmt "@[%a@[<v 2>__try@ %a@]@ @[<v 2>__finally@ %a@]@]" (fun fmt -> self#line_directive fmt) l - (fun fmt -> self#block fmt) b - (fun fmt -> self#block fmt) h + (self#unboxed_block Other) b + (self#unboxed_block Other) h | TryExcept (b, (il, e), h, l) -> fprintf fmt "@[%a@[<v 2>__try@ %a@]@ @[<v 2>__except(@\n@[" (fun fmt -> self#line_directive fmt) l - (fun fmt -> self#block fmt) b; + (self#unboxed_block Other) b; (* Print the instructions but with a comma at the end, instead of * semicolon *) instr_terminator <- ","; Pretty_utils.pp_list ~sep:"@\n" self#instr fmt il; instr_terminator <- ";"; - fprintf fmt "%a) @]@ %a@]" self#exp e (fun fmt -> self#block fmt) h + fprintf fmt "%a) @]@ %a@]" self#exp e (self#unboxed_block Other) h | Throw (e,_) -> let print_expr fmt (e,_) = self#exp fmt e in @@ -1382,23 +1426,23 @@ class cil_printer () = object (self) let print_var_catch_all fmt v = match v with | Catch_all -> pp_print_string fmt "..." - | Catch_exn(v,l) -> + | Catch_exn(v,l) -> fprintf fmt "@[<v 2>@[%a@]%a@]" self#vdecl v (Pretty_utils.pp_list ~pre:"@;" ~sep:"@;" (fun fmt (v,_) -> self#vdecl fmt v)) l in - let braces = false in let print_one_catch fmt (v,b) = - fprintf fmt "@[<v 2>@[%a (@;%a@;)@] {@;%a@]@;}" + fprintf fmt "@[<v 2>@[%a (@;%a@;)@] %a@]" self#pp_keyword "catch" print_var_catch_all v - (self#block ~braces) b + (self#unboxed_block Other) b in - fprintf fmt "@[<v 2>%a@ @[%a@]@]@\n@[<v 2>%a@]" + fprintf fmt "@[<v 0>@[<v 2>%a %a@]@;@[<v 2>%a@]@]" self#pp_keyword "try" - (self#block ~braces) body - (Pretty_utils.pp_list ~sep:"@;" print_one_catch) catch + (self#unboxed_block Other) body + (Pretty_utils.pp_list + ~pre:"" ~sep:"@;" ~suf:"" print_one_catch) catch (*** GLOBALS ***) method global fmt (g:global) = @@ -1409,11 +1453,12 @@ class cil_printer () = object (self) (* If the function has attributes then print a prototype because * GCC cannot accept function attributes in a definition *) let oldattr = fundec.svar.vattr in + let oldattr = List.filter keep_attr oldattr in (* Always print the file name before function declarations *) (* Prototype first *) if oldattr <> [] then (self#line_directive fmt l; - fprintf fmt "%a;@\n" + fprintf fmt "%a@\n" self#vdecl_complete fundec.svar); (* Temporarily remove the function attributes *) fundec.svar.vattr <- []; @@ -1601,7 +1646,7 @@ class cil_printer () = object (self) (*List.iter (fprintf fmt "@\n%a;" self#vdecl) f.slocals ;*) (* body. *) if entering_ghost then is_ghost <- true; - self#unboxed_block ~has_annot:false ~braces:true fmt f.sbody; + self#unboxed_block Body fmt f.sbody; if entering_ghost then is_ghost <- false; fprintf fmt "@]%t@]@." (if entering_ghost @@ -1851,7 +1896,9 @@ class cil_printer () = object (self) fprintf fmt "%a " (Pretty_utils.pp_list ~sep:" " self#attrparam) args; true - | s, _ when s = Cil.bitfield_attribute_name && not state.print_cil_as_is -> + | s, _ when s = Cil.bitfield_attribute_name && + not state.print_cil_as_is && + not (Kernel.is_debug_key_enabled debug_bitfields) -> false | _ -> (* This is the default case *) (* Add underscores to the name *) @@ -1889,6 +1936,11 @@ class cil_printer () = object (self) | AInt n -> fprintf fmt "%a" Datatype.Integer.pretty n | AStr s -> fprintf fmt "\"%s\"" (Escape.escape_string s) | ACons(s, []) -> fprintf fmt "%s" s + | ACons("__fc_assign", [a1; a2]) -> + fprintf fmt "%a=%a" + (self#attribute_prec level) a1 + (self#attribute_prec level) a2 + | ACons("__fc_float", [AStr s]) -> pp_print_string fmt s | ACons(s,al) -> fprintf fmt "%s(%a)" s @@ -1958,11 +2010,7 @@ class cil_printer () = object (self) loop in__attr__ rest end in - let keep_attr = function - | Attr (s,_) -> not (List.mem s !reserved_attributes) - | AttrAnnot _ -> true - in - loop [] (List.filter keep_attr a); + loop [] (filter_printing_attributes a); (* ******************************************************************* *) (* Logic annotations printer *) @@ -2194,7 +2242,7 @@ class cil_printer () = object (self) | Tapp (f, labels, tl) -> fprintf fmt "%a%a%a" self#logic_info f - self#labels (List.map snd labels) + self#labels labels (Pretty_utils.pp_list ~pre:"@[(" ~suf:")@]" ~sep:",@ " self#term) tl | Tif (cond,th,el) -> fprintf fmt "@[<2>%a?@;%a:@;%a@]" @@ -2407,7 +2455,7 @@ class cil_printer () = object (self) | Papp (p,labels,l) -> fprintf fmt "@[%a%a%a@]" self#logic_info p - self#labels (List.map snd labels) + self#labels labels (Pretty_utils.pp_list ~pre:"@[(" ~suf:")@]" ~sep:",@ " self#term) l | Prel (rel,l,r) -> fprintf fmt "@[%a@ %a@ %a@]" term l self#relation rel term r @@ -2826,22 +2874,34 @@ class cil_printer () = object (self) Pretty_utils.pp_list ~pre:"<@[" ~suf:"@]>" ~sep:",@ " pp_print_string fmt tvars - method logic_label fmt lab = - let s = - match lab with - | LogicLabel (_, s) -> s - | StmtLabel sref -> - let rec pickLabel = function - | [] -> None - | Label (l, _, _) :: _ -> Some l - | _ :: rest -> pickLabel rest - in - match pickLabel !sref.labels with - | Some l -> l - | None -> "__invalid_label" - in + method logic_builtin_label fmt l = + let s = match l with + | Here -> "Here" + | Old -> "Old" + | Pre -> "Pre" + | Post -> "Post" + | LoopEntry -> "LoopEntry" + | LoopCurrent -> "LoopCurrent" + | Init -> "Init" + in pp_print_string fmt s + method logic_label fmt lab = + match lab with + | BuiltinLabel (_, l) -> self#logic_builtin_label fmt l + | FormalLabel s -> pp_print_string fmt s + | StmtLabel sref -> + let rec pickLabel = function + | [] -> None + | Label (l, _, _) :: _ -> Some l + | _ :: rest -> pickLabel rest + in + let s = match pickLabel !sref.labels with + | Some l -> l + | None -> "__invalid_label" + in + pp_print_string fmt s + method private labels fmt labels = match labels with | [ l ] when diff --git a/src/kernel_services/ast_printing/cil_printer.mli b/src/kernel_services/ast_printing/cil_printer.mli index 6027aaca71cb20473f4a9bd3cc841cf88de72231..4346d47f786ebd9c133e030c8b439ece1ce8d037 100644 --- a/src/kernel_services/ast_printing/cil_printer.mli +++ b/src/kernel_services/ast_printing/cil_printer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/cil_types_debug.ml b/src/kernel_services/ast_printing/cil_types_debug.ml index 39b243746641c013590d1ff0356485f31d758c9d..c455cea2ef78b5ad2ca04e6e4b824de5c72358f9 100644 --- a/src/kernel_services/ast_printing/cil_types_debug.ml +++ b/src/kernel_services/ast_printing/cil_types_debug.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -75,28 +75,31 @@ let pp_int = Format.pp_print_int let pp_char = Format.pp_print_char let pp_float = Format.pp_print_float +let pp_if_list_not_empty prefix suffix pp_l fmt l = + if l <> [] then Format.fprintf fmt "%s%a%s" prefix pp_l l suffix + else () let pp_variant pp_term = pp_pair pp_term (pp_option pp_string) -let pp_allocation pp_locs fmt = function +let rec pp_allocation fmt = function | FreeAlloc(locs_list1,locs_list2) -> Format.fprintf fmt "FreeAlloc(%a,%a)" - (pp_list pp_locs) locs_list1 (pp_list pp_locs) locs_list2 + (pp_list pp_identified_term) locs_list1 (pp_list pp_identified_term) locs_list2 | FreeAllocAny -> Format.fprintf fmt "FreeAllocAny" -let pp_deps pp_locs fmt = function - | From(locs_list) -> Format.fprintf fmt "From(%a)" (pp_list pp_locs) locs_list +and pp_deps fmt = function + | From(locs_list) -> Format.fprintf fmt "From(%a)" (pp_list pp_identified_term) locs_list | FromAny -> Format.fprintf fmt "FromAny" -let pp_from pp_locs = pp_pair pp_locs (pp_deps pp_locs) +and pp_from fmt = pp_pair pp_identified_term pp_deps fmt -let pp_assigns pp_locs fmt = function +and pp_assigns pp_locs fmt = function | WritesAny -> Format.fprintf fmt "WritesAny" | Writes(from_list) -> Format.fprintf fmt "Writes(%a)" (pp_list pp_locs) from_list -let rec pp_file fmt file = Format.fprintf fmt "{fileName=%a;globals=%a;globinit=%a;globinitcalled=%a}" +and pp_file fmt file = Format.fprintf fmt "{fileName=%a;globals=%a;globinit=%a;globinitcalled=%a}" pp_string file.fileName (pp_list pp_global) file.globals (pp_option pp_fundec) file.globinit pp_bool file.globinitcalled and pp_global fmt = function @@ -546,6 +549,16 @@ and pp_catch_binder fmt = function (pp_list (pp_pair pp_varinfo pp_block)) varinfo_block_pair_list | Catch_all -> Format.fprintf fmt "Catch_all" +and pp_constructor_kind fmt = function + | Constructor -> Format.pp_print_string fmt "Constructor" + | Plain_func -> Format.pp_print_string fmt "Plain_func" + +and pp_local_init fmt = function + | AssignInit i -> Format.fprintf fmt "AssignInit(%a)" pp_init i + | ConsInit(f,args,kind) -> + Format.fprintf fmt "ConsInit(%a,%a,%a)" pp_varinfo f (pp_list pp_exp) args + pp_constructor_kind kind + and pp_instr fmt = function | Set(lval,exp,location) -> Format.fprintf fmt "Set(%a,%a,%a)" pp_lval lval pp_exp exp pp_location location | Call(lval_option,exp,exp_list,location) -> @@ -557,6 +570,8 @@ and pp_instr fmt = function | Skip(location) -> Format.fprintf fmt "Skip(%a)" pp_location location | Code_annot(code_annotation,location) -> Format.fprintf fmt "Code_annot(%a,%a)" pp_code_annotation code_annotation pp_location location + | Local_init(vi,i,location) -> + Format.fprintf fmt "Local_init(%a,%a,%a)" pp_varinfo vi pp_local_init i pp_location location and pp_extended_asm fmt _extended_asm = Format.fprintf fmt "pp_extended_asm_TODO" (*{ { @@ -575,6 +590,11 @@ and pp_location fmt (pos_start,pos_end) = let p = if print_locations then Format.fprintf else Format.ifprintf in p fmt "(%a,%a)" pp_lexing_position pos_start pp_lexing_position pos_end +and pp_if_loc_known prefix suffix fmt loc = + if print_locations && loc <> Cil_datatype.Location.unknown + then Format.fprintf fmt "%s%a%s" prefix pp_location loc suffix + else () + and pp_logic_constant fmt = function | Integer(integer,string_option) -> Format.fprintf fmt "Integer(%a,%a)" pp_integer integer (pp_option pp_string) string_option @@ -607,13 +627,30 @@ and pp_identified_term fmt identified_term = and pp_logic_label fmt = function | StmtLabel(stmt_ref) -> Format.fprintf fmt "StmtLabel(%a)" (pp_ref pp_stmt) stmt_ref - | LogicLabel(stmt_option,string) -> - Format.fprintf fmt "LogicLabel(%a,%a)" (pp_option pp_stmt) stmt_option pp_string string + | FormalLabel s -> Format.fprintf fmt "FormalLabel %s" s + | BuiltinLabel(stmt_option, l) -> + Format.fprintf fmt "BuiltinLabel(%a,%a)" + (pp_option pp_stmt) stmt_option + pp_logic_builtin_label l + +and pp_logic_builtin_label fmt l = + let s = match l with + | Here -> "Here" + | Old -> "Old" + | Pre -> "Pre" + | Post -> "Post" + | LoopEntry -> "LoopEntry" + | LoopCurrent -> "LoopCurrent" + | Init -> "Init" + in + pp_string fmt s and pp_term fmt term = - Format.fprintf fmt "{term_node=%a;term_loc=%a;term_type=%a;term_name=%a}" - pp_term_node term.term_node pp_location term.term_loc - pp_logic_type term.term_type (pp_list pp_string) term.term_name + Format.fprintf fmt "{term_node=%a;%aterm_type=%a%a}" + pp_term_node term.term_node + (pp_if_loc_known "term_loc=" ";") term.term_loc + pp_logic_type term.term_type + (pp_if_list_not_empty ";term_name=" "" (pp_list pp_string)) term.term_name and pp_term_node fmt = function | TConst(logic_constant) -> Format.fprintf fmt "TConst(%a)" pp_logic_constant logic_constant @@ -629,10 +666,10 @@ and pp_term_node fmt = function | TCastE(typ,term) -> Format.fprintf fmt "TCastE(%a,%a)" pp_typ typ pp_term term | TAddrOf(term_lval) -> Format.fprintf fmt "TAddrOf(%a)" pp_term_lval term_lval | TStartOf(term_lval) -> Format.fprintf fmt "TStartOf(%a)" pp_term_lval term_lval - | Tapp(logic_info,logic_label_logic_label_pair_list,term_list) -> + | Tapp(logic_info,logic_label_list,term_list) -> Format.fprintf fmt "Tapp(%a,%a,%a)" pp_logic_info logic_info - (pp_list (pp_pair pp_logic_label pp_logic_label)) logic_label_logic_label_pair_list + (pp_list pp_logic_label) logic_label_list (pp_list pp_term) term_list | Tlambda(quantifiers,term) -> Format.fprintf fmt "Tlambda(%a,%a)" pp_quantifiers quantifiers pp_term term | TDataCons(logic_ctor_info,term_list) -> @@ -692,7 +729,13 @@ and pp_term_offset fmt = function | TIndex(term,term_offset) -> Format.fprintf fmt "TIndex(%a,%a)" pp_term term pp_term_offset term_offset -and pp_logic_info fmt _logic_info = Format.fprintf fmt "pp_logic_info_TODO" (*{ +and pp_logic_info fmt logic_info = + Format.fprintf fmt "{l_var_info=%a;%al_tparams=%a;logic_type=%a;TODO}" + pp_logic_var logic_info.l_var_info + (pp_if_list_not_empty "l_labels=" ";" (pp_list pp_logic_label)) logic_info.l_labels + (pp_list pp_string) logic_info.l_tparams + (pp_option pp_logic_type) logic_info.l_type +(*{ mutable l_var_info : logic_var; mutable l_labels : logic_label_list; mutable l_tparams : string_list; @@ -769,10 +812,10 @@ and pp_relation fmt = function and pp_predicate_node fmt = function | Pfalse -> Format.fprintf fmt "Pfalse" | Ptrue -> Format.fprintf fmt "Ptrue" - | Papp(logic_info,logic_label_logic_label_pair_list,term_list) -> + | Papp(logic_info,logic_label_list,term_list) -> Format.fprintf fmt "Papp(%a,%a,%a)" pp_logic_info logic_info - (pp_list (pp_pair pp_logic_label pp_logic_label)) logic_label_logic_label_pair_list + (pp_list pp_logic_label) logic_label_list (pp_list pp_term) term_list | Pseparated(term_list) -> Format.fprintf fmt "Pseparated(%a)" (pp_list pp_term) term_list @@ -820,16 +863,14 @@ and pp_predicate_node fmt = function | Psubtype(term1,term2) -> Format.fprintf fmt "Psubtype(%a,%a)" pp_term term1 pp_term term2 -and pp_identified_predicate fmt _identified_predicate = Format.fprintf fmt "pp_identified_predicate_TODO" (*{ - ip_id: int; - ip_content: predicate; -}*) +and pp_identified_predicate fmt identified_predicate = + Format.fprintf fmt "{ip_id=%d;ip_content=%a}" + identified_predicate.ip_id pp_predicate identified_predicate.ip_content -and pp_predicate fmt _predicate = Format.fprintf fmt "pp_predicate_TODO" (*{ - pred_name : string_list; - pred_loc : location; - pred_content : predicate_node; -}*) +and pp_predicate fmt predicate = Format.fprintf fmt "{%a%apred_content=%a}" + (pp_if_list_not_empty "pred_name=" ";" (pp_list pp_string)) predicate.pred_name + (pp_if_loc_known "pred_loc=" ";") predicate.pred_loc + pp_predicate_node predicate.pred_content and pp_spec fmt _spec = Format.fprintf fmt "pp_spec_TODO" (*{ mutable spec_behavior : behavior_list; @@ -851,8 +892,8 @@ and pp_behavior fmt _behavior = Format.fprintf fmt "pp_behavior_TODO" (*{ mutable b_requires : identified_predicate_list; mutable b_assumes : identified_predicate_list; mutable b_post_cond : (termination_kind * identified_predicate)_list; - mutable b_assigns : identified_term assigns; - mutable b_allocation : identified_term allocation; + mutable b_assigns : assigns; + mutable b_allocation : allocation; mutable b_extended : acsl_extension_list }*) @@ -893,10 +934,10 @@ and pp_code_annotation_node fmt = function Format.fprintf fmt "AVariant(%a)" (pp_variant pp_term) term_variant | AAssigns(string_list,assigns) -> Format.fprintf fmt "AAssigns(%a,%a)" (pp_list pp_string) string_list - (pp_assigns (pp_from pp_identified_term)) assigns + (pp_assigns pp_from) assigns | AAllocation(string_list,allocation) -> Format.fprintf fmt "AAllocation(%a,%a)" (pp_list pp_string) string_list - (pp_allocation pp_identified_term) allocation + pp_allocation allocation | APragma(pragma) -> Format.fprintf fmt "APragma(%a)" (pp_pragma pp_term) pragma | AExtended(string_list,acsl_extension) -> diff --git a/src/kernel_services/ast_printing/cil_types_debug.mli b/src/kernel_services/ast_printing/cil_types_debug.mli index 0199e26147f0e8e04e0f0f123a8dcb3f7f91ce08..655ad0f2e319d648715a00d8f2a1dbf2850434dd 100644 --- a/src/kernel_services/ast_printing/cil_types_debug.mli +++ b/src/kernel_services/ast_printing/cil_types_debug.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -64,16 +64,14 @@ val pp_float : Format.formatter -> float -> unit val pp_variant : 'a Pretty_utils.formatter -> ('a * string option) Pretty_utils.formatter val pp_allocation : - 'a Pretty_utils.formatter -> - Format.formatter -> 'a Cil_types.allocation -> unit + Format.formatter -> Cil_types.allocation -> unit val pp_deps : - 'a Pretty_utils.formatter -> Format.formatter -> 'a Cil_types.deps -> unit + Format.formatter -> Cil_types.deps -> unit val pp_from : - 'a Pretty_utils.formatter -> - ('a * 'a Cil_types.deps) Pretty_utils.formatter + (Cil_types.identified_term * Cil_types.deps) Pretty_utils.formatter val pp_assigns : - 'a Cil_types.from Pretty_utils.formatter -> - Format.formatter -> 'a Cil_types.assigns -> unit + Cil_types.from Pretty_utils.formatter -> + Format.formatter -> Cil_types.assigns -> unit val pp_file : Format.formatter -> Cil_types.file -> unit val pp_global : Format.formatter -> Cil_types.global -> unit val pp_typ : Cil_types.typ Pretty_utils.formatter @@ -118,6 +116,8 @@ val pp_logic_real : Format.formatter -> Cil_types.logic_real -> unit val pp_logic_type : Cil_types.logic_type Pretty_utils.formatter val pp_identified_term : Cil_types.identified_term Pretty_utils.formatter val pp_logic_label : Cil_types.logic_label Pretty_utils.formatter +val pp_logic_builtin_label : + Cil_types.logic_builtin_label Pretty_utils.formatter val pp_term : Cil_types.term Pretty_utils.formatter val pp_term_node : Format.formatter -> Cil_types.term_node -> unit val pp_term_lval : Format.formatter -> Cil_types.term_lval -> unit @@ -136,7 +136,7 @@ val pp_logic_ctor_info : Cil_types.logic_ctor_info Pretty_utils.formatter val pp_quantifiers : Format.formatter -> Cil_types.quantifiers -> unit val pp_relation : Format.formatter -> Cil_types.relation -> unit val pp_predicate_node : Format.formatter -> Cil_types.predicate_node -> unit -val pp_identified_predicate : Format.formatter -> 'a -> unit +val pp_identified_predicate : Format.formatter -> Cil_types.identified_predicate -> unit val pp_predicate : Cil_types.predicate Pretty_utils.formatter val pp_spec : Format.formatter -> Cil_types.spec -> unit val pp_acsl_extension : Format.formatter -> Cil_types.acsl_extension -> unit @@ -147,16 +147,16 @@ val pp_termination_kind : Format.formatter -> Cil_types.termination_kind -> unit val pp_loop_pragma : Cil_types.term Pretty_utils.formatter -> - Format.formatter -> Cil_types.term Cil_types.loop_pragma -> unit + Format.formatter -> Cil_types.loop_pragma -> unit val pp_slice_pragma : Cil_types.term Pretty_utils.formatter -> - Format.formatter -> Cil_types.term Cil_types.slice_pragma -> unit + Format.formatter -> Cil_types.slice_pragma -> unit val pp_impact_pragma : Cil_types.term Pretty_utils.formatter -> - Format.formatter -> Cil_types.term Cil_types.impact_pragma -> unit + Format.formatter -> Cil_types.impact_pragma -> unit val pp_pragma : Cil_types.term Pretty_utils.formatter -> - Format.formatter -> Cil_types.term Cil_types.pragma -> unit + Format.formatter -> Cil_types.pragma -> unit val pp_code_annotation_node : Format.formatter -> Cil_types.code_annotation_node -> unit val pp_funspec : Format.formatter -> Cil_types.funspec -> unit diff --git a/src/kernel_services/ast_printing/cprint.ml b/src/kernel_services/ast_printing/cprint.ml index a104d412d42c5426497396298c2bde823a858094..a2262b145f01eaf8953c68f9317fe55fa41c2eaa 100644 --- a/src/kernel_services/ast_printing/cprint.ml +++ b/src/kernel_services/ast_printing/cprint.ml @@ -47,20 +47,20 @@ ** File: cprint.ml ** Version: 2.1e ** Date: 9.1.99 -** Author: Hugues Cassé +** Author: Hugues Cassé ** -** 1.0 2.22.99 Hugues Cassé First version. -** 2.0 3.18.99 Hugues Cassé Compatible with Frontc 2.1, use of CAML +** 1.0 2.22.99 Hugues Cassé First version. +** 2.0 3.18.99 Hugues Cassé Compatible with Frontc 2.1, use of CAML ** pretty printer. -** 2.1 3.22.99 Hugues Cassé More efficient custom pretty printer used. -** 2.1a 4.12.99 Hugues Cassé Correctly handle: +** 2.1 3.22.99 Hugues Cassé More efficient custom pretty printer used. +** 2.1a 4.12.99 Hugues Cassé Correctly handle: ** char *m, *m, *p; m + (n - p) -** 2.1b 4.15.99 Hugues Cassé x + (y + z) stays x + (y + z) for +** 2.1b 4.15.99 Hugues Cassé x + (y + z) stays x + (y + z) for ** keeping computation order. -** 2.1c 7.23.99 Hugues Cassé Improvement of case and default display. -** 2.1d 8.25.99 Hugues Cassé Rebuild escape sequences in string and +** 2.1c 7.23.99 Hugues Cassé Improvement of case and default display. +** 2.1d 8.25.99 Hugues Cassé Rebuild escape sequences in string and ** characters. -** 2.1e 9.1.99 Hugues Cassé Fix, recognize and correctly display '\0'. +** 2.1e 9.1.99 Hugues Cassé Fix, recognize and correctly display '\0'. *) (* George Necula: I changed this pretty dramatically since CABS changed *) @@ -70,7 +70,7 @@ open Logic_print open Cabs open Escape -let version = "Cprint 2.1e 9.1.99 Hugues Cassé" +let version = "Cprint 2.1e 9.1.99 Hugues Cassé" let msvcMode = ref false diff --git a/src/kernel_services/ast_printing/description.ml b/src/kernel_services/ast_printing/description.ml index e4b77289c426dfcc11a7718d2a4a1da91dc4c545..825daf3286f640fda04ca8474142401f39e12f4e 100644 --- a/src/kernel_services/ast_printing/description.ml +++ b/src/kernel_services/ast_printing/description.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -75,7 +75,7 @@ let pp_allocation kloc fmt (allocation:identified_term list) = | _ -> Format.fprintf fmt "'%s'" (String.concat "," names) -let pp_region kloc fmt (region:identified_term from list) = +let pp_region kloc fmt (region:from list) = if region = [] then Format.fprintf fmt "nothing" else let names = @@ -124,6 +124,8 @@ let pp_code_annot fmt ca = let pp_stmt kloc fmt stmt = match stmt.skind with + | Instr (Local_init (v,_,loc)) -> + Format.fprintf fmt "initialization of '%s'%a" v.vname (pp_kloc kloc) loc | Instr (Call(_,{enode=Lval(Var v,_)},_,loc)) -> Format.fprintf fmt "call '%s'%a" v.vname (pp_kloc kloc) loc | Instr (Set(_,_,loc)|Call(_,_,_,loc)) -> diff --git a/src/kernel_services/ast_printing/description.mli b/src/kernel_services/ast_printing/description.mli index c466144f9ade2b2d98e80b0ace49887636b9177a..a2e61746700291489f4e30e3b594db010a44f336 100644 --- a/src/kernel_services/ast_printing/description.mli +++ b/src/kernel_services/ast_printing/description.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,7 +34,7 @@ val pp_kinstr : bool -> Format.formatter -> kinstr -> unit val pp_idpred : bool -> Format.formatter -> identified_predicate -> unit (** prints the "'<labels>'" or the "(<location>)" of the predicate *) -val pp_region : bool -> Format.formatter -> identified_term from list -> unit +val pp_region : bool -> Format.formatter -> from list -> unit (** prints message "nothing" or the "'<names>'" or the "(<location>)" of the relation *) diff --git a/src/kernel_services/ast_printing/logic_print.ml b/src/kernel_services/ast_printing/logic_print.ml index 627c91eee44f9ee8b02466e27cef11332eee4c02..e2170f52eb8dc45cb8d4586be2bc101aa5bf5e89 100644 --- a/src/kernel_services/ast_printing/logic_print.ml +++ b/src/kernel_services/ast_printing/logic_print.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -23,7 +23,6 @@ (**************************************************************************) open Format -open Cil_types open Pretty_utils open Logic_ptree diff --git a/src/kernel_services/ast_printing/logic_print.mli b/src/kernel_services/ast_printing/logic_print.mli index a942bc1e1f50257eb4124946109c8b82a0e7310e..48d00f529a84c0c0f035f8e91cf4087c164313a6 100644 --- a/src/kernel_services/ast_printing/logic_print.mli +++ b/src/kernel_services/ast_printing/logic_print.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/kernel_services/ast_printing/printer.ml b/src/kernel_services/ast_printing/printer.ml index 51df099cc36c8f6ca5e485a8d19771bc50c0f542..51577549d16a2ae49855fbfd221ae04782bc6bef 100644 --- a/src/kernel_services/ast_printing/printer.ml +++ b/src/kernel_services/ast_printing/printer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -122,20 +122,19 @@ class printer_with_annot () = object (self) let spec = Annotations.funspec ~populate:false kf in self#opt_funspec fmt spec + method! private stmt_has_annot s = Annotations.has_code_annot s + method! private has_annot = - super#has_annot - || match self#current_stmt with - | None -> false - | Some s -> Annotations.has_code_annot s + Extlib.may_map self#stmt_has_annot ~dft:false self#current_stmt - method! private inline_block ?has_annot blk = - super#inline_block ?has_annot blk + method! private inline_block ctxt blk = + super#inline_block ctxt blk && (match blk.bstmts with | [] -> true | [ s ] -> not (Annotations.has_code_annot s && logic_printer_enabled) && (match s.skind with - | Block blk -> self#inline_block blk + | Block blk -> self#inline_block ctxt blk | _ -> true) | _ :: _ -> false) @@ -221,10 +220,9 @@ class printer_with_annot () = object (self) (let loc = fst (Cil_datatype.Stmt.loc s.skind) in Format.fprintf fmt "/*Loc=%s:%d*/" loc.Lexing.pos_fname loc.Lexing.pos_lnum); *) - Format.pp_open_hvbox fmt 2; + Format.pp_open_hvbox fmt 0; (* print the labels *) self#stmt_labels fmt s; - Format.pp_open_hvbox fmt 0; if Kernel.PrintComments.get () then begin let comments = Globals.get_comments_stmt s in if comments <> [] then @@ -272,9 +270,17 @@ class printer_with_annot () = object (self) pGhost fmt s) end else self#stmtkind next fmt s.skind; - Format.pp_close_box fmt (); Format.pp_close_box fmt () - + + method! stmtkind (next: stmt) fmt skind = + super#stmtkind next fmt + begin + match skind with + | Goto({ contents = { skind = (Return _) as return }},_) + when Kernel.PrintReturn.get () -> return + | _ -> skind + end + end (* class printer_with_annot *) include Printer_builder.Make(struct class printer = printer_with_annot end) @@ -293,19 +299,35 @@ let () = Cil_datatype.Block.pretty_ref := pp_block let () = Cil_datatype.Instr.pretty_ref := pp_instr let () = Cil_datatype.Logic_var.pretty_ref := pp_logic_var let () = Cil_datatype.Model_info.pretty_ref := pp_model_info -let () = Cil_datatype.Logic_label.pretty_ref := pp_logic_label let () = Cil_datatype.Logic_type.pretty_ref := pp_logic_type let () = Cil_datatype.Term.pretty_ref := pp_term let () = Cil_datatype.Term_lval.pretty_ref := pp_term_lval let () = Cil_datatype.Term_offset.pretty_ref := pp_term_offset +let () = Cil_datatype.Code_annotation.pretty_ref := pp_code_annotation +let () = Cil_datatype.Funspec.pretty_ref := pp_funspec + +(* to fix issue #2 *) +let () = Cil_datatype.Cabs_file.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Label.pretty_ref := pp_label +let () = Cil_datatype.Compinfo.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Fieldinfo.pretty_ref := (fun fmt f -> pp_varname fmt f.fname) +let () = Cil_datatype.Builtin_logic_info.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Logic_type_info.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Logic_ctor_info.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Initinfo.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Logic_info.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Logic_constant.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Identified_term.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Term_lhost.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Logic_label.pretty_ref := pp_logic_label let () = Cil_datatype.Global_annotation.pretty_ref := pp_global_annotation let () = Cil_datatype.Global.pretty_ref := pp_global -let () = Cil_datatype.Code_annotation.pretty_ref := pp_code_annotation let () = Cil_datatype.Predicate.pretty_ref := pp_predicate let () = Cil_datatype.Identified_predicate.pretty_ref := pp_identified_predicate -let () = Cil_datatype.Funspec.pretty_ref := pp_funspec -let () = - Cil_datatype.Fieldinfo.pretty_ref := (fun fmt f -> pp_varname fmt f.fname) +let () = Cil_datatype.Fundec.pretty_ref := (fun _ _ -> assert false) +let () = Cil_datatype.Lexpr.pretty_ref := (fun _ _ -> assert false) + + (* Local Variables: diff --git a/src/kernel_services/ast_printing/printer.mli b/src/kernel_services/ast_printing/printer.mli index 63da998800bded6a5d00e35b2b98dad1affc4858..f1d6b3227c07a19b41232f31a7cc32a3f1995c1d 100644 --- a/src/kernel_services/ast_printing/printer.mli +++ b/src/kernel_services/ast_printing/printer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_printing/printer_api.mli b/src/kernel_services/ast_printing/printer_api.mli index 765b782f4da57a4fed26cd55c59637e474c0310f..b30df44701d55ddac0344aecdfbd1b417bd684eb 100644 --- a/src/kernel_services/ast_printing/printer_api.mli +++ b/src/kernel_services/ast_printing/printer_api.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -27,6 +27,16 @@ open Cil_types +(** context in which a block will be printed. useful to decide whether + braces are required or not. *) +type block_ctxt = + | Stmt_block of stmt (** stmt is Block b. *) + | Body (** body of a function. *) + | Then_with_else (** block is the then branch of a conditional that has + an else branch. *) + | Other (** block is any other toplevel block of the cfg + (then without else, else branch, switch, while, ... *) + (* ********************************************************************* *) (** {2 Class type for extensible printer} *) (* ********************************************************************* *) @@ -61,6 +71,10 @@ class type extensible_printer_type = object method private current_behavior: funbehavior option (** @return the [funbehavior] being pretty-printed. *) + method private stmt_has_annot: stmt -> bool + (** [true] if the given statement has some annotations attached to it. + @since Phosphorus-20170501-beta1 *) + method private has_annot: bool (** [true] if [current_stmt] has some annotations attached to it. *) @@ -73,17 +87,20 @@ class type extensible_printer_type = object For example this is called whenever a [while(1)] followed by a conditional [if (cond) break;] may be compacted into [while (cond)]. *) - method private require_braces: ?has_annot:bool -> block -> bool - (** @return [true] if the given block must be enclosed in a block. - [has_annot] indicates if the stmt corresponding to the block may have - annotations (default is [true]). - @modify Fluorine-20130401 optional arguments has been modified. *) + method private require_braces: block_ctxt -> block -> bool + (** @return [true] if the given block must be enclosed in a pair of braces, + given the context in which it appears. + @modify Fluorine-20130401 optional arguments has been modified. + @modify Phosphorus-20170501-beta1 use proper context to determine result + *) - method private inline_block: ?has_annot:bool -> block -> bool + method private inline_block: block_ctxt -> block -> bool (** @return [true] if the given block may be inlined in a single line. [has_annot] indicates if the stmt corresponding to the block may have annotations (default is [true]). - @modify Fluorine-20130401 optional arguments has been modified. *) + @modify Fluorine-20130401 optional arguments has been modified. + @modify Phosphorus-20170501-beta1 use proper context to determine result + *) method private get_instr_terminator: unit -> string (** What terminator to print after an instruction. sometimes we want to @@ -187,11 +204,10 @@ class type extensible_printer_type = object method next_stmt : stmt -> Format.formatter -> stmt -> unit - method block: ?braces: bool -> Format.formatter -> block -> unit + method block: Format.formatter -> block -> unit (** Prints a block. - Enclose the block braces '\{' and '\}' according to the optional - argument. If it is not set, braces are put only when required. - @modify Fluorine-20130401 optional arguments has been modified. *) + @modify Fluorine-20130401 optional arguments has been modified. + @modify Phosphorus-20170501-beta1 no more options for pretty-printing *) method exp: Format.formatter -> exp -> unit (** Print expressions *) @@ -221,6 +237,7 @@ class type extensible_printer_type = object method term_lval: Format.formatter -> term_lval -> unit method model_field: Format.formatter -> model_info -> unit method term_offset: Format.formatter -> term_offset -> unit + method logic_builtin_label: Format.formatter -> logic_builtin_label -> unit method logic_label: Format.formatter -> logic_label -> unit method logic_info: Format.formatter -> logic_info -> unit method logic_var: Format.formatter -> logic_var -> unit @@ -245,23 +262,23 @@ class type extensible_printer_type = object method funspec: Format.formatter -> funspec -> unit method assigns: - string -> Format.formatter -> identified_term assigns -> unit + string -> Format.formatter -> assigns -> unit (** first parameter is the introducing keyword (e.g. loop_assigns or assigns). *) method allocation: - isloop:bool -> Format.formatter -> identified_term allocation -> unit + isloop:bool -> Format.formatter -> allocation -> unit (** first parameter is the introducing keyword (e.g. loop_allocates, loop_frees, allocates or free) @since Oxygen-20120901. *) - method from: string -> Format.formatter -> identified_term from -> unit + method from: string -> Format.formatter -> from -> unit (** prints an assignment with its dependencies. *) method code_annotation: Format.formatter -> code_annotation -> unit method global_annotation: Format.formatter -> global_annotation -> unit - method decreases: Format.formatter -> term variant -> unit - method variant: Format.formatter -> term variant -> unit + method decreases: Format.formatter -> variant -> unit + method variant: Format.formatter -> variant -> unit (* ******************************************************************* *) (** {3 Modifying pretty-printer behavior} *) @@ -390,6 +407,7 @@ module type S = sig val pp_term: Format.formatter -> term -> unit val pp_model_field: Format.formatter -> model_info -> unit val pp_term_offset: Format.formatter -> term_offset -> unit + val pp_logic_builtin_label: Format.formatter -> logic_builtin_label -> unit val pp_logic_label: Format.formatter -> logic_label -> unit val pp_predicate_node: Format.formatter -> predicate_node -> unit @@ -399,18 +417,18 @@ module type S = sig val pp_funspec: Format.formatter -> funspec -> unit val pp_behavior: Format.formatter -> funbehavior -> unit val pp_global_annotation: Format.formatter -> global_annotation -> unit - val pp_decreases: Format.formatter -> term variant -> unit - val pp_variant: Format.formatter -> term variant -> unit - val pp_from: Format.formatter -> identified_term from -> unit - val pp_assigns: Format.formatter -> identified_term assigns -> unit + val pp_decreases: Format.formatter -> variant -> unit + val pp_variant: Format.formatter -> variant -> unit + val pp_from: Format.formatter -> from -> unit + val pp_assigns: Format.formatter -> assigns -> unit - val pp_allocation: Format.formatter -> identified_term allocation -> unit + val pp_allocation: Format.formatter -> allocation -> unit (** @since Oxygen-20120901 *) - val pp_loop_from: Format.formatter -> identified_term from -> unit - val pp_loop_assigns: Format.formatter -> identified_term assigns -> unit + val pp_loop_from: Format.formatter -> from -> unit + val pp_loop_assigns: Format.formatter -> assigns -> unit - val pp_loop_allocation: Format.formatter -> identified_term allocation -> unit + val pp_loop_allocation: Format.formatter -> allocation -> unit (** @since Oxygen-20120901 *) val pp_post_cond: @@ -421,7 +439,7 @@ module type S = sig (* ********************************************************************* *) val pp_full_assigns: - string -> Format.formatter -> identified_term assigns -> unit + string -> Format.formatter -> assigns -> unit (** first parameter is the introducing keyword (e.g. loop_assigns or assigns). *) diff --git a/src/kernel_services/ast_printing/printer_builder.ml b/src/kernel_services/ast_printing/printer_builder.ml index c2524f56617f17c9c5f71b5a932e60b428f83ec4..606c0be2470e368695236b4a8d416c5b1a9e80d2 100644 --- a/src/kernel_services/ast_printing/printer_builder.ml +++ b/src/kernel_services/ast_printing/printer_builder.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -87,6 +87,7 @@ struct let pp_attributes fmt x = (printer ())#attributes fmt x let pp_instr fmt x = (printer ())#instr fmt x let pp_label fmt x = (printer ())#label fmt x + let pp_logic_builtin_label fmt x = (printer ())#logic_builtin_label fmt x let pp_logic_label fmt x = (printer ())#logic_label fmt x let pp_stmt fmt x = (printer ())#stmt fmt x let pp_block fmt x = (printer ())#block fmt x diff --git a/src/kernel_services/ast_printing/printer_builder.mli b/src/kernel_services/ast_printing/printer_builder.mli index 3a0e6a966aa4fa93b1e5782ac40ef589c4805b83..372edb78201d69365fd8e9fe692641cc204e113b 100644 --- a/src/kernel_services/ast_printing/printer_builder.mli +++ b/src/kernel_services/ast_printing/printer_builder.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_queries/ast_info.ml b/src/kernel_services/ast_queries/ast_info.ml index 971bf4404e386d768d8a50c4c9319008dfa63bbb..69d53bd00019091620f0a97e6ed0157d81644430 100644 --- a/src/kernel_services/ast_queries/ast_info.ml +++ b/src/kernel_services/ast_queries/ast_info.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -168,7 +168,7 @@ let disjoint_behaviors spec bhv_names = in do_list Logic_const.ptrue bhv_assumes -let merge_assigns_internal (get:'b -> 'c assigns) (origin:'b -> string list) +let merge_assigns_internal (get:'b -> assigns) (origin:'b -> string list) (acc:(('a*(bool * string list))*int) option) (bhvs: 'b list) = let cmp_assigns acc b = let a' = get b in @@ -442,7 +442,11 @@ let can_be_cea_function name = let is_cea_function name = Extlib.string_prefix "Frama_C_show_each" name -let is_cea_dump_function name = (name = "Frama_C_dump_each") +let is_cea_domain_function name = + Extlib.string_prefix "Frama_C_domain_show_each" name + +let is_cea_dump_function name = + Extlib.string_prefix "Frama_C_dump_each" name let is_cea_dump_file_function name = Extlib.string_prefix "Frama_C_dump_each_file" name @@ -451,6 +455,7 @@ let is_frama_c_builtin n = can_be_cea_function n && (is_cea_dump_function n || is_cea_function n || + is_cea_domain_function n || is_cea_dump_file_function n) let () = Cil.add_special_builtin_family is_frama_c_builtin diff --git a/src/kernel_services/ast_queries/ast_info.mli b/src/kernel_services/ast_queries/ast_info.mli index c68e4c0a8dcc0091f2e5548469a459a75197e5da..ff093a26ac12ab725b0be878aba25e3c98d609fd 100644 --- a/src/kernel_services/ast_queries/ast_info.mli +++ b/src/kernel_services/ast_queries/ast_info.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -90,8 +90,8 @@ val complete_behaviors : funspec -> string list -> predicate @since Nitrogen-20111001 *) val merge_assigns_from_complete_bhvs: - ?warn:bool -> ?unguarded:bool -> funbehavior list -> string list list -> identified_term assigns - (** @return the assigns of an unguarded behavior (when [unguarded]=true) + ?warn:bool -> ?unguarded:bool -> funbehavior list -> string list list -> assigns + (** @return the assigns of an unguarded behavior (when [unguarded]=true) or a set of complete behaviors. - the funbehaviors can come from either a statement contract or a function contract. @@ -101,14 +101,14 @@ val merge_assigns_from_complete_bhvs: warnings. @since Oxygen-20120901 *) -val merge_assigns_from_spec: ?warn:bool -> funspec -> identified_term assigns +val merge_assigns_from_spec: ?warn:bool -> funspec -> assigns (** It is a shortcut for [merge_assigns_from_complete_bhvs spec.spec_complete_behaviors spec.spec_behavior]. Optional [warn] argument can be used to force emitting or cancelation of warnings @return the assigns of an unguarded behavior or a set of complete behaviors. @since Oxygen-20120901 *) -val merge_assigns: ?warn:bool -> funbehavior list -> identified_term assigns +val merge_assigns: ?warn:bool -> funbehavior list -> assigns (** Returns the assigns of an unguarded behavior. @modify Oxygen-20120901 Optional [warn] argument added which can be used to force emitting or cancelation of warnings. *) @@ -181,6 +181,7 @@ end val can_be_cea_function : string -> bool val is_cea_function : string -> bool +val is_cea_domain_function : string -> bool val is_cea_dump_function : string -> bool val is_cea_dump_file_function : string -> bool val is_frama_c_builtin : string -> bool diff --git a/src/kernel_services/ast_queries/cil.ml b/src/kernel_services/ast_queries/cil.ml index 77ae52aa0d0af8c3b93e469d7b5dab16b0be7123..420e443ebab4ee9fcca20f066afe6555892f52d2 100644 --- a/src/kernel_services/ast_queries/cil.ml +++ b/src/kernel_services/ast_queries/cil.ml @@ -261,7 +261,9 @@ let rec addOffset (toadd: offset) (off: offset) : offset = | Index(e, offset) -> Index(e, addOffset toadd offset) let mkBlock (slst: stmt list) : block = - { battrs = []; bstmts = slst; blocals = []} + { battrs = []; bstmts = slst; blocals = []; bscoping = true } + +let mkBlockNonScoping l = let b = mkBlock l in b.bscoping <- false; b let mkStmt ?(ghost=false) ?(valid_sid=false) (sk: stmtkind) : stmt = { skind = sk; @@ -274,15 +276,12 @@ let mkStmt ?(ghost=false) ?(valid_sid=false) (sk: stmtkind) : stmt = succs = []; preds = []; ghost = ghost} - let stmt_of_instr_list ?(loc=Location.unknown) = function +let stmt_of_instr_list ?(loc=Location.unknown) = function | [] -> Instr (Skip loc) | [i] -> Instr i | il -> - let b = mkBlock (List.map (fun i -> mkStmt (Instr i)) il) in - match b.bstmts with - | [] -> Instr (Skip loc) - | [s] when b.battrs = [] -> s.skind - | _ -> Block b + let b = mkBlockNonScoping (List.map (fun i -> mkStmt (Instr i)) il) in + Block b (**** Utility functions ******) @@ -564,7 +563,6 @@ type attributeClass = (* Make a varinfo. Used mostly as a helper function below *) let makeVarinfo ?(source=true) ?(temp=false) global formal name typ = - (* Strip const from type for locals *) let vi = { vorig_name = name; vname = name; @@ -573,8 +571,7 @@ type attributeClass = vdefined = false; vformal = formal; vtemp = temp; - vtype = if formal || global then typ - else typeRemoveAttributes ["const"] typ; + vtype = typ; vdecl = Location.unknown; vinline = false; vattr = []; @@ -596,7 +593,7 @@ type attributeClass = (Varinfo.Hashtbl) (Datatype.List(Varinfo)) (struct - let name = "FormalsDecl" + let name = "Cil.FormalsDecl" let dependencies = [] (* depends on Ast.self; see below *) let size = 47 end) @@ -1712,6 +1709,9 @@ class type cilVisitor = object (** Initializers for globals, * pass the global where this * occurs, and the offset *) + + method vlocal_init: varinfo -> local_init -> local_init visitAction + method vtype: typ -> typ visitAction (** Use of some type. Note * that for structure/union * and enumeration types the @@ -1800,25 +1800,25 @@ class type cilVisitor = object method vspec: funspec -> funspec visitAction method vassigns: - identified_term assigns -> identified_term assigns visitAction + assigns -> assigns visitAction method vfrees: identified_term list -> identified_term list visitAction method vallocates: identified_term list -> identified_term list visitAction method vallocation: - identified_term allocation -> identified_term allocation visitAction + allocation -> allocation visitAction - method vloop_pragma: term loop_pragma -> term loop_pragma visitAction + method vloop_pragma: loop_pragma -> loop_pragma visitAction - method vslice_pragma: term slice_pragma -> term slice_pragma visitAction - method vimpact_pragma: term impact_pragma -> term impact_pragma visitAction + method vslice_pragma: slice_pragma -> slice_pragma visitAction + method vimpact_pragma: impact_pragma -> impact_pragma visitAction method vdeps: - identified_term deps -> identified_term deps visitAction + deps -> deps visitAction method vfrom: - identified_term from -> identified_term from visitAction + from -> from visitAction method vcode_annot: code_annotation -> code_annotation visitAction @@ -1874,6 +1874,7 @@ end method vfunc (_f:fundec) = DoChildren method vglob (_g:global) = DoChildren method vinit (_forg: varinfo) (_off: offset) (_i:init) = DoChildren + method vlocal_init _ _ = DoChildren method vtype (_t:typ) = DoChildren method vcompinfo _ = DoChildren method venuminfo _ = DoChildren @@ -1979,11 +1980,87 @@ let assertEmptyQueue vis = (* Either a visitor inserted an instruction somewhere that it shouldn't have (i.e. at the top level rather than inside of a statement), or there's a bug in the visitor engine. *) - Kernel.fatal + Kernel.fatal "Visitor's instruction queue is not empty.@\n\ You should only use queueInstr inside a function body!"; () +let vis_tmp_attr = "FRAMAC_VIS_TMP_ATTR" + +let transient_block b = + if b.blocals <> [] then + Kernel.fatal + "Attempting to mark as transient a block that declares local variables"; + b.battrs <- addAttribute (Attr (vis_tmp_attr,[])) b.battrs; b + +let block_of_transient b = + if hasAttribute vis_tmp_attr b.battrs then begin + if b.blocals <> [] then + Kernel.fatal + "Block that is supposed to be transient declares local variabels"; + b.battrs <- dropAttribute vis_tmp_attr b.battrs; + b.bscoping <- false + end; + b + +let is_transient_block b = hasAttribute vis_tmp_attr b.battrs + +let flatten_transient_sub_blocks b = + let prev = ref None in + let previous_is_annot () = + match !prev with + | None -> false + | Some { + skind = + Instr (Code_annot ({ annot_content = AStmtSpec _ | APragma _}, _))} + -> true + | Some _ -> false + in + let treat_one_stmt s = + match s.skind with + | Block b when is_transient_block b -> + if previous_is_annot () then begin + s.skind <- Block (block_of_transient b); + prev := Some s; + [ s ] + end else begin + match s.labels, b.bstmts with + | [], _ -> prev:= None; b.bstmts + | _, [] -> + (* Empty block, but we have a label attached to the statement, so + that it is difficult to get rid of it (see below). Replace with + a Skip. + *) + s.skind <- Instr (Skip (Cil_datatype.Stmt.loc s)); + prev:=Some s; + [s] + | _, s'::tl when s'.labels = [] -> + (* res is the target of a label (either goto or case). Removing the + block would imply updating the origin of the jump, which is + quite complicated at this point. On the other hand, since s' is + not referred to elsewhere, we can just put its skind in place of + the block, and return the list. *) + s.skind <- s'.skind; + prev:=None; + s :: tl + | _ -> + (* both the block and the first statement have labels. Just keep + the block. *) + s.skind <- Block (block_of_transient b); + prev:=Some s; + [s] + end + | _ -> prev:= Some s; [ s ] + in + b.bstmts <- List.concat (List.map treat_one_stmt b.bstmts); + b + +let stmt_of_instr_list_visitor ?loc l = + let res = stmt_of_instr_list ?loc l in + match res with + | Block b -> Block (transient_block b) + | _ -> res + (*** Define the visiting engine ****) (* visit all the nodes in a Cil expression *) let doVisit (vis: 'visitor) @@ -2112,7 +2189,8 @@ let copy_logic_label is_copy l = if is_copy then begin match l with | StmtLabel s -> StmtLabel (ref !s) - | LogicLabel(_,s) -> LogicLabel(None,s) + | FormalLabel s -> FormalLabel s + | BuiltinLabel (_,s) -> BuiltinLabel (None,s) (* we don't copy the associated statement. It will be recomputed if needed. *) end else l @@ -2177,7 +2255,7 @@ and childrenTermNode vis tn = | Tapp(li,labels,args) -> let li' = vLogicInfo li in let labels' = - mapNoCopy (visitCilLogicLabelApp vis) labels in + mapNoCopy (visitCilLogicLabel vis) labels in (* Format.eprintf "Cil.children_term_node: li = %s(%d), li' = %s(%d)@." li.l_var_info.lv_name li.l_var_info.lv_id @@ -2270,12 +2348,7 @@ and visitCilLogicLabel vis l = and childrenLogicLabel vis l = match l with StmtLabel s -> s := vis#behavior.get_stmt !s; l - | LogicLabel _ -> l - -and visitCilLogicLabelApp vis (l1,l2 as p) = - let l1' = visitCilLogicLabel vis l1 in - let l2' = visitCilLogicLabel vis l2 in - if l1 != l1' || l2 != l2' then (l1',l2') else p + | FormalLabel _ | BuiltinLabel _ -> l and visitCilTermLval vis tl = doVisitCil vis id vis#vterm_lval childrenTermLval tl @@ -2512,7 +2585,7 @@ and visitCilLogicLabelApp vis (l1,l2 as p) = Pfalse | Ptrue -> p | Papp (pred,labels,args) -> let pred' = vLogicInfo pred in - let labels' = mapNoCopy (visitCilLogicLabelApp vis) labels in + let labels' = mapNoCopy (visitCilLogicLabel vis) labels in let args' = mapNoCopy vTerm args in if pred' != pred || labels' != labels || args' != args then Papp(pred',labels',args') @@ -3022,6 +3095,19 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp = and visitCilInitOffset (vis: cilVisitor) (off: offset) : offset = doVisitCil vis id vis#vinitoffs childrenOffset off + and visitCilLocal_init (vis: cilVisitor) vi li = + doVisitCil vis id (vis#vlocal_init vi) (childrenLocal_init vi) li + + and childrenLocal_init vi (vis: cilVisitor) li = + match li with + | AssignInit i -> + let i' = visitCilInit vis vi NoOffset i in + if i != i' then AssignInit i' else li + | ConsInit(f,args, k) -> + let f' = visitCilVarUse vis f in + let args' = mapNoCopy (visitCilExpr vis) args in + if f' != f || args' != args then ConsInit(f',args',k) else li + and visitCilInstr (vis: cilVisitor) (i: instr) : instr list = let oldloc = CurrentLoc.get () in CurrentLoc.set (Cil_datatype.Instr.loc i); @@ -3038,6 +3124,12 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp = match i with | Skip _l -> i + | Local_init (vi, li, l) -> + let vi' = visitCilVarUse vis vi in + let li' = visitCilLocal_init vis vi' li in + if vi' != vi || li' != li then + Local_init(vi', li', l) + else i | Set(lv,e,l) -> let lv' = fLval lv in let e' = fExp e in if lv' != lv || e' != e then Set(lv',e',l) else i @@ -3098,11 +3190,14 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp = (match !toPrepend with [] -> () (* Return the same statement *) | _ -> - (* Make our statement contain the instructions to prepend *) - res.skind <- - Block (mkBlock - ((List.map (fun i -> mkStmt (Instr i)) !toPrepend) @ - [ mkStmt res.skind ] ))); + let b = + mkBlockNonScoping + ((List.map (fun i -> mkStmt (Instr i)) !toPrepend) + @ [mkStmt res.skind]) + in + b.battrs <- addAttribute (Attr (vis_tmp_attr, [])) b.battrs; + (* Make our statement contain the instructions to prepend *) + res.skind <- Block b); CurrentLoc.set oldloc; vis#pop_stmt s; res @@ -3121,6 +3216,9 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp = mapNoCopy (function (stmt,modified,writes,reads,calls) as orig-> let stmt' = visitCilStmt vis stmt in + (match stmt'.skind with + | Block b -> b.battrs <- dropAttribute vis_tmp_attr b.battrs; + | _ -> ()); (* might make sense for the default to be to just copy the varinfo when using the copy visitor, and not apply vvrbl, i.e. not using vis but generic_visitor ? @@ -3175,7 +3273,7 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp = | Instr i -> begin match fInst i with | [i'] when i' == i -> s.skind - | il -> stmt_of_instr_list ~loc:(Cil_datatype.Instr.loc i) il + | il -> stmt_of_instr_list_visitor ~loc:(Cil_datatype.Instr.loc i) il end | Block b -> let b' = fBlock b in @@ -3248,15 +3346,29 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp = if v != v' || l != l' then Catch_exn(v',l') else cb | Catch_all -> cb and visitCilBlock (vis: cilVisitor) (b: block) : block = - doVisitCil vis vis#behavior.cblock vis#vblock childrenBlock b + let b' = vis#behavior.cblock b in + if vis#behavior.is_copy_behavior then begin + (* in case we are the main block of the current function, + update immediately the sbody, so that makeLocalVar can be used + seamlessly by the underlying visitor and associate the + local variable to the appropriate sbody when no inner block is present. + *) + match vis#current_func with + | Some fd when fd.sbody == b -> + (get_fundec vis#behavior fd).sbody <- b' + | Some _ | None -> () + end; + doVisitCil vis id vis#vblock childrenBlock b' and childrenBlock (vis: cilVisitor) (b: block) : block = let fStmt s = visitCilStmt vis s in let stmts' = mapNoCopy fStmt b.bstmts in let locals' = mapNoCopy (vis#behavior.get_varinfo) b.blocals in - if stmts' != b.bstmts || locals' != b.blocals then - { battrs = b.battrs; bstmts = stmts'; blocals = locals' } - else b - + let res = + if stmts' != b.bstmts || locals' != b.blocals then + { battrs=b.battrs; bstmts=stmts'; blocals=locals'; bscoping=b.bscoping } + else b + in + flatten_transient_sub_blocks res and visitCilType (vis : cilVisitor) (t : typ) : typ = doVisitCil vis id vis#vtype childrenType t @@ -4058,7 +4170,7 @@ let parseIntExp ~loc repr = body let block_from_unspecified_sequence us = - { battrs = []; bstmts = List.map (fun (x,_,_,_,_) ->x) us; blocals = [] } + mkBlock (List.map (fun (x,_,_,_,_) ->x) us) let rec stripCasts (e: exp) = match e.enode with CastE(_, e') -> stripCasts e' | _ -> e @@ -4437,7 +4549,22 @@ let isCharPtrType t = try visit ty; false with Exit -> true - + (**** Check for volatile attribute ****) + + let isVolatileType typ_lval = typeHasAttributeDeep "volatile" typ_lval + + let rec isVolatileLogicType = function + | Ctype typ -> isVolatileType typ + | Linteger | Lreal | Lvar _ | Larrow _ -> false + | Ltype( { lt_def } ,_) -> + match lt_def with + | None | Some (LTsum _) -> false + | Some (LTsyn lt) -> isVolatileLogicType lt + + let isVolatileLval lv = isVolatileType (typeOfLval lv) + let isVolatileTermLval lv = + Logic_const.plain_or_set isVolatileLogicType (typeOfTermLval lv) + (** ** ** MACHINE DEPENDENT PART @@ -5830,64 +5957,6 @@ let need_cast ?(force=false) oldt newt = ik <> e.ekind | _ -> true) -(* Strip the "const" from the type. It is unfortunate that const variables can - only be set in initialization. Once we decided to move all declarations to - the top of the functions, we have no way of setting a "const" - variable. Furthermore, if the type of the variable is an array or a struct - we must recursively strip the "const" from fields and array elements. *) - let rec stripConstLocalType (t: typ) : typ = - let dc a = - if hasAttribute "const" a then - dropAttribute "const" a - else a - in - match t with - | TPtr (bt, a) -> - (* We want to be able to detect by pointer equality if the type has - * changed. So, don't realloc the type unless necessary. *) - let a' = dc a in if a != a' then TPtr(bt, a') else t - | TInt (ik, a) -> - let a' = dc a in if a != a' then TInt(ik, a') else t - | TFloat(fk, a) -> - let a' = dc a in if a != a' then TFloat(fk, a') else t - | TNamed (ti, a) -> - (* We must go and drop the consts from the typeinfo as well ! *) - let t' = stripConstLocalType ti.ttype in - if t != t' then begin - (* ignore (warn "Stripping \"const\" from typedef %s\n" ti.tname); *) - ti.ttype <- t' - end; - let a' = dc a in if a != a' then TNamed(ti, a') else t - - | TEnum (ei, a) -> - let a' = dc a in if a != a' then TEnum(ei, a') else t - - | TArray(bt, leno, _, a) -> - (* We never assign to the array. So, no need to change the const. But - * we must change it on the base type *) - let bt' = stripConstLocalType bt in - if bt' != bt then TArray(bt', leno, empty_size_cache (), a) else t - - | TComp(ci, _, a) -> - (* Must change both this structure as well as its fields *) - List.iter - (fun f -> - let t' = stripConstLocalType f.ftype in - if t' != f.ftype then begin - Kernel.debug ~level:3 "Stripping \"const\" from field %s of %s\n" - f.fname (compFullName ci) ; - f.ftype <- t' - end) - ci.cfields; - let a' = dc a in if a != a' then TComp(ci, empty_size_cache (), a') else t - - (* We never assign functions either *) - | TFun(_rt, _args, _va, _a) -> t - | TVoid _ -> (* this may happen with temporary used only for their sizeof. *) - t - | TBuiltin_va_list a -> - let a' = dc a in if a != a' then TBuiltin_va_list a' else t - let cvar_to_lvar vi = match vi.vlogic_var_assoc with | None -> let lv = @@ -5932,7 +6001,6 @@ let need_cast ?(force=false) oldt newt = (* Make a local variable and add it to a function *) let makeLocalVar fdec ?scope ?(temp=false) ?(insert = true) name typ = - let typ = stripConstLocalType typ in let vi = makeLocal ~temp fdec name typ in if insert then begin @@ -6023,15 +6091,19 @@ let need_cast ?(force=false) oldt newt = let makeGlobalVar ?source ?temp name typ = makeVarinfo ?source ?temp true false name typ - let mkPureExpr ?(ghost:bool = false) ~(fundec:fundec) ?(loc=Location.unknown) - (e : exp) : stmt = + let mkPureExprInstr ~fundec ~scope ?loc e = + let loc = match loc with None -> e.eloc | Some l -> l in let typ = typeOf e in let descr = Format.asprintf "%a" !pp_exp_ref e in - let scope = mkBlock [] in - let temp = true in - let tmp = makeLocalVar ~temp ~scope fundec "tmp" typ in + let tmp = makeLocalVar ~temp:true ~scope fundec "tmp" typ in tmp.vdescr <- Some descr; - scope.bstmts <- [ mkStmtOneInstr ~ghost (Set(var tmp, e, loc)) ]; + tmp.vdefined <- true; + Local_init(tmp, AssignInit (SingleInit e), loc) + + let mkPureExpr ?(ghost:bool = false) ~(fundec:fundec) ?loc (e : exp) : stmt = + let scope = mkBlock [] in + let instr = mkPureExprInstr ~fundec ~scope ?loc e in + scope.bstmts <- [ mkStmtOneInstr ~ghost instr]; mkStmt (Block scope) let emptyFunctionFromVI vi = @@ -6411,7 +6483,7 @@ let childrenFileSameGlobals vis f = | Some [] -> doUnspecifiedStmtList rest | Some (hd::tl) -> let call s = match s.skind with - | Instr(Call _ ) -> [ref s] + | Instr(Call _ | Local_init (_, ConsInit _, _)) -> [ref s] | _ -> [] in let res = @@ -6496,6 +6568,47 @@ let childrenFileSameGlobals vis f = d_plainexp addr d_plainoffset off d_plainexp res); *) res + let treat_constructor_as_func action v f args kind loc = + let lv, args = + match kind with + | Plain_func -> Some (var v), args + | Constructor -> None, mkAddrOfVi v :: args + in + action lv (evar f) args loc + + let fold_local_init b f acc = + let rec find_stmt acc s = + match s.skind with + | Instr(Local_init(v',i,l)) -> f s (v',i,l) acc + | UnspecifiedSequence l -> List.fold_left find_stmt_seq acc l + | Block b when not b.bscoping -> List.fold_left find_stmt acc b.bstmts + | _ -> acc + and find_stmt_seq acc (s, _, _, _, _) = find_stmt acc s + in + List.fold_left find_stmt acc b.bstmts + + let find_def_stmt b v = + if not (v.vdefined && List.exists (Cil_datatype.Varinfo.equal v) b.blocals) + then Kernel.fatal "inconsistent arguments for find_def_stmt"; + let module M = struct exception Found of stmt end in + let action s (v',_,_) () = + if Cil_datatype.Varinfo.equal v v' then raise (M.Found s) else () + in + try + fold_local_init b action (); + Kernel.fatal ~source:(fst v.vdecl) + "inconsistent AST: local variable %a is supposed to be initialized, \ + but no initialization statement found." Cil_datatype.Varinfo.pretty v + with M.Found s -> s + + let has_extern_local_init b = + (* a scoping block defines all the locals inside it.*) + if b.bscoping then false + else begin + let action _ _ () = raise Exit in + try fold_local_init b action (); false with Exit -> true + end + let splitFunctionType (ftype: typ) : typ * (string * typ * attributes) list option * bool * attributes = match unrollType ftype with @@ -6509,24 +6622,30 @@ let childrenFileSameGlobals vis f = TFun (rt, args, isva, a) -> rt, args, isva, a | _ -> Kernel.abort "Function %s invoked on a non function type" fvi.vname - let rec integralPromotion ?(forComparison=false) (t : typ) : typ = (* c.f. ISO 6.3.1.1 *) + let remove_attributes_for_integral_promotion a = + dropAttributes (bitfield_attribute_name :: spare_attributes_for_c_cast) a + + let rec integralPromotion t = (* c.f. ISO 6.3.1.1 *) match unrollType t with - | TInt ((IShort|ISChar|IBool), a) -> TInt(IInt, a) - | TInt (IUChar|IUShort as k, a) -> - if bitsSizeOfInt k < bitsSizeOf intType then + | TInt ((IShort|ISChar|IBool), a) -> + let a = remove_attributes_for_integral_promotion a in + TInt(IInt, a) + | TInt (IUChar|IUShort as k, a) -> + let a = remove_attributes_for_integral_promotion a in + if bitsSizeOfInt k < bitsSizeOf intType then TInt(IInt, a) else TInt(IUInt,a) | TInt (IChar,a) -> let k = if isSigned IChar then ISChar else IUChar in - integralPromotion ~forComparison (TInt (k, a)) + integralPromotion (TInt (k, a)) | TInt (k,a) -> begin match findAttribute bitfield_attribute_name a with | [AInt size] -> (* This attribute always fits in int. *) let size = Integer.to_int size in let sizeofint = bitsSizeOf intType in - let attrs = dropAttribute bitfield_attribute_name a in + let attrs = remove_attributes_for_integral_promotion a in let kind = if size < sizeofint then IInt else if size = sizeofint then @@ -6538,17 +6657,10 @@ let childrenFileSameGlobals vis f = | [] -> t | _ -> assert false end - | TEnum (ei, a) -> let r = integralPromotion (TInt(ei.ekind, a)) in - if forComparison then - (match r with - | TInt(kind,_) -> if kind <> ei.ekind then r else t - | t -> Kernel.fatal ~current:true "integralPromotion: not expecting %a" !pp_typ_ref t) - else r - (* gcc packed enums can be < int *) + | TEnum (ei, a) -> (* gcc packed enums can be < int *) + integralPromotion (TInt(ei.ekind, a)) | t -> Kernel.fatal ~current:true "integralPromotion: not expecting %a" !pp_typ_ref t - let integralPromotion (t : typ) : typ = integralPromotion t - let arithmeticConversion t1 t2 = (* c.f. ISO 6.3.1.8 *) let checkToInt _ = () in (* dummies for now *) let checkToFloat _ = () in @@ -6845,18 +6957,12 @@ let rec makeZeroInit ~loc (t: typ) : init = in CompoundInit (t', inits) | TComp (comp, _, _) when not comp.cstruct -> - let fstfield, _rest = - match comp.cfields with - f :: rest -> f, rest - | [] -> Kernel.fatal ~current:true "Cannot create init for empty union" - in - let fieldToInit = - (* ISO C99 [6.7.8.10] says that the first field of the union - is the one we should initialize. *) - fstfield - in - CompoundInit(t, [(Field(fieldToInit, NoOffset), - makeZeroInit ~loc fieldToInit.ftype)]) + (match comp.cfields with + | [] -> CompoundInit(t, []) (* tolerate empty initialization. *) + | f :: _rest -> + (* ISO C99 [6.7.8.10] says that the first field of the union + is the one we should initialize. *) + CompoundInit(t, [(Field(f, NoOffset), makeZeroInit ~loc f.ftype)])) | TArray(bt, Some len, _, _) as t' -> let n = match constFoldToInt len with @@ -7507,11 +7613,12 @@ let extract_labels_from_pred pred = let extract_stmts_from_labels labels = - Logic_label.Set.fold + Logic_label.Set.fold (fun l a -> match l with | StmtLabel (stmt) -> Stmt.Set.add !stmt a - | LogicLabel (Some (stmt), _str) -> Stmt.Set.add stmt a - | LogicLabel (None, _str) -> a) + | BuiltinLabel (Some stmt, _l) -> Stmt.Set.add stmt a + | FormalLabel _ -> a + | BuiltinLabel (None, _) -> a) labels Stmt.Set.empty let close_predicate p = diff --git a/src/kernel_services/ast_queries/cil.mli b/src/kernel_services/ast_queries/cil.mli index c494e12c6a7fb9f8320cb8e55d7f13ca6946b35d..7431ea6f31e0c9881ec333352d5aa440d2766e6e 100644 --- a/src/kernel_services/ast_queries/cil.mli +++ b/src/kernel_services/ast_queries/cil.mli @@ -77,7 +77,7 @@ val is_special_builtin: string -> bool (** @return [true] if the given name refers to a special built-in function. A special built-in function can have any number of arguments. It is up to the plug-ins to know what to do with it. - @since Boron-20100401-dev *) + @since Carbon-20101201 *) (** register a new special built-in function *) val add_special_builtin: string -> unit @@ -177,13 +177,6 @@ val setFunctionTypeMakeFormals: fundec -> typ -> unit * {!Cil.makeTempVar}. *) val setMaxId: fundec -> unit -(** Strip const attribute from the type. This is useful for - any type used as the type of a local variable which may be assigned. - Note that the type attributes are mutated in place. - @since Nitrogen-20111001 -*) -val stripConstLocalType : Cil_types.typ -> Cil_types.typ - val selfFormalsDecl: State.t (** state of the table associating formals to each prototype. *) @@ -321,15 +314,15 @@ val makeZeroInit: loc:location -> typ -> init * This is a good way to use it to scan even nested initializers : {v let rec myInit (lv: lval) (i: init) (acc: 'a) : 'a = - match i with - SingleInit e -> ... do something with lv and e and acc ... + match i with + | SingleInit e -> (* ... do something with [lv] and [e] and [acc] ... *) | CompoundInit (ct, initl) -> foldLeftCompound ~implicit:false - ~doinit:(fun off' i' t' acc -> - myInit (addOffsetLval lv off') i' acc) - ~ct:ct - ~initl:initl - ~acc:acc + ~doinit:(fun off' i' _typ acc' -> + myInit (addOffsetLval off' lv) i' acc') + ~ct + ~initl + ~acc v} *) val foldLeftCompound: @@ -647,10 +640,6 @@ val makeFormalVar: fundec -> ?where:string -> string -> typ -> varinfo Make sure you know what you are doing if you set [insert=false]. [temp] is passed to {!Cil.makeVarinfo}. The variable is attached to the toplevel block if [scope] is not specified. - - @since Nitrogen-20111001 This function will strip const attributes - of its type in place in order for local variable to be assignable at - least once. *) val makeLocalVar: fundec -> ?scope:block -> ?temp:bool -> ?insert:bool @@ -968,6 +957,14 @@ val mkStmtCfg: before:bool -> new_stmtkind:stmtkind -> ref_stmt:stmt -> stmt (** Construct a block with no attributes, given a list of statements *) val mkBlock: stmt list -> block +(** Construct a non-scoping block, i.e. a block that is not used to determine + the end of scope of local variables. Hence, the blocals of such a block + must always be empty. + + @since Phosphorus-20170501-beta1 +*) +val mkBlockNonScoping: stmt list -> block + (** Construct a block with no attributes, given a list of statements and wrap it into the Cfg. *) val mkStmtCfgBlock: stmt list -> stmt @@ -993,11 +990,22 @@ val dummyInstr: instr @plugin development guide *) val dummyStmt: stmt -(** Make a statement equivalent to a pure expression, 'exp;'. Despite doing - nothing, this statement implies that it is valid to read 'exp' and - therefore has consequences on program verification. - The statement is build as 'tmp = exp;' where tmp is a new fresh - variable. *) +(** Create an instruction equivalent to a pure expression. The new instruction + corresponds to the initialization of a new fresh variable, i.e. + [int tmp = exp]. The scope of this fresh variable + is determined by the block given in argument, that is the instruction + must be placed directly (modulo non-scoping blocks) inside this block. +*) +val mkPureExprInstr: + fundec:fundec -> scope:block -> ?loc:location -> exp -> instr + +(** Create an instruction as above, enclosed in a block + of a single ([Instr]) statement, which will be the scope of the fresh + variable holding the value of the expression. + + As usual, [ghost] defaults to [false]. [loc] defaults to the location of + the expression itself. +*) val mkPureExpr: ?ghost:bool -> fundec:fundec -> ?loc:location -> exp -> stmt (** Make a while loop. Can contain Break or Continue *) @@ -1019,6 +1027,32 @@ val mkFor: start:stmt list -> guard:exp -> next: stmt list -> val block_from_unspecified_sequence: (stmt * lval list * lval list * lval list * stmt ref list) list -> block +(** [treat_constructor_as_func action v f args kind loc] calls [action] with + the parameters corresponding to the call to [f], of kind [kind], + initializing [v] with arguments [args]. + @since Phosphorus-20170501-beta1 +*) +val treat_constructor_as_func: + (lval option -> exp -> exp list -> location -> 'a) -> + varinfo -> varinfo -> exp list -> constructor_kind -> location -> 'a + +(** [find_def_stmt b v] returns the [Local_init] instruction within [b] that + initializes [v]. [v] must have its [vdefined] field set to true, and be + among [b.blocals]. + @raise Fatal error if [v] is not a local variable of [b] with an + initializer. + @since Phosphorus-20170501-beta1 +*) +val find_def_stmt: block -> varinfo -> stmt + +(** returns [true] iff the given non-scoping block contains local init + statements (thus of locals belonging to an outer block), either directly or + within a non-scoping block or undefined sequence.labels + + @since Phosphorus-20170501-beta1 +*) +val has_extern_local_init: block -> bool + (* ************************************************************************* *) (** {2 Values for manipulating attributes} *) (* ************************************************************************* *) @@ -1184,6 +1218,26 @@ val expToAttrParam: exp -> attrparam exception NotAnAttrParam of exp +(* ************************************************************************* *) +(** {2 Volatile Attribute} *) +(* ************************************************************************* *) + +val isVolatileType : typ -> bool +(** Check for ["volatile"] qualifier from the type of an l-value (do not follow pointer) + @since Frama-C+dev *) + +val isVolatileLogicType : logic_type -> bool +(** Check for ["volatile"] qualifier from a logic type + @since Frama-C+dev *) + +val isVolatileLval : lval -> bool +(** Check if the l-value has a volatile part + @since Frama-C+dev *) + +val isVolatileTermLval : term_lval -> bool +(** Check if the l-value has a volatile part + @since Frama-C+dev *) + (* ************************************************************************* *) (** {2 The visitor} *) (* ************************************************************************* *) @@ -1223,8 +1277,8 @@ val mk_behavior : ?assumes:identified_predicate list -> ?requires:identified_predicate list -> ?post_cond:(termination_kind * identified_predicate) list -> - ?assigns:identified_term Cil_types.assigns -> - ?allocation:identified_term Cil_types.allocation -> + ?assigns:Cil_types.assigns -> + ?allocation:Cil_types.allocation -> ?extended:acsl_extension list -> unit -> Cil_types.behavior @@ -1274,7 +1328,7 @@ val refresh_visit: Project.t -> visitor_behavior varinfo that are declared in the scope of the visit will be copied and provided with a new id. @since Sodium-20150201 - *) + *) (** true iff the behavior provides fresh id for copied structs with id. Always [false] for an inplace visitor. @@ -1288,7 +1342,9 @@ val is_copy_behavior: visitor_behavior -> bool val reset_behavior_varinfo: visitor_behavior -> unit (** resets the internal tables used by the given visitor_behavior. If you use fresh instances of visitor for each round of transformation, this should - not be needed. In place modifications do not need that at all. *) + not be needed. In place modifications do not need that at all. + @plugin development guide + *) val reset_behavior_compinfo: visitor_behavior -> unit val reset_behavior_enuminfo: visitor_behavior -> unit @@ -1305,7 +1361,9 @@ val reset_behavior_fundec: visitor_behavior -> unit val get_varinfo: visitor_behavior -> varinfo -> varinfo (** retrieve the representative of a given varinfo in the current - state of the visitor *) + state of the visitor + @plugin development guide + *) val get_compinfo: visitor_behavior -> compinfo -> compinfo val get_enuminfo: visitor_behavior -> enuminfo -> enuminfo @@ -1326,7 +1384,9 @@ val get_fundec: visitor_behavior -> fundec -> fundec val get_original_varinfo: visitor_behavior -> varinfo -> varinfo (** retrieve the original representative of a given copy of a varinfo - in the current state of the visitor. *) + in the current state of the visitor. + @plugin development guide + *) val get_original_compinfo: visitor_behavior -> compinfo -> compinfo val get_original_enuminfo: visitor_behavior -> enuminfo -> enuminfo @@ -1347,6 +1407,7 @@ val set_varinfo: visitor_behavior -> varinfo -> varinfo -> unit (** change the representative of a given varinfo in the current state of the visitor. Use with care (i.e. makes sure that the old one is not referenced anywhere in the AST, or sharing will be lost. + @plugin development guide *) val set_compinfo: visitor_behavior -> compinfo -> compinfo -> unit val set_enuminfo: visitor_behavior -> enuminfo -> enuminfo -> unit @@ -1555,8 +1616,10 @@ class type cilVisitor = object @plugin development guide *) method vinit: varinfo -> offset -> init -> init visitAction - (** Initializers for globals, pass the global where this occurs, and the - offset *) + (** Initializers. Pass the global where this occurs, and the offset *) + + method vlocal_init: varinfo -> local_init -> local_init visitAction + (** local initializer. pass the variable under initialization. *) method vtype: typ -> typ visitAction (** Use of some type. For typedef, struct, union and enum, the visit is @@ -1657,8 +1720,7 @@ class type cilVisitor = object method vpredicate: predicate -> predicate visitAction method vbehavior: funbehavior -> funbehavior visitAction method vspec: funspec -> funspec visitAction - method vassigns: - identified_term assigns -> identified_term assigns visitAction + method vassigns: assigns -> assigns visitAction method vfrees: identified_term list -> identified_term list visitAction @@ -1668,16 +1730,15 @@ class type cilVisitor = object identified_term list -> identified_term list visitAction (** @since Oxygen-20120901 *) - method vallocation: - identified_term allocation -> identified_term allocation visitAction + method vallocation: allocation -> allocation visitAction (** @since Oxygen-20120901 *) - method vloop_pragma: term loop_pragma -> term loop_pragma visitAction - method vslice_pragma: term slice_pragma -> term slice_pragma visitAction - method vimpact_pragma: term impact_pragma -> term impact_pragma visitAction + method vloop_pragma: loop_pragma -> loop_pragma visitAction + method vslice_pragma: slice_pragma -> slice_pragma visitAction + method vimpact_pragma: impact_pragma -> impact_pragma visitAction - method vdeps: identified_term deps -> identified_term deps visitAction - method vfrom: identified_term from -> identified_term from visitAction + method vdeps: deps -> deps visitAction + method vfrom: from -> from visitAction method vcode_annot: code_annotation -> code_annotation visitAction method vannotation: global_annotation -> global_annotation visitAction @@ -1790,6 +1851,9 @@ val visitCilOffset: cilVisitor -> offset -> offset (** Visit an initializer offset *) val visitCilInitOffset: cilVisitor -> offset -> offset +(** Visit a local initializer (with the local being initialized). *) +val visitCilLocal_init: cilVisitor -> varinfo -> local_init -> local_init + (** Visit an instruction *) val visitCilInstr: cilVisitor -> instr -> instr list @@ -1799,6 +1863,47 @@ val visitCilStmt: cilVisitor -> stmt -> stmt (** Visit a block *) val visitCilBlock: cilVisitor -> block -> block +(** Mark the given block as candidate to be flattened into its parent block, + after returning from its visit. This is not systematic, as the environment + might prevent it (e.g. if the preceding statement is a statement contract + or a slicing/pragma annotation, or if there are labels involved). Use + that whenever you're creating a block in order to hold multiple statements + as a result of visiting a single statement. + + @raise Fatal error if the given block attempts to declare local variables + (in which case it can't be marked as transient anyways). + + @since Phosphorus-20170501-beta1 +*) +val transient_block: block -> block + +(** tells whether the block has been marked as transient + + @since Phosphorus-20170501-beta1. +*) +val is_transient_block: block -> bool + +(** [flatten_transient_sub_blocks b] flattens all direct sub-blocks of [b] + that have been marked as cleanable, whenever possible + + @since Phosphorus-20170501-beta1 +*) +val flatten_transient_sub_blocks: block -> block + +(**/**) + +(** Internal usage only. *) + +(** Indicates that the potentially transient block given as argument + must in fact be preserved after the visit. The resulting block will + be marked as non-scoping. + + @since Phosphorus-20170501-beta1. +*) +val block_of_transient: block -> block + +(**/**) + (** Visit a type *) val visitCilType: cilVisitor -> typ -> typ @@ -1816,14 +1921,11 @@ val visitCilAnnotation: cilVisitor -> global_annotation -> global_annotation val visitCilCodeAnnotation: cilVisitor -> code_annotation -> code_annotation -val visitCilDeps: - cilVisitor -> identified_term deps -> identified_term deps +val visitCilDeps: cilVisitor -> deps -> deps -val visitCilFrom: - cilVisitor -> identified_term from -> identified_term from +val visitCilFrom: cilVisitor -> from -> from -val visitCilAssigns: - cilVisitor -> identified_term assigns -> identified_term assigns +val visitCilAssigns: cilVisitor -> assigns -> assigns (** @since Oxygen-20120901 *) @@ -1837,8 +1939,7 @@ val visitCilAllocates: (** @since Oxygen-20120901 *) -val visitCilAllocation: - cilVisitor -> identified_term allocation -> identified_term allocation +val visitCilAllocation: cilVisitor -> allocation -> allocation val visitCilFunspec: cilVisitor -> funspec -> funspec @@ -2053,7 +2154,7 @@ val bytesAlignOf: typ -> int (** [intOfAttrparam a] tries to const-fold [a] into a numeric value. Returns [Some n] if it succeeds, [None] otherwise. - @since Aluminium-20160501+dev *) + @since Silicium-20161101 *) val intOfAttrparam: attrparam -> int option (** Give a type of a base and an offset, returns the number of bits from the @@ -2118,6 +2219,9 @@ val d_formatarg : Format.formatter -> formatArg -> unit (** {2 Misc} *) (* ************************************************************************* *) +(** if the list has 2 elements or more, it will return a block with + [bscoping=false] +*) val stmt_of_instr_list : ?loc:location -> instr list -> stmtkind (** Convert a C variable into the corresponding logic variable. diff --git a/src/kernel_services/ast_queries/cil_datatype.ml b/src/kernel_services/ast_queries/cil_datatype.ml index 0aaa774b2bcdded8e1c81100cd9c3038e054595e..e011530da20149d184b38abaac27bde62bdb6cc8 100644 --- a/src/kernel_services/ast_queries/cil_datatype.ml +++ b/src/kernel_services/ast_queries/cil_datatype.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -125,23 +125,27 @@ let rank_term = function (** {3 Cabs types} *) (**************************************************************************) -module Cabs_file = - Make +module Cabs_file =struct + + let pretty_ref = ref (fun _ _ -> assert false) + include Make (struct type t = Cabs.file let name = "Cabs_file" let reprs = [ "", []; "", [ true, Cabs.GLOBANNOT [] ] ] let varname (s, _) = "cabs_" ^ s let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref end) - +end + (**************************************************************************) (** {3 C types} *) (**************************************************************************) -module Position = - Make_with_collections +module Position = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = Lexing.position let name = "Position" @@ -156,7 +160,8 @@ module Position = (Filepath.pretty pos.Lexing.pos_fname) pos.Lexing.pos_lnum (pos.Lexing.pos_cnum - pos.Lexing.pos_bol) let varname _ = "pos" - end) + end) +end module Location = struct let unknown = Lexing.dummy_pos, Lexing.dummy_pos @@ -206,6 +211,7 @@ module Instr = struct end) let loc = function + | Local_init (_,_,l) -> l | Skip l | Set (_,_,l) | Call (_,_,_,l) @@ -631,15 +637,16 @@ module Exp = struct end) end -module Label = - Make_with_collections +module Label = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = label let name = "Label" let reprs = [ Label("", Location.unknown, false); Default Location.unknown ] let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined let hash = function | Default _ -> 7 @@ -665,7 +672,8 @@ module Label = let equal = Datatype.from_compare let copy = Datatype.undefined end) - +end + module Varinfo_Id = struct let pretty_ref = ref (fun _ _ -> assert false) let internal_pretty_code_ref = ref (fun _ _ _ -> assert false) @@ -718,8 +726,9 @@ module Varinfo = struct let () = clear_caches := Hptset.clear_caches :: !clear_caches end -module Compinfo = - Make_with_collections +module Compinfo = struct + let pretty_ref = Extlib.mk_fun "Cil_datatype.Compinfo.pretty_ref" + include Make_with_collections (struct type t = compinfo let name = "compinfo" @@ -737,9 +746,10 @@ module Compinfo = let equal v1 v2 = v1.ckey = v2.ckey let copy = Datatype.undefined let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty fmt f = !pretty_ref fmt f let varname = Datatype.undefined - end) + end) +end module Fieldinfo = struct let pretty_ref = Extlib.mk_fun "Cil_datatype.Fieldinfo.pretty_ref" @@ -783,8 +793,9 @@ module Fieldinfo = struct end) end -module Enuminfo = - Make_with_collections +module Enuminfo = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct include Datatype.Undefined type t = enuminfo @@ -799,10 +810,13 @@ module Enuminfo = let compare v1 v2 = String.compare v1.ename v2.ename let hash v = Hashtbl.hash v.ename let equal v1 v2 = v1.ename = v2.ename + let pretty fmt v = !pretty_ref fmt v end) - -module Enumitem = - Make_with_collections +end + +module Enumitem = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct include Datatype.Undefined type t = enumitem @@ -820,8 +834,10 @@ module Enumitem = let compare v1 v2 = String.compare v1.einame v2.einame let hash v = Hashtbl.hash v.einame let equal v1 v2 = v1.einame = v2.einame + let pretty fmt v = !pretty_ref fmt v end) - +end + let compare_constant c1 c2 = match c1, c2 with | CInt64(v1,k1,_), CInt64(v2,k2,_) -> compare_chain Integer.compare v1 v2 Extlib.compare_basic k1 k2 @@ -1010,7 +1026,7 @@ module Block = struct type t = block let name = "Block" let reprs = - [ { battrs = []; blocals = Varinfo.reprs; bstmts = Stmt.reprs } ] + [{battrs=[]; blocals=Varinfo.reprs; bstmts=Stmt.reprs; bscoping=true}] let internal_pretty_code = Datatype.undefined let pretty fmt b = !pretty_ref fmt b let varname = Datatype.undefined @@ -1166,8 +1182,9 @@ module Logic_var = struct end) end -module Builtin_logic_info = - Make_with_collections +module Builtin_logic_info = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = builtin_logic_info let name = "Builtin_logic_info" @@ -1182,12 +1199,14 @@ module Builtin_logic_info = let equal i1 i2 = i1.bl_name = i2.bl_name let copy = Datatype.identity (* works only if an AST is never modified *) let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined end) - -module Logic_type_info = - Make_with_collections +end + +module Logic_type_info = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = logic_type_info let name = "Logic_type_info" @@ -1198,12 +1217,14 @@ module Logic_type_info = let hash t = Hashtbl.hash t.lt_name let copy = Datatype.identity (* works only if an AST is never modified *) let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined - end) + end) +end -module Logic_ctor_info = - Make_with_collections +module Logic_ctor_info = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = logic_ctor_info let name = "Logic_ctor_info" @@ -1216,12 +1237,14 @@ module Logic_ctor_info = let hash t = Hashtbl.hash t.ctor_name let copy = Datatype.identity (* works only if an AST is never modified *) let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined end) - -module Initinfo = - Make +end + +module Initinfo = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make (struct type t = initinfo let name = "Initinfo" @@ -1229,12 +1252,14 @@ module Initinfo = { init = None } :: List.map (fun t -> { init = Some (CompoundInit(t, [])) }) Typ.reprs let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined - end) + end) +end -module Logic_info = - Make_with_collections +module Logic_info = struct + let pretty_ref = ref (fun fmt f -> Logic_var.pretty fmt f.l_var_info) + include Make_with_collections (struct type t = logic_info let name = "Logic_info" @@ -1253,10 +1278,11 @@ module Logic_info = let hash i = Logic_var.hash i.l_var_info let copy = Datatype.undefined let internal_pretty_code = Datatype.undefined - let pretty fmt f = Logic_var.pretty fmt f.l_var_info + let pretty = !pretty_ref let varname _ = "logic_varinfo" end) - +end + let rec compare_logic_type config v1 v2 = let rank = function | Linteger -> 0 @@ -1436,7 +1462,7 @@ let rec compare_term t1 t2 = | Tapp(f1,labs1,ts1) , Tapp(f2,labs2,ts2) -> let cf = Logic_info.compare f1 f2 in if cf <> 0 then cf else - let cl = compare_list compare_logic_label_pair labs1 labs2 in + let cl = compare_list compare_logic_label labs1 labs2 in if cl <> 0 then cl else compare_list compare_term ts1 ts2 | Tlambda(q1,t1) , Tlambda(q2,t2) -> let cq = compare_list Logic_var.compare q1 q2 in @@ -1525,20 +1551,18 @@ and compare_toffset off1 off2 = | TModel _, (TField _ | TNoOffset) | TIndex _, (TModel _ | TField _ | TNoOffset) -> 1 -and compare_logic_label_pair (x1,p1) (x2,p2) = - let c1 = compare_logic_label x1 x2 in - if c1 <> 0 then c1 else compare_logic_label p1 p2 - and compare_logic_label l1 l2 = match l1, l2 with | StmtLabel s1 , StmtLabel s2 -> Stmt.compare !s1 !s2 - | LogicLabel (None,l1), LogicLabel (None,l2) -> String.compare l1 l2 - | LogicLabel (Some s1,l1), LogicLabel (Some s2,l2) -> - let cl = String.compare l1 l2 in + | FormalLabel s1, FormalLabel s2 -> String.compare s1 s2 + | BuiltinLabel (None, l1), BuiltinLabel (None, l2) -> + Pervasives.compare l1 l2 + | BuiltinLabel (Some s1, l1), BuiltinLabel (Some s2, l2) -> + let cl = Pervasives.compare l1 l2 in if cl <> 0 then cl else Stmt.compare s1 s2 - | (StmtLabel _ , LogicLabel _ - | LogicLabel (None,_),LogicLabel (Some _,_)) -> (-1) - | ( LogicLabel _ , StmtLabel _ - | LogicLabel (Some _,_),LogicLabel (None,_)) -> 1 + | ((StmtLabel _ | FormalLabel _), (FormalLabel _ | BuiltinLabel _) + | BuiltinLabel (None,_), BuiltinLabel (Some _,_)) -> -1 + | ((BuiltinLabel _ | FormalLabel _), (StmtLabel _ | FormalLabel _) + | BuiltinLabel (Some _,_), BuiltinLabel (None,_)) -> 1 and compare_ctor c1 c2 = String.compare c1.ctor_name c2.ctor_name @@ -1564,7 +1588,8 @@ let hash_logic_constant = function let hash_label x = match x with StmtLabel r -> 2*(Stmt.hash !r) - | LogicLabel(_,l) -> 2*(Hashtbl.hash l) + 1 + | BuiltinLabel(_,l) -> 2*(Hashtbl.hash l) + 1 + | FormalLabel s -> 2*(Hashtbl.hash s) + 3 let rec hash_term (acc,depth,tot) t = if tot <= 0 || depth <= 0 then raise (StopRecursion acc) @@ -1590,9 +1615,9 @@ let rec hash_term (acc,depth,tot) t = | TStartOf lv -> hash_tlval (acc+209,depth-1,tot-1) lv | Tapp (li,labs,apps) -> let hash1 = acc + 228 + Logic_info.hash li in - let hash_lb (acc,tot) (_,lb) = + let hash_lb (acc,tot) l = if tot = 0 then raise (StopRecursion acc) - else (acc + hash_label lb,tot - 1) + else (acc + hash_label l,tot - 1) in let hash_one_term (acc,tot) t = hash_term (acc,depth-1,tot) t in let res = List.fold_left hash_lb (hash1,tot-1) labs in @@ -1702,8 +1727,9 @@ and hash_toffset (acc, depth, tot) t = let hash_fct f t = try fst (f (0,10,100) t) with StopRecursion n -> n -module Logic_constant = - Make_with_collections +module Logic_constant = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = logic_constant let name = "Logic_constant" @@ -1713,9 +1739,10 @@ module Logic_constant = let hash = hash_logic_constant let copy = Datatype.undefined let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname _ = "lconst" - end) + end) +end module Term = struct let pretty_ref = ref (fun _ _ -> assert false) @@ -1741,8 +1768,9 @@ module Term = struct end) end -module Identified_term = - Make_with_collections +module Identified_term = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = identified_term let name = "Identified_term" @@ -1755,12 +1783,14 @@ module Identified_term = { it_id = x.it_id; it_content = Term.copy x.it_content } let hash x = x.it_id let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname _ = "id_term" end) - -module Term_lhost = - Make_with_collections +end + +module Term_lhost = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make_with_collections (struct type t = term_lhost let name = "Term_lhost" @@ -1778,9 +1808,10 @@ module Term_lhost = let hash = hash_fct hash_tlhost let copy = Datatype.undefined let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined - end) + end) +end module Term_offset = struct let pretty_ref = ref (fun _ _ -> assert false) @@ -1815,7 +1846,7 @@ module Logic_label = struct type t = logic_label let name = "Logic_label" let reprs = - (LogicLabel (None,"Pre")) + (BuiltinLabel (None, Pre)) :: List.map (fun x -> StmtLabel (ref x)) Stmt.reprs let compare = compare_logic_label let equal = Datatype.from_compare @@ -2194,14 +2225,15 @@ module Funspec = struct end) end -module Fundec = struct +module Fundec = struct + let pretty_ref = ref (fun _ _ -> assert false) let make_dummy vi fs = { svar = vi; sformals = []; slocals = []; smaxid = 0; - sbody = { battrs = [] ; blocals = []; bstmts = [] }; + sbody = List.hd (Block.reprs); smaxstmtid = None; sallstmts = []; sspec = fs ; @@ -2236,17 +2268,19 @@ end Sorted by alphabetic order. *) (**************************************************************************) -module Lexpr = - Make +module Lexpr = struct + let pretty_ref = ref (fun _ _ -> assert false) + include Make (struct open Logic_ptree type t = lexpr let name = "Lexpr" let reprs = [ { lexpr_node = PLvar ""; lexpr_loc = Location.unknown } ] let internal_pretty_code = Datatype.undefined - let pretty = Datatype.undefined + let pretty = !pretty_ref let varname = Datatype.undefined - end) + end) +end (**************************************************************************) (** {3 Other types} *) diff --git a/src/kernel_services/ast_queries/cil_datatype.mli b/src/kernel_services/ast_queries/cil_datatype.mli index af3bc7b880fd1cd2535cbc424ae4f0bcd6c940ed..52ca66e64fba762761ef9582f16e462c9c263e36 100644 --- a/src/kernel_services/ast_queries/cil_datatype.mli +++ b/src/kernel_services/ast_queries/cil_datatype.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -47,7 +47,7 @@ end (** Single position in a file. @since Nitrogen-20111001 *) -module Position: S_with_collections with type t = Lexing.position +module Position: S_with_collections_pretty with type t = Lexing.position (** Cil locations. *) module Location: sig @@ -67,7 +67,7 @@ module Localisation: Datatype.S with type t = localisation (** {3 Cabs types} *) (**************************************************************************) -module Cabs_file: S with type t = Cabs.file +module Cabs_file: S_with_pretty with type t = Cabs.file (**************************************************************************) (** {3 C types} @@ -77,9 +77,9 @@ module Cabs_file: S with type t = Cabs.file module Block: S_with_pretty with type t = block (* Blocks cannot compared or hashed, so collections are not available *) -module Compinfo: S_with_collections with type t = compinfo -module Enuminfo: S_with_collections with type t = enuminfo -module Enumitem: S_with_collections with type t = enumitem +module Compinfo: S_with_collections_pretty with type t = compinfo +module Enuminfo: S_with_collections_pretty with type t = enuminfo +module Enumitem: S_with_collections_pretty with type t = enumitem (** @since Fluorine-20130401 @@ -108,10 +108,10 @@ module Global: sig include S_with_collections_pretty with type t = global val loc: t -> location val attr: t -> attributes - (** @since Frama-C+dev *) + (** @since Phosphorus-20170501-beta1 *) end -module Initinfo: S with type t = initinfo +module Initinfo: S_with_pretty with type t = initinfo module Instr: sig include S_with_pretty with type t = instr @@ -126,7 +126,7 @@ module Kinstr: sig val loc: t -> location end -module Label: S_with_collections with type t = label +module Label: S_with_collections_pretty with type t = label (** Note that the equality is based on eid (for sub-expressions). For structural equality, use {!LvalStructEq} *) @@ -213,7 +213,7 @@ end Sorted by alphabetic order. *) (**************************************************************************) -module Builtin_logic_info: S_with_collections with type t = builtin_logic_info +module Builtin_logic_info: S_with_collections_pretty with type t = builtin_logic_info module Code_annotation: sig include S_with_collections_pretty with type t = code_annotation @@ -225,7 +225,7 @@ module Funbehavior: S with type t = funbehavior module Funspec: S_with_pretty with type t = funspec (** @since Fluorine-20130401 *) -module Fundec: S_with_collections with type t = fundec +module Fundec: S_with_collections_pretty with type t = fundec module Global_annotation: sig include S_with_collections_pretty with type t = global_annotation @@ -233,14 +233,14 @@ module Global_annotation: sig val attr: t -> attributes (** attributes tied to the global annotation. - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) end -module Identified_term: S_with_collections with type t = identified_term +module Identified_term: S_with_collections_pretty with type t = identified_term -module Logic_ctor_info: S_with_collections with type t = logic_ctor_info -module Logic_info: S_with_collections with type t = logic_info -module Logic_constant: S_with_collections with type t = logic_constant +module Logic_ctor_info: S_with_collections_pretty with type t = logic_ctor_info +module Logic_info: S_with_collections_pretty with type t = logic_info +module Logic_constant: S_with_collections_pretty with type t = logic_constant module Logic_label: S_with_collections_pretty with type t = logic_label @@ -250,7 +250,7 @@ module Logic_type: S_with_collections_pretty with type t = logic_type module Logic_type_ByName: S_with_collections_pretty with type t = logic_type module Logic_type_NoUnroll: S_with_collections_pretty with type t = logic_type -module Logic_type_info: S_with_collections with type t = logic_type_info +module Logic_type_info: S_with_collections_pretty with type t = logic_type_info module Logic_var: S_with_collections_pretty with type t = logic_var @@ -259,7 +259,7 @@ module Model_info: S_with_collections_pretty with type t = model_info module Term: S_with_collections_pretty with type t = term -module Term_lhost: S_with_collections with type t = term_lhost +module Term_lhost: S_with_collections_pretty with type t = term_lhost module Term_offset: S_with_collections_pretty with type t = term_offset module Term_lval: S_with_collections_pretty with type t = term_lval @@ -273,7 +273,7 @@ module Identified_predicate: Sorted by alphabetic order. *) (**************************************************************************) -module Lexpr: S with type t = Logic_ptree.lexpr +module Lexpr: S_with_pretty with type t = Logic_ptree.lexpr (**/**) (* ****************************************************************************) diff --git a/src/kernel_services/ast_queries/cil_state_builder.ml b/src/kernel_services/ast_queries/cil_state_builder.ml index 06c1c8dd69b128bf7cb8262f6f86cba75762083b..06eae04808de1bb2fdf8d61f3dbd70e2b54d0029 100644 --- a/src/kernel_services/ast_queries/cil_state_builder.ml +++ b/src/kernel_services/ast_queries/cil_state_builder.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,6 +29,8 @@ module Stmt_hashtbl = Hashtbl(Stmt.Hashtbl) module Varinfo_hashtbl = Hashtbl(Varinfo.Hashtbl) module Exp_hashtbl = Hashtbl(Exp.Hashtbl) module Kernel_function_hashtbl = Hashtbl(Kf.Hashtbl) +module Lval_hashtbl = Hashtbl(Lval.Hashtbl) + (* module Code_annotation_hashtbl = State_builder.Hashtbl(Cil_datatype.Code_Annotation) diff --git a/src/kernel_services/ast_queries/cil_state_builder.mli b/src/kernel_services/ast_queries/cil_state_builder.mli index 87969bf2e54a79a55831b3282d405e1bd94cdcbe..c4fdd608ba03025113eeca993d9d4288f070a780 100644 --- a/src/kernel_services/ast_queries/cil_state_builder.mli +++ b/src/kernel_services/ast_queries/cil_state_builder.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -41,6 +41,10 @@ module Exp_hashtbl(Data:Datatype.S)(Info: State_builder.Info_with_size) : State_builder.Hashtbl with type key = Cil_types.exp and type data = Data.t +module Lval_hashtbl(Data:Datatype.S)(Info: State_builder.Info_with_size) : + State_builder.Hashtbl with type key = Cil_types.lval + and type data = Data.t + module Kernel_function_hashtbl (Data:Datatype.S)(Info: State_builder.Info_with_size): State_builder.Hashtbl with type key = Cil_types.kernel_function diff --git a/src/kernel_services/ast_queries/file.ml b/src/kernel_services/ast_queries/file.ml index 82595f8203b3bb5ba9d40b885992370f060171de..fec85f16dc8bf28dc57bf24e004c0c5eb9a2f548 100644 --- a/src/kernel_services/ast_queries/file.ml +++ b/src/kernel_services/ast_queries/file.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -103,19 +103,12 @@ let get_preprocessor_command () = if cmdline <> "" then begin (cmdline, cpp_opt_kind ()) end else begin - try - let runtime_cpp = Sys.getenv "CPP" in - match cpp_opt_kind () with - | Unknown -> - (* if CPP has not been changed in the runtime, use it *) - if Config.preprocessor = runtime_cpp then - if Config.preprocessor_is_gnu_like then runtime_cpp, Gnu - else runtime_cpp, Not_gnu - else runtime_cpp, Unknown - | _ as kind -> runtime_cpp, kind - with Not_found -> - let gnu = if Config.preprocessor_is_gnu_like then Gnu else Not_gnu in - (Config.preprocessor, gnu) + let gnu = + if Config.using_default_cpp then + if Config.preprocessor_is_gnu_like then Gnu else Not_gnu + else cpp_opt_kind () + in + Config.preprocessor, gnu end let from_filename ?cpp f = @@ -218,25 +211,6 @@ end let get_all = Files.get let pre_register = Files.pre_register -let pre_register_in_share s = - let real_s = Filename.concat Config.datadir s in - if not (Sys.file_exists real_s) then - Kernel.abort - "Cannot find file %s, needed for Frama-C initialization. \ - Please check that %s is the correct share path for Frama-C, and that \ - Frama-C has been installed." - s - Config.datadir; - pre_register (from_filename real_s) - -(* Registers the initial builtins, for each new project. *) -let () = - Project.register_create_hook - (fun p -> - let selection = State_selection.singleton Files.pre_register_state in - Project.on ~selection p pre_register_in_share - (Filename.concat "libc" "__fc_builtin_for_normalization.i")) - (* ************************************************************************* *) (** {2 Machdep} *) @@ -277,7 +251,7 @@ let print_machdep fmt (m : Cil_types.mach) = Format.fprintf fmt " machine is %s endian@\n" (if m.little_endian then "little" else "big") ; Format.fprintf fmt " strings are %s chars@\n" - (if m.underscore_name then "const" else "writable") ; + (if m.const_string_literals then "const" else "writable") ; Format.fprintf fmt " assembly names %s leading '_'@\n" (if m.underscore_name then "have" else "have no") ; Format.fprintf fmt " compiler %s builtin __va_list@\n" @@ -623,133 +597,6 @@ let () = in new_file_type ".ci" handle -(* Print a warning message when an undefined behavior may occurs in an - unspecified sequence, i.e. two writes or a write and a read (not used - for determining the value to write, Cf. C99 6.5§2). We compute an - over-approximation here but under the assumption that - it is not possible to access two distinct fields by overflowing - an index, i.e. s.f[i] is always distinct from s.g[j] -*) -let check_unspecified file = - (* checks whether offsets starting from the same base might overlap *) - let rec may_overlap_offset offs1 offs2 = - match offs1, offs2 with - | NoOffset,_ | _, NoOffset -> true - | Field (f1,offs1), Field(f2,offs2) -> - (* it's probably a bit overkill to check if any of the field is in - an union, as the types of offs1 and offs2 are very probably - identical, but I don't have a Coq proof of that fact at the moment. *) - (not f1.fcomp.cstruct || not f2.fcomp.cstruct) || - (f1.fname = f2.fname && - f1.fcomp.ckey = f2.fcomp.ckey && - may_overlap_offset offs1 offs2) - | Index(i1,offs1), Index(i2,offs2) -> - (match Cil.constFoldToInt i1, Cil.constFoldToInt i2 with - | Some c1, Some c2 -> - Integer.equal c1 c2 && - may_overlap_offset offs1 offs2 - | None, _ | _, None -> - may_overlap_offset offs1 offs2 - ) - | (Index _|Field _), (Index _|Field _) -> - (* A bit strange, but we're not immune against some ugly cast. - Let's play safe here. *) - true - in - (* checks whether two lval may overlap *) - let may_overlap_lval (base1,offs1)(base2,offs2) = - match (base1,offs1), (base2,offs2) with - | (Mem _,_),(Mem _,_) -> true - | (Var v,_),(Mem _,_) | (Mem _,_), (Var v,_)-> - v.vaddrof (* if the address of v is not taken, - it cannot be aliased*) - | (Var v1,offs1),(Var v2,offs2) -> - v1.vid = v2.vid && may_overlap_offset offs1 offs2 - in - (* checks whether some element of the first list may overlap with some - element of the second one. *) - let may_overlap l1 l2 = - Extlib.product_fold (fun f e1 e2 -> f || may_overlap_lval e1 e2) - false l1 l2 - in - let check_unspec = object - inherit Cil.nopCilVisitor - method! vstmt s = - (match s.skind with - | UnspecifiedSequence [] | UnspecifiedSequence [ _ ] -> () - | UnspecifiedSequence seq -> - (* We have more than one side-effect in an unspecified sequence. - For each statement, we check whether its side effects may overlap - with the others, or with the reads. *) - let my_stmt_print = object(self) - inherit Cil_printer.extensible_printer () as super - method! stmt fmt = function - | {skind = UnspecifiedSequence seq } -> - Pretty_utils.pp_list ~sep:"@\n" - (fun fmt (s,m,w,r,_) -> - Format.fprintf fmt - "/*@ %t%a@ <-@ %a@ */@\n%a" - (fun fmt -> if (Kernel.debug_atleast 2) then - Pretty_utils.pp_list - ~pre:"@[(" - ~suf:")@]" - ~sep:"@ " - self#lval fmt m) - (Pretty_utils.pp_list ~sep:"@ " self#lval) w - (Pretty_utils.pp_list ~sep:"@ " self#lval) r - self#stmt s) - fmt - seq - | s -> super#stmt fmt s - end in - (* when checking for overlaps, we do not consider temporaries - introduced by the normalization. In other words, - we assume that the normalization itself is correct. *) - let remove_mod m l = - List.filter (fun x -> not (List.exists (Lval.equal x) m)) l - in - (* l1 contains two lists: the first one is the temporaries we - do not want to consider, the second one are locations that - are read by a given statement. l2 contains locations that are - written by another statement. *) - let may_overlap_modified l1 l2 = - List.fold_left - (fun flag (m,r) -> flag || may_overlap (remove_mod m l2) r) - false l1 - in - let warn,_,_ = - List.fold_left - (fun ((warn,writes,reads) as res) (_,m,w,r,_) -> - (* the accumulator contains the lists of written - and read locations from the previous statements. - We check for overlapping between the following pairs: - - w vs writes - - r vs writes (modulo temporaries m as explained above). - - reads vs w (id. ) - As soon as we have identified a potential overlap, we - output the whole unspecified sequence. - *) - if warn then res else begin - let new_writes = w @ writes in - let new_reads = (m,r)::reads in - let new_warn = - warn || may_overlap writes w || - may_overlap (remove_mod m writes) r || - may_overlap_modified reads w - in - new_warn,new_writes,new_reads - end) - (false, [], []) seq - in - if warn then - Kernel.warning ~current:true ~once:true - "Unspecified sequence with side effect:@\n%a@\n" - (my_stmt_print#without_annot my_stmt_print#stmt) s - | _ -> ()); - DoChildren - end - in - Cil.visitCilFileSameGlobals check_unspec file (** Keep defined entry point even if not defined, and possibly the functions @@ -795,18 +642,19 @@ let files_to_cabs_cil files = Logic_utils.complete_types merged_file; Rmtmps.removeUnusedTemps ~isRoot:keep_entry_point merged_file; if Kernel.UnspecifiedAccess.get () then - check_unspecified merged_file; + Undefined_sequence.check_sequences merged_file; merged_file, cabs_files (* "Implicit" annotations are those added by the kernel with ACSL name 'Frama_C_implicit_init'. Currently, this concerns statements that are generated to initialize local variables. *) module Implicit_annotations = - State_builder.Set_ref - (Property.Set) + State_builder.Hashtbl + (Property.Hashtbl)(Datatype.List(Property)) (struct let name = "File.Implicit_annotations" let dependencies = [Annotations.code_annot_state] + let size = 32 end) let () = Ast.add_linked_state Implicit_annotations.self @@ -820,11 +668,11 @@ let () = Implicit_annotations.remove p end) -let emit_status p = +let emit_status p hyps = Kernel.debug ~dkey:dkey_annot "Marking implicit property %a as true" Property.pretty p; - Property_status.emit Emitter.kernel ~hyps:[] p Property_status.True + Property_status.emit Emitter.kernel ~hyps p Property_status.True let emit_all_statuses _ = Kernel.debug ~dkey:dkey_annot "Marking properties"; @@ -841,7 +689,7 @@ let add_annotation kf st a = ([], ({ spec_behavior = [ { b_name = "Frama_C_implicit_init" } as bhv]})) -> let props = Property.ip_post_cond_of_behavior kf (Kstmt st) [] bhv in - List.iter Implicit_annotations.add props + List.iter (fun p -> Implicit_annotations.add p []) props | _ -> () let synchronize_source_annot has_new_stmt kf = @@ -962,18 +810,31 @@ effects"; let register_global = function | GFun (fundec, loc) -> - (* ensure there is only one return *) - Oneret.oneret fundec; - (* Build the Control Flow Graph for all + let onerets = ref [] in + let callback return goto = onerets := (return,goto) :: !onerets in + (* ensure there is only one return *) + Oneret.oneret ~callback fundec; + (* Build the Control Flow Graph for all functions *) - if Kernel.SimplifyCfg.get () then begin - Cfg.prepareCFG ~keepSwitch:(Kernel.KeepSwitch.get ()) fundec; - Cfg.clearCFGinfo fundec; - Cfg.cfgFun fundec; - (* prepareCFG may add additional labels that are not used in the end. *) - Rmtmps.remove_unused_labels fundec; - end; - Globals.Functions.add (Definition(fundec,loc)); + if Kernel.SimplifyCfg.get () then begin + Cfg.prepareCFG ~keepSwitch:(Kernel.KeepSwitch.get ()) fundec; + Cfg.clearCFGinfo fundec; + Cfg.cfgFun fundec; + (* prepareCFG may add additional labels that are not used in the end. *) + Rmtmps.remove_unused_labels fundec; + end; + Globals.Functions.add (Definition(fundec,loc)); + let kf = Globals.Functions.get fundec.svar in + (* Finally set property-status on oneret clauses *) + List.iter + (fun ((sret,b,pret),gotos) -> + let ipreturns = + Property.ip_of_ensures kf (Kstmt sret) b (Returns,pret) in + let ipgotos = List.map + (fun (sgot,agot) -> Property.ip_of_code_annot_single kf sgot agot) + gotos in + Implicit_annotations.add ipreturns ipgotos + ) !onerets ; | GFunDecl (spec, f,loc) -> (* global prototypes *) let args = @@ -1162,7 +1023,8 @@ let recompute_cfg _ = Cfg_recomputation_queue.clear () let transform_and_check name is_normalized f ast = - Kernel.feedback ~dkey:dkey_transform "applying %s to file" name; + Kernel.feedback + ~dkey:dkey_transform "applying %s to file:@\n%a" name Printer.pp_file ast; f ast; recompute_cfg (); if Kernel.Check.get () then begin diff --git a/src/kernel_services/ast_queries/file.mli b/src/kernel_services/ast_queries/file.mli index 627b95310ad66de23c9148fe6625dc8dcd9be865..b3452c4af5b6235448c4a927d63a436c1aa21e07 100644 --- a/src/kernel_services/ast_queries/file.mli +++ b/src/kernel_services/ast_queries/file.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_queries/filecheck.ml b/src/kernel_services/ast_queries/filecheck.ml index c609df41a8ff7e93e93095908a81b1a95e680a23..7fdf69e2e8084bae9db4ca4e08ad6e82e46ca784 100644 --- a/src/kernel_services/ast_queries/filecheck.ml +++ b/src/kernel_services/ast_queries/filecheck.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -109,7 +109,10 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = (check_abort "variables %s and %s have the same id (%d)" v.vname v'.vname v.vid)) else - Varinfo.Hashtbl.add known_vars v v; + if v.vformal || v.vglob || not v.vdefined then + (* A defined local will only enter scope when the corresponding + Local_init statement is reached. *) + Varinfo.Hashtbl.add known_vars v v; match v.vlogic_var_assoc with | None -> Cil.DoChildren | Some ({ lv_origin = Some v'} as lv) when v == v' -> @@ -179,7 +182,12 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = "logic variable %a as an associated variable %a, but is not \ flagged as having a C origin" Printer.pp_logic_var lv Printer.pp_varinfo v - | Some { vlogic_var_assoc = Some lv' } when lv == lv' -> Cil.DoChildren + | Some { vlogic_var_assoc = Some lv' } when lv == lv' -> + ignore + Visitor.(visitFramacLogicType (self:>frama_c_visitor) lv.lv_type); + (* DoChildren on initialized local variables would fail, as it performs + a vvrbl on the C variable, before having reached the initializer. *) + Cil.SkipChildren | Some v -> check_abort "logic variable %a is not properly referenced by the original \ @@ -442,9 +450,37 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = Printer.pp_varinfo v v.vid end + (* Stack of local variables that are supposed to be initialized in + each currently opened block (with [bscoping=true]), the top of the + stack corresponding to the innermost block. Used to check that these + variables have a Local_init instruction in the appropriate block. + *) + val current_block_vars = Stack.create () + method! vblock b = + let check_locals b = + List.iter + (fun v -> + if v.vdefined then + check_abort + "Local variable %a is supposed to be defined, \ + but no initializer found in the block where it is in scope" + Printer.pp_varinfo v) + (Stack.pop current_block_vars); + b + in List.iter self#check_local_var b.blocals; - Cil.DoChildren + if b.bscoping then begin + Stack.push b.blocals current_block_vars; + Cil.DoChildrenPost check_locals + end else if b.blocals <> [] then + (* non-scoping block mustn't declare locals *) + check_abort + "Block below is declaring local variables %a, but its attributes \ + indicates that it is not used as a scope boundary.@\n%a" + (Pretty_utils.pp_list ~sep:", " Printer.pp_varinfo) b.blocals + Printer.pp_block b + else Cil.DoChildren method! vbehavior b = let vpred p = @@ -574,7 +610,8 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = method private check_logic_label lab = match lab with | StmtLabel _ -> () - | LogicLabel _ -> + | FormalLabel _ + | BuiltinLabel _ -> let is_declared = List.exists (fun x -> Cil_datatype.Logic_label.equal x lab) logic_labels @@ -612,18 +649,7 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = pred_or_func Printer.pp_logic_var li.l_var_info lab_declared lab_provided; List.iter - (fun (_,lab) -> self#check_logic_label lab) labs; - (* NdV: I'm not sure why the list of labels instantiations contains pairs - with the declared label as first component, but as long as the AST - stays that way, it cannot hurt to check for consistency here. *) - List.iter2 - (fun lab (lab',_) -> - if not (Cil_datatype.Logic_label.equal lab lab') then - check_abort - "%s %a has a label declared as %a, which is instantiated as %a" - pred_or_func Printer.pp_logic_var li.l_var_info - Printer.pp_logic_label lab Printer.pp_logic_label lab') - li.l_labels labs + (fun lab -> self#check_logic_label lab) labs method! vterm t = match t.term_node with @@ -677,6 +703,17 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = Cil.DoChildren | Tat(_,l) | Tbase_addr(l,_) | Toffset(l,_) | Tblock_length(l,_) -> self#check_logic_label l; Cil.DoChildren + | TBinOp (bop, lterm, _) -> + begin + match bop, Logic_utils.isLogicPointerType lterm.term_type with + | (PlusA | MinusA), true -> + check_abort "PlusA/MinusA operator with pointer argument @[(%a)@]" + Printer.pp_logic_type lterm.term_type + | (PlusPI | MinusPI), false -> + check_abort "PlusPI/MinusPI with non-pointer argument @[(%a)@]" + Printer.pp_logic_type lterm.term_type + | _ -> Cil.DoChildren + end | _ -> Cil.DoChildren method! vinitoffs = self#voffs @@ -834,6 +871,36 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = let old_labels = logic_labels in logic_labels <- labels @ logic_labels; Cil.DoChildrenPost (fun g -> logic_labels <- old_labels; g) + | Dtype (t,_) -> + let t' = + try Logic_env.find_logic_type t.lt_name + with Not_found -> + check_abort "logic type %s is not present in the environment" + t.lt_name + in + if t != t' then + check_abort + "Definition of logic type %s is not shared between \ + AST and environment" t.lt_name; + let treat_cons c = + let c' = + try Logic_env.find_logic_ctor c.ctor_name + with Not_found -> + check_abort + "logic constructor %s is not present in the environment" + c.ctor_name + in + if c != c' then + check_abort + "Definition of logic constructor %s is not shared between \ + AST and environment" + c.ctor_name + in + (match t.lt_def with + | Some (LTsum l) -> List.iter treat_cons l + | Some (LTsyn _) -> () + | None -> ()); + Cil.DoChildren | _ -> Cil.DoChildren method! vlogic_label = function @@ -950,48 +1017,81 @@ class check ?(is_normalized=true) what : Visitor.frama_c_visitor = fun e -> ignore (Stack.pop accept_array); e) + method private check_initialized_var v = + let block_vars = Stack.pop current_block_vars in + match List.partition (Cil_datatype.Varinfo.equal v) block_vars with + | [_], block_vars -> + Stack.push block_vars current_block_vars; + Cil_datatype.Varinfo.Hashtbl.add known_vars v v + | [], _ -> + if Cil_datatype.Varinfo.Hashtbl.mem known_vars v then + check_abort "Local variable %a is initialized twice" + Printer.pp_varinfo v + else + check_abort + "%a is initialized, but not marked as a local variable \ + of the nearest enclosing block" + Printer.pp_varinfo v + | _, _ -> + check_abort + "Local variable %a is present several times in block's locals list" + Printer.pp_varinfo v + method! vinst i = + let treat_call lvopt f args _loc = + match f.enode with + | Lval (Var f, NoOffset) -> + let (treturn,targs,is_variadic,_) = Cil.splitFunctionTypeVI f in + if Cil.isVoidType treturn && lvopt != None then + check_abort + "in call %a, assigning result of a function returning void" + Printer.pp_instr i; + (match lvopt with + | None -> () + | Some lv -> + let tlv = Cil.typeOfLval lv in + if not (Cabs2cil.allow_return_collapse ~tlv ~tf:treturn) then + check_abort "in call %a, cannot implicitly cast from \ + function return type %a to type of %a (%a)" + Printer.pp_instr i + Printer.pp_typ treturn + Printer.pp_lval lv + Printer.pp_typ tlv); + let rec aux l1 l2 = + match l1,l2 with + | [],[] -> Cil.DoChildren + | _::_, [] -> + check_abort "call %a has too few arguments" Printer.pp_instr i + | [],e::_ -> + if is_variadic then Cil.DoChildren + else + check_abort "call %a has too many arguments, starting from %a" + Printer.pp_instr i Printer.pp_exp e + | (_,ty1,_)::l1,arg::l2 -> + let ty2 = Cil.typeOf arg in + if not (is_admissible_conversion arg ty2 ty1) then + check_abort "in call %a, arg %a has type %a instead of %a" + Printer.pp_instr i + Printer.pp_exp arg + Printer.pp_typ ty2 + Printer.pp_typ ty1; + aux l1 l2 + in + (match targs with + | None -> Cil.DoChildren + | Some targs -> aux targs args) + | _ -> (* indirect call. Can't check coherence with a given kf *) + Cil.DoChildren + in match i with - | Call(lvopt,{ enode = Lval(Var f, NoOffset)},args,_) -> - let (treturn,targs,is_variadic,_) = Cil.splitFunctionTypeVI f in - if Cil.isVoidType treturn && lvopt != None then - check_abort - "in call %a, assigning result of a function returning void" - Printer.pp_instr i; - (match lvopt with - | None -> () - | Some lv -> - let tlv = Cil.typeOfLval lv in - if not (Cabs2cil.allow_return_collapse ~tlv ~tf:treturn) then - check_abort "in call %a, cannot implicitly cast from \ - function return type %a to type of %a (%a)" - Printer.pp_instr i - Printer.pp_typ treturn - Printer.pp_lval lv - Printer.pp_typ tlv); - let rec aux l1 l2 = - match l1,l2 with - | [],[] -> Cil.DoChildren - | _::_, [] -> - check_abort "call %a has too few arguments" Printer.pp_instr i - | [],e::_ -> - if is_variadic then Cil.DoChildren - else - check_abort "call %a has too many arguments, starting from %a" - Printer.pp_instr i Printer.pp_exp e - | (_,ty1,_)::l1,arg::l2 -> - let ty2 = Cil.typeOf arg in - if not (is_admissible_conversion arg ty2 ty1) then - check_abort "in call %a, arg %a has type %a instead of %a" - Printer.pp_instr i - Printer.pp_exp arg - Printer.pp_typ ty2 - Printer.pp_typ ty1; - aux l1 l2 - in - (match targs with - | None -> Cil.DoChildren - | Some targs -> aux targs args) + | Call(lvopt,f,args,loc) -> + treat_call lvopt f args loc + | Local_init (v, AssignInit _, _) -> + self#check_initialized_var v; + Cil.DoChildren + | Local_init (v, ConsInit(f,args,k),loc) -> + self#check_initialized_var v; + Cil.treat_constructor_as_func treat_call v f args k loc | Asm(_,_,Some { asm_gotos },_) -> List.iter self#check_label asm_gotos; Cil.DoChildren | _ -> Cil.DoChildren @@ -1047,6 +1147,11 @@ let extend_checker f = current_checker := f !current_checker let check_ast ?is_normalized ?(ast = Ast.get()) what = let module M = (val !current_checker : Extensible_checker) in + Kernel.debug ~dkey:dkey_check + "Checking integrity of AST:@\n%a" + (if Extlib.opt_conv true is_normalized + then Printer.pp_file else Cil_printer.pp_file) + ast; Cil.visitCilFileSameGlobals (new M.check ?is_normalized what :> Cil.cilVisitor) ast diff --git a/src/kernel_services/ast_queries/filecheck.mli b/src/kernel_services/ast_queries/filecheck.mli index 93b1c0def0becc7aa0a529c93ac17d0e53ed3f83..fa341b087f0c5f32e9cdc2c51d8c339d2528a8e3 100644 --- a/src/kernel_services/ast_queries/filecheck.mli +++ b/src/kernel_services/ast_queries/filecheck.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -42,7 +42,7 @@ end (** Allows to register an extension to current checks. The function will be given as input the current state of the checker. - @since Frama-C+dev + @since Phosphorus-20170501-beta1 *) val extend_checker: ((module Extensible_checker) -> (module Extensible_checker)) -> unit diff --git a/src/kernel_services/ast_queries/logic_const.ml b/src/kernel_services/ast_queries/logic_const.ml index d5245a80f06188e0fcbd2a7961167c0f8364bcfc..17c43258f50918b7cafe5ab325ead184e3886cf8 100644 --- a/src/kernel_services/ast_queries/logic_const.ml +++ b/src/kernel_services/ast_queries/logic_const.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -112,19 +112,19 @@ let refresh_code_annotation annot = (** {2 pre-defined logic labels} *) (* empty line for ocamldoc *) -let init_label = LogicLabel (None, "Init") +let init_label = BuiltinLabel (None, Init) -let pre_label = LogicLabel (None, "Pre") +let pre_label = BuiltinLabel (None, Pre) -let post_label = LogicLabel (None, "Post") +let post_label = BuiltinLabel (None, Post) -let here_label = LogicLabel (None, "Here") +let here_label = BuiltinLabel (None, Here) -let old_label = LogicLabel (None, "Old") +let old_label = BuiltinLabel (None, Old) -let loop_current_label = LogicLabel (None, "LoopCurrent") +let loop_current_label = BuiltinLabel (None, LoopCurrent) -let loop_entry_label = LogicLabel (None, "LoopEntry") +let loop_entry_label = BuiltinLabel (None, LoopEntry) (** {2 Types} *) diff --git a/src/kernel_services/ast_queries/logic_const.mli b/src/kernel_services/ast_queries/logic_const.mli index 64604fd7f668ddfb947debb21019201db7fcd06d..86910ce67cacc49abf81b51e4fced8fefed9ed2a 100644 --- a/src/kernel_services/ast_queries/logic_const.mli +++ b/src/kernel_services/ast_queries/logic_const.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -103,7 +103,7 @@ val pold: ?loc:location -> predicate -> predicate (** application of predicate*) val papp: ?loc:location -> - logic_info * (logic_label * logic_label) list * term list -> + logic_info * logic_label list * term list -> predicate (** && *) @@ -191,7 +191,7 @@ val pseparated: ?loc:location -> term list -> predicate (** {2 Logic types} *) (* ************************************************************************** *) -(** returns [true] if the type is a set<t>. +(** returns [true] if the type is a list<t>. @since Aluminium-20160501 *) val is_list_type: logic_type -> bool diff --git a/src/kernel_services/ast_queries/logic_env.ml b/src/kernel_services/ast_queries/logic_env.ml index 8750429f5b86a188dbc889850b4fbb3de652327f..bdeeb40fee7d5f6f3837c2972542bab74567604b 100644 --- a/src/kernel_services/ast_queries/logic_env.ml +++ b/src/kernel_services/ast_queries/logic_env.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -36,7 +36,7 @@ module Logic_builtin = (Datatype.String.Hashtbl) (Cil_datatype.Builtin_logic_info) (struct - let name = "built-in logic functions table" + let name = "Logic_env.Logic_builtin" let dependencies = [] let size = 17 end) @@ -46,7 +46,7 @@ module Logic_info = (Datatype.String.Hashtbl) (Cil_datatype.Logic_info) (struct - let name = "logic functions table" + let name = "Logic_env.Logic_info" let dependencies = [ Logic_builtin.self ] let size = 17 end) @@ -55,7 +55,7 @@ module Logic_builtin_used = struct include State_builder.Ref (Cil_datatype.Logic_info.Set) (struct - let name = "used built-in logic functions" + let name = "Logic_env.Logic_builtin_used" let dependencies = [ Logic_builtin.self; Logic_info.self ] let default () = Cil_datatype.Logic_info.Set.empty end) @@ -69,7 +69,7 @@ module Logic_type_builtin = (Datatype.String.Hashtbl) (Cil_datatype.Logic_type_info) (struct - let name = "built-in logic types table" + let name = "Logic_env.Logic_type_builtin" let dependencies = [] let size = 17 end) @@ -82,7 +82,7 @@ module Logic_type_info = (Datatype.String.Hashtbl) (Cil_datatype.Logic_type_info) (struct - let name = "logic types table" + let name = "Logic_env.Logic_type_info" let dependencies = [ Logic_type_builtin.self ] let size = 17 end) @@ -92,7 +92,7 @@ module Logic_ctor_builtin = (Datatype.String.Hashtbl) (Cil_datatype.Logic_ctor_info) (struct - let name = "built-in logic constructors table" + let name = "Logic_env.Logic_ctor_builtin" let dependencies = [] let size = 17 end) @@ -102,7 +102,7 @@ module Logic_ctor_info = (Datatype.String.Hashtbl) (Cil_datatype.Logic_ctor_info) (struct - let name = "logic constructors table" + let name = "Logic_env.Logic_ctor_info" let dependencies = [ Logic_ctor_builtin.self ] let size = 17 end) @@ -112,7 +112,7 @@ module Lemmas = (Datatype.String.Hashtbl) (Cil_datatype.Global_annotation) (struct - let name = "lemmas" + let name = "Logic_env.Lemmas" let dependencies = [] let size = 17 end) @@ -122,7 +122,7 @@ module Model_info = (Datatype.String.Hashtbl) (Cil_datatype.Model_info) (struct - let name = "model fields table" + let name = "Logic_env.Model_info" let dependencies = [] let size = 17 end) @@ -255,7 +255,7 @@ module Builtins= struct module Applied = State_builder.False_ref (struct - let name = "Application of logic built-ins hook" + let name = "Logic_env.Builtins.Applied" let dependencies = builtin_states (* if the built-in states are not kept, hooks must be replayed. *) end) diff --git a/src/kernel_services/ast_queries/logic_env.mli b/src/kernel_services/ast_queries/logic_env.mli index 39d4422188171351b8a94340527db3de11ccac69..6dd65542ebbd728439af01957d3dfb08cf04d7af 100644 --- a/src/kernel_services/ast_queries/logic_env.mli +++ b/src/kernel_services/ast_queries/logic_env.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/kernel_services/ast_queries/logic_typing.ml b/src/kernel_services/ast_queries/logic_typing.ml index 080e19d9eb37c6ff0ae6ee0239a92ebbb2eee485..dc11caf65618ff21653dd51d29f780da0f534131 100644 --- a/src/kernel_services/ast_queries/logic_typing.ml +++ b/src/kernel_services/ast_queries/logic_typing.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -378,10 +378,9 @@ let set_current_logic_label lab env = let env = { env with current_logic_label = Some lab } in match lab with - LogicLabel (_,"Post") -> enter_post_state env Normal - | LogicLabel (_,("Pre" | "Old")) | StmtLabel _ -> exit_post_state env - | LogicLabel (_,"Here") -> env - | LogicLabel _ -> exit_post_state env + BuiltinLabel (_, Post) -> enter_post_state env Normal + | BuiltinLabel (_, Here) -> env + | BuiltinLabel _ | FormalLabel _ | StmtLabel _ -> exit_post_state env let default_label = ref None @@ -492,7 +491,7 @@ type typing_context = { typing_context -> accept_formal:bool -> Lenv.t -> - Logic_ptree.lexpr Cil_types.assigns -> identified_term Cil_types.assigns; + Logic_ptree.assigns -> Cil_types.assigns; error: 'a 'b. location -> ('a,formatter,unit,'b) format4 -> 'a } @@ -1770,7 +1769,7 @@ struct with Not_found -> C.error loc "\\old undefined in this context" - let default_inferred_label = LogicLabel (None, "L") + let default_inferred_label = FormalLabel "L" let find_current_label loc env = match env.Lenv.current_logic_label with @@ -1794,11 +1793,11 @@ struct let labels_assoc loc id env fun_labels effective_labels = match fun_labels, effective_labels with - [lf], [] -> [lf, find_current_label loc env] + [_], [] -> [find_current_label loc env] | _ -> try List.map2 - (fun l1 l2 -> (l1,l2)) + (fun _ l2 -> l2) fun_labels effective_labels with Invalid_argument _ -> C.error loc "wrong number of labels for %s" id @@ -2076,12 +2075,12 @@ let add_label info lab = method! vterm_node t = match t with | Tapp(info',[],args) when Cil_datatype.Logic_info.equal info info' -> - ChangeDoChildrenPost(Tapp(info,[lab, curr_lab], args),Extlib.id) + ChangeDoChildrenPost(Tapp(info,[curr_lab], args),Extlib.id) | _ -> DoChildren method! vpredicate_node p = match p with | Papp(info',[],args) when Cil_datatype.Logic_info.equal info info' -> - ChangeDoChildrenPost (Papp(info, [lab,curr_lab], args),Extlib.id) + ChangeDoChildrenPost (Papp(info, [curr_lab], args),Extlib.id) | _ -> DoChildren method private treat_ind_case (n,labs,t,p as ind) = @@ -2198,35 +2197,10 @@ let add_label info lab = aux t let boolean_term_to_predicate t = - let loc = t.term_loc in - let conversion zero = prel ~loc (Cil_types.Rneq, t, zero) in - let arith_conversion () = conversion (Cil.lzero ~loc ()) in - let ptr_conversion () = conversion (Logic_const.term ~loc Tnull t.term_type) - in - match unroll_type t.term_type with - | Ctype (TInt _) -> arith_conversion () - | Ctype (TFloat _) -> conversion - (Logic_const.treal_zero ~loc ~ltyp:t.term_type ()) - | Ctype (TPtr _) -> ptr_conversion () - | Ctype (TArray _) -> ptr_conversion () - (* Could be transformed to \true: an array is never \null *) - | Ctype (TFun _) -> ptr_conversion () - (* decay as pointer *) - | Linteger -> arith_conversion () - | Lreal -> conversion (Logic_const.treal_zero ~loc ()) - | Ltype ({lt_name = name},[]) when name = Utf8_logic.boolean -> - let ctrue = C.find_logic_ctor "\\true" in - prel ~loc - (Cil_types.Req,t, - { term_node = TDataCons(ctrue,[]); - term_loc = loc; - term_type = Ltype(ctrue.ctor_type,[]); - term_name = []; - }) - | Ltype _ | Lvar _ | Larrow _ - | Ctype (TVoid _ | TNamed _ | TComp _ | TEnum _ | TBuiltin_va_list _) - -> - C.error loc "expecting a predicate and not a term" + if Logic_utils.is_zero_comparable t then + Logic_utils.scalar_term_to_predicate t + else + C.error t.term_loc "expecting a term that can be coerced to a boolean" let rec normalize_update_term ctxt env loc t v = function (* Transform terms like {x \with .c[idx] = v} @@ -2502,9 +2476,9 @@ let add_label info lab = match f.l_labels with [] -> TLval (TVar(f.l_var_info),TNoOffset), typ - | [l] -> + | [_] -> let curr = find_current_label loc env in - Tapp(f,[l,curr],[]), typ + Tapp(f,[curr],[]), typ | _ -> C.error loc "%s labels must be explicitly instantiated" x @@ -3274,7 +3248,7 @@ let add_label info lab = | None -> let labels = match info.l_labels with [] -> [] - | [l] -> [l,find_current_label loc env] + | [_] -> [find_current_label loc env] | _ -> C.error loc "%s labels must be explicitly instantiated" x @@ -3343,7 +3317,7 @@ let add_label info lab = in let tl = Logic_const.new_identified_term tl in match d with - FromAny -> (tl,FromAny) + FromAny -> (tl,Cil_types.FromAny) | From f -> let tf = List.map (term_lval_assignable ctxt ~accept_formal:true env) f @@ -3356,11 +3330,11 @@ let add_label info lab = Logic_const.new_identified_term td) tf in - (tl, From tf) + (tl, Cil_types.From tf) let type_assign ctxt ~accept_formal env a = match a with - WritesAny -> WritesAny + WritesAny -> Cil_types.WritesAny | Writes l -> let res = List.map (type_from ctxt ~accept_formal env) l in (* we drop assigns \result; and assigns \exit_status; without from @@ -3371,10 +3345,10 @@ let add_label info lab = (fun (l,f) -> not (Logic_const.is_result l.it_content || Logic_const.is_exit_status l.it_content) - || f <> FromAny) + || f <> Cil_types.FromAny) res in - Writes res + Cil_types.Writes res let base_ctxt env = make_typing_context @@ -3417,11 +3391,11 @@ let add_label info lab = t in match p with - | Unroll_specs l -> Unroll_specs (List.map (term env) l) - | Widen_variables l -> Widen_variables (List.map (term_accept accept_var) l) + | Unroll_specs l -> Cil_types.Unroll_specs (List.map (term env) l) + | Widen_variables l -> Cil_types.Widen_variables (List.map (term_accept accept_var) l) | Widen_hints l -> let accept t = accept_int t || accept_var t in - Widen_hints (List.map (term_accept accept) l) + Cil_types.Widen_hints (List.map (term_accept accept) l) let type_annot loc ti = let env = append_here_label (append_init_label (Lenv.empty())) in @@ -3560,10 +3534,10 @@ let add_label info lab = in let b_allocation= match bfa with - | FreeAllocAny -> FreeAllocAny + | FreeAllocAny -> Cil_types.FreeAllocAny | FreeAlloc(f,a) -> - FreeAlloc((List.map (id_term env) f), - List.map (id_term (post_state_env Normal)) a) + Cil_types.FreeAlloc((List.map (id_term env) f), + List.map (id_term (post_state_env Normal)) a) in let b_extended = List.map (type_extended ~typing_context ~loc) bext in { Cil_types.b_name; b_assumes; b_requires; b_post_cond; @@ -3630,12 +3604,13 @@ let add_label info lab = in type_spec old_behaviors vi.vdecl false log_return_typ env s let slice_pragma env = function - SPexpr t -> SPexpr (term env t) - | (SPctrl | SPstmt) as sp -> sp + SPexpr t -> Cil_types.SPexpr (term env t) + | SPctrl -> Cil_types.SPctrl + | SPstmt -> Cil_types.SPstmt let impact_pragma env = function - IPexpr t -> IPexpr (term env t) - | IPstmt as ip -> ip + IPexpr t -> Cil_types.IPexpr (term env t) + | IPstmt -> Cil_types.IPstmt let code_annot_env () = let env = append_here_label (append_pre_label (append_init_label @@ -3652,11 +3627,11 @@ let add_label info lab = check_behavior_names loc current_behaviors behav; Cil_types.AAssert (behav,predicate (code_annot_env()) p) | APragma (Impact_pragma sp) -> - Cil_types.APragma (Impact_pragma (impact_pragma (code_annot_env()) sp)) + Cil_types.APragma (Cil_types.Impact_pragma (impact_pragma (code_annot_env()) sp)) | APragma (Slice_pragma sp) -> - Cil_types.APragma (Slice_pragma (slice_pragma (code_annot_env()) sp)) + Cil_types.APragma (Cil_types.Slice_pragma (slice_pragma (code_annot_env()) sp)) | APragma (Loop_pragma lp) -> - Cil_types.APragma (Loop_pragma (loop_pragma (code_annot_env()) lp)) + Cil_types.APragma (Cil_types.Loop_pragma (loop_pragma (code_annot_env()) lp)) | AStmtSpec (behav,s) -> (* function behaviors and statement behaviors are not at the same level. Do not mix them in a complete or disjoint clause @@ -3681,9 +3656,9 @@ let add_label info lab = check_behavior_names loc current_behaviors behav; Cil_types.AAllocation(behav, (match fa with - | FreeAllocAny -> FreeAllocAny + | FreeAllocAny -> Cil_types.FreeAllocAny | FreeAlloc(f,a) -> - FreeAlloc((List.map (id_term (loop_annot_env())) f), + Cil_types.FreeAlloc((List.map (id_term (loop_annot_env())) f), List.map (id_term (loop_annot_env())) a))); | AAssigns (behav,a) -> let env = loop_annot_env () in @@ -3763,9 +3738,9 @@ let add_label info lab = (fun l (labs,e) -> try let _ = Lenv.find_logic_label l e in - C.error loc "multiply defined label `%s'" l + C.error loc "multiple defined label `%s'" l with Not_found -> - let lab = LogicLabel (None, l) in + let lab = FormalLabel l in (lab::labs,Lenv.add_logic_label l lab e)) labels ([],env) in diff --git a/src/kernel_services/ast_queries/logic_typing.mli b/src/kernel_services/ast_queries/logic_typing.mli index bd13f5ce702c1fd27d0e89a5c61af0f124d2f4b3..fa8904f49ce3f0c8e9d24cb0e98a6b442b7e76ec 100644 --- a/src/kernel_services/ast_queries/logic_typing.mli +++ b/src/kernel_services/ast_queries/logic_typing.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -119,8 +119,8 @@ type typing_context = { typing_context -> Lenv.t -> Logic_ptree.lexpr -> term; type_assigns: typing_context -> - accept_formal:bool -> - Lenv.t -> Logic_ptree.lexpr assigns -> identified_term assigns; + accept_formal:bool -> + Lenv.t -> Logic_ptree.assigns -> assigns; error: 'a 'b. location -> ('a,Format.formatter,unit,'b) format4 -> 'a; } diff --git a/src/kernel_services/ast_queries/logic_utils.ml b/src/kernel_services/ast_queries/logic_utils.ml index 303aecdd72c6dff1ce0f06c07cde132b62844290..2e1d834acf69ed1ff87000437ba3c554d5c7387c 100644 --- a/src/kernel_services/ast_queries/logic_utils.ml +++ b/src/kernel_services/ast_queries/logic_utils.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -344,6 +344,52 @@ let numeric_coerce ltyp t = | _ -> coerce t) | _ -> coerce t +(* Don't forget to keep is_zero_comparable + and scalar_term_to_predicate in sync. +*) + +let is_zero_comparable t = + match unroll_type t.term_type with + | Ctype (TInt _ | TFloat _ | TPtr _ | TArray _ | TFun _) -> true + | Ctype _ -> false + | Linteger | Lreal -> true + | Ltype ({lt_name},[]) -> lt_name = Utf8_logic.boolean + | Ltype _ -> false + | Lvar _ | Larrow _ -> false + +let scalar_term_to_predicate t = + let loc = t.term_loc in + let conversion zero = prel ~loc (Cil_types.Rneq, t, zero) in + let arith_conversion () = conversion (Cil.lzero ~loc ()) in + let ptr_conversion () = conversion (Logic_const.term ~loc Tnull t.term_type) + in + match unroll_type t.term_type with + | Ctype (TInt _) -> arith_conversion () + | Ctype (TFloat _) -> + conversion + (Logic_const.treal_zero ~loc ~ltyp:t.term_type ()) + | Ctype (TPtr _) -> ptr_conversion () + | Ctype (TArray _) -> ptr_conversion () + (* Could be transformed to \true: an array is never \null *) + | Ctype (TFun _) -> ptr_conversion () + (* decay as pointer *) + | Linteger -> arith_conversion () + | Lreal -> conversion (Logic_const.treal_zero ~loc ()) + | Ltype ({lt_name = name},[]) when name = Utf8_logic.boolean -> + let ctrue = Logic_env.Logic_ctor_info.find "\\true" in + prel ~loc + (Cil_types.Req,t, + { term_node = TDataCons(ctrue,[]); + term_loc = loc; + term_type = Ltype(ctrue.ctor_type,[]); + term_name = []; + }) + | Ltype _ | Lvar _ | Larrow _ + | Ctype (TVoid _ | TNamed _ | TComp _ | TEnum _ | TBuiltin_va_list _) + -> Kernel.fatal + "Cannot convert to predicate a term of type %a" + Cil_printer.pp_logic_type t.term_type + let rec expr_to_term ~cast e = let e_typ = unrollType (Cil.typeOf e) in let loc = e.eloc in @@ -426,6 +472,26 @@ and offset_to_term_offset ~cast:cast = function TIndex (expr_to_term_coerce ~cast e,offset_to_term_offset ~cast off) | Field (fi,off) -> TField(fi,offset_to_term_offset ~cast off) +and expr_to_predicate ~cast e = + let open Cil_types in + match e.enode with + | BinOp ((Lt | Gt | Le | Ge | Eq | Ne as op), l, r, _) -> + let tl = expr_to_term ~cast l in + let tr = expr_to_term ~cast r in + let rel = match op with + | Lt -> Rlt | Gt -> Rgt | Le -> Rle | Ge -> Rge | Eq -> Req | Ne -> Rneq + | _ -> assert false + in + let pred = Prel (rel, tl, tr) in + Logic_const.new_predicate (Logic_const.unamed ~loc:e.eloc pred) + | _ -> + let t = expr_to_term ~cast e in + if is_zero_comparable t then + Logic_const.new_predicate (scalar_term_to_predicate t) + else + Kernel.fatal + "Cannot convert into predicate the C expression %a" + Cil_printer.pp_exp e let array_with_range arr size = let loc = arr.eloc in @@ -521,25 +587,9 @@ let rec add_attribute_glob_annot a g = let is_same_list f l1 l2 = try List.for_all2 f l1 l2 with Invalid_argument _ -> false -(* [VP 2011-04-19] StmtLabel case is a bit restricted, but it's not really - possible to do any better, and this function should not be called in - contexts where it matters. *) -let is_same_logic_label l1 l2 = - match l1, l2 with - StmtLabel s1, StmtLabel s2 -> !s1 == !s2 - | StmtLabel _, LogicLabel _ - | LogicLabel _, StmtLabel _ -> false - (* What is important here is the name of the logic label, not - the hypothetical statement it is referring to. *) - | LogicLabel (_, l1), LogicLabel (_, l2) -> l1 = l2 - -(* same remark as above *) -let compare_logic_label l1 l2 = - match l1, l2 with - | StmtLabel s1, StmtLabel s2 -> Cil_datatype.Stmt.compare !s1 !s2 - | StmtLabel _, LogicLabel _ -> 1 - | LogicLabel _, StmtLabel _ -> -1 - | LogicLabel (_,l1), LogicLabel(_,l2) -> String.compare l1 l2 +let is_same_logic_label l1 l2 = Cil_datatype.Logic_label.equal l1 l2 + +let compare_logic_label l1 l2 = Cil_datatype.Logic_label.compare l1 l2 let is_same_opt f x1 x2 = match x1,x2 with @@ -740,7 +790,7 @@ let rec is_same_term t1 t2 = | Tapp(f1,labels1, args1), Tapp(f2, labels2, args2) -> is_same_logic_signature f1 f2 && List.for_all2 - (fun (x,y) (t,z) -> is_same_logic_label x t && is_same_logic_label y z) + is_same_logic_label labels1 labels2 && List.for_all2 is_same_term args1 args2 | Tif(c1,t1,e1), Tif(c2,t2,e2) -> @@ -835,9 +885,7 @@ and is_same_predicate_node p1 p2 = | Papp(i1,labels1,args1), Papp(i2,labels2,args2) -> is_same_logic_signature i1 i2 && List.for_all2 - (fun (x,y) (z,t) -> - is_same_logic_label x z && - is_same_logic_label y t) + is_same_logic_label labels1 labels2 && @@ -918,7 +966,7 @@ let is_same_allocation a1 a2 = is_same_list is_same_identified_term a1 a2 | (FreeAllocAny | FreeAlloc _), _ -> false -let is_same_variant (v1,o1 : _ Cil_types.variant) (v2,o2: _ Cil_types.variant) = +let is_same_variant (v1,o1 : Cil_types.variant) (v2,o2: Cil_types.variant) = is_same_term v1 v2 && (match o1, o2 with None, None -> true | None, _ | _, None -> false | Some o1, Some o2 -> o1 = o2) @@ -1246,10 +1294,11 @@ and is_same_lexpr l1 l2 = | PLset _ | PLempty ),_ -> false -let hash_label l = +let hash_label l = match l with - StmtLabel _ -> 0 (* We can't rely on sid at this point. *) - | LogicLabel (_,l) -> 19 + Hashtbl.hash l + StmtLabel _ -> 0 (* We can't rely on sid at this point. *) + | BuiltinLabel (_,l) -> 19 + Hashtbl.hash l + | FormalLabel s -> 23 + Hashtbl.hash s exception StopRecursion of int @@ -1277,9 +1326,9 @@ let rec hash_term (acc,depth,tot) t = | TStartOf lv -> hash_term_lval (acc+209,depth-1,tot-1) lv | Tapp (li,labs,apps) -> let hash1 = acc + 228 + Hashtbl.hash li.l_var_info.lv_name in - let hash_lb (acc,tot) (_,lb) = + let hash_lb (acc,tot) l = if tot = 0 then raise (StopRecursion acc) - else (acc + hash_label lb,tot - 1) + else (acc + hash_label l,tot - 1) in let hash_one_term (acc,tot) t = hash_term (acc,depth-1,tot) t in let res = List.fold_left hash_lb (hash1,tot-1) labs in @@ -1443,11 +1492,7 @@ let rec compare_term t1 t2 = | Tapp(f1,labels1, args1), Tapp(f2, labels2, args2) -> let res = compare_logic_signature f1 f2 in if res = 0 then - let compare_labels (x,y) (t,z) = - let res = compare_logic_label x t in - if res = 0 then compare_logic_label y z else res - in - let res = Extlib.list_compare compare_labels labels1 labels2 in + let res = Extlib.list_compare compare_logic_label labels1 labels2 in if res = 0 then Extlib.list_compare compare_term args1 args2 else res else res | Tapp _, _ -> 1 @@ -1620,11 +1665,7 @@ and compare_predicate_node p1 p2 = | Papp(i1,labels1,args1), Papp(i2,labels2,args2) -> let res = compare_logic_signature i1 i2 in if res = 0 then - let compare_labels (x,y) (z,t) = - let res = compare_logic_label x z in - if res = 0 then compare_logic_label y t else res - in - let res = Extlib.list_compare compare_labels labels1 labels2 in + let res = Extlib.list_compare compare_logic_label labels1 labels2 in if res = 0 then Extlib.list_compare compare_term args1 args2 else res else res | Papp _, _ -> 1 diff --git a/src/kernel_services/ast_queries/logic_utils.mli b/src/kernel_services/ast_queries/logic_utils.mli index 499e57d5bf1ffb8bbc88cc843ad8d25fc9a30424..cb16838906a34a27dc2fb8772684d63962256a74 100644 --- a/src/kernel_services/ast_queries/logic_utils.mli +++ b/src/kernel_services/ast_queries/logic_utils.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -167,7 +167,6 @@ val points_to_valid_string: ?loc:location -> term -> predicate addition is translated into an addition of [real] numbers). @plugin development guide *) val expr_to_term : cast:bool -> exp -> term - (** same as {!expr_to_term}, except that if the new term has an arithmetic type, it is automatically coerced into real (or integer for integral types). @@ -175,6 +174,32 @@ val expr_to_term : cast:bool -> exp -> term *) val expr_to_term_coerce: cast:bool -> exp -> term +val is_zero_comparable: term -> bool +(** [true] if the given term has a type for which a comparison to 0 exists + (i.e. scalar C types, logic integers and reals). + + @since Frama-C+dev +*) + +val expr_to_predicate: cast:bool -> exp -> identified_predicate +(** same as {expr_to_term}, but the result is a predicate. Expressions starting + with relational operators ([==], [<=], etc) are translated directly. + Otherwise, the result of [expr_to_predicate e] is the predicate + [e <> 0]. + + @raise Fatal error if the expression is not a comparison and cannot be + compared to zero. + @since Frama-C+dev +*) + +val scalar_term_to_predicate: term -> predicate +(** Compare the given term with the constant 0 (of the appropriate type) + to return the result of the comparison [e <> 0]. + + @raise Fatal error if the argument cannot be compared to 0 + @since Frama-C+dev +*) + val lval_to_term_lval : cast:bool -> lval -> term_lval val host_to_term_host : cast:bool -> lhost -> term_lhost val offset_to_term_offset : @@ -226,7 +251,7 @@ val is_trivially_false: predicate -> bool (** {2 Global annotations} *) (** add an attribute to a global annotation - @since Frama-C+dev + @since Phosphorus-20170501-beta1 *) val add_attribute_glob_annot: attribute -> global_annotation -> global_annotation @@ -273,14 +298,12 @@ val is_same_identified_predicate : identified_predicate -> identified_predicate -> bool val is_same_identified_term : identified_term -> identified_term -> bool -val is_same_deps : - identified_term deps -> - identified_term deps -> bool +val is_same_deps : deps -> deps -> bool val is_same_allocation : - identified_term allocation -> identified_term allocation -> bool + allocation -> allocation -> bool val is_same_assigns : - identified_term assigns -> identified_term assigns -> bool -val is_same_variant : term variant -> term variant -> bool + assigns -> assigns -> bool +val is_same_variant : variant -> variant -> bool val is_same_post_cond : termination_kind * identified_predicate -> termination_kind * identified_predicate -> bool @@ -290,17 +313,10 @@ val is_same_logic_type_def : logic_type_def -> logic_type_def -> bool val is_same_logic_type_info : logic_type_info -> logic_type_info -> bool -val is_same_loop_pragma : - term loop_pragma -> - term loop_pragma -> bool -val is_same_slice_pragma : - term slice_pragma -> - term slice_pragma -> bool -val is_same_impact_pragma : - term impact_pragma -> - term impact_pragma -> bool -val is_same_pragma : - term pragma -> term pragma -> bool +val is_same_loop_pragma : loop_pragma -> loop_pragma -> bool +val is_same_slice_pragma : slice_pragma -> slice_pragma -> bool +val is_same_impact_pragma : impact_pragma -> impact_pragma -> bool +val is_same_pragma : pragma -> pragma -> bool val is_same_code_annotation : code_annotation -> code_annotation -> bool val is_same_global_annotation : global_annotation -> global_annotation -> bool val is_same_axiomatic : @@ -323,29 +339,21 @@ val get_behavior_names : spec -> string list (** Concatenates two assigns if both are defined, returns WritesAny if one (or both) of them is WritesAny. @since Nitrogen-20111001 *) -val concat_assigns: - identified_term assigns -> - identified_term assigns -> identified_term assigns +val concat_assigns: assigns -> assigns -> assigns (** merge assigns: take the one that is defined and select an arbitrary one if both are, emitting a warning unless both are syntactically the same. *) -val merge_assigns : - identified_term assigns -> - identified_term assigns -> identified_term assigns +val merge_assigns : assigns -> assigns -> assigns (** Concatenates two allocation clauses if both are defined, returns FreeAllocAny if one (or both) of them is FreeAllocAny. @since Nitrogen-20111001 *) -val concat_allocation: - identified_term allocation -> - identified_term allocation -> identified_term allocation +val concat_allocation: allocation -> allocation -> allocation (** merge allocation: take the one that is defined and select an arbitrary one if both are, emitting a warning unless both are syntactically the same. @since Oxygen-20120901 *) -val merge_allocation : - identified_term allocation -> - identified_term allocation -> identified_term allocation +val merge_allocation : allocation -> allocation -> allocation val merge_behaviors : silent:bool -> funbehavior list -> funbehavior list -> funbehavior list @@ -380,11 +388,11 @@ val is_loop_annot : code_annotation -> bool val is_trivial_annotation : code_annotation -> bool -val is_property_pragma : term pragma -> bool +val is_property_pragma : pragma -> bool (** Should this pragma be proved by plugins *) val extract_loop_pragma : - code_annotation list -> term loop_pragma list + code_annotation list -> loop_pragma list val extract_contract : code_annotation list -> (string list * funspec) list diff --git a/src/kernel_services/ast_transformations/clone.ml b/src/kernel_services/ast_transformations/clone.ml index e7cb316abef1c0426e9cbbba3b57c2e7305714ef..ce133b2fc8f34a8574fc176d02752f4c36444361 100644 --- a/src/kernel_services/ast_transformations/clone.ml +++ b/src/kernel_services/ast_transformations/clone.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_transformations/clone.mli b/src/kernel_services/ast_transformations/clone.mli index e49b3c554ed5fd6f8c18d05ce5a545a3130af1ee..4dc3cdf827bcc33e4906fd4f94c3b61eba7a2b1a 100644 --- a/src/kernel_services/ast_transformations/clone.mli +++ b/src/kernel_services/ast_transformations/clone.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/ast_transformations/filter.ml b/src/kernel_services/ast_transformations/filter.ml index 2d8c060cb0acd01990de754c80d96b44f682d7fa..a92ad1be60ef3e60518592e69edce67711875141 100644 --- a/src/kernel_services/ast_transformations/filter.ml +++ b/src/kernel_services/ast_transformations/filter.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -56,7 +56,7 @@ module type RemoveInfo = sig val fun_frees_visible : fct -> identified_term -> bool val fun_allocates_visible : fct -> identified_term -> bool - val fun_assign_visible : fct -> identified_term from -> bool + val fun_assign_visible : fct -> from -> bool val fun_deps_visible : fct -> identified_term -> bool val called_info : (proj * fct) -> stmt -> @@ -364,6 +364,17 @@ end = struct Cil.SkipChildren else Cil.SkipChildren (*copy has already been done by default visitor*) + method! vexpr e = + (* We may be creating entirely new expressions through the specialization + mechanism. When not performing a basic copy, refresh the ids. *) + let do_post e' = + if Cil_datatype.ExpStructEq.equal e e' then + e' + else + Cil.new_exp ~loc:e.eloc e'.enode + in + DoChildrenPost do_post + (*method vvdec _ = SkipChildren (* everything is done elsewhere *)*) method private add_formals_bindings v formals = @@ -434,10 +445,9 @@ end = struct pred_content = Ptrue}))) end - method private process_call call_stmt call = + method private process_call is_init_call call_stmt lval _f args loc = let finfo = self#get_finfo () in let info = (pinfo, finfo) in - let lval, _funcexp, args, loc = call in let called_info = Info.called_info info call_stmt in match called_info with | None -> call_stmt.skind @@ -447,7 +457,28 @@ end = struct let new_args = filter_params called_finfo args in let need_lval = Info.res_call_visible finfo call_stmt in let new_lval = if need_lval then lval else None in - let new_call = Call (new_lval, new_funcexp, new_args, loc) in + let new_call = + if is_init_call then begin + match lval with + | None -> (* initializer takes address of variable *) + if Info.param_visible called_finfo 1 then begin + match new_args with + | { enode = AddrOf (Var v, NoOffset) } :: args -> + Local_init(v, ConsInit(var_slice,args,Constructor), loc) + | _ -> assert false (* We have kept the first argument. *) + end else begin + (* variable is useless. *) + Call(None, new_funcexp, new_args, loc) + end + | Some _ -> + (match new_lval with + | None -> Call (None, new_funcexp, new_args, loc) + | Some (Var v, NoOffset) -> + Local_init(v, ConsInit(var_slice, new_args, Plain_func), loc) + | Some _ -> assert false (* destination must be a variable *)) + end + else Call (new_lval, new_funcexp, new_args, loc) + in debug1 "[process_call] call %s@." var_slice.vname; Instr (new_call) @@ -516,6 +547,17 @@ end = struct assert false (* a block is always visible *) | TryFinally _ | TryExcept _ -> assert false (*TODO*) | Return (_,l) -> mk_new_stmt s (Return (None,l)) + | Instr (Local_init (v, _, _)) -> + (* The initialization of the variable is useless (e.g. because it is + overwritten before being read). Just treat it as uninitialized. + Note that if the variable itself is invisible, we don't have + anything to do: it will not appear at all in the function. + *) + if Info.loc_var_visible (self#get_finfo()) v then begin + let v' = Cil.get_varinfo self#behavior v in + v'.vdefined <- false; + end; + mk_new_stmt s (mk_stmt_skip s) | _ -> mk_new_stmt s (mk_stmt_skip s)); debug2 "@[<hov 10>[process_invisible_stmt] gives sid:%d@ @[%a@]@]@." s.sid Printer.pp_stmt s; @@ -525,12 +567,22 @@ end = struct ChangeDoChildrenPost(s, do_after) method private process_visible_stmt s = - debug2 "[process_visible_stmt] does sid:%d@." s.sid; + debug2 "[process_visible_stmt] does sid:%d@." s.sid; let finfo = self#get_finfo () in (match s.skind with - | Instr (Call (lval, funcexp, args, loc)) -> - let call = (lval, funcexp, args, loc) in - let new_call = self#process_call s call in + | Instr (Call (lval, f, args, loc)) -> + let new_call = self#process_call false s lval f args loc in + mk_new_stmt s new_call + | Instr (Local_init(v, ConsInit(f, args, kind), loc)) -> + let new_call = + Cil.treat_constructor_as_func + (self#process_call true s) v f args kind loc + in + (match new_call with + | Instr(Call _) -> + (* initialization's result was found to be useless. *) + v.vdefined <- false + | _ -> ()); mk_new_stmt s new_call | _ -> () (* copy the statement before modifying it *) (* mk_new_stmt s [] s.skind *) diff --git a/src/kernel_services/ast_transformations/filter.mli b/src/kernel_services/ast_transformations/filter.mli index f3099e23a024e40cbbf90a59b9c90445387b8f0d..d2c05f9f171c7c56f0e262e61650153e2d86a370 100644 --- a/src/kernel_services/ast_transformations/filter.mli +++ b/src/kernel_services/ast_transformations/filter.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -86,7 +86,7 @@ module type RemoveInfo = sig val fun_frees_visible : fct -> identified_term -> bool val fun_allocates_visible : fct -> identified_term -> bool - val fun_assign_visible : fct -> identified_term from -> bool + val fun_assign_visible : fct -> from -> bool (** true if the assigned value (first component of the from) is visible @raise EraseAssigns to indicate that the corresponding assigns clause should be erased entirely (i.e. assigns everything. If it were to diff --git a/src/kernel_services/cmdline_parameters/cmdline.ml b/src/kernel_services/cmdline_parameters/cmdline.ml index 5f0fa1e9a9edd1ae5e1952f6d287ad6a7c92ef2d..8988d8462c1e7651500a9baa1225e776ba3b941f 100644 --- a/src/kernel_services/cmdline_parameters/cmdline.ml +++ b/src/kernel_services/cmdline_parameters/cmdline.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/cmdline.mli b/src/kernel_services/cmdline_parameters/cmdline.mli index 695210545decf74dac328189e622ed4e1881cfa4..2c15ed295cedba48849d5974ecc21482365a38d2 100644 --- a/src/kernel_services/cmdline_parameters/cmdline.mli +++ b/src/kernel_services/cmdline_parameters/cmdline.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -241,7 +241,7 @@ val list_plugins: unit -> exit (** Display the list of all installed plug-ins and their options, in a condensed format. Used for zsh autocompletion. - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) val list_all_plugin_options : print_invisible:bool -> exit val plugin_help: string -> exit diff --git a/src/kernel_services/cmdline_parameters/parameter_builder.ml b/src/kernel_services/cmdline_parameters/parameter_builder.ml index 2da9ef02340b81d5cd85b7223a714326ebdb56c1..affee3cffb5423d00f21b6553d703f68c959080e 100644 --- a/src/kernel_services/cmdline_parameters/parameter_builder.ml +++ b/src/kernel_services/cmdline_parameters/parameter_builder.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_builder.mli b/src/kernel_services/cmdline_parameters/parameter_builder.mli index b56440c192c09225c14e560d49dc4fd0a8f57ce9..bd44e21defaf9ce6df8558152f22565d0235940a 100644 --- a/src/kernel_services/cmdline_parameters/parameter_builder.mli +++ b/src/kernel_services/cmdline_parameters/parameter_builder.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_category.ml b/src/kernel_services/cmdline_parameters/parameter_category.ml index 5322b2adb316a6309738204559e334a27fff7578..a41150a2dab3f0b54f361b474b76b86c8c7890a2 100644 --- a/src/kernel_services/cmdline_parameters/parameter_category.ml +++ b/src/kernel_services/cmdline_parameters/parameter_category.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_category.mli b/src/kernel_services/cmdline_parameters/parameter_category.mli index 4e053e80442af5296c13683a54c915137d7a75e9..af68da73de27ec31587a54d415a19609c4b30d02 100644 --- a/src/kernel_services/cmdline_parameters/parameter_category.mli +++ b/src/kernel_services/cmdline_parameters/parameter_category.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_customize.ml b/src/kernel_services/cmdline_parameters/parameter_customize.ml index c8c6fb0d8d6df2c5d022b87fdb79d31b6ba7058c..10ce13f441a77d7291f0aec470dabfd9d977a145 100644 --- a/src/kernel_services/cmdline_parameters/parameter_customize.ml +++ b/src/kernel_services/cmdline_parameters/parameter_customize.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_customize.mli b/src/kernel_services/cmdline_parameters/parameter_customize.mli index 933cf5214e6b6653639fca74428cc0f184f114e9..e0d3ccdfc057946c585be33397205f20fdde1444 100644 --- a/src/kernel_services/cmdline_parameters/parameter_customize.mli +++ b/src/kernel_services/cmdline_parameters/parameter_customize.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_sig.mli b/src/kernel_services/cmdline_parameters/parameter_sig.mli index 7c5206c5ea64a98de133e91f4bb1f0093105bc36..8ba442d1f36cef79171ffa61ed05c6ba1bb436e2 100644 --- a/src/kernel_services/cmdline_parameters/parameter_sig.mli +++ b/src/kernel_services/cmdline_parameters/parameter_sig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_state.ml b/src/kernel_services/cmdline_parameters/parameter_state.ml index 058f5d879aa1365e8f03d2834240f1f6f77ad11c..6eedbfa5b63810a60562a3c5398986b7b7f47633 100644 --- a/src/kernel_services/cmdline_parameters/parameter_state.ml +++ b/src/kernel_services/cmdline_parameters/parameter_state.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/parameter_state.mli b/src/kernel_services/cmdline_parameters/parameter_state.mli index e8cb276395eee0ed792cb49ecf7521ba47cb9cea..6e0374d53de384102dc2121a4068e80d903a594b 100644 --- a/src/kernel_services/cmdline_parameters/parameter_state.mli +++ b/src/kernel_services/cmdline_parameters/parameter_state.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/typed_parameter.ml b/src/kernel_services/cmdline_parameters/typed_parameter.ml index 2ebc746446d8afef6fddde64096024e5c97a973b..f7eca041b4e85ee4d4744540134e339c1372878c 100644 --- a/src/kernel_services/cmdline_parameters/typed_parameter.ml +++ b/src/kernel_services/cmdline_parameters/typed_parameter.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/cmdline_parameters/typed_parameter.mli b/src/kernel_services/cmdline_parameters/typed_parameter.mli index 48ba08f2b205a0a376f67589d31650172eb2a771..b73db5b202a6556bf771c4ca60855a76a80fe7cf 100644 --- a/src/kernel_services/cmdline_parameters/typed_parameter.mli +++ b/src/kernel_services/cmdline_parameters/typed_parameter.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/parsetree/cabshelper.ml b/src/kernel_services/parsetree/cabshelper.ml index fc046b25a1ee058ffaa10f3dd4501ec053290c37..bee64ffca749e4fce3a954a6d3da1efc0f19d19e 100644 --- a/src/kernel_services/parsetree/cabshelper.ml +++ b/src/kernel_services/parsetree/cabshelper.ml @@ -223,7 +223,7 @@ let pop_attr_test () = ignore (Stack.pop state_stack) let is_attr_test () = Stack.top state_stack = Test let mk_behavior ?(name=Cil.default_behavior_name) ?(assumes=[]) ?(requires=[]) - ?(post_cond=[]) ?(assigns=Cil_types.WritesAny) ?(allocation=Cil_types.FreeAllocAny) ?(extended=[]) () + ?(post_cond=[]) ?(assigns=Logic_ptree.WritesAny) ?(allocation=Logic_ptree.FreeAllocAny) ?(extended=[]) () = { Logic_ptree.b_name = name; b_assumes = assumes; (* must be always empty for default_behavior_name *) diff --git a/src/kernel_services/parsetree/cabshelper.mli b/src/kernel_services/parsetree/cabshelper.mli index df558504f83bba7e6bb0c8909881b266013800d7..13a295600e72f9bd53dc4d8ae509608d81dc6cbf 100644 --- a/src/kernel_services/parsetree/cabshelper.mli +++ b/src/kernel_services/parsetree/cabshelper.mli @@ -82,8 +82,8 @@ val mk_behavior : ?assumes:Logic_ptree.lexpr list -> ?requires:Logic_ptree.lexpr list -> ?post_cond:(Cil_types.termination_kind * Logic_ptree.lexpr) list -> - ?assigns:Logic_ptree.lexpr Cil_types.assigns -> - ?allocation:Logic_ptree.lexpr Cil_types.allocation -> + ?assigns:Logic_ptree.assigns -> + ?allocation:Logic_ptree.allocation -> ?extended:Logic_ptree.extension list -> unit -> Logic_ptree.behavior diff --git a/src/kernel_services/parsetree/logic_ptree.mli b/src/kernel_services/parsetree/logic_ptree.mli index f76476fa6ebe8c50a1b6cec8be010ebfc6ecd20e..c0dbfe04c2e8aa5428535751cef5571ffe08d295 100644 --- a/src/kernel_services/parsetree/logic_ptree.mli +++ b/src/kernel_services/parsetree/logic_ptree.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -244,7 +244,29 @@ and decl_node = | LDvolatile of lexpr list * (string option * string option) (** volatile clause read/write. *) -and deps = lexpr Cil_types.deps (** C locations. *) +(** dependencies of an assigned location. *) +and deps = + | From of lexpr list (** tsets. Empty list means \nothing. *) + | FromAny (** Nothing specified. Any location can be involved. *) + +and from = (lexpr * deps) + +(** zone assigned with its dependencies. *) +and assigns = + | WritesAny (** Nothing specified. Anything can be written. *) + | Writes of from list + (** list of locations that can be written. Empty list means \nothing. *) + +(** allocates and frees. + @since Oxygen-20120901 *) +and allocation = + | FreeAlloc of lexpr list * lexpr list (** tsets. Empty list means \nothing. *) + | FreeAllocAny (** Nothing specified. Semantics depends on where it + is written. *) + +(** variant of a loop or a recursive function. *) +and variant = lexpr * string option + type extension = string * lexpr list @@ -255,8 +277,8 @@ type behavior = { mutable b_requires : lexpr list; (** require clauses. *) mutable b_assumes : lexpr list; (** assume clauses. *) mutable b_post_cond : (Cil_types.termination_kind * lexpr) list; (** post-condition. *) - mutable b_assigns : lexpr Cil_types.assigns; (** assignments. *) - mutable b_allocation : lexpr Cil_types.allocation; (** frees, allocates. *) + mutable b_assigns : assigns; (** assignments. *) + mutable b_allocation : allocation; (** frees, allocates. *) mutable b_extended : extension list (** extensions *) } @@ -266,7 +288,7 @@ type spec = { mutable spec_behavior : behavior list; (** behaviors *) - mutable spec_variant : lexpr Cil_types.variant option; + mutable spec_variant : variant option; (** variant for recursive functions. *) mutable spec_terminates: lexpr option; @@ -281,7 +303,32 @@ type spec = { It is possible to have more than one set of disjoint behaviors *) } -(** all annotations that can be found in the code. This type shares the name of +(** Pragmas for the value analysis plugin of Frama-C. *) + +type loop_pragma = + | Unroll_specs of lexpr list + | Widen_hints of lexpr list + | Widen_variables of lexpr list + +(** Pragmas for the slicing plugin of Frama-C. *) +and slice_pragma = + | SPexpr of lexpr + | SPctrl + | SPstmt + +(** Pragmas for the impact plugin of Frama-C. *) +and impact_pragma = + | IPexpr of lexpr + | IPstmt + +(** The various kinds of pragmas. *) +and pragma = + | Loop_pragma of loop_pragma + | Slice_pragma of slice_pragma + | Impact_pragma of impact_pragma + + +(** all annotations that can be found in the code. This type shares the name of its constructors with {!Cil_types.code_annotation_node}. *) type code_annot = | AAssert of string list * lexpr @@ -297,31 +344,25 @@ type code_annot = this invariant applies. The boolean flag is true for normal loop invariants and false for invariant-as-assertions. *) - | AVariant of lexpr Cil_types.variant + | AVariant of variant (** loop variant. Note that there can be at most one variant associated to a given statement *) - | AAssigns of string list * lexpr Cil_types.assigns + | AAssigns of string list * assigns (** loop assigns. (see [b_assigns] in the behaviors for other assigns). At most one clause associated to a given (statement, behavior) couple. *) - | AAllocation of string list * lexpr Cil_types.allocation + | AAllocation of string list * allocation (** loop allocation clause. (see [b_allocation] in the behaviors for other allocation clauses). At most one clause associated to a given (statement, behavior) couple. @since Oxygen-20120901 when [b_allocation] has been added. *) - | APragma of lexpr Cil_types.pragma (** pragma. *) + | APragma of pragma (** pragma. *) | AExtended of string list * extension (** extension in a loop annotation. @since Silicon-20161101 *) -(** assignment performed by a C function. *) -type assigns = lexpr Cil_types.assigns - -(** variant for loop or recursive function. *) -type variant = lexpr Cil_types.variant - (** custom trees *) type custom_tree = diff --git a/src/kernel_services/plugin_entry_points/db.ml b/src/kernel_services/plugin_entry_points/db.ml index 4993d188bdb89dfdedf6dc8cd8ac21e46f5c99db..e66601dbd6fa6edb9ef7343fbe3de50a4299444e 100644 --- a/src/kernel_services/plugin_entry_points/db.ml +++ b/src/kernel_services/plugin_entry_points/db.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -275,22 +275,22 @@ module Value = struct FunArgs.self; VGlobals.self ] - let size = 1789 + let size = 256 module States_by_callstack = Value_types.Callstack.Hashtbl.Make(Cvalue.Model) - module Table_By_Callstack = + module Table_By_Callstack = Cil_state_builder.Stmt_hashtbl(States_by_callstack) (struct - let name = "Value analysis results by callstack" + let name = "Db.Value.Table_By_Callstack" let size = size let dependencies = dependencies end) module Table = Cil_state_builder.Stmt_hashtbl(Cvalue.Model) (struct - let name = "Value analysis results" + let name = "Db.Value.Table" let size = size let dependencies = [ Table_By_Callstack.self ] end) @@ -309,12 +309,12 @@ module Value = struct ) - module AfterTable_By_Callstack = + module AfterTable_By_Callstack = Cil_state_builder.Stmt_hashtbl(States_by_callstack) (struct - let name = "Value analysis results after states by callstack" + let name = "Db.Value.AfterTable_By_Callstack" let size = size - let dependencies = dependencies + let dependencies = [ Table_By_Callstack.self ] end) @@ -332,7 +332,7 @@ module Value = struct Cil_state_builder.Stmt_hashtbl (Datatype.Int) (struct - let name = "Conditions statuses" + let name = "Db.Value.Conditions_table" let size = 101 let dependencies = only_self end) @@ -374,7 +374,7 @@ module Value = struct State_builder.Hashtbl(Kernel_function.Hashtbl) (States_by_callstack) (struct - let name = "called_functions_by_callstack" + let name = "Db.Value.Called_Functions_By_Callstack" let size = 11 let dependencies = only_self end) @@ -383,7 +383,7 @@ module Value = struct State_builder.Hashtbl(Kernel_function.Hashtbl) (Cvalue.Model) (struct - let name = "called_functions_memo" + let name = "Db.Value.Called_Functions_Memo" let size = 11 let dependencies = [ Called_Functions_By_Callstack.self ] end) @@ -441,7 +441,8 @@ module Value = struct module Call_Type_Value_Callbacks = Hook.Build(struct - type t = [`Builtin of Value_types.call_result | `Spec | `Def | `Memexec] + type t = [`Builtin of Value_types.call_result | `Spec of funspec + | `Def | `Memexec] * state * (kernel_function * kinstr) list end) ;; @@ -450,10 +451,15 @@ module Value = struct Hook.Build (struct type t = stmt * callstack * state list end) + (* -remove-redundant-alarms feature, applied at the end of an Eva analysis, + fulfilled by the Scope plugin that also depends on Eva. We thus use a + reference here to avoid a cyclic dependency. *) + let rm_asserts = mk_fun "Value.rm_asserts" + let no_results = mk_fun "Value.no_results" let update_callstack_table ~after stmt callstack v = - let open Value_types in + let open Value_types in let find,add = if after then AfterTable_By_Callstack.find, AfterTable_By_Callstack.add @@ -461,11 +467,11 @@ module Value = struct in try let by_callstack = find stmt in - begin try - let o = Callstack.Hashtbl.find by_callstack callstack in - Callstack.Hashtbl.replace by_callstack callstack(Cvalue.Model.join o v) - with Not_found -> - Callstack.Hashtbl.add by_callstack callstack v + begin try + let o = Callstack.Hashtbl.find by_callstack callstack in + Callstack.Hashtbl.replace by_callstack callstack(Cvalue.Model.join o v) + with Not_found -> + Callstack.Hashtbl.add by_callstack callstack v end; with Not_found -> let r = Callstack.Hashtbl.create 7 in @@ -548,7 +554,7 @@ module Value = struct assert (is_computed ()); (* this assertion fails during value analysis *) try Some (if after then AfterTable_By_Callstack.find stmt else - Table_By_Callstack.find stmt) + Table_By_Callstack.find stmt) with Not_found -> None let fold_stmt_state_callstack f acc ~after stmt = @@ -592,7 +598,7 @@ module Value = struct let access_location = mk_fun "Value.access_location" - let find state loc = snd (Cvalue.Model.find state loc) + let find state loc = Cvalue.Model.find state loc let access = mk_fun "Value.access" let access_expr = mk_fun "Value.access_expr" @@ -613,12 +619,14 @@ module Value = struct mk_fun "Value.use_spec_instead_of_definition" let eval_lval = - ref (fun ~with_alarms:_ _ -> mk_labeled_fun "Value.eval_lval") + ref (fun ?with_alarms:_ _ -> mk_labeled_fun "Value.eval_lval") let eval_expr = - ref (fun ~with_alarms:_ _ -> mk_labeled_fun "Value.eval_expr") + ref (fun ?with_alarms:_ _ -> mk_labeled_fun "Value.eval_expr") let eval_expr_with_state = - ref (fun ~with_alarms:_ _ -> mk_labeled_fun "Value.eval_expr_with_state") + ref (fun ?with_alarms:_ _ -> mk_labeled_fun "Value.eval_expr_with_state") + + let reduce_by_cond = mk_fun "Value.reduce_by_cond" let find_lv_plus = mk_fun "Value.find_lv_plus" @@ -638,10 +646,11 @@ module Value = struct let call_to_kernel_function call_stmt = match call_stmt.skind with | Instr (Call (_, fexp, _, _)) -> let _, called_functions = - !expr_to_kernel_function - ~with_alarms:CilE.warn_none_mode ~deps:None + !expr_to_kernel_function ?with_alarms:None ~deps:None (Kstmt call_stmt) fexp in called_functions + | Instr(Local_init(_, ConsInit(f,_,_),_)) -> + Kernel_function.Hptset.singleton (Globals.Functions.get f) | _ -> raise Not_a_call @@ -654,6 +663,8 @@ module Value = struct let lval_to_zone = mk_fun "Value.lval_to_zone" let lval_to_zone_state = mk_fun "Value.lval_to_zone_state" let lval_to_zone_with_deps_state = mk_fun "Value.lval_to_zone_with_deps_state" + let lval_to_precise_loc_state = + ref (fun ?with_alarms:_ _ -> mk_labeled_fun "Value.lval_to_precise_loc") let lval_to_precise_loc_with_deps_state = mk_fun "Value.lval_to_precise_loc_with_deps_state" let assigns_inputs_to_zone = mk_fun "Value.assigns_inputs_to_zone" @@ -683,7 +694,7 @@ module Value = struct | { skind = Return (None, _) } -> raise Void_Function | _ -> assert false in - !lval_to_loc (Kstmt ki) ~with_alarms:CilE.warn_none_mode lval + !lval_to_loc (Kstmt ki) ?with_alarms:None lval with Kernel_function.No_Statement -> (* [JS 2011/05/17] should be better to have another name for this exception or another one since it is possible to have no return without @@ -817,25 +828,6 @@ module Pdg = struct end -(* ************************************************************************* *) -(** {2 Scope} *) -(* ************************************************************************* *) - -(** Interface for the Scope plugin *) -module Scope = struct - let get_data_scope_at_stmt = mk_fun "Datascope.get_data_scope_at_stmt" - let get_prop_scope_at_stmt = mk_fun "Datascope.get_prop_scope_at_stmt" - let check_asserts = mk_fun "Datascope.check_asserts" - let rm_asserts = mk_fun "Datascope.rm_asserts" - let get_defs = mk_fun "Datascope.get_defs" - let get_defs_with_type = mk_fun "Datascope.get_defs_with_type" - - type t_zones = Locations.Zone.t Stmt.Hashtbl.t - let build_zones = mk_fun "Pdg.build_zones" - let pretty_zones = mk_fun "Pdg.pretty_zones" - let get_zones = mk_fun "Pdg.get_zones" -end - (* ************************************************************************* *) (** {2 Spare Code} *) (* ************************************************************************* *) @@ -848,186 +840,6 @@ module Sparecode = struct ref (fun ?new_proj_name:_ -> mk_labeled_fun "Sparecode.rm_unused_globals") end -(* ************************************************************************* *) -(** {2 Slicing} *) -(* ************************************************************************* *) - -(** Interface for the slicing tool. *) -module Slicing = struct - - exception No_Project - exception Existing_Project - - let self = ref State.dummy - - let set_modes = - ref (fun ?calls:_ ?callers:_ ?sliceUndef:_ ?keepAnnotations:_ - ?print:_ _ -> mk_labeled_fun "Slicing.set_modes") - - (* TODO: merge with frama-c projects (?) *) - module Project = struct - type t = SlicingTypes.sl_project - let dyn_t = SlicingTypes.Sl_project.ty - - let default_slice_names = mk_fun "Slicing.Project.default_slice_names" - let extract = mk_fun "Slicing.Project.extract" - let pretty = mk_fun "Slicing.Project.pretty" - let print_extracted_project = - ref (fun ?fmt:_ ~extracted_prj:_ -> - mk_labeled_fun "Slicing.Project.print_extracted_project") - let print_dot = - ref (fun ~filename:_ ~title:_ _ -> - mk_labeled_fun "Slicing.Project.print_dot") - - let get_all = mk_fun "Slicing.Project.get_all" - let get_project = mk_fun "Slicing.Project.get_project" - let set_project = mk_fun "Slicing.Project.set_project" - let mk_project = mk_fun "Slicing.Project.mk_project" - let from_unique_name = mk_fun "Slicing.Project.from_unique_name" - let get_name = mk_fun "Slicing.Project.get_name" - - let is_directly_called_internal = - mk_fun "Slicing.Project.is_directly_called_internal" - let is_called = mk_fun "Slicing.Project.is_called" - let has_persistent_selection = - mk_fun "Slicing.Project.has_persistent_selection" - let change_slicing_level = - mk_fun "Slicing.Project.change_slicing_level" - end - - module Mark = struct - type t = SlicingTypes.sl_mark - let dyn_t = SlicingTypes.dyn_sl_mark - let compare = mk_fun "Slicing.Mark.compare" - let pretty = mk_fun "Slicing.Mark.pretty" - let make = - ref (fun ~data:_ ~addr:_ ~ctrl:_ -> mk_labeled_fun "Slicing.Mark.make") - let is_bottom = mk_fun "Slicing.Mark.is_bottom" - let is_spare = mk_fun "Slicing.Mark.is_spare" - let is_ctrl = mk_fun "Slicing.Mark.is_ctrl" - let is_data = mk_fun "Slicing.Mark.is_data" - let is_addr = mk_fun "Slicing.Mark.is_addr" - let get_from_src_func = mk_fun "Slicing.Mark.get_from_src_func" - end - - module Select = struct - type t = SlicingTypes.sl_select - let dyn_t = SlicingTypes.Sl_select.ty - type set = SlicingTypes.Fct_user_crit.t Cil_datatype.Varinfo.Map.t - module S = Cil_datatype.Varinfo.Map.Make(SlicingTypes.Fct_user_crit) - let dyn_set = S.ty - - let get_function = mk_fun "Slicing.Select.get_function" - let select_stmt = mk_fun "Slicing.Select.select_stmt" - let select_stmt_ctrl = mk_fun "Slicing.Select.select_stmt_ctrl" - let select_stmt_lval_rw = mk_fun "Slicing.Select.select_stmt_lval_rw" - let select_stmt_lval = mk_fun "Slicing.Select.select_stmt_lval" - let select_stmt_zone = mk_fun "Slicing.Select.select_stmt_zone" - let select_stmt_annots = mk_fun "Slicing.Select.select_stmt_annots" - let select_stmt_annot = mk_fun "Slicing.Select.select_stmt_annot" - let select_stmt_pred = mk_fun "Slicing.Select.select_stmt_pred" - let select_stmt_term = mk_fun "Slicing.Select.select_stmt_term" - let select_func_return = mk_fun "Slicing.Select.select_func_return" - let select_func_calls_to = mk_fun "Slicing.Select.select_func_calls_to" - let select_func_calls_into = mk_fun "Slicing.Select.select_func_calls_into" - let select_func_lval_rw = mk_fun "Slicing.Select.select_func_lval_rw" - let select_func_lval = mk_fun "Slicing.Select.select_func_lval" - let select_func_zone = mk_fun "Slicing.Select.select_func_zone" - let select_func_annots = mk_fun "Slicing.Select.select_func_annots" - let select_stmt_internal = mk_fun "Slicing.Select.select_stmt_internal" - let select_label_internal = mk_fun "Slicing.Select.select_label_internal" - let empty_selects = - Journal.register - "Db.Slicing.Select.empty_selects" - dyn_set - Cil_datatype.Varinfo.Map.empty - let add_to_selects_internal = - mk_fun "Slicing.Select.add_to_selects_internal" - let iter_selects_internal = - mk_fun "Slicing.Select.iter_selects_internal" - (* didn't manage to put this polymorphic function as a ref... *) - let fold_selects_internal f acc selections = - let r = ref acc in - let dof select = r := f !r select in - !iter_selects_internal dof selections; !r - let merge_internal = - mk_fun "Slicing.Select.merge_internal" - let select_min_call_internal = - mk_fun "Slicing.Select.select_min_call_internal" - let select_stmt_ctrl_internal = - mk_fun "Slicing.Select.select_control_stmt_ctrl" - let select_pdg_nodes = - mk_fun "Slicing.Select.select_pdg_nodes" - let select_entry_point_internal = - mk_fun "Slicing.Select.select_entry_point_internal" - let select_return_internal = - mk_fun "Slicing.Select.select_return_internal" - let select_decl_var_internal = - mk_fun "Slicing.Select.select_decl_var_internal" - let select_pdg_nodes_internal = - mk_fun "Slicing.Select.select_pdg_nodes_internal" - let select_stmt_zone_internal = - mk_fun "Slicing.Select.select_stmt_zone_internal" - let select_zone_at_entry_point_internal = - mk_fun "Slicing.Select.select_zone_at_entry_point_internal" - let select_modified_output_zone_internal = - mk_fun "Slicing.Select.select_modified_output_zone_internal" - let select_zone_at_end_internal = - mk_fun "Slicing.Select.select_zone_at_end_internal" - let pretty = mk_fun "Slicing.Select.pretty" - end - - module Slice = struct - type t = SlicingTypes.sl_fct_slice - let dyn_t = SlicingTypes.dyn_sl_fct_slice - let create = mk_fun "Slicing.Slice.create" - let remove = mk_fun "Slicing.Slice.remove" - let remove_uncalled = mk_fun "Slicing.Slice.remove_uncalled" - let get_all = mk_fun "Slicing.Slice.get_all" - let get_callers = mk_fun "Slicing.Slice.get_callers" - let get_called_slice = mk_fun "Slicing.Slice.get_called_slice" - let get_called_funcs = mk_fun "Slicing.Slice.get_called_funcs" - let get_function = mk_fun "Slicing.Slice.get_function" - let pretty = mk_fun "Slicing.Slice.pretty" - let get_mark_from_stmt = mk_fun "Slicing.Slice.get_mark_from_stmt" - let get_mark_from_local_var = - mk_fun "Slicing.Slice.get_mark_from_local_var" - let get_mark_from_formal = mk_fun "Slicing.Slice.get_mark_from_formal" - let get_mark_from_label = mk_fun "Slicing.Slice.get_from_label" - let get_user_mark_from_inputs = - mk_fun "Slicing.Slice.get_user_mark_from_inputs" - let get_num_id = - mk_fun "Slicing.Slice.get_num_id" - let from_num_id = - mk_fun "Slicing.Slice.from_num_id" - end - - module Request = struct - let add_selection = mk_fun "Slicing.Request.add_selection" - let add_persistent_selection = mk_fun "Slicing.Request.add_persistent_selection" - let add_persistent_cmdline = mk_fun "Slicing.Request.add_persistent_cmdline" - let is_already_selected_internal = - mk_fun "Slicing.Request.is_already_selected_internal" - let add_slice_selection_internal = - mk_fun "Slicing.Request.add_slice_selection_internal" - let add_selection_internal = - mk_fun "Slicing.Request.add_selection_internal" - let add_call_slice = mk_fun "Slicing.Request.add_call_slice" - let add_call_fun = mk_fun "Slicing.Request.add_call_fun" - let add_call_min_fun = mk_fun "Slicing.Request.add_call_min_fun" - let merge_slices = mk_fun "Slicing.Request.merge_slices" - let copy_slice = mk_fun "Slicing.Request.copy_slice" - let split_slice = mk_fun "Slicing.Request.split_slice" - let propagate_user_marks = mk_fun "Slicing.Request.propagate_user_marks" - let apply_all = mk_fun "Slicing.Request.apply_all" - let apply_all_internal = mk_fun "Slicing.Request.apply_all_internal" - let apply_next_internal = mk_fun "Slicing.Request.apply_next_internal" - let is_request_empty_internal = mk_fun "Slicing.Request.is_request_empty_internal" - let pretty = mk_fun "Slicing.Request.pretty" - end - -end - (* ************************************************************************* *) (** {2 Properties} *) (* ************************************************************************* *) @@ -1172,10 +984,10 @@ module Properties = struct end let add_assert emitter kf kinstr prop = - Kernel.deprecated "Db.Properties.add_assert" ~now:"ACSL_importer plug-in" + Kernel.deprecated "Db.Properties.add_assert" ~now:"ACSL_importer plug-in" (fun () -> - let interp_prop = !Interp.code_annot kf kinstr prop in - Annotations.add_code_annot emitter kinstr interp_prop) + let interp_prop = !Interp.code_annot kf kinstr prop in + Annotations.add_code_annot emitter kinstr interp_prop) () end @@ -1206,7 +1018,7 @@ module Occurrence = struct end module RteGen = struct - type status_accessor = + type status_accessor = string * (kernel_function -> bool -> unit) * (kernel_function -> bool) let compute = mk_fun "RteGen.compute" let annotate_kf = mk_fun "RteGen.annotate_kf" @@ -1223,10 +1035,8 @@ module RteGen = struct let get_pointerCall_status = mk_fun "RteGen.get_pointerCall_status" let get_unsignedOv_status = mk_fun "RteGen.get_unsignedOv_status" let get_unsignedDownCast_status = mk_fun "RteGen.get_unsignedDownCast_status" -end - -module Report = struct - let print = mk_fun "Report.print" + let get_float_to_int_status = mk_fun "RteGen.get_float_to_int_status" + let get_finite_float_status = mk_fun "RteGen.get_finite_float_status" end module Constant_Propagation = struct diff --git a/src/kernel_services/plugin_entry_points/db.mli b/src/kernel_services/plugin_entry_points/db.mli index e7b0d6f04e8815382367d083f110b2fa26116436..99900a3a457d8823387afa29fa619ee4e739d4f8 100644 --- a/src/kernel_services/plugin_entry_points/db.mli +++ b/src/kernel_services/plugin_entry_points/db.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -83,7 +83,7 @@ val register_guarded_compute: (unit -> unit) ref -> (unit -> unit) -> unit (** Frama-C main interface. - @since Lithium-20081201 + @since Lithium-20081201 @plugin development guide *) module Main: sig @@ -176,7 +176,7 @@ module Value : sig (** {3 Parameterization} *) exception Outside_builtin_possibilities - + (** Type for a Value builtin function *) type builtin_sig = (** Memory state at the beginning of the function *) @@ -267,8 +267,8 @@ module Value : sig kernel_function -> state Value_types.Callstack.Hashtbl.t option val get_state : kinstr -> state - - val get_stmt_state_callstack: + + val get_stmt_state_callstack: after:bool -> stmt -> state Value_types.Callstack.Hashtbl.t option val get_stmt_state : stmt -> state @@ -285,17 +285,20 @@ module Value : sig (** {3 Evaluations} *) val eval_lval : - (with_alarms:CilE.warn_mode -> + (?with_alarms:CilE.warn_mode -> Locations.Zone.t option -> state -> lval -> Locations.Zone.t option * t) ref val eval_expr : - (with_alarms:CilE.warn_mode -> state -> exp -> t) ref + (?with_alarms:CilE.warn_mode -> state -> exp -> t) ref val eval_expr_with_state : - (with_alarms:CilE.warn_mode -> state -> exp -> state * t) ref + (?with_alarms:CilE.warn_mode -> state -> exp -> state * t) ref + + val reduce_by_cond: + (state -> exp -> bool -> state) ref val find_lv_plus : (Cvalue.Model.t -> Cil_types.exp -> @@ -307,7 +310,7 @@ module Value : sig val expr_to_kernel_function : (kinstr - -> with_alarms:CilE.warn_mode + -> ?with_alarms:CilE.warn_mode -> deps:Locations.Zone.t option -> exp -> Locations.Zone.t * Kernel_function.Hptset.t) ref @@ -361,11 +364,11 @@ module Value : sig (** {3 Locations of left values} *) val lval_to_loc : - (kinstr -> with_alarms:CilE.warn_mode -> lval -> Locations.location) ref + (kinstr -> ?with_alarms:CilE.warn_mode -> lval -> Locations.location) ref val lval_to_loc_with_deps : (kinstr - -> with_alarms:CilE.warn_mode + -> ?with_alarms:CilE.warn_mode -> deps:Locations.Zone.t -> lval -> Locations.Zone.t * Locations.location) ref @@ -380,7 +383,7 @@ module Value : sig (state -> lval -> Locations.location) ref val lval_to_offsetmap : - ( kinstr -> lval -> with_alarms:CilE.warn_mode -> + ( kinstr -> ?with_alarms:CilE.warn_mode -> lval -> Cvalue.V_Offsetmap.t option) ref val lval_to_offsetmap_state : @@ -388,7 +391,7 @@ module Value : sig (** @since Carbon-20110201 *) val lval_to_zone : - (kinstr -> with_alarms:CilE.warn_mode -> lval -> Locations.Zone.t) ref + (kinstr -> ?with_alarms:CilE.warn_mode -> lval -> Locations.Zone.t) ref val lval_to_zone_state : (state -> lval -> Locations.Zone.t) ref @@ -405,6 +408,10 @@ module Value : sig memory zones that are writable. [exact] indicates that [lv] evaluates to a valid location of cardinal at most one. *) + val lval_to_precise_loc_state: + (?with_alarms:CilE.warn_mode -> state -> lval -> + state * Precise_locs.precise_location * typ) ref + val lval_to_precise_loc_with_deps_state: (state -> deps:Locations.Zone.t option -> lval -> Locations.Zone.t * Precise_locs.precise_location) ref @@ -412,16 +419,16 @@ module Value : sig (** Evaluation of the [\from] clause of an [assigns] clause.*) val assigns_inputs_to_zone : - (state -> identified_term assigns -> Locations.Zone.t) ref + (state -> assigns -> Locations.Zone.t) ref (** Evaluation of the left part of [assigns] clause (without [\from]).*) val assigns_outputs_to_zone : - (state -> result:varinfo option -> identified_term assigns -> Locations.Zone.t) ref + (state -> result:varinfo option -> assigns -> Locations.Zone.t) ref (** Evaluation of the left part of [assigns] clause (without [\from]). Each assigns term results in one location. *) val assigns_outputs_to_locations : - (state -> result:varinfo option -> identified_term assigns -> Locations.location list) ref + (state -> result:varinfo option -> assigns -> Locations.location list) ref (** For internal use only. Evaluate the [assigns] clause of the given function in the given prestate, compare it with the @@ -440,7 +447,7 @@ module Value : sig Property_status.emitted_status) ref (** Evaluate the given predicate in the given states for the Pre and Here ACSL labels. - @since Neon-20140301 *) + @since Neon-20140301 *) end @@ -487,7 +494,7 @@ module Value : sig @since Aluminium-20160501 *) module Call_Type_Value_Callbacks: Hook.Iter_hook with type param = - [`Builtin of Value_types.call_result | `Spec | `Def | `Memexec] + [`Builtin of Value_types.call_result | `Spec of funspec | `Def | `Memexec] * state * callstack @@ -495,6 +502,11 @@ module Value : sig module Compute_Statement_Callbacks: Hook.Iter_hook with type param = stmt * callstack * state list + (* -remove-redundant-alarms feature, applied at the end of an Eva analysis, + fulfilled by the Scope plugin that also depends on Eva. We thus use a + reference here to avoid a cyclic dependency. *) + val rm_asserts: (unit -> unit) ref + (** {3 Pretty printing} *) @@ -540,7 +552,7 @@ end module From : sig (** exception raised by [find_deps_no_transitivity_*] if the given expression - is not an lvalue. + is not an lvalue. @since Aluminium-20160501 *) exception Not_lval @@ -558,7 +570,7 @@ module From : sig val get : (kernel_function -> Function_Froms.t) ref val access : (Locations.Zone.t -> Function_Froms.Memory.t -> Locations.Zone.t) ref - + val find_deps_no_transitivity : (stmt -> exp -> Locations.Zone.t) ref val find_deps_no_transitivity_state : @@ -635,14 +647,14 @@ module Properties : sig (** {3 From logic terms to C terms} *) (** Exception raised by the functions below when their given argument - cannot be interpreted in the C world. + cannot be interpreted in the C world. @since Aluminium-20160501 *) exception No_conversion val term_lval_to_lval: (result: Cil_types.varinfo option -> term_lval -> Cil_types.lval) ref - (** @raise No_conversion if the argument is not a left value. + (** @raise No_conversion if the argument is not a left value. @modify Aluminium-20160501 raises a custom exn instead of generic Invalid_arg *) @@ -662,7 +674,7 @@ module Properties : sig (result: Cil_types.varinfo option -> term -> Cil_types.exp list) ref (** @return a list of C expressions. @raise No_conversion if the argument is not a valid set of - expressions. + expressions. @modify Aluminium-20160501 raises a custom exn instead of generic Invalid_arg *) @@ -676,7 +688,7 @@ module Properties : sig val term_offset_to_offset: (result: Cil_types.varinfo option -> term_offset -> offset) ref - (** @raise No_conversion if the argument is not a valid offset. + (** @raise No_conversion if the argument is not a valid offset. @modify Aluminium-20160501 raises a custom exn instead of generic Invalid_arg *) @@ -692,7 +704,7 @@ module Properties : sig (** {3 From logic terms to Locations.location} *) val loc_to_loc: - (result: Cil_types.varinfo option -> Value.state -> term -> + (result: Cil_types.varinfo option -> Value.state -> term -> Locations.location) ref (** @raise No_conversion if the translation fails. @modify Aluminium-20160501 raises a custom exn instead of generic @@ -700,7 +712,7 @@ module Properties : sig *) val loc_to_loc_under_over: - (result: Cil_types.varinfo option -> Value.state -> term -> + (result: Cil_types.varinfo option -> Value.state -> term -> Locations.location * Locations.location * Locations.Zone.t) ref (** Same as {!loc_to_loc}, except that we return simultaneously an under-approximation of the term (first location), and an @@ -808,13 +820,13 @@ module Properties : sig (** {3 Assertions} *) val add_assert: Emitter.t -> kernel_function -> stmt -> string -> unit - (** @deprecated since Oxygen-20120901 - Ask for {ACSL_importer plug-in} if you need such functionality. - @modify Boron-20100401 takes as additional argument the - computation which adds the assert. - @modify Oxygen-20120901 replaces the State.t list by an Emitter.t - *) - + (** @deprecated since Oxygen-20120901 + Ask for {ACSL_importer plug-in} if you need such functionality. + @modify Boron-20100401 takes as additional argument the + computation which adds the assert. + @modify Oxygen-20120901 replaces the State.t list by an Emitter.t + *) + end (* ************************************************************************* *) @@ -864,13 +876,13 @@ module RteGen : sig val do_precond : (kernel_function -> unit) ref val do_all_rte : (kernel_function -> unit) ref val do_rte : (kernel_function -> unit) ref - type status_accessor = + type status_accessor = string (* name *) * (kernel_function -> bool -> unit) (* for each kf and each kind of - annotation, set/unset the fact - that there has been generated *) - * (kernel_function -> bool) (* is this kind of annotation generated in - kf? *) + annotation, set/unset the fact + that there has been generated *) + * (kernel_function -> bool) (* is this kind of annotation generated in + kf? *) val get_all_status : (unit -> status_accessor list) ref val get_precond_status : (unit -> status_accessor) ref val get_divMod_status : (unit -> status_accessor) ref @@ -880,12 +892,8 @@ module RteGen : sig val get_signed_downCast_status : (unit -> status_accessor) ref val get_unsignedOv_status : (unit -> status_accessor) ref val get_unsignedDownCast_status : (unit -> status_accessor) ref -end - -(** Dump Properties-Status consolidation tree. *) -module Report : -sig - val print : (unit -> unit) ref + val get_float_to_int_status : (unit -> status_accessor) ref + val get_finite_float_status : (unit -> status_accessor) ref end (** Constant propagation plugin. @@ -1261,64 +1269,6 @@ module Pdg : sig end -(** Interface for the Scope plugin. - @see <../scope/index.html> internal documentation. *) -module Scope : sig - val get_data_scope_at_stmt : - (kernel_function -> stmt -> lval -> - Stmt.Hptset.t * (Stmt.Hptset.t * Stmt.Hptset.t)) ref - (** - * @raise Kernel_function.No_Definition if [kf] has no definition. - * @return 3 statement sets related to the value of [lval] before [stmt] : - * - the forward selection, - * - the both way selection, - * - the backward selection. - *) - - val get_prop_scope_at_stmt : - (kernel_function -> stmt -> code_annotation -> - Stmt.Hptset.t * code_annotation list) ref - (** compute the set of statements where the given annotation has the same - value as before the given stmt. Also returns the eventual code annotations - that are implied by the one given as argument. *) - - val check_asserts : (unit -> code_annotation list) ref - (** Print how many assertions could be removed based on the previous - * analysis ([get_prop_scope_at_stmt]) and return the annotations - * that can be removed. *) - - val rm_asserts : (unit -> unit) ref - (** Same analysis than [check_asserts] but mark the assertions as proven. *) - - val get_defs : - (kernel_function -> stmt -> lval -> - (Stmt.Hptset.t * Locations.Zone.t option) option) ref - (** @return the set of statements that define [lval] before [stmt] in [kf]. - * Also returns the zone that is possibly not defined. - * Can return [None] when the information is not available (Pdg missing). - * *) - - val get_defs_with_type : - (kernel_function -> stmt -> lval -> - ((bool * bool) Stmt.Map.t * Locations.Zone.t option) option) ref - (** @return a map from the statements that define [lval] before [stmt] in - [kf]. The first boolean indicates the possibility of a direct - modification at this statement, ie. [lval = ...] or [lval = f()]. - The second boolean indicates a possible indirect modification through - a call. - Also returns the zone that is possibly not defined. - Can return [None] when the information is not available (Pdg missing). - *) - - (** {3 Zones} *) - - type t_zones = Locations.Zone.t Stmt.Hashtbl.t - val build_zones : - (kernel_function -> stmt -> lval -> Stmt.Hptset.t * t_zones) ref - val pretty_zones : (Format.formatter -> t_zones -> unit) ref - val get_zones : (t_zones -> Cil_types.stmt -> Locations.Zone.t) ref - -end (** Interface for the unused code detection. @see <../sparecode/index.html> internal documentation. *) @@ -1353,565 +1303,6 @@ module Occurrence: sig val self: State.t ref end -(** Interface for the slicing tool. - @see <../slicing/index.html> internal documentation. *) -module Slicing : sig - - exception No_Project - exception Existing_Project - - val self: State.t ref - (** Internal state of the slicing tool from project viewpoints. *) - - val set_modes : (?calls:int -> ?callers:bool -> ?sliceUndef:bool - -> ?keepAnnotations:bool -> ?print:bool - -> unit -> unit) ref - - (** Slicing project management. *) - module Project : sig - - type t = SlicingTypes.sl_project - (** Abstract data type for slicing project. *) - val dyn_t : t Type.t - (** For dynamic type checking and journalization. *) - - val mk_project : (string -> t) ref - (** To use to start a new slicing project. - Several projects from a same current project can be managed. - @raise Existing_Project if an existing project has the same name.*) - - val from_unique_name : (string -> t) ref - (** Find a slicing project from its name. - @raise No_Project when no project is found. *) - - val get_all : (unit -> t list) ref - (** Get all slicing projects. *) - - val set_project : (t option -> unit) ref - (** Get the current project. *) - - val get_project : (unit -> t option) ref - (** Get the current project. *) - - val get_name : (t -> string) ref - (** Get the slicing project name. *) - - (** {3 Kernel function} *) - - val is_called : (t -> kernel_function -> bool) ref - (** Return [true] iff the source function is called (even indirectly via - transitivity) from a [Slice.t]. *) - - val has_persistent_selection : (t -> kernel_function -> bool) ref - (** return [true] iff the source function has persistent selection *) - - val change_slicing_level : (t -> kernel_function -> int -> unit) ref - (** change the slicing level of this function - (see the [-slicing-level] option documentation to know the meaning of the - number) - @raise SlicingTypes.ExternalFunction if [kf] has no definition. - @raise SlicingTypes.WrongSlicingLevel if [n] is not valid. - *) - - (** {3 Extraction} *) - - val default_slice_names : (kernel_function -> bool -> int -> string) ref - - val extract : (string -> - ?f_slice_names:(kernel_function -> bool -> int -> string) -> - t -> Project.t) ref - (** Build a new [Db.Project.t] from all [Slice.t] of a project. - * Can optionally specify how to name the sliced functions - * by defining [f_slice_names]. - * [f_slice_names kf src_visi num_slice] has to return the name - * of the exported functions based on the source function [kf]. - * - [src_visi] tells if the source function name is used - * (if not, it can be used for a slice) - * - [num_slice] gives the number of the slice to name. - * The entry point function is only exported once : - * it is VERY recommended to give to it its original name, - * even if it is sliced. - * *) - - val print_extracted_project : (?fmt:Format.formatter -> - extracted_prj:Project.t -> unit) ref - (** Print the extracted project when "-slice-print" is set. *) - - val print_dot : (filename:string -> title:string -> t -> unit) ref - (** Print a representation of the slicing project (call graph) - in a dot file which name is the given string. *) - - (** {3 Internal use only} *) - - val pretty : (Format.formatter -> t -> unit) ref - (** For debugging... Pretty print project information. *) - - val is_directly_called_internal : (t -> kernel_function -> bool) ref - (** Return [true] if the source function is directly (even via pointer - function) called from a [Slice.t]. *) - - end - - (** Access to slicing results. *) - module Mark : sig - - type t = SlicingTypes.sl_mark - (** Abstract data type for mark value. *) - val dyn_t : t Type.t - (** For dynamic type checking and journalization. *) - - val make : (data:bool -> addr:bool -> ctrl:bool -> t) ref - (** To construct a mark such as - [(is_ctrl result, is_data result, isaddr result) = - (~ctrl, ~data, ~addr)], - [(is_bottom result) = false] and - [(is_spare result) = not (~ctrl || ~data || ~addr)]. *) - - val compare : (t -> t -> int) ref - (** A total ordering function similar to the generic structural - comparison function [compare]. - Can be used to build a map from [t] marks to, for example, colors for - the GUI. *) - - val is_bottom : (t -> bool) ref - (** [true] iff the mark is empty: it is the only case where the - associated element is invisible. *) - - val is_spare : (t -> bool) ref - (** Smallest visible mark. Usually used to mark element that need to be - visible for compilation purpose, not really for the selected - computations. *) - - val is_data : (t -> bool) ref - (** The element is used to compute selected data. - Notice that a mark can be [is_data] and/or [is_ctrl] and/or [is_addr] - at the same time. *) - - val is_ctrl : (t -> bool) ref - (** The element is used to control the program point of a selected - data. *) - - val is_addr : (t -> bool) ref - (** The element is used to compute the address of a selected data. *) - - val get_from_src_func : (Project.t -> kernel_function -> t) ref - (** The mark [m] related to all statements of a source function [kf]. - Property : [is_bottom (get_from_func proj kf) = not (Project.is_called proj kf) ] *) - - val pretty : (Format.formatter -> t -> unit) ref - (** For debugging... Pretty mark information. *) - - end - - (** Slicing selections. *) - module Select : sig - - type t = SlicingTypes.sl_select - (** Internal selection. *) - val dyn_t : t Type.t - (** For dynamic type checking and journalization. *) - - type set = SlicingTypes.Fct_user_crit.t Cil_datatype.Varinfo.Map.t - (** Set of colored selections. *) - val dyn_set : set Type.t - (** For dynamic type checking and journalization. *) - - val empty_selects : set - (** Empty selection. *) - - val select_stmt : - (set -> spare:bool -> stmt -> kernel_function -> set) ref - (** To select a statement. *) - - val select_stmt_ctrl : - (set -> spare:bool -> stmt -> kernel_function -> set) ref - (** To select a statement reachability. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_lval_rw : - (set -> - Mark.t -> - rd:Datatype.String.Set.t -> - wr:Datatype.String.Set.t -> - stmt -> - eval:stmt -> - kernel_function -> set) ref - (** To select rw accesses to lvalues (given as string) related to a statement. - Variables of [~rd] and [~wr] string are bounded - relatively to the whole scope of the function. - The interpretation of the address of the lvalues is - done just before the execution of the statement [~eval]. - The selection preserve the [~rd] and ~[wr] accesses contained into the statement [ki]. - Note: add also a transparent selection on the whole statement. - @modify Magnesium-20151001 argument [~scope] removed. *) - - val select_stmt_lval : - (set -> Mark.t -> Datatype.String.Set.t -> before:bool -> stmt -> - eval:stmt -> kernel_function -> set) ref - (** To select lvalues (given as string) related to a statement. - Variables of [lval_str] string are bounded - relatively to the whole scope of the function. - The interpretation of the address of the lvalue is - done just before the execution of the statement [~eval]. - The selection preserve the value of these lvalues before or - after (c.f. boolean [~before]) the statement [ki]. - Note: add also a transparent selection on the whole statement. - @modify Magnesium-20151001 argument [~scope] removed. *) - - val select_stmt_zone : - (set -> Mark.t -> Locations.Zone.t -> before:bool -> stmt -> - kernel_function -> set) ref - (** To select a zone value related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_term : - (set -> Mark.t -> term -> stmt -> - kernel_function -> set) ref - (** To select a predicate value related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_pred : - (set -> Mark.t -> predicate -> stmt -> - kernel_function -> set) ref - (** To select a predicate value related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_annot : - (set -> Mark.t -> spare:bool -> code_annotation -> stmt -> - kernel_function -> set) ref - (** To select the annotations related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_stmt_annots : - (set -> Mark.t -> spare:bool -> threat:bool -> user_assert:bool -> - slicing_pragma:bool -> loop_inv:bool -> loop_var:bool -> - stmt -> kernel_function -> set) ref - (** To select the annotations related to a statement. - Note: add also a transparent selection on the whole statement. *) - - val select_func_lval_rw : - (set -> Mark.t -> rd:Datatype.String.Set.t -> wr:Datatype.String.Set.t -> - eval:stmt -> kernel_function -> set) ref - (** To select rw accesses to lvalues (given as a string) related to a function. - Variables of [~rd] and [~wr] string are bounded - relatively to the whole scope of the function. - The interpretation of the address of the lvalues is - done just before the execution of the statement [~eval]. - The selection preserve the value of these lvalues into the whole project. - @modify Magnesium-20151001 argument [~scope] removed. *) - - val select_func_lval : - (set -> Mark.t -> Datatype.String.Set.t -> kernel_function -> set) ref - (** To select lvalues (given as a string) related to a function. - Variables of [lval_str] string are bounded - relatively to the scope of the first statement of [kf]. - The interpretation of the address of the lvalues is - done just before the execution of the first statement [kf]. - The selection preserve the value of these lvalues before - execution of the return statement. *) - - val select_func_zone : - (set -> Mark.t -> Locations.Zone.t -> kernel_function -> set) ref - (** To select an output zone related to a function. *) - - val select_func_return : - (set -> spare:bool -> kernel_function -> set) ref - (** To select the function result (returned value). *) - - val select_func_calls_to : - (set -> spare:bool -> kernel_function -> set) ref - (** To select every calls to the given function, i.e. the call keeps - its semantics in the slice. *) - - val select_func_calls_into : - (set -> spare:bool -> kernel_function -> set) ref - (** To select every calls to the given function without the selection of - its inputs/outputs. *) - - val select_func_annots : - (set -> Mark.t -> spare:bool -> threat:bool -> user_assert:bool -> - slicing_pragma:bool -> loop_inv:bool -> loop_var:bool -> - kernel_function -> set) ref - (** To select the annotations related to a function. *) - - (** {3 Internal use only} *) - - val pretty : (Format.formatter -> t -> unit) ref - (** For debugging... Pretty print selection information. *) - - val get_function : (t -> kernel_function) ref - (** The function related to an internal selection. *) - - val merge_internal : (t -> t -> t) ref - (** The function related to an internal selection. *) - - val add_to_selects_internal : (t -> set -> set) ref - val iter_selects_internal : ((t -> unit) -> set -> unit) ref - val fold_selects_internal : (('a -> t -> 'a) -> 'a -> set -> 'a) - - val select_stmt_internal : (kernel_function -> ?select:t -> - stmt -> Mark.t -> t) ref - (** Internally used to select a statement : - - if [is_ctrl_mark m], - propagate ctrl_mark on ctrl dependencies of the statement - - if [is_addr_mark m], - propagate addr_mark on addr dependencies of the statement - - if [is_data_mark m], - propagate data_mark on data dependencies of the statement - - mark the node with a spare_mark and propagate so that - the dependencies that were not selected yet will be marked spare. - When the statement is a call, its functional inputs/outputs are - also selected (The call is still selected even it has no output). - When the statement is a composed one (block, if, etc...), - all the sub-statements are selected. - @raise SlicingTypes.NoPdg if ? - *) - - val select_label_internal : (kernel_function -> ?select:t -> - Logic_label.t -> Mark.t -> t) ref - - val select_min_call_internal : - (kernel_function -> ?select:t -> stmt -> Mark.t -> t) ref - (** Internally used to select a statement call without its - inputs/outputs so that it doesn't select the statements computing the - inputs of the called function as [select_stmt_internal] would do. - Raise [Invalid_argument] when the [stmt] isn't a call. - @raise SlicingTypes.NoPdg if ? - *) - - val select_stmt_zone_internal : - (kernel_function -> ?select:t -> - stmt -> before:bool -> Locations.Zone.t -> Mark.t -> t) ref - (** Internally used to select a zone value at a program point. - @raise SlicingTypes.NoPdg if ? - *) - - val select_zone_at_entry_point_internal : - (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) ref - (** Internally used to select a zone value at the beginning of a function. - * For a defined function, it is similar to [select_stmt_zone_internal] - * with the initial statement, but it can also be used for undefined - * functions. - * - @raise SlicingTypes.NoPdg if ? - *) - - val select_zone_at_end_internal : - (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) ref - (** Internally used to select a zone value at the end of a function. - * For a defined function, it is similar to [select_stmt_zone_internal] - * with the return statement, but it can also be used for undefined - * functions. - * - @raise SlicingTypes.NoPdg if ? - *) - - val select_modified_output_zone_internal : - (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) ref - (** Internally used to select the statements that modify the - * given zone considered as in output. - * Be careful that it is NOT the same as selecting the zone at the end! - * ( the 'undef' zone is not propagated...) - * *) - - val select_stmt_ctrl_internal : - (kernel_function -> ?select:t -> stmt -> t) ref - (** Internally used to select a statement reachability : - Only propagate a ctrl_mark on the statement control dependencies. - @raise SlicingTypes.NoPdg if ? - *) - - val select_pdg_nodes_internal : - (kernel_function -> ?select:t -> PdgTypes.Node.t list -> Mark.t -> t) ref - (** Internally used to select PDG nodes : - - if [is_ctrl_mark m], - propagate ctrl_mark on ctrl dependencies of the statement - - if [is_addr_mark m], - propagate addr_mark on addr dependencies of the statement - - if [is_data_mark m], - propagate data_mark on data dependencies of the statement - - mark the node with a spare_mark and propagate so that - the dependencies that were not selected yet will be marked spare. - *) - - val select_entry_point_internal : - (kernel_function -> ?select:t -> Mark.t -> t) ref - val select_return_internal : - (kernel_function -> ?select:t -> Mark.t -> t) ref - val select_decl_var_internal : - (kernel_function -> ?select:t -> Cil_types.varinfo -> Mark.t -> t) ref - val select_pdg_nodes : - (set -> Mark.t -> PdgTypes.Node.t list -> kernel_function -> set) ref - end - - (** Function slice. *) - module Slice : sig - - type t = SlicingTypes.sl_fct_slice - (** Abstract data type for function slice. *) - val dyn_t : t Type.t - (** For dynamic type checking and journalization. *) - - val create : (Project.t -> kernel_function -> t) ref - (** Used to get an empty slice (nothing selected) related to a - function. *) - - val remove : (Project.t -> t -> unit) ref - (** Remove the slice from the project. The slice shouldn't be called. *) - - val remove_uncalled : (Project.t -> unit) ref - (** Remove the uncalled slice from the project. *) - - (** {3 Getters} *) - - val get_all: (Project.t -> kernel_function -> t list) ref - (** Get all slices related to a function. *) - - val get_function : (t -> kernel_function) ref - (** To get the function related to a slice *) - - val get_callers : (t -> t list) ref - (** Get the slices having direct calls to a slice. *) - - val get_called_slice : (t -> stmt -> t option) ref - (** To get the slice directly called by the statement of a slice. - Returns None when the statement mark is bottom, - or else the statement isn't a call - or else the statement is a call to one or several (via pointer) - source functions. *) - - val get_called_funcs : (t -> stmt -> kernel_function list) ref - (** To get the source functions called by the statement of a slice. - Returns an empty list when the statement mark is bottom, - or else the statement isn't a call - or else the statement is a call to a function slice. *) - - val get_mark_from_stmt : (t -> stmt -> Mark.t) ref - (** Get the mark value of a statement. *) - - val get_mark_from_label : (t -> stmt -> Cil_types.label -> Mark.t) ref - (** Get the mark value of a label. *) - - val get_mark_from_local_var : (t -> varinfo -> Mark.t) ref - (** Get the mark value of local variable. *) - - val get_mark_from_formal : (t -> varinfo -> Mark.t) ref - (** Get the mark from the formal of a function. *) - - val get_user_mark_from_inputs : (t -> Mark.t) ref - (** Get a mark that is the merged user inputs marks of the slice *) - - (** {3 Internal use only} *) - - val get_num_id : (t -> int) ref - - val from_num_id : (Project.t -> kernel_function -> int -> t) ref - - val pretty : (Format.formatter -> t -> unit) ref - (** For debugging... Pretty print slice information. *) - - end - - (** Requests for slicing jobs. - Slicing requests are part of a slicing project. - So, user requests affect slicing project. *) - module Request : sig - - val apply_all: (Project.t -> propagate_to_callers:bool -> unit) ref - (** Apply all slicing requests. *) - - (** {3 Adding a request} *) - - val add_selection: (Project.t -> Select.set -> unit) ref - (** Add a selection request to all slices (existing) - of a function to the project requests. *) - - val add_persistent_selection: (Project.t -> Select.set -> unit) ref - (** Add a persistent selection request to all slices (already existing or - created later) of a function to the project requests. *) - - val add_persistent_cmdline : (Project.t -> unit) ref - (** Add persistent selection from the command line. *) - - val is_already_selected_internal: (Slice.t -> Select.t -> bool) ref - (** Return true when the requested selection is already selected into the - * slice. *) - - val add_slice_selection_internal: - (Project.t -> Slice.t -> Select.t -> unit) ref - (** Internally used to add a selection request for a function slice - to the project requests. *) - - val add_selection_internal: - (Project.t -> Select.t -> unit) ref - (** Internally used to add a selection request to the project requests. - This selection will be applied to every slices of the function - (already existing or created later). *) - - val add_call_slice: - (Project.t -> caller:Slice.t -> to_call:Slice.t -> unit) ref - (** change every call to any [to_call] source or specialisation in order - to call [to_call] in [caller]. *) - - val add_call_fun: - (Project.t -> caller:Slice.t -> to_call:kernel_function -> unit) ref - (** change every call to any [to_call] source or specialisation - * in order to call the source function [to_call] in [caller] *) - - val add_call_min_fun: - (Project.t -> caller:Slice.t -> to_call:kernel_function -> unit) ref - (** For each call to [to_call] in [caller] such so that, at least, it - will be visible at the end, ie. call either the source function or - one of [to_call] slice (depending on the [slicing_level]). *) - - (** {3 Internal use only} *) - - val apply_all_internal: (Project.t -> unit) ref - (** Internally used to apply all slicing requests. *) - - val apply_next_internal: (Project.t -> unit) ref - (** Internally used to apply the first slicing request of the project list - and remove it from the list. - That may modify the contents of the remaining list. - For example, new requests may be added to the list. *) - - val is_request_empty_internal: (Project.t -> bool) ref - (** Internally used to know if internal requests are pending. *) - - val merge_slices: - (Project.t -> Slice.t -> Slice.t -> replace:bool -> Slice.t) ref - (** Build a new slice which marks is a merge of the two given slices. - [choose_call] requests are added to the project in order to choose - the called functions for this new slice. - If [replace] is true, more requests are added to call this new - slice instead of the two original slices. When these requests will - be applied, the user will be able to remove those two slices using - [Db.Slicing.Slice.remove]. *) - - val copy_slice: - (Project.t -> Slice.t -> Slice.t) ref - (** Copy the input slice. The new slice is not called, - * so it is the user responsibility to change the calls if he wants to. *) - - val split_slice: - (Project.t -> Slice.t -> Slice.t list) ref - (** Copy the input slice to have one slice for each call of the original - * slice and generate requests in order to call them. - * @return the newly created slices. - *) - - val propagate_user_marks : (Project.t -> unit) ref - (** Apply pending request then propagate user marks to callers - recursively then apply pending requests *) - - val pretty : (Format.formatter -> Project.t -> unit) ref - (** For debugging... Pretty print the request list. *) - - end - -end - - (** Signature common to some Inout plugin options. The results of the computations are available on a per function basis. *) module type INOUTKF = sig diff --git a/src/kernel_services/plugin_entry_points/dynamic.ml b/src/kernel_services/plugin_entry_points/dynamic.ml index effc8d2cfbd5dc37c1b0139d1b5399c22d750b2f..bf681b411b81f320d3d55705719de530ca32fdc6 100644 --- a/src/kernel_services/plugin_entry_points/dynamic.ml +++ b/src/kernel_services/plugin_entry_points/dynamic.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -40,25 +40,22 @@ let error ~name ~message ~details = exception Unloadable of string module Tbl = Type.String_tbl(struct type 'a t = 'a end) -module Dynlib = FCDynlink let dynlib_init = ref false let dynlib_init () = if not !dynlib_init then begin dynlib_init := true ; - Dynlib.init () ; - Dynlib.allow_unsafe_modules true ; + Dynlink.init () ; + Dynlink.allow_unsafe_modules true ; end exception Incompatible_type = Tbl.Incompatible_type exception Unbound_value = Tbl.Unbound_value let dynlib_error name = function - | Dynlib.Unsupported_Feature s -> - error ~name ~message:"dynamic loading not supported" ~details:s ; - | Dynlib.Error e -> - error ~name ~message:"cannot load module" ~details:(Dynlib.error_message e) ; + | Dynlink.Error e -> + error ~name ~message:"cannot load module" ~details:(Dynlink.error_message e) ; | Sys_error _ as e -> error ~name ~message:"system error" ~details:(Printexc.to_string e) | Unloadable details -> @@ -81,7 +78,7 @@ let dynlib_module name file = Klog.feedback ~dkey "Loading module '%s' from '%s'." name file ; try dynlib_init () ; - Dynlib.loadfile file ; + Dynlink.loadfile file ; with error -> Cmdline.add_loading_failures name; dynlib_error name error @@ -117,7 +114,7 @@ let is_file base ext = if Sys.file_exists file then Some file else None let is_object base = - if Dynlib.is_native then is_file base ".cmxs" else + if Dynlink.is_native then is_file base ".cmxs" else match is_file base ".cma" with | Some _ as file -> file | None -> is_file base ".cmo" @@ -174,7 +171,7 @@ let load_packages pkgs = let gui = if !Config.is_gui then ["gui"] else [] in let predicates = (** The order is important for the archive cases *) - if Dynlib.is_native then + if Dynlink.is_native then [ "plugin", ["native"]@gui; "archive", ["plugin"]@gui; @@ -207,7 +204,7 @@ let load_packages pkgs = List.iter (load_archive pkg base) archives end (Findlib.package_deep_ancestors - (if Dynlib.is_native then [ "native" ] else [ "byte" ]) + (if Dynlink.is_native then [ "native" ] else [ "byte" ]) pkgs) with | Findlib.No_such_package(pkg,details) -> @@ -231,7 +228,7 @@ let load_script base = let cmd = Buffer.create 80 in let fmt = Format.formatter_of_buffer cmd in begin - if Dynlib.is_native then + if Dynlink.is_native then Format.fprintf fmt "%s -shared -o %s.cmxs" Config.ocamlopt base else Format.fprintf fmt "%s -c" Config.ocamlc ; @@ -248,7 +245,7 @@ let load_script base = then Klog.error "compilation of '%s.ml' failed" base else let pkg = Filename.basename base in - if Dynlib.is_native then + if Dynlink.is_native then dynlib_module pkg (base ^ ".cmxs") else dynlib_module pkg (base ^ ".cmo") ; diff --git a/src/kernel_services/plugin_entry_points/dynamic.mli b/src/kernel_services/plugin_entry_points/dynamic.mli index 14e1d0ae0ffc2acd7b5325dc5504720f71311be1..5b33394b70882dfa0bc69df54e7a7f8455bc2c2e 100644 --- a/src/kernel_services/plugin_entry_points/dynamic.mli +++ b/src/kernel_services/plugin_entry_points/dynamic.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -153,7 +153,7 @@ val load_module: string -> unit (** Sets the load path for modules in FRAMAC_PLUGIN, prepending it with [path]. Does not load any plugins. Must be invoked only once from boot during extending stage. - @since Frama-C+dev. *) + @since Phosphorus-20170501-beta1. *) val set_module_load_path : string list -> unit (**/**) @@ -161,7 +161,7 @@ val load_plugin_path: unit -> unit (** Load all plugins in the path set with [set_module_load_path]. Must be invoked only once from boot during extending stage. @since Magnesium-20151001 new API. - @modify Frama-C+dev changed signature. *) + @modify Phosphorus-20170501-beta1 changed signature. *) (**/**) (* diff --git a/src/kernel_services/plugin_entry_points/emitter.ml b/src/kernel_services/plugin_entry_points/emitter.ml index 52399e316a6e120aed25971616254b76babd876a..4391c2c34207eb76bfea65614a88774952fbe7e3 100644 --- a/src/kernel_services/plugin_entry_points/emitter.ml +++ b/src/kernel_services/plugin_entry_points/emitter.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/plugin_entry_points/emitter.mli b/src/kernel_services/plugin_entry_points/emitter.mli index b6e40c9b593c998dbe7a17247df8ee32db1c3962..3ae0bd009ddae8ad0eb1ce0869ad1e0976687f3f 100644 --- a/src/kernel_services/plugin_entry_points/emitter.mli +++ b/src/kernel_services/plugin_entry_points/emitter.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/plugin_entry_points/journal.ml b/src/kernel_services/plugin_entry_points/journal.ml index a196031390d3e9b315a78f637405b6f086cc7627..b4e8ee70199f65cc89b36d3e5b2021f994ac51aa 100644 --- a/src/kernel_services/plugin_entry_points/journal.ml +++ b/src/kernel_services/plugin_entry_points/journal.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/plugin_entry_points/journal.mli b/src/kernel_services/plugin_entry_points/journal.mli index dc0391c7b70e680916c299b15f89ced9b2bf184a..c019c41565fd34f30d2ca74de3bbcac579214048 100644 --- a/src/kernel_services/plugin_entry_points/journal.mli +++ b/src/kernel_services/plugin_entry_points/journal.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/plugin_entry_points/kernel.ml b/src/kernel_services/plugin_entry_points/kernel.ml index fe73f1edadef58da771408a46676a0a89193f9c8..4548449bb9c1bebb187d4b9f3ab101a0d36e3404 100644 --- a/src/kernel_services/plugin_entry_points/kernel.ml +++ b/src/kernel_services/plugin_entry_points/kernel.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -434,6 +434,15 @@ module PrintLibc = let default = !Fc_config.is_gui (* always print by default on the GUI *) end) +let () = Parameter_customize.set_group inout_source +module PrintReturn = + False + (struct + let module_name = "PrintReturn" + let option_name = "-print-return" + let help = "inline gotos to return statement" + end) + module CodeOutput = struct let () = Parameter_customize.set_group inout_source @@ -703,22 +712,6 @@ module Machdep = See \"-machdep help\" for a list" end) -let () = Parameter_customize.set_group parsing -let () = Parameter_customize.do_not_reset_on_copy () -module CustomAnnot = - P.Empty_string( - struct - let option_name = "-custom-annot-char" - let help = "use a custom character <c> for starting ACSL annotations" - let arg_name = "c" - end) -let () = CustomAnnot.add_set_hook - (fun _ s -> - if CamlString.length s <> 1 then - abort - "-custom-annot expects a single character. Invalid argument %s" - s) - let () = Parameter_customize.set_group parsing let () = Parameter_customize.do_not_reset_on_copy () module ReadAnnot = @@ -1028,17 +1021,7 @@ module DoCollapseCallCast = and the lvalue it is assigned to." end) -let () = Parameter_customize.set_group normalisation -module ForceRLArgEval = - False(struct - let option_name = "-force-rl-arg-eval" - let module_name = "ForceRLArgEval" - let help = "Force right to left evaluation order for \ - arguments of function calls" - end) - let normalization_parameters = [ - ForceRLArgEval.parameter; UnrollingLevel.parameter; Machdep.parameter; CppCommand.parameter; @@ -1169,6 +1152,20 @@ module UnsignedDowncast = destination range" end) + +(* Not finite floats are ok, but might not always be a behavior the programmer + wants. *) +let () = Parameter_customize.set_group analysis_options +let () = Parameter_customize.do_not_reset_on_copy () +module FiniteFloat = + False + (struct + let module_name = "FiniteFloat" + let option_name = "-warn-not-finite-float" + let help = "generate alarms when infinite floats or NaN are produced" + end) + + (* ************************************************************************* *) (** {2 Sequencing options} *) (* ************************************************************************* *) diff --git a/src/kernel_services/plugin_entry_points/kernel.mli b/src/kernel_services/plugin_entry_points/kernel.mli index 4220cd43579316f5992ea957c068c8d97cf8bf4b..2a10b5958ed45f0308fcf6e68043aeecdb3f28b7 100644 --- a/src/kernel_services/plugin_entry_points/kernel.mli +++ b/src/kernel_services/plugin_entry_points/kernel.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -86,15 +86,19 @@ module PrintCode : Parameter_sig.Bool module PrintMachdep : Parameter_sig.Bool (** Behavior of option "-print-machdep" - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) module PrintLibc: Parameter_sig.Bool (** Behavior of option "-print-libc" - @since Frama-C+dev *) + @since Phosphorus-20170501-beta1 *) module PrintComments: Parameter_sig.Bool (** Behavior of option "-keep-comments" *) +module PrintReturn : Parameter_sig.Bool + (** Behavior of option "-print-return" + @since Frama-C+dev *) + (** Behavior of option "-ocode". @plugin development guide *) module CodeOutput : sig @@ -197,9 +201,6 @@ module CppGnuLike: Parameter_sig.Bool module FramaCStdLib: Parameter_sig.Bool (** Behavior of option "-frama-c-stdlib" *) -module CustomAnnot: Parameter_sig.String - (** Behavior of option "-custom-annot-char". *) - module ReadAnnot: Parameter_sig.Bool (** Behavior of option "-read-annot" *) @@ -281,9 +282,6 @@ module DoCollapseCallCast: Parameter_sig.Bool This is false by default. Set to true to replicate the behavior of CIL 1.3.5 and earlier. *) -module ForceRLArgEval: Parameter_sig.Bool - (** Behavior of option "-force-rl-arg-eval". *) - (* ************************************************************************* *) (** {2 Analysis Behavior of options} *) (* ************************************************************************* *) @@ -338,6 +336,9 @@ module SignedDowncast: Parameter_sig.Bool module UnsignedDowncast: Parameter_sig.Bool (** Behavior of option "-warn-unsigned-downcast" *) +module FiniteFloat: Parameter_sig.Bool + (** Behavior of option "-warn-not-finite-float" *) + module AbsoluteValidRange: Parameter_sig.String (** Behavior of option "-absolute-valid-range" *) diff --git a/src/kernel_services/plugin_entry_points/log.ml b/src/kernel_services/plugin_entry_points/log.ml index b9f75d1a5be2a426db20cb48ecf776a14d93d517..a0ed00f387740155c4e74b6bee1a7fb7e1ca9964 100644 --- a/src/kernel_services/plugin_entry_points/log.ml +++ b/src/kernel_services/plugin_entry_points/log.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/plugin_entry_points/log.mli b/src/kernel_services/plugin_entry_points/log.mli index d93f983026bb019aa08e48d5ac4eabb3a57c6cce..c4692e283ca4d9494fff528f73defbb703c8e7cc 100644 --- a/src/kernel_services/plugin_entry_points/log.mli +++ b/src/kernel_services/plugin_entry_points/log.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/plugin_entry_points/plugin.ml b/src/kernel_services/plugin_entry_points/plugin.ml index 7ed1b8bd73b504387a61a3b66364f8887b022258..ec1989f9ba30d9cb8266670c7384dd8b17f8769a 100644 --- a/src/kernel_services/plugin_entry_points/plugin.ml +++ b/src/kernel_services/plugin_entry_points/plugin.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -601,7 +601,7 @@ struct && D.String.Set.mem "help" after then (* level 0 just in case user ask to display all categories in an otherwise quiet run *) - Cmdline.at_normal_exit + Cmdline.run_after_exiting_stage (fun () -> L.feedback ~level:0 "@[<v 2>Available message categories are:%a@]" @@ -611,7 +611,9 @@ struct let s = (s:Log.category:>string) in if s <> empty_string then Format.fprintf fmt "@;%s" s) set) - (L.get_all_categories ())); + (L.get_all_categories ()); + raise Cmdline.Exit + ); let add_category c s = D.String.Set.add (c:Log.category:>string) s in let subcategory_closure s = D.String.Set.fold diff --git a/src/kernel_services/plugin_entry_points/plugin.mli b/src/kernel_services/plugin_entry_points/plugin.mli index f7975983b43fabc733a0f65f5e4c7b117a6737d7..928f6d28d41962f8df5872657ee41756eb210678 100644 --- a/src/kernel_services/plugin_entry_points/plugin.mli +++ b/src/kernel_services/plugin_entry_points/plugin.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/kernel_services/visitors/visitor.ml b/src/kernel_services/visitors/visitor.ml index f9da857ba9e6fe49993e95b75dab82bac78680a4..1a3d7a4adb4287ccd048213d8964056580a14f15 100644 --- a/src/kernel_services/visitors/visitor.ml +++ b/src/kernel_services/visitors/visitor.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -132,9 +132,13 @@ object(self) end in let post_action f stmt = - let annots = make_children_annot self in + let (add, _ as new_annots) = make_children_annot self in let stmt = f stmt in - change_stmt stmt annots; + (match stmt.skind with + | Block b when annots <> [] || add <> [] -> + stmt.skind <- Block (Cil.block_of_transient b) + | _ -> ()); + change_stmt stmt new_annots; stmt in let copy stmt = diff --git a/src/kernel_services/visitors/visitor.mli b/src/kernel_services/visitors/visitor.mli index 183090b0d9784e4ada5f9cacfa08c79652a7741e..01acfc9fe2257f840abd4c4e8d84051ec2627a10 100644 --- a/src/kernel_services/visitors/visitor.mli +++ b/src/kernel_services/visitors/visitor.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -184,17 +184,13 @@ val visitFramacAnnotation: val visitFramacCodeAnnotation: frama_c_visitor -> code_annotation -> code_annotation -val visitFramacAllocation: - frama_c_visitor -> identified_term allocation -> identified_term allocation +val visitFramacAllocation: frama_c_visitor -> allocation -> allocation -val visitFramacAssigns: - frama_c_visitor -> identified_term assigns -> identified_term assigns +val visitFramacAssigns: frama_c_visitor -> assigns -> assigns -val visitFramacFrom: - frama_c_visitor -> identified_term from -> identified_term from +val visitFramacFrom: frama_c_visitor -> from -> from -val visitFramacDeps: - frama_c_visitor -> identified_term deps -> identified_term deps +val visitFramacDeps: frama_c_visitor -> deps -> deps val visitFramacFunspec: frama_c_visitor -> funspec -> funspec diff --git a/src/libraries/datatype/datatype.ml b/src/libraries/datatype/datatype.ml index 5dcc2386841dd02df7a5b6131df063c3e853d466..7298aeeb102c3f37612c0b8da74706a0299acdba 100644 --- a/src/libraries/datatype/datatype.ml +++ b/src/libraries/datatype/datatype.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/datatype.mli b/src/libraries/datatype/datatype.mli index 0c9e2da056012d49bb30f9187cb10d561e24ccdd..19fb87843b0976120e98297adac3ef3b1a2b876c 100644 --- a/src/libraries/datatype/datatype.mli +++ b/src/libraries/datatype/datatype.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/descr.ml b/src/libraries/datatype/descr.ml index ecfaf4e91230a799b6f6b757ed0194bc8a6c1354..2f786b84fd3088ee37b3581d9176fb5f66d839a7 100644 --- a/src/libraries/datatype/descr.ml +++ b/src/libraries/datatype/descr.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/descr.mli b/src/libraries/datatype/descr.mli index c420a202157d33a862db64e5dd0d6fd9b6acddf6..6b6ef02edbd173cf73b87c7cd5899cb0a39d5de7 100644 --- a/src/libraries/datatype/descr.mli +++ b/src/libraries/datatype/descr.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/structural_descr.ml b/src/libraries/datatype/structural_descr.ml index 48dd14aebcf9cb4fd91b851b432782e059392f6f..2f4e6f7281f8614bc55dbaa9c1c2c449f26707ed 100644 --- a/src/libraries/datatype/structural_descr.ml +++ b/src/libraries/datatype/structural_descr.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/structural_descr.mli b/src/libraries/datatype/structural_descr.mli index 006291b1ae4d3225bdddc4e326b9c017a0059143..e0d2d45a3b3314ac5b58652cee78ffe34a2da2ef 100644 --- a/src/libraries/datatype/structural_descr.mli +++ b/src/libraries/datatype/structural_descr.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/type.ml b/src/libraries/datatype/type.ml index 7215f383564b9dbc000a701d6f225f799fc5b983..3bc88b8ab520f98e4f29ff871b43baebd29406de 100644 --- a/src/libraries/datatype/type.ml +++ b/src/libraries/datatype/type.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/type.mli b/src/libraries/datatype/type.mli index 42a2a17bbc76bef042278e6f39e75d9a84b9f0df..f32d5a7efd4fb6cccebef9b5df7ebac4917cb31a 100644 --- a/src/libraries/datatype/type.mli +++ b/src/libraries/datatype/type.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/unmarshal.ml b/src/libraries/datatype/unmarshal.ml index f0da96450e54d1258421771543df4fab1119d27a..888573ad32561e550d7ee883224466c68a787de1 100644 --- a/src/libraries/datatype/unmarshal.ml +++ b/src/libraries/datatype/unmarshal.ml @@ -36,8 +36,11 @@ (* caml_unmarshal by Ineffable Casters *) -(* Version 3.11.2.0 *) - +(* Version big-marshal. + Patch by TrustInSoft. See + - https://github.com/ocaml/ocaml/pull/224 + - https://github.com/TrustInSoft/tis-interpreter/blob/master/src/libraries/datatype/unmarshal.ml +*) (* Warning: @@ -62,8 +65,6 @@ let arch_sixtyfour = Sys.word_size = 64;; let arch_bigendian = (Obj.magic [| 0x00002600 |] : string).[1] <> 'L';; let arch_float_endianness = (Obj.magic 1.23530711838574823e-307 : string).[1];; -let intext_magic_number = "\x84\x95\xA6\xBE";; - let ill_formed reason = let msg = "input_value: ill-formed message" in failwith (if false(*debug*) then Printf.sprintf "%s (%s)" msg reason else msg) @@ -146,6 +147,8 @@ let readheader32 ch = let c2 = Char.code (input_char ch) in let c1 = Char.code (input_char ch) in let c0 = Char.code (input_char ch) in + (* fst: read32u masked by 0xFF + snd: read32u shifted right by 10 (Wosize_hd) *) (c0, (c1 lsr 2) lor (c2 lsl 6) lor (c3 lsl 14)) ;; @@ -160,8 +163,10 @@ let readheader64 = let c2 = Char.code (input_char ch) in let c1 = Char.code (input_char ch) in let c0 = Char.code (input_char ch) in - (c0, (c1 lsr 2) lor (c2 lsr 6) lor (c3 lsr 14) lor (c4 lsr 22) - lor (c5 lsr 30) lor (c6 lsr 38) lor (c7 lsr 46)) + (* fst: read64u masked by 0xFF + snd: read64u shifted right by 10 (Wosize_hd) *) + (c0, (c1 lsr 2) lor (c2 lsl 6) lor (c3 lsl 14) lor (c4 lsl 22) + lor (c5 lsl 30) lor (c6 lsl 38) lor (c7 lsl 46)) end else begin fun _ -> failwith "input_value: data block too large" end @@ -228,10 +233,14 @@ let (code_area_start, cksum) = ;; *) -let check_const ch s msg = - for i = 0 to String.length s - 1 do - if input_char ch <> s.[i] then failwith msg; - done +let check_const ch s = + try + for i = 0 to String.length s - 1 do + if input_char ch <> s.[i] then raise Exit + done; + false + with Exit -> true + ;; (* Auxiliary functions for handling Custom blocks. *) @@ -341,13 +350,36 @@ let rec get_structure t context = | Dynamic _ -> assert false ;; +(* let intext_magic_number_small = "\x84\x95\xA6\xBE";; +let intext_magic_number_big = "\x84\x95\xA6\xBF";; +*) + let input_val ch t = set_binary_mode_in ch true; - check_const ch intext_magic_number "input_value: bad object"; - let _block_len = getword ch in - let num_objects = read32u ch in - let _size_32 = getword ch in - let _size_64 = getword ch in + let num_objects = + if check_const ch "\x84\x95\xA6" + then failwith "input_value: bad object"; + let last_char = input_char ch in + match last_char with + | '\xBF' -> + (* See + https://github.com/ocaml/ocaml/blob/c065a0995c0a18fcc2430977dbc887766b6ffe45/byterun/extern.c#L626 + https://github.com/ocaml/ocaml/blob/e2d0a13165b31cb06d4a7bdba3847198b32e1bd4/byterun/caml/intext.h#L43 *) + if check_const ch "\x00\x00\x00\x00" + then failwith "input_value: bad object (reserved bytes should be 0)"; + ignore (read64s ch); (* block_len *) + let n = read64u ch in + ignore (read64s ch); (* size_64 *) + n + | '\xBE' -> + ignore (getword ch); (* block_len *) + let n = read32u ch in + ignore (getword ch); (* size_32 *) + ignore (getword ch); (* size_64 *) + n + | _ -> + failwith "input_value: bad object" + in let tbl = LA.make num_objects null in let patch = LA.make num_objects [] in @@ -384,6 +416,9 @@ let input_val ch t = | 0x06 (* CODE_SHARED32 *) -> let ofs = read32u ch in read_shared stk ofs + | 0x14 (* CODE_SHARED64 *) -> + let ofs = read64u ch in + read_shared stk ofs | 0x08 (* CODE_BLOCK32 *) -> let (tag, size) = readheader32 ch in @@ -398,6 +433,9 @@ let input_val ch t = | 0x0A (* CODE_STRING32 *) -> let len = read32u ch in read_string stk t len + | 0x15 (* CODE_STRING64 *) -> + let len = read64u ch in + read_string stk t len | 0x0C (* CODE_DOUBLE_LITTLE *) -> read_double stk t readfloat_little @@ -415,6 +453,12 @@ let input_val ch t = | 0x0F (* CODE_DOUBLE_ARRAY32_BIG *) -> let len = read32u ch in read_double_array stk t len readfloat_big + | 0x17 (* CODE_DOUBLE_ARRAY64_LITTLE *) -> + let len = read64u ch in + read_double_array stk t len readfloat_little + | 0x16 (* CODE_DOUBLE_ARRAY64_BIG *) -> + let len = read64u ch in + read_double_array stk t len readfloat_big | 0x10 (* CODE_CODEPOINTER *) -> assert false diff --git a/src/libraries/datatype/unmarshal_z.ml b/src/libraries/datatype/unmarshal_z.ml index 966694858b308135811d5fcaae00205c20844b7e..7a43df962772dd2f4710b3b93910e9db00c7c2b5 100644 --- a/src/libraries/datatype/unmarshal_z.ml +++ b/src/libraries/datatype/unmarshal_z.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/datatype/unmarshal_z.mli b/src/libraries/datatype/unmarshal_z.mli index 09181a7c0701dcb7512ea8abcc14b2a59b199e4c..d6b80d2bddc086eb05fa38746694cad6e041059a 100644 --- a/src/libraries/datatype/unmarshal_z.mli +++ b/src/libraries/datatype/unmarshal_z.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/project.ml b/src/libraries/project/project.ml index 98a591dcf40015180653df1aee11807e4bab207d..8e6d177159a0773d45e35972c4d547977b0da9cd 100644 --- a/src/libraries/project/project.ml +++ b/src/libraries/project/project.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/project.mli b/src/libraries/project/project.mli index 64c37c20c82fe7d24d1c3bc19921dbc2b0cd0538..db7663431981598d07bc494ef71d487759e37be2 100644 --- a/src/libraries/project/project.mli +++ b/src/libraries/project/project.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/project_skeleton.ml b/src/libraries/project/project_skeleton.ml index be6e0d162e0074a3db18b6444b3566e6d2e75d56..77994ea2cee12896392524fef301a834533890da 100644 --- a/src/libraries/project/project_skeleton.ml +++ b/src/libraries/project/project_skeleton.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/project_skeleton.mli b/src/libraries/project/project_skeleton.mli index 92b9660246511516b9fad3f4291ab942ee826089..9861f317dfd25c192fbf79282c7d401b6e7d1e5c 100644 --- a/src/libraries/project/project_skeleton.mli +++ b/src/libraries/project/project_skeleton.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state.ml b/src/libraries/project/state.ml index ec100fd3029b44cf4a1fdcf19ed327f9ef1bd91f..3a88e7f91654e34916ee52d0ba988efcb55f1e59 100644 --- a/src/libraries/project/state.ml +++ b/src/libraries/project/state.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state.mli b/src/libraries/project/state.mli index b67cf7eb11527e74ee691d924e0f1ec560e957da..71cded022c238425cf442a5a15c9f37209eec190 100644 --- a/src/libraries/project/state.mli +++ b/src/libraries/project/state.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state_builder.ml b/src/libraries/project/state_builder.ml index 8ad617af0666e6a028068cec3ef3a8d829d1a6c9..c9cb0db92ba0026d6c3badd340e324d7e392897b 100644 --- a/src/libraries/project/state_builder.ml +++ b/src/libraries/project/state_builder.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -589,8 +589,23 @@ module type Weak_hashtbl = sig val remove: data -> unit end +module type Sub_caml_weak_hashtbl = +sig + include Datatype.Sub_caml_weak_hashtbl + val clear: t -> unit + val merge: t -> data -> data + val add: t -> data -> unit + val count: t -> int + val iter: (data->unit) -> t -> unit + val fold: (data->'a->'a) -> t -> 'a -> 'a + val find: t -> data -> data + val find_all: t -> data -> data list + val mem: t -> data -> bool + val remove: t -> data -> unit +end + module Weak_hashtbl - (W: Weak.S) + (W: Sub_caml_weak_hashtbl) (Data: Datatype.S with type t = W.data) (Info: Info_with_size) = struct @@ -743,8 +758,6 @@ struct HW.clear t; add_initial_values t - let stats _ = - abort "Not implemented: stats for %s (Hashconsing_tbl_no_gc)" Info.name let fold f = HW.fold_sorted (fun v _ acc -> f v acc) let iter f = HW.iter_sorted (fun v _ -> f v) let mem = HW.mem diff --git a/src/libraries/project/state_builder.mli b/src/libraries/project/state_builder.mli index 7ae3c2ec42e76efffd0bd1b4ad86311d51c57ae1..19c704ca799e369a59865cd02bec30d4c729125b 100644 --- a/src/libraries/project/state_builder.mli +++ b/src/libraries/project/state_builder.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state_dependency_graph.ml b/src/libraries/project/state_dependency_graph.ml index 5762035b3ae0640b0e96b64cac89ae7ee6a4ed94..49ae78135f81d02501f41ce46eafdf5fa5b60a6b 100644 --- a/src/libraries/project/state_dependency_graph.ml +++ b/src/libraries/project/state_dependency_graph.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state_dependency_graph.mli b/src/libraries/project/state_dependency_graph.mli index 6ac4db3edf68c05d8874b4bd8c7a562ed70326b5..99932307d3b01c467a8f7bb37150dd718052cbf0 100644 --- a/src/libraries/project/state_dependency_graph.mli +++ b/src/libraries/project/state_dependency_graph.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state_selection.ml b/src/libraries/project/state_selection.ml index 70a50126755573a55c033f2fe89131595e621592..02ed78f0453508b335c81ff92f6763322b50d804 100644 --- a/src/libraries/project/state_selection.ml +++ b/src/libraries/project/state_selection.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/project/state_selection.mli b/src/libraries/project/state_selection.mli index b8380fddcd22bdfb5c56c4f4b8d47dc679577d44..848236ed4b3d1424897b315f851f81d580f51336 100644 --- a/src/libraries/project/state_selection.mli +++ b/src/libraries/project/state_selection.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,7 +31,9 @@ type t (** Type of a state selection. - @since Carbon-20101201 *) + @since Carbon-20101201 + @plugin development guide + *) val ty: t Type.t (** Type value representing {!t}. diff --git a/src/libraries/stdlib/FCDynlink.mli b/src/libraries/stdlib/FCDynlink.mli deleted file mode 100644 index c5c3bbb7e0870e3b64b653171c25230d4522fb49..0000000000000000000000000000000000000000 --- a/src/libraries/stdlib/FCDynlink.mli +++ /dev/null @@ -1,109 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Wrapper for [Dynlink] compatible with all OCaml versions. *) - -module type OldDynlink = sig - - (** {6 Dynamic loading of compiled files} *) - -val loadfile : string -> unit -(** In bytecode: load the given bytecode object file ([.cmo] file) or - bytecode library file ([.cma] file), and link it with the running - program. In native code: load the given OCaml plugin file (usually - [.cmxs]), and link it with the running - program. - All toplevel expressions in the loaded compilation units - are evaluated. No facilities are provided to - access value names defined by the unit. Therefore, the unit - must register itself its entry points with the main program, - e.g. by modifying tables of functions. *) - -(** {6 Access control} *) - -val allow_unsafe_modules : bool -> unit -(** Govern whether unsafe object files are allowed to be - dynamically linked. A compilation unit is ``unsafe'' if it contains - declarations of external functions, which can break type safety. - By default, dynamic linking of unsafe object files is - not allowed. In native code, this function does nothing; object files - with external functions are always allowed to be dynamically linked. *) - -(** {6 Deprecated, initialization} *) - -val init : unit -> unit -(** @deprecated Initialize the [Dynlink] library. This function is called - automatically when needed. *) - -val add_interfaces: string list -> string list -> unit -(**/**) - -(** {6 Internal functions} *) - -val digest_interface : string -> string list -> Digest.t - -end - -include OldDynlink - -exception Unsupported_Feature of string - -(** Dynamic loading of object files. *) - -val is_native: bool -(** [true] if the program is native, - [false] if the program is bytecode. *) - -val adapt_filename: string -> string -(** In bytecode, the identity function. In native code, replace the last - extension with [.cmxs]. *) - -(** {6 Error reporting} *) - -type linking_error = - Undefined_global of string - | Unavailable_primitive of string - | Uninitialized_global of string - -type error = - Not_a_bytecode_file of string - | Inconsistent_import of string - | Unavailable_unit of string - | Unsafe_file - | Linking_error of string * linking_error - | Corrupted_interface of string - | File_not_found of string - | Cannot_open_dll of string - | Inconsistent_implementation of string - -exception Error of error -(** Errors in dynamic linking are reported by raising the [Error] - exception with a description of the error. *) - -val error_message : error -> string -(** Convert an error description to a printable message. *) - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/libraries/stdlib/FCHashtbl.ml b/src/libraries/stdlib/FCHashtbl.ml index 0858b7dfe7456cf63886e94fde47d1df1bce4d6a..68367efd07cd6d40b77b31f6195258165f592379 100644 --- a/src/libraries/stdlib/FCHashtbl.ml +++ b/src/libraries/stdlib/FCHashtbl.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/stdlib/FCHashtbl.mli b/src/libraries/stdlib/FCHashtbl.mli index f48b7f66cd18e5bec38b09568528541acb83d865..d904fda0c7738851ec04143129a08baafda7f30f 100644 --- a/src/libraries/stdlib/FCHashtbl.mli +++ b/src/libraries/stdlib/FCHashtbl.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/stdlib/dynlink_native_ko.ml b/src/libraries/stdlib/dynlink_native_ko.ml deleted file mode 100644 index 2e5f1990ade7dcf2cf75bac01d23a0bb8dec7a00..0000000000000000000000000000000000000000 --- a/src/libraries/stdlib/dynlink_native_ko.ml +++ /dev/null @@ -1,98 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(* Implementation of [FCDynlink] compatible with OCaml >=3.11 - whenever [Dynlink] **does not** correctly work. *) - -module type OldDynlink = sig - val loadfile : string -> unit - val allow_unsafe_modules : bool -> unit - val init : unit -> unit - val add_interfaces: string list -> string list -> unit - val digest_interface : string -> string list -> Digest.t -end - -exception Unsupported_Feature of string -let fail s = fun _ -> raise (Unsupported_Feature s) - -let is_native = Dynlink.is_native - -let adapt_filename = - if is_native then fail "adapt_filename" else Dynlink.adapt_filename - -let loadfile = if is_native then fail "loadfile" else Dynlink.loadfile - -let loadfile_private = - if is_native then fail "loadfile_private" else Dynlink.loadfile_private - -let allow_unsafe_modules = - if is_native then fail "allow_unsafe_modules" - else Dynlink.allow_unsafe_modules - -let init = if is_native then fail "init" else Dynlink.init - -let clear_available_units = - if is_native then fail "clear_available_units" - else Dynlink.clear_available_units - -let add_available_units = - if is_native then fail "add_available_units" else Dynlink.add_available_units - -let add_interfaces = - if is_native then fail "add_interfaces" else Dynlink.add_interfaces - -let default_available_units = - if is_native then fail "default_available_units" - else Dynlink.default_available_units - -let prohibit = if is_native then fail "prohibit" else Dynlink.prohibit -let allow_only = if is_native then fail "allow_only" else Dynlink.allow_only - -type linking_error = Dynlink.linking_error = - Undefined_global of string - | Unavailable_primitive of string - | Uninitialized_global of string - -type error = Dynlink.error = - Not_a_bytecode_file of string - | Inconsistent_import of string - | Unavailable_unit of string - | Unsafe_file - | Linking_error of string * linking_error - | Corrupted_interface of string - | File_not_found of string - | Cannot_open_dll of string - | Inconsistent_implementation of string - -exception Error = Dynlink.Error - -let error_message = - if is_native then fail "error_message" else Dynlink.error_message - -let digest_interface = - if is_native then fail "digest_interface" else Dynlink.digest_interface - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) diff --git a/src/libraries/stdlib/extlib.ml b/src/libraries/stdlib/extlib.ml index 7e176edf36b16855326822d916d7737570cdaacf..6752c7d0874f70d634aef68cf207f478269fdbb6 100644 --- a/src/libraries/stdlib/extlib.ml +++ b/src/libraries/stdlib/extlib.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,7 +29,7 @@ let adapt_filename f = try Filename.chop_extension f ^ ext with Invalid_argument _ -> f ^ ext in - change_suffix (if FCDynlink.is_native then ".cmxs" else ".cmo") + change_suffix (if Dynlink.is_native then ".cmxs" else ".cmo") (* [max_cpt t1 t2] returns the maximum of [t1] and [t2] wrt the total ordering induced by tags creation. This ordering is defined as follows: @@ -288,46 +288,9 @@ let xor x y = if x then not y else y (* replace "noalloc" with [@@noalloc] for OCaml version >= 4.03.0 *) [@@@ warning "-3"] -external getperfcount: unit -> int = "getperfcount" "noalloc" -external getperfcount1024: unit -> int = "getperfcount1024" "noalloc" external address_of_value: 'a -> int = "address_of_value" "noalloc" [@@@ warning "+3"] -let gentime counter ?msg f x = - let c1 = counter () in - let res = f x in - let c2 = counter () in - Format.printf "Time%s: %d@." - (match msg with None -> "" | Some s -> " of " ^ s) - (c2 - c1); - res - -let time ?msg f x = gentime getperfcount ?msg f x -let time1024 ?msg f x = gentime getperfcount1024 ?msg f x - -(* The two functions below are not exported right now *) -let _time' name f = - let cpt = ref 0 in - fun x -> - let b = getperfcount () in - let res = f x in - let e = getperfcount () in - let diff = e - b in - cpt := !cpt + diff; - Format.eprintf "timing of %s: %d (%d)@." name !cpt diff; - res - -let _time2 name f = - let cpt = ref 0 in - fun x y -> - let b = getperfcount () in - let res = f x y in - let e = getperfcount () in - let diff = e - b in - cpt := !cpt + diff; - Format.eprintf "timing of %s: %d (%d)@." name !cpt diff; - res - (* ************************************************************************* *) (** {2 Exception catcher} *) (* ************************************************************************* *) diff --git a/src/libraries/stdlib/extlib.mli b/src/libraries/stdlib/extlib.mli index 6ed2a0a8fae6f2c4cc5742d92af5ed06d6e5bbd4..5345182573b7715a44c6fd53ea99c099c5b2c4af 100644 --- a/src/libraries/stdlib/extlib.mli +++ b/src/libraries/stdlib/extlib.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -286,14 +286,9 @@ val make_unique_name: (* replace "noalloc" with [@@noalloc] for OCaml version >= 4.03.0 *) [@@@ warning "-3"] -external getperfcount: unit -> int = "getperfcount" "noalloc" -external getperfcount1024: unit -> int = "getperfcount1024" "noalloc" external address_of_value: 'a -> int = "address_of_value" "noalloc" [@@@ warning "+3"] -val time: ?msg:string -> ('a -> 'b) -> 'a -> 'b -val time1024: ?msg:string -> ('a -> 'b) -> 'a -> 'b - (* ************************************************************************* *) (** {2 Exception catcher} *) (* ************************************************************************* *) diff --git a/src/libraries/stdlib/integer.ml b/src/libraries/stdlib/integer.ml index b2982ac797c071e38a15916e3e892557c29c92c6..a9ba6ed7b57f558de00e75384e5789c57bbc749c 100644 --- a/src/libraries/stdlib/integer.ml +++ b/src/libraries/stdlib/integer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/stdlib/integer.mli b/src/libraries/stdlib/integer.mli index 9ee3e7cba12a585c64cf659301a8985fcc062971..488ea062159d21a823c9a120980fdbbc2adfe859 100644 --- a/src/libraries/stdlib/integer.mli +++ b/src/libraries/stdlib/integer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/stdlib/transitioning.ml b/src/libraries/stdlib/transitioning.ml index 5eb8e4c2dec9ab194ee9755de07f7e371d85717f..b093ff6be201368512e1887ef67974c462e9de98 100644 --- a/src/libraries/stdlib/transitioning.ml +++ b/src/libraries/stdlib/transitioning.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/stdlib/transitioning.mli b/src/libraries/stdlib/transitioning.mli index 8983c05037c51e778dccfa4d9453f934a123a79f..556440733d9cad0cf1cad801bbbc93652c44767c 100644 --- a/src/libraries/stdlib/transitioning.mli +++ b/src/libraries/stdlib/transitioning.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/bag.ml b/src/libraries/utils/bag.ml index fb2b52f7c672058a717c38fc016e3d7d2df370e2..a01f88ae84d9db529a1cb944635436a4a1a21076 100644 --- a/src/libraries/utils/bag.ml +++ b/src/libraries/utils/bag.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/bag.mli b/src/libraries/utils/bag.mli index 515ffffc0faa5bbc6683a58ed0eb968485755af1..2c38d9498be49afa13f4562939b9dffd38d50dab 100644 --- a/src/libraries/utils/bag.mli +++ b/src/libraries/utils/bag.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/binary_cache.ml b/src/libraries/utils/binary_cache.ml index 8e3a7f6fb579b7324530ef85f7ba4ae34426f34d..7332a288eed184280b84c2e4e85d48606c5ac623 100644 --- a/src/libraries/utils/binary_cache.ml +++ b/src/libraries/utils/binary_cache.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/binary_cache.mli b/src/libraries/utils/binary_cache.mli index 8e90f0826d29ead944388fc52437a382cba0ec32..400dcc0809dbdff2cd269b055e8b3f16e2a978d1 100644 --- a/src/libraries/utils/binary_cache.mli +++ b/src/libraries/utils/binary_cache.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/bitvector.ml b/src/libraries/utils/bitvector.ml index 3ebf43df12b59650f7a61f4fad2203111d8bef37..5f32c055bc90a148b5ba3344c075baf966427d37 100644 --- a/src/libraries/utils/bitvector.ml +++ b/src/libraries/utils/bitvector.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/bitvector.mli b/src/libraries/utils/bitvector.mli index 79032ee400ea1a1c5068fc8cb6c51cc3ae68fc22..d0362f0aef1d17ee4c563414e721eabccfd3c370 100644 --- a/src/libraries/utils/bitvector.mli +++ b/src/libraries/utils/bitvector.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/c_bindings.c b/src/libraries/utils/c_bindings.c index 4dbaa607890f0fac5539e9771ec84ace97bfd9de..0672ff14ce1491609e81df7db4a27d6a2acdb1c7 100644 --- a/src/libraries/utils/c_bindings.c +++ b/src/libraries/utils/c_bindings.c @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ @@ -54,24 +54,6 @@ typedef enum { FE_ToNearest, FE_Upward, FE_Downward, FE_TowardZero } c_rounding_mode_t; -#if defined(__i386__) -#define GETCOUNTER(low,high) \ - __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high)); -#else -#if defined(__x86_64__) -#define GETCOUNTER(low,high) \ -{ \ - unsigned int __a,__d; \ - asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ - low = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ - high = 0; \ -} -#else -#define GETCOUNTER(low,high) \ - { low = 0; high = 0; } -#endif -#endif - value c_round(value d) { return caml_copy_double(round(Double_val(d))); @@ -129,22 +111,6 @@ value c_sqrtf(value d) return caml_copy_double(res); } -value getperfcount1024(value dum) -{ - unsigned long l,h,acc; - GETCOUNTER(l,h); - acc = (l >> 10) | (h << 22); - return (acc | 1); -} - -value getperfcount(value dum) -{ - unsigned long l, h; - GETCOUNTER(l,h); - (void) h; - return (l | 1); -} - value compare_strings(value v1, value v2, value vlen) { if (memcmp(String_val(v1), String_val(v2), Long_val(vlen)) == 0) return Val_true; @@ -240,10 +206,19 @@ float strtof(const char *, char **); value single_precision_of_string(value str) { + const char *s = (const char *)str; + const char *s_end = s + caml_string_length(str); char *end; - float f = strtof((const char *)str, &end); - if (end != (char *)str + caml_string_length(str)) - caml_failwith("single_precision_of_string"); + float f = strtof(s, &end); + if (end != s_end) { + // Because strtof does not consider optional floating-point suffixes + // (f, F, l, L), we have to test if they are the cause of the difference, + // and if so, ignore it. + if (end + 1 != s_end || + (*end != 'f' && *end != 'F' && *end != 'l' && *end == 'L')) { + caml_failwith("single_precision_of_string"); + } + } double d = f; return caml_copy_double(d); } diff --git a/src/libraries/utils/command.ml b/src/libraries/utils/command.ml index 10a629079266d95f859641309939e97ffafeca1b..bd0b139c96f8a34f39d98c68909a30873680fff4 100644 --- a/src/libraries/utils/command.ml +++ b/src/libraries/utils/command.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/command.mli b/src/libraries/utils/command.mli index 30f9dcb9176adeb0e077832cef915834e563e28c..9c302717d9ae9acb810d0c4e4d9cebf075798fd9 100644 --- a/src/libraries/utils/command.mli +++ b/src/libraries/utils/command.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/escape.ml b/src/libraries/utils/escape.ml index 0ba389fc33ed2c2c104b8e203f362d30b3b1efea..bed960e171cfbc914c92f7b5544201e9b835c09f 100644 --- a/src/libraries/utils/escape.ml +++ b/src/libraries/utils/escape.ml @@ -46,26 +46,35 @@ type wchar = int64 type wstring = wchar list +let escape_char_internal maybe_trigraph = + function + | '\007' -> maybe_trigraph := false; "\\a" + | '\b' -> maybe_trigraph := false; "\\b" + | '\t' -> maybe_trigraph := false; "\\t" + | '\n' -> maybe_trigraph := false; "\\n" + | '\011' -> maybe_trigraph := false; "\\v" + | '\012' -> maybe_trigraph := false; "\\f" + | '\r' -> maybe_trigraph := false; "\\r" + | '"' -> maybe_trigraph := false; "\\\"" + | '\'' -> maybe_trigraph := false; "\\'" + | '\\' -> maybe_trigraph := false; "\\\\" + | '?' -> + let s = if !maybe_trigraph then "\\?" else "?" in + maybe_trigraph := true; + s + | ' ' .. '~' as printable -> maybe_trigraph := false; String.make 1 printable + | unprintable -> maybe_trigraph := false; Printf.sprintf "\\%03o" (Char.code unprintable) -let escape_char = function - | '\007' -> "\\a" - | '\b' -> "\\b" - | '\t' -> "\\t" - | '\n' -> "\\n" - | '\011' -> "\\v" - | '\012' -> "\\f" - | '\r' -> "\\r" - | '"' -> "\\\"" - | '\'' -> "\\'" - | '\\' -> "\\\\" - | ' ' .. '~' as printable -> String.make 1 printable - | unprintable -> Printf.sprintf "\\%03o" (Char.code unprintable) +let escape_char c = + let r = ref false in + escape_char_internal r c let escape_string str = let length = String.length str in let buffer = Buffer.create length in + let maybe_trigraph = ref false in for index = 0 to length - 1 do - Buffer.add_string buffer (escape_char (String.get str index)) + Buffer.add_string buffer (escape_char_internal maybe_trigraph (String.get str index)) done; Buffer.contents buffer diff --git a/src/libraries/utils/filepath.ml b/src/libraries/utils/filepath.ml index 9f5ce1e31bc1b0ffcd56244aeaf4dcd499b874f6..628af08c580f0e3830095637311257c1d5033476 100644 --- a/src/libraries/utils/filepath.ml +++ b/src/libraries/utils/filepath.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/filepath.mli b/src/libraries/utils/filepath.mli index 2001b955762fa68877cbab1eeffb2fe3ef5acfb5..08cd26ef78310860b34efaae7e278516882a25d4 100644 --- a/src/libraries/utils/filepath.mli +++ b/src/libraries/utils/filepath.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/floating_point.ml b/src/libraries/utils/floating_point.ml index ac2ac043cf9fadc6f2fb05bb7e1d41b12f82f924..d1ad782d93f935931f5239d0ff7968106e647544 100644 --- a/src/libraries/utils/floating_point.ml +++ b/src/libraries/utils/floating_point.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -224,9 +224,12 @@ let is_hex s = let single_precision_of_string s = if is_hex s - then - let f = sys_single_precision_of_string s in - { f_lower = f ; f_nearest = f ; f_upper = f } + then + try + let f = sys_single_precision_of_string s in + { f_lower = f ; f_nearest = f ; f_upper = f } + with Failure _ -> + Kernel.fatal "could not parse single-precision float string: %s" s else (* decimal *) parse_float ~man_size:23 ~min_exp:(-126) ~max_exp:127 s diff --git a/src/libraries/utils/floating_point.mli b/src/libraries/utils/floating_point.mli index 3ed11cf8ded53234d5deb1324d1cfefaa3300fbc..c24585cceedeebb793229742a9409a5c2dd81e5b 100644 --- a/src/libraries/utils/floating_point.mli +++ b/src/libraries/utils/floating_point.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/hook.ml b/src/libraries/utils/hook.ml index 7c4e762cee2b81fa6c01cc98ed6850bf7d3c5299..90b31751daec023dd1cca630e18eb4f2037e073e 100644 --- a/src/libraries/utils/hook.ml +++ b/src/libraries/utils/hook.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -54,7 +54,7 @@ let add_once v queue = let already = Queue.fold (fun b v' -> b || v' == v) false queue in if not already then Queue.add v queue -module Build(P:sig type t end) = struct +module Build(P:sig type t end): Iter_hook with type param = P.t = struct type param = P.t type result = unit let hooks = Queue.create () @@ -74,7 +74,8 @@ module Build(P:sig type t end) = struct let length () = Queue.length hooks end -module Fold(P:sig type t end) = struct +module Fold(P:sig type t end): S with type param=P.t and type result = P.t = +struct type param = P.t type result = P.t let hooks = Queue.create () diff --git a/src/libraries/utils/hook.mli b/src/libraries/utils/hook.mli index 640e96aa3d88b8a868e82f3bbcab7aa9735cf2af..b413418912262cd20392ff518f0bb7d5c863c4fa 100644 --- a/src/libraries/utils/hook.mli +++ b/src/libraries/utils/hook.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/hptmap.ml b/src/libraries/utils/hptmap.ml index a2bfa6868acb653442053db9b51a2c4f7f9c97cc..0d2c8ad5796b06006e17079c7236c61ffafad8dc 100644 --- a/src/libraries/utils/hptmap.ml +++ b/src/libraries/utils/hptmap.ml @@ -755,6 +755,18 @@ struct else if tree1' == Empty then tree0' else wrap_Branch p m tree0' tree1' + let rec filter f htr = match htr with + | Empty -> Empty + | Leaf (key, _data, _) -> + if f key then htr else Empty + | Branch (p, m, tree0, tree1, _) -> + let tree0' = filter f tree0 and tree1' = filter f tree1 in + if tree0' == tree0 && tree1' == tree1 + then htr + else if tree0' == Empty then tree1' + else if tree1' == Empty then tree0' + else wrap_Branch p m tree0' tree1' + (* The comment below is outdated: [map] and [endo_map] do not have the same signature for [f] *) (** [endo_map] is similar to [map], but attempts to physically share its diff --git a/src/libraries/utils/hptmap_sig.mli b/src/libraries/utils/hptmap_sig.mli index fa1ac37bce5ae2afdf78c644b66dd91a8ac7b618..8b67f8eb16a290687d0a512237e7bfccfe5e882c 100644 --- a/src/libraries/utils/hptmap_sig.mli +++ b/src/libraries/utils/hptmap_sig.mli @@ -86,6 +86,9 @@ module type S = sig (** Same as [map], except if [f k v] returns [None]. In this case, [k] is not bound in the resulting map. *) + val filter: (key -> bool) -> t -> t + (** [filter f t] keep only the bindings of [m] whose key verify [f]. *) + val fold : (key -> v -> 'b -> 'b) -> t -> 'b -> 'b (** [fold f m seed] invokes [f k d accu], in turn, for each binding from key [k] to datum [d] in the map [m]. Keys are presented to [f] in diff --git a/src/libraries/utils/hptset.ml b/src/libraries/utils/hptset.ml index dd5eabebd286a729014a6f92ea060e89bac4677a..41ec8a1c1a4446ac430e3b80751109645cd57d01 100644 --- a/src/libraries/utils/hptset.ml +++ b/src/libraries/utils/hptset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -91,8 +91,6 @@ module Make(X: Hptmap.Id_Datatype) let choose s = fst (min_binding s) - let filter f s = fold (fun x acc -> if f x then add x acc else acc) s empty - let partition f s = fold (fun x (w, wo) -> if f x then add x w, wo else w, add x wo) s (empty, empty) diff --git a/src/libraries/utils/hptset.mli b/src/libraries/utils/hptset.mli index 22bed95b5443d27025ddb852a406846111eece3c..d6f2b5f050b25972233f611c23cc723d368edfa4 100644 --- a/src/libraries/utils/hptset.mli +++ b/src/libraries/utils/hptset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/indexer.ml b/src/libraries/utils/indexer.ml index 841c2bde456a95c2736ce689efb2459e326fe846..2059d88f463a1952a16d2e47954836ce050ef90e 100644 --- a/src/libraries/utils/indexer.ml +++ b/src/libraries/utils/indexer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/indexer.mli b/src/libraries/utils/indexer.mli index 65cf44aa3ec956dc58ce6991c71dc712251cd4dc..529b31ea48797123ef192ee5f79fde43d61e073a 100644 --- a/src/libraries/utils/indexer.mli +++ b/src/libraries/utils/indexer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/json.mli b/src/libraries/utils/json.mli index 329d9cbc15852042d92032462f5c14e73ad9c200..53d24206a7ddd5f89711b945c96a3b9c42f288cf 100644 --- a/src/libraries/utils/json.mli +++ b/src/libraries/utils/json.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/json.mll b/src/libraries/utils/json.mll index 081d2d3b7a99fc579e420f66d6b573dd06b96db1..3db028eaf91087bf6dde62c1129cddeec3da129c 100644 --- a/src/libraries/utils/json.mll +++ b/src/libraries/utils/json.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/pretty_utils.ml b/src/libraries/utils/pretty_utils.ml index f44eeb56c48610d012b1ed730939715f13480192..2b77e9adbd8d18be5b5964f7654c35fc74788d3a 100644 --- a/src/libraries/utils/pretty_utils.ml +++ b/src/libraries/utils/pretty_utils.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/pretty_utils.mli b/src/libraries/utils/pretty_utils.mli index 4829f39539df7b039e52cf421c4fc62f287d3d50..b82b2377f72b30730a9edb68bdcb48ac17a51d26 100644 --- a/src/libraries/utils/pretty_utils.mli +++ b/src/libraries/utils/pretty_utils.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/qstack.ml b/src/libraries/utils/qstack.ml index b307fec1c7937b89641f3bb99126f03a707672eb..ff4d89fa8833a218dba29f83997bef7a6398e494 100644 --- a/src/libraries/utils/qstack.ml +++ b/src/libraries/utils/qstack.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/qstack.mli b/src/libraries/utils/qstack.mli index b35f43e57b216953a601bd84b94ebc0887928755..2d0acba7f78002ce355698abfa11447f1923b878 100644 --- a/src/libraries/utils/qstack.mli +++ b/src/libraries/utils/qstack.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/rgmap.ml b/src/libraries/utils/rgmap.ml index ed15b8b4c43cda1356a0b33cd9c9dad9dbaeeabc..d59932a19caca7d528d2bd714aa7bb681d701679 100644 --- a/src/libraries/utils/rgmap.ml +++ b/src/libraries/utils/rgmap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/rgmap.mli b/src/libraries/utils/rgmap.mli index 35a75229078ef2aa03c1301c8a005dceee3c9268..0d1acc80d36af37185382a7ff5364b8db1dbad5f 100644 --- a/src/libraries/utils/rgmap.mli +++ b/src/libraries/utils/rgmap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/task.ml b/src/libraries/utils/task.ml index 39e5aa5347896e6c361acf38d34510d30bcdd7b2..fc4d9a7f6e52401dc6a6c5030cccf0da0a409523 100644 --- a/src/libraries/utils/task.ml +++ b/src/libraries/utils/task.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/task.mli b/src/libraries/utils/task.mli index eec28be5ca5f107a13609a7e428d98290063a71c..27027a1cda700774275f0cef1d52119944a11c02 100644 --- a/src/libraries/utils/task.mli +++ b/src/libraries/utils/task.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/unicode.ml b/src/libraries/utils/unicode.ml index 6eb552bf79ae3832e5ed4bb18aef086d50c8f690..2ffcf5725cf1e19c278d6e4a58db1d17f480e5d4 100644 --- a/src/libraries/utils/unicode.ml +++ b/src/libraries/utils/unicode.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,3 +25,9 @@ let inset_string () = let emptyset_string () = if Kernel.Unicode.get () then Utf8_logic.emptyset else "EMPTY_SET" + +let top_string () = + if Kernel.Unicode.get () then Utf8_logic.top else "TOP" + +let bottom_string () = + if Kernel.Unicode.get () then Utf8_logic.bottom else "BOTTOM" diff --git a/src/libraries/utils/unicode.mli b/src/libraries/utils/unicode.mli index 6bdf22ecbee1f8a6158902e9db0e8ce7c3f2d642..7cc58a4e5de6c07c24547b66d4ae808877fb4ca9 100644 --- a/src/libraries/utils/unicode.mli +++ b/src/libraries/utils/unicode.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,3 +25,6 @@ val inset_string : unit -> string val emptyset_string : unit -> string + +val top_string: unit -> string +val bottom_string: unit -> string diff --git a/src/libraries/utils/utf8_logic.ml b/src/libraries/utils/utf8_logic.ml index 0b54882627f5217031808f1167e6197fb6cfbd29..01942556923e6c85567354705d396637e3c07138 100644 --- a/src/libraries/utils/utf8_logic.ml +++ b/src/libraries/utils/utf8_logic.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -69,6 +69,8 @@ let neg = from_unichar 0x00AC let x_or = from_unichar 0x22BB let inset = from_unichar 0x2208 let emptyset = from_unichar 0x2205 +let top = from_unichar 0x22A4 +let bottom = from_unichar 0x22A5 let boolean = from_unichar 0x1D539 let integer = from_unichar 0x2124 diff --git a/src/libraries/utils/utf8_logic.mli b/src/libraries/utils/utf8_logic.mli index 8cdfae91a6ee736fde3e053444ade320a718cda0..26592bcef3f7d188ed6782983c8bffdce79d8e5e 100644 --- a/src/libraries/utils/utf8_logic.mli +++ b/src/libraries/utils/utf8_logic.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -38,6 +38,8 @@ val neg : string val x_or : string val inset : string val emptyset : string +val top: string +val bottom:string val minus: string val boolean: string val integer: string diff --git a/src/libraries/utils/vector.ml b/src/libraries/utils/vector.ml index 779b9a021aabd5393b1b4dece883c48de1af1ec1..198f97cf11b09f6f68a6cf0bc48daef6b972f87b 100644 --- a/src/libraries/utils/vector.ml +++ b/src/libraries/utils/vector.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/vector.mli b/src/libraries/utils/vector.mli index 371be219c4352f727dac3b92f26a69a18839a79b..8e2dd7be6db49d70410349a32d9ebe25d2acf3da 100644 --- a/src/libraries/utils/vector.mli +++ b/src/libraries/utils/vector.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/wto.ml b/src/libraries/utils/wto.ml index 2b12e9697737f7bbfd6dc530ca59fa71eb39c301..9c29941f41ac07f9d55d106e2b9edd1a217bef13 100644 --- a/src/libraries/utils/wto.ml +++ b/src/libraries/utils/wto.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/libraries/utils/wto.mli b/src/libraries/utils/wto.mli index a6313d69150512018d00d19660bf494637ded349..2b8c546c7446d72c5c9fce37adfda0e60743205f 100644 --- a/src/libraries/utils/wto.mli +++ b/src/libraries/utils/wto.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/memory_state/new_offsetmap_extract_bits_and_stitch.pdf b/src/memory_state/new_offsetmap_extract_bits_and_stitch.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2e4b49d4c0156d41e79da50225e55f9dda676563 Binary files /dev/null and b/src/memory_state/new_offsetmap_extract_bits_and_stitch.pdf differ diff --git a/src/plugins/aorai/Aorai.mli b/src/plugins/aorai/Aorai.mli index 423a0ffbb333f29e634a66aa8d250fa51711e958..33b464133268632ce20f4b740fe878f9285c6fbc 100644 --- a/src/plugins/aorai/Aorai.mli +++ b/src/plugins/aorai/Aorai.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/Makefile.in b/src/plugins/aorai/Makefile.in index 30368f26d28192bb7e685527c9bfd337b3af6ed2..4dece6dd180d2a97edbfa13cd05a42a6e959ce87 100644 --- a/src/plugins/aorai/Makefile.in +++ b/src/plugins/aorai/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Aorai plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # INRIA (Institut National de Recherche en Informatique et en # @@ -39,7 +39,6 @@ endif PLUGIN_DIR ?=. PLUGIN_ENABLE:=@ENABLE_AORAI@ -PLUGIN_DYNAMIC:=@DYNAMIC_AORAI@ PLUGIN_NAME:=Aorai PLUGIN_GENERATED:= $(addprefix ${PLUGIN_DIR}/, \ promelalexer_withexps.ml promelaparser_withexps.ml \ diff --git a/src/plugins/aorai/aorai_dataflow.ml b/src/plugins/aorai/aorai_dataflow.ml index 8ef91772a037503ba8d6c5f2465db687a42bd2ea..73b0e32dff3233fbf6f73563be08640e666e1da8 100644 --- a/src/plugins/aorai/aorai_dataflow.ml +++ b/src/plugins/aorai/aorai_dataflow.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -430,50 +430,59 @@ module Computer(I: Init) = struct Some (res,loops) end - let doInstr s i (state,loops as d) = + let do_call s f args (state,loops as d) = + let kf = Globals.Functions.get f in + if Data_for_aorai.isIgnoredFunction (Kernel_function.get_name kf) + then d (* we simply skip ignored functions. *) + else begin + set_call_state s state; + Aorai_option.debug + ~dkey:forward_dkey "Call to %a from state:@\n @[%a@]" + Kernel_function.pretty kf Data_for_aorai.pretty_state state; + let prms = Kernel_function.get_formals (Globals.Functions.get f) in + let rec bind acc prms args = + match prms, args with + (* in case of variadics, we can have more args than prms *) + | [],_ -> acc + | _,[] -> + Aorai_option.fatal + "too few arguments in call to %a" Printer.pp_varinfo f + | p::prms, a::args -> + let lv = Logic_const.tvar (Cil.cvar_to_lvar p) in + let la = Logic_utils.expr_to_term ~cast:false a in + let value = + Cil_datatype.Term.Map.add + la (Fixed 0) Cil_datatype.Term.Map.empty + in + let acc = Cil_datatype.Term.Map.add lv value acc in + bind acc prms args + in + let args = bind Cil_datatype.Term.Map.empty prms args in + let init_states = extract_current_states state in + let init_trans = make_start_transition kf init_states in + let end_state = !compute_func I.stack (Kstmt s) kf init_trans in + let new_state = compose_states ~args state end_state in + Aorai_option.debug ~dkey:forward_dkey "At end of call:@\n @[%a@]" + Data_for_aorai.pretty_state new_state; + (new_state,loops) + end + + let doInstr s i d = match i with | Call (_,{ enode = Lval(Var v,NoOffset) },args,_) -> - let kf = Globals.Functions.get v in - if Data_for_aorai.isIgnoredFunction (Kernel_function.get_name kf) - then d (* we simply skip ignored functions. *) - else begin - set_call_state s state; - Aorai_option.debug - ~dkey:forward_dkey "Call to %a from state:@\n @[%a@]" - Kernel_function.pretty kf Data_for_aorai.pretty_state state; - let prms = Kernel_function.get_formals (Globals.Functions.get v) in - let rec bind acc prms args = - match prms, args with - (* in case of variadics, we can have more args than prms *) - | [],_ -> acc - | _,[] -> - Aorai_option.fatal - "too few arguments in call to %a" Printer.pp_varinfo v - | p::prms, a::args -> - let lv = Logic_const.tvar (Cil.cvar_to_lvar p) in - let la = Logic_utils.expr_to_term ~cast:false a in - let value = - Cil_datatype.Term.Map.add - la (Fixed 0) Cil_datatype.Term.Map.empty - in - let acc = Cil_datatype.Term.Map.add lv value acc in - bind acc prms args - in - let args = bind Cil_datatype.Term.Map.empty prms args in - let init_states = extract_current_states state in - let kf = Globals.Functions.get v in - let init_trans = make_start_transition kf init_states in - let end_state = !compute_func I.stack (Kstmt s) kf init_trans in - let new_state = compose_states ~args state end_state in - Aorai_option.debug ~dkey:forward_dkey "At end of call:@\n @[%a@]" - Data_for_aorai.pretty_state new_state; - (new_state,loops) - end + do_call s v args d | Call (_,e,_,_) -> Aorai_option.not_yet_implemented "Indirect call to %a is not handled yet" Printer.pp_exp e + | Local_init (v, ConsInit(f,args,kind),_) -> + let args = + match kind with + | Plain_func -> args + | Constructor -> Cil.mkAddrOfVi v :: args + in + do_call s f args d + | Local_init (_, AssignInit _, _) | Set _ | Asm _ | Skip _ | Code_annot _ -> d - let doGuard _ _ _ = (GDefault, GDefault) @@ -747,48 +756,51 @@ struct | Return _ -> Dataflow2.Done Reach.end_state | _ -> Dataflow2.Default + let do_call s f state = + let kf = Globals.Functions.get f in + if Data_for_aorai.isIgnoredFunction (Kernel_function.get_name kf) + then Dataflow2.Default (* we simply skip ignored functions. *) + else begin + try + let call_state = Call_state.find s in + let treat_one_state state map acc = + let current_states = set_of_map map in + let before_state = + !backward_analysis Reach.stack kf current_states + in + let possible_states = set_of_map before_state in + let call_map = + Data_for_aorai.Aorai_state.Map.find state call_state + in + Aorai_option.debug ~dkey:backward_dkey + "Stmt %d - %a@\nPossible states@\n%a" + s.sid Cil_datatype.Stmt.pretty s + (Data_for_aorai.pretty_end_state state) call_map; + let call_map = filter_state possible_states call_map in + Aorai_option.debug ~dkey:backward_dkey + "Filtered states@\n%a" + (Data_for_aorai.pretty_end_state state) call_map; + if Data_for_aorai.Aorai_state.Map.is_empty call_map then acc + else Data_for_aorai.Aorai_state.Map.add state call_map acc + in + let before_state = + Data_for_aorai.Aorai_state.Map.fold + treat_one_state state Data_for_aorai.Aorai_state.Map.empty + in + Done before_state + with Not_found -> + (* Not attained by forward analysis: this code is dead anyway. *) + Done Data_for_aorai.Aorai_state.Map.empty + end + let doInstr s instr state = match instr with - | Call (_,{ enode = Lval(Var v,NoOffset) },_,_) -> - let kf = Globals.Functions.get v in - if Data_for_aorai.isIgnoredFunction (Kernel_function.get_name kf) - then Dataflow2.Default (* we simply skip ignored functions. *) - else begin - try - let call_state = Call_state.find s in - let kf = Globals.Functions.get v in - let treat_one_state state map acc = - let current_states = set_of_map map in - let before_state = - !backward_analysis Reach.stack kf current_states - in - let possible_states = set_of_map before_state in - let call_map = - Data_for_aorai.Aorai_state.Map.find state call_state - in - Aorai_option.debug ~dkey:backward_dkey - "Stmt %d - %a@\nPossible states@\n%a" - s.sid Cil_datatype.Stmt.pretty s - (Data_for_aorai.pretty_end_state state) call_map; - let call_map = filter_state possible_states call_map in - Aorai_option.debug ~dkey:backward_dkey - "Filtered states@\n%a" - (Data_for_aorai.pretty_end_state state) call_map; - if Data_for_aorai.Aorai_state.Map.is_empty call_map then acc - else Data_for_aorai.Aorai_state.Map.add state call_map acc - in - let before_state = - Data_for_aorai.Aorai_state.Map.fold - treat_one_state state Data_for_aorai.Aorai_state.Map.empty - in - Done before_state - with Not_found -> - (* Not attained by forward analysis: this code is dead anyway. *) - Done Data_for_aorai.Aorai_state.Map.empty - end + | Call (_,{ enode = Lval(Var f,NoOffset) },_,_) -> do_call s f state | Call (_,e,_,_) -> Aorai_option.not_yet_implemented "Indirect call to %a is not handled yet" Printer.pp_exp e + | Local_init (_,ConsInit(f,_,_),_) -> do_call s f state + | Local_init (_,AssignInit _,_) | Set _ | Asm _ | Skip _ | Code_annot _ -> Dataflow2.Default let filterStmt _ _ = true diff --git a/src/plugins/aorai/aorai_dataflow.mli b/src/plugins/aorai/aorai_dataflow.mli index a42bcbf64996b0d3befeaf94fec4bb7d0bd56102..90c0ce1769e6e2b7c4f226edaeaf06a11a4e2658 100644 --- a/src/plugins/aorai/aorai_dataflow.mli +++ b/src/plugins/aorai/aorai_dataflow.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/aorai_option.ml b/src/plugins/aorai/aorai_option.ml index 73447b9156fd49ed6a3723e2e5e87592bfc120e8..2ebaf7472604b3299546f155bdba72d67a0bde52 100644 --- a/src/plugins/aorai/aorai_option.ml +++ b/src/plugins/aorai/aorai_option.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -154,17 +154,6 @@ let is_on () = not (Ltl_File.is_default () && To_Buchi.is_default () && Buchi.is_default () && Ya.is_default () ) -(* [JS 2009/10/04] - Preserve the behaviour of svn release <= r5012. - However it works only if aorai is run from the command line. *) -let init () = - if is_on () then begin - Kernel.SimplifyCfg.on (); - Kernel.KeepSwitch.on () - end - -let () = Cmdline.run_after_configuring_stage init - let promela_file () = if Buchi.get () = "" then To_Buchi.get () else Buchi.get () diff --git a/src/plugins/aorai/aorai_option.mli b/src/plugins/aorai/aorai_option.mli index 21baec5bd95613bb3d011c36d9a1053682e9ed47..5412e8973bbf59e881b8ec3cdef344d6f396310f 100644 --- a/src/plugins/aorai/aorai_option.mli +++ b/src/plugins/aorai/aorai_option.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/aorai_register.ml b/src/plugins/aorai/aorai_register.ml index b8c9e0905203b6680a5e47e872dcae24a8f1149e..0e430295fe9cf7e77da6aed5d2162ac27aeec98d 100644 --- a/src/plugins/aorai/aorai_register.ml +++ b/src/plugins/aorai/aorai_register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/aorai_utils.ml b/src/plugins/aorai/aorai_utils.ml index dfc4fa866b03d9cb49dc568a420f0e9c8964c7c6..410b2457715444bc186bb8ef0fdddb40a1812767 100644 --- a/src/plugins/aorai/aorai_utils.ml +++ b/src/plugins/aorai/aorai_utils.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -885,14 +885,17 @@ let pred_of_condition subst subst_res label cond = in let mk_func_start f = mk_func_status f Promelaast.Call in let mk_func_return f = mk_func_status f Promelaast.Return in - let rec aux kf pos = function + let rec aux kf is_or = function | TOr(c1,c2) -> - kf, Logic_const.por (snd (aux kf pos c1), snd (aux kf pos c2)) + let kf, c1 = aux kf true c1 in + let kf, c2 = aux kf true c2 in + kf, Logic_const.por (c1, c2) | TAnd(c1,c2) -> - let kf, c1 = aux kf pos c1 in - let kf, c2 = aux kf pos c2 in + let kf, c1 = aux kf false c1 in + let kf, c2 = aux kf false c2 in kf, Logic_const.pand (c1, c2) - | TNot c -> let kf, c = aux kf (not pos) c in kf, Logic_const.pnot c + | TNot c -> + let kf, c = aux kf (not is_or) c in kf, Logic_const.pnot c | TCall (s,b) -> let pred = mk_func_start (Kernel_function.get_name s) in let pred = @@ -904,19 +907,20 @@ let pred_of_condition subst subst_res label cond = in kf, pred | TReturn s -> - let kf = if pos then Some s else kf in - kf, mk_func_return (Kernel_function.get_name s) + let kf = if is_or then kf else Some s in + kf, mk_func_return (Kernel_function.get_name s) | TTrue -> kf, ptrue | TFalse -> kf, pfalse | TRel(rel,t1,t2) -> kf, unamed (change_vars subst subst_res kf label (prel (rel,t1,t2)).pred_content) - in snd (aux None true cond) + in + snd (aux None true cond) let mk_deterministic_lemma () = let automaton = Data_for_aorai.getAutomata () in let make_one_lemma state = - let label = Cil_types.LogicLabel(None, "L") in + let label = Cil_types.FormalLabel "L" in let disjoint_guards acc trans1 trans2 = if trans1.numt <= trans2.numt then acc (* don't need to repeat the same condition twice*) @@ -1000,7 +1004,10 @@ let initGlobals root complete = if Aorai_option.Deterministic.get () then make_enum_states (); (* non deterministic mode uses one variable for each possible state *) mk_global_c_enum_type - listOp (List.map (fun e -> func_to_op_func e) (getFunctions_from_c())); + listOp + (List.map + (fun e -> func_to_op_func e) + (getFunctions_from_c() @ getIgnoredFunctions())); mk_global_c_initialized_enum curOp listOp (func_to_init (Kernel_function.get_name root)); mk_global_c_enum_type listStatus (callStatus::[termStatus]); diff --git a/src/plugins/aorai/aorai_utils.mli b/src/plugins/aorai/aorai_utils.mli index 5ccf05a9a783a86a38c0e4355a48da985e2fcd5e..af9ce416bdced2937947841c3dbfad5fed4b2eef 100644 --- a/src/plugins/aorai/aorai_utils.mli +++ b/src/plugins/aorai/aorai_utils.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -101,8 +101,7 @@ val is_out_of_state_exp: state -> location -> Cil_types.exp @since Neon-20140301 adds kf argument *) val aorai_assigns: - Data_for_aorai.state -> - Cil_types.location -> Cil_types.identified_term Cil_types.assigns + Data_for_aorai.state -> Cil_types.location -> Cil_types.assigns (** returns the list of predicates expressing that for each current state the automaton currently is in, there is at least one transition that is diff --git a/src/plugins/aorai/aorai_visitors.ml b/src/plugins/aorai/aorai_visitors.ml index 0f5b485abb57a87c2e05aa951801c3709945cece..0575a30555d38763d9077e0dd2b74f18265933bd 100644 --- a/src/plugins/aorai/aorai_visitors.ml +++ b/src/plugins/aorai/aorai_visitors.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -1096,48 +1096,11 @@ object(self) ChangeDoChildrenPost(stmt,after) method! vinst = function - | Call _ -> self#call (); DoChildren + | Call _ | Local_init (_, ConsInit _, _) -> self#call (); DoChildren | _ -> DoChildren end - - - - -(****************************************************************************) -(** - This visitor computes the list of ignored functions. - A function is ignored if its call is present in the C program, - while its definition is not available. -*) -class visit_computing_ignored_functions () = - let declaredFunctions = Data_for_aorai.getFunctions_from_c () in - let isDeclaredInC fname = - List.exists - (fun s -> (String.compare fname s)=0) - declaredFunctions - in -object (*(self)*) - - inherit Visitor.frama_c_inplace - - method! vfunc _f = DoChildren - - method! vstmt_aux stmt = - match stmt.skind with - | Instr(Call (_,funcexp,_,_)) -> - let name = get_call_name funcexp in - (* If the called function is neither ignored, nor declared, - then it has to be added to ignored functions. *) - if (not (Data_for_aorai.isIgnoredFunction name)) - && (not (isDeclaredInC name)) then - (Data_for_aorai.addIgnoredFunction name); - DoChildren - | _ -> DoChildren - -end - let add_pre_post_from_buch file treatloops = let visitor = new visit_adding_pre_post_from_buch treatloops in Cil.visitCilFile (visitor :> Cil.cilVisitor) file; @@ -1165,11 +1128,6 @@ let add_sync_with_buch file = let visitor = new visit_adding_code_for_synchronisation in Cil.visitCilFile (visitor :> Cil.cilVisitor) file -(* Call of the visitor *) -let compute_ignored_functions file = - let visitor = new visit_computing_ignored_functions () in - Cil.visitCilFile (visitor :> Cil.cilVisitor) file - (* Local Variables: compile-command: "make -C ../../.." diff --git a/src/plugins/aorai/bool3.ml b/src/plugins/aorai/bool3.ml index 41efa3c1eeb7921dfb2e7d3d10e3deccc10e3901..3c189f5ff1edb0294c6b516735f829d91db380c3 100644 --- a/src/plugins/aorai/bool3.ml +++ b/src/plugins/aorai/bool3.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/bool3.mli b/src/plugins/aorai/bool3.mli index cbca524aa846b39ffdcae4e9d75570fbb2de4b34..5144656fdc4a19398eb69392170a2c28fa69da40 100644 --- a/src/plugins/aorai/bool3.mli +++ b/src/plugins/aorai/bool3.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/configure.ac b/src/plugins/aorai/configure.ac index 7bc91ba4e4ece61af4504f649214c22db3ff8002..92743c459ea0319b1b3a4036c29da0a2108fc6c5 100644 --- a/src/plugins/aorai/configure.ac +++ b/src/plugins/aorai/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Aorai plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # INRIA (Institut National de Recherche en Informatique et en # diff --git a/src/plugins/aorai/data_for_aorai.ml b/src/plugins/aorai/data_for_aorai.ml index 0332a621393f158cfbf5a8183380700e35c7930b..e487a24d6a4c2ff1079055fc5075c2b626f1a815 100644 --- a/src/plugins/aorai/data_for_aorai.ml +++ b/src/plugins/aorai/data_for_aorai.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -293,7 +293,7 @@ let update_condition vi1 vi2 cond = let pebble_set_at li lab = assert (li.l_profile = []); - let labels = List.map (fun x -> (x,lab)) li.l_labels in + let labels = List.map (fun _ -> lab) li.l_labels in Logic_const.term (Tapp (li,labels,[])) (Extlib.the li.l_type) let memo_multi_state st = @@ -304,7 +304,7 @@ let memo_multi_state st = let set = Cil_const.make_logic_info (get_fresh (st.name ^ "_pebble")) in let typ = Logic_const.make_set_type (Ctype Cil.intType) in set.l_var_info.lv_type <- typ; - set.l_labels <- [ LogicLabel(None,"L")]; + set.l_labels <- [FormalLabel "L"]; set.l_type <- Some typ; set.l_body <- LBreads @@ -873,7 +873,7 @@ let type_cond needs_pebble env tr cond = let env, e2, c2 = type_expr env ~tr ?current e2 in let call_cond = if pos then tand c1 c2 else tor (tnot c1) (tnot c2) in let rel = TRel(Logic_typing.type_rel rel,e1,e2) in - let cond = if pos then tand rel call_cond else tor rel call_cond in + let cond = if pos then tand call_cond rel else tor call_cond rel in env, cond | PTrue -> env, TTrue | PFalse -> env, TFalse diff --git a/src/plugins/aorai/data_for_aorai.mli b/src/plugins/aorai/data_for_aorai.mli index 7179248f97e6d8320e9d59e95dc9404bc66e5b0c..b3a35a34398a4487176ddfa42f11df4556d9c76c 100644 --- a/src/plugins/aorai/data_for_aorai.mli +++ b/src/plugins/aorai/data_for_aorai.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/logic_simplification.ml b/src/plugins/aorai/logic_simplification.ml index 87203f97056fa5a654ea553141c4b7c41a883e7c..1996d7234441d67283237e0082e2d32665c47a0f 100644 --- a/src/plugins/aorai/logic_simplification.ml +++ b/src/plugins/aorai/logic_simplification.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) @@ -56,12 +56,13 @@ let rec condToDNF cond = | TOr (c1, c2) -> (condToDNF c1)@(condToDNF c2) | TAnd (c1, c2) -> let d1,d2=(condToDNF c1), (condToDNF c2) in - List.fold_left - (fun lclause clauses2 -> - (List.map (fun clauses1 -> clauses1@clauses2) d1) @ lclause - ) - [] d2 - | TNot (c) -> + List.rev + (List.fold_left + (fun lclause clauses1 -> + (List.map (fun clauses2 -> clauses1@clauses2) d2) @ lclause + ) + [] d1) + | TNot (c) -> begin match c with | TOr (c1, c2) -> condToDNF (TAnd(TNot(c1),TNot(c2))) @@ -146,52 +147,57 @@ let positiveCallOrRet clause = (None, []) clause in + let computePositive = List.rev computePositive in (* Step 2 : Remove negatives not enough expressive *) match positive with | None -> computePositive | Some (TCall (kf1,None)) -> - List.fold_left - (fun treated term -> - match term with - | TNot(TCall (kf2,_)) -> - if Kernel_function.equal kf1 kf2 then raise Exit - (* Positive information more specific than negative *) - else treated - | TNot(TReturn _) -> treated - | _ -> term::treated - ) - [] computePositive + List.rev + (List.fold_left + (fun treated term -> + match term with + | TNot(TCall (kf2,_)) -> + if Kernel_function.equal kf1 kf2 then raise Exit + (* Positive information more specific than negative *) + else treated + | TNot(TReturn _) -> treated + | _ -> term::treated + ) + [] computePositive) | Some (TCall (kf1, Some b1)) -> - List.fold_left - (fun treated term -> - match term with - | TNot(TCall (kf2,None)) -> - if Kernel_function.equal kf1 kf2 then raise Exit - (* Positive information more specific than negative *) - else treated - | TNot(TCall(kf2, Some b2)) -> - if Kernel_function.equal kf1 kf2 then - if Datatype.String.equal b1.b_name b2.b_name then raise Exit - else term :: treated - else treated - | TNot(TReturn _) -> treated - | _ -> term::treated - ) - [] computePositive - + List.rev + (List.fold_left + (fun treated term -> + match term with + | TNot(TCall (kf2,None)) -> + if Kernel_function.equal kf1 kf2 then raise Exit + (* Positive information more specific than negative *) + else treated + | TNot(TCall(kf2, Some b2)) -> + if Kernel_function.equal kf1 kf2 then + if Datatype.String.equal b1.b_name b2.b_name then + raise Exit + else term :: treated + else treated + | TNot(TReturn _) -> treated + | _ -> term::treated + ) + [] computePositive) | Some (TReturn kf1) -> - List.fold_left - (fun treated term -> - match term with - | TNot(TCall _) -> treated - | TNot(TReturn kf2) -> - (* Two opposite information *) - if Kernel_function.equal kf1 kf2 then raise Exit else treated - | _ -> term::treated - ) - [] computePositive - | _ -> - Aorai_option.fatal "inconsistent environment in positiveCallOrRet" + List.rev + (List.fold_left + (fun treated term -> + match term with + | TNot(TCall _) -> treated + | TNot(TReturn kf2) -> + (* Two opposite information *) + if Kernel_function.equal kf1 kf2 then raise Exit + else treated + | _ -> term::treated + ) + [] computePositive) + | _ -> + Aorai_option.fatal "inconsistent environment in positiveCallOrRet" with Exit -> [TFalse] (* contradictory requirements for current event. *) let rel_are_equals (rel1,t11,t12) (rel2,t21,t22) = @@ -213,56 +219,6 @@ let contradict_rel r1 (rel2,t21,t22) = rel_are_equals r1 (opposite_rel rel2, t21,t22) || rel_are_equals (swap_rel r1) (opposite_rel rel2, t21, t22) -(** Simplify redundant relations. *) -let simplify clause = - try - List.fold_left - (fun clause term -> - match term with - | TTrue | TNot(TFalse) -> clause - | TFalse | TNot(TTrue) -> raise Exit - | TRel(rel1,t11,t12) -> - if - List.exists - (fun term -> - match term with - | TRel(rel2,t21,t22) - when contradict_rel (rel1,t11,t12) (rel2, t21,t22) -> - raise Exit - | TRel(rel2,t21,t22) -> - rel_are_equals (rel1,t11,t12) (rel2,t21,t22) - | TNot(TRel(rel2,t21,t22)) - when (rel_are_equals (rel1,t11,t12) (rel2,t21,t22)) -> - raise Exit - | TNot(TRel(rel2,t21,t22)) -> - contradict_rel (rel1,t11,t12) (rel2,t21,t22) - | _ -> false) - clause - then clause - else term::clause - | TNot(TRel(rel1,t11,t12)) -> - if - List.exists - (fun term -> - match term with - | TNot(TRel(rel2,t21,t22)) - when contradict_rel (rel1,t11,t12) (rel2, t21,t22) -> - raise Exit - | TNot(TRel(rel2,t21,t22)) -> - rel_are_equals (rel1,t11,t12) (rel2,t21,t22) - | TRel(rel2,t21,t22) - when (rel_are_equals (rel1,t11,t12) (rel2,t21,t22)) -> - raise Exit - | TRel(rel2,t21,t22) -> - contradict_rel (rel1,t11,t12) (rel2,t21,t22) - | _ -> false) - clause - then clause - else term::clause - | _ -> term :: clause) - [] clause - with Exit -> [TFalse] - let rec termsAreEqual term1 term2 = match term1,term2 with | TTrue,TTrue @@ -275,10 +231,35 @@ let rec termsAreEqual term1 term2 = | TRel(rel1,t11,t12), TNot(TRel(rel2,t21,t22)) -> contradict_rel (rel1,t11,t12) (rel2,t21,t22) | TNot(a),TNot(b) -> termsAreEqual a b - | TRel(rel1,t11,t12), TRel(rel2,t21,t22) -> + | TRel(rel1,t11,t12), TRel(rel2,t21,t22) -> rel_are_equals (rel1,t11,t12) (rel2,t21,t22) | _ -> false +let negative_term term = + match term with + | TNot(c) -> c + | TCall _ | TReturn _ | TRel _ -> TNot term + | TTrue -> TFalse + | TFalse -> TTrue + | TAnd (_,_) | TOr (_,_) -> Aorai_option.fatal "not a term of DNF clause" + +(** Simplify redundant relations. *) +let simplify clause = + try + List.rev + (List.fold_left + (fun clause term -> + match term with + | TTrue | TNot(TFalse) -> clause + | TFalse | TNot(TTrue) -> raise Exit + | _ -> + if List.exists (termsAreEqual (negative_term term)) clause + then raise Exit; + if List.exists (termsAreEqual term) clause then clause + else term :: clause) + [] clause) + with Exit -> [TFalse] + (** true iff clause1 <: clause2*) let clausesAreSubSetEq clause1 clause2 = (List.for_all @@ -295,37 +276,28 @@ let removeClause lclauses cl = List.filter (fun c -> not (clausesAreSubSetEq cl c)) lclauses (* Obvious version. *) -let negativeClause clause = - List.map - (fun term -> - match term with - | TNot(c) -> c - | TCall _ | TReturn _ | TRel _ -> TNot term - | TTrue -> TFalse - | TFalse -> TTrue - | TAnd (_,_) - | TOr (_,_) -> Aorai_option.fatal "not a DNF clause" - ) clause +let negativeClause clause = List.map negative_term clause let simplifyClauses clauses = try - List.fold_left - (fun acc c -> - (* If 2 clauses are C and not C then their disjunction implies true *) + List.rev + (List.fold_left + (fun acc c -> + (* If 2 clauses are C and not C then their disjunction implies true *) if List.exists (clausesAreEqual (negativeClause c)) acc then raise Exit - (* If an observed clause c2 is included inside the current clause + (* If an observed clause c2 is included inside the current clause then the current is not added *) - else if (List.exists (fun c2 -> clausesAreSubSetEq c2 c) acc) then - acc - (* If the current clause is included inside an observed clause - c2 then the current is add and c2 is removed *) - else if (List.exists (fun c2 -> clausesAreSubSetEq c c2) acc) then - c::(removeClause acc c) - (* If no simplification then c is add to the list *) - else c::acc + else if (List.exists (fun c2 -> clausesAreSubSetEq c2 c) acc) then + acc + (* If the current clause is included inside an observed clause + c2 then the current is added and c2 is removed *) + else if (List.exists (fun c2 -> clausesAreSubSetEq c c2) acc) then + c::(removeClause acc c) + (* If no simplification then c is add to the list *) + else c::acc ) - [] clauses + [] clauses) with Exit -> [[]] let tor t1 t2 = @@ -340,24 +312,43 @@ let tand t1 t2 = | TFalse,_ | _,TFalse -> TFalse | _,_ -> TAnd(t1,t2) -let tnot t = +let has_result t = + let module M = struct exception Has_result end in + let vis = object + inherit Visitor.frama_c_inplace + method! vterm_lhost = function + | TResult _ -> raise M.Has_result + | _ -> Cil.DoChildren + end + in + try ignore (Visitor.visitFramacTerm vis t); false + with M.Has_result -> true + +let rec tnot t = match t with - TTrue -> TFalse + | TTrue -> TFalse | TFalse -> TTrue | TNot t -> t + (* If relation uses \result, keep information about which function + is returning close to it. *) + | TAnd ((TReturn _ as t1), (TRel (_,op1,op2) as t2)) + when has_result op1 || has_result op2 -> + TOr (tnot t1, TAnd (t1, tnot t2)) + | TAnd (t1,t2) -> TOr(tnot t1, tnot t2) + | TOr (t1,t2) -> TAnd(tnot t1, tnot t2) | TRel(rel,t1,t2) -> TRel(opposite_rel rel, t1, t2) - | _ -> TNot t + | TCall _ | TReturn _ -> TNot t -let tands l = List.fold_left tand TTrue l +let tands l = List.fold_right tand l TTrue -let tors l = List.fold_left tor TFalse l +let tors l = List.fold_right tor l TFalse (** Given a DNF condition, it returns a condition in Promelaast.condition form. WARNING : empty lists not supported *) let dnfToCond d = tors (List.map tands d) -let simplClause dnf clause = +let simplClause clause dnf = match clause with | [] | [TTrue] | [TNot TFalse]-> [[]] | [TFalse] | [TNot TTrue] -> dnf @@ -375,15 +366,18 @@ let simplifyCond condition = Aorai_option.debug "initial dnf: %a" pretty_dnf res1; (* Step 2 : Positive Call/Ret are used to simplify negative ones *) let res = - List.fold_left - (fun lclauses clause -> simplClause lclauses (positiveCallOrRet clause)) - [] res1 + List.rev + (List.fold_left + (fun lclauses clause -> + simplClause (positiveCallOrRet clause) lclauses) + [] res1) in Aorai_option.debug "after step 2: %a" pretty_dnf res; (* Step 3 : simplification between exprs inside a clause *) - let res = - List.fold_left - (fun lclauses clause -> simplClause lclauses (simplify clause)) [] res + let res = + List.rev + (List.fold_left + (fun lclauses clause -> simplClause (simplify clause) lclauses) [] res) in Aorai_option.debug "after step 3: %a" pretty_dnf res; diff --git a/src/plugins/aorai/logic_simplification.mli b/src/plugins/aorai/logic_simplification.mli index c626a2fbed76a1a621c6aea8d81f9a931ddcde8d..1e00db4c95c6ecb364b63ddb77994014ec88e2a5 100644 --- a/src/plugins/aorai/logic_simplification.mli +++ b/src/plugins/aorai/logic_simplification.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/ltl_output.ml b/src/plugins/aorai/ltl_output.ml index 6bf4cb0f231b2fd59d90583325498b99e26b8038..adb7882101ffa707cc6ab116d8b7117e14347c9e 100644 --- a/src/plugins/aorai/ltl_output.ml +++ b/src/plugins/aorai/ltl_output.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/ltl_output.mli b/src/plugins/aorai/ltl_output.mli index 338cad3065d22328708ad84603f8025fe8419dab..2fbefc47636de9d8fe483444e8511312513b58bb 100644 --- a/src/plugins/aorai/ltl_output.mli +++ b/src/plugins/aorai/ltl_output.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/ltlast.mli b/src/plugins/aorai/ltlast.mli index 002cbd060d9504b080c9a7391f61280ed49d0bfb..526acfb44ea2493ce44444011ea0aad8c26e97fe 100644 --- a/src/plugins/aorai/ltlast.mli +++ b/src/plugins/aorai/ltlast.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/ltllexer.mll b/src/plugins/aorai/ltllexer.mll index 499489aad543c495cdb73fb78442a4ef2f0ccd53..de21b4349d7b9323cdfba5133bdded1e4b5dc261 100644 --- a/src/plugins/aorai/ltllexer.mll +++ b/src/plugins/aorai/ltllexer.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/ltlparser.mly b/src/plugins/aorai/ltlparser.mly index db19c5963cafc3056ee9f71313eb1d72a48428fc..0234ed2e6648fb63312125016a985e36ba8425e2 100644 --- a/src/plugins/aorai/ltlparser.mly +++ b/src/plugins/aorai/ltlparser.mly @@ -2,7 +2,7 @@ /* */ /* This file is part of Aorai plug-in of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* INRIA (Institut National de Recherche en Informatique et en */ diff --git a/src/plugins/aorai/path_analysis.ml b/src/plugins/aorai/path_analysis.ml index 7c1dbfcc3b0f4dd8b08dc3f68e16c0f88d761ff1..c9362e17fa3a55a347c94ace4bcbf8666a8ee762 100644 --- a/src/plugins/aorai/path_analysis.ml +++ b/src/plugins/aorai/path_analysis.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/promelaast.mli b/src/plugins/aorai/promelaast.mli index 1dd65e46c0af4a2be62415601559b5395c99961e..5c7aed61e466e1557d43e19a657e3dbd4366e72b 100644 --- a/src/plugins/aorai/promelaast.mli +++ b/src/plugins/aorai/promelaast.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/promelalexer.mll b/src/plugins/aorai/promelalexer.mll index 68b97db0d6392b48413729df326aa4bb60a55290..3b94fb7f6978c98f80f5eb4b4589beead5aa8815 100644 --- a/src/plugins/aorai/promelalexer.mll +++ b/src/plugins/aorai/promelalexer.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/promelalexer_withexps.mll b/src/plugins/aorai/promelalexer_withexps.mll index ce3a7c9e9311ef6926e10acd714edec86fdc520d..6c11ec53c6f60850203a78defe386981e303f8ad 100644 --- a/src/plugins/aorai/promelalexer_withexps.mll +++ b/src/plugins/aorai/promelalexer_withexps.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/promelaoutput.ml b/src/plugins/aorai/promelaoutput.ml index 71212db8b9653307b5e8be1979fbd365a3e3f30c..e48c4feebed34e7e960a2562519c1c0321d1e3ee 100644 --- a/src/plugins/aorai/promelaoutput.ml +++ b/src/plugins/aorai/promelaoutput.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/promelaoutput.mli b/src/plugins/aorai/promelaoutput.mli index ad4eb8c9ceff8a18a6ee7ac7e7e28f0defd3c2a9..20f851516c154ee14dbd1be67f0185fa00b439eb 100644 --- a/src/plugins/aorai/promelaoutput.mli +++ b/src/plugins/aorai/promelaoutput.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/promelaparser.mly b/src/plugins/aorai/promelaparser.mly index 83608e2974b43d8722655b9a4869bf29147c83a8..e2df039912c3fbffec64923464c80878a206ac63 100644 --- a/src/plugins/aorai/promelaparser.mly +++ b/src/plugins/aorai/promelaparser.mly @@ -2,7 +2,7 @@ /* */ /* This file is part of Aorai plug-in of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* INRIA (Institut National de Recherche en Informatique et en */ diff --git a/src/plugins/aorai/promelaparser_withexps.mly b/src/plugins/aorai/promelaparser_withexps.mly index ecaeb3788c4b3a54e55391d0d0d3ba81516d687a..0111e48cee0148e30e88c0fb8ccf2712d1a6eeca 100644 --- a/src/plugins/aorai/promelaparser_withexps.mly +++ b/src/plugins/aorai/promelaparser_withexps.mly @@ -2,7 +2,7 @@ /* */ /* This file is part of Aorai plug-in of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* INRIA (Institut National de Recherche en Informatique et en */ diff --git a/src/plugins/aorai/tests/aorai/Aorai_test.ml b/src/plugins/aorai/tests/aorai/Aorai_test.ml index 5c6fc77a9ec1985e20baf9b3b783168eeda1f844..8de40da5d3119812fc61f7e00b0413fb6b56b02f 100644 --- a/src/plugins/aorai/tests/aorai/Aorai_test.ml +++ b/src/plugins/aorai/tests/aorai/Aorai_test.ml @@ -37,32 +37,8 @@ module ProveAuxSpec = of auxiliary automata functions match" end) -let tmpfile = ref (Filename.temp_file "aorai_test" ".i") - -let tmpfile_set = ref false - let ok = ref false -let () = - Extlib.safe_at_exit (fun () -> - if Debug.get () >= 1 || not !ok then - result "Keeping temp file %s" !tmpfile - else - try Sys.remove !tmpfile with Sys_error _ -> ()) - -let set_tmpfile _ l = - if not !tmpfile_set then - begin - let name = List.hd l in - let name = Filename.basename name in - let name = Filename.chop_extension name in - tmpfile := (Filename.get_temp_dir_name()) ^ "/aorai_" ^ name ^ - (string_of_int (TestNumber.get())) ^ ".i"; - tmpfile_set := true - end - -let () = Kernel.Files.add_set_hook set_tmpfile - let is_suffix suf str = let lsuf = StdString.length suf in let lstr = StdString.length str in @@ -89,7 +65,20 @@ let extend () = wp_compute_kf (Some kf) [] [] in run f; - let chan = open_out !tmpfile in + let tmpfile = + Filename.get_temp_dir_name () ^ "/aorai_" ^ + (Filename.chop_extension + (Filename.basename (List.hd (Kernel.Files.get())))) ^ "_" ^ + (string_of_int (TestNumber.get ())) ^ ".i" + in + let () = + Extlib.safe_at_exit + (fun () -> + if Debug.get () >= 1 || not !ok then + result "Keeping temp file %s" tmpfile + else Extlib.safe_remove tmpfile) + in + let chan = open_out tmpfile in let fmt = Format.formatter_of_out_channel chan in File.pretty_ast ~prj:(Project.from_unique_name "aorai") ~fmt (); close_out chan; @@ -98,7 +87,7 @@ let extend () = in Project.copy ~selection my_project; Project.set_current my_project; - Files.append_after [ !tmpfile ]; + Files.append_after [ tmpfile ]; Constfold.off (); Ast.compute(); if ProveAuxSpec.get () then begin diff --git a/src/plugins/aorai/tests/aorai/declared_function.i b/src/plugins/aorai/tests/aorai/declared_function.i new file mode 100644 index 0000000000000000000000000000000000000000..f342110e6315590733693661b2893d6f0afc14f4 --- /dev/null +++ b/src/plugins/aorai/tests/aorai/declared_function.i @@ -0,0 +1,9 @@ +/* run.config* +OPT: -aorai-automata @PTEST_DIR@/@PTEST_NAME@.ya -aorai-test 1 -load-module tests/aorai/Aorai_test.cmxs -aorai-test-number @PTEST_NUMBER@ @PROVE_OPTIONS@ +*/ + +int f(); + +void main(void) { + f(); +} diff --git a/src/plugins/aorai/tests/aorai/declared_function.ya b/src/plugins/aorai/tests/aorai/declared_function.ya new file mode 100644 index 0000000000000000000000000000000000000000..0965d8c1f9d786ade08e564441373e3229092197 --- /dev/null +++ b/src/plugins/aorai/tests/aorai/declared_function.ya @@ -0,0 +1,7 @@ +%init : I; +%deterministic; + +I : { f().return == 0} -> I + | { f().return == 1 + 2 } -> I + | other -> I + ; diff --git a/src/plugins/aorai/tests/aorai/oracle/assigns.0.res.oracle b/src/plugins/aorai/tests/aorai/oracle/assigns.0.res.oracle index 4dd2faefdd78d9d1f31652d14bfa771457366f8b..d4dfd5db8dd4c6ebbea9033d37489c1118508643 100644 --- a/src/plugins/aorai/tests/aorai/oracle/assigns.0.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/assigns.0.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/assigns.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_assigns0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_assigns_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 1, diff --git a/src/plugins/aorai/tests/aorai/oracle/assigns.1.res.oracle b/src/plugins/aorai/tests/aorai/oracle/assigns.1.res.oracle index 72e238500aa869d7a223d00515a2868b04418fbd..b52a02ae3106afe0e4d7e496dc7f81726e40bb3b 100644 --- a/src/plugins/aorai/tests/aorai/oracle/assigns.1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/assigns.1.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/assigns.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_assigns1.i (no preprocessing) +[kernel] Parsing /tmp/aorai_assigns_1.i (no preprocessing) /* Generated by Frama-C */ enum aorai_States { aorai_reject_state = -2, diff --git a/src/plugins/aorai/tests/aorai/oracle/assigns.2.res.oracle b/src/plugins/aorai/tests/aorai/oracle/assigns.2.res.oracle index 57644ea9bbaf8a5085439f56514b9099b03b883d..a03928c6cad0adaaa70de524ae1c846eca1db1bd 100644 --- a/src/plugins/aorai/tests/aorai/oracle/assigns.2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/assigns.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/assigns.c (with preprocessing) [aorai] Welcome to the Aorai plugin /* Generated by Frama-C */ diff --git a/src/plugins/aorai/tests/aorai/oracle/bts1289.0.res.oracle b/src/plugins/aorai/tests/aorai/oracle/bts1289.0.res.oracle index 0d1c345127a504a3104e90880897222aa63ba925..8d3a3579fc8b8bd4b39606f04ccc138c0595f173 100644 --- a/src/plugins/aorai/tests/aorai/oracle/bts1289.0.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/bts1289.0.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/bts1289.i (no preprocessing) [aorai] Welcome to the Aorai plugin [aorai] warning: Call to main does not follow automaton's specification. This path is assumed to be dead [aorai] warning: No state of the automaton is reachable. Program and specification are incompatible, instrumentation will not be generated. -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_bts12890.i (no preprocessing) +[kernel] Parsing /tmp/aorai_bts1289_0.i (no preprocessing) /* Generated by Frama-C */ void a(void) { @@ -13,14 +11,12 @@ void a(void) void main(void) { - int i; - i = 0; + int i = 0; /*@ loop assigns i; */ while (i < 10) { a(); i ++; } - while_0_break: ; return; } diff --git a/src/plugins/aorai/tests/aorai/oracle/bts1289.1.res.oracle b/src/plugins/aorai/tests/aorai/oracle/bts1289.1.res.oracle index 0ad22622aa1c9addf157d1dddf1e13f8ce9dce34..c9699d26a614ecc8c606734d4a103b7e45029c70 100644 --- a/src/plugins/aorai/tests/aorai/oracle/bts1289.1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/bts1289.1.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/bts1289.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_bts12891.i (no preprocessing) +[kernel] Parsing /tmp/aorai_bts1289_1.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_a = 1, @@ -295,32 +293,29 @@ void main_post_func(void) */ void main(void) { - int aorai_Loop_Init_16; - int i; + int aorai_Loop_Init_4; main_pre_func(); - i = 0; - /*@ ghost aorai_Loop_Init_16 = 1; */ - aorai_loop_16: - /*@ loop invariant Aorai: 1 ≡ S ∨ 0 ≡ S; - loop invariant Aorai: 1 ≡ T ∨ 0 ≡ T; - loop invariant Aorai: 0 ≡ aorai_intermediate_state; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_0; - loop invariant Aorai: 0 ≡ init; - loop invariant Aorai: 1 ≡ S ∨ 1 ≡ T; - loop invariant - Aorai: aorai_Loop_Init_16 ≢ 0 ⇒ \at(1 ≡ init,Pre) ⇒ 0 ≡ T; - loop assigns i, aorai_Loop_Init_16, aorai_CurOpStatus, - aorai_CurOperation, S, T, aorai_intermediate_state, - aorai_intermediate_state_0, init; - loop assigns aorai_Loop_Init_16 \from \nothing; - */ - while (1) { - if (! (i < 10)) goto while_0_break; - /*@ ghost aorai_Loop_Init_16 = 0; */ - a(); - i ++; - } - while_0_break: ; + int i = 0; + /*@ ghost aorai_Loop_Init_4 = 1; */ + aorai_loop_4: + /*@ loop invariant Aorai: 1 ≡ S ∨ 0 ≡ S; + loop invariant Aorai: 1 ≡ T ∨ 0 ≡ T; + loop invariant Aorai: 0 ≡ aorai_intermediate_state; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_0; + loop invariant Aorai: 0 ≡ init; + loop invariant Aorai: 1 ≡ S ∨ 1 ≡ T; + loop invariant + Aorai: aorai_Loop_Init_4 ≢ 0 ⇒ \at(1 ≡ init,Pre) ⇒ 0 ≡ T; + loop assigns i, aorai_Loop_Init_4, aorai_CurOpStatus, + aorai_CurOperation, S, T, aorai_intermediate_state, + aorai_intermediate_state_0, init; + loop assigns aorai_Loop_Init_4 \from \nothing; + */ + while (i < 10) { + /*@ ghost aorai_Loop_Init_4 = 0; */ + a(); + i ++; + } main_post_func(); return; } diff --git a/src/plugins/wp/tests/wp/oracle/wp_inv_in_loop.err.oracle b/src/plugins/aorai/tests/aorai/oracle/declared_function.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp/oracle/wp_inv_in_loop.err.oracle rename to src/plugins/aorai/tests/aorai/oracle/declared_function.err.oracle diff --git a/src/plugins/aorai/tests/aorai/oracle/declared_function.res.oracle b/src/plugins/aorai/tests/aorai/oracle/declared_function.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..b2d483bb028ee7e16728487903c8c61105e9ed7a --- /dev/null +++ b/src/plugins/aorai/tests/aorai/oracle/declared_function.res.oracle @@ -0,0 +1,108 @@ +[kernel] Parsing tests/aorai/declared_function.i (no preprocessing) +[aorai] Welcome to the Aorai plugin +[kernel] Parsing /tmp/aorai_declared_function_0.i (no preprocessing) +/* Generated by Frama-C */ +enum aorai_States { + aorai_reject_state = -2, + I = 0 +}; +enum aorai_ListOper { + op_f = 1, + op_main = 0 +}; +enum aorai_OpStatusList { + aorai_Terminated = 1, + aorai_Called = 0 +}; +int f(); + +/*@ ghost enum aorai_ListOper aorai_CurOperation = op_main; */ +/*@ ghost enum aorai_OpStatusList aorai_CurOpStatus = aorai_Called; */ +/*@ +lemma I_deterministic_trans{L}: + (∀ int __retres_f; + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + __retres_f ≡ 0 ∧ + (¬(\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated) ∨ + (\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + __retres_f ≢ 1 + 2 ∧ __retres_f ≢ 0)))) ∧ + (∀ int __retres_f; + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + __retres_f ≡ 1 + 2 ∧ + (¬(\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated) ∨ + (\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + __retres_f ≢ 1 + 2 ∧ __retres_f ≢ 0)))) ∧ + (∀ int __retres_f; + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + __retres_f ≡ 1 + 2 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ __retres_f ≡ 0)); + */ +/*@ ghost int aorai_CurStates = I; */ +/*@ ensures aorai_CurOpStatus ≡ aorai_Called; + ensures aorai_CurOperation ≡ op_main; + assigns aorai_CurOpStatus, aorai_CurOperation, aorai_CurStates; + + behavior buch_state_I_in: + assumes aorai_CurStates ≡ I; + ensures aorai_CurStates ≡ I; + + behavior buch_state_I_out: + assumes aorai_CurStates ≢ I; + ensures aorai_CurStates ≢ I; + */ +void main_pre_func(void) +{ + /*@ ghost int aorai_CurStates_tmp; */ + aorai_CurOpStatus = aorai_Called; + aorai_CurOperation = op_main; + aorai_CurStates_tmp = aorai_CurStates; + if (0 == aorai_CurStates) aorai_CurStates_tmp = I; + aorai_CurStates = aorai_CurStates_tmp; + return; +} + +/*@ requires aorai_CurStates ≡ I; + ensures aorai_CurOpStatus ≡ aorai_Terminated; + ensures aorai_CurOperation ≡ op_main; + assigns aorai_CurOpStatus, aorai_CurOperation, aorai_CurStates; + + behavior buch_state_I_in: + assumes aorai_CurStates ≡ I; + ensures aorai_CurStates ≡ I; + + behavior buch_state_I_out: + assumes aorai_CurStates ≢ I; + ensures aorai_CurStates ≢ I; + */ +void main_post_func(void) +{ + /*@ ghost int aorai_CurStates_tmp; */ + aorai_CurOpStatus = aorai_Terminated; + aorai_CurOperation = op_main; + aorai_CurStates_tmp = aorai_CurStates; + if (0 == aorai_CurStates) aorai_CurStates_tmp = I; + aorai_CurStates = aorai_CurStates_tmp; + return; +} + +/*@ requires aorai_CurStates ≡ I; + + behavior Buchi_property_behavior: + ensures aorai_CurStates ≡ I; + */ +void main(void) +{ + main_pre_func(); + f(); + main_post_func(); + return; +} + + diff --git a/src/plugins/aorai/tests/aorai/oracle/deterministic.res.oracle b/src/plugins/aorai/tests/aorai/oracle/deterministic.res.oracle index 99507b3b7bfabb88a01ec0346209b6402b6d237b..5cf565f5e56aac1d286c5e2c0656161ad4a132a4 100644 --- a/src/plugins/aorai/tests/aorai/oracle/deterministic.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/deterministic.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/deterministic.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_deterministic0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_deterministic_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_States { aorai_reject_state = -2, @@ -50,9 +48,9 @@ lemma S3_deterministic_trans{L}: /*@ lemma S1_deterministic_trans{L}: ∀ int __retres_f, int x; - ¬(\at(X,L) ≡ 5 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ __retres_f ≡ 0 ∧ - \at(aorai_CurOperation,L) ≡ op_f ∧ + \at(X,L) ≡ 5 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Called ∧ x ≡ 4); */ /*@ @@ -168,7 +166,7 @@ void g_post_func(void) } /*@ requires aorai_CurStates ≡ S3; - requires aorai_CurStates ≡ S3 ⇒ x ≡ 4 ∨ x ≡ 5; + requires aorai_CurStates ≡ S3 ⇒ x ≡ 5 ∨ x ≡ 4; behavior Buchi_behavior_in_1: assumes aorai_CurStates ≡ S3 ∧ x ≡ 5; @@ -244,11 +242,11 @@ void f_pre_func(int x) ensures aorai_CurStates ≢ S1; behavior buch_state_S2_in: - assumes aorai_CurStates ≡ S1 ∧ X ≡ 5 ∧ res ≡ 0; + assumes aorai_CurStates ≡ S1 ∧ res ≡ 0 ∧ X ≡ 5; ensures aorai_CurStates ≡ S2; behavior buch_state_S2_out: - assumes aorai_CurStates ≢ S1 ∨ ¬(X ≡ 5 ∧ res ≡ 0); + assumes aorai_CurStates ≢ S1 ∨ ¬(res ≡ 0 ∧ X ≡ 5); ensures aorai_CurStates ≢ S2; behavior buch_state_S3_out: @@ -273,8 +271,8 @@ void f_post_func(int res) aorai_CurOperation = op_f; aorai_CurStates_tmp = aorai_CurStates; if (1 == aorai_CurStates) - if (X == 5) - if (res == 0) aorai_CurStates_tmp = S2; + if (res == 0) + if (X == 5) aorai_CurStates_tmp = S2; aorai_CurStates = aorai_CurStates_tmp; return; } @@ -397,7 +395,7 @@ void real_main_post_func(int res) } /*@ requires aorai_CurStates ≡ S0; - requires aorai_CurStates ≡ S0 ⇒ c ≢ 0 ∨ c ≡ 0; + requires aorai_CurStates ≡ S0 ⇒ c ≡ 0 ∨ c ≢ 0; behavior Buchi_property_behavior: ensures aorai_CurStates ≡ Sf; diff --git a/src/plugins/aorai/tests/aorai/oracle/formals.res.oracle b/src/plugins/aorai/tests/aorai/oracle/formals.res.oracle index 7f554ae9916b516480ca4cee596e7214042cab35..2aa1667c2d9f80f1459a3841b4d9206007a7c2a3 100644 --- a/src/plugins/aorai/tests/aorai/oracle/formals.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/formals.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/formals.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_formals0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_formals_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_States { aorai_reject_state = -2, @@ -35,10 +33,10 @@ enum aorai_OpStatusList { /*@ lemma main_0_deterministic_trans{L}: ∀ int x; - ¬(x ≡ 3 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ - \at(aorai_CurOpStatus,L) ≡ aorai_Called ∧ x ≡ 1 ∧ + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ + \at(aorai_CurOpStatus,L) ≡ aorai_Called ∧ x ≡ 3 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ - \at(aorai_CurOpStatus,L) ≡ aorai_Called); + \at(aorai_CurOpStatus,L) ≡ aorai_Called ∧ x ≡ 1); */ /*@ lemma aorai_intermediate_state_0_deterministic_trans{L}: @@ -51,8 +49,9 @@ lemma aorai_intermediate_state_0_deterministic_trans{L}: /*@ ghost int aorai_x_0 = 0; */ /*@ lemma aorai_intermediate_state_2_deterministic_trans{L}: - ¬(\at(aorai_x_0,L) ≡ 3 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + \at(aorai_x_0,L) ≡ 3 ∧ (¬(\at(aorai_CurOperation,L) ≡ op_f ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated) ∨ \at(aorai_x_0,L) ≢ 3)); @@ -60,8 +59,9 @@ lemma aorai_intermediate_state_2_deterministic_trans{L}: /*@ ghost int aorai_y = 0; */ /*@ lemma aorai_intermediate_state_1_deterministic_trans{L}: - ¬(\at(aorai_y,L) ≡ 2 ∧ \at(aorai_CurOperation,L) ≡ op_g ∧ + ¬(\at(aorai_CurOperation,L) ≡ op_g ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + \at(aorai_y,L) ≡ 2 ∧ (¬(\at(aorai_CurOperation,L) ≡ op_g ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated) ∨ \at(aorai_y,L) ≢ 2)); @@ -69,8 +69,9 @@ lemma aorai_intermediate_state_1_deterministic_trans{L}: /*@ ghost int aorai_x = 0; */ /*@ lemma aorai_intermediate_state_deterministic_trans{L}: - ¬(\at(aorai_x,L) ≡ 1 ∧ \at(aorai_CurOperation,L) ≡ op_f ∧ + ¬(\at(aorai_CurOperation,L) ≡ op_f ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated ∧ + \at(aorai_x,L) ≡ 1 ∧ (¬(\at(aorai_CurOperation,L) ≡ op_f ∧ \at(aorai_CurOpStatus,L) ≡ aorai_Terminated) ∨ \at(aorai_x,L) ≢ 1)); @@ -143,10 +144,10 @@ void f_pre_func(int x) aorai_CurStates ≡ aorai_intermediate_state_2; requires aorai_CurStates ≡ aorai_intermediate_state ⇒ - aorai_x ≡ 1 ∨ aorai_x ≢ 1; + aorai_x ≢ 1 ∨ aorai_x ≡ 1; requires aorai_CurStates ≡ aorai_intermediate_state_2 ⇒ - aorai_x_0 ≡ 3 ∨ aorai_x_0 ≢ 3; + aorai_x_0 ≢ 3 ∨ aorai_x_0 ≡ 3; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_f; assigns aorai_CurOpStatus, aorai_CurOperation, aorai_CurStates; @@ -222,7 +223,7 @@ void f_post_func(int res) } /*@ requires aorai_CurStates ≡ main_0; - requires aorai_CurStates ≡ main_0 ⇒ x ≡ 1 ∨ x ≡ 3; + requires aorai_CurStates ≡ main_0 ⇒ x ≡ 3 ∨ x ≡ 1; ensures aorai_CurStates ≡ aorai_intermediate_state_0 ∨ aorai_CurStates ≡ OK; @@ -241,7 +242,7 @@ void f_post_func(int res) (aorai_CurStates ≡ OK ⇒ aorai_x_0 ≡ 3) ∧ (aorai_CurStates ≡ aorai_intermediate_state_0 ⇒ aorai_x ≡ 1) ∧ (aorai_CurStates ≡ aorai_reject ⇒ - aorai_x ≢ 1 ∨ aorai_x_0 ≢ 3); + aorai_x_0 ≢ 3 ∨ aorai_x ≢ 1); ensures aorai_CurStates ≡ OK ∨ aorai_CurStates ≡ aorai_reject; ensures \at(aorai_CurStates ≡ main_0,Pre) ∧ @@ -261,7 +262,7 @@ void f_post_func(int res) (aorai_CurStates ≡ OK ⇒ aorai_x_0 ≡ 3) ∧ (aorai_CurStates ≡ aorai_intermediate_state_0 ⇒ aorai_x ≡ 1) ∧ (aorai_CurStates ≡ aorai_reject ⇒ - aorai_x ≢ 1 ∨ aorai_x_0 ≢ 3); + aorai_x_0 ≢ 3 ∨ aorai_x ≢ 1); ensures aorai_CurStates ≡ aorai_intermediate_state_0 ∨ aorai_CurStates ≡ aorai_reject; @@ -351,7 +352,7 @@ void g_pre_func(int y) aorai_CurStates ≡ aorai_intermediate_state_1; requires aorai_CurStates ≡ aorai_intermediate_state_1 ⇒ - aorai_y ≡ 2 ∨ aorai_y ≢ 2; + aorai_y ≢ 2 ∨ aorai_y ≡ 2; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_g; assigns aorai_CurOpStatus, aorai_CurOperation, aorai_CurStates; diff --git a/src/plugins/aorai/tests/aorai/oracle/generate_assigns_bts1290.res.oracle b/src/plugins/aorai/tests/aorai/oracle/generate_assigns_bts1290.res.oracle index af69b876003b94ecd6c599a0e1af71f17501ca30..d0d19c2132d071d68dad1c4f0f1b53af2cab99ec 100644 --- a/src/plugins/aorai/tests/aorai/oracle/generate_assigns_bts1290.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/generate_assigns_bts1290.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/generate_assigns_bts1290.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_generate_assigns_bts12900.i (no preprocessing) +[kernel] Parsing /tmp/aorai_generate_assigns_bts1290_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 0 @@ -69,23 +67,20 @@ void main_post_func(void) */ void main(void) { - int aorai_Loop_Init_11; - int i; + int aorai_Loop_Init_2; main_pre_func(); - i = 0; - /*@ ghost aorai_Loop_Init_11 = 1; */ - aorai_loop_11: - /*@ loop invariant Aorai: 1 ≡ S; - loop assigns i, aorai_Loop_Init_11, aorai_CurOpStatus, - aorai_CurOperation, S; - loop assigns aorai_Loop_Init_11 \from \nothing; - */ - while (1) { - if (! (i < 10)) goto while_0_break; - /*@ ghost aorai_Loop_Init_11 = 0; */ - i ++; - } - while_0_break: ; + int i = 0; + /*@ ghost aorai_Loop_Init_2 = 1; */ + aorai_loop_2: + /*@ loop invariant Aorai: 1 ≡ S; + loop assigns i, aorai_Loop_Init_2, aorai_CurOpStatus, + aorai_CurOperation, S; + loop assigns aorai_Loop_Init_2 \from \nothing; + */ + while (i < 10) { + /*@ ghost aorai_Loop_Init_2 = 0; */ + i ++; + } main_post_func(); return; } diff --git a/src/plugins/aorai/tests/aorai/oracle/goto.res.oracle b/src/plugins/aorai/tests/aorai/oracle/goto.res.oracle index afe5437f362aaf891c466b72d33d7b13dd279741..ee5776a1de77677432de2a6459ec7b035f97c67a 100644 --- a/src/plugins/aorai/tests/aorai/oracle/goto.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/goto.res.oracle @@ -1,9 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/goto.c (with preprocessing) [aorai] Welcome to the Aorai plugin tests/aorai/goto.c:28:[aorai] warning: Call to opc does not follow automaton's specification. This path is assumed to be dead -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_goto0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_goto_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 3, diff --git a/src/plugins/aorai/tests/aorai/oracle/hoare_seq.res.oracle b/src/plugins/aorai/tests/aorai/oracle/hoare_seq.res.oracle index 4d645773fd7734f8a7ff24fe4e3d7e65961bd520..c4de6d08ef21404b9a739cc1e376b7cce1bb661c 100644 --- a/src/plugins/aorai/tests/aorai/oracle/hoare_seq.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/hoare_seq.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/hoare_seq.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_hoare_seq0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_hoare_seq_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 1, @@ -303,7 +301,7 @@ void main_pre_func(int c) (1 ≡ aorai_intermediate_state ∨ 1 ≡ aorai_intermediate_state_0 ∨ 1 ≡ aorai_intermediate_state_2) ∧ 0 ≡ S0 ∧ 0 ≡ Sf ∧ 0 ≡ aorai_intermediate_state_1; - requires 1 ≡ aorai_intermediate_state_2 ⇒ res ≡ 0 ∨ res ≢ 0; + requires 1 ≡ aorai_intermediate_state_2 ⇒ res ≢ 0 ∨ res ≡ 0; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_main; assigns aorai_CurOpStatus, aorai_CurOperation, S0, Sf, @@ -404,7 +402,7 @@ void main_post_func(int res) 0 ≡ aorai_intermediate_state_0 ∧ 0 ≡ aorai_intermediate_state_1 ∧ 0 ≡ aorai_intermediate_state_2 ∧ 0 ≡ aorai_reject; - requires 1 ≡ S0 ⇒ c > 0 ∨ c ≤ 0; + requires 1 ≡ S0 ⇒ c ≤ 0 ∨ c > 0; ensures 1 ≡ Sf; behavior bhv: diff --git a/src/plugins/aorai/tests/aorai/oracle/incorrect.res.oracle b/src/plugins/aorai/tests/aorai/oracle/incorrect.res.oracle index 91f4502a0a28e0433e706843bed9bd7116251282..dec3d20d7dd68ce61831cc9537b0036b18d3a2cf 100644 --- a/src/plugins/aorai/tests/aorai/oracle/incorrect.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/incorrect.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/incorrect.i (no preprocessing) [aorai] Welcome to the Aorai plugin [aorai] warning: Call to main does not follow automaton's specification. This path is assumed to be dead [aorai] warning: No state of the automaton is reachable. Program and specification are incompatible, instrumentation will not be generated. -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_incorrect0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_incorrect_0.i (no preprocessing) /* Generated by Frama-C */ int f(); diff --git a/src/plugins/aorai/tests/aorai/oracle/loop_bts1050.res.oracle b/src/plugins/aorai/tests/aorai/oracle/loop_bts1050.res.oracle index 86bc6d993c85826e911fa3a1b51a5d7fbc923a2b..6c2ded3fb12e815c4a12db213eb99fba710f34df 100644 --- a/src/plugins/aorai/tests/aorai/oracle/loop_bts1050.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/loop_bts1050.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/loop_bts1050.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_loop_bts10500.i (no preprocessing) +[kernel] Parsing /tmp/aorai_loop_bts1050_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 2, @@ -543,48 +541,45 @@ void main_post_func(int res) */ int main(int c) { - int aorai_Loop_Init_37; + int aorai_Loop_Init_13; int __retres; main_pre_func(c); if (c < 0) c = 0; if (c > 0) c = 5; - /*@ ghost aorai_Loop_Init_37 = 1; */ - aorai_loop_37: - /*@ loop invariant Aorai: 0 ≡ S0; - loop invariant Aorai: 0 ≡ Sf; - loop invariant - Aorai: - 1 ≡ aorai_intermediate_state ∨ 0 ≡ aorai_intermediate_state; - loop invariant - Aorai: - 1 ≡ aorai_intermediate_state_0 ∨ - 0 ≡ aorai_intermediate_state_0; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_1; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_2; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_3; - loop invariant - Aorai: - 1 ≡ aorai_intermediate_state ∨ - 1 ≡ aorai_intermediate_state_0; - loop invariant - Aorai: - aorai_Loop_Init_37 ≢ 0 ⇒ - \at(1 ≡ S0,Pre) ⇒ 0 ≡ aorai_intermediate_state_0; - loop invariant - Aorai: aorai_Loop_Init_37 ≡ 0 ⇒ 0 ≡ aorai_intermediate_state; - loop invariant - Aorai: - \at(1 ≡ aorai_intermediate_state,aorai_loop_37) ∧ - 1 ≡ aorai_intermediate_state_0 ⇒ 1 ≤ aorai_counter ≤ 5; - */ - while (1) { - if (! c) goto while_0_break; - /*@ ghost aorai_Loop_Init_37 = 0; */ - f(); - g(); - c --; - } - while_0_break: ; + /*@ ghost aorai_Loop_Init_13 = 1; */ + aorai_loop_13: + /*@ loop invariant Aorai: 0 ≡ S0; + loop invariant Aorai: 0 ≡ Sf; + loop invariant + Aorai: + 1 ≡ aorai_intermediate_state ∨ 0 ≡ aorai_intermediate_state; + loop invariant + Aorai: + 1 ≡ aorai_intermediate_state_0 ∨ + 0 ≡ aorai_intermediate_state_0; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_1; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_2; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_3; + loop invariant + Aorai: + 1 ≡ aorai_intermediate_state ∨ 1 ≡ aorai_intermediate_state_0; + loop invariant + Aorai: + aorai_Loop_Init_13 ≢ 0 ⇒ + \at(1 ≡ S0,Pre) ⇒ 0 ≡ aorai_intermediate_state_0; + loop invariant + Aorai: aorai_Loop_Init_13 ≡ 0 ⇒ 0 ≡ aorai_intermediate_state; + loop invariant + Aorai: + \at(1 ≡ aorai_intermediate_state,aorai_loop_13) ∧ + 1 ≡ aorai_intermediate_state_0 ⇒ 1 ≤ aorai_counter ≤ 5; + */ + while (c) { + /*@ ghost aorai_Loop_Init_13 = 0; */ + f(); + g(); + c --; + } __retres = 0; main_post_func(__retres); return __retres; diff --git a/src/plugins/aorai/tests/aorai/oracle/not_prm.res.oracle b/src/plugins/aorai/tests/aorai/oracle/not_prm.res.oracle index 4b1af1f728cf81e58dbc568e7ed0919ff227bb85..c936e1183e0c1e85b5412805bc751887b1b80c83 100644 --- a/src/plugins/aorai/tests/aorai/oracle/not_prm.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/not_prm.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/not_prm.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_not_prm0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_not_prm_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 0 diff --git a/src/plugins/aorai/tests/aorai/oracle/other.res.oracle b/src/plugins/aorai/tests/aorai/oracle/other.res.oracle index fd1badb5af746d73c6472e43f43217a15e1a22e7..705124879237fa436ae0719bc00a243fe0eeefb2 100644 --- a/src/plugins/aorai/tests/aorai/oracle/other.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/other.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/other.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_other0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_other_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 2, @@ -107,7 +105,7 @@ void f_pre_func(void) } /*@ requires 1 ≡ init ∨ 1 ≡ last ∨ 1 ≡ step1; - requires 1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 3; + requires 1 ≡ last ⇒ x ≡ 3 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_f; assigns aorai_CurOpStatus, aorai_CurOperation, init, last, step1; @@ -196,7 +194,7 @@ void f_post_func(void) } /*@ requires 1 ≡ init ∨ 1 ≡ last ∨ 1 ≡ step1; - requires 1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 3; + requires 1 ≡ last ⇒ x ≡ 3 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4; requires 1 ≡ step1 ∨ 0 ≡ step1; requires 1 ≡ last ∨ 0 ≡ last; requires 1 ≡ init ∨ 0 ≡ init; @@ -204,9 +202,9 @@ void f_post_func(void) behavior Buchi_behavior_in_0: assumes (1 ≡ last ∧ x ≡ 4) ∨ (1 ≡ init ∧ x ≢ 3); ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ init ∨ 0 ≡ init; ensures 1 ≡ step1 ∨ 0 ≡ step1; ensures 1 ≡ init ∨ 1 ≡ step1; @@ -215,9 +213,9 @@ void f_post_func(void) assumes (1 ≡ step1 ∧ x ≡ 4) ∨ (1 ≡ last ∧ x ≢ 4 ∧ x ≢ 3); ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ init ∨ 0 ≡ init; ensures 1 ≡ last ∨ 0 ≡ last; ensures 1 ≡ step1 ∨ 0 ≡ step1; @@ -228,9 +226,9 @@ void f_post_func(void) (1 ≡ step1 ∧ x ≢ 4) ∨ (1 ≡ last ∧ x ≡ 3) ∨ (1 ≡ init ∧ x ≡ 3); ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ last ∨ 0 ≡ last; ensures 1 ≡ step1 ∨ 0 ≡ step1; ensures 1 ≡ last ∨ 1 ≡ step1; @@ -347,7 +345,7 @@ void g_pre_func(void) } /*@ requires 1 ≡ init ∨ 1 ≡ last ∨ 1 ≡ step1; - requires 1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 3; + requires 1 ≡ last ⇒ x ≡ 3 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_g; assigns aorai_CurOpStatus, aorai_CurOperation, init, last, step1; @@ -436,7 +434,7 @@ void g_post_func(void) } /*@ requires 1 ≡ init ∨ 1 ≡ last ∨ 1 ≡ step1; - requires 1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 3; + requires 1 ≡ last ⇒ x ≡ 3 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4; requires 1 ≡ step1 ∨ 0 ≡ step1; requires 1 ≡ last ∨ 0 ≡ last; requires 1 ≡ init ∨ 0 ≡ init; @@ -444,9 +442,9 @@ void g_post_func(void) behavior Buchi_behavior_in_0: assumes (1 ≡ last ∧ x ≡ 4) ∨ (1 ≡ init ∧ x ≢ 3); ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ init ∨ 0 ≡ init; ensures 1 ≡ step1 ∨ 0 ≡ step1; ensures 1 ≡ init ∨ 1 ≡ step1; @@ -455,9 +453,9 @@ void g_post_func(void) assumes (1 ≡ step1 ∧ x ≡ 4) ∨ (1 ≡ last ∧ x ≢ 4 ∧ x ≢ 3); ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ init ∨ 0 ≡ init; ensures 1 ≡ last ∨ 0 ≡ last; ensures 1 ≡ step1 ∨ 0 ≡ step1; @@ -468,9 +466,9 @@ void g_post_func(void) (1 ≡ step1 ∧ x ≢ 4) ∨ (1 ≡ last ∧ x ≡ 3) ∨ (1 ≡ init ∧ x ≡ 3); ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ last ∨ 0 ≡ last; ensures 1 ≡ step1 ∨ 0 ≡ step1; ensures 1 ≡ last ∨ 1 ≡ step1; @@ -539,7 +537,7 @@ void main_pre_func(void) } /*@ requires 1 ≡ init ∨ 1 ≡ last ∨ 1 ≡ step1; - requires 1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 3; + requires 1 ≡ last ⇒ x ≡ 3 ∨ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_main; assigns aorai_CurOpStatus, aorai_CurOperation, init, last, step1; @@ -635,9 +633,9 @@ void main_post_func(int res) behavior Buchi_property_behavior: ensures - (1 ≡ init ⇒ x ≢ 3 ∨ x ≡ 4) ∧ - (1 ≡ last ⇒ (x ≢ 4 ∧ x ≢ 3) ∨ x ≡ 4) ∧ - (1 ≡ step1 ⇒ x ≡ 3 ∨ x ≢ 4); + (1 ≡ init ⇒ x ≡ 4 ∨ x ≢ 3) ∧ + (1 ≡ last ⇒ x ≡ 4 ∨ (x ≢ 4 ∧ x ≢ 3)) ∧ + (1 ≡ step1 ⇒ x ≢ 4 ∨ x ≡ 3); ensures 1 ≡ init ∨ 0 ≡ init; ensures 1 ≡ last ∨ 0 ≡ last; ensures 1 ≡ step1 ∨ 0 ≡ step1; diff --git a/src/plugins/aorai/tests/aorai/oracle/seq.res.oracle b/src/plugins/aorai/tests/aorai/oracle/seq.res.oracle index 6f25ee1cd9056420c701a513e162551f705ed302..0feb9f18cabb9294676350b02e034d635ecd5b76 100644 --- a/src/plugins/aorai/tests/aorai/oracle/seq.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/seq.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/seq.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_seq0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_seq_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 2, diff --git a/src/plugins/aorai/tests/aorai/oracle/seq_loop.res.oracle b/src/plugins/aorai/tests/aorai/oracle/seq_loop.res.oracle index 17fd928041419bd74189ab74761eea3c537282d2..d846ff2ed1de631698bceb91738be087d1911bb9 100644 --- a/src/plugins/aorai/tests/aorai/oracle/seq_loop.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/seq_loop.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/seq_loop.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_seq_loop0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_seq_loop_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_f = 2, @@ -547,55 +545,52 @@ void main_post_func(int res) */ int main(int c) { - int aorai_Loop_Init_39; + int aorai_Loop_Init_14; int __retres; main_pre_func(c); if (c < 0) c = 0; if (c > 5) c = 5; /*@ assert 0 ≤ c ≤ 5; */ ; - /*@ ghost aorai_Loop_Init_39 = 1; */ - aorai_loop_39: - /*@ loop invariant Aorai: 0 ≡ S0; - loop invariant Aorai: 0 ≡ Sf; - loop invariant - Aorai: - 1 ≡ aorai_intermediate_state ∨ 0 ≡ aorai_intermediate_state; - loop invariant - Aorai: - 1 ≡ aorai_intermediate_state_0 ∨ - 0 ≡ aorai_intermediate_state_0; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_1; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_2; - loop invariant Aorai: 0 ≡ aorai_intermediate_state_3; - loop invariant - Aorai: - 1 ≡ aorai_intermediate_state ∨ - 1 ≡ aorai_intermediate_state_0; - loop invariant - Aorai: - aorai_Loop_Init_39 ≢ 0 ⇒ - \at(1 ≡ S0,Pre) ⇒ 0 ≡ aorai_intermediate_state_0; - loop invariant - Aorai: aorai_Loop_Init_39 ≡ 0 ⇒ 0 ≡ aorai_intermediate_state; - loop invariant - Aorai: - \at(1 ≡ aorai_intermediate_state,aorai_loop_39) ∧ - 1 ≡ aorai_intermediate_state_0 ⇒ 1 ≤ aorai_counter ≤ 5; - loop assigns c, aorai_Loop_Init_39, aorai_CurOpStatus, - aorai_CurOperation, S0, Sf, aorai_intermediate_state, - aorai_intermediate_state_0, aorai_intermediate_state_1, - aorai_intermediate_state_2, aorai_intermediate_state_3, - aorai_counter; - loop assigns aorai_Loop_Init_39 \from \nothing; - */ - while (1) { - if (! c) goto while_0_break; - /*@ ghost aorai_Loop_Init_39 = 0; */ - f(); - g(); - c --; - } - while_0_break: ; + /*@ ghost aorai_Loop_Init_14 = 1; */ + aorai_loop_14: + /*@ loop invariant Aorai: 0 ≡ S0; + loop invariant Aorai: 0 ≡ Sf; + loop invariant + Aorai: + 1 ≡ aorai_intermediate_state ∨ 0 ≡ aorai_intermediate_state; + loop invariant + Aorai: + 1 ≡ aorai_intermediate_state_0 ∨ + 0 ≡ aorai_intermediate_state_0; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_1; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_2; + loop invariant Aorai: 0 ≡ aorai_intermediate_state_3; + loop invariant + Aorai: + 1 ≡ aorai_intermediate_state ∨ 1 ≡ aorai_intermediate_state_0; + loop invariant + Aorai: + aorai_Loop_Init_14 ≢ 0 ⇒ + \at(1 ≡ S0,Pre) ⇒ 0 ≡ aorai_intermediate_state_0; + loop invariant + Aorai: aorai_Loop_Init_14 ≡ 0 ⇒ 0 ≡ aorai_intermediate_state; + loop invariant + Aorai: + \at(1 ≡ aorai_intermediate_state,aorai_loop_14) ∧ + 1 ≡ aorai_intermediate_state_0 ⇒ 1 ≤ aorai_counter ≤ 5; + loop assigns c, aorai_Loop_Init_14, aorai_CurOpStatus, + aorai_CurOperation, S0, Sf, aorai_intermediate_state, + aorai_intermediate_state_0, aorai_intermediate_state_1, + aorai_intermediate_state_2, aorai_intermediate_state_3, + aorai_counter; + loop assigns aorai_Loop_Init_14 \from \nothing; + */ + while (c) { + /*@ ghost aorai_Loop_Init_14 = 0; */ + f(); + g(); + c --; + } __retres = 0; main_post_func(__retres); return __retres; diff --git a/src/plugins/aorai/tests/aorai/oracle/single_call.res.oracle b/src/plugins/aorai/tests/aorai/oracle/single_call.res.oracle index b7c083b6f7ca19b86315274cd2d18aa7e2253cd2..5f8d466d22424908feb54148ff330348025086b0 100644 --- a/src/plugins/aorai/tests/aorai/oracle/single_call.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/single_call.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/single_call.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_single_call0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_single_call_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 0 diff --git a/src/plugins/aorai/tests/aorai/oracle/test_acces_params.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_acces_params.res.oracle index 363211001f063d2f8b30f4b5bc9dda2152e31405..d703a2229a90e7ba6cce9b3d66bbb5b708c753d5 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_acces_params.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_acces_params.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_acces_params.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_acces_params0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_acces_params_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 2, diff --git a/src/plugins/aorai/tests/aorai/oracle/test_acces_params2.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_acces_params2.res.oracle index 0a269aa74b57373b5b36e901b251629bf24292b2..92799624f78e869afade5563e14186da7e789a43 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_acces_params2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_acces_params2.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_acces_params2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_acces_params20.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_acces_params2_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 3, diff --git a/src/plugins/aorai/tests/aorai/oracle/test_boucle.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_boucle.res.oracle index 50a02e5792dfaa9e8d1b524dd9aab2d84fc24b90..3e2861b66dd694704d37ffaffe6fc4c92769268d 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_boucle.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_boucle.res.oracle @@ -1,11 +1,10 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle.c (with preprocessing) tests/aorai/test_boucle.c:16:[kernel] warning: Calling undeclared function call_to_an_undefined_function. Old style K&R code? [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_boucle0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_boucle_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { + op_call_to_an_undefined_function = 3, op_a = 2, op_b = 1, op_main = 0 @@ -302,34 +301,30 @@ void main_post_func(int res) */ int main(void) { - int aorai_Loop_Init_26; - int x; + int aorai_Loop_Init_7; int tmp_1; main_pre_func(); - x = a(); - /*@ ghost aorai_Loop_Init_26 = 1; */ - aorai_loop_26: - /*@ loop invariant i: 0 ≤ x ≤ 11; - loop invariant Aorai: 1 ≡ T0_S2 ∨ 0 ≡ T0_S2; - loop invariant Aorai: 0 ≡ T0_init; - loop invariant Aorai: 1 ≡ accept_S1 ∨ 0 ≡ accept_S1; - loop invariant Aorai: 1 ≡ T0_S2 ∨ 1 ≡ accept_S1; - loop invariant - Aorai: - aorai_Loop_Init_26 ≢ 0 ⇒ - \at(1 ≡ T0_init,Pre) ⇒ 0 ≡ T0_S2; - loop invariant Aorai: aorai_Loop_Init_26 ≡ 0 ⇒ 0 ≡ accept_S1; - */ - while (1) { - if (! (x < 10)) goto while_0_break; - /*@ ghost aorai_Loop_Init_26 = 0; */ - { - int tmp_0; - tmp_0 = b(); - x += tmp_0; - } + int x = a(); + /*@ ghost aorai_Loop_Init_7 = 1; */ + aorai_loop_7: + /*@ loop invariant i: 0 ≤ x ≤ 11; + loop invariant Aorai: 1 ≡ T0_S2 ∨ 0 ≡ T0_S2; + loop invariant Aorai: 0 ≡ T0_init; + loop invariant Aorai: 1 ≡ accept_S1 ∨ 0 ≡ accept_S1; + loop invariant Aorai: 1 ≡ T0_S2 ∨ 1 ≡ accept_S1; + loop invariant + Aorai: + aorai_Loop_Init_7 ≢ 0 ⇒ \at(1 ≡ T0_init,Pre) ⇒ 0 ≡ T0_S2; + loop invariant Aorai: aorai_Loop_Init_7 ≡ 0 ⇒ 0 ≡ accept_S1; + */ + while (x < 10) { + /*@ ghost aorai_Loop_Init_7 = 0; */ + { + int tmp_0; + tmp_0 = b(); + x += tmp_0; } - while_0_break: ; + } tmp_1 = a(); main_post_func(tmp_1); return tmp_1; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_boucle1.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_boucle1.res.oracle index e457cd383a9ce25b7d1b33c44c2bc818fba7ff36..7bdd915bc9bde2520ddf4ff0e4f1d8d0df71bcb6 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_boucle1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_boucle1.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle1.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_boucle10.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_boucle1_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_commit_trans = 2, @@ -211,7 +209,7 @@ void init_trans_pre_func(void) /*@ requires 1 ≡ accept_S2 ∧ 0 ≡ accept_S1 ∧ 0 ≡ accept_S3 ∧ 0 ≡ accept_S4 ∧ 0 ≡ accept_init; - requires 1 ≡ accept_S2 ⇒ status ≡ 0 ∨ status ≢ 0; + requires 1 ≡ accept_S2 ⇒ status ≢ 0 ∨ status ≡ 0; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_init_trans; assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2, @@ -438,34 +436,32 @@ void main_post_func(int res) */ int main(void) { - int aorai_Loop_Init_32; + int aorai_Loop_Init_7; int __retres; main_pre_func(); cpt = 3; status = 0; - /*@ ghost aorai_Loop_Init_32 = 1; */ - aorai_loop_32: - /*@ loop invariant - i: - 0 ≤ status ≤ 1 ∧ 0 ≤ cpt ≤ 3 ∧ - (cpt ≡ 0 ⇒ status ≡ 0); - loop invariant Aorai: 0 ≡ accept_S1; - loop invariant Aorai: 1 ≡ accept_S2; - loop invariant Aorai: 0 ≡ accept_S3; - loop invariant Aorai: 0 ≡ accept_S4; - loop invariant Aorai: 0 ≡ accept_init; - */ - while (1) { - if (! (cpt > 0)) goto while_0_break; - /*@ ghost aorai_Loop_Init_32 = 0; */ - status = init_trans(); - if (status) { - status = commit_trans(); - if (status) goto label_ok; - } - cpt --; + /*@ ghost aorai_Loop_Init_7 = 1; */ + aorai_loop_7: + /*@ loop invariant + i: + 0 ≤ status ≤ 1 ∧ 0 ≤ cpt ≤ 3 ∧ + (cpt ≡ 0 ⇒ status ≡ 0); + loop invariant Aorai: 0 ≡ accept_S1; + loop invariant Aorai: 1 ≡ accept_S2; + loop invariant Aorai: 0 ≡ accept_S3; + loop invariant Aorai: 0 ≡ accept_S4; + loop invariant Aorai: 0 ≡ accept_init; + */ + while (cpt > 0) { + /*@ ghost aorai_Loop_Init_7 = 0; */ + status = init_trans(); + if (status) { + status = commit_trans(); + if (status) goto label_ok; } - while_0_break: ; + cpt --; + } __retres = 0; goto return_label; label_ok: __retres = 1; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_boucle2.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_boucle2.res.oracle index 4268959c354da266998a59e34d933140a54c9dfa..4f101eb24f62cff6ab0f08b9c9604dd83e0869dc 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_boucle2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_boucle2.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_boucle20.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_boucle2_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 2, @@ -455,33 +453,30 @@ void main_post_func(int res) */ int main(void) { - int aorai_Loop_Init_26; + int aorai_Loop_Init_7; int __retres; - /*@ ghost int tmp; */ main_pre_func(); - /*@ ghost aorai_Loop_Init_26 = 1; */ - aorai_loop_26: - /*@ loop invariant 0 ≤ rr ≤ 50; - loop invariant Aorai: 1 ≡ T0_S2 ∨ 0 ≡ T0_S2; - loop invariant Aorai: 0 ≡ T0_init; - loop invariant Aorai: 1 ≡ accept_S3 ∨ 0 ≡ accept_S3; - loop invariant Aorai: 0 ≡ accept_S4; - loop invariant Aorai: 0 ≡ accept_S5; - loop invariant Aorai: 0 ≡ accept_all; - loop invariant Aorai: 1 ≡ T0_S2 ∨ 1 ≡ accept_S3; - loop invariant - Aorai: - aorai_Loop_Init_26 ≢ 0 ⇒ - \at(1 ≡ T0_init,Pre) ⇒ 0 ≡ accept_S3; - */ - while (1) { - if (! (rr < 50)) goto while_0_break; - /*@ ghost aorai_Loop_Init_26 = 0; */ - opa(); - } - while_0_break: ; + /*@ ghost aorai_Loop_Init_7 = 1; */ + aorai_loop_7: + /*@ loop invariant 0 ≤ rr ≤ 50; + loop invariant Aorai: 1 ≡ T0_S2 ∨ 0 ≡ T0_S2; + loop invariant Aorai: 0 ≡ T0_init; + loop invariant Aorai: 1 ≡ accept_S3 ∨ 0 ≡ accept_S3; + loop invariant Aorai: 0 ≡ accept_S4; + loop invariant Aorai: 0 ≡ accept_S5; + loop invariant Aorai: 0 ≡ accept_all; + loop invariant Aorai: 1 ≡ T0_S2 ∨ 1 ≡ accept_S3; + loop invariant + Aorai: + aorai_Loop_Init_7 ≢ 0 ⇒ + \at(1 ≡ T0_init,Pre) ⇒ 0 ≡ accept_S3; + */ + while (rr < 50) { + /*@ ghost aorai_Loop_Init_7 = 0; */ + opa(); + } opb(); - /*@ ghost tmp = 1; */ + /*@ ghost int tmp = 1; */ /*@ ghost tmp = 0; */ __retres = 1; main_post_func(__retres); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_boucle3.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_boucle3.res.oracle index 6956850b193a934eb23df005e14f64003fb890e7..02a0be5d77b163a9623bba2d62f8b846fed48f61 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_boucle3.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_boucle3.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle3.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_boucle30.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_boucle3_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 2, @@ -439,41 +437,37 @@ void main_post_func(int res) */ int main(void) { - int aorai_Loop_Init_41; - int aorai_Loop_Init_31; + int aorai_Loop_Init_15; + int aorai_Loop_Init_7; int __retres; main_pre_func(); - /*@ ghost aorai_Loop_Init_31 = 1; */ - aorai_loop_31: - /*@ loop invariant 0 ≤ rr ≤ 50; - loop invariant Aorai: 0 ≡ T0_S4; - loop invariant Aorai: 0 ≡ T0_init; - loop invariant Aorai: 1 ≡ T1_S2; - loop invariant Aorai: 0 ≡ accept_S3; - loop invariant Aorai: 0 ≡ accept_all; - */ - while (1) { - if (! (rr < 50)) goto while_0_break; - /*@ ghost aorai_Loop_Init_31 = 0; */ - opa(); - } - while_0_break: ; + /*@ ghost aorai_Loop_Init_7 = 1; */ + aorai_loop_7: + /*@ loop invariant 0 ≤ rr ≤ 50; + loop invariant Aorai: 0 ≡ T0_S4; + loop invariant Aorai: 0 ≡ T0_init; + loop invariant Aorai: 1 ≡ T1_S2; + loop invariant Aorai: 0 ≡ accept_S3; + loop invariant Aorai: 0 ≡ accept_all; + */ + while (rr < 50) { + /*@ ghost aorai_Loop_Init_7 = 0; */ + opa(); + } opb(); rr = 0; - /*@ ghost aorai_Loop_Init_41 = 1; */ - aorai_loop_41: - /*@ loop invariant Aorai: 1 ≡ T0_S4; - loop invariant Aorai: 0 ≡ T0_init; - loop invariant Aorai: 0 ≡ T1_S2; - loop invariant Aorai: 0 ≡ accept_S3; - loop invariant Aorai: 0 ≡ accept_all; - */ - while (1) { - if (! (rr < 50)) goto while_1_break; - /*@ ghost aorai_Loop_Init_41 = 0; */ - opa(); - } - while_1_break: ; + /*@ ghost aorai_Loop_Init_15 = 1; */ + aorai_loop_15: + /*@ loop invariant Aorai: 1 ≡ T0_S4; + loop invariant Aorai: 0 ≡ T0_init; + loop invariant Aorai: 0 ≡ T1_S2; + loop invariant Aorai: 0 ≡ accept_S3; + loop invariant Aorai: 0 ≡ accept_all; + */ + while (rr < 50) { + /*@ ghost aorai_Loop_Init_15 = 0; */ + opa(); + } __retres = 1; main_post_func(__retres); return __retres; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_boucle_rechercheTableau.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_boucle_rechercheTableau.res.oracle index af568cc08b37330be3cbebfa255c3cefaa3c1234..a07524e2facf44e19c31ef7602b3a198a1f4b5ca 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_boucle_rechercheTableau.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_boucle_rechercheTableau.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle_rechercheTableau.c (with preprocessing) tests/aorai/test_boucle_rechercheTableau.c:17:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_boucle_rechercheTableau.c:7:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_boucle_rechercheTableau0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_boucle_rechercheTableau_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_foo = 2, @@ -58,7 +56,7 @@ void isPresent_pre_func(int *t, int max, int val) } /*@ requires 1 ≡ Idle ∧ 0 ≡ End ∧ 0 ≡ WillDoFoo; - requires 1 ≡ Idle ⇒ res ≢ -1 ∨ res ≡ -1; + requires 1 ≡ Idle ⇒ res ≡ -1 ∨ res ≢ -1; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_isPresent; assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, WillDoFoo; @@ -126,31 +124,29 @@ void isPresent_post_func(int res) */ int isPresent(int *t, int max, int val) { - int aorai_Loop_Init_32; + int aorai_Loop_Init_2; int __retres; - int i; isPresent_pre_func(t,max,val); - i = 0; - /*@ ghost aorai_Loop_Init_32 = 1; */ - aorai_loop_32: - /*@ loop invariant - inv: - 0 ≤ i ≤ max ∧ \valid(t + (0 .. max)) ∧ max ≥ 0 ∧ - (∀ ℤ j; 0 ≤ j ≤ i - 1 ⇒ *(t + j) ≢ val); - loop invariant Aorai: 0 ≡ End; - loop invariant Aorai: 1 ≡ Idle; - loop invariant Aorai: 0 ≡ WillDoFoo; - loop variant (v: max - i); - */ - while (1) { - if (i < max) { - if (! (*(t + i) != val)) goto while_0_break; - } - else goto while_0_break; - /*@ ghost aorai_Loop_Init_32 = 0; */ - i ++; + int i = 0; + /*@ ghost aorai_Loop_Init_2 = 1; */ + aorai_loop_2: + /*@ loop invariant + inv: + 0 ≤ i ≤ max ∧ \valid(t + (0 .. max)) ∧ max ≥ 0 ∧ + (∀ ℤ j; 0 ≤ j ≤ i - 1 ⇒ *(t + j) ≢ val); + loop invariant Aorai: 0 ≡ End; + loop invariant Aorai: 1 ≡ Idle; + loop invariant Aorai: 0 ≡ WillDoFoo; + loop variant (v: max - i); + */ + while (1) { + if (i < max) { + if (! (*(t + i) != val)) break; } - while_0_break: ; + else break; + /*@ ghost aorai_Loop_Init_2 = 0; */ + i ++; + } if (*(t + i) == val) { __retres = i; goto return_label; @@ -335,14 +331,9 @@ void main_post_func(int res) int main(int argc, char **argv) { int __retres; - int tab[4]; - int r; main_pre_func(argc,argv); - tab[0] = 10; - tab[1] = 20; - tab[2] = 33; - tab[3] = 15; - r = isPresent(tab,3,33); + int tab[4] = {10, 20, 33, 15}; + int r = isPresent(tab,3,33); if (r == -1) foo(); __retres = 1; main_post_func(__retres); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_factorial.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_factorial.res.oracle index c9a6235f36e2e9510a324875de0cbd841b242be1..f53dce6046053a1eb412b9e04818132567dade6b 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_factorial.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_factorial.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_factorial.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_factorial0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_factorial_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_decode_int = 2, @@ -110,76 +108,68 @@ void decode_int_post_func(int res) */ int decode_int(char *s) { - int aorai_Loop_Init_81; + int aorai_Loop_Init_5; int __retres; - int intmax; - int cutlim; - int cutoff; - int value; char c; decode_int_pre_func(s); - intmax = ~ (1 << (sizeof(int) * (unsigned int)8 - (unsigned int)1)); - cutlim = intmax % 10; - cutoff = intmax / 10; - value = 0; - /*@ ghost aorai_Loop_Init_81 = 1; */ - aorai_loop_81: - /*@ loop invariant Aorai: 1 ≡ accept_S1; - loop invariant Aorai: 0 ≡ accept_S2; - loop invariant Aorai: 0 ≡ accept_init; - */ - while (1) { + int intmax = ~ (1 << (sizeof(int) * (unsigned int)8 - (unsigned int)1)); + int cutlim = intmax % 10; + int cutoff = intmax / 10; + int value = 0; + /*@ ghost aorai_Loop_Init_5 = 1; */ + aorai_loop_5: + /*@ loop invariant Aorai: 1 ≡ accept_S1; + loop invariant Aorai: 0 ≡ accept_S2; + loop invariant Aorai: 0 ≡ accept_init; + */ + while (1) { + { + char *tmp; + /*@ ghost aorai_Loop_Init_5 = 0; */ + tmp = s; + s ++; + c = *tmp; + if (! c) break; { - char *tmp; - /*@ ghost aorai_Loop_Init_81 = 0; */ - tmp = s; - s ++; - c = *tmp; - if (! c) goto while_0_break; - { - int v; - v = 0; - switch ((int)c) { - case '0': v = 0; - goto switch_1_break; - case '1': v = 1; - goto switch_1_break; - case '2': v = 2; - goto switch_1_break; - case '3': v = 3; - goto switch_1_break; - case '4': v = 4; - goto switch_1_break; - case '5': v = 5; - goto switch_1_break; - case '6': v = 6; - goto switch_1_break; - case '7': v = 7; - goto switch_1_break; - case '8': v = 8; - goto switch_1_break; - case '9': v = 9; - goto switch_1_break; - default: ; - __retres = -1; - goto return_label; - } - switch_1_break: ; - if (value > cutoff) { - __retres = -1; - goto return_label; - } - else - if (value == cutoff) - if (v > cutlim) { - __retres = -1; - goto return_label; - } - value = value * 10 + v; + int v = 0; + switch ((int)c) { + case '0': v = 0; + break; + case '1': v = 1; + break; + case '2': v = 2; + break; + case '3': v = 3; + break; + case '4': v = 4; + break; + case '5': v = 5; + break; + case '6': v = 6; + break; + case '7': v = 7; + break; + case '8': v = 8; + break; + case '9': v = 9; + break; + default: __retres = -1; + goto return_label; + } + if (value > cutoff) { + __retres = -1; + goto return_label; } + else + if (value == cutoff) + if (v > cutlim) { + __retres = -1; + goto return_label; + } + value = value * 10 + v; } } - while_0_break: ; + } __retres = value; return_label: decode_int_post_func(__retres); return __retres; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_factorial2.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_factorial2.res.oracle index ee43c663d624e1b83df65175765dcfbd02c1690e..5e32a76cc3f447b7bcfb5bc977867133cb9a4dac 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_factorial2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_factorial2.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_factorial2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_factorial20.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_factorial2_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_decode_int = 2, @@ -109,76 +107,68 @@ void decode_int_post_func(int res) */ int decode_int(char *s) { - int aorai_Loop_Init_81; + int aorai_Loop_Init_5; int __retres; - int intmax; - int cutlim; - int cutoff; - int value; char c; decode_int_pre_func(s); - intmax = ~ (1 << (sizeof(int) * (unsigned int)8 - (unsigned int)1)); - cutlim = intmax % 10; - cutoff = intmax / 10; - value = 0; - /*@ ghost aorai_Loop_Init_81 = 1; */ - aorai_loop_81: - /*@ loop invariant Aorai: 1 ≡ S1; - loop invariant Aorai: 0 ≡ S2; - loop invariant Aorai: 0 ≡ main_0; - */ - while (1) { + int intmax = ~ (1 << (sizeof(int) * (unsigned int)8 - (unsigned int)1)); + int cutlim = intmax % 10; + int cutoff = intmax / 10; + int value = 0; + /*@ ghost aorai_Loop_Init_5 = 1; */ + aorai_loop_5: + /*@ loop invariant Aorai: 1 ≡ S1; + loop invariant Aorai: 0 ≡ S2; + loop invariant Aorai: 0 ≡ main_0; + */ + while (1) { + { + char *tmp; + /*@ ghost aorai_Loop_Init_5 = 0; */ + tmp = s; + s ++; + c = *tmp; + if (! c) break; { - char *tmp; - /*@ ghost aorai_Loop_Init_81 = 0; */ - tmp = s; - s ++; - c = *tmp; - if (! c) goto while_0_break; - { - int v; - v = 0; - switch ((int)c) { - case '0': v = 0; - goto switch_1_break; - case '1': v = 1; - goto switch_1_break; - case '2': v = 2; - goto switch_1_break; - case '3': v = 3; - goto switch_1_break; - case '4': v = 4; - goto switch_1_break; - case '5': v = 5; - goto switch_1_break; - case '6': v = 6; - goto switch_1_break; - case '7': v = 7; - goto switch_1_break; - case '8': v = 8; - goto switch_1_break; - case '9': v = 9; - goto switch_1_break; - default: ; - __retres = -1; - goto return_label; - } - switch_1_break: ; - if (value > cutoff) { - __retres = -1; - goto return_label; - } - else - if (value == cutoff) - if (v > cutlim) { - __retres = -1; - goto return_label; - } - value = value * 10 + v; + int v = 0; + switch ((int)c) { + case '0': v = 0; + break; + case '1': v = 1; + break; + case '2': v = 2; + break; + case '3': v = 3; + break; + case '4': v = 4; + break; + case '5': v = 5; + break; + case '6': v = 6; + break; + case '7': v = 7; + break; + case '8': v = 8; + break; + case '9': v = 9; + break; + default: __retres = -1; + goto return_label; + } + if (value > cutoff) { + __retres = -1; + goto return_label; } + else + if (value == cutoff) + if (v > cutlim) { + __retres = -1; + goto return_label; + } + value = value * 10 + v; } } - while_0_break: ; + } __retres = value; return_label: decode_int_post_func(__retres); return __retres; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_recursion1.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_recursion1.res.oracle index 8974c621cb2acc6a95859eb4109b6fe55e2ccfe7..6075ca136c46708b33e6eab8a01e8ac78628b6a3 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_recursion1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_recursion1.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion1.c (with preprocessing) tests/aorai/test_recursion1.c:21:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_recursion1.c:42:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_recursion1.c:54:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_recursion10.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_recursion1_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -135,10 +133,9 @@ void countOne_post_func(int res) int countOne(char *argv) { int __retres; - int r; int tmp; countOne_pre_func(argv); - r = 0; + int r = 0; if ((int)*(argv + 0) == 0) { __retres = 0; goto return_label; @@ -238,9 +235,8 @@ void count_post_func(int res) */ int count(int argc, char **argv) { - int s; count_pre_func(argc,argv); - s = countOne(*(argv + 0)); + int s = countOne(*(argv + 0)); if (argc > 1) { int tmp_0; tmp_0 = count(argc - 1,argv + 1); @@ -349,9 +345,8 @@ void main_post_func(int res) int main(int argc, char **argv) { int __retres; - int somme; main_pre_func(argc,argv); - somme = 0; + int somme = 0; if (argc > 0) somme = count(argc,argv); __retres = 1; main_post_func(__retres); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_recursion2.0.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_recursion2.0.res.oracle index 018c922a1b80a45c44adc2c5a0cca8fdab797363..e61ff4d5eb6692b2efd4921767fd876b63113670 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_recursion2.0.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_recursion2.0.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_recursion20.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_recursion2_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -290,31 +288,26 @@ void sumOne_post_func(int res) */ int sumOne(char *t, int length) { - int aorai_Loop_Init_43; - int sum; - int i; + int aorai_Loop_Init_11; sumOne_pre_func(t,length); - sum = 0; + int sum = 0; + int i = 0; i = 0; - i = 0; - /*@ ghost aorai_Loop_Init_43 = 1; */ - aorai_loop_43: - /*@ loop invariant ranges: 0 ≤ i ≤ length; - loop invariant sumValue0: i ≡ 0 ⇒ sum ≡ 0; - loop invariant - sumValuei: i > 0 ⇒ sum ≡ sum_tab(t, length, i - 1); - loop invariant Aorai: 0 ≡ S1; - loop invariant Aorai: 0 ≡ T0_init; - loop invariant Aorai: 1 ≡ T1; - loop invariant Aorai: 0 ≡ accept_T2; - */ - while (1) { - if (! (i < length)) goto while_0_break; - /*@ ghost aorai_Loop_Init_43 = 0; */ - sum += (int)*(t + i); - i ++; - } - while_0_break: ; + /*@ ghost aorai_Loop_Init_11 = 1; */ + aorai_loop_11: + /*@ loop invariant ranges: 0 ≤ i ≤ length; + loop invariant sumValue0: i ≡ 0 ⇒ sum ≡ 0; + loop invariant sumValuei: i > 0 ⇒ sum ≡ sum_tab(t, length, i - 1); + loop invariant Aorai: 0 ≡ S1; + loop invariant Aorai: 0 ≡ T0_init; + loop invariant Aorai: 1 ≡ T1; + loop invariant Aorai: 0 ≡ accept_T2; + */ + while (i < length) { + /*@ ghost aorai_Loop_Init_11 = 0; */ + sum += (int)*(t + i); + i ++; + } sumOne_post_func(sum); return sum; } @@ -433,10 +426,9 @@ void main_post_func(int res) int main(int argc, char **argv) { int __retres; - int sum; int length; main_pre_func(argc,argv); - sum = 0; + int sum = 0; global_argc = argc; if (argc > 0) { length = count(*(argv + 0)); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_recursion2.1.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_recursion2.1.res.oracle index 594c54713b0823a4e701cbb5ea4c4b5e1544d5f7..27ccb8a910f862d12ce15adeb7522703f6177a6f 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_recursion2.1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_recursion2.1.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_recursion21.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_recursion2_1.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -290,31 +288,26 @@ void sumOne_post_func(int res) */ int sumOne(char *t, int length) { - int aorai_Loop_Init_43; - int sum; - int i; + int aorai_Loop_Init_11; sumOne_pre_func(t,length); - sum = 0; + int sum = 0; + int i = 0; i = 0; - i = 0; - /*@ ghost aorai_Loop_Init_43 = 1; */ - aorai_loop_43: - /*@ loop invariant ranges: 0 ≤ i ≤ length; - loop invariant sumValue0: i ≡ 0 ⇒ sum ≡ 0; - loop invariant - sumValuei: i > 0 ⇒ sum ≡ sum_tab(t, length, i - 1); - loop invariant Aorai: 0 ≡ S1; - loop invariant Aorai: 0 ≡ T0_init; - loop invariant Aorai: 1 ≡ T1; - loop invariant Aorai: 0 ≡ accept_T2; - */ - while (1) { - if (! (i < length)) goto while_0_break; - /*@ ghost aorai_Loop_Init_43 = 0; */ - sum += (int)*(t + i); - i ++; - } - while_0_break: ; + /*@ ghost aorai_Loop_Init_11 = 1; */ + aorai_loop_11: + /*@ loop invariant ranges: 0 ≤ i ≤ length; + loop invariant sumValue0: i ≡ 0 ⇒ sum ≡ 0; + loop invariant sumValuei: i > 0 ⇒ sum ≡ sum_tab(t, length, i - 1); + loop invariant Aorai: 0 ≡ S1; + loop invariant Aorai: 0 ≡ T0_init; + loop invariant Aorai: 1 ≡ T1; + loop invariant Aorai: 0 ≡ accept_T2; + */ + while (i < length) { + /*@ ghost aorai_Loop_Init_11 = 0; */ + sum += (int)*(t + i); + i ++; + } sumOne_post_func(sum); return sum; } @@ -436,10 +429,9 @@ void main_post_func(int res) int main(int argc, char **argv) { int __retres; - int sum; int length; main_pre_func(argc,argv); - sum = 0; + int sum = 0; global_argc = argc; if (argc > 0) { length = count(*(argv + 0)); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_recursion4.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_recursion4.res.oracle index 67342b2fc69d2e82956f795b27c7f3cae7e6fd6c..2beb5344b89a1793b3ee741dc83b7196106430bc 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_recursion4.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_recursion4.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion4.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_recursion40.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_recursion4_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_foo = 2, @@ -58,7 +56,7 @@ void isPresent_pre_func(int *t, int size, int val) /*@ requires 1 ≡ End ∨ 1 ≡ Idle ∨ 1 ≡ WillDoFoo; requires 1 ≡ End ⇒ res ≢ -1; - requires 1 ≡ Idle ⇒ res ≢ -1 ∨ res ≡ -1; + requires 1 ≡ Idle ⇒ res ≡ -1 ∨ res ≢ -1; requires 1 ≡ WillDoFoo ⇒ res ≡ -1; ensures aorai_CurOpStatus ≡ aorai_Terminated; ensures aorai_CurOperation ≡ op_isPresent; @@ -148,7 +146,6 @@ void isPresent_post_func(int res) int isPresent(int *t, int size, int val) { int __retres; - int r; int tmp; isPresent_pre_func(t,size,val); if (size == 0) { @@ -160,7 +157,7 @@ int isPresent(int *t, int size, int val) goto return_label; } tmp = isPresent(t + 1,size - 1,val); - r = 1 + tmp; + int r = 1 + tmp; if (r == 0) r = -1; __retres = r; return_label: isPresent_post_func(__retres); @@ -342,14 +339,9 @@ void main_post_func(int res) int main(int argc, char **argv) { int __retres; - int tab[4]; - int r; main_pre_func(argc,argv); - tab[0] = 10; - tab[1] = 20; - tab[2] = 33; - tab[3] = 15; - r = isPresent(tab,4,33); + int tab[4] = {10, 20, 33, 15}; + int r = isPresent(tab,4,33); if (r == -1) foo(); __retres = 1; main_post_func(__retres); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_recursion5.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_recursion5.res.oracle index a40daed0716eed753887367fd78a1609d99a7190..b18fa647dfe22bba131b9b3806a14f80c3b171fa 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_recursion5.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_recursion5.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion5.c (with preprocessing) tests/aorai/test_recursion5.c:12:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_recursion5.c:28:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_recursion50.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_recursion5_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_foo = 3, @@ -69,7 +67,7 @@ void isPresentRec_pre_func(int *t, int i, int max, int val) /*@ requires (1 ≡ Idle ∨ 1 ≡ IgnoreFoo ∨ 1 ≡ WillDoFoo) ∧ 0 ≡ End; - requires 1 ≡ Idle ⇒ res ≢ -1 ∨ res ≡ -1; + requires 1 ≡ Idle ⇒ res ≡ -1 ∨ res ≢ -1; requires 1 ≡ IgnoreFoo ⇒ res ≢ -1; requires 1 ≡ WillDoFoo ⇒ res ≡ -1; ensures aorai_CurOpStatus ≡ aorai_Terminated; @@ -530,14 +528,9 @@ void main_post_func(int res) int main(int argc, char **argv) { int __retres; - int tab[4]; - int r; main_pre_func(argc,argv); - tab[0] = 10; - tab[1] = 20; - tab[2] = 33; - tab[3] = 15; - r = isPresent(tab,3,33); + int tab[4] = {10, 20, 33, 15}; + int r = isPresent(tab,3,33); if (r == -1) foo(); __retres = 1; main_post_func(__retres); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_struct.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_struct.res.oracle index 8f9e98b8e409ce00f6103f59cb86977aaca1f094..d958a05da1c12e6610283cd831a8ee2f8f652a44 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_struct.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_struct.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_struct.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_struct0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_struct_0.i (no preprocessing) /* Generated by Frama-C */ struct People { int Age ; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_switch2.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_switch2.res.oracle index ccead7fc514974e93d3ed7fa9a2edf1cad2a1479..400929df180d66bc80ca48350b626b775862a616 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_switch2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_switch2.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch2.c (with preprocessing) [aorai] Welcome to the Aorai plugin tests/aorai/test_switch2.c:34:[aorai] warning: Call to opc not conforming to automaton (post-cond). Assuming it is on a dead path tests/aorai/test_switch2.c:23:[aorai] warning: Call to opc not conforming to automaton (pre-cond). Assuming it is on a dead path -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_switch20.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_switch2_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_main = 3, @@ -656,12 +654,10 @@ int main(void) main_pre_func(); switch (rr) { case 1: opa(); - goto switch_0_break; + break; case 3: opa(); - default: ; - opc(); + default: opc(); } - switch_0_break: ; opb(); __retres = 1; main_post_func(__retres); diff --git a/src/plugins/aorai/tests/aorai/oracle/test_switch3.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_switch3.res.oracle index 3007bdc77e3a788148da83c695e1257685f192c5..ee0889115ef33193a598f25f75c62f587935044b 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_switch3.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_switch3.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_switch30.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_switch3_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -124,19 +122,16 @@ void countOne_post_func(int res) */ int countOne(char *argv) { - int r; countOne_pre_func(argv); - r = 0; + int r = 0; switch ((int)*(argv + 0)) { int tmp; case 0: r = 0; - goto switch_0_break; - case 1: case 2: case 3: default: ; - r ++; + break; + case 1: case 2: case 3: default: r ++; tmp = countOne(argv + 1); r += tmp; } - switch_0_break: ; countOne_post_func(r); return r; } diff --git a/src/plugins/aorai/tests/aorai/oracle/test_switch3_et_recursion.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_switch3_et_recursion.res.oracle index 89bfa16906464f3b31902045958643597bb7e3a5..096f3396c8ed57f310da26ea9f7e1d5728bfec27 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_switch3_et_recursion.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_switch3_et_recursion.res.oracle @@ -1,9 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3_et_recursion.c (with preprocessing) [aorai] Welcome to the Aorai plugin tests/aorai/test_switch3_et_recursion.c:26:[aorai] warning: Call to countOne does not follow automaton's specification. This path is assumed to be dead -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_switch3_et_recursion0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_switch3_et_recursion_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -102,14 +100,12 @@ void countOne_post_func(int res) */ int countOne(char *argv) { - int r; countOne_pre_func(argv); - r = 0; + int r = 0; switch ((int)*(argv + 0)) { int tmp; case 0: r = 0; - case 1: case 2: case 3: default: ; - r ++; + case 1: case 2: case 3: default: r ++; tmp = countOne(argv + 1); r += tmp; } diff --git a/src/plugins/aorai/tests/aorai/oracle/test_switch3_if.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_switch3_if.res.oracle index 9f75f51e6617e19987dbfdaa55677b1a2e62f071..7659747030e79f6f104226457602e750099b8d27 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_switch3_if.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_switch3_if.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3_if.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_switch3_if0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_switch3_if_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -124,9 +122,8 @@ void countOne_post_func(int res) */ int countOne(char *argv) { - int r; countOne_pre_func(argv); - r = 0; + int r = 0; if ((int)*(argv + 0) != 0) { int tmp; r ++; diff --git a/src/plugins/aorai/tests/aorai/oracle/test_switch3_return.res.oracle b/src/plugins/aorai/tests/aorai/oracle/test_switch3_return.res.oracle index 78cf441e88b2fad2247b23351ad9825f341c110e..e9ccfe2be0313145c06872f3ebedf1681b579b61 100644 --- a/src/plugins/aorai/tests/aorai/oracle/test_switch3_return.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle/test_switch3_return.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3_return.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing /tmp/aorai_test_switch3_return0.i (no preprocessing) +[kernel] Parsing /tmp/aorai_test_switch3_return_0.i (no preprocessing) /* Generated by Frama-C */ enum aorai_ListOper { op_count = 2, @@ -125,15 +123,13 @@ void countOne_post_func(int res) int countOne(char *argv) { int __retres; - int r; countOne_pre_func(argv); - r = 0; + int r = 0; switch ((int)*(argv + 0)) { int tmp; case 0: __retres = 0; goto return_label; - case 1: case 2: case 3: default: ; - r ++; + case 1: case 2: case 3: default: r ++; tmp = countOne(argv + 1); r += tmp; } diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/assigns.0.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/assigns.0.res.oracle index e80d48acef70cd17f25e21e2c26d906ee8a293c4..0df1f87a75a68d878c491ed2b6f6d445365d6caf 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/assigns.0.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/assigns.0.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/assigns.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_assigns0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/assigns.1.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/assigns.1.res.oracle index 572e6a797a6aaf1cee5af090c97e559b4eac9ec8..41e6f16bbda7da4b391df70936a88a0c36a6d7aa 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/assigns.1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/assigns.1.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/assigns.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_assigns1.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/assigns.2.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/assigns.2.res.oracle index 57644ea9bbaf8a5085439f56514b9099b03b883d..a03928c6cad0adaaa70de524ae1c846eca1db1bd 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/assigns.2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/assigns.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/assigns.c (with preprocessing) [aorai] Welcome to the Aorai plugin /* Generated by Frama-C */ diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.0.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.0.res.oracle index 5cb2a57accfac6229cc3834b3ec9dbafdb1a8345..726f606bd8df59676839c74e39ef89ab6853eec4 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.0.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.0.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/bts1289.i (no preprocessing) [aorai] Welcome to the Aorai plugin [aorai] warning: Call to main does not follow automaton's specification. This path is assumed to be dead -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_bts12890.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.1.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.1.res.oracle index 13c0ef157f278686ed3208d979274ed16652d4f4..fa9585a7fef59bf3913169f46ec40af9d92912ec 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/bts1289.1.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/bts1289.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_bts12891.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/deterministic.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/deterministic.res.oracle index a5dc417e687c11d83dcfa69a641b29947d9d7ab2..336773a611b568b032e0f02be9029489b9ab720a 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/deterministic.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/deterministic.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/deterministic.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_deterministic0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/formals.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/formals.res.oracle index 962b1fb577441e9e6b952fc0faceffb06418b821..fbf2d361e5a6b10b8bc6709fa7e04a969f591a82 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/formals.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/formals.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/formals.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_formals0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/generate_assigns_bts1290.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/generate_assigns_bts1290.res.oracle index 63d11928879553c0deeb326b5ccddba5a4667cb2..74dfe092ace0323030b97467e8acbf682d42de8b 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/generate_assigns_bts1290.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/generate_assigns_bts1290.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/generate_assigns_bts1290.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_generate_assigns_bts12900.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/goto.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/goto.res.oracle index 40e9790cab0bcd2857037b7cf9e0b8d6ee7d2c39..f29a5c02b36d7de375ae4ce96a1cc627fb3133df 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/goto.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/goto.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/goto.c (with preprocessing) [aorai] Welcome to the Aorai plugin tests/aorai/goto.c:28:[aorai] warning: Call to opc does not follow automaton's specification. This path is assumed to be dead -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_goto0.i (no preprocessing) /tmp/aorai_goto0.i:4:[wp] warning: Global invariant not handled yet ('inv' ignored) [wp] Collecting axiomatic usage diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/hoare_seq.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/hoare_seq.res.oracle index 0b8b99ab0f6031ea61fcb853f7c7ea7258fe9ca4..d1a8dce2eb23b6ef73e833d6683b624dcab2484a 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/hoare_seq.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/hoare_seq.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/hoare_seq.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_hoare_seq0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/loop_bts1050.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/loop_bts1050.res.oracle index 311908d438f920b023216f1b1aeb8fc349596db0..8251302b8c97a827a9bf3bf6aa276d0e182b10e7 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/loop_bts1050.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/loop_bts1050.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/loop_bts1050.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_loop_bts10500.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/not_prm.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/not_prm.res.oracle index 89be32be504510d0bc85f51a82d25acbc0626114..4d9c5febd4bf309268f76ad1db7fba72b5c9bff5 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/not_prm.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/not_prm.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/not_prm.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_not_prm0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/other.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/other.res.oracle index 23a2d0f0635ed4c3ea26906160ffb32e8ce41ca8..e3f9de9e5215c71c449f41cee15e94154ef80b2f 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/other.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/other.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/other.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_other0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/seq.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/seq.res.oracle index d95957d41fff7885961bc66056ddee368f31f28d..c885df01ab6aa381f0739cd8a67c9f6c22b2bd9a 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/seq.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/seq.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/seq.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_seq0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/seq_loop.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/seq_loop.res.oracle index cb9bfc672b1153a53616c305ed4b0db51097fe0a..fa97bb7c5ad0fba69131b3c65fb51f1c2954f41a 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/seq_loop.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/seq_loop.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/seq_loop.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_seq_loop0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/single_call.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/single_call.res.oracle index 2f9a39e03fe8d763f2d4169aaa92bb71a3599c1d..712bfa00cd2c8c656bdce8aad08ab0120956c1f5 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/single_call.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/single_call.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/single_call.i (no preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_single_call0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params.res.oracle index 9fff7c402383372a3e7c605fa76e25d7b60860a1..ff9ed90082ea33e0e744cbf57045d37191f398a8 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_acces_params.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_acces_params0.i (no preprocessing) /tmp/aorai_test_acces_params0.i:4:[wp] warning: Global invariant not handled yet ('inv' ignored) [wp] Collecting axiomatic usage diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params2.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params2.res.oracle index b7cb10cf71e4e22349c878ce257b3a163b3b30db..36faad6b3f8756de4bd9e8dc54eab26af41ca28b 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_acces_params2.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_acces_params2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_acces_params20.i (no preprocessing) /tmp/aorai_test_acces_params20.i:3:[wp] warning: Global invariant not handled yet ('inv' ignored) [wp] Collecting axiomatic usage diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle.res.oracle index 748e996345452fcd6fe94da568df3d71e4363f15..da1fcef5be47d91894510004a4838fb0164d6fda 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle.c (with preprocessing) tests/aorai/test_boucle.c:16:[kernel] warning: Calling undeclared function call_to_an_undefined_function. Old style K&R code? [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_boucle0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle1.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle1.res.oracle index 8deb878485efd7e2a4119c117653118cedd40e03..b08aaf3b180a7b6796e6cc1cb244013567aaaba8 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle1.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle1.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_boucle10.i (no preprocessing) /tmp/aorai_test_boucle10.i:3:[wp] warning: Global invariant not handled yet ('inv_cpt' ignored) /tmp/aorai_test_boucle10.i:6:[wp] warning: Global invariant not handled yet ('inv_status' ignored) diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle2.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle2.res.oracle index de26315aed714ccecd95521c8a4e19984e316eb7..ed96de3b6af2a9f36f0fc45ba036b3fb2cfe4538 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle2.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_boucle20.i (no preprocessing) /tmp/aorai_test_boucle20.i:4:[wp] warning: Global invariant not handled yet ('inv' ignored) [wp] Collecting axiomatic usage diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle3.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle3.res.oracle index c489cc058de127525d873cea796f4a5f15d653ae..f5fe45a55d0956768eb9685301ad887c4fbd7773 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle3.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle3.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle3.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_boucle30.i (no preprocessing) /tmp/aorai_test_boucle30.i:4:[wp] warning: Global invariant not handled yet ('inv' ignored) [wp] Collecting axiomatic usage diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle_rechercheTableau.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle_rechercheTableau.res.oracle index 85b2b8b2ba9ee40e814e6626aa2fd641f375fa30..bf30d3ed3da4f90707f9b37ba4d1ce7ec0001c5f 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle_rechercheTableau.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_boucle_rechercheTableau.res.oracle @@ -1,9 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_boucle_rechercheTableau.c (with preprocessing) tests/aorai/test_boucle_rechercheTableau.c:17:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_boucle_rechercheTableau.c:7:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_boucle_rechercheTableau0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial.res.oracle index f2bd125cee815f39adeb3c3cfac2715bff0d4c5a..246b748a70d9af01d11ebb1ce45a294160c870d7 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_factorial.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_factorial0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial2.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial2.res.oracle index 4b86728a0ee33bc71f5508741bbcbee350e9ce0f..4944a79ee26faa16a15db9ab2edfb30644fefc90 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_factorial2.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_factorial2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_factorial20.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion1.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion1.res.oracle index 2997376a1845d741a7f19cd6a838f34a7903a738..143f3333da9b923a6a9e50fec6c98bf48bd19bc8 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion1.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion1.c (with preprocessing) tests/aorai/test_recursion1.c:21:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_recursion1.c:42:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_recursion1.c:54:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_recursion10.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: No definition for 'string_len' interpreted as reads nothing diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.0.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.0.res.oracle index 0c5481b21da04b097202bc231795725ba51d09bb..11708e2d1cea3cd908a55cc8fc3f9e4db16be754 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.0.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.0.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_recursion20.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: No definition for 'string_len' interpreted as reads nothing diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.1.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.1.res.oracle index b8cc6f9cf4f420bce26f3917682ced0d3c59dec8..3147fb0b473ab66376dd1d39b5ea0587311839a1 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.1.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion2.1.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion2.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_recursion21.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: No definition for 'string_len' interpreted as reads nothing diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion4.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion4.res.oracle index f9f30429ccf2ad59a8fb8827e51c52fb151e1771..742aff39a927383abfbbb2be8d371c6be872186a 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion4.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion4.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion4.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_recursion40.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion5.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion5.res.oracle index bba040dd14a2163e42b11b0d5de827c817399b67..d19ffd1364213d90e472befbc3219d8ac7e1fc2e 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion5.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_recursion5.res.oracle @@ -1,9 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_recursion5.c (with preprocessing) tests/aorai/test_recursion5.c:12:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/aorai/test_recursion5.c:28:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_recursion50.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_struct.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_struct.res.oracle index e747bfcc02a8b6c553d0a68e5cf137600189d82e..e44ffe014aa3c754ee511304d3b77406946e0fe6 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_struct.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_struct.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_struct.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_struct0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch2.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch2.res.oracle index 044b5265e446b801bce2baecab2ec83074628fb8..c242d324f4265404212e6145056b250f4bc76461 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch2.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch2.res.oracle @@ -1,9 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch2.c (with preprocessing) [aorai] Welcome to the Aorai plugin tests/aorai/test_switch2.c:34:[aorai] warning: Call to opc not conforming to automaton (post-cond). Assuming it is on a dead path tests/aorai/test_switch2.c:23:[aorai] warning: Call to opc not conforming to automaton (pre-cond). Assuming it is on a dead path -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_switch20.i (no preprocessing) /tmp/aorai_test_switch20.i:4:[wp] warning: Global invariant not handled yet ('inv' ignored) [wp] Collecting axiomatic usage diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3.res.oracle index bdba643b1a2a9c463726b3f85131f7a50058ced2..ab0f22fee2f3132b3db42027759c32a0232ad24b 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_switch30.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_et_recursion.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_et_recursion.res.oracle index d9b6824741fae96f6fab2d12d73be137d4311f6b..a5cf704fc19e475aebedba6aac3a7ff595b70fb9 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_et_recursion.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_et_recursion.res.oracle @@ -1,8 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3_et_recursion.c (with preprocessing) [aorai] Welcome to the Aorai plugin tests/aorai/test_switch3_et_recursion.c:26:[aorai] warning: Call to countOne does not follow automaton's specification. This path is assumed to be dead -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_switch3_et_recursion0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_if.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_if.res.oracle index 6ffb0cbd9e8dadde4dae1b876f79a655ef3c6d33..88c0e9d0cb1000d7837bfe235e5ca00376bab973 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_if.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_if.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3_if.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_switch3_if0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_return.res.oracle b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_return.res.oracle index ffac42371f1b17fc5951a1a137dac03a71e1f3f2..7a4d8695c525f060ef9bf5b52fc55ea53260142e 100644 --- a/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_return.res.oracle +++ b/src/plugins/aorai/tests/aorai/oracle_prove/test_switch3_return.res.oracle @@ -1,7 +1,5 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/aorai/test_switch3_return.c (with preprocessing) [aorai] Welcome to the Aorai plugin -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing /tmp/aorai_test_switch3_return0.i (no preprocessing) [wp] Collecting axiomatic usage [wp] warning: Missing RTE guards diff --git a/src/plugins/aorai/utils_parser.ml b/src/plugins/aorai/utils_parser.ml index 70438cc8ab29dbd08f02ed1df0f610898ac6f71e..442ce5eba6476143b505c1ba2dc6b5ca6bf6f024 100644 --- a/src/plugins/aorai/utils_parser.ml +++ b/src/plugins/aorai/utils_parser.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/yalexer.mll b/src/plugins/aorai/yalexer.mll index 7e4d83a2c3f02e60b7d8a849d3f4f6cee717eb1a..6eb5bd0d24ee4bdd705e52d743918bdcd57de9a8 100644 --- a/src/plugins/aorai/yalexer.mll +++ b/src/plugins/aorai/yalexer.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Aorai plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* INRIA (Institut National de Recherche en Informatique et en *) diff --git a/src/plugins/aorai/yaparser.mly b/src/plugins/aorai/yaparser.mly index ee28820629872696c6b765ecbe31fdfec300fbc3..842fe81b6c5635291682c3fa466b927465ccb8df 100644 --- a/src/plugins/aorai/yaparser.mly +++ b/src/plugins/aorai/yaparser.mly @@ -2,7 +2,7 @@ /* */ /* This file is part of Aorai plug-in of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* INRIA (Institut National de Recherche en Informatique et en */ @@ -285,7 +285,7 @@ seq_elt: ; repetition: - | /* empty */ %prec lowest + | /* empty */ %prec highest { Some Data_for_aorai.cst_one, Some Data_for_aorai.cst_one } | PLUS { Some Data_for_aorai.cst_one, None} | STAR { None, None } @@ -322,18 +322,18 @@ logic_relation arith_relation : arith_relation_mul PLUS arith_relation { PBinop(Badd,$1,$3) } | arith_relation_mul MINUS arith_relation { PBinop(Bsub,$1,$3) } - | arith_relation_mul %prec lowest { $1 } + | arith_relation_mul %prec highest { $1 } ; arith_relation_mul : arith_relation_mul SLASH access_or_const { PBinop(Bdiv,$1,$3) } | arith_relation_mul STAR access_or_const { PBinop(Bmul, $1, $3) } | arith_relation_mul PERCENT access_or_const { PBinop(Bmod, $1, $3) } - | arith_relation_bw %prec lowest { $1 } + | arith_relation_bw %prec highest { $1 } ; arith_relation_bw - : access_or_const %prec lowest { $1 } + : access_or_const %prec highest { $1 } | arith_relation_bw AMP access_or_const { PBinop(Bbw_and,$1,$3) } | arith_relation_bw PIPE access_or_const { PBinop(Bbw_or,$1,$3) } | arith_relation_bw CARET access_or_const { PBinop(Bbw_xor,$1,$3) } diff --git a/src/plugins/callgraph/Callgraph.mli b/src/plugins/callgraph/Callgraph.mli index e78f74dbbd96f92b37635352d1494d1b33695a67..e2a93d96c30635f3823e91098a204519d9eb59da 100644 --- a/src/plugins/callgraph/Callgraph.mli +++ b/src/plugins/callgraph/Callgraph.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -24,7 +24,7 @@ module Options: sig module Filename: Parameter_sig.String - module Init_func: Parameter_sig.Kernel_function_set + module Service_roots: Parameter_sig.Kernel_function_set module Uncalled: Parameter_sig.Bool module Uncalled_leaf: Parameter_sig.Bool module Services: Parameter_sig.Bool @@ -41,6 +41,6 @@ module Uses: module type of Uses (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/callgraph_api.mli b/src/plugins/callgraph/callgraph_api.mli index db8cca539345109f696429f4779a79e00fdfcdf4..324aeb3c3b18af878bbbcdf1433c41f699060389 100644 --- a/src/plugins/callgraph/callgraph_api.mli +++ b/src/plugins/callgraph/callgraph_api.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -33,8 +33,12 @@ module type Graph = sig val get: unit -> G.t (** Get the graph from the AST. *) + module Subgraph: sig val get: unit -> G.t end + (** Subgraph of [get ()] wrt [Options.Roots.get ()] *) + val dump: unit -> unit - (** Dump the graph in the file of the corresponding command line argument. *) + (** Dump the (possibly sub-)graph in the file of the corresponding command + line argument. *) val is_computed: unit -> bool (** Is the graph already built? *) diff --git a/src/plugins/callgraph/cg.ml b/src/plugins/callgraph/cg.ml index 1a7605b05d9ff278d90015d31503699cc6e093af..c812697019a735eedea154e5e41ab45e85d717af 100644 --- a/src/plugins/callgraph/cg.ml +++ b/src/plugins/callgraph/cg.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -75,24 +75,28 @@ let get_pointed_kfs = let res = ref None in fun () -> let compute () = - let l = ref [] in - let o = object - inherit Visitor.frama_c_inplace - method !vexpr e = match e.enode with - | AddrOf (Var vi, NoOffset) when Cil.isFunctionType vi.vtype -> + if Options.Function_pointers.get () then + let l = ref [] in + let o = object + inherit Visitor.frama_c_inplace + method !vexpr e = match e.enode with + | AddrOf (Var vi, NoOffset) when Cil.isFunctionType vi.vtype -> (* function pointer *) - let kf = - try Globals.Functions.get vi - with Not_found -> assert false - in - l := kf :: !l; - Cil.SkipChildren - | _ -> - Cil.DoChildren - end - in - Visitor.visitFramacFileSameGlobals o (Ast.get ()); - !l + let kf = + try Globals.Functions.get vi + with Not_found -> assert false + in + l := kf :: !l; + Cil.SkipChildren + | _ -> + Cil.DoChildren + end + in + Visitor.visitFramacFileSameGlobals o (Ast.get ()); + !l + else + (* ignore function pointers when the option is off *) + [] in match !res with | None -> @@ -147,13 +151,22 @@ let syntactic_compute g = (* call via a function pointer: add an edge from each function which the address is taken to this callee. *) let pointed = get_pointed_kfs () in - let callee = Extlib.the self#current_kf in + let caller = Extlib.the self#current_kf in List.iter - (fun caller -> + (fun callee -> G.add_edge_e g (caller, Extlib.the self#current_stmt, callee)) pointed; Cil.SkipChildren - | _ -> + | Local_init (_,ConsInit(v,_,_),_) -> + let callee = + try Globals.Functions.get v + with Not_found -> assert false + in + let caller = Extlib.the self#current_kf in + G.add_edge_e g (caller, Extlib.the self#current_stmt, callee); + Cil.SkipChildren + | Local_init (_, AssignInit _, _) | Set _ + | Skip _ | Asm _ | Code_annot _ -> (* skip children for efficiency *) Cil.SkipChildren @@ -236,9 +249,15 @@ module Graphviz_attributes = struct let get_subgraph _ = None end +module Subgraph = + Subgraph.Make + (G) + (D) + (struct include State let get = get let vertex kf = kf end) + let dump () = let module GV = Graph.Graphviz.Dot(Graphviz_attributes) in - let g = get () in + let g = Subgraph.get () in Options.dump GV.output_graph g include Journalize.Make @@ -253,6 +272,6 @@ include Journalize.Make (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/cg.mli b/src/plugins/callgraph/cg.mli index 02a00c5f1cc2cfb26b965ad55dc0762eb5346408..6a81308a9ffba9ab6c91a290c5f90ae74e8a5399 100644 --- a/src/plugins/callgraph/cg.mli +++ b/src/plugins/callgraph/cg.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/callgraph/cg_viewer.ml b/src/plugins/callgraph/cg_viewer.ml index d58bbd570d12721b7e794d9c74bffcf72fac8feb..b8dd23b4c651947376bbcaf6184cad93a781616f 100644 --- a/src/plugins/callgraph/cg_viewer.ml +++ b/src/plugins/callgraph/cg_viewer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -136,24 +136,35 @@ let make_graph_view ~packing () = ~packing ?root:(Services.entry_point ()) ~mk_global_view:services_view - (Services.get ()) + (Services.Subgraph.get ()) in view let main (window: Design.main_window_extension_points) = ignore ((window#menu_manager ())#add_plugin - [ Menu_manager.menubar "Show callgraph" - (Menu_manager.Unit_callback (fun () -> - Service_graph.frama_c_display true; - Gtk_helper.graph_window - ~parent:window#main_window ~title:"Callgraph" - make_graph_view)) - ]) + [ Menu_manager.menubar "Show callgraph" + (Menu_manager.Unit_callback (fun () -> + try + (* check existence of the entry point *) + ignore (Globals.entry_point ()); + (* display the callgraph through its dot output *) + Service_graph.frama_c_display true; + Gtk_helper.graph_window + ~parent:window#main_window ~title:"Callgraph" + make_graph_view + with + | Globals.No_such_entry_point _ -> + GToolbox.message_box ~title:"Error: callgraph not available" + "No entry point found: use option '-main' to specify it." + | ex -> + GToolbox.message_box ~title:"Error" + ("Error loading callgraph: " ^ (Printexc.to_string ex)) + ))]) let () = Design.register_extension main (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/journalize.ml b/src/plugins/callgraph/journalize.ml index 8dc17877a40ffe5846308a90a85864d2399f1506..4bd3129b58382bd1a47c7b1f4135dc41b2b34464 100644 --- a/src/plugins/callgraph/journalize.ml +++ b/src/plugins/callgraph/journalize.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/callgraph/journalize.mli b/src/plugins/callgraph/journalize.mli index aec7fe8b5ed0491a84b48d157708ed75803ee82c..c9eed0879807662b6809553eb33591d6293eaf4b 100644 --- a/src/plugins/callgraph/journalize.mli +++ b/src/plugins/callgraph/journalize.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/callgraph/options.ml b/src/plugins/callgraph/options.ml index f8d7c2d4ab565216ff47f0584b35aa2eeee68a79..c780b4ae060e9ca4fc0f637a49350005e87d53aa 100644 --- a/src/plugins/callgraph/options.ml +++ b/src/plugins/callgraph/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,52 +25,73 @@ let name = "callgraph" include Plugin.Register (struct - let name = name - let shortname = "cg" - let help = "automatically compute the callgraph of the program. \ -Using Value might improve the precision of this plug-in" - end) + let name = name + let shortname = "cg" + let help = "automatically compute the callgraph of the program. \ + Using Eva might improve the precision of this plug-in" + end) module Filename = Empty_string (struct - let option_name = "-cg" - let arg_name = "filename" - let help = "dump the callgraph to the file \ -<filename> in dot format" - end) + let option_name = "-cg" + let arg_name = "filename" + let help = "dump the callgraph to the file \ + <filename> in dot format" + end) -module Init_func = +module Roots = Kernel_function_set (struct - let option_name = "-cg-init-func" - let arg_name = "" - let help = "use the given set of functions as root services for the \ -callgraph" - end) + let option_name = "-cg-roots" + let arg_name = "" + let help = "if not empty, display only the functions of the callgraph \ + reachable from the given functions" + end) + +module Service_roots = + Kernel_function_set + (struct + let option_name = "-cg-service-roots" + let arg_name = "" + let help = "when computing the callgraph services (groups of related \ + functions), use the given functions as service roots. \ + If none, use the main function if any; \ + else use every uncalled function" + end) + +module Function_pointers = + True + (struct + let option_name = "-cg-function-pointers" + let help = "when Eva has not been computed, safely over-approximate \ + callees in presence of function pointers; \ + always done when Eva has been previously computed. \ + WARNING: this option is unsound" + end) module Uncalled = True (struct let option_name = "-cg-uncalled" let help = "add the uncalled functions to the callgraph \ -(the main function is always added anyway)" - end) + (the main function is always added anyway)" + end) module Uncalled_leaf = False (struct let option_name = "-cg-uncalled-leaf" - let help = "add to the callgraph the uncalled functions that do not call \ -themselves any function" - end) + let help = "add to the callgraph the uncalled functions that, \ + themselves, do not call any function" + end) module Services = True (struct let option_name = "-cg-services" let help = "compute and display the services from the callgraph" - end) + end) let dump output g = let file = Filename.get () in @@ -86,6 +107,6 @@ let dump output g = (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/options.mli b/src/plugins/callgraph/options.mli index 3c6de81b923d85662a4f749de1f2678cf2efc8d5..adeeddb3a2103364419d5c441b6161d116f03797 100644 --- a/src/plugins/callgraph/options.mli +++ b/src/plugins/callgraph/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -24,7 +24,9 @@ include Plugin.S val name: string module Filename: Parameter_sig.String -module Init_func: Parameter_sig.Kernel_function_set +module Roots: Parameter_sig.Kernel_function_set +module Service_roots: Parameter_sig.Kernel_function_set +module Function_pointers: Parameter_sig.Bool module Uncalled: Parameter_sig.Bool module Uncalled_leaf: Parameter_sig.Bool module Services: Parameter_sig.Bool @@ -34,6 +36,6 @@ val dump: (out_channel -> 'a -> unit) -> 'a -> unit (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/register.ml b/src/plugins/callgraph/register.ml index cd9b1ba81fe90f291a9f540e8b7188f324d7534d..65e50003c7dc1ab76a672f2f743010a99d6bb089 100644 --- a/src/plugins/callgraph/register.ml +++ b/src/plugins/callgraph/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/callgraph/services.ml b/src/plugins/callgraph/services.ml index fbc15ef9289f392c6d839131d82aa535b3fa6023..e2ea015ff8f98a79ac35aa4cc53cfe39b787c4cd 100644 --- a/src/plugins/callgraph/services.ml +++ b/src/plugins/callgraph/services.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,11 +20,28 @@ (* *) (**************************************************************************) -let get_init_funcs main cg = - (* the entry point is always a root *) - let init_funcs = Kernel_function.Set.add main (Options.Init_func.get ()) in - (* Add the callees of entry point as roots *) - Cg.G.fold_succ Kernel_function.Set.add cg main init_funcs +let initial_service_roots cg = + let roots = Options.Service_roots.get () in + let roots = + if Kernel_function.Set.is_empty roots then + (* if possible, use the main function as initial root *) + try Kernel_function.Set.singleton (fst (Globals.entry_point ())) + with Globals.No_such_entry_point _ -> + (* otherwise use every uncalled function *) + Cg.G.fold_vertex + (fun v set -> + if Cg.G.in_degree cg v = 0 then Kernel_function.Set.add v set + else set) + cg + Kernel_function.Set.empty + else + roots + in + (* Add the callees of initial roots as roots *) + Kernel_function.Set.fold + (fun v set -> Cg.G.fold_succ Kernel_function.Set.add cg v set) + roots + roots (* Intermediate module because of Ocaml: "The parameter cannot be eliminated in the result type. @@ -44,8 +61,8 @@ module G_for_S = struct end module S = Service_graph.Make(G_for_S) - module G = S.Service_graph + module Graphviz_attributes = S.TP let entry_point = S.entry_point @@ -63,22 +80,34 @@ let self = State.self let compute () = let cg = Cg.get () in - let init_funcs = get_init_funcs (fst (Globals.entry_point ())) cg in - let init_func_names = + let isr = initial_service_roots cg in + let isr_names = Kernel_function.Set.fold (fun kf acc -> Datatype.String.Set.add (Kernel_function.get_name kf) acc) - init_funcs + isr Datatype.String.Set.empty in - let sg = S.compute cg init_func_names in + let sg = S.compute cg isr_names in State.mark_as_computed (); sg let get () = State.memo compute +let get_services = get let compute () = ignore (compute ()) +module Subgraph = + Subgraph.Make + (G) + (S.Service_graph.Datatype) + (struct + include State + (* do not use [get] because hidden by the above "include" *) + let get = get_services + let vertex = S.vertex + end) + let dump () = - let sg = get () in + let sg = Subgraph.get () in Service_graph.frama_c_display false; Options.dump S.output_graph sg @@ -94,6 +123,6 @@ include Journalize.Make (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/services.mli b/src/plugins/callgraph/services.mli index de00ba1a22a3ff01086c61b9099132d968ba73fb..bc70e8d278ff5d2487f771be582088f3117440ce 100644 --- a/src/plugins/callgraph/services.mli +++ b/src/plugins/callgraph/services.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,6 +31,6 @@ module Graphviz_attributes: Graph.Graphviz.GraphWithDotAttrs (* Local Variables: -compile-command: "make -C ../.." +compile-command: "make -C ../../.." End: *) diff --git a/src/plugins/callgraph/subgraph.ml b/src/plugins/callgraph/subgraph.ml new file mode 100644 index 0000000000000000000000000000000000000000..004bad7426948b5d7a9ded11d85d02f609472b35 --- /dev/null +++ b/src/plugins/callgraph/subgraph.ml @@ -0,0 +1,85 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +module Make + (G: sig + include Graph.Sig.G + val create: ?size:int -> unit -> t + val add_edge_e: t -> E.t -> unit + end) + (D: Datatype.S with type t = G.t) + (Info: sig + val self: State.t + val name: string + val get: unit -> G.t + val vertex: Kernel_function.t -> G.V.t + end) = +struct + + module S = + State_builder.Option_ref + (Datatype.Option(D)) (* none if no root is specified *) + (struct + let name = "Subgraph of " ^ Info.name + let dependencies = [ Info.self; Options.Roots.self ] + end) + + let self = S.self + + let compute = + let module HNodes = Hashtbl.Make(G.V) in + fun () -> + let g = Info.get () in + let roots = Options.Roots.get () in + if Kernel_function.Set.is_empty roots then None + else + let subg = G.create () in + let visited = HNodes.create 17 in + let rec add_component v = + (* iter over the connected component of [v] for adding every edge to + the subgraph *) + if not (HNodes.mem visited v) then begin + HNodes.add visited v (); + G.iter_succ_e + (fun e -> + G.add_edge_e subg e; + add_component (G.E.dst e)) + g + v + end + in + Kernel_function.Set.iter + (fun kf -> add_component (Info.vertex kf)) + roots; + Some subg + + let get () = match S.memo compute with + | None -> Info.get () (* when no root is specified, use the whole graph *) + | Some g -> g + +end + +(* +Local Variables: +compile-command: "make -C ../../.." +End: +*) diff --git a/src/libraries/stdlib/dynlink_native_ok.ml b/src/plugins/callgraph/subgraph.mli similarity index 74% rename from src/libraries/stdlib/dynlink_native_ok.ml rename to src/plugins/callgraph/subgraph.mli index 493783e5b38d1b5a3030f290dff2e6eebf3bbb78..5d62bf48641788d962b1ecceda0e743dc5ccce02 100644 --- a/src/libraries/stdlib/dynlink_native_ok.ml +++ b/src/plugins/callgraph/subgraph.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,20 +20,27 @@ (* *) (**************************************************************************) -(* Implementation of [FCDynlink] compatible with OCaml >=3.11 - whenever [Dynlink] does correctly work. *) - -module type OldDynlink = sig - val loadfile : string -> unit - val allow_unsafe_modules : bool -> unit - val init : unit -> unit - val add_interfaces: string list -> string list -> unit - val digest_interface : string -> string list -> Digest.t +(** Subgraph from a given vertex *) +module Make + (G: sig + (** Graph datastructure *) + include Graph.Sig.G + val create: ?size:int -> unit -> t + val add_edge_e: t -> E.t -> unit + end) + (D: Datatype.S with type t = G.t (** Graph datatype *)) + (Info: sig + (** additional information *) + val self: State.t + val name: string (** name of the state *) + val get: unit -> G.t + val vertex: Kernel_function.t -> G.V.t + end) : +sig + val get: unit -> G.t + val self: State.t end -exception Unsupported_Feature of string -include Dynlink - (* Local Variables: compile-command: "make -C ../../.." diff --git a/src/plugins/callgraph/uses.ml b/src/plugins/callgraph/uses.ml index 6c3ea5b7e42ac3a13f061944981d30c6fa2a38b2..3ed411cb37c5adf9a7ff84a75def3418402d8a7b 100644 --- a/src/plugins/callgraph/uses.ml +++ b/src/plugins/callgraph/uses.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -44,6 +44,12 @@ struct module T = Graph.Topological.Make_stable(G) let iter g f = + (* Warns if [-cg-no-function-pointers] is in effect, which may lead + to unsound analyses for the users of the callgraph. *) + if not (Options.Function_pointers.get ()) then + Options.warning ~once:true "using callgraph while option %s is unset, \ + result may be unsound" + Options.Function_pointers.name; if S.is_empty () then T.iter S.add g; S.iter f @@ -110,6 +116,12 @@ let accept_base ~with_formals ~with_locals kf v = | true , _, Declaration (_, vd, _, _) -> Base.is_formal_of_prototype v vd) || is_local_or_formal_of_caller v kf +let nb_calls () = + let g = Cg.get () in + (* [g] contains bidirectional edges (from caller to callee and + conversely). Conseqently each function call is counted twice. *) + Cg.G.nb_edges g / 2 + (* Local Variables: compile-command: "make -C ../../.." diff --git a/src/plugins/callgraph/uses.mli b/src/plugins/callgraph/uses.mli index 43fee57880a3690bea79698276df2274e0333842..1dbc1700adf770bac7cb233127b5b1fd803b3ac2 100644 --- a/src/plugins/callgraph/uses.mli +++ b/src/plugins/callgraph/uses.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -49,6 +49,11 @@ val accept_base : - a formal or local of one of the callers of [kf] - a formal or local of [kf] and the corresponding argument is [true]. *) +val nb_calls: unit -> int +(** @return the number of function calls in the whole callgraph. It is not + (necessarily) equal to the number of graph edges (depending on the + underlying graph datastructure) *) + (* Local Variables: compile-command: "make -C ../.." diff --git a/src/plugins/constant_propagation/Constant_Propagation.mli b/src/plugins/constant_propagation/Constant_Propagation.mli index 838161556276e21309f3b68d783bbe099f0bf1ce..28b6e3efe07ae89fed8073b47de6b967d3c5a813 100644 --- a/src/plugins/constant_propagation/Constant_Propagation.mli +++ b/src/plugins/constant_propagation/Constant_Propagation.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/constant_propagation/propagationParameters.ml b/src/plugins/constant_propagation/propagationParameters.ml index c75f4ac21e8d02c9c25e8861aedfff48f672b97d..2f00d70484ac7c5910a47c5a09f30a33ea483c2c 100644 --- a/src/plugins/constant_propagation/propagationParameters.ml +++ b/src/plugins/constant_propagation/propagationParameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/constant_propagation/propagationParameters.mli b/src/plugins/constant_propagation/propagationParameters.mli index b62242a915a2a43578f2710abc0596721c0eaabd..f85cc40b526af328f19d690a34839b3fe1da8d6d 100644 --- a/src/plugins/constant_propagation/propagationParameters.mli +++ b/src/plugins/constant_propagation/propagationParameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/constant_propagation/register.ml b/src/plugins/constant_propagation/register.ml index d1055928d2ae555fae365cb2f26e4438294498c7..0419272e5cfb35b84495784b7d6c501d495b38c9 100644 --- a/src/plugins/constant_propagation/register.ml +++ b/src/plugins/constant_propagation/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -149,7 +149,7 @@ class propagate project fnames ~cast_intro = object(self) self#current_kf) in let change_to = match b with - | Base.Var(vi, _) | Base.Allocated (vi, _) + | Base.Var(vi, _) | Base.Allocated (vi, _, _) when not (Base.is_weak b) && can_replace vi -> if vi.vglob && not (Varinfo.Set.mem vi known_globals) then self#add_decl_non_source_var vi; @@ -249,7 +249,7 @@ class propagate project fnames ~cast_intro = object(self) with | Cannot_change -> None | Not_found | Cannot_expand | Cil.Not_representable - | Int_Base.Error_Top as e -> + | Abstract_interp.Error_Top as e -> PropagationParameters.debug "Replacement failed %s" (Printexc.to_string e); None diff --git a/src/plugins/constant_propagation/register.mli b/src/plugins/constant_propagation/register.mli index 4fb08cbc3e33087a4cb5287329cd5f61608f7e73..ffe6895ad13133a4b4014ed2ba1895471de5c67b 100644 --- a/src/plugins/constant_propagation/register.mli +++ b/src/plugins/constant_propagation/register.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/From.mli b/src/plugins/from/From.mli index 4b9a2f7b109b41841bf9ff4691d32f0487389f64..9852cb8d0b3393f42ac41ce9089f5ce873b4b4f6 100644 --- a/src/plugins/from/From.mli +++ b/src/plugins/from/From.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/callwise.ml b/src/plugins/from/callwise.ml index 5c59508b7b59ea7ebd32a62eda61182f22a0628a..2fc9a04e8d47737bd651ff05c5f9d5f040796960 100644 --- a/src/plugins/from/callwise.ml +++ b/src/plugins/from/callwise.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -77,6 +77,14 @@ let call_for_individual_froms (call_type, value_initial_state, call_stack) = "calldeps internal error 23 empty callfromsstack %a" Kernel_function.pretty current_function in + let compute_from_behaviors bhv = + let assigns = Ast_info.merge_assigns bhv in + let froms = + From_compute.compute_using_prototype_for_state + value_initial_state current_function assigns + in + register_from froms + in match call_type with | `Def | `Memexec -> let table_for_calls = Kinstr.Hashtbl.create 7 in @@ -85,12 +93,13 @@ let call_for_individual_froms (call_type, value_initial_state, call_stack) = !call_froms_stack | `Builtin { Value_types.c_from = Some (result,_) } -> register_from result - | `Spec | `Builtin { Value_types.c_from = None } -> - let froms = - From_compute.compute_using_prototype_for_state - value_initial_state current_function + | `Builtin { Value_types.c_from = None } -> + let behaviors = + !Db.Value.valid_behaviors current_function value_initial_state in - register_from froms + compute_from_behaviors behaviors + | `Spec spec -> + compute_from_behaviors spec.Cil_types.spec_behavior end let end_record call_stack froms = diff --git a/src/plugins/from/callwise.mli b/src/plugins/from/callwise.mli index 1d57c77809ab08dcba086475ba7f489de7dc0be7..49d6f475d443b386e56dea11944cdb18e186be13 100644 --- a/src/plugins/from/callwise.mli +++ b/src/plugins/from/callwise.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/from_compute.ml b/src/plugins/from/from_compute.ml index 0cb7fe51fdbc0c68b751706c83f0f9162754c8c4..0b8fee09889c3e88e7803b591e9ab609cf5212ed 100644 --- a/src/plugins/from/from_compute.ml +++ b/src/plugins/from/from_compute.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -68,10 +68,8 @@ and find_deps_lval_no_transitivity state lv = Zone.pretty ind_deps Zone.pretty direct_deps; { Function_Froms.Deps.data = direct_deps; indirect = ind_deps } -let compute_using_prototype_for_state state kf = +let compute_using_prototype_for_state state kf assigns = let varinfo = Kernel_function.get_vi kf in - let behaviors = !Db.Value.valid_behaviors kf state in - let assigns = Ast_info.merge_assigns behaviors in let return_deps,deps = match assigns with | WritesAny -> @@ -322,9 +320,11 @@ struct let new_z = Zone.join old.additional_deps new_.additional_deps in m, new_z, false in - let map, included' = - Function_Froms.Memory.join_and_is_included - new_.deps_table old.deps_table + let map = + Function_Froms.Memory.join new_.deps_table old.deps_table + in + let included' = + Function_Froms.Memory.is_included new_.deps_table old.deps_table in { deps_table = map; additional_deps_table = additional_map; @@ -335,12 +335,14 @@ struct let is_included old new_ = snd (join_and_is_included old new_) (** Handle an assignment [lv = ...], the dependencies of the right-hand - side being stored in [deps_right]. *) - let transfer_assign stmt lv deps_right state = + side being stored in [deps_right]. [init] is true for a local + initialization, in which case the left location is not reduced to its + valid part for a writing, in order to keep the const local variables. *) + let transfer_assign stmt ~init lv deps_right state = (* The assigned location is [loc], whose address is computed from [deps]. *) let deps, loc, exact = - lval_to_precise_loc_with_deps stmt ~for_writing:true lv + lval_to_precise_loc_with_deps stmt ~for_writing:(not init) lv in let deps_of_deps = Function_Froms.Memory.find state.deps_table deps in let all_indirect = Zone.join state.additional_deps deps_of_deps in @@ -349,121 +351,137 @@ struct Function_Froms.Memory.add_binding_precise_loc ~exact state.deps_table loc deps } + let transfer_call stmt dest f args _loc state = + !Db.progress (); + let value_state = To_Use.get_value_state stmt in + let f_deps, called_vinfos = + !Db.Value.expr_to_kernel_function_state + value_state ~deps:(Some Zone.bottom) f + in + (* dependencies for the evaluation of [f] *) + let f_deps = + Function_Froms.Memory.find state.deps_table f_deps + in + let additional_deps = + Zone.join + state.additional_deps + f_deps + in + let args_froms = + List.map + (fun arg -> + (* TODO : dependencies on subfields for structs *) + find stmt state.deps_table arg) + args + in + let states_with_formals = ref [] in + let do_on kf = + let called_vinfo = Kernel_function.get_vi kf in + if Ast_info.is_cea_function called_vinfo.vname then + state + else + let froms_call = To_Use.get_from_call kf stmt in + let froms_call_table = froms_call.Function_Froms.deps_table in + if Function_Froms.Memory.is_bottom froms_call_table then + bottom_from + else + let formal_args = Kernel_function.get_formals kf in + let state_with_formals = ref state.deps_table in + begin try + List.iter2 + (fun vi from -> + state_with_formals := + Function_Froms.Memory.bind_var + vi from !state_with_formals; + ) formal_args args_froms; + with Invalid_argument _ -> + From_parameters.warning ~once:true ~current:true + "variadic call detected. Using only %d argument(s)." + (min + (List.length formal_args) + (List.length args_froms)) + end; + if not (Db.From.Record_From_Callbacks.is_empty ()) + then + states_with_formals := + (kf, !state_with_formals) :: !states_with_formals; + let subst_before_call = + substitute !state_with_formals additional_deps + in + (* From state just after the call, + but before the result assignment *) + let deps_after_call = + let before_call = state.deps_table in + let open Function_Froms in + let subst d = DepsOrUnassigned.subst subst_before_call d in + let call_substituted = Memory.map subst froms_call_table in + Memory.compose call_substituted before_call + in + let state = {state with deps_table = deps_after_call } in + (* Treatement for the possible assignment + of the call result *) + match dest with + | None -> state + | Some lv -> + let return_from = froms_call.Function_Froms.deps_return in + let deps_ret = subst_before_call return_from in + transfer_assign stmt ~init:false lv deps_ret state + in + let f f acc = + let p = do_on f in + match acc with + | None -> Some p + | Some acc_memory -> + Some + {state with + deps_table = Function_Froms.Memory.join + p.deps_table + acc_memory.deps_table} + in + let result = + try + (match Kernel_function.Hptset.fold f called_vinfos None with + | None -> state + | Some s -> s); + with Call_did_not_take_place -> state + in + if not (Db.From.Record_From_Callbacks.is_empty ()) + then + Stmt.Hashtbl.replace + callwise_states_with_formals + stmt + !states_with_formals; + result + let transfer_instr stmt (i: instr) (state: t) = !Db.progress (); match i with | Set (lv, exp, _) -> let comp_vars = find stmt state.deps_table exp in - transfer_assign stmt lv comp_vars state - | Call (lvaloption,funcexp,argl,_) -> - !Db.progress (); - let value_state = To_Use.get_value_state stmt in - let funcexp_deps, called_vinfos = - !Db.Value.expr_to_kernel_function_state - value_state ~deps:(Some Zone.bottom) funcexp - in - (* dependencies for the evaluation of [funcexp] *) - let funcexp_deps = - Function_Froms.Memory.find state.deps_table funcexp_deps - in - let additional_deps = - Zone.join - state.additional_deps - funcexp_deps - in - let args_froms = - List.map - (fun arg -> - (* TODO : dependencies on subfields for structs *) - find stmt state.deps_table arg) - argl - in - let states_with_formals = ref [] in - let do_on kf = - let called_vinfo = Kernel_function.get_vi kf in - if Ast_info.is_cea_function called_vinfo.vname then - state - else - let froms_call = To_Use.get_from_call kf stmt in - let froms_call_table = froms_call.Function_Froms.deps_table in - if Function_Froms.Memory.is_bottom froms_call_table then - bottom_from - else - let formal_args = Kernel_function.get_formals kf in - let state_with_formals = ref state.deps_table in - begin try - List.iter2 - (fun vi from -> - state_with_formals := - Function_Froms.Memory.bind_var - vi from !state_with_formals; - ) formal_args args_froms; - with Invalid_argument _ -> - From_parameters.warning ~once:true ~current:true - "variadic call detected. Using only %d argument(s)." - (min - (List.length formal_args) - (List.length args_froms)) - end; - if not (Db.From.Record_From_Callbacks.is_empty ()) - then - states_with_formals := - (kf, !state_with_formals) :: !states_with_formals; - let subst_before_call = - substitute !state_with_formals additional_deps - in - (* From state just after the call, - but before the result assignment *) - let deps_after_call = - let before_call = state.deps_table in - let open Function_Froms in - let subst d = DepsOrUnassigned.subst subst_before_call d in - let call_substituted = Memory.map subst froms_call_table in - Memory.compose call_substituted before_call - in - let state = {state with deps_table = deps_after_call } in - (* Treatment for the possible assignment - of the call result *) - match lvaloption with - | None -> state - | Some lv -> - let return_from = froms_call.Function_Froms.deps_return in - let deps_ret = subst_before_call return_from in - transfer_assign stmt lv deps_ret state - in - let f f acc = - let p = do_on f in - match acc with - | None -> Some p - | Some acc_memory -> - Some - {state with - deps_table = Function_Froms.Memory.join - p.deps_table - acc_memory.deps_table} - in - let result = - try - (match Kernel_function.Hptset.fold f called_vinfos None with - | None -> state - | Some s -> s); - with Call_did_not_take_place -> state - in - if not (Db.From.Record_From_Callbacks.is_empty ()) - then - Stmt.Hashtbl.replace - callwise_states_with_formals - stmt - !states_with_formals; - result - | _ -> state + transfer_assign stmt ~init:false lv comp_vars state + | Local_init(v, AssignInit i, _) -> + let implicit = true in + let rec aux lv i acc = + let doinit o i _ state = aux (Cil.addOffsetLval o lv) i state in + match i with + | SingleInit e -> + let comp_vars = find stmt acc.deps_table e in + transfer_assign stmt ~init:true lv comp_vars acc + | CompoundInit (ct, initl) -> + Cil.foldLeftCompound ~implicit ~doinit ~ct ~initl ~acc + in + aux (Cil.var v) i state + | Call (lvaloption,funcexp,argl,loc) -> + transfer_call stmt lvaloption funcexp argl loc state + | Local_init (v, ConsInit(f, args, kind), loc) -> + Cil.treat_constructor_as_func + (transfer_call stmt) v f args kind loc state + | Asm _ | Code_annot _ | Skip _ -> state let transfer_guard s e d = let value_state = To_Use.get_value_state s in - let interpreted_e = - !Db.Value.eval_expr ~with_alarms:CilE.warn_none_mode value_state e - in + let interpreted_e = !Db.Value.eval_expr value_state e in let t1 = unrollType (typeOf e) in let do_then, do_else = if isIntegralType t1 || isPointerType t1 @@ -639,7 +657,9 @@ struct let compute_using_prototype kf = let state = Db.Value.get_initial_state kf in - compute_using_prototype_for_state state kf + let behaviors = !Db.Value.valid_behaviors kf state in + let assigns = Ast_info.merge_assigns behaviors in + compute_using_prototype_for_state state kf assigns let compute_and_return kf = let call_site_loc = CurrentLoc.get () in diff --git a/src/plugins/from/from_compute.mli b/src/plugins/from/from_compute.mli index 8daa78f2989bf831b95c1e0dea2077f075723444..2ca8d3262b67bc213cd210f32dde19fb5a92bbf1 100644 --- a/src/plugins/from/from_compute.mli +++ b/src/plugins/from/from_compute.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -48,7 +48,10 @@ end (** Function that compute the Froms from a given prototype, called in the given state *) val compute_using_prototype_for_state : - Db.Value.state -> Kernel_function.t -> Function_Froms.froms + Db.Value.state -> + Kernel_function.t -> + assigns -> + Function_Froms.froms (** Direct computation of the dependencies on expressions, offsets and diff --git a/src/plugins/from/from_parameters.ml b/src/plugins/from/from_parameters.ml index b362cd591ec5d27f31d1a95779a2760d9903ddcc..f7099f7f20f0d2c4867977348fcaf91ab4aaaabf 100644 --- a/src/plugins/from/from_parameters.ml +++ b/src/plugins/from/from_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/from_parameters.mli b/src/plugins/from/from_parameters.mli index 8d7c9a31de0f902a762a58efcf9ec1c202b86537..89f99d541c2b95096e093d4834d448128d868ea3 100644 --- a/src/plugins/from/from_parameters.mli +++ b/src/plugins/from/from_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/from_register.ml b/src/plugins/from/from_register.ml index 34bc8667ab999f4ae8a5994b3a5fb973f548b9d5..8be51ec6de22370a961ad2daaef9cc6876668ec2 100644 --- a/src/plugins/from/from_register.ml +++ b/src/plugins/from/from_register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -92,6 +92,34 @@ let main () = let not_quiet = From_parameters.verbose_atleast 1 in let forcedeps = From_parameters.ForceDeps.get () in let forcecalldeps = From_parameters.ForceCallDeps.get () in + let treat_call s funtype = + let caller = Kernel_function.find_englobing_kf s in + let f, typ_f = + if !Db.Value.no_results (Kernel_function.get_definition caller) + then "<unknown>", funtype + else + try + let set = Db.Value.call_to_kernel_function s in + let kf = Kernel_function.Hptset.choose set in + Pretty_utils.to_string Kernel_function.pretty kf, + Kernel_function.get_type kf + with + | Not_found -> + From_parameters.fatal + ~source:(fst (Cil_datatype.Stmt.loc s)) + "Invalid call %a@." Printer.pp_stmt s + in + (fun fmt -> + Format.fprintf fmt "@[call to %s at %a (by %a)%t:@]" + f + Cil_datatype.Location.pretty (Cil_datatype.Stmt.loc s) + Kernel_function.pretty caller + (fun fmt -> + if From_parameters.debug_atleast 1 then + Format.fprintf fmt " <sid %d>" s.Cil_types.sid) + ), + typ_f + in if forcedeps then begin !Db.From.compute_all (); From_parameters.ForceDeps.output @@ -111,37 +139,13 @@ These dependencies hold at termination for the executions that terminate:"; (fun ki d -> let header, typ = match ki with - | Cil_types.Kglobal -> + | Kglobal -> (fun fmt -> Format.fprintf fmt "@[entry point:@]"), Kernel_function.get_type (fst (Globals.entry_point ())) - | Cil_types.Kstmt ({skind = Instr (Call (_, ekf, _, _))} as s) -> - let caller = Kernel_function.find_englobing_kf s in - let f, typ_f = - if !Db.Value.no_results (Kernel_function.get_definition caller) - then - "<unknown>", (Cil.typeOf ekf) - else - try - let set = Db.Value.call_to_kernel_function s in - let kf = Kernel_function.Hptset.choose set in - Pretty_utils.to_string Kernel_function.pretty kf, - Kernel_function.get_type kf - with - | Not_found -> - From_parameters.fatal - ~source:(fst (Cil_datatype.Stmt.loc s)) - "Invalid call %a@." Printer.pp_stmt s - in - (fun fmt -> - Format.fprintf fmt "@[call to %s at %a (by %a)%t:@]" - f - Cil_datatype.Location.pretty (Cil_datatype.Stmt.loc s) - Kernel_function.pretty caller - (fun fmt -> - if From_parameters.debug_atleast 1 then - Format.fprintf fmt " <sid %d>" s.Cil_types.sid) - ), - typ_f + | Kstmt ({skind = Instr (Call (_, ekf, _, _))} as s) -> + treat_call s (Cil.typeOf ekf) + | Kstmt ({skind = Instr (Local_init(_,ConsInit(f,_,_),_))} as s)-> + treat_call s f.vtype | _ -> assert false (* Not a call *) in From_parameters.printf ~header diff --git a/src/plugins/from/from_register.mli b/src/plugins/from/from_register.mli index 3eb393ce4ef33372b877d582b77df6a41c1b68bb..5f4e77acc8796e011349b04a770a4f331ca7f6f8 100644 --- a/src/plugins/from/from_register.mli +++ b/src/plugins/from/from_register.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/from_register_gui.ml b/src/plugins/from/from_register_gui.ml index 5ac0f08da602aa99ae6aee383c265bedf4e7f151..94bab17f9112fdc7e9d631fe136c2679bd84db16 100644 --- a/src/plugins/from/from_register_gui.ml +++ b/src/plugins/from/from_register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/from_register_gui.mli b/src/plugins/from/from_register_gui.mli index 288af5aaac5a7bb0389283edcd2fd77c203acca0..912884b8f474496bb3709f362d6f159b67709419 100644 --- a/src/plugins/from/from_register_gui.mli +++ b/src/plugins/from/from_register_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/from/functionwise.ml b/src/plugins/from/functionwise.ml index b1d8847f44eb3d21fedc9b685d990090caaa11cf..33ccac98443c4ece9fbe35f5fb00808569d81983 100644 --- a/src/plugins/from/functionwise.ml +++ b/src/plugins/from/functionwise.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -70,7 +70,7 @@ module To_Use = struct let zone_substitution x = try zone_substitution x - with Zone.Error_Top -> Zone.top + with Abstract_interp.Error_Top -> Zone.top in let map_zone = Function_Froms.Deps.map zone_substitution in let subst = Function_Froms.DepsOrUnassigned.subst map_zone in @@ -114,6 +114,8 @@ let () = let state = Db.Value.get_stmt_state stmt in let deps = From_compute.find_deps_no_transitivity state lv in Function_Froms.Deps.to_zone deps); + (* Once this function has been moved to Eva, remove the dependency of Inout + from From. *) Db.From.find_deps_no_transitivity_state := (fun s e -> let deps = From_compute.find_deps_no_transitivity s e in diff --git a/src/plugins/from/functionwise.mli b/src/plugins/from/functionwise.mli index 88182001424c78e27b9df0b735c83e10d8217be6..3f387374b19c3c9d2a2e25231015906de9e526bb 100644 --- a/src/plugins/from/functionwise.mli +++ b/src/plugins/from/functionwise.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/analyses_manager.ml b/src/plugins/gui/analyses_manager.ml index 382d5898576183d5e335be53aa35fd5f1f2b4293..946507909f8a16243edb0f3fdcb187f40ac2e631 100644 --- a/src/plugins/gui/analyses_manager.ml +++ b/src/plugins/gui/analyses_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/analyses_manager.mli b/src/plugins/gui/analyses_manager.mli index baae90d1b9984ffb93654a97b8a2a1941d98ee71..30ff3182c01ba8a9447c127e3541e5f6eab46234 100644 --- a/src/plugins/gui/analyses_manager.mli +++ b/src/plugins/gui/analyses_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/book_manager.ml b/src/plugins/gui/book_manager.ml index 17ba1b7fdf3ad4d17b87346e22b0888f11a52c2e..2fb8af1fc2aa02399ffaebc83312374a44187b3c 100644 --- a/src/plugins/gui/book_manager.ml +++ b/src/plugins/gui/book_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/book_manager.mli b/src/plugins/gui/book_manager.mli index 09ca796e2632c6f068cc44f5002935fe3ddb87d1..598239fb2b1c917f5d1d1cde51ac080532c6e9dd 100644 --- a/src/plugins/gui/book_manager.mli +++ b/src/plugins/gui/book_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/debug_manager.ml b/src/plugins/gui/debug_manager.ml index 9227cd1fa2f72c3663a82a94ec6561f63888b3ba..b7be20ea07e018bcdd9f2bdfbce3ccd66a966e55 100644 --- a/src/plugins/gui/debug_manager.ml +++ b/src/plugins/gui/debug_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/debug_manager.mli b/src/plugins/gui/debug_manager.mli index baae90d1b9984ffb93654a97b8a2a1941d98ee71..30ff3182c01ba8a9447c127e3541e5f6eab46234 100644 --- a/src/plugins/gui/debug_manager.mli +++ b/src/plugins/gui/debug_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/design.ml b/src/plugins/gui/design.ml index 868a66fd4db267685a039a592bfab22202490fdb..7a3d66fece6c0fa792f1ef37ce9d6bd4f75ee296 100644 --- a/src/plugins/gui/design.ml +++ b/src/plugins/gui/design.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,6 +28,7 @@ open Pretty_source open Gtk_helper let dkey = Gui_parameters.register_category "design" +let dkey_scroll = Gui_parameters.register_category "scroll" let use_external_viewer = false @@ -333,6 +334,7 @@ let print_code_annotations (main_ui:main_window_extension_points) kf stmt = let print_call_preconditions (main_ui: main_window_extension_points) stmt = let by_ptr_call = match stmt.skind with | Instr (Call (_, e, _, _)) -> Some (Kernel_function.get_called e = None) + | Instr (Local_init (_, ConsInit _, _)) -> Some false | _ -> None in match by_ptr_call with @@ -362,6 +364,15 @@ let to_do_on_select ~button selected = + let view_original ?loc stmt = + Gui_parameters.debug ~dkey:dkey_scroll + "view_original: %a, stmt id %d" + (Pretty_utils.pp_opt ~none:"None" Printer.pp_location) loc + stmt.sid; + match loc with + | None -> main_ui#view_original_stmt stmt + | Some loc -> main_ui#view_original loc; loc + in let current_statement_msg ?loc kf stmt = main_ui#pretty_information "Function: %t@." @@ -371,12 +382,7 @@ let to_do_on_select match stmt with | Kglobal -> main_ui#pretty_information "@." | Kstmt s -> - let loc = match loc with - | None -> main_ui#view_original_stmt s - | Some loc -> - main_ui#view_original loc; - loc - in + let loc = view_original ?loc s in if main_ui#show_ids then main_ui#pretty_information "Statement: %d (%a)@.@." s.sid Printer.pp_location loc @@ -488,9 +494,15 @@ let to_do_on_select | PLval (kf, ki,lv) -> let ty = typeOfLval lv in - if isFunctionType ty then + if isFunctionType ty then begin + begin + match ki with + | Kstmt s -> ignore (view_original s) + | Kglobal -> (); + end; main_ui#pretty_information "This is a C function of type `%a'@." Gui_printers.pp_typ ty + end else begin current_statement_msg kf ki; match lv with @@ -521,9 +533,18 @@ let to_do_on_select let typ = typeOf e in match constFoldToInt e with | Some i -> + begin match e.enode with + | Const (CEnum {eihost}) -> + let typ_enum = TEnum (eihost, []) in + main_ui#pretty_information + "This is a C enumeration constant, \ + defined in %a with a value of %a.@." + Gui_printers.pp_typ typ_enum Abstract_interp.Int.pretty i + | _ -> main_ui#pretty_information "This is a constant C expression of type %a, equal to %a.@." - Gui_printers.pp_typ typ Datatype.Integer.pretty i + Gui_printers.pp_typ typ Abstract_interp.Int.pretty i + end | None -> main_ui#pretty_information "This is a pure C expression of type %a.@." Gui_printers.pp_typ typ @@ -534,7 +555,7 @@ let to_do_on_select Printer.pp_logic_type (Cil.typeOfTermLval tlv); main_ui#view_original (Property.location ip) - | PVDecl (kf,vi) -> + | PVDecl (kf,_,vi) -> main_ui#view_original vi.vdecl; if vi.vglob then @@ -560,6 +581,7 @@ let to_do_on_select match go_to_definition selected main_ui with | None -> () (* no menu to show *) | Some (vi, callback) -> + if vi.vsource then ignore (menu_factory#add_item ("Go to definition of " ^ (Pretty_utils.escape_underscores @@ -688,6 +710,19 @@ struct | F.Invalid_under_hyp -> "invalid_under_hyp" | F.Inconsistent -> "inconsistent" + let long_category = function + | F.Never_tried -> "Never tried: no status is available for this property" + | F.Considered_valid -> "Considered valid: this is a hypothesis that shall be verified outside Frama-C" + | F.Valid -> "Surely valid: verified (including all of its dependencies)" + | F.Invalid -> "Surely invalid: refuted (and all of its dependencies have been verified)" + | F.Invalid_but_dead -> "Invalid but dead: refuted, but unreachable" + | F.Valid_but_dead -> "Valid but dead: verified, but unreachable" + | F.Unknown_but_dead -> "Unknown but dead: unknown status, and unreachable" + | F.Unknown -> "Unknown: a verification has been attempted, but without conclusion" + | F.Valid_under_hyp -> "Valid under hypotheses: verified (but has dependencies with Unknown status)" + | F.Invalid_under_hyp -> "Invalid under hypotheses: refuted (but has dependencies with Unknown status)" + | F.Inconsistent -> "Inconsistent: got both true and false statuses (possibly cyclic dependencies, or an incorrect axiomatization)" + let declare_markers (source:GSourceView2.source_view) = List.iter (fun v -> @@ -706,12 +741,16 @@ struct F.Invalid_under_hyp; F.Inconsistent ] + (* tooltip marks are recreated whenever the buffer changes *) + let tooltip_marks : (int, string) Hashtbl.t = Hashtbl.create 8 + let mark (source:GSourceView2.source_buffer) ~offset validity = begin let iter = source#get_iter_at_char offset in let category = category validity in source#remove_source_marks iter iter () ; ignore (source#create_source_mark ~category iter) ; + Hashtbl.replace tooltip_marks iter#line (long_category validity); end end @@ -868,6 +907,28 @@ class main_window () : main_window_extension_points = begin source_viewer#set_show_line_numbers false ; source_viewer#set_show_line_marks true ; + let _ = + source_viewer#event#connect#motion_notify ~callback: + (fun ev -> + let x = GdkEvent.Motion.x ev in + if x < 20.0 (* roughly the width of the left bar *) then begin + let y = GdkEvent.Motion.y ev in + let (xbuf, ybuf) = source_viewer#window_to_buffer_coords + ~tag:`WIDGET ~x:(int_of_float x) ~y:(int_of_float y) + in + let iterpos = source_viewer#get_iter_at_location xbuf ybuf in + let line = iterpos#line in + if Hashtbl.mem Feedback.tooltip_marks line then begin + let text = Hashtbl.find Feedback.tooltip_marks line in + source_viewer#misc#set_has_tooltip true; + source_viewer#misc#set_tooltip_text text; + end else begin + source_viewer#misc#set_has_tooltip false; + end + end else + source_viewer#misc#set_has_tooltip false; + ; false) + in Feedback.declare_markers source_viewer ; end in @@ -1054,6 +1115,8 @@ class main_window () : main_window_extension_points = scroll to [loc]. Otherwise, open a relevant buffer by finding a varinfo or a global for [loc], then scroll to [loc]. *) method scroll loc = + Gui_parameters.debug ~dkey:dkey_scroll + "main_ui: scroll: localizable %a" Pretty_source.Localizable.pretty loc; (* Used to avoid having two different history events, one created by [select_global], the other by [scroll] *) let history = History.on_current_history () in @@ -1102,6 +1165,8 @@ class main_window () : main_window_extension_points = ignore (self#view_original_stmt stmt) method view_original loc = + Gui_parameters.debug ~dkey:dkey_scroll + "main_ui: view_original: location %a" Location.pretty loc; if not (Location.equal loc Location.unknown) then Source_manager.load_file self#original_source_viewer @@ -1111,42 +1176,41 @@ class main_window () : main_window_extension_points = match olocz with | None -> () | Some locz -> - let scroll_to_locz locz = - Wutil.later (fun () -> - (* Prevent filetree selector from resetting the - original source viewer. *) - Source_manager.selection_locked := true; - self#scroll locz; - (* The selection lock is asynchronously released by a - callback, and cannot be released here. *) - ) - in - match locz with - | PVDecl (_okf, vi) -> - (* if it is a global variable, show it instead of the current function *) - begin - try - ignore (Globals.Vars.find vi); - let glob = GVarDecl (vi, loc) in - Wutil.later (fun () -> - Source_manager.selection_locked := true; - self#select_or_display_global glob; - ) - with - | Not_found -> - (* not a global variable, treat as usual *) - scroll_to_locz locz - end - | PGlobal g -> - (* if it is a type declaration/definition, ignore it, since - types are not displayed in the file tree *) - begin - match g with - | GType _ | GCompTag _ | GCompTagDecl _ | GEnumTag _ - | GEnumTagDecl _ -> () - | _ -> scroll_to_locz locz - end - | _ -> scroll_to_locz locz + let scroll_to_locz locz = + Wutil.later (fun () -> + (* Prevent filetree selector from resetting the + original source viewer. *) + Source_manager.selection_locked := true; + self#scroll locz; + (* The selection lock is asynchronously released by a + callback, and cannot be released here. *) + ) + in + match locz with + | PVDecl (_okf, _, vi) -> begin + (* if it is a global variable, show it instead of the + current function *) + try + ignore (Globals.Vars.find vi); + let glob = GVarDecl (vi, loc) in + Wutil.later (fun () -> + Source_manager.selection_locked := true; + self#select_or_display_global glob; + ) + with + | Not_found -> + (* not a global variable, treat as usual *) + scroll_to_locz locz + end + | PGlobal g -> begin + (* if it is a type declaration/definition, ignore it, since + types are not displayed in the file tree *) + match g with + | GType _ | GCompTag _ | GCompTagDecl _ | GEnumTag _ + | GEnumTagDecl _ -> () + | _ -> scroll_to_locz locz + end + | _ -> scroll_to_locz locz ) () @@ -1300,7 +1364,7 @@ class main_window () : main_window_extension_points = let text = if use_dialog then Extlib.opt_conv "" - (GToolbox.input_string + (Gtk_helper.input_string ~title:"Find" ~ok:"Find" ~cancel:"Cancel" "Find global:" ~text:last_find_text) else last_find_text @@ -1343,7 +1407,7 @@ class main_window () : main_window_extension_points = let text = if use_dialog then Extlib.opt_conv "" - (GToolbox.input_string + (Gtk_helper.input_string ~title:"Find" ~ok:"Find" ~cancel:"Cancel" ("Find text (" ^ where_to_find ^ "):") ~text:last_find_text) else last_find_text @@ -1444,6 +1508,10 @@ class main_window () : main_window_extension_points = Extlib.may (fun pos -> Extlib.may self#scroll (Pretty_source.loc_to_localizable pos); + (* Note: the code below generates double scrolling: + the previous call to self#scroll causes the original source + viewer to scroll to the beginning of the function, and then + the code below re-scrolls it to the exact location. *) self#view_original (pos,pos)) e.Log.evt_source in diff --git a/src/plugins/gui/design.mli b/src/plugins/gui/design.mli index 706249837d75ca4255d03f8b2b35da6d7ef3d7ed..8ee8e8cac056ae419c4d49619f546f5ef776869e 100644 --- a/src/plugins/gui/design.mli +++ b/src/plugins/gui/design.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/file_manager.ml b/src/plugins/gui/file_manager.ml index d4d0173ced66b32f96da54ab9f3dd2738882e62b..f50d33e31389f15cfa4bde812e71eb0abe59aa24 100644 --- a/src/plugins/gui/file_manager.ml +++ b/src/plugins/gui/file_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/file_manager.mli b/src/plugins/gui/file_manager.mli index baae90d1b9984ffb93654a97b8a2a1941d98ee71..30ff3182c01ba8a9447c127e3541e5f6eab46234 100644 --- a/src/plugins/gui/file_manager.mli +++ b/src/plugins/gui/file_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/filetree.ml b/src/plugins/gui/filetree.ml index f32f90eb9c58681470d07eddf286a1a9cc788d1d..9273c6e03392a96648665234a4bbfe7da9b11d5e 100644 --- a/src/plugins/gui/filetree.ml +++ b/src/plugins/gui/filetree.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -255,7 +255,8 @@ module MYTREE = struct Filepath.is_relative ~base:Config.datadir filename let is_stdlib_global g = - Cil.hasAttribute "fc_stdlib" (Cil_datatype.Global.attr g) + Cil.hasAttribute "fc_stdlib" (Cil_datatype.Global.attr g) || + Cil.hasAttribute "fc_stdlib_generated" (Cil_datatype.Global.attr g) let is_function t = match t with | MFile _ -> false diff --git a/src/plugins/gui/filetree.mli b/src/plugins/gui/filetree.mli index 21f534cef98ff7fdb6ac8457a412968bef0772ca..25201371bb1f4fcdad3b3f82eefe3ab4d89f8a89 100644 --- a/src/plugins/gui/filetree.mli +++ b/src/plugins/gui/filetree.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/gtk_form.ml b/src/plugins/gui/gtk_form.ml index 1e8d87e8f7bad3568bbfdf91a71f4ec455b2a8af..c406ed706b8849f6e4c5d4fa618d88520d4c077c 100644 --- a/src/plugins/gui/gtk_form.ml +++ b/src/plugins/gui/gtk_form.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/gtk_form.mli b/src/plugins/gui/gtk_form.mli index b8886a7cc3bed69e951279277b990425dc210915..9b3e5975f07c10f5e98b2e722d3e49bb3cc6b464 100644 --- a/src/plugins/gui/gtk_form.mli +++ b/src/plugins/gui/gtk_form.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/gtk_helper.ml b/src/plugins/gui/gtk_helper.ml index f7c9bca1f0ea224f88ff0357b15bc114ee7df5f1..273c78b2c1f7aaf6b0aacb2d7666913c7b057f7d 100644 --- a/src/plugins/gui/gtk_helper.ml +++ b/src/plugins/gui/gtk_helper.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -697,6 +697,59 @@ struct cview end +(* NOTE: this code has been copied from lablgtk's gToolbox.ml to + allow binding the behavior of "keypad enter" to the "return" key *) +let input_widget ~widget ~event ~get_text ~bind_ok ~expand + ~title ?(ok="Ok") ?(cancel="Cancel") message = + let retour = ref None in + let window = GWindow.dialog ~title ~modal:true () in + ignore (window#connect#destroy ~callback: GMain.Main.quit); + let main_box = window#vbox in + let hbox_boutons = window#action_area in + let vbox_saisie = GPack.vbox ~packing: (main_box#pack ~expand: true) () in + ignore (GMisc.label ~text:message ~packing:(vbox_saisie#pack ~padding:3) ()); + vbox_saisie#pack widget ~expand ~padding: 3; + let wb_ok = GButton.button ~label: ok + ~packing: (hbox_boutons#pack ~expand: true ~padding: 3) () in + wb_ok#grab_default (); + let wb_cancel = GButton.button ~label: cancel + ~packing: (hbox_boutons#pack ~expand: true ~padding: 3) () in + let f_ok () = + retour := Some (get_text ()) ; + window#destroy () + in + let f_cancel () = + retour := None; + window#destroy () + in + ignore (wb_ok#connect#clicked f_ok); + ignore (wb_cancel#connect#clicked f_cancel); + (* the enter key is linked to the ok action *) + (* the escape key is linked to the cancel action *) + ignore (event#connect#key_press ~callback: + begin fun ev -> + if (GdkEvent.Key.keyval ev = GdkKeysyms._Return || + GdkEvent.Key.keyval ev = GdkKeysyms._KP_Enter) && bind_ok + then f_ok (); + if GdkEvent.Key.keyval ev = GdkKeysyms._Escape then f_cancel (); + false + end); + widget#misc#grab_focus (); + window#show (); + GMain.Main.main (); + !retour + +(* NOTE: this code has been copied from lablgtk's gToolbox.ml to + allow binding the behavior of "keypad enter" to the "return" key *) +let input_string ~title ?ok ?cancel ?(text="") message = + let we_chaine = GEdit.entry ~text () in + if text <> "" then + we_chaine#select_region 0 (we_chaine#text_length); + input_widget ~widget:we_chaine#coerce ~event:we_chaine#event + ~get_text:(fun () -> we_chaine#text) ~bind_ok:true + ~expand: false + ~title ?ok ?cancel message + (* ************************************************************************** *) (** {2 Error manager} *) (* ************************************************************************** *) diff --git a/src/plugins/gui/gtk_helper.mli b/src/plugins/gui/gtk_helper.mli index 21ba828186bf10870357ce1a2c05ef95c83e1915..ba05c301191b9e247359f9578bf95fe872a33cd9 100644 --- a/src/plugins/gui/gtk_helper.mli +++ b/src/plugins/gui/gtk_helper.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -410,6 +410,12 @@ module MAKE_CUSTOM_LIST(A : sig type t end) GTree.view_column end +(** Copied from lablgtk [GToolbox.input_string]. See the lablgtk API for more + details. *) +val input_string : + title:string -> + ?ok:string -> ?cancel:string -> ?text:string -> string -> string option + (** Create a new window displaying a graph. @plugin development guide *) val graph_window: diff --git a/src/plugins/gui/gui_parameters.ml b/src/plugins/gui/gui_parameters.ml index b4f154b1b6754c11122dcd40152eac4fd3d91e49..431ffedcd39afec5f4b25f62a209287cbd00d7d2 100644 --- a/src/plugins/gui/gui_parameters.ml +++ b/src/plugins/gui/gui_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/gui_parameters.mli b/src/plugins/gui/gui_parameters.mli index c59d4f74caf2736f86c2b2cfdf6609befe1a908b..a21b3acecac1b18eac122c9becf43491b51c3e90 100644 --- a/src/plugins/gui/gui_parameters.mli +++ b/src/plugins/gui/gui_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/gui_printers.ml b/src/plugins/gui/gui_printers.ml index c5b99a62708936581c96cffa156006421f81897e..8f0fc410b21bb5d1654a88597458d64c12e1a03d 100644 --- a/src/plugins/gui/gui_printers.ml +++ b/src/plugins/gui/gui_printers.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/gui_printers.mli b/src/plugins/gui/gui_printers.mli index e01082caae1f29d1e22c0e73a0aa4fad475ba023..30d4ef3d96387ec0894452fd3ccfdb6add33269f 100644 --- a/src/plugins/gui/gui_printers.mli +++ b/src/plugins/gui/gui_printers.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/help_manager.ml b/src/plugins/gui/help_manager.ml index 91044fa3a652e83e087fab4496feb7692100cb6e..e7178fde191adf87e2c9edbd5e52c0abfd2cac24 100644 --- a/src/plugins/gui/help_manager.ml +++ b/src/plugins/gui/help_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -22,6 +22,8 @@ let show main_ui = let authors = [ + "Michele Alberti"; + "Gergö Barany"; "Patrick Baudin"; "François Bobot"; "Richard Bonichon"; @@ -33,6 +35,8 @@ let show main_ui = "Jean-Christophe Filliâtre"; "Philippe Herrmann"; "Florent Kirchner"; + "Tristan Le Gall"; + "Jean-Christophe Léchenet"; "Matthieu Lemerre"; "David Maison"; "Claude Marché"; @@ -46,6 +50,7 @@ let show main_ui = "Armand Puccetti"; "Muriel Roger"; "Julien Signoles"; + "Kostyantyn Vorobyov"; "Boris Yakobowski" ] in diff --git a/src/plugins/gui/help_manager.mli b/src/plugins/gui/help_manager.mli index baae90d1b9984ffb93654a97b8a2a1941d98ee71..30ff3182c01ba8a9447c127e3541e5f6eab46234 100644 --- a/src/plugins/gui/help_manager.mli +++ b/src/plugins/gui/help_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/history.ml b/src/plugins/gui/history.ml index badc51ebb0593ce6cf098f56904036e544d28024..38a3d62729b7a0ede03f66dc2d67153e832630bb 100644 --- a/src/plugins/gui/history.ml +++ b/src/plugins/gui/history.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -212,8 +212,8 @@ let translate_history_elt old_helt = GCompTag( {corig_name = new_name}, new_loc)) | (GCompTagDecl( {corig_name = old_name}, old_loc), GCompTagDecl( {corig_name = new_name}, new_loc)) - | (GVarDecl( {vorig_name = old_name}, old_loc), - GVarDecl( {vorig_name = new_name}, new_loc)) + | (GVarDecl( {vorig_name = old_name}, old_loc), + GVarDecl( {vorig_name = new_name}, new_loc)) | (GFunDecl(_, {vorig_name = old_name}, old_loc), GFunDecl(_, {vorig_name = new_name}, new_loc)) | (GVar( {vorig_name = old_name},_, old_loc), @@ -254,7 +254,7 @@ let translate_history_elt old_helt = match old_helt with | Global old_g -> global_Global old_g | Localizable (PGlobal old_g) -> global_Global old_g - | Localizable(PVDecl(Some kf,_)) -> + | Localizable(PVDecl(Some kf,_,_)) -> global_Global (kf_to_global kf) | Localizable ( PStmt(kf,_) | PLval(Some kf,_,_) | PExp(Some kf,_,_) | PTermLval(Some kf,_,_,_) as loc) -> @@ -292,7 +292,7 @@ let translate_history_elt old_helt = end end | Localizable (PLval(None,_,_) | PExp(None,_,_) | PTermLval(None,_,_,_) - | PVDecl(None,_)) -> (** no names useful? *) None + | PVDecl(None,_,_)) -> (** no names useful? *) None | Localizable (PIP _ ) -> (** no names available *) None (* diff --git a/src/plugins/gui/history.mli b/src/plugins/gui/history.mli index 22f527e896991a5883fbd0ca2b2612d57f465036..48858c0caae03982a882ca31520e55409f187b35 100644 --- a/src/plugins/gui/history.mli +++ b/src/plugins/gui/history.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/launcher.ml b/src/plugins/gui/launcher.ml index 2b04f292058bebab52bc6000eb82d15c90ce8336..053299750f0824701ba4310ffcf7e0392aa40d8f 100644 --- a/src/plugins/gui/launcher.ml +++ b/src/plugins/gui/launcher.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/launcher.mli b/src/plugins/gui/launcher.mli index c9affad4199f088e8a56ef2b0473717470807eba..1f98f41020fe51c56a555b544cbe7bdaa6b6ae14 100644 --- a/src/plugins/gui/launcher.mli +++ b/src/plugins/gui/launcher.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/menu_manager.ml b/src/plugins/gui/menu_manager.ml index 05a20b2cb44d8172c7b536e0fa6751a0e40bfa35..b0fd483069f520eb61ca3f5be283cbdb2ce7a61c 100644 --- a/src/plugins/gui/menu_manager.ml +++ b/src/plugins/gui/menu_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/menu_manager.mli b/src/plugins/gui/menu_manager.mli index 54f6d65801ac1a26e4272c078adfc2a1084e423b..9e1e78135857767e50bf46fb0594cf0d0ced47bd 100644 --- a/src/plugins/gui/menu_manager.mli +++ b/src/plugins/gui/menu_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/pretty_source.ml b/src/plugins/gui/pretty_source.ml index c23397c31c5b8e069cb0cfaff2ca8d8044419931..07751a45dbc6ce34f8c3f8ca8598d382d3b4b245 100644 --- a/src/plugins/gui/pretty_source.ml +++ b/src/plugins/gui/pretty_source.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -33,7 +33,7 @@ type localizable = | PLval of (kernel_function option * kinstr * lval) | PExp of (kernel_function option * kinstr * exp) | PTermLval of (kernel_function option * kinstr * Property.t * term_lval) - | PVDecl of (kernel_function option * varinfo) + | PVDecl of (kernel_function option * kinstr * varinfo) | PGlobal of global | PIP of Property.t module Localizable = @@ -51,7 +51,7 @@ module Localizable = Kinstr.equal ki1 ki2 && Property.equal pi1 pi2 && Logic_utils.is_same_tlval lv1 lv2 (* [JS 2008/01/21] term_lval are not shared: cannot use == *) - | PVDecl (_,v1), PVDecl (_,v2) -> Varinfo.equal v1 v2 + | PVDecl (_,_,v1), PVDecl (_,_,v2) -> Varinfo.equal v1 v2 | PExp (_,_,e1), PExp(_,_,e2) -> Cil_datatype.Exp.equal e1 e2 | PIP ip1, PIP ip2 -> Property.equal ip1 ip2 | PGlobal g1, PGlobal g2 -> Cil_datatype.Global.equal g1 g2 @@ -59,22 +59,25 @@ module Localizable = | PIP _ | PGlobal _), _ -> false let mem_project = Datatype.never_any_project + let pp_ki_loc fmt ki = + match ki with + | Kglobal -> (* no location, print 'global' *) + Format.fprintf fmt "global" + | Kstmt st -> + Format.fprintf fmt "%a" Cil_datatype.Location.pretty (Stmt.loc st) let pretty fmt = function | PStmt (_, s) -> Format.fprintf fmt "LocalizableStmt %d (%a)" s.sid Printer.pp_location (Cil_datatype.Stmt.loc s) | PLval (_, ki, lv) -> Format.fprintf fmt "LocalizableLval %a (%a)" - Printer.pp_lval lv - Cil_datatype.Location.pretty (Cil_datatype.Kinstr.loc ki) + Printer.pp_lval lv pp_ki_loc ki | PExp (_, ki, lv) -> Format.fprintf fmt "LocalizableExp %a (%a)" - Printer.pp_exp lv - Cil_datatype.Location.pretty (Cil_datatype.Kinstr.loc ki) + Printer.pp_exp lv pp_ki_loc ki | PTermLval (_, ki, _pi, tlv) -> Format.fprintf fmt "LocalizableTermLval %a (%a)" - Printer.pp_term_lval tlv - Cil_datatype.Location.pretty (Cil_datatype.Kinstr.loc ki) - | PVDecl (_, vi) -> + Printer.pp_term_lval tlv pp_ki_loc ki + | PVDecl (_, _, vi) -> Format.fprintf fmt "LocalizableVDecl %a" Printer.pp_varinfo vi | PGlobal g -> Format.fprintf fmt "LocalizableGlobal %a" Printer.pp_global g @@ -86,7 +89,7 @@ let kf_of_localizable loc = match loc with | PLval (kf_opt, _, _) | PExp (kf_opt,_,_) | PTermLval(kf_opt, _,_,_) - | PVDecl (kf_opt, _) -> kf_opt + | PVDecl (kf_opt, _, _) -> kf_opt | PStmt (kf, _) -> Some kf | PIP ip -> Property.get_kf ip | PGlobal (GFun ({svar = vi}, _)) -> Some (Globals.Functions.get vi) @@ -95,8 +98,8 @@ let kf_of_localizable loc = match loc with let ki_of_localizable loc = match loc with | PLval (_, ki, _) | PExp (_, ki, _) - | PTermLval(_, ki,_,_) -> ki - | PVDecl (_, _) -> Kglobal + | PTermLval(_, ki,_,_) + | PVDecl (_, ki, _) -> ki | PStmt (_, st) -> Kstmt st | PIP ip -> Property.get_kinstr ip | PGlobal _ -> Kglobal @@ -410,7 +413,7 @@ module TagPrinterClassDeferred (X: Printer.PrinterClass) = struct method! vdecl fmt vi = Format.fprintf fmt "@{<%s>%a@}" - (Tag.create (PVDecl (self#current_kf,vi))) + (Tag.create (PVDecl (self#current_kf, self#current_kinstr, vi))) super#vdecl vi method private tag_property p = @@ -606,11 +609,14 @@ let equal_or_same_loc loc1 loc2 = Localizable.equal loc1 loc2 || match loc1, loc2 with | PIP (Property.IPReachable (_, Kstmt s, _)), PStmt (_, s') - | PStmt (_, s'), PIP (Property.IPReachable (_, Kstmt s, _)) when + | PStmt (_, s'), PIP (Property.IPReachable (_, Kstmt s, _)) + | PIP (Property.IPPropertyInstance (_, Kstmt s, _)), PStmt (_, s') + | PStmt (_, s'), PIP (Property.IPPropertyInstance (_, Kstmt s, _)) + when Cil_datatype.Stmt.equal s s' -> true | PIP (Property.IPReachable (Some kf, Kglobal, _)), - (PVDecl (_, vi) | PGlobal (GFun ({ svar = vi }, _))) - | (PVDecl (_, vi) | PGlobal (GFun ({ svar = vi }, _))), + (PVDecl (_, _, vi) | PGlobal (GFun ({ svar = vi }, _))) + | (PVDecl (_, _, vi) | PGlobal (GFun ({ svar = vi }, _))), PIP (Property.IPReachable (Some kf, Kglobal, _)) when Kernel_function.get_vi kf = vi -> true @@ -636,7 +642,7 @@ let localizable_from_locs state ~file ~line = None -> Location.unknown | Some kf -> Kernel_function.get_location kf) | Kstmt st -> Stmt.loc st) - | PVDecl (_,vi) -> vi.vdecl + | PVDecl (_,_,vi) -> vi.vdecl | PGlobal g -> Global.loc g | (PLval _ | PTermLval _ | PExp _) as localize -> (match kf_of_localizable localize with @@ -894,20 +900,22 @@ class pos_to_localizable = match self#current_kf with | None -> (* should not happen*) () | Some kf -> - self#add_range vi.vdecl (PVDecl (Some kf, vi)); + self#add_range vi.vdecl (PVDecl (Some kf,self#current_kinstr,vi)); end; Cil.DoChildren method! vglob_aux g = (match g with | GFun ({ svar = vi }, loc) -> - self#add_range loc (PVDecl (Some (Globals.Functions.get vi), vi)) + self#add_range loc + (PVDecl (Some (Globals.Functions.get vi), Kglobal, vi)) | GVar (vi, _, loc) -> - self#add_range loc (PVDecl (None, vi)) + self#add_range loc (PVDecl (None, Kglobal, vi)) | GFunDecl (_, vi, loc) -> - self#add_range loc (PVDecl (Some (Globals.Functions.get vi), vi)) + self#add_range loc + (PVDecl (Some (Globals.Functions.get vi), Kglobal, vi)) | GVarDecl (vi, loc) -> - self#add_range loc (PVDecl (None, vi)) + self#add_range loc (PVDecl (None, Kglobal, vi)) | _ -> self#add_range (Global.loc g) (PGlobal g) ); Cil.DoChildren diff --git a/src/plugins/gui/pretty_source.mli b/src/plugins/gui/pretty_source.mli index f4b3babfb22b5c7d5d3236f7f94f9d3adb78b8c4..859abdeddb6ddfd5f3ac8927cfb072a93ee03ae9 100644 --- a/src/plugins/gui/pretty_source.mli +++ b/src/plugins/gui/pretty_source.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,11 +31,12 @@ type localizable = | PLval of (kernel_function option * kinstr * lval) | PExp of (kernel_function option * kinstr * exp) | PTermLval of (kernel_function option * kinstr * Property.t * term_lval) - | PVDecl of (kernel_function option * varinfo) + | PVDecl of (kernel_function option * kinstr * varinfo) (** Declaration and definition of variables and function. Check the type of the varinfo to distinguish between the various possibilities. If the varinfo is a global or a local, the kernel_function is the - one in which the variable is declared. *) + one in which the variable is declared. The [kinstr] argument is given + for local variables with an explicit initializer. *) | PGlobal of global (** all globals but variable declarations and function definitions. *) | PIP of Property.t diff --git a/src/plugins/gui/project_manager.ml b/src/plugins/gui/project_manager.ml index ea4d8aa5969f82765b9c1f3aa06078cec6d0fe5e..5e9ac4de90865f9c7ad4969b6d5a39ad71857eb6 100644 --- a/src/plugins/gui/project_manager.ml +++ b/src/plugins/gui/project_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -141,7 +141,7 @@ let load_project (host_window: Design.main_window_extension_points) = let rename_project (main_ui: Design.main_window_extension_points) project = let old = Project.get_unique_name project in let s = - GToolbox.input_string + Gtk_helper.input_string ~title:"Renaming project" (Format.sprintf "New name for project %S:" old) in diff --git a/src/plugins/gui/project_manager.mli b/src/plugins/gui/project_manager.mli index 5dec0610564aa110b1527504a802cdeaf47a7a12..252be57718d6775f18034c19a2bc7afcdba5ee3b 100644 --- a/src/plugins/gui/project_manager.mli +++ b/src/plugins/gui/project_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/property_navigator.ml b/src/plugins/gui/property_navigator.ml index d3432cb53db7ccbe73481422c41ef06555d2d70a..fc81ce97d272e115c9773c134ceb5e68b652d839 100644 --- a/src/plugins/gui/property_navigator.ml +++ b/src/plugins/gui/property_navigator.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -551,7 +551,12 @@ let make_panel (main_ui:main_window_extension_points) = if not currently_selected then begin match model#custom_get_iter path with | Some {MODEL.finfo={ip = ip;}} -> - ignore (main_ui#scroll (Pretty_source.PIP ip)) + ignore (main_ui#scroll (Pretty_source.PIP ip)); + (* Note: the code below generates double scrolling: + the previous call to main_ui#scroll causes the original source + viewer to scroll to the beginning of the function, and then + the code below re-scrolls it to the exact statement. *) + main_ui#view_original (Property.location ip) | None -> () end; true); @@ -746,7 +751,7 @@ let highlighter (buffer:reactive_buffer) localizable ~start ~stop = | Pretty_source.PIP ppt -> Design.Feedback.mark buffer#buffer ~offset:start (Property_status.Feedback.get ppt) - | Pretty_source.PStmt(_,({ skind=Instr(Call _) } as stmt)) -> + | Pretty_source.PStmt(_,({ skind=Instr(Call _| Local_init (_, ConsInit _, _)) } as stmt)) -> let kfs = Statuses_by_call.all_functions_with_preconditions stmt in (* We separate the consolidated statuses of the preconditions inside guarded behaviors from those outside. For guarded behaviors, since we diff --git a/src/plugins/gui/property_navigator.mli b/src/plugins/gui/property_navigator.mli index 07a8feb1d2fb75c37f2d6f43243097c8b5131f07..3a8e9e55f15df2d9b86ee0d3fbab24cb71afa83e 100644 --- a/src/plugins/gui/property_navigator.mli +++ b/src/plugins/gui/property_navigator.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/source_manager.ml b/src/plugins/gui/source_manager.ml index 40d5c38d9e05ec8d2dc820cdde55f6ef588f7d6e..dca6a8f071bcd44847445fc9182cef84aca4bcae 100644 --- a/src/plugins/gui/source_manager.ml +++ b/src/plugins/gui/source_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/source_manager.mli b/src/plugins/gui/source_manager.mli index dbe7289120f4085608f0e03a3dc240a283481616..543139d4156b61ecb904848346af1743af49d731 100644 --- a/src/plugins/gui/source_manager.mli +++ b/src/plugins/gui/source_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/source_viewer.ml b/src/plugins/gui/source_viewer.ml index bc2de5fbe1fbd52bcb449d74a0eebb4c63e640c9..70ca779da43149c0ff24e1ced391f7d17d5c89a1 100644 --- a/src/plugins/gui/source_viewer.ml +++ b/src/plugins/gui/source_viewer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/source_viewer.mli b/src/plugins/gui/source_viewer.mli index 5ef3dfd4718ea1ab4eab96e7adb818f88704613f..f6930a31631ca7b6f269a844973c5035c57d433f 100644 --- a/src/plugins/gui/source_viewer.mli +++ b/src/plugins/gui/source_viewer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/warning_manager.ml b/src/plugins/gui/warning_manager.ml index 2bd70f1387a5e4af58ccfd7db78bf5aa6a89e10e..104a9d16272258c73977f4b4e8785ada1761747e 100644 --- a/src/plugins/gui/warning_manager.ml +++ b/src/plugins/gui/warning_manager.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/warning_manager.mli b/src/plugins/gui/warning_manager.mli index 83d623f9051ba6deb2f5353a6f70e117bb480eb1..bb9a59405556877833c2e0ddc20be1ad993e5940 100644 --- a/src/plugins/gui/warning_manager.mli +++ b/src/plugins/gui/warning_manager.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wbox.ml b/src/plugins/gui/wbox.ml index c2d28b9378d54527a82225310a201288df0bbf3f..3ea4bcb04ad58e78a10074c35b6e9b59125ef67b 100644 --- a/src/plugins/gui/wbox.ml +++ b/src/plugins/gui/wbox.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wbox.mli b/src/plugins/gui/wbox.mli index 7529975f046507d2eb0368145a1ad73a305ae37e..efbbbc3562f8a8625267722d639c6b8c26c850f9 100644 --- a/src/plugins/gui/wbox.mli +++ b/src/plugins/gui/wbox.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wfile.ml b/src/plugins/gui/wfile.ml index 6e334c24f36dff681e2b054d96d4cb387f92915a..1b368fcedac2e9f5315aa38325c6630c0c54bf24 100644 --- a/src/plugins/gui/wfile.ml +++ b/src/plugins/gui/wfile.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wfile.mli b/src/plugins/gui/wfile.mli index b9e769747c009185119a6b9391fa81902aebd480..964550c213a26bd39754533ca0283f2578eec21a 100644 --- a/src/plugins/gui/wfile.mli +++ b/src/plugins/gui/wfile.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/widget.ml b/src/plugins/gui/widget.ml index 90b9c0d75bf706d7c3fa37377b0c297fad7a1875..f8f2df99c6038b7f94ffa4ee8fae4e679fd2c641 100644 --- a/src/plugins/gui/widget.ml +++ b/src/plugins/gui/widget.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -338,7 +338,7 @@ class spinner ?min ?max ?(step=1) ~value ?tooltip () = set_tooltip b tooltip ; let fmap v = function None -> v | Some x -> float x in b#adjustment#set_bounds - ~lower:(fmap 0.0 min) ~upper:(fmap max_float max) + ~lower:(fmap (float min_int) min) ~upper:(fmap (float max_int) max) ~step_incr:(float step) () ; b#set_value (float value) ; let callback () = s#set b#value_as_int in diff --git a/src/plugins/gui/widget.mli b/src/plugins/gui/widget.mli index 5090510f24a744ff624be951b68e1ebee3a45270..f15f9342914d3014af2e5a3f5f667ba7ae2bd8d0 100644 --- a/src/plugins/gui/widget.mli +++ b/src/plugins/gui/widget.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wpalette.ml b/src/plugins/gui/wpalette.ml index 6f8b7ca463f1872e1ded8aa899f9fcf1c13c21ba..5774b420f0dd197e1011a87a3c406292fa855b12 100644 --- a/src/plugins/gui/wpalette.ml +++ b/src/plugins/gui/wpalette.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wpalette.mli b/src/plugins/gui/wpalette.mli index 448f718823a051150ba55e6c9ae652679eee186c..6b4598c11990aee2881011a5a429ad934e8216bc 100644 --- a/src/plugins/gui/wpalette.mli +++ b/src/plugins/gui/wpalette.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wpane.ml b/src/plugins/gui/wpane.ml index b46b12942b9d5fa65e68a9e6641b45a9de9ddfa3..5bf0e98243c9312c313c06e485249f92db797e99 100644 --- a/src/plugins/gui/wpane.ml +++ b/src/plugins/gui/wpane.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wpane.mli b/src/plugins/gui/wpane.mli index b23978d2321154b9d0b463e38f37af67b544a404..861352a40780ee2b3567679bf00cf3a6d828f9fe 100644 --- a/src/plugins/gui/wpane.mli +++ b/src/plugins/gui/wpane.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wtable.ml b/src/plugins/gui/wtable.ml index f4525b689321e83e63aa9a08054fd95359ae2eae..d9e09750a5a0b1400a4a9cb6001145d3a83a3d19 100644 --- a/src/plugins/gui/wtable.ml +++ b/src/plugins/gui/wtable.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wtable.mli b/src/plugins/gui/wtable.mli index 7ffabe252391ea5284485cba12184bbb87604219..df9b7927751998f6a6e885a66144bc03015a3c23 100644 --- a/src/plugins/gui/wtable.mli +++ b/src/plugins/gui/wtable.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wtext.ml b/src/plugins/gui/wtext.ml index 074a067d2cb0c832896d0273fb72610f5404f44a..feedbbefbd699ad8f0e5393823adff02d2a45829 100644 --- a/src/plugins/gui/wtext.ml +++ b/src/plugins/gui/wtext.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wtext.mli b/src/plugins/gui/wtext.mli index e432fd8332b57b02827fe07b8af283fc5665ca8d..924cf024aebce84486574d8c9fcc66ced95af15c 100644 --- a/src/plugins/gui/wtext.mli +++ b/src/plugins/gui/wtext.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wutil.ml b/src/plugins/gui/wutil.ml index 5466bc00c08c8ec6198a09297e071894810d3e76..58e3c361a73a21af739d8e4a3a6bac363f252c92 100644 --- a/src/plugins/gui/wutil.ml +++ b/src/plugins/gui/wutil.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/gui/wutil.mli b/src/plugins/gui/wutil.mli index 90cb8c9fb37340803cef06767d95998bf569149e..13002b8055c3882245f1f6fc343b369ec7bcc8a4 100644 --- a/src/plugins/gui/wutil.mli +++ b/src/plugins/gui/wutil.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/Impact.mli b/src/plugins/impact/Impact.mli index 05df0ecec0dc4fbe3ebefe958d7831b5117731ac..8d7d76bcdcd81eda3b91bcc8b3e97d380e4d42e5 100644 --- a/src/plugins/impact/Impact.mli +++ b/src/plugins/impact/Impact.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/compute_impact.ml b/src/plugins/impact/compute_impact.ml index bb4f81d0cdca27d774eb8f3b8fd709b740d3e57d..a9ce628b0d0ca00e27f87e3019fb28a86102d1fe 100644 --- a/src/plugins/impact/compute_impact.ml +++ b/src/plugins/impact/compute_impact.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/compute_impact.mli b/src/plugins/impact/compute_impact.mli index b72861a3e616c2765629102c950b9b45ed99250d..b876e8f76f791e990e0d15bec0bdffe118ea3a5e 100644 --- a/src/plugins/impact/compute_impact.mli +++ b/src/plugins/impact/compute_impact.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/options.ml b/src/plugins/impact/options.ml index 5ac8902dc8ebdd95311e14c37f6806dc971e5b88..2a4861a3b33bc9bb04581e9a3949d698ec99421f 100644 --- a/src/plugins/impact/options.ml +++ b/src/plugins/impact/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/options.mli b/src/plugins/impact/options.mli index b462e637823038f4d543f29233351e875ebbfe3a..f8c5a0b4dfffc1789913fb05c726bac3bed42b5b 100644 --- a/src/plugins/impact/options.mli +++ b/src/plugins/impact/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/pdg_aux.ml b/src/plugins/impact/pdg_aux.ml index df0b5af2667b71e4dd3e96418b1ce146478f73a0..847a45622eb1f3271f3f6ee6f35ce80122d8ed73 100644 --- a/src/plugins/impact/pdg_aux.ml +++ b/src/plugins/impact/pdg_aux.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/pdg_aux.mli b/src/plugins/impact/pdg_aux.mli index 6596420b852e6221da2191ccf4976d3a427e5455..042dba6b0e2bdf39d56b158702f4fb132fd47d18 100644 --- a/src/plugins/impact/pdg_aux.mli +++ b/src/plugins/impact/pdg_aux.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/reason_graph.ml b/src/plugins/impact/reason_graph.ml index 59b37fba02870cd3a942a29dd8c189e98876652b..6b1d2803b31630dffa6e76bc78aa9e9036798033 100644 --- a/src/plugins/impact/reason_graph.ml +++ b/src/plugins/impact/reason_graph.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/impact/register.ml b/src/plugins/impact/register.ml index 10c477e82d43d9adee9ca7d9400c93d2b797f23b..6cd6d085ad84678a441997b0dd9c56718ab13a81 100644 --- a/src/plugins/impact/register.ml +++ b/src/plugins/impact/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,11 +20,8 @@ (* *) (**************************************************************************) -open Cil open Cil_types open Cil_datatype -open Visitor -open Options let rec pp_stmt fmt s = match s.skind with | Instr _ | Return _ | Goto _ | Break _ | Continue _ | TryFinally _ @@ -65,14 +62,14 @@ let compute_from_nodes kf nodes = let compute_multiple_stmts skip kf ls = - debug "computing impact of statement(s) %a" + Options.debug "computing impact of statement(s) %a" (Pretty_utils.pp_list ~sep:",@ " Stmt.pretty_sid) ls; let reason = Options.Reason.get () in let res, _, _ = Compute_impact.nodes_impacted_by_stmts ~skip ~reason kf ls in let res_nodes = Compute_impact.result_to_nodes res in let res_stmts = Compute_impact.nodes_to_stmts res_nodes in - if Print.get () then begin - result "@[<v 2>@[impacted statements of stmt(s) %a are:@]@ %a@]" + if Options.Print.get () then begin + Options.result "@[<v 2>@[impacted statements of stmt(s) %a are:@]@ %a@]" (Pretty_utils.pp_list ~sep:",@ " Stmt.pretty_sid) ls print_results res_stmts end; @@ -80,22 +77,24 @@ let compute_multiple_stmts skip kf ls = (* Slice on the given list of stmts *) let slice (stmts:stmt list) = - feedback ~level:2 "beginning slicing"; + Options.feedback ~level:2 "beginning slicing"; let name = "impact slicing" in - let slicing = !Db.Slicing.Project.mk_project name in + Slicing.Api.Project.reset_slicing (); let select sel ({ sid = id } as stmt) = let kf = Kernel_function.find_englobing_kf stmt in - debug ~level:3 "selecting sid %d (of %s)" id (Kernel_function.get_name kf); - !Db.Slicing.Select.select_stmt sel ~spare:false stmt kf + Options.debug ~level:3 "selecting sid %d (of %s)" + id + (Kernel_function.get_name kf); + Slicing.Api.Select.select_stmt sel ~spare:false stmt kf in - let sel = List.fold_left select Db.Slicing.Select.empty_selects stmts in - debug ~level:2 "applying slicing request"; - !Db.Slicing.Request.add_persistent_selection slicing sel; - !Db.Slicing.Request.apply_all_internal slicing; - !Db.Slicing.Slice.remove_uncalled slicing; - let extracted_prj = !Db.Slicing.Project.extract name slicing in - !Db.Slicing.Project.print_extracted_project ?fmt:None ~extracted_prj ; - feedback ~level:2 "slicing done" + let sel = List.fold_left select Slicing.Api.Select.empty_selects stmts in + Options.debug ~level:2 "applying slicing request"; + Slicing.Api.Request.add_persistent_selection sel; + Slicing.Api.Request.apply_all_internal (); + Slicing.Api.Slice.remove_uncalled (); + let extracted_prj = Slicing.Api.Project.extract name in + Options.feedback ~level:2 "slicing done"; + extracted_prj let all_pragmas_kf l = List.fold_left @@ -123,17 +122,18 @@ let compute_pragmas () = (fun a -> s, a) (Annotations.code_annot ~filter:Logic_utils.is_impact_pragma s) @ !pragmas; - DoChildren + Cil.DoChildren end in (* fill [pragmas] with all the pragmas of all the selected functions *) - let pragmas = Pragma.fold - (fun kf acc -> - (* Pragma option only accept defined functions. *) - let f = Kernel_function.get_definition kf in - ignore (visitFramacFunction visitor f); - if !pragmas != [] then (kf, !pragmas) :: acc else acc) - [] + let pragmas = + Options.Pragma.fold + (fun kf acc -> + (* Pragma option only accept defined functions. *) + let f = Kernel_function.get_definition kf in + ignore (Visitor.visitFramacFunction visitor f); + if !pragmas != [] then (kf, !pragmas) :: acc else acc) + [] in let skip = Compute_impact.skip () in (* compute impact analyses on each kf *) @@ -149,11 +149,11 @@ let compute_pragmas () = ;; let main () = - if is_on () then begin - feedback "beginning analysis"; - assert (not (Pragma.is_empty ())); + if Options.is_on () then begin + Options.feedback "beginning analysis"; + assert (not (Options.Pragma.is_empty ())); ignore (!Db.Impact.compute_pragmas ()); - feedback "analysis done" + Options.feedback "analysis done" end let () = Db.Main.extend main diff --git a/src/plugins/impact/register_gui.ml b/src/plugins/impact/register_gui.ml index d02763693c03d5a9a2fd2258a6c448e2d00846c5..37c46020018b918d789ebcee680f326523ba9ec9 100644 --- a/src/plugins/impact/register_gui.ml +++ b/src/plugins/impact/register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -202,7 +202,7 @@ let impact_statement restrict s = List.iter (Highlighted_stmt.add kf) stmts' ) impact; let impact = List.concat !stmts in - if Slicing.get () then Register.slice impact; + if Slicing.get () then ignore (Register.slice impact); Enabled.set true; impact @@ -333,7 +333,7 @@ let impact_selector pp_impacted_call_outputs main_ui kf s end - | PVDecl (_, vi) | PGlobal (GFun ({ svar = vi }, _)) + | PVDecl (_, _, vi) | PGlobal (GFun ({ svar = vi }, _)) when Cil.isFunctionType vi.vtype -> if button = 1 then begin let kf = Globals.Functions.get vi in diff --git a/src/plugins/impact/register_gui.mli b/src/plugins/impact/register_gui.mli index 6cd0651e6b14de9923cfb4cfe98c8f23cd531896..5e03391789c9838656c2a2da6cdb4481385e4e15 100644 --- a/src/plugins/impact/register_gui.mli +++ b/src/plugins/impact/register_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/Inout.mli b/src/plugins/inout/Inout.mli index d5ced51e58c658a1edd4e02453fc46d828e8b2a8..e7c843598da4bd254124315e8453e037db5e467e 100644 --- a/src/plugins/inout/Inout.mli +++ b/src/plugins/inout/Inout.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/context.mli b/src/plugins/inout/context.mli index a050a3a10b186ceb0409d471497f58bee2008251..3ec963e47d07c829dc7ed962c81aa4d2b593d4d9 100644 --- a/src/plugins/inout/context.mli +++ b/src/plugins/inout/context.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/cumulative_analysis.ml b/src/plugins/inout/cumulative_analysis.ml index 036424e369784314f7120222be884e496b88f9a0..91801c138c8fbf932403442efccdf62d5166148a 100644 --- a/src/plugins/inout/cumulative_analysis.ml +++ b/src/plugins/inout/cumulative_analysis.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,6 +30,20 @@ let specialize_state_on_call ?stmt kf = if Cvalue.Model.is_top at_stmt then Cvalue.Model.top (* can occur with -no-results-function option *) else !Db.Value.add_formals_to_state at_stmt kf l + | Some + ({skind = + Instr(Local_init(v, ConsInit(_,args,kind),_))} as stmt) -> + let at_stmt = Db.Value.get_stmt_state stmt in + if Cvalue.Model.is_top at_stmt then + Cvalue.Model.top + else begin + let args = + match kind with + | Constructor -> Cil.mkAddrOfVi v :: args + | Plain_func -> args + in + !Db.Value.add_formals_to_state at_stmt kf args + end | _ -> Db.Value.get_initial_state kf @@ -71,7 +85,7 @@ struct module Memo = Kernel_function.Make_Table(X.T) (struct - let name = "Memo " ^ X.analysis_name + let name = "Inout.Cumulative_analysis.Memo(" ^ X.analysis_name ^ ")" let dependencies = [ Db.Value.self ] let size = 97 end) diff --git a/src/plugins/inout/cumulative_analysis.mli b/src/plugins/inout/cumulative_analysis.mli index ddc7f5f6e39981481be945e3d9d45503fdac20ac..28705ed7f36b642c6238deb59a6fce420fe0d05c 100644 --- a/src/plugins/inout/cumulative_analysis.mli +++ b/src/plugins/inout/cumulative_analysis.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/derefs.ml b/src/plugins/inout/derefs.ml index 88b7544ab7c99f69609be3dc60700f5ba8f13fa2..e670ef7addd79d97574338b0d63c582a792ce332 100644 --- a/src/plugins/inout/derefs.ml +++ b/src/plugins/inout/derefs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -43,9 +43,7 @@ class virtual do_it_ = object(self) let state = Db.Value.get_state (Kstmt (Extlib.the self#current_stmt)) in - let r = - !Db.Value.eval_expr ~with_alarms:CilE.warn_none_mode state e - in + let r = !Db.Value.eval_expr state e in let loc = loc_bytes_to_loc_bits r in let size = Bit_utils.sizeof_lval lv in self#join @@ -80,7 +78,7 @@ let externalize _return fundec x = module Externals = Kernel_function.Make_Table(Locations.Zone) (struct - let name = "External derefs" + let name = "Inout.Derefs.Externals" let dependencies = [ Analysis.Memo.self ] let size = 17 end) diff --git a/src/plugins/inout/derefs.mli b/src/plugins/inout/derefs.mli index ac6336ca71f52400d60d3db64f1988930986e876..f18605756449ce3a0bfca394ce766ca5a7b98ff0 100644 --- a/src/plugins/inout/derefs.mli +++ b/src/plugins/inout/derefs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/inout_parameters.ml b/src/plugins/inout/inout_parameters.ml index 96d159b547e84a2af265f688a58def88b2a9e572..000f6104fd9bfb8ffbe8015a460409224d904ffc 100644 --- a/src/plugins/inout/inout_parameters.ml +++ b/src/plugins/inout/inout_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -77,12 +77,20 @@ module ForceInout = let help = "Compute operational inputs, an over-approximation of the set of locations whose initial value is used; and the sure outputs, an under-approximation of the set of the certainly written locations" end) +(* Remove in Frama-C Chlorine *) +let () = Parameter_customize.is_invisible () module ForceCallwiseInout = - False + True (struct let option_name = "-inout-callwise" let help = "Compute callsite-wide operational inputs; this results in more precise results for -inout and -out options" - end) + end) +let () = + ForceCallwiseInout.add_update_hook + (fun _ new_ -> + if not new_ then + Kernel.abort "@[option -inout-callwise can no longer be unset.@]") + module ForceInoutExternalWithFormals = False diff --git a/src/plugins/inout/inout_parameters.mli b/src/plugins/inout/inout_parameters.mli index 2b6e903a76ba63e1aa9b0df8d695bb3846efe1e0..c65541b013fcb684f29b2c29f122512fc3d7e53d 100644 --- a/src/plugins/inout/inout_parameters.mli +++ b/src/plugins/inout/inout_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/inputs.ml b/src/plugins/inout/inputs.ml index 3d639dc2de73c57f67149f409bdd2e298a16011c..fafa18a020f0763f81a0f8c29cffe8ca15c057c1 100644 --- a/src/plugins/inout/inputs.ml +++ b/src/plugins/inout/inputs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -58,7 +58,6 @@ class virtual do_it_ = object(self) method private do_assign lv = let deps,_loc = !Db.Value.lval_to_loc_with_deps (* loc ignored *) - ~with_alarms:CilE.warn_none_mode ~deps:Zone.bottom self#current_kinstr lv @@ -67,6 +66,22 @@ class virtual do_it_ = object(self) Zone.pretty deps; *) self#join deps; + method private do_arg_calls f args = + let state = Db.Value.get_state self#current_kinstr in + (if Cvalue.Model.is_top state then + self#join Zone.top + else + let deps_callees, callees = + !Db.Value.expr_to_kernel_function_state + ~deps:(Some Zone.bottom) state f + in + self#join deps_callees; + Kernel_function.Hptset.iter + (fun kf -> self#join (self#compute_kf kf)) callees; + ); + List.iter + (fun exp -> ignore (visitFramacExpr (self:>frama_c_visitor) exp)) args + method! vinst i = if Db.Value.is_reachable (Db.Value.get_state self#current_kinstr) then begin match i with @@ -75,27 +90,34 @@ class virtual do_it_ = object(self) ignore (visitFramacExpr (self:>frama_c_visitor) exp); Cil.SkipChildren + | Local_init(v, AssignInit i,_) -> + let rec aux lv = function + | SingleInit e -> + self#do_assign lv; + ignore (visitFramacExpr (self:>frama_c_visitor) e) + | CompoundInit (ct,initl) -> + let implicit = true in + let doinit o i _ () = + ignore (visitFramacOffset (self:>frama_c_visitor) o); + aux (Cil.addOffsetLval o lv) i + in + Cil.foldLeftCompound ~implicit ~doinit ~ct ~initl ~acc:() + in + aux (Cil.var v) i; + Cil.SkipChildren + | Call (lv_opt,exp,args,_) -> - (match lv_opt with None -> () - | Some lv -> self#do_assign lv); - let state = Db.Value.get_state self#current_kinstr in - (if Cvalue.Model.is_top state then - self#join Zone.top - else - let deps_callees, callees = - !Db.Value.expr_to_kernel_function_state - ~deps:(Some Zone.bottom) - state exp - in - self#join deps_callees; - Kernel_function.Hptset.iter - (fun kf -> self#join (self#compute_kf kf)) callees; - ); - List.iter - (fun exp -> ignore (visitFramacExpr (self:>frama_c_visitor) exp)) - args; - Cil.SkipChildren - | _ -> Cil.DoChildren + Extlib.may self#do_assign lv_opt; + self#do_arg_calls exp args; + Cil.SkipChildren + | Local_init(v, ConsInit(f, args, Plain_func), _) -> + self#do_assign (Cil.var v); + self#do_arg_calls (Cil.evar f) args; + Cil.SkipChildren + | Local_init(v, ConsInit(f, args, Constructor), _) -> + self#do_arg_calls (Cil.evar f) (Cil.mkAddrOfVi v :: args); + Cil.SkipChildren + | Skip _ | Asm _ | Code_annot _ -> Cil.DoChildren end else Cil.SkipChildren @@ -104,12 +126,14 @@ class virtual do_it_ = object(self) | AddrOf lv | StartOf lv -> let deps,_loc = !Db.Value.lval_to_loc_with_deps (* loc ignored *) - ~with_alarms:CilE.warn_none_mode ~deps:Zone.bottom self#current_kinstr lv in self#join deps; Cil.SkipChildren + | SizeOfE _ | AlignOfE _ | SizeOf _ | AlignOf _ -> + (* we're not evaluating an expression here: there's no input. *) + Cil.SkipChildren | _ -> Cil.DoChildren method compute_funspec kf = @@ -137,7 +161,7 @@ let get_internal = Analysis.kernel_function module Externals = Kernel_function.Make_Table(Locations.Zone) (struct - let name = "External inputs" + let name = "Inout.Inputs.Externals" let dependencies = [ Analysis.Memo.self ] let size = 17 end) diff --git a/src/plugins/inout/inputs.mli b/src/plugins/inout/inputs.mli index 5bfa69b68fa32909fa09913d8d8b24a0b55b36b0..681a6e1c55403bada5b6e328fd2eb267ed971736 100644 --- a/src/plugins/inout/inputs.mli +++ b/src/plugins/inout/inputs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/operational_inputs.ml b/src/plugins/inout/operational_inputs.ml index 5545a8ab13ac1b89322498ab6b629112ff65030d..a945b054eb128460e00840a4e13acfba252c6408 100644 --- a/src/plugins/inout/operational_inputs.ml +++ b/src/plugins/inout/operational_inputs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -111,7 +111,7 @@ let eval_assigns kf state assigns = let clean_deps = Locations.Zone.filter_base (function - | Base.Var (v, _) | Base.Allocated (v, _) -> + | Base.Var (v, _) | Base.Allocated (v, _, _) -> not (Kernel_function.is_formal v kf) | Base.CLogic_Var _ | Base.Null | Base.String _ -> true) in @@ -126,9 +126,9 @@ let eval_assigns kf state assigns = (enumerate_valid_bits_under ~for_writing:true loc_out_under, enumerate_valid_bits ~for_writing:true loc_out_over, clean_deps deps) - with Invalid_argument _ -> + with Db.Properties.Interp.No_conversion -> Inout_parameters.warning ~current:true ~once:true - "Failed to interpret assigns clause '%a'" Printer.pp_term out.it_content; + "failed to interpret assigns clause '%a'" Printer.pp_term out.it_content; (Zone.bottom, Zone.top, Zone.top) in (* Compute all inputs as a zone *) @@ -145,9 +145,9 @@ let eval_assigns kf state assigns = Zone.join z acc in List.fold_left aux deps l - with Invalid_argument _ -> + with Db.Properties.Interp.No_conversion -> Inout_parameters.warning ~current:true ~once:true - "Failed to interpret inputs in assigns clause '%a'" + "failed to interpret inputs in assigns clause '%a'" Printer.pp_from asgn; Zone.top in @@ -188,6 +188,10 @@ let compute_using_prototype_state state kf = let assigns = Ast_info.merge_assigns behaviors in eval_assigns kf state assigns +let compute_using_given_spec_state state funspec kf = + let assigns = Ast_info.merge_assigns funspec.spec_behavior in + eval_assigns kf state assigns + let compute_using_prototype ?stmt kf = let state = Cumulative_analysis.specialize_state_on_call ?stmt kf in compute_using_prototype_state state kf @@ -197,7 +201,7 @@ let compute_using_prototype ?stmt kf = module Internals = Kernel_function.Make_Table(Inout_type) (struct - let name = "Internal inouts full" + let name = "Inout.Operational_inputs.Internals" let dependencies = [ Db.Value.self ] let size = 17 end) @@ -215,7 +219,7 @@ module CallwiseResults = let size = 17 let dependencies = [Internals.self; Inout_parameters.ForceCallwiseInout.self] - let name = "Operational_inputs.CallwiseResults" + let name = "Inout.Operational_inputs.CallwiseResults" end) module Computer(Fenv:Dataflows.FUNCTION_ENV)(X:sig @@ -281,85 +285,100 @@ end) = struct {data with over_inputs_d = Zone.join data.over_inputs_d new_inputs} ;; + let add_out state lv deps data = + let deps, new_outs, exact = + !Db.Value.lval_to_zone_with_deps_state state + ~deps:(Some deps) ~for_writing:true lv + in + store_non_terminating_outputs new_outs; + let new_inputs = Zone.diff deps data.under_outputs_d in + store_non_terminating_inputs new_inputs; + let new_sure_outs = + if exact then + (* There is only one modified zone. So, this is an exact output. + Add it into the under-approximated outputs. *) + Zone.link data.under_outputs_d new_outs + else data.under_outputs_d + in { + under_outputs_d = new_sure_outs; + over_inputs_d = Zone.join data.over_inputs_d new_inputs; + over_outputs_d = Zone.join data.over_outputs_d new_outs } + + let transfer_call s dest f args _loc data = + let state = X.stmt_state s in + let f_inputs, called = + !Db.Value.expr_to_kernel_function_state + ~deps:(Some Zone.bottom) + state + f + in + let acc_f_arg_inputs = + (* add the inputs of [argl] to the inputs of the + function expression *) + List.fold_right + (fun arg inputs -> + let arg_inputs = !Db.From.find_deps_no_transitivity_state + state arg + in Zone.join inputs arg_inputs) + args + f_inputs + in + let data = + catenate + data + { over_inputs_d = acc_f_arg_inputs ; + under_outputs_d = Zone.bottom; + over_outputs_d = Zone.bottom; } + in + let for_functions = + Kernel_function.Hptset.fold + (fun kf acc -> + let res = X.at_call s kf in + store_non_terminating_subcall data.over_outputs_d res; + let for_function = { + over_inputs_d = res.over_inputs_if_termination; + under_outputs_d = res.under_outputs_if_termination; + over_outputs_d = res.over_outputs_if_termination; + } in + join for_function acc) + called + bottom + in + let result = catenate data for_functions in + let result = + (* Treatment for the possible assignment of the call result *) + (match dest with + | None -> result + | Some lv -> add_out state lv Zone.bottom result) + in result + (* Transfer function on instructions. *) let transfer_instr stmt (i: instr) (data: t) = - let state = X.stmt_state stmt in - let add_out lv deps data = - let deps, new_outs, exact = - !Db.Value.lval_to_zone_with_deps_state state - ~deps:(Some deps) ~for_writing:true lv - in - store_non_terminating_outputs new_outs; - let new_inputs = Zone.diff deps data.under_outputs_d in - store_non_terminating_inputs new_inputs; - let new_sure_outs = - if exact then - (* There is only one modified zone. So, this is an exact output. - Add it into the under-approximated outputs. *) - Zone.link data.under_outputs_d new_outs - else data.under_outputs_d - in { - under_outputs_d = new_sure_outs; - over_inputs_d = Zone.join data.over_inputs_d new_inputs; - over_outputs_d = Zone.join data.over_outputs_d new_outs } - in match i with | Set (lv, exp, _) -> - let state = X.stmt_state stmt in - let e_inputs = - !Db.From.find_deps_no_transitivity_state state exp - in - add_out lv e_inputs data - - | Call (lvaloption,funcexp,argl,_) -> - let state = X.stmt_state stmt in - let funcexp_inputs, called = - !Db.Value.expr_to_kernel_function_state - ~deps:(Some Zone.bottom) - state - funcexp - in - let acc_funcexp_arg_inputs = - (* add the inputs of [argl] to the inputs of the - function expression *) - List.fold_right - (fun arg inputs -> - let arg_inputs = !Db.From.find_deps_no_transitivity_state - state arg - in Zone.join inputs arg_inputs) - argl - funcexp_inputs - in - let data = - catenate - data - { over_inputs_d = acc_funcexp_arg_inputs ; - under_outputs_d = Zone.bottom; - over_outputs_d = Zone.bottom; } - in - let for_functions = - Kernel_function.Hptset.fold - (fun kf acc -> - let res = X.at_call stmt kf in - store_non_terminating_subcall data.over_outputs_d res; - let for_function = { - over_inputs_d = res.over_inputs_if_termination; - under_outputs_d = res.under_outputs_if_termination; - over_outputs_d = res.over_outputs_if_termination; - } in - join for_function acc) - called - bottom - in - let result = catenate data for_functions in - let result = - (* Treatment for the possible assignment of the call result *) - (match lvaloption with - | None -> result - | Some lv -> add_out lv Zone.bottom result) - in result - - | _ -> data + let state = X.stmt_state stmt in + let e_inputs = + !Db.From.find_deps_no_transitivity_state state exp + in + add_out state lv e_inputs data + | Local_init (v, AssignInit i, _) -> + let state = X.stmt_state stmt in + let rec aux lv i acc = + match i with + | SingleInit e -> + let e_inputs = !Db.From.find_deps_no_transitivity_state state e in + add_out state lv e_inputs acc + | CompoundInit(ct, initl) -> + let implicit = true in + let doinit o i _ data = aux (Cil.addOffsetLval o lv) i data in + Cil.foldLeftCompound ~implicit ~doinit ~ct ~initl ~acc + in + aux (Cil.var v) i data + | Call (lvaloption,funcexp,argl,loc) -> + transfer_call stmt lvaloption funcexp argl loc data + | Local_init(v, ConsInit(f, args, kind), loc) -> + Cil.treat_constructor_as_func (transfer_call stmt) v f args kind loc data + | Asm _ | Code_annot _ | Skip _ -> data ;; (* transfer_guard: gets the state obtained after evaluating the @@ -368,7 +387,7 @@ end) = struct edges get bottom, instead of the input state. *) let transfer_guard stmt e t = let state = X.stmt_state stmt in - let v_e = !Db.Value.eval_expr ~with_alarms:CilE.warn_none_mode state e in + let v_e = !Db.Value.eval_expr state e in let t1 = Cil.unrollType (Cil.typeOf e) in let do_then, do_else = if Cil.isIntegralType t1 || Cil.isPointerType t1 @@ -551,7 +570,10 @@ module Callwise = struct let table_current_function = CallsiteHash.create 7 in call_inout_stack := (current_function, table_current_function) :: !call_inout_stack - | `Spec | `Builtin { Value_types.c_from = None } -> + | `Spec spec -> + let inout =compute_using_given_spec_state state spec current_function in + merge_inout inout + | `Builtin { Value_types.c_from = None } -> let inout = compute_using_prototype_state state current_function in merge_inout inout end;; @@ -602,13 +624,15 @@ module Callwise = struct let _cur_kf, table = List.hd !call_inout_stack in try let with_internals = CallsiteHash.find table (kf, Kstmt stmt) in - match kf.fundec with + let filter = + match kf.fundec with | Definition (fundec, _) -> - let filter = Zone.filter_base - (fun b -> not (Base.is_formal_or_local b fundec)) - in - Inout_type.map filter with_internals - | _ -> with_internals + (fun b -> not (Base.is_formal_or_local b fundec)) + | _ -> + let vi_kf = Kernel_function.get_vi kf in + (fun b -> not (Base.is_formal_of_prototype b vi_kf)) + in + Inout_type.map (Zone.filter_base filter) with_internals with Not_found -> Inout_type.bottom end) in let module Compute = Dataflows.Simple_forward(Fenv)(Computer) in @@ -644,20 +668,10 @@ module Callwise = struct (* Register our callbacks inside the value analysis *) - let add_hooks () = + let () = Db.Value.Record_Value_Callbacks_New.extend_once record_for_callwise_inout; Db.Value.Call_Type_Value_Callbacks.extend_once call_for_callwise_inout;; - let () = Inout_parameters.ForceCallwiseInout.add_update_hook - (fun _bold bnew -> if bnew then add_hooks ()) - - let () = Inout_parameters.ForceCallwiseInout.add_set_hook - (fun bold bnew -> - if bold = false && bnew then - Project.clear - ~selection:(State_selection.with_dependencies Db.Value.self) (); - ) - end @@ -756,7 +770,7 @@ let compute_external kf = ignore (get_external kf) module Externals_With_Formals = Kernel_function.Make_Table(Inout_type) (struct - let name = "External inouts with formals full" + let name = "Inout.Operational_inputs.Externals_With_Formals" let dependencies = [ Internals.self ] let size = 17 end) diff --git a/src/plugins/inout/outputs.ml b/src/plugins/inout/outputs.ml index f64f6952906c75894a2db931a1fd8a8b220526c6..3f215825dd8be901c4399891ff7bc66ce5c5385e 100644 --- a/src/plugins/inout/outputs.ml +++ b/src/plugins/inout/outputs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -45,11 +45,13 @@ class virtual do_it_ = object(self) method join new_ = outs <- Zone.join new_ outs; - method private do_assign lv = + (* For local initializations, counts the written variable as an output of the + function, even if it is const; thus, [for_writing] is false in this case. *) + method private do_assign ~for_writing lv = let state = Db.Value.get_state self#current_kinstr in let _deps, bits_loc, _exact = !Db.Value.lval_to_zone_with_deps_state state - ~deps:None ~for_writing:true lv + ~deps:None ~for_writing lv in self#join bits_loc @@ -59,10 +61,10 @@ class virtual do_it_ = object(self) (* noassert needed for Eval.memoize. Not really satisfactory *) begin match i with - | Set (lv,_,_) -> self#do_assign lv + | Set (lv,_,_) -> self#do_assign ~for_writing:true lv | Call (lv_opt,exp,_,_) -> (match lv_opt with None -> () - | Some lv -> self#do_assign lv); + | Some lv -> self#do_assign ~for_writing:true lv); let state = Db.Value.get_state self#current_kinstr in if Cvalue.Model.is_top state then self#join Zone.top @@ -73,11 +75,32 @@ class virtual do_it_ = object(self) (fun kf -> let { Inout_type.over_outputs = z } = Operational_inputs.get_external_aux - ?stmt:self#current_stmt kf + ?stmt:self#current_stmt kf in self#join z ) callees - | _ -> () + | Local_init (v, AssignInit i, _) -> + let rec aux lv = function + | SingleInit _ -> self#do_assign ~for_writing:false lv + | CompoundInit (ct, initl) -> + let implicit = true in + let doinit o i _ () = aux (Cil.addOffsetLval o lv) i in + Cil.foldLeftCompound ~implicit ~doinit ~ct ~initl ~acc:() + in aux (Cil.var v) i + | Local_init (v, ConsInit(f, _, _),_) -> + let state = Db.Value.get_state self#current_kinstr in + if Cvalue.Model.is_top state then self#join Zone.top + else begin + let { Inout_type.over_outputs = z } = + Operational_inputs.get_external_aux ?stmt:self#current_stmt + (Globals.Functions.get f) + in + self#do_assign ~for_writing:false (Cil.var v); + (* might be redundant with z in case f takes address of + v as first argument, but this shouldn't hurt. *) + self#join z + end + | Asm _ | Skip _ | Code_annot _ -> () end; Cil.SkipChildren @@ -113,7 +136,7 @@ let externalize kf x = module Externals = Kernel_function.Make_Table(Locations.Zone) (struct - let name = "External outs" + let name = "Inout.Outputs.Externals" let dependencies = [ Analysis.Memo.self ] let size = 17 end) diff --git a/src/plugins/inout/outputs.mli b/src/plugins/inout/outputs.mli index 23d67b041610896539ea8f3cd1b23d56992ca144..53fa4e7b0fb18dfc35026ce1047dbfb52ea92fae 100644 --- a/src/plugins/inout/outputs.mli +++ b/src/plugins/inout/outputs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/inout/register.ml b/src/plugins/inout/register.ml index 5e9e2f75e53c20c24e2dfdb172c22cf2918ce41a..5b113d349ca4b76886a0bc1113ad1d319450341a 100644 --- a/src/plugins/inout/register.ml +++ b/src/plugins/inout/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/LoopAnalysis.mli b/src/plugins/loop_analysis/LoopAnalysis.mli index 60d14abaf82451350d37d0a069679d386cede1b1..04a2b7803a02cdd4c21d46844c070e10ac3c2128 100644 --- a/src/plugins/loop_analysis/LoopAnalysis.mli +++ b/src/plugins/loop_analysis/LoopAnalysis.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/Makefile.in b/src/plugins/loop_analysis/Makefile.in index 039e653a1e1ffb452b9351ab51c80e03c72b3d76..27f7553a93ff58fdb530ec251ed56bd65c06d183 100644 --- a/src/plugins/loop_analysis/Makefile.in +++ b/src/plugins/loop_analysis/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -28,7 +28,6 @@ FRAMAC_LIBDIR :=$(shell frama-c-config -print-libpath) endif PLUGIN_ENABLE:=@ENABLE_LOOP_ANALYSIS@ -PLUGIN_DYNAMIC:=@DYNAMIC_LOOP_ANALYSIS@ PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) PLUGIN_NAME:= LoopAnalysis diff --git a/src/plugins/loop_analysis/configure.ac b/src/plugins/loop_analysis/configure.ac index e2ead63245485323f640290a848a325932563535..99dd2d2cb356bbb4a059bac77471406386eb1847 100644 --- a/src/plugins/loop_analysis/configure.ac +++ b/src/plugins/loop_analysis/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/loop_analysis/loop_analysis.ml b/src/plugins/loop_analysis/loop_analysis.ml index ad8fb4d5f23d0f22b19bd5979b274b2eb3b7bed0..2d646849278aaf45db606aa0a12dad8e0db6c697 100644 --- a/src/plugins/loop_analysis/loop_analysis.ml +++ b/src/plugins/loop_analysis/loop_analysis.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -222,9 +222,6 @@ module Binary(* :BINARY_SEMILATTICE *) = struct | Unknown, Unknown -> Unknown | _,_ -> Unknown - (* let pretty _ = assert false *) - (* let join_and_is_included _ = assert false *) - (* let is_included _ = assert false *) end @@ -301,6 +298,10 @@ module Store(* (B:sig *) -> (Varinfo.Map.add vi (B.transfer_exp exp (load value)) value, conds) | Set _ -> (value,conds) (* | Set((Var(vi),NoOffset),exp,_) -> assert false *) + | Local_init (vi, AssignInit (SingleInit e), _) -> + (Varinfo.Map.add vi (B.transfer_exp e (load value)) value, conds) + | Local_init (_, AssignInit (CompoundInit _), _) -> (value,conds) + | Local_init (_,ConsInit _,_) -> (value,conds) | Call _ -> (value,conds) | Asm _ -> (value,conds) | Code_annot _ -> (value,conds) diff --git a/src/plugins/loop_analysis/loop_analysis.mli b/src/plugins/loop_analysis/loop_analysis.mli index db104e11c9812d49b68f3281614b1135f9e46460..8c84e49e7e51b9f24d57e6769236ccdad4c88772 100644 --- a/src/plugins/loop_analysis/loop_analysis.mli +++ b/src/plugins/loop_analysis/loop_analysis.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/options.ml b/src/plugins/loop_analysis/options.ml index 4aef563691cefad8dec53dda9543c61b4b23c7af..93e5f668f3a123f80e91b432b610cd41cba2f25b 100644 --- a/src/plugins/loop_analysis/options.ml +++ b/src/plugins/loop_analysis/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/options.mli b/src/plugins/loop_analysis/options.mli index d4fba4d7de6efb94f537dc65cf3706865549e28a..c4fe5b16f890e5d463e34ff02130bc2a3ec0ec67 100644 --- a/src/plugins/loop_analysis/options.mli +++ b/src/plugins/loop_analysis/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/region_analysis.ml b/src/plugins/loop_analysis/region_analysis.ml index 737b2f8bc1552a06acebf94b01b4f2ed2f54d3c0..b4d91e50d074c6f96d19ac5442376b68eead30bc 100644 --- a/src/plugins/loop_analysis/region_analysis.ml +++ b/src/plugins/loop_analysis/region_analysis.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/region_analysis.mli b/src/plugins/loop_analysis/region_analysis.mli index de502a6823218a197133f223a61bc42bbf6ff2b4..f20f83eab88fd518793d9e63a1ea86bdea3a5dfc 100644 --- a/src/plugins/loop_analysis/region_analysis.mli +++ b/src/plugins/loop_analysis/region_analysis.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/region_analysis_sig.ml b/src/plugins/loop_analysis/region_analysis_sig.ml index 72e818cd9aa4f9cc154d5d5cde9958ba323e673f..cce9b4c7666e5b2ab73b8a3e8293bb0127bab511 100644 --- a/src/plugins/loop_analysis/region_analysis_sig.ml +++ b/src/plugins/loop_analysis/region_analysis_sig.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/region_analysis_stmt.ml b/src/plugins/loop_analysis/region_analysis_stmt.ml index 7336c29bd6d4a734bd12b2a33d425f57f6d85075..375eee0ecbbdb53ce5c34a0aedae787646bf0907 100644 --- a/src/plugins/loop_analysis/region_analysis_stmt.ml +++ b/src/plugins/loop_analysis/region_analysis_stmt.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/region_analysis_stmt.mli b/src/plugins/loop_analysis/region_analysis_stmt.mli index 2b3e61631497c8f63b4acbd1261d6531a9fe129a..bdb7ebb0ec44d9d9df03e51445219c5230798631 100644 --- a/src/plugins/loop_analysis/region_analysis_stmt.mli +++ b/src/plugins/loop_analysis/region_analysis_stmt.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/register.ml b/src/plugins/loop_analysis/register.ml index 3b5ad60f12646c06ac31a5ed3677441c54e2fb48..941ec93c19fc14289a5a69f8117a5a19743d5ad4 100644 --- a/src/plugins/loop_analysis/register.ml +++ b/src/plugins/loop_analysis/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/slevel_analysis.ml b/src/plugins/loop_analysis/slevel_analysis.ml index a738172ac848c072bdf712fcab67117e59ba675c..2bc84a98c5ac1c22d6beced041d1a23fce5d14d9 100644 --- a/src/plugins/loop_analysis/slevel_analysis.ml +++ b/src/plugins/loop_analysis/slevel_analysis.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/mixed_output.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/mixed_output.res.oracle index 02dd6b02d2ecc318e4fd76793dd9009314e46061..2fb69a46f950b80d0416b28b92cb544fa1371f4d 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/mixed_output.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/mixed_output.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/mixed_output.i (no preprocessing) [loop] Functions with loops whose bounds we could not find: loop_inf diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/ne.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/ne.res.oracle index 750e30795c0b144cc8e5d46254b8215d2b18e89c..7c54e7911c16b4541e003245de5e1bb5230f9376 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/ne.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/ne.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/ne.i (no preprocessing) tests/loop_analysis/ne.i:38:[loop] warning: termination condition may not be reached (infinite loop?) loop amounts to: for (i = 0; i != 7; i += 2) diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/non_natural_loop.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/non_natural_loop.res.oracle index 6887d6fdb3a8ddb20aba766c0b893db8e8e8779b..5fffdb7fe47b9ed49481518b580db508ac969755 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/non_natural_loop.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/non_natural_loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/non_natural_loop.i (no preprocessing) tests/loop_analysis/non_natural_loop.i:4:[kernel] warning: Non-natural loop detected. [loop] warning: Could not analyze function duff; diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/slevel_overflow.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/slevel_overflow.res.oracle index d7d4b7dd3f65f93d2e62ae25e226fa3162e45333..4142361360ba943044a330b83705a4bbb451454f 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/slevel_overflow.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/slevel_overflow.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/slevel_overflow.c (with preprocessing) [loop] Functions with loops whose estimated bounds were larger than -loop-max-slevel (we recommend setting their slevel to 0 to avoid wasting time): diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.0.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.0.res.oracle index d8b18beaf0bb149038b1844e0485c9611da268fa..25223df726ac3e75b6eb1a93a0c6551a05c8d510 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.0.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/small_loop.i (no preprocessing) [loop] Add this to your command line: -val-slevel-merge-after-loop main \ diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.1.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.1.res.oracle index d8b18beaf0bb149038b1844e0485c9611da268fa..25223df726ac3e75b6eb1a93a0c6551a05c8d510 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.1.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/small_loop.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/small_loop.i (no preprocessing) [loop] Add this to your command line: -val-slevel-merge-after-loop main \ diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.0.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.0.res.oracle index 0b48e16f9f3b9ae6eed76f1f16bdde265a3e3257..6ff9c5a8e0ddd65247fcf161eb6aeef65ab440c0 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.0.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/test.i (no preprocessing) [loop] Functions with loops whose bounds we could not find: g diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.1.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.1.res.oracle index a1dd1a254b5086aa18dc0061f1d9dd521b503f6b..8fb020263b340528aca3a6b34cdd670d9c452427 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.1.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/test.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/test.i (no preprocessing) [loop] Functions with loops whose bounds we could not find: g diff --git a/src/plugins/loop_analysis/tests/loop_analysis/oracle/with_value.res.oracle b/src/plugins/loop_analysis/tests/loop_analysis/oracle/with_value.res.oracle index a2e3498de534a3d3dfd72a5de9c3bff714d62d66..431632795d15c24ca0175434a4dd41662d54683d 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/oracle/with_value.res.oracle +++ b/src/plugins/loop_analysis/tests/loop_analysis/oracle/with_value.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/loop_analysis/with_value.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/loop_analysis/tests/loop_analysis/with_value.i b/src/plugins/loop_analysis/tests/loop_analysis/with_value.i index 84e5b36cc8395c6f30f5783342370e42fea1fd5a..351cc705b420a27484139c74f748f06f0e08715a 100644 --- a/src/plugins/loop_analysis/tests/loop_analysis/with_value.i +++ b/src/plugins/loop_analysis/tests/loop_analysis/with_value.i @@ -1,5 +1,5 @@ /*run.config -OPT: -no-autoload-plugins -load-module from,inout,loopanalysis,value -val -then -loop +OPT: -no-autoload-plugins -load-module from,inout,loopanalysis,value,scope -val -val-show-progress -then -loop */ void f1(int n) { diff --git a/src/plugins/metrics/Metrics.mli b/src/plugins/metrics/Metrics.mli index 3515f7cd328eb254dfe3b77e95c0505f83464acc..6de9e5b4935d4c1c528e8266ed3957db1bbba357 100644 --- a/src/plugins/metrics/Metrics.mli +++ b/src/plugins/metrics/Metrics.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/css_html.ml b/src/plugins/metrics/css_html.ml index 678e47889d02f55578f3f5bad56492f1b1c43316..7d2d7839c661982ac22a20847cc1e33f1dd3d838 100644 --- a/src/plugins/metrics/css_html.ml +++ b/src/plugins/metrics/css_html.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_acsl.ml b/src/plugins/metrics/metrics_acsl.ml index d929236a72bf12d7192a3a2b893c1095089a5e45..d36d512839c26a5f116134aa96f9ecc7363441d1 100644 --- a/src/plugins/metrics/metrics_acsl.ml +++ b/src/plugins/metrics/metrics_acsl.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_acsl.mli b/src/plugins/metrics/metrics_acsl.mli index cdb6f4caf27483e70f7b7e726fbc9b9882c25d47..f1e4e69b41a5b27a5ce0d3ba421d17e5a8ef5309 100644 --- a/src/plugins/metrics/metrics_acsl.mli +++ b/src/plugins/metrics/metrics_acsl.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_base.ml b/src/plugins/metrics/metrics_base.ml index 6ae1c6e085d3f2e68e73a5e0d33987ab53d24740..2515a77e25f538ed998e2859192567fb17313faa 100644 --- a/src/plugins/metrics/metrics_base.ml +++ b/src/plugins/metrics/metrics_base.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -279,11 +279,11 @@ let pretty_extern_vars fmt s = Pretty_utils.pp_iter ~pre:"@[" ~suf:"@]" ~sep:";@ " VInfoSet.iter Printer.pp_varinfo fmt s -let is_in_libc (loc:location) = - Filepath.is_relative ~base:Config.datadir (fst loc).Lexing.pos_fname +let is_in_libc attrs = Cil.hasAttribute "fc_stdlib" attrs || + Cil.hasAttribute "fc_stdlib_generated" attrs let is_entry_point vinfo times_called = - times_called = 0 && not vinfo.vaddrof && not (is_in_libc vinfo.vdecl) + times_called = 0 && not vinfo.vaddrof && not (is_in_libc vinfo.vattr) ;; let number_entry_points fs = @@ -334,11 +334,11 @@ let consider_function ~libc vinfo = not (!Db.Value.mem_builtin vinfo.vname || Ast_info.is_frama_c_builtin vinfo.vname || Cil.is_unused_builtin vinfo - ) && (libc || not (is_in_libc vinfo.vdecl)) + ) && (libc || not (is_in_libc vinfo.vattr)) let consider_variable ~libc vinfo = not (Cil.hasAttribute "FRAMA_C_MODEL" vinfo.vattr) && - (libc || not (is_in_libc vinfo.vdecl)) + (libc || not (is_in_libc vinfo.vattr)) let float_to_string f = let s = Format.sprintf "%F" f in diff --git a/src/plugins/metrics/metrics_base.mli b/src/plugins/metrics/metrics_base.mli index e48d4864b2cc591fa88ca53ebfd63f50ff38038c..7b5bdc7097c02b50207e19182e37c11ba584aba4 100644 --- a/src/plugins/metrics/metrics_base.mli +++ b/src/plugins/metrics/metrics_base.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_cabs.ml b/src/plugins/metrics/metrics_cabs.ml index 98bbe0861b3fc8ace48a70cb64d6ccc35fb0dcaf..480d344a1627a10975b58ac4ebb558cbdcd1676e 100644 --- a/src/plugins/metrics/metrics_cabs.ml +++ b/src/plugins/metrics/metrics_cabs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_cabs.mli b/src/plugins/metrics/metrics_cabs.mli index 7bb8b126c3def7dbff8329b3bc46f1ee4be828fa..cdc3ddd47bcf1aeac63941bde026198de94366c9 100644 --- a/src/plugins/metrics/metrics_cabs.mli +++ b/src/plugins/metrics/metrics_cabs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_cilast.ml b/src/plugins/metrics/metrics_cilast.ml index 261399b5f0fd6fe6f75593b1b70e48e553eb4fbb..3fb967db7f1d9471199c0e57cbe0551c7f22876d 100644 --- a/src/plugins/metrics/metrics_cilast.ml +++ b/src/plugins/metrics/metrics_cilast.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -335,13 +335,25 @@ class slocVisitor ~libc : sloc_visitor = object(self) method! vinst i = begin match i with - | Call(_, e, _, _) -> + | Call(v, e, _, _) -> self#incr_both_metrics incr_calls; (match e.enode with | Lval(Var vinfo, NoOffset) -> self#update_call_maps vinfo 1 | _ -> ()); + (match v with + | Some _ -> self#incr_both_metrics incr_assigns + | None -> ()); | Set _ -> self#incr_both_metrics incr_assigns; - | _ -> () + | Local_init (_, AssignInit _, _) -> self#incr_both_metrics incr_assigns + | Local_init (_, ConsInit(f,_, k),_) -> + (* if f takes the address of the initialized variable as first + argument, there's no explicit assignment in the current function. *) + (match k with + | Plain_func -> self#incr_both_metrics incr_assigns + | Constructor -> ()); + self#incr_both_metrics incr_calls; + self#update_call_maps f 1 + | Asm _ | Skip _ | Code_annot _ -> () end; Cil.DoChildren @@ -531,47 +543,39 @@ class locals_size_visitor kf callstack = object inherit Visitor.frama_c_inplace method! vinst i = match i with - | Call (_, e, _, _) -> + | Call (_, { enode = Lval(Var vi, NoOffset) }, _, _) + | Local_init(_, ConsInit(vi,_,_),_) -> begin - match e.enode with - | Lval ((Var vi), _) -> - begin - try - let kf' = Globals.Functions.find_by_name vi.vname in - Metrics_parameters.debug - "@[function %a:@;computing call to function %a@]" - Kernel_function.pretty kf Kernel_function.pretty kf'; - let new_cs = kf' :: callstack in - if List.mem kf' callstack then - Metrics_parameters.abort - "@[unsupported recursive call detected:@;%a@]" - (Pretty_utils.pp_list ~sep:"@ <-@ " Kernel_function.pretty) - (List.rev new_cs); - let new_vis = new locals_size_visitor kf' new_cs in - ignore (Visitor.visitFramacKf - (new_vis :> Visitor.frama_c_visitor) kf'); - let call_size_no_temps = - Integer.add new_vis#get_max_size_calls_no_temps - new_vis#get_locals_size_no_temps - in - let call_size_temps = - Integer.add new_vis#get_max_size_calls_temps - new_vis#get_locals_size_temps - in - max_size_calls_no_temps <- - Integer.max max_size_calls_no_temps call_size_no_temps; - max_size_calls_temps <- - Integer.max max_size_calls_temps call_size_temps - with Not_found -> - (* should not happen *) - Metrics_parameters.fatal ~current:true - "@[function not found:@;%s@]" vi.vname; - end; - () - | _ -> - Metrics_parameters.warning ~current:true - "@[ignoring unsupported function call in expression:@;%a@]" - Printer.pp_exp e + try + let kf' = Globals.Functions.find_by_name vi.vname in + Metrics_parameters.debug + "@[function %a:@;computing call to function %a@]" + Kernel_function.pretty kf Kernel_function.pretty kf'; + let new_cs = kf' :: callstack in + if List.mem kf' callstack then + Metrics_parameters.abort + "@[unsupported recursive call detected:@;%a@]" + (Pretty_utils.pp_list ~sep:"@ <-@ " Kernel_function.pretty) + (List.rev new_cs); + let new_vis = new locals_size_visitor kf' new_cs in + ignore (Visitor.visitFramacKf + (new_vis :> Visitor.frama_c_visitor) kf'); + let call_size_no_temps = + Integer.add new_vis#get_max_size_calls_no_temps + new_vis#get_locals_size_no_temps + in + let call_size_temps = + Integer.add new_vis#get_max_size_calls_temps + new_vis#get_locals_size_temps + in + max_size_calls_no_temps <- + Integer.max max_size_calls_no_temps call_size_no_temps; + max_size_calls_temps <- + Integer.max max_size_calls_temps call_size_temps + with Not_found -> + (* should not happen *) + Metrics_parameters.fatal ~current:true + "@[function not found:@;%s@]" vi.vname; end; Cil.DoChildren | _ -> Cil.DoChildren diff --git a/src/plugins/metrics/metrics_cilast.mli b/src/plugins/metrics/metrics_cilast.mli index 96e240ddffb78cf0ffaa602f91e84b74085b34db..fe31eb439d8201ccb598a3636e90abc7b703dd39 100644 --- a/src/plugins/metrics/metrics_cilast.mli +++ b/src/plugins/metrics/metrics_cilast.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_coverage.ml b/src/plugins/metrics/metrics_coverage.ml index 0fa853d4ec403c7d98ebe04c7b253642223212ba..3c58b6e8d8334f7ae5098e41ecb561d26d4c2899 100644 --- a/src/plugins/metrics/metrics_coverage.ml +++ b/src/plugins/metrics/metrics_coverage.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -153,7 +153,11 @@ object(self) if Varinfo.Set.mem (Kernel_function.get_vi f) cov_metrics.semantic then let mess = match self#current_stmt with - | Some {skind = Instr (Call (_, {enode = Lval (Var v, _)}, _, _))} + | Some + {skind = + Instr ( + Call (_, {enode = Lval (Var v, NoOffset)}, _, _) + | Local_init (_, ConsInit(v, _, _),_))} when Varinfo.equal v vi -> "calls" | _ -> "references" in @@ -270,15 +274,15 @@ class syntactic_printer ~libc reachable = object(self) (fun fvinfo acc -> if Metrics_base.consider_function ~libc fvinfo then let fname = Metrics_base.file_of_vinfodef fvinfo in - add_binding acc fname fvinfo + add_binding acc (Filepath.pretty fname) fvinfo else acc ) set Datatype.String.Map.empty in Format.fprintf fmt "@[<v 0>"; Datatype.String.Map.iter - (fun fname fvinfoset -> + (fun pretty_fname fvinfoset -> Format.fprintf fmt "@[<hov 2><%s>:@ %a@]@ " - (Filepath.pretty fname) + pretty_fname (fun fmt vinfoset -> let vars = Varinfo.Set.elements vinfoset in let sorted_vars = List.sort compare_vi_names vars in @@ -338,7 +342,7 @@ class semantic_printer ~libc (cov_metrics : coverage_metrics) = object(self) (Metrics_base.mk_hdr 1) "Value coverage statistics" nsyn nall nsem percent; if unseen_num > 0 then - Format.fprintf fmt "@ @[<v 2>Unseen functions (%d) =@ %a@]" + Format.fprintf fmt "@ @[<v 2>Unreached functions (%d) =@ %a@]" unseen_num self#pp_fun_set_by_file unseen; Format.fprintf fmt "@]" diff --git a/src/plugins/metrics/metrics_coverage.mli b/src/plugins/metrics/metrics_coverage.mli index 5a9a387e17823c5c26f98410578af79047bd5102..18f0aea9de06c502b4488b4932a37152cea8f083 100644 --- a/src/plugins/metrics/metrics_coverage.mli +++ b/src/plugins/metrics/metrics_coverage.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_gui.ml b/src/plugins/metrics/metrics_gui.ml index ed160ff8b19d0e11410b15c155e9a57b05572cbb..4cc165094e4e5e87982aaf46269afc83a586e6b8 100644 --- a/src/plugins/metrics/metrics_gui.ml +++ b/src/plugins/metrics/metrics_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_gui.mli b/src/plugins/metrics/metrics_gui.mli index 682d3edbbf9bfcc0c1a9a5bed673515cc49dff85..93f9c971042b1adab6a205a706140eb531f13a39 100644 --- a/src/plugins/metrics/metrics_gui.mli +++ b/src/plugins/metrics/metrics_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_parameters.ml b/src/plugins/metrics/metrics_parameters.ml index 191908fb06b99eab4067bddf20aee6953b481e55..3c0fbf793ae03dd2e12f88fcf29552429e63db42 100644 --- a/src/plugins/metrics/metrics_parameters.ml +++ b/src/plugins/metrics/metrics_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/metrics_parameters.mli b/src/plugins/metrics/metrics_parameters.mli index d5f1da0fc6d4a0c89b82e549413bb474a6f7c87a..5c1b8d41f2e54e5266859781dd19d5ed4485e026 100644 --- a/src/plugins/metrics/metrics_parameters.mli +++ b/src/plugins/metrics/metrics_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/register.ml b/src/plugins/metrics/register.ml index 9572af9959d1ae6fba4bac3fff4a5b3d8a1c9beb..be4a4154909648009013fb825f6a151bd0db24a5 100644 --- a/src/plugins/metrics/register.ml +++ b/src/plugins/metrics/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/metrics/register_gui.ml b/src/plugins/metrics/register_gui.ml index d74897f42132c73b2e8cef824791fc15d1f9f07d..2962d625286ddea2eaf0da196a4ef575c943853d 100644 --- a/src/plugins/metrics/register_gui.ml +++ b/src/plugins/metrics/register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -86,7 +86,7 @@ module CyclomaticMetricsGUI = struct method do_value (main_ui:Design.main_window_extension_points) loc (total:int) (valeur:int) (percent:float) = match loc with - | PVDecl (Some kf,_) -> + | PVDecl (Some kf,_,_) -> begin (* Get the global of this function *) let fname = Kernel_function.get_name kf in @@ -155,7 +155,7 @@ module CyclomaticMetricsGUI = struct method display_localizable localizable () = begin match localizable with - | PVDecl (Some kf,_) -> (* Process only the function selected *) + | PVDecl (Some kf,_,_) -> (* Process only the function selected *) (* Get the global of this function *) checked_fun <- kf; self#do_cyclo main_ui; @@ -165,7 +165,7 @@ module CyclomaticMetricsGUI = struct method cyclo_selector (popup_factory:GMenu.menu GMenu.factory) main_ui ~button localizable = if button = 3 && Db.Value.is_computed () then match localizable with - | PVDecl (Some kf, _) -> + | PVDecl (Some kf, _,_) -> let callback1 () = Metrics_parameters.debug "cyclo_selector - callback"; self#display_localizable localizable () @@ -261,7 +261,7 @@ module ValueCoverageGUI = struct and unseen_hilit () = hilit "red" in match loc with - | Pretty_source.PVDecl(_, vi) -> + | Pretty_source.PVDecl(_, _, vi) -> if Ast_info.is_function_type vi then begin if Varinfo.Set.mem vi pure_syntactic then syn_hilit () else if Varinfo.Set.mem vi metrics.semantic then sem_hilit () diff --git a/src/plugins/nonterm/Makefile.in b/src/plugins/nonterm/Makefile.in index 2ed1f04b1fbc15e6ece9cb260a2e4163d6c3bd96..c59d89cee5dc0840ebf3c00ada37277b65c1f68b 100644 --- a/src/plugins/nonterm/Makefile.in +++ b/src/plugins/nonterm/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -35,7 +35,6 @@ endif PLUGIN_DIR ?=. PLUGIN_ENABLE:=@ENABLE_NONTERM@ -PLUGIN_DYNAMIC:=@DYNAMIC_NONTERM@ PLUGIN_NAME:=Nonterm PLUGIN_CMO:= nonterm_run PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) diff --git a/src/plugins/nonterm/Nonterm.mli b/src/plugins/nonterm/Nonterm.mli index 09181a7c0701dcb7512ea8abcc14b2a59b199e4c..d6b80d2bddc086eb05fa38746694cad6e041059a 100644 --- a/src/plugins/nonterm/Nonterm.mli +++ b/src/plugins/nonterm/Nonterm.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/nonterm/configure.ac b/src/plugins/nonterm/configure.ac index d22740930532427d026d7da39c28af1a16e14fc4..046bb5b8a29759d22e8089f94a98adb025fc9f80 100644 --- a/src/plugins/nonterm/configure.ac +++ b/src/plugins/nonterm/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/nonterm/nonterm_run.ml b/src/plugins/nonterm/nonterm_run.ml index 696c9f47cce891ddad6e0bdfd43d33fae27ddbf8..4c7e33bd2ca611bdb54be5b6487e76af27d6200e 100644 --- a/src/plugins/nonterm/nonterm_run.ml +++ b/src/plugins/nonterm/nonterm_run.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -80,6 +80,8 @@ let pretty_stmt_kind fmt stmt = | Loop _ -> Format.fprintf fmt "loop" | Switch _ -> Format.fprintf fmt "switch" | Instr (Call _) -> Format.fprintf fmt "function call" + | Instr (Local_init(_,ConsInit _,_)) -> + Format.fprintf fmt "function call (initializer)" | _ -> Format.fprintf fmt "statement" let pp_numbered_stacks fmt callstacks = @@ -260,7 +262,8 @@ class stmt_collector to_ignore = object method! vstmt stmt = begin match stmt.skind with - | Instr (Call (_, {enode = Lval (Var vi, _)}, _, _)) when + | (Instr (Call (_, {enode = Lval (Var vi, _)}, _, _)) + | Instr (Local_init (_, ConsInit(vi,_,_), _))) when (ignore_kf vi.vname to_ignore) -> () | _ -> instr_stmts := stmt :: !instr_stmts end; diff --git a/src/plugins/nonterm/tests/nonterm/oracle/builtin_termination.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/builtin_termination.res.oracle index f3858f9dd8c60fec3977dc62fd7478c04ec810be..d1d1920ca7b9fd6a1db6652f1e2553dd0e525e20 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/builtin_termination.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/builtin_termination.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/builtin_termination.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization nondet ∈ [--..--] -[value] Call to builtin bzero(({{ (unsigned char *)&str1 }},{4})) tests/nonterm/builtin_termination.c:15:[value] Call to builtin Frama_C_strlen(({{ &str1[0] }})) tests/nonterm/builtin_termination.c:16:[value] Call to builtin Frama_C_strlen(({{ &str2[0] }})) tests/nonterm/builtin_termination.c:16:[value] warning: builtin Frama_C_strlen: reading indeterminate data diff --git a/src/plugins/nonterm/tests/nonterm/oracle/builtin_with_body.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/builtin_with_body.res.oracle index 3963e9d0ec4720a92b0564beb467273f3d71f025..6e71ca749286cd9185d0dd786e1e32430526ed06 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/builtin_with_body.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/builtin_with_body.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/builtin_with_body.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/callstack.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/callstack.res.oracle index 3ec86077de6dbde1e0f192879ed2421f975c0708..edd55170c2e7111e48ad3da11777beda704f7a17 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/callstack.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/callstack.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/callstack.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n1.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n1.res.oracle index 066336b5b64503b5177efa2a5f51037dbd709765..3b4eff10487888a3310717c4056b1a6694cf9a4b 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n1.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n2.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n2.res.oracle index a3f281f5400d5e65528ee3a90a1f03e3f246d262..9aed11beaf45339680ca7c2306cf2bc66319bc25 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n2.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n3.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n3.res.oracle index ed61a8626c08113614bcbe0271451944c6056078..4772650f3330d9bf09525f6b682d1c3c9f41534b 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n3.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n3.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n4.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n4.res.oracle index fa667124d6a733103972f462faaf268b329dfd1b..ad36cb17bc785b54c478b43babda3a7edaff11e6 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n4.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n4.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n5.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n5.res.oracle index 07b8cc77ce11a73dc44a2050cf64e580934a5d7e..f4b142747d3a81f3c043b791a14cbe169e0d164b 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n5.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n5.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n6.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n6.res.oracle index c0e962f2b8e60cf5dc4f03bb9ac8ce12f6ed4cd6..0bf82ecb5231e49b33854d15737b6c2419576171 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n6.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n6.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n7.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n7.res.oracle index 4fe2af346ff29e906601c45896afd9387f611f47..5c26316b03b32f604ff69e377f0b0c6b1bbc89f7 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n7.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n7.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n8.0.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n8.0.res.oracle index c7661d84818b64f856866903c67567e6f97bdeca..9d0ce1330645d789aab8c609b62a41026d32331a 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n8.0.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n8.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n8.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n8.1.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n8.1.res.oracle index 3d6518e7e062e7802da35886b9b42e69d743537b..960f7491560f4c007feacec054d75af4fe13037d 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n8.1.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n8.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n8.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/n9.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/n9.res.oracle index f9d408cf8aa77d49d979ba89b1917b6987a3bb7d..ae962930c9180129fd8297cb95aaac8cd5cd4417 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/n9.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/n9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/n9.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/nonterm/oracle/output_to_file.res.oracle b/src/plugins/nonterm/tests/nonterm/oracle/output_to_file.res.oracle index 59660e2312c949abe96e574f7353bdfc4cfafd01..ae64bd2703032de364175dc62906e1a8031d124d 100644 --- a/src/plugins/nonterm/tests/nonterm/oracle/output_to_file.res.oracle +++ b/src/plugins/nonterm/tests/nonterm/oracle/output_to_file.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonterm/output_to_file.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/nonterm/tests/test_config b/src/plugins/nonterm/tests/test_config index 3b79d28337b773db0fbbf09552cb068b2457a245..32af202375114b2ca25b608d6a16a5ef3bef3d9f 100644 --- a/src/plugins/nonterm/tests/test_config +++ b/src/plugins/nonterm/tests/test_config @@ -1 +1 @@ -OPT: -no-autoload-plugins -load-module from,inout,nonterm -val -then -nonterm -nonterm-verbose 2 +OPT: -no-autoload-plugins -load-module from,inout,nonterm,scope -val -val-show-progress -then -nonterm -nonterm-verbose 2 diff --git a/src/plugins/obfuscator/Makefile.in b/src/plugins/obfuscator/Makefile.in index d409adc3d921eb93d52f5e0bf290278eb748fd98..ad3967eddf00bd0ea55f5647445290ef5c9927e2 100644 --- a/src/plugins/obfuscator/Makefile.in +++ b/src/plugins/obfuscator/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -29,7 +29,6 @@ endif PLUGIN_DIR ?=. PLUGIN_ENABLE:=@ENABLE_OBFUSCATOR@ -PLUGIN_DYNAMIC:=@DYNAMIC_OBFUSCATOR@ PLUGIN_NAME:=Obfuscator PLUGIN_CMO:= options \ diff --git a/src/plugins/obfuscator/Obfuscator.mli b/src/plugins/obfuscator/Obfuscator.mli index 685e0f3fd519f027b2d6b76326eca8a25efc3c6b..a92f353a8127f03beadea10b3f09c10434964c22 100644 --- a/src/plugins/obfuscator/Obfuscator.mli +++ b/src/plugins/obfuscator/Obfuscator.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/configure.ac b/src/plugins/obfuscator/configure.ac index 8f21fe9ae728f58bba74fb3a3cd526a863ef0284..c201a4c20636c1e495c563d68acb02140256fe98 100644 --- a/src/plugins/obfuscator/configure.ac +++ b/src/plugins/obfuscator/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/obfuscator/dictionary.ml b/src/plugins/obfuscator/dictionary.ml index cd9235e62f538a40d9c776490f99f00d8c884aba..f8fbbbe4c8688fb64efe95dd5b6e370f47f0d88f 100644 --- a/src/plugins/obfuscator/dictionary.ml +++ b/src/plugins/obfuscator/dictionary.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/dictionary.mli b/src/plugins/obfuscator/dictionary.mli index 3cd3608f5a8f6263f0a85f662b2d5bdb03963291..87f14d9ed4b6b3d31473377bad98bcc7393ce07a 100644 --- a/src/plugins/obfuscator/dictionary.mli +++ b/src/plugins/obfuscator/dictionary.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/obfuscate.ml b/src/plugins/obfuscator/obfuscate.ml index 9a008fac4b83d8cb0cc03d2551a7e17e916cb1be..ff7cf3883ead664d5601d656d772524bf63e7f7d 100644 --- a/src/plugins/obfuscator/obfuscate.ml +++ b/src/plugins/obfuscator/obfuscate.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/obfuscate.mli b/src/plugins/obfuscator/obfuscate.mli index cdd045e5a94900d193a1a1a4d421620e5dbd77a5..9e7a53dd7f38666b604a9f1c7582e446c7120ea3 100644 --- a/src/plugins/obfuscator/obfuscate.mli +++ b/src/plugins/obfuscator/obfuscate.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/obfuscator_kind.ml b/src/plugins/obfuscator/obfuscator_kind.ml index 1979c1d95e2afcc7af245c1d44a3533c8f4d4108..be7f1edf081fd8de2bc3556a5975c96c9efbc7e5 100644 --- a/src/plugins/obfuscator/obfuscator_kind.ml +++ b/src/plugins/obfuscator/obfuscator_kind.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/obfuscator_kind.mli b/src/plugins/obfuscator/obfuscator_kind.mli index 56c2aa5ca72dfe4395723726aa1d4f06f5bb2b2a..53534c76591cbbb4a11968a337c8e9de370bf407 100644 --- a/src/plugins/obfuscator/obfuscator_kind.mli +++ b/src/plugins/obfuscator/obfuscator_kind.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/obfuscator_register.ml b/src/plugins/obfuscator/obfuscator_register.ml index 6cd9dcc8bd2027b5853a67c05e320042b97ccf99..755685a4ea5de3fb475d02f476f934ba85fc52a3 100644 --- a/src/plugins/obfuscator/obfuscator_register.ml +++ b/src/plugins/obfuscator/obfuscator_register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/options.ml b/src/plugins/obfuscator/options.ml index d4155d5e7f1a262a318e1d5b8ef48095694c02c7..a3f716c22fe6fe46579fed76fb19fcc5b4ac5930 100644 --- a/src/plugins/obfuscator/options.ml +++ b/src/plugins/obfuscator/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/obfuscator/options.mli b/src/plugins/obfuscator/options.mli index 0fef01093b298146286e19d608ee4ca075b535c3..5d3fb48547b65b4dc759f58700bbabe23c8e6d35 100644 --- a/src/plugins/obfuscator/options.mli +++ b/src/plugins/obfuscator/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/occurrence/Occurrence.mli b/src/plugins/occurrence/Occurrence.mli index a1668782a02d584008bdb3795248e8a7bab74a5d..a5fa4020fba001ebe38b2cc00640d2c560e0da4f 100644 --- a/src/plugins/occurrence/Occurrence.mli +++ b/src/plugins/occurrence/Occurrence.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/occurrence/options.ml b/src/plugins/occurrence/options.ml index 931201fcc6b9a0889d43bb148c2bf87208211c70..e25130941b1510711483e8b491f369b52b8b73c7 100644 --- a/src/plugins/occurrence/options.ml +++ b/src/plugins/occurrence/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/occurrence/options.mli b/src/plugins/occurrence/options.mli index 2fa575dc79c4dfa484b9b1859a84632c35c789b7..27a03a4de51c675b945ce2e698e2c3f895b30b4d 100644 --- a/src/plugins/occurrence/options.mli +++ b/src/plugins/occurrence/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/occurrence/register.ml b/src/plugins/occurrence/register.ml index 51ca7dfe618e7f75948ec2c80844d7b8a494280a..3544c041109dce54f10d6d2719844770d3f270b2 100644 --- a/src/plugins/occurrence/register.ml +++ b/src/plugins/occurrence/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -109,16 +109,16 @@ class occurrence = object (self) method! vlval lv = let ki = self#current_kinstr in if Db.Value.is_accessible ki then begin - let z = !Db.Value.lval_to_zone ki ~with_alarms:CilE.warn_none_mode lv in + let z = !Db.Value.lval_to_zone ki lv in try Locations.Zone.fold_topset_ok (fun b _ () -> match b with - | Base.Var (vi, _) | Base.Allocated (vi, _) -> + | Base.Var (vi, _) | Base.Allocated (vi, _, _) -> Occurrences.add vi self#current_kf ki lv | _ -> () ) z () - with Locations.Zone.Error_Top -> + with Abstract_interp.Error_Top -> error ~current:true "Found completely imprecise value (%a). Ignoring@." Printer.pp_lval lv end; @@ -178,6 +178,15 @@ let classify_accesses (_kf, ki, lv) = else Write else Read + | Local_init (v, _, _) -> + (match lv with + | Var v', _ when Cil_datatype.Varinfo.equal v v' -> + (* We are initializing v. We can't read from it at the same time. + Hence, there's no need to perform the additional checks done + in the cases above. *) + Write + | _ -> Read) + | Asm (_, _, Some { asm_outputs; asm_inputs },_) -> if List.exists (fun (_, _, out) -> is_lv out) asm_outputs then if List.exists (fun (_, _, inp) -> contained_exp inp) asm_inputs diff --git a/src/plugins/occurrence/register_gui.ml b/src/plugins/occurrence/register_gui.ml index 0e61aa770be24ccdb18f33277866490c025b3559..8209527d80d0efa7d85a221fd5fcf4cfda1cbb94 100644 --- a/src/plugins/occurrence/register_gui.ml +++ b/src/plugins/occurrence/register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -94,7 +94,7 @@ let find_occurrence (main_ui:Design.main_window_extension_points) vi () = main_ui#rehighlight () let apply_on_vi f localizable = match localizable with - | PVDecl(_,vi) + | PVDecl(_,_,vi) | PLval(_, _, (Var vi, NoOffset)) | PTermLval(_, _, _, (TVar { lv_origin = Some vi }, TNoOffset)) -> if not (Cil.isFunctionType vi.vtype) then @@ -127,7 +127,7 @@ let occurrence_highlighter buffer loc ~start ~stop = && Kinstr.equal k ki in if List.exists same_tlval result then highlight () - | PVDecl(_, vi') when Varinfo.equal vi vi' -> + | PVDecl(_, _,vi') when Varinfo.equal vi vi' -> highlight () | PExp _ | PVDecl _ | PStmt _ | PGlobal _ | PIP _ -> () diff --git a/src/plugins/occurrence/register_gui.mli b/src/plugins/occurrence/register_gui.mli index e3ba789a43402f2b483a05a1de9324b0852b539f..cb392fa6d81e29face9c30bd144df580d0171848 100644 --- a/src/plugins/occurrence/register_gui.mli +++ b/src/plugins/occurrence/register_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/Pdg.mli b/src/plugins/pdg/Pdg.mli index 7edb60f72f2791affec2a30fd344b98ae03bee92..bdae5ecdaab1136f2e6a9029c8f8a632d662f7a2 100644 --- a/src/plugins/pdg/Pdg.mli +++ b/src/plugins/pdg/Pdg.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/annot.ml b/src/plugins/pdg/annot.ml index a676e1e6138bc43855a1b04a1dbe1cd09ab06b03..1b498e19ed4c01552a50f2ed6785d95056f23f69 100644 --- a/src/plugins/pdg/annot.ml +++ b/src/plugins/pdg/annot.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -138,14 +138,15 @@ let find_code_annot_nodes pdg stmt annot = try (Sets.find_label_node pdg !stmt l)::acc with Not_found -> acc in List.fold_left add acc (!stmt).labels - | LogicLabel (Some stmt, str) -> - let add acc l = match l with - | Label (sl, _, _) when sl = str -> - (try (Sets.find_label_node pdg stmt l)::acc - with Not_found -> acc) - | _ -> acc - in List.fold_left add acc stmt.labels - | LogicLabel (None, _) -> acc + | BuiltinLabel (Some stmt, l) -> + let str = Format.asprintf "%a" Printer.pp_logic_builtin_label l in + let add acc l = match l with + | Label (sl, _, _) when sl = str -> + (try (Sets.find_label_node pdg stmt l)::acc + with Not_found -> acc) + | _ -> acc + in List.fold_left add acc stmt.labels + | FormalLabel _ | BuiltinLabel (None, _) -> acc in let ctrl_dpds = Logic_label.Set.fold add_label_nodes labels ctrl_dpds in if Pdg_parameters.debug_atleast 2 then begin diff --git a/src/plugins/pdg/annot.mli b/src/plugins/pdg/annot.mli index 0c5d9fbddb94dce9c289b13b5068d20b43a471ea..ace099ca0157faefc1df9c68729525a12a452374 100644 --- a/src/plugins/pdg/annot.mli +++ b/src/plugins/pdg/annot.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/build.ml b/src/plugins/pdg/build.ml index 886b976570fa46236e1c763f6f89e446e37e2448..bdf2eb6dc8c64e9f7d8a228c2e043d8bb11c3b2e 100644 --- a/src/plugins/pdg/build.ml +++ b/src/plugins/pdg/build.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -250,10 +250,8 @@ let is_variadic kf = add_decl_dpd pdg new_node Dpd.Addr decl_node ; add_decl_dpd pdg decl_node Dpd.Addr new_node ; let z = Locations.zone_of_varinfo v in - let new_state = - Pdg_state.add_loc_node - state ~initializing:true ~exact:true z new_node in - (n+1, new_state) + let new_state = Pdg_state.add_loc_node state ~exact:true z new_node in + (n+1, new_state) in let _next_in_num, new_state = List.fold_left do_param (1, Pdg_state.empty) formals in @@ -283,7 +281,7 @@ let is_variadic kf = let new_node = arg in add_ctrl_dpd pdg new_node ctrl_node; let z = Locations.zone_of_varinfo param in - Pdg_state.add_loc_node ~initializing:true state z new_node ~exact:true + Pdg_state.add_loc_node state z new_node ~exact:true in let rec do_param_arg state param_list (arg_nodes: arg_nodes) = match param_list, arg_nodes with @@ -348,16 +346,15 @@ let is_variadic kf = (** for skip statement : we want to add a node in the PDG in order to be able * to store information (like marks) about this statement later on *) - let process_skip pdg _state stmt = - ignore (add_elem pdg (Key.stmt_key stmt)); - None (* keep previous state *) + let process_skip pdg state stmt = + ignore (add_elem pdg (Key.stmt_key stmt)); state (** for asm: similar to [process_skip], except that we emit a warning *) - let process_asm pdg _state stmt = + let process_asm pdg state stmt = Pdg_parameters.warning ~once:true ~current:true "Ignoring inline assembly code"; ignore (add_elem pdg (Key.stmt_key stmt)); - None (* keep previous state *) + state let add_label pdg label label_stmt = @@ -627,7 +624,7 @@ let process_asgn pdg state stmt lval exp = in add_dpds pdg new_node Dpd.Data state r_dpds; add_decl_dpds pdg new_node Dpd.Data r_decl; - Some new_state + new_state (** Add a PDG node and its dependencies for each explicit call argument. *) @@ -700,7 +697,7 @@ let call_outputs pdg state_before_call state_with_inputs stmt Use the state at ki (before the call) and returns the new state (after the call). *) -let process_call pdg state stmt lvaloption funcexp argl = +let process_call pdg state stmt lvaloption funcexp argl _loc = let state_before_call = state in (** add a simple node for each call in order to have something in the PDG for this statement even if there are no input/output *) @@ -709,7 +706,6 @@ let process_call pdg state stmt lvaloption funcexp argl = let state_with_args = state in let funcexp_dpds, called_functions = !Db.Value.expr_to_kernel_function - ~with_alarms:CilE.warn_none_mode (Kstmt stmt) ~deps:(Some Locations.Zone.bottom) funcexp in let mixed_froms = @@ -718,7 +714,7 @@ let process_call pdg state stmt lvaloption funcexp argl = in let process_simple_call called_kf acc = let state_with_inputs = - process_call_params pdg state_with_args stmt called_kf arg_nodes + process_call_params pdg state_with_args stmt called_kf arg_nodes in let r = match mixed_froms with @@ -752,7 +748,7 @@ let process_call pdg state stmt lvaloption funcexp argl = call_outputs pdg state_before_call new_state stmt lvaloption froms funcexp_dpds in - Some new_state + new_state (** Add a node in the PDG for the conditional statement, * and register the statements that are control-dependent on it. @@ -858,28 +854,37 @@ module Computer let join a b = fst (join_and_is_included a b) let is_included a b = snd (join_and_is_included a b) + let rec process_init current_pdg state stmt lv = function + | SingleInit e -> process_asgn current_pdg state stmt lv e + | CompoundInit (_,l) -> + List.fold_left + (fun acc (o,i) -> + let lv = Cil.addOffsetLval o lv in + process_init current_pdg acc stmt lv i) + state l + (** Compute the new state after 'instr' starting from state before 'state'. *) let doInstr stmt instr state = !Db.progress (); pdg_debug "doInstr sid:%d : %a" stmt.sid Printer.pp_instr instr; - let state' = match instr with + match instr with | _ when not (Db.Value.is_reachable_stmt stmt) -> - pdg_debug "stmt sid:%d is unreachable : skip.@." stmt.sid ; - Some Pdg_state.bottom + pdg_debug "stmt sid:%d is unreachable : skip.@." stmt.sid ; + Pdg_state.bottom + | Local_init (v, AssignInit i, _) -> + process_init current_pdg state stmt (Cil.var v) i + | Local_init (v, ConsInit (f, args, kind), loc) -> + !Db.progress (); + Cil.treat_constructor_as_func + (process_call current_pdg state stmt) v f args kind loc | Set (lv, exp, _) -> process_asgn current_pdg state stmt lv exp - | Call (lvaloption,funcexp,argl,_) -> + | Call (lvaloption,funcexp,argl,loc) -> !Db.progress (); - process_call current_pdg state stmt lvaloption funcexp argl + process_call current_pdg state stmt lvaloption funcexp argl loc | Code_annot _ | Skip _ -> process_skip current_pdg state stmt | Asm _ -> process_asm current_pdg state stmt - in - (* BY: simplify this code. No need to return an option in the functions - above *) - match state' with - | None -> state - | Some state -> state (** Called before processing the successors of the statements. *) diff --git a/src/plugins/pdg/build.mli b/src/plugins/pdg/build.mli index eb0a7665ac51037d9a521b1f54c62d5bbfe2e2a4..346b2bb5fda4d79890cb48e272cdd2b753ec3a75 100644 --- a/src/plugins/pdg/build.mli +++ b/src/plugins/pdg/build.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/ctrlDpds.ml b/src/plugins/pdg/ctrlDpds.ml index 2ce81a28ecff14d580ff41dfebd7b7cdf0f11cde..f8896ff38a6b3afbcd39c1c8b8f3df97ace02d74 100644 --- a/src/plugins/pdg/ctrlDpds.ml +++ b/src/plugins/pdg/ctrlDpds.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/ctrlDpds.mli b/src/plugins/pdg/ctrlDpds.mli index 294ac402e309f57507765602c3b848dda275825d..dff6a0143d6a83598deec89795dcef9e6d149b36 100644 --- a/src/plugins/pdg/ctrlDpds.mli +++ b/src/plugins/pdg/ctrlDpds.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/marks.ml b/src/plugins/pdg/marks.ml index 566cacbd88583833c3976c0d874d427762886122..a0c57b516fa95f7c70c38a16a8cd7f46e6938e33 100644 --- a/src/plugins/pdg/marks.ml +++ b/src/plugins/pdg/marks.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/marks.mli b/src/plugins/pdg/marks.mli index 42215b9a162e1e59b3606cc99e9d3290f8d4e044..2340f5963ee163b90e83ea73411aeeb95c63acad 100644 --- a/src/plugins/pdg/marks.mli +++ b/src/plugins/pdg/marks.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/pdg_parameters.ml b/src/plugins/pdg/pdg_parameters.ml index 0eec1d42a64ac4e7cbc5d2d702f09eba94c7aaee..719e326e1412c492e99ee014a258705d2465e816 100644 --- a/src/plugins/pdg/pdg_parameters.ml +++ b/src/plugins/pdg/pdg_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/pdg_parameters.mli b/src/plugins/pdg/pdg_parameters.mli index d524318d7a9fa444404c31671b8591861e087174..3b88f8f18946f5f9032c5a645aadbb2ec18570bb 100644 --- a/src/plugins/pdg/pdg_parameters.mli +++ b/src/plugins/pdg/pdg_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/pdg_state.ml b/src/plugins/pdg/pdg_state.ml index ee2560cec085efff4858ef342d0a8907efd0c4d9..06db9ae6fa87f576ebcf14c022e3ebb6b92d0a38 100644 --- a/src/plugins/pdg/pdg_state.ml +++ b/src/plugins/pdg/pdg_state.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -47,7 +47,7 @@ let pretty fmt state = LocInfo.pretty state.loc_info Locations.Zone.pretty state.under_outputs -let add_loc_node state ?(initializing=false) ~exact loc node = +let add_loc_node state ~exact loc node = P.debug ~dkey ~level:2 "add_loc_node (%s) : node %a -> %a@." (if exact then "exact" else "merge") PdgTypes.Node.pretty node @@ -58,9 +58,8 @@ let add_loc_node state ?(initializing=false) ~exact loc node = state else let new_info = NodeSetLattice.inject_singleton node in - let reducing = initializing in let new_loc_info = - LocInfo.add_binding ~exact ~reducing state.loc_info loc new_info in + LocInfo.add_binding ~exact state.loc_info loc new_info in let new_outputs = (* Zone.link in the under-approx version of Zone.join *) if exact then Locations.Zone.link state.under_outputs loc else state.under_outputs @@ -79,8 +78,7 @@ let add_init_state_input state loc node = | _ -> let new_info = NodeSetLattice.inject_singleton node in let new_loc_info = - LocInfo.add_binding - ~reducing:true ~exact:false state.loc_info loc new_info + LocInfo.add_binding ~exact:false state.loc_info loc new_info in let new_outputs = Locations.Zone.link state.under_outputs loc in make new_loc_info new_outputs diff --git a/src/plugins/pdg/pdg_state.mli b/src/plugins/pdg/pdg_state.mli index accc7bd94c90358243207eb28daced1f98d146d3..979b6d7245e564af3030d51c5f05af1e9eb80c89 100644 --- a/src/plugins/pdg/pdg_state.mli +++ b/src/plugins/pdg/pdg_state.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,7 +30,7 @@ val empty : data_state val bottom: data_state val add_loc_node : - data_state -> ?initializing:bool -> exact:bool -> Locations.Zone.t -> Node.t -> data_state + data_state -> exact:bool -> Locations.Zone.t -> Node.t -> data_state val add_init_state_input : data_state -> Locations.Zone.t -> Node.t -> data_state diff --git a/src/plugins/pdg/register.ml b/src/plugins/pdg/register.ml index a5c37b543f898fc53d508fce76dc98c13b343341..56e5287f6f43edf8a5eb825f3b3c7e1dddb98186 100644 --- a/src/plugins/pdg/register.ml +++ b/src/plugins/pdg/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/sets.ml b/src/plugins/pdg/sets.ml index 2ecfd16cb5ad2f89043bf4205ee9ef80b37dd216..5b8060d2d3df5bb43b0d61669e647e4154671c52 100644 --- a/src/plugins/pdg/sets.ml +++ b/src/plugins/pdg/sets.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg/sets.mli b/src/plugins/pdg/sets.mli index 06576983af26617b97fe24403ed95384ee980299..9dc480f456d0c48614902dad3f2ed7617373e6a9 100644 --- a/src/plugins/pdg/sets.mli +++ b/src/plugins/pdg/sets.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg_types/pdgIndex.ml b/src/plugins/pdg_types/pdgIndex.ml index 975adc7bf5220c15ade5b67bcb0ebc68edc016da..0c91e98902ff403404269aedbb62f05e04c579ba 100644 --- a/src/plugins/pdg_types/pdgIndex.ml +++ b/src/plugins/pdg_types/pdgIndex.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,7 +29,9 @@ exception CallStatement exception Not_equal let is_call_stmt stmt = - match stmt.skind with Instr (Call _) -> true | _ -> false + match stmt.skind with + | Instr (Call _|Local_init(_,ConsInit _,_)) -> true + | _ -> false module Signature = struct type in_key = InCtrl | InNum of int | InImpl of Locations.Zone.t diff --git a/src/plugins/pdg_types/pdgIndex.mli b/src/plugins/pdg_types/pdgIndex.mli index c5217ee5bf403f5029c4b99683bfc6f6095e6bd4..f9e026599ab7b16eda03847b190c91feba5dd4e3 100644 --- a/src/plugins/pdg_types/pdgIndex.mli +++ b/src/plugins/pdg_types/pdgIndex.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg_types/pdgMarks.ml b/src/plugins/pdg_types/pdgMarks.ml index c594233be488c95673d4c877da7d76f309dff575..17c16d7b18ff904fe81d3dbaf556561e3f52b109 100644 --- a/src/plugins/pdg_types/pdgMarks.ml +++ b/src/plugins/pdg_types/pdgMarks.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg_types/pdgMarks.mli b/src/plugins/pdg_types/pdgMarks.mli index cec8092445797ed824f9c1f1f3d4a51392177216..e18a30e771858b5bdc172510b85fd5df2dc7cd3c 100644 --- a/src/plugins/pdg_types/pdgMarks.mli +++ b/src/plugins/pdg_types/pdgMarks.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/pdg_types/pdgTypes.ml b/src/plugins/pdg_types/pdgTypes.ml index 79856f8e41eec00c6774d774a5f0f3c9bd8405e1..b066f4dbbbb4e74f0e161a7dfa891c0265a97d7c 100644 --- a/src/plugins/pdg_types/pdgTypes.ml +++ b/src/plugins/pdg_types/pdgTypes.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -111,7 +111,7 @@ let () = Ast.add_monotonic_state NodeSet.self (** set of nodes of the graph *) module NodeSetLattice = struct - include Abstract_interp.Make_Lattice_Set(Node) + include Abstract_interp.Make_Lattice_Set (Node) (Node.Set) let default : t = empty end diff --git a/src/plugins/pdg_types/pdgTypes.mli b/src/plugins/pdg_types/pdgTypes.mli index 4a3d4a35ad957474e7bccd28b45d09bf7a0e34cc..4b41756f6f0121503747b11555f4efabccee99cd 100644 --- a/src/plugins/pdg_types/pdgTypes.mli +++ b/src/plugins/pdg_types/pdgTypes.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/postdominators/Postdominators.mli b/src/plugins/postdominators/Postdominators.mli index 590b88bfeb23a064c37b63f2edc2106c59938872..80b7707c4a051255678add6d1410fd71330399cd 100644 --- a/src/plugins/postdominators/Postdominators.mli +++ b/src/plugins/postdominators/Postdominators.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/postdominators/compute.ml b/src/plugins/postdominators/compute.ml index 0e1eeea7c2f3fb894f9914091d811d4bf3c38873..f31f070a000babc14e95213feef1361711d8be21 100644 --- a/src/plugins/postdominators/compute.ml +++ b/src/plugins/postdominators/compute.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/postdominators/postdominators_parameters.ml b/src/plugins/postdominators/postdominators_parameters.ml index 298fb820fbe0c9c7df47be899fa5a64cd565abaf..f79f3dafe20fe15bf95e714ed096550d2571d63a 100644 --- a/src/plugins/postdominators/postdominators_parameters.ml +++ b/src/plugins/postdominators/postdominators_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/postdominators/postdominators_parameters.mli b/src/plugins/postdominators/postdominators_parameters.mli index 14adfb724e1ad2cfb3883125b754401dcf240601..b364030649f065eacca9756478aad6fb2af1f1c5 100644 --- a/src/plugins/postdominators/postdominators_parameters.mli +++ b/src/plugins/postdominators/postdominators_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/postdominators/print.ml b/src/plugins/postdominators/print.ml index 226eb6c404d18749b99151c1ec60f61c1064a23a..d6910fc7390f3d860c630576262a67f305423b71 100644 --- a/src/plugins/postdominators/print.ml +++ b/src/plugins/postdominators/print.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/print_api/Makefile b/src/plugins/print_api/Makefile index 1f33ca8ed94c211eae5b4a22f9370eceef43b7af..d6af05a30c77b35871e87f3746bc7ef48058a512 100644 --- a/src/plugins/print_api/Makefile +++ b/src/plugins/print_api/Makefile @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/print_api/Print_api.mli b/src/plugins/print_api/Print_api.mli index 09181a7c0701dcb7512ea8abcc14b2a59b199e4c..d6b80d2bddc086eb05fa38746694cad6e041059a 100644 --- a/src/plugins/print_api/Print_api.mli +++ b/src/plugins/print_api/Print_api.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/print_api/grammar.mly b/src/plugins/print_api/grammar.mly index efdb9a84b9049feb07b32d4851c305eeaa16c4db..dad8de399b0812e07f52d95be33b1aaf2649f067 100644 --- a/src/plugins/print_api/grammar.mly +++ b/src/plugins/print_api/grammar.mly @@ -2,7 +2,7 @@ /* */ /* This file is part of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ diff --git a/src/plugins/print_api/lexer.mll b/src/plugins/print_api/lexer.mll index afad392a476ab91bed719aa65e896a444135125a..d4739036035258edc00ea0809bd1a730540cef0c 100644 --- a/src/plugins/print_api/lexer.mll +++ b/src/plugins/print_api/lexer.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/print_api/print_interface.ml b/src/plugins/print_api/print_interface.ml index 71bf44c56c7b2f3d83a75da39204c075923a83b0..c666496bf23845e9d5ffd7b0da0618084042ec48 100644 --- a/src/plugins/print_api/print_interface.ml +++ b/src/plugins/print_api/print_interface.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/Makefile.in b/src/plugins/report/Makefile.in index 8cd9b1a7def551d614ada59ce6cd491c9461d3ee..a223bdd7432036891908c7ddd3767ae001707fa3 100644 --- a/src/plugins/report/Makefile.in +++ b/src/plugins/report/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -35,7 +35,6 @@ endif PLUGIN_DIR ?=. PLUGIN_ENABLE:=@ENABLE_REPORT@ -PLUGIN_DYNAMIC:=@DYNAMIC_REPORT@ PLUGIN_NAME:=Report PLUGIN_CMO:= report_parameters scan dump csv register PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) diff --git a/src/plugins/report/Report.mli b/src/plugins/report/Report.mli index 268f1c420ebba0ee71779801968409fd56f8c4f9..c6975ee973a030de4da0a40d43e1533b5cae18cb 100644 --- a/src/plugins/report/Report.mli +++ b/src/plugins/report/Report.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,5 +20,8 @@ (* *) (**************************************************************************) - -(** No function is directly exported: they are registered in {!Db.Report}. *) +(* Pretty prints a report about the status of all properties. + @since Frama-C+dev *) +module Register : sig + val print : unit -> unit +end diff --git a/src/plugins/report/configure.ac b/src/plugins/report/configure.ac index 0354d79b814259620bbffa08536ee127c3efaa08..9cb3002836ffb9cbfe5d758c47bc9c348a7ba80d 100644 --- a/src/plugins/report/configure.ac +++ b/src/plugins/report/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/report/csv.ml b/src/plugins/report/csv.ml index 0ace93bc3c6f344154b8656bb7bcffeeefa987b9..1806f2d5de4a7ec32da902853b4a33e9e9932b86 100644 --- a/src/plugins/report/csv.ml +++ b/src/plugins/report/csv.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/csv.mli b/src/plugins/report/csv.mli index 09181a7c0701dcb7512ea8abcc14b2a59b199e4c..d6b80d2bddc086eb05fa38746694cad6e041059a 100644 --- a/src/plugins/report/csv.mli +++ b/src/plugins/report/csv.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/dump.ml b/src/plugins/report/dump.ml index 5ad8ca0f599335ded29ccfc29d213050d1bedd74..b579a023c6cd89722e612cba19745e969be8b729 100644 --- a/src/plugins/report/dump.ml +++ b/src/plugins/report/dump.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/dump.mli b/src/plugins/report/dump.mli index 65a31473e046842a8c834e77d3f3a7a60fd24014..2dbb30aee4c35c6bb69d6948321a27b694c35fe1 100644 --- a/src/plugins/report/dump.mli +++ b/src/plugins/report/dump.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/register.ml b/src/plugins/report/register.ml index e5287bf8774706bcee81d6d2df052ab99c8ae0d0..ef40ffb18f913eebcc26f744dc5d1070b7a012af 100644 --- a/src/plugins/report/register.ml +++ b/src/plugins/report/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -24,10 +24,10 @@ (* --- Plug-in Implementation --- *) (* -------------------------------------------------------------------------- *) -let print () = +let print () = Report_parameters.feedback "Computing properties status..." ; Log.print_on_output (fun fmt -> Scan.iter (Dump.create fmt)) - + let print = Dynamic.register ~plugin:"Report" @@ -40,7 +40,7 @@ let print, _ = State_builder.apply_once "Report.print_once" [ Report_parameters.Enabled.self; (* reprint if we explicitly ask for *) - Report_parameters.PrintProperties.self; + Report_parameters.PrintProperties.self; Report_parameters.Specialized.self; Property_status.self ] print @@ -48,7 +48,6 @@ let print, _ = let main () = if Report_parameters.Enabled.get () then print () let () = - Db.Report.print := print; Db.Main.extend main; (* diff --git a/src/plugins/report/register.mli b/src/plugins/report/register.mli index d7abe4a79ccd86150d5975b85f8b6712fa340e30..7e601306707c55e0d9be0d3a0246638a9773206b 100644 --- a/src/plugins/report/register.mli +++ b/src/plugins/report/register.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/report_parameters.ml b/src/plugins/report/report_parameters.ml index b673fac760e7f9b2eb498f4a6b80854228fb23e3..2eff9c689ef05c8dd2675fce9dda88c877ad351f 100644 --- a/src/plugins/report/report_parameters.ml +++ b/src/plugins/report/report_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/report_parameters.mli b/src/plugins/report/report_parameters.mli index 6f5eb6fea92af2db9e544465fede39f0b6b2218c..0df2c1cd49bb1d97a3531a6a4f29e1fd4b500330 100644 --- a/src/plugins/report/report_parameters.mli +++ b/src/plugins/report/report_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/scan.ml b/src/plugins/report/scan.ml index 1f062292c8c9818ff09e48689612977243806087..daea1f40f3edba6eda86633cb4f3439294c82048 100644 --- a/src/plugins/report/scan.ml +++ b/src/plugins/report/scan.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/scan.mli b/src/plugins/report/scan.mli index 7faba5bbaec147786d442d3ba3dc5fd8b0063f58..1c7611cd3ec223eba0dbc9999228218dcbcaec19 100644 --- a/src/plugins/report/scan.mli +++ b/src/plugins/report/scan.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/report/tests/report/csv.c b/src/plugins/report/tests/report/csv.c index 67c18868e0670c43ad5bb9f1a1d9fb3e53a2548f..80f3d05a79b7b707d57a1b7d1e2998ab00fa2c89 100644 --- a/src/plugins/report/tests/report/csv.c +++ b/src/plugins/report/tests/report/csv.c @@ -1,6 +1,6 @@ /* run.config LOG: csv.csv - OPT: -no-autoload-plugins -load-module from,inout,report,scope,value -val-warn-copy-indeterminate=-main4 -val -remove-redundant-alarms -no-val-warn-on-alarms -value-msg-key=-alarm -then -report-csv @PTEST_RESULT@/csv.csv -report-no-proven -then -report-csv= -val-warn-on-alarms -slevel 1 + OPT: -no-autoload-plugins -load-module from,inout,report,scope,value -val-warn-copy-indeterminate=-main4 -val -val-show-progress -remove-redundant-alarms -no-val-warn-on-alarms -value-msg-key=-alarm -then -report-csv @PTEST_RESULT@/csv.csv -report-no-proven -then -report-csv= -val-warn-on-alarms -slevel 1 COMMENT: first, do an analysis without any message, but check that the .csv is complete. Then, redo the analysis with value warnings. slevel 1 is just there to force Value to restart */ volatile v; diff --git a/src/plugins/report/tests/report/oracle/csv.res.oracle b/src/plugins/report/tests/report/oracle/csv.res.oracle index f6d492d9b88cf97d2c4ab760108a341d680e6f54..d7cfc641c781e4b0c17fa51a70911c2e5d0c78d4 100644 --- a/src/plugins/report/tests/report/oracle/csv.res.oracle +++ b/src/plugins/report/tests/report/oracle/csv.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/report/csv.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/src/plugins/report/tests/report/oracle/hyp.0.res.oracle b/src/plugins/report/tests/report/oracle/hyp.0.res.oracle index 5a51a41627e0c2477473a50ae5b0fa04b8b0a6a6..e78d730a035aaa235e1c957d2fb6f0414eddc845 100644 --- a/src/plugins/report/tests/report/oracle/hyp.0.res.oracle +++ b/src/plugins/report/tests/report/oracle/hyp.0.res.oracle @@ -1,11 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/report/hyp.i (no preprocessing) [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- tests/report/hyp.i:25:[kernel] warning: Neither code nor specification for function f, generating default assigns from the prototype [kernel] SETTING STATUS OF assert \false; TO unknown diff --git a/src/plugins/report/tests/report/oracle/hyp.1.res.oracle b/src/plugins/report/tests/report/oracle/hyp.1.res.oracle index 471d90f35921b67493a6de68e8944ba1299758e4..efdc1442b0b209f062926aaae566cb7456e396fb 100644 --- a/src/plugins/report/tests/report/oracle/hyp.1.res.oracle +++ b/src/plugins/report/tests/report/oracle/hyp.1.res.oracle @@ -1,11 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/report/hyp.i (no preprocessing) [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- tests/report/hyp.i:25:[kernel] warning: Neither code nor specification for function f, generating default assigns from the prototype tests/report/hyp.i:25:[kernel] warning: Neither code nor specification for function f2, generating default assigns from the prototype diff --git a/src/plugins/report/tests/report/oracle/single.0.res.oracle b/src/plugins/report/tests/report/oracle/single.0.res.oracle index c988c8dc06eb759ecb11827ea7e37fae8f3bcb64..64f57594d7338549f7c58223a8bb7b7fc8adfddf 100644 --- a/src/plugins/report/tests/report/oracle/single.0.res.oracle +++ b/src/plugins/report/tests/report/oracle/single.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/report/single.i (no preprocessing) [kernel] SETTING STATUS TO unknown IN p [report] Computing properties status... @@ -51,11 +50,8 @@ -------------------------------------------------------------------------------- [kernel] CHANGING DEFAULT PROJECT TO p2 [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- [kernel] SETTING STATUS TO false_and_reachable [report] Computing properties status... @@ -91,11 +87,8 @@ -------------------------------------------------------------------------------- [kernel] SETTING A CORRECTNESS PARAMETER [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- [kernel] SETTING STATUS TO unknown IN p [report] Computing properties status... diff --git a/src/plugins/report/tests/report/oracle/single.1.res.oracle b/src/plugins/report/tests/report/oracle/single.1.res.oracle index 8be7b4a22da720ca25929c043935f280d6cad1e1..a47026150e026717af27c229e66c8b3ff8bd1ae6 100644 --- a/src/plugins/report/tests/report/oracle/single.1.res.oracle +++ b/src/plugins/report/tests/report/oracle/single.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/report/single.i (no preprocessing) [kernel] SETTING STATUS TO dont_know [report] Computing properties status... diff --git a/src/plugins/report/tests/report/oracle/single.2.res.oracle b/src/plugins/report/tests/report/oracle/single.2.res.oracle index 25993d3ea455f8d1b6759d8fa5b966a2a6d84def..08bdf3a349cd32576721e2ecfb66f20b0ee98378 100644 --- a/src/plugins/report/tests/report/oracle/single.2.res.oracle +++ b/src/plugins/report/tests/report/oracle/single.2.res.oracle @@ -1,11 +1,7 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/report/single.i (no preprocessing) [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- [kernel] Test1 SET STATUS TO unknown [kernel] Test2 SET STATUS TO unknown diff --git a/src/plugins/rte/RteGen.mli b/src/plugins/rte/RteGen.mli index d2355d1abe39381c9d75cd9e68c716b42e62dacf..0b668451a28c8d8f3cbc97b8d310c3773fae99aa 100644 --- a/src/plugins/rte/RteGen.mli +++ b/src/plugins/rte/RteGen.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/rte/generator.ml b/src/plugins/rte/generator.ml index 00b5c408d2d517d23181fd87a6d1eabf27e307d1..a02a9524a4e074f7c88f3e1a43e4254c2dd4d77e 100644 --- a/src/plugins/rte/generator.ml +++ b/src/plugins/rte/generator.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -131,6 +131,16 @@ module Float_to_int = let additional_parameters = [] end) + +module Finite_float = + Make + (struct + let name = "finite_float" + let parameter = Kernel.FiniteFloat.parameter + let additional_parameters = [] + end) + + module Called_precond = Make (struct @@ -167,6 +177,8 @@ let pointer_call_status = Pointer_call.triple let float_to_int_status = Float_to_int.triple let unsigned_overflow_status = Unsigned_overflow.triple let unsigned_downcast_status = Unsigned_downcast.triple +let float_to_int = Float_to_int.triple +let finite_float = Finite_float.triple let all_status = [ precond_status; diff --git a/src/plugins/rte/generator.mli b/src/plugins/rte/generator.mli index 21eeb6fbb3fdafb7dcd068a23e47442769976107..298be841290ce96bec745018eae71d54ff62470e 100644 --- a/src/plugins/rte/generator.mli +++ b/src/plugins/rte/generator.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,6 +34,7 @@ module Signed_downcast: S module Unsigned_overflow: S module Unsigned_downcast: S module Float_to_int: S +module Finite_float: S module Called_precond: S val emitter: Emitter.t @@ -48,6 +49,8 @@ val signed_overflow_status: Db.RteGen.status_accessor val signed_downcast_status: Db.RteGen.status_accessor val unsigned_overflow_status: Db.RteGen.status_accessor val unsigned_downcast_status: Db.RteGen.status_accessor +val float_to_int: Db.RteGen.status_accessor +val finite_float: Db.RteGen.status_accessor val all_status: Db.RteGen.status_accessor list diff --git a/src/plugins/rte/options.ml b/src/plugins/rte/options.ml index 772eab7ab707a7f42b2c5efce66edc5d0826f686..b7f9f4757eab3fc9923c7debd8cf2c1389dad1d3 100644 --- a/src/plugins/rte/options.ml +++ b/src/plugins/rte/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -54,7 +54,7 @@ module DoShift = let help = "when on (default), annotate for left and right shifts by a value out of bounds" end) -(* annotates division by zero (undefined behavior) *) +(* annotates casts from floating-point to integer (undefined behavior) *) module DoFloatToInt = True (struct diff --git a/src/plugins/rte/options.mli b/src/plugins/rte/options.mli index f86cef2972c433c56beda2f3cee79df0adc8d9f9..0e7c53c0b1d34804174d71016465f6efe5986010 100644 --- a/src/plugins/rte/options.mli +++ b/src/plugins/rte/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/rte/register.ml b/src/plugins/rte/register.ml index 4a4af1926c0da3fbb307ef98e6771441e6479296..042a41ff8e2e597bc96a789c98d4bd8cfb793819 100644 --- a/src/plugins/rte/register.ml +++ b/src/plugins/rte/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -61,7 +61,9 @@ let () = Db.RteGen.get_unsignedOv_status Generator.unsigned_overflow_status; nojournal_register Db.RteGen.get_unsignedDownCast_status Generator.unsigned_downcast_status; - nojournal_register Db.RteGen.get_all_status Generator.all_status + nojournal_register Db.RteGen.get_all_status Generator.all_status; + nojournal_register Db.RteGen.get_float_to_int_status Generator.float_to_int; + nojournal_register Db.RteGen.get_finite_float_status Generator.finite_float (* dynamic registration *) diff --git a/src/plugins/rte/rte.ml b/src/plugins/rte/rte.ml index c2c72c0fc70cc9ede02b5a9ef154ceabbf1b9e04..92b08f8330dc885a632037bda17e73bc75d2f65d 100644 --- a/src/plugins/rte/rte.ml +++ b/src/plugins/rte/rte.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -126,7 +126,7 @@ let uminus_assertion ~remove_trivial ~on_alarm exp = else alarm () (* assertions for multiplication/addition/subtraction overflows *) -let mult_sub_add_assertion ~remove_trivial ~on_alarm (signed,exp,op,lexp,rexp) = +let mult_sub_add_assertion ~signed ~remove_trivial ~on_alarm (exp,op,lexp,rexp) = (* signed multiplication/addition/subtraction: the expression overflows iff its integer value is strictly more than [max_ty] or strictly less than [min_ty] *) @@ -245,7 +245,7 @@ let signed_div_assertion ~remove_trivial ~on_alarm (exp, lexp, rexp) = end else alarm () -let shift_alarm ~remove_trivial ~on_alarm (exp, upper_bound) = +let shift_width_assertion ~remove_trivial ~on_alarm (exp, upper_bound) = let alarm ?status () = let a = Alarms.Invalid_shift(exp, upper_bound) in on_alarm ?status a; @@ -267,7 +267,7 @@ let shift_alarm ~remove_trivial ~on_alarm (exp, upper_bound) = else alarm () (* assertions for bitwise left/right shift signed overflow *) -let signed_shift_assertion ~remove_trivial ~on_alarm (exp, op, lexp, rexp) = +let shift_overflow_assertion ~signed ~remove_trivial ~on_alarm (exp, op, lexp, rexp) = (* - (1) right operand should be nonnegative and strictly less than the width of promoted left operand: now done by shift_right_operand_assertion @@ -280,14 +280,18 @@ let signed_shift_assertion ~remove_trivial ~on_alarm (exp, op, lexp, rexp) = if size <> Cil.bitsSizeOf (Cil.typeOf lexp) then (* size of result type should be size of left (promoted) operand *) Options.warn "problem with bitsSize of %a: not treated" Printer.pp_exp exp; - shift_alarm ~remove_trivial ~on_alarm (lexp, None); + if signed then + shift_width_assertion ~remove_trivial ~on_alarm (lexp, None); if op = Shiftlt then (* compute greatest representable "size bits" (signed) integer *) - let maxValResult = Cil.max_signed_number size in + let maxValResult = + if signed + then Cil.max_signed_number size + else Cil.max_unsigned_number size + in let overflow_alarm ?status () = - let a = - Alarms.Overflow(Alarms.Signed, exp, maxValResult, Alarms.Upper_bound) - in + let signed = if signed then Alarms.Signed else Alarms.Unsigned in + let a = Alarms.Overflow (signed, exp, maxValResult, Alarms.Upper_bound) in on_alarm ?status a; in if remove_trivial then begin @@ -433,6 +437,10 @@ let float_to_int_assertion ~remove_trivial ~on_alarm (ty, exp) = ) | _ -> () +(* assertion for checking only finite float are used *) +let finite_float_assertion ~remove_trivial:_ ~on_alarm (fkind, exp) = + on_alarm ?status:None (Alarms.Is_nan_or_infinite(exp,fkind)) + (* assertion for a pointer call [( *e )(...)]. *) let pointer_call ~remove_trivial:_ ~on_alarm e = on_alarm ?status:None (Alarms.Function_pointer e) diff --git a/src/plugins/rte/rte.mli b/src/plugins/rte/rte.mli index fae9fdba0c2e3b3c0328d0c1e4e134251d30727e..ef3f34bf8e2ac0536177003b243129e9d830ba14 100644 --- a/src/plugins/rte/rte.mli +++ b/src/plugins/rte/rte.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -36,13 +36,14 @@ type 'a alarm_gen = val lval_assertion: read_only: Alarms.access_kind -> lval alarm_gen val divmod_assertion: exp alarm_gen val signed_div_assertion: (exp * exp * exp) alarm_gen -val shift_alarm: (exp * int option) alarm_gen -val signed_shift_assertion: (exp * binop * exp * exp) alarm_gen -val mult_sub_add_assertion: (bool * exp * binop * exp * exp) alarm_gen +val shift_width_assertion: (exp * int option) alarm_gen +val shift_overflow_assertion: signed:bool -> (exp * binop * exp * exp) alarm_gen +val mult_sub_add_assertion: signed:bool -> (exp * binop * exp * exp) alarm_gen val uminus_assertion: exp alarm_gen val signed_downcast_assertion: (typ * exp) alarm_gen val unsigned_downcast_assertion: (typ * exp) alarm_gen val float_to_int_assertion: (typ * exp) alarm_gen +val finite_float_assertion: (fkind * exp) alarm_gen val pointer_call: exp alarm_gen (* diff --git a/src/plugins/rte/visit.ml b/src/plugins/rte/visit.ml index 71134d7870d57dda8fda18cff3477d30384650ea..3141423b4fbc80fff118064b921a266a140a8a24 100644 --- a/src/plugins/rte/visit.ml +++ b/src/plugins/rte/visit.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -145,9 +145,9 @@ let replacement_visitor replace_pre fa_terms ret_opt = object method! vlogic_label = function | StmtLabel _ -> Cil.DoChildren - | LogicLabel _ as l when Logic_label.equal l Logic_const.pre_label -> + | BuiltinLabel _ as l when Logic_label.equal l Logic_const.pre_label -> Cil.ChangeDoChildrenPost(replace_pre, fun x->x) - | LogicLabel _ -> Cil.DoChildren + | BuiltinLabel _ | FormalLabel _ -> Cil.DoChildren end @@ -205,6 +205,7 @@ type to_annotate = { signed_downcast: bool; unsigned_downcast: bool; float_to_int: bool; + finite_float: bool; pointer_call: bool; precond: bool; } @@ -218,6 +219,7 @@ let annotate_nothing = { signed_downcast = false; unsigned_downcast = false; float_to_int = false; + finite_float = false; pointer_call = false; precond = false; } @@ -231,6 +233,7 @@ let annotate_all = { signed_downcast = true; unsigned_downcast = true; float_to_int = true; + finite_float = true; pointer_call = true; precond = true; } @@ -246,6 +249,7 @@ let annotate_from_options () = { signed_downcast = Kernel.SignedDowncast.get (); unsigned_downcast = Kernel.UnsignedDowncast.get (); float_to_int = Options.DoFloatToInt.get (); + finite_float = Kernel.FiniteFloat.get (); pointer_call = Options.DoPointerCall.get (); precond = Options.DoCalledPrecond.get (); } @@ -289,6 +293,9 @@ class annot_visitor kf to_annot on_alarm = object (self) method private do_float_to_int () = to_annot.float_to_int && not (Generator.Float_to_int.is_computed kf) + method private do_finite_float () = + to_annot.finite_float && not (Generator.Finite_float.is_computed kf) + method private do_pointer_call () = to_annot.pointer_call && not (Generator.Pointer_call.is_computed kf) @@ -329,7 +336,7 @@ class annot_visitor kf to_annot on_alarm = object (self) let p' = Logic_const.pred_of_id_pred p in try let p_unnamed = - Logic_const.unamed + Logic_const.unamed ~loc:p'.pred_loc (treat_pred replace_pre p'.pred_content @@ -435,18 +442,18 @@ class annot_visitor kf to_annot on_alarm = object (self) let rec change_at_result acc = function | [] -> Writes (List.rev acc) | (a,from) :: tl -> - let new_a = match a.it_content.term_node with - | Tat ({term_node=(TLval(TResult _,_) as trm)}, - LogicLabel (_, "Post")) -> - let ttype = Ctype ret_type - (* cf. bug #559 *) - (* Logic_utils.typ_to_logic_type - ret_type *) - in - Logic_const.new_identified_term + let new_a = match a.it_content.term_node with + | Tat ({term_node=(TLval(TResult _,_) as trm)}, + BuiltinLabel (_, Post)) -> + let ttype = Ctype ret_type + (* cf. bug #559 *) + (* Logic_utils.typ_to_logic_type + ret_type *) + in + Logic_const.new_identified_term (Logic_const.term trm ttype) - | _ -> a - in + | _ -> a + in change_at_result ((new_a,from) :: acc) tl in change_at_result [] assigns @@ -627,18 +634,7 @@ class annot_visitor kf to_annot on_alarm = object (self) Cil.ChangeDoChildrenPost (s', fun _ -> s) | _ -> Cil.DoChildren - (* assigned left values are checked for valid access *) - method! vinst = function - | Set (lval,_,_) -> - if self#do_mem_access () then begin - Options.debug "lval %a: validity of potential mem access checked\n" - Printer.pp_lval lval; - self#generate_assertion - (Rte.lval_assertion ~read_only:Alarms.For_writing) - lval - end; - Cil.DoChildren - | Call (ret_opt,funcexp,argl,_) -> + method private treat_call ret_opt funcexp argl = (match ret_opt, self#do_mem_access () with | None, _ | Some _, false -> () | Some ret, true -> @@ -688,6 +684,19 @@ class annot_visitor kf to_annot on_alarm = object (self) Cil_printer.pp_stmt (Extlib.the (self#current_stmt)); | _ -> assert false end; + + (* assigned left values are checked for valid access *) + method! vinst = function + | Set (lval,_,_) -> + if self#do_mem_access () then begin + Options.debug "lval %a: validity of potential mem access checked\n" + Printer.pp_lval lval; + self#generate_assertion + (Rte.lval_assertion ~read_only:Alarms.For_writing) + lval + end; + Cil.DoChildren + | Call (ret_opt,funcexp,argl,_) -> self#treat_call ret_opt funcexp argl; (* Alarm if the call is through a pointer. Done in DoChildrenPost to get a more pleasant ordering of annotations. *) let do_ptr () = @@ -697,112 +706,140 @@ class annot_visitor kf to_annot on_alarm = object (self) | _ -> () in Cil.DoChildrenPost (fun res -> do_ptr (); res) - | _ -> Cil.DoChildren + | Local_init (v,ConsInit(f,args,kind),loc) -> + let do_call lv e args _loc = self#treat_call lv e args in + Cil.treat_constructor_as_func do_call v f args kind loc; + Cil.DoChildren + | Local_init (_,AssignInit _,_) + | Asm _ | Skip _ | Code_annot _ -> Cil.DoChildren method! vexpr exp = Options.debug "considering exp %a\n" Printer.pp_exp exp; match exp.enode with - | BinOp((Div | Mod) as op, lexp, rexp, ty) -> - (match Cil.unrollType ty with - | TInt(kind,_) -> - (* add assertion "divisor not zero" *) - if self#do_div_mod () then - self#generate_assertion Rte.divmod_assertion rexp; - if self#do_signed_overflow () && op = Div && Cil.isSigned kind then - (* treat the special case of signed division overflow - (no signed modulo overflow) *) - self#generate_assertion Rte.signed_div_assertion (exp, lexp, rexp); - Cil.DoChildren - | _ -> Cil.DoChildren) - - | BinOp((Shiftlt | Shiftrt) as op, lexp, rexp,ttype ) -> - (match Cil.unrollType ttype with - | TInt(kind,_) -> - if self#do_shift () then begin - let t = Cil.unrollType (Cil.typeOf exp) in - let size = Cil.bitsSizeOf t in - (* Not really a problem of overflow, but almost a similar to self#do_div_mod *) - self#generate_assertion Rte.shift_alarm (rexp, Some size); - end; - if self#do_signed_overflow () && Cil.isSigned kind then - self#generate_assertion - Rte.signed_shift_assertion (exp, op, lexp, rexp); - Cil.DoChildren - | _ -> Cil.DoChildren) - - | BinOp((PlusA |MinusA | Mult) as op, lexp, rexp, ttype) -> - (* may be skipped if the enclosing expression is a downcast to a signed - type *) - (match Cil.unrollType ttype with - | TInt(kind,_) when Cil.isSigned kind -> - if self#do_signed_overflow () && not (self#must_skip exp) then - self#generate_assertion Rte.mult_sub_add_assertion - (true, exp, op, lexp, rexp); - Cil.DoChildren - | TInt(kind,_) when not (Cil.isSigned kind) -> - if self#do_unsigned_overflow () then - self#generate_assertion Rte.mult_sub_add_assertion - (false, exp, op, lexp, rexp); - Cil.DoChildren - | _ -> Cil.DoChildren) - - | UnOp(Neg, exp, ty) -> - (* Note: if unary minus on unsigned integer is to be understood as - "subtracting the promoted value from the largest value - of the promoted type and adding one", - the result is always representable: so no overflow *) - (match Cil.unrollType ty with - | TInt(kind,_) when Cil.isSigned kind -> - if self#do_signed_overflow () then - self#generate_assertion Rte.uminus_assertion exp; - | _ -> ()); - Cil.DoChildren - - | Lval lval -> - (* left values are checked for valid access *) - Cil.DoChildrenPost - (fun new_e -> - (* Use Cil.DoChildrenPost so that inner expression and lvals are - checked first. The order of resulting assertions will be better. *) - if self#do_mem_access () then begin - Options.debug - "exp %a is an lval: validity of potential mem access checked" - Printer.pp_exp exp; - self#generate_assertion - (Rte.lval_assertion ~read_only:Alarms.For_reading) lval - end; - new_e) - - | CastE (ty, e) -> - (match Cil.unrollType ty, Cil.unrollType (Cil.typeOf e) with - | TInt(kind,_), TInt (_, _) -> - if Cil.isSigned kind then begin - if self#do_signed_downcast () then begin - self#generate_assertion Rte.signed_downcast_assertion (ty, e); - self#mark_to_skip e; - end - end - else if self#do_unsigned_downcast () then - self#generate_assertion Rte.unsigned_downcast_assertion (ty, e) - - | TInt _, TFloat _ -> - if self#do_float_to_int () then - self#generate_assertion Rte.float_to_int_assertion (ty, e) - - | _ -> ()); - Cil.DoChildren - - | StartOf _ - | AddrOf _ - | Info _ - | UnOp _ - | Const _ - | BinOp _ -> Cil.DoChildren | SizeOf _ | SizeOfE _ | SizeOfStr _ | AlignOf _ | AlignOfE _ -> Cil.SkipChildren + | _ -> + let generate () = + match exp.enode with + | BinOp((Div | Mod) as op, lexp, rexp, ty) -> + (match Cil.unrollType ty with + | TInt(kind,_) -> + (* add assertion "divisor not zero" *) + if self#do_div_mod () then + self#generate_assertion Rte.divmod_assertion rexp; + if self#do_signed_overflow () && op = Div && Cil.isSigned kind then + (* treat the special case of signed division overflow + (no signed modulo overflow) *) + self#generate_assertion Rte.signed_div_assertion (exp, lexp, rexp) + | TFloat(fkind,_) when self#do_finite_float () -> + self#generate_assertion Rte.finite_float_assertion (fkind,exp); + | _ -> ()) + + | BinOp((Shiftlt | Shiftrt) as op, lexp, rexp,ttype ) -> + (match Cil.unrollType ttype with + | TInt(kind,_) -> + if self#do_shift () then begin + let t = Cil.unrollType (Cil.typeOf exp) in + let size = Cil.bitsSizeOf t in + (* Not really a problem of overflow, but almost a similar to self#do_div_mod *) + self#generate_assertion Rte.shift_width_assertion (rexp, Some size); + end; + let signed = Cil.isSigned kind in + if self#do_signed_overflow () && signed + || self#do_unsigned_overflow () && not signed + then + self#generate_assertion + (Rte.shift_overflow_assertion ~signed) (exp, op, lexp, rexp) + | _ -> ()) + + | BinOp((PlusA |MinusA | Mult) as op, lexp, rexp, ttype) -> + (* may be skipped if the enclosing expression is a downcast to a signed + type *) + (match Cil.unrollType ttype with + | TInt(kind,_) when Cil.isSigned kind -> + if self#do_signed_overflow () && not (self#must_skip exp) then + self#generate_assertion + (Rte.mult_sub_add_assertion ~signed:true) + (exp, op, lexp, rexp) + | TInt(kind,_) when not (Cil.isSigned kind) -> + if self#do_unsigned_overflow () then + self#generate_assertion + (Rte.mult_sub_add_assertion ~signed:false) + (exp, op, lexp, rexp) + | TFloat(fkind,_) when self#do_finite_float () -> + self#generate_assertion Rte.finite_float_assertion (fkind,exp) + | _ -> ()) + + | UnOp(Neg, exp, ty) -> + (* Note: if unary minus on unsigned integer is to be understood as + "subtracting the promoted value from the largest value + of the promoted type and adding one", + the result is always representable: so no overflow *) + (match Cil.unrollType ty with + | TInt(kind,_) when Cil.isSigned kind -> + if self#do_signed_overflow () then + self#generate_assertion Rte.uminus_assertion exp; + | TFloat(fkind,_) when self#do_finite_float () -> + self#generate_assertion Rte.finite_float_assertion (fkind,exp) + | _ -> ()) + + | Lval lval -> + (* left values are checked for valid access *) + if self#do_mem_access () then begin + Options.debug + "exp %a is an lval: validity of potential mem access checked" + Printer.pp_exp exp; + self#generate_assertion + (Rte.lval_assertion ~read_only:Alarms.For_reading) lval + end + | CastE (ty, e) -> + (match Cil.unrollType ty, Cil.unrollType (Cil.typeOf e) with + (* to , from *) + | TInt(kind,_), TInt (_, _) -> + if Cil.isSigned kind then begin + if self#do_signed_downcast () then begin + self#generate_assertion Rte.signed_downcast_assertion (ty, e); + self#mark_to_skip e; + end + end + else if self#do_unsigned_downcast () then + self#generate_assertion Rte.unsigned_downcast_assertion (ty, e) + + | TInt _, TFloat _ -> + if self#do_float_to_int () then + self#generate_assertion Rte.float_to_int_assertion (ty, e) + + | TFloat (to_fkind,_), TFloat (from_fkind,_) when + self#do_finite_float () && Cil.frank to_fkind < Cil.frank from_fkind -> + self#generate_assertion Rte.finite_float_assertion (to_fkind,exp) + | _ -> ()); + | Const (CReal(f,fkind,_)) when self#do_finite_float () -> + begin match Pervasives.classify_float f with + | FP_normal + | FP_subnormal + | FP_zero -> () + | FP_infinite + | FP_nan -> + self#generate_assertion Rte.finite_float_assertion (fkind,exp) + end + | StartOf _ + | AddrOf _ + | Info _ + | UnOp _ + | Const _ + | BinOp _ -> () + | SizeOf _ + | SizeOfE _ + | SizeOfStr _ + | AlignOf _ + | AlignOfE _ -> assert false + in + (* Use Cil.DoChildrenPost so that inner expression and lvals are + checked first. The order of resulting assertions will be better. *) + Cil.DoChildrenPost (fun new_e -> generate (); new_e) end diff --git a/src/plugins/rte/visit.mli b/src/plugins/rte/visit.mli index 7cbbe255a75b7e9cfa0ce9075c242f18effb0842..3560c3b95c81f367985e216f43c7cbbd0efc8ccb 100644 --- a/src/plugins/rte/visit.mli +++ b/src/plugins/rte/visit.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/scope/Scope.mli b/src/plugins/scope/Scope.mli index 65076d16b7fff3142680f221f0ac6d284e614526..bad5466d2479d9bfed2b78bee6cc8b42ccf1ac93 100644 --- a/src/plugins/scope/Scope.mli +++ b/src/plugins/scope/Scope.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,7 +20,66 @@ (* *) (**************************************************************************) +open Cil_types +open Cil_datatype + (** Scope analysis. *) -(** No function is directly exported: - they are registered in !Db.Scope. *) +(** Interface for the Scope plugin. + @see <index.html> internal documentation. *) +module Defs : sig + val get_defs : + Kernel_function.t -> stmt -> lval -> + (Stmt.Hptset.t * Locations.Zone.t option) option + (** @return the set of statements that define [lval] before [stmt] in [kf]. + Also returns the zone that is possibly not defined. + Can return [None] when the information is not available (Pdg missing). *) + + val get_defs_with_type : + Kernel_function.t -> stmt -> lval -> + ((bool * bool) Stmt.Map.t * Locations.Zone.t option) option +(** @return a map from the statements that define [lval] before [stmt] in + [kf]. The first boolean indicates the possibility of a direct + modification at this statement, ie. [lval = ...] or [lval = f()]. + The second boolean indicates a possible indirect modification through + a call. + Also returns the zone that is possibly not defined. + Can return [None] when the information is not available (Pdg missing). + *) +end + +module Datascope : sig + val get_data_scope_at_stmt : + Kernel_function.t -> stmt -> lval -> + Stmt.Hptset.t * (Stmt.Hptset.t * Stmt.Hptset.t) + (** @raise Kernel_function.No_Definition if [kf] has no definition. + @return 3 statement sets related to the value of [lval] before [stmt] : + - the forward selection, + - the both way selection, + - the backward selection. *) + + val get_prop_scope_at_stmt : + kernel_function -> stmt -> code_annotation -> + Stmt.Hptset.t * code_annotation list + (** compute the set of statements where the given annotation has the same + value as before the given stmt. Also returns the eventual code annotations + that are implied by the one given as argument. *) + + val check_asserts : unit -> code_annotation list + (** Print how many assertions could be removed based on the previous + analysis ([get_prop_scope_at_stmt]) and return the annotations + that can be removed. *) + + val rm_asserts : unit -> unit + (** Same analysis than [check_asserts] but mark the assertions as proven. *) +end + +(** {3 Zones} *) + +module Zones : sig + type t_zones = Locations.Zone.t Stmt.Hashtbl.t + val build_zones : + kernel_function -> stmt -> lval -> Stmt.Hptset.t * t_zones + val pretty_zones : Format.formatter -> t_zones -> unit + val get_zones : t_zones -> Cil_types.stmt -> Locations.Zone.t +end diff --git a/src/plugins/scope/datascope.ml b/src/plugins/scope/datascope.ml index 81e9e55e5d636c10d9e1114a97d7af059d61974e..57c816bb9e430213951b610d58bb41090906fc74 100644 --- a/src/plugins/scope/datascope.ml +++ b/src/plugins/scope/datascope.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -38,7 +38,6 @@ module R = let cat_rm_asserts = R.register_category cat_rm_asserts_name - (** {2 Computing a mapping between zones and modifying statements} We first go through all the function statements in other to build a mapping between each zone and the statements that are modifying it. @@ -71,9 +70,9 @@ module InitSid = struct let empty = LM.empty let find = LM.find - let add_zone ~exact lmap zone sid = + let add_zone lmap zone sid = let new_val = StmtSetLattice.single sid in - LM.add_binding ~reducing:false ~exact lmap zone new_val + LM.add_binding ~exact:false lmap zone new_val let pretty fmt lmap = Format.fprintf fmt "Lmap = %a@\n" LM.pretty lmap @@ -91,16 +90,26 @@ let get_lval_zones ~for_writing stmt lval = * Something to do only for calls and assignments. * *) let register_modified_zones lmap stmt = - let register lmap zone = - (* [exact] should always be false because we want to store all the stmts *) - InitSid.add_zone ~exact:false lmap zone stmt + let register lmap zone = InitSid.add_zone lmap zone stmt in + let aux_out kf out = + let inout= !Db.Operational_inputs.get_internal_precise ~stmt kf in + Locations.Zone.join out inout.Inout_type.over_outputs in - match stmt.skind with + match stmt.skind with | Instr (Set (lval, _, _)) -> let _dpds, _, zone = get_lval_zones ~for_writing:true stmt lval in register lmap zone + | Instr (Local_init(v, i, _)) -> + let _, _, zone = get_lval_zones ~for_writing:true stmt (Cil.var v) in + let lmap_init = register lmap zone in + (match i with + | AssignInit _ -> lmap_init + | ConsInit(f,_,_) -> + let kf = Globals.Functions.get f in + let out = aux_out kf Locations.Zone.bottom in + register lmap_init out) | Instr (Call (dst,funcexp,_args,_)) -> begin let lmap = match dst with @@ -112,12 +121,7 @@ let register_modified_zones lmap stmt = register lmap zone in let _, kfs = - !Db.Value.expr_to_kernel_function - ~with_alarms:CilE.warn_none_mode ~deps:None (Kstmt stmt) funcexp - in - let aux_out kf out = - let inout= !Db.Operational_inputs.get_internal_precise ~stmt kf in - Locations.Zone.join out inout.Inout_type.over_outputs + !Db.Value.expr_to_kernel_function ~deps:None (Kstmt stmt) funcexp in let out = Kernel_function.Hptset.fold aux_out kfs Locations.Zone.bottom @@ -134,6 +138,7 @@ let compute kf = R.debug ~level:1 "computing for function %a" Kernel_function.pretty kf; let f = Kernel_function.get_definition kf in let do_stmt lmap s = + Cil.CurrentLoc.set (Cil_datatype.Stmt.loc s); if Db.Value.is_reachable_stmt s then register_modified_zones lmap s else lmap @@ -235,11 +240,11 @@ module BackwardScope (X : sig val modified : stmt -> bool end ) = struct | _ -> state include State - + end -let backward_data_scope _allstmts modif_stmts s kf = - let modified s = StmtSetLattice.mem s modif_stmts in +let backward_data_scope modif_stmts s kf = + let modified s = StmtSetLattice.mem s modif_stmts in let module Fenv = (val Dataflows.function_env kf: Dataflows.FUNCTION_ENV) in let module Arg = struct include BackwardScope(struct let modified = modified end) @@ -249,12 +254,21 @@ let backward_data_scope _allstmts modif_stmts s kf = Compute.pre_state ;; -module ForwardScope (X : sig val modified : stmt -> bool end ) = struct +module ForwardScope (X : sig + (* Effects of the statement itself *) + val modified : stmt -> bool + (* Effects of scope change *) + val modified_by_edge: stmt -> stmt -> bool + end) = +struct include State;; let transfer_stmt s state = let map_on_all_succs new_state = - List.map (fun x -> (x,new_state)) s.succs + let do_succ s' = + (s', State.transfer (X.modified_by_edge s s') new_state) + in + List.map do_succ s.succs in match s.skind with | Instr _ -> map_on_all_succs (State.transfer (X.modified s) state) @@ -270,12 +284,15 @@ module ForwardScope (X : sig val modified : stmt -> bool end ) = struct end -let forward_data_scope modif_stmts s kf = - let modified s = StmtSetLattice.mem s modif_stmts in +let forward_data_scope modif_stmts modif_edge s kf = + let modified s = StmtSetLattice.mem s modif_stmts in let module Fenv = (val Dataflows.function_env kf: Dataflows.FUNCTION_ENV) in let module Arg = struct - include ForwardScope(struct let modified = modified end) - let init = [(s,State.Start)];; + include ForwardScope(struct + let modified = modified + let modified_by_edge = modif_edge + end) + let init = [(s,State.Start)];; end in let module Compute = Dataflows.Simple_forward(Fenv)(Arg) in Compute.pre_state, Compute.post_state @@ -295,21 +312,96 @@ let add_s s acc = * - forward and backward, * - backward only. *) -let find_scope allstmts modif_stmts s kf = +let find_scope allstmts modif_stmts modif_edge s kf = (* Add only statements for which the lvalue certainly did not change. *) let add get_state acc s = match get_state s with | State.Start | State.SameVal -> add_s s acc | _ -> acc in - let _, fw_post = forward_data_scope modif_stmts s kf in + let _, fw_post = forward_data_scope modif_stmts modif_edge s kf in let fw = List.fold_left (add fw_post) Cil_datatype.Stmt.Hptset.empty allstmts in - let bw_pre = backward_data_scope allstmts modif_stmts s kf in + let bw_pre = backward_data_scope modif_stmts s kf in let bw = List.fold_left (add bw_pre) Cil_datatype.Stmt.Hptset.empty allstmts in let fb = Cil_datatype.Stmt.Hptset.inter bw fw in let fw = Cil_datatype.Stmt.Hptset.diff fw fb in let bw = Cil_datatype.Stmt.Hptset.diff bw fb in - fw, fb, bw + fw, fb, bw + +(* Computes the memory zones that points to a base in [escaping] in a state. *) +let gather_escaping_zones escaping = function + | Cvalue.Model.Top -> Locations.Zone.top + | Cvalue.Model.Bottom -> Locations.Zone.bottom + | Cvalue.Model.Map m -> + let aux base offsm zone = + let test b = Base.Hptset.mem b escaping in + let gather (_, _ as itv) (v, _, _) acc = + let v = Cvalue.V_Or_Uninitialized.get_v v in + if Cvalue.V.contains_addresses_of_locals test v + then + let z = Locations.Zone.inject base (Int_Intervals.inject_itv itv) in + Locations.Zone.join acc z + else acc + in + Cvalue.V_Offsetmap.fold gather offsm zone + in + Cvalue.Model.fold aux m Locations.Zone.bottom + +(* compute the memory zones that are changed into ESCAPING ADDRESS + when taking the cfg edge s1->s2 *) +let compute_escaping_zones s1 s2 = + let closed_blocks = Kernel_function.blocks_closed_by_edge s1 s2 in + let locals = List.flatten (List.map (fun b -> b.blocals) closed_blocks) in + let filter acc v = + if v.vtemp || not v.vreferenced + then acc else Base.Hptset.add (Base.of_varinfo v) acc + in + let bases = List.fold_left filter Base.Hptset.empty locals in + if Base.Hptset.is_empty bases + then Locations.Zone.bottom + else gather_escaping_zones bases (Db.Value.get_stmt_state s1) + +(* type pair_stmts = stmt * stmt *) +module PairStmts = + Datatype.Pair_with_collections + (Cil_datatype.Stmt)(Cil_datatype.Stmt) + (struct let module_name = "Scope.Datascope.PairStmts" end) + +(* Hashtbl from pairs of stmts to zone. Used as maps from Cfg edges to the + memory zones that are 'modified' by thescope change. *) +module HashPairStmtsZone = + PairStmts.Hashtbl.Make(Locations.Zone) +type modified_by_edge = HashPairStmtsZone.t + +(* compute the {!modified_by_edge} hashtbl for the fundec [fdec] *) +let compute_modif_edge fdec : modified_by_edge = + let modifs_edge = PairStmts.Hashtbl.create 17 in + let do_stmt stmt = + let do_succ stmt' = + let z = compute_escaping_zones stmt stmt' in + PairStmts.Hashtbl.add modifs_edge (stmt, stmt') z + in + List.iter do_succ stmt.succs + in + List.iter do_stmt fdec.sallstmts; + modifs_edge + +module ModifEdge = + Cil_state_builder.Kernel_function_hashtbl(HashPairStmtsZone) + (struct + let name = "Scope.Datatscope.ModifsEdge" + let dependencies = [Db.Value.self] + let size = 16 + end) + +let modified_by_edge_kf = + ModifEdge.memo + (fun kf -> compute_modif_edge (Kernel_function.get_definition kf)) + +(* Does the Cfg edge [s1->s2] has an effect on [z]? *) +let is_modified_by_edge kf z s1 s2 = + let modifs_edge = modified_by_edge_kf kf in + Locations.Zone.intersects z (PairStmts.Hashtbl.find modifs_edge (s1, s2)) (** Try to find the statement set where [data] has the same value than * before [stmt]. @@ -321,7 +413,10 @@ let get_data_scope_at_stmt kf stmt lval = let zone = Locations.Zone.join dpds zone in let allstmts, info = compute kf in let modif_stmts = InitSid.find info zone in - let (f_scope, fb_scope, b_scope) = find_scope allstmts modif_stmts stmt kf in + let modifs_edge = is_modified_by_edge kf zone in + let (f_scope, fb_scope, b_scope) = + find_scope allstmts modif_stmts modifs_edge stmt kf + in R.debug "@[<hv 4>get_data_scope_at_stmt %a at %d @\n\ modified by = %a@\n\ @@ -400,26 +495,54 @@ let check_stmt_annots (ca, stmt_ca) stmt acc = R.debug "annot at stmt %d could be removed: %a" stmt.sid Printer.pp_code_annotation annot; acc - else - acc + else + acc | _ -> acc in Annotations.fold_code_annot check stmt acc +exception VolatileFound + +(* This visitor detects the presence of a volatile logic l-value. Such a + l-value may evaluate differently at different program point. *) +class containsVolatile = object + inherit Visitor.frama_c_inplace + + method! vterm t = + match t.term_node with + | TLval tlv -> begin + match Logic_utils.unroll_type (Cil.typeOfTermLval tlv) with + | Ctype typ -> + if Cil.typeHasQualifier "volatile" typ then raise VolatileFound + | _ -> () + end; + Cil.DoChildren + | _ -> Cil.DoChildren + +end + +let code_annot_is_volatile ca = + let vis = new containsVolatile in + try ignore (Visitor.visitFramacCodeAnnotation vis ca); false + with VolatileFound -> true + (** Return the set of stmts ([scope]) where [annot] has the same value as at [stmt], and adds to [proven] the annotations that are identical to [annot] at statements that are both in [scope] and dominated by [stmt]. [stmt] is not added to the set, and [annot] is not added to [proven]. *) -let get_prop_scope_at_stmt kf stmt ?(proven=CA_Map.empty) annot = +let get_prop_scope_at_stmt ~warn kf stmt ?(proven=CA_Map.empty) annot = R.debug "[get_prop_scope_at_stmt] at stmt %d in %a : %a" stmt.sid Kernel_function.pretty kf Printer.pp_code_annotation annot; let acc = (Cil_datatype.Stmt.Hptset.empty, proven) in + if code_annot_is_volatile annot then acc + else try let zone = get_annot_zone kf stmt annot in let allstmts, info = compute kf in let modif_stmts = InitSid.find info zone in - let pre_state, _ = forward_data_scope modif_stmts stmt kf in + let modifs_edge = is_modified_by_edge kf zone in + let pre_state, _ = forward_data_scope modif_stmts modifs_edge stmt kf in begin match annot.annot_content with | AAssert _ -> () | _ -> R.abort "only 'assert' are handled by get_prop_scope_at_stmt" @@ -436,8 +559,9 @@ let get_prop_scope_at_stmt kf stmt ?(proven=CA_Map.empty) annot = in List.fold_left add acc allstmts with ToDo -> - R.warning - "[get_annot_zone] don't know how to compute zone: skip this annotation"; + if warn then + R.warning ~current:true ~once:true + "[get_annot_zone] don't know how to compute zone: skip this annotation"; acc (** Collect the annotations that can be removed because they are redundant. *) @@ -459,8 +583,10 @@ class check_annot_visitor = object(self) R.debug ~level:2 "[check] annot %d at stmt %d in %a : %a@." annot.annot_id stmt.sid Kernel_function.pretty kf Printer.pp_code_annotation annot; - let _scope, proven' = get_prop_scope_at_stmt kf stmt ~proven annot in - proven <- proven' + let _scope, proven' = + get_prop_scope_at_stmt ~warn:false kf stmt ~proven annot + in + proven <- proven' | _ -> () end; Cil.SkipChildren @@ -477,7 +603,7 @@ class check_annot_visitor = object(self) end (* class check_annot_visitor *) -let f_check_asserts () = +let redundant_assertions () = let visitor = new check_annot_visitor in ignore (Visitor.visitFramacFile (visitor:>Visitor.frama_c_visitor) @@ -486,14 +612,14 @@ let f_check_asserts () = let check_asserts () = R.feedback "check if there are some redundant assertions..."; - let to_be_removed = f_check_asserts () in + let to_be_removed = redundant_assertions () in let n = CA_Map.cardinal to_be_removed in R.result "[check_asserts] %d assertion(s) could be removed@." n; (list_proven to_be_removed) (* erasing optional arguments, plus return a list*) let get_prop_scope_at_stmt kf stmt annot = - let s, m = get_prop_scope_at_stmt kf stmt annot in + let s, m = get_prop_scope_at_stmt ~warn:true kf stmt annot in s, list_proven m (* Currently lazy, because we need to define it after Value as been registered @@ -507,7 +633,7 @@ let emitter = lazy ( (** Mark as proved the annotations collected by [check_asserts]. *) let rm_asserts () = - let to_be_removed = f_check_asserts () in + let to_be_removed = redundant_assertions () in let n = CA_Map.cardinal to_be_removed in if n > 0 then begin R.feedback ~dkey:cat_rm_asserts "removing %d assertion(s)@." n; @@ -526,45 +652,48 @@ let rm_asserts () = CA_Map.iter aux to_be_removed end -(** Register external functions into Db. *) -let () = - Db.register (* kernel_function -> stmt -> lval -> - Cil_datatype.Stmt.Set.t * - (Cil_datatype.Stmt.Set.t * - Cil_datatype.Stmt.Set.t) *) - (Db.Journalize - ("Scope.get_data_scope_at_stmt", - Datatype.func3 +let get_data_scope_at_stmt = + Journal.register + "Scope.Datascope.get_data_scope_at_stmt" + (Datatype.func3 Kernel_function.ty Cil_datatype.Stmt.ty Cil_datatype.Lval.ty - (Datatype.pair - Cil_datatype.Stmt.Hptset.ty - (Datatype.pair Cil_datatype.Stmt.Hptset.ty - Cil_datatype.Stmt.Hptset.ty)))) - Db.Scope.get_data_scope_at_stmt get_data_scope_at_stmt; - - Db.register (* (kernel_function -> stmt -> code_annotation -> - Cil_datatype.Stmt.Hptset.t * code_annotation list *) - Db.Journalization_not_required (* TODO *) - (* (Db.Journalize("Scope.get_prop_scope_at_stmt", - Datatype.func Kernel_type.kernel_function - (Datatype.func Kernel_type.stmt - (Datatype.func code_annotation_type - (Datatype.couple Kernel_type.stmt_set - (Datatype.list code_annotation_type)))))) *) - Db.Scope.get_prop_scope_at_stmt get_prop_scope_at_stmt; - - Db.register (* unit -> code_annotation list *) - Db.Journalization_not_required (* TODO *) - (* (Db.Journalize("Scope.check_asserts", - Datatype.func Datatype.unit (Datatype.list code_annotation_type))) *) - Db.Scope.check_asserts check_asserts; + (Datatype.pair + Cil_datatype.Stmt.Hptset.ty + (Datatype.pair Cil_datatype.Stmt.Hptset.ty + Cil_datatype.Stmt.Hptset.ty))) + get_data_scope_at_stmt + +let get_prop_scope_at_stmt = + Journal.register + "Scope.Datascope.get_prop_scope_at_stmt" + (Datatype.func3 + Kernel_function.ty + Cil_datatype.Stmt.ty + Cil_datatype.Code_annotation.ty + (Datatype.pair + (Cil_datatype.Stmt.Hptset.ty) + (Datatype.list Cil_datatype.Code_annotation.ty))) + get_prop_scope_at_stmt + +let check_asserts = + Journal.register + "Scope.Datascope.check_asserts" + (Datatype.func Datatype.unit (Datatype.list Cil_datatype.Code_annotation.ty)) + check_asserts + +let rm_asserts = + Journal.register + "Scope.Datascope.rm_asserts" + (Datatype.func Datatype.unit Datatype.unit) + rm_asserts +let () = Db.register (Db.Journalize - ("Scope.rm_asserts", Datatype.func Datatype.unit Datatype.unit)) - Db.Scope.rm_asserts rm_asserts + ("Value.rm_asserts", Datatype.func Datatype.unit Datatype.unit)) + Db.Value.rm_asserts rm_asserts (* Local Variables: diff --git a/src/plugins/scope/datascope.mli b/src/plugins/scope/datascope.mli index f85762b5927b832ea12e5e325c4afc23696f9787..9331f563eced603e0dd6e06df78766a49df069a7 100644 --- a/src/plugins/scope/datascope.mli +++ b/src/plugins/scope/datascope.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,9 +20,22 @@ (* *) (**************************************************************************) -(** Registration of [Scope] plugin. Some functions are also defined here, - but they registered through {!Db}. *) +open Cil_types +open Cil_datatype +val get_data_scope_at_stmt : + Kernel_function.t -> stmt -> lval -> + Stmt.Hptset.t * (Stmt.Hptset.t * Stmt.Hptset.t) + +val get_prop_scope_at_stmt : + kernel_function -> stmt -> code_annotation -> + Stmt.Hptset.t * code_annotation list + +val check_asserts : unit -> code_annotation list + +val rm_asserts : unit -> unit + +(** for internal use *) module R: Plugin.General_services val get_lval_zones: diff --git a/src/plugins/scope/defs.ml b/src/plugins/scope/defs.ml index dcb1a6a6ce55c404eb63c98a9f40d5ca110c651e..dab177d5dbe35e15ab77305ef699e603d0f35e99 100644 --- a/src/plugins/scope/defs.ml +++ b/src/plugins/scope/defs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -90,7 +90,7 @@ let rec add_callee_nodes z acc nodes = initial zone that we are looking for, so that we do not look for more than it. *) (* BYTODO: maybe [undef] could be used instead of [z] altogether *) -let rec add_caller_nodes z kf acc (undef, nodes) = +let rec add_caller_nodes z kf acc (undef, nodes) = let join_undef u u' = match u, u' with | _, None -> u | None, Some _ -> u' @@ -119,7 +119,7 @@ let rec add_caller_nodes z kf acc (undef, nodes) = acc_undef, NSet.add n acc | PdgIndex.Signature.InImpl z' -> let z = Locations.Zone.narrow z z' in - let nodes, undef'= !Db.Pdg.find_location_nodes_at_stmt + let nodes, undef'= !Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before:true z in let acc_undef = join_undef acc_undef undef' in @@ -131,7 +131,7 @@ let rec add_caller_nodes z kf acc (undef, nodes) = in let add_one_caller_nodes acc (kf, stmts) = let pdg = !Db.Pdg.get kf in - let acc_undef, caller_nodes = + let acc_undef, caller_nodes = List.fold_left (add_one_call_nodes pdg) (None, NSet.empty) stmts in add_caller_nodes z kf (NSet.union caller_nodes acc) (acc_undef, caller_nodes) in List.fold_left add_one_caller_nodes acc (!Db.Value.callers kf) @@ -145,7 +145,7 @@ let compute_aux kf stmt zone = !Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before:true zone in let nodes = add_list_to_set (List.map fst nodes) NSet.empty in - let nodes = + let nodes = if Interproc.get () then begin let caller_nodes = add_caller_nodes zone kf nodes (undef, nodes) in @@ -169,9 +169,7 @@ let compute kf stmt lval = (defs, undef) in !Db.Value.compute (); - let zone = - !Db.Value.lval_to_zone (Kstmt stmt) ~with_alarms:CilE.warn_none_mode lval - in + let zone = !Db.Value.lval_to_zone (Kstmt stmt) lval in Extlib.opt_map extract (compute_aux kf stmt zone) (* Variation of the function above. For each PDG node that has been found, @@ -200,7 +198,8 @@ let compute_with_def_type_zone kf stmt zone = change s (true, false) (* defined by formal v in 'f(v)' *) | PdgIndex.Signature.Out (PdgIndex.Signature.OutLoc _) -> begin match s.skind with - | Instr (Call (_, { enode = Lval (Var vi, NoOffset)}, _, _)) + | Instr (Call (_, { enode = Lval (Var vi, NoOffset)}, _, _) + | Local_init (_, ConsInit(vi,_,_),_)) when let kf = Globals.Functions.get vi in !Db.Value.use_spec_instead_of_definition kf -> @@ -208,7 +207,7 @@ let compute_with_def_type_zone kf stmt zone = change s (true, false) | _ -> (* defined within call to a function with a body*) - change s (false, true) + change s (false, true) end ) | PdgIndex.Key.SigKey _ -> acc @@ -221,9 +220,7 @@ let compute_with_def_type_zone kf stmt zone = let compute_with_def_type kf stmt lval = !Db.Value.compute (); - let zone = - !Db.Value.lval_to_zone (Kstmt stmt) ~with_alarms:CilE.warn_none_mode lval - in + let zone = !Db.Value.lval_to_zone (Kstmt stmt) lval in compute_with_def_type_zone kf stmt zone (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) @@ -236,19 +233,14 @@ module DT = Datatype.Option (Stmt.Map.Make(Datatype.Pair(Datatype.Bool)(Datatype.Bool))) (Datatype.Option(Locations.Zone))) -let () = - Db.register (* kernel_function -> stmt -> lval -> - (Cil_datatype.Stmt.Hptset.t * Locations.Zone.t option) option *) - (Db.Journalize - ("Scope.get_defs", - Datatype.func3 Kernel_function.ty Stmt.ty Lval.ty (D.ty))) - Db.Scope.get_defs compute; - Db.register (* kernel_function -> stmt -> lval -> - ((bool, bool) Cil_datatype.Stmt.Map.t * - Locations.Zone.t option) option *) - (Db.Journalize - ("Scope.get_defs_with_type", - Datatype.func3 Kernel_function.ty Stmt.ty Lval.ty (DT.ty))) - Db.Scope.get_defs_with_type compute_with_def_type; - - +let get_defs = + Journal.register + "Scope.Defs.get_defs" + (Datatype.func3 Kernel_function.ty Stmt.ty Lval.ty (D.ty)) + compute + +let get_defs_with_type = + Journal.register + "Scope.Defs.get_defs_with_type" + (Datatype.func3 Kernel_function.ty Stmt.ty Lval.ty (DT.ty)) + compute_with_def_type diff --git a/src/plugins/scope/defs.mli b/src/plugins/scope/defs.mli index 45fac42564ec17f0dac8703ae8f0473f3ab53784..a4908c0bb578342f5de5332b5d31654ef995579b 100644 --- a/src/plugins/scope/defs.mli +++ b/src/plugins/scope/defs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,11 +20,18 @@ (* *) (**************************************************************************) -(** Computations of Def points. Some of the functions of this module are - registered in module {!Db.Scope}. *) +val get_defs : + Kernel_function.t -> Cil_datatype.Stmt.t -> Cil_datatype.Lval.t -> + (Cil_datatype.Stmt.Hptset.t * Locations.Zone.t option) option +val get_defs_with_type : + Kernel_function.t -> Cil_datatype.Stmt.t -> Cil_datatype.Lval.t -> + ((bool * bool) Cil_datatype.Stmt.Map.t * Locations.Zone.t option) option + + +(* internal use *) val compute_with_def_type_zone: Cil_types.kernel_function -> Cil_types.stmt -> Locations.Zone.t -> ((bool * bool) Cil_datatype.Stmt.Map.t * Locations.Zone.t option) option -(** This function is similar to {!Db.Scope.get_defs_with_type}, except +(** This function is similar to {get_defs_with_type}, except that it receives a zone as argument, instead of an l-value *) diff --git a/src/plugins/scope/dpds_gui.ml b/src/plugins/scope/dpds_gui.ml index ad052a26ef819e569bb269908ffb7943e701b027..20f40b31e5a6f809a3e26a13fb3e84dcc0bd70b4 100644 --- a/src/plugins/scope/dpds_gui.ml +++ b/src/plugins/scope/dpds_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -48,7 +48,7 @@ let pretty_zone fmt z = Format.fprintf fmt "@[<h 1>%a@]" Locations.Zone.pretty z let ask_for_lval (main_ui:Design.main_window_extension_points) kf = - let txt = GToolbox.input_string ~title:"Input lvalue expression" "" in + let txt = Gtk_helper.input_string ~title:"Input lvalue expression" "" in match txt with None | Some "" -> None | Some txt -> try @@ -100,7 +100,7 @@ module Kf_containing_highlighted_stmt = let name = "Dpds_gui.Kf_containing_highlighted_stmt" let size = 7 let dependencies = - [ (*Dependencies are managed manually by Make_StmtSetState*) ] + [ (*Dependencies are managed manually by Make_StmtSetState*) ] end) let default_icon_name = "gtk-apply" @@ -120,8 +120,8 @@ module Make_StmtSetState (Info:sig val name: string end) = Kf_containing_highlighted_stmt.clear (); Stmt.Hptset.iter (fun stmt -> - Kf_containing_highlighted_stmt.replace - (Kernel_function.find_englobing_kf stmt) default_icon) + Kf_containing_highlighted_stmt.replace + (Kernel_function.find_englobing_kf stmt) default_icon) s; !update_column `Contents @@ -149,7 +149,7 @@ module Make_StmtMapState (Info:sig val name: string end) = with Not_found -> D.String.Set.empty in let union = D.String.Set.union prev s in - Kf_containing_highlighted_stmt.replace kf union) + Kf_containing_highlighted_stmt.replace kf union) s; !update_column `Contents @@ -196,7 +196,7 @@ module DataScope : (DpdCmdSig with type t_in = lval) = struct else "[scope] selected" let compute kf stmt lval = - let f, (fb, b) = !Db.Scope.get_data_scope_at_stmt kf stmt lval in + let f, (fb, b) = Datascope.get_data_scope_at_stmt kf stmt lval in Fscope.set f; FBscope.set fb; Bscope.set b; "[scope] computed" @@ -236,7 +236,7 @@ module Pscope (* : (DpdCmdSig with type t_in = code_annotation) *) = struct else "[prop_scope] selected" let compute kf stmt annot = - let s1, s2 = !Db.Scope.get_prop_scope_at_stmt kf stmt annot in + let s1, s2 = Datascope.get_prop_scope_at_stmt kf stmt annot in Pscope.set s1; Pscope_warn.set s2; "[prop_scope] computed" @@ -328,10 +328,10 @@ module Zones : (DpdCmdSig with type t_in = lval) = struct set s; Kf_containing_highlighted_stmt.clear (); Stmt.Hptset.iter - (fun stmt -> - Kf_containing_highlighted_stmt.replace - (Kernel_function.find_englobing_kf stmt) default_icon) - (snd s); + (fun stmt -> + Kf_containing_highlighted_stmt.replace + (Kernel_function.find_englobing_kf stmt) default_icon) + (snd s); !update_column `Contents end let clear () = ZonesState.clear () @@ -348,7 +348,7 @@ module Zones : (DpdCmdSig with type t_in = lval) = struct match kf_stmt_opt with | None -> "[zones] no information for this point" | Some (_kf, stmt) -> - let z = !Db.Scope.get_zones zones stmt in + let z = Zones.get_zones zones stmt in let txt = Format.asprintf "[zones] needed before stmt %d = %a" stmt.sid pretty_zone z @@ -356,7 +356,7 @@ module Zones : (DpdCmdSig with type t_in = lval) = struct with Not_found -> "" let compute kf stmt lval = - let used_stmts, zones = !Db.Scope.build_zones kf stmt lval in + let used_stmts, zones = Zones.build_zones kf stmt lval in ZonesState.set (zones, used_stmts); "[zones] computed" @@ -379,7 +379,7 @@ let help (main_ui:Design.main_window_extension_points) = ^"and the data is the one that is selected if any, " ^"or it can be given via a popup.\n" ^"\tIf the text given in the popup is empty, or 'Cancel' is chosen, " - ^"the selection of the command is reseted."); + ^"the selection of the command is reset."); add (ShowDef.help); add (Zones.help); add (DataScope.help); diff --git a/src/plugins/scope/zones.ml b/src/plugins/scope/zones.ml index ea55ac07d40d929723f0af023bfaa3e694c2f8ca..1ddf708c5f93d1ea252e508ba1ebcf0fa7635570 100644 --- a/src/plugins/scope/zones.ml +++ b/src/plugins/scope/zones.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -27,6 +27,8 @@ let debug2 fmt = R.debug ~level:2 fmt open Cil_datatype open Cil_types +type t_zones = Locations.Zone.t Stmt.Hashtbl.t + module Data = struct type t = Locations.Zone.t let bottom = Locations.Zone.bottom @@ -141,9 +143,9 @@ let process_one_call data stmt lvaloption froms = let used = res_used || out_used in used, data -let process_call data_after stmt lvaloption funcexp args = +let process_call data_after stmt lvaloption funcexp args _loc = let funcexp_dpds, called_functions = - !Db.Value.expr_to_kernel_function ~with_alarms:CilE.warn_none_mode + !Db.Value.expr_to_kernel_function (Kstmt stmt) ~deps:(Some Data.bottom) funcexp in let used, data = @@ -209,20 +211,38 @@ module Computer (Param:sig val states : Ctx.t end) = struct let doStmt _stmt = Dataflow2.Default + let do_assign stmt lval exp data = + let l_dpds, exact, l_zone = + Datascope.get_lval_zones ~for_writing:true stmt lval in + let r_dpds = Data.exp_zone stmt exp in + let used, data = compute_new_data data l_zone l_dpds exact r_dpds in + let _ = if used then add_used_stmt stmt in + data + let doInstr stmt instr data = match instr with - | Set (lval, exp, _) -> - let l_dpds, exact, l_zone = - Datascope.get_lval_zones ~for_writing:true stmt lval in - let r_dpds = Data.exp_zone stmt exp in - let used, data = compute_new_data data l_zone l_dpds exact r_dpds in - let _ = if used then add_used_stmt stmt in - Dataflow2.Done data - | Call (lvaloption,funcexp,args,_) -> - let used, data = process_call data stmt lvaloption funcexp args in + | Set (lval, exp, _) -> Dataflow2.Done (do_assign stmt lval exp data) + | Local_init (v, AssignInit i, _) -> + let rec aux lv i acc = + match i with + | SingleInit e -> do_assign stmt lv e data + | CompoundInit(ct, initl) -> + let implicit = true in + let doinit o i _ data = aux (Cil.addOffsetLval o lv) i data in + Cil.foldLeftCompound ~implicit ~doinit ~ct ~initl ~acc + in + Dataflow2.Done (aux (Cil.var v) i data) + | Call (lvaloption,funcexp,args,loc) -> + let used, data = process_call data stmt lvaloption funcexp args loc in let _ = if used then add_used_stmt stmt in Dataflow2.Done data - | _ -> Dataflow2.Default + | Local_init(v, ConsInit(f, args, k), l) -> + let used, data = + Cil.treat_constructor_as_func (process_call data stmt) v f args k l + in + if used then add_used_stmt stmt; + Dataflow2.Done data + | Skip _ | Code_annot _ | Asm _ -> Dataflow2.Default let filterStmt _stmt _next = true @@ -316,26 +336,21 @@ let pretty fmt stmt_zones = (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) -let () = - Db.register (* kernel_function -> stmt -> lval -> StmtHptset.t * t_zones *) - Db.Journalization_not_required (* TODO *) - (* - (Db.Journalize("Scope.build_zones", - Datatype.func Kernel_type.kernel_function +let build_zones = + (* TODO: Journal.register *) + (* (Datatype.func Kernel_type.kernel_function (Datatype.func Kernel_type.stmt (Datatype.func Kernel_type.lval (Datatype.couple Kernel_type.stmt_set zones_ty))))) *) - Db.Scope.build_zones compute; - - Db.register (* t_zones -> Cil_types.stmt -> Locations.Zone.t *) - Db.Journalization_not_required (* TODO *) - (*(Db.Journalize("Scope.get_zones", - Datatype.func zones_ty (Datatype.func Kernel_type.stmt data_ty)))*) - Db.Scope.get_zones get; - - Db.register (* (Format.formatter -> t_zones -> unit) *) - Db.Journalization_not_required (* TODO *) - (*(Db.Journalize("Scope.pretty_zones", - Datatype.func Datatype.formatter (Datatype.func zones_ty Datatype.unit)))*) - Db.Scope.pretty_zones pretty; + compute + +let get_zones = + (* TODO: Journal.register *) + (*(Datatype.func zones_ty (Datatype.func Kernel_type.stmt data_ty)))*) + get + +let pretty_zones = + (* TODO: Journal.register *) + (*( Datatype.func Datatype.formatter (Datatype.func zones_ty Datatype.unit)))*) + pretty diff --git a/src/plugins/scope/zones.mli b/src/plugins/scope/zones.mli index d6469d86630da5a1821aef5b9f58087d68fcad22..77d51d48f13a6c1026428df932f878252c6adb90 100644 --- a/src/plugins/scope/zones.mli +++ b/src/plugins/scope/zones.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,6 +20,11 @@ (* *) (**************************************************************************) -(* - This file is empty on purpose. Plugins register callbacks in src/kernel/db.ml. -*) +open Cil_types +open Cil_datatype + +type t_zones = Locations.Zone.t Stmt.Hashtbl.t +val build_zones : + kernel_function -> stmt -> lval -> Stmt.Hptset.t * t_zones +val pretty_zones : Format.formatter -> t_zones -> unit +val get_zones : t_zones -> Cil_types.stmt -> Locations.Zone.t diff --git a/src/plugins/security_slicing/Makefile.in b/src/plugins/security_slicing/Makefile.in index bf71b838cead49896716a6ef2ab0a2433dcedc2c..5a5ae0fba4367a0006913b3ab526c79992d65e8f 100644 --- a/src/plugins/security_slicing/Makefile.in +++ b/src/plugins/security_slicing/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -31,7 +31,6 @@ endif PLUGIN_DIR ?=. PLUGIN_ENABLE:=@ENABLE_SECURITY_SLICING@ -PLUGIN_DYNAMIC:=@DYNAMIC_SECURITY_SLICING@ PLUGIN_NAME:=Security_slicing PLUGIN_CMO:= security_slicing_parameters components PLUGIN_GUI_CMO:= register_gui diff --git a/src/plugins/security_slicing/Security_slicing.mli b/src/plugins/security_slicing/Security_slicing.mli index c04a47fce6ad547860fdd6e4703423c2515906b9..89d1b5336415af92901de56ce9e9a03e7c5e0631 100644 --- a/src/plugins/security_slicing/Security_slicing.mli +++ b/src/plugins/security_slicing/Security_slicing.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/security_slicing/components.ml b/src/plugins/security_slicing/components.ml index 0e01b7962fc8419eef13f58e95856f4a201a3b9c..a8db3f028af1e40789c16e8d412f60c958af6b0b 100644 --- a/src/plugins/security_slicing/components.ml +++ b/src/plugins/security_slicing/components.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -438,7 +438,7 @@ module Component = struct (* [TODO optimisation:] en fait, regarder from_deep: si vrai, faire pour chaque caller - sinon, faire uniquement pour le caller d'où on vient *) + sinon, faire uniquement pour le caller d'où on vient *) match kind, callstack_length with | (Direct | Indirect_Backward), 0 -> (* input of a deep security annotation: foreach call diff --git a/src/plugins/security_slicing/components.mli b/src/plugins/security_slicing/components.mli index 0411f96dd86956d3b96d958f5a7f8783810f21c6..63b1987fd78afd470856d53d96433c20b65b58df 100644 --- a/src/plugins/security_slicing/components.mli +++ b/src/plugins/security_slicing/components.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/security_slicing/configure.ac b/src/plugins/security_slicing/configure.ac index c10dbd24e9796b66c69fc5a5e547e9da7af328e1..388f6cd070f97bd17b7aed6dc949394a7d9cf8f8 100644 --- a/src/plugins/security_slicing/configure.ac +++ b/src/plugins/security_slicing/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/security_slicing/register_gui.ml b/src/plugins/security_slicing/register_gui.ml index 273b76cfeab4947edd8fb03927fc36d2ca7fe417..5ed8ac7a4b47f305157746bb3b6c51e6deea4b48 100644 --- a/src/plugins/security_slicing/register_gui.ml +++ b/src/plugins/security_slicing/register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/security_slicing/register_gui.mli b/src/plugins/security_slicing/register_gui.mli index 782c2f05f75776cb5347b693f594ac3680e2953e..202ac53011c11dd7dd06cafb0e930102521f532f 100644 --- a/src/plugins/security_slicing/register_gui.mli +++ b/src/plugins/security_slicing/register_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/security_slicing/security_slicing_parameters.ml b/src/plugins/security_slicing/security_slicing_parameters.ml index 7b401733589998ca889a9b3d1880cd81aefc3f08..a4314dc619663c6272596e003dced9f842552d51 100644 --- a/src/plugins/security_slicing/security_slicing_parameters.ml +++ b/src/plugins/security_slicing/security_slicing_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/security_slicing/security_slicing_parameters.mli b/src/plugins/security_slicing/security_slicing_parameters.mli index c4a045692b1d389ea695da478b613714dac970f9..f26080bc18a410ef84a53134721de0927dcfb419 100644 --- a/src/plugins/security_slicing/security_slicing_parameters.mli +++ b/src/plugins/security_slicing/security_slicing_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/slicing/Slicing.mli b/src/plugins/slicing/Slicing.mli index b641b9fe037983f6a1598c655f77cce10a0f4dfa..4534c64d01ea01886fd652fc0b41910f54c12216 100644 --- a/src/plugins/slicing/Slicing.mli +++ b/src/plugins/slicing/Slicing.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,20 +20,561 @@ (* *) (**************************************************************************) +open Cil_types +open Cil_datatype + (** Slicing API. *) +module Api:sig + + val self: State.t + (** Internal state of the slicing tool from project viewpoints. *) + + val set_modes : ?calls:int -> ?callers:bool -> ?sliceUndef:bool -> + ?keepAnnotations:bool -> unit -> unit + (** Sets slicing parameters related to command line options + [-slicing-level], [-slice-callers], [-slice-undef-functions], + [-slicing-keep-annotations]. + @modified Frama-C+dev the optional argument and the related + deprecated option [-slice-print] have been removed. *) + + (* ---------------------------------------------------------------------- *) + + (** Slicing project management. *) + module Project : sig + + val reset_slicing : unit -> unit + (** Function that can be used for: + - initializing the slicing tool before starting a slicing project; + - removing all computed slices and all internal pending requests + of the current slicing project. *) + + (** {3 Kernel function} *) + + val is_called : kernel_function -> bool + (** Return [true] iff the source function is called (even indirectly via + transitivity) from a [Slice.t]. *) + + val has_persistent_selection : kernel_function -> bool + (** Return [true] iff the source function has persistent selection *) + + val change_slicing_level : kernel_function -> int -> unit + (** Change the slicing level of this function (see the [-slicing-level] + option documentation to know the meaning of the number). + @raise SlicingTypes.ExternalFunction if [kf] has no definition. + @raise SlicingTypes.WrongSlicingLevel if [n] is not valid. *) + + (** {3 Extraction} *) + + val default_slice_names : kernel_function -> bool -> int -> string + (** Default function used for the optional [?f_slice_names] argument of + [extract] function. *) + + val extract : ?f_slice_names:(kernel_function -> bool -> int -> string) -> + string -> Project.t + (** Build a new [Db.Project.t] from all [Slice.t] of a project. + The string argument is used for naming the new project. + Can optionally specify how to name the sliced functions + by defining [f_slice_names]. + [f_slice_names kf src_visi num_slice] has to return the name + of the exported functions based on the source function [kf]. + - [src_visi] tells if the source function name is used + (if not, it can be used for a slice) + - [num_slice] gives the number of the slice to name. + The entry point function is only exported once : + it is VERY recommended to give to it its original name, + even if it is sliced. + @modified Frama-C+dev argument order and arity. *) + + (** {3 Not for casual users} *) + + val is_directly_called_internal : kernel_function -> bool + (** Return [true] if the source function is directly (even via pointer + function) called from a [Slice.t]. *) + + val print_dot : filename:string -> title:string -> unit + (** May be used to for debugging... + Pretty print a representation of the slicing project (call graph) + in a dot file which name is the given string. *) + + val pretty : Format.formatter -> unit + (** May be used for debugging... Pretty print project information. *) + + end + + (* ---------------------------------------------------------------------- *) + + (** Access to slicing results. *) + module Mark : sig + + type t = SlicingTypes.sl_mark + (** Abstract data type for mark value. *) + val dyn_t : t Type.t + (** For dynamic type checking and journalization. *) + + val make : data:bool -> addr:bool -> ctrl:bool -> t + (** To construct a mark such as + [(is_ctrl result, is_data result, isaddr result) = + (~ctrl, ~data, ~addr)], + [(is_bottom result) = false] and + [(is_spare result) = not (~ctrl || ~data || ~addr)]. *) + + val compare : t -> t -> int + (** A total ordering function similar to the generic structural + comparison function [compare]. + Can be used to build a map from [t] marks to, for example, colors for + the GUI. *) + + val is_bottom : t -> bool + (** [true] iff the mark is empty: it is the only case where the + associated element is invisible. *) + + val is_spare : t -> bool + (** Smallest visible mark. Usually used to mark element that need to be + visible for compilation purpose, not really for the selected + computations. *) + + val is_data : t -> bool + (** The element is used to compute selected data. + Notice that a mark can be [is_data] and/or [is_ctrl] and/or [is_addr] + at the same time. *) + + val is_ctrl : t -> bool + (** The element is used to control the program point of a selected + data. *) + + val is_addr : t -> bool + (** The element is used to compute the address of a selected data. *) + + val get_from_src_func : kernel_function -> t + (** The mark [m] related to all statements of a source function [kf]. + Property : [is_bottom (get_from_func proj kf) = not (Project.is_called proj kf) ] *) + + (** {3 Not for casual users} *) + + val pretty : Format.formatter -> t -> unit + (** May be used for debugging... Pretty mark information. *) + + end + + (* ---------------------------------------------------------------------- *) + + (** Slicing selections. *) + module Select : sig + + type t = SlicingTypes.sl_select + (** Internal selection. *) + + val dyn_t : t Type.t + (** For dynamic type checking and journalization. *) + + type set = SlicingTypes.Fct_user_crit.t Cil_datatype.Varinfo.Map.t + (** Set of colored selections. *) + + val dyn_set : set Type.t + (** For dynamic type checking and journalization. *) + + (** {3 Journalized selectors} *) + + val empty_selects : set + (** Empty selection. *) + + val select_stmt : set -> spare:bool -> stmt -> kernel_function -> set + (** To select a statement. *) + + val select_stmt_ctrl : set -> spare:bool -> stmt -> kernel_function -> set + (** To select a statement reachability. + Note: add also a transparent selection on the whole statement. *) + + val select_stmt_lval_rw : + (set -> + Mark.t -> + rd:Datatype.String.Set.t -> + wr:Datatype.String.Set.t -> + stmt -> + eval:stmt -> + kernel_function -> set) + (** To select rw accesses to lvalues (given as a string) related to a + statement. + Variable names used in the sets of strings [~rd] and [~wr] are relative + to the function scope. + The interpretation of the address of the lvalues is + done just before the execution of the statement [~eval]. + The selection preserves the [~rd] and ~[wr] accesses contained into + the statement [ki]. + Note: add also a transparent selection on the whole statement. + @modify Magnesium-20151001 argument [~scope] removed. *) + + val select_stmt_lval : + (set -> Mark.t -> Datatype.String.Set.t -> before:bool -> stmt -> + eval:stmt -> kernel_function -> set) + (** To select lvalues (given as string) related to a statement. + Variable names used in the sets of strings [~rd] and [~wr] are relative + to the function scope. + The interpretation of the address of the lvalue is + done just before the execution of the statement [~eval]. + The selection preserve the value of these lvalues before or + after (c.f. boolean [~before]) the statement [ki]. + Note: add also a transparent selection on the whole statement. + @modify Magnesium-20151001 argument [~scope] removed. *) + + val select_stmt_annots : + (set -> Mark.t -> spare:bool -> threat:bool -> user_assert:bool -> + slicing_pragma:bool -> loop_inv:bool -> loop_var:bool -> + stmt -> kernel_function -> set) + (** To select the annotations related to a statement. + Note: add also a transparent selection on the whole statement. *) + + val select_func_lval_rw : + (set -> Mark.t -> rd:Datatype.String.Set.t -> wr:Datatype.String.Set.t -> + eval:stmt -> kernel_function -> set) + (** To select rw accesses to lvalues (given as a string) related to a + function. + Variable names used in the sets of strings [~rd] and [~wr] are relative + to the function scope. + The interpretation of the address of the lvalues is + done just before the execution of the statement [~eval]. + The selection preserve the value of these lvalues into the whole + project. + @modify Magnesium-20151001 argument [~scope] removed. *) + + val select_func_lval : + (set -> Mark.t -> Datatype.String.Set.t -> kernel_function -> set) + (** To select lvalues (given as a string) related to a function. + Variable names used in the sets of strings [lval_str] string are + relative to the scope of the first statement of [kf]. + The interpretation of the address of the lvalues is + done just before the execution of the first statement [kf]. + The selection preserve the value of these lvalues before + execution of the return statement. *) + + val select_func_return : set -> spare:bool -> kernel_function -> set + (** To select the function result (returned value). *) + + val select_func_calls_to : set -> spare:bool -> kernel_function -> set + (** To select every calls to the given function, i.e. the call keeps + its semantics in the slice. *) + + val select_func_calls_into : set -> spare:bool -> kernel_function -> set + (** To select every calls to the given function without the selection of + its inputs/outputs. *) + + val select_func_annots : + (set -> Mark.t -> spare:bool -> threat:bool -> user_assert:bool -> + slicing_pragma:bool -> loop_inv:bool -> loop_var:bool -> + kernel_function -> set) + (** To select the annotations related to a function. *) + + (** {3 Selectors that are not journalized} *) + + val select_func_zone : + (set -> Mark.t -> Locations.Zone.t -> kernel_function -> set) + (** To select an output zone related to a function. *) + + val select_stmt_zone : + (set -> Mark.t -> Locations.Zone.t -> before:bool -> stmt -> + kernel_function -> set) + (** To select a zone value related to a statement. + Note: add also a transparent selection on the whole statement. *) + + val select_stmt_term : + (set -> Mark.t -> term -> stmt -> + kernel_function -> set) + (** To select a predicate value related to a statement. + Note: add also a transparent selection on the whole statement. *) + + val select_stmt_pred : + (set -> Mark.t -> predicate -> stmt -> + kernel_function -> set) + (** To select a predicate value related to a statement. + Note: add also a transparent selection on the whole statement. *) + + val select_stmt_annot : + (set -> Mark.t -> spare:bool -> code_annotation -> stmt -> + kernel_function -> set) + (** To select the annotations related to a statement. + Note: add also a transparent selection on the whole statement. *) + + val select_pdg_nodes : + (set -> Mark.t -> PdgTypes.Node.t list -> kernel_function -> set) + (** To select nodes of the PDG + - if [is_ctrl_mark m], + propagate ctrl_mark on ctrl dependencies + - if [is_addr_mark m], + propagate addr_mark on addr dependencies + - if [is_data_mark m], + propagate data_mark on data dependencies + - mark the node with a spare_mark and propagate so that + the dependencies that were not selected yet will be marked spare. *) + + (** {3 Not for casual users and not journalized} *) + + val get_function : t -> kernel_function + (** May be used to get the function related to an internal selection. *) -(** No function is directly exported: they are registered in {!Db.Slicing}. *) + val merge_internal : t -> t -> t + val add_to_selects_internal : t -> set -> set + val iter_selects_internal : (t -> unit) -> set -> unit + val fold_selects_internal : ('a -> t -> 'a) -> 'a -> set -> 'a + + val select_stmt_internal : (kernel_function -> ?select:t -> + stmt -> Mark.t -> t) + (** May be used to select a statement : + - if [is_ctrl_mark m], + propagates ctrl_mark on ctrl dependencies of the statement + - if [is_addr_mark m], + propagates addr_mark on addr dependencies of the statement + - if [is_data_mark m], + propagates data_mark on data dependencies of the statement + - otherwise, marks the node with a spare_mark and propagate so that + the dependencies that were not selected yet will be marked spare. + When the statement is a call, its functional inputs/outputs are + also selected (The call is still selected even it has no output). + When the statement is a composed one (block, if, etc...), + all the sub-statements are selected. + @raise SlicingTypes.NoPdg when there is no PDG for the + [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) -(**/**) + val select_label_internal : (kernel_function -> ?select:t -> + Logic_label.t -> Mark.t -> t) + (** May be used to select a label. *) + + val select_min_call_internal : + (kernel_function -> ?select:t -> stmt -> Mark.t -> t) + (** May be used to select a statement call without its + inputs/outputs so that it doesn't select the statements computing the + inputs of the called function as [select_stmt_internal] would do. + @raise Invalid_argument when the [stmt] isn't a call. + @raise SlicingTypes.NoPdg when there is no PDG for the + [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) + + val select_stmt_zone_internal : + (kernel_function -> ?select:t -> + stmt -> before:bool -> Locations.Zone.t -> Mark.t -> t) + (** May be used to select a zone value at a program point. + @raise SlicingTypes.NoPdg when there is no PDG for the + [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) + + val select_zone_at_entry_point_internal : + (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) + (** May be used to select a zone value at the beginning of a function. + For a defined function, it is similar to [select_stmt_zone_internal] + with the initial statement, but it can also be used for undefined + functions. + @raise SlicingTypes.NoPdg when there is no PDG for the + [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) + + val select_zone_at_end_internal : + (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) + (** May be used to select a zone value at the end of a function. + For a defined function, it is similar to [select_stmt_zone_internal] + with the return statement, but it can also be used for undefined + functions. + @raise SlicingTypes.NoPdg when there is no PDG for the + [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) + + val select_modified_output_zone_internal : + (kernel_function -> ?select:t -> Locations.Zone.t -> Mark.t -> t) + (** May be used to select the statements that modify the + given zone considered as in output. + Be careful that it is NOT the same as selecting the zone at the end! + (the 'undef' zone is not propagated...). *) + + val select_stmt_ctrl_internal : kernel_function -> ?select:t -> stmt -> t + (** May be used to select a statement reachability : + Only propagate a ctrl_mark on the statement control dependencies. + @raise SlicingTypes.NoPdg when there is no PDG for the + [kernel_function] (related to [PdgTypes.Pdg.is_top]). *) + + val select_entry_point_internal : + (kernel_function -> ?select:t -> Mark.t -> t) + val select_return_internal : + (kernel_function -> ?select:t -> Mark.t -> t) + val select_decl_var_internal : + (kernel_function -> ?select:t -> Cil_types.varinfo -> Mark.t -> t) + + val select_pdg_nodes_internal : + (kernel_function -> ?select:t -> PdgTypes.Node.t list -> Mark.t -> t) + (** May be used to select PDG nodes. *) + + val pretty : Format.formatter -> t -> unit + (** May be used for debugging... Pretty mark information. *) + + end + + (* ---------------------------------------------------------------------- *) + + (** Function slice. *) + module Slice : sig + + type t = SlicingTypes.sl_fct_slice + (** Abstract data type for function slice. *) + + val dyn_t : t Type.t + (** For dynamic type checking and journalization. *) + + val create : kernel_function -> t + (** Used to get an empty slice (nothing selected) related to a + function. *) + + val remove : t -> unit + (** Remove the slice from the project. The slice shouldn't be called. *) + + val remove_uncalled : unit -> unit + (** Remove the uncalled slice from the project. *) + + (** {3 Getters} *) + + val get_all: kernel_function -> t list + (** Get all slices related to a function. *) + + val get_function : t -> kernel_function + (** To get the function related to a slice *) + + val get_callers : t -> t list + (** Get the slices having direct calls to a slice. *) + + val get_called_slice : t -> stmt -> t option + (** To get the slice directly called by the statement of a slice. + Returns None when the statement mark is bottom, + or else the statement isn't a call + or else the statement is a call to one or several (via pointer) + source functions. *) + + val get_called_funcs : t -> stmt -> kernel_function list + (** To get the source functions called by the statement of a slice. + Returns an empty list when the statement mark is bottom, + or else the statement isn't a call + or else the statement is a call to a function slice. *) + + val get_mark_from_stmt : t -> stmt -> Mark.t + (** Get the mark value of a statement. *) + + val get_mark_from_label : t -> stmt -> Cil_types.label -> Mark.t + (** Get the mark value of a label. *) + + val get_mark_from_local_var : t -> varinfo -> Mark.t + (** Get the mark value of local variable. *) + + val get_mark_from_formal : t -> varinfo -> Mark.t + (** Get the mark from the formal of a function. *) + + val get_user_mark_from_inputs : t -> Mark.t + (** Get a mark that is the merged user inputs marks of the slice *) + + (** {3 Not for casual users} *) + + val get_num_id : t -> int + + val from_num_id : kernel_function -> int -> t + + val pretty : Format.formatter -> t -> unit + (** May be used for debugging... Pretty print slice information. *) + + end + + (* ---------------------------------------------------------------------- *) + + (** Requests for slicing jobs. + Slicing requests are part of a slicing project. + So, user requests affect slicing project. *) + module Request : sig + + (** {3 Applying the added requests} *) + + val apply_all: propagate_to_callers:bool -> unit + (** Apply all slicing requests. *) + + (** {3 Adding slicing requests} *) + + val add_selection: Select.set -> unit + (** Add a selection request to all (existing) slices + of a function to the project requests. *) + + val add_persistent_selection: Select.set -> unit + (** Add a persistent selection request to all slices (already existing or + created later) of a function to the project requests. *) + + val add_persistent_cmdline : unit -> unit + (** Add persistent selection from the command line. *) + + (** {3 Not for casual users and not journalized} *) + + val add_slice_selection_internal:Slice.t -> Select.t -> unit + (** May be used to add a selection request for a function slice + to the project requests. *) + + val add_selection_internal: Select.t -> unit + (** May be used to add a selection request to the project requests. + This selection will be applied to every slicies of the function + (already existing or created later). *) + + val add_call_slice:caller:Slice.t -> to_call:Slice.t -> unit + (** May be used to change every call to any [to_call] source or specialisation in order + to call [to_call] in [caller]. *) + + val add_call_fun: caller:Slice.t -> to_call:kernel_function -> unit + (** May be used to change every call to any [to_call] source or specialisation + in order to call the source function [to_call] in [caller]. *) + + val add_call_min_fun: caller:Slice.t -> to_call:kernel_function -> unit + (** May be used to change each call to [to_call] in [caller] such that, at least, it + will be visible at the end, ie. call either the source function or + one of [to_call] slice (depending on the [slicing_level]). *) + + val is_request_empty_internal: unit -> bool + (** May be used to know if internal requests are pending. *) + + (* REMOVED: val is_already_selected_internal: Slice.t -> Select.t -> bool *) + (** Return true when the requested selection is already selected into the + slice. *) + + val apply_all_internal: unit -> unit + (** May be used to apply all slicing requests. *) + + val apply_next_internal: unit -> unit + (** May be used to apply the first slicing request of the project list + and remove it from the list. + That may modify the contents of the remaining list. + For example, new requests may be added to the list. *) + + val merge_slices: Slice.t -> Slice.t -> replace:bool -> Slice.t + (** May be used to build a new slice which marks is a merge of the two given slices. + [choose_call] requests are added to the project in order to choose + the called functions for this new slice. + If [replace] is true, more requests are added to call this new + slice instead of the two original slices. When these requests will + be applied, the user will be able to remove those two slices using + [Db.Slicing.Slice.remove]. *) + + val copy_slice: Slice.t -> Slice.t + (** May be used to copy the input slice. The new slice is not called, so it is the user + responsibility to change the calls if he wants to. *) + + val split_slice: Slice.t -> Slice.t list + (** May be used to copy the input slice to have one slice for each call of the original + slice and generate requests in order to call them. + @return the newly created slices. *) + + val propagate_user_marks : unit -> unit + (** May be used to apply pending request then propagate user marks to callers + recursively then apply pending requests *) + + val pretty : Format.formatter -> unit + (** May be used for debugging... Pretty print the request list. *) + + end + +end -(** Debugging purpose only. +(* ---------------------------------------------------------------------- *) +(** For debugging purpose only. API used by the tests of slicing (see tests/slicing/libSelect.ml). *) module PrintSlice: sig val print_fct_stmts: Format.formatter -> - Db.Slicing.Project.t * Kernel_function.t -> + kernel_function -> unit end diff --git a/src/plugins/slicing/api.ml b/src/plugins/slicing/api.ml new file mode 100644 index 0000000000000000000000000000000000000000..6863579f4a79cd869399a62c4210e309fb00a128 --- /dev/null +++ b/src/plugins/slicing/api.ml @@ -0,0 +1,579 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types +open Cil_datatype + +(* ---------------------------------------------------------------------- *) +(** Global data management *) + +let split_slice s = + SlicingParameters.debug ~level:1 "[Api.split_slice]"; + SlicingProject.split_slice s + +let merge_slices ff_1 ff_2 ~replace = + SlicingParameters.debug ~level:1 "[Api.merge_slices]"; + SlicingProject.merge_slices ff_1 ff_2 replace + +let copy_slice ff = + SlicingParameters.debug ~level:1 "[Api.copy_slice]"; + Fct_slice.copy_slice ff + +(* ---------------------------------------------------------------------- *) +(** {1 Global setting } *) + +let self = SlicingState.self + +(* ---------------------------------------------------------------------- *) + + (** {2 Functions with journalized side effects } *) + +let set_modes calls callers sliceUndef keepAnnotations () = + SlicingParameters.Mode.Calls.set calls ; + SlicingParameters.Mode.Callers.set callers ; + SlicingParameters.Mode.SliceUndef.set sliceUndef; + SlicingParameters.Mode.KeepAnnotations.set keepAnnotations +let set_modes = + Journal.register "Slicing.Api.set_modes" + (Datatype.func4 + ~label1:("calls", None) Datatype.int + ~label2:("callers", None) Datatype.bool + ~label3:("sliceUndef", None) Datatype.bool + ~label4:("keepAnnotations", None) Datatype.bool + (Datatype.func + Datatype.unit + Datatype.unit)) + set_modes +let set_modes ?(calls=SlicingParameters.Mode.Calls.get ()) + ?(callers=SlicingParameters.Mode.Callers.get ()) + ?(sliceUndef=SlicingParameters.Mode.SliceUndef.get ()) + ?(keepAnnotations=SlicingParameters.Mode.KeepAnnotations.get ()) + () = + set_modes calls callers sliceUndef keepAnnotations () + +(* ---------------------------------------------------------------------- *) + +(** {1 Slicing project } *) +module Project = struct + + (** {2 Values } *) + + let default_slice_names = SlicingTransform.default_slice_names + let () = + Journal.Binding.add + (Datatype.func3 + Kernel_function.ty Datatype.bool Datatype.int Datatype.string) + default_slice_names + "Slicing.Api.Project.default_slice_names" + + (** {2 Functions with journalized side effects } *) + + let reset_slicing = Journal.register "Slicing.Api.Project.reset_slicing" + (Datatype.func Datatype.unit Datatype.unit) + SlicingState.reset_slicing + + let extract f_slice_names = SlicingTransform.extract ~f_slice_names + let extract = Journal.register "Slicing.Api.Project.extract" + (Datatype.func2 + ~label1:("f_slice_names", + Some (fun () -> default_slice_names)) + (Datatype.func3 + Kernel_function.ty Datatype.bool Datatype.int Datatype.string) + Datatype.string + Project.ty) + extract + let extract ?(f_slice_names=default_slice_names) new_proj_name = + extract f_slice_names new_proj_name + + let print_dot = PrintSlice.build_dot_project + let print_dot = Journal.register "Slicing.Api.Project.print_dot" + (Datatype.func2 + ~label1:("filename", None) Datatype.string + ~label2:("title", None) Datatype.string + Datatype.unit) + print_dot + let print_dot ~filename ~title = + print_dot filename title + + let change_slicing_level = + Journal.register "Slicing.Api.Project.change_slicing_level" + (Datatype.func2 + Kernel_function.ty + Datatype.int + Datatype.unit) + SlicingMacros.change_slicing_level + + (** {2 No needs of Journalization} *) + + let is_directly_called_internal = SlicingMacros.is_src_fun_called + let is_called = Fct_slice.is_src_fun_called + let has_persistent_selection = SlicingMacros.has_persistent_selection + + (** {2 Debug} *) + + let pretty = SlicingProject.print_project_and_worklist + +end + +(* ---------------------------------------------------------------------- *) + +(** {1 Mark} *) +module Mark = struct + + type t = SlicingTypes.sl_mark + let dyn_t = SlicingTypes.dyn_sl_mark + + (** {2 No needs of Journalization} *) + + let compare = SlicingMarks.compare_marks + let pretty = SlicingMarks.pretty_mark + let make = SlicingMarks.mk_user_mark + let is_bottom = SlicingMarks.is_bottom_mark + let is_spare = SlicingMarks.is_spare_mark + let is_ctrl = SlicingMarks.is_ctrl_mark + let is_data = SlicingMarks.is_addr_mark + let is_addr = SlicingMarks.is_data_mark + let get_from_src_func = Fct_slice.get_mark_from_src_fun +end + +(* ---------------------------------------------------------------------- *) + +(** {1 Selection} *) +module Select = struct + + type t = SlicingTypes.sl_select + let dyn_t = SlicingTypes.Sl_select.ty + type set = SlicingCmds.set + module S = Cil_datatype.Varinfo.Map.Make(SlicingTypes.Fct_user_crit) + let dyn_set = S.ty + + (** {2 Journalized selectors } *) + + let empty_selects = Journal.register + "Slicing.Api.Select.empty_selects" + dyn_set + Cil_datatype.Varinfo.Map.empty + + let select_stmt set spare = SlicingCmds.select_stmt set ~spare + let select_stmt = Journal.register "Slicing.Api.Select.select_stmt" + (Datatype.func4 + dyn_set + ~label2:("spare", None) Datatype.bool + Stmt.ty + Kernel_function.ty + dyn_set) + select_stmt + let select_stmt set ~spare = + select_stmt set spare + + let select_stmt_ctrl set spare = SlicingCmds.select_stmt_ctrl set ~spare + let select_stmt_ctrl = Journal.register "Slicing.Api.Select.select_stmt_ctrl" + (Datatype.func4 + dyn_set + ~label2:("spare", None) Datatype.bool + Stmt.ty + Kernel_function.ty + dyn_set) + select_stmt_ctrl + let select_stmt_ctrl set ~spare = + select_stmt_ctrl set spare + + let select_stmt_lval_rw set mark rd wr stmt eval = + SlicingCmds.select_stmt_lval_rw set mark ~rd ~wr stmt ~eval + let select_stmt_lval_rw = Journal.register + "Slicing.ApiSelect.select_stmt_lval_rw" + (Datatype.func4 + dyn_set + SlicingTypes.dyn_sl_mark + ~label3:("rd", None) Datatype.String.Set.ty + ~label4:("wr", None) Datatype.String.Set.ty + (Datatype.func3 + Stmt.ty + ~label2:("eval", None) Stmt.ty + Kernel_function.ty + dyn_set)) + select_stmt_lval_rw + let select_stmt_lval_rw set mark ~rd ~wr stmt ~eval = + select_stmt_lval_rw set mark rd wr stmt eval + + let select_stmt_lval set mark lval before stmt eval = + SlicingCmds.select_stmt_lval set mark lval ~before stmt ~eval + let select_stmt_lval = Journal.register "Slicing.Api.Select.select_stmt_lval" + (Datatype.func4 + dyn_set + Mark.dyn_t + Datatype.String.Set.ty + ~label4:("before", None) Datatype.bool + (Datatype.func3 + Stmt.ty + ~label2:("eval", None) Stmt.ty + Kernel_function.ty + dyn_set)) + select_stmt_lval + let select_stmt_lval set mark lval ~before stmt ~eval = + select_stmt_lval set mark lval before stmt eval + + let select_stmt_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var = + SlicingCmds.select_stmt_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var + let select_stmt_annots = Journal.register + "Slicing.Api.Select.select_stmt_annots" + (Datatype.func4 + dyn_set + Mark.dyn_t + ~label3:("spare", None) Datatype.bool + ~label4:("threat", None) Datatype.bool + (Datatype.func4 + ~label1:("user_assert", None) Datatype.bool + ~label2:("slicing_pragma", None) Datatype.bool + ~label3:("loop_inv", None) Datatype.bool + ~label4:("loop_var", None) Datatype.bool + (Datatype.func2 + Stmt.ty + Kernel_function.ty + dyn_set))) + select_stmt_annots + let select_stmt_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var = + select_stmt_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var + + let select_func_lval = Journal.register "Slicing.Api.Select.select_func_lval" + (Datatype.func4 + dyn_set + Mark.dyn_t + Datatype.String.Set.ty + Kernel_function.ty + dyn_set) + SlicingCmds.select_func_lval + + let select_func_lval_rw set mark rd wr eval = + SlicingCmds.select_func_lval_rw set mark ~rd ~wr ~eval + let select_func_lval_rw = Journal.register + "Slicing.Api.Select.select_func_lval_rw" + (Datatype.func4 + dyn_set + Mark.dyn_t + ~label3:("rd", None) Datatype.String.Set.ty + ~label4:("wr", None) Datatype.String.Set.ty + (Datatype.func2 + ~label1:("eval", None) Stmt.ty + Kernel_function.ty + dyn_set)) + select_func_lval_rw + let select_func_lval_rw set mark ~rd ~wr ~eval = + select_func_lval_rw set mark rd wr eval + + let select_func_return set spare = + SlicingCmds.select_func_return set ~spare + let select_func_return = Journal.register + "Slicing.Api.Select.select_func_return" + (Datatype.func3 + dyn_set + ~label2:("spare", None) Datatype.bool + Kernel_function.ty + dyn_set) + select_func_return + let select_func_return set ~spare = select_func_return set spare + + let select_func_calls_to set spare = + SlicingCmds.select_func_calls_to set ~spare + let select_func_calls_to = Journal.register + "Slicing.Api.Select.select_func_calls_to" + (Datatype.func3 + dyn_set + ~label2:("spare", None) Datatype.bool + Kernel_function.ty + dyn_set) + select_func_calls_to + let select_func_calls_to set ~spare = + select_func_calls_to set spare + + let select_func_calls_into set spare = + SlicingCmds.select_func_calls_into set ~spare + let select_func_calls_into = Journal.register + "Slicing.Api.Select.select_func_calls_into" + (Datatype.func3 + dyn_set + ~label2:("spare", None) Datatype.bool + Kernel_function.ty + dyn_set) + select_func_calls_into + let select_func_calls_into set ~spare = + select_func_calls_into set spare + + let select_func_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var = + SlicingCmds.select_func_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var + let select_func_annots = Journal.register + "Slicing.Api.Select.select_func_annots" + (Datatype.func4 + dyn_set + Mark.dyn_t + ~label3:("spare", None) Datatype.bool + ~label4:("threat", None) Datatype.bool + (Datatype.func4 + ~label1:("user_assert", None) Datatype.bool + ~label2:("slicing_pragma", None) Datatype.bool + ~label3:("loop_inv", None) Datatype.bool + ~label4:("loop_var", None) Datatype.bool + (Datatype.func Kernel_function.ty dyn_set))) + select_func_annots + let select_func_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var = + select_func_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var + + (** {2 No Journalization} *) + + let select_func_zone = SlicingCmds.select_func_zone + let select_stmt_term = SlicingCmds.select_stmt_term + let select_stmt_pred = SlicingCmds.select_stmt_pred + let select_stmt_annot = SlicingCmds.select_stmt_annot + let select_stmt_zone = SlicingCmds.select_stmt_zone + + let select_pdg_nodes = SlicingCmds.select_pdg_nodes + + (** {2 No Journalization} *) + + let get_function = SlicingCmds.get_select_kf + let merge_internal = SlicingSelect.merge_db_select + + let add_to_selects_internal = SlicingSelect.Selections.add_to_selects + let iter_selects_internal = SlicingSelect.Selections.iter_selects_internal + let fold_selects_internal = SlicingSelect.Selections.fold_selects_internal + let select_stmt_internal = SlicingSelect.select_stmt_computation + let select_label_internal = SlicingSelect.select_label + let select_min_call_internal = SlicingSelect.select_minimal_call + let select_stmt_zone_internal = SlicingSelect.select_stmt_zone + let select_zone_at_entry_point_internal = SlicingSelect.select_zone_at_entry + let select_zone_at_end_internal = SlicingSelect.select_zone_at_end + let select_modified_output_zone_internal = SlicingSelect.select_modified_output_zone + let select_stmt_ctrl_internal = SlicingSelect.select_stmt_ctrl + let select_entry_point_internal = SlicingSelect.select_entry_point + let select_return_internal = SlicingSelect.select_return + let select_decl_var_internal = SlicingSelect.select_decl_var + let select_pdg_nodes_internal = SlicingSelect.select_pdg_nodes + + (** {2 Debug} *) + + let pretty = SlicingSelect.print_select + +end + +(* ---------------------------------------------------------------------- *) + +(** {1 Slice} *) +module Slice = struct + + type t = SlicingTypes.sl_fct_slice + let dyn_t = SlicingTypes.dyn_sl_fct_slice + + (** {2 Functions with journalized side effects } *) + + let create = + Journal.register "Slicing.Api.Slice.create" + (Datatype.func Kernel_function.ty dyn_t) + SlicingProject.create_slice + + let remove = + Journal.register "Slicing.Api.Slice.remove" + (Datatype.func dyn_t Datatype.unit) + SlicingProject.remove_ff + + let remove_uncalled = + Journal.register "Slicing.Api.Slice.remove_uncalled" + (Datatype.func Datatype.unit Datatype.unit) + SlicingProject.remove_uncalled_slices + + (** {2 No needs of Journalization} *) + + let get_all = SlicingProject.get_slices + let get_function = SlicingMacros.get_ff_kf + let get_callers = SlicingProject.get_slice_callers + + let get_called_slice ff stmt = + match stmt.skind with + | Instr (Call _ | Local_init (_, ConsInit _, _)) -> + fst (Fct_slice.get_called_slice ff stmt) + | _ -> None + + let get_called_funcs ff stmt = + match stmt.skind with + | Instr (Call (_,expr_f,_,_)) -> + if snd (Fct_slice.get_called_slice ff stmt) then + Kernel_function.Hptset.elements + (snd (!Db.Value.expr_to_kernel_function (Kstmt stmt) ~deps:None expr_f)) + else + [] + | Instr (Local_init (_, ConsInit (f, _, _), _)) -> [ Globals.Functions.get f ] + | _ -> [] + + let get_mark_from_stmt = Fct_slice.get_stmt_mark + let get_mark_from_label = Fct_slice.get_label_mark + let get_mark_from_local_var = Fct_slice.get_local_var_mark + + let get_mark_from_formal ff var = + let kf = SlicingMacros.get_ff_kf ff in + let param_list = Kernel_function.get_formals kf in + let rec find n var_list = match var_list with + | [] -> raise Not_found + | v :: var_list -> if Cil_datatype.Varinfo.equal v var then n + else find (n+1) var_list + in let n = find 1 param_list in + Fct_slice.get_param_mark ff n + + let get_user_mark_from_inputs = Fct_slice.merge_inputs_m1_mark + + let get_num_id = SlicingMacros.get_ff_id + + let from_num_id kf num = + List.find + (fun f -> num = SlicingMacros.get_ff_id f) + (SlicingProject.get_slices kf) + + (** {2 Debug} *) + + let pretty = SlicingProject.pretty_slice + +end + +(* ---------------------------------------------------------------------- *) + +(** {1 Slicing request} *) +module Request = struct + + (** {2 Functions with journalized side effects } *) + + let apply_all propagate_to_callers = + SlicingCmds.apply_all ~propagate_to_callers + let apply_all = Journal.register "Slicing.Api.Request.apply_all" + (Datatype.func + ~label:("propagate_to_callers", None) Datatype.bool + Datatype.unit) + apply_all + let apply_all ~propagate_to_callers = + apply_all propagate_to_callers + + let apply_all_internal = + Journal.register "Slicing.Api.Request.apply_all_internal" + (Datatype.func Datatype.unit Datatype.unit) + SlicingCmds.apply_all_actions + + let apply_next_internal = + Journal.register "Slicing.Api.Request.apply_next_internal" + (Datatype.func Datatype.unit Datatype.unit) + SlicingCmds.apply_next_action + + let propagate_user_marks = + Journal.register "Slicing.Api.Request.propagate_user_marks" + (Datatype.func Datatype.unit Datatype.unit) + SlicingCmds.topologic_propagation + + let copy_slice = Journal.register "Slicing.Api.Request.copy_slice" + (Datatype.func + Slice.dyn_t + Slice.dyn_t) + copy_slice + + let split_slice = Journal.register "Slicing.Api.Request.split_slice" + (Datatype.func + Slice.dyn_t + (Datatype.list Slice.dyn_t)) + split_slice + + let merge_slices ff_1 ff_2 replace = + merge_slices ff_1 ff_2 ~replace + let merge_slices = Journal.register "Slicing.Api.Request.merge_slices" + (Datatype.func3 + Slice.dyn_t + Slice.dyn_t + ~label3:("replace", None) Datatype.bool + Slice.dyn_t) + merge_slices + let merge_slices ff_1 ff_2 ~replace = + merge_slices ff_1 ff_2 replace + + let add_call_slice caller to_call = + SlicingSelect.call_ff_in_caller ~caller ~to_call + let add_call_slice = + Journal.register "Slicing.Api.Request.add_call_slice" + (Datatype.func2 + ~label1:("caller", None) Slice.dyn_t + ~label2:("to_call", None) Slice.dyn_t + Datatype.unit) + add_call_slice + let add_call_slice ~caller ~to_call = + add_call_slice caller to_call + + let add_call_fun caller to_call = + SlicingSelect.call_fsrc_in_caller ~caller ~to_call + let add_call_fun = + Journal.register "Slicing.Api.Request.add_call_fun" + (Datatype.func2 + ~label1:("caller", None) Slice.dyn_t + ~label2:("to_call", None) Kernel_function.ty + Datatype.unit) + add_call_fun + let add_call_fun ~caller ~to_call = + add_call_fun caller to_call + + let add_call_min_fun caller to_call = + SlicingSelect.call_min_f_in_caller ~caller ~to_call + let add_call_min_fun = + Journal.register "Slicing.Api.Request.add_call_min_fun" + (Datatype.func2 + ~label1:("caller", None) Slice.dyn_t + ~label2:("to_call", None) Kernel_function.ty + Datatype.unit) + add_call_min_fun + let add_call_min_fun ~caller ~to_call = + add_call_min_fun caller to_call + + let add_selection = Journal.register "Slicing.Request.add_selection" + (Datatype.func + Select.dyn_set Datatype.unit) + SlicingCmds.add_selection + + let add_persistent_selection = + Journal.register "Slicing.Request.add_persistent_selection" + (Datatype.func + Select.dyn_set Datatype.unit) + SlicingCmds.add_persistent_selection + + let add_persistent_cmdline = + Journal.register "Slicing.Request.add_persistent_cmdline" + (Datatype.func Datatype.unit Datatype.unit) + SlicingCmds.add_persistent_cmdline + + (** {2 No needs of Journalization} *) + + let is_request_empty_internal = SlicingProject.is_request_empty + + let add_slice_selection_internal = SlicingSelect.add_ff_selection + let add_selection_internal = SlicingSelect.add_fi_selection + + (** {2 Debug} *) + + let pretty = SlicingProject.print_proj_worklist + +end +(* ---------------------------------------------------------------------- *) +(* +Local Variables: +compile-command: "make -C ../.." +End: +*) diff --git a/src/plugins/slicing/fct_slice.ml b/src/plugins/slicing/fct_slice.ml index 42124fa3651d7099b0245d0b231a697e4bcda7e7..776e049ed1f3b44980ea7c07d0c1c0fdbeae45f5 100644 --- a/src/plugins/slicing/fct_slice.ml +++ b/src/plugins/slicing/fct_slice.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -43,6 +43,34 @@ open Cil_types (**/**) +(* Look at (only once) the callers of [kf] ([kf] included). *) +let exists_fun_callers fpred kf = + let table = ref Kernel_function.Set.empty in + let rec exists_fun_callers kf = + if fpred kf + then true + else + if Kernel_function.Set.mem kf !table + then false (* no way to call the initial [kf]. *) + else begin + table := Kernel_function.Set.add kf !table ; + List.exists + (fun (kf,_) -> exists_fun_callers kf) + (!Db.Value.callers kf) + end + in + exists_fun_callers kf + +let is_src_fun_visible = exists_fun_callers SlicingMacros.is_src_fun_visible + +let is_src_fun_called kf = + let kf_entry, _library = Globals.entry_point () in + let fpred f = + if (kf_entry == f) + then SlicingMacros.is_src_fun_visible f (* for the entry point *) + else SlicingMacros.is_src_fun_called f (* for the others *) + in exists_fun_callers fpred kf + (** Manage the information related to a function call in a slice. * It is composed of the called function if it has been established yet, * and the call signature. Also deals with the [called_by] information. *) @@ -61,9 +89,9 @@ module CallInfo : sig val something_visible : t -> bool - val remove_called_by : SlicingInternals.project -> call_id -> t -> unit + val remove_called_by : call_id -> t -> unit val is_call_to_change : t -> SlicingInternals.called_fct option -> bool - val change_call : SlicingInternals.project -> SlicingInternals.marks_index -> call_id -> + val change_call : SlicingInternals.marks_index -> call_id -> SlicingInternals.called_fct option -> unit end = struct @@ -120,10 +148,11 @@ end = struct let _, stmt = call_id in let funcexp = match stmt.skind with | Instr (Call (_,funcexp,_,_)) -> funcexp + | Instr (Local_init (_, ConsInit (f, _, _), _)) -> Cil.evar f | _ -> assert false in let _, called_functions = - !Db.Value.expr_to_kernel_function ~with_alarms:CilE.warn_none_mode + !Db.Value.expr_to_kernel_function (Kstmt stmt) ~deps:(Some Locations.Zone.bottom) funcexp in Kernel_function.Hptset.elements called_functions @@ -132,7 +161,7 @@ end = struct * we don't want [f] to call [g] anymore, so we have to update [g] [called_by] * field. * *) - let remove_called_by proj call_id call_info = + let remove_called_by call_id call_info = let rec remove called_by = match called_by with | [] -> [] | e :: called_by -> if (SlicingMacros.same_ff_call call_id e) then called_by @@ -149,7 +178,7 @@ end = struct | Some (SlicingInternals.CallSrc (None)) -> let called = indirectly_called_src_functions call_id in let update kf = - let old_fi = SlicingMacros.get_kf_fi proj kf in + let old_fi = SlicingMacros.get_kf_fi kf in old_fi.SlicingInternals.f_called_by <- remove old_fi.SlicingInternals.f_called_by in List.iter update called @@ -157,23 +186,23 @@ end = struct * no checks at all (they must have been done before). * [call] in [ff] is changed in order to call [to_call]. If some function was * previously called, update its [called_by] information. *) - let change_call proj ff_marks call_id to_call = + let change_call ff_marks call_id to_call = SlicingParameters.debug ~level:2 "[Fct_Slice.CallInfo.change_call]"; let call_info = get_info_call call_id in let something_to_do = is_call_to_change call_info to_call in if something_to_do then begin SlicingParameters.debug ~level:2 " -> remove old_called"; - let _ = remove_called_by proj call_id call_info in + remove_called_by call_id call_info; SlicingParameters.debug ~level:2 " -> add new_called"; - let _ = match to_call with + begin match to_call with | None -> () (* nothing to do *) | Some f -> begin match f with | (SlicingInternals.CallSrc None) -> let called = indirectly_called_src_functions call_id in let update kf = - let fi = SlicingMacros.get_kf_fi proj kf in + let fi = SlicingMacros.get_kf_fi kf in fi.SlicingInternals.f_called_by <- call_id :: fi.SlicingInternals.f_called_by in List.iter update called | (SlicingInternals.CallSlice g) -> @@ -181,7 +210,7 @@ end = struct | (SlicingInternals.CallSrc (Some fi)) -> fi.SlicingInternals.f_called_by <- call_id :: fi.SlicingInternals.f_called_by end - in + end; let _ff, call = call_id in let new_call_info = to_call in PdgIndex.FctIndex.add_info_call ff_marks call new_call_info true @@ -275,7 +304,7 @@ module FctMarks : sig val fold_calls : (Cil_types.stmt -> CallInfo.t -> 'a -> 'a) -> SlicingInternals.fct_slice -> 'a -> 'a - val change_call : SlicingInternals.project -> SlicingInternals.fct_slice -> Cil_types.stmt -> + val change_call : SlicingInternals.fct_slice -> Cil_types.stmt -> SlicingInternals.called_fct option -> unit val debug_marked_ff : Format.formatter -> SlicingInternals.fct_slice -> unit @@ -379,10 +408,10 @@ end = struct let fm = ff.SlicingInternals.ff_marks in CallInfo.fold_calls process ff (get_marks fm) acc - let change_call proj ff call newf = + let change_call ff call newf = let ff_marks = get_ff_marks ff in let marks = get_marks ff_marks in - CallInfo.change_call proj marks (ff, call) newf + CallInfo.change_call marks (ff, call) newf (** mark the node with the given mark and propagate it to its dependencies *) let mark_and_propagate (fct_marks:t) @@ -422,12 +451,14 @@ end = struct SlicingMarks.pretty_mark m SlicingMarks.pretty_mark (match new_m with None -> SlicingMarks.bottom_mark | Some m -> m); - let _ = match new_m with - | Some _new_m when SlicingMarks.is_bottom_mark old_m -> - let init_m = get_fi_node_mark fi_to_call key in - if SlicingMarks.is_bottom_mark init_m then new_input := true - | _ -> () - in new_m + begin + match new_m with + | Some _new_m when SlicingMarks.is_bottom_mark old_m -> + let init_m = get_fi_node_mark fi_to_call key in + if SlicingMarks.is_bottom_mark init_m then new_input := true + | _ -> () + end; + new_m else None in @@ -867,11 +898,11 @@ let filter_already_in ff selection = * for the same reason (if we mark [x = g ();] in [f], we don't necessarily want * all versions of [g] to have a visible [return] for instance). **) -let prop_persistent_marks proj fi to_prop actions = +let prop_persistent_marks fi to_prop actions = let pdg_node_marks = FctMarks.persistent_in_marks_to_prop fi to_prop in let add_act acc (pdg, node_marks) = let kf = SlicingMacros.get_pdg_kf pdg in - let fi = SlicingMacros.get_kf_fi proj kf in + let fi = SlicingMacros.get_kf_fi kf in let a = match node_marks with | PdgMarks.SelList node_marks -> @@ -889,7 +920,7 @@ let prop_persistent_marks proj fi to_prop actions = * If it is the first persistent selection for this function, * and [propagate=true], also generates the actions to make every calls to this * function visible. *) -let add_marks_to_fi proj fi nodes_marks propagate actions = +let add_marks_to_fi fi nodes_marks propagate actions = SlicingParameters.debug ~level:2 "[Fct_Slice.add_marks_to_fi] (persistent)"; let marks, are_new_marks = match FctMarks.fi_marks fi with @@ -900,7 +931,7 @@ let add_marks_to_fi proj fi nodes_marks propagate actions = in let to_prop = add_marks marks nodes_marks in let actions = if propagate - then prop_persistent_marks proj fi to_prop actions + then prop_persistent_marks fi to_prop actions else actions in are_new_marks, actions @@ -1151,14 +1182,14 @@ let check_called_outputs call_id ff actions = * If the chosen function doesn't compute enough output, * build an action to add outputs to it. * *) -let apply_choose_call proj ff call = +let apply_choose_call ff call = SlicingParameters.debug ~level:2 "[Fct_Slice.apply_choose_call] for call-%d" call.sid; let call_id = ff, call in let call_info = CallInfo.get_info_call (ff, call) in if ((CallInfo.get_f_called call_info) = None) then begin if CallInfo.something_visible call_info then - let fbase_to_call = SlicingMacros.get_fi_call proj call in + let fbase_to_call = SlicingMacros.get_fi_call call in let f_to_call, actions = choose_f_to_call fbase_to_call call_info in let actions = @@ -1201,7 +1232,7 @@ let apply_modif_call_inputs ff call missing_inputs = (** [ff] calls a slice [g] that needs more inputs than those computed by [ff]. * The slicing level of [ff] is used in order to know if we have to modify [ff] * or to call another function. *) -let apply_missing_inputs proj ff call missing_inputs = +let apply_missing_inputs ff call missing_inputs = let _input_marks, more_inputs = missing_inputs in SlicingParameters.debug ~level:1 "[Fct_Slice.apply_missing_inputs] (%s)" (if more_inputs then "more" else "marks"); @@ -1222,8 +1253,8 @@ let apply_missing_inputs proj ff call missing_inputs = * let's keep the same called function. If it adds visible inputs, * let's choose another one *) begin - FctMarks.change_call proj ff call None; - apply_choose_call proj ff call + FctMarks.change_call ff call None; + apply_choose_call ff call end else apply_modif_call_inputs ff call missing_inputs @@ -1233,7 +1264,7 @@ let apply_missing_inputs proj ff call missing_inputs = * The slicing level has to be used to choose either to modify the called * function [g] or to change it. *) -let apply_missing_outputs proj ff call output_marks more_outputs = +let apply_missing_outputs ff call output_marks more_outputs = SlicingParameters.debug ~level:2 "[Fct_Slice.apply_missing_outputs]"; let ff_g = match CallInfo.get_call_f_called (ff, call) with | Some (SlicingInternals.CallSlice g) -> g @@ -1244,8 +1275,8 @@ let apply_missing_outputs proj ff call output_marks more_outputs = begin (* the easiest way is to ignore the called function and to use * [choose_call] *) - FctMarks.change_call proj ff call None; - apply_choose_call proj ff call + FctMarks.change_call ff call None; + apply_choose_call ff call end else apply_add_marks ff_g output_marks @@ -1260,7 +1291,7 @@ let apply_missing_outputs proj ff call output_marks more_outputs = * if needed. * @raise ChangeCallErr if [f_to_call] doesn't compute enough outputs. *) -let apply_change_call proj ff call f_to_call = +let apply_change_call ff call f_to_call = SlicingParameters.debug ~level:1 "[Fct_Slice.apply_change_call]"; let pdg = SlicingMacros.get_ff_pdg ff in let to_call, to_prop = @@ -1309,7 +1340,7 @@ let apply_change_call proj ff call f_to_call = let to_prop = FctMarks.mark_spare_call_nodes ff call in f_to_call, to_prop in - FctMarks.change_call proj ff call (Some to_call); + FctMarks.change_call ff call (Some to_call); let new_filters = after_marks_modifications ff to_prop in new_filters @@ -1317,7 +1348,7 @@ let apply_change_call proj ff call f_to_call = (** When the user wants to make a [change_call] to a function that doesn't * compute enough outputs, he can call [check_outputs_before_change_call] in * order to build the action the add those outputs. *) -let check_outputs_before_change_call _proj caller call ff_to_call = +let check_outputs_before_change_call caller call ff_to_call = let call_id = caller, call in let actions = [] in let actions = check_called_outputs call_id ff_to_call actions in @@ -1349,9 +1380,9 @@ let merge_slices ff1 ff2 = * and to remove the called function in [ff]. * @raise SlicingTypes.CantRemoveCalledFf if the slice is called. * *) -let clear_ff proj ff = +let clear_ff ff = let clear_call call_stmt call_info _ = - CallInfo.remove_called_by proj (ff, call_stmt) call_info in + CallInfo.remove_called_by (ff, call_stmt) call_info in match ff.SlicingInternals.ff_called_by with | [] -> FctMarks.fold_calls clear_call ff () @@ -1420,7 +1451,7 @@ let get_input_loc_under_mark ff loc = exception StopMerging -let merge_fun_callers get_list get_value merge is_top acc proj kf = +let merge_fun_callers get_list get_value merge is_top acc kf = if is_top acc then acc else begin let acc = ref acc in @@ -1436,7 +1467,7 @@ let merge_fun_callers get_list get_value merge is_top acc proj kf = let vf = Kernel_function.get_vi kf in if not (Cil_datatype.Varinfo.Set.mem vf !table) then begin table := Cil_datatype.Varinfo.Set.add vf !table ; - List.iter (fun x -> merge (get_value x)) (get_list proj kf) ; + List.iter (fun x -> merge (get_value x)) (get_list kf) ; List.iter merge_fun_caller (!Db.Value.callers kf) end (* else no way to add something, the [kf] contribution is already @@ -1449,18 +1480,18 @@ let merge_fun_callers get_list get_value merge is_top acc proj kf = end (** The mark [m] related to all statements of a source function [kf]. - Property : [is_bottom (get_from_func proj kf) = not (Project.is_called proj kf) ] *) -let get_mark_from_src_fun proj kf = + Property : [is_bottom (get_from_func kf) = not (is_src_fun_called kf) ] *) +let get_mark_from_src_fun kf = let kf_entry, _library = Globals.entry_point () in - if !Db.Slicing.Project.is_called proj kf_entry then + if is_src_fun_called kf_entry then SlicingMarks.mk_user_mark ~data:true ~addr:true ~ctrl:true else - let directly_called proj kf = (SlicingMacros.get_kf_fi proj kf).SlicingInternals.f_called_by in + let directly_called kf = (SlicingMacros.get_kf_fi kf).SlicingInternals.f_called_by in let get_call_mark (ff,stmt) = get_stmt_mark ff stmt in let merge m1 m2 = SlicingMarks.merge_marks [m1 ; m2] in let is_top = SlicingMarks.is_top_mark in let bottom = SlicingMarks.bottom_mark in - merge_fun_callers directly_called get_call_mark merge is_top bottom proj kf + merge_fun_callers directly_called get_call_mark merge is_top bottom kf (*-----------------------------------------------------------------------*) (** {2 Printing} (see also {!PrintSlice}) *) diff --git a/src/plugins/slicing/fct_slice.mli b/src/plugins/slicing/fct_slice.mli index 414904dc9fc0f234521d76e6361beacd031c1b5c..12ccce0eea46f696063d436539210eadf51e87b6 100644 --- a/src/plugins/slicing/fct_slice.mli +++ b/src/plugins/slicing/fct_slice.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,6 +23,15 @@ open SlicingInternals open Cil_types +(** Return [true] if the source function is called +* (even indirectly via transitivity) from a [Slice.t]. *) +val is_src_fun_called : + Cil_types.kernel_function -> bool + +(** Return [true] if the source function is visible +* (even indirectly via transitivity) from a [Slice.t]. *) +val is_src_fun_visible : + Cil_types.kernel_function -> bool (** * @raise SlicingTypes.ExternalFunction if the function has no source code, * because there cannot be any slice for it. @@ -39,26 +48,26 @@ val filter_already_in : fct_slice -> fct_base_criterion -> fct_base_criterion val apply_add_marks : fct_slice -> fct_base_criterion -> criterion list val add_marks_to_fi : - project -> fct_info -> fct_base_criterion -> bool -> criterion list -> + fct_info -> fct_base_criterion -> bool -> criterion list -> bool * criterion list val add_top_mark_to_fi : fct_info -> pdg_mark -> bool -> criterion list -> criterion list val check_outputs_before_change_call : - project -> fct_slice -> stmt -> fct_slice -> criterion list + fct_slice -> stmt -> fct_slice -> criterion list val apply_change_call : - project -> fct_slice -> stmt -> called_fct -> criterion list + fct_slice -> stmt -> called_fct -> criterion list -val apply_choose_call : project -> fct_slice -> stmt -> criterion list +val apply_choose_call : fct_slice -> stmt -> criterion list val apply_missing_inputs : - project -> fct_slice -> stmt -> (fct_base_criterion * bool) -> + fct_slice -> stmt -> (fct_base_criterion * bool) -> criterion list val apply_missing_outputs : - project -> fct_slice -> stmt -> fct_base_criterion -> bool -> + fct_slice -> stmt -> fct_base_criterion -> bool -> criterion list val apply_examine_calls : @@ -76,11 +85,11 @@ val get_param_mark : fct_slice -> int -> pdg_mark val get_local_var_mark : fct_slice -> varinfo -> pdg_mark val get_input_loc_under_mark : fct_slice -> Locations.Zone.t -> pdg_mark -val get_mark_from_src_fun : project -> Kernel_function.t -> pdg_mark +val get_mark_from_src_fun : Kernel_function.t -> pdg_mark val merge_inputs_m1_mark : fct_slice -> pdg_mark -val clear_ff : project -> fct_slice -> unit +val clear_ff : fct_slice -> unit val print_ff_sig : Format.formatter -> fct_slice -> unit diff --git a/src/plugins/slicing/printSlice.ml b/src/plugins/slicing/printSlice.ml index 653753ba4850ace704e2ea341fdf7c97e6f7b0fd..3564875635d133f3b577487ec0689e9cce4ea424 100644 --- a/src/plugins/slicing/printSlice.ml +++ b/src/plugins/slicing/printSlice.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -111,7 +111,7 @@ class printerClass optional_ff = object(self) label_info super#label l - method! private require_braces ?has_annot:_ _ = true + method! private require_braces _ _ = true end let print_fct_from_pdg fmt ?ff pdg = @@ -134,6 +134,10 @@ let print_original_glob fmt glob = (*----------------------------------------------------------------------------*) module PrintProject = struct + (* Type project is left, instead of being replaced by + calls to !Db.Slicing.Project.get_project everywhere. + Not sure which solution is the best one. + *) type t = string * SlicingInternals.project type node = | Src of SlicingInternals.fct_info @@ -171,7 +175,7 @@ module PrintProject = struct | rq :: rq_list -> f (Action (n, rq)) ; do_act (n+1) rq_list in do_act 1 proj.SlicingInternals.actions; let do_kf kf = - let fi = SlicingMacros.get_kf_fi proj kf in + let fi = SlicingMacros.get_kf_fi kf in let slices = SlicingMacros.fi_slices fi in List.iter (fun ff -> f (Slice ff)) slices; f (Src fi) @@ -197,23 +201,22 @@ module PrintProject = struct do_act_edge (n+1) (rq2 :: rq_list) in do_act_edge 1 proj.SlicingInternals.actions - let iter_edges_src_fun f proj = + let iter_edges_src_fun f = let do_kf_calls kf = - let fi = SlicingMacros.get_kf_fi proj kf in + let fi = SlicingMacros.get_kf_fi kf in let doit (kf_caller,_) = - let fi_caller = SlicingMacros.get_kf_fi proj kf_caller in + let fi_caller = SlicingMacros.get_kf_fi kf_caller in f ((Src fi_caller, Src fi), None) in List.iter doit (!Db.Value.callers kf) in Globals.Functions.iter do_kf_calls let iter_edges_e f (_, proj) = - let _ = match proj.SlicingInternals.actions with [] -> () - | rq :: _ -> f ((node_slice_callers (), (Action (1, rq))), None) in - let _ = iter_edges_slices f proj in - let _ = iter_edges_actions f proj in - let _ = iter_edges_src_fun f proj in - () + match proj.SlicingInternals.actions with [] -> () + | rq :: _ -> f ((node_slice_callers (), (Action (1, rq))), None); + iter_edges_slices f proj; + iter_edges_actions f proj; + iter_edges_src_fun f let color_soft_green = (0x7FFFD4) let color_medium_green = (0x00E598) @@ -323,12 +326,13 @@ end module PrintProjGraph = Graph.Graphviz.Dot(PrintProject) -let build_dot_project filename title project = +let build_dot_project filename title = + let project = SlicingState.get () in let file = open_out filename in - PrintProjGraph.output_graph file (title, project); - close_out file + PrintProjGraph.output_graph file (title, project); + close_out file -let print_fct_stmts fmt (_proj, kf) = +let print_fct_stmts fmt kf = try let pdg = !Db.Pdg.get kf in print_fct_from_pdg fmt pdg; diff --git a/src/plugins/slicing/printSlice.mli b/src/plugins/slicing/printSlice.mli index 035fe67306e0529a870974c491389541e59b8552..d973279d5b2f60daf6e4d59c68aa2a998bf5583f 100644 --- a/src/plugins/slicing/printSlice.mli +++ b/src/plugins/slicing/printSlice.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,7 +30,7 @@ val print_original_glob : Format.formatter -> Cil_types.global -> unit val print_fct_stmts : Format.formatter -> - (SlicingTypes.sl_project * Cil_types.kernel_function) -> + Cil_types.kernel_function -> unit -val build_dot_project : string -> string -> SlicingInternals.project -> unit +val build_dot_project : string -> string -> unit diff --git a/src/plugins/slicing/register.ml b/src/plugins/slicing/register.ml index fb051e65de0e1144a64ab56a2bfc54db9ee8951f..f9b1cae698e97b6f88223642da5dfe003143330d 100644 --- a/src/plugins/slicing/register.ml +++ b/src/plugins/slicing/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,1162 +20,6 @@ (* *) (**************************************************************************) -open Cil_types -module FC_file = File -open Cil_datatype - -let check_call stmt is_call = - let err = match stmt.skind with - | Instr (Call _) -> not is_call - | _ -> is_call - in - if err then - let str = if is_call then "not" else "" in - let msg = "This statement is "^str^" a call" in - raise (Invalid_argument msg) - else stmt - -let _pretty_list pretty fmt l = List.iter (pretty fmt) l - -let print_select fmt db_select = - let db_fvar, select = db_select in - Format.fprintf fmt "In %a : %a" - Varinfo.pretty db_fvar SlicingActions.print_f_crit select - -let get_select_kf (fvar, _select) = Globals.Functions.get fvar - -let check_db_select fvar db_select = - let db_fvar, select = db_select in - if not (Cil_datatype.Varinfo.equal db_fvar fvar) then - begin - SlicingParameters.debug - "slice name = %s <> select = %a@." - (fvar.vname) print_select db_select ; - raise (Invalid_argument - "This selection doesn't belong to the given function"); - end; - fvar, select - -let empty_db_select kf = (Kernel_function.get_vi kf, SlicingInternals.CuSelect []) -let top_db_select kf m = (Kernel_function.get_vi kf, SlicingInternals.CuTop m) -let check_kf_db_select kf = check_db_select (Kernel_function.get_vi kf) -let _check_fi_db_select fi = check_db_select (SlicingMacros.fi_svar fi) -let check_ff_db_select ff = check_db_select (SlicingMacros.ff_svar ff) - -let bottom_msg kf = - SlicingParameters.feedback - "bottom PDG for function '%s': ignore selection" - (Kernel_function.get_name kf) - -let basic_add_select kf select nodes ?(undef) nd_marks = - let fvar, sel = check_kf_db_select kf select in - match sel with - | SlicingInternals.CuTop _ -> select - | SlicingInternals.CuSelect sel -> - let pdg = !Db.Pdg.get kf in - let nodes = - List.map (fun n -> (n, None) (*TODO: add z_part ? *)) nodes in - (* let nd_marks = SlicingActions.build_node_and_dpds_selection mark in *) - (* let nd_marks = SlicingActions.build_simple_node_selection mark in *) - let crit = [(nodes, nd_marks)] in - let sel = SlicingActions.translate_crit_to_select pdg ~to_select:sel crit in - let sel = match undef with None -> sel - | Some (undef, mark) -> - PdgMarks.add_undef_in_to_select sel undef mark in - let sel = SlicingInternals.CuSelect sel in - (fvar, sel) - -let select_pdg_nodes kf ?(select=empty_db_select kf) nodes mark = - SlicingParameters.debug ~level:1 "[Register.select_pdg_nodes]" ; - let nd_marks = SlicingActions.build_node_and_dpds_selection mark in - try basic_add_select kf select nodes nd_marks - with Db.Pdg.Top | Db.Pdg.Bottom -> - assert false (* if we have node, we must have a pdg somewhere ! *) - -let mk_select pdg sel nodes undef mark = - let nd_marks = SlicingActions.build_simple_node_selection mark in - let crit = [(nodes, nd_marks)] in - let sel = SlicingActions.translate_crit_to_select pdg ~to_select:sel crit in - let sel = PdgMarks.add_undef_in_to_select sel undef mark in - let sel = SlicingInternals.CuSelect sel in - sel - -let select_stmt_zone kf ?(select=empty_db_select kf) stmt ~before loc mark = - SlicingParameters.debug ~level:1 "[Register.select_stmt_zone] %a %s stmt %d (m=%a)" - Locations.Zone.pretty loc - (if before then "before" else "after") stmt.sid - SlicingMarks.pretty_mark mark; - if not (Db.Value.is_reachable_stmt stmt) then - begin - SlicingParameters.feedback - "@[Nothing to select for @[%a@]@ %s unreachable stmt of %a@]" - Locations.Zone.pretty loc - (if before then "before" else "after") - Kernel_function.pretty kf; - select - end - else - let fvar, sel = check_kf_db_select kf select in - match sel with - | SlicingInternals.CuTop _ -> select - | SlicingInternals.CuSelect sel -> - try - let pdg = !Db.Pdg.get kf in - let nodes, undef = - !Db.Pdg.find_location_nodes_at_stmt pdg stmt before loc in - let sel = mk_select pdg sel nodes undef mark in - (fvar, sel) - with - | Not_found -> (* stmt probably unreachable *) - SlicingParameters.feedback - "@[Nothing to select for @[%a@]@ %s required stmt in %a@]" - Locations.Zone.pretty loc - (if before then "before" else "after") - Kernel_function.pretty kf; - SlicingParameters.debug - "@[Nothing to select for @[%a@]@ %s stmt %d in %a@]" - Locations.Zone.pretty loc - (if before then "before" else "after") stmt.sid - Kernel_function.pretty kf; - select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select - - -(** this one is similar to [select_stmt_zone] with the return statement -* when the function is defined, but it can also be used for undefined functions. *) -let select_in_out_zone ~at_end ~use_undef kf select loc mark = - SlicingParameters.debug - "[Register.select_in_out_zone] select zone %a (m=%a) at %s of %a" - Locations.Zone.pretty loc SlicingMarks.pretty_mark mark - (if at_end then "end" else "begin") Kernel_function.pretty kf; - let fvar, sel = check_kf_db_select kf select in - match sel with - | SlicingInternals.CuTop _ -> select - | SlicingInternals.CuSelect sel -> - try - let pdg = !Db.Pdg.get kf in - let find = - if at_end then !Db.Pdg.find_location_nodes_at_end - else !Db.Pdg.find_location_nodes_at_begin in - let nodes, undef = find pdg loc in - let undef = if use_undef then undef else None in - let sel = mk_select pdg sel nodes undef mark in - (fvar, sel) - with - | Not_found -> (* in or out unreachable ? *) - SlicingParameters.feedback - "@[Nothing to select for zone %a (m=%a) at %s of %a@]" - Locations.Zone.pretty loc SlicingMarks.pretty_mark mark - (if at_end then "end" else "begin") Kernel_function.pretty kf; - select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select - -let select_zone_at_end kf ?(select=empty_db_select kf) loc mark = - select_in_out_zone ~at_end:true ~use_undef:true kf select loc mark - -let select_modified_output_zone kf ?(select=empty_db_select kf) loc mark = - select_in_out_zone ~at_end:true ~use_undef:false kf select loc mark - -let select_zone_at_entry kf ?(select=empty_db_select kf) loc mark = - select_in_out_zone ~at_end:false ~use_undef:true kf select loc mark - -let stmt_nodes_to_select pdg stmt = - try - let stmt_nodes = !Db.Pdg.find_stmt_and_blocks_nodes pdg stmt in - SlicingParameters.debug ~level:2 "[Register.stmt_nodes_to_select] results on stmt %d (%a)" stmt.sid - (fun fmt l -> List.iter (!Db.Pdg.pretty_node true fmt) l) - stmt_nodes; - stmt_nodes - with Not_found -> - SlicingParameters.debug ~level:2 "[Register.stmt_nodes_to_select] no results for stmt %d, probably unreachable" stmt.sid; - [] - -let select_stmt_computation kf ?(select=empty_db_select kf) stmt mark = - SlicingParameters.debug ~level:1 "[Register.select_stmt_computation] on stmt %d" stmt.sid; - if not (Db.Value.is_reachable_stmt stmt) then - begin - SlicingParameters.feedback - "@[Nothing to select for an unreachable stmt of %a@]" - Kernel_function.pretty kf; - select - end - else - try - let pdg = !Db.Pdg.get kf in - let stmt_nodes = stmt_nodes_to_select pdg stmt in - let nd_marks = SlicingActions.build_node_and_dpds_selection mark in - basic_add_select kf select stmt_nodes nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select - -let select_label kf ?(select=empty_db_select kf) label mark = - SlicingParameters.debug ~level:1 "[Register.select_label] on label " - (* Logic_label.pretty label *); - try - let pdg = !Db.Pdg.get kf in - let nodes = - let add_label_nodes l acc = match l with - | StmtLabel stmt -> - let add acc l = - try (!Db.Pdg.find_label_node pdg !stmt l)::acc - with Not_found -> acc - in List.fold_left add acc (!stmt).labels - | LogicLabel (Some stmt, str) -> - let add acc l = match l with - | Label (sl, _, _) when sl = str -> - (try (!Db.Pdg.find_label_node pdg stmt l)::acc - with Not_found -> acc) - | _ -> acc - in List.fold_left add acc stmt.labels - | LogicLabel (None, _) -> acc - in - (* Logic_label.Set.fold add_label_nodes labels [] *) - add_label_nodes label [] - in - let nd_marks = SlicingActions.build_node_and_dpds_selection mark in - basic_add_select kf select nodes nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; select - -(** marking a call node means that a [choose_call] will have to decide that to - * call according to the slicing-level, but anyway, the call will be visible. - *) -let select_minimal_call kf ?(select=empty_db_select kf) stmt m = - SlicingParameters.debug ~level:1 "[Register.select_minimal_call]"; - try - let pdg = !Db.Pdg.get kf in - let call = check_call stmt true in - let call_node = !Db.Pdg.find_call_ctrl_node pdg call in - let nd_marks = SlicingActions.build_simple_node_selection m in - basic_add_select kf select [call_node] nd_marks - with Db.Pdg.Top -> top_db_select kf m - | Db.Pdg.Bottom -> bottom_msg kf; select - -let select_stmt_ctrl kf ?(select=empty_db_select kf) stmt = - SlicingParameters.debug ~level:1 "[Register.select_stmt_ctrl] of sid:%d" stmt.sid; - let mark = SlicingMarks.mk_user_mark ~ctrl:true ~data:false ~addr:false in - try - let pdg = !Db.Pdg.get kf in - let stmt_nodes = !Db.Pdg.find_simple_stmt_nodes pdg stmt in - let nd_marks = SlicingActions.build_ctrl_dpds_selection mark in - basic_add_select kf select stmt_nodes nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf - -let select_entry_point kf ?(select=empty_db_select kf) mark = - SlicingParameters.debug ~level:1 "[Register.select_entry_point] of %a" - Kernel_function.pretty kf; - try - let pdg = !Db.Pdg.get kf in - let node = !Db.Pdg.find_entry_point_node pdg in - let nd_marks = SlicingActions.build_simple_node_selection mark in - basic_add_select kf select [node] nd_marks - with Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf - -let select_return kf ?(select=empty_db_select kf) mark = - SlicingParameters.debug ~level:1 "[Register.select_return] of %a" - Kernel_function.pretty kf; - try - let pdg = !Db.Pdg.get kf in - let node = !Db.Pdg.find_ret_output_node pdg in - let nd_marks = SlicingActions.build_simple_node_selection mark in - basic_add_select kf select [node] nd_marks - with - | Not_found -> (* unreachable ? *) - SlicingParameters.feedback - "@[Nothing to select for return stmt of %a@]" - Kernel_function.pretty kf; - select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf - -let select_decl_var kf ?(select=empty_db_select kf) vi mark = - SlicingParameters.debug ~level:1 "[Register.select_decl_var] of %s in %a@." - vi.Cil_types.vname Kernel_function.pretty kf; - if vi.Cil_types.vglob (* no slicing request on globals *) - then select - else try - let pdg = !Db.Pdg.get kf in - let node = !Db.Pdg.find_decl_var_node pdg vi in - let nd_marks = SlicingActions.build_simple_node_selection mark in - basic_add_select kf select [node] nd_marks - with - | Not_found -> - SlicingParameters.feedback - "@[Nothing to select for %s declarationin %a@]" - vi.Cil_types.vname Kernel_function.pretty kf; - select - | Db.Pdg.Top -> top_db_select kf mark - | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf - - -let merge_select select1 select2 = - let select = match select1, select2 with - | SlicingInternals.CuTop m, _ | _, SlicingInternals.CuTop m -> SlicingInternals.CuTop m - | SlicingInternals.CuSelect select1, SlicingInternals.CuSelect select2 -> - (* TODO : we can probably do better...*) - SlicingInternals.CuSelect (select1 @ select2) - in select - -let merge_db_select db_select1 db_select2 = - let fvar, select1 = db_select1 in - let _, select2 = check_db_select fvar db_select2 in - let select = merge_select select1 select2 in - (fvar, select) - -module Selections = struct - - let add_to_selects db_select set = - let vf, select = db_select in - let select = - try merge_select (Cil_datatype.Varinfo.Map.find vf set) select - with Not_found -> select - in - Cil_datatype.Varinfo.Map.add vf select set - - let iter_selects_internal f set = - Cil_datatype.Varinfo.Map.iter (fun v sel -> f (v, sel)) set - -end - -let add_crit_ff_change_call proj ff_caller call f_to_call = - let crit = SlicingActions.mk_crit_change_call ff_caller call f_to_call in - SlicingProject.add_filter proj crit - -(** change the call to call the given slice. - * This is a user request, so it might be the case that - * the new function doesn't compute enough outputs : - * in that case, add outputs first. - *) -let call_ff_in_caller proj ~caller ~to_call = - let kf_caller = SlicingMacros.get_ff_kf caller in - let kf_to_call = SlicingMacros.get_ff_kf to_call in - let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller kf_to_call in - let ff_to_call = SlicingInternals.CallSlice to_call in - let add_change_call stmt = - add_crit_ff_change_call proj caller stmt ff_to_call ; - match Fct_slice.check_outputs_before_change_call proj caller - stmt to_call with - | [] -> () - | [c] -> SlicingProject.add_filter proj c - | _ -> assert false - - in List.iter add_change_call call_stmts - -let call_fsrc_in_caller proj ~caller ~to_call = - let kf_caller = SlicingMacros.get_ff_kf caller in - let fi_to_call = SlicingMacros.get_kf_fi proj to_call in - let kf_to_call = SlicingMacros.get_fi_kf fi_to_call in - let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller kf_to_call in - let add_change_call stmt = - add_crit_ff_change_call proj caller stmt (SlicingInternals.CallSrc (Some fi_to_call)) - in List.iter add_change_call call_stmts - -let call_min_f_in_caller proj ~caller ~to_call = - let kf_caller = SlicingMacros.get_ff_kf caller in - let pdg = SlicingMacros.get_ff_pdg caller in - let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller to_call in - let call_nodes = - List.map (fun call -> (!Db.Pdg.find_call_ctrl_node pdg call),None) - call_stmts in - let m = SlicingMarks.mk_user_spare in - let nd_marks = SlicingActions.build_simple_node_selection m in - let select = SlicingActions.translate_crit_to_select pdg [(call_nodes, nd_marks)] in - SlicingProject.add_fct_ff_filter proj caller (SlicingInternals.CuSelect select) - -let is_already_selected ff db_select = - let _, select = check_ff_db_select ff db_select in - match select with - | SlicingInternals.CuTop _ -> assert false - | SlicingInternals.CuSelect to_select -> - (* let pdg = !Db.Pdg.get (Globals.Functions.get fvar) in *) - let new_marks = Fct_slice.filter_already_in ff to_select in - let ok = if new_marks = [] then true else false in - if ok then - SlicingParameters.debug ~level:1 - "[Register.is_already_selected] %a ?\t--> yes" - !Db.Slicing.Select.pretty db_select - else SlicingParameters.debug ~level:1 - "[Register.is_already_selected] %a ?\t--> no (missing %a)" - !Db.Slicing.Select.pretty db_select - SlicingActions.print_sel_marks_list new_marks; - ok - -let add_ff_selection proj ff db_select = - SlicingParameters.debug ~level:1 "[Register.add_ff_selection] %a to %s" - !Db.Slicing.Select.pretty db_select (SlicingMacros.ff_name ff); - let _, select = check_ff_db_select ff db_select in - SlicingProject.add_fct_ff_filter proj ff select - -(** add a persistent selection to the function. -* This might change its slicing level in order to call slices later on. *) -let add_fi_selection proj db_select = - SlicingParameters.debug ~level:1 "[Register.add_fi_selection] %a" - !Db.Slicing.Select.pretty db_select; - let kf = get_select_kf db_select in - let fi = SlicingMacros.get_kf_fi proj kf in - let _, select = db_select in - SlicingProject.add_fct_src_filter proj fi select; - match fi.SlicingInternals.fi_level_option with - | SlicingInternals.DontSlice | SlicingInternals.DontSliceButComputeMarks -> - SlicingMacros.change_fi_slicing_level fi SlicingInternals.MinNbSlice; - SlicingParameters.debug ~level:1 "[Register.add_fi_selection] changing %s slicing level to %s@." - (SlicingMacros.fi_name fi) - (SlicingMacros.str_level_option fi.SlicingInternals.fi_level_option) - - | SlicingInternals.MinNbSlice | SlicingInternals.MaxNbSlice -> () - -let get_mark_from_param ff var = - let kf = SlicingMacros.get_ff_kf ff in - let param_list = Kernel_function.get_formals kf in - let rec find n var_list = match var_list with - | [] -> raise Not_found - | v :: var_list -> if Cil_datatype.Varinfo.equal v var then n - else find (n+1) var_list - in let n = find 1 param_list in - Fct_slice.get_param_mark ff n - -let get_called_slice ff stmt = - match stmt.skind with - | Instr (Call _) -> fst (Fct_slice.get_called_slice ff stmt) - | _ -> None - -let get_called_funcs ff stmt = match stmt.skind with - | Instr (Call (_,expr_f,_,_)) -> - if snd (Fct_slice.get_called_slice ff stmt) then - Kernel_function.Hptset.elements - (snd (!Db.Value.expr_to_kernel_function - (Kstmt stmt) - ~with_alarms:CilE.warn_none_mode - ~deps:None - expr_f)) - else - [] - | _ -> [] - - -let _db_pretty fmt (_project, kf) = - try !Db.Pdg.pretty fmt (!Db.Pdg.get kf) - with Not_found -> () - -let create_slice s = - SlicingParameters.debug ~level:1 "[Register.create_slice]"; - SlicingProject.create_slice s - -let copy_slice _proj ff = - SlicingParameters.debug ~level:1 "[Register.copy_slice]"; - Fct_slice.copy_slice ff - -let split_slice s = - SlicingParameters.debug ~level:1 "[Register.split_slice]"; - SlicingProject.split_slice s - -let merge_slices proj ff_1 ff_2 ~replace = - SlicingParameters.debug ~level:1 "[Register.merge_slices]"; - SlicingProject.merge_slices proj ff_1 ff_2 replace - -let remove_slice s = - SlicingParameters.debug ~level:1 "[Register.remove_slice]"; - SlicingProject.remove_ff s - -let is_request_empty p = - SlicingParameters.debug ~level:1 "[Register.is_request_empty]"; - SlicingProject.is_request_empty p - -let apply_next_action s = - SlicingParameters.debug ~level:1 "[Register.apply_next_action]"; - SlicingProject.apply_next_action s - -let apply_all_actions p = - SlicingParameters.debug ~level:1 "[Register.apply_all_actions]"; - SlicingParameters.feedback ~level:1 "applying all slicing requests..."; - SlicingParameters.debug ~level:2 "pending requests:@\n %a@\n" - !Db.Slicing.Request.pretty p ; - let r = SlicingProject.apply_all_actions p in - SlicingParameters.feedback ~level:2 "done (applying all slicing requests)."; - r - -let print_extracted_project ?fmt ~extracted_prj = - if SlicingParameters.Print.get () then - FC_file.pretty_ast ?fmt ~prj:extracted_prj () - -(** Global data management *) - -module P = - State_builder.Ref - (Datatype.Pair - (Datatype.List(SlicingTypes.Sl_project)) - (Datatype.Option(SlicingTypes.Sl_project))) - (struct - let name = "Slicing.Project" - let dependencies = [] (* others delayed below *) - let default () = [], None - end) - -let get_all () = fst (P.get ()) -let get_project () = snd (P.get ()) -let set_project proj_opt = P.set (get_all (), proj_opt) - -let from_unique_name name = - let all = get_all () in - try List.find (fun p -> name = SlicingProject.get_name p) all - with Not_found -> raise Db.Slicing.No_Project - -let mk_project name = -(* try - let _ = from_unique_name name in - raise Db.Slicing.Existing_Project - with Db.Slicing.No_Project -> *) - !Db.Value.compute () ; - let project = (SlicingProject.mk_project name) in - let all,current = P.get () in - P.set ((project :: all), current); - project - -let from_num_id proj kf num = - List.find - (fun f -> num = !Db.Slicing.Slice.get_num_id f) - (!Db.Slicing.Slice.get_all proj kf) - -(** {2 For the journalization of the slicing plug-in } *) - -(** {3 For the journalization of the Db.Slicing.Project.functions} *) -let dot_project = PrintSlice.build_dot_project -let dot_project = - Journal.register - "Slicing.Project.print_dot" - (Datatype.func3 - ~label1:("filename", None) Datatype.string - ~label2:("title", None) Datatype.string - Db.Slicing.Project.dyn_t - Datatype.unit) - dot_project -let dot_project ~filename ~title project = - dot_project filename title project - -let extract f_slice_names = SlicingTransform.extract ~f_slice_names -let extract = - Journal.register - "!Db.Slicing.Project.extract" - (Datatype.func3 - ~label1:("f_slice_names", - Some (fun () -> !Db.Slicing.Project.default_slice_names)) - (Datatype.func3 - Kernel_function.ty Datatype.bool Datatype.int Datatype.string) - Datatype.string - Db.Slicing.Project.dyn_t - Project.ty) - extract -let extract new_proj_name - ?(f_slice_names=(!Db.Slicing.Project.default_slice_names)) = - extract f_slice_names new_proj_name - -let default_slice_names = SlicingTransform.default_slice_names -let () = - Journal.Binding.add - (Datatype.func3 - Kernel_function.ty Datatype.bool Datatype.int Datatype.string) - default_slice_names - "!Db.Slicing.Project.default_slice_names" - -(** {3 For the journalization of the Db.Slicing.Select.functions} *) - -let higher_select_stmt set spare = SlicingCmds.select_stmt set ~spare -let higher_select_stmt = - Journal.register - "!Db.Slicing.Select.select_stmt" - (Datatype.func4 - Db.Slicing.Select.dyn_set - ~label2:("spare", None) Datatype.bool - Stmt.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set) - higher_select_stmt -let higher_select_stmt set ~spare = - higher_select_stmt set spare - -let higher_select_stmt_ctrl set spare = SlicingCmds.select_stmt_ctrl set ~spare -let higher_select_stmt_ctrl = - Journal.register - "!Db.Slicing.Select.select_stmt_ctrl" - (Datatype.func4 - Db.Slicing.Select.dyn_set - ~label2:("spare", None) Datatype.bool - Stmt.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set) - higher_select_stmt_ctrl -let higher_select_stmt_ctrl set ~spare = - higher_select_stmt_ctrl set spare - -let higher_select_stmt_lval_rw set mark rd wr stmt eval = - SlicingCmds.select_stmt_lval_rw set mark ~rd ~wr stmt ~eval -let higher_select_stmt_lval_rw = - Journal.register - "!Db.Slicing.Select.select_stmt_lval_rw" - (Datatype.func4 - Db.Slicing.Select.dyn_set - Db.Slicing.Mark.dyn_t - ~label3:("rd", None) Datatype.String.Set.ty - ~label4:("wr", None) Datatype.String.Set.ty - (Datatype.func3 - Stmt.ty - ~label2:("eval", None) Stmt.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set)) - higher_select_stmt_lval_rw -let higher_select_stmt_lval_rw set mark ~rd ~wr stmt ~eval = - higher_select_stmt_lval_rw set mark rd wr stmt eval - -let higher_select_stmt_lval set mark lval before stmt eval = - SlicingCmds.select_stmt_lval set mark lval ~before stmt ~eval -let higher_select_stmt_lval = - Journal.register - "!Db.Slicing.Select.select_stmt_lval" - (Datatype.func4 - Db.Slicing.Select.dyn_set - Db.Slicing.Mark.dyn_t - Datatype.String.Set.ty - ~label4:("before", None) Datatype.bool - (Datatype.func3 - Stmt.ty - ~label2:("eval", None) Stmt.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set)) - higher_select_stmt_lval -let higher_select_stmt_lval set mark lval ~before stmt ~eval = - higher_select_stmt_lval set mark lval before stmt eval - -let higher_select_stmt_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var = - SlicingCmds.select_stmt_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var -let higher_select_stmt_annots = - Journal.register - "!Db.Slicing.Select.select_stmt_annots" - (Datatype.func4 - Db.Slicing.Select.dyn_set - Db.Slicing.Mark.dyn_t - ~label3:("spare", None) Datatype.bool - ~label4:("threat", None) Datatype.bool - (Datatype.func4 - ~label1:("user_assert", None) Datatype.bool - ~label2:("slicing_pragma", None) Datatype.bool - ~label3:("loop_inv", None) Datatype.bool - ~label4:("loop_var", None) Datatype.bool - (Datatype.func2 - Stmt.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set))) - higher_select_stmt_annots -let higher_select_stmt_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var = - higher_select_stmt_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var - -let higher_select_func_lval_rw set mark rd wr eval = - SlicingCmds.select_func_lval_rw set mark ~rd ~wr ~eval -let higher_select_func_lval_rw = - Journal.register - "!Db.Slicing.Select.select_func_lval_rw" - (Datatype.func4 - Db.Slicing.Select.dyn_set - Db.Slicing.Mark.dyn_t - ~label3:("rd", None) Datatype.String.Set.ty - ~label4:("wr", None) Datatype.String.Set.ty - (Datatype.func2 - ~label1:("eval", None) Stmt.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set)) - higher_select_func_lval_rw -let higher_select_func_lval_rw set mark ~rd ~wr ~eval = - higher_select_func_lval_rw set mark rd wr eval - -let higher_select_func_return set spare = - SlicingCmds.select_func_return set ~spare -let higher_select_func_return = - Journal.register - "!Db.Slicing.Select.select_func_return" - (Datatype.func3 - Db.Slicing.Select.dyn_set - ~label2:("spare", None) Datatype.bool - Kernel_function.ty - Db.Slicing.Select.dyn_set) - higher_select_func_return -let higher_select_func_return set ~spare = higher_select_func_return set spare - -let higher_select_func_calls_to set spare = - SlicingCmds.select_func_calls_to set ~spare -let higher_select_func_calls_to = - Journal.register - "!Db.Slicing.Select.select_func_calls_to" - (Datatype.func3 - Db.Slicing.Select.dyn_set - ~label2:("spare", None) Datatype.bool - Kernel_function.ty - Db.Slicing.Select.dyn_set) - higher_select_func_calls_to -let higher_select_func_calls_to set ~spare = - higher_select_func_calls_to set spare - -let higher_select_func_calls_into set spare = - SlicingCmds.select_func_calls_into set ~spare -let higher_select_func_calls_into = - Journal.register - "!Db.Slicing.Select.select_func_calls_into" - (Datatype.func3 - Db.Slicing.Select.dyn_set - ~label2:("spare", None) Datatype.bool - Kernel_function.ty - Db.Slicing.Select.dyn_set) - higher_select_func_calls_into -let higher_select_func_calls_into set ~spare = - higher_select_func_calls_into set spare - -let higher_select_func_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var = - SlicingCmds.select_func_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var -let higher_select_func_annots = - Journal.register - "!Db.Slicing.Select.select_func_annots" - (Datatype.func4 - Db.Slicing.Select.dyn_set - Db.Slicing.Mark.dyn_t - ~label3:("spare", None) Datatype.bool - ~label4:("threat", None) Datatype.bool - (Datatype.func4 - ~label1:("user_assert", None) Datatype.bool - ~label2:("slicing_pragma", None) Datatype.bool - ~label3:("loop_inv", None) Datatype.bool - ~label4:("loop_var", None) Datatype.bool - (Datatype.func Kernel_function.ty Db.Slicing.Select.dyn_set))) - higher_select_func_annots -let higher_select_func_annots set mark ~spare ~threat ~user_assert ~slicing_pragma ~loop_inv ~loop_var = - higher_select_func_annots set mark spare threat user_assert slicing_pragma loop_inv loop_var - -(** {3 For the journalization of the Db.Slicing.Request.functions} *) -let apply_all project propagate_to_callers = - SlicingCmds.apply_all project ~propagate_to_callers -let apply_all = - Journal.register - "!Db.Slicing.Request.apply_all" - (Datatype.func2 - Db.Slicing.Project.dyn_t - ~label2:("propagate_to_callers", None) Datatype.bool - Datatype.unit) - apply_all -let apply_all project ~propagate_to_callers = - apply_all project propagate_to_callers - -let merge_slices proj ff_1 ff_2 replace = - merge_slices proj ff_1 ff_2 ~replace -let merge_slices = - Journal.register - "!Db.Slicing.Request.merge_slices" - (Datatype.func4 - Db.Slicing.Project.dyn_t - Db.Slicing.Slice.dyn_t - Db.Slicing.Slice.dyn_t - ~label4:("replace", None) Datatype.bool - Db.Slicing.Slice.dyn_t) - merge_slices -let merge_slices proj ff_1 ff_2 ~replace = - merge_slices proj ff_1 ff_2 replace - -let call_ff_in_caller proj caller to_call = - call_ff_in_caller proj ~caller ~to_call -let call_ff_in_caller = - Journal.register - "!Db.Slicing.Request.add_call_slice" - (Datatype.func3 - Db.Slicing.Project.dyn_t - ~label2:("caller", None) Db.Slicing.Slice.dyn_t - ~label3:("to_call", None) Db.Slicing.Slice.dyn_t - Datatype.unit) - call_ff_in_caller -let call_ff_in_caller proj ~caller ~to_call = - call_ff_in_caller proj caller to_call - -let call_fsrc_in_caller proj caller to_call = - call_fsrc_in_caller proj ~caller ~to_call -let call_fsrc_in_caller = - Journal.register - "!Db.Slicing.Request.add_call_fun" - (Datatype.func3 - Db.Slicing.Project.dyn_t - ~label2:("caller", None) Db.Slicing.Slice.dyn_t - ~label3:("to_call", None) Kernel_function.ty - Datatype.unit) - call_fsrc_in_caller -let call_fsrc_in_caller proj ~caller ~to_call = - call_fsrc_in_caller proj caller to_call - -let call_min_f_in_caller proj caller to_call = - call_min_f_in_caller proj ~caller ~to_call -let call_min_f_in_caller = - Journal.register - "!Db.Slicing.Request.add_call_min_fun" - (Datatype.func3 - Db.Slicing.Project.dyn_t - ~label2:("caller", None) Db.Slicing.Slice.dyn_t - ~label3:("to_call", None) Kernel_function.ty - Datatype.unit) - call_min_f_in_caller -let call_min_f_in_caller proj ~caller ~to_call = - call_min_f_in_caller proj caller to_call - - -(** {3 For the journalization of the Db.Slicingfunctions} *) - -let set_modes calls callers sliceUndef keepAnnotations print () = - SlicingParameters.Mode.Calls.set calls ; - SlicingParameters.Mode.Callers.set callers ; - SlicingParameters.Mode.SliceUndef.set sliceUndef; - SlicingParameters.Mode.KeepAnnotations.set keepAnnotations; - SlicingParameters.Print.set print - -let set_modes = - Journal.register - "!Db.Slicing.set_modes" - (Datatype.func4 - ~label1:("calls", None) Datatype.int - ~label2:("callers", None) Datatype.bool - ~label3:("sliceUndef", None) Datatype.bool - ~label4:("keepAnnotations", None) Datatype.bool - (Datatype.func2 - ~label1:("print", None) Datatype.bool - Datatype.unit - Datatype.unit)) - set_modes -let set_modes ?(calls=SlicingParameters.Mode.Calls.get ()) - ?(callers=SlicingParameters.Mode.Callers.get ()) - ?(sliceUndef=SlicingParameters.Mode.SliceUndef.get ()) - ?(keepAnnotations=SlicingParameters.Mode.KeepAnnotations.get ()) - ?(print=SlicingParameters.Print.get ()) - () = - set_modes calls callers sliceUndef keepAnnotations print () - -(** {2 Initialisation of the slicing plug-in} *) - -let () = - Cmdline.run_after_extended_stage - (fun () -> - State_dependency_graph.add_codependencies - ~onto:P.self - [ !Db.Pdg.self; !Db.Inputs.self_external; !Db.Outputs.self_external ]) - -(** {3 Register external functions into Db.Slicing} *) -let () = - Db.Slicing.self := P.self; - Db.Slicing.set_modes := set_modes (* Journalized *) - -(** {3 Register external functions into Db.Slicing.Project} *) -let () = - Db.Slicing.Project.print_dot := dot_project; (* Journalized *) - Db.Slicing.Project.extract := extract ; (* Journalized *) - Db.Slicing.Project.default_slice_names := default_slice_names ; (* Journalized *) - Db.register - (Db.Journalize - ("Slicing.Project.mk_project", - Datatype.func Datatype.string Db.Slicing.Project.dyn_t)) - Db.Slicing.Project.mk_project - mk_project; - Db.register - (Db.Journalize - ("Slicing.Project.set_project", - Datatype.func (Datatype.option Db.Slicing.Project.dyn_t) Datatype.unit)) - Db.Slicing.Project.set_project - set_project; - Db.register - (Db.Journalize - ("Slicing.Project.change_slicing_level", - Datatype.func3 - Db.Slicing.Project.dyn_t - Kernel_function.ty - Datatype.int - Datatype.unit)) - Db.Slicing.Project.change_slicing_level - SlicingMacros.change_slicing_level ; - - (* No needs of Journalization for others Db.Slicing.Project.functions *) - Db.register Db.Journalization_not_required - Db.Slicing.Project.print_extracted_project print_extracted_project; - Db.register Db.Journalization_not_required - Db.Slicing.Project.from_unique_name from_unique_name; - Db.register Db.Journalization_not_required - Db.Slicing.Project.get_all get_all; - Db.register Db.Journalization_not_required - Db.Slicing.Project.get_project get_project; - Db.register Db.Journalization_not_required - Db.Slicing.Project.get_name SlicingProject.get_name; - Db.register Db.Journalization_not_required - Db.Slicing.Project.pretty SlicingProject.print_project_and_worklist ; - Db.register Db.Journalization_not_required - Db.Slicing.Project.is_directly_called_internal SlicingMacros.is_src_fun_called ; - Db.register Db.Journalization_not_required - Db.Slicing.Project.is_called SlicingTransform.is_src_fun_called ; - Db.register Db.Journalization_not_required - Db.Slicing.Project.has_persistent_selection SlicingMacros.has_persistent_selection - -(** {3 Register external functions into Db.Slicing.Select} *) -let () = - (* No needs of Journalization for low-level Db.Slicing.Select.functions. - * [Note:] They can be Journalized. In that case, functions computing [Db.Slicing.Select.t] - * values have to be Journalized - *) - Db.register (Db.Journalization_must_not_happen "Slicing.Select.add_to_selects_internal") - Db.Slicing.Select.add_to_selects_internal Selections.add_to_selects; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_internal") - Db.Slicing.Select.select_stmt_internal select_stmt_computation; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_label_internal") - Db.Slicing.Select.select_label_internal select_label; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_ctrl_internal") - Db.Slicing.Select.select_stmt_ctrl_internal select_stmt_ctrl ; (* TODO? Journalized *) - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_entry_point_internal") - Db.Slicing.Select.select_entry_point_internal select_entry_point; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_return_internal") - Db.Slicing.Select.select_return_internal select_return; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_decl_var_internal") - Db.Slicing.Select.select_decl_var_internal select_decl_var; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_min_call_internal") - Db.Slicing.Select.select_min_call_internal select_minimal_call; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_merge_internal") - Db.Slicing.Select.merge_internal merge_db_select; - - (* No needs of Journalization for low-level Db.Slicing.Select.functions. - * [Note:] They can be Journalized. In that case, functions computing [Db.Slicing.Select.t] - * [Pdg.node] values have to be Journalized - *) - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_pdg_nodes_internal") - Db.Slicing.Select.select_pdg_nodes_internal select_pdg_nodes; - - (* No needs of Journalization for low-level Db.Slicing.Select.functions. - * [Note:] They can be Journalized. In that case, functions computing [Db.Slicing.Select.t] - * [Location.Zone.t] values have to be Journalized - *) - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_zone_internal") - Db.Slicing.Select.select_stmt_zone_internal select_stmt_zone; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_zone_at_entry_internal") - Db.Slicing.Select.select_zone_at_entry_point_internal select_zone_at_entry; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_zone_at_end_internal") - Db.Slicing.Select.select_zone_at_end_internal select_zone_at_end; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_modified_output_zone_internal") - Db.Slicing.Select.select_modified_output_zone_internal select_modified_output_zone; - - (* No needs of Journalization for intermediate-level Db.Slicing.Select.functions *) - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_term") - (* [Note] Can be Journalized -> Functions computing [term] values have to be Journalized *) - Db.Slicing.Select.select_stmt_term SlicingCmds.select_stmt_term ; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_pred") - (* [Note] Can be Journalized -> Functions computing [predicate] values have to be Journalized *) - Db.Slicing.Select.select_stmt_pred SlicingCmds.select_stmt_pred ; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_annot") - (* [Note] Can be Journalized -> Functions computing [code_annotation] values have to be Journalized *) - Db.Slicing.Select.select_stmt_annot SlicingCmds.select_stmt_annot ; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_pdg_nodes") - (* [Note] Can be Journalized -> Functions computing [Pdg.node] values have to be Journalized *) - Db.Slicing.Select.select_pdg_nodes SlicingCmds.select_pdg_nodes ; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_stmt_zone") - (* [Note] Can be Journalized -> Functions computing [Locations.Zone.t] values have to be Journalized *) - Db.Slicing.Select.select_stmt_zone SlicingCmds.select_stmt_zone ; - Db.register (Db.Journalization_must_not_happen "Slicing.Select.select_func_zone") - (* [Note] Can be Journalized -> Functions computing [Locations.Zone.t] values have to be Journalized *) - Db.Slicing.Select.select_func_zone SlicingCmds.select_func_zone ; - - (* higher level function from slicingCmds *) - Db.Slicing.Select.select_stmt := higher_select_stmt ; (* Journalized *) - Db.Slicing.Select.select_stmt_ctrl := higher_select_stmt_ctrl ; (* Journalized *) - Db.Slicing.Select.select_stmt_lval_rw := higher_select_stmt_lval_rw ; (* Journalized *) - Db.Slicing.Select.select_stmt_lval := higher_select_stmt_lval ; (* Journalized *) - Db.Slicing.Select.select_stmt_annots := higher_select_stmt_annots ; (* Journalized *) - Db.Slicing.Select.select_func_lval_rw := higher_select_func_lval_rw ; (* Journalized *) - Db.register - (Db.Journalize - ("Slicing.Select.select_func_lval", - Datatype.func4 - Db.Slicing.Select.dyn_set - Db.Slicing.Mark.dyn_t - Datatype.String.Set.ty - Kernel_function.ty - Db.Slicing.Select.dyn_set)) - Db.Slicing.Select.select_func_lval - SlicingCmds.select_func_lval ; - Db.Slicing.Select.select_func_return := higher_select_func_return ; (* Journalized *) - Db.Slicing.Select.select_func_calls_to := higher_select_func_calls_to ; (* Journalized *) - Db.Slicing.Select.select_func_calls_into := higher_select_func_calls_into ; (* Journalized *) - Db.Slicing.Select.select_func_annots := higher_select_func_annots ; (* Journalized *) - - (* No needs of Journalization for others Db.Slicing.Select.functions *) - Db.register - Db.Journalization_not_required - Db.Slicing.Select.iter_selects_internal - Selections.iter_selects_internal ; - Db.register - Db.Journalization_not_required - Db.Slicing.Select.get_function - get_select_kf; - Db.register - Db.Journalization_not_required - Db.Slicing.Select.pretty - print_select - -(** {3 Register external functions into Db.Slicing.Slice} *) -let () = - Db.register (Db.Journalize - ("Slicing.Slice.create", - Datatype.func2 - Db.Slicing.Project.dyn_t - Kernel_function.ty - Db.Slicing.Slice.dyn_t)) - Db.Slicing.Slice.create - create_slice ; - Db.register - (Db.Journalize - ("Slicing.Slice.remove", - Datatype.func2 Db.Slicing.Project.dyn_t Db.Slicing.Slice.dyn_t Datatype.unit)) - Db.Slicing.Slice.remove - remove_slice ; - - (* higher level function from slicingCmds *) - Db.register - (Db.Journalize - ("Slicing.Slice.remove_uncalled", - Datatype.func Db.Slicing.Project.dyn_t Datatype.unit)) - Db.Slicing.Slice.remove_uncalled - SlicingProject.remove_uncalled_slices ; - - (* No needs of Journalization for others Db.Slicing.Slice.functions *) - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_all SlicingProject.get_slices ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_callers SlicingProject.get_slice_callers ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_called_slice get_called_slice ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_called_funcs get_called_funcs ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.pretty SlicingProject.pretty_slice ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_mark_from_stmt Fct_slice.get_stmt_mark; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_mark_from_label Fct_slice.get_label_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_mark_from_formal get_mark_from_param ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_mark_from_local_var Fct_slice.get_local_var_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_user_mark_from_inputs Fct_slice.merge_inputs_m1_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_callers SlicingProject.get_slice_callers ; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_function SlicingMacros.get_ff_kf; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.get_num_id SlicingMacros.get_ff_id; - Db.register Db.Journalization_not_required - Db.Slicing.Slice.from_num_id from_num_id - -(** {3 Register external functions into Db.Slicing.Request} *) -let () = - (* intermediate-level Db.Slicing.Request.functions *) - Db.register (Db.Journalization_must_not_happen "Db.Slicing.Request.add_slice_selection_internal") - (* [Note] Can be Journalized -> Functions computing [Db.Slicing.Select.t] values have to be Journalized *) - Db.Slicing.Request.add_slice_selection_internal add_ff_selection ; - Db.register (Db.Journalization_must_not_happen "Db.Slicing.Request.add_selection_internal") - (* [Note] Can be Journalized -> Functions computing [Db.Slicing.Select.t] values have to be Journalized *) - Db.Slicing.Request.add_selection_internal add_fi_selection ; - (* higher level Db.Slicing.Request.functions *) - Db.register - (Db.Journalize - ("Slicing.Request.propagate_user_marks", - Datatype.func Db.Slicing.Project.dyn_t Datatype.unit)) - Db.Slicing.Request.propagate_user_marks - SlicingCmds.topologic_propagation ; - Db.register - (Db.Journalize - ("Slicing.Request.add_selection", - Datatype.func2 - Db.Slicing.Project.dyn_t Db.Slicing.Select.dyn_set Datatype.unit)) - Db.Slicing.Request.add_selection - SlicingCmds.add_selection ; - Db.register - (Db.Journalize - ("Slicing.Request.add_persistent_selection", - Datatype.func2 - Db.Slicing.Project.dyn_t Db.Slicing.Select.dyn_set Datatype.unit)) - Db.Slicing.Request.add_persistent_selection - SlicingCmds.add_persistent_selection ; - Db.register - (Db.Journalize - ("Slicing.Request.add_persistent_cmdline", - Datatype.func Db.Slicing.Project.dyn_t Datatype.unit)) - Db.Slicing.Request.add_persistent_cmdline - SlicingCmds.add_persistent_cmdline ; - Db.Slicing.Request.add_call_slice := call_ff_in_caller ; (* Journalized *) - Db.Slicing.Request.add_call_fun := call_fsrc_in_caller ; (* Journalized *) - Db.Slicing.Request.add_call_min_fun := call_min_f_in_caller ; (* Journalized *) - Db.Slicing.Request.merge_slices := merge_slices ; (* Journalized *) - Db.register - (Db.Journalize - ("Slicing.Request.copy_slice", - Datatype.func2 - Db.Slicing.Project.dyn_t - Db.Slicing.Slice.dyn_t - Db.Slicing.Slice.dyn_t)) - Db.Slicing.Request.copy_slice - copy_slice ; - Db.register - (Db.Journalize - ("Slicing.Request.split_slice", - Datatype.func2 - Db.Slicing.Project.dyn_t - Db.Slicing.Slice.dyn_t - (Datatype.list Db.Slicing.Slice.dyn_t))) - Db.Slicing.Request.split_slice - split_slice ; - Db.Slicing.Request.apply_all := apply_all ; (* Journalized *) - Db.register - (Db.Journalize - ("Slicing.Request.apply_next_internal", - Datatype.func Db.Slicing.Project.dyn_t Datatype.unit)) - Db.Slicing.Request.apply_next_internal - apply_next_action ; - Db.register - (Db.Journalize - ("Slicing.Request.apply_all_internal", - Datatype.func Db.Slicing.Project.dyn_t Datatype.unit)) - Db.Slicing.Request.apply_all_internal - apply_all_actions; - - (* No needs of Journalization for Db.Slicing.Request.functions *) - Db.register Db.Journalization_not_required - Db.Slicing.Request.is_request_empty_internal is_request_empty; - Db.register Db.Journalization_not_required - Db.Slicing.Request.is_already_selected_internal is_already_selected ; - Db.register Db.Journalization_not_required - Db.Slicing.Request.pretty SlicingProject.print_proj_worklist - -(** {3 Register external functions into Db.Slicing.Mark} *) -let () = - (* No needs of Journalization for Db.Slicing.Mark.functions *) - Db.register Db.Journalization_not_required - Db.Slicing.Mark.compare SlicingMarks.compare_marks ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.pretty SlicingMarks.pretty_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.make SlicingMarks.mk_user_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.is_bottom SlicingMarks.is_bottom_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.is_spare SlicingMarks.is_spare_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.is_ctrl SlicingMarks.is_ctrl_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.is_addr SlicingMarks.is_addr_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.is_data SlicingMarks.is_data_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.is_data SlicingMarks.is_data_mark ; - Db.register Db.Journalization_not_required - Db.Slicing.Mark.get_from_src_func Fct_slice.get_mark_from_src_fun - let main () = if SlicingParameters.is_on () then begin SlicingParameters.feedback ~level:1 "slicing requests in progress..."; @@ -1186,38 +30,30 @@ let main () = !Db.Value.compute (); let project_name = SlicingParameters.ProjectName.get () in - let project = !Db.Slicing.Project.mk_project project_name in - !Db.Slicing.Project.set_project (Some project); - !Db.Slicing.Request.add_persistent_cmdline project; + Api.Project.reset_slicing (); + Api.Request.add_persistent_cmdline (); (* Apply all pending requests. *) - if !Db.Slicing.Request.is_request_empty_internal project then + if Api.Request.is_request_empty_internal () then begin SlicingParameters.warning "No internal slicing request from the command line." ; if SlicingParameters.Mode.Callers.get () then let kf_entry, _library = Globals.entry_point () in SlicingParameters.warning "Adding an extra request on the entry point of function: %a." Kernel_function.pretty kf_entry; - let set = Db.Slicing.Select.empty_selects in - let set = !Db.Slicing.Select.select_func_calls_into set true kf_entry in - !Db.Slicing.Request.add_persistent_selection project set + let set = Api.Select.empty_selects in + let set = Api.Select.select_func_calls_into set true kf_entry in + Api.Request.add_persistent_selection set end; - !Db.Slicing.Request.apply_all_internal project; + Api.Request.apply_all_internal (); if SlicingParameters.Mode.Callers.get () then - !Db.Slicing.Slice.remove_uncalled project; + Api.Slice.remove_uncalled (); let sliced_project_name = project_name ^ (SlicingParameters.ExportedProjectPostfix.get ()) in SlicingParameters.set_off (); - let sliced_project = - !Db.Slicing.Project.extract sliced_project_name project - in - Project.on sliced_project SlicingParameters.clear (); - if SlicingParameters.Print.get () then begin - FC_file.pretty_ast ~prj:sliced_project (); - SlicingParameters.result ~level:2 "Results :@ %a@." - !Db.Slicing.Project.pretty project - end; + let sliced_project = Api.Project.extract sliced_project_name in + Project.on sliced_project SlicingParameters.clear (); SlicingParameters.feedback ~level:2 "done (slicing requests in progress)."; end diff --git a/src/plugins/slicing/register_gui.ml b/src/plugins/slicing/register_gui.ml index bf6a38b55a378057cf5d6475fd9e8d67110e04a5..07ae1be637d93c38dbebf4fd5cca47c49f7eef85 100644 --- a/src/plugins/slicing/register_gui.ml +++ b/src/plugins/slicing/register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,17 +31,17 @@ module Enabled = struct (Datatype.Bool) (struct let name = "Slicing_gui.State" - let dependencies = [!Db.Slicing.self] + let dependencies = [Api.self] let default () = false end) end (* for slicing callback *) -let mk_selection fselect = fselect Db.Slicing.Select.empty_selects +let mk_selection fselect = fselect Api.Select.empty_selects (* for slicing callback *) let mk_selection_cad fselect = - mk_selection fselect (!Db.Slicing.Mark.make ~ctrl:true ~addr:true ~data:true) + mk_selection fselect (Api.Mark.make ~ctrl:true ~addr:true ~data:true) (* for slicing callback *) let mk_selection_all fselect = @@ -50,19 +50,15 @@ let mk_selection_all fselect = (* for slicing callback *) let mk_slice selection = Enabled.set true; - let n = string_of_int (1 + List.length (!Db.Slicing.Project.get_all ())) in - let project_name = SlicingParameters.ProjectName.get () ^ n in - let project = !Db.Slicing.Project.mk_project project_name in - !Db.Slicing.Request.add_persistent_selection project selection ; - !Db.Slicing.Request.apply_all_internal project; + Api.Project.reset_slicing (); + Api.Request.add_persistent_selection selection ; + Api.Request.apply_all_internal (); if SlicingParameters.Mode.Callers.get () then - !Db.Slicing.Slice.remove_uncalled project; + Api.Slice.remove_uncalled (); let sliced_project_name = - project_name ^ SlicingParameters.ExportedProjectPostfix.get () + SlicingParameters.ProjectName.get () ^ SlicingParameters.ExportedProjectPostfix.get () in - let new_project = !Db.Slicing.Project.extract sliced_project_name project in - !Db.Slicing.Project.set_project (Some project); - new_project + Api.Project.extract sliced_project_name (* To add a sensitive/insensitive menu item to a [factory] *) let add_item (factory:GMenu.menu GMenu.factory) ~callback name arg_opt = @@ -118,18 +114,6 @@ let gui_apply_action (main_ui:Design.main_window_extension_points) f x ~info = f x ; gui_annot_info main_ui info - -let gui_set_project (main_ui:Design.main_window_extension_points) proj_opt = - gui_apply_action main_ui !Db.Slicing.Project.set_project proj_opt - ~info:(fun fmt -> - match proj_opt with - | None -> Format.fprintf fmt "Clear slicing highlighting" - | Some project -> - Format.fprintf fmt "Highlighting for@ %s" - (!Db.Slicing.Project.get_name project) - ); - main_ui#rehighlight () - let slicing_selector (popup_factory:GMenu.menu GMenu.factory) (main_ui:Design.main_window_extension_points) ~button localizable = if (not (Db.Value.is_computed ())) @@ -148,50 +132,53 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) else enable () )) else - let slicing_project = !Db.Slicing.Project.get_project () in if button = 1 then begin let level = 1 in - let slicing_view project = + let slicing_view () = gui_annot_info main_ui ~level - (fun fmt -> Format.fprintf fmt "Highlighting for@ %s" - (!Db.Slicing.Project.get_name project)) + (fun fmt -> Format.fprintf fmt "Highlighting.") in - Extlib.may slicing_view slicing_project; + SlicingState.may slicing_view; if SlicingParameters.verbose_atleast level then begin - let slicing_mark project = + let slicing_mark () = let slicing_mark kf get_mark = (* use -slicing-debug -verbose to get slicing mark information *) let add_mark_info txt = gui_annot_info ~level main_ui (fun fmt -> Format.fprintf fmt "Tag: %s" (txt ())) in - let slices = !Db.Slicing.Slice.get_all project kf in + let slices = Api.Slice.get_all kf in match slices with | [] -> (* No slice for this kf *) add_mark_info (fun () -> - if !Db.Slicing.Project.is_called project kf + if Api.Project.is_called kf then (* but the source function is called *) (Format.asprintf "<src>%a" - !Db.Slicing.Mark.pretty (!Db.Slicing.Mark.get_from_src_func project kf)) + Api.Mark.pretty (Api.Mark.get_from_src_func kf)) else "< >< >") | slices -> - if !Db.Slicing.Project.is_called project kf + if Api.Project.is_called kf then begin (* The source function is also called *) assert (not (kf == fst (Globals.entry_point ()))) ; add_mark_info (fun () -> Format.asprintf "<src>%a" - !Db.Slicing.Mark.pretty (!Db.Slicing.Mark.get_from_src_func project kf)) + Api.Mark.pretty (Api.Mark.get_from_src_func kf)) end ; let mark_slice slice = - add_mark_info (fun () -> Format.asprintf "%a" !Db.Slicing.Mark.pretty (get_mark slice)) + add_mark_info (fun () -> Format.asprintf "%a" Api.Mark.pretty (get_mark slice)) in List.iter mark_slice slices in match localizable with - | Pretty_source.PTermLval(Some kf,(Kstmt ki),_,_) (* as for the statement *) - | Pretty_source.PLval (Some kf,(Kstmt ki),_) (* as for the statement *) - | Pretty_source.PStmt (kf,ki) -> slicing_mark kf (fun slice -> !Db.Slicing.Slice.get_mark_from_stmt slice ki) - | Pretty_source.PVDecl (Some kf,vi) -> slicing_mark kf (fun slice -> !Db.Slicing.Slice.get_mark_from_local_var slice vi) + | Pretty_source.PTermLval(Some kf,(Kstmt ki),_,_) + | Pretty_source.PLval (Some kf,(Kstmt ki),_) + | Pretty_source.PStmt (kf,ki) -> + slicing_mark kf + (fun slice -> Api.Slice.get_mark_from_stmt slice ki) + | Pretty_source.PVDecl (Some kf,_,vi) -> + slicing_mark kf + (fun slice -> Api.Slice.get_mark_from_local_var slice vi) | _ -> () - in Extlib.may slicing_mark slicing_project + in + SlicingState.may slicing_mark end end else if button = 3 then begin @@ -215,7 +202,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) Format.fprintf fmt "Request for slicing effects of function %a" Kernel_function.pretty kf) - (mk_selection_all !Db.Slicing.Select.select_func_calls_to kf) + (mk_selection_all Api.Select.select_func_calls_to kf) in add_slicing_item "Slice calls to" kf_opt ~callback); @@ -225,7 +212,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) Format.fprintf fmt "Request for slicing entrance into function %a" Kernel_function.pretty kf) - (mk_selection_all !Db.Slicing.Select.select_func_calls_into kf) + (mk_selection_all Api.Select.select_func_calls_into kf) in add_slicing_item "Slice calls into" kf_opt ~callback); @@ -235,7 +222,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) Format.fprintf fmt "Request for returned value of function %a" Kernel_function.pretty kf) - (mk_selection_all !Db.Slicing.Select.select_func_return kf) + (mk_selection_all Api.Select.select_func_return kf) in add_slicing_item "Slice result" (Extlib.opt_filter @@ -254,16 +241,16 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) Format.fprintf fmt "Request for slicing effects of statement %d" ki.sid) - (mk_selection_all !Db.Slicing.Select.select_stmt ki kf) + (mk_selection_all Api.Select.select_stmt ki kf) in add_slicing_item "Slice stmt" kf_ki_lv_opt ~callback); let get_lv lvopt text = match lvopt with | None -> - GToolbox.input_string ~title:"Enter an lvalue" text + Gtk_helper.input_string ~title:"Enter an lvalue" text | Some lv -> - (* For probably dubious reasons, the functions in Db.Slicing.Select + (* For probably dubious reasons, the functions in Api.Select require strings instead of directly a lvalue. Thus, we convert our shiny lvalue to string, so that it may be parsed back... *) Some (Pretty_utils.to_string Printer.pp_lval lv) @@ -280,7 +267,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) "Request for slicing lvalue %s before statement %d" txt ki.sid) - (mk_selection_cad !Db.Slicing.Select.select_stmt_lval + (mk_selection_cad Api.Select.select_stmt_lval lval_str ~before:true ki ~eval:ki kf) with e -> main_ui#error "Invalid expression: %s" (Printexc.to_string e) @@ -304,7 +291,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) "Request for slicing read accesses to lvalue %s" txt) (mk_selection_cad - !Db.Slicing.Select.select_func_lval_rw + Api.Select.select_func_lval_rw ~rd:lval_str ~wr:Datatype.String.Set.empty ~eval:ki kf) @@ -330,7 +317,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) "Request for slicing written accesses to lvalue %s" txt) (mk_selection_cad - !Db.Slicing.Select.select_func_lval_rw + Api.Select.select_func_lval_rw ~rd:Datatype.String.Set.empty ~wr:lval_str ~eval:ki kf) @@ -350,7 +337,7 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) Format.fprintf fmt "Request for slicing accessibility to statement %d" ki.sid) - (mk_selection_all !Db.Slicing.Select.select_stmt_ctrl ki kf) + (mk_selection_all Api.Select.select_stmt_ctrl ki kf) in add_slicing_item "Slice ctrl" kf_ki_lv_opt ~callback in @@ -377,38 +364,25 @@ let slicing_selector (popup_factory:GMenu.menu GMenu.factory) (* as for 'statement' localizable. We currently ignore the term-lval *) *) - | Pretty_source.PStmt (kf,ki) -> - add_slice_menu None (some_kf_ki_lv kf ki None) - | Pretty_source.PVDecl (_,vi) -> - add_slice_menu (some_kf_from_vi vi) None + | Pretty_source.PStmt (kf, stmt) -> + add_slice_menu None (some_kf_ki_lv kf stmt None) + | Pretty_source.PVDecl (kfopt,ki,vi) -> begin + add_slice_menu (some_kf_from_vi vi) None; + match kfopt, ki with + | Some kf, Kstmt stmt -> + add_slice_menu None (some_kf_ki_lv kf stmt None) + | _ -> () + end | _ -> add_slice_menu None None end; - let projects = !Db.Slicing.Project.get_all() in ignore (slicing_factory#add_separator ()); - add_slicing_item "_Disable" - (Some ()) - ~callback:(fun () -> Enabled.set false); - add_slicing_item "_Clear" - (if slicing_project = None then None else Some ()) - ~callback:(fun () -> gui_set_project main_ui None) ; - List.iter - (fun proj -> - let add_highlight_menu sensitive = - add_slicing_item - ("Highlight " ^ (Pretty_utils.escape_underscores (!Db.Slicing.Project.get_name proj))) - sensitive - ~callback:(fun () -> gui_set_project main_ui (Some proj)) - in match slicing_project with - | Some project -> add_highlight_menu (if (proj == project) then None else Some ()) - | None -> add_highlight_menu (Some())) - projects; end let slicing_highlighter(buffer:Design.reactive_buffer) localizable ~start ~stop= if Enabled.get () then begin (* Definition for highlight 'Slicing' *) - let highlight project = + let highlight () = let buffer = buffer#buffer in let ki = Pretty_source.ki_of_localizable localizable in if Db.Value.is_accessible ki then @@ -426,35 +400,35 @@ let slicing_highlighter(buffer:Design.reactive_buffer) localizable ~start ~stop= let apply_mark mark = if SlicingParameters.debug_atleast 1 then SlicingParameters.debug "Got mark: %a" - !Db.Slicing.Mark.pretty mark; - if !Db.Slicing.Mark.is_bottom mark then + Api.Mark.pretty mark; + if Api.Mark.is_bottom mark then Gtk_helper.apply_tag buffer unused_code_area pb pe; - if !Db.Slicing.Mark.is_spare mark then + if Api.Mark.is_spare mark then Gtk_helper.apply_tag buffer spare_code_area pb pe; - if (!Db.Slicing.Mark.is_ctrl mark - || !Db.Slicing.Mark.is_data mark - || !Db.Slicing.Mark.is_addr mark) + if (Api.Mark.is_ctrl mark + || Api.Mark.is_data mark + || Api.Mark.is_addr mark) then Gtk_helper.apply_tag buffer necessary_code_area pb pe in - let slices = !Db.Slicing.Slice.get_all project kf in + let slices = Api.Slice.get_all kf in begin match slices with | [] -> (* No slice for this kf *) - if !Db.Slicing.Project.is_called project kf + if Api.Project.is_called kf then begin SlicingParameters.debug "Got source code@." ; - apply_mark (!Db.Slicing.Mark.get_from_src_func project kf) + apply_mark (Api.Mark.get_from_src_func kf) end else Gtk_helper.apply_tag buffer unused_code_area pb pe | slices -> - if !Db.Slicing.Project.is_called project kf + if Api.Project.is_called kf then begin assert (not (kf == fst (Globals.entry_point ()))) ; SlicingParameters.debug "Got source code" ; - apply_mark (!Db.Slicing.Mark.get_from_src_func project kf) + apply_mark (Api.Mark.get_from_src_func kf) end ; if SlicingParameters.debug_atleast 1 then begin let l = List.length slices in @@ -462,7 +436,7 @@ let slicing_highlighter(buffer:Design.reactive_buffer) localizable ~start ~stop= SlicingParameters.debug "Got %d slices" (List.length slices) end; let mark_slice slice = - let mark = mark_of_slice project slice in + let mark = mark_of_slice slice in apply_mark mark in List.iter mark_slice slices end @@ -473,7 +447,7 @@ let slicing_highlighter(buffer:Design.reactive_buffer) localizable ~start ~stop= kf pb pe - (fun _ slice -> !Db.Slicing.Slice.get_mark_from_stmt slice stmt) + (fun slice -> Api.Slice.get_mark_from_stmt slice stmt) in let tag_vdecl kf vi pb pe = if not vi.vglob then @@ -481,50 +455,24 @@ let slicing_highlighter(buffer:Design.reactive_buffer) localizable ~start ~stop= kf pb pe - (fun _ slice -> !Db.Slicing.Slice.get_mark_from_local_var slice vi) + (fun slice -> Api.Slice.get_mark_from_local_var slice vi) in match localizable with | Pretty_source.PStmt (kf,stmt) -> tag_stmt kf stmt start stop - | Pretty_source.PVDecl (Some kf,vi) -> tag_vdecl kf vi start stop - | Pretty_source.PVDecl (None,_) + | Pretty_source.PVDecl (Some kf,_,vi) -> tag_vdecl kf vi start stop + | Pretty_source.PVDecl (None,_,_) | Pretty_source.PLval _ | Pretty_source.PTermLval _ | Pretty_source.PGlobal _ | Pretty_source.PIP _ | Pretty_source.PExp _ -> () in - let slicing_project = !Db.Slicing.Project.get_project () in (* 2. Highlights the 'Slicing' *) - Extlib.may highlight slicing_project + SlicingState.may highlight end -let none_text = "<i>None</i>" - -let rebuild_model ((_, (model, _column)) as combo_box_text) = - model#clear (); - GEdit.text_combo_add combo_box_text none_text; - List.iter - (fun p -> GEdit.text_combo_add combo_box_text (!Db.Slicing.Project.get_name p)) - (List.rev (!Db.Slicing.Project.get_all())) - -let refresh_combo_box ((combo_box, (model, _column)) as combo_box_text) - slicing_project sensitive = - let nb_combo_elts = model#iter_n_children None in - let projects = List.rev (!Db.Slicing.Project.get_all()) in - if nb_combo_elts<>(1+(List.length projects)) - then rebuild_model combo_box_text; - (* Reset the active project as active in the combo box *) - let nth_proj = ref 0 in - let i = ref 1 in - List.iter (fun proj -> - Extlib.may (fun slicing_proj -> - if proj == slicing_proj then nth_proj := !i) - slicing_project; - incr i) - projects; - combo_box#set_active !nth_proj; - combo_box#misc#set_sensitive sensitive - +(* Not used *) +(* let none_text = "<i>None</i>" *) let pretty_setting_option fmt = Format.fprintf fmt "@[Setting option %s@ %s@ for the current project@]" @@ -554,29 +502,6 @@ let gui_set_slicing_undef_functions (main_ui:Design.main_window_extension_points let slicing_panel (main_ui:Design.main_window_extension_points) = let w = GPack.vbox () in - let hbox1 = GPack.hbox ~packing:w#pack () in - let combo_box_text = - let ((combo_box, (_model, column)) as combo_box_text) = - GEdit.combo_box_text ~strings:[ none_text ] ~wrap_width:3 ~use_markup:true - ~packing:(hbox1#pack ~expand:true ~fill:true) () in - combo_box#set_active 0 ; - ignore (combo_box#connect#changed - (fun () -> - match combo_box#active_iter with - | None -> () - | Some row -> - let slicing_project_name = - (* get the text entry related to the current slicing project *) - Extlib.may_map !Db.Slicing.Project.get_name ~dft:none_text (!Db.Slicing.Project.get_project ()) - and selected_name = combo_box#model#get ~row ~column in - if (selected_name != slicing_project_name) then - let proj_opt = - try Some (List.find (fun proj -> selected_name = !Db.Slicing.Project.get_name proj) (!Db.Slicing.Project.get_all ())) - with Not_found -> None - in - gui_set_project main_ui proj_opt)); - combo_box_text - in let table = GPack.table ~columns:2 ~rows:2 ~homogeneous:true ~packing:w#pack () in let hbox2 = GPack.hbox ~packing:(table#attach ~left:1 ~top:0) () in @@ -626,13 +551,8 @@ let slicing_panel (main_ui:Design.main_window_extension_points) = SlicingParameters.Mode.Calls.get (gui_set_slicing_level main_ui) in - Project.register_after_set_current_hook - ~user_only:true - (fun _ -> rebuild_model combo_box_text); - let refresh () = let value_is_computed = Db.Value.is_computed () in - let slicing_project = !Db.Slicing.Project.get_project () in let enabled = Enabled.get () in enabled_button#misc#set_sensitive value_is_computed ; slice_undef_button#misc#set_sensitive enabled ; @@ -643,8 +563,6 @@ let slicing_panel (main_ui:Design.main_window_extension_points) = !update_column `Contents; ); slice_undef_button#set_active (SlicingParameters.Mode.SliceUndef.get()); - refresh_combo_box combo_box_text slicing_project - (enabled && value_is_computed) in refresh () ; "Slicing",w#coerce,Some refresh @@ -654,25 +572,23 @@ let file_tree_decorate (file_tree:Filetree.t) = file_tree#append_pixbuf_column ~title:"Slicing" (fun globs -> - Extlib.may_map - (fun project -> - if (List.exists - (fun glob -> match glob with - | GFun ({svar = vi},_ ) -> - begin - try - let kf = Globals.Functions.get vi - in (!Db.Slicing.Project.is_called project kf) - || ( [] != (!Db.Slicing.Slice.get_all project kf)) - with Not_found -> false - end - | _ -> false) - globs) then - [`STOCK_ID "gtk-apply"] - else - [`STOCK_ID ""]) + SlicingState.may_map ~dft:[`STOCK_ID ""] - (!Db.Slicing.Project.get_project ())) + (fun () -> + if List.exists + (fun glob -> match glob with + | GFun ({svar = vi},_ ) -> + begin + try + let kf = Globals.Functions.get vi + in (Api.Project.is_called kf) + || ( [] != (Api.Slice.get_all kf)) + with Not_found -> false + end + | _ -> false) + globs + then [`STOCK_ID "gtk-apply"] + else [`STOCK_ID ""])) (fun () -> Enabled.get ()); !update_column `Visibility diff --git a/src/plugins/slicing/register_gui.mli b/src/plugins/slicing/register_gui.mli index a3c7dca3d9c439ff059915d751c404c4901c3bc2..89e10d9e3176c724e8d46cb75c1852c3d4373c0e 100644 --- a/src/plugins/slicing/register_gui.mli +++ b/src/plugins/slicing/register_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/slicing/slicingActions.ml b/src/plugins/slicing/slicingActions.ml index 70590fb5fd0f8ca0f0b7ac947a65e40ab8a96f20..eadf1f03c9a85af0ecd7912d22803d8c38f12ff5 100644 --- a/src/plugins/slicing/slicingActions.ml +++ b/src/plugins/slicing/slicingActions.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/slicing/slicingActions.mli b/src/plugins/slicing/slicingActions.mli index c246dbcda30210f3b03f9a20232b3cf0028fb49c..b54253cade2959bec2332da04a404a4736ee1a56 100644 --- a/src/plugins/slicing/slicingActions.mli +++ b/src/plugins/slicing/slicingActions.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/slicing/slicingCmds.ml b/src/plugins/slicing/slicingCmds.ml index 529f0446efa26fa84cd169475ccbd5b1ba4023f8..037e827d6ec847d9bc6c00089384bf4a6ade4899 100644 --- a/src/plugins/slicing/slicingCmds.ml +++ b/src/plugins/slicing/slicingCmds.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,9 +25,36 @@ * Db.Slicing only. There are mainly high level functions which make easier * to achieve simple tasks. *) -open Cil open Cil_types +type set = SlicingTypes.Fct_user_crit.t Cil_datatype.Varinfo.Map.t + +let apply_all_actions () = + SlicingParameters.debug ~level:1 "[Api.apply_all_internal]"; + SlicingParameters.feedback ~level:1 "applying all slicing requests..."; + SlicingParameters.debug ~level:2 "pending requests:@\n %t@\n" + SlicingProject.print_proj_worklist; + let r = SlicingProject.apply_all_actions () in + SlicingParameters.feedback ~level:2 "done (applying all slicing requests)."; + r + +let apply_next_action () = + SlicingParameters.debug ~level:1 "[Api.apply_next_internal]"; + SlicingProject.apply_next_action () + +let apply_all ~propagate_to_callers = + SlicingParameters.debug ~level:1 "[Api.apply_all]"; + assert (not propagate_to_callers) ; + try + while (true) + do + (* Format.printf "@\napply_next_internal@."; *) + apply_next_action () + done + with Not_found -> () + +let get_select_kf (fvar, _select) = Globals.Functions.get fvar + (** Utilities for [kinstr]. *) module Kinstr: sig val iter_from_func : (stmt -> unit) -> kernel_function -> unit @@ -37,42 +64,8 @@ module Kinstr: sig struct (** Iter on statements of a kernel function *) let iter_from_func f kf = - let definition = Kernel_function.get_definition kf - and visitor = object - inherit nopCilVisitor as super - method! vstmt stmt = f stmt; super#vstmt stmt - (* speed up *) - method! vvdec _ = SkipChildren (* via visitCilFunction *) - method! vspec _ = SkipChildren (* via visitCilFunction *) - method! vcode_annot _ = SkipChildren (* via Code_annot stmt *) - method! vexpr _ = SkipChildren (* via stmt such as Return, IF, ... *) - method! vlval _ = SkipChildren (* via stmt such as Set, Call, Asm, ... *) - method! vattr _ = SkipChildren (* via Asm stmt *) - method! vvrbl _ = assert false - method! voffs _ = assert false - method! vinitoffs _ = assert false - method! vglob _ = assert false - method! vinit _ = assert false - method! vtype _ = assert false - method! vattrparam _ = assert false - method! vlogic_type _ = assert false - method! vterm _ = assert false - method! vterm_node _ = assert false - method! vterm_lval _ = assert false - method! vterm_lhost _ = assert false - method! vterm_offset _ = assert false - method! vlogic_info_decl _ = assert false - method! vlogic_info_use _ = assert false - method! vlogic_var_use _ = assert false - method! vlogic_var_decl _ = assert false - method! vquantifiers _ = assert false - method! vpredicate _ = assert false - method! vpredicate_node _ = assert false - method! vbehavior _ = assert false - method! vannotation _ = assert false - end - in - ignore (visitCilFunction (visitor:>cilVisitor) definition) + let definition = Kernel_function.get_definition kf in + List.iter f definition.sallstmts (** Get directly read/written [Zone.t] by the statement. * i.e. directly means when [ki] is a call, @@ -89,7 +82,21 @@ struct state ~deps:(Some read_zone) ~for_writing:true lv in deps, zloc - in match stmt.skind with + in + let call_process lv f args _loc = + (* returns [Zone.t read] by [lv, f, args], [Zone.t written] by [lv] *) + let read_zone = !Db.From.find_deps_no_transitivity stmt f in + let add_args arg inputs = + Locations.Zone.join inputs + (!Db.From.find_deps_no_transitivity stmt arg) in + let read_zone = List.fold_right add_args args read_zone in + let read_zone,write_zone = + match lv with + | None -> read_zone , Locations.Zone.bottom + | Some lv -> lval_process read_zone stmt lv + in read_zone,write_zone + in + match stmt.skind with | Switch (exp,_,_,_) | If (exp,_,_,_) -> (* returns [Zone.t read] by condition [exp], [Zone.bottom] *) @@ -98,17 +105,21 @@ struct (* returns [Zone.t read] by [exp, lv], [Zone.t written] by [lv] *) let read_zone = !Db.From.find_deps_no_transitivity stmt exp in lval_process read_zone stmt lv - | Instr (Call (lvaloption,funcexp,argl,_)) -> - (* returns [Zone.t read] by [lvaloption, funcexp, argl], [Zone.t written] by [lvaloption] *) - let read_zone = !Db.From.find_deps_no_transitivity stmt funcexp in - let add_args arg inputs = - Locations.Zone.join inputs (!Db.From.find_deps_no_transitivity stmt arg) in - let read_zone = List.fold_right add_args argl read_zone in - let read_zone,write_zone = - match lvaloption with - | None ->read_zone , Locations.Zone.bottom - | Some lv -> lval_process read_zone stmt lv - in read_zone,write_zone + | Instr (Local_init (v, AssignInit i, _)) -> + let rec collect zone i = + match i with + | SingleInit e -> + Locations.Zone.join zone (!Db.From.find_deps_no_transitivity stmt e) + | CompoundInit (_,l) -> + List.fold_left + (fun acc (_,i) -> collect acc i) zone l + in + let read_zone = collect Locations.Zone.bottom i in + lval_process read_zone stmt (Cil.var v) + | Instr (Call (lvaloption,funcexp,argl,l)) -> + call_process lvaloption funcexp argl l + | Instr (Local_init(v, ConsInit(f, args, k),l)) -> + Cil.treat_constructor_as_func call_process v f args k l | _ -> Locations.Zone.bottom, Locations.Zone.bottom (** Look at intersection of [rd_zone_opt]/[wr_zone_opt] with the @@ -130,29 +141,29 @@ end (** Topologically propagate user marks to callers in whole project *) let topologic_propagation project = - !Db.Slicing.Request.apply_all_internal project; + apply_all_actions project; Callgraph.Uses.iter_in_rev_order (fun kf -> SlicingParameters.debug ~level:3 "doing topologic propagation for function: %a" Kernel_function.pretty kf; - !Db.Slicing.Request.apply_all_internal project) + apply_all_actions project) let add_to_selection set selection = - !Db.Slicing.Select.add_to_selects_internal selection set + SlicingSelect.Selections.add_to_selects selection set (** Registered as a slicing selection function: Add a selection of the pdg nodes. *) let select_pdg_nodes set mark nodes kf = - let selection = !Db.Slicing.Select.select_pdg_nodes_internal kf nodes mark + let selection = SlicingSelect.select_pdg_nodes kf nodes mark in add_to_selection set selection (** Registered as a slicing selection function: Add a selection of the statement. *) let select_stmt set ~spare stmt kf = - let stmt_mark = !Db.Slicing.Mark.make + let stmt_mark = SlicingMarks.mk_user_mark ~data:(not spare) ~addr:(not spare) ~ctrl:(not spare) in - let selection = !Db.Slicing.Select.select_stmt_internal kf stmt stmt_mark + let selection = SlicingSelect.select_stmt_computation kf stmt stmt_mark in add_to_selection set selection (** Add a selection to the entrance of the function [kf] @@ -163,13 +174,13 @@ let select_entry_point_and_some_inputs_outputs set ~mark kf ~return ~outputs ~in SlicingParameters.debug ~level:3 "select_entry_point_and_some_inputs_outputs %a" Kernel_function.pretty kf ; - let set = let selection = !Db.Slicing.Select.select_entry_point_internal kf mark in + let set = let selection = SlicingSelect.select_entry_point kf mark in add_to_selection set selection in let set = if (Locations.Zone.equal Locations.Zone.bottom inputs) then set - else let selection = !Db.Slicing.Select.select_zone_at_entry_point_internal kf inputs mark in + else let selection = SlicingSelect.select_zone_at_entry kf inputs mark in add_to_selection set selection in if ((Locations.Zone.equal Locations.Zone.bottom outputs) && not return) || (try @@ -189,10 +200,10 @@ let select_entry_point_and_some_inputs_outputs set ~mark kf ~return ~outputs ~in let set = if (Locations.Zone.equal Locations.Zone.bottom outputs) then set - else let selection = !Db.Slicing.Select.select_modified_output_zone_internal kf outputs mark in + else let selection = SlicingSelect.select_modified_output_zone kf outputs mark in add_to_selection set selection in if return - then let selection = !Db.Slicing.Select.select_return_internal kf mark in + then let selection = SlicingSelect.select_return kf mark in add_to_selection set selection else set @@ -203,24 +214,24 @@ let generic_select_func_calls select_stmt set ~spare kf = let callers = !Db.Value.callers kf in let select_calls acc (caller, stmts) = List.fold_left (fun acc s -> select_stmt acc ~spare s caller) acc stmts - in + in List.fold_left select_calls set callers - + (** Registered as a slicing selection function: Add a selection of calls to a [kf]. *) let select_func_calls_into set ~spare kf = let add_to_select set ~spare select = let mark = let nspare = not spare in - !Db.Slicing.Mark.make ~data:nspare ~addr:nspare ~ctrl:nspare + SlicingMarks.mk_user_mark ~data:nspare ~addr:nspare ~ctrl:nspare in add_to_selection set (select mark) in let kf_entry, _library = Globals.entry_point () in if Kernel_function.equal kf_entry kf then - add_to_select set ~spare (!Db.Slicing.Select.select_entry_point_internal kf) + add_to_select set ~spare (SlicingSelect.select_entry_point kf) else let select_min_call set ~spare ki kf = - add_to_select set ~spare (!Db.Slicing.Select.select_min_call_internal kf ki) + add_to_select set ~spare (SlicingSelect.select_minimal_call kf ki) in generic_select_func_calls select_min_call set ~spare kf @@ -232,7 +243,7 @@ let select_func_calls_to set ~spare kf = begin let mark = let nspare = not spare in - !Db.Slicing.Mark.make ~data:nspare ~addr:nspare ~ctrl:nspare + SlicingMarks.mk_user_mark ~data:nspare ~addr:nspare ~ctrl:nspare in assert (Db.Value.is_computed ()); let outputs = !Db.Outputs.get_external kf in @@ -247,7 +258,7 @@ let select_func_calls_to set ~spare kf = (** Registered as a slicing selection function: Add selection of function outputs. *) let select_func_zone set mark zone kf = - let selection = !Db.Slicing.Select.select_zone_at_end_internal kf zone mark + let selection = SlicingSelect.select_zone_at_end kf zone mark in add_to_selection set selection (** Registered as a slicing selection function: @@ -258,7 +269,7 @@ let select_func_return set ~spare kf = in select_stmt set ~spare ki kf with Kernel_function.No_Statement -> let mark = - !Db.Slicing.Mark.make + SlicingMarks.mk_user_mark ~data:(not spare) ~addr:(not spare) ~ctrl:(not spare) in select_entry_point_and_some_inputs_outputs @@ -274,8 +285,8 @@ let select_func_return set ~spare kf = Note: add also a transparent selection on the whole statement. *) let select_stmt_ctrl set ~spare ki kf = let ctrl_mark = - !Db.Slicing.Mark.make ~data:false ~addr:false ~ctrl:(not spare) in - let selection = !Db.Slicing.Select.select_stmt_internal kf ki ctrl_mark + SlicingMarks.mk_user_mark ~data:false ~addr:false ~ctrl:(not spare) in + let selection = SlicingSelect.select_stmt_computation kf ki ctrl_mark in add_to_selection set selection (** Registered as a slicing selection function: @@ -283,7 +294,7 @@ let select_stmt_ctrl set ~spare ki kf = Note: add also a transparent selection on the whole statement. *) let select_stmt_zone set mark zone ~before ki kf = let selection = - !Db.Slicing.Select.select_stmt_zone_internal kf ki ~before zone mark + SlicingSelect.select_stmt_zone kf ki ~before zone mark in let set = add_to_selection set selection in select_stmt_ctrl set ~spare:true ki kf @@ -425,7 +436,7 @@ let select_stmt_lval_rw set mark ~rd ~wr ki ~eval kf = (** Add a selection of the declaration of [vi]. *) let select_decl_var set mark vi kf = - let selection = !Db.Slicing.Select.select_decl_var_internal kf vi mark in + let selection = SlicingSelect.select_decl_var kf vi mark in add_to_selection set selection let select_ZoneAnnot_pragmas set ~spare pragmas kf = @@ -451,7 +462,7 @@ let select_ZoneAnnot_zones_decl_vars set mark (zones,decl_vars) kf = let set = Cil_datatype.Logic_label.Set.fold (fun l acc -> - let selection = !Db.Slicing.Select.select_label_internal kf l mark + let selection = SlicingSelect.select_label kf l mark in add_to_selection acc selection) decl_vars.Db.Properties.Interp.To_zone.lbl set @@ -568,20 +579,20 @@ let select_func_lval_rw set mark ~rd ~wr ~eval kf = Note: - the function begins by applying the remaining internal requests. - the requests added for the last kernel function are not applied. *) -let add_selection project set = +let add_selection set = let add_selection prev selection = - let kf = !Db.Slicing.Select.get_function selection in + let kf = get_select_kf selection in let r = match prev with - None -> !Db.Slicing.Request.apply_all_internal project ; Some (kf) + None -> apply_all_actions () ; Some (kf) | Some prev_kf -> if prev_kf == kf then prev else None and make_request slice = - !Db.Slicing.Request.add_slice_selection_internal project slice selection + SlicingSelect.add_ff_selection slice selection and slices = - let slices = !Db.Slicing.Slice.get_all project kf - in if slices = [] then [!Db.Slicing.Slice.create project kf] else slices + let slices = SlicingProject.get_slices kf + in if slices = [] then [SlicingProject.create_slice kf] else slices in List.iter make_request slices ; r - in ignore (Db.Slicing.Select.fold_selects_internal add_selection None set) + in ignore (SlicingSelect.Selections.fold_selects_internal add_selection None set) (** Registered as a slicing request function: Add selections that will be applied to all the slices of the function @@ -589,15 +600,15 @@ let add_selection project set = Note: - the function begins by applying the remaining internal requests. - the requests added for the last kernel function are not applied. *) -let add_persistent_selection project set = +let add_persistent_selection set = (* Format.printf "@\nadd_persistent_selection@."; *) let add_selection prev selection = - let kf = !Db.Slicing.Select.get_function selection in + let kf = get_select_kf selection in let r = match prev with - None -> !Db.Slicing.Request.apply_all_internal project ; Some (kf) + None -> apply_all_actions () ; Some (kf) | Some prev_kf -> if prev_kf == kf then prev else None - in !Db.Slicing.Request.add_selection_internal project selection; r - in ignore (Db.Slicing.Select.fold_selects_internal add_selection None set) + in SlicingSelect.add_fi_selection selection; r + in ignore (SlicingSelect.Selections.fold_selects_internal add_selection None set) (** Registered as a slicing request function: Add selections that will be applied to all the slices of the function @@ -605,12 +616,12 @@ let add_persistent_selection project set = Note: - the function begins by applying the remaining internal requests. - the requests added for the last kernel function are not applied. *) -let add_persistent_cmdline project = +let add_persistent_cmdline () = SlicingParameters.feedback ~level:1 "interpreting slicing requests from the command line..."; begin try - let selection = ref Db.Slicing.Select.empty_selects in - let top_mark = !Db.Slicing.Mark.make ~addr:true ~ctrl:true ~data:true in + let selection = ref Cil_datatype.Varinfo.Map.empty in + let top_mark = SlicingMarks.mk_user_mark ~addr:true ~ctrl:true ~data:true in Globals.Functions.iter (fun kf -> let add_selection opt select = @@ -619,33 +630,33 @@ let add_persistent_cmdline project = in add_selection SlicingParameters.Select.Return.get - !Db.Slicing.Select.select_func_return; + select_func_return; add_selection SlicingParameters.Select.Calls.get - !Db.Slicing.Select.select_func_calls_to; + select_func_calls_to; add_selection SlicingParameters.Select.Pragma.get - (fun s -> !Db.Slicing.Select.select_func_annots s top_mark + (fun s -> select_func_annots s top_mark ~threat:false ~user_assert:false ~slicing_pragma:true ~loop_inv:false ~loop_var:false); add_selection SlicingParameters.Select.Threat.get - (fun s -> !Db.Slicing.Select.select_func_annots s top_mark + (fun s -> select_func_annots s top_mark ~threat:true ~user_assert:false ~slicing_pragma:false ~loop_inv:false ~loop_var:false); add_selection SlicingParameters.Select.Assert.get - (fun s -> !Db.Slicing.Select.select_func_annots s top_mark + (fun s -> select_func_annots s top_mark ~threat:false ~user_assert:true ~slicing_pragma:false ~loop_inv:false ~loop_var:false); add_selection SlicingParameters.Select.LoopInv.get - (fun s -> !Db.Slicing.Select.select_func_annots s top_mark + (fun s -> select_func_annots s top_mark ~threat:false ~user_assert:false ~slicing_pragma:false ~loop_inv:true ~loop_var:false); add_selection SlicingParameters.Select.LoopVar.get - (fun s -> !Db.Slicing.Select.select_func_annots s top_mark + (fun s -> select_func_annots s top_mark ~threat:false ~user_assert:false ~slicing_pragma:false ~loop_inv:false ~loop_var:true); ); @@ -662,9 +673,9 @@ let add_persistent_cmdline project = lval_str Db.pretty_name kf; *) let kf = fst (Globals.entry_point ()) in let ki_scope_eval = Kernel_function.find_first_stmt kf in - selection := !Db.Slicing.Select.select_func_lval !selection top_mark + selection := select_func_lval !selection top_mark (SlicingParameters.Select.Value.get ()) kf; - selection := !Db.Slicing.Select.select_func_lval_rw !selection top_mark + selection := select_func_lval_rw !selection top_mark ~rd:(SlicingParameters.Select.RdAccess.get ()) ~wr:(SlicingParameters.Select.WrAccess.get ()) ~eval:ki_scope_eval kf ; @@ -672,23 +683,13 @@ let add_persistent_cmdline project = SlicingParameters.Select.RdAccess.clear () ; SlicingParameters.Select.WrAccess.clear () ; end; - !Db.Slicing.Request.add_persistent_selection project !selection; + add_persistent_selection !selection; with Logic_interp.Error(_loc,msg) -> SlicingParameters.error "%s. Slicing requests from the command line are ignored." msg end; SlicingParameters.feedback ~level:2 "done (interpreting slicing requests from the command line)." -let apply_all project ~propagate_to_callers = - assert (not propagate_to_callers) ; - try - while (true) - do - (* Format.printf "@\napply_next_internal@."; *) - !Db.Slicing.Request.apply_next_internal project - done - with Not_found -> () - (* Local Variables: compile-command: "make -C ../../.." diff --git a/src/plugins/slicing/slicingCmds.mli b/src/plugins/slicing/slicingCmds.mli index caad16489df73c198c6bce7f3bf59590c2d39ea0..6a964edc3ed1e4857740a1add33fbc2b893fc04d 100644 --- a/src/plugins/slicing/slicingCmds.mli +++ b/src/plugins/slicing/slicingCmds.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,111 +29,115 @@ open Cil_types are slightly modified in Register, then registered in Db. This module and Register should be fused. *) -val topologic_propagation : Db.Slicing.Project.t -> unit +type set = SlicingTypes.Fct_user_crit.t Cil_datatype.Varinfo.Map.t + +val get_select_kf : SlicingTypes.sl_select -> kernel_function + +val topologic_propagation : unit -> unit val select_pdg_nodes : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> PdgTypes.Node.t list -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt : - Db.Slicing.Select.set -> + set -> spare:bool -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_func_calls_to : - Db.Slicing.Select.set -> + set -> spare:bool -> Kernel_function.t -> - Db.Slicing.Select.set + set val select_func_calls_into : - Db.Slicing.Select.set -> + set -> spare:bool -> Kernel_function.t -> - Db.Slicing.Select.set + set val select_func_zone : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> Locations.Zone.t -> kernel_function -> - Db.Slicing.Select.set + set val select_func_return : - Db.Slicing.Select.set -> + set -> spare:bool -> Kernel_function.t -> - Db.Slicing.Select.set + set val select_stmt_ctrl : - Db.Slicing.Select.set -> + set -> spare:bool -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt_zone : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> Locations.Zone.t -> before:bool -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt_lval : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> Datatype.String.Set.t -> before:bool -> stmt -> eval:stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt_lval_rw : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> rd:Datatype.String.Set.t -> wr:Datatype.String.Set.t -> stmt -> eval:stmt -> Kernel_function.t -> - Db.Slicing.Select.set + set val select_stmt_pred : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> predicate -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt_term : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> term -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt_annot : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> spare:bool -> code_annotation -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_stmt_annots : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> spare:bool -> threat:bool -> user_assert:bool -> @@ -142,11 +146,11 @@ val select_stmt_annots : loop_var:bool -> stmt -> kernel_function -> - Db.Slicing.Select.set + set val select_func_annots : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> spare:bool -> threat:bool -> user_assert:bool -> @@ -154,25 +158,27 @@ val select_func_annots : loop_inv:bool -> loop_var:bool -> kernel_function -> - Db.Slicing.Select.set + set val select_func_lval : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> Datatype.String.Set.t -> Kernel_function.t -> - Db.Slicing.Select.set + set val select_func_lval_rw : - Db.Slicing.Select.set -> - Db.Slicing.Mark.t -> + set -> + SlicingTypes.sl_mark -> rd:Datatype.String.Set.t -> wr:Datatype.String.Set.t -> - eval:stmt -> Kernel_function.t -> Db.Slicing.Select.set + eval:stmt -> Kernel_function.t -> set -val add_selection : Db.Slicing.Project.t -> Db.Slicing.Select.set -> unit +val add_selection : set -> unit val add_persistent_selection : - Db.Slicing.Project.t -> Db.Slicing.Select.set -> unit -val add_persistent_cmdline : Db.Slicing.Project.t -> unit + set -> unit +val add_persistent_cmdline : unit -> unit -val apply_all : Db.Slicing.Project.t -> propagate_to_callers:bool -> unit +val apply_all : propagate_to_callers:bool -> unit +val apply_all_actions : unit -> unit +val apply_next_action : unit -> unit diff --git a/src/plugins/slicing/slicingMacros.ml b/src/plugins/slicing/slicingMacros.ml index 5f365e7658026354a17f79e938db9e337bf3c312..a25d9bc4d09cc1ed77549f9b41360ad373ffdde9 100644 --- a/src/plugins/slicing/slicingMacros.ml +++ b/src/plugins/slicing/slicingMacros.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -63,8 +63,9 @@ let ff_svar ff = fi_svar (ff.SlicingInternals.ff_fct) (** {4 getting [fct_info]} *) (** Get the fct_info if it exists or build a new fct_info. *) -let get_kf_fi proj kf = +let get_kf_fi kf = let fct_var = Kernel_function.get_vi kf in + let proj = SlicingState.get () in try Cil_datatype.Varinfo.Hashtbl.find proj.SlicingInternals.functions fct_var with Not_found -> let fi_def, is_def = @@ -77,7 +78,6 @@ let get_kf_fi proj kf = let new_fi = { SlicingInternals.fi_kf = kf; SlicingInternals.fi_def = fi_def; - SlicingInternals.fi_project = proj; SlicingInternals.fi_top = None; SlicingInternals.fi_level_option = get_default_level_option is_def; SlicingInternals.fi_init_marks = None ; @@ -88,7 +88,8 @@ let get_kf_fi proj kf = Cil_datatype.Varinfo.Hashtbl.add proj.SlicingInternals.functions fct_var new_fi; new_fi -let fold_fi f acc proj = +let fold_fi f acc = + let proj = SlicingState.get () in Cil_datatype.Varinfo.Hashtbl.fold (fun _v fi acc -> f acc fi) proj.SlicingInternals.functions @@ -140,9 +141,9 @@ let change_fi_slicing_level fi slicing_level = (** @raise SlicingTypes.WrongSlicingLevel if [n] is not valid. * *) -let change_slicing_level proj kf n = +let change_slicing_level kf n = let slicing_level = translate_num_to_slicing_level n in - let fi = get_kf_fi proj kf in (* build if if it doesn't exist *) + let fi = get_kf_fi kf in (* build if if it doesn't exist *) change_fi_slicing_level fi slicing_level (** {2 functions and slices} *) @@ -168,20 +169,18 @@ let same_ff_call (f1,c1) (f2,c2) = equal_ff f1 f2 && same_call c1 c2 let is_call_stmt stmt = - match stmt.skind with Instr (Call _) -> true | _ -> false + match stmt.skind with + | Instr (Call _ | Local_init(_, ConsInit _,_)) -> true | _ -> false let get_called_kf call_stmt = match call_stmt.skind with | Instr (Call (_, funcexp,_,_)) -> let _funcexp_dpds, called_functions = - !Db.Value.expr_to_kernel_function - ~with_alarms:CilE.warn_none_mode - ~deps:(Some Locations.Zone.bottom) - (Kstmt call_stmt) - funcexp + !Db.Value.expr_to_kernel_function ~deps:None (Kstmt call_stmt) funcexp in (match Kernel_function.Hptset.contains_single_elt called_functions with | Some kf -> kf | _ -> raise SlicingTypes.PtrCallExpr) + | Instr (Local_init(_, ConsInit (f, _, _), _)) -> Globals.Functions.get f | _ -> invalid_arg "Not a call statement !" let is_variadic kf = @@ -191,28 +190,28 @@ let is_variadic kf = | _ -> assert false (** get the [fct_info] of the called function, if we know it *) -let get_fi_call proj call = +let get_fi_call call = try let kf = get_called_kf call in if is_variadic kf then None else - let fct_info = get_kf_fi proj kf in + let fct_info = get_kf_fi kf in Some fct_info with SlicingTypes.PtrCallExpr -> None -let is_src_fun_called proj kf = - let fi = get_kf_fi proj kf in +let is_src_fun_called kf = + let fi = get_kf_fi kf in match fi.SlicingInternals.f_called_by with [] -> false | _ -> true -let is_src_fun_visible proj kf = +let is_src_fun_visible kf = let is_fi_top fi = match fi.SlicingInternals.fi_top with None -> false | Some _ -> true - in is_src_fun_called proj kf || is_fi_top (get_kf_fi proj kf) + in is_src_fun_called kf || is_fi_top (get_kf_fi kf) let fi_has_persistent_selection fi = (match fi.SlicingInternals.fi_init_marks with None -> false | _ -> true) -let has_persistent_selection proj kf = - let fi = get_kf_fi proj kf in +let has_persistent_selection kf = + let fi = get_kf_fi kf in fi_has_persistent_selection fi diff --git a/src/plugins/slicing/slicingMacros.mli b/src/plugins/slicing/slicingMacros.mli index 0f889014f3dcff3c339d0a91a297424834d67611..46356d2277676d2b57fe8302af123198ef2453aa 100644 --- a/src/plugins/slicing/slicingMacros.mli +++ b/src/plugins/slicing/slicingMacros.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,8 +30,8 @@ val str_level_option : level_option -> string val get_default_level_option : bool -> level_option val fi_svar : fct_info -> Cil_types.varinfo val ff_svar : fct_slice -> Cil_types.varinfo -val get_kf_fi : project -> Kernel_function.t -> fct_info -val fold_fi : ('a -> fct_info -> 'a) -> 'a -> project -> 'a +val get_kf_fi : Kernel_function.t -> fct_info +val fold_fi : ('a -> fct_info -> 'a) -> 'a -> 'a val get_ff_id : fct_slice -> int val fi_name : fct_info -> string val ff_name : fct_slice -> string @@ -44,15 +44,15 @@ val get_fi_pdg : fct_info -> Db.Pdg.t val get_ff_pdg : fct_slice -> Db.Pdg.t val ff_slicing_level : fct_slice -> level_option val change_fi_slicing_level : fct_info -> level_option -> unit -val change_slicing_level : project -> Kernel_function.t -> int -> unit +val change_slicing_level : Kernel_function.t -> int -> unit val fi_slices : fct_info -> fct_slice list val equal_fi : fct_info -> fct_info -> bool val equal_ff : fct_slice -> fct_slice -> bool val same_ff_call : fct_slice * Cil_types.stmt -> fct_slice * Cil_types.stmt -> bool val is_call_stmt : Cil_types.stmt -> bool -val get_fi_call : project -> Cil_types.stmt -> fct_info option -val is_src_fun_called : project -> Kernel_function.t -> bool -val is_src_fun_visible : project -> Kernel_function.t -> bool +val get_fi_call : Cil_types.stmt -> fct_info option +val is_src_fun_called : Kernel_function.t -> bool +val is_src_fun_visible : Kernel_function.t -> bool val fi_has_persistent_selection : fct_info -> bool -val has_persistent_selection : project -> Kernel_function.t -> bool +val has_persistent_selection : Kernel_function.t -> bool diff --git a/src/plugins/slicing/slicingMarks.ml b/src/plugins/slicing/slicingMarks.ml index ad00843722dd49bd4efeb3adcba6303ec8d6d69d..8d986b03a5ef9ed53591a255f96de133485203f7 100644 --- a/src/plugins/slicing/slicingMarks.ml +++ b/src/plugins/slicing/slicingMarks.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/slicing/slicingMarks.mli b/src/plugins/slicing/slicingMarks.mli index 97f736839b5c18aec27eab8817a24ca35de907d0..931a39a6fb3feeecac77bab0f05e7626ff32110f 100644 --- a/src/plugins/slicing/slicingMarks.mli +++ b/src/plugins/slicing/slicingMarks.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/slicing/slicingParameters.ml b/src/plugins/slicing/slicingParameters.ml index b5383d324af55ff4be19853b3e6ad9e1edb17028..f488f56d26c20174084d9fe2de1075164c773156 100644 --- a/src/plugins/slicing/slicingParameters.ml +++ b/src/plugins/slicing/slicingParameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -195,21 +195,6 @@ the name of the exported project (defaults to \" export\")" let default = " export" end) -module Print = struct - let new_command = "<normal slicing command> -then-on 'Slicing export' -print" - include False(struct - let option_name = "-slice-print" - let help = "deprecated. Use instead " ^ new_command - end) - (* Just a small hack to inform the end-user that he is using a deprecated - option without changing the old behavior (incompatible with -ocode for - instance). *) - let get () = - let b = get () in - if b then deprecated "-slice-print" ~now:new_command (fun () -> ()) (); - b -end - module Force = True(struct let option_name = "-slice-force" @@ -241,8 +226,7 @@ let () = Mode.Callers.self; Mode.Calls.self; Mode.SliceUndef.self; - Mode.KeepAnnotations.self; - Print.self ] + Mode.KeepAnnotations.self ] let is_on () = (Force.get () || OptionModified.get ()) diff --git a/src/plugins/slicing/slicingParameters.mli b/src/plugins/slicing/slicingParameters.mli index 76825322cb39e114063d0b7bfaf9cc676ec1fc02..b0bd508c880638f41f619c5383be651ffa0a5c8b 100644 --- a/src/plugins/slicing/slicingParameters.mli +++ b/src/plugins/slicing/slicingParameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -51,8 +51,6 @@ module ProjectName: Parameter_sig.String (** @since Carbon-20110201 *) module ExportedProjectPostfix: Parameter_sig.String -module Print: Parameter_sig.Bool - val is_on: unit -> bool val set_off: unit -> unit val clear: unit -> unit diff --git a/src/plugins/slicing/slicingProject.ml b/src/plugins/slicing/slicingProject.ml index 39ff546ca446f1f30b8ebc94e01a30598ade4244..be6e2063ad8a55cc4b902ae4b5b77e9f7bfcb468 100644 --- a/src/plugins/slicing/slicingProject.ml +++ b/src/plugins/slicing/slicingProject.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,79 +29,66 @@ module M = SlicingMacros (**/**) -(*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) -(** {2 Building project } *) - -(** API function : see {!val: Db.Slicing.Project.mk_project}. *) -let mk_project name = - SlicingParameters.feedback ~level:1 "making slicing project '%s'..." name; - let r = { T.name = name ; - T.application = Project.current () ; - T.functions = Cil_datatype.Varinfo.Hashtbl.create 17; - T.actions = []; - } in - SlicingParameters.feedback ~level:2 "done (making slicing project '%s')." name; - r - -let get_name proj = proj.T.name (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (** {2 Managing the slices} *) -let add_proj_actions proj actions = proj.T.actions <- actions @ proj.T.actions +let add_proj_actions actions = + let proj = SlicingState.get () in + proj.T.actions <- actions @ proj.T.actions (** Add a new slice for the function. It can be the case that it create actions * if the function has some persistent selection, that make function calls to * choose. * @raise SlicingTypes.NoPdg when the function has no PDG. * *) -let create_slice proj kf = - let ff, actions = Fct_slice.make_new_ff (M.get_kf_fi proj kf) true in - add_proj_actions proj actions; ff +let create_slice kf = + let ff, actions = Fct_slice.make_new_ff (M.get_kf_fi kf) true in + add_proj_actions actions; ff (** Delete [ff_to_remove] if it is not called. * @raise T.CantRemoveCalledFf if it is. *) -let remove_ff proj ff_to_remove = +let remove_ff ff_to_remove = let rec remove ff_list ff_num = match ff_list with | [] -> raise Not_found | ff :: tail -> - if ff.T.ff_id = ff_num then (Fct_slice.clear_ff proj ff; tail) + if ff.T.ff_id = ff_num then (Fct_slice.clear_ff ff; tail) else ff :: (remove tail ff_num) in let fi = ff_to_remove.T.ff_fct in let ff_num = ff_to_remove.T.ff_id in let new_ff_list = remove fi.T.fi_slices ff_num in fi.T.fi_slices <- new_ff_list -let call_src_and_remove_all_ff proj fi = +let call_src_and_remove_all_ff fi = let do_call actions (ff_caller, call_id) = let new_actions = - Fct_slice.apply_change_call proj ff_caller call_id (T.CallSrc (Some fi)) + Fct_slice.apply_change_call ff_caller call_id (T.CallSrc (Some fi)) in new_actions @ actions in let do_ff actions ff = let calls = ff.SlicingInternals.ff_called_by in let actions = List.fold_left do_call actions calls in - remove_ff proj ff; + remove_ff ff; actions in List.fold_left do_ff [] fi.T.fi_slices -let rec remove_uncalled_slices proj = +let rec remove_uncalled_slices () = let kf_entry, _ = Globals.entry_point () in let entry_name = Kernel_function.get_name kf_entry in let check_ff changes ff = - match ff.T.ff_called_by with [] -> remove_ff proj ff; true | _ -> changes + match ff.T.ff_called_by with [] -> remove_ff ff; true | _ -> changes in let check_fi changes fi = if (M.fi_name fi) <> entry_name then List.fold_left check_ff changes (M.fi_slices fi) else changes - in let changes = M.fold_fi check_fi false proj in - if changes then remove_uncalled_slices proj else () + in let changes = M.fold_fi check_fi false in + if changes then remove_uncalled_slices () else () (** Build a new slice [ff] which contains the marks of [ff1] and [ff2] * and generate everything that is needed to choose the calls in [ff]. * If [replace] also generate requests call [ff] instead of [ff1] and [ff2]. *) -let merge_slices proj ff1 ff2 replace = +let merge_slices ff1 ff2 replace = let ff, ff_actions = Fct_slice.merge_slices ff1 ff2 in if replace then begin @@ -112,12 +99,12 @@ let merge_slices proj ff1 ff2 replace = in let actions = List.fold_left add [] ff2.T.ff_called_by in let actions = List.fold_left add actions ff1.T.ff_called_by in - add_proj_actions proj actions + add_proj_actions actions end; - add_proj_actions proj ff_actions; + add_proj_actions ff_actions; ff -let split_slice proj ff = +let split_slice ff = let add (actions, slices) (caller, call) = let new_ff = Fct_slice.copy_slice ff in let rq = SlicingActions.mk_crit_change_call caller call @@ -126,20 +113,21 @@ let split_slice proj ff = in let calls = List.tl ff.T.ff_called_by in (* keep ff for the first call *) let actions, slices = List.fold_left add ([], [ff]) calls in - add_proj_actions proj actions; + add_proj_actions actions; slices (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (** {2 Getting information } *) -let get_slices proj kf = M.fi_slices (M.get_kf_fi proj kf) +let get_slices kf = M.fi_slices (M.get_kf_fi kf) let get_slice_callers ff = List.map (fun (ff, _) -> ff) ff.T.ff_called_by (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (** {2 Adding requests } *) -let add_filter proj filter = +let add_filter filter = + let proj = SlicingState.get () in proj.T.actions <- filter :: proj.T.actions (* @@ -158,39 +146,39 @@ let add_fct_filter proj f_id criterion = which is a new slice if the function to filter is the source one, or the given slice otherwise. *) -let add_fct_src_filter proj fi to_select = +let add_fct_src_filter fi to_select = match to_select with (* T.CuSelect [] : don't ignore empty selection because the input control node has to be selected anyway... *) | T.CuSelect select -> let filter = SlicingActions.mk_crit_fct_user_select fi select in - add_filter proj filter + add_filter filter | T.CuTop m -> let filter = SlicingActions.mk_crit_fct_top fi m in - add_filter proj filter + add_filter filter (* let add_fct_src_filters proj fi actions = List.iter (fun a -> ignore (add_fct_src_filter proj fi a)) actions *) -let add_fct_ff_filter proj ff to_select = +let add_fct_ff_filter ff to_select = match to_select with | T.CuSelect [] -> SlicingParameters.debug ~level:1 "[SlicingProject.add_fct_ff_filter] (ignored empty selection)" | T.CuSelect select -> let filter = SlicingActions.mk_ff_user_select ff select in - add_filter proj filter + add_filter filter | T.CuTop _ -> assert false (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (** {2 Print} *) -let print_project fmt proj = +let print_project fmt = let get_slices var_fct = let kf = Globals.Functions.get var_fct in - let fct_info = M.get_kf_fi proj kf in + let fct_info = M.get_kf_fi kf in M.fi_slices fct_info in let print glob = @@ -207,15 +195,15 @@ let print_project fmt proj = List.iter print global_decls -let print_proj_worklist fmt proj = - Format.fprintf fmt "Slicing project worklist [%s/%s] =@\n%a@.@." - (Project.get_name proj.T.application) - proj.T.name +let print_proj_worklist fmt = + let proj = SlicingState.get () in + Format.fprintf fmt "Slicing project worklist [%s] =@\n%a@.@." + (Project.get_name (Project.current ())) SlicingActions.print_list_crit proj.T.actions -let print_project_and_worklist fmt proj = - print_project fmt proj; - print_proj_worklist fmt proj +let print_project_and_worklist fmt = + print_project fmt; + print_proj_worklist fmt let pretty_slice fmt ff = PrintSlice.print_marked_ff fmt ff; @@ -230,12 +218,12 @@ let apply_fct_crit ff to_select = let actions = Fct_slice.apply_add_marks ff to_select in actions -let apply_appli_crit proj appli_crit = +let apply_appli_crit appli_crit = match appli_crit with | T.CaCall fi_to_call -> let kf_to_call = M.get_fi_kf fi_to_call in let add_actions actions (kf_caller,_) = - let fi_caller = M.get_kf_fi proj kf_caller in + let fi_caller = M.get_kf_fi kf_caller in let mark = SlicingMarks.mk_user_spare in let action = SlicingActions.mk_crit_mark_calls fi_caller kf_to_call mark in @@ -256,9 +244,9 @@ let apply_appli_crit proj appli_crit = * If it is a propagation, no need to create a new slice * because it will be created when the call will be selected anyway. * *) -let add_persistent_marks proj fi node_marks orig propagate actions = +let add_persistent_marks fi node_marks orig propagate actions = let new_fi_marks, actions = - Fct_slice.add_marks_to_fi proj fi node_marks propagate actions + Fct_slice.add_marks_to_fi fi node_marks propagate actions in let actions = match M.fi_slices fi with | [] -> (* no slice *) @@ -281,7 +269,7 @@ let add_persistent_marks proj fi node_marks orig propagate actions = else actions in actions -let apply_fct_action proj fct_crit = +let apply_fct_action fct_crit = match fct_crit.T.cf_fct with | T.FctSliced ff -> let _ = M.get_ff_pdg ff in @@ -294,14 +282,14 @@ let apply_fct_action proj fct_crit = | T.CcUserMark (T.CuSelect crit) -> apply_fct_crit ff crit | T.CcUserMark (T.CuTop _) -> assert false (* impossible on ff ! *) | T.CcChangeCall (call, f) -> - Fct_slice.apply_change_call proj ff call f + Fct_slice.apply_change_call ff call f | T.CcChooseCall call -> - Fct_slice.apply_choose_call proj ff call + Fct_slice.apply_choose_call ff call | T.CcMissingInputs (call, input_marks, more_inputs) -> - Fct_slice.apply_missing_inputs proj ff call + Fct_slice.apply_missing_inputs ff call (input_marks, more_inputs) | T.CcMissingOutputs (call, output_marks, more_outputs) -> - Fct_slice.apply_missing_outputs proj ff call + Fct_slice.apply_missing_outputs ff call output_marks more_outputs | T.CcPropagate _ -> assert false (* not for ff at the moment *) | T.CcExamineCalls marks -> @@ -314,37 +302,37 @@ let apply_fct_action proj fct_crit = let propagate = SlicingParameters.Mode.Callers.get () in match fct_crit.T.cf_info with | T.CcUserMark (T.CuSelect to_select) -> - add_persistent_marks proj fi to_select true propagate [] + add_persistent_marks fi to_select true propagate [] | T.CcUserMark (T.CuTop m) -> SlicingParameters.result ~level:1 "unable to slice %s (-> TOP)" (M.fi_name fi); - let filters = call_src_and_remove_all_ff proj fi in + let filters = call_src_and_remove_all_ff fi in Fct_slice.add_top_mark_to_fi fi m propagate filters | T.CcPropagate [] -> SlicingParameters.debug ~level:1 "[apply_fct_action] nothing to propagate"; [] | T.CcPropagate node_marks -> - add_persistent_marks proj fi node_marks false propagate [] + add_persistent_marks fi node_marks false propagate [] | T.CcExamineCalls _ | _ -> SlicingParameters.not_yet_implemented "This slicing criterion on source function" (** apply [filter] and return a list of generated filters *) -let apply_action proj filter = +let apply_action filter = SlicingParameters.debug ~level:1 "[SlicingProject.apply_action] : %a" SlicingActions.print_crit filter; let new_filters = try match filter with | T.CrFct fct_crit -> begin - try (apply_fct_action proj fct_crit) + try (apply_fct_action fct_crit) with PdgTypes.Pdg.Bottom -> SlicingParameters.debug ~level:1 " -> action ABORTED (PDG is bottom)" ; [] end | T.CrAppli appli_crit -> - apply_appli_crit proj appli_crit + apply_appli_crit appli_crit with Not_found -> (* catch unprocessed Not_found here *) assert false in SlicingParameters.debug ~level:1 " -> %d generated filters : %a@." @@ -352,37 +340,43 @@ let apply_action proj filter = SlicingActions.print_list_crit new_filters; new_filters -let get_next_filter proj = +let get_next_filter () = + let proj = SlicingState.get () in match proj.T.actions with - | [] -> SlicingParameters.debug ~level:2 "[SlicingProject.get_next_filter] No more filter"; - raise Not_found + | [] -> + SlicingParameters.debug ~level:2 + "[SlicingProject.get_next_filter] No more filter"; + raise Not_found | f :: tail -> proj.T.actions <- tail; f -let apply_next_action proj = +let apply_next_action () = SlicingParameters.debug ~level:2 "[SlicingProject.apply_next_action]"; - let filter = get_next_filter proj in - let new_filters = apply_action proj filter in - proj.T.actions <- new_filters @ proj.T.actions + let proj = SlicingState.get () in + let filter = get_next_filter () in + let new_filters = apply_action filter in + proj.T.actions <- new_filters @ proj.T.actions -let is_request_empty proj = +let is_request_empty () = + let proj = SlicingState.get () in proj.T.actions = [] -let apply_all_actions proj = +let apply_all_actions () = + let proj = SlicingState.get () in let nb_actions = List.length proj.T.actions in let rec apply actions = match actions with [] -> () | a::actions -> SlicingParameters.feedback ~level:2 "applying sub action..."; - let new_filters = apply_action proj a in + let new_filters = apply_action a in apply new_filters; apply actions in SlicingParameters.feedback ~level:1 "applying %d actions..." nb_actions; let rec apply_user n = try - let a = get_next_filter proj in + let a = get_next_filter () in SlicingParameters.feedback ~level:1 "applying actions: %d/%d..." n nb_actions; - let new_filters = apply_action proj a in + let new_filters = apply_action a in apply new_filters; apply_user (n+1) with Not_found -> diff --git a/src/plugins/slicing/slicingProject.mli b/src/plugins/slicing/slicingProject.mli index 895d6bc1596c6c82c73bb64c4d8aadb7c42ba252..3c8647f554f5338a1e28b62c85bd8eeb418eaf22 100644 --- a/src/plugins/slicing/slicingProject.mli +++ b/src/plugins/slicing/slicingProject.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,21 +26,19 @@ open SlicingInternals -val mk_project : string -> project -val get_name : project -> string -val create_slice : project -> Kernel_function.t -> fct_slice -val remove_ff : project -> fct_slice -> unit -val remove_uncalled_slices : project -> unit -val merge_slices : project -> fct_slice -> fct_slice -> bool -> fct_slice -val split_slice : project -> fct_slice -> fct_slice list -val get_slices : project -> Kernel_function.t -> fct_slice list +val create_slice : Kernel_function.t -> fct_slice +val remove_ff : fct_slice -> unit +val remove_uncalled_slices : unit -> unit +val merge_slices : fct_slice -> fct_slice -> bool -> fct_slice +val split_slice : fct_slice -> fct_slice list +val get_slices : Kernel_function.t -> fct_slice list val get_slice_callers : fct_slice -> fct_slice list -val add_filter : project -> criterion -> unit -val add_fct_src_filter : project -> fct_info -> fct_user_crit -> unit -val add_fct_ff_filter : project -> fct_slice -> fct_user_crit -> unit -val print_proj_worklist : Format.formatter -> project -> unit -val print_project_and_worklist : Format.formatter -> project -> unit +val add_filter : criterion -> unit +val add_fct_src_filter : fct_info -> fct_user_crit -> unit +val add_fct_ff_filter : fct_slice -> fct_user_crit -> unit +val print_proj_worklist : Format.formatter -> unit +val print_project_and_worklist : Format.formatter -> unit val pretty_slice : Format.formatter -> fct_slice -> unit -val apply_next_action : project -> unit -val is_request_empty : project -> bool -val apply_all_actions : project -> unit +val apply_next_action : unit -> unit +val is_request_empty : unit -> bool +val apply_all_actions : unit -> unit diff --git a/src/plugins/slicing/slicingSelect.ml b/src/plugins/slicing/slicingSelect.ml new file mode 100644 index 0000000000000000000000000000000000000000..5929c477b34760352dd2ea5c5423ae1ad76dd413 --- /dev/null +++ b/src/plugins/slicing/slicingSelect.ml @@ -0,0 +1,436 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types +open Cil_datatype + +(* ---------------------------------------------------------------------- *) +(** {1 For internal use} *) + +let check_call stmt is_call = + let err = match stmt.skind with + | Instr (Call _ | Local_init(_, ConsInit _,_)) -> not is_call + | _ -> is_call + in + if err then + let str = if is_call then "not" else "" in + let msg = "This statement is "^str^" a call" in + raise (Invalid_argument msg) + else stmt + +let print_select fmt db_select = + let db_fvar, select = db_select in + Format.fprintf fmt "In %a : %a" + Varinfo.pretty db_fvar SlicingActions.print_f_crit select + +let get_select_kf (fvar, _select) = Globals.Functions.get fvar + +let check_db_select fvar db_select = + let db_fvar, select = db_select in + if not (Cil_datatype.Varinfo.equal db_fvar fvar) then + begin + SlicingParameters.debug + "slice name = %s <> select = %a@." + (fvar.vname) print_select db_select ; + raise (Invalid_argument + "This selection doesn't belong to the given function"); + end; + fvar, select + +let empty_db_select kf = (Kernel_function.get_vi kf, SlicingInternals.CuSelect []) +let top_db_select kf m = (Kernel_function.get_vi kf, SlicingInternals.CuTop m) +let check_kf_db_select kf = check_db_select (Kernel_function.get_vi kf) +let _check_fi_db_select fi = check_db_select (SlicingMacros.fi_svar fi) +let check_ff_db_select ff = check_db_select (SlicingMacros.ff_svar ff) + +let bottom_msg kf = + SlicingParameters.feedback + "bottom PDG for function '%s': ignore selection" + (Kernel_function.get_name kf) + +let basic_add_select kf select nodes ?(undef) nd_marks = + let fvar, sel = check_kf_db_select kf select in + match sel with + | SlicingInternals.CuTop _ -> select + | SlicingInternals.CuSelect sel -> + let pdg = !Db.Pdg.get kf in + let nodes = + List.map (fun n -> (n, None) (*TODO: add z_part ? *)) nodes in + (* let nd_marks = SlicingActions.build_node_and_dpds_selection mark in *) + (* let nd_marks = SlicingActions.build_simple_node_selection mark in *) + let crit = [(nodes, nd_marks)] in + let sel = SlicingActions.translate_crit_to_select pdg ~to_select:sel crit in + let sel = match undef with None -> sel + | Some (undef, mark) -> + PdgMarks.add_undef_in_to_select sel undef mark in + let sel = SlicingInternals.CuSelect sel in + (fvar, sel) + +let select_pdg_nodes kf ?(select=empty_db_select kf) nodes mark = + SlicingParameters.debug ~level:1 "[Register.select_pdg_nodes]" ; + let nd_marks = SlicingActions.build_node_and_dpds_selection mark in + try basic_add_select kf select nodes nd_marks + with Db.Pdg.Top | Db.Pdg.Bottom -> + assert false (* if we have node, we must have a pdg somewhere ! *) + +let mk_select pdg sel nodes undef mark = + let nd_marks = SlicingActions.build_simple_node_selection mark in + let crit = [(nodes, nd_marks)] in + let sel = SlicingActions.translate_crit_to_select pdg ~to_select:sel crit in + let sel = PdgMarks.add_undef_in_to_select sel undef mark in + let sel = SlicingInternals.CuSelect sel in + sel + +let select_stmt_zone kf ?(select=empty_db_select kf) stmt ~before loc mark = + SlicingParameters.debug ~level:1 "[Register.select_stmt_zone] %a %s stmt %d (m=%a)" + Locations.Zone.pretty loc + (if before then "before" else "after") stmt.sid + SlicingMarks.pretty_mark mark; + if not (Db.Value.is_reachable_stmt stmt) then + begin + SlicingParameters.feedback + "@[Nothing to select for @[%a@]@ %s unreachable stmt of %a@]" + Locations.Zone.pretty loc + (if before then "before" else "after") + Kernel_function.pretty kf; + select + end + else + let fvar, sel = check_kf_db_select kf select in + match sel with + | SlicingInternals.CuTop _ -> select + | SlicingInternals.CuSelect sel -> + try + let pdg = !Db.Pdg.get kf in + let nodes, undef = + !Db.Pdg.find_location_nodes_at_stmt pdg stmt before loc in + let sel = mk_select pdg sel nodes undef mark in + (fvar, sel) + with + | Not_found -> (* stmt probably unreachable *) + SlicingParameters.feedback + "@[Nothing to select for @[%a@]@ %s required stmt in %a@]" + Locations.Zone.pretty loc + (if before then "before" else "after") + Kernel_function.pretty kf; + SlicingParameters.debug + "@[Nothing to select for @[%a@]@ %s stmt %d in %a@]" + Locations.Zone.pretty loc + (if before then "before" else "after") stmt.sid + Kernel_function.pretty kf; + select + | Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; select + + +(** this one is similar to [select_stmt_zone] with the return statement +* when the function is defined, but it can also be used for undefined functions. *) +let select_in_out_zone ~at_end ~use_undef kf select loc mark = + SlicingParameters.debug + "[Register.select_in_out_zone] select zone %a (m=%a) at %s of %a" + Locations.Zone.pretty loc SlicingMarks.pretty_mark mark + (if at_end then "end" else "begin") Kernel_function.pretty kf; + let fvar, sel = check_kf_db_select kf select in + match sel with + | SlicingInternals.CuTop _ -> select + | SlicingInternals.CuSelect sel -> + try + let pdg = !Db.Pdg.get kf in + let find = + if at_end then !Db.Pdg.find_location_nodes_at_end + else !Db.Pdg.find_location_nodes_at_begin in + let nodes, undef = find pdg loc in + let undef = if use_undef then undef else None in + let sel = mk_select pdg sel nodes undef mark in + (fvar, sel) + with + | Not_found -> (* in or out unreachable ? *) + SlicingParameters.feedback + "@[Nothing to select for zone %a (m=%a) at %s of %a@]" + Locations.Zone.pretty loc SlicingMarks.pretty_mark mark + (if at_end then "end" else "begin") Kernel_function.pretty kf; + select + | Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; select + +let select_zone_at_end kf ?(select=empty_db_select kf) loc mark = + select_in_out_zone ~at_end:true ~use_undef:true kf select loc mark + +let select_modified_output_zone kf ?(select=empty_db_select kf) loc mark = + select_in_out_zone ~at_end:true ~use_undef:false kf select loc mark + +let select_zone_at_entry kf ?(select=empty_db_select kf) loc mark = + select_in_out_zone ~at_end:false ~use_undef:true kf select loc mark + +let stmt_nodes_to_select pdg stmt = + try + let stmt_nodes = !Db.Pdg.find_stmt_and_blocks_nodes pdg stmt in + SlicingParameters.debug ~level:2 "[Register.stmt_nodes_to_select] results on stmt %d (%a)" stmt.sid + (fun fmt l -> List.iter (!Db.Pdg.pretty_node true fmt) l) + stmt_nodes; + stmt_nodes + with Not_found -> + SlicingParameters.debug ~level:2 "[Register.stmt_nodes_to_select] no results for stmt %d, probably unreachable" stmt.sid; + [] + +let select_stmt_computation kf ?(select=empty_db_select kf) stmt mark = + SlicingParameters.debug ~level:1 "[Register.select_stmt_computation] on stmt %d" stmt.sid; + if not (Db.Value.is_reachable_stmt stmt) then + begin + SlicingParameters.feedback + "@[Nothing to select for an unreachable stmt of %a@]" + Kernel_function.pretty kf; + select + end + else + try + let pdg = !Db.Pdg.get kf in + let stmt_nodes = stmt_nodes_to_select pdg stmt in + let nd_marks = SlicingActions.build_node_and_dpds_selection mark in + basic_add_select kf select stmt_nodes nd_marks + with Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; select + +let select_label kf ?(select=empty_db_select kf) label mark = + SlicingParameters.debug ~level:1 "[Register.select_label] on label " + (* Logic_label.pretty label *); + try + let pdg = !Db.Pdg.get kf in + let nodes = + let add_label_nodes l acc = match l with + | StmtLabel stmt -> + let add acc l = + try !Db.Pdg.find_label_node pdg !stmt l :: acc + with Not_found -> acc + in + List.fold_left add acc (!stmt).labels + | BuiltinLabel (Some stmt, l) -> + let str = Format.asprintf "%a" Printer.pp_logic_builtin_label l in + let add acc l = match l with + | Label (sl, _, _) when sl = str -> + (try (!Db.Pdg.find_label_node pdg stmt l)::acc + with Not_found -> acc) + | _ -> acc + in List.fold_left add acc stmt.labels + | FormalLabel _ | BuiltinLabel (None, _) -> acc + in + (* Logic_label.Set.fold add_label_nodes labels [] *) + add_label_nodes label [] + in + let nd_marks = SlicingActions.build_node_and_dpds_selection mark in + basic_add_select kf select nodes nd_marks + with Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; select + +(** marking a call node means that a [choose_call] will have to decide that to + * call according to the slicing-level, but anyway, the call will be visible. + *) +let select_minimal_call kf ?(select=empty_db_select kf) stmt m = + SlicingParameters.debug ~level:1 "[Register.select_minimal_call]"; + try + let pdg = !Db.Pdg.get kf in + let call = check_call stmt true in + let call_node = !Db.Pdg.find_call_ctrl_node pdg call in + let nd_marks = SlicingActions.build_simple_node_selection m in + basic_add_select kf select [call_node] nd_marks + with Db.Pdg.Top -> top_db_select kf m + | Db.Pdg.Bottom -> bottom_msg kf; select + +let select_stmt_ctrl kf ?(select=empty_db_select kf) stmt = + SlicingParameters.debug ~level:1 "[Register.select_stmt_ctrl] of sid:%d" stmt.sid; + let mark = SlicingMarks.mk_user_mark ~ctrl:true ~data:false ~addr:false in + try + let pdg = !Db.Pdg.get kf in + let stmt_nodes = !Db.Pdg.find_simple_stmt_nodes pdg stmt in + let nd_marks = SlicingActions.build_ctrl_dpds_selection mark in + basic_add_select kf select stmt_nodes nd_marks + with Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + +let select_entry_point kf ?(select=empty_db_select kf) mark = + SlicingParameters.debug ~level:1 "[Register.select_entry_point] of %a" + Kernel_function.pretty kf; + try + let pdg = !Db.Pdg.get kf in + let node = !Db.Pdg.find_entry_point_node pdg in + let nd_marks = SlicingActions.build_simple_node_selection mark in + basic_add_select kf select [node] nd_marks + with Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + +let select_return kf ?(select=empty_db_select kf) mark = + SlicingParameters.debug ~level:1 "[Register.select_return] of %a" + Kernel_function.pretty kf; + try + let pdg = !Db.Pdg.get kf in + let node = !Db.Pdg.find_ret_output_node pdg in + let nd_marks = SlicingActions.build_simple_node_selection mark in + basic_add_select kf select [node] nd_marks + with + | Not_found -> (* unreachable ? *) + SlicingParameters.feedback + "@[Nothing to select for return stmt of %a@]" + Kernel_function.pretty kf; + select + | Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + +let select_decl_var kf ?(select=empty_db_select kf) vi mark = + SlicingParameters.debug ~level:1 "[Register.select_decl_var] of %s in %a@." + vi.Cil_types.vname Kernel_function.pretty kf; + if vi.Cil_types.vglob (* no slicing request on globals *) + then select + else try + let pdg = !Db.Pdg.get kf in + let node = !Db.Pdg.find_decl_var_node pdg vi in + let nd_marks = SlicingActions.build_simple_node_selection mark in + basic_add_select kf select [node] nd_marks + with + | Not_found -> + SlicingParameters.feedback + "@[Nothing to select for %s declarationin %a@]" + vi.Cil_types.vname Kernel_function.pretty kf; + select + | Db.Pdg.Top -> top_db_select kf mark + | Db.Pdg.Bottom -> bottom_msg kf; empty_db_select kf + + +let merge_select select1 select2 = + let select = match select1, select2 with + | SlicingInternals.CuTop m, _ | _, SlicingInternals.CuTop m -> SlicingInternals.CuTop m + | SlicingInternals.CuSelect select1, SlicingInternals.CuSelect select2 -> + (* TODO : we can probably do better...*) + SlicingInternals.CuSelect (select1 @ select2) + in select + +let merge_db_select db_select1 db_select2 = + let fvar, select1 = db_select1 in + let _, select2 = check_db_select fvar db_select2 in + let select = merge_select select1 select2 in + (fvar, select) + +module Selections = struct + + let add_to_selects db_select set = + let vf, select = db_select in + let select = + try merge_select (Cil_datatype.Varinfo.Map.find vf set) select + with Not_found -> select + in + Cil_datatype.Varinfo.Map.add vf select set + + let iter_selects_internal f set = + Cil_datatype.Varinfo.Map.iter (fun v sel -> f (v, sel)) set + + let fold_selects_internal f acc selections = + let r = ref acc in + let dof select = r := f !r select in + iter_selects_internal dof selections; !r +end + +let add_crit_ff_change_call ff_caller call f_to_call = + let crit = SlicingActions.mk_crit_change_call ff_caller call f_to_call in + SlicingProject.add_filter crit + +(** change the call to call the given slice. + * This is a user request, so it might be the case that + * the new function doesn't compute enough outputs : + * in that case, add outputs first. + *) +let call_ff_in_caller ~caller ~to_call = + let kf_caller = SlicingMacros.get_ff_kf caller in + let kf_to_call = SlicingMacros.get_ff_kf to_call in + let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller kf_to_call in + let ff_to_call = SlicingInternals.CallSlice to_call in + let add_change_call stmt = + add_crit_ff_change_call caller stmt ff_to_call ; + match Fct_slice.check_outputs_before_change_call caller + stmt to_call with + | [] -> () + | [c] -> SlicingProject.add_filter c + | _ -> assert false + + in List.iter add_change_call call_stmts + +let call_fsrc_in_caller ~caller ~to_call = + let kf_caller = SlicingMacros.get_ff_kf caller in + let fi_to_call = SlicingMacros.get_kf_fi to_call in + let kf_to_call = SlicingMacros.get_fi_kf fi_to_call in + let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller kf_to_call in + let add_change_call stmt = + add_crit_ff_change_call caller stmt (SlicingInternals.CallSrc (Some fi_to_call)) + in List.iter add_change_call call_stmts + +let call_min_f_in_caller ~caller ~to_call = + let kf_caller = SlicingMacros.get_ff_kf caller in + let pdg = SlicingMacros.get_ff_pdg caller in + let call_stmts = !Db.Pdg.find_call_stmts ~caller:kf_caller to_call in + let call_nodes = + List.map (fun call -> (!Db.Pdg.find_call_ctrl_node pdg call),None) + call_stmts in + let m = SlicingMarks.mk_user_spare in + let nd_marks = SlicingActions.build_simple_node_selection m in + let select = SlicingActions.translate_crit_to_select pdg [(call_nodes, nd_marks)] in + SlicingProject.add_fct_ff_filter caller (SlicingInternals.CuSelect select) + +let is_already_selected ff db_select = + let _, select = check_ff_db_select ff db_select in + match select with + | SlicingInternals.CuTop _ -> assert false + | SlicingInternals.CuSelect to_select -> + (* let pdg = !Db.Pdg.get (Globals.Functions.get fvar) in *) + let new_marks = Fct_slice.filter_already_in ff to_select in + let ok = if new_marks = [] then true else false in + if ok then + SlicingParameters.debug ~level:1 + "[Api.is_already_selected] %a ?\t--> yes" + print_select db_select + else SlicingParameters.debug ~level:1 + "[Api.is_already_selected] %a ?\t--> no (missing %a)" + print_select db_select + SlicingActions.print_sel_marks_list new_marks; + ok + +let add_ff_selection ff db_select = + SlicingParameters.debug ~level:1 "[Api.add_ff_selection] %a to %s" + print_select db_select (SlicingMacros.ff_name ff); + let _, select = check_ff_db_select ff db_select in + SlicingProject.add_fct_ff_filter ff select + +(** add a persistent selection to the function. +* This might change its slicing level in order to call slices later on. *) +let add_fi_selection db_select = + SlicingParameters.debug ~level:1 "[Api.add_fi_selection] %a" + print_select db_select; + let kf = get_select_kf db_select in + let fi = SlicingMacros.get_kf_fi kf in + let _, select = db_select in + SlicingProject.add_fct_src_filter fi select; + match fi.SlicingInternals.fi_level_option with + | SlicingInternals.DontSlice | SlicingInternals.DontSliceButComputeMarks -> + SlicingMacros.change_fi_slicing_level fi SlicingInternals.MinNbSlice; + SlicingParameters.debug ~level:1 "[Register.add_fi_selection] changing %s slicing level to %s@." + (SlicingMacros.fi_name fi) + (SlicingMacros.str_level_option fi.SlicingInternals.fi_level_option) + + | SlicingInternals.MinNbSlice | SlicingInternals.MaxNbSlice -> () + diff --git a/src/libraries/stdlib/dynlink_no_native.ml b/src/plugins/slicing/slicingState.ml similarity index 54% rename from src/libraries/stdlib/dynlink_no_native.ml rename to src/plugins/slicing/slicingState.ml index f4b9a3a3b0964a59a83e4b00aedc6fa9b3c2e0f8..f26c74b459de111c24a9ba5f22b2aafdc933302c 100644 --- a/src/libraries/stdlib/dynlink_no_native.ml +++ b/src/plugins/slicing/slicingState.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,50 +20,45 @@ (* *) (**************************************************************************) -(* Implementation of [FCDynlink] when no dynlink is available *) +module P = + State_builder.Option_ref + (SlicingTypes.Sl_project) + (struct + let name = "Slicing.Project" + let dependencies = [] (* others delayed in Register *) + end) -module type OldDynlink = sig - val loadfile : string -> unit - val allow_unsafe_modules : bool -> unit - val init : unit -> unit - val add_interfaces: string list -> string list -> unit - val digest_interface : string -> string list -> Digest.t -end +let self = P.self +let () = + Cmdline.run_after_extended_stage + (fun () -> + State_dependency_graph.add_codependencies + ~onto:self + [ !Db.Pdg.self; !Db.Inputs.self_external; !Db.Outputs.self_external ]) -exception Unsupported_Feature of string -let fail s = fun _ -> raise (Unsupported_Feature s) +let get () = + try P.get () + with Not_found -> SlicingParameters.fatal "slicing not initialized." -let is_native = true -let adapt_filename = fail "adapt_filename" +let may f = match P.get_option () with + | None -> () + | Some _ -> f () -let loadfile = fail "loadfile" -let allow_unsafe_modules = fail "allow_unsafe_modules" -let init = fail "init" -let add_interfaces = fail "add_interfaces" +let may_map ~dft f = match P.get_option () with + | None -> dft + | Some _ -> f () -type linking_error = - Undefined_global of string - | Unavailable_primitive of string - | Uninitialized_global of string - -type error = - Not_a_bytecode_file of string - | Inconsistent_import of string - | Unavailable_unit of string - | Unsafe_file - | Linking_error of string * linking_error - | Corrupted_interface of string - | File_not_found of string - | Cannot_open_dll of string - | Inconsistent_implementation of string - -exception Error of error - -let error_message = fail "error_message" -let digest_interface = fail "digest_interface" - -(* -Local Variables: -compile-command: "make -C ../../.." -End: -*) +let reset_slicing () = + !Db.Value.compute () ; + let initialized = match P.get_option () with | None -> false | Some _ -> true in + if not initialized then + SlicingParameters.feedback ~level:1 "initializing slicing ..." + else + SlicingParameters.feedback ~level:1 "reinitializing slicing ..."; + P.set + SlicingInternals.{ functions = Cil_datatype.Varinfo.Hashtbl.create 17; + actions = [] }; + if not initialized then + SlicingParameters.feedback ~level:2 "done (initializing slicing)." + else + SlicingParameters.feedback ~level:2 "done (reinitializing slicing)." diff --git a/src/plugins/value/legacy/state_imp.mli b/src/plugins/slicing/slicingState.mli similarity index 61% rename from src/plugins/value/legacy/state_imp.mli rename to src/plugins/slicing/slicingState.mli index 84215506aeffac5ec0f84fce7727e0888b8c7ccf..048698947d45b70670e44b75b17667df03029a48 100644 --- a/src/plugins/value/legacy/state_imp.mli +++ b/src/plugins/slicing/slicingState.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,39 +20,27 @@ (* *) (**************************************************************************) -(** Sets of Cvalue.Model.t implemented imperatively. Current implementation - is optimized to detect similarities in the memory states *) +(** State of the slicing. + @since Phosphorus-20170501-beta1 *) -type t +val get: unit -> SlicingTypes.sl_project +(** Get the state of the slicing project. + Assume it has already been initialized through {!Db.Slicing.reset_slice}. *) -val pretty : Format.formatter -> t -> unit +val may: (unit -> unit) -> unit +(** apply the given closure if the slicing project has been initialized through + {!Db.Slicing.reset_slice}. *) -(** Creation *) -val empty : unit -> t -val singleton : Cvalue.Model.t -> t +val may_map: dft:'a -> (unit -> 'a) -> 'a +(** apply the given closure if the slicing project has been initialized through + {!Db.Slicing.reset_slice}, or else return the default value.*) -(** Information *) -val is_empty : t -> bool -val length : t -> int +val self: State.t +(** Internal state of the slicing tool from project viewpoints. + @since Frama-C+dev *) -(** Adding elements. *) -exception Unchanged (** The three next functions raise [Unchanged] if the - element(s) was already present. *) -val merge_set_return_new : State_set.t -> t -> State_set.t - -(** Iterators *) -val fold : ( Cvalue.Model.t -> 'a -> 'a) -> t -> 'a -> 'a -val iter : (Cvalue.Model.t -> unit) -> t -> unit -val exists : (Cvalue.Model.t -> bool) -> t -> bool - -(** Export *) -val join : t -> Cvalue.Model.t -val to_set : t -> State_set.t -val to_list : t -> Cvalue.Model.t list - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) +val reset_slicing: unit -> unit +(** Function that can be used for: + - initializing the slicing tool before starting a slicing project; + - removing all computed slices and all internal pending requests + of the current slicing project. *) diff --git a/src/plugins/slicing/slicingTransform.ml b/src/plugins/slicing/slicingTransform.ml index ec2f9e3fba8d8d5f3a80a8eefca2f697ee2399f0..2b2c960881d4097a6253fa611670cb852b5d1ae8 100644 --- a/src/plugins/slicing/slicingTransform.ml +++ b/src/plugins/slicing/slicingTransform.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,34 +28,6 @@ open Cil (**/**) -(* Look at (only once) the callers of [kf] ([kf] included). *) -let exists_fun_callers fpred kf = - let table = ref Cil_datatype.Varinfo.Set.empty in - let rec exists_fun_callers kf = - if fpred kf - then true - else let vf = Kernel_function.get_vi kf in - if Cil_datatype.Varinfo.Set.mem vf !table - then false (* no way to call the initial [kf]. *) - else begin - table := Cil_datatype.Varinfo.Set.add vf !table ; - List.exists - (fun (kf,_) -> exists_fun_callers kf) - (!Db.Value.callers kf) - end - in - exists_fun_callers kf - -let is_src_fun_visible prj = exists_fun_callers (SlicingMacros.is_src_fun_visible prj) - -let is_src_fun_called prj kf = - let kf_entry, _library = Globals.entry_point () in - let fpred f = - if (kf_entry == f) - then SlicingMacros.is_src_fun_visible prj f (* for the entry point *) - else SlicingMacros.is_src_fun_called prj f (* for the others *) - in exists_fun_callers fpred kf - module Visibility (SliceName : sig val get : kernel_function -> bool -> int -> string end) = struct @@ -63,7 +35,7 @@ module Visibility (SliceName : sig exception EraseAssigns exception EraseAllocation - type proj = SlicingInternals.project + type proj = unit type transform = { slice: SlicingInternals.fct_slice; src_visible: bool (* whether the src function of the slice is visible and @@ -80,10 +52,12 @@ module Visibility (SliceName : sig Kernel_function.is_definition kf && not (!Db.Value.use_spec_instead_of_definition kf) - let fct_info project kf = - let fi = SlicingMacros.get_kf_fi project kf in + (* _project is left to comply with a module signature defined outside + the slicing module (in filter) *) + let fct_info _proj kf = + let fi = SlicingMacros.get_kf_fi kf in let slices = SlicingMacros.fi_slices fi in - let src_visible = is_src_fun_visible project kf in + let src_visible = Fct_slice.is_src_fun_visible kf in SlicingParameters.debug ~level:1 "[SlicingTransform.Visibility.fct_info] processing %a (%d slices/src %svisible)" Kernel_function.pretty kf (List.length slices) (if src_visible then "" else "not "); @@ -115,7 +89,7 @@ module Visibility (SliceName : sig SlicingParameters.debug ~level:2 "[SlicingTransform.Visibility.fct_name] get fct_name = %s" name; name - let visible_mark m = not (!Db.Slicing.Mark.is_bottom m) + let visible_mark m = not (SlicingMarks.is_bottom_mark m) let param_visible ff_opt n = match ff_opt with | Isrc _ | Iproto -> true @@ -130,14 +104,14 @@ module Visibility (SliceName : sig | Isrc _ -> true | Iproto -> false | Iff {slice = ff} -> - let m = !Db.Slicing.Slice.get_mark_from_stmt ff inst in + let m = Fct_slice.get_stmt_mark ff inst in visible_mark m let label_visible ff_opt inst label = match ff_opt with | Isrc _ -> true | Iproto -> false | Iff {slice = ff} -> - let m = !Db.Slicing.Slice.get_mark_from_label ff inst label in + let m = Fct_slice.get_label_mark ff inst label in let v = visible_mark m in SlicingParameters.debug ~level:2 "[SlicingTransform.Visibility.label_visible] label %a is %svisible" @@ -160,7 +134,7 @@ module Visibility (SliceName : sig let all_nodes_visible ff nodes = let is_visible visi n = let m = Fct_slice.get_node_mark ff n in - if !Db.Slicing.Mark.is_bottom m then + if SlicingMarks.is_bottom_mark m then begin SlicingParameters.debug ~level:3 "[SlicingTransform.Visibility.all_nodes_visible] node %a invisible" @@ -194,7 +168,7 @@ module Visibility (SliceName : sig | _, _ -> key in let m = Fct_slice.get_node_key_mark ff key in - if !Db.Slicing.Mark.is_bottom m then + if SlicingMarks.is_bottom_mark m then begin SlicingParameters.debug ~level:2 "[SlicingTransform.Visibility.data_nodes_visible]@\n\ @@ -420,7 +394,7 @@ module Visibility (SliceName : sig | Isrc _ -> true | Iproto -> false | Iff {slice = ff} -> - let m = !Db.Slicing.Slice.get_mark_from_local_var ff var in + let m = Fct_slice.get_local_var_mark ff var in visible_mark m let res_call_visible ff call_stmt = match ff with @@ -444,7 +418,9 @@ module Visibility (SliceName : sig visible_mark m with Not_found -> false - let called_info (project, ff) call_stmt = + (* _project is left to comply with a module signature defined outside + the slicing module (in filter) *) + let called_info (_project, ff) call_stmt = let info = match ff with | Isrc _ | Iproto -> None | Iff {slice = ff} -> @@ -461,7 +437,7 @@ module Visibility (SliceName : sig | Some (Some (SlicingInternals.CallSlice ff)) -> let kf_ff = SlicingMacros.get_ff_kf ff in (* BY: no idea why this is not the same code as in fct_info *) - let src_visible = is_src_fun_visible project kf_ff in + let src_visible = Fct_slice.is_src_fun_visible kf_ff in let keep_body = keep_body kf_ff in Some (kf_ff, Iff { slice = ff; src_visible; keep_body}) with Not_found -> @@ -483,15 +459,17 @@ let default_slice_names kf _src_visible ff_num = if Kernel_function.equal kf kf_entry then fname else Printf.sprintf "%s_slice_%d" fname ff_num -let extract ~f_slice_names new_proj_name slicing_project = +let extract ~f_slice_names new_proj_name = SlicingParameters.feedback ~level:1 "exporting project to '%s'..." new_proj_name; - !Db.Slicing.Request.apply_all_internal slicing_project; + SlicingParameters.feedback ~level:1 "applying all slicing requests..."; + SlicingProject.apply_all_actions (); + SlicingParameters.feedback ~level:2 "done (applying all slicing requests)."; let module S = struct let get = f_slice_names end in let module Visi = Visibility (S) in let module Transform = Filter.F (Visi) in let tmp_prj = - Transform.build_cil_file (new_proj_name ^ " tmp") slicing_project + Transform.build_cil_file (new_proj_name ^ " tmp") () in let new_prj = !Db.Sparecode.rm_unused_globals ~new_proj_name ~project:tmp_prj () diff --git a/src/plugins/slicing/slicingTransform.mli b/src/plugins/slicing/slicingTransform.mli index 899d0af7996e85da9ef382708fe842762bf65631..8d1bdf205d190bcfebb362088a804eba5c09da2a 100644 --- a/src/plugins/slicing/slicingTransform.mli +++ b/src/plugins/slicing/slicingTransform.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,14 +31,5 @@ val default_slice_names:(Cil_types.kernel_function -> bool -> int -> string) *) val extract : f_slice_names:(Cil_types.kernel_function -> bool -> int -> string) - -> string -> Db.Slicing.Project.t -> Project.t + -> string -> Project.t -(** Return [true] if the source function is called -* (even indirectly via transitivity) from a [Slice.t]. *) -val is_src_fun_called : - Db.Slicing.Project.t -> Cil_types.kernel_function -> bool - -(** Return [true] if the source function is visible -* (even indirectly via transitivity) from a [Slice.t]. *) -val is_src_fun_visible : - Db.Slicing.Project.t -> Cil_types.kernel_function -> bool diff --git a/src/plugins/slicing_types/slicingInternals.ml b/src/plugins/slicing_types/slicingInternals.ml index 2f7b8263fb3260f340707cfe5755b6a3c108bf0c..907bfb44712f555f7eb4b56cf6d739b3c552481c 100644 --- a/src/plugins/slicing_types/slicingInternals.ml +++ b/src/plugins/slicing_types/slicingInternals.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -76,7 +76,6 @@ let compare_pdg_mark p1 p2 = type fct_info = { fi_kf : Cil_types.kernel_function; fi_def : Cil_types.fundec option; - fi_project : project; mutable fi_top : pdg_mark option; (** indicates if the function is marked top (=> src visible) *) mutable fi_level_option : level_option; @@ -132,9 +131,7 @@ and ff_marks = PdgTypes.Pdg.t * marks_index and - project = { name : string ; - application : Project.t ; - functions : fct_info Varinfo.Hashtbl.t; + project = { functions : fct_info Varinfo.Hashtbl.t; mutable actions : criterion list; } @@ -230,15 +227,12 @@ let dummy_pdg_mark = {m1 = Spare ; m2 = Spare } (** The whole project. *) let dummy_project = - { name = ""; - application = Project_skeleton.dummy; - functions = Varinfo.Hashtbl.create 0; + { functions = Varinfo.Hashtbl.create 0; actions = [] } let dummy_fct_info = { fi_kf = Kernel_function.dummy () ; fi_def = None; - fi_project = dummy_project; fi_top = None; fi_level_option = DontSlice; fi_init_marks = None; diff --git a/src/plugins/slicing_types/slicingTypes.ml b/src/plugins/slicing_types/slicingTypes.ml index d8639a98542c3e338acecaf73cffd88caaaa4d1a..9891d4f0740828cd96c4eead01b23f5c1a4e7063 100644 --- a/src/plugins/slicing_types/slicingTypes.ml +++ b/src/plugins/slicing_types/slicingTypes.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -76,10 +76,10 @@ type sl_mark = SlicingInternals.pdg_mark (** {3 For the journalization of values of these types} *) -let pp_sl_project p_caller fmt p = +let pp_sl_project p_caller fmt _p = let pp fmt = - Format.fprintf fmt "@[<hv 2>!Db.Slicing.Project.from_unique_name@;%S@]" - p.SlicingInternals.name + Format.fprintf fmt + "@[<hv 2>Extlib.the@;~exn:Db.Slicing.No_Project@;@[<hv 2>(!Db.Slicing.Project.get_project@;())@]@]" in Type.par p_caller Type.Call fmt pp @@ -91,8 +91,8 @@ module Sl_project = let reprs = [ SlicingInternals.dummy_project ] let name = "SlicingTypes.Sl_project" let internal_pretty_code = pp_sl_project - let varname s = "sl_project_" ^ s.SlicingInternals.name - let mem_project f s = f s.SlicingInternals.application + let varname _s = "sl_project_" + let mem_project = Datatype.never_any_project end) module Sl_select = @@ -112,9 +112,7 @@ module Sl_select = let pp_sl_fct_slice p_caller fmt ff = let pp fmt = Format.fprintf fmt - "@[<hv 2>!Db.Slicing.Slice.from_num_id@;%a@;%a@;%d@]" - (Sl_project.internal_pretty_code Type.Call) - ff.SlicingInternals.ff_fct.SlicingInternals.fi_project + "@[<hv 2>!Db.Slicing.Slice.from_num_id@;%a@;%d@]" (Kernel_function.internal_pretty_code Type.Call) ff.SlicingInternals.ff_fct.SlicingInternals.fi_kf ff.SlicingInternals.ff_id @@ -130,7 +128,7 @@ module Sl_fct_slice = let name = "SlicingTypes.Sl_fct_slice" let reprs = [ dummy_fct_slice ] let internal_pretty_code = pp_sl_fct_slice - let mem_project f x = f x.ff_fct.fi_project.application + let mem_project = Datatype.never_any_project end) let dyn_sl_fct_slice = Sl_fct_slice.ty diff --git a/src/plugins/sparecode/Sparecode.mli b/src/plugins/sparecode/Sparecode.mli index a9dde41fad7c18a0efdc9aa48a10bed879d642f0..84d63fc7ffb46c68504341acd882916cc51c9080 100644 --- a/src/plugins/sparecode/Sparecode.mli +++ b/src/plugins/sparecode/Sparecode.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/sparecode/globs.ml b/src/plugins/sparecode/globs.ml index d7935fb3720bc26648a9b362f7a35014ba44a5f8..ee7098b2120528911de1728c84f29fdb81db1f47 100644 --- a/src/plugins/sparecode/globs.ml +++ b/src/plugins/sparecode/globs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/sparecode/register.ml b/src/plugins/sparecode/register.ml index 4f6fea4b2673849069c9daf60bed3654ca7419fc..7843a0f6b3f3e87a3bdf88df80cc6b2dc16b1e0b 100644 --- a/src/plugins/sparecode/register.ml +++ b/src/plugins/sparecode/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/sparecode/spare_marks.ml b/src/plugins/sparecode/spare_marks.ml index 3f21edc91cdf6b1c1f966f0eaafa97fab861d557..ef3560c18690b3feefd543c1dd44ebc3f3482da1 100644 --- a/src/plugins/sparecode/spare_marks.ml +++ b/src/plugins/sparecode/spare_marks.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/sparecode/spare_marks.mli b/src/plugins/sparecode/spare_marks.mli index f3f9294391071c935f812b1944b699e43c6d8ace..57cb1a366297237b4d360c910789b6dc0808d030 100644 --- a/src/plugins/sparecode/spare_marks.mli +++ b/src/plugins/sparecode/spare_marks.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/sparecode/sparecode_params.ml b/src/plugins/sparecode/sparecode_params.ml index e3368c223b0a5fa0db116040353e057715537e68..3845518548cd73c8a07b18bd861738afe854bba9 100644 --- a/src/plugins/sparecode/sparecode_params.ml +++ b/src/plugins/sparecode/sparecode_params.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -42,11 +42,10 @@ module Annot = module GlobDecl = False(struct - let option_name = "-rm-unused-globals" - let help = ("only remove unused global types and variables "^ - "(automatically done by -sparecode-analysis)") - end) - + let option_name = "-sparecode-rm-unused-globals" + let help = ("only remove unused global types and variables "^ + "(automatically done by -sparecode-analysis)") + end) (* Local Variables: diff --git a/src/plugins/sparecode/sparecode_params.mli b/src/plugins/sparecode/sparecode_params.mli index 194f3611025676a96aaf1074fae1395876564c81..e22c83a5feaf17f98f4ab947d222f4064b0cde0e 100644 --- a/src/plugins/sparecode/sparecode_params.mli +++ b/src/plugins/sparecode/sparecode_params.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/sparecode/transform.ml b/src/plugins/sparecode/transform.ml index e6219ee70c8dade2c6020e467d7100ab2159f082..18f9efaac7acd2ebdfa9b52f50dc7fbab0dc62d4 100644 --- a/src/plugins/sparecode/transform.ml +++ b/src/plugins/sparecode/transform.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -125,7 +125,7 @@ module BoolInfo = struct let called_info (project, _fm) call_stmt = match call_stmt.skind with - | Instr (Call (_, _fexp, _, _)) -> + | Instr (Call (_, _, _, _) | Local_init(_, ConsInit _, _)) -> let called_functions = Db.Value.call_to_kernel_function call_stmt in let call_info = match diff --git a/src/plugins/users/Users.mli b/src/plugins/users/Users.mli index e32bf2419ce007edcbcee77eb77233598c5903e0..701418c2bf426b1cc1068cc59333509c9acad9d8 100644 --- a/src/plugins/users/Users.mli +++ b/src/plugins/users/Users.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/users/users_register.ml b/src/plugins/users/users_register.ml index f43a578ddc33c7717423275f5f7647ef024b85b6..9c67529c356a2f8407db59f1c16e5caf6255dba7 100644 --- a/src/plugins/users/users_register.ml +++ b/src/plugins/users/users_register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/Value.mli b/src/plugins/value/Value.mli index ab5c901eee2076533d05950c1fb5669bc1fe2928..fe45348dd40adb9ab8184ab8b3efb9cf4f688262 100644 --- a/src/plugins/value/Value.mli +++ b/src/plugins/value/Value.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -33,3 +33,4 @@ module Value_results: sig val change_callstacks: (Value_types.callstack -> Value_types.callstack) -> results -> results end + diff --git a/src/plugins/value/alarmset.ml b/src/plugins/value/alarmset.ml index 2f0261569c508afe6f0be3e74529396ef63fc57c..6aac0faaf29c268878a7d2780036260b66e0ee95 100644 --- a/src/plugins/value/alarmset.ml +++ b/src/plugins/value/alarmset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -173,8 +173,8 @@ let exists test ~default = function | AllBut m -> M.exists test m || default Unknown let for_all test ~default = function - | Just m -> M.for_all test m || default True - | AllBut m -> M.for_all test m || default Unknown + | Just m -> M.for_all test m && default True + | AllBut m -> M.for_all test m && default Unknown (* -------------------------------------------------------------------------- @@ -224,33 +224,54 @@ let local_printer: Printer.extensible_printer = let pr_annot = local_printer#code_annotation -let register_alarm ?kf ki alarm status f = +(* Default behaviour: print one alarm per kinstr. *) +module Alarm_key = + Datatype.Pair_with_collections (Cil_datatype.Kinstr) (Alarms) + (struct + let module_name = "Alarm_key" + end) + +module Alarm_cache = + State_builder.Hashtbl (Alarm_key.Hashtbl) (Datatype.Unit) + (struct + let name = "Value_messages.Alarm_cache" + let dependencies = [Db.Value.self] + let size = 35 + end) + +let loc = function + | Cil_types.Kglobal -> (* can occur in case of obscure bugs (already happened) + with wacky initializers. Module Initial_state of + value analysis correctly positions the loc *) + Cil.CurrentLoc.get () + | Cil_types.Kstmt s -> Cil_datatype.Stmt.loc s + +let report_alarm ki annot str = + let loc = loc ki in + let str = + Format.kfprintf + (fun _fmt -> Format.flush_str_formatter ()) + Format.str_formatter + "@[%s.@ %a@]%t" str pr_annot annot Value_util.pp_callstack + in + Value_util.alarm_report ~source:(fst loc) "%s" str + +let register_alarm ki alarm status str = let status = match status with | True -> Property_status.True | False -> Property_status.False_if_reachable | Unknown -> Property_status.Dont_know in let annot, _is_new = - Alarms.register ~loc:(Value_messages.loc ki) ?kf ~status emitter ki alarm + Alarms.register ~loc:(loc ki) ~status emitter ki alarm in - let k = - Format.kfprintf - (fun _fmt -> Format.flush_str_formatter ()) Format.str_formatter - in - let str = f annot k Value_util.pp_callstack in - Value_messages.new_alarm ki alarm status annot str - -type place = At of kinstr | Nowhere + (* Report each alarm only once per analysis. The boolean [is_new] returned + by {{Alarms.register}} is inadequate, as an alarm emitted by another + plugin or by a previous run of Eva would be considered as not new. *) + Alarm_cache.memo (fun (_ki,_alarm) -> report_alarm ki annot str) (ki, alarm) -let do_warn place {a_log; a_call} alarm status str = - match place, a_log with - | At kinstr, true -> - register_alarm kinstr alarm status - (fun annot k -> k "@[%s.@ %a@]%t" str pr_annot annot); - a_call () - | _, _ -> a_call () - -let warn place warn_mode alarm (status:status) = +let emit_alarm kinstr alarm (status:status) = + let register_alarm = register_alarm kinstr alarm status in match alarm with | Alarms.Pointer_comparison (_, e) -> let emit = match Value_parameters.WarnPointerComparison.get () with @@ -259,52 +280,44 @@ let warn place warn_mode alarm (status:status) = | "pointer" -> Cil.isPointerType (Cil.typeOf e) | _ -> assert false in - if emit then - do_warn place warn_mode.defined_logic alarm status "pointer comparison" + if emit then register_alarm "pointer comparison" - | Alarms.Division_by_zero _ -> - do_warn place warn_mode.others alarm status "division by zero" + | Alarms.Division_by_zero _ -> register_alarm "division by zero" | Alarms.Overflow (kind, _, _, _) -> - do_warn place warn_mode.others alarm status - (Format.sprintf "%s" - (match kind with - | Alarms.Signed -> "signed overflow" - | Alarms.Unsigned -> "unsigned overflow" - | Alarms.Signed_downcast -> "signed downcast" - | Alarms.Unsigned_downcast -> "unsigned downcast" - )) + let str = match kind with + | Alarms.Signed -> "signed overflow" + | Alarms.Unsigned -> "unsigned overflow" + | Alarms.Signed_downcast -> "signed downcast" + | Alarms.Unsigned_downcast -> "unsigned downcast" + in + register_alarm str | Alarms.Float_to_int _ -> - do_warn place warn_mode.others alarm status - "overflow in conversion from floating-point to integer" + register_alarm "overflow in conversion from floating-point to integer" | Alarms.Invalid_shift (_, Some _) -> - do_warn place warn_mode.others alarm status - "invalid RHS operand for shift" + register_alarm "invalid RHS operand for shift" | Alarms.Invalid_shift (_, None) -> - do_warn place warn_mode.others alarm status - "invalid LHS operand for left shift" + register_alarm "invalid LHS operand for left shift" | Alarms.Memory_access (_, access_kind) | Alarms.Logic_memory_access (_, access_kind) -> - do_warn place warn_mode.others alarm status - (Format.sprintf "out of bounds %s" - (match access_kind with - | Alarms.For_reading -> "read" | Alarms.For_writing -> "write")) + let access = match access_kind with + | Alarms.For_reading -> "read" + | Alarms.For_writing -> "write" + in + register_alarm (Format.sprintf "out of bounds %s" access) | Alarms.Index_out_of_bound _ -> - do_warn place warn_mode.others alarm status - "accessing out of bounds index" + register_alarm "accessing out of bounds index" | Alarms.Valid_string _ -> - do_warn place warn_mode.defined_logic alarm status - "may not point to a valid string" + register_alarm "may not point to a valid string" | Alarms.Differing_blocks _ -> - do_warn place warn_mode.defined_logic alarm status - "pointer subtraction" + register_alarm "pointer subtraction" | Alarms.Is_nan_or_infinite (_, fkind) -> let sfkind = match fkind with @@ -312,28 +325,22 @@ let warn place warn_mode alarm (status:status) = | Cil_types.FDouble -> "double" | Cil_types.FLongDouble -> "long double" in - do_warn place warn_mode.others alarm status - (Format.sprintf "non-finite %s value" sfkind) + register_alarm (Format.sprintf "non-finite %s value" sfkind) | Alarms.Uninitialized _ -> - do_warn place warn_mode.unspecified alarm status - "accessing uninitialized left-value" + register_alarm "accessing uninitialized left-value" | Alarms.Dangling _ -> - do_warn place warn_mode.unspecified alarm status - "accessing left-value that contains escaping addresses" + register_alarm "accessing left-value that contains escaping addresses" | Alarms.Not_separated _ -> - do_warn place warn_mode.others alarm status - "undefined multiple accesses in expression" + register_alarm "undefined multiple accesses in expression" | Alarms.Overlap _ -> - do_warn place warn_mode.others alarm status - "partially overlapping lvalue assignment" + register_alarm "partially overlapping lvalue assignment" | Alarms.Function_pointer _ -> - do_warn place warn_mode.others alarm status - "pointer to function with incompatible type" + register_alarm "pointer to function with incompatible type" let rec height_expr expr = match expr.enode with @@ -382,19 +389,47 @@ let height_alarm = function let cmp a1 a2 = Datatype.Int.compare (height_alarm (fst a1)) (height_alarm (fst a2)) -let emit do_warn warn_mode = function - | Just m -> - let list = M.bindings m in - let sorted_list = List.sort cmp list in - List.iter (fun (alarm, status) -> - warn do_warn warn_mode alarm status) sorted_list +let emit_alarms kinstr map = + let list = M.bindings map in + let sorted_list = List.sort cmp list in + List.iter (fun (alarm, status) -> emit_alarm kinstr alarm status) sorted_list; + if Alarm_cache.length () >= Value_parameters.StopAtNthAlarm.get () + then begin + Value_parameters.log "Stopping at nth alarm" ; + raise Db.Value.Aborted + end + +let emit kinstr = function + | Just map -> if not (M.is_empty map) then emit_alarms kinstr map (* TODO: use GADT to avoid this assert false ? *) | AllBut _ -> Value_parameters.abort ~current:true ~once:true - "All alarms may arise: abstract state too imprecise to continue the analysis." - -let notify warn_mode alarms = emit Nowhere warn_mode alarms -let emit warn_mode ki alarms = emit (At ki) warn_mode alarms + "All alarms may arise: \ + abstract state too imprecise to continue the analysis." + +let warn_alarm warn_mode = function + | Alarms.Uninitialized _ + | Alarms.Dangling _ + -> warn_mode.unspecified () + | Alarms.Pointer_comparison _ + | Alarms.Valid_string _ + | Alarms.Differing_blocks _ + -> warn_mode.defined_logic () + | Alarms.Division_by_zero _ + | Alarms.Overflow _ + | Alarms.Float_to_int _ + | Alarms.Invalid_shift _ + | Alarms.Memory_access _ + | Alarms.Logic_memory_access _ + | Alarms.Index_out_of_bound _ + | Alarms.Is_nan_or_infinite _ + | Alarms.Not_separated _ + | Alarms.Overlap _ + | Alarms.Function_pointer _ + -> warn_mode.others () + +let notify warn_mode alarms = + iter (fun alarm _status -> warn_alarm warn_mode alarm) alarms (* diff --git a/src/plugins/value/alarmset.mli b/src/plugins/value/alarmset.mli index 8e7f69dd3a4c957760ffbc268e4647f4f2e8a978..4bed0bcd25eb0d2a1e64084fe0a09075f7408abe 100644 --- a/src/plugins/value/alarmset.mli +++ b/src/plugins/value/alarmset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -94,7 +94,7 @@ val iter: (alarm -> status -> unit) -> t -> unit (** Emits the alarms according to the given warn mode, at the given instruction. *) -val emit: CilE.warn_mode -> Cil_types.kinstr -> t -> unit +val emit: Cil_types.kinstr -> t -> unit (** Calls the functions registered in the [warn_mode] according to the set of alarms. *) diff --git a/src/plugins/value/domains/abstract_domain.mli b/src/plugins/value/domains/abstract_domain.mli index 37403ba54711d17cf62db58242ffde7196d45a77..d9e9b95b025300cc2d9f9346adb8eb64945da00e 100644 --- a/src/plugins/value/domains/abstract_domain.mli +++ b/src/plugins/value/domains/abstract_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -98,11 +98,14 @@ module type Lattice = sig (** Inclusion test. *) val join: state -> state -> state (** Semi-lattice structure. *) - val join_and_is_included: state -> state -> state * bool - (** Do both operations simultaneously *) val widen: kernel_function -> stmt -> state -> state -> state (** [widen h t1 t2] is an over-approximation of [join t1 t2]. Assumes [is_included t1 t2] *) + val narrow: state -> state -> state or_bottom + (** Over-approximation of the intersection of two abstract states (called meet + in the literature). Used only to gain some precision when interpreting the + complete behaviors of a function specification. Can be very imprecise + without impeding the analysis: [meet x y = `Value x] is always sound. *) end @@ -160,6 +163,18 @@ module type Queries = sig end +(** Results of an evaluation: the results of all intermediate calculation (the + value of each expression and the location of each lvalue) are cached in a + map. *) +module type Valuation = sig + type t + type value (** Abstract value. *) + type origin (** Origin of abstract values. *) + type loc (** Abstract memory location. *) + val find : t -> exp -> (value, origin) record_val or_top + val fold : (exp -> (value, origin) record_val -> 'a -> 'a) -> t -> 'a -> 'a + val find_loc : t -> lval -> loc record_loc or_top +end (** Transfer function of the domain. *) module type Transfer = sig @@ -217,42 +232,37 @@ module type Transfer = sig - [stmt] is the statement of the call site; - [call] represents the function call and its arguments. - [pre] and [post] are the states before and at the end of the call - respectively. - *) + respectively. *) val finalize_call: stmt -> value call -> pre:state -> post:state -> state or_bottom val approximate_call: stmt -> value call -> state -> state list or_bottom + (** Called on the Frama_C_show_each directives. Prints the internal properties + inferred by the domain in the [state] about the expression [exp]. Can use + the [valuation] resulting from the cooperative evaluation of the + expression. *) + val show_expr: valuation -> state -> Format.formatter -> exp -> unit end -(** Logic evaluation. Temporary API. - TODO: factorization of these functions for generic abstract domain. *) -module type Logic = sig - type state - type eval_env (** Evaluation environment. *) - val env_current_state: eval_env -> state or_bottom - val env_annot: pre:state -> here:state -> unit -> eval_env - val env_pre_f: pre:state -> unit -> eval_env - val env_post_f: pre:state -> post:state -> result:varinfo option -> unit -> eval_env - val eval_predicate: eval_env -> predicate -> Alarmset.status - val reduce_by_predicate: eval_env -> bool -> predicate -> eval_env -end +(** Environment for the logical evaluation of predicates. *) +type 'state logic_environment = { + (** The logic can refer to the states at other points of the program using + labels. [states] associates a state (which can be top) to each label. *) + states: logic_label -> 'state; + (** [result] contains the variable corresponding to \result. It is None when + \result is meaningless. *) + result: varinfo option; +} -(** Results of an evaluation: the results of all intermediate calculation (the - value of each expression and the location of each lvalue) are cached in a - map. *) -module type Valuation = sig - type t - type value (** Abstract value. *) - type origin (** Origin of abstract values. *) - type loc (** Abstract memory location. *) - val find : t -> exp -> (value, origin) record_val or_top - val fold : (exp -> (value, origin) record_val -> 'a -> 'a) -> t -> 'a -> 'a - val find_loc : t -> lval -> loc record_loc or_top -end +(** Value for the initialization of variables. Can be either zero or top. *) +type init_value = Zero | Top + +(* Kind of variable being initialized by initialize_variable_using_type. *) +type init_kind = + Main_Formal | Library_Global | Spec_Return of kernel_function (** Signature for the abstract domains of the analysis. *) module type S = sig @@ -273,19 +283,34 @@ module type S = sig (Valuation: Valuation with type value = value and type origin = origin and type loc = location) - : Transfer with type state = t - and type value = value - and type location = location - and type valuation = Valuation.t - + : Transfer with type state := t + and type value := value + and type location := location + and type valuation := Valuation.t (** {3 Logic } *) - (* TODO: revise this signature. *) - val compute_using_specification: - kinstr -> value call -> funspec -> state -> state list or_bottom + (** Logical evaluation. This API is subject to changes. *) + (* TODO: cooperative evaluation of predicates in the engine. *) + + (** [logic_assign from loc_asgn pre state] applies the effect of the + [assigns ... \from ...] clause [from] to [state]. [pre] is the state + before the assign clauses, in which the terms of the clause are evaluated. + [loc_asgn] is the result of the evaluation of the [assigns] part of [from] + in [pre]. *) + val logic_assign: from -> location -> pre:state -> state -> state + + (** Evaluates a [predicate] to a logical status in the current [state]. + The [logic_environment] contains the states at some labels and the + potential variable for \result. *) + val evaluate_predicate: + state logic_environment -> state -> predicate -> Alarmset.status - include Logic with type state := t + (** [reduce_by_predicate env state pred b] reduces the current [state] by + assuming that the predicate [pred] evaluates to [b]. [env] contains the + states at some labels and the potential variable for \result. *) + val reduce_by_predicate: + state logic_environment -> state -> predicate -> bool -> state or_bottom (** {3 Miscellaneous } *) @@ -303,10 +328,27 @@ module type S = sig val leave_loop: stmt -> state -> state (** Initialization *) + + (** The initial state with which the analysis start. *) val empty: unit -> t - val initialize_var: t -> lval -> location -> (value * bool) or_bottom -> t - val initialize_var_using_type: t -> varinfo -> t - val global_state: unit -> (t or_bottom) option + + (** Introduces the list of global variables in the state. At this point, + these variables are uninitialized: they will be initialized through the + two functions below.*) + val introduce_globals: varinfo list -> t -> t + + (** [initialize_variable lval loc ~initialized init_value state] initializes + the value of the location [loc] of lvalue [lval] in [state] with: + - bits 0 if init_value = Zero; + - any bits if init_value = Top. + The boolean initialized is true if the location is initialized, and false + if the location may be not initialized. *) + val initialize_variable: + lval -> location -> initialized:bool -> init_value -> t -> t + + (** Initializes a variable according to its type. TODO: move some parts + of the cvalue implementation of this function in the generic engine. *) + val initialize_variable_using_type: init_kind -> varinfo -> t -> t (** Mem exec. *) val filter_by_bases: Base.Hptset.t -> t -> t @@ -343,8 +385,13 @@ type 'a structure = 'a Structure.Key_Domain.structure = (** Structure of a domain. *) module type S_with_Structure = sig include S + (** A structure matching the type of the domain. *) val structure : t structure + + (** Category for the messages about the domain. + Must be created through {Value_parameters.register_category}. *) + val log_category : Log.category end (** External interface of a domain, with accessors. @@ -377,17 +424,19 @@ end (** Automatic storage of the states computed during the analysis. *) module type Store = sig type state + val register_global_state: state or_bottom -> unit val register_initial_state: Value_types.callstack -> state -> unit val register_state_before_stmt: Value_types.callstack -> stmt -> state -> unit val register_state_after_stmt: Value_types.callstack -> stmt -> state -> unit + val get_global_state: unit -> state or_bottom val get_initial_state: kernel_function -> state or_bottom val get_initial_state_by_callstack: - kernel_function -> state Value_types.Callstack.Hashtbl.t option + kernel_function -> state Value_types.Callstack.Hashtbl.t or_top_or_bottom val get_stmt_state: stmt -> state or_bottom val get_stmt_state_by_callstack: - after:bool -> stmt -> state Value_types.Callstack.Hashtbl.t option + after:bool -> stmt -> state Value_types.Callstack.Hashtbl.t or_top_or_bottom end (** Full implementation of domains. Automatically built by diff --git a/src/plugins/value/domains/apron/apron_domain.ko.ml b/src/plugins/value/domains/apron/apron_domain.ko.ml index 58f8afa7cd190f3be1266ffbcc703b66e9d34ad8..a1d4e3368bed94b4e6099dc39226d579e78913d8 100644 --- a/src/plugins/value/domains/apron/apron_domain.ko.ml +++ b/src/plugins/value/domains/apron/apron_domain.ko.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/apron/apron_domain.mli b/src/plugins/value/domains/apron/apron_domain.mli index ceed6b7fc6e74471c65a8aab3a7c2514a030a29f..e46d4fcd7399083a07b824c8b8d8e53806d13ef3 100644 --- a/src/plugins/value/domains/apron/apron_domain.mli +++ b/src/plugins/value/domains/apron/apron_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/apron/apron_domain.ok.ml b/src/plugins/value/domains/apron/apron_domain.ok.ml index aa450924e547c6546a5d97b021687054d74c937f..534c378f42ab753febb2b1b066c4b6bdb0cfded6 100644 --- a/src/plugins/value/domains/apron/apron_domain.ok.ml +++ b/src/plugins/value/domains/apron/apron_domain.ok.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -362,6 +362,7 @@ module Make (Man: sig type t val manager: t Manager.t + val name: string val key: t Abstract1.t Abstract_domain.key end) = struct @@ -373,6 +374,7 @@ module Make let man = Man.manager let structure = Abstract_domain.Leaf Man.key + let log_category = dkey let empty_env = Environment.make [||] [||] @@ -383,11 +385,15 @@ module Make struct include Datatype.Undefined type t = state - let name = Manager.get_library man + let name = Manager.get_library Man.manager let reprs = [top] let structural_descr = Structural_descr.t_unknown - let equal = Abstract1.is_eq man + (* Abstract1.is_eq raises an error when the environments of the two + states are incompatible. *) + let equal a b = + Environment.equal (Abstract1.env a) (Abstract1.env b) + && Abstract1.is_eq man a b let hash = Abstract1.hash man @@ -408,6 +414,8 @@ module Make let mem_project = Datatype.never_any_project end ) + let name = Man.name + let is_included = Abstract1.is_leq man let join s1 s2 = @@ -425,9 +433,12 @@ module Make and s2 = Abstract1.change_environment man s2 env false in Abstract1.join man s1 s2 - let join_and_is_included a b = let j = join a b in j, equal j b let widen _kf _stmt s1 s2 = Abstract1.widening man s1 s2 + let narrow s1 s2 = + let s = Abstract1.meet man s1 s2 in + if Abstract1.is_bottom man s then `Bottom else `Value s + type origin = unit let make_eval state = @@ -488,12 +499,16 @@ module Make value, Alarmset.all with | Out_of_Scope _ -> top + (* May happen when evaluating an expression in the GUI, while the states + of Apron have not been saved. In this case, we evaluate in the top + apron state, whose environment raises the Failure exception. *) + | Failure _ -> top let extract_expr _oracle state expr = compute state expr (Cil.typeOf expr) let extract_lval _oracle state lval typ _loc = - let expr = Cil.dummy_exp (Cil_types.Lval lval) in + let expr = Value_util.lval_to_exp lval in compute state expr typ let reduce_further _ _ _ = [] @@ -540,7 +555,7 @@ module Make in Precise_locs.fold aux_ploc loc state - let enter_scope _kf vars state = + let enter_scope vars state = let translate acc varinfo = try translate_varinfo varinfo :: acc with Out_of_Scope _ -> acc @@ -556,36 +571,11 @@ module Make let incr_loop_counter _ state = state let leave_loop _ state = state - let approximate_call call state = - let name = Kernel_function.get_name call.kf in - let state = - if Ast_info.is_frama_c_builtin name || - (name <> "free" && Eval_typ.kf_assigns_only_result_or_volatile call.kf) - then state - else make_top (Abstract1.env state) - in - (* We need to introduce the variable used to model the return code - (even though we do not constrain it), because it will be remove later - by the generic part of the evaluator. *) - let state = match call.return with - | Some vi_ret -> enter_scope call.kf [vi_ret] state - | None -> state - in - `Value [state] - - let compute_using_specification _ call _spec state = - approximate_call call state - module Transfer (Valuation: Abstract_domain.Valuation with type value = value and type loc = location) = struct - type state = t - type value = Main_values.Interval.t - type location = Precise_locs.precise_location - type valuation = Valuation.t - (* make an oracle for the translation Cil->Apron, using the valuation. Translate integer expressions that have been evaluated (which should be all of them if the translation is called on a source expression!) @@ -701,46 +691,41 @@ module Make then Result (`Bottom, Value_types.Cacheable) else Compute (Continue state, true) - let finalize_call _stmt call ~pre:_ ~post = - let kf = call.kf in - let name = Kernel_function.get_name kf in - if Ast_info.is_frama_c_builtin name then begin - if Ast_info.is_cea_dump_function name && - Value_parameters.is_debug_key_enabled dkey - then begin - let l = fst (Cil.CurrentLoc.get ()) in - Value_parameters.result "DUMPING APRON STATE \ - of file %s line %d@.%a" - (Filepath.pretty l.Lexing.pos_fname) l.Lexing.pos_lnum - pretty post; - end; - end; - `Value post - - let approximate_call _stmt call state = approximate_call call state + let finalize_call _stmt _call ~pre:_ ~post = `Value post + + let approximate_call _stmt call state = + let name = Kernel_function.get_name call.kf in + let state = + if Ast_info.is_frama_c_builtin name || + (name <> "free" && Eval_typ.kf_assigns_only_result_or_volatile call.kf) + then state + else make_top (Abstract1.env state) + in + (* We need to introduce the variable used to model the return code + (even though we do not constrain it), because it will be remove later + by the generic part of the evaluator. *) + let state = match call.return with + | Some vi_ret -> enter_scope [vi_ret] state + | None -> state + in + `Value [state] + let show_expr _valuation _state _fmt _expr = () end - type eval_env = state - let env_current_state state = `Value state - let env_annot ~pre:_ ~here () = here - let env_pre_f ~pre () = pre - let env_post_f ~pre:_ ~post ~result:_ () = post - let eval_predicate _ _ = Alarmset.Unknown - let reduce_by_predicate state _ _ = state + let logic_assign _assigns location ~pre:_ state = kill_bases location state + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state let empty () = top - let initialize_var state lval _loc _value = - try - let env = Abstract1.env state in - let var = translate_lval lval in - let env = Environment.add env [|var|] [||] in - Abstract1.change_environment man state env false - with - | Out_of_Scope _ -> state + let introduce_globals vars state = enter_scope vars state + + let enter_scope _kf vars state = enter_scope vars state - let initialize_var_using_type state varinfo = + let initialize_variable _lval _loc ~initialized:_ _init_value state = state + + let initialize_variable_using_type _kind varinfo state = try let var = translate_varinfo varinfo in let env = Abstract1.env state in @@ -753,8 +738,6 @@ module Make with | Out_of_Scope _ -> state - let global_state () = None - let filter_by_bases _ state = state let reuse ~current_input:_ ~previous_output = previous_output @@ -773,28 +756,33 @@ let polka_equalities_key = Structure.Key_Domain.create_key "polka-equalities" module Apron_Octagon = struct type t = Oct.t let manager = Oct.manager_alloc () + let name = "Apron octagon domain" let key = octagon_key end module Apron_Box = struct type t = Box.t let manager = Box.manager_alloc () + let name = "Apron box domain" let key = box_key end module Apron_Polka_Loose = struct type t = Polka.loose Polka.t let manager = Polka.manager_alloc_loose () + let name = "Polka loose polyhedra domain" let key = polka_loose_key end module Apron_Polka_Strict = struct type t = Polka.strict Polka.t let manager = Polka.manager_alloc_strict () + let name = "Polka strict polyhedra domain" let key = polka_strict_key end module Apron_Polka_Equalities = struct type t = Polka.equalities Polka.t let manager = Polka.manager_alloc_equalities () + let name = "Polka linear equalities domain" let key = polka_equalities_key end diff --git a/src/plugins/value/domains/cvalue/builtins.ml b/src/plugins/value/domains/cvalue/builtins.ml index 96f6f61ab97ba951ce91da02aafb9e76ae05b5fc..58a8d9e26aa93d2e031c11585af27587545f425d 100644 --- a/src/plugins/value/domains/cvalue/builtins.ml +++ b/src/plugins/value/domains/cvalue/builtins.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -33,10 +33,10 @@ type use_builtin = Always | OnAuto let table = Hashtbl.create 17 let register_builtin name ?replace f = - Hashtbl.add table name (f, Always); + Hashtbl.replace table name (f, None, Always); match replace with | None -> () - | Some name -> Hashtbl.add table name (f, OnAuto) + | Some fname -> Hashtbl.replace table fname (f, Some name, OnAuto) let () = Db.Value.register_builtin := register_builtin @@ -45,36 +45,93 @@ let () = Db.Value.register_builtin := register_builtin let registered_builtins () = let l = Hashtbl.fold - (fun name (f, u) acc -> if u = Always then (name, f) :: acc else acc) + (fun name (f, _, u) acc -> if u = Always then (name, f) :: acc else acc) table [] in List.sort (fun (name1, _) (name2, _) -> String.compare name1 name2) l let () = Db.Value.registered_builtins := registered_builtins +let builtin_names_and_replacements () = + let stand_alone, replacements = + Hashtbl.fold (fun name (_, replaced_by, _) (acc1, acc2) -> + match replaced_by with + | None -> name :: acc1, acc2 + | Some rep_by -> acc1, (name, rep_by) :: acc2 + ) table ([], []) + in + List.sort String.compare stand_alone, + List.sort (fun (name1, _) (name2, _) -> String.compare name1 name2) replacements + +let () = + Cmdline.run_after_configuring_stage + (fun () -> + if Value_parameters.BuiltinsList.get () then begin + let stand_alone, replacements = builtin_names_and_replacements () in + Log.print_on_output + (fun fmt -> + Format.fprintf fmt "@[*** LIST OF EVA BUILTINS@\n@\n\ + ** Replacements set by -val-builtins-auto:\ + @\n unless otherwise specified, \ + function <f> is replaced by builtin \ + Frama_C_<f>:@\n@\n @[%a@]@]@\n" + (Pretty_utils.pp_list ~sep:",@ " + (fun fmt (name, rep_by) -> + if rep_by = "Frama_C_" ^ name then + Format.fprintf fmt "%s" name + else + Format.fprintf fmt "%s (replaced by: %s)" name rep_by)) + replacements); + Log.print_on_output + (fun fmt -> + Format.fprintf fmt "@\n@[** Full list of builtins \ + (configurable via -val-builtin):@\n\ + @\n @[%a@]@]@\n" + (Pretty_utils.pp_list ~sep:",@ " + Format.pp_print_string) stand_alone); + raise Cmdline.Exit + end) + let find_builtin name = - let f, u = Hashtbl.find table name in + let f, _, u = Hashtbl.find table name in if u = Always then f else raise Not_found let mem_builtin name = - try snd (Hashtbl.find table name) = Always + try + let _, _, u = Hashtbl.find table name in + u = Always with Not_found -> false let () = Db.Value.mem_builtin := mem_builtin - let find_builtin_override kf = let name = try Value_parameters.BuiltinsOverrides.find kf with Not_found -> Kernel_function.get_name kf in try - let f, u = Hashtbl.find table name in + let f, _, u = Hashtbl.find table name in if u = Always || Value_parameters.BuiltinsAuto.get () then Some f else None with Not_found -> None +let warn_definitions_overridden_by_builtins () = + Globals.Functions.iter (fun kf -> + try + let bname = Value_parameters.BuiltinsOverrides.find kf in + if Kernel_function.is_definition kf && + not (Cil.hasAttribute "fc_stdlib" (Kernel_function.get_vi kf).vattr) + then + let fname = Kernel_function.get_name kf in + let source = fst (Kernel_function.get_location kf) in + Value_parameters.warning ~source ~once:true + "function %s: definition will be overridden by %s@ \ + (use '-no-val-warn-builtin-override' to disable this warning)" + fname (if fname = bname then "its builtin" else "builtin " ^ bname) + with Not_found -> () + ) + (* -------------------------------------------------------------------------- *) (* --- Returning a clobbered set --- *) (* -------------------------------------------------------------------------- *) @@ -90,7 +147,7 @@ let clobbered_set_from_ret state ret = else acc in try V.fold_topset_ok aux ret Base.SetLattice.bottom - with V.Error_Top -> Base.SetLattice.top + with Abstract_interp.Error_Top -> Base.SetLattice.top (* -------------------------------------------------------------------------- *) @@ -127,7 +184,9 @@ let warning_gen stmt ~kind ~text = let loc = Cil_datatype.Stmt.loc stmt in let pred = List.hd (Logic_env.find_all_logic_functions "\\warning") in let s = Logic_const.tstring ~loc text in - let np = Logic_const.unamed ~loc (Papp (pred, [], [s])) in + (* We need a label here, to indicate that [\warning] "accesses" the memory + (in its own way). *) + let np = Logic_const.(unamed ~loc (Papp (pred, [here_label], [s]))) in let np = { np with pred_name = [kind] } in let ca = Logic_const.new_code_annotation (AAssert([], np)) in ca diff --git a/src/plugins/value/domains/cvalue/builtins.mli b/src/plugins/value/domains/cvalue/builtins.mli index dd3bfc879c2d5cee854768535f89dff4d718ba8e..5a936a3229c2cb2522f9f15b868887b2476ef80b 100644 --- a/src/plugins/value/domains/cvalue/builtins.mli +++ b/src/plugins/value/domains/cvalue/builtins.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -62,6 +62,12 @@ val emit_alarm: kind:string -> text:string -> bool val fold_emitted_alarms: (Cil_types.stmt -> Cil_datatype.Code_annotation.Set.t -> 'a -> 'a) -> 'a -> 'a +(** Emits warnings for each function definition that will be overridden by an + EVA built-in. + Does not include definitions in the Frama-C stdlib. + @since Phosphorus-20170501-beta1 *) +val warn_definitions_overridden_by_builtins: unit -> unit + (* Local Variables: compile-command: "make -C ../../../../.." diff --git a/src/plugins/value/domains/cvalue/builtins_float.ml b/src/plugins/value/domains/cvalue/builtins_float.ml index eae8117d297e2b6526e8385d3b23825fa5f305cf..1530c6ea1ee6ee7ea5a927c59fd441bc401b3247 100644 --- a/src/plugins/value/domains/cvalue/builtins_float.ml +++ b/src/plugins/value/domains/cvalue/builtins_float.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/builtins_float.mli b/src/plugins/value/domains/cvalue/builtins_float.mli index 0c4cf79de3f3258ce54200289585c7f0c389ea0e..a240f0b5f95a27e5a869c388313cf249dacf9157 100644 --- a/src/plugins/value/domains/cvalue/builtins_float.mli +++ b/src/plugins/value/domains/cvalue/builtins_float.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/builtins_malloc.ml b/src/plugins/value/domains/cvalue/builtins_malloc.ml index 5b3e7281e6f92ee07eb7a532e89280c890419477..dac02f516d702d1fbe2883216742552de084b5fd 100644 --- a/src/plugins/value/domains/cvalue/builtins_malloc.ml +++ b/src/plugins/value/domains/cvalue/builtins_malloc.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,41 +29,26 @@ let dkey = Value_parameters.register_category "malloc" (** {1 Dynamically allocated bases} *) +module Base_hptmap = Hptmap.Make + (Base.Base) + (Value_types.Callstack) + (Hptmap.Comp_unused) + (struct let v = [ [ ] ] end) + (struct let l = [ Ast.self ] end) + module Dynamic_Alloc_Bases = State_builder.Ref - (Base.Hptset) + (Base_hptmap) (struct let dependencies = [Ast.self] (* TODO: should probably depend on Value itself *) let name = "Value.Builtins_malloc.Dynamic_Alloc_Bases" - let default () = Base.Hptset.empty + let default () = Base_hptmap.empty end) let () = Ast.add_monotonic_state Dynamic_Alloc_Bases.self -let register_malloced_base b = - Dynamic_Alloc_Bases.set (Base.Hptset.add b (Dynamic_Alloc_Bases.get ())) - -let malloced_bases () = Dynamic_Alloc_Bases.get () - - (** {1 Auxiliary functions} *) -(* Extracts the minimum/maximum sizes (in bytes) for malloc/realloc, - respecting the bounds of size_t if the information is imprecise. - Note that the value returned for maximum size corresponds to one past - the last valid index. *) -let extract_size sizev_bytes = - try - let sizei_bytes = Cvalue.V.project_ival sizev_bytes in - begin match Ival.min_and_max sizei_bytes with - | Some smin, Some smax -> - assert (Integer.(ge smin zero)); - smin, smax - | _ -> assert false (* Cil invariant: cast to size_t *) - end - with V.Not_based_on_null -> - Integer.zero, (Bit_utils.max_byte_size ()) - (* Remove some parts of the callstack: - Remove the bottom of the call tree until we get to the call site of the call to the first malloc function. The idea is that each of @@ -88,6 +73,36 @@ let call_stack_no_wrappers () = bottom_filter stack ;; +let register_malloced_base ?(stack=call_stack_no_wrappers ()) b = + let stack_without_top = List.tl stack in + Dynamic_Alloc_Bases.set (Base_hptmap.add b stack_without_top (Dynamic_Alloc_Bases.get ())) + +let fold_dynamic_bases (f: Base.t -> Value_types.Callstack.t -> 'a -> 'a) init = + Base_hptmap.fold f (Dynamic_Alloc_Bases.get ()) init + +(* only returns true for bases allocated via alloca() *) +let is_automatically_deallocated base = + match base with + | Base.Allocated (_, Base.Alloca, _) -> true + | _ -> false + +(* Extracts the minimum/maximum sizes (in bytes) for malloc/realloc/calloc, + respecting the bounds of size_t. + Note that the value returned for maximum size corresponds to one past + the last valid index. *) +let extract_size sizev_bytes = + let max = Bit_utils.max_byte_size () in + try + let sizei_bytes = Cvalue.V.project_ival sizev_bytes in + begin match Ival.min_and_max sizei_bytes with + | Some smin, Some smax -> + assert (Integer.(ge smin zero)); + smin, Integer.min smax max + | _ -> assert false (* Cil invariant: cast to size_t *) + end + with V.Not_based_on_null -> (* size is a garbled mix *) + Integer.zero, max + (* Name of the base that will be given to a malloced variable, determined using the callstack. *) let base_name prefix stack = @@ -159,6 +174,7 @@ type typed_size = { (* Guess the intended type for the cell returned by malloc, given [sizev == [size_min .. size_max] (in bytes). We look for [T *v = malloc(foo)], then check that [size_min] and [size_max] are multiples of [sizeof(T)]. + Note that [sizeof(T)] can be zero (e.g. an empty struct). If no information can be found, we use char for the base type. If the size cannot change later ([constant_size]), we also compute the number of elements that are allocated. *) @@ -168,23 +184,28 @@ let guess_intended_malloc_type stack sizev constant_size = let size_min, size_max = extract_size sizev in let nb_elems elem_size = if constant_size && Int.equal size_min size_max - then Some (Int.div size_min elem_size) + then Some (if Int.(equal elem_size zero) then Int.zero + else Int.div size_min elem_size) else None in + let mk_typed_size t = + match Cil.unrollType t with + | TPtr (t, _) when not (Cil.isVoidType t) -> + let s = Int.of_int (Cil.bytesSizeOf t) in + if Int.(equal s zero) || + (Int.equal (Int.rem size_min s) Int.zero && + Int.equal (Int.rem size_max s) Int.zero) + then + { min_bytes = size_min; max_bytes = size_max; + elem_typ = t; nb_elems = nb_elems s } + else raise Exit + | _ -> raise Exit + in try match snd (List.hd stack) with - | Kstmt {skind = Instr (Call (Some lv, _, _, _))} -> begin - match Cil.unrollType (Cil.typeOfLval lv) with - | TPtr (t, _) when not (Cil.isVoidType t) -> - let s = Int.of_int (Cil.bytesSizeOf t) in - if Int.equal (Int.rem size_min s) Int.zero && - Int.equal (Int.rem size_max s) Int.zero - then - { min_bytes = size_min; max_bytes = size_max; elem_typ = t; - nb_elems = nb_elems s } - else raise Exit - | _ -> raise Exit - end + | Kstmt {skind = Instr (Call (Some lv, _, _, _))} -> + mk_typed_size (Cil.typeOfLval lv) + | Kstmt {skind = Instr(Local_init(vi, _, _))} -> mk_typed_size vi.vtype | _ -> raise Exit with Exit | Cil.SizeOfError _ -> (* Default, use char *) { min_bytes = size_min; max_bytes = size_max; elem_typ = Cil.charType; @@ -196,7 +217,7 @@ let guess_intended_malloc_type stack sizev constant_size = imprecise size. This is not a problem in practice, because in C you annot obtain the size of an allocated block, and \block_length handles Allocated variables through their validity. *) -let type_from_nb_elems loc tsize = +let type_from_nb_elems tsize = let typ = tsize.elem_typ in match tsize.nb_elems with | None -> TArray (typ, None, Cil.empty_size_cache (), []) @@ -204,6 +225,7 @@ let type_from_nb_elems loc tsize = if Int.equal Int.one nb then typ else + let loc = Cil.CurrentLoc.get () in let esize_arr = Cil.kinteger64 ~loc nb in (* [nb] fits in size_t *) TArray (typ, Some esize_arr, Cil.empty_size_cache (), []) @@ -223,22 +245,25 @@ let size_sure_valid b = match Base.validity b with ;; (* Create a new offsetmap initialized to [bottom] on the entire allocable - range, with the first [max_alloc] bits uninitialized. *) -let offsm_with_uninit validity max_alloc = + range, with the first [max_alloc] bits set to [v]. + [v] must be an isotropic value. *) +let offsm_with_v v validity max_alloc = let size = Bottom.non_bottom (V_Offsetmap.size_from_validity validity) in let offsm = V_Offsetmap.create_isotropic ~size V_Or_Uninitialized.bottom in + (* max_alloc is -1 when allocating an empty base *) if Int.(lt max_alloc zero) then (* malloc(0) => nothing to uninitialize *) offsm else (* malloc(i > 0) => uninitialize i bytes *) V_Offsetmap.add ~exact:true (Int.zero, max_alloc) - (V_Or_Uninitialized.uninitialized, Int.one, Rel.zero) offsm + (v, Int.one, Rel.zero) offsm -(* add UNINITIALIZED as a possible value for the bits [0..max_valid_bits] of - [base] in [state] *) -let add_uninitialized state base max_valid_bits = +(* add [v] as a possible value for the bits [0..max_valid_bits] of + [base] in [state]. + [v] must be an isotropic value. *) +let add_v v state base max_valid_bits = let validity = Base.validity base in - let offsm = offsm_with_uninit validity max_valid_bits in + let offsm = offsm_with_v v validity max_valid_bits in let new_offsm = try let cur = match Model.find_base_or_default base state with @@ -251,10 +276,13 @@ let add_uninitialized state base max_valid_bits = in Model.add_base base new_offsm state -let wrap_fallible_malloc ret_base orig_state state_after_alloc = +let add_uninitialized = add_v V_Or_Uninitialized.uninitialized +let add_zeroes = add_v (V_Or_Uninitialized.initialized Cvalue.V.singleton_zero) + +let wrap_fallible_malloc ?(returns_null=Value_parameters.MallocReturnsNull.get ()) ret_base orig_state state_after_alloc = let ret = V.inject ret_base Ival.zero in let success = Eval_op.wrap_ptr ret, state_after_alloc in - if Value_parameters.MallocReturnsNull.get () + if returns_null then let failure = Eval_op.wrap_ptr Cvalue.V.singleton_zero, orig_state in [ success ; failure ] @@ -268,15 +296,21 @@ let pp_validity fmt (v1, v2) = (** {1 Malloc} *) -(* Create a new variable of size [sizev], using [stack] to infer a type. - Returns the new base, and its maximum validity. *) -let alloc_abstract stack loc weak prefix sizev = +(* Create a new variable of size [sizev] with deallocation type [deallocation], + using [stack] to infer a type. + Returns the new base, and its maximum validity. + Note that [_state] is not used, but it is present to ensure a compatible + signature with [alloc_by_stack]. *) +let alloc_abstract weak deallocation stack prefix sizev _state = let tsize = guess_intended_malloc_type stack sizev (weak = Strong) in - let type_base = type_from_nb_elems loc tsize in + let type_base = type_from_nb_elems tsize in let var = create_new_var stack prefix type_base weak in Value_parameters.result ~current:true ~once:true - "allocating %svariable %a" - (if weak = Weak then "weak " else "") Printer.pp_varinfo var; + "allocating %svariable %a%s" + (if weak = Weak then "weak " else "") Printer.pp_varinfo var + (if Value_parameters.PrintCallstacks.get () + then (Format.asprintf "@.stack: %a" Value_types.Callstack.pretty stack) + else ""); let size_char = Bit_utils.sizeofchar () in (* Sizes are in bits *) let min_alloc = Int.(pred (mul size_char tsize.min_bytes)) in @@ -287,17 +321,16 @@ let alloc_abstract stack loc weak prefix sizev = (* note that min_alloc may be negative (-1) if the allocated size is 0 *) let weak = match weak with Weak -> true | Strong -> false in let variable_v = Base.create_variable_validity ~weak ~min_alloc ~max_alloc in - let new_base = Base.register_allocated_var var (Base.Variable variable_v) in - register_malloced_base new_base; + let new_base = Base.register_allocated_var var deallocation (Base.Variable variable_v) in + register_malloced_base ~stack new_base; new_base, max_alloc (* Simplest allocation function: a new base each time, of the required size. *) -let alloc_size weak state actuals = +let alloc_fresh ?(prefix="malloc") weak region state actuals = match actuals with - | [exp_size, size, _] -> + | [_, size, _] -> let stack = call_stack_no_wrappers () in - let loc = exp_size.eloc in - let base, max_valid = alloc_abstract stack loc weak "malloc" size in + let base, max_valid = alloc_abstract weak region stack prefix size state in let new_state = add_uninitialized state base max_valid in let c_values = wrap_fallible_malloc base state new_state in { Value_types.c_values = c_values ; @@ -307,9 +340,57 @@ let alloc_size weak state actuals = } | _ -> raise (Builtins.Invalid_nb_of_args 1) -let () = Builtins.register_builtin "Frama_C_alloc_size" (alloc_size Strong) -let () = Builtins.register_builtin "Frama_C_alloc_size_weak" (alloc_size Weak) +let () = Builtins.register_builtin "Frama_C_malloc_fresh" (alloc_fresh Strong Base.Malloc) +let () = Builtins.register_builtin "Frama_C_malloc_fresh_weak" (alloc_fresh Weak Base.Malloc) + +let alloc_size_ok intended_size = + try + let size = Cvalue.V.project_ival intended_size in + let ok_size = + Ival.inject_range (Some Integer.zero) (Some (Bit_utils.max_byte_size ())) + in + if Ival.is_included size ok_size then Alarmset.True + else if Ival.intersects size ok_size then Alarmset.Unknown + else Alarmset.False + with Cvalue.V.Not_based_on_null -> Alarmset.Unknown (* garbled mix in size *) + +(* Generic function used both by [calloc_size] and [calloc_by_stack]. + [calloc_f] is the actual function used (calloc_size or calloc_by_stack). *) +let calloc_abstract calloc_f state actuals = + let stack = call_stack_no_wrappers () in + let nmemb, sizev = + match actuals with + | [(_exp, nmemb, _); (_, size, _)] -> nmemb, size + | _ -> raise (Builtins.Invalid_nb_of_args 2) + in + let alloc_size = Cvalue.V.mul nmemb sizev in + let size_ok = alloc_size_ok alloc_size in + if size_ok <> Alarmset.True then + Value_util.warning_once_current + "calloc out of bounds: assert(nmemb * size <= SIZE_MAX)"; + if size_ok = Alarmset.False then (* size always overflows *) + { Value_types.c_values = [Eval_op.wrap_ptr Cvalue.V.singleton_zero, state]; + c_clobbered = Base.SetLattice.bottom; + c_cacheable = Value_types.NoCacheCallers; + c_from = None; + } + else + let base, max_valid = calloc_f stack "calloc" alloc_size state in + let new_state = add_zeroes state base max_valid in + let returns_null = if size_ok = Alarmset.Unknown then Some true else None in + let c_values = wrap_fallible_malloc ?returns_null base state new_state in + { Value_types.c_values = c_values ; + c_clobbered = Base.SetLattice.bottom; + c_cacheable = Value_types.NoCacheCallers; + c_from = None; + } + +(* Equivalent to [malloc_fresh], but for [calloc]. *) +let calloc_fresh weak state actuals = + calloc_abstract (alloc_abstract weak Base.Malloc) state actuals +let () = Builtins.register_builtin "Frama_C_calloc_fresh" (calloc_fresh Strong) +let () = Builtins.register_builtin "Frama_C_calloc_fresh_weak" (calloc_fresh Weak) (* Variables that have been returned by a call to an allocation function at this callstack. The first allocated variable is at the top of the @@ -330,7 +411,7 @@ let () = Ast.add_monotonic_state MallocedByStack.self let update_variable_validity ?(make_weak=false) base sizev = let size_min, size_max = extract_size sizev in match base with - | Base.Allocated (vi, (Base.Variable variable_v)) -> + | Base.Allocated (vi, _deallocation, (Base.Variable variable_v)) -> if make_weak && (variable_v.Base.weak = false) then mutate_name_to_weak vi; let min_sure_bits = Int.(pred (mul eight size_min)) in @@ -353,7 +434,7 @@ let update_variable_validity ?(make_weak=false) base sizev = base, max_valid_bits | _ -> Value_parameters.fatal "base is not Allocated: %a" Base.pretty base -let alloc_by_stack_aux loc stack sizev prefix state = +let alloc_by_stack_aux region stack prefix sizev state = let max_level = Value_parameters.MallocLevel.get () in let all_vars = try MallocedByStack.find stack @@ -362,7 +443,7 @@ let alloc_by_stack_aux loc stack sizev prefix state = let rec aux nb vars = match vars with | [] -> (* must allocate a new variable *) - let b, _ as r = alloc_abstract stack loc Strong prefix sizev in + let b, _ as r = alloc_abstract Strong region stack prefix sizev state in MallocedByStack.replace stack (all_vars @ [b]); r | b :: q -> @@ -380,52 +461,77 @@ let alloc_by_stack_aux loc stack sizev prefix state = (* For each callstack, the first MallocPrecision.get() are precise fresh distinct locations. The following allocations all return the same base, first strong, then weak, and which is extended as needed. *) -let alloc_by_stack : Db.Value.builtin_sig = fun state actuals-> +let alloc_by_stack ?(prefix="malloc") region ?returns_null : Db.Value.builtin_sig = fun state actuals-> let stack = call_stack_no_wrappers () in - let exp_size, sizev = match actuals with - | [exp,size,_] -> exp, size + let sizev = match actuals with + | [_,size,_] -> size | _ -> raise (Builtins.Invalid_nb_of_args 1) in - let loc = exp_size.eloc in - let base, max_valid = alloc_by_stack_aux loc stack sizev "malloc" state in + let base, max_valid = alloc_by_stack_aux region stack prefix sizev state in let new_state = add_uninitialized state base max_valid in - let c_values = wrap_fallible_malloc base state new_state in + let c_values = wrap_fallible_malloc ?returns_null base state new_state in { Value_types.c_values = c_values ; c_clobbered = Base.SetLattice.bottom; c_from = None; c_cacheable = Value_types.NoCacheCallers } ;; let () = Builtins.register_builtin - ~replace:"malloc" "Frama_C_alloc_by_stack" alloc_by_stack + ~replace:"malloc" "Frama_C_malloc_by_stack" (alloc_by_stack Base.Malloc) +let () = Builtins.register_builtin + ~replace:"__fc_vla_alloc" "Frama_C_vla_alloc_by_stack" + (alloc_by_stack Base.VLA ~returns_null:false) +let () = Builtins.register_builtin + ~replace:"alloca" "Frama_C_alloca" + (alloc_by_stack ~prefix:"alloca" Base.Alloca ~returns_null:false) +(* Equivalent to [alloc_by_stack], but for [calloc]. *) +let calloc_by_stack : Db.Value.builtin_sig = fun state actuals -> + calloc_abstract (alloc_by_stack_aux Base.Malloc) state actuals + +let () = Builtins.register_builtin + ~replace:"calloc" "Frama_C_calloc_by_stack" calloc_by_stack (** {1 Free} *) (* Change all references to bases into ESCAPINGADDR into the given state, and remove those bases from the state entirely when [exact] holds *) let free ~exact bases state = + let changed = ref Locations.Zone.bottom in + (* Uncomment this code to simulate the fact that free "writes" the bases + it deallocates + Base_hptmap.iter (fun b -> + changed := Zone.join !changed (enumerate_bits (loc_of_base b)) + ) bases; *) (* No need to remove the freed bases from the state if [exact] is false, because they must remain for the 'inexact' case *) let state = if exact then Base.Hptset.fold Cvalue.Model.remove_base bases state else state in - let is_the_base_to_free x = Base.Hptset.mem x bases in - let offsetmap_top_addresses_of_locals = - Locals_scoping.offsetmap_top_addresses_of_locals is_the_base_to_free + let escaping = bases in + let on_escaping ~b ~itv ~v:_ = + let z = Locations.Zone.inject b (Int_Intervals.inject_itv itv) in + changed := Locations.Zone.join !changed z in - Locals_scoping.state_top_addresses_of_locals - (fun _ _ -> ()) (* no informative message *) - offsetmap_top_addresses_of_locals ~exact (Locals_scoping.top ()) - state + let within = Base.SetLattice.top in + let state = + Locals_scoping.make_escaping ~exact ~escaping ~on_escaping ~within state + in + let from_changed = + let open Function_Froms in + let m = Memory.(add_binding ~exact empty !changed Deps.bottom) in + { deps_table = m; deps_return = Deps.bottom } + in + state, (from_changed, if exact then !changed else Zone.bottom) let resolve_bases_to_free arg = (* Categorizes the bases in arg *) let f base offset (acc, card, null) = - let allocated_base = Base.Hptset.mem base (malloced_bases ()) in + let allocated_base = Base_hptmap.mem base (Dynamic_Alloc_Bases.get ()) in (* Does arg contain at least one invalid value? *) if (not allocated_base && not (Base.is_null base)) || Ival.contains_non_zero offset + || is_automatically_deallocated base then Value_util.warning_once_current "Wrong free: assert(pass a freeable address)"; (* Collect the bases to remove from the memory state. @@ -472,26 +578,65 @@ let frama_c_free state actuals = c_cacheable = Value_types.Cacheable; } else let strong = card_to_remove <= 1 in - let state = free_aux state ~strong bases_to_remove in + let state, changed = free_aux state ~strong bases_to_remove in { Value_types.c_values = [None, state]; c_clobbered = Base.SetLattice.bottom; - c_from = None; + c_from = Some changed; c_cacheable = Value_types.Cacheable; } | _ -> raise (Builtins.Invalid_nb_of_args 1) let () = Builtins.register_builtin ~replace:"free" "Frama_C_free" frama_c_free +(* built-in for [__fc_vla_free] function. By construction, VLA should always + be mapped to a single base. *) +let frama_c_vla_free state actuals = + match actuals with + | [ _, arg, _] -> + let bases_to_remove, _card_to_remove, _null = resolve_bases_to_free arg in + let state, changed = free_aux state ~strong:true bases_to_remove in + { Value_types.c_values = [None, state]; + c_clobbered = Base.SetLattice.bottom; + c_from = Some changed; + c_cacheable = Value_types.Cacheable; + } + | _ -> raise (Builtins.Invalid_nb_of_args 1) + +let () = + Builtins.register_builtin + ~replace:"__fc_vla_free" "Frama_C_vla_free" frama_c_vla_free + +let free_automatic_bases stack state = + (* free automatic bases that were allocated in the current function *) + let bases_to_free = + Base_hptmap.fold (fun base stack' acc -> + if is_automatically_deallocated base && + Value_types.Callstack.equal stack stack' + then Base.Hptset.add base acc + else acc + ) (Dynamic_Alloc_Bases.get ()) Base.Hptset.empty + in + if Base.Hptset.is_empty bases_to_free then state + else begin + Value_parameters.result ~current:true ~once:true + "freeing automatic bases: %a" Base.Hptset.pretty bases_to_free; + let state', _changed = free_aux state ~strong:true bases_to_free in + (* TODO: propagate 'freed' bases for From? *) + state' + end (** {1 Realloc} *) +(* Note: realloc never fails during read/write operations, hence we can + always ignore the validity of locations. (We craft them ourselves anyway.) + The only possible cause of failure is a pointer that was not malloced. *) + (* Auxiliary function for [realloc], that copies the [size] first bytes of [b] (or less if [b] is too small) in [src_state], then pastes them in [new_base] in [dst_state], which is supposed to be big enough for [size]. This function always perform weak updates, in case multiple bases are copied to [new_base]. *) let realloc_copy_one size ~src_state ~dst_state new_base b = - let with_alarms = CilE.warn_none_mode in let size_char = Bit_utils.sizeofchar () in let size_bits = Integer.mul size size_char in let up = match Base.validity b with @@ -502,11 +647,11 @@ let realloc_copy_one size ~src_state ~dst_state new_base b = in let size_to_copy = Int.min (Int.succ up) size_bits in let src = Location_Bits.inject b Ival.zero in - match Eval_op.copy_offsetmap ~with_alarms src size_to_copy src_state with + match Cvalue.Model.copy_offsetmap src size_to_copy src_state with | `Bottom -> assert false | `Value offsetmap -> if Int.gt size_to_copy Int.zero then - Eval_op.paste_offsetmap ~reducing:false ~with_alarms + Cvalue.Model.paste_offsetmap ~from:offsetmap ~dst_loc:new_base ~size:size_to_copy ~exact:false dst_state else dst_state @@ -518,7 +663,7 @@ let realloc_copy_one size ~src_state ~dst_state new_base b = [null] in its argument. [weak] indicates which type of variable must be created: if [Weak], convergence is ensured using a malloc builtin that converges. If [Strong], a new base is created for each call. *) -let realloc_alloc_copy loc weak bases_to_realloc null_in_arg sizev state = +let realloc_alloc_copy weak bases_to_realloc null_in_arg sizev state = Value_parameters.debug ~dkey "bases_to_realloc: %a" Base.Hptset.pretty bases_to_realloc; assert (not (Model.(equal state bottom || equal state top))); @@ -527,8 +672,8 @@ let realloc_alloc_copy loc weak bases_to_realloc null_in_arg sizev state = let base, max_valid = let prefix = "realloc" in match weak with - | Strong -> alloc_abstract stack loc Strong prefix sizev - | Weak -> alloc_by_stack_aux loc stack sizev prefix state + | Strong -> alloc_abstract Strong Base.Malloc stack prefix sizev state + | Weak -> alloc_by_stack_aux Base.Malloc stack prefix sizev state in (* Make sure that [ret] will be present in the result: we bind it at least to bottom everywhere *) @@ -539,7 +684,7 @@ let realloc_alloc_copy loc weak bases_to_realloc null_in_arg sizev state = let lbases = Base.Hptset.elements bases_to_realloc in let dst_state = (* uninitialized on all reallocated valid bits *) - let offsm = offsm_with_uninit (Base.validity base) max_valid in + let offsm = offsm_with_v V_Or_Uninitialized.uninitialized (Base.validity base) max_valid in let offsm = if null_in_arg then offsm (* In this case, realloc may copy nothing *) else @@ -555,7 +700,7 @@ let realloc_alloc_copy loc weak bases_to_realloc null_in_arg sizev state = (V_Or_Uninitialized.bottom, Int.one, Rel.zero) offsm else offsm in - Eval_op.paste_offsetmap ~reducing:false ~with_alarms:CilE.warn_none_mode + Cvalue.Model.paste_offsetmap ~from:offsm ~dst_loc:loc_bits ~size:(Int.succ max_valid) ~exact:false dst_state in @@ -569,44 +714,43 @@ let realloc_alloc_copy loc weak bases_to_realloc null_in_arg sizev state = (* Auxiliary function for [realloc]. All the bases in [bases] are realloced one by one, plus NULL if [null] holds. This function acts as if we had first made a disjunction on the pointer passed to [realloc]. *) -let realloc_multiple loc state size bases null = +let realloc_multiple state size bases null = (* this function should never be used with weak allocs *) let aux_bases b acc = Base.Hptset.singleton b :: acc in let lbases = Base.Hptset.fold aux_bases bases [] in (* This function reallocates the base [b] alone, but does not free it. We cannot free yet, because [b] would leak in the states corresponding to the variables different from [b]. *) - let realloc_one_base b = realloc_alloc_copy loc Strong b false size state in + let realloc_one_base b = realloc_alloc_copy Strong b false size state in let join (ret1, st1) (ret2, st2) = V.join ret1 ret2, Model.join st1 st2 in let aux_one_base acc b = join (realloc_one_base b) acc in let res = List.fold_left aux_one_base (V.bottom, state) lbases in (* Add another base for realloc(NULL) if needed. *) if null then - join res (realloc_alloc_copy loc Strong Base.Hptset.empty true size state) + join res (realloc_alloc_copy Strong Base.Hptset.empty true size state) else res (* Multiple indicates that existing bases are reallocated into as many new bases. *) let realloc ~multiple state args = match args with - | [ (eptr,ptr,_); (_,size,_) ] -> + | [ (_,ptr,_); (_,size,_) ] -> let (bases, card_ok, null) = resolve_bases_to_free ptr in if card_ok > 0 then - let loc = eptr.eloc in let ret, state = if multiple - then realloc_multiple loc state size bases null - else realloc_alloc_copy loc Weak bases null size state + then realloc_multiple state size bases null + else realloc_alloc_copy Weak bases null size state in (* Maybe the calls above made [ret] weak, and it was among the arguments. In this case, do not free it entirely! *) let weak = Base.Hptset.exists Base.is_weak bases in let strong = card_ok <= 1 && not weak in (* free old bases. *) - let state = free_aux state ~strong bases in + let state, changed = free_aux state ~strong bases in { Value_types.c_values = [Eval_op.wrap_ptr ret, state] ; c_clobbered = Builtins.clobbered_set_from_ret state ret; c_cacheable = Value_types.NoCacheCallers; - c_from = None; + c_from = Some changed; } else (* Invalid call. *) { Value_types.c_values = [] ; @@ -650,9 +794,9 @@ let check_if_base_is_leaked base_to_check state = (* Does not detect leaked cycles within malloc'ed bases. The complexity is very far from being optimal. *) let check_leaked_malloced_bases state _ = - let alloced_bases = malloced_bases () in - Base.Hptset.iter - (fun base -> if check_if_base_is_leaked base state then + let alloced_bases = Dynamic_Alloc_Bases.get () in + Base_hptmap.iter + (fun base _ -> if check_if_base_is_leaked base state then Value_util.warning_once_current "memory leak detected for %a" Base.pretty base) alloced_bases; diff --git a/src/plugins/value/domains/cvalue/builtins_malloc.mli b/src/plugins/value/domains/cvalue/builtins_malloc.mli index 6473a905e5cd7c322bf44abc2312fa9a6123c50e..beccdadd2106c5cf0757a69dd412963645c20c90 100644 --- a/src/plugins/value/domains/cvalue/builtins_malloc.mli +++ b/src/plugins/value/domains/cvalue/builtins_malloc.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,9 +23,22 @@ (** Dynamic allocation related builtins. Most functionality is exported as builtins. *) -val malloced_bases: unit -> Base.Hptset.t -(** All bases that have been dynamically created in the current execution. *) +val fold_dynamic_bases: (Base.t -> Value_types.Callstack.t -> 'a -> 'a) -> 'a -> 'a +(** [fold_dynamic_bases f init] folds [f] to each dynamically allocated base, + with initial accumulator [init]. + Note that this also includes bases created by [alloca] and [VLAs]. *) -val register_malloced_base: Base.t -> unit -(** Should not be used by casual users. *) +val alloc_size_ok: Cvalue.V.t -> Alarmset.status +(* [alloc_size_ok size] checks that [size] represents a valid allocation + size w.r.t. the total address space. [True] means that the requested size is + small enough, [False] that the allocation is guaranteed to fail (because + the size is always greater than SIZE_MAX). *) +val free_automatic_bases: Value_types.Callstack.t -> Cvalue.Model.t -> Cvalue.Model.t +(** Performs the equivalent of [free] for each location that was allocated via + [alloca()] in the current function (as per [Value_util.call_stack ()]). + This function must be called during finalization of a function call. *) + +(**/**) +val register_malloced_base: ?stack:Value_types.Callstack.t -> Base.t -> unit +(* Should not be used by casual users. *) diff --git a/src/plugins/value/domains/cvalue/builtins_misc.ml b/src/plugins/value/domains/cvalue/builtins_misc.ml index 7fc7506f1c6be58e22a33c68de5c70bf012f7bdf..73c30fef7cb5428affa9ae58197dc2b6faba3502 100644 --- a/src/plugins/value/domains/cvalue/builtins_misc.ml +++ b/src/plugins/value/domains/cvalue/builtins_misc.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,8 +20,6 @@ (* *) (**************************************************************************) -open Abstract_interp -open Locations open Value_util @@ -36,17 +34,12 @@ let frama_C_assert state actuals = if Cvalue.V.is_zero arg then do_bottom () else if Cvalue.V.contains_zero arg - then begin - try - let state = - Eval_exprs.reduce_by_cond state - { Eval_exprs.exp = arg_exp ; positive = true } - in - warning_once_current "Frama_C_assert: unknown"; - state - with Eval_exprs.Reduce_to_bottom -> - do_bottom () - end + then begin + let state = !Db.Value.reduce_by_cond state arg_exp true in + if Cvalue.Model.is_reachable state + then (warning_once_current "Frama_C_assert: unknown"; state) + else do_bottom () + end else begin warning_once_current "Frama_C_assert: true"; state @@ -63,62 +56,10 @@ let frama_C_assert state actuals = let () = Builtins.register_builtin "Frama_C_assert" frama_C_assert -let frama_c_bzero state actuals = - if Value_parameters.ValShowProgress.get () then - Value_parameters.feedback "Call to builtin bzero(%a)%t" - pretty_actuals actuals Value_util.pp_callstack; - match actuals with - | [(exp_dst, dst, _); (exp_size, size, _)] -> - let with_alarms = warn_all_quiet_mode () in - let size = - try - let size = Cvalue.V.project_ival size in - Int.mul Int.eight (Ival.project_int size) - with Cvalue.V.Not_based_on_null | Ival.Not_Singleton_Int -> - raise Db.Value.Outside_builtin_possibilities - in - let term_size = Logic_utils.expr_to_term ~cast:true exp_size in - let array_dst = Logic_utils.array_with_range exp_dst term_size in - Valarms.set_syntactic_context (Valarms.SyMemLogic array_dst); - if not (Cvalue.V.cardinal_zero_or_one dst) - then raise Db.Value.Outside_builtin_possibilities; - let left = loc_bytes_to_loc_bits dst - and offsm_repeat = - Cvalue.V_Offsetmap.create_isotropic ~size - (Cvalue.V_Or_Uninitialized.initialized Cvalue.V.singleton_zero) - in - let state = - if Int.gt size Int.zero then - Eval_op.paste_offsetmap ~reducing:false ~with_alarms - ~from:offsm_repeat ~dst_loc:left ~size:size ~exact:true state - else state - in - { Value_types.c_values = [ None, state ] ; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.Cacheable; - } - | _ -> raise (Builtins.Invalid_nb_of_args 3) - -let () = Builtins.register_builtin "Frama_C_bzero" frama_c_bzero - - (* -------------------------------------------------------------------------- *) (* --- Multi-names builtins, not registered in the table --- *) (* -------------------------------------------------------------------------- *) -let dump_state initial_state _ = - let l = fst (Cil.CurrentLoc.get ()) in - Value_parameters.result - "DUMPING STATE of file %s line %d@\n%a\n=END OF DUMP==" - (Filepath.pretty l.Lexing.pos_fname) l.Lexing.pos_lnum - Cvalue.Model.pretty initial_state; - { Value_types.c_values = [None, initial_state]; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.NoCache; - } - module DumpFileCounters = State_builder.Hashtbl (Datatype.String.Hashtbl)(Datatype.Int) (struct let size = 3 @@ -159,29 +100,3 @@ let dump_state_file name initial_state args = c_cacheable = Value_types.NoCache; } - -(* Builtin for Frama_C_show_each family of functions *) -let dump_args name initial_state actuals = - (* Print one argument *) - let pp_one fmt (actual, v, offsm) = - (* YYY: catch pointers to arrays, and print the contents of the array *) - Format.fprintf fmt "@["; - let card = Cvalue.V_Offsetmap.fold_on_values (fun _ n -> n+1) offsm 0 in - if card > 1 (*|| true (* TODO: uninit & co *)*) then begin - let typ = Cil.typeOf actual in - Cvalue.V_Offsetmap.pretty_generic ~typ () fmt offsm; - Eval_op.pretty_stitched_offsetmap fmt typ offsm - end else if card = 0 then (* the value as a Cvalue.V is misleading *) - Format.fprintf fmt "%s" (Unicode.emptyset_string ()) - else - Cvalue.V.pretty fmt v; - Format.fprintf fmt "@]"; - in - let pp = Pretty_utils.pp_list ~pre:"@[<hv>" ~sep:",@ " ~suf:"@]" pp_one in - Value_parameters.result "Called %s(%a)%t" name pp actuals - Value_util.pp_callstack; - { Value_types.c_values = [ None, initial_state] ; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.Cacheable; - } diff --git a/src/plugins/value/domains/cvalue/builtins_misc.mli b/src/plugins/value/domains/cvalue/builtins_misc.mli index 0fecfe7bea32aabda57c813d54cf7b72772adb53..ca1a2e193aa80225323fe2f45fd633cc61cef9bf 100644 --- a/src/plugins/value/domains/cvalue/builtins_misc.mli +++ b/src/plugins/value/domains/cvalue/builtins_misc.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,7 +25,4 @@ (** Builtins with multiple names; the lookup is done using a distinctive prefix *) -(* TODO: move the lookup mechanism into find_builtin *) -val dump_state: Db.Value.builtin_sig -val dump_args: string -> Db.Value.builtin_sig val dump_state_file: string -> Db.Value.builtin_sig diff --git a/src/plugins/value/domains/cvalue/builtins_nonfree.ml b/src/plugins/value/domains/cvalue/builtins_nonfree.ml index e6086eb1dfd5ab1203af263eefbd0fbea6a1d0a6..81c0e81e7d67553012d3d41ce70c68501b584144 100644 --- a/src/plugins/value/domains/cvalue/builtins_nonfree.ml +++ b/src/plugins/value/domains/cvalue/builtins_nonfree.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -52,7 +52,7 @@ let frama_C_is_base_aligned state actuals = with | Found_misaligned_base | Not_found (* from project_ival *) - | Location_Bytes.Error_Top (* from fold_i *) -> + | Abstract_interp.Error_Top (* from fold_i *) -> { Value_types.c_values = [Eval_op.wrap_int Cvalue.V.zero_or_one, state]; c_clobbered = Base.SetLattice.bottom; c_from = None; @@ -74,7 +74,7 @@ let frama_c_offset state actuals = Ival.bottom in Cvalue.V.inject_ival offsets - with Location_Bytes.Error_Top -> + with Abstract_interp.Error_Top -> Value_parameters.error ~current:true "Builtin Frama_C_offset is applied to a value not \ guaranteed to be an address"; @@ -89,6 +89,18 @@ guaranteed to be an address"; let () = register_builtin "Frama_C_offset" frama_c_offset +(* Emission of the "special" preconditions for memcpy/memset, as + Logic_mem_access alarms *) +let warn_read_write rw ~start ~size = + let kinstr = snd (List.hd (Value_util.call_stack ())) in + let term = Logic_utils.array_with_range start size in + let alarm = Alarms.Logic_memory_access (term, rw) in + let alarms = Alarmset.singleton alarm in + Alarmset.emit kinstr alarms + +let warn_read = warn_read_write Alarms.For_reading +let warn_write = warn_read_write Alarms.For_writing + exception Memcpy_result of (Cvalue.Model.t * Function_Froms.froms * Zone.t) exception Indeterminate of V_Or_Uninitialized.t @@ -125,7 +137,6 @@ let frama_c_memcpy state actuals = Value_parameters.feedback ~current:true "Call to builtin memcpy(%a)%t" pretty_actuals actuals Value_util.pp_callstack; let plevel = Value_parameters.ArrayPrecisionLevel.get() in - let with_alarms = warn_all_quiet_mode () in let size = try Cvalue.V.project_ival size with Cvalue.V.Not_based_on_null -> Ival.top (* TODO: use size_t *) @@ -136,9 +147,26 @@ let frama_c_memcpy state actuals = let size_min = Int.mul char_bits min in let right = loc_bytes_to_loc_bits src in let left = loc_bytes_to_loc_bits dst in - let term_size = Logic_utils.expr_to_term ~cast:true exp_size in - let array_src = Logic_utils.array_with_range exp_src term_size in - let array_dst = Logic_utils.array_with_range exp_dst term_size in + let warn_left, warn_right = match max with + | None -> (* unbounded size, warn *) true, true + | Some max -> + let size_max = Int_Base.inject (Int.mul char_bits max) in + let loc_left = make_loc left size_max in + let loc_right = make_loc right size_max in + not (Locations.is_valid ~for_writing:true loc_left), + not (Locations.is_valid ~for_writing:false loc_right) + in + if warn_left || warn_right then begin + let term_size = Logic_utils.expr_to_term ~cast:true exp_size in + if warn_right then warn_read exp_src term_size; + if warn_left then warn_write exp_dst term_size; + end; + (* Remove read-only destinations *) + let left = + if warn_left + then Location_Bits.filter_base (fun b -> not (Base.is_read_only b)) left + else left + in let deps_return = deps_nth_arg 0 in let empty_cfrom = Function_Froms.({ deps_table = Memory.empty; deps_return }) @@ -146,20 +174,19 @@ let frama_c_memcpy state actuals = let precise_copy state = (* First step: copy the bytes we are sure to copy *) if Int.gt size_min Int.zero then begin - Valarms.set_syntactic_context (Valarms.SyMemLogic array_src); - let loc_left = make_loc left (Int_Base.inject size_min) in - match Eval_op.copy_offsetmap ~with_alarms right size_min state with + match Cvalue.Model.copy_offsetmap right size_min state with | `Bottom -> (* Read failed. Source was invalid, but must be read, we stop the analysis *) raise (Memcpy_result (Cvalue.Model.bottom,empty_cfrom,Zone.bottom)) | `Value offsetmap -> + let loc_left = make_loc left (Int_Base.inject size_min) in memcpy_check_indeterminate_offsetmap offsetmap; (* Read succeeded. We write the result *) - Valarms.set_syntactic_context (Valarms.SyMemLogic array_dst); let loc_right = make_loc right (Int_Base.inject size_min) in - let new_state = Eval_op.paste_offsetmap ~with_alarms ~remove_invalid:true - ~reducing:false ~from:offsetmap ~dst_loc:left ~size:size_min - ~exact:true state in + let new_state = + Cvalue.Model.paste_offsetmap + ~from:offsetmap ~dst_loc:left ~size:size_min ~exact:true state + in let (deps_table, sure_zone) = let zone_left = enumerate_valid_bits ~for_writing:true loc_left in let zone_right= enumerate_valid_bits ~for_writing:false loc_right in @@ -199,7 +226,7 @@ let frama_c_memcpy state actuals = to be copied, we use a more precise method (see do_size below). However, in all cases, those locations are used to compute the read and written bits. *) - let range = Ival.inject_top (Some Int.zero) diff Int.zero char_bits in + let range = Ival.inject_interval (Some Int.zero) diff Int.zero char_bits in let size_char = Int_Base.inject char_bits in let loc_right = make_loc (Location_Bits.shift range right) size_char in let loc_left = make_loc (Location_Bits.shift range left) size_char in @@ -226,19 +253,16 @@ let frama_c_memcpy state actuals = (left, right, s, state) else begin (* Copy data between prev_size and s *) - Valarms.set_syntactic_context (Valarms.SyMemLogic array_src); - match Eval_op.copy_offsetmap ~with_alarms right diff state with + match Cvalue.Model.copy_offsetmap right diff state with | `Bottom -> (* This size is completely invalid. The following ones will also be invalid, stop now with current result *) raise (Memcpy_result (state,c_from,sure_zone)) | `Value offsetmap -> memcpy_check_indeterminate_offsetmap offsetmap; - Valarms.set_syntactic_context (Valarms.SyMemLogic array_dst); let new_state = - Eval_op.paste_offsetmap ~with_alarms ~reducing:false - ~remove_invalid:true ~from:offsetmap ~dst_loc:left - ~size:diff ~exact:false state + Cvalue.Model.paste_offsetmap + ~from:offsetmap ~dst_loc:left ~size:diff ~exact:false state in if Db.Value.is_reachable new_state then let diffi = Ival.inject_singleton diff in @@ -262,22 +286,18 @@ let frama_c_memcpy state actuals = (* Too many slices in the size. We read the entire range src+(size_min..size_max-1) in one step, as one byte, and write the result as one byte in dst+(size_min..size_max-1) *) - let alarm, v = (* conflate_bottom=false: we want to copy padding bits *) - Model.find_unspecified ~conflate_bottom:false state loc_right + let v = (* conflate_bottom=false: we want to copy padding bits *) + Model.find_indeterminate ~conflate_bottom:false state loc_right in - if alarm then begin - Valarms.set_syntactic_context (Valarms.SyMemLogic array_src); - Valarms.warn_mem_read with_alarms; - end; begin match v with | V_Or_Uninitialized.C_init_noesc _ -> () | _ -> Value_parameters.result ~dkey ~current:true ~once:true "@[In memcpy@ builtin:@ imprecise@ copy of@ indeterminate@ values@]%t" Value_util.pp_callstack end; - Valarms.set_syntactic_context (Valarms.SyMemLogic array_dst); - let updated_state = Eval_op.add_binding_unspecified ~with_alarms - ~remove_invalid:true ~exact:false new_state loc_left v + let updated_state = + Cvalue.Model.add_indeterminate_binding + ~exact:false new_state loc_left v in (* Beware that all the imprecise sizes may be invalid, in which case [add_binding] will return [Bottom]. In this case, return the @@ -317,128 +337,9 @@ let frama_c_memcpy state actuals = let () = register_builtin ~replace:"memcpy" "Frama_C_memcpy" frama_c_memcpy -(* Reads the [size] bytes between [block] and [block+size-1], and copy - then [length] times, between [block+size] and [block+size*(n+1)-1] - This builtin is incorrect if the size is imprecise (relies on the - declared type of the actual block parameter. This captures the usage that - is done in generated initialization blocks. *) -(* TODO: add Offsetmap.paste_repeated_slices to Offsetmap, and use it - there *) -let frama_c_copy_block state actuals = - if Value_parameters.ValShowProgress.get () then - Value_parameters.feedback ~current:true "Call to builtin copy_block(%a)%t" - pretty_actuals actuals Value_util.pp_callstack; - match actuals with - | [(exp_block, block, _); (exp_size, size,_); (exp_length, length,_)] -> - let bt = Cil.typeOf_pointed (Cil.typeOf exp_block) in - let cell_size = - try Int.of_int (Cil.bytesSizeOf bt) - with Cil.SizeOfError _ -> raise Db.Value.Outside_builtin_possibilities - in - let with_alarms = warn_all_quiet_mode () in - let char_bits = Bit_utils.sizeofchar() in - let size = Cvalue.V.project_ival size in - let size = - try - let min,max = Ival.min_and_max size in - let min = match min with - | None -> cell_size - | Some m -> Int.mul char_bits (Int.max m Int.zero) - in - let max = match max with - | None -> cell_size - | Some m -> Int.mul char_bits (Int.max m Int.zero) - in - (* if we are precise, use the given value. Otherwise, stick with - the computed one. - *) - if Int.equal min max then min else cell_size - with V.Not_based_on_null -> cell_size - in - (* for length, we can have some imprecision. *) - let length_min, length_max = - let length = Cvalue.V.project_ival length in - try - let min,max = Ival.min_and_max length in - let min = match min with - | None -> Int.zero - | Some m -> Int.max m Int.zero - in - let max = match max with - | None -> Int.div (Bit_utils.max_bit_address ()) size - | Some m -> Int.max m Int.zero - in - min,max - with V.Not_based_on_null -> - Int.zero, Int.div (Bit_utils.max_bit_address ()) size - in - let term_size = Logic_utils.expr_to_term ~cast:true exp_size in - let term_length = Logic_utils.expr_to_term ~cast:true exp_length in - let char_length = - Logic_const.term ~loc:Cil_datatype.Location.unknown - (TBinOp(Mult,term_size,term_length)) Linteger - in - let array = Logic_utils.array_with_range exp_block char_length in - Valarms.set_syntactic_context (Valarms.SyMemLogic array); - let start = loc_bytes_to_loc_bits block in - (match Eval_op.copy_offsetmap ~with_alarms start size state with - | `Bottom -> - (* cannot read the first cell to get init value *) - { Value_types.c_values = [ None, Cvalue.Model.bottom]; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.Cacheable; - } - | `Value offsetmap -> - let isize = Ival.inject_singleton size in - (* Write this offsetmap at the other cells of the block. *) - let rec write_one_cell sure_write bound state cell i = - if Int.gt bound i then begin - let state = - Eval_op.paste_offsetmap ~with_alarms ~remove_invalid:true - ~reducing:false ~from:offsetmap ~dst_loc:cell ~size - ~exact:sure_write state - in - let cell = Location_Bits.shift isize cell in - write_one_cell - sure_write bound state cell (Int.add i Int.one) - end else state - in - let cell = Location_Bits.shift isize start in - let is_sure_write = - try - ignore (Location_Bits.find_lonely_key cell); true - with Not_found -> false - in - let state = - write_one_cell is_sure_write length_min state cell Int.one - in - let state = - if Int.gt length_max length_min then begin - let cell = Location_Bits.shift - (* cell is already at index 1. Shift appropriately. *) - (Ival.inject_singleton - (Int.mul size (Int.sub length_min Int.one))) - cell - in - write_one_cell false length_max state cell length_min - end else state - in - { Value_types.c_values = [None, state]; - c_clobbered = Builtins.clobbered_set_from_ret state block; - c_from = None; - c_cacheable = Value_types.Cacheable; - } - ) - | _ -> raise (Builtins.Invalid_nb_of_args 3) - -let () = register_builtin "Frama_C_copy_block" frama_c_copy_block - -(* Implementation of [memset] that accepts imprecise arguments. Assumes - the syntactic context is positioned. *) +(* Implementation of [memset] that accepts imprecise arguments. *) let frama_c_memset_imprecise state dst v size = let size_char = Bit_utils.sizeofchar () in - let with_alarms = warn_all_quiet_mode () in let size_min, size_max_bytes = try let size = Cvalue.V.project_ival size in @@ -463,9 +364,7 @@ let frama_c_memset_imprecise state dst v size = let loc = Location_Bytes.shift shift dst in let loc = loc_bytes_to_loc_bits loc in let loc = make_loc loc (Int_Base.inject size_char) in - let state = - Eval_op.add_binding ~with_alarms - ~remove_invalid:true ~exact:false state loc v in + let state = Cvalue.Model.add_binding ~exact:false state loc v in (state,enumerate_valid_bits ~for_writing:true loc) else (state,Zone.bottom) in @@ -484,8 +383,9 @@ let frama_c_memset_imprecise state dst v size = let vuninit = V_Or_Uninitialized.initialized v in let from = V_Offsetmap.create ~size:sure vuninit ~size_v:size_char in let state = - Eval_op.paste_offsetmap ~with_alarms ~remove_invalid:true - ~reducing:false ~from ~dst_loc:left' ~size:sure ~exact:true new_state in + Cvalue.Model.paste_offsetmap + ~from ~dst_loc:left' ~size:sure ~exact:true new_state + in let sure_loc = make_loc left' (Int_Base.inject sure) in let sure_zone = enumerate_valid_bits ~for_writing:true sure_loc in (state,sure_zone) @@ -545,11 +445,11 @@ let pretty_imprecise_memset_reason fmt = function Format.pp_print_string fmt "size is negative or null" -(* [memset_typ_offsm typ i] returns an offsetmap of size [sizeof(typ)] +(* [memset_typ_offsm exp typ i] returns an offsetmap of size [sizeof(typ)] that maps each byte to the integer [i]. The shape of the type is respected: the fields in [typ] are bound to values of the good type, not just to 'i%repeated modulo 8'. May raise ImpreciseMemset. *) -let memset_typ_offsm_int full_typ i = +let memset_typ_offsm_int exp full_typ i = try let size = Int.of_int (Cil.bitsSizeOf full_typ) in let vi = V_Or_Uninitialized.initialized (Cvalue.V.inject_int i) in @@ -560,17 +460,6 @@ let memset_typ_offsm_int full_typ i = optimally precise *) else let validity = Base.validity_from_size size in - (* no access error to signal here, given the validity we use. However, - we want to be notified of float conversion errors. *) - let alarms_ok = ref true in - let with_alarms = - let not_ok () = alarms_ok := false in { - CilE.others = {CilE.a_ignore with CilE.a_call=not_ok}; - unspecified = {CilE.a_ignore with CilE.a_call=not_ok}; - defined_logic = {CilE.a_ignore with CilE.a_call=not_ok}; - imprecision_tracing = CilE.a_ignore; - } - in let rec aux styp offset offsm = (* Read [full_offsm] between [offset] and [offset+size-1], and return the value stored there. *) @@ -593,17 +482,16 @@ let memset_typ_offsm_int full_typ i = let signed = Bit_utils.is_signed_int_enum_pointer styp in let v, _ok = Cvalue.V.cast ~size ~signed v in update size v - | TFloat (fkind, _) -> + | TFloat _ -> let size = Int.of_int (Cil.bitsSizeOf styp) in let v = V_Or_Uninitialized.get_v (find size) in (* Use reinterpret_float to get a floating point-value when possible: the transfer functions in Ival do not like mismatches - integer/float. BUT catch errors (is_finite) during the conversion, + integer/float. BUT use the original value when alarms are returned, because we prefer having a precise int value instead of a bottom/imprecise float .*) - alarms_ok := true; - let v' = Eval_op.reinterpret_float ~with_alarms fkind v in - if !alarms_ok then update size v' else update size v + let v', alarms = Cvalue_forward.reinterpret exp styp v in + if Alarmset.is_empty alarms then update size v' else update size v | TComp ({ cstruct = true ; cfields = l}, _, _) as tcomp -> (* struct *) let aux_field offsm fi = let field = Field (fi, NoOffset) in @@ -657,19 +545,19 @@ let memset_typ_offsm_int full_typ i = | TNamed _ -> assert false (* unrolled *) in aux full_typ Int.zero full_offsm - with Cil.SizeOfError _ | Int_Base.Error_Top -> + with Cil.SizeOfError _ | Abstract_interp.Error_Top -> raise (ImpreciseMemset ImpreciseTypeSize) (* Type-aware memset on an entire type. Same as [memset_typ_offsm_int], but with a [Cvalue.V] instead of an integer. We accept [-ilevel] different possible values in [v] before falling back to the imprecise memset. May raise {!ImpreciseMemset}. *) -let memset_typ_offsm typ v = +let memset_typ_offsm exp typ v = try let i = V.project_ival v in ignore (Ival.cardinal_less_than i (Ival.get_small_cardinal ())); let aux_i i offsm = - let offsm_i = memset_typ_offsm_int typ i in + let offsm_i = memset_typ_offsm_int exp typ i in match offsm with | None -> Some offsm_i | Some o -> Some (Cvalue.V_Offsetmap.join o offsm_i) @@ -683,8 +571,8 @@ let memset_typ_offsm typ v = raise (ImpreciseMemset ImpreciseValue) (* Precise memset builtin, that requires its arguments to be sufficiently - precise abstract values. Assumes the syntactic context is positioned. *) -let frama_c_memset_precise state dst v (exp_size, size) = + precise abstract values. *) +let frama_c_memset_precise state dst (exp_v, v) (exp_size, size) = try let size_char = Bit_utils.sizeofchar () in (* We want an exact size, Otherwise, we can use the imprecise memset as a @@ -718,7 +606,7 @@ let frama_c_memset_precise state dst v (exp_size, size) = let mo = Bit_utils.MatchSize size_bits in snd (Bit_utils.(find_offset vi_dst.vtype offset_dst_bits mo)) in - let offsm = memset_typ_offsm typ v in + let offsm = memset_typ_offsm exp_v typ v in let dst_loc = Locations.loc_bytes_to_loc_bits dst in let (c_from,dst_zone) = let input = deps_nth_arg 1 in @@ -735,10 +623,9 @@ let frama_c_memset_precise state dst v (exp_size, size) = c_from,dst_zone in let _ = c_from in - let with_alarms = warn_all_quiet_mode () in let state' = - Eval_op.paste_offsetmap ~with_alarms ~remove_invalid:true - ~reducing:false ~from:offsm ~dst_loc ~size:size_bits ~exact:true state + Cvalue.Model.paste_offsetmap + ~from:offsm ~dst_loc ~size:size_bits ~exact:true state in { Value_types.c_values = [Eval_op.wrap_ptr dst, state']; c_clobbered = Base.SetLattice.bottom; @@ -759,21 +646,38 @@ let frama_c_memset state actuals = Value_parameters.feedback ~current:true "Call to builtin memset(%a)%t" pretty_actuals actuals Value_util.pp_callstack; match actuals with - | [(exp_dst, dst, _); (_exp_v, v, _); (exp_size, size, _)] -> + | [(exp_dst, dst, _); (exp_v, v, _); (exp_size, size, _)] -> begin - (* Position syntactic context *) - let term_size = Logic_utils.expr_to_term ~cast:true exp_size in - let array_dst = Logic_utils.array_with_range exp_dst term_size in - Valarms.set_syntactic_context (Valarms.SyMemLogic array_dst); - (* Keep only the first byte of the argument *) + let warn = (* Invalid write? *) + try + match snd (Ival.min_and_max (V.project_ival size)) with + | None -> true (* unbounded size *) + | Some max -> + let char_bits = Bit_utils.sizeofchar() in + let size_max = Int_Base.inject (Int.mul char_bits max) in + let dst = loc_bytes_to_loc_bits dst in + let loc = make_loc dst size_max in + not (Locations.is_valid ~for_writing:true loc) + with V.Not_based_on_null -> true + in + if warn then begin (* Invalid write. Emit a special alarm *) + let term_size = Logic_utils.expr_to_term ~cast:true exp_size in + warn_write exp_dst term_size; + end; + (* Remove read-only destinations *) + let dst = + if warn + then V.filter_base (fun b -> not (Base.is_read_only b)) dst + else dst + in + (* Keep only the first byte of the value argument *) let _, v = Cvalue.V.extract_bits ~topify:Origin.K_Misalign_read ~start:Int.zero ~stop:(Int.pred (Bit_utils.sizeofchar ())) ~size:(Int.of_int (Cil.bitsSizeOfInt IInt)) v in - try - frama_c_memset_precise state dst v (exp_size, size) + try frama_c_memset_precise state dst (exp_v, v) (exp_size, size) with ImpreciseMemset reason -> Value_parameters.debug ~dkey ~current:true "Call to builtin precise_memset(%a) failed; %a%t" @@ -813,32 +717,6 @@ let frama_c_interval_split state actuals = let () = register_builtin "Frama_C_interval_split" frama_c_interval_split -let rec topify_pointed_arguments state args = - match args with - | [] -> state - | (exp_arg,value_arg,_) :: tail -> - let typ = Cil.typeOf_pointed (Cil.typeOf exp_arg) in - let loc_bits = loc_bytes_to_loc_bits value_arg in - let loc = make_loc loc_bits (Int_Base.inject (Integer.of_int (Cil.bitsSizeOf typ))) in - let state = - Eval_op.add_binding ~with_alarms:(warn_all_quiet_mode ()) - ~exact:false state loc V.top_int - in - topify_pointed_arguments state tail - -let frama_c_fscanf state actuals = - match actuals with - | (_,_file,_) :: (_,_format,_) :: tail -> - let state = topify_pointed_arguments state tail in - { Value_types.c_values = [ Eval_op.wrap_int Cvalue.V.top_int, state ]; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.Cacheable; - } - | _ -> raise (Builtins.Invalid_nb_of_args 2) - -let () = register_builtin "fscanf" frama_c_fscanf - (* Transforms a garbled mix into Top_int. Let other values unchanged. Remark: this currently returns an int. Maybe we need multiple versions? *) let frama_c_ungarble state actuals = @@ -862,76 +740,6 @@ let frama_c_ungarble state actuals = let () = register_builtin "Frama_C_ungarble" frama_c_ungarble -(* -------------------------------------------------------------------------- *) -(* --- Variadic calls --- *) -(* -------------------------------------------------------------------------- *) - -(* Tentative code for variadic builtins. Equivalent code is currently in - eval_slevel, just where a function call is treated. The code below does - not work: transforming "va_start(foo, bar)" into "__builtin_va_start(foo)" - cannot work, as "__builtin_va_start" needs to initialize foo... *) - -(* Builtin-in that does nothing for simple "va_foo" macros. We just put - something random into the argument of type va_list *) -let _frama_c_va_nothing builtin state actuals = - if Value_parameters.ValShowProgress.get () then - Value_parameters.feedback "Call to builtin %s(%a)%t" - builtin pretty_actuals actuals Value_util.pp_callstack; - match actuals with - | [ {enode = Lval lv}, v, _] -> - let size = Bit_utils.sizeof (TBuiltin_va_list []) in - let loc = make_loc (loc_bytes_to_loc_bits v) size in - Valarms.set_syntactic_context (Valarms.SyMem lv); - let state = Eval_op.add_binding ~with_alarms:(warn_all_quiet_mode ()) - ~exact:true state loc V.top_int - in - { Value_types.c_values = [ None, state ] ; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.Cacheable; - } - - | _ -> raise (Builtins.Invalid_nb_of_args 1) - -(* -let () = register_builtin "__builtin_va_start" (frama_c_va_nothing "va_start") -let () = register_builtin "__builtin_va_end" (frama_c_va_nothing "va_end") -*) - -(* Builtin for va_arg. Initializes its last argument, but does not map - it the a real variadic value yet. (Variadic arguments of the caller are - not visible at all here) *) -let _frama_c_va_arg state actuals = - if Value_parameters.ValShowProgress.get () then - Value_parameters.feedback "Call to builtin va_arg(%a)%t" - pretty_actuals actuals Value_util.pp_callstack; - match actuals with - [_; ({enode = SizeOf _typ}, vsize, _); (edst, vdst, _)] -> - let size = - try - let i = V.project_ival vsize in - let i = Ival.project_int i in - let ibytes = Integer.mul i (Bit_utils.sizeofchar ()) in - Int_Base.inject ibytes - with V.Not_based_on_null | Ival.Not_Singleton_Int -> - Int_Base.top - in - let loc = make_loc (loc_bytes_to_loc_bits vdst) size in - (* TODO: missing cast to the proper type. *) - Valarms.set_syntactic_context (Valarms.SyMem (Mem edst, NoOffset)); - let state = Eval_op.add_binding ~with_alarms:(warn_all_quiet_mode ()) - ~exact:true state loc V.top_int - in - { Value_types.c_values = [ None, state ] ; - c_clobbered = Base.SetLattice.bottom; - c_from = None; - c_cacheable = Value_types.Cacheable; - } - - | _ -> raise (Builtins.Invalid_nb_of_args 2) - -(* let () = register_builtin "__builtin_va_arg" frama_c_va_arg *) - (* Local Variables: compile-command: "make -C ../../../../.." diff --git a/src/plugins/value/domains/cvalue/builtins_nonfree.mli b/src/plugins/value/domains/cvalue/builtins_nonfree.mli index 74240cc556149f23a4015637039ece6bcca9ecc3..d9fba2abffed44a60d0870afb3e26c3704af1404 100644 --- a/src/plugins/value/domains/cvalue/builtins_nonfree.mli +++ b/src/plugins/value/domains/cvalue/builtins_nonfree.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.ml b/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.ml index 8b9269b0e030eac29b1888e36af6b9283d3ff82d..ee706d0547679aafa80aee6c1fb1f0e4b51e14a9 100644 --- a/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.ml +++ b/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -69,12 +69,12 @@ let pretty_int_range fmt print_ampamp typname lv v = if Int.equal mn mx then begin print_ampamp(); - Format.fprintf fmt "*(%s*)%s == %s" typname lv mn_repr + Format.fprintf fmt "(*(%s*)%s == %s || (printf(\"%%d\\n\", __LINE__), 0))" typname lv mn_repr end else begin let mx_repr = c_string_of_int mx in print_ampamp(); - Format.fprintf fmt "%s <= *(%s*)%s && *(%s*)%s <= %s" + Format.fprintf fmt "((%s <= *(%s*)%s && *(%s*)%s <= %s) || (printf(\"%%d\\n\", __LINE__), 0))" mn_repr typname lv typname lv mx_repr end | _ -> () @@ -92,12 +92,12 @@ let pretty_float_range fmt print_ampamp typname lv v = if Fval.F.equal mn mx then begin print_ampamp(); - Format.fprintf fmt "*(%s*)%s == %a" + Format.fprintf fmt "(*(%s*)%s == %a || (printf(\"%%d\\n\", __LINE__), 0))" typname lv pp_float mn end else begin print_ampamp(); - Format.fprintf fmt "%a <= *(%s*)%s && *(%s*)%s <= %a" + Format.fprintf fmt "((%a <= *(%s*)%s && *(%s*)%s <= %a) || (printf(\"%%d\\n\", __LINE__), 0))" pp_float mn typname lv typname lv pp_float mx; end @@ -123,8 +123,11 @@ let pretty_pointer_assignment fmt typname lv v = if V.cardinal_zero_or_one v then Format.fprintf fmt "*(void * *)%s = %a;\n" lv (pretty_assignment_expression typname) v - else assert false - + else + Kernel.abort ~current:true + "pretty_pointer_assignment expected cardinal zero or one@ \ + for value %a (lv %s);@ \ + (did you forget -val-no-malloc-returns-null?)" Cvalue.V.pretty v lv let types = Hashtbl.create 7;; @@ -176,6 +179,7 @@ let () = "long long", pretty_int_range, pretty_int_assignment] ;; +exception Too_large_to_enumerate let value_pretty cas print_ampamp lv s_bytes fmt v = try @@ -197,7 +201,9 @@ let value_pretty cas print_ampamp lv s_bytes fmt v = if cas then find_typ candidate_types else find_typ_assignment candidate_types - with V.Not_based_on_null -> () + with + | V.Not_based_on_null -> () + | Not_found -> Value_parameters.result "Unknown size %d for %s" s_bytes lv let value_uninit_pretty cas prampamp lv s fmt = function @@ -205,7 +211,6 @@ let value_uninit_pretty cas prampamp lv s fmt = function value_pretty cas prampamp lv s fmt v | _ -> () - let offsetmap_pretty cas name print_ampamp fmt offsm = let pretty_binding (bk,ek) (v, modu, offset) = let iso = V_Or_Uninitialized.is_isotropic v in @@ -220,6 +225,8 @@ let offsetmap_pretty cas name print_ampamp fmt offsm = let start = ref ((Integer.to_int bk) / 8) in let ek = Integer.to_int ek in let ek = ek / 8 in + if ek / step > 1_000_000 (* arbitrary limit *) then + raise Too_large_to_enumerate; while !start + step <= ek do let lv = if !start = 0 @@ -252,13 +259,21 @@ let state_pretty cas fmt m = Model.iter (fun base offs -> match base with - | Base.Allocated (v,_) - | Base.Var(v,_) -> - let name = v.Cil_types.vname in - if name <> "crc32_tab" (* Specialized for Csmith *) - then offsetmap_pretty cas name print_ampamp fmt offs - | _ -> ()) - m + | Base.Allocated (v,_,_) + | Base.Var(v,_) -> + let name = v.Cil_types.vname in + if name <> "crc32_tab" (* Specialized for Csmith *) + then + begin + try offsetmap_pretty cas name print_ampamp fmt offs + with + | Failure _ + | Too_large_to_enumerate -> + Value_parameters.warning "base %s too large, \ + will not print it" name + end + | _ -> ()) + m | Model.Top -> Format.fprintf fmt "1" ); Format.fprintf fmt "@]" @@ -266,24 +281,27 @@ let state_pretty cas fmt m = let pretty_state_as_c_assert = state_pretty true let print_declarations_for_malloc_bases fmt = - let malloced_bases = Builtins_malloc.malloced_bases () in - let pretty_declaration base = + let pretty_declaration base _cs () = match base with + | Base.Allocated (var, _, validity) | Base.Var (var, validity) -> let name = var.Cil_types.vname in let dim = - match validity with - | Base.Known (l,u) when (Int.is_zero l)-> - Int.div (Int.succ u) Int.eight - | _ -> assert false + match validity with + | Base.Known (l,u) when (Int.is_zero l)-> + Int.div (Int.succ u) Int.eight + | Base.Variable { Base.min_alloc; max_alloc } when + Int.(ge min_alloc zero && equal min_alloc max_alloc) -> + Int.div (Int.succ min_alloc) Int.eight + | _ -> Kernel.abort ~current:true "got unexpected validity: %a" + Base.pretty_validity validity in Format.fprintf fmt "char %s[%a];\n" name Int.pretty dim - | _ -> assert false - + | _ -> + Kernel.abort ~current:true "got non-Var, non-Allocated base: %a" + Base.pretty base in - Base.Hptset.iter - pretty_declaration - malloced_bases + Builtins_malloc.fold_dynamic_bases pretty_declaration () let pretty_state_as_c_assignments fmt state = print_declarations_for_malloc_bases fmt ; diff --git a/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.mli b/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.mli index f0bc35faa513774ed80a60340cf6805680c6d7f1..24edb82ec3d37c2f9e6451bc81f1f9b88f342731 100644 --- a/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.mli +++ b/src/plugins/value/domains/cvalue/builtins_nonfree_print_c.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.ml b/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.ml index c5f16e12cbb1157febd4a04cf8eaf50998cb12f6..30247feec812f03a9fb62816a4ce81ee5ea13a50 100644 --- a/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.ml +++ b/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -98,7 +98,7 @@ let watch_hook (stmt, _callstack, states) = let treat ({name_lv = name; loc=loc; v=wa; remaining_count=current; stmts=set} as w) = List.iter (fun state -> - let _, vs = Model.find ~conflate_bottom:false state loc in + let vs = Model.find ~conflate_bottom:false state loc in let watching = match wa with Value v -> diff --git a/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.mli b/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.mli index 4932c81c175e2e54a72af510500b3e597bc3d2ac..8dcb4cbd3de1617e323c4c2f91a66ed3b9388b44 100644 --- a/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.mli +++ b/src/plugins/value/domains/cvalue/builtins_nonfree_watchpoint.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/builtins_string.ml b/src/plugins/value/domains/cvalue/builtins_string.ml index 794e05dc6dbdf59125304e159e4e89caaed6f5c0..48b42b73af02be92d14e157116d4cc9558ae123d 100644 --- a/src/plugins/value/domains/cvalue/builtins_string.ml +++ b/src/plugins/value/domains/cvalue/builtins_string.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -69,7 +69,7 @@ end module VU = Cvalue.V_Or_Uninitialized -(* Init_status describes if a given byte is: +(* Init_status describes if a given char is: - always initialized or maybe uninitialized; - always non-escaping or maybe escaping; - always determinate or maybe indeterminate (out of bounds). *) @@ -124,7 +124,7 @@ module Init_status = struct end module IS = Init_status -(* [FS] (for "found status") resumes, for each byte, whether the searched +(* [FS] (for "found status") resumes, for each char, whether the searched character is present (always/maybe/never/invalid access). Used both for the searched character and the stop character (esp. in strchr). *) @@ -137,9 +137,9 @@ module FS = struct | Bool.Bottom -> Format.fprintf fmt "Invalid" end -(* [byte_status] resumes the initialization and found/not found status - for each byte in the simplified Bytecharmap. *) -module Byte_status = struct +(* [char_status] resumes the initialization and found/not found status + for each char in the simplified Charcharmap. *) +module Char_status = struct type t = { search_st: FS.t; stop_st: FS.t; init_st: IS.t } let bottom = { search_st = FS.bottom; stop_st = FS.bottom; init_st = IS.bottom } let top = { search_st = FS.top; stop_st = FS.top; init_st = IS.top } @@ -153,9 +153,6 @@ module Byte_status = struct init_st = IS.join bs1.init_st bs2.init_st; } let is_included bs1 bs2 = equal (join bs1 bs2) bs2 - let join_and_is_included bs1 bs2 = - let j = join bs1 bs2 in - j, equal j bs2 let narrow bs1 bs2 = { search_st = FS.narrow bs1.search_st bs2.search_st; stop_st = FS.narrow bs1.stop_st bs2.stop_st; @@ -167,38 +164,37 @@ module Byte_status = struct Format.fprintf fmt "{search_st:%a,stop_st:%a,init_st:%a}" FS.pretty bs.search_st FS.pretty bs.stop_st IS.pretty bs.init_st end -module BS = Byte_status +module BS = Char_status -(* Datatype used to construct [Bytecharmap]. *) +(* Datatype used to construct [Charcharmap]. *) module Str_datatype = struct (* Definitions for datatype *) - type t = Byte_status.t - let hash = Byte_status.hash + type t = Char_status.t + let hash = Char_status.hash let name = "Builtins_string.Str_datatype" let rehash = Datatype.identity let structural_descr = Structural_descr.t_abstract - let reprs = [Byte_status.bottom] - let equal t1 t2 = Byte_status.equal t1 t2 + let reprs = [Char_status.bottom] + let equal t1 t2 = Char_status.equal t1 t2 let compare t1 t2 = compare t1 t2 let copy = Datatype.identity let internal_pretty_code = Datatype.undefined - let pretty = Byte_status.pretty + let pretty = Char_status.pretty let varname t = "str_" ^ (Pretty_utils.sfprintf "%a" pretty t) let mem_project _ _ = false end module Str_lattice = struct module M = Datatype.Make(Str_datatype) include M - module BS = Byte_status + module BS = Char_status let join = BS.join let is_included = BS.is_included - let join_and_is_included = BS.join_and_is_included let bottom = BS.bottom let top = BS.top let narrow = BS.narrow end module SL = Str_lattice -module Bytecharmap = Offsetmap.Make_bitwise(Str_lattice) +module Charcharmap = Offsetmap.Make_bitwise(Str_lattice) (* Boolean-like flag to indicate if the built-in is imprecise for the given arguments. A future version may remove this restriction. *) @@ -206,18 +202,20 @@ type imprecise_builtin = | Imprecise | Not_imprecise -(* converts bits to bytes, emitting a warning in case of inexact division. *) -let bytes_of_bits ?inexact i = - if I.(i % eight <> zero) && +let cwidth_to_bytes cwidth = Int.(div cwidth eight) + +(* converts bits to chars, emitting a warning in case of inexact division. *) +let chars_of_bits ~cwidth ?inexact i = + if I.(i % cwidth <> zero) && match inexact with | Some b -> not b | None -> true then (* message for debugging purposes mostly, should not happen *) - Value_parameters.warning "bytes_of_bits: inexact division (%a / 8)" - Int.pretty i; - I.(i / eight) -let bits_of_bytes i = I.(i * eight) -let is_byte_aligned i = I.(i % eight = zero) + Value_parameters.warning "chars_of_bits: inexact division (%a / %a)" + Int.pretty i Int.pretty cwidth; + I.(i / cwidth) +let bits_of_chars ~cwidth i = I.(i * cwidth) +let is_char_aligned ~cwidth i = I.(i % cwidth = zero) -(* Given a value from a bytecharmap, returns its found_status. +(* Given a value from a charcharmap, returns its found_status. Special case for '\0' (more efficient, used by strlen/strnlen). *) let found_status_of_v_zero ival = assert(not (Ival.is_bottom ival)); @@ -226,7 +224,7 @@ let found_status_of_v_zero ival = else FS.Top else FS.False -(* Given a value from a bytecharmap, returns its byte_status. +(* Given a value from a charcharmap, returns its char_status. Searches for the character(s) in [chr] (memchr). *) (* requires [not (Ival.is_bottom ival) *) let found_status_of_v_char chr ival = @@ -271,37 +269,38 @@ let char_zero_bs_of_vu chr vu : BS.t = in { BS.search_st; stop_st; init_st } -(* [add_byte_status validity offsets bs bcm] binds byte status [bs] to +(* [add_char_status validity offsets bs bcm] binds char status [bs] to offsets [offsets] in [bcm]. *) -let add_byte_status ~validity offsets bs bcm = +let add_char_status ~validity offsets bs bcm = let size = Int_Base.one in let exact = true in - match Bytecharmap.add_binding_ival ~validity ~exact offsets ~size bs bcm with + match Charcharmap.add_binding_ival ~validity ~exact offsets ~size bs bcm with | `Bottom -> assert false | `Value m -> m (* [process_range_whole] efficiently processes one entire range of the offsetmap (between [range_start] and [range_end]), but requires its values to be - byte_aligned. Also handles isotropic values. *) -let process_range_whole bs_of_vu_f offsetmap offsm_validity base_size_bytes range_start range_end vu size_bits acc = - let bcm_validity (*validity/8*) = Base.validity_from_size base_size_bytes in + char_aligned. Also handles isotropic values. *) +let process_range_whole ~cwidth bs_of_vu_f offsetmap offsm_validity base_size_chars range_start range_end vu size_bits acc = + let bcm_validity (*validity/cwidth*) = Base.validity_from_size base_size_chars in if I.(size_bits = one) then (* isotropic value *) let bs = bs_of_vu_f vu in let offsets = - Ival.scale_div ~pos:true I.eight + Ival.scale_div ~pos:true cwidth (Ival.inject_range (Some range_start) (Some range_end)) in - add_byte_status ~validity:bcm_validity offsets bs acc + add_char_status ~validity:bcm_validity offsets bs acc else begin let acc = ref acc in - let nb_bytes_val = I.(size_bits / eight) in + let nb_chars_val = I.(size_bits / cwidth) in (* in this range of [nb_repeat+1] values, each composed of - [nb_bytes_val] bytes, write the first byte for each repetition - in the range, then the second byte, then the third, etc. + [nb_chars_val] chars, write the first char for each repetition + in the range, then the second char, then the third, etc. Example: the offsetmap below has three ranges, and we are - processing the second one (each underscore is a byte, values - are separated by vertical bars): + processing the second one (each underscore is a char, values + are separated by vertical bars; cwidth is assumed to be 8, i.e. + non-wide characters): abc? abc? abc? |________| |____|____|____| |____|____| @@ -309,83 +308,83 @@ let process_range_whole bs_of_vu_f offsetmap offsm_validity base_size_bytes rang first_bit last_bit This range has size 8 * 12 = 96 bits, composed of three - repetitions of the bytes "abc?" (where "?" is unknown). + repetitions of the chars "abc?" (where "?" is unknown). The result we want in the end is the following, where 'F' (for False) is "Non" and 'U' (for Unknown) is "Maybe": FFFU FFFU FFFU |________| |____|____|____| |____|____| ^ ^ - for i=0: start_byte stop_byte + for i=0: start_char stop_char ^ ^ - for i=1: start_byte stop_byte + for i=1: start_char stop_char - Each value occupies a single bit of the resulting bytecharmap. - In this example, [size_bits] equals 32, [nb_bytes_val] equals 4, + Each value occupies a single bit of the resulting charcharmap. + In this example, [size_bits] equals 32, [nb_chars_val] equals 4, [range_end] equals [159] (64+95), [range_start] equals [64] (159-95), [nb_repeat] equals 2 (truncated division; - it may be 0 if there are no repetitions), [start_byte] equals - 8, and [stop_byte] equals 16. + it may be 0 if there are no repetitions), [start_char] equals + 8, and [stop_char] equals 16. If nb_repeat is too high (above plevel), the result is automatically approximated. *) - for i = 0 to (Int.to_int nb_bytes_val) - 1 do + for i = 0 to (Int.to_int nb_chars_val) - 1 do let bs = - let cur_start_bits = I.(range_start + (of_int i * eight)) in + let cur_start_bits = I.(range_start + (of_int i * cwidth)) in let offsets = Ival.inject_singleton cur_start_bits in let _, vu = - Cvalue.V_Offsetmap.find ~validity:offsm_validity ~offsets ~size:Int.eight offsetmap + Cvalue.V_Offsetmap.find ~validity:offsm_validity ~offsets ~size:cwidth offsetmap in bs_of_vu_f vu in - let start_byte = I.(of_int i + range_start / eight) in + let start_char = I.(of_int i + range_start / cwidth) in (* nb_repeat is intentionally truncating the division below (may be 0). *) let nb_repeat = I.((range_end - range_start) / size_bits) in - let stop_byte = I.(start_byte + nb_repeat * nb_bytes_val) in + let stop_char = I.(start_char + nb_repeat * nb_chars_val) in let offsets = - Ival.inject_top (Some start_byte) (Some stop_byte) - (Int.rem start_byte nb_bytes_val) nb_bytes_val + Ival.inject_interval (Some start_char) (Some stop_char) + (Int.rem start_char nb_chars_val) nb_chars_val in (* in some cases (notably when the range does not start at remainder 0) offsets may include values beyond the size of the offsetmap, - so they are filtered to avoid [add_byte_status] from trying to + so they are filtered to avoid [add_char_status] from trying to retrieve them and obtaining `Bottom. If the filtered offset is empty, - then [add_byte_status] is not called. *) + then [add_char_status] is not called. *) let filtered_offsets = Ival.backward_comp_int_left Comp.Lt offsets - (Ival.inject_singleton base_size_bytes) + (Ival.inject_singleton base_size_chars) in if not (Ival.is_bottom filtered_offsets) then - acc := add_byte_status ~validity:bcm_validity filtered_offsets bs !acc + acc := add_char_status ~validity:bcm_validity filtered_offsets bs !acc done; !acc end -(* [process_range_bytewise] splits a given offsetmap range into each byte, - and then iterates byte-per-byte. Less efficient than [process_range_whole], - but necessary when the values are not byte-aligned (e.g. due to bitfields). *) -let process_range_bytewise bs_of_vu_f offsetmap offsm_validity base_size_bytes range_start range_end acc = - let bcm_validity (*validity/8*) = Base.validity_from_size base_size_bytes in +(* [process_range_charwise] splits a given offsetmap range into each char, + and then iterates char-per-char. Less efficient than [process_range_whole], + but necessary when the values are not char-aligned (e.g. due to bitfields). *) +let process_range_charwise ~cwidth bs_of_vu_f offsetmap offsm_validity base_size_chars range_start range_end acc = + let bcm_validity (*validity/cwidth*) = Base.validity_from_size base_size_chars in let acc = ref acc in - for i = Int.to_int (bytes_of_bits ~inexact:true range_start) to - Int.to_int (bytes_of_bits ~inexact:true range_end) + for i = Int.to_int (chars_of_bits ~cwidth ~inexact:true range_start) to + Int.to_int (chars_of_bits ~cwidth ~inexact:true range_end) do let bs = - let cur_start_bits = I.(of_int i * eight) in + let cur_start_bits = I.(of_int i * cwidth) in let offsets = Ival.inject_singleton cur_start_bits in let _, vu = - Cvalue.V_Offsetmap.find ~validity:offsm_validity ~offsets ~size:Int.eight offsetmap + Cvalue.V_Offsetmap.find ~validity:offsm_validity ~offsets ~size:cwidth offsetmap in bs_of_vu_f vu in let offsets = Ival.inject_singleton (I.of_int i) in - acc := add_byte_status ~validity:bcm_validity offsets bs !acc + acc := add_char_status ~validity:bcm_validity offsets bs !acc done; !acc -(* Computes a [Bytecharmap.t] from a given base and its offsetmap. - The resulting map associates, to each byte offset in the base, +(* Computes a [Charcharmap.t] from a given base and its offsetmap. + The resulting map associates, to each char offset in the base, a status maybe/must/not indicating whether the searched character can be found at that position. [first_offset_bits] and [last_offset_bits] are an optimization: @@ -393,25 +392,25 @@ let process_range_bytewise bs_of_vu_f offsetmap offsm_validity base_size_bytes r only between these bits. [last_offset_bits] must not be greater than the end of the base ([base_end_bits]). [base_end_bits] is used to compute the base length. *) -let make_bytecharmap bs_of_vu_f base m first_offset_bits last_offset_bits base_end_bits = +let make_charcharmap ~cwidth bs_of_vu_f base m first_offset_bits last_offset_bits base_end_bits = assert Int.(le last_offset_bits base_end_bits); (* [validity] is the validity of the base (original offsetmap), while - [validitybyte] is the validity of the new offsetmap that will be created *) + [validitychar] is the validity of the new offsetmap that will be created *) let validity = Base.validity base in - let base_size_bytes = bytes_of_bits I.(succ base_end_bits) in - let bot = Bytecharmap.create ~size:base_size_bytes SL.bottom (* TODO *) in + let base_size_chars = chars_of_bits ~cwidth I.(succ base_end_bits) in + let bot = Charcharmap.create ~size:base_size_chars SL.bottom (* TODO *) in Cvalue.V_Offsetmap.fold_between ~entire:false (first_offset_bits, last_offset_bits) (fun (range_start, range_end) (vu, size_bits, rel) acc -> - if is_byte_aligned range_start && is_byte_aligned I.(succ range_end) && - ((is_byte_aligned (Obj.magic (*TODO*) rel) && is_byte_aligned size_bits + if is_char_aligned ~cwidth range_start && is_char_aligned ~cwidth I.(succ range_end) && + ((is_char_aligned ~cwidth (Obj.magic (*TODO*) rel) && is_char_aligned ~cwidth size_bits || I.(size_bits = one) )) then (* linear in [size_bits] in some cases, or in [plevel] at most *) - process_range_whole bs_of_vu_f m validity base_size_bytes + process_range_whole ~cwidth bs_of_vu_f m validity base_size_chars range_start range_end vu size_bits acc else (* code with bitfields; linear in the size of the range *) - process_range_bytewise bs_of_vu_f m validity base_size_bytes + process_range_charwise ~cwidth bs_of_vu_f m validity base_size_chars range_start range_end acc ) m bot @@ -634,14 +633,14 @@ module Search_single_offset = struct - [Bottom_val] indicates that no possible solution has been found and the search must stop. The only case where this does not lead to an error is when a limited search (strnlen/memchr) has run out of "fuel" (and should - return the number of searched bytes). *) + return the number of searched chars). *) exception Must_stop of (Int.t * Int.t) option (*bounds*) * FS.t (*Found_status of searched character*) * bool (*maybe_found_stop*) * IS.t (*init status*) exception Maybe_no_fuel of (Int.t * Int.t) option (*bounds*) * bool (*maybe_found_stop*) - * Int.t (*rightmost contiguous valid byte*) + * Int.t (*rightmost contiguous valid char*) * IS.t * bool (*maybe_had_fuel*) exception Bottom_val of (Int.t * Int.t) option @@ -651,10 +650,10 @@ module Search_single_offset = struct (* Initializes the fuel counters, converting unbounded fuel to a sufficiently large (finite) value. *) - let init_fuel_from_n_len n_len max_byte_to_look = + let init_fuel_from_n_len n_len max_char_to_look = (* infinite_fuel is a value sufficiently high that should never reach zero before the iteration ends *) - let infinite_fuel = Int.succ max_byte_to_look in + let infinite_fuel = Int.succ max_char_to_look in match n_len with | None -> None | Some n -> @@ -676,8 +675,8 @@ module Search_single_offset = struct else Some (new_min, new_max) ) fuel - (* [range_start] and [range_end] are in bytes *) - let process_search_in_byte range_start range_end bs acc = + (* [range_start] and [range_end] are in chars *) + let process_search_in_char range_start range_end bs acc = match bs.BS.search_st with | FS.Bottom -> (* this Invalid can only be due to initialization/danglingness; @@ -695,9 +694,9 @@ module Search_single_offset = struct | _ -> (* unbounded or excess min fuel => sure error *) fpf "reached end of base with excess fuel \ - (fuel_left = %a, offset was <N/A>, max_byte_to_look <N/A>): \ + (fuel_left = %a, offset was <N/A>, max_char_to_look <N/A>): \ Bottom_val, acc: %a" pp_opt_int_pair acc.fuel_left - (*Int.pretty offset Int.pretty max_byte_to_look*) pp_acc_t acc; + (*Int.pretty offset Int.pretty max_char_to_look*) pp_acc_t acc; let maybe_found_stop = false in raise (Bottom_val (acc.kars_pos, maybe_found_stop, acc.is, range_start)) @@ -769,16 +768,16 @@ module Search_single_offset = struct (* fuel = None => unbounded fuel (strlen, or strnlen with unbounded argument) fuel = (Some n_min, Some n_max) => - can look only up to [n_max] bytes (does not include offset), - and must look at least [n_min] bytes *) + can look only up to [n_max] chars (does not include offset), + and must look at least [n_min] chars *) (* Performs a left-to-right search starting at a fixed offset. Takes into account a possibly variable and possibly unbounded amount of fuel (search distance). *) - let search bytecharmap offset n_len max_byte_to_look : str_res_t = - fpf "search (single offset): offset: %a, n_len: %a, max_byte_to_look: %a" + let search charcharmap offset n_len max_char_to_look : str_res_t = + fpf "search (single offset): offset: %a, n_len: %a, max_char_to_look: %a" Int.pretty offset (Pretty_utils.pp_opt Ival.pretty) n_len - Int.pretty max_byte_to_look; - let fuel = init_fuel_from_n_len n_len max_byte_to_look in + Int.pretty max_char_to_look; + let fuel = init_fuel_from_n_len n_len max_char_to_look in fpf "search (single offset): init_fuel = %a" pp_opt_int_pair fuel; let init_acc = { kars_pos = None; maybe_found_stop = false; fuel_left = fuel; is = IS.bottom; } @@ -787,30 +786,32 @@ module Search_single_offset = struct (instead of relative ones) during the fold, and only at the end they are converted into relative bounds. *) try + if Int.(lt offset zero) then + raise (Bottom_val (None, false, IS.bottom, offset)); let acc = - Bytecharmap.fold_itv ~direction:`LTR ~entire:false + Charcharmap.fold_itv ~direction:`LTR ~entire:false (fun (range_start, range_end) bs acc -> fpf " fold_itv in search (single offset): range_offsets: \ %a - %a, acc = %a, bs: %a" Int.pretty range_start Int.pretty range_end pp_acc_t acc Str_datatype.pretty bs; - process_search_in_byte range_start range_end bs acc - ) (offset, max_byte_to_look) bytecharmap init_acc + process_search_in_char range_start range_end bs acc + ) (offset, max_char_to_look) charcharmap init_acc in match acc.fuel_left with | Some (min_f, max_f) when I.(min_f = zero) -> (* min fuel has been consumed *) fpf "reached end of base, but no excess fuel acc: %a" pp_acc_t acc; - raise (Maybe_no_fuel (acc.kars_pos, acc.maybe_found_stop, max_byte_to_look, + raise (Maybe_no_fuel (acc.kars_pos, acc.maybe_found_stop, max_char_to_look, acc.is, I.(max_f > zero))) | _ -> (* unbounded or excess fuel, but reached end of base => invalid access *) fpf "reached end of base with excess fuel \ - (fuel_left = %a, offset was %a, max_byte_to_look %a): \ + (fuel_left = %a, offset was %a, max_char_to_look %a): \ Bottom_val, acc: %a" pp_opt_int_pair acc.fuel_left Int.pretty offset - Int.pretty max_byte_to_look pp_acc_t acc; + Int.pretty max_char_to_look pp_acc_t acc; raise (Bottom_val (acc.kars_pos, acc.maybe_found_stop, - acc.is, I.succ max_byte_to_look)) + acc.is, I.succ max_char_to_look)) with | Must_stop (kars_pos, char_fs, maybe_found_stop, is) -> (* certainly found the searched or stopping character, will stop searching *) @@ -826,7 +827,7 @@ module Search_single_offset = struct Maybe_ok (res_ival, ival_of_opt_int_pair kars_pos, char_fs, maybe_found_stop, Non_exhausted, is) | Maybe_no_fuel (kars_pos, maybe_found_stop, rcvb, is, maybe_had_fuel) -> - fpf "Maybe_no_fuel, kars_pos: %a, rightmost contiguous valid byte: %a, \ + fpf "Maybe_no_fuel, kars_pos: %a, rightmost contiguous valid char: %a, \ maybe_had_fuel: %b" pp_opt_int_pair kars_pos Int.pretty rcvb maybe_had_fuel; begin @@ -890,25 +891,25 @@ module Search_single_offset = struct IS.ensure_an_error (IS.join is1 is2)) | Never_ok (is1), Never_ok (is2) -> Never_ok (IS.join is1 is2) - (* Wrapper for [search] which prepares the [max_byte_to_look] + (* Wrapper for [search] which prepares the [max_char_to_look] parameter and joins the result with the accumulator [acc]. - Needed by strnlen, since [last_byte_to_look] may be imprecise due to the + Needed by strnlen, since [last_char_to_look] may be imprecise due to the fact that max(n_len) may be unbounded. *) - let search_and_acc bytecharmap offset ?n_len last_byte_to_look acc = - let actual_last_byte = match n_len with - | None -> (* no change *) last_byte_to_look + let search_and_acc charcharmap offset ?n_len last_char_to_look acc = + let actual_last_char = match n_len with + | None -> (* no change *) last_char_to_look | Some ival -> begin match Ival.max_int ival with - | None -> (* no change *) last_byte_to_look - | Some max_n -> I.(min last_byte_to_look (pred (offset + max_n))) + | None -> (* no change *) last_char_to_look + | Some max_n -> I.(min last_char_to_look (pred (offset + max_n))) end in - fpf "search_and_acc (offset: %a), n_len: {%a}, last_byte_to_look: %a, \ - adjusted last_byte_to_look: %a" Int.pretty offset - (Pretty_utils.pp_opt Ival.pretty) n_len Int.pretty last_byte_to_look - Int.pretty actual_last_byte; - let res = search bytecharmap offset n_len actual_last_byte in + fpf "search_and_acc (offset: %a), n_len: {%a}, last_char_to_look: %a, \ + adjusted last_char_to_look: %a" Int.pretty offset + (Pretty_utils.pp_opt Ival.pretty) n_len Int.pretty last_char_to_look + Int.pretty actual_last_char; + let res = search charcharmap offset n_len actual_last_char in let res' = join_acc acc res in fpf "search_and_acc will return: %a" pp_str_res_t res'; res' @@ -922,7 +923,7 @@ module Search_ranges = struct (* Accumulator for the iterator of [search]. Information about previous/best bounds is necessary due to the possibility of "holes" between ranges. For instance, consider the following - bytecharmap, where T/F/U stands for True/False/Unknown (Must/None/Maybe): + charcharmap, where T/F/U stands for True/False/Unknown (Must/None/Maybe): F U F T U F T |_|_|_|_|_|_|_| @@ -940,7 +941,7 @@ module Search_ranges = struct be incremented), and also (2) what is the length of the *current* sequence of unbroken None/Maybe. Without both these numbers, we cannot know if the current value for [max] should increase (because we are adding yet - another byte range to it) or should stay the same (if we have started a + another char range to it) or should stay the same (if we have started a new sequence which is not yet larger than the largest one previously found). @@ -980,10 +981,10 @@ module Search_ranges = struct is = IS.join acc.is is; prev_es; best_es } (* initializes the accumulator used by the search by ranges *) - let search_init bytecharmap ?n_len last_byte_to_look offset_end : range_acc_t = + let search_init charcharmap ?n_len last_char_to_look offset_end : range_acc_t = match let res = - Search_single_offset.search bytecharmap offset_end n_len last_byte_to_look + Search_single_offset.search charcharmap offset_end n_len last_char_to_look in fpf "search (single offset) returned: %a" pp_str_res_t res; res @@ -1015,7 +1016,7 @@ module Search_ranges = struct make_acc None None None None maybe_found_stop is es es end - (* Performs right-to-left traversal of the Bytecharmap representing the string, + (* Performs right-to-left traversal of the Charcharmap representing the string, accumulating resulting bounds and error messages along the way. *) let search_rtl range_start range_end bs ?n_len acc = let range_len = Int.length range_start range_end in @@ -1135,38 +1136,38 @@ module Search_ranges = struct | Exit -> min_bounds, max_bounds - let search_ptr_imprecise bytecharmap base offset_ival n_len last_byte_to_look = - (* [max_valid_offset_bytes] is the maximum possibly valid offset for + let search_ptr_imprecise ~cwidth charcharmap base offset_ival n_len last_char_to_look = + (* [max_valid_offset_chars] is the maximum possibly valid offset for the base, which is a better upper bound than MAX_INT. *) - let max_valid_offset_bytes = + let max_valid_offset_chars = match Base.valid_range (Base.validity base) with | Base.Invalid_range -> (* should not happen... *) Int.zero | Base.Valid_range opt_itv -> match opt_itv with - | None -> Bit_utils.max_byte_address () + | None -> Int.(div (Bit_utils.max_byte_address ()) (cwidth_to_bytes cwidth)) | Some (_, mx_bits) -> - Int.(div mx_bits eight) (* possible rounding towards zero *) + Int.(div mx_bits cwidth) (* possible rounding towards zero *) in (* TODO: extra precision can be obtained by splitting cases *) match Ival.max_int offset_ival with | None -> let max_res = match n_len with - | None -> max_valid_offset_bytes - | Some len -> Extlib.opt_conv max_valid_offset_bytes (Ival.max_int len) + | None -> max_valid_offset_chars + | Some len -> Extlib.opt_conv max_valid_offset_chars (Ival.max_int len) in let abs_offs = Ival.inject_range (Some I.zero) (Some max_res) in Maybe_ok (abs_offs, abs_offs, FS.top, true, - Maybe_exhausted max_valid_offset_bytes, IS.top) + Maybe_exhausted max_valid_offset_chars, IS.top) | Some max_offset_ival -> (* pre-computed safe upper bound in case it will be used *) let max_unexplored_offset = I.pred max_offset_ival in (* cannot use the maximum length of [n_len] as upper bound, because it is a relative offset *) - let max_res = Int.min max_unexplored_offset max_valid_offset_bytes in + let max_res = Int.min max_unexplored_offset max_valid_offset_chars in let init = Maybe_ok (Ival.bottom, Ival.bottom, FS.False, false, Non_exhausted, IS.bottom) in match Search_single_offset.search_and_acc - bytecharmap max_offset_ival ?n_len last_byte_to_look init + charcharmap max_offset_ival ?n_len last_char_to_look init with | Never_ok _ as res -> if I.(max_offset_ival > zero) then @@ -1185,25 +1186,23 @@ module Search_ranges = struct res | Maybe_ok (_bounds, abs_offs, _char_fs, _maybe_found_stop, _es, _is) -> assert (not (Ival.is_bottom abs_offs)); - let max_res = Extlib.opt_conv max_valid_offset_bytes (Ival.max_int abs_offs) in + let max_res = Extlib.opt_conv max_valid_offset_chars (Ival.max_int abs_offs) in let approx_abs_offs = Ival.inject_range (Some I.zero) (Some max_res) in Maybe_ok (approx_abs_offs, approx_abs_offs, FS.top, true, Maybe_exhausted max_res, IS.top) - (* [search bytecharmap offset_ival offset_start offset_end n_len last_byte_to_look] - searches for a character in [bytecharmap], for all offsets in [offset_ival] + (* [search charcharmap offset_ival offset_start offset_end n_len last_char_to_look] + searches for a character in [charcharmap], for all offsets in [offset_ival] and up to all lengths in [n_len]. - [offset_start], [offset_end] and [last_byte_to_look] are optimizations to + [offset_start], [offset_end] and [last_char_to_look] are optimizations to avoid searching the entire offsetmap. *) - (* last_byte_to_look is [base_len+1] for strlen, + (* last_char_to_look is [base_len+1] for strlen, or [max_offset + max_n] for strnlen. - For strnlen, max_byte_to_look may be adjusted by Search_single.search_and_acc + For strnlen, max_char_to_look may be adjusted by Search_single.search_and_acc to a more precise value. *) - (* [base] is only used to obtain the maximum validity, when the result is - imprecise *) - let search bytecharmap ~ret_rel_offs base offset_ival offset_start offset_end ?n_len last_byte_to_look = + let search ~cwidth charcharmap ~ret_rel_offs base offset_ival offset_start offset_end ?n_len last_char_to_look = fpf "@[by_offset_ival: offset_ival: %a, offset_start: %a, offset_end: %a, \ - last_byte_to_look: %a@]" Ival.pretty offset_ival Int.pretty offset_start - Int.pretty offset_end Int.pretty last_byte_to_look; + last_char_to_look: %a@]" Ival.pretty offset_ival Int.pretty offset_start + Int.pretty offset_end Int.pretty last_char_to_look; let res = match offset_ival with | Ival.Set a -> @@ -1212,9 +1211,9 @@ module Search_ranges = struct Maybe_ok (Ival.bottom, Ival.bottom, FS.False, false, Non_exhausted, IS.bottom) in Array.fold_left (fun acc offset -> - (* for each given offset, adjust [last_byte_to_look] if strnlen *) + (* for each given offset, adjust [last_char_to_look] if strnlen *) let res = Search_single_offset.search_and_acc - bytecharmap offset ?n_len last_byte_to_look acc + charcharmap offset ?n_len last_char_to_look acc in fpf "search with small set, cur offset: %a, res: %a " Int.pretty offset pp_str_res_t res; @@ -1223,32 +1222,47 @@ module Search_ranges = struct | _ -> (* less precise but more efficient version *) (* str functions returning pointers are currently imprecise for ranges *) if not ret_rel_offs then - search_ptr_imprecise bytecharmap base offset_ival n_len last_byte_to_look, Imprecise + search_ptr_imprecise ~cwidth charcharmap base offset_ival n_len last_char_to_look, Imprecise else begin fpf "by_offset_ival: not a small set!"; let init_acc = - search_init bytecharmap ?n_len last_byte_to_look offset_end + search_init charcharmap ?n_len last_char_to_look offset_end in fpf "search_init returned init_acc = %a" pp_acc init_acc; - let res_acc = - Bytecharmap.fold_itv ~direction:`RTL ~entire:false - (fun (range_start, range_end) bs acc -> - search_rtl range_start range_end bs ?n_len acc - ) (offset_start, (I.pred offset_end)) bytecharmap init_acc + let validity_alarm, valid_itv = + Tr_offset.trim_by_validity + Ival.(mul (inject_singleton cwidth) offset_ival) + cwidth (*sizeof(char)*) (Base.validity base) in - fpf "res_acc = %a" pp_acc res_acc; - match res_acc.best_min, res_acc.best_max with - | Some _, Some _ -> - (* for strnlen, adjust bounds according to the [n] argument *) - let (adj_min, adj_max) = - adjust_bounds res_acc.best_min res_acc.best_max n_len + fpf "trim_by_validity (%a, %a) returned = %b, %a" + Int.pretty offset_start Int.pretty offset_end + validity_alarm Tr_offset.pretty valid_itv; + match valid_itv with + | Tr_offset.Invalid -> (* no valid interval *) + let is = { init_acc.is with IS.maybe_indet = true } in + Never_ok is, Not_imprecise + | _ -> + let res_acc = + Charcharmap.fold_itv ~direction:`RTL ~entire:false + (fun (range_start, range_end) bs acc -> + search_rtl range_start range_end bs ?n_len acc + ) (offset_start, (I.pred offset_end)) charcharmap init_acc in - Maybe_ok (Ival.inject_range adj_min adj_max, - (*abs_offs not used by caller*)Ival.top, - (*fs not used by caller*)FS.Top, res_acc.maybe_not_found, - res_acc.best_es, res_acc.is), Not_imprecise - | _, _ -> - Never_ok (res_acc.is), Not_imprecise + fpf "res_acc = %a" pp_acc res_acc; + match res_acc.best_min, res_acc.best_max with + | Some _, Some _ -> + (* for strnlen, adjust bounds according to the [n] argument *) + let (adj_min, adj_max) = + adjust_bounds res_acc.best_min res_acc.best_max n_len + in + let maybe_indet = res_acc.is.IS.maybe_indet || validity_alarm in + Maybe_ok (Ival.inject_range adj_min adj_max, + (*abs_offs not used by caller*)Ival.top, + (*fs not used by caller*)FS.Top, res_acc.maybe_not_found, + res_acc.best_es, { res_acc.is with IS.maybe_indet }), + Not_imprecise + | _, _ -> + Never_ok (res_acc.is), Not_imprecise end in res @@ -1259,7 +1273,7 @@ exception Top_res of Problem.t (* [compute_maybe_invalid] is an optional triple: - [None]: that a definitive error has been found, so don't bother; - - [Some (base_max_sure_byte, base_end_byte, abs_offs)]: + - [Some (base_max_sure_char, base_end_char, abs_offs)]: compute if there may have been an access to offsets past the validity of their bases. *) let compute_problems imprecise is compute_maybe_invalid = @@ -1286,21 +1300,21 @@ let compute_problems imprecise is compute_maybe_invalid = let acc_probs = match compute_maybe_invalid with | None -> (* do not compute *) acc_probs - | Some (base_max_sure_byte, base_end_byte, abs_offs) -> - if Int.lt base_max_sure_byte base_end_byte && + | Some (base_max_sure_char, base_end_char, abs_offs) -> + if Int.lt base_max_sure_char base_end_char && not (Ival.is_bottom abs_offs) then match Ival.max_int abs_offs with | None -> (* unbounded max: other warnings have already been emitted, so omit this one *) acc_probs - | Some max_byte_to_look -> - if Int.(gt max_byte_to_look base_max_sure_byte) then + | Some max_char_to_look -> + if Int.(gt max_char_to_look base_max_sure_char) then Problems.add Problem.Maybe_invalid acc_probs else acc_probs else acc_probs in acc_probs (* Searches base [base+offset_arg], for up to [n_len] characters. *) -let search_by_base bs_of_vu_f ~ret_rel_offs base offset_arg ?n_len state : +let search_by_base ~cwidth bs_of_vu_f ~ret_rel_offs base offset_arg ?n_len state : Ival.t * Ival.t * FS.t * bool * exhausted_status * Problems.t = fpf "base: %a (validity: %a)" Base.pretty base Base.pretty_validity (Base.validity base); @@ -1319,13 +1333,13 @@ let search_by_base bs_of_vu_f ~ret_rel_offs base offset_arg ?n_len state : | Base.Variable var_valid -> var_valid.Base.min_alloc, var_valid.Base.max_alloc | Base.Invalid -> assert false in - let base_end_byte = bytes_of_bits ~inexact:true base_end_bit (*truncated*) in - (* base_max_sure_byte is only used to generate an alarm in case a possibly + let base_end_char = chars_of_bits ~cwidth ~inexact:true base_end_bit (*truncated*) in + (* base_max_sure_char is only used to generate an alarm in case a possibly invalid location may be accessed during search *) - let base_max_sure_byte = bytes_of_bits ~inexact:true base_max_sure_bit in + let base_max_sure_char = chars_of_bits ~cwidth ~inexact:true base_max_sure_bit in let offset_start = Extlib.opt_conv Int.zero (Ival.min_int offset_arg) in - let offset_start_bit = bits_of_bytes offset_start in - let offset_end = Extlib.opt_conv base_end_byte (Ival.max_int offset_arg) in + let offset_start_bit = bits_of_chars ~cwidth offset_start in + let offset_end = Extlib.opt_conv base_end_char (Ival.max_int offset_arg) in let max_bit_to_look = match n_len with | None -> base_end_bit @@ -1333,40 +1347,40 @@ let search_by_base bs_of_vu_f ~ret_rel_offs base offset_arg ?n_len state : begin match Ival.max_int n with | Some max_n -> - (* compute the last byte that is possibly examined; if [max_n] is 0, - the last looked byte is -1 (no byte is examined) *) + (* compute the last char that is possibly examined; if [max_n] is 0, + the last looked char is -1 (no char is examined) *) if I.(max_n = zero) then I.minus_one else - (* look at bytes between [offset_end] and [offset_end+max_n-1] *) - let max_byte_to_look = I.(pred (offset_end + max_n)) in - fpf "max_byte_to_look (before max end_base): \ - %a (offset_end: %a, max_n: %a)" Int.pretty max_byte_to_look + (* look at chars between [offset_end] and [offset_end+max_n-1] *) + let max_char_to_look = I.(pred (offset_end + max_n)) in + fpf "max_char_to_look (before max end_base): \ + %a (offset_end: %a, max_n: %a)" Int.pretty max_char_to_look Int.pretty offset_end Int.pretty max_n; - let max_byte_to_look = Int.min max_byte_to_look base_end_byte in - fpf "max_byte_to_look (after max end_base): %a" - Int.pretty max_byte_to_look; - (* for each byte, bits 0 to 7 are examined *) - I.(bits_of_bytes max_byte_to_look + (of_int 7)) + let max_char_to_look = Int.min max_char_to_look base_end_char in + fpf "max_char_to_look (after max end_base): %a" + Int.pretty max_char_to_look; + (* for each char, bits 0 to (cwidth-1) are examined *) + I.(bits_of_chars ~cwidth max_char_to_look + (pred cwidth)) | None -> (* fallback to base size *) base_end_bit end in fpf "max_bit_to_look: %a" Int.pretty max_bit_to_look; - let max_byte_to_look = bytes_of_bits ~inexact:true max_bit_to_look in - (* adjust max_byte_to_look for strlen() if needed + let max_char_to_look = chars_of_bits ~cwidth ~inexact:true max_bit_to_look in + (* adjust max_char_to_look for strlen() if needed (may look past the end of the base) *) - let max_byte_to_look = - if n_len = None then I.succ max_byte_to_look else max_byte_to_look + let max_char_to_look = + if n_len = None then I.succ max_char_to_look else max_char_to_look in - fpf "max_byte_to_look (adjusted): %a" Int.pretty max_byte_to_look; + fpf "max_char_to_look (adjusted): %a" Int.pretty max_char_to_look; (* convert to str*-specific optimized bitwise offsetmap *) - let bytecharmap = - make_bytecharmap bs_of_vu_f base offsetmap offset_start_bit + let charcharmap = + make_charcharmap ~cwidth bs_of_vu_f base offsetmap offset_start_bit max_bit_to_look base_end_bit in - fpf "bytecharmap: %a" Bytecharmap.pretty bytecharmap; + fpf "charcharmap: %a" Charcharmap.pretty charcharmap; let res, imprecise = - Search_ranges.search bytecharmap ~ret_rel_offs base offset_arg - offset_start offset_end ?n_len max_byte_to_look + Search_ranges.search ~cwidth charcharmap ~ret_rel_offs base offset_arg + offset_start offset_end ?n_len max_char_to_look in fpf "by_offset_ival returned: %a" pp_str_res_t res; match res with @@ -1382,7 +1396,7 @@ let search_by_base bs_of_vu_f ~ret_rel_offs base offset_arg ?n_len state : else let problems = compute_problems imprecise is - (Some (base_max_sure_byte, base_end_byte, abs_offs)) + (Some (base_max_sure_char, base_end_char, abs_offs)) in (bounds, abs_offs, char_fs, maybe_found_stop, es, problems) @@ -1393,12 +1407,12 @@ let search_by_base bs_of_vu_f ~ret_rel_offs base offset_arg ?n_len state : Otherwise, it is called once with a non-singleton interval. [acc_res] and [acc_probs] contain the accumulated result and list of warnings. *) -let search_by_base_wrapper bs_of_vu_f ~ret_rel_offs state base offs ?n_ival ~include_exh () : +let search_by_base_wrapper ~cwidth bs_of_vu_f ~ret_rel_offs state base offs ?n_ival ~include_exh () : Base_res.t = fpf "fold base(%a, offset %a)" Base.pretty base Ival.pretty offs; let (vals, abs_offs, char_fs, maybe_not_found, es, problems) = - search_by_base ~ret_rel_offs bs_of_vu_f base offs state ?n_len:n_ival + search_by_base ~cwidth ~ret_rel_offs bs_of_vu_f base offs state ?n_len:n_ival in let vals' = if include_exh && ret_rel_offs then match es with @@ -1446,7 +1460,7 @@ let search_by_base_wrapper bs_of_vu_f ~ret_rel_offs state base offs ?n_ival ~inc [name] is the built-in name (used for error messages), [n_ival] is used for built-ins having a length argument. May raise [Top_res]. *) -let search_char_n bs_of_vu_f ~ret_rel_offs name state ?n ~include_exh str : bm_res_t = +let search_char_n ~cwidth bs_of_vu_f ~ret_rel_offs name state ?n ~include_exh str : bm_res_t = try let str_map = match str with @@ -1456,39 +1470,45 @@ let search_char_n bs_of_vu_f ~ret_rel_offs name state ?n ~include_exh str : bm_r | Location_Bytes.Map m -> m in let offs_map = basemap_of_locmap str_map in - let search_f = search_by_base_wrapper bs_of_vu_f state in + let search_f = search_by_base_wrapper ~cwidth bs_of_vu_f state in let bm_res = match n with | None -> BaseMap.mapi - (fun base offs -> search_f ~ret_rel_offs base offs ~include_exh:false ()) offs_map + (fun base offs -> + let norm_offs = Ival.(scale_div ~pos:false (cwidth_to_bytes cwidth) offs) in + search_f ~ret_rel_offs base norm_offs ~include_exh:false ()) offs_map | Some n' -> let n_ival_all = Cvalue.V.project_ival n' in match n_ival_all with | Ival.Set n_vals -> (* small set: compute a precise result for each value and join then *) BaseMap.mapi (fun base offs -> + let norm_offs = Ival.(scale_div ~pos:false (cwidth_to_bytes cwidth) offs) in Array.fold_left (fun acc_br cur_n -> let cur_n = Ival.inject_singleton cur_n in let base_res = - search_f ~ret_rel_offs base offs ~n_ival:cur_n ~include_exh () + search_f ~ret_rel_offs base norm_offs ~n_ival:cur_n ~include_exh () in Base_res.join acc_br base_res ) Base_res.bottom n_vals ) offs_map | Ival.Top _ -> BaseMap.mapi (fun base offs -> - search_f ~ret_rel_offs base offs ~n_ival:n_ival_all ~include_exh () + let norm_offs = Ival.(scale_div ~pos:false (cwidth_to_bytes cwidth) offs) in + search_f ~ret_rel_offs base norm_offs ~n_ival:n_ival_all ~include_exh () ) offs_map | Ival.Float _ -> (*should not happen*) - raise (Invalid_argument "n argument contains float") + Value_parameters.error + "float (%a) value in str" Ival.pretty n_ival_all; + raise Db.Value.Aborted in bm_res with | Cvalue.V.Not_based_on_null (* from project_ival on argument [n] *) -> raise (Top_res (Problem.Misc ("assert(no address in second argument of " ^ name ^ ")"))) - | Ival.Error_Top -> + | Abstract_interp.Error_Top -> raise (Top_res (Problem.Misc "Ival.Error_Top")) (* Computes an offset from a list of pairs (base, offset). @@ -1619,26 +1639,14 @@ type str_builtin_sig = (according to [has_char] and [has_n]), calls [search_char_n], computes the result and the alarms, and produces the output (according to [is_ret_pointer]). Does not emit the produced alarms. *) -let search_char_n_wrapper name nb_args str_builtin_type ~has_n ~is_ret_pointer state args = +let search_char_n_wrapper ~cwidth name nb_args str_builtin_type ~has_n ~is_ret_pointer state args = (* prepare auxiliary function *) let eval_op_wrapper = if is_ret_pointer then Eval_op.wrap_ptr else Eval_op.wrap_size_t in try let (et_str, str) = List.nth args 0 in - let has_char, bs_of_vu_f = - match str_builtin_type with - | Search_zero_stop_zero -> - false, zero_zero_bs_of_vu - | Search_char_stop_char -> - let (_exp_chr, chr) = List.nth args 1 in - let chr_ival = Cvalue.V.project_ival chr in - true, char_char_bs_of_vu chr_ival - | Search_char_stop_zero -> - let (_exp_chr, chr) = List.nth args 1 in - let chr_ival = Cvalue.V.project_ival chr in - true, char_zero_bs_of_vu chr_ival - in + let has_char = str_builtin_type <> Search_zero_stop_zero in let n = if has_n then let n_index = if has_char then 2 else 1 in @@ -1652,7 +1660,17 @@ let search_char_n_wrapper name nb_args str_builtin_type ~has_n ~is_ret_pointer s in let value, problems = try - let bm = search_char_n bs_of_vu_f ~ret_rel_offs:(not is_ret_pointer) name state ?n + let bs_of_vu_f = + match str_builtin_type with + | Search_zero_stop_zero -> zero_zero_bs_of_vu + | Search_char_stop_char -> + let (_, chr) = List.nth args 1 in + char_char_bs_of_vu (Cvalue.V.project_ival chr) + | Search_char_stop_zero -> + let (_, chr) = List.nth args 1 in + char_zero_bs_of_vu (Cvalue.V.project_ival chr) + in + let bm = search_char_n ~cwidth bs_of_vu_f ~ret_rel_offs:(not is_ret_pointer) name state ?n ~include_exh:(not is_ret_pointer) str in let problems = BaseMap.fold (fun _base base_res acc -> @@ -1660,6 +1678,10 @@ let search_char_n_wrapper name nb_args str_builtin_type ~has_n ~is_ret_pointer s in res_of_base_res_f bm, problems with + | Cvalue.V.Not_based_on_null (* project_ival on chr *) -> + Cvalue.V.top_int, Problems.singleton + (Problem.Misc + ("assert(no address in second argument of " ^ name ^ ")")) | Top_res prob -> Cvalue.V.top_int, Problems.singleton prob in @@ -1708,7 +1730,7 @@ let args_of_actuals = List.map (fun (e,v,_) -> (Exp e, v)) (* Export the builtin as an OCaml function, and also registers it as a Value builtin, of name [name]. *) -let export_and_register c_name nb_args str_builtin_type ~has_n ~is_ret_pointer = +let export_and_register c_name nb_args str_builtin_type ~has_n ~is_ret_pointer ~cwidth = let name = "Frama_C_" ^ c_name in let print_call actuals = (*reset_callstack_base ();*) @@ -1719,7 +1741,7 @@ let export_and_register c_name nb_args str_builtin_type ~has_n ~is_ret_pointer = name Printer.pp_location (Cil_const.CurrentLoc.get()); in let f = - search_char_n_wrapper name nb_args str_builtin_type ~has_n ~is_ret_pointer + search_char_n_wrapper ~cwidth name nb_args str_builtin_type ~has_n ~is_ret_pointer in let f_builtin state actuals = let actuals = args_of_actuals actuals in @@ -1736,21 +1758,33 @@ let export_and_register c_name nb_args str_builtin_type ~has_n ~is_ret_pointer = let frama_c_strlen_wrapper = export_and_register "strlen" 1 - Search_zero_stop_zero ~has_n:false ~is_ret_pointer:false + Search_zero_stop_zero ~has_n:false ~is_ret_pointer:false ~cwidth:I.eight let frama_c_strnlen_wrapper = export_and_register "strnlen" 2 - Search_zero_stop_zero ~has_n:true ~is_ret_pointer:false + Search_zero_stop_zero ~has_n:true ~is_ret_pointer:false ~cwidth:I.eight let frama_c_rawmemchr_wrapper = export_and_register "rawmemchr" 2 - Search_char_stop_char ~has_n:false ~is_ret_pointer:true + Search_char_stop_char ~has_n:false ~is_ret_pointer:true ~cwidth:I.eight let frama_c_memchr_wrapper = export_and_register "memchr" 3 - Search_char_stop_char ~has_n:true ~is_ret_pointer:true + Search_char_stop_char ~has_n:true ~is_ret_pointer:true ~cwidth:I.eight let frama_c_strchr_wrapper = export_and_register "strchr" 2 - Search_char_stop_zero ~has_n:false ~is_ret_pointer:true - + Search_char_stop_zero ~has_n:false ~is_ret_pointer:true ~cwidth:I.eight + +(* because wchar_t depends on the machdep, wchar.h builtins are defined + differently from those in string.h. *) +let frama_c_wcslen_wrapper () = + let cwidth = I.of_int (Cil.bitsSizeOf Cil.theMachine.Cil.wcharType) in + export_and_register "wcslen" 1 + Search_zero_stop_zero ~has_n:false ~is_ret_pointer:false ~cwidth + +let () = Db.Main.extend + (fun () -> + let _ = frama_c_wcslen_wrapper () in + () + ) diff --git a/src/plugins/value/domains/cvalue/builtins_string.mli b/src/plugins/value/domains/cvalue/builtins_string.mli index 81820624a5cbed6430ce4fe94a80c91fe45169c2..d868dc38b9271e1b02bab0907c3eedc598f133c2 100644 --- a/src/plugins/value/domains/cvalue/builtins_string.mli +++ b/src/plugins/value/domains/cvalue/builtins_string.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -52,3 +52,5 @@ val frama_c_rawmemchr_wrapper: str_builtin_sig val frama_c_memchr_wrapper: str_builtin_sig val frama_c_strchr_wrapper: str_builtin_sig + +val frama_c_wcslen_wrapper: unit -> str_builtin_sig diff --git a/src/plugins/value/domains/cvalue/cvalue_domain.ml b/src/plugins/value/domains/cvalue/cvalue_domain.ml index bb03f782a831e7290c4962bca2f94a42e16901fd..b4c2a0616f667289d0498cfebd84899dad051828 100644 --- a/src/plugins/value/domains/cvalue/cvalue_domain.ml +++ b/src/plugins/value/domains/cvalue/cvalue_domain.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -53,7 +53,7 @@ module Model = struct let eval_one_loc state lval typ = let eval_one_loc single_loc = (* ignore alarm, which will be emitted by warn_reduce_by_accessed_loc *) - let _alarm_loc, v = Cvalue.Model.find_unspecified state single_loc in + let v = Cvalue.Model.find_indeterminate state single_loc in Cvalue.V_Or_Uninitialized.get_v v, indeterminate_alarms lval v in fun loc (acc_result, acc_alarms) -> @@ -65,7 +65,7 @@ module Model = struct let process_one_loc = eval_one_loc state lval typ in let acc = Cvalue.V.bottom, Alarmset.none in let value1, alarms1 = Precise_locs.fold process_one_loc loc acc in - let expr = Cil.dummy_exp (Cil_types.Lval lval) in + let expr = Value_util.lval_to_exp lval in let value2, alarms2 = Cvalue_forward.reinterpret expr typ value1 in let alarms = Alarmset.union alarms1 alarms2 in (* The origin denotes whether the conversion has really improved the result. @@ -82,7 +82,7 @@ module Model = struct let upto = succ (Ival.get_small_cardinal()) in let loc = Precise_locs.imprecise_location precise_loc in let eval_one_loc single_loc = - let v = snd (Cvalue.Model.find state single_loc) in + let v = Cvalue.Model.find state single_loc in let v = Cvalue_forward.make_volatile ~typ v in Cvalue_forward.unsafe_reinterpret typ v in @@ -104,7 +104,7 @@ module Model = struct let loc = loc.Locations.loc in Locations.Location_Bits.fold_i fold_ival loc acc with - Locations.Location_Bits.Error_Top -> loc.Locations.loc, value + Abstract_interp.Error_Top -> loc.Locations.loc, value in let acc = Locations.Location_Bits.bottom, Cvalue.V.bottom in let loc_bits, value = fold_location loc acc in @@ -124,6 +124,8 @@ module State = struct let structure = Abstract_domain.Node (Abstract_domain.Leaf key, Abstract_domain.Void) + let log_category = Value_parameters.dkey_cvalue_domain + include Datatype.Make_with_collections ( struct include Datatype.Serializable_undefined @@ -142,18 +144,23 @@ module State = struct let mem_project = Datatype.never_any_project end ) + let name = "Cvalue domain" + type value = Model.value type location = Model.location let top = Model.top, Locals_scoping.bottom () let is_included (a, _) (b, _) = Model.is_included a b let join (a, clob) (b, _) = Model.join a b, clob - let join_and_is_included a b = let r = join a b in r, equal r b let widen kf stmt (a, clob) (b, _) = let hint = Widen.getWidenHints kf stmt in Model.widen hint a b, clob + let narrow (a, clob) (b, _) = + let s = Model.narrow a b in + if Model.(equal bottom s) then `Bottom else `Value (s, clob) + type origin = Model.origin let extract_expr evaluate (s, _) expr = Model.extract_expr evaluate s expr @@ -171,10 +178,6 @@ module State = struct = struct module T = Cvalue_transfer.Transfer (Valuation) - type value = Valuation.value - type location = Valuation.loc - type state = t - type valuation = Valuation.t let update valuation (s, clob) = T.update valuation s, clob @@ -221,6 +224,7 @@ module State = struct (* TODO *) let approximate_call _stmt _call (_state, _clob) = assert false + let show_expr valuation (state, _) = T.show_expr valuation state end (* ------------------------------------------------------------------------ *) @@ -244,74 +248,86 @@ module State = struct (* Logic *) (* ------------------------------------------------------------------------ *) - (* Evaluation environment. *) - type eval_env = Eval_terms.eval_env * Locals_scoping.clobbered_set - let env_current_state (env, clob) = - let t = Eval_terms.env_current_state env in - if Model.is_reachable t then `Value (t, clob) else `Bottom - let env_annot ~pre:(pre, _) ~here:(here, clob) () = - Eval_terms.env_annot ~pre ~here (), clob - let env_pre_f ~pre:(pre, clob) () = - Eval_terms.env_pre_f ~pre (), clob - let env_post_f ~pre:(pre, _) ~post:(post, clob) ~result () = - Eval_terms.env_post_f ~pre ~post ~result (), clob - let eval_predicate (env, _) pred = - match Eval_terms.eval_predicate env pred with + let lift_env logic_env = + Abstract_domain.{ states = (fun label -> fst (logic_env.states label)); + result = logic_env.result; } + + let evaluate_predicate logic_env (state, _clob) pred = + let eval_env = Eval_terms.make_env (lift_env logic_env) state in + match Eval_terms.eval_predicate eval_env pred with | Eval_terms.True -> Alarmset.True | Eval_terms.False -> Alarmset.False | Eval_terms.Unknown -> Alarmset.Unknown - let reduce_by_predicate (env, clob) b pred = - Eval_terms.reduce_by_predicate env b pred, clob - - - (* ---------------------------------------------------------------------- *) - (* Specifications *) - (* ---------------------------------------------------------------------- *) - - (* Evaluate [kf] in state [with_formals], first by reducing by the - preconditions, then by evaluating the assigns, then by reducing - by the post-conditions. *) - let compute_using_specification call_kinstr call spec state = - if Value_parameters.InterpreterMode.get () - then begin - Value_util.warning_once_current "Library function call. Stopping."; - exit 0 - end; - Value_parameters.feedback ~once:true "@[using specification for function %a@]" - Kernel_function.pretty call.kf; - Cvalue_specification.compute_using_specification - call spec ~call_kinstr ~with_formals:state - >>-: fun result -> - let aux (offsm, post_state) = - match offsm with - | None -> post_state - | Some offsm -> - let vi = Extlib.the call.return in - let b = Base.of_varinfo vi in - Cvalue.Model.add_base b offsm post_state - in - List.map aux result.Value_types.c_values, result.Value_types.c_clobbered - - let compute_using_specification call_kinstr call fundec (state, clob) = - compute_using_specification call_kinstr call fundec state - >>- fun (res, sclob) -> - Locals_scoping.(remember_bases_with_locals clob sclob); - let list = List.map (fun return -> return, clob) res in - Bottom.bot_of_list list + let reduce_by_predicate logic_env (state, clob) pred b = + let eval_env = Eval_terms.make_env (lift_env logic_env) state in + let eval_env = Eval_terms.reduce_by_predicate eval_env b pred in + let state = Eval_terms.env_current_state eval_env in + if Cvalue.Model.is_reachable state + then `Value (state, clob) + else `Bottom + + let pp_eval_error fmt e = + if e <> Eval_terms.CAlarm then + Format.fprintf fmt "@ (%a)" Eval_terms.pretty_logic_evaluation_error e + + let evaluate_from_clause env (_, ins as assign) = + let open Cil_types in + match ins with + | FromAny -> Cvalue.V.top_int + | From l -> + try + (* Evaluates the contents of one element of the from clause, topify them, + and add them to the current state of the evaluation in acc. *) + let one_from_contents acc { it_content = t } = + let loc = + Eval_terms.(eval_tlval_as_location ~alarm_mode:Ignore env t) + in + let state = Eval_terms.env_current_state env in + let v = Cvalue.Model.find ~conflate_bottom:false state loc in + Cvalue.V.join acc (Cvalue.V.topify_leaf_origin v) + in + let filter x = not (List.mem "indirect" x.it_content.term_name) in + let direct = List.filter filter l in + List.fold_left one_from_contents Cvalue.V.top_int direct + with Eval_terms.LogicEvalError e -> + Value_util.warning_once_current + "cannot interpret@ 'from' clause@ '%a'%a" + Printer.pp_from assign pp_eval_error e; + Cvalue.V.top + + let logic_assign assign location ~pre:(pre_state, _) (state, sclob) = + let location = Precise_locs.imprecise_location location in + let env = Eval_terms.env_assigns pre_state in + let value = evaluate_from_clause env assign in + Locals_scoping.remember_if_locals_in_value sclob location value; + Cvalue.Model.add_binding ~exact:false state location value, sclob (* ------------------------------------------------------------------------ *) (* Initialization *) (* ------------------------------------------------------------------------ *) - let initialize_var (state, clob) _lval loc value = - let value = match value with - | `Bottom -> Cvalue.V_Or_Uninitialized.uninitialized - | `Value (v, true) -> Cvalue.V_Or_Uninitialized.C_init_noesc v - | `Value (v, false) -> Cvalue.V_Or_Uninitialized.C_uninit_noesc v + let introduce_globals vars (state, clob) = + let introduce state varinfo = + let base = Base.of_varinfo varinfo in + let loc = Locations.loc_of_base base in + let value = Cvalue.V_Or_Uninitialized.uninitialized in + Model.add_indeterminate_binding ~exact:true state loc value + in + List.fold_left introduce state vars, clob + + let initialize_variable _lval loc ~initialized init_value (state, clob) = + let value = match init_value with + | Abstract_domain.Top -> Cvalue.V.top_int + | Abstract_domain.Zero -> Cvalue.V.singleton_zero + in + let cvalue = + if initialized + then Cvalue.V_Or_Uninitialized.C_init_noesc value + else Cvalue.V_Or_Uninitialized.C_uninit_noesc value in let loc = Precise_locs.imprecise_location loc in - Model.add_initial_binding state loc value, clob + Model.add_indeterminate_binding ~exact:true state loc cvalue, clob let empty () = let open Cvalue in @@ -338,21 +354,15 @@ module State = struct end else state, Locals_scoping.bottom () - let initialize_var_using_type (state, clob) varinfo = - Cvalue_init.initialize_var_using_type varinfo state, clob - - let global_state () = - if Db.Value.globals_use_supplied_state () - then - let state = Db.Value.globals_state () in - let state = - if Model.is_reachable state - then `Value (state, Locals_scoping.bottom ()) - else `Bottom - in - Some state - else None - + let initialize_variable_using_type kind varinfo (state, clob) = + match kind with + | Abstract_domain.Main_Formal + | Abstract_domain.Library_Global -> + Cvalue_init.initialize_var_using_type varinfo state, clob + | Abstract_domain.Spec_Return kf -> + let value, state = Library_functions.returned_value kf state in + let loc = Locations.loc_of_varinfo varinfo in + Model.add_binding ~exact:true state loc value, clob (* ------------------------------------------------------------------------ *) (* Misc *) @@ -362,7 +372,13 @@ module State = struct let bind_local state vi = let b = Base.of_varinfo vi in let offsm = - Bottom.non_bottom (Cvalue.Default_offsetmap.default_offsetmap b) + if Value_parameters.InitializedLocals.get () then + let v = Cvalue.(V_Or_Uninitialized.initialized V.top_int) in + match Cvalue.V_Offsetmap.size_from_validity (Base.validity b) with + | `Bottom -> assert false + | `Value size -> Cvalue.V_Offsetmap.create_isotropic ~size v + else + Bottom.non_bottom (Cvalue.Default_offsetmap.default_offsetmap b) in Model.add_base b offsm state in @@ -372,7 +388,7 @@ module State = struct let state = Model.remove_variables vars state in try let fdec = Kernel_function.get_definition kf in - Locals_scoping.state_top_addresses fdec clob vars state, clob + Locals_scoping.make_escaping_fundec fdec clob vars state, clob with Kernel_function.No_Definition -> state, clob let enter_loop _stmt (s, clob) = s, clob @@ -387,6 +403,15 @@ module State = struct (* ------------------------------------------------------------------------ *) module Store = struct + module Storage = + State_builder.Ref (Datatype.Bool) + (struct + let dependencies = [Db.Value.self] + let name = name ^ ".Storage" + let default () = false + end) + + let register_global_state _ = Storage.set true let register_initial_state callstack (state, _clob) = Db.Value.merge_initial_state callstack state let register_state_before_stmt callstack stmt (state, _clob) = @@ -408,13 +433,24 @@ module State = struct Callstack.Hashtbl.iter process tbl; h + let get_global_state () = return (Db.Value.globals_state ()) let get_initial_state kf = return (Db.Value.get_initial_state kf) let get_initial_state_by_callstack kf = - Extlib.opt_map lift_tbl (Db.Value.get_initial_state_callstack kf) + if Storage.get () + then + match Db.Value.get_initial_state_callstack kf with + | Some tbl -> `Value (lift_tbl tbl) + | None -> `Bottom + else `Top let get_stmt_state stmt = return (Db.Value.get_stmt_state stmt) let get_stmt_state_by_callstack ~after stmt = - Extlib.opt_map lift_tbl (Db.Value.get_stmt_state_callstack ~after stmt) + if Storage.get () + then + match Db.Value.get_stmt_state_callstack ~after stmt with + | Some tbl -> `Value (lift_tbl tbl) + | None -> `Bottom + else `Top end end diff --git a/src/plugins/value/domains/cvalue/cvalue_domain.mli b/src/plugins/value/domains/cvalue/cvalue_domain.mli index 7a79dc85cdb48ae9451b7d9133f8e554fbd9dd0a..0cf912f5f75de588ff90d18db6b8a1a43c1b4dec 100644 --- a/src/plugins/value/domains/cvalue/cvalue_domain.mli +++ b/src/plugins/value/domains/cvalue/cvalue_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/cvalue_init.ml b/src/plugins/value/domains/cvalue/cvalue_init.ml index cc23fb671f1a64177e9d3e5864edd19e223a2580..4924abe7f59d5b3f8fce6339a8bc8f56ffffd806 100644 --- a/src/plugins/value/domains/cvalue/cvalue_init.ml +++ b/src/plugins/value/domains/cvalue/cvalue_init.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,14 +25,10 @@ open Cil_types open Locations -let dkey = Value_parameters.register_category "initial_state" +let dkey = Value_parameters.register_category "initial-state" -(** Those functions intentionally ignore 'const' attributes. Functions of - Eval_op should not be used in this module, unless they have a 'reducing' - argument. *) let add_initialized state loc v = - let value = Cvalue.V_Or_Uninitialized.initialized v in - Cvalue.Model.add_initial_binding state loc value + Cvalue.Model.add_binding ~exact:true state loc v let make_well hidden_base state loc = let size = Bit_utils.max_bit_size () in @@ -111,7 +107,6 @@ let reject_empty_struct b offset typ = (** [initialize_var_using_type varinfo state] uses the type of [varinfo] to create an initial value in [state]. *) let initialize_var_using_type varinfo state = - let with_alarms = CilE.warn_none_mode in Cil.CurrentLoc.set varinfo.vdecl; let rec add_offsetmap depth b name_desc name typ offset_orig typ_orig state = let typ = Cil.unrollType typ in @@ -228,7 +223,7 @@ let initialize_var_using_type varinfo state = if max_precise_size < size then begin (* Some elements remain to be initialized *) let offsm_of_loc loc = (* This rereads one of the first cells*) - let _alarm, offsm = + let offsm = Cvalue.Model.copy_offsetmap loc size_elt !state in match offsm with `Bottom -> assert false | `Value m -> m @@ -268,11 +263,8 @@ let initialize_var_using_type varinfo state = (* paste [size - max_precise_size] elements, starting from the last location initialized + 1 *) state := - Eval_op.paste_offsetmap ~reducing:true ~with_alarms - ~from:offsm_repeat - ~dst_loc:loc - ~size:total_size - ~exact:true + Cvalue.Model.paste_offsetmap + ~from:offsm_repeat ~dst_loc:loc ~size:total_size ~exact:true !state else ( (* We have probably initialized a struct with different fields. @@ -286,11 +278,8 @@ let initialize_var_using_type varinfo state = loc := Location_Bits.shift (Ival.inject_singleton size_elt) !loc; state := - Eval_op.paste_offsetmap ~reducing:true ~with_alarms - ~from:offsm_joined - ~dst_loc:!loc - ~size:size_elt - ~exact:true + Cvalue.Model.paste_offsetmap + ~from:offsm_joined ~dst_loc:!loc ~size:size_elt ~exact:true !state done); end; diff --git a/src/plugins/value/domains/cvalue/cvalue_init.mli b/src/plugins/value/domains/cvalue/cvalue_init.mli index 36e5ffd57c6c6062f52a37f3e89e446e1acd5c68..99475d690c5e7a16b61578f8360694b0afe9b6ac 100644 --- a/src/plugins/value/domains/cvalue/cvalue_init.mli +++ b/src/plugins/value/domains/cvalue/cvalue_init.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/cvalue/cvalue_specification.ml b/src/plugins/value/domains/cvalue/cvalue_specification.ml index f099fc5e008a5f4460e59c17aeec8abbbc4d498d..e303919bbbe0b9301a8a0403b16e90e82fcdb0aa 100644 --- a/src/plugins/value/domains/cvalue/cvalue_specification.ml +++ b/src/plugins/value/domains/cvalue/cvalue_specification.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -21,484 +21,174 @@ (**************************************************************************) open Cil_types -open Eval module AB = Transfer_logic.ActiveBehaviors -module LogicDomain = struct - include Cvalue.Model - type state = t - let join_and_is_included a b = let r = join a b in r, equal r b - let widen kf stmt a b = - let hint = Widen.getWidenHints kf stmt in - widen hint a b - - (* Evaluation environment. *) - type eval_env = Eval_terms.eval_env - let env_current_state env = - let t = Eval_terms.env_current_state env in - if is_reachable t then `Value t else `Bottom - let env_annot ~pre ~here () = Eval_terms.env_annot ~pre ~here () - let env_pre_f ~pre () = Eval_terms.env_pre_f ~pre () - let env_post_f ~pre ~post ~result () = - Eval_terms.env_post_f ~pre ~post ~result () - let eval_predicate env pred = - match Eval_terms.eval_predicate env pred with - | Eval_terms.True -> Alarmset.True - | Eval_terms.False -> Alarmset.False - | Eval_terms.Unknown -> Alarmset.Unknown - let reduce_by_predicate env b pred = Eval_terms.reduce_by_predicate env b pred -end - -module States = struct - include Powerset.Make (LogicDomain) - let singleton state = - if Cvalue.Model.is_reachable state - then singleton state - else empty - let add state states = - if Cvalue.Model.is_reachable state - then add state states - else states -end -module Logic = Transfer_logic.Make (LogicDomain) (States) - -(* Computes [narrow] with all the state sets in [stl]. - [stl] must not be empty. *) -let narrow_states_list stl = - let stl = List.map (fun s -> States.to_list s) stl in - let join_list acc list = match list with - | [] -> acc - | hd :: tl -> (List.fold_left Cvalue.Model.join hd tl) :: acc +(* Eval: under-approximation of the term. Note that ACSL states + that assigns clauses are evaluated in the pre-state. + We skip [\result]: it is meaningless when evaluating the 'assigns' part, + and a special treatment must be done in [from] clauses anyway. *) +let eval_assigns_from pre_state it = + let term = it.it_content in + if Logic_utils.is_result it.it_content then + Locations.Zone.bottom + else + let eval_env = Eval_terms.env_assigns pre_state in + let under, _ = + Eval_terms.eval_tlval_as_zone_under_over + ~alarm_mode:Eval_terms.Ignore ~for_writing:false eval_env term + in + under + +(** Compute the validity status for [from] in [pre_state], assuming the + entire clause is [assigns asgn \from from]. The inferred dependencies + are [found_froms], while [asgn] evaluates to [assigns_zone]. *) +let check_from pre_state asgn assigns_zone from found_froms = + let open Locations in + let found_deps = + let open Function_Froms in + if Logic_utils.is_result asgn.it_content then + found_froms.deps_return + else + Memory.find_precise found_froms.deps_table assigns_zone in - let s = List.fold_left join_list [] stl in - let snarrow = - List.fold_left Cvalue.Model.narrow Cvalue.Model.top s + let (indirect_deps,direct_deps) = + let filter x = List.mem "indirect" x.it_content.term_name in + List.partition filter from in - List.fold_left - (fun acc st -> - let narrowed_st = List.map (fun s -> Cvalue.Model.narrow s snarrow) st in - let states = States.of_list narrowed_st in - fst (States.merge ~into:states acc)) States.empty stl - - -(** Evaluate the assigns [assigns] of [kf] (for one or more behaviors) - in the state [with_formals]. - [per_behavior] indicates that the assigns clause is computed separately - for each behavior. It is used to control the emission of warnings. *) -let compute_assigns kf assigns return_used sclob ~with_formals ~per_behavior = - let with_alarms = CilE.warn_none_mode in - let vi = Kernel_function.get_vi kf in - if (not (Cvalue.Model.is_reachable with_formals)) || - Cil.hasAttribute "noreturn" vi.vattr - then - None, Cvalue.Model.bottom - else - let returned_value, with_formals = - Library_functions.returned_value kf with_formals - in - let returned_value = ref returned_value in - let env = Eval_terms.env_assigns with_formals in - let pp_eval_error fmt e = - if e <> Eval_terms.CAlarm then - Format.fprintf fmt "@ (%a)" Eval_terms.pretty_logic_evaluation_error e - in - (* Treat one assign ... \from ... clause. Update [state] accordingly, - as well as [returned_value] and [sclob] *) - let treat_assign state ({it_content = out}, ins as asgn) = - (* Evaluate the contents of one element of the from clause, topify them, - and add them to the current state of the evaluation in acc *) - let one_from_contents acc { it_content = t } = - let r = Eval_terms.eval_term ~with_alarms env t in - Cvalue.V.join acc (Cvalue.V.topify_leaf_origin r.Eval_terms.eover) - in - (* evaluation of the entire from clause *) - let froms_contents = - match ins with - | FromAny -> Cvalue.V.top_int - | From l -> - try - let filter x = not(List.mem "indirect" x.it_content.term_name) in - let direct = List.filter filter l in - List.fold_left one_from_contents Cvalue.V.top_int direct - with Eval_terms.LogicEvalError e -> - Value_util.warning_once_current - "cannot interpret@ 'from' clause@ '%a'@ of function %a%a" - Printer.pp_from asgn - Kernel_function.pretty kf pp_eval_error e; - Cvalue.V.top - in - (* Treat one location coming from the evaluation of [out] *) - let treat_output_loc acc loc = - let valid = Locations.valid_part ~for_writing:true loc in - if Locations.is_bottom_loc valid then - (if (not (Locations.is_bottom_loc loc)) - then (Value_parameters.warning ~current:true ~once:true - "@[Completely invalid destination@ for assigns@ clause %a.@ \ - Ignoring.@]" Printer.pp_term out); - acc) - else ( - Locals_scoping.remember_if_locals_in_value sclob loc froms_contents; - let state' = - snd (Cvalue.Model.add_binding ~exact:false acc loc froms_contents) - in - if Cvalue.Model.equal Cvalue.Model.top state' then ( - Value_parameters.error ~once:true ~current:true - "Cannot@ handle@ assigns@ for %a,@ location@ is@ too@ imprecise@ \ - (%a).@ Assuming@ it@ is@ not@ assigned,@ but@ be@ aware@ this\ - @ is@ incorrect." Printer.pp_term out Locations.pretty loc; - acc) - else state') - in - (* Treat the output part of the assigns clause *) - if Logic_utils.is_result out then ( - (* Special case for \result *) - returned_value := Cvalue.V.join froms_contents !returned_value; - state - ) else - try - (* TODO: warn about errors during evaluation *) - let loc = Eval_terms.eval_tlval_as_location ~with_alarms env out in - treat_output_loc state loc - with - | Eval_terms.LogicEvalError e -> - Value_util.warning_once_current - "cannot interpret assigns %a@ in function %a%a; effects will be \ - ignored" - Printer.pp_term out Kernel_function.pretty kf pp_eval_error e; - state - in - (* Treat all the assigns for the function *) - let state = - match assigns with - | WritesAny -> - (* No need to warn for missing assigns when evaluating a behavior, - we can always use those of the default behavior as a fallback. *) - if not per_behavior then - Value_util.warning_once_current - "Cannot handle empty assigns clause. Assuming assigns \\nothing: \ - be aware this is probably incorrect."; - with_formals - | Writes l -> - (* Warn for clauses without \from *) - let no_from = List.filter (fun (_, from) -> from = FromAny) l in - (match no_from with - | (out, _) :: _ as l -> - let source = fst out.it_content.term_loc in - Value_parameters.warning ~source ~once:true - "@[no \\from part@ for clause '%a' of@ function %a@]" - Printer.pp_assigns (Writes l) Kernel_function.pretty kf - | [] -> () - ); - (* Warn in case the 'assigns \result' clause is missing *) - (if return_used then - let for_result (out, _) = Logic_utils.is_result out.it_content in - let result = List.filter for_result l in - if result = [] then - let source = fst (Kernel_function.get_location kf) in - Value_parameters.warning ~once:true ~source - "@[no 'assigns \\result@ \\from ...'@ clause@ specified \ - for@ function %a@]" Kernel_function.pretty kf - ); - (* Compute the effects of the assigns clause *) - List.fold_left treat_assign with_formals l - in - let retres_vi, state = - match Library_functions.get_retres_vi kf with - | None -> None, state - | Some retres_vi -> - let return_type = Cil.getReturnType vi.vtype in - let offsetmap = Eval_op.offsetmap_of_v return_type !returned_value in - let retres_base = Base.of_varinfo retres_vi in - let state = Cvalue.Model.add_base retres_base offsetmap state in - Some retres_vi, state - in - retres_vi, state + (* Under-approximation of the union. *) + let link zones = List.fold_left Zone.link Zone.bottom zones in + let eval = eval_assigns_from pre_state in + let stated_indirect_deps = link (List.map eval indirect_deps) in + let stated_direct_deps = link (List.map eval direct_deps) in + let found_direct_deps = found_deps.Function_Froms.Deps.data in + let found_indirect_deps = found_deps.Function_Froms.Deps.indirect in + let res_for_unknown txt = + Value_parameters.debug "found_direct deps %a stated_direct_deps %a \ + found_indirect_deps %a stated_indirect_deps %a" + Zone.pretty found_direct_deps Zone.pretty stated_direct_deps + Zone.pretty found_indirect_deps Zone.pretty stated_indirect_deps; + "unknown (cannot validate "^txt^" dependencies)", + Alarmset.Unknown + in + match (Zone.is_included found_direct_deps stated_direct_deps, + Zone.is_included found_indirect_deps stated_indirect_deps) with + | true,true -> "valid", Alarmset.True + | false,true -> res_for_unknown "direct" + | false,false -> res_for_unknown "direct and indirect" + | true,false -> res_for_unknown "indirect" -(* Performs the join of two varinfo option, used for the return value. - If both are Some, then they should be the same. *) -let join_rvi rvi1 rvi2 = Extlib.merge_opt - (fun () vi1 vi2 -> - assert (Cil_datatype.Varinfo.equal vi1 vi2); - vi1 - ) () rvi1 rvi2 -(* Returns the assigns clause to be used during per-behavior processing. - The specification states that, if a behavior has no assigns clause, - then the assigns clause of the default behavior must be used instead. *) -let get_assigns_for_behavior ab b = - match b.b_assigns with - | WritesAny -> (* no assigns clause, using the default behavior's *) - let def_b = AB.behavior_from_name ab Cil.default_behavior_name in - def_b.b_assigns - | _ -> b.b_assigns +(* Emits a status and a notification message. Returns the message callback. *) +let emit_status ppt status = + Property_status.emit ~distinct:true Value_util.emitter ~hyps:[] ppt status -let compute_assigns_and_post_conds_for_behavior kf ab ~with_formals - bhv_states_after_requires return_used sclob b_name = - let b = AB.behavior_from_name ab b_name in - let states_after_requires = List.assoc b_name bhv_states_after_requires in - let retres_vi = ref None in - let states_after_assigns = - States.fold (fun state acc -> - let rvi, state_after_assigns = - let assigns = get_assigns_for_behavior ab b in - compute_assigns kf assigns return_used sclob state true - in - retres_vi := join_rvi !retres_vi rvi; - States.add state_after_assigns acc - ) states_after_requires States.empty - in - let states_after_post_conds = - Logic.check_fct_postconditions_for_behaviors kf ab [b] Normal - ~result:!retres_vi ~per_behavior:true ~pre_state:with_formals - ~post_states:states_after_assigns - in - (b_name, states_after_post_conds) -(* When there is at least one behavior whose active status is [True], we can - perform the intersection of the states and assigns clauses, and compute the - result for every [True] state at once. Here, [b_names] is a list of True - behaviors. *) -let compute_merged_assigns_and_post_conds_for_behaviors kf ab - bhv_states_after_requires return_used sclob b_names = - if b_names = [] then `Value States.empty +(* Display the message as result/warning depending on [status] *) +let msg_status status ?current ?once ?source fmt = + if status = Alarmset.True then + if Value_parameters.ValShowProgress.get () + then Value_parameters.result ?current ?once ?source fmt + else Value_parameters.result ?current ?once ?source ~level:2 fmt else - let bs = List.map (AB.behavior_from_name ab) b_names in - let states_after_requires_list = - Extlib.filter_map (fun (b_name, _) -> List.mem b_name b_names) snd - bhv_states_after_requires - in - States.join (narrow_states_list states_after_requires_list) - >>-: fun state_after_requires -> - let retres_vi = ref None in - let state_after_assigns = - List.fold_left (fun st0 b -> - let rvi, state_after_assigns = - let assigns = get_assigns_for_behavior ab b in - compute_assigns kf assigns return_used sclob st0 true - in - retres_vi := join_rvi !retres_vi rvi; - state_after_assigns - ) state_after_requires bs - in - Logic.check_fct_postconditions_for_behaviors kf ab bs Normal - ~per_behavior:true ~result:!retres_vi - ~pre_state:state_after_requires - ~post_states:(States.singleton state_after_assigns) - -(** Computes and returns three disjoint sets, [b_t], [b_u] and [b_f], - where [b_t] contains all behaviors which are certainly active - (status [True], and not empty after requires), [b_u] contains - behaviors which are possibly active (status [Unknown], and - not empty after requires), and [b_f] contains behaviors which - are empty. - The default behavior is never included in the returned sets. - Note that [b_f] does NOT contain behaviors which were previously - known to be inactive (set to [False] by the assumes clause). - [bhv_states_post_requires] is an association list from - behaviors to their states after applying requires clauses. -*) -let partition_behaviors_after_requires ab bhv_states_after_requires = - (* We filter the default behavior here *) - let bhv_states_after_requires' = - List.filter - (fun (b_name, _) -> b_name <> Cil.default_behavior_name) - bhv_states_after_requires + if Value_parameters.AlarmsWarnings.get () then + Value_parameters.warning ?current ?once ?source fmt + else + Value_parameters.result + ?current ?once ?source ~dkey:Value_parameters.dkey_alarm fmt + + +let pp_bhv fmt b = + if not (Cil.is_default_behavior b) + then Format.fprintf fmt ", behavior %s" b.b_name + +let pp_header kf fmt b = + Format.fprintf fmt "function %a%a" + Kernel_function.pretty kf pp_bhv b + + +let conv_status = function + | Alarmset.False -> Property_status.False_if_reachable; + | Alarmset.True -> Property_status.True; + | Alarmset.Unknown -> Property_status.Dont_know + + +let check_fct_assigns kf ab ~pre_state found_froms = + let open Locations in + let open Alarmset in + let behaviors = Annotations.behaviors kf in + (* Under-approximation of the union. *) + let link zones = List.fold_left Zone.link Zone.bottom zones in + let outputs = Function_Froms.outputs found_froms in + let check_for_behavior b = + let activity = AB.is_active ab b in + match activity with + | False -> () + | True | Unknown -> + let pp_activity fmt activity = match activity with + | False -> assert false + | True -> () + (* If unknown, the error may be because we did not notice + that the behavior is inactive. *) + | Unknown -> Format.fprintf fmt "(the behavior may be inactive)" + in + (match b.b_assigns with + | WritesAny -> () + | Writes(assigns_deps) -> + let bol = Property.Id_contract (Datatype.String.Set.empty,b) in + let ip = Extlib.the (Property.ip_of_assigns kf Kglobal bol b.b_assigns) + in + let source = fst (Property.location ip) in + (* First, check the assigns. *) + let assigns = List.map fst assigns_deps in + let assigns_zones = List.map (eval_assigns_from pre_state) assigns in + let assigns_union = link assigns_zones in + let status_txt, vstatus, status = + if not (Zone.is_included outputs assigns_union) + then ( + Value_parameters.debug "found_assigns %a stated_assigns %a" + Zone.pretty outputs Zone.pretty assigns_union; + "unknown", Unknown, Property_status.Dont_know) + else "valid", True, Property_status.True + in + msg_status vstatus ~once:true ~source + "%a: assigns got status %s.%a%t" + (pp_header kf) b + status_txt + pp_activity activity + Value_util.pp_callstack; + emit_status ip status; + (* Now, checks the individual froms. *) + let check_from ((asgn,deps) as from) assigns_zone = + match deps with + | FromAny -> () + | From deps -> + let status_txt, status = + check_from pre_state asgn assigns_zone deps found_froms + in + let ip = Extlib.the (Property.ip_of_from kf Kglobal bol from) in + let source = fst (asgn.it_content.term_loc) in + msg_status status ~once:true ~source + "%a: \\from ... part in assign clause got status %s.%a%t" + (pp_header kf) b + status_txt + pp_activity activity + Value_util.pp_callstack; + emit_status ip (conv_status status) + in + List.iter2 check_from assigns_deps assigns_zones) + in List.iter check_for_behavior behaviors + +let verify_assigns_from kf ~pre froms = + let funspec = Annotations.funspec kf in + let env = Eval_terms.env_pre_f ~pre () in + let eval_predicate pred = + match Eval_terms.eval_predicate env pred with + | Eval_terms.True -> Alarmset.True + | Eval_terms.False -> Alarmset.False + | Eval_terms.Unknown -> Alarmset.Unknown in - List.fold_left (fun (b_t0, b_u0, b_f0) (b_name, stateset) -> - if States.is_empty stateset then - (* falsely active behavior: requires clauses not satisfied *) - (b_t0, b_u0, b_name :: b_f0) - else - (* requires clauses did not change the behavior's status *) - match AB.is_active ab (AB.behavior_from_name ab b_name) with - | Alarmset.True -> (b_name :: b_t0, b_u0, b_f0) - | Alarmset.Unknown -> (b_t0, b_name :: b_u0, b_f0) - | Alarmset.False -> (b_t0, b_u0, b_name :: b_f0) - ) ([],[],[]) bhv_states_after_requires' - -(** - Promotes [Unknown] behaviors from [b_u] to [True] when they are the only - possible choice in a given complete set. - Returns the new sets [b_t] and [b_u], of [True] and [Unknown] behaviors. -*) -let promote_complete_unknown_behaviors comp_lists b_t b_u = - ListLabels.fold_left ~init:(b_t,b_u) comp_lists - ~f:(fun (acc_t,acc_u as acc) comp_set -> - let unk_bhvs_in_set = List.filter (ListLabels.mem ~set:b_u) comp_set in - match unk_bhvs_in_set with - | [] -> (* no Unknown behaviors, nothing to promote *)acc - | [b_unk] -> (* a single Unknown behavior, will be promoted to True *) - b_unk :: acc_t,List.filter (fun b -> b <> b_unk) acc_u - | _ -> (* more than one Unknown behavior, cannot promote *) - acc_t,acc_u - ) - -(* Reduce the state by the assumes and requires clauses for behavior [b], - and emit statuses for the requires. *) -let compute_assumes_and_requires_for_behavior kf ab b call_kinstr states = - let states_after_assumes = Logic.reduce_by_assumes_of_behavior kf b states in - Logic.check_fct_preconditions_for_behavior kf ab ~per_behavior:true - call_kinstr states_after_assumes b + let ab = AB.create eval_predicate funspec in + check_fct_assigns kf ab ~pre_state:pre froms;; -let compute_using_specification call spec ~call_kinstr ~with_formals = - let kf = call.kf in - let ab = Logic.create_from_spec with_formals spec in - let sclob = Locals_scoping.bottom () in - let complete_bhvs_lists = spec.spec_complete_behaviors in - let maybe_active_behaviors = - ListLabels.filter spec.spec_behavior - ~f:(fun b -> AB.is_active ab b <> Alarmset.False && - not (Cil.is_default_behavior b)) - in - let def_bhv = AB.behavior_from_name ab Cil.default_behavior_name in - (* TODO: integrate slevel *) - let init_state_set = States.singleton with_formals in - let states_after_global_requires = - Logic.check_fct_preconditions_for_behavior kf ab - ~per_behavior:true call_kinstr init_state_set - def_bhv - in - (* state_after_global_requires is an overapproximation of the - disjunction of states after the global requires clause. It is used - in some places, but the actual disjunction is more precise and should be - used when possible. *) - let state_after_global_requires = States.join states_after_global_requires in - (* Notify user about inactive behaviors *) - Transfer_logic.process_inactive_behaviors kf call_kinstr ab; - state_after_global_requires >>- fun state_after_global_requires -> - (* In order to know which behaviors will be considered by the analysis, - we need to compute the \requires clause to eliminate empty behaviors, - such as "assumes x < 0; requires x > 0;". Otherwise, we will later - incorrectly consider such cases as if we had Bottom (empty state sets), - and the narrow operator will give an incorrect result. *) - let final_states = - (* bhv_states_after_requires: association list (name, stateset), - from (possibly active) behavior names to their post-requires - sets of disjoint states. *) - let bhv_states_after_requires = - (* requires for default behavior already computed *) - (Cil.default_behavior_name, states_after_global_requires) :: - ListLabels.map maybe_active_behaviors - ~f:(fun b -> b.b_name, - compute_assumes_and_requires_for_behavior - kf ab b call_kinstr states_after_global_requires) - in - let return_used = match call_kinstr with - | Kglobal -> true - | Kstmt {skind = Instr (Call (lv, _, _, _))} -> - lv <> None || Value_util.postconditions_mention_result spec - | _ -> assert false - in - let (b_t, b_u, b_f) = - partition_behaviors_after_requires ab bhv_states_after_requires - in - (* If there are behaviors with invalid preconditions, notify the - user. *) - Transfer_logic.process_inactive_postconds kf - (Extlib.filter_map (fun (b,_st) -> List.mem b b_f) - (fun (b,_st) -> AB.behavior_from_name ab b) - bhv_states_after_requires); - (* To obtain maximum precision, we consider behaviors according to - these rules: - 1) Inactive behaviors are never considered. - 3) All behaviors which are [True] (including the default behavior) - have their assigns/ensures clauses computed as in the case of a - single specification, to avoid a combinatorial explosion and to - obtain the equivalent of a narrowed state S_t. - 4) [Unknown] behaviors are added to S_t. For each set of complete - behaviors, we join its [Unknown] states. We obtain different - states S_c_1, S_c_2, etc., for each set of complete states c_i. - We then narrow these states to obtain the final result. - *) - let b_t, b_u = - promote_complete_unknown_behaviors spec.spec_complete_behaviors b_t b_u - in - (* If there is at least one "complete behaviors" clause, then we ignore - the default behavior when computing a "true state" - (intersection of True behaviors). - Otherwise, we add the default behavior to the set of True behaviors. - *) - let b_t = - if complete_bhvs_lists = [] then Cil.default_behavior_name :: b_t - else b_t - in - compute_merged_assigns_and_post_conds_for_behaviors - kf ab bhv_states_after_requires return_used sclob b_t - >>-: fun true_states -> - (* If there are no "complete behaviors" clauses, we add a set - containing the default behavior. *) - let complete_sets = - if complete_bhvs_lists = [] - then [[Cil.default_behavior_name]] - else complete_bhvs_lists - in - (* From now on, we compute the state corresponding to the behaviors - with status Unknown *) - (* We only compute states for useful behaviors: those that are present - in some of the complete_bhvs_lists and that are [Unknown] (because - they are in the true state), plus the default behavior. *) - let bhvs_to_compute = - Extlib.sort_unique Pervasives.compare - (List.filter (ListLabels.mem ~set:b_u) (List.flatten complete_sets)) - in - let bhv_states_after_post_conds = - List.map - (compute_assigns_and_post_conds_for_behavior kf ab - ~with_formals:state_after_global_requires - bhv_states_after_requires return_used sclob) bhvs_to_compute - in - (* For each set [c_i] of complete behaviors, compute a state set - [stateset_per_c_i] with its unknown behaviors, then narrow the - resulting state sets to obtain a more precise result. *) - let stateset_per_c_i_list = - List.map ( - Extlib.filter_map - (fun b -> List.mem b bhvs_to_compute) - (fun b -> List.assoc b bhv_states_after_post_conds) - ) complete_sets - in - let stateset_per_c_i = - List.map - (fun c_i_stateset_list -> - List.fold_left - (fun acc_st stateset -> - fst (States.merge stateset acc_st)) - States.empty c_i_stateset_list - ) stateset_per_c_i_list in - (* Finally, we narrow the result obtained for each set c_i of complete - behaviors. The more sets there are, the more precise the final result - will be. *) - let unk_state = narrow_states_list stateset_per_c_i in - (* Finally, we merge the states for the behaviors with status True - and Unknown*) - fst (States.merge true_states unk_state) - in - final_states >>-: fun final_states -> - let rvi = Kernel_function.get_vi kf in - let return_type = Cil.getReturnType rvi.vtype in - let infer_rvi state = - if Cil.isVoidType return_type || Cil.hasAttribute "noreturn" rvi.vattr - || not (Cvalue.Model.is_reachable state) - then None - else call.return - in - let aux state = - match infer_rvi state with - | None -> None, state - | Some vi -> - match state with - | Cvalue.Model.Bottom -> None, state - | Cvalue.Model.Top -> Warn.warn_top () - | Cvalue.Model.Map _ -> - let retres_base = Base.of_varinfo vi in - let without_ret = Cvalue.Model.remove_base retres_base state in - match Cvalue.Model.find_base retres_base state with - | `Value m -> Some m, without_ret - | `Bottom (*tested above*) | `Top (*state is not top*)-> assert false - in - { Value_types.c_values = List.map aux (States.to_list final_states); - c_clobbered = sclob.Locals_scoping.clob; - c_cacheable = Value_types.Cacheable; - c_from = None; - } +Db.Value.verify_assigns_froms := verify_assigns_from;; diff --git a/src/plugins/value/domains/cvalue/cvalue_specification.mli b/src/plugins/value/domains/cvalue/cvalue_specification.mli index d72d99120f6e61775c918037a3beba6d56998fee..09d3aa811fbc2603b1cc55212e49ca230a27e0a3 100644 --- a/src/plugins/value/domains/cvalue/cvalue_specification.mli +++ b/src/plugins/value/domains/cvalue/cvalue_specification.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,14 +20,4 @@ (* *) (**************************************************************************) -(** Evaluation of functions using their specification *) - -(** Evaluate [kf] in state [with_formals], first by reducing by the - preconditions, then by evaluating the assigns, then by reducing - by the post-conditions. *) -val compute_using_specification: - Cvalue.V.t Eval.call -> - Cil_types.funspec -> - call_kinstr:Cil_types.kinstr -> - with_formals:Cvalue.Model.t -> - Value_types.call_result Eval.or_bottom +(** No function exported. Registers Db.Value.verify_assigns_from. *) diff --git a/src/plugins/value/domains/cvalue/cvalue_transfer.ml b/src/plugins/value/domains/cvalue/cvalue_transfer.ml index 1bbe7bc513a089526e9b037645dc0d60277914d1..9160828b7320b6406dfa39793de4a0a7ebb90932 100644 --- a/src/plugins/value/domains/cvalue/cvalue_transfer.ml +++ b/src/plugins/value/domains/cvalue/cvalue_transfer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -38,21 +38,6 @@ let unbottomize = function (* Functions on Offsetmap *) (* ---------------------------------------------------------------------- *) -let make_right_value cvalue = - let open Cvalue.V_Or_Uninitialized in - let value = get_v cvalue in - let v = if Cvalue.V.is_bottom value then `Bottom else `Value value in - { v; initialized = is_initialized cvalue; escaping = not (is_noesc cvalue) } - -let offsetmap_to_value typ offsm = - let size = Integer.of_int (Cil.bitsSizeOf typ) in - let validity = Base.validity_from_size size in - let offsets = Ival.zero in - let _, value = Cvalue.V_Offsetmap.find ~validity ~offsets ~size offsm in - value - -let find_right_value typ offsm = make_right_value (offsetmap_to_value typ offsm) - let offsetmap_of_v ~typ v = let size = Integer.of_int (Cil.bitsSizeOf typ) in let v = Cvalue.V.anisotropic_cast ~size v in @@ -120,18 +105,10 @@ module Transfer (* Assignments *) (* ---------------------------------------------------------------------- *) - let with_alarms = Value_util.warn_all_quiet_mode () - - let warn_imprecise_lval_read lval loc v = - Warn.warn_imprecise_lval_read ~with_alarms lval loc v - - let warn_right_imprecision lval loc v = - Warn.warn_right_exp_imprecision ~with_alarms lval loc v - let write_abstract_value state (lval, loc, typ) assigned_value = let {v; initialized; escaping} = assigned_value in let value = unbottomize v in - warn_right_imprecision lval loc value; + Warn.warn_right_exp_imprecision lval loc value; let value = if Cil.typeHasQualifier "volatile" typ then Cvalue_forward.make_volatile value @@ -151,7 +128,7 @@ module Transfer let value = Cvalue.V_Or_Uninitialized.make ~initialized ~escaping value in (* let value = Cvalue.V_Or_Uninitialized.initialized value in *) - snd (add_unsafe_binding ~exact state loc value) + add_indeterminate_binding ~exact state loc value exception Do_assign_imprecise_copy @@ -159,11 +136,11 @@ module Transfer let left_lval, left_loc, left_typ = left_lv and right_lval, right_loc, right_typ = right_lv in (* Warn if right_loc is imprecise *) - warn_imprecise_lval_read right_lval right_loc Cvalue.V.bottom; + Warn.warn_imprecise_lval_read right_lval right_loc Cvalue.V.bottom; (* top size is tested before this function is called, in which case the imprecise copy mode is used. *) let size = Int_Base.project right_loc.Locations.size in - let offsetmap = snd (copy_offsetmap right_loc.Locations.loc size state) in + let offsetmap = copy_offsetmap right_loc.Locations.loc size state in let make_volatile = Cil.typeHasQualifier "volatile" left_typ || Cil.typeHasQualifier "volatile" right_typ @@ -183,12 +160,12 @@ module Transfer raise Do_assign_imprecise_copy; let () = match offsetmap_contains_imprecision offsetmap with - | Some v -> warn_right_imprecision left_lval left_loc v + | Some v -> Warn.warn_right_exp_imprecision left_lval left_loc v | _ -> () in `Value - (snd (paste_offsetmap ~reducing:false ~exact:true - ~from:offsetmap ~dst_loc:left_loc.Locations.loc ~size state)) + (paste_offsetmap ~exact:true + ~from:offsetmap ~dst_loc:left_loc.Locations.loc ~size state) let make_determinate value = { v = `Value value; initialized = true; escaping = false } @@ -246,11 +223,6 @@ module Transfer (* Builtins *) (* ---------------------------------------------------------------------- *) - let add_binding ~exact state loc value = - let value = Cvalue.V_Or_Uninitialized.initialized value in - let _alarm, state = add_binding_unspecified ~exact state loc value in - state - let va_start valuation state args = match args with | [{enode = Lval lv}, _, _] -> @@ -288,14 +260,8 @@ module Transfer } | _ -> assert false - let apply_abstract_builtin stmt builtin state actuals = - try - (* RMVALUE: currently, builtins use the legacy Value code to emit - the alarms. We have to position the current location. *) - Valarms.start_stmt (Kstmt stmt); - let r = builtin state actuals in - Valarms.end_stmt (); - Some r + let apply_abstract_builtin builtin state actuals = + try Some (builtin state actuals) with | Builtins.Invalid_nb_of_args n -> Value_parameters.error ~current:true @@ -310,12 +276,8 @@ module Transfer (* Apply special builtins, such as Frama_C_show_each_foo *) let apply_special_builtins valuation name state actuals = if Ast_info.can_be_cea_function name then - (* A few special functions that are not registered in the builtin table *) - if Ast_info.is_cea_dump_function name then - Some (Builtins_misc.dump_state state actuals) - else if Ast_info.is_cea_function name then - Some (Builtins_misc.dump_args name state actuals) - else if Ast_info.is_cea_dump_file_function name then + (* One special function that is not registered in the builtin table *) + if Ast_info.is_cea_dump_file_function name then Some (Builtins_misc.dump_state_file name state actuals) else None @@ -329,7 +291,7 @@ module Transfer (* Compute a call to a possible builtin [kf] in state [state]. [actuals] are the arguments of [kf], and have not been bound to its formals. Returns [None] if the call must be computed using the Cil function for [kf]. *) - let compute_maybe_builtin stmt call valuation state actuals rest = + let compute_maybe_builtin call valuation state actuals rest = let actuals = actuals @ rest in let name = Kernel_function.get_name call.kf in match Builtins.find_builtin_override call.kf with @@ -337,7 +299,7 @@ module Transfer (* This is an interesting C function. Mark it as called, otherwise it would get skipped, eg. from the Gui. *) Value_results.mark_kf_as_called call.kf; - apply_abstract_builtin stmt abstract_function state actuals + apply_abstract_builtin abstract_function state actuals | None -> apply_special_builtins valuation name state actuals @@ -346,39 +308,32 @@ module Transfer (* Function Calls *) (* ---------------------------------------------------------------------- *) + let warn_if_imprecise lval loc offsm = + match offsetmap_contains_imprecision offsm with + | Some v -> + let loc = Precise_locs.imprecise_location loc in + Warn.warn_imprecise_lval_read lval loc v + | None -> () + + let offsetmap_of_lval valuation state lval = + let record = match Valuation.find_loc valuation lval with + | `Value record -> record + | `Top -> assert false + in + let offsm = + try Eval_op.offsetmap_of_loc record.loc state + with Abstract_interp.Error_Top -> + (* Subsumed by check_arg_size? *) + Value_parameters.abort ~current:true + "Function argument %a has unknown size. Aborting" + Printer.pp_lval lval; + in + match offsm with + | `Value offsm -> warn_if_imprecise lval record.loc offsm; offsm + | `Bottom -> raise InvalidCall + let offsetmap_of_formal valuation state typ = function - | Copy (lval, _value) -> - let record = match Valuation.find_loc valuation lval with - | `Value record -> record - | `Top -> assert false - in - let aux loc offsm_res = - let open Locations in - try - let size = Int_Base.project loc.size in - let _, copy = Cvalue.Model.copy_offsetmap loc.loc size state in - Bottom.join Cvalue.V_Offsetmap.join copy offsm_res - with - Int_Base.Error_Top -> - (* Subsumed by check_arg_size? *) - Value_parameters.abort ~current:true - "Function argument %a has unknown size. Aborting" - Printer.pp_lval lval; - in - let o = Precise_locs.fold aux record.loc `Bottom in - let offsm, _ = - match o with - | `Value offsm -> - begin match offsetmap_contains_imprecision offsm with - | Some v -> - let loc = Precise_locs.imprecise_location record.loc in - warn_imprecise_lval_read lval loc v - | None -> () - end; - offsm, state - | `Bottom -> raise InvalidCall - in - offsm + | Copy (lval, _value) -> offsetmap_of_lval valuation state lval | Assign value -> offsetmap_of_v ~typ value let actualize_formals valuation state arguments rest = @@ -400,14 +355,14 @@ module Transfer let rest = List.fold_right treat_one_rest rest [] in state, list, rest - let start_call stmt call valuation state = + let start_call _stmt call valuation state = let state = update valuation state in let with_formals, list, rest = actualize_formals valuation state call.arguments call.rest in let stack_with_call = Value_util.call_stack () in Db.Value.Call_Value_Callbacks.apply (with_formals, stack_with_call); - match compute_maybe_builtin stmt call valuation state list rest with + match compute_maybe_builtin call valuation state list rest with | None -> Compute (Continue with_formals, true), Base.SetLattice.bottom | Some res -> (* Store the initial state, but do not called mark_as_called. Uninteresting @@ -430,7 +385,24 @@ module Transfer Result (Bottom.bot_of_list list, res.Value_types.c_cacheable), res.Value_types.c_clobbered - let finalize_call _stmt _call ~pre:_ ~post:state = `Value state + let finalize_call stmt call ~pre:_ ~post:state = + (* Deallocate memory allocated via alloca(). + To minimize computations, only do it for function definitions. *) + let state' = + if Kernel_function.is_definition call.kf then + let stack = (call.kf, Kstmt stmt) :: (Value_util.call_stack ()) in + Builtins_malloc.free_automatic_bases stack state + else state + in + `Value state' let approximate_call _stmt _call _t = assert false + + let show_expr valuation state fmt expr = + match expr.enode with + | Lval lval -> + let offsm = offsetmap_of_lval valuation state lval in + let typ = Cil.typeOf expr in + Eval_op.pretty_offsetmap typ fmt offsm + | _ -> Format.fprintf fmt "%s" (Unicode.top_string ()) end diff --git a/src/plugins/value/domains/cvalue/cvalue_transfer.mli b/src/plugins/value/domains/cvalue/cvalue_transfer.mli index f2bedba9e2e11b87406d7b3c675de8cd3159e44e..4923cb1812b34873b8aa3e2b262434cf1392c778 100644 --- a/src/plugins/value/domains/cvalue/cvalue_transfer.mli +++ b/src/plugins/value/domains/cvalue/cvalue_transfer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -27,9 +27,6 @@ open Eval type value = Main_values.CVal.t type location = Main_locations.PLoc.location -val find_right_value: - Cil_types.typ -> Cvalue.V_Offsetmap.t -> value flagged_value - module Transfer (Valuation: Abstract_domain.Valuation with type value = value and type origin = bool diff --git a/src/plugins/value/domains/cvalue/locals_scoping.ml b/src/plugins/value/domains/cvalue/locals_scoping.ml index 8e9c86f5b55a959ed6e9feb4a747f54e04bb263c..b2677f94a7b63a3f3a2661a1b8092ee3f9aedc7c 100644 --- a/src/plugins/value/domains/cvalue/locals_scoping.ml +++ b/src/plugins/value/domains/cvalue/locals_scoping.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -53,71 +53,39 @@ let offsetmap_contains_local offm = false with Exit -> true -let remember_if_locals_in_offsetmap clob left_loc offsm = - if offsetmap_contains_local offsm then - let s = Location_Bits.get_bases left_loc.loc in - remember_bases_with_locals clob s -type topify_offsetmap = - Cvalue.V_Offsetmap.t -> - Base.SetLattice.t * Cvalue.V_Offsetmap.t - -type topify_offsetmap_approx = - exact:bool -> - topify_offsetmap - -type topify_state = Cvalue.Model.t -> Cvalue.Model.t - - -(* For all bindings [v] of [offsm] that verify [test], replace them by - [snd (topify v)], and gather [fst (topify v)] within [acc_locals] *) -let top_gather_locals test topify join acc_locals : topify_offsetmap = - fun offsm -> +(* Rebuild [offsm] by applying [f] to the bindings that verify [test]. + Also call [warn] in this case. *) +let rebuild_offsetmap f warn offsm = Cvalue.V_Offsetmap.fold - (fun (_,_ as i) (v, m, r) (acc_locals, acc_o as acc) -> - if test v - then - let locals, topified_v = topify v in - (join acc_locals locals), - Cvalue.V_Offsetmap.add i (topified_v, m, r) acc_o - else acc) + (fun (_,_ as itv) (v, m, r) acc -> + let changed, v' = f v in + if changed then begin + warn ~itv ~v:(Cvalue.V_Or_Uninitialized.get_v v); + Cvalue.V_Offsetmap.add itv (v', m, r) acc + end else + acc) + offsm offsm - (acc_locals, offsm) - -(* Return a function that topifies all parts of an offsetmap that contains a - pointer that verifying [is_local]. *) -let offsetmap_top_addresses_of_locals is_local : topify_offsetmap_approx = - (* Partial application is important, this function has a cache *) - let is_local_bytes = Location_Bytes.contains_addresses_of_locals is_local in - fun ~exact offsetmap -> - let loc_contains_addresses_of_locals t = - let v = Cvalue.V_Or_Uninitialized.get_v t in - is_local_bytes v - in - let locals, result = - top_gather_locals - loc_contains_addresses_of_locals - (Cvalue.V_Or_Uninitialized.unspecify_escaping_locals ~exact is_local) - Base.SetLattice.join - Base.SetLattice.bottom - offsetmap - in - locals, result +(* make escaping the ranges of [offsetmap] that verify [test]. Honor [exact], + and warn using [warn] on those ranges. *) +let make_escaping_offsetmap test warn ~exact offsetmap = + let make_escaping v = + Cvalue.V_Or_Uninitialized.unspecify_escaping_locals ~exact test v + in + rebuild_offsetmap make_escaping warn offsetmap -(* Topify the locals in the offsetmaps bound to [bases] in [state]. *) -let state_top_addresses_of_locals ~exact fwarn_escape (topify_offsetmap:topify_offsetmap_approx) bases state = - (* Assumes [offsm] is bound to [base] in [state]. Remove locals from [offsm], - and bind it again to [base] in the result. *) +let make_escaping ~exact ~escaping ~on_escaping ~within state = + (* Clean [offsm], and bind it to [base] if it is modified. *) let aux base offsm state = - let locals, offsm' = topify_offsetmap ~exact offsm in - let found_locals = not (Cvalue.V_Offsetmap.equal offsm' offsm) in - if found_locals then - ((fwarn_escape base locals : unit); - Cvalue.Model.add_base base offsm' state) - else state + let test b = Base.Hptset.mem b escaping in + let on_escaping = on_escaping ~b:base in + let offsm' = make_escaping_offsetmap test on_escaping ~exact offsm in + if Cvalue.V_Offsetmap.equal offsm' offsm then state + else Cvalue.Model.add_base base offsm' state in - (* Clean the locals in the offsetmap bound to [base] in [state] *) + (* Clean the offsetmap bound to [base] in [state] *) let aux' base state = try match Cvalue.Model.find_base base state with @@ -125,57 +93,16 @@ let state_top_addresses_of_locals ~exact fwarn_escape (topify_offsetmap:topify_o | `Value offsm -> aux base offsm state with Not_found -> state in - try (* Iterate on all the bases that might contain a local, and clean them*) - Base.SetLattice.fold aux' bases.clob (aux' Base.null state) - with Base.SetLattice.Error_Top -> + try (* Iterate on all the bases that might contain a variable to clean *) + Base.SetLattice.fold aux' within (aux' Base.null state) + with Abstract_interp.Error_Top -> (* [bases] is too imprecise. Iterate on the entire memory state instead, which is much slower *) match state with | Cvalue.Model.Top | Cvalue.Model.Bottom -> state | Cvalue.Model.Map m -> Cvalue.Model.fold aux m state -(* Topifies all references to the locals and formals of [fdec]*) -let top_addresses_of_locals fdec clob = - let entry_point, lib = Kernel.MainFunction.get (), Kernel.LibEntry.get () in - (* Do nothing for main, except in lib-entry mode (no sense to warn for - a variable escaping the main function) *) - if lib || not (fdec.svar.vname = entry_point) - then - let offsetmap_top_addresses_of_locals = - offsetmap_top_addresses_of_locals - (Extlib.swap Base.is_formal_or_local fdec) - in - let state_top_addresses_of_locals = - state_top_addresses_of_locals - (Warn.warn_locals_escape false fdec) - offsetmap_top_addresses_of_locals clob - in - (offsetmap_top_addresses_of_locals ~exact:true, - state_top_addresses_of_locals ~exact:true) - else (fun x -> Base.SetLattice.bottom, x),(fun x -> x) - -(* Topifies all the references to the variables local to [blocks] *) -let block_top_addresses_of_locals fdec clob blocks = - (* no need to topify references to [v] if it is not referenced, or if it - a Cil temporary *) - let safe_var v = v.vtemp || not v.vreferenced in - if List.for_all (fun b -> List.for_all safe_var b.blocals) blocks then - fun x -> x - else - let offsetmap_top_addresses_of_locals = - offsetmap_top_addresses_of_locals - (fun v -> List.exists (Base.is_block_local v) blocks) - in - let state_top_addresses_of_locals = - state_top_addresses_of_locals - (Warn.warn_locals_escape true fdec) - offsetmap_top_addresses_of_locals - clob - in - state_top_addresses_of_locals ~exact:true - -(* Topifies all the references to the variables [vars] in [state]. *) -let state_top_addresses fundec clob vars state = +let make_escaping_fundec fundec clob vars state = let filter acc v = if v.vtemp || not v.vreferenced then acc else Base.Hptset.add (Base.of_varinfo v) acc @@ -184,22 +111,20 @@ let state_top_addresses fundec clob vars state = if Base.Hptset.is_empty vars then state else - let offsetmap_top_addresses_of_locals = - offsetmap_top_addresses_of_locals (fun b -> Base.Hptset.mem b vars) - in (* Detect whether we are deallocating an inner block of the function, or a formal/a toplevel local. This is used for the warning message. *) let is_inner_block = let b = Base.Hptset.choose vars in not (Base.is_formal b fundec || Base.is_block_local b fundec.sbody) in - let state_top_addresses_of_locals = - state_top_addresses_of_locals - (Warn.warn_locals_escape is_inner_block fundec) - offsetmap_top_addresses_of_locals - clob + let escaping = vars in + let on_escaping ~b ~itv:_ ~v = + let bases_v = Cvalue.(V.get_bases v) in + let escaping = Base.SetLattice.inject escaping in + let bases = Base.SetLattice.meet escaping bases_v in + Warn.warn_locals_escape is_inner_block fundec b bases in - state_top_addresses_of_locals ~exact:true state + make_escaping ~exact:true ~escaping ~on_escaping ~within:clob.clob state (* diff --git a/src/plugins/value/domains/cvalue/locals_scoping.mli b/src/plugins/value/domains/cvalue/locals_scoping.mli index 1486df947281b9f6fcb1df928195e4a6253ba039..669535cb4986f8f89827a824427ded909f6251ef 100644 --- a/src/plugins/value/domains/cvalue/locals_scoping.mli +++ b/src/plugins/value/domains/cvalue/locals_scoping.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -43,71 +43,32 @@ val remember_if_locals_in_value: (** [remember_locals_in_value clob loc v] adds all bases pointed to by [loc] to [clob] if [v] contains the address of a local or formal *) -val remember_if_locals_in_offsetmap: - clobbered_set -> Locations.location -> Cvalue.V_Offsetmap.t -> unit -(** Same as above with an entire offsetmap *) - val offsetmap_contains_local: Cvalue.V_Offsetmap.t -> bool -type topify_offsetmap = - Cvalue.V_Offsetmap.t -> - Base.SetLattice.t * Cvalue.V_Offsetmap.t -(** Type of a function that topifies the references to a local in an offsetmap. - It returns the cleared up offsetmap, and the of variables whose address - was found *) - -type topify_offsetmap_approx = - exact:bool -> - topify_offsetmap -(** Type of a function that partially topifies the references to a local in - an offsetmap. If [exact] is false, references to locals are both kept and - flagged as being escaping addresses. *) - -type topify_state = Cvalue.Model.t -> Cvalue.Model.t -(** Type of a function that topifies a state. Introduced here by symmetry. *) - - -val offsetmap_top_addresses_of_locals: - (Base.t -> bool) -> - topify_offsetmap_approx -(** [offsetmap_top_addresses_of_locals is_local] returns a function that - topifies all the parts of an offsetmap that contains a pointer verifying - [is_local]. For efficiency reasons, this function is meant to be partially - applied to its first argument. *) -val state_top_addresses_of_locals: +val make_escaping: exact:bool -> - (Base.t -> Base.SetLattice.t -> unit) -> - topify_offsetmap_approx -> - clobbered_set -> - topify_state -(** [state_top_addresses_of_locals exact warn topoffsm clob] generalizes - [topoffsm] into a function that topifies a memory state. [topoffsm] is - called only on the offsetmaps bound to the bases in [clob]. The [exact] - argument is passed to [topoffsm]. If escaping locals [locals] are referenced - in the offsetmap bound to [b], [warn b locals] is called. *) - -val top_addresses_of_locals: - Cil_types.fundec -> clobbered_set -> topify_offsetmap * topify_state -(** Return two functions that topifies all references to the locals and formals - of the given function. For memory states, only the offsetmaps bound - to the variables in the clobbered set are treated. *) - -val block_top_addresses_of_locals: - Cil_types.fundec -> clobbered_set -> Cil_types.block list -> topify_state -(** Return a function that topifies all references to the variables local - to the given blocks. Only the offsetmaps bound to the variables in the - clobbered set are treated. *) - -val state_top_addresses: + escaping:Base.Hptset.t -> + on_escaping:(b:Base.t -> itv:Integer.t * Integer.t -> v:Cvalue.V.t -> unit) -> + within:Base.SetLattice.t -> + Cvalue.Model.t -> Cvalue.Model.t +(** [make_escaping ~exact ~escaping ~on_escaping ~within state] changes all + references to the variables in [escaping] to "escaping address". + All such references must be in the offsetmaps bound to [within]. + [on_escaping b itv v] is called when a reference is found: [v] is the value + that refers to [escaping], [b] is the base in which [v] appears + (included in [within]) and [itv] is the offset at which [v] appears. + If [exact] holds, a strong update is performed. Otherwise, only + a week update is executed. *) + +val make_escaping_fundec: Cil_types.fundec -> clobbered_set -> Cil_types.varinfo list -> Cvalue.Model.t -> Cvalue.Model.t -(** [state_top_addresses kf clob l state] topifies all references to the - variables in [l]. For efficiency reasons, only the variables referenced - in [clob]. Indeed, by construction, [clob] should be an over-approximation - of the variables that may contain a reference to [l]. - - This function is the one that should be used in Eva. *) +(** [make_escaping_fundec fdec clob l state] changes all references to the + local or formal variables in [l] to "escaping". All pointers to [l] should + be in the offsetmap bound to the variables contained in [clob]. + [fdec] is used to detect whether we are deallocating the outer scope of a + function, in which case a different warning is emitted. *) (* diff --git a/src/plugins/value/domains/cvalue/warn.ml b/src/plugins/value/domains/cvalue/warn.ml new file mode 100644 index 0000000000000000000000000000000000000000..914200b4b0cec74eccdddf2c574492037f9ff6fc --- /dev/null +++ b/src/plugins/value/domains/cvalue/warn.ml @@ -0,0 +1,134 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types +open Locations + +let warn_locals_escape is_block fundec k locals = + let pretty_base = Base.pretty in + let pretty_block fmt = Pretty_utils.pp_cond is_block fmt "a block of " in + let sv = fundec.svar in + match locals with + | Base.SetLattice.Top -> + Value_util.warning_once_current + "locals escaping the scope of %t%a through %a" + pretty_block + Printer.pp_varinfo sv + pretty_base k + | Base.SetLattice.Set _ -> + Value_util.warning_once_current + "locals %a escaping the scope of %t%a through %a" + Base.SetLattice.pretty locals + pretty_block + Printer.pp_varinfo sv + pretty_base k + +let warn_imprecise_lval_read lv loc contents = + if Value_parameters.verbose_atleast 1 then + let pretty_gm fmt s = + let s = Base.SetLattice.(inject (O.remove Base.null s)) in + Base.SetLattice.pretty fmt s + in + let pretty_param fmt param = + match param with + | Base.SetLattice.Top -> Format.fprintf fmt "is imprecise" + | Base.SetLattice.Set s -> + Format.fprintf fmt "is a garbled mix of %a" pretty_gm s + in + let pretty_param_b fmt param = + match param with + | Base.SetLattice.Top -> + Format.fprintf fmt "The contents@ are imprecise" + | Base.SetLattice.Set s -> + Format.fprintf fmt "It contains@ a garbled@ mix@ of@ %a" pretty_gm s + in + let something_to_warn = + match loc.loc with + | Location_Bits.Top _ -> true + | Location_Bits.Map _ -> + match contents with + | Location_Bytes.Top _ -> true + | Location_Bytes.Map _ -> false + in + if something_to_warn + then + Value_parameters.result ~current:true ~once:true + "@[<v>@[Reading left-value %a.@]@ %t%t%t@]" + Printer.pp_lval lv + (fun fmt -> + match loc.loc with + | Location_Bits.Top (param,o) when Origin.equal o Origin.top -> + Format.fprintf fmt "@[The location %a.@]@ " + pretty_param param + | Location_Bits.Top (param,orig) -> + Format.fprintf fmt "@[The location @[%a@]@ because of@ %a.@]@ " + pretty_param param + Origin.pretty orig + | Location_Bits.Map _ -> + match lv with + | Mem _, _ -> + Format.fprintf fmt "@[The location is @[%a@].@]@ " + Location_Bits.pretty loc.loc + | Var _, _ -> () + ) + (fun fmt -> + match contents with + | Location_Bytes.Top (param,o) when Origin.equal o Origin.top -> + Format.fprintf fmt "@[%a.@]" + pretty_param_b param + | Location_Bytes.Top (param,orig) -> + Format.fprintf fmt "@[%a@ because of@ %a.@]" + pretty_param_b param + Origin.pretty orig + | Location_Bytes.Map _ -> ()) + Value_util.pp_callstack + +(* Auxiliary function for [do_assign] below. When computing the + result of [lv = exp], warn if the evaluation of [exp] results in + an imprecision. [loc_lv] is the location pointed to by [lv]. + [exp_val] is the part of the evaluation of [exp] that is imprecise. *) +let warn_right_exp_imprecision lv loc_lv exp_val = + match exp_val with + | Location_Bytes.Top(_topparam,origin) -> + Value_parameters.result ~once:true ~current:true + "@[<v>@[Assigning imprecise value to %a%t.@]%a%t@]" + Printer.pp_lval lv + (fun fmt -> match lv with + | (Mem _, _) -> + Format.fprintf fmt "@ (pointing to %a)" + (Locations.pretty_english ~prefix:false) loc_lv + | (Var _, _) -> ()) + (fun fmt org -> + if not (Origin.is_top origin) then + Format.fprintf fmt + "@ @[The imprecision@ originates@ from@ %a@]" + Origin.pretty org) + origin + Value_util.pp_callstack + | Location_Bytes.Map _ -> () + + +(* +Local Variables: +compile-command: "make -C ../../../.." +End: +*) diff --git a/src/plugins/value/legacy/initial_state.mli b/src/plugins/value/domains/cvalue/warn.mli similarity index 80% rename from src/plugins/value/legacy/initial_state.mli rename to src/plugins/value/domains/cvalue/warn.mli index f44ee06e4c974930160841069959d10d30299231..25db140323af5cca12a23609cb39a018e7f39cfd 100644 --- a/src/plugins/value/legacy/initial_state.mli +++ b/src/plugins/value/domains/cvalue/warn.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,16 +20,11 @@ (* *) (**************************************************************************) -(** Creation of the initial state for Value. *) +(** Alarms and imprecision warnings emitted during the analysis. *) -val initial_state_not_lib_entry: unit -> Cvalue.Model.t -val initial_state_lib_entry: unit -> Cvalue.Model.t +open Cil_types +open Locations -val initialize_var_using_type: - Cil_types.varinfo -> Cvalue.Model.t -> Cvalue.Model.t - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) +val warn_locals_escape: bool -> fundec -> Base.t -> Base.SetLattice.t -> unit +val warn_imprecise_lval_read: lval -> location -> Location_Bytes.t -> unit +val warn_right_exp_imprecision: lval -> location -> Cvalue.V.t -> unit diff --git a/src/plugins/value/domains/domain_builder.ml b/src/plugins/value/domains/domain_builder.ml index 4726e0e8f6b90fabeea8e35f025c200712aa7c73..0463cef70dedfaf9da136c023d07d3ecf233c732 100644 --- a/src/plugins/value/domains/domain_builder.ml +++ b/src/plugins/value/domains/domain_builder.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,3 +34,248 @@ module Complete module Store = Domain_store.Make (Domain) end + +open Simpler_domains + +let simplify_argument argument = + { formal = argument.Eval.formal; + concrete = argument.Eval.concrete } + +let simplify_call call = + { kf = call.Eval.kf; + arguments = List.map simplify_argument call.Eval.arguments; + rest = List.map fst call.Eval.rest; + return = call.Eval.return; + recursive = call.Eval.recursive } + +module Make_Minimal + (Value: Abstract_value.S) + (Location: Abstract_location.S) + (Domain: Simpler_domains.Minimal) += struct + + include Domain + + let structure = Abstract_domain.Void + let log_category = Value_parameters.register_category ("d-" ^ name) + + type value = Value.t + type location = Location.location + type state = Domain.t + type origin = unit + + let narrow x _y = `Value x + + let top_answer = `Value (Value.top, ()), Alarmset.all + let extract_expr _oracle _state _expr = top_answer + let extract_lval _oracle _state _lval _typ _location = top_answer + let backward_location _state _lval _typ location value = `Value (location, value) + let reduce_further _sttae _expr _value = [] + + module Transfer + (Valuation: Abstract_domain.Valuation with type value = value + and type origin = origin + and type loc = location) + = struct + + let update _valuation state = state + + let assign kinstr lv expr _value _valuation state = + Domain.assign kinstr lv.Eval.lval expr state + + let assume stmt expr positive _valuation state = + Domain.assume stmt expr positive state + + let start_call stmt call _valuation state = + Eval.Compute + (Eval.Continue (Domain.start_call stmt (simplify_call call) state), + true) + + let finalize_call stmt call ~pre ~post = + Domain.finalize_call stmt (simplify_call call) ~pre ~post + + let approximate_call stmt call state = + let call = simplify_call call in + let name = Kernel_function.get_name call.kf in + if Ast_info.is_frama_c_builtin name || + (name <> "free" && Eval_typ.kf_assigns_only_result_or_volatile call.kf) + then `Value [ state ] + else Domain.approximate_call stmt call state + + let show_expr _valuation = Domain.show_expr + end + + let enter_loop _stmt state = state + let incr_loop_counter _stmt state = state + let leave_loop _stmt state = state + + let initialize_variable lval _location ~initialized value state = + Domain.initialize_variable lval ~initialized value state + + let initialize_variable_using_type _kind varinfo state = + let lval = Cil.var varinfo in + let state = introduce_globals [varinfo] state in + Domain.initialize_variable lval ~initialized:true Abstract_domain.Top state + + let logic_assign _assigns _location ~pre:_ _state = top + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ t _ _ = `Value t + + let filter_by_bases _bases state = state + let reuse ~current_input:_ ~previous_output = previous_output +end + + +module Complete_Minimal + (Value: Abstract_value.S) + (Location: Abstract_location.S) + (Domain: Simpler_domains.Minimal) += struct + + module D = struct + include Make_Minimal (Value) (Location) (Domain) + + include + (Datatype.Make_with_collections + (struct + include Datatype.Undefined + type t = Domain.t + let name = Domain.name + let reprs = [ Domain.top ] + let equal x y = Domain.compare x y = 0 + let compare = Domain.compare + let hash = Domain.hash + let pretty = Domain.pretty + let mem_project = Datatype.never_any_project + end) + : Datatype.S_with_collections with type t := t) + + let storage () = false + end + + include Complete (D) + +end + + +module Complete_Minimal_with_datatype + (Value: Abstract_value.S) + (Location: Abstract_location.S) + (Domain: Minimal_with_datatype) += struct + + module D = struct + + include Make_Minimal (Value) (Location) (Domain) + + include + (Datatype.With_collections + (Domain) (struct let module_name = Domain.name end) + : Datatype.S_with_collections with type t := t) + + let storage () = false + end + + include Complete (D) + +end + +open Eval + +module Complete_Simple_Cvalue (Domain: Simpler_domains.Simple_Cvalue) += struct + + module D = struct + include Domain + + include + (Datatype.With_collections + (Domain) (struct let module_name = Domain.name end) + : Datatype.S_with_collections with type t := t) + + let structure = Abstract_domain.Void + let log_category = Value_parameters.register_category ("d-" ^ name) + + type value = Cvalue.V.t + type location = Precise_locs.precise_location + type state = Domain.t + type origin = unit + + let narrow x _y = `Value x + + let extract_expr _oracle state expr = + let v = Domain.extract_expr state expr >>-: fun v -> v, () in + v, Alarmset.all + + let extract_lval _oracle state lval typ location = + let v = Domain.extract_lval state lval typ location >>-: fun v -> v, () in + v, Alarmset.all + + let backward_location _state _lval _typ location value = + `Value (location, value) + + let reduce_further _state _expr _value = [] + + module Transfer + (Valuation: Abstract_domain.Valuation with type value = value + and type origin = origin + and type loc = location) + = struct + + let find valuation expr = + match Valuation.find valuation expr with + | `Top -> `Top + | `Value record -> `Value record.value + + let find_loc valuation lval = + match Valuation.find_loc valuation lval with + | `Top -> `Top + | `Value record -> `Value record.loc + + let record valuation = { find = find valuation; + find_loc = find_loc valuation; } + + let update _valuation state = state + let assign kinstr lv expr value valuation state = + Domain.assign kinstr lv expr value (record valuation) state + let assume stmt expr positive valuation state = + Domain.assume stmt expr positive (record valuation) state + let start_call stmt call valuation state = + Compute (Continue (Domain.start_call stmt call (record valuation) state), + true) + let finalize_call = Domain.finalize_call + + let approximate_call stmt call state = + let name = Kernel_function.get_name call.kf in + if Ast_info.is_frama_c_builtin name + then `Value [ state ] + else Domain.approximate_call stmt call state + + let show_expr _valuation = Domain.show_expr + + end + + let enter_loop _stmt state = state + let incr_loop_counter _stmt state = state + let leave_loop _stmt state = state + + let initialize_variable lval _location ~initialized value state = + Domain.initialize_variable lval ~initialized value state + + let initialize_variable_using_type _kind varinfo state = + let lval = Cil.var varinfo in + let state = introduce_globals [varinfo] state in + Domain.initialize_variable lval ~initialized:true Abstract_domain.Top state + + let logic_assign _assigns _location ~pre:_ _state = top + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ t _ _ = `Value t + + let filter_by_bases _bases state = state + let reuse ~current_input:_ ~previous_output = previous_output + + let storage () = false + end + + include Complete (D) +end diff --git a/src/plugins/value/domains/domain_builder.mli b/src/plugins/value/domains/domain_builder.mli index 749ed252c2a900d6cb672dd0a3a43bf7f3360c47..8ed4b4165bb80db42b006729b7b90adc0ace0e33 100644 --- a/src/plugins/value/domains/domain_builder.mli +++ b/src/plugins/value/domains/domain_builder.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,6 +20,9 @@ (* *) (**************************************************************************) +(** Automatic builders to complete abstract domains from different + simplified interfaces. *) + module type InputDomain = sig include Abstract_domain.S_with_Structure val storage: unit -> bool @@ -30,3 +33,25 @@ module Complete : Abstract_domain.Internal with type state = Domain.state and type value = Domain.value and type location = Domain.location + +module Complete_Minimal + (Value: Abstract_value.S) + (Location: Abstract_location.S) + (Domain: Simpler_domains.Minimal) + : Abstract_domain.Internal with type value = Value.t + and type location = Location.location + and type state = Domain.t + +module Complete_Minimal_with_datatype + (Value: Abstract_value.S) + (Location: Abstract_location.S) + (Domain: Simpler_domains.Minimal_with_datatype) + : Abstract_domain.Internal with type value = Value.t + and type location = Location.location + and type state = Domain.t + +module Complete_Simple_Cvalue + (Domain: Simpler_domains.Simple_Cvalue) + : Abstract_domain.Internal with type value = Cvalue.V.t + and type location = Precise_locs.precise_location + and type state = Domain.t diff --git a/src/plugins/value/domains/domain_lift.ml b/src/plugins/value/domains/domain_lift.ml index a1cd9734652574b656cb30d919a9a7fdbbe03708..2bc3b1fa9449e5c180d59529c925856ada99595e 100644 --- a/src/plugins/value/domains/domain_lift.ml +++ b/src/plugins/value/domains/domain_lift.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -46,6 +46,7 @@ module Make include (Domain : Abstract_domain.Lattice with type state = Domain.state) let structure = Domain.structure + let log_category = Domain.log_category type value = Convert.extended_value type location = Convert.extended_location @@ -123,11 +124,6 @@ module Make module Internal_Transfer = Domain.Transfer (Internal_Valuation) - type state = Domain.state - type value = Convert.extended_value - type location = Convert.extended_location - type valuation = Valuation.t - let update = Internal_Transfer.update let assign stmt lv expr value valuation state = @@ -147,13 +143,14 @@ module Make let approximate_call stmt call state = Internal_Transfer.approximate_call stmt (lift_call call) state + let show_expr = Internal_Transfer.show_expr end - let compute_using_specification kinstr call spec state = - let call = lift_call call in - Domain.compute_using_specification kinstr call spec state + let logic_assign assigns location ~pre state = + Domain.logic_assign assigns (Convert.restrict_loc location) ~pre state - include (Domain : Abstract_domain.Logic with type state := t) + let evaluate_predicate = Domain.evaluate_predicate + let reduce_by_predicate = Domain.reduce_by_predicate let enter_scope = Domain.enter_scope let leave_scope = Domain.leave_scope @@ -163,13 +160,12 @@ module Make let leave_loop = Domain.leave_loop let empty = Domain.empty - let initialize_var state lval loc value = + let introduce_globals = Domain.introduce_globals + let initialize_variable lval loc ~initialized init_value state = let loc = Convert.restrict_loc loc in - let value = value >>-: fun (v, b) -> Convert.restrict_val v, b in - Domain.initialize_var state lval loc value + Domain.initialize_variable lval loc ~initialized init_value state - let initialize_var_using_type = Domain.initialize_var_using_type - let global_state = Domain.global_state + let initialize_variable_using_type = Domain.initialize_variable_using_type let filter_by_bases = Domain.filter_by_bases let reuse = Domain.reuse diff --git a/src/plugins/value/domains/domain_lift.mli b/src/plugins/value/domains/domain_lift.mli index bee39dbe6bc9ef4cbc0f03531f1ed50ed7ec8e13..8d563da61368a6dfa81324429adb07992eeb1a0c 100644 --- a/src/plugins/value/domains/domain_lift.mli +++ b/src/plugins/value/domains/domain_lift.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/domain_product.ml b/src/plugins/value/domains/domain_product.ml index ca54ae287156cafc8848dad48953c611c515f876..5578ef8018aa5197524e9e7b7ec0670514b0a2d6 100644 --- a/src/plugins/value/domains/domain_product.ml +++ b/src/plugins/value/domains/domain_product.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -24,6 +24,8 @@ open Eval let counter = ref 0 +let product_category = Value_parameters.register_category "domain_product" + module Make (Value: Abstract_value.S) (Left: Abstract_domain.Internal with type value = Value.t) @@ -49,24 +51,23 @@ module Make (struct let module_name = name end) type state = t - let pretty fmt (left, right) = - Format.fprintf fmt - "@[<v>(@[%a@]@ ,@ @[%a@])@]" Left.pretty left Right.pretty right - let structure = Abstract_domain.Node (Left.structure, Right.structure) + let log_category = product_category + let top = Left.top, Right.top let is_included (left1, right1) (left2, right2) = Left.is_included left1 left2 && Right.is_included right1 right2 let join (left1, right1) (left2, right2) = Left.join left1 left2, Right.join right1 right2 - let join_and_is_included (left1, right1) (left2, right2) = - let left, b1 = Left.join_and_is_included left1 left2 - and right, b2 = Right.join_and_is_included right1 right2 in - (left, right), b1 && b2 let widen kf stmt (left1, right1) (left2, right2) = Left.widen kf stmt left1 left2, Right.widen kf stmt right1 right2 + let narrow (left1, right1) (left2, right2) = + Left.narrow left1 left2 >>- fun left -> + Right.narrow right1 right2 >>-: fun right -> + (left, right) + let merge (eval1, alarms1) (eval2, alarms2) = match Alarmset.inter alarms1 alarms2 with @@ -136,11 +137,6 @@ module Make and type loc = location) = struct - type state = t - type value = Value.t - type location = Left.location - type valuation = Valuation.t - module type Lift = sig type o val side : origin -> reductness * o @@ -240,48 +236,91 @@ module Make in Result (result, c2) + let show_expr = + let (|-) f g = fun fmt exp -> f fmt exp; g fmt exp in + let show_expr_one_side category name show_expr = fun fmt exp -> + if Value_parameters.is_debug_key_enabled category + then Format.fprintf fmt "@,@]@[<v># %s: @[<hov>%a@]" name show_expr exp + in + let right_log = Right.log_category + and left_log = Left.log_category in + match left_log = product_category, + right_log = product_category with + | true, true -> + (fun valuation (left, right) -> + Left_Transfer.show_expr valuation left |- + Right_Transfer.show_expr valuation right) + | true, false -> + (fun valuation (left, right) -> + Left_Transfer.show_expr valuation left |- + show_expr_one_side right_log Right.name + (Right_Transfer.show_expr valuation right)) + | false, true -> + (fun valuation (left, right) -> + show_expr_one_side left_log Left.name + (Left_Transfer.show_expr valuation left) |- + Right_Transfer.show_expr valuation right) + | false, false -> + (fun valuation (left, right) -> + show_expr_one_side left_log Left.name + (Left_Transfer.show_expr valuation left) |- + show_expr_one_side right_log Right.name + (Right_Transfer.show_expr valuation right)) end - - (* TODO *) - let compute_using_specification kinstr call spec (left, right) = - Left.compute_using_specification kinstr call spec left >>- fun left -> - Right.compute_using_specification kinstr call spec right >>-: fun right -> - merge_results call.kf left right - - - type eval_env = Left.eval_env * Right.eval_env - - let env_current_state (left, right) = - Left.env_current_state left >>- fun left_env -> - Right.env_current_state right >>-: fun right_env -> - left_env, right_env - - let env_annot ~pre ~here () = - Left.env_annot ~pre:(fst pre) ~here:(fst here) (), - Right.env_annot ~pre:(snd pre) ~here:(snd here) () - - let env_pre_f ~pre () = - Left.env_pre_f ~pre:(fst pre) (), Right.env_pre_f ~pre:(snd pre) () - - let env_post_f ~pre ~post ~result () = - Left.env_post_f ~pre:(fst pre) ~post:(fst post) ~result (), - Right.env_post_f ~pre:(snd pre) ~post:(snd post) ~result () - - let eval_predicate (left, right) pred = - let status = - Alarmset.Status.inter - (Left.eval_predicate left pred) (Right.eval_predicate right pred) + let pretty = + let print_one_side fmt category name dump state = + if Value_parameters.is_debug_key_enabled category + then Format.fprintf fmt "# %s:@ @[<hv>%a@]@ " name dump state in - match status with + let right_log = Right.log_category + and left_log = Left.log_category in + match left_log = product_category, + right_log = product_category with + | true, true -> + (fun fmt (left, right) -> + Left.pretty fmt left; + Right.pretty fmt right) + | true, false -> + (fun fmt (left, right) -> + Left.pretty fmt left; + print_one_side fmt right_log Right.name Right.pretty right) + | false, true -> + (fun fmt (left, right) -> + print_one_side fmt left_log Left.name Left.pretty left; + Right.pretty fmt right) + | false, false -> + (fun fmt (left, right) -> + print_one_side fmt left_log Left.name Left.pretty left; + print_one_side fmt right_log Right.name Right.pretty right) + + + let logic_assign assign location ~pre:(left_pre, right_pre) (left, right) = + Left.logic_assign assign location ~pre:left_pre left, + Right.logic_assign assign location ~pre:right_pre right + + let lift_logic_env f logic_env = + Abstract_domain.{ states = (fun label -> f (logic_env.states label)); + result = logic_env.result; } + + let split_logic_env logic_env = + lift_logic_env fst logic_env, lift_logic_env snd logic_env + + let evaluate_predicate logic_environment (left, right) pred = + let left_env, right_env = split_logic_env logic_environment in + let left_status = Left.evaluate_predicate left_env left pred + and right_status = Right.evaluate_predicate right_env right pred in + match Alarmset.Status.inter left_status right_status with | `Inconsistent -> Value_parameters.abort ~current:true ~once:true "Inconsistent status of alarms: unsound states." | `Value status -> status - let reduce_by_predicate (left, right) positive pred = - Left.reduce_by_predicate left positive pred, - Right.reduce_by_predicate right positive pred + let reduce_by_predicate logic_environment (left, right) pred positive = + let left_env, right_env = split_logic_env logic_environment in + Left.reduce_by_predicate left_env left pred positive >>- fun left -> + Right.reduce_by_predicate right_env right pred positive >>-: fun right -> + left, right let enter_scope kf vars (left, right) = Left.enter_scope kf vars left, Right.enter_scope kf vars right @@ -296,18 +335,14 @@ module Make Left.leave_loop stmt left, Right.leave_loop stmt right let empty () = Left.empty (), Right.empty () - let initialize_var (left, right) lval loc value = - Left.initialize_var left lval loc value, - Right.initialize_var right lval loc value - let initialize_var_using_type (left, right) varinfo = - Left.initialize_var_using_type left varinfo, - Right.initialize_var_using_type right varinfo - let global_state () = - match Left.global_state (), Right.global_state () with - | None, None -> None - | None, Some s -> Some (s >>-: fun s -> Left.top, s) - | Some s, None -> Some (s >>-: fun s -> s, Right.top) - | Some l, Some r -> Some (l >>- fun l -> r >>-: fun r -> l, r) + let introduce_globals vars (left, right) = + Left.introduce_globals vars left, Right.introduce_globals vars right + let initialize_variable lval loc ~initialized init_value (left, right) = + Left.initialize_variable lval loc ~initialized init_value left, + Right.initialize_variable lval loc ~initialized init_value right + let initialize_variable_using_type kind varinfo (left, right) = + Left.initialize_variable_using_type kind varinfo left, + Right.initialize_variable_using_type kind varinfo right let filter_by_bases bases (left, right) = @@ -319,7 +354,7 @@ module Make ~current_input:(snd current_input) ~previous_output:(snd previous_output) - let merge_callstack_tbl left_tbl right_tbl = + let merge_tbl left_tbl right_tbl = let open Value_types in let tbl = Callstack.Hashtbl.create 7 in let merge callstack left = @@ -330,9 +365,27 @@ module Make Not_found -> () in Callstack.Hashtbl.iter merge left_tbl; - Some tbl + if Callstack.Hashtbl.length tbl > 0 then `Value tbl else `Bottom + + let lift_tbl f tbl = + let open Value_types in + let new_tbl = Callstack.Hashtbl.create 7 in + let lift cs t = Callstack.Hashtbl.replace new_tbl cs (f t) in + Callstack.Hashtbl.iter lift tbl; + `Value new_tbl + + let merge_callstack_tbl left right = + match left, right with + | `Top, `Top -> `Top + | `Value left, `Value right -> merge_tbl left right + | `Top, `Value right -> lift_tbl (fun t -> Left.top, t) right + | `Value left, `Top -> lift_tbl (fun t -> t, Right.top) left + | `Bottom, _ | _, `Bottom -> `Bottom module Store = struct + let register_global_state state = + Left.Store.register_global_state (state >>-: fst); + Right.Store.register_global_state (state >>-: snd) let register_initial_state callstack (left, right) = Left.Store.register_initial_state callstack left; Right.Store.register_initial_state callstack right @@ -343,6 +396,10 @@ module Make Left.Store.register_state_after_stmt callstack stmt left; Right.Store.register_state_after_stmt callstack stmt right + let get_global_state () = + Left.Store.get_global_state () >>- fun left -> + Right.Store.get_global_state () >>-: fun right -> + left, right let get_initial_state kf = Left.Store.get_initial_state kf >>- fun left -> Right.Store.get_initial_state kf >>-: fun right -> @@ -350,9 +407,7 @@ module Make let get_initial_state_by_callstack kf = let left_tbl = Left.Store.get_initial_state_by_callstack kf and right_tbl = Right.Store.get_initial_state_by_callstack kf in - match left_tbl, right_tbl with - | Some left, Some right -> merge_callstack_tbl left right - | _, _ -> None + merge_callstack_tbl left_tbl right_tbl let get_stmt_state stmt = Left.Store.get_stmt_state stmt >>- fun left -> @@ -361,9 +416,7 @@ module Make let get_stmt_state_by_callstack ~after stmt = let left_tbl = Left.Store.get_stmt_state_by_callstack ~after stmt and right_tbl = Right.Store.get_stmt_state_by_callstack ~after stmt in - match left_tbl, right_tbl with - | Some left, Some right -> merge_callstack_tbl left right - | _, _ -> None + merge_callstack_tbl left_tbl right_tbl end diff --git a/src/plugins/value/domains/domain_product.mli b/src/plugins/value/domains/domain_product.mli index 7e902aa10bbe19ca7616b6614cd7197d09655b56..2b18a7a53e7bd62cdc46a91494b28ccddfe23598 100644 --- a/src/plugins/value/domains/domain_product.mli +++ b/src/plugins/value/domains/domain_product.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,6 +20,7 @@ (* *) (**************************************************************************) +val product_category: Log.category module Make (Value: Abstract_value.S) diff --git a/src/plugins/value/domains/domain_store.ml b/src/plugins/value/domains/domain_store.ml index 96384fc28bcb788c443e748943f2ef83f3ba9b42..31cfe893fa022e8bc05c7f1946c72cddd0afa834 100644 --- a/src/plugins/value/domains/domain_store.ml +++ b/src/plugins/value/domains/domain_store.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,24 +30,30 @@ end module Make (Domain: InputDomain) = struct - let name = Domain.name ^ "_Store" + let name = Domain.name ^ ".Store" + + (* This module stores the resulting states of an Eva analysis. They depends on + the set of parameters with which the analysis has been run, and must be + cleared each time one of this parameter is changed. Thus, the tables of + this module have as dependencies Db.Value.self, the internal state of Eva + (all parameters of Eva are added as codependencies of this state). *) + let dependencies = [ Db.Value.self ] + let size = 16 module Storage = State_builder.Ref (Datatype.Bool) (struct - let dependencies = [Db.Value.self] + let dependencies = dependencies let name = name ^ ".Storage" let default () = false end) - (* Do NOT add dependencies to Kernel parameters here, but at the top of - Value/Value_parameters *) - let dependencies = - [ Ast.self; - Alarms.self; - Annotations.code_annot_state ] - - let size = 1789 + module Global_State = + State_builder.Option_ref (Domain) + (struct + let dependencies = dependencies + let name = name ^ ".Global_State" + end) module States_by_callstack = Value_types.Callstack.Hashtbl.Make (Domain) @@ -55,52 +61,34 @@ module Make (Domain: InputDomain) = struct module Table_By_Callstack = Cil_state_builder.Stmt_hashtbl(States_by_callstack) (struct - let name = Domain.name ^ " results by callstack" + let name = name ^ ".Table_By_Callstack" let size = size let dependencies = dependencies end) module Table = Cil_state_builder.Stmt_hashtbl (Domain) (struct - let name = Domain.name ^ " results" + let name = name ^ ".Table" let size = size let dependencies = [ Table_By_Callstack.self ] end) - (* Clear Value's various caches each time [Db.Value.is_computed] is updated, - including when it is set, reset, or during project change. Some operations - of Value depend on -ilevel, -plevel, etc, so clearing those caches when - Value ends ensures that those options will have an effect between two runs - of Value. *) - let () = Table_By_Callstack.add_hook_on_update - (fun _ -> - Cvalue.V_Offsetmap.clear_caches (); - Cvalue.Model.clear_caches (); - Locations.Location_Bytes.clear_caches (); - Locations.Zone.clear_caches (); - Function_Froms.Memory.clear_caches (); - ) module AfterTable_By_Callstack = Cil_state_builder.Stmt_hashtbl (States_by_callstack) (struct - let name = Domain.name ^ " results after states by callstack" + let name = name ^ ".AfterTable_By_Callstack" let size = size let dependencies = dependencies end) - - let self = Table_By_Callstack.self - let only_self = [ self ] - - module Called_Functions_By_Callstack = State_builder.Hashtbl (Kernel_function.Hashtbl) (States_by_callstack) (struct - let name = name ^ ".called_functions_by_callstack" + let name = name ^ ".Called_Functions_By_Callstack" let size = 11 - let dependencies = only_self + let dependencies = dependencies end) module Called_Functions_Memo = @@ -108,7 +96,7 @@ module Make (Domain: InputDomain) = struct (Kernel_function.Hashtbl) (Domain) (struct - let name = name ^ ".called_functions_memo" + let name = name ^ ".Called_Functions_Memo" let size = 11 let dependencies = [ Called_Functions_By_Callstack.self ] end) @@ -133,12 +121,16 @@ module Make (Domain: InputDomain) = struct Callstack.Hashtbl.add r callstack v; add stmt r - let register_initial_state callstack state = - let storage = match callstack with - | [_, Cil_types.Kglobal] -> let s = Domain.storage () in Storage.set s; s - | _ -> Storage.get () - in + let register_global_state state = + let storage = Domain.storage () in + Storage.set storage; if storage then + match state with + | `Bottom -> () + | `Value state -> Global_State.set state + + let register_initial_state callstack state = + if Storage.get () then let open Value_types in let kf = match callstack with (kf, _) :: _ -> kf | _ -> assert false in let by_callstack = @@ -154,6 +146,13 @@ module Make (Domain: InputDomain) = struct with Not_found -> Callstack.Hashtbl.add by_callstack callstack state + let get_global_state () = + if not (Storage.get ()) + then `Value Domain.top + else match Global_State.get_option () with + | None -> `Bottom + | Some state -> `Value state + let get_initial_state kf = if not (Storage.get ()) then `Value Domain.top @@ -172,8 +171,11 @@ module Make (Domain: InputDomain) = struct with Not_found -> `Bottom let get_initial_state_by_callstack kf = - try Some (Called_Functions_By_Callstack.find kf) - with Not_found -> None + if not (Storage.get ()) + then `Top + else + try `Value (Called_Functions_By_Callstack.find kf) + with Not_found -> `Bottom let get_stmt_state s = if not (Storage.get ()) @@ -194,11 +196,13 @@ module Make (Domain: InputDomain) = struct state let get_stmt_state_by_callstack ~after stmt = - try - Some (if after then AfterTable_By_Callstack.find stmt - else Table_By_Callstack.find stmt) - with Not_found -> None - + if not (Storage.get ()) + then `Top + else + try `Value (if after + then AfterTable_By_Callstack.find stmt + else Table_By_Callstack.find stmt) + with Not_found -> `Bottom let register_state_before_stmt callstack stmt state = if Storage.get () diff --git a/src/plugins/value/domains/domain_store.mli b/src/plugins/value/domains/domain_store.mli index f96f5b7f608d3b1f95cf5c250133f002dfc0a74d..de757fddaa85d633204e96822804669dcbab9ef3 100644 --- a/src/plugins/value/domains/domain_store.mli +++ b/src/plugins/value/domains/domain_store.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/equality/equality.ml b/src/plugins/value/domains/equality/equality.ml index b480d960c5cf03169f9f80e0ab8a3ebbdb5170cd..76759a1865436bca32544504d624780e2f352447 100644 --- a/src/plugins/value/domains/equality/equality.ml +++ b/src/plugins/value/domains/equality/equality.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/equality/equality.mli b/src/plugins/value/domains/equality/equality.mli index f3f1d65eeb20a5cacc4c73972c307135087bdf8f..b9ae74fe083940d085ad9617a8580bec9e598f25 100644 --- a/src/plugins/value/domains/equality/equality.mli +++ b/src/plugins/value/domains/equality/equality.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/equality/equality_domain.ml b/src/plugins/value/domains/equality/equality_domain.ml index c669af3c3a0b343b4c03f674afc7e9747ca887b1..e25783ee37eb542fdfcc3fb69a8ec1b5de25bf50 100644 --- a/src/plugins/value/domains/equality/equality_domain.ml +++ b/src/plugins/value/domains/equality/equality_domain.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -44,13 +44,14 @@ module type S = sig val project : t -> equalities end -let dkey = Value_parameters.register_category "d-eq" +let dkey = Value_parameters.register_category "d-eqs" module type InternalDatatype = sig include Datatype.S_with_collections include Abstract_domain.Lattice with type state = t module Store: Abstract_domain.Store with type state := state val structure : t Abstract_domain.structure + val log_category : Log.category val key : t Abstract_domain.key type equalities val project : t -> equalities @@ -144,26 +145,28 @@ module MakeDatatype type state = t - let key = Structure.Key_Domain.create_key "equality_domain" + let name = "Equality domain" + let key = Structure.Key_Domain.create_key name let structure : t Abstract_domain.structure = Abstract_domain.Leaf key + let log_category = dkey type equalities = Equality.Set.t let project (t, _, _) = t - let pretty fmt (eqs, _, _) = - Format.fprintf fmt "@[<v>Eqs: %a@]" Equality.Set.pretty eqs - let top = Equality.Set.empty, Atom.Deps.empty, Locations.Zone.top let is_included (a, _, y) (b, _, z) = Equality.Set.subset b a && Locations.Zone.is_included y z let join (e1, d1, z1) (e2, d2, z2) = Equality.Set.inter e1 e2, Atom.Deps.join d1 d2, Locations.Zone.join z1 z2 - let join_and_is_included a b = - join a b, is_included a b (* TODO *) let widen _kf _stmt a b = join a b + let narrow (e1, d1, z1) (e2, d2, z2) = + if Atom.Deps.equal d1 d2 + then `Value (Equality.Set.union e1 e2, d1, Locations.Zone.narrow z1 z2) + else `Value (e1, d1, z1) + let storage = Value_parameters.EqualityStorage.get end @@ -183,12 +186,13 @@ module MakeDomain include Internal + let get_cvalue = Value.get Main_values.cvalue_key + type value = Value.t type location = Precise_locs.precise_location type origin = unit - let pretty fmt (eqs, _, _) = - Format.fprintf fmt "@[<v>Eqs: %a@]" Equality.Set.pretty eqs + let pretty fmt (eqs, _, _) = Equality.Set.pretty fmt eqs let pretty_debug fmt (eqs, deps, modified) = Format.fprintf fmt @@ -222,9 +226,6 @@ module MakeDomain let concat (e1, d1, z1) (e2, d2, z2) = Equality.Set.union e1 e2, Atom.Deps.concat d1 d2, Locations.Zone.join z1 z2 - let join_and_is_included a b = - join a b, is_included a b - (* TODO *) let widen _kf _stmt a b = join a b @@ -242,6 +243,21 @@ module MakeDomain let alarms_inter x y = (* TODO *) if Alarmset.is_empty y then x else Alarmset.all + (* Remove all 'origin' information from the Cvalue component of a value. + Since we perform evaluations at the current statement, the origin + information we compute is incompatible with the one obtained from e.g. + the Cvalue domain. *) + let imprecise_origin = + match get_cvalue with + | None -> fun v -> v + | Some get -> + fun v -> + let c = get v in + if Cvalue.V.is_imprecise c then + let c' = Cvalue.V.topify_with_origin Origin.top c in + Value.set Main_values.cvalue_key c' v + else v + let coop_eval oracle equalities atom_src = match Equality.Set.find_option atom_src equalities with | Some equality -> @@ -250,6 +266,8 @@ module MakeDomain else let e = Atom.to_exp atom in let v', alarms = oracle e in + (* Remove 'origin' information *) + let v' = v' >>-: imprecise_origin in Bottom.narrow Value.narrow accv v', alarms_inter accalarms alarms in Equality.fold aux_eq equality (`Value Value.top, Alarmset.none) @@ -319,11 +337,6 @@ module MakeDomain and type loc = Precise_locs.precise_location) = struct - type state = t - type value = Value.t - type location = Precise_locs.precise_location - type valuation = Valuation.t - let find_loc valuation = fun lval -> match Valuation.find_loc valuation lval with | `Top -> assert false (* TODO *) @@ -331,8 +344,6 @@ module MakeDomain let update _valuation state = state - let get_cvalue = Value.get Main_values.cvalue_key - let is_singleton = match get_cvalue with | None -> fun _ -> false | Some get -> @@ -447,18 +458,6 @@ module MakeDomain let finalize_call _stmt call ~pre ~post = let kf = call.kf in - let name = Kernel_function.get_name kf in - if Ast_info.is_frama_c_builtin name then begin - if Ast_info.is_cea_dump_function name && - Value_parameters.is_debug_key_enabled dkey - then begin - let l = fst (Cil.CurrentLoc.get ()) in - Value_parameters.result "DUMPING EQ STATE \ - of file %s line %d@.%a" - (Filepath.pretty l.Lexing.pos_fname) l.Lexing.pos_lnum - pretty post; - end; - end; (* remove equalities involving formals, that will no longer be in scope. equalities on locals have already been removed. *) let post = unscope post (Kernel_function.get_formals kf) in @@ -480,18 +479,20 @@ module MakeDomain let approximate_call _stmt call state = approximate_call call.kf state + let show_expr _valuation (equalities, _, _) fmt expr = + let atom = Atom.of_exp expr in + match Equality.Set.find_option atom equalities with + | Some equality -> Equality.pretty fmt equality + | None -> () end - let compute_using_specification _ call _spec state = - approximate_call call.kf state + let logic_assign _assigns location ~pre:_ state = + let loc = Precise_locs.imprecise_location location in + let zone = Locations.enumerate_bits loc in + kill AddAsModified zone state - type eval_env = state - let env_current_state state = `Value state - let env_annot ~pre:_ ~here () = here - let env_pre_f ~pre () = pre - let env_post_f ~pre:_ ~post ~result:_ () = post - let eval_predicate _ _ = Alarmset.Unknown - let reduce_by_predicate state _ _ = state + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state let enter_scope _kf _vars state = state let leave_scope _kf vars state = unscope state vars @@ -501,9 +502,9 @@ module MakeDomain let leave_loop _ state = state let empty () = empty - let initialize_var state _ _ _ = state - let initialize_var_using_type state _ = state - let global_state () = None + let introduce_globals _vars state = state + let initialize_variable _ _ ~initialized:_ _ state = state + let initialize_variable_using_type _ _ state = state let filter_by_bases _ state = state let reuse ~current_input:_ ~previous_output:state = state diff --git a/src/plugins/value/domains/equality/equality_domain.mli b/src/plugins/value/domains/equality/equality_domain.mli index 44355eb6422e62a40f574c5caf4d8eec9e18f576..4e308e96b995d25f03f2cac79dfbcaffda6e5d9c 100644 --- a/src/plugins/value/domains/equality/equality_domain.mli +++ b/src/plugins/value/domains/equality/equality_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/equality/equality_sig.mli b/src/plugins/value/domains/equality/equality_sig.mli index a2b3b1a02ad0bf652ed641ec472fa82cd01b226c..9e5e7261e356e91148094518043cecc85a01eeac 100644 --- a/src/plugins/value/domains/equality/equality_sig.mli +++ b/src/plugins/value/domains/equality/equality_sig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/gauges/gauges_domain.ml b/src/plugins/value/domains/gauges/gauges_domain.ml index ddd017d40a099ba4fa7835ccad23069c1659a4b1..156ff18c3527c248c18aacb9a114d148bb2208f3 100644 --- a/src/plugins/value/domains/gauges/gauges_domain.ml +++ b/src/plugins/value/domains/gauges/gauges_domain.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -94,15 +94,15 @@ module G = struct (* This function computes how much the bounds of [i2] have increased from those of [i1], i.e. [diff [1 .. 4] [-2 .. 8]] is [-3 .. 4] and [diff [-2 .. 8] [1 .. 4]] is [-4 .. 3]. *) - let sub (i1: t) (i2: t) : t = + let delta (i1: t) (i2: t) : t = let min1, max1 = i1 in let min2, max2 = i2 in - let sub_min = opt2 Integer.sub min2 min1 in - let sub_max = opt2 Integer.sub max2 max1 in + let delta_min = opt2 Integer.sub min2 min1 in + let delta_max = opt2 Integer.sub max2 max1 in (* we may need to reorder the pointwise subtractions. See the second example above. *) - let min = opt2 Integer.min sub_min sub_max in - let max = opt2 Integer.max sub_min sub_max in + let min = opt2 Integer.min delta_min delta_max in + let max = opt2 Integer.max delta_min delta_max in min, max let join = lift Integer.min Integer.max @@ -272,7 +272,11 @@ module G = struct end (* A MV contains (usual) values for the different bases that are incremented - in a loop. For missing bases, no information is stored. *) + in a loop. + 1. for missing bases, no information is stored (i.e. Top) + 2. bases are mapped to an interger range, or to a pointer + 2.1. bases can only be mapped to a pointer with a single base address + *) module MV = struct include Hptmap.Make(Base)(Cvalue.V)(Hptmap.Comp_unused) @@ -281,59 +285,74 @@ module G = struct (* This function computes a pointwise union on two MVs assumed to have disjoint set of keys. *) - let join_disjoint = - let cache = cache_name "MV.join_disjoint" in + let merge_disjoint = + let cache = cache_name "MV.merge_disjoint" in let decide _ _ _ = assert false in - join ~cache ~symmetric:true ~idempotent:true ~decide + join ~cache ~symmetric:true ~idempotent:false ~decide let empty_wh = Integer.zero, (fun _ -> Ival.Widen_Hints.empty) let widen = - let cache = cache_name "widen" in - let decide _ b1 b2 = Cvalue.V.widen empty_wh b1 b2 in - join ~cache ~symmetric:false ~idempotent:true ~decide + let cache = cache_name "MV.widen" in + let decide _ b1 b2 = Some (Cvalue.V.widen empty_wh b1 b2) in + inter ~cache ~symmetric:false ~idempotent:true ~decide let is_included = let cache = cache_name "MV.is_included" in let decide_fst _b _v1 = true (* v2 is top *) in let decide_snd _b _v2 = false (* v1 is top, v2 is not *) in let decide_both _ v1 v2 = Cvalue.V.is_included v1 v2 in - let decide_fast s t = if s == t then PTrue else PUnknown + let decide_fast s t = + if s == t || is_empty t (*all bases present in s but not in t + are implicitly bound to Top in t, + hence the inclusion holds *) + then PTrue + else PUnknown in binary_predicate cache UniversalPredicate ~decide_fast ~decide_fst ~decide_snd ~decide_both end - (* A MV contains, for interesting variables, the coefficient that is + (* A MC contains, for interesting variables, the coefficient that is associated to one lambda, represented as an integer interval. - Missing coefficients are 0. *) + Missing coefficients are 0. This is useful for variables that + are not incremented in one inner, but only in outemost one. *) module MC = struct include Hptmap.Make(Base)(Bounds)(Hptmap.Comp_unused) (struct let v = [] end) (struct let l = [Ast.self] end) + (* This function computes a pointwise union on two MCs assumed to have + disjoint set of keys. *) + let merge_disjoint = + let cache = cache_name "MC.merge_disjoint" in + let decide _ _ _ = assert false in + join ~cache ~symmetric:true ~idempotent:false ~decide + + + (* For the "standard" join and widen, keys present in one map but not + in the other are assumed to be 0. *) + + let default = function None -> Bounds.zero | Some b -> b + let widen = - let cache = cache_name "Gauges.MC.widen" in - let decide _ b1 b2 = Bounds.widen b1 b2 in - join ~cache ~symmetric:true ~idempotent:true ~decide + let cache = cache_name "MC.widen" in + let decide _ b1 b2 = Bounds.widen (default b1) (default b2) in + generic_join ~cache ~symmetric:false ~idempotent:true ~decide let join = - let cache = cache_name "Gauges.MC.join" in - let decide _ b1 b2 = Bounds.join b1 b2 in - join ~cache ~symmetric:true ~idempotent:true ~decide + let cache = cache_name "MC.join" in + let decide _ b1 b2 = Bounds.join (default b1) (default b2) in + generic_join ~cache ~symmetric:true ~idempotent:true ~decide let is_included = let cache = cache_name "MC.is_included" in let decide_fst _b v1 = Bounds.(equal zero v1) in let decide_snd _b v2 = Bounds.(is_included zero v2) in let decide_both _ v1 v2 = Bounds.is_included v1 v2 in - let decide_fast s t = - if s == t || is_empty t (*all bases present in s but not in t - are implicitly bound to Top in t, hence the inclusion holds *) - then PTrue - else PUnknown + let decide_fast s t = if s == t then PTrue else PUnknown in binary_predicate cache UniversalPredicate ~decide_fast ~decide_fst ~decide_snd ~decide_both @@ -343,31 +362,31 @@ module G = struct (* This function computes how much the bounds of [v2] have increased from those of [v1]. On pointers, we return a result in bytes, and only if the - two variables point to the same base. *) - let sub_min_max_cvalue v1 v2 = + two variables point to the same base (invariant 2.1) *) + let delta_min_max_cvalue v1 v2 = try let b1, i1 = Cvalue.V.find_lonely_key v1 in let b2, i2 = Cvalue.V.find_lonely_key v2 in if Base.equal b1 b2 - then Some (Bounds.sub (Ival.min_and_max i1) (Ival.min_and_max i2)) + then Some (Bounds.delta (Ival.min_and_max i1) (Ival.min_and_max i2)) else None - with Not_found -> None + with Not_found -> assert false (* invariant 2.1 of MV must already hold *) (* This function takes two mv, and 'subtracts' them for the [inc] operation of gauges. More precisely, for each base present in both maps, we subtract pointwise the min and max or their possible values. This is used to compute the 'difference' during one loop iteration. *) - let sub_mv = - let cache = cache_name "sub_mv" in + let delta_mv = + let cache = cache_name "delta_mv" in let empty = MC.empty in let empty_left _ = empty in let empty_right _ = empty in let both b v1 v2 = - match sub_min_max_cvalue v1 v2 with (* BIGTODO: remove b from ct *) + match delta_min_max_cvalue v1 v2 with | None -> MC.empty (* drop the base from the result *) | Some i -> MC.singleton b i in - let join = MC.join in + let join = MC.merge_disjoint in let f = MV.fold2_join_heterogeneous ~cache ~empty_left ~empty_right ~both ~join ~empty @@ -379,18 +398,18 @@ module G = struct let cache = cache_name "mv_minus_mc" in let empty = MV.empty in let empty_left _ = empty in - let empty_right _ = empty in + let empty_right v = v in let both b v i = - (* BIGTODO: we do not check that are we are on the same base as in the - original computation of the coefficients. This requires a more - complicated iterator, though... *) - let bv, iv = Cvalue.V.find_lonely_key v in - let i'_min, i'_max = Bounds.sub i (Ival.min_and_max iv) in + let bv, iv = + try Cvalue.V.find_lonely_key v + with Not_found -> assert false (* invariant 2.1 of MV *) + in + let i'_min, i'_max = Bounds.delta i (Ival.min_and_max iv) in let i' = Ival.inject_range i'_min i'_max in let v' = Cvalue.V.inject bv i' in MV.singleton b v' in - let join = MV.join_disjoint in + let join = MV.merge_disjoint in let f = MV.fold2_join_heterogeneous ~cache ~empty_left ~empty_right ~both ~join ~empty @@ -413,7 +432,7 @@ module G = struct let v' = Cvalue.V.add_untyped ~factor:Int_Base.one v p in MV.singleton b v' in - let join = MV.join_disjoint in + let join = MV.merge_disjoint in MV.fold2_join_heterogeneous ~cache ~empty_left ~empty_right ~both ~join ~empty mv (MC.shape mc) @@ -441,11 +460,11 @@ module G = struct (* Widen [i1] and [i2]. The number of iterations is widened only if [widen_nb] holds. *) - let widen stmt ~widen_nb i1 i2 = + let widen _stmt ~widen_nb i1 i2 = let nb = if widen_nb then let threshold = - if false then LoopAnalysis.Loop_analysis.get_bounds stmt else None + None (* LoopAnalysis.Loop_analysis.get_bounds _stmt *) in let threshold = Extlib.opt_map Integer.of_int threshold in let (min, max as w) = Bounds.widen ?threshold i1.nb i2.nb in @@ -456,6 +475,10 @@ module G = struct in { nb; coeffs = MC.widen i1.coeffs i2.coeffs } + (* Keep only the variables of [mi.coeffs] already present in [mv]. *) + let restrict mv mi = + { mi with coeffs = MC.inter_with_shape (MV.shape mv) mi.coeffs } + end type iteration_info = @@ -496,6 +519,12 @@ module G = struct | MultipleIterations m1, MultipleIterations m2 -> Bounds.is_included m1.nb m2.nb && MC.is_included m1.coeffs m2.coeffs + + let restrict mv = function + | PreciseIteration _ as pi -> pi + | MultipleIterations mi -> + MultipleIterations (MultipleIterations.restrict mv mi) + end (* type t = MV.t * (stmt * iteration_info) list *) @@ -554,11 +583,17 @@ module G = struct in aux l ct + (* Remove from the coefficient maps the variables for which we have + no initial value, for canonicity purposes. This occurs for example when + a pointer points to multiple variables through multiple iterations. *) + let restrict mv l = + List.map (fun (s, mi) -> s, IterationInfo.restrict mv mi) l + (* [l] is the number iteration in [s1], while it is [l+1] in [s2]. Compute a slope, then remove [l] and [l+1] iterations from [ct1] and [ct2] accordingly. *) let join_consecutive_lambda l ct1 ct2 = - let coeffs = sub_mv ct1 ct2 in + let coeffs = delta_mv ct1 ct2 in coeffs, remove_coeffs coeffs l ct1, remove_coeffs coeffs (l+1) ct2 @@ -574,8 +609,7 @@ module G = struct if Base.equal b1 b2 then Some (Cvalue.V.join v1 v2) else None - with Not_found -> assert false (* this invariant should be already true - in the two states *) + with Not_found -> assert false (* invariant 2.1 of MV must already hold *) in MV.inter ~cache ~symmetric:true ~idempotent:true ~decide @@ -618,7 +652,9 @@ module G = struct | -1 -> (** One more iteration in s2 *) let coeffs, ct1, ct2 = join_consecutive_lambda n1 ct1 ct2 in (ct1, ct2), MultipleIterations { nb; coeffs }, true - | _ -> (** difference > 1. Go to top *) + | _ -> (** difference > 1. This case does not happen with the + current iteration engine, and requires a division function + in module Bounds. Go to top *) (MV.empty, MV.empty), MultipleIterations { nb; coeffs = MC.empty }, true in @@ -643,16 +679,23 @@ module G = struct try let ct1, ct2, q, _ = join_iterations s1 s2 in let ct = join_same_lambda ct1 ct2 in - ct, q + let q = restrict ct q in + let r = (ct, q) in + (* Kernel.result ~current:true "JOIN@.%a@.@.%a@.R@.%a" + pretty s1 pretty s2 pretty r; *) + r with MessyJoin -> empty let is_included (ct1, l1: t) (ct2, l2: t) = MV.is_included ct1 ct2 && List.for_all2 (fun (_, i1) (_, i2) -> IterationInfo.is_included i1 i2) l1 l2 - - let join_and_is_included a b = - join a b, is_included a b + (* debug version *) + let _is_included s1 s2 = + let r = is_included s1 s2 in + Kernel.result ~current:true "INCL %b@.%a@.@.%a" r pretty s1 pretty s2; + r + (* hypothesis from Value: s2 is supposed to happen 'after' s1. This widening function is full of heuristics to maintain some precision, i.e. do not widen everything to Top immediately. Basically: @@ -671,9 +714,9 @@ module G = struct (* Now we widen the bounds unstable between s1 and the join. We do so only if the coefficients are compatible enough, meaning that no precise iterations were generalized. This is to regain some precision, - but may theoretically endanger soundness. *) + but may theoretically endanger termination. *) let ct = if joined_iter then ctj else MV.widen ct1 ctj in - let rec widen_l _first l1 lj = + let rec widen_l l1 lj = match l1, lj with | [], [] -> [] | [], _ | _, [] -> assert false @@ -695,15 +738,18 @@ module G = struct MultipleIterations (MultipleIterations.widen stmt ~widen_nb i1 ij) in if IterationInfo.equal i ij then - (stmt', i) :: widen_l false q1 qj (* find something to widen deeper *) + (stmt', i) :: widen_l q1 qj (* find something to widen deeper *) else (stmt', i) :: qj in - (* Widen list if coefficients have not been widened only. Relies on the - fact that MV.widen goes to infty automatically. *) - let l = if MV.equal ctj ct2 then widen_l true l1 lj else lj in + (* Widen list if coefficients have not been widened only. This may help + precision, and should not endanger convergence. *) + let l = if MV.equal ctj ct2 then widen_l l1 lj else lj in + let l = restrict ct l in ct, l + let narrow x _y = `Value x + let enter_loop stmt (ct, l: t) : t = ct, (stmt, PreciseIteration 0) :: l @@ -754,15 +800,14 @@ module G = struct Format.fprintf fmt "@[(%a,@ %a)@]" Cvalue.V.pretty v (Pretty_utils.pp_list ~pre:"" ~suf:"" ~sep:",@ " Bounds.pretty) l + let _ = pretty (* silence warning *) + (* assumes that [f x 0] = x *) let rec map2 f l1 l2 = match l1, l2 with | [], l | l, [] -> l (* all other coefficients are implicitly 0 *) | b1 :: l1, b2 :: l2 -> f b1 b2 :: map2 f l1 l2 - let _join (ct1, l1: t) (ct2, l2: t) : t = - Cvalue.V.join ct1 ct2, map2 Bounds.join l1 l2 - let on_cvalue_ival f v = try let v = Cvalue.V.project_ival v in @@ -792,7 +837,7 @@ module G = struct with Cvalue.V.Not_based_on_null | Ival.Not_Singleton_Int -> raise Untranslatable - (* Check that [v] is an integer, or a single pointer. *) + (* Check that [v] is an integer, or a single pointer (invariant 2 of MV) *) let sanitize_v v = try let _b, i = Cvalue.V.find_lonely_key v in @@ -1011,9 +1056,7 @@ module G = struct if Ival.is_included i range then g else raise Untranslatable else g (* we consider pointers offsets never overflow *) - with Not_found -> - Kernel.abort "Imprecise pointer %a, v %a@.%a" - Gauge.pretty g Cvalue.V.pretty v pretty state + with Not_found -> assert false (* invariant 2.1 of MV *) in aux e @@ -1050,9 +1093,11 @@ module G = struct let g = translate_exp state to_loc to_v e in store_gauge b g state with Untranslatable -> - Locations.Location_Bits.fold_topset_ok - (fun b _ state -> kill_base b state) loc.Locations.loc state - + try + Locations.Location_Bits.fold_topset_ok + (fun b _ state -> kill_base b state) loc.Locations.loc state + with Abstract_interp.Error_Top -> top state + end let dkey = Value_parameters.register_category "d-gauges" @@ -1068,7 +1113,10 @@ module D_Impl : Abstract_domain.S_with_Structure include G + let name = "Gauges domain" + let structure = Abstract_domain.Void + let log_category = dkey let empty _ = G.empty @@ -1102,39 +1150,32 @@ module D_Impl : Abstract_domain.S_with_Structure in `Value [ post_state ] + let kill loc state = + let loc = Precise_locs.imprecise_location loc in + let loc = loc.Locations.loc in + let aux_base b _ acc = + try Base.to_varinfo b :: acc + with Base.Not_a_C_variable (* NULL *) -> acc + in + let vars = Locations.Location_Bits.fold_topset_ok aux_base loc [] in + remove_variables vars state + module Transfer (Valuation: Abstract_domain.Valuation with type value = value and type origin = origin and type loc = location) : Abstract_domain.Transfer - with type state = state - and type value = value - and type location = location - and type valuation = Valuation.t + with type state := state + and type value := value + and type location := location + and type valuation := Valuation.t = struct - type value = Cvalue.V.t - type state = G.t - type location = Precise_locs.precise_location - type valuation = Valuation.t let update _valuation st = st (* TODO? *) - let kill loc state = - let loc = loc.Locations.loc in - let aux_base b _ acc = - try Base.to_varinfo b :: acc - with Base.Not_a_C_variable (* NULL *) -> acc - in - let vars = Locations.Location_Bits.fold_topset_ok aux_base loc [] in - remove_variables vars state - - let imprecise_assign lv _value state = - let loc = Precise_locs.imprecise_location lv.lloc in - `Value (kill loc state) - exception Unassignable - let assign _kinstr lv e assignment valuation (state:state) = + let assign _kinstr lv e _assignment valuation (state:state) = let to_loc lv = match Valuation.find_loc valuation lv with | `Value r -> Precise_locs.imprecise_location r.loc @@ -1149,7 +1190,7 @@ module D_Impl : Abstract_domain.S_with_Structure | _ -> raise Unassignable in try `Value (G.assign to_loc to_val lv.lval e state) - with Unassignable -> imprecise_assign lv assignment state + with Unassignable -> `Value (kill lv.lloc state) let assume_exp valuation e r state = if r.reductness = Created || r.reductness = Reduced then @@ -1212,29 +1253,15 @@ module D_Impl : Abstract_domain.S_with_Structure let state = List.fold_left aux_arg state call.arguments in Compute (Continue state, true) - let approximate_call _stmt call state = - let kf = call.kf in - let name = Kernel_function.get_name kf in - if Ast_info.is_frama_c_builtin name then begin - if Ast_info.is_cea_function name - then - let l = fst (Cil.CurrentLoc.get ()) in - Value_parameters.result ~dkey "DUMPING GAUGES STATE \ - of file %s line %d@.%a" - (Filepath.pretty l.Lexing.pos_fname) l.Lexing.pos_lnum - pretty state; - end; - approximate_call kf state + let approximate_call _stmt call state = approximate_call call.kf state + let show_expr _valuation _state _fmt _expr = () end let enter_loop = G.enter_loop let incr_loop_counter _ = G.inc let leave_loop = G.leave_loop - let compute_using_specification _ call _spec state = - approximate_call call.kf state - (* TODO: it would be interesting to return something here, but we currently need a valuation to perform the translation. *) let extract_expr _oracle _state _exp = @@ -1264,18 +1291,14 @@ module D_Impl : Abstract_domain.S_with_Structure let reuse ~current_input:_ ~previous_output = previous_output (* Initial state *) - let global_state () = None - let initialize_var_using_type state _ = state - let initialize_var state _ _ _ = state + let introduce_globals _ state = state + let initialize_variable_using_type _ _ state = state + let initialize_variable _ _ ~initialized:_ _ state = state (* Logic *) - type eval_env = state - let env_current_state state = `Value state - let env_annot ~pre:_ ~here () = here - let env_pre_f ~pre () = pre - let env_post_f ~pre:_ ~post ~result:_ () = post - let eval_predicate _ _ = Alarmset.Unknown - let reduce_by_predicate state _ _ = state + let logic_assign _assigns location ~pre:_ state = kill location state + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state let top = G.empty (* must not be used, not neutral w.r.t. join (because join crashes...)!! *) diff --git a/src/plugins/value/domains/gauges/gauges_domain.mli b/src/plugins/value/domains/gauges/gauges_domain.mli index a8a9ad80ec4a1801c2a951be61606904c76ad03b..1522549050e7ddc738723f300b6b88dcc97a5e49 100644 --- a/src/plugins/value/domains/gauges/gauges_domain.mli +++ b/src/plugins/value/domains/gauges/gauges_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/hcexprs.ml b/src/plugins/value/domains/hcexprs.ml index 092322b9f93c627c682a5c26ba56fae491c1633b..bda77dd09615c59615cb59fa03c4af7d61ec92b9 100644 --- a/src/plugins/value/domains/hcexprs.ml +++ b/src/plugins/value/domains/hcexprs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -51,8 +51,8 @@ module Datatype_UHCE = Datatype.Make (struct | E _, LV _ -> 1 let pretty fmt = function - | E e -> Format.fprintf fmt "(e)%a" Exp.pretty e - | LV lv -> Format.fprintf fmt "(l)%a" Lval.pretty lv + | E e -> Format.fprintf fmt "%a" Exp.pretty e + | LV lv -> Format.fprintf fmt "%a" Lval.pretty lv let hash = function | E e -> Exp.hash e @@ -76,7 +76,7 @@ module HCE = struct let to_exp h = match get h with | E e -> e - | LV lv -> Cil.dummy_exp (Lval lv) + | LV lv -> Value_util.lval_to_exp lv end diff --git a/src/plugins/value/domains/hcexprs.mli b/src/plugins/value/domains/hcexprs.mli index 68a7c26c97c3a53863ab117e06ccfb74029edd67..5efad74e3e0dcf6a5a1b1f729eedea7aabe626c9 100644 --- a/src/plugins/value/domains/hcexprs.mli +++ b/src/plugins/value/domains/hcexprs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/inout_domain.ml b/src/plugins/value/domains/inout_domain.ml new file mode 100644 index 0000000000000000000000000000000000000000..577d2e1b60ee37a7dc9e07ff9f5fd24f7dea5a33 --- /dev/null +++ b/src/plugins/value/domains/inout_domain.ml @@ -0,0 +1,324 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Locations + +type inout = { + (* over-approximation of the memory locations written by the function *) + over_outputs: Zone.t; + (* over-approximation of the memory locations read by the function *) + over_inputs: Zone.t; + (* under-approximation of the memory locations written by the function *) + under_outputs: Zone.t; + (* over-approximation of the memory locations parts read by the function + that are parts of its inputs (i.e. that the function has not written + previously) *) + operational_inputs: Zone.t; +} + + +(* Lattice structure for the abstract state above *) +module LatticeInout = struct + + (* Frama-C "datatype" for type [inout] *) + include Datatype.Make_with_collections(struct + include Datatype.Serializable_undefined + + type t = inout + let name = "Value.Inout.t" + + let reprs = [ { + over_outputs = List.hd Zone.reprs; + over_inputs = List.hd Zone.reprs; + under_outputs = List.hd Zone.reprs; + operational_inputs = List.hd Zone.reprs; + } ] + + let structural_descr = + Structural_descr.t_record [| + Zone.packed_descr; + Zone.packed_descr; + Zone.packed_descr; + Zone.packed_descr; + |] + + let compare m1 m2 = + let c = Zone.compare m1.over_outputs m2.over_outputs in + if c <> 0 then c + else + let c = Zone.compare m1.over_inputs m2.over_inputs in + if c <> 0 then c + else + let c = Zone.compare m1.under_outputs m2.under_outputs in + if c <> 0 then c + else Zone.compare m1.operational_inputs m2.operational_inputs + + let equal = Datatype.from_compare + + let pretty fmt c = + Format.fprintf fmt + "@[<v 2>Over outputs:@ @[<hov>%a@]@]@.\ + @[<v 2>Over inputs:@ @[<hov>%a@]@]@.\ + @[<v 2>Sure outputs:@ @[<hov>%a@]@]@.\ + @[<v 2>Operational inputs:@ @[<hov>%a@]@]" + Zone.pretty c.over_outputs + Zone.pretty c.over_inputs + Zone.pretty c.under_outputs + Zone.pretty c.operational_inputs + + let hash m = + Hashtbl.hash (Zone.hash m.over_outputs, + Zone.hash m.over_inputs, + Zone.hash m.under_outputs, + Zone.hash m.operational_inputs) + + let copy c = c + + end) + + (* Initial abstract at the beginning of the computation: nothing written + or read so far. *) + let empty = { + over_outputs = Zone.bottom; + over_inputs = Zone.bottom; + under_outputs = Zone.bottom; + operational_inputs = Zone.bottom; + } + + (* Top state: everything read or written, nothing written in a sure way *) + let top = { + over_outputs = Zone.top; + over_inputs = Zone.top; + under_outputs = Zone.bottom; + operational_inputs = Zone.top; + } + + (* Join: over-approximation are joined, under-approximation are met. *) + let join c1 c2 = { + over_outputs = Zone.join c1.over_outputs c2.over_outputs; + over_inputs = Zone.join c1.over_inputs c2.over_inputs; + under_outputs = Zone.meet c1.under_outputs c2.under_outputs; + operational_inputs = Zone.join c1.operational_inputs c2.operational_inputs; + } + + (* The memory locations are finite, so the ascending chain property is + already verified. We simply use a join. *) + let widen _ _ c1 c2 = join c1 c2 + + let narrow c1 c2 = + `Value + { over_outputs = Zone.narrow c1.over_outputs c2.over_outputs; + over_inputs = Zone.narrow c1.over_inputs c2.over_inputs; + under_outputs = Zone.link c1.under_outputs c2.under_outputs; + operational_inputs = + Zone.narrow c1.operational_inputs c2.operational_inputs; } + + (* Inclusion testing: pointwise for over-approximations, counter-pointwise + for under-approximations *) + let is_included c1 c2 = + Zone.is_included c1.over_outputs c2.over_outputs && + Zone.is_included c1.over_inputs c2.over_inputs && + Zone.is_included c2.under_outputs c1.under_outputs && + Zone.is_included c1.operational_inputs c2.operational_inputs + +end + +module Transfer = struct + + (* Approximations of two consecutive statements [s1; s2], respectively + abstracted as [c1] and [c2]. The result is immediate, except for + operational inputs. For those, we subtract from the inputs of [c2] + the memory locations that have been written in a sure way in [c1], + then perform the join. *) + let catenate c1 c2 = + { over_outputs = Zone.join c1.over_outputs c2.over_outputs; + over_inputs = Zone.join c1.over_inputs c2.over_inputs; + under_outputs = Zone.link c1.under_outputs c2.under_outputs; + operational_inputs = + Zone.join c1.operational_inputs + (Zone.diff c2.operational_inputs c1.under_outputs); + } + + (* Effects of a conditional [if (e)]. [to_z] converts the lvalues present + in [e] into locations. Nothing is written, the memory locations + present in [e] are read. *) + let effects_assume to_z e = + let inputs = Value_util.zone_of_expr to_z e in + { + over_outputs = Zone.bottom; + over_inputs = inputs; + under_outputs = Zone.bottom; + operational_inputs = inputs; + } + + (* Effects of an assigment [lv = e]. [to_z] converts the lvalues present + in [lv] and [e] into locations. *) + let effects_assign to_z lv e = + let inputs_e = Value_util.zone_of_expr to_z e in + let inputs_lv = Value_util.indirect_zone_of_lval to_z lv.Eval.lval in + let inputs = Zone.join inputs_e inputs_lv in + let outputs = + Precise_locs.enumerate_valid_bits ~for_writing:true lv.Eval.lloc + in + let exact_outputs = Precise_locs.cardinal_zero_or_one lv.Eval.lloc in + { + over_outputs = outputs; + over_inputs = inputs; + under_outputs = if exact_outputs then outputs else Zone.bottom; + operational_inputs = inputs; + } + + (* Removes a list of variables from a state. Used to model exiting a + scope. *) + let remove_variables vars state = + let bases = + List.fold_left + (fun acc v -> Base.Set.add (Base.of_varinfo v) acc) + Base.Set.empty vars + in + let rm = Zone.filter_base (fun b -> not (Base.Set.mem b bases)) in { + over_outputs = rm state.over_outputs; + over_inputs = rm state.over_inputs; + under_outputs = rm state.under_outputs; + operational_inputs = rm state.operational_inputs; + } + +end + +let key = Structure.Key_Domain.create_key "inout domain" + +module Internal + (*: Domain_builder.InputDomain + with type state = inout + and type value = Cvalue.V.t + and type location = Precise_locs.precise_location *) += struct + type state = inout + type value = Cvalue.V.t + type location = Precise_locs.precise_location + + include (LatticeInout: sig + include Datatype.S_with_collections with type t = state + include Abstract_domain.Lattice with type state := state + end) + + let structure : t Abstract_domain.structure = Abstract_domain.Leaf key + let log_category = Value_parameters.register_category "d-inout" + + let enter_scope _kf _vars state = state + let leave_scope _kf vars state = Transfer.remove_variables vars state + + type origin = unit + + module Transfer (Valuation: Abstract_domain.Valuation + with type value = value + and type origin = origin + and type loc = Precise_locs.precise_location) + : Abstract_domain.Transfer + with type state = state + and type value = Cvalue.V.t + and type location = Precise_locs.precise_location + and type valuation = Valuation.t + = struct + type value = Cvalue.V.t + type state = inout + type location = Precise_locs.precise_location + type valuation = Valuation.t + + let to_z valuation lv = + match Valuation.find_loc valuation lv with + | `Value loc -> loc.Eval.loc + | `Top -> Precise_locs.loc_top (* should not occur *) + + let assign _ki lv e _v valuation state = + let to_z = to_z valuation in + let effects = Transfer.effects_assign to_z lv e in + `Value (Transfer.catenate state effects) + + let assume _stmt e _pos valuation state = + let to_z = to_z valuation in + let effects = Transfer.effects_assume to_z e in + `Value (Transfer.catenate state effects) + + let start_call _stmt _call _valuation _state = + Eval.(Compute (Continue LatticeInout.empty, true)) + + let finalize_call _stmt _call ~pre ~post = + `Value (Transfer.catenate pre post) + + let approximate_call _stmt call state = + let state = + if Ast_info.is_frama_c_builtin name || + Eval_typ.kf_assigns_only_result_or_volatile call.Eval.kf + then state + else LatticeInout.top + in + `Value [state] + + let update _valuation state = state + + let show_expr _valuation _state _fmt _expr = () + end + + (* Memexec *) + let filter_by_bases _bases state = state + let reuse ~current_input:state ~previous_output:_ = state + + (* Initial state. Initializers are singletons, so we store nothing. *) + let empty () = LatticeInout.empty + let introduce_globals _vars state = state + let initialize_variable _ _ ~initialized:_ _ state = state + let initialize_variable_using_type _ _ state = state + + (* TODO *) + let logic_assign _assign _location ~pre:_ _state = top + + (* Logic *) + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state + + let storage () = true + + let top_query = `Value (Cvalue.V.top, ()), Alarmset.all + + let extract_expr _oracle _state _expr = top_query + let extract_lval _oracle _state _lv _typ _locs = top_query + + let backward_location _state _lval _typ loc value = + `Value (loc, value) + + let enter_loop _ state = state + let incr_loop_counter _ state = state + let leave_loop _ state = state + + let reduce_further _state _expr _value = [] (*Nothing intelligent to suggest*) + +end + +module D = Domain_builder.Complete (Internal) + + +(* +Local Variables: +compile-command: "make -C ../../.." +End: +*) diff --git a/src/plugins/value/slevel/separate.mli b/src/plugins/value/domains/inout_domain.mli similarity index 85% rename from src/plugins/value/slevel/separate.mli rename to src/plugins/value/domains/inout_domain.mli index 4424bea6e7dd666dbdb702520bc0eff6ea41ff50..95cf2238da1c670df8cb432be34fb0ee12ef3cd2 100644 --- a/src/plugins/value/slevel/separate.mli +++ b/src/plugins/value/domains/inout_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,9 +20,10 @@ (* *) (**************************************************************************) -val prologue : unit -> unit -val filter_if : - Cil_types.stmt -> - 'a Dataflow2.guardaction * 'b Dataflow2.guardaction -> - 'a Dataflow2.guardaction * 'b Dataflow2.guardaction -val epilogue : unit -> unit +(** Computation of inputs of outputs. *) + +module D: Abstract_domain.Internal + with type value = Cvalue.V.t + and type location = Precise_locs.precise_location + +val key: D.t Abstract_domain.key diff --git a/src/plugins/value/domains/offsm_domain.ml b/src/plugins/value/domains/offsm_domain.ml index d28f879b220ebde264a6a8e8fc25e589f1e86676..5022fd67ceda794d07904936c9a5c6cd72f36287 100644 --- a/src/plugins/value/domains/offsm_domain.ml +++ b/src/plugins/value/domains/offsm_domain.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,7 +30,7 @@ let store_redundant = false unsoundnesses in the domain through testing, because many more expressions end up being handled. *) -let dkey = Value_parameters.register_category "d-offsm" +let dkey = Value_parameters.register_category "d-bitwise" module Default_offsetmap = struct open Cvalue @@ -81,12 +81,11 @@ module Memory = struct include Lmap.Make_LOffset(V_Or_Uninitialized)(V_Offsetmap)(Default_offsetmap) - let join_and_is_included t1 t2 = - let t12 = join t1 t2 in (t12, equal t12 t2) - let widen kf stmt s1 s2 = let wh = Widen.getWidenHints kf stmt in widen wh s1 s2 + + let narrow x _y = `Value x end @@ -103,7 +102,9 @@ module Internal : Domain_builder.InputDomain include Abstract_domain.Lattice with type state := state end) + let name = "Bitwise domain" let structure = Abstract_domain.Void + let log_category = dkey let empty _ = Memory.empty_map @@ -122,21 +123,16 @@ module Internal : Domain_builder.InputDomain and type origin = origin and type loc = Precise_locs.precise_location) : Abstract_domain.Transfer - with type state = state - and type value = offsm_or_top - and type location = Precise_locs.precise_location - and type valuation = Valuation.t + with type state := state + and type value := offsm_or_top + and type location := Precise_locs.precise_location + and type valuation := Valuation.t = struct - type value = offsm_or_top - type state = Memory.t - type location = Precise_locs.precise_location - type valuation = Valuation.t let update _valuation st = st (* TODO? *) let kill loc state = - snd (Memory.add_binding ~reducing:true ~exact:true - state loc V_Or_Uninitialized.top) + Memory.add_binding ~exact:true state loc V_Or_Uninitialized.top let store loc state v = let state' = @@ -149,8 +145,8 @@ module Internal : Domain_builder.InputDomain match loc.Locations.size with | Int_Base.Top -> assert false | Int_Base.Value size -> - snd (Memory.paste_offsetmap ~reducing:true - ~from:o ~dst_loc:loc.Locations.loc ~size ~exact:true state) + Memory.paste_offsetmap + ~from:o ~dst_loc:loc.Locations.loc ~size ~exact:true state in match state' with | Memory.Bottom -> `Bottom @@ -187,34 +183,20 @@ module Internal : Domain_builder.InputDomain top with Kernel_function.No_Statement -> let name = Kernel_function.get_name kf in - if Ast_info.is_frama_c_builtin name then begin - if Ast_info.is_cea_dump_function name - then begin - let l = fst (Cil.CurrentLoc.get ()) in - Value_parameters.result ~dkey "DUMPING OFFSM STATE \ - of file %s line %d@.%a" - (Filepath.pretty l.Lexing.pos_fname) l.Lexing.pos_lnum - pretty state; - end; - state - end - else top + if Ast_info.is_frama_c_builtin name then state else top in `Value [post_state] + let show_expr _valuation _state _fmt _expr = () end - (* TODO: this function is buggy! *) - let compute_using_specification _ _ _ state = - `Value [state] - let extract_expr _oracle _state _exp = `Value (Offsm_value.Offsm.top, ()), Alarmset.all (* Basic 'find' on a location *) let find_loc state loc = let size = Int_Base.project loc.Locations.size in - let _, o = Memory.copy_offsetmap loc.Locations.loc size state in + let o = Memory.copy_offsetmap loc.Locations.loc size state in o >>-: fun o -> if Default_offsetmap.is_top o || (not store_redundant && V_Offsetmap.is_single_interval o) @@ -235,7 +217,7 @@ module Internal : Domain_builder.InputDomain in Precise_locs.fold aux_loc locs `Bottom >>-: fun v -> v, () - with Int_Base.Error_Top -> `Value (Top, ()) + with Abstract_interp.Error_Top -> `Value (Top, ()) in o, Alarmset.all @@ -256,18 +238,14 @@ module Internal : Domain_builder.InputDomain state (* Initial state *) - let global_state () = None - let initialize_var_using_type state _ = state - let initialize_var state _ _ _ = state + let introduce_globals _ state = state + let initialize_variable_using_type _ _ state = state + let initialize_variable _ _ ~initialized:_ _ state = state (* Logic *) - type eval_env = state - let env_current_state state = `Value state - let env_annot ~pre:_ ~here () = here - let env_pre_f ~pre () = pre - let env_post_f ~pre:_ ~post ~result:_ () = post - let eval_predicate _ _ = Alarmset.Unknown - let reduce_by_predicate state _ _ = state + let logic_assign _assign _location ~pre:_ _state = top + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state let storage = Value_parameters.BitwiseOffsmStorage.get diff --git a/src/plugins/value/domains/offsm_domain.mli b/src/plugins/value/domains/offsm_domain.mli index ef2a876be8f0c4b603abe151b10565bc93a5387a..4d979d489868405f41c0072eebef5f1cca7c61dc 100644 --- a/src/plugins/value/domains/offsm_domain.mli +++ b/src/plugins/value/domains/offsm_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/powerset.ml b/src/plugins/value/domains/powerset.ml index 0e066d41461be774baafaaf52cd0a0b30f0347e4..1674f894423b9aaa15903ee9688ef5c25df5212c 100644 --- a/src/plugins/value/domains/powerset.ml +++ b/src/plugins/value/domains/powerset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/powerset.mli b/src/plugins/value/domains/powerset.mli index 2b5d66bc9d09ae0ed438e016cc8901f56ba0a344..97f7c653ef7f65568d2d0e311c5261a2fed92bb6 100644 --- a/src/plugins/value/domains/powerset.mli +++ b/src/plugins/value/domains/powerset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/sign_domain.ml b/src/plugins/value/domains/sign_domain.ml new file mode 100644 index 0000000000000000000000000000000000000000..b95fdc6583bfd561903f67d420d6e5313a08d652 --- /dev/null +++ b/src/plugins/value/domains/sign_domain.ml @@ -0,0 +1,35 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types + +module Sign_Value = struct + include Sign_value + + (* In this domain, we only track integer variables. *) + let track_variable vi = Cil.isIntegralType vi.vtype + + (* The base lattice is finite, we can use join to perform widening *) + let widen = join +end + +include Simple_memory.Make_Domain (struct let name = "sign" end) (Sign_Value) diff --git a/src/plugins/value/legacy/eval_funs.mli b/src/plugins/value/domains/sign_domain.mli similarity index 83% rename from src/plugins/value/legacy/eval_funs.mli rename to src/plugins/value/domains/sign_domain.mli index ea37cd02205188dcd39b0d9f629eb295e8825c65..8a2c4dcf2a024873af414f208448e399c6d7fb73 100644 --- a/src/plugins/value/legacy/eval_funs.mli +++ b/src/plugins/value/domains/sign_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,14 +20,7 @@ (* *) (**************************************************************************) -(** Value analysis of entire functions, using the legacy engine. *) +(** Abstraction of the sign of integer variables. *) -val force_compute : unit -> unit -(** Perform a full analysis, starting from the [main] function. *) - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) +include Abstract_domain.Internal with type value = Sign_value.t + and type location = Precise_locs.precise_location diff --git a/src/plugins/value/domains/simple_memory.ml b/src/plugins/value/domains/simple_memory.ml new file mode 100644 index 0000000000000000000000000000000000000000..8abe69a68c03218776addb2f40759dc369e5fbcb --- /dev/null +++ b/src/plugins/value/domains/simple_memory.ml @@ -0,0 +1,314 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types +open Eval + +module type Value = sig + include Datatype.S + val top : t + val join : t -> t -> t + val widen : t -> t -> t + val narrow : t -> t -> t or_bottom + val is_included : t -> t -> bool + val track_variable: Cil_types.varinfo -> bool + val pretty_debug: t Pretty_utils.formatter +end + +module type S = sig + type t + type value + val add: Precise_locs.precise_location -> Cil_types.typ -> value -> t -> t + val find: Precise_locs.precise_location -> Cil_types.typ -> t -> value + val remove: Precise_locs.precise_location -> t -> t + val remove_variables: Cil_types.varinfo list -> t -> t + val fold: (Base.t -> value -> 'a -> 'a) -> t -> 'a -> 'a +end + +module Make_Memory (Value: Value) = struct + + module Initial_Values = struct let v = [] end + module Deps = struct let l = [Ast.self] end + + include Hptmap.Make (Base) (Value)(Hptmap.Comp_unused) (Initial_Values) (Deps) + + let cache_name s = + Hptmap_sig.PersistentCache ("Value." ^ Value.name ^ "." ^ s) + + let narrow = + let module E = struct exception Bottom end in + let cache = cache_name "narrow" in + let decide _ v1 v2 = + match Value.narrow v1 v2 with + | `Bottom -> raise E.Bottom + | `Value v -> v + in + fun a b -> + try `Value (join ~cache ~symmetric:true ~idempotent:true ~decide a b) + with E.Bottom -> `Bottom + + let join = + let cache = cache_name "join" in + let decide _ v1 v2 = + let r = Value.join v1 v2 in + if Value.(equal top r) then None else Some r + in + inter ~cache ~symmetric:true ~idempotent:true ~decide + + let widen = + let cache = cache_name "widen" in + let decide _ b1 b2 = + let r = Value.widen b1 b2 in + if Value.(equal top r) then None else Some r + in + inter ~cache ~symmetric:false ~idempotent:true ~decide + + let is_included = + let cache = cache_name "is_included" in + let decide_fst _b _v1 = true (* v2 is top *) in + let decide_snd _b _v2 = false (* v1 is top, v2 is not *) in + let decide_both _ v1 v2 = Value.is_included v1 v2 in + let decide_fast s t = if s == t then PTrue else PUnknown in + binary_predicate cache UniversalPredicate + ~decide_fast ~decide_fst ~decide_snd ~decide_both + + let top = empty + + type loc_for_base = Precise | Imprecise + + (* Checks whether the offset [o] and the size [size] corresponds to the + tracked location for [b]. + The conditions are as follow: + - the variable corresponding to [b] is not volatile. + - the variable corresponding to [b] must be tracked. + - the location must assign the entire variable. + - the type of the variable matches [typ]. *) + let covers_base b o size typ = + match b with + | Base.Var (vi, Base.Known (_, max)) -> (* "standard" varinfos only *) + if not (Cil.typeHasQualifier "volatile" vi.vtype) && + Value.track_variable vi && + Cil_datatype.Typ.equal typ vi.vtype && + Ival.is_zero o && + (match size with + | Int_Base.Value size -> Integer.equal size (Integer.succ max) + | Int_Base.Top -> false) + then Precise + else Imprecise + | _ -> Imprecise + + let find_or_top b state = try find b state with Not_found -> Value.top + + let add loc typ v state = + let open Locations in + let {loc; size} = Precise_locs.imprecise_location loc in + (* exact means that the location is precise and that we can perform + a strong update. *) + let exact = Location_Bits.cardinal_zero_or_one loc in + let aux_base b o state = + match covers_base b o size typ with + | Precise -> + (* The location exactly matches [b]: we are able to store the result. + If the location is not exact, performs a weak update: join [v] with + the current value for [b]. *) + let v = if exact then v else Value.join v (find_or_top b state) in + (* Store the new value unless it is top. In this case, drop it for + canonicity. *) + if Value.(equal v top) + then remove b state + else add b v state + | Imprecise -> remove b state + in + Location_Bits.fold_topset_ok aux_base loc state + + let remove_variables vars state = + let remove_variable state v = remove (Base.of_varinfo v) state in + List.fold_left remove_variable state vars + + let remove loc state = + let loc = Precise_locs.imprecise_location loc in + Locations.(Location_Bits.fold_bases remove loc.loc state) + + let find loc typ state = + let open Locations in + let {loc; size} = Precise_locs.imprecise_location loc in + let aux_base b o r = + (* We degenerate to Top as soon as we find an imprecise location, + or a base which is not bound in the map. *) + match covers_base b o size typ with + | Precise -> Bottom.join Value.join r (`Value (find_or_top b state)) + | Imprecise -> `Value Value.top + in + match Location_Bits.fold_topset_ok aux_base loc `Bottom with + | `Bottom -> Value.top (* does not happen if the location is not empty *) + | `Value v -> v + +end + +module Make_Internal (Info: sig val name: string end) (Value: Value) = struct + + include Make_Memory (Value) + + let name = Info.name + + type state = t + type value = Value.t + type location = Precise_locs.precise_location + + let key = Structure.Key_Domain.create_key (Info.name ^ " domain") + let structure : t Abstract_domain.structure = Abstract_domain.Leaf key + + let log_category = Value_parameters.register_category ("d-" ^ Info.name) + + let widen _kf _stmt = widen + + (* This function returns the information known about the location + corresponding to [_lv], so that it may be used by the engine during + evaluation. *) + let extract_lval _oracle state _lv typ loc = + let v = find loc typ state in + `Value (v, ()), Alarmset.all + + let extract_expr _oracle _state _expr = `Value (Value.top, ()), Alarmset.all + + let backward_location state _lval typ loc _value = + let new_value = find loc typ state in + `Value (loc, new_value) + + let reduce_further _state _expr _value = [] + + type origin = unit + + module Transfer + (Valuation: Abstract_domain.Valuation with type value := value + and type origin := origin + and type loc := location) + = struct + + (* This function binds [loc] to [v], of type [typ], in [state]. + [v] can be [`Bottom], which means that its contents are guaranteed + to be indeterminate (e.g. unitialized data). *) + let bind_loc loc typ v state = + match v with + (* We are adding a "good" value. Store it in the state. *) + | `Value v -> add loc typ v state + (* Indeterminate value. Drop the information known for loc. *) + | `Bottom -> remove loc state + + (* This function updates [state] with information for [expr], only possible + when it is an lvalue. In this case, we can update the corresponding + location with the result of the evaluation of [exp]. Both the value and + the location are found in the [valuation]. *) + let assume_exp valuation expr record state = + match expr.enode with + | Lval lv -> begin + match Valuation.find_loc valuation lv with + | `Top -> state + | `Value {loc; typ} -> bind_loc loc typ record.value.v state + end + | _ -> state + + (* This function fills [state] according to the information available + in [valuation]. This information is computed by EVA's engine for + all the expressions involved in the current statement. *) + let update valuation state = + Valuation.fold (assume_exp valuation) valuation state + + (* Abstraction of an assignment. *) + let assign _kinstr lv _expr value valuation state = + (* Update the state with the information obtained from evaluating + [lv] and [e] *) + let state = update valuation state in + (* Extract the abstract value *) + let value = Eval.value_assigned value in + (* Store the information [lv = e;] in the state *) + let state = bind_loc lv.lloc lv.ltyp value state in + `Value state + + (* Abstraction of a conditional. All information inferred by the engine + is present in the valuation, and must be stored in the memory + abstraction of the domain itself. *) + let assume _stmt _expr _pos valuation state = + `Value (update valuation state) + + let start_call _stmt _call _valuation state = + Eval.(Compute (Continue state, true)) + + let finalize_call _stmt _call ~pre:_ ~post = `Value post + + let approximate_call _stmt call state = + let state = + if Ast_info.is_frama_c_builtin (Kernel_function.get_name call.kf) || + (* Frama-C standard library uses volatile variables to model flow + information about e.g. the filesystem, but this domain does not + track them. So it is always correct to skip calls to functions that + only influence such variables. *) + Eval_typ.kf_assigns_only_result_or_volatile call.kf + then state + else top + in + `Value [state] + + let show_expr valuation state fmt expr = + match expr.enode with + | Lval lval -> + begin + match Valuation.find_loc valuation lval with + | `Top -> () + | `Value {loc; typ} -> Value.pretty fmt (find loc typ state) + end + | _ -> () + end + + let enter_scope _kf _vars state = state + let leave_scope _kf vars state = remove_variables vars state + + let enter_loop _ state = state + let incr_loop_counter _ state = state + let leave_loop _ state = state + + let logic_assign _assign location ~pre:_ state = remove location state + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state + + let empty () = top + let introduce_globals _varinfos state = state + let initialize_variable _lval _location ~initialized:_ _value state = state + let initialize_variable_using_type _kind _varinfo state = state + + let filter_by_bases _bases state = state + let reuse ~current_input:_ ~previous_output:state = state + + let storage () = true +end + + +module Make_Domain (Info: sig val name: string end) (Value: Value) = +struct + module M = Make_Internal (Info) (Value) + include Domain_builder.Complete (M) + let add = M.add + let find = M.find + let remove = M.remove + let remove_variables = M.remove_variables + let fold = M.fold +end diff --git a/src/plugins/value/domains/simple_memory.mli b/src/plugins/value/domains/simple_memory.mli new file mode 100644 index 0000000000000000000000000000000000000000..f0366a3422b79e219232e8acaefcca7ac6069ff9 --- /dev/null +++ b/src/plugins/value/domains/simple_memory.mli @@ -0,0 +1,106 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Simple memory abstraction for scalar non-volatile variables, built upon a + value abstraction. Basically a map from variable to values. *) + +(** Abstraction of the values variables are mapped to. *) +module type Value = sig + include Datatype.S + + (** Lattice structure. *) + + val top : t + val join : t -> t -> t + val widen : t -> t -> t + val narrow : t -> t -> t Eval.or_bottom + val is_included : t -> t -> bool + + (** This function must return [true] if the given variable should be + tracked by the domain. All untracked variables are implicitely + mapped to [V.top]. *) + val track_variable: Cil_types.varinfo -> bool + + (** Can be equal to {!pretty} *) + val pretty_debug: t Pretty_utils.formatter +end + +(** Signature of a simple memory abstraction for scalar variables. *) +module type S = sig + type t + type value + + (** [add loc typ v state] binds [loc] to [v] in state. If [typ] does + not match the effective type of the location pointed, [V.top] is + bound instead. This function automatically handles the case where + [loc] abstracts multiple locations, or when some locations are not + tracked by the domain. *) + val add: Precise_locs.precise_location -> Cil_types.typ -> value -> t -> t + + (** [find loc typ state] returns the join of the abstract values stored + in the locations abstracted to by [loc] in [state], assuming the + result has type [typ]. When [loc] includes untracked locations, or when + [typ] does not match the type of the locations in [loc], the + result is approximated. *) + val find: Precise_locs.precise_location -> Cil_types.typ -> t -> value + + (** [remove loc state] drops all information on the locations pointed to + by [loc] from [state]. *) + val remove: Precise_locs.precise_location -> t -> t + + (** [remove_variables list state] drops all information about the variables + in [list] from state. *) + val remove_variables: Cil_types.varinfo list -> t -> t + + (** Fold on base value pairs. *) + val fold: (Base.t -> value -> 'a -> 'a) -> t -> 'a -> 'a + +end + +(* Builds a memory from a value abstraction. *) +module Make_Memory (Value: Value) : sig + include Datatype.S_with_collections + include S with type t := t + and type value := Value.t + + val top: t + (** The top abstraction, which maps all variables to {!V.top}. *) + + val join: t -> t -> t + val widen: t -> t -> t + val is_included: t -> t -> bool +end + + +(* Builds a complete Eva domain from a value abstraction. *) +module Make_Domain + (Info: sig val name: string end) + (Value: Value) + : sig + + include Abstract_domain.Internal with type value = Value.t + and type location = Precise_locs.precise_location + + include S with type t := t + and type value := Value.t + + end diff --git a/src/plugins/value/domains/simpler_domains.mli b/src/plugins/value/domains/simpler_domains.mli new file mode 100644 index 0000000000000000000000000000000000000000..c3cab406c7338c26c59976277b2d91af89dd5024 --- /dev/null +++ b/src/plugins/value/domains/simpler_domains.mli @@ -0,0 +1,148 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Simplified interfaces for abstract domains. Complete abstract domains can be + built from these interfaces through the functors in {!Domain_builder}. More + documentation can be found on the complete interface of abstract domains, + in {!Abstract_domain}. *) + +open Cil_types +open Eval + +(** Both the formal argument of a called function and the concrete argument at a + call site. *) +type simple_argument = { + formal: varinfo; + concrete: exp; +} + +(** Simple information about a function call. *) +type simple_call = { + kf: kernel_function; (* The called function. *) + arguments: simple_argument list; (* The list of arguments of the call. *) + rest: exp list; (* Extra arguments. *) + return: varinfo option; (* Fake varinfo where the result of the + call is stored. *) + recursive: bool; (* Is the call recursive? *) +} + +(** Simplest interface for an abstract domain. No exchange of information with + the other abstractions of Eva. *) +module type Minimal = sig + type t + val name: string + val compare: t -> t -> int + val hash: t -> int + + (** Lattice structure. *) + + val top: t + val is_included: t -> t -> bool + val join: t -> t -> t + val widen: kernel_function -> stmt -> t -> t -> t + + (** Transfer functions. *) + + val assign: kinstr -> lval -> exp -> t -> t or_bottom + val assume: stmt -> exp -> bool -> t -> t or_bottom + val start_call: stmt -> simple_call -> t -> t + val finalize_call: stmt -> simple_call -> pre:t -> post:t -> t or_bottom + val approximate_call: stmt -> simple_call -> t -> t list or_bottom + + (** Initialization of variables. *) + + val empty: unit -> t + val introduce_globals: varinfo list -> t -> t + val initialize_variable: + lval -> initialized:bool -> Abstract_domain.init_value -> t -> t + + val enter_scope: kernel_function -> varinfo list -> t -> t + val leave_scope: kernel_function -> varinfo list -> t -> t + + (** Pretty printers. *) + + val pretty: Format.formatter -> t -> unit + val show_expr: t -> Format.formatter -> exp -> unit +end + +(** The simplest interface of domains, equipped with a frama-c datatype. *) +module type Minimal_with_datatype = sig + include Minimal + include Datatype.S with type t := t +end + + +(** A simpler functional interface for valuations. *) +type cvalue_valuation = { + find: exp -> Cvalue.V.t flagged_value or_top; + find_loc: lval -> Precise_locs.precise_location or_top +} + +(** A simple interface allowing the abstract domain to use the value and + location abstractions computed by the other domains. Only the {!Cvalue.V} + and the the {!Precise_locs} abstractions are available in this interface, on + the transfer functions for assignment, assumption and at the call sites. On + the other hand, the abstract domain cannot assist the computation of these + value and location abstractions. The communication is thus unidirectional, + from other domains to these simpler domains. *) +module type Simple_Cvalue = sig + include Datatype.S + + (** Lattice structure. *) + + val top: t + val is_included: t -> t -> bool + val join: t -> t -> t + val widen: kernel_function -> stmt -> t -> t -> t + + (** Query functions. *) + + val extract_expr: t -> exp -> Cvalue.V.t or_bottom + val extract_lval: + t -> lval -> typ -> Precise_locs.precise_location -> Cvalue.V.t or_bottom + + (** Transfer functions. *) + + val assign: + kinstr -> Precise_locs.precise_location left_value -> exp -> + Cvalue.V.t assigned -> cvalue_valuation -> t -> t or_bottom + + val assume: stmt -> exp -> bool -> cvalue_valuation -> t -> t or_bottom + + val start_call: stmt -> Cvalue.V.t call -> cvalue_valuation -> t -> t + + val finalize_call: stmt -> Cvalue.V.t call -> pre:t -> post:t -> t or_bottom + val approximate_call: stmt -> Cvalue.V.t call -> t -> t list or_bottom + + (** Initialization of variables. *) + + val empty: unit -> t + val introduce_globals: varinfo list -> t -> t + val initialize_variable: + lval -> initialized:bool -> Abstract_domain.init_value -> t -> t + + val enter_scope: kernel_function -> varinfo list -> t -> t + val leave_scope: kernel_function -> varinfo list -> t -> t + + (** Pretty printer. *) + val show_expr: t -> Format.formatter -> exp -> unit +end diff --git a/src/plugins/value/domains/symbolic_locs.ml b/src/plugins/value/domains/symbolic_locs.ml index 13a127e3ba39c907661b4c0303579a2535345ade..ea68c9c16e753b5e2e5bf4c335eb63493cafdd8c 100644 --- a/src/plugins/value/domains/symbolic_locs.ml +++ b/src/plugins/value/domains/symbolic_locs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -48,6 +48,28 @@ module K2V = struct let decide _ v1 v2 = Some (V.join v1 v2) in M.inter ~cache ~symmetric ~idempotent ~decide + let widen = + let cache = Hptmap_sig.NoCache in + let symmetric = false in + let idempotent = true in + let wh = Integer.zero, fun _b -> Ival.Widen_Hints.empty in + let decide _ v1 v2 = Some (V.widen wh v1 v2) in + M.inter ~cache ~symmetric ~idempotent ~decide + + let _narrow = + let module E = struct exception Bottom end in + let cache_name = cache_prefix ^ ".narrow" in + let cache = Hptmap_sig.PersistentCache cache_name in + let symmetric = true in + let idempotent = true in + let decide _ v1 v2 = + let v = V.narrow v1 v2 in + if V.is_bottom v then raise E.Bottom else v + in + fun a b -> + try `Value (M.join ~cache ~symmetric ~idempotent ~decide a b) + with E.Bottom -> `Bottom + let is_included = let cache_name = cache_prefix ^ ".is_included" in let decide_fst _b _v1 = true (* v2 is top *) in @@ -244,7 +266,26 @@ module Memory = struct let bases = Base.Set.union (key_deps k) (v_deps v) in let syntactic_deps = Base.Set.fold add_dep bases state.syntactic_deps in { values; zones; deps; syntactic_deps } - with Zone.Error_Top (* unknown dependencies *) -> state + with Abstract_interp.Error_Top (* unknown dependencies *) -> state + + (* rebuild the state from scratch, especially [deps] and [syntactic_deps]. + For debugging purposes. *) + let rebuild state = + let aux k v acc = + let z = + try K2Z.find k state.zones + with Not_found -> + Value_parameters.abort "Missing zone for %a@.%a" + K.HCE.pretty k pretty state + in + add_key k v z acc + in + K2V.fold aux state.values empty_map + + (* check that a state is correct w.r.t. the invariants on [deps] and + [syntactic_deps]. *) + let _check state = + assert (equal state (rebuild state)) (* inverse operation of [add_key] *) let remove_key k state = @@ -287,12 +328,13 @@ module Memory = struct syntactic_deps = B2K.union m1.syntactic_deps m2.syntactic_deps; } - let join_and_is_included m1 m2 = - let m = join m1 m2 in - let incl = K2V.M.equal m.values m2.values && K2Z.equal m.zones m2.zones in - (m, incl) + let widen _kf _wh m1 m2 = + if K2V.equal m1.values m2.values && K2Z.equal m1.zones m2.zones + then m1 + else { m2 with values = K2V.widen m1.values m2.values } - let widen _kf _wh m1 m2 = join m1 m2 (* TODO: widen values? *) + (* TODO *) + let narrow m1 _m2 = `Value m1 (* ------------------------------------------------------------------------ *) (* --- High-level functions --- *) @@ -313,7 +355,7 @@ module Memory = struct try (* Check all the keys overwritten *) Zone.fold_bases aux_base z acc - with Zone.Error_Top -> top + with Abstract_interp.Error_Top -> top (* remove the keys that depend on the variables in [l] *) let remove_variables l state = @@ -381,7 +423,9 @@ module Internal : Domain_builder.InputDomain include Abstract_domain.Lattice with type state := state end) + let name = "Symbolic locations domain" let structure = Abstract_domain.Void + let log_category = dkey let empty _ = Memory.empty_map @@ -394,18 +438,6 @@ module Internal : Domain_builder.InputDomain let incr_loop_counter _ state = state let leave_loop _ state = state - (* Call in which we do not use the body. Return Top, except for builtins - and functions that do not significantly alter the memory. *) - let approximate_call kf state = - let post_state = - let name = Kernel_function.get_name kf in - if Ast_info.is_frama_c_builtin name || - (name <> "free" && Eval_typ.kf_assigns_only_result_or_volatile kf) - then state - else top - in - `Value [post_state] - type origin = unit module Transfer (Valuation: Abstract_domain.Valuation @@ -413,15 +445,11 @@ module Internal : Domain_builder.InputDomain and type origin = origin and type loc = Precise_locs.precise_location) : Abstract_domain.Transfer - with type state = state - and type value = V.t - and type location = Precise_locs.precise_location - and type valuation = Valuation.t + with type state := state + and type value := V.t + and type location := Precise_locs.precise_location + and type valuation := Valuation.t = struct - type value = V.t - type state = Memory.t - type location = Precise_locs.precise_location - type valuation = Valuation.t (* build a [get_locs] function from a valuation *) let get_locs valuation = @@ -447,7 +475,19 @@ module Internal : Domain_builder.InputDomain match r.reductness, v.v, v.initialized, v.escaping with | (Created | Reduced), `Value v, true, false -> if not (is_cond e) && multiple_loc_exp (get_locs valuation) e then - Memory.add_exp state (get_locs valuation) e v + begin + let k = K.HCE.of_exp e in + (* remove the existing binding: the key may already be in + the state, and [add_exp] assumes it is not the case. + The new dependencies may not be the same (in rare cases + where one dependency has disappeared by reduction), so + we need to update the dependency inverse maps. *) + (* TODO: it would be more efficient to use a function that + compares the previous and current dependencies, and update + the inverse maps accordingly. *) + let state = Memory.remove_key k state in + Memory.add_exp state (get_locs valuation) e v + end else state | _ -> state @@ -491,29 +531,23 @@ module Internal : Domain_builder.InputDomain let state = update valuation state in Compute (Continue state, true) - let dump_current_state state = - let l = fst (Cil.CurrentLoc.get ()) in - Value_parameters.result ~dkey "DUMPING SYMBLOCS STATE \ - of file %s line %d@.%a" - (Filepath.pretty l.Lexing.pos_fname) l.Lexing.pos_lnum - pretty state - - let finalize_call _stmt call ~pre:_ ~post = - let kf = call.kf in - let name = Kernel_function.get_name kf in - if Ast_info.is_cea_dump_function name && - Value_parameters.is_debug_key_enabled dkey - then dump_current_state post; - `Value post + let finalize_call _stmt _call ~pre:_ ~post = `Value post + (* Call in which we do not use the body. Return Top, except for builtins + and functions that do not significantly alter the memory. *) let approximate_call _stmt call state = - approximate_call call.kf state + let post_state = + let name = Kernel_function.get_name call.kf in + if Ast_info.is_frama_c_builtin name || + name <> "free" && Eval_typ.kf_assigns_only_result_or_volatile call.kf + then state + else top + in + `Value [post_state] + let show_expr _valuation _state _fmt _expr = () end - let compute_using_specification _ki call _spec state = - approximate_call call.kf state - let top_query = `Value (V.top, ()), Alarmset.all (* For extraction functions, if we have an information about the value, @@ -546,18 +580,17 @@ module Internal : Domain_builder.InputDomain state (* TODO *) (* Initial state. Initializers are singletons, so we store nothing. *) - let global_state () = None - let initialize_var_using_type state _ = state - let initialize_var state _ _ _ = state + let introduce_globals _ state = state + let initialize_variable_using_type _ _ state = state + let initialize_variable _ _ ~initialized:_ _ state = state (* Logic *) - type eval_env = state - let env_current_state state = `Value state - let env_annot ~pre:_ ~here () = here - let env_pre_f ~pre () = pre - let env_post_f ~pre:_ ~post ~result:_ () = post - let eval_predicate _ _ = Alarmset.Unknown - let reduce_by_predicate state _ _ = state + let logic_assign _assigns location ~pre:_ state = + let loc = Precise_locs.imprecise_location location in + Memory.kill loc state + + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ state _ _ = `Value state let storage = Value_parameters.SymbolicLocsStorage.get diff --git a/src/plugins/value/domains/symbolic_locs.mli b/src/plugins/value/domains/symbolic_locs.mli index c67989af6a33459522fbcf21df2fc52d5dd91440..f5f8a6b2fbab4c2217b78d0b8fcb5bc7a2bd34d3 100644 --- a/src/plugins/value/domains/symbolic_locs.mli +++ b/src/plugins/value/domains/symbolic_locs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/domains/unit_domain.ml b/src/plugins/value/domains/unit_domain.ml index 51b8c5c5bffa09fa09c68f89f62bfc7bc9e47bee..e138e5a2af10d98720fd78722087126444ff3db1 100644 --- a/src/plugins/value/domains/unit_domain.ml +++ b/src/plugins/value/domains/unit_domain.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -22,24 +22,39 @@ open Eval -module MakeInternal +let log_key = Value_parameters.register_category "unit-domain" + +module Static = struct + module D = struct + include Datatype.Unit + type state = t + + let name = "Unit domain" + let structure = Abstract_domain.Void + let log_category = log_key + + let top = () + let is_included _ _ = true + let join _ _ = () + let widen _ _ _ _ = () + let narrow _ _ = `Value () + + let storage () = false + end + + include D + module Store = Domain_store.Make (D) +end + +module Make (Value: Abstract_value.S) (Loc: Abstract_location.S) = struct - include Datatype.Unit - type state = t + include Static type value = Value.t type location = Loc.location - let structure = Abstract_domain.Void - - let top = () - let is_included _ _ = true - let join _ _ = () - let join_and_is_included _ _ = (), true - let widen _ _ _ _ = () - type origin = unit let eval_top = `Value (Value.top, ()), Alarmset.all @@ -48,36 +63,23 @@ module MakeInternal let backward_location _ _ _ loc value = `Value (loc, value) let reduce_further _ _ _ = [] - let call_result = `Value [ () ] - module Transfer (Valuation: Abstract_domain.Valuation with type value = value and type loc = location) = struct - type state = t - type value = Value.t - type location = Loc.location - type valuation = Valuation.t - let update _ _ = () let assign _ _ _ _ _ _ = `Value () let assume _ _ _ _ _ = `Value () let start_call _ _ _ _ = Compute (Continue (), true) let finalize_call _ _ ~pre:_ ~post:_ = `Value () - let approximate_call _ _ _ = call_result - + let approximate_call _ _ _ = `Value [ () ] + let show_expr _ _ _ _ = () end - type eval_env = unit - let env_current_state _ = `Value () - let env_annot ~pre:_ ~here:_ () = () - let env_pre_f ~pre:_ () = () - let env_post_f ~pre:_ ~post:_ ~result:_ () = () - let eval_predicate _ _ = Alarmset.Unknown - let reduce_by_predicate _ _ _ = () - - let compute_using_specification _ _ _ _ = call_result + let logic_assign _ _ ~pre:_ _ = () + let evaluate_predicate _ _ _ = Alarmset.Unknown + let reduce_by_predicate _ _ _ _ = `Value () let enter_scope _ _ _ = () let leave_scope _ _ _ = () @@ -87,24 +89,14 @@ module MakeInternal let leave_loop _ _ = () let empty () = () - let initialize_var _ _ _ _ = () - let initialize_var_using_type _ _ = () - let global_state () = None + let introduce_globals _ () = () + let initialize_variable _ _ ~initialized:_ _ _ = () + let initialize_variable_using_type _ _ _ = () let filter_by_bases _ _ = () let reuse ~current_input:_ ~previous_output:_ = () - - let storage () = false - end -module Make - (Value: Abstract_value.S) - (Loc: Abstract_location.S) -= Domain_builder.Complete (MakeInternal (Value) (Loc)) - - - (* Local Variables: diff --git a/src/plugins/value/domains/unit_domain.mli b/src/plugins/value/domains/unit_domain.mli index f6925a91d66bf90c9c616914f9afc06b51c6e261..26571694f833a3d7e841bc9782c3ddf95a43ceea 100644 --- a/src/plugins/value/domains/unit_domain.mli +++ b/src/plugins/value/domains/unit_domain.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/engine/abstractions.ml b/src/plugins/value/engine/abstractions.ml index 5f482dc2b96fdbbbcc08a54267f9824b6f34cb2d..8fb2fb7df2ce68264f0b3884d436327ab15e9a14 100644 --- a/src/plugins/value/engine/abstractions.ml +++ b/src/plugins/value/engine/abstractions.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -33,6 +33,8 @@ type config = { polka_loose : bool; polka_strict : bool; polka_equalities : bool; + inout: bool; + signs: bool; } let configure () = { @@ -46,6 +48,8 @@ let configure () = { polka_loose = Value_parameters.PolkaLoose.get (); polka_strict = Value_parameters.PolkaStrict.get (); polka_equalities = Value_parameters.PolkaEqualities.get (); + inout = Value_parameters.InoutDomain.get (); + signs = Value_parameters.SignDomain.get (); } let default_config = configure () @@ -61,6 +65,8 @@ let legacy_config = { polka_loose = false; polka_strict = false; polka_equalities = false; + inout = false; + signs = false; } module type Value = sig @@ -95,10 +101,21 @@ let has_apron config = config.apron_oct || config.apron_box || config.polka_equalities || config.polka_loose || config.polka_strict -let add_value_abstraction value v = - let module Value = (val value : Abstract_value.Internal) in - let module V = (val v : Abstract_value.Internal) in - (module Value_product.Make (Value) (V) : Abstract_value.Internal) +(* The apron domains relies on a specific interval abstraction to communicate + with other domains. This function adds the intervals to the current [value] + abstraction. These intervals carry the same information as the cvalue + abstractions (if they are enabled). Do not display the intervals in the GUI + in this case. *) +let add_apron_value config value = + let module Left = ((val value: Abstract_value.Internal)) in + let module V = struct + include Value_product.Make (Left) (Main_values.Interval) + let pretty_typ = + if config.cvalue + then fun fmt typ (left, _right) -> Left.pretty_typ fmt typ left + else pretty_typ + end in + (module V: Abstract_value.Internal) let open_value_abstraction value = let module Value = (val value : Abstract_value.Internal) in @@ -113,9 +130,16 @@ let build_value config = then (module Offsm_value.CvalueOffsm : Abstract_value.Internal) else (module Main_values.CVal : Abstract_value.Internal) in + let value = + if config.signs + then + let module V = Value_product.Make ((val value)) (Sign_value) in + (module V: Abstract_value.Internal) + else value + in let value = if has_apron config - then add_value_abstraction value (module Main_values.Interval) + then add_apron_value config value else value in open_value_abstraction value @@ -323,6 +347,33 @@ let add_symbolic_locs = let add_gauges = add_standard_domain (module Gauges_domain.D) +(* -------------------------------------------------------------------------- *) +(* Inout *) +(* -------------------------------------------------------------------------- *) + +let add_inout = + add_standard_domain (module Inout_domain.D) + +(* -------------------------------------------------------------------------- *) +(* Sign Domain *) +(* -------------------------------------------------------------------------- *) + +let add_signs abstract = + let module Abstract = (val abstract : Abstract) in + let module K = struct + type v = Sign_value.t + let key = Sign_value.sign_key + end in + let module Conv = Convert (Abstract.Val) (K) in + let module Sign = Domain_lift.Make (Sign_domain) (Conv) in + let module Dom = Domain_product.Make (Abstract.Val) (Abstract.Dom) (Sign) in + (module struct + module Val = Abstract.Val + module Loc = Abstract.Loc + module Dom = Dom + end : Abstract) + + (* -------------------------------------------------------------------------- *) (* Build Abstractions *) (* -------------------------------------------------------------------------- *) @@ -383,6 +434,16 @@ let build_abstractions config = then add_gauges abstractions else abstractions in + let abstractions = + if config.inout + then add_inout abstractions + else abstractions + in + let abstractions = + if config.signs + then add_signs abstractions + else abstractions + in let abstractions = add_dynamic_abstractions abstractions in abstractions diff --git a/src/plugins/value/engine/abstractions.mli b/src/plugins/value/engine/abstractions.mli index 2a3a958373cb7b371fc345da31d3d9a637021288..a0e4f92df625685bfd8f792e49cbf10419f9ebe2 100644 --- a/src/plugins/value/engine/abstractions.mli +++ b/src/plugins/value/engine/abstractions.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,6 +34,8 @@ type config = { polka_loose : bool; polka_strict : bool; polka_equalities : bool; + inout: bool; + signs: bool; } (** Default configuration of EVA. *) diff --git a/src/plugins/value/engine/analysis.ml b/src/plugins/value/engine/analysis.ml index 25a9b7bf376cd228a9064d0f057fcb06d9bc8304..7c3d247128b580773b541010a90740df3cead5ae 100644 --- a/src/plugins/value/engine/analysis.ml +++ b/src/plugins/value/engine/analysis.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,15 +26,26 @@ open Eval module type Results = sig type state type value + type location val get_stmt_state : stmt -> state or_bottom + val get_kinstr_state: kinstr -> state or_bottom + val get_stmt_state_by_callstack: + after:bool -> stmt -> state Value_types.Callstack.Hashtbl.t or_top_or_bottom + val get_initial_state_by_callstack: + kernel_function -> state Value_types.Callstack.Hashtbl.t or_top_or_bottom + val eval_expr : state -> exp -> value evaluated + val copy_lvalue: state -> lval -> value flagged_value evaluated + val eval_lval_to_loc: state -> lval -> location evaluated + val eval_function_exp: state -> exp -> kernel_function list evaluated end module type S = sig include Abstractions.S include Results with type state := Dom.state and type value := Val.t + and type location := Loc.location end module type Analyzer = sig @@ -49,8 +60,7 @@ module Make (Abstract: Abstractions.S) = struct include Abstract - module Eva = Evaluation.Make (Abstract.Val) (Abstract.Loc) (Abstract.Dom) - module Eval = Non_linear_evaluation.Make (Abstract.Val) (Eva) + module Eval = Evaluation.Make (Abstract.Val) (Abstract.Loc) (Abstract.Dom) include Compute_functions.Make (Abstract) (Eval) @@ -60,8 +70,28 @@ module Make (Abstract: Abstractions.S) = struct then Abstract.Dom.Store.get_stmt_state stmt else `Value Abstract.Dom.top + let get_kinstr_state = function + | Kglobal -> Abstract.Dom.Store.get_global_state () + | Kstmt stmt -> get_stmt_state stmt + + let get_stmt_state_by_callstack = + Abstract.Dom.Store.get_stmt_state_by_callstack + + let get_initial_state_by_callstack = + Abstract.Dom.Store.get_initial_state_by_callstack + let eval_expr state expr = Eval.evaluate state expr >>=: snd + let copy_lvalue state expr = Eval.copy_lvalue state expr >>=: snd + + let eval_lval_to_loc state lv = + let get_loc (_, loc, _) = loc in + let for_writing = false in + Eval.lvaluate ~for_writing state lv >>=: get_loc + + let eval_function_exp state e = + Eval.eval_function_exp e state >>=: (List.map fst) + end @@ -74,40 +104,74 @@ module Default = else (module Make (Abstractions.Default))) : Analyzer) -let abstracts config = - if config = Abstractions.default_config - then (module Abstractions.Default : Abstractions.S) - else Abstractions.make config +(* Reference to the current configuration (built by Abstractions.configure from + the parameters of Eva regarding the abstractions used in the analysis) and + the current Analyzer module. *) let ref_analyzer = ref (Abstractions.default_config, (module Default : Analyzer)) -let current = ref (module Default : S) -let current_analyzer = ref (module Default : Analyzer) +(* Returns the current Analyzer module. *) +let current_analyzer () = (module (val (snd !ref_analyzer)): S) + +(* Set of hooks called whenever the current Analyzer module is changed. + Useful for the GUI parts that depend on it. *) +module Analyzer_Hook = Hook.Build (struct type t = (module S) end) + +(* Register a new hook. *) +let register_hook = Analyzer_Hook.extend + +(* Sets the current Analyzer module for a given configuration. + Calls the hooks above. *) +let set_current_analyzer config (analyzer: (module Analyzer)) = + Analyzer_Hook.apply (module (val analyzer): S); + ref_analyzer := (config, analyzer) let cvalue_initial_state () = - let module A = (val !current_analyzer) in + let module A = (val snd !ref_analyzer) in let _, lib_entry = Globals.entry_point () in Cvalue_domain.extract A.Dom.get (A.initial_state ~lib_entry) -let compute config ~lib_entry kf = +(* Builds the Analyzer module corresponding to a given configuration, + and sets it as the current analyzer. *) +let make_analyzer config = let analyzer = if config = Abstractions.legacy_config then (module Legacy: Analyzer) else if config = Abstractions.default_config then (module Default) - else if config = fst !ref_analyzer then snd !ref_analyzer else - let module Abstract = (val abstracts config) in + let module Abstract = (val Abstractions.make config) in let module Analyzer = Make (Abstract) in - ref_analyzer := (config, (module Analyzer)); (module Analyzer) in - let module Analyzer = (val analyzer) in - current := (module Analyzer: S); - current_analyzer := (module Analyzer: Analyzer); - Analyzer.compute_from_entry_point ~lib_entry kf + set_current_analyzer config analyzer + +(* Builds the analyzer according to the parameters of Eva. *) +let reset_analyzer () = + let config = Abstractions.configure () in + (* If the configuration has not changed, do not reset the Analyzer but uses + the reference instead. *) + if config <> fst !ref_analyzer + then make_analyzer config +(* Builds the analyzer if needed, and run the analysis. *) let force_compute () = Ast.compute (); let kf, lib_entry = Globals.entry_point () in - let config = Abstractions.configure () in - compute config ~lib_entry kf + reset_analyzer (); + let module Analyzer = (val snd !ref_analyzer) in + Analyzer.compute_from_entry_point ~lib_entry kf + +let set_hook_on_parameter parameter = + let open Typed_parameter in + match parameter.accessor with + | Bool (accessor, _) -> accessor.add_set_hook (fun _ _ -> reset_analyzer ()) + | Int (accessor, _) -> accessor.add_set_hook (fun _ _ -> reset_analyzer ()) + | String (accessor, _) -> accessor.add_set_hook (fun _ _ -> reset_analyzer ()) + +(* Resets the Analyzer whenever an abstraction parameter or the current project + is changed. This maintains the analyzer consistent with the Eva parameters. *) +let () = + List.iter set_hook_on_parameter Value_parameters.parameters_abstractions; + Project.register_after_set_current_hook + ~user_only:true (fun _ -> reset_analyzer ()); + Project.register_after_global_load_hook reset_analyzer diff --git a/src/plugins/value/engine/analysis.mli b/src/plugins/value/engine/analysis.mli index ef256f4cba0d3331309a483173925cbb1aabd892..3fffc3a504e695dc9d876e04bd325cf173164225 100644 --- a/src/plugins/value/engine/analysis.mli +++ b/src/plugins/value/engine/analysis.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,9 +26,19 @@ open Eval module type Results = sig type state type value + type location val get_stmt_state : stmt -> state or_bottom + val get_kinstr_state: kinstr -> state or_bottom + val get_stmt_state_by_callstack: + after:bool -> stmt -> state Value_types.Callstack.Hashtbl.t or_top_or_bottom + val get_initial_state_by_callstack: + kernel_function -> state Value_types.Callstack.Hashtbl.t or_top_or_bottom + val eval_expr : state -> exp -> value evaluated + val copy_lvalue: state -> lval -> value flagged_value evaluated + val eval_lval_to_loc: state -> lval -> location evaluated + val eval_function_exp: state -> exp -> kernel_function list evaluated end @@ -39,6 +49,7 @@ module Make (Abstract: Abstractions.S) : sig include Results with type state := Abstract.Dom.state and type value := Abstract.Val.t + and type location := Abstract.Loc.location end @@ -46,14 +57,16 @@ module type S = sig include Abstractions.S include Results with type state := Dom.state and type value := Val.t + and type location := Loc.location end -val current : (module S) ref +val current_analyzer : unit -> (module S) (** The abstractions used in the latest analysis, and its results. *) -val compute : Abstractions.config -> lib_entry:bool -> kernel_function -> unit -(** Perform a full analysis, starting from the given kernel_function and with - the abstractions specified by the configuration. *) +val register_hook: ((module S) -> unit) -> unit +(** Registers a hook that will be called each time the [current] analyzer + is changed. This happens when a new analysis is run with different + abstractions than before, or when the current project is changed. *) val force_compute : unit -> unit (** Perform a full analysis, starting from the [main] function. *) diff --git a/src/plugins/value/engine/compute_functions.ml b/src/plugins/value/engine/compute_functions.ml index a14678cf03f35e5185ff5adf8b78c37fca8b2829..822b547f5672d1cc763965d2fe3ad2f983924362 100644 --- a/src/plugins/value/engine/compute_functions.ml +++ b/src/plugins/value/engine/compute_functions.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,7 +25,6 @@ open Eval let dkey = Value_parameters.register_category "callbacks" - let floats_ok () = let u = min_float /. 2. in let u = u /. 2. in @@ -76,14 +75,14 @@ let pre_analysis () = Split_return.pretty_strategies (); generate_specs (); Widen.precompute_widen_hints (); + if Value_parameters.WarnBuiltinOverride.get () then + Builtins.warn_definitions_overridden_by_builtins (); Value_perf.reset (); (* We may be resuming Value from a previously crashed analysis. Clear degeneration states *) Value_util.DegenerationPoints.clear (); Cvalue.V.clear_garbled_mix (); - Stop_at_nth.clear (); Value_util.clear_call_stack (); - Separate.prologue (); Db.Value.mark_as_computed () let post_analysis_cleanup ~aborted = @@ -94,13 +93,12 @@ let post_analysis_cleanup ~aborted = (fun s _ -> ignore (Db.Value.get_stmt_state s)); if not aborted then begin (* Keep memexec results for users that want to resume the analysis *) - Mem_exec2.cleanup_results (); + Mem_exec.cleanup_results (); if not (Value_parameters.SaveFunctionState.is_empty ()) then State_import.save_globals_state (); end let post_analysis () = - Separate.epilogue (); (* Garbled mix must be dumped here -- at least before the call to mark_green_and_red -- because fresh ones are created when re-evaluating all the alarms, and we get an unpleasant "ghost effect". *) @@ -117,7 +115,7 @@ let post_analysis () = Eval_annots.mark_rte (); post_analysis_cleanup ~aborted:false; (* Remove redundant alarms *) - if Value_parameters.RmAssert.get() then !Db.Scope.rm_asserts () + if Value_parameters.RmAssert.get () then !Db.Value.rm_asserts () (* Register a signal handler for SIGUSR1, that will be used to abort Value *) let () = @@ -133,8 +131,6 @@ let () = | Sys.Signal_handle f -> prev := f with Invalid_argument _ -> () (* Ignore: SIGURSR1 is not available on Windows, and possibly on other platforms. *) - - module Make (Abstract: Abstractions.S) (Eva: Evaluation.S with type value = Abstract.Val.t @@ -143,11 +139,6 @@ module Make and type state = Abstract.Dom.t) = struct - module Init = - Initialization.Make (Abstract.Val) (Abstract.Loc) (Abstract.Dom) (Eva) - - let initial_state = Init.initial_state - module Domain = struct include Abstract.Dom let enter_scope kf vars state = match vars with @@ -157,24 +148,24 @@ module Make | [] -> state | _ -> leave_scope kf vars state end - module PowersetDomain = Powerset.Make (Domain) - module Domain_Transfer = struct - include Domain.Transfer (Eva.Valuation) - let leave_scope = Domain.leave_scope - module Store = Domain.Store - include (Domain : Datatype.S with type t = state) - end - module Transfer = - Transfer_stmt.Make (Abstract.Val) (Abstract.Loc) (Domain_Transfer) (Eva) + Transfer_stmt.Make (Abstract.Val) (Abstract.Loc) (Domain) (Eva) + + module Logic = Transfer_logic.Make (Domain) (PowersetDomain) - module Logic = - Transfer_logic.Make (Domain) (PowersetDomain) + module Spec = + Transfer_specification.Make + (Abstract.Val) (Abstract.Loc) (Domain) (PowersetDomain) (Logic) + + module Init = Initialization.Make (Abstract.Dom) (Eva) (Transfer) module Computer = - Partitioned_dataflow.Computer (Domain) (PowersetDomain) (Transfer) (Logic) + Partitioned_dataflow.Computer + (Domain) (PowersetDomain) (Transfer) (Init) (Logic) (Spec) + + let initial_state = Init.initial_state let get_cvalue = match Domain.get Cvalue_domain.key with @@ -192,24 +183,29 @@ module Make Value_results.mark_kf_as_called kf; let global = match call_kinstr with Kglobal -> true | _ -> false in let pp = not global && Value_parameters.ValShowProgress.get () in + let call_stack = Value_util.call_stack () in if pp then Value_parameters.feedback "@[computing for function %a.@\nCalled from %a.@]" - Value_types.Callstack.pretty_short (Value_util.call_stack ()) + Value_types.Callstack.pretty_short call_stack Cil_datatype.Location.pretty (Cil_datatype.Kinstr.loc call_kinstr); - let use_spec = match kf.fundec with - | Declaration (_,_,_,_) -> `Spec (Annotations.funspec kf) - | Definition (def, _) -> - if Kernel_function.Set.mem kf (Value_parameters.UsePrototype.get ()) - then `Spec (Annotations.funspec kf) - else `Def def + let use_spec = + if call.recursive then + `Spec (Recursion.empty_spec_for_recursive_call kf) + else + match kf.fundec with + | Declaration (_,_,_,_) -> `Spec (Annotations.funspec kf) + | Definition (def, _) -> + if Kernel_function.Set.mem kf (Value_parameters.UsePrototype.get ()) + then `Spec (Annotations.funspec kf) + else `Def def in - let cvalue_state = get_cvalue state - and call_stack = Value_util.call_stack () in - let result = match use_spec with + let cvalue_state = get_cvalue state in + let resulting_states, cacheable = match use_spec with | `Spec spec -> - Db.Value.Call_Type_Value_Callbacks.apply (`Spec, cvalue_state, call_stack); - Domain.compute_using_specification call_kinstr call spec state, + Db.Value.Call_Type_Value_Callbacks.apply + (`Spec spec, cvalue_state, call_stack); + Spec.compute_using_specification call_kinstr call spec state, Value_types.Cacheable | `Def _fundec -> Db.Value.Call_Type_Value_Callbacks.apply (`Def, cvalue_state, call_stack); @@ -218,39 +214,41 @@ module Make if pp then Value_parameters.feedback "Done for function %a" Kernel_function.pretty kf; - result + Transfer.{ states = resulting_states; cacheable } (* Mem Exec *) - module MemExec = Mem_exec2.Make (Abstract.Val) (Domain) + module MemExec = Mem_exec.Make (Abstract.Val) (Domain) let compute_call call_kinstr call init_state = - let default () = - compute_using_spec_or_body call_kinstr call init_state - in + let default () = compute_using_spec_or_body call_kinstr call init_state in if Value_parameters.MemExecAll.get () then let args = List.map (fun {avalue} -> Eval.value_assigned avalue) call.arguments in match MemExec.reuse_previous_call call.kf init_state args with | None -> - let res, cacheable = default () in - if not (!Db.Value.use_spec_instead_of_definition call.kf) - && cacheable = Value_types.Cacheable - then - MemExec.store_computed_call call.kf init_state args res; - res, cacheable - | Some (res, i) -> + let call_result = default () in + let () = + if not (!Db.Value.use_spec_instead_of_definition call.kf) + && call_result.Transfer.cacheable = Value_types.Cacheable + then + let final_states = call_result.Transfer.states in + MemExec.store_computed_call call.kf init_state args final_states + in + call_result + | Some (states, i) -> + let stack_with_call = Value_util.call_stack () in Db.Value.Call_Type_Value_Callbacks.apply - (`Memexec, get_cvalue init_state, Value_util.call_stack ()); + (`Memexec, get_cvalue init_state, stack_with_call); (* Evaluate the preconditions of kf, to update the statuses at this call. *) let spec = Annotations.funspec call.kf in if Eval_annots.has_requires spec then begin let ab = Logic.create init_state call.kf in ignore (Logic.check_fct_preconditions - call.kf ab call_kinstr init_state); + call_kinstr call.kf ab init_state); end; if Value_parameters.ValShowProgress.get () then begin Value_parameters.feedback ~current:true @@ -262,7 +260,7 @@ module Make Db.Value.Record_Value_Callbacks_New.apply (stack_with_call, Value_types.Reuse i); (* call can be cached since it was cached once *) - res, Value_types.Cacheable + Transfer.{states; cacheable = Value_types.Cacheable} else default () @@ -278,7 +276,9 @@ module Make Value_results.mark_kf_as_called kf; Value_util.push_call_stack kf Kglobal; store_initial_state kf init_state; - let call = {kf; arguments = []; rest = []; return = None} in + let call = + {kf; arguments = []; rest = []; return = None; recursive = false} + in ignore (compute_using_spec_or_body Kglobal call init_state); Value_util.pop_call_stack (); Value_parameters.feedback "done for function %a" Kernel_function.pretty kf; @@ -298,7 +298,13 @@ module Make Value_parameters.feedback "Analyzing a%scomplete application starting at %a" (if lib_entry then "n in" else " ") Kernel_function.pretty kf; - match Init.initial_state_with_formals ~lib_entry kf with + let initial_state = + try Init.initial_state_with_formals ~lib_entry kf + with Db.Value.Aborted -> + post_analysis_cleanup ~aborted:true; + Value_parameters.abort "Degeneration occurred during initialization, aborting." + in + match initial_state with | `Bottom -> Value_parameters.result "Value analysis not started because globals \ initialization is not computable."; @@ -308,8 +314,8 @@ module Make let compute_from_init_state kf init_state = pre_analysis (); + Domain.Store.register_global_state (`Value init_state); compute kf init_state - end diff --git a/src/plugins/value/engine/compute_functions.mli b/src/plugins/value/engine/compute_functions.mli index de2485f66ca550e3d5c63c00bc62ec2371d3d87e..e475b3a0d375f980c9e598d331996b44bdc6595c 100644 --- a/src/plugins/value/engine/compute_functions.mli +++ b/src/plugins/value/engine/compute_functions.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/engine/evaluation.ml b/src/plugins/value/engine/evaluation.ml index f1f9eba6aaa26d4f0e9193554494b02609266069..e845737fb760620a9daa6a4d586cf833b94a737c 100644 --- a/src/plugins/value/engine/evaluation.ml +++ b/src/plugins/value/engine/evaluation.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -155,18 +155,16 @@ module type S = sig val lvaluate : ?valuation:Valuation.t -> for_writing:bool -> state -> lval -> (Valuation.t * loc * typ) evaluated + val can_copy: + ?valuation:Valuation.t -> is_ret:bool -> state -> kinstr -> + lval -> exp -> (lval option * Valuation.t) evaluated val reduce: ?valuation:Valuation.t -> state -> exp -> bool -> Valuation.t evaluated val assume: ?valuation:Valuation.t -> state -> exp -> value -> Valuation.t or_bottom - - val loc_size: loc -> Int_Base.t - val reinterpret: exp -> typ -> value -> value evaluated - val do_promotion: src_typ:typ -> dst_typ: typ -> exp -> value -> value evaluated val split_by_evaluation: exp -> Integer.t list -> state list -> (Integer.t * state list * bool) list * state list - val check_copy_lval: (lval * loc) -> (lval * loc) -> bool evaluated val check_non_overlapping: state -> lval list -> lval list -> unit evaluated val eval_function_exp: @@ -189,7 +187,7 @@ let close_dereference_alarms lval typ alarms = let closed_alarms = Alarmset.set escap_alarm escap_status closed_alarms in match typ with | TFloat (fkind, _) -> - let expr = Cil.dummy_exp (Cil_types.Lval lval) in + let expr = Value_util.lval_to_exp lval in let nan_inf_alarm = Alarms.Is_nan_or_infinite (expr, fkind) in let nan_inf_status = Alarmset.find nan_inf_alarm alarms in Alarmset.set nan_inf_alarm nan_inf_status closed_alarms, reduced @@ -339,6 +337,40 @@ module Make let v = record.value.v >>-: Value.reduce in { record with value = {record.value with v = v} } + + let may_overflow = function + | Shiftlt | Mult | MinusPP | MinusPI | IndexPI | PlusPI + | PlusA | Div | Mod | MinusA -> true + | _ -> false + + let handle_integer_overflow expr range eval = + let signed = range.Eval_typ.i_signed in + if (signed && Kernel.SignedOverflow.get ()) || + (not signed && Kernel.UnsignedOverflow.get ()) + then eval >>= Value.truncate_integer expr range + else eval >>=: Value.rewrap_integer range + + let handle_overflow ~may_overflow expr typ eval = + match Eval_typ.classify_as_scalar typ with + | Eval_typ.TSInt range -> + (* If the operation cannot overflow, truncates the abstract value to the + range of the type (without emitting alarms). This can regain some + precision when the abstract operator was too imprecise. + Otherwise, truncates or rewraps the abstract value according to + the parameters of the analysis. *) + if not may_overflow + then eval >>=. fun v -> fst (Value.truncate_integer expr range v) + else handle_integer_overflow expr range eval + | Eval_typ.TSFloat fk -> + eval >>= Value.cast_float expr fk + | Eval_typ.TSPtr _ + | Eval_typ.TSNotScalar -> eval + + (* Makes the oracle for the domain queries, called by the forward evaluation. + Defined below, after applying the subdivided_evaluation to the forward + evaluation function. *) + let make_oracle = ref (fun _ _ _ -> `Value Value.top, Alarmset.all) + (* Returns the cached value and alarms for the evaluation if it exists; call [coop_forward_eval] and caches its result otherwise. Also returns a boolean indicating whether the expression is volatile. *) @@ -392,11 +424,7 @@ module Make | Lval lval -> eval_lval fuel state lval | BinOp _ | UnOp _ | CastE _ -> begin let intern_value, alarms = internal_forward_eval fuel state expr in - let oracle = - if fuel > 0 - then forward_eval (pred fuel) state - else fun _ -> fuel_consumed := true; `Value Value.top, Alarmset.all - in + let oracle = !make_oracle fuel state in let domain_value, alarms' = Domain.extract_expr oracle state expr in (* Intersection of alarms, as each sets of alarms are correct and "complete" for the evaluation of [expr]. *) @@ -432,20 +460,8 @@ module Make {value; origin; reductness; val_alarms = Alarmset.all}, reduction, volatile - (* Reinterpret the abstract value computed by [recursive_forward_eval] - according to the type of [expr]. *) - and internal_forward_eval fuel state expr = - recursive_forward_eval fuel state expr - >>= fun (value, reduction, volatile) -> - (* TODO: the functions called above should respect the destination type. - Calling reinterpret should be useless *) - let v, a = Value.reinterpret expr (Cil.typeOf expr) value in - (v, a) >>=: fun v -> - let reduction = update_reduction reduction (Alarmset.is_empty a) in - v, reduction, volatile - (* Recursive descent in the sub-expressions. *) - and recursive_forward_eval fuel state expr = + and internal_forward_eval fuel state expr = let compute_reduction (v, a) volatile = (v, a) >>=: fun v -> let reduction = if Alarmset.is_empty a then Neither else Forward in @@ -468,22 +484,25 @@ module Make >>=: fun (loc, _, _) -> Loc.to_value loc, Neither, false - | UnOp (op, e, _typ) -> + | UnOp (op, e, typ) -> root_forward_eval fuel state e >>= fun (v, volatile) -> - let context = {operand = e; result = expr} - and typ = Cil.unrollType (Cil.typeOf e) in - let v = Value.forward_unop ~context typ op v in + let context = { operand = e } + and e_typ = Cil.unrollType (Cil.typeOf e) in + let v = Value.forward_unop ~context e_typ op v in + let may_overflow = op = Neg in + let v = handle_overflow ~may_overflow expr typ v in compute_reduction v volatile | BinOp (op, e1, e2, typ) -> let context = - {left_operand = e1; right_operand = e2; - binary_result = expr; result_typ = typ} + { left_operand = e1; right_operand = e2; binary_result = expr } in root_forward_eval fuel state e1 >>= fun (v1, volatile1) -> root_forward_eval fuel state e2 >>= fun (v2, volatile2) -> let typ_e1 = Cil.unrollType (Cil.typeOf e1) in let v = Value.forward_binop ~context typ_e1 op v1 v2 in + let may_overflow = may_overflow op in + let v = handle_overflow ~may_overflow expr typ v in compute_reduction v (volatile1 || volatile2) | CastE (dst_typ, e) -> @@ -635,11 +654,7 @@ module Make *) let volatile = volatile_expr || Cil.typeHasQualifier "volatile" typ_lv in (* Find the value of the location, if not bottom. *) - let oracle = - if fuel > 0 - then forward_eval (pred fuel) state - else fun _ -> fuel_consumed := true; `Value Value.top, Alarmset.all - in + let oracle = !make_oracle fuel state in let v, alarms = Domain.extract_lval oracle state lval typ_lv loc in let alarms, reduced = close_dereference_alarms lval typ_lv alarms in if indeterminate @@ -656,14 +671,55 @@ module Make {value; origin; reductness; val_alarms = Alarmset.all}, reduction, volatile + (* Find a lvalue hidden under identity casts. This function correctly detects + bitfields (thanks to [need_cast]) and will never expose the underlying + field. *) + let rec find_lv expr = match expr.enode with + | Lval lv -> Some lv + | CastE (typ, e) -> + if Eval_typ.need_cast typ (Cil.typeOf e) then None else find_lv e + | _ -> None (* ------------------------------------------------------------------------ - Backward Evaluation + Subdivided Forward Evaluation ------------------------------------------------------------------------ *) - let eq_zero positive e = - let op = if positive then Eq else Ne in - Cil.new_exp ~loc:e.eloc (BinOp (op, Value_util.zero e, e, Cil.intType)) + (* These two modules could be implemented as mutually recursive, to avoid + the reference for the oracle given to the domains. *) + module Forward_Evaluation = struct + type state = Domain.t + let evaluate ?(valuation=Cache.empty) ~fuel state expr = + cache := valuation; + root_forward_eval fuel state expr >>=: fun (value, _) -> + !cache, value + end + + module Subdivided_Evaluation = + Subdivided_evaluation.Make (Value) (Loc) (Cache) (Forward_Evaluation) + + let () = + make_oracle := + fun fuel state -> + let fuel = pred fuel in + if fuel > 0 + then + fun expr -> + let valuation = !cache in + Subdivided_Evaluation.evaluate ~valuation ~fuel state expr + >>=: fun (valuation, value) -> + cache := valuation; + value + else + fun _ -> fuel_consumed := true; `Value Value.top, Alarmset.all + + let subdivided_forward_eval valuation state expr = + let fuel = root_fuel () in + Subdivided_Evaluation.evaluate ~valuation ~fuel state expr + + + (* ------------------------------------------------------------------------ + Backward Evaluation + ------------------------------------------------------------------------ *) (* Find the value of a previously evaluated expression. *) let find_val expr = @@ -774,9 +830,10 @@ module Make match expr.enode with | Lval _lv -> assert false | UnOp (LNot, e, _) -> + let cond = Value_util.normalize_as_cond e false in (* TODO: should we compute the meet with the result of the call to Value.backward_unop? *) - backward_eval fuel state (eq_zero true e) (Some value) + backward_eval fuel state cond (Some value) | UnOp (op, e, _typ) -> let typ_e = Cil.unrollType (Cil.typeOf e) in find_val e >>- fun v -> @@ -998,147 +1055,6 @@ module Make second_forward_eval state exp >>- fun () -> recursive_descent_offset state remaining - - (* Reduce by cond enumerate : when a backward evaluation is not precise - enough, tries to reduce further by enumerating the value of some - "influential" lvalues. As we can enumerate only on cvalues, extracts - the cvalue component of the value module. *) - - let get_cvalue = Value.get Main_values.cvalue_key - let set_cvalue = Value.set Main_values.cvalue_key - - (* It is worthwhile to enumerate on a cvalue when it has a small cardinal - but is not a singleton. *) - let is_enumerable value = - not (Cvalue.V.cardinal_zero_or_one value) && - try - let upto = succ (Ival.get_small_cardinal ()) in - ignore (Cvalue.V.cardinal_less_than value upto); - true - with Abstract_interp.Not_less_than -> false - - (* Find locations on which it is interesting to proceed by case disjunction - to evaluate the expression: locations which are singletons (on which the - cvalue domain can reduce) and has an enumerable value. *) - let rec get_influential_vars get_cvalue state exp acc = - match exp.enode with - | Lval (Var v, off) -> - let reduce_valid_index = true in - let eval, _ = eval_offset no_fuel ~reduce_valid_index v.vtype state off in - eval >>- fun (offset, _, _) -> - if Loc.offset_cardinal_zero_or_one offset - then - (* no variable in offset can be influential. Check the - contents of the location, on which we might want to enumerate *) - if Base.(is_weak (of_varinfo v)) then - `Value acc (* cannot enumerate on the contents, multiple locations *) - else - find_val exp >>- fun contents -> - if is_enumerable (get_cvalue contents) - then `Value (exp :: acc) - else `Value acc - else - (* A variable in offset may be influential. The contents themselves - are not influential, because we would need to split both by - offset and by content in sync. *) - get_vars_offset get_cvalue state off acc - | Lval (Mem e, off) -> - let t = Cil.typeOf_pointed (Cil.typeOf e) in - let eval, _ = eval_offset no_fuel ~reduce_valid_index:true t state off in - eval >>- fun (offset, _, _) -> - if Loc.offset_cardinal_zero_or_one offset - then - find_val e >>- fun contents -> - find_val exp >>- fun value -> - if Cvalue.V.cardinal_zero_or_one (get_cvalue contents) - && is_enumerable (get_cvalue value) - then `Value (exp :: acc) - else get_influential_vars get_cvalue state e acc - else - (* variables in expr or offset can be influential *) - get_influential_vars get_cvalue state e acc >>- fun acc -> - get_vars_offset get_cvalue state off acc - | BinOp (_, e1, e2, _) -> - get_influential_vars get_cvalue state e1 acc >>- fun acc -> - get_influential_vars get_cvalue state e2 acc - | UnOp (_, e, _) -> get_influential_vars get_cvalue state e acc - | CastE (_, exp) -> get_influential_vars get_cvalue state exp acc - | _ -> `Value acc - - and get_vars_offset get_cvalue state offset acc = match offset with - | NoOffset -> `Value acc - | Field (_, off) -> get_vars_offset get_cvalue state off acc - | Index (ind, off) -> - get_influential_vars get_cvalue state ind acc >>- fun acc -> - get_vars_offset get_cvalue state off acc - - let get_influential_exprs get_cvalue state expr = - get_influential_vars get_cvalue state expr [] - - module Clear = Eval.Clear_Valuation (Cache) - - let reduce_by_cond_enumerate get_cvalue state cond positive influentials = - (* Test whether the condition [expr] may still be true when the - sub-expression [e] has the value [v]. *) - let condition_may_still_be_true cleared_cache expr record value = - let cache_cache = !cache in - let value = { record.value with v = `Value value } in - cache := Cache.add cleared_cache expr { record with value }; - let eval, _alarms = forward_eval no_fuel state cond in - cache := cache_cache; - match eval with - | `Bottom -> false - | `Value v -> - let v = get_cvalue v in - if positive - then Cvalue.V.contains_non_zero v - else if Value_parameters.UndefinedPointerComparisonPropagateAll.get () - then Cvalue.V.contains_zero v - else Cvalue.V.is_included Cvalue.V.singleton_zero v - in - let enumerate subexpr = - match Cache.find !cache subexpr with - | `Top -> `Value () - | `Value record -> - record.value.v >>- fun v -> - let cleared_cache = - Clear.clear_englobing_exprs !cache ~expr:cond ~subexpr - in - let process sub_cvalue acc = - let subvalue = set_cvalue sub_cvalue v in - if condition_may_still_be_true cleared_cache subexpr record subvalue - then Bottom.join Value.join (`Value subvalue) acc else acc - in - let cvalue = get_cvalue v in - Cvalue.V.fold_enum process cvalue `Bottom >>-: fun value -> - if not (Value.equal v value) - then - let reductness = - if record.reductness = Created then Created else Reduced - in - let value = { record.value with v = `Value value } in - let record = { record with value; reductness } in - cache := Cache.add !cache subexpr record - in - match influentials with - | [] -> `Value () - | expr :: _ -> enumerate expr - - (* If the value module contains no cvalue component, this function is - inoperative. Otherwise, it calls reduce_by_cond_enumerate with the - value accessor for the cvalue component. *) - let reduce_by_enumeration = match get_cvalue with - | None -> fun _ _ _ -> `Value () - | Some get_cvalue -> - fun state expr positive -> - if Value_parameters.EnumerateCond.get () - then - get_influential_exprs get_cvalue state expr >>- fun split_on -> - reduce_by_cond_enumerate get_cvalue state expr positive split_on - else - `Value () - - (* ------------------------------------------------------------------------ Generic Interface ------------------------------------------------------------------------ *) @@ -1146,21 +1062,20 @@ module Make module Valuation = Cache let evaluate ?(valuation=Cache.empty) ?(reduction=true) state expr = - cache := valuation; - let value, alarms = forward_eval (root_fuel ()) state expr in + let eval, alarms = subdivided_forward_eval valuation state expr in let result = - value >>- fun value -> if not reduction || Alarmset.is_empty alarms - then `Value (!cache, value) + then eval else - backward_eval (backward_fuel ()) state expr None >>- fun _ -> - find_val expr >>-: fun value -> + eval >>- fun (valuation, value) -> + cache := valuation; + backward_eval (backward_fuel ()) state expr None >>-: fun _ -> !cache, value in result, alarms let copy_lvalue ?(valuation=Cache.empty) state lval = - let expr = Cil.dummy_exp (Lval lval) + let expr = Value_util.lval_to_exp lval and fuel = root_fuel () in try let record, report = Cache.find' valuation expr in @@ -1179,7 +1094,25 @@ module Make let valuation = Cache.add' !cache expr (record, report) in valuation, record.value + (* When evaluating an lvalue, we use the subdivided evaluation for the + expressions included in the lvalue. *) + let rec evaluate_offsets valuation state = function + | NoOffset -> `Value valuation, Alarmset.none + | Field (_, offset) -> evaluate_offsets valuation state offset + | Index (expr, offset) -> + subdivided_forward_eval valuation state expr + >>= fun (valuation, _value) -> + evaluate_offsets valuation state offset + + let evaluate_host valuation state = function + | Var _ -> `Value valuation, Alarmset.none + | Mem expr -> + subdivided_forward_eval valuation state expr >>=: fst + let lvaluate ?(valuation=Cache.empty) ~for_writing state lval = + let host, offset = lval in + evaluate_host valuation state host >>= fun valuation -> + evaluate_offsets valuation state offset >>= fun valuation -> cache := valuation; lval_to_loc (root_fuel ()) ~for_writing ~reduction:true state lval >>=. fun (_, typ, _) -> @@ -1188,46 +1121,19 @@ module Make | `Value record -> !cache, record.loc, typ | `Top -> assert false - let inv_rel = function - | Gt -> Le - | Lt -> Ge - | Le -> Gt - | Ge -> Lt - | Eq -> Ne - | Ne -> Eq - | _ -> assert false - - (* Transform an expression supposed to be [positive] into an equivalent - one in which the root expression is a comparison operator. *) - let rec normalize_as_cond expr positive = - match expr.enode with - | UnOp (LNot, e, _) -> normalize_as_cond e (not positive) - | BinOp ((Le|Ne|Eq|Gt|Lt|Ge as binop), e1, e2, typ) -> - if positive then - expr - else - let binop = inv_rel binop in - let enode = BinOp (binop, e1, e2, typ) in - Cil.new_exp ~loc:expr.eloc enode - | _ -> - eq_zero (not positive) expr - let reduce ?valuation:(valuation=Cache.empty) state expr positive = - let aux state expr = - (* Generate [e == 0] *) - let expr = normalize_as_cond expr (not positive) in - root_forward_eval (root_fuel ()) state expr >>=. fun (_v, volatile) -> - (* Reduce by [(e == 0) == 0] *) - backward_eval (backward_fuel ()) state expr (Some Value.zero) - >>- fun () -> - try second_forward_eval state expr - with Not_Exact_Reduction -> - (* Avoids reduce_by_cond_enumerate on volatile expressions. *) - if volatile then `Value () else reduce_by_enumeration state expr false - in + (* Generate [e == 0] *) + let expr = Value_util.normalize_as_cond expr (not positive) in cache := valuation; - aux state expr >>=: fun () -> - !cache + root_forward_eval (root_fuel ()) state expr >>=. fun (_v, volatile) -> + (* Reduce by [(e == 0) == 0] *) + backward_eval (backward_fuel ()) state expr (Some Value.zero) + >>- fun () -> + try second_forward_eval state expr >>-: fun () -> !cache + with Not_Exact_Reduction -> + (* Avoids reduce_by_cond_enumerate on volatile expressions. *) + if volatile then `Value !cache + else Subdivided_Evaluation.reduce_by_enumeration !cache state expr false let assume ?valuation:(valuation=Cache.empty) state expr value = cache := valuation; @@ -1239,11 +1145,6 @@ module Make Misc ------------------------------------------------------------------------ *) - let loc_size = Loc.size - - let reinterpret = Value.reinterpret - let do_promotion = Value.do_promotion - let eval_function_exp funcexp state = match funcexp.enode with | Lval (Var vinfo, NoOffset) -> @@ -1272,7 +1173,8 @@ module Make (* Build the expression [exp_f == &f] and reduce accordingly *) let addr = Cil.mkAddrOfVi vi_f in let expr = Cil.mkBinOp ~loc:v.eloc Eq v addr in - reduce_by_enumeration state expr true >>-: fun () -> !cache + let valuation = !cache in + Subdivided_Evaluation.reduce_by_enumeration valuation state expr true in let process kf acc = let res = reduce kf >>-: fun valuation -> kf, valuation in @@ -1294,7 +1196,7 @@ module Make end | _ -> assert false - let split_by_evaluation = match get_cvalue with + let split_by_evaluation = match Value.get Main_values.cvalue_key with | None -> fun _ _ states -> [], states | Some get -> fun expr expected_values states -> let typ = Cil.typeOf expr in @@ -1356,6 +1258,36 @@ module Make in `Value compatible_locations, alarms + let can_copy ?(valuation=Cache.empty) ~is_ret state kinstr lv e = + let warn_indeterminate = match kinstr with + | Kglobal -> true + | Kstmt stmt -> + try + let kf = Kernel_function.find_englobing_kf stmt in + Value_util.warn_indeterminate kf && not is_ret + with Not_found -> assert false + in + if warn_indeterminate && Cil.isArithmeticOrPointerType (Cil.typeOfLval lv) + then `Value (None, valuation), Alarmset.none + else begin + match find_lv e with + | Some right_lv -> + (* [lv] should already have been evaluated here, and this should just + retrieve its location in the valuation. *) + lvaluate ~for_writing:false ~valuation state lv + >>= fun (valuation, lloc, _) -> + lvaluate ~for_writing:false ~valuation state right_lv + >>= fun (valuation, right_loc, _right_typ) -> + check_copy_lval (lv, lloc) (right_lv, right_loc) + >>=: fun compatible_locations -> + (* TODO: safety check. should always be true if the AST is explicit + enough. *) + if compatible_locations then + Some right_lv, valuation + else + None, valuation + | None -> `Value (None, valuation), Alarmset.none + end end diff --git a/src/plugins/value/engine/evaluation.mli b/src/plugins/value/engine/evaluation.mli index 0792bf86dda395449a5a5d1936a4c4c1d250e4a1..a271eb12630fb944cb7cc2e62ec30f5b51a13985 100644 --- a/src/plugins/value/engine/evaluation.mli +++ b/src/plugins/value/engine/evaluation.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -74,6 +74,20 @@ module type S = sig ?valuation:Valuation.t -> for_writing:bool -> state -> lval -> (Valuation.t * loc * typ) evaluated + (** [can_copy is_ret state kf lv e] checks whether assigning [e] to [lv] + inside function [kf] and in the context of [state] + can be a simple copy of an lval or must be an assignment + (see {!Eval.assigned} for more information). + [is_ret] indicates whether the assigned expr is in fact the value + returned by a callee. + + @return [Some rlv] if the assignment can be seen as a copy from rlv to lv, + and [None] otherwise + *) + val can_copy: + ?valuation:Valuation.t -> is_ret:bool -> state -> kinstr -> + lval -> exp -> (lval option * Valuation.t) evaluated + (** [reduce ~valuation state expr positive] evaluates the expression [expr] in the state [state], and then reduces the [valuation] such that the expression [expr] evaluates to a zero or a non-zero value, according @@ -94,11 +108,6 @@ module type S = sig ?valuation:Valuation.t -> state -> exp -> value -> Valuation.t or_bottom - - val loc_size: loc -> Int_Base.t - val reinterpret: exp -> typ -> value -> value evaluated - val do_promotion: src_typ:typ -> dst_typ: typ -> exp -> value -> value evaluated - (* Sorts a list of states by the evaluation of an expression, according to a list of expected integer values. [split_by_evaluation expr expected_values states] returns two list @@ -114,8 +123,6 @@ module type S = sig exp -> Integer.t list -> state list -> (Integer.t * state list * bool) list * state list - val check_copy_lval: (lval * loc) -> (lval * loc) -> bool evaluated - val check_non_overlapping: state -> lval list -> lval list -> unit evaluated diff --git a/src/plugins/value/engine/initialization.ml b/src/plugins/value/engine/initialization.ml index 54b8027c5931da87ec594e1a0262f6d6e681e4ed..ea82f04014f05e83874095c0581bfea3228881d0 100644 --- a/src/plugins/value/engine/initialization.ml +++ b/src/plugins/value/engine/initialization.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,369 +20,383 @@ (* *) (**************************************************************************) -(* Creation of the initial state of abstract domain. *) +(* Creation of the initial state of abstract domains. *) open Cil_types open Eval -type source = Supplied | Computed - module type S = sig type state val initial_state : lib_entry:bool -> state or_bottom val initial_state_with_formals : lib_entry:bool -> kernel_function -> state or_bottom + val initialize_local_variable: + stmt -> varinfo -> Cil_types.init -> state -> state or_bottom end -(* Is the padding filled with fully initialized values. In this case, we - can speed up the generation of the initial state in a few cases. *) -let fully_initialized_padding () = - Value_parameters.InitializationPaddingGlobals.get () = "yes" - - -let warn_unknown_size_aux pp v (messt, t) = - Value_parameters.warning ~once:true ~current:true - "@[during initialization@ of %a,@ size of@ type '%a'@ cannot be@ computed@ \ - (%s)@]" pp v Printer.pp_typ t messt - -let warn_unknown_size = - warn_unknown_size_aux - (fun fmt v -> Format.fprintf fmt "variable '%a'" Printer.pp_varinfo v) +type padding_initialization = [ + | `Initialized + | `Uninitialized + | `MaybeInitialized +] + +(* There are two different options for locals and for globals variables: + a three-valued parameter of Eva for globals, and a boolean parameter of + the kernel for locals. Please don't ask. *) +let padding_initialization ~local : padding_initialization = + if local + then + if Kernel.InitializedPaddingLocals.get () + then `Initialized else `Uninitialized + else + match Value_parameters.InitializationPaddingGlobals.get () with + | "yes" -> `Initialized + | "maybe" -> `MaybeInitialized + | "no" -> `Uninitialized + | _ -> assert false -let warn_size vi = +(* Warn if the size is unknown. *) +let warn_unknown_size vi = try ignore (Cil.bitsSizeOf vi.vtype); false with Cil.SizeOfError (s, t)-> - warn_unknown_size vi (s, t); + let pp fmt v = Format.fprintf fmt "variable '%a'" Printer.pp_varinfo v in + Value_parameters.warning ~once:true ~current:true + "@[during initialization@ of %a,@ size of@ type '%a'@ cannot be@ \ + computed@ (%s)@]" pp vi Printer.pp_typ t s; true +let warn_on_volatile kinstr lval = + let is_local = match kinstr with Kglobal -> false | Kstmt _ -> true in + let is_var = match lval with (Var _, NoOffset) -> true | _ -> false in + Value_util.warning_once_current + "%sinitialization of volatile %s %a ignored" + (if is_local then "" else "global ") + (if is_var then "variable" else "zone") + Printer.pp_lval lval + +(* A bottom in any part of an initializer results in a bottom for the + whole initialization. Thus, the following monad raises an exception on a + bottom case; the exception is catched by the root initialization functions + to return a proper `Bottom. *) +exception Initialization_failed + +let (>>>) t f = match t with + | `Bottom -> raise Initialization_failed + | `Value v -> f v let counter = ref 0 module Make - (Value: Abstract_value.S) - (Loc: Abstract_location.S with type value = Value.t) - (Domain: Abstract_domain.External with type value = Value.t - and type location = Loc.location) + (Domain: Abstract_domain.External) (Eva: Evaluation.S with type state = Domain.state - and type value = Domain.value - and type origin = Domain.origin and type loc = Domain.location) + (Transfer: Transfer_stmt.S with type state = Domain.t) = struct - incr counter; - - module Transfer = Domain.Transfer (Eva.Valuation) - - (** Padding value. The exact contents (bottom | zero | top_int), - initialized or not, is determined from [lib_entry] and option - [-val-initialization-padding-globals] *) - let padding_value lib_entry = - match Value_parameters.InitializationPaddingGlobals.get () with - | "yes" -> `Value ((if lib_entry then Value.top_int else Value.zero), true) - | "no" -> `Bottom - | "maybe" -> - `Value ((if lib_entry then Value.top_int else Value.zero), false) - | _ -> assert false - - exception Initialization_failed - - (* Evaluation in Top state. - We do not want the location to depend on other globals. *) - let lval_to_loc lval = Eva.lvaluate ~for_writing:false Domain.top lval - - let init_var state lval varinfo value = - ignore (warn_size varinfo); - let lloc = Loc.eval_varinfo varinfo in - Domain.initialize_var state lval lloc (`Value (value, true)) - - let init_var' state lval varinfo v = - ignore (warn_size varinfo); - let loc = Loc.eval_varinfo varinfo in - Domain.initialize_var state lval loc v - - let init_var_lib_entry state lval varinfo = - let loc = Loc.eval_varinfo varinfo in - if warn_size varinfo then - Domain.initialize_var state lval loc (`Value (Value.top_int, true)) - else - (* add padding everywhere *) - let padding = padding_value true in - let state = Domain.initialize_var state lval loc padding in - (* then initialize non-padding bits according to the type *) - Domain.initialize_var_using_type state varinfo - - - let assign_single_initializer state lval expr = - lval_to_loc lval >>= fun (valuation, lloc, ltyp) -> - Eva.evaluate ~valuation state expr >>=: fun (valuation, value) -> - let left_lv = { lval; ltyp; lloc } in - left_lv, expr, Assign value, valuation - - (* Evaluation of a [SingleInit] in Cil parlance. - TODO: volatile *) - let init_single_initializer state lval expr = - let eval, alarms = assign_single_initializer state lval expr in - let with_alarms = Value_util.warn_all_quiet_mode () in - Alarmset.emit with_alarms Kglobal alarms; - match eval with + incr counter;; + + (* Evaluation in the top state: we do not want a location to depend on + other globals. *) + let lval_to_loc lval = + fst (Eva.lvaluate ~for_writing:false Domain.top lval) + >>> fun (_valuation, loc, _typ) -> loc + + + (* ------------------------- Apply initializer ---------------------------- *) + + (* Conventions: + - functions in *_var_* act on the entire variables, and receive only + the corresponding varinfo + - other functions act on a lvalue, which they directly receive *) + + (* Initializes an entire variable [vi], in particular padding bits, + according to [local] and [lib_entry] mode. *) + let initialize_var_padding ~local ~lib_entry vi state = + let lval = Cil.var vi in + match padding_initialization ~local with + | `Uninitialized -> state + | `Initialized | `MaybeInitialized as i -> + let initialized = i = `Initialized in + let init_value = + if not local && lib_entry + then Abstract_domain.Top + else Abstract_domain.Zero + in + let location = lval_to_loc lval in + Domain.initialize_variable lval location ~initialized init_value state + + (* Initializes a volatile lvalue to top. *) + let initialize_volatile lval state = + let location = lval_to_loc lval in + let init_value = Abstract_domain.Top in + Domain.initialize_variable lval location ~initialized:true init_value state + + (* Applies a single Cil initializer, using the standard transfer function on + assignments. Warns if the results is bottom. *) + let apply_cil_single_initializer kinstr state lval expr = + match Transfer.assign state kinstr lval expr with | `Bottom -> - Value_parameters.result ~source:(fst expr.eloc) - "Evaluation of initializer '%a' failed@." Printer.pp_exp expr; + if kinstr = Kglobal then + Value_parameters.result ~source:(fst expr.eloc) + "evaluation of initializer '%a' failed@." Printer.pp_exp expr; raise Initialization_failed - | `Value (lv, expr, assigned, valuation) -> - Transfer.assign Kglobal lv expr assigned valuation state - - - (* Apply an initializer (not recursively). Take volatile qualifiers into - account. If [warn] holds, we warn when an initializer is ignored - because it points to a volatile location. - TODO: volatile *) - let rec init_initializer_or_volatile state lval init warn = - if Cil.typeHasQualifier "volatile" (Cil.typeOfLval lval) then begin - if warn then - Value_util.warning_once_current - "global initialization of volatile zone %a ignored" - Printer.pp_lval lval; - let eval, _alarms = lval_to_loc lval in - eval >>-: fun (_valuation, loc, _typ) -> - Domain.initialize_var state lval loc (`Value (Value.top_int, true)) - end + | `Value v -> v + + (* Applies an initializer. Take volatile qualifiers into account. + If [warn] holds, warns when an initializer is ignored because it points + to a volatile location. *) + let rec apply_cil_initializer kinstr ~warn lval init state = + if Cil.typeHasQualifier "volatile" (Cil.typeOfLval lval) + then + if warn + then (warn_on_volatile kinstr lval; state) + else initialize_volatile lval state else match init with - | SingleInit exp -> init_single_initializer state lval exp - | CompoundInit (base_typ, l) -> - Cil.foldLeftCompound - ~implicit:false - ~doinit: - (fun off init _typ state -> - state >>- fun state -> - let lval' = Cil.addOffsetLval off lval in - init_initializer_or_volatile state lval' init warn) - ~ct:base_typ - ~initl:l - ~acc:(`Value state) - - (* Special initializers. Only lval with attributes 'const' and non-volatile - are initialized *) - let rec init_const_initializer state lval = function + | SingleInit exp -> apply_cil_single_initializer kinstr state lval exp + | CompoundInit (typ, l) -> + let doinit off init _typ state = + let lval = Cil.addOffsetLval off lval in + apply_cil_initializer kinstr ~warn lval init state + in + Cil.foldLeftCompound ~implicit:false ~doinit ~ct:typ ~initl:l ~acc:state + + (* Initialization of a variable to zero (or top if volatile), field by field. + Very inefficient. *) + let initialize_var_zero_or_volatile kinstr vi state = + let loc = Cil_datatype.Location.unknown in + let zero_init = Cil.makeZeroInit ~loc vi.vtype in + apply_cil_initializer kinstr ~warn:false (Cil.var vi) zero_init state + + (* ----------------------- Non Lib-entry mode ----------------------------- *) + + (* Initializes a varinfo, padding bits + optionaly an initializer. *) + let initialize_var_not_lib_entry kinstr ~local vi init state = + ignore (warn_unknown_size vi); + let typ = vi.vtype in + let lval = Cil.var vi in + let volatile_everywhere = Cil.typeHasQualifier "volatile" typ in + if volatile_everywhere && padding_initialization ~local = `Initialized + then + let () = if init <> None then warn_on_volatile kinstr lval in + initialize_volatile lval state + else + (* Initializes padding bits everywhere (non padding bits are overwritten + afterwards). *) + let state = + initialize_var_padding vi ~local ~lib_entry:false state + in + (* Initializes everything except padding bits: non-volatile locations + to zero, volatile locations to top. We only do so if the variable + must be different from zero somewhere. This is a not-so minor + optimization. *) + let state = + if padding_initialization ~local = `Initialized && + not (Cil.typeHasAttributeDeep "volatile" typ) + then state + else initialize_var_zero_or_volatile kinstr vi state + in + (* Applies the real initializer on top. *) + match init with + | None -> state + | Some init -> apply_cil_initializer kinstr ~warn:true lval init state + + + (* --------------------------- Lib-entry mode ----------------------------- *) + + (* Special application of an initializer: only non-volatile lval with + attributes 'const' are initialized. *) + let rec apply_cil_const_initializer kinstr state lval = function | SingleInit exp -> let typ_lval = Cil.typeOfLval lval in if Cil.typeHasQualifier "const" typ_lval && not (Cil.typeHasQualifier "volatile" typ_lval) - then - init_single_initializer state lval exp - else `Value state - | CompoundInit (base_typ, l) -> - if Cil.typeHasQualifier "volatile" base_typ || - not (Cil.typeHasAttributeDeep "const" base_typ) - then `Value state (* initializer is not useful *) + then apply_cil_single_initializer kinstr state lval exp + else state + | CompoundInit (typ, l) -> + if Cil.typeHasQualifier "volatile" typ || + not (Cil.typeHasAttributeDeep "const" typ) + then state (* initializer is not useful *) else - Cil.foldLeftCompound - ~implicit:true - ~doinit: - (fun off init _typ state -> - state >>- fun state -> - init_const_initializer state (Cil.addOffsetLval off lval) init) - ~ct:base_typ - ~initl:l - ~acc:(`Value state) - - - (* initialize [vi] when [-lib-entry] is not set, by writing successively - the padding, zero, and the initializers. *) - let init_var_not_lib_entry_initializer vi init state = - Cil.CurrentLoc.set vi.vdecl; - let volatile_somewhere = Cil.typeHasAttributeDeep "volatile" vi.vtype in - let volatile_everywhere = Cil.typeHasQualifier "volatile" vi.vtype in - let lval = Var vi, NoOffset in - if fully_initialized_padding () && - (volatile_everywhere || not volatile_somewhere) - then - (* shortcut: padding and volatile won't interfere, we can do a global - initialisation, then write the initializer on top if there is one. *) - if volatile_everywhere then begin - if init <> None then - Value_util.warning_once_current - "global initialization of volatile variable %a ignored" - Printer.pp_varinfo vi; - `Value (init_var state lval vi Value.top_int) - end - else - let state = init_var state lval vi Value.zero in - match init with - | None -> `Value state - | Some init -> init_initializer_or_volatile state lval init true - else (* "slow" initialization *) - let padding = padding_value false in - let state = init_var' state lval vi padding in - let typ = vi.vtype in - let loc = Cil_datatype.Location.unknown in - let zi = Cil.makeZeroInit ~loc typ in - (* initialise everything (except padding) to zero). Do not warn, as - most of the initializer is generated. *) - init_initializer_or_volatile state lval zi false >>- fun state -> - (* then write the real initializer on top *) - match init with - | None -> `Value state - | Some init -> init_initializer_or_volatile state lval init true - + let doinit off init _typ state = + apply_cil_const_initializer + kinstr state (Cil.addOffsetLval off lval) init + in + Cil.foldLeftCompound ~implicit:true ~doinit ~ct:typ ~initl:l ~acc:state - (* initialize [vi] as if in [-lib-entry] mode. Active when [-lib-entry] is set, - or when [vi] is extern. [const] initializers, explicit or implicit, are - taken into account *) - let init_var_lib_entry_initializer vi init state = - Cil.CurrentLoc.set vi.vdecl; - let lval = Var vi, NoOffset in + (* Initializes [vi] as if in [-lib-entry] mode. Active when [-lib-entry] is + set, or when [vi] is extern. [const] initializers, explicit or implicit, + are taken into account *) + let initialize_var_lib_entry kinstr vi init state = if Cil.typeHasQualifier "const" vi.vtype && not (vi.vstorage = Extern) - then (* Fully const base. Ignore -lib-entry altogether *) - init_var_not_lib_entry_initializer vi init state + then (* Fully const base. Ignore -lib-entry altogether. *) + initialize_var_not_lib_entry kinstr ~local:false vi init state else - (* Fill padding + contents of non-padding bits according to the type *) - let state = init_var_lib_entry state lval vi in - (* if needed, initialize const fields according to the initialiser + let unknown_size = warn_unknown_size vi in + let state = + if unknown_size then + (* the type is unknown, initialize everything to Top *) + let lval = Cil.var vi in + let loc = lval_to_loc lval in + let v = Abstract_domain.Top in + Domain.initialize_variable lval loc ~initialized:true v state + else + (* Add padding everywhere. *) + let state = + initialize_var_padding vi ~local:false ~lib_entry:true state + in + (* Then initialize non-padding bits according to the type. *) + let kind = Abstract_domain.Library_Global in + Domain.initialize_variable_using_type kind vi state + in + (* If needed, initializes const fields according to the initialiser (or generate one if there are none). In the first phase, they have been - set to generic values *) + set to generic values. *) if Cil.typeHasAttributeDeep "const" vi.vtype && not (vi.vstorage = Extern) then let init = match init with | None -> Cil.makeZeroInit ~loc:vi.vdecl vi.vtype | Some init -> init in - init_const_initializer state lval init - else `Value state - - - module Domain_with_Bottom = Bottom.Make_Datatype (Domain) - - module NotLibEntryGlobals = - State_builder.Option_ref - (Domain_with_Bottom) - (struct - let name = "Value.Initialization.NotLibEntryGlobals" - ^ "(" ^ string_of_int !counter ^ ")" - let dependencies = - [ Ast.self; Kernel.AbsoluteValidRange.self; - Value_parameters.InitializationPaddingGlobals.self ] - end) - - module LibEntryGlobals = - State_builder.Option_ref - (Domain_with_Bottom) - (struct - let name = "Value.Initialization.LibEntryGlobals" - ^ "(" ^ string_of_int !counter ^ ")" - open Value_parameters - let dependencies = - [ Ast.self; Kernel.AbsoluteValidRange.self; - InitializationPaddingGlobals.self; AllocatedContextValid.self; - AutomaticContextMaxWidth.self; AutomaticContextMaxDepth.self; - ] - end) - let () = Ast.add_monotonic_state LibEntryGlobals.self + apply_cil_const_initializer kinstr state (Cil.var vi) init + else state - let initial_state ~lib_entry () = - Value_parameters.debug ~level:2 "Computing globals values"; - try - `Value - (Globals.Vars.fold_in_file_order - (fun vi init state -> - if vi.vsource then begin - let initialize = - if lib_entry || (vi.vstorage = Extern (* use -lib-entry mode. *)) - then init_var_lib_entry_initializer - else init_var_not_lib_entry_initializer - in - match initialize vi init.init state with - | `Bottom -> raise Initialization_failed - | `Value state -> state - end - else state - ) (Domain.empty ())) - with Initialization_failed -> `Bottom - - let initial_state_not_lib_entry () = - NotLibEntryGlobals.memo (initial_state ~lib_entry:false) - let initial_state_lib_entry () = - LibEntryGlobals.memo (initial_state ~lib_entry:true) - - let compute_initial_state ~lib_entry = - if lib_entry then - initial_state_lib_entry () - else - initial_state_not_lib_entry () - - let initial_state ~lib_entry = - match Domain.global_state () with - | Some state -> state - | None -> compute_initial_state lib_entry - - (* Print cvalue state only. TODO: apply to the whole state. *) - let report_initial_state init_state source = - let cvalue_state = Cvalue_domain.extract Domain.get init_state in - match source with - | Supplied -> - Value_parameters.feedback "Initial state supplied by user"; - Value_parameters.printf - ~header:(fun fmt -> Format.pp_print_string fmt - "Values of globals") - ~level:2 "@[ %a@]" Cvalue.Model.pretty cvalue_state - | Computed -> - Value_parameters.feedback "Initial state computed"; - Value_parameters.printf ~dkey:Value_parameters.dkey_initial_state - ~header:(fun fmt -> Format.pp_print_string fmt - "Values of globals at initialization") - "@[ %a@]" Cvalue.Model.pretty cvalue_state + (* ------------- Adds formal argument of the main function --------------- *) + (* Compute values for the formals of [kf] (as if those were variables in + lib-entry mode) and add them to [state] *) let compute_main_formals kf state = match kf.fundec with | Declaration (_, _, None, _) -> state | Declaration (_, _, Some l, _) | Definition ({ sformals = l }, _) -> - if l <> [] && Value_parameters.InterpreterMode.get() - then begin - Value_parameters.error "Entry point %a has arguments" - Kernel_function.pretty kf; - exit 0; - end; - List.fold_right - (fun vi state -> Domain.initialize_var_using_type state vi) - l - state + if l <> [] && Value_parameters.InterpreterMode.get () + then + Value_parameters.abort "Entry point %a has arguments" + Kernel_function.pretty kf + else + let kind = Abstract_domain.Main_Formal in + List.fold_right (Domain.initialize_variable_using_type kind) l state + + (* Use the values supplied in [actuals] for the formals of [kf], and + bind them in [state] *) + let add_supplied_main_formals kf actuals state = + match Domain.get Cvalue_domain.key with + | None -> + Value_parameters.abort "Function Db.Value.fun_set_args cannot be used \ + without the Cvalue domain" + | Some get_cvalue -> + let formals = Kernel_function.get_formals kf in + if (List.length formals) <> List.length actuals then + raise Db.Value.Incorrect_number_of_arguments; + let cvalue_state = get_cvalue state in + let add_actual state actual formal = + let actual = Eval_op.offsetmap_of_v ~typ:formal.vtype actual in + Cvalue.Model.add_base (Base.of_varinfo formal) actual state + in + let cvalue_state = + List.fold_left2 add_actual cvalue_state actuals formals + in + let set_domain = Domain.set Cvalue_domain.key in + set_domain cvalue_state state let add_main_formals kf state = match Db.Value.fun_get_args () with | None -> compute_main_formals kf state - | Some actuals -> - match Domain.get Cvalue_domain.key with - | None -> - Value_parameters.abort "Function Db.Value.fun_set_args cannot be used \ - without the Cvalue domain" - | Some get_cvalue -> - let formals = Kernel_function.get_formals kf in - if (List.length formals) <> List.length actuals then - raise Db.Value.Incorrect_number_of_arguments; - let treat_one_formal f a = - (), Eval_op.offsetmap_of_v ~typ:f.vtype a - in - let cvalue_state = get_cvalue state in - let l = List.map2 treat_one_formal formals actuals in - let cvalue_state = Function_args.actualize_formals kf cvalue_state l in - let set_domain = Domain.set Cvalue_domain.key in - set_domain cvalue_state state + | Some actuals -> add_supplied_main_formals kf actuals state + (* ------------------------ High-level functions -------------------------- *) + + let initialize_local_variable stmt vi init state = + try + `Value + (initialize_var_not_lib_entry + (Kstmt stmt) ~local:true vi (Some init) state) + with Initialization_failed -> `Bottom + + let initialize_global_variable ~lib_entry vi init state = + Cil.CurrentLoc.set vi.vdecl; + let state = Domain.introduce_globals [vi] state in + if vi.vsource then + let initialize = + if lib_entry || (vi.vstorage = Extern) + then initialize_var_lib_entry + else initialize_var_not_lib_entry ~local:false + in + initialize Kglobal vi init.init state + else state + + (* Compute the initial state with all global variable initialized. *) + let compute_global_state ~lib_entry () = + Value_parameters.debug ~level:2 "Computing globals values"; + let state = Domain.empty () in + let initialize = initialize_global_variable ~lib_entry in + try `Value (Globals.Vars.fold_in_file_order initialize state) + with Initialization_failed -> `Bottom + + (* Dependencies for the Frama-C states containing the initial states + of EVA: all correctness parameters of EVA, plus the AST itself. We + cannot use [Db.Value.self] directly, because we do not want to + depend on the tuning parameters. Previously, we use a more + fine-grained list, but this lead to bugs. See mantis #2277. *) + let correctness_deps = + Ast.self :: + List.map + (fun p -> State.get p.Typed_parameter.name) + Value_parameters.parameters_correctness + + module InitialState = + State_builder.Option_ref + (Bottom.Make_Datatype (Domain)) + (struct + let name = "Value.Initialization" ^ "(" ^ string_of_int !counter ^ ")" + let dependencies = correctness_deps + end) + let () = Ast.add_monotonic_state InitialState.self + + (* The computation depends on the lib_entry option, which is a corrrectness + parameter of the analyzer: the InitialState memoization is thus safely + cleaned when lib_entry changes. *) + let global_state ~lib_entry = + InitialState.memo (compute_global_state ~lib_entry) + + (* The global cvalue state may be supplied by the user. *) + let supplied_state () = + let cvalue_state = Db.Value.globals_state () in + if Cvalue.Model.is_reachable cvalue_state + then `Value (Domain.set Cvalue_domain.key cvalue_state Domain.top) + else `Bottom + + let initial_state ~lib_entry = + if Db.Value.globals_use_supplied_state () + then supplied_state () + else global_state ~lib_entry + let initial_state_with_formals ~lib_entry kf = - let init_state, source = - match Domain.global_state () with - | Some state -> state, Supplied - | None -> + let init_state = + if Db.Value.globals_use_supplied_state () + then begin + Value_parameters.feedback "Initial state supplied by user"; + supplied_state () + end + else begin Value_parameters.feedback "Computing initial state"; - compute_initial_state lib_entry, Computed + let state = global_state ~lib_entry in + Value_parameters.feedback "Initial state computed"; + state + end in - report_initial_state init_state source; + Domain.Store.register_global_state init_state; + (* Prints the initial cvalue state. *) + let cvalue_state = Cvalue_domain.extract Domain.get init_state in + Value_parameters.printf ~dkey:Value_parameters.dkey_initial_state + ~header:(fun fmt -> Format.pp_print_string fmt + "Values of globals at initialization") + "@[ %a@]" Cvalue.Model.pretty cvalue_state; init_state >>-: add_main_formals kf end diff --git a/src/plugins/value/engine/initialization.mli b/src/plugins/value/engine/initialization.mli index 7e2653ed1b20085f34121112182c4d19e269ebe8..5560e7480a5076f2c3f14c4b3d0cbf83881ce1f5 100644 --- a/src/plugins/value/engine/initialization.mli +++ b/src/plugins/value/engine/initialization.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -37,17 +37,17 @@ module type S = sig but also bind the formal parameters of the function given as argument. *) val initial_state_with_formals : lib_entry:bool -> kernel_function -> state or_bottom + + (** Initializes a local variable in the current state. *) + val initialize_local_variable: + stmt -> varinfo -> init -> state -> state or_bottom end module Make - (Value: Abstract_value.S) - (Loc: Abstract_location.S with type value = Value.t) - (Domain: Abstract_domain.External with type value = Value.t - and type location = Loc.location) + (Domain: Abstract_domain.External) (Eva: Evaluation.S with type state = Domain.state - and type value = Domain.value - and type origin = Domain.origin and type loc = Domain.location) + (Transfer: Transfer_stmt.S with type state = Domain.t) : S with type state := Domain.t diff --git a/src/plugins/value/engine/mem_exec2.ml b/src/plugins/value/engine/mem_exec.ml similarity index 96% rename from src/plugins/value/engine/mem_exec2.ml rename to src/plugins/value/engine/mem_exec.ml index 072958601aaf7e4769e7de8f236616316e9d1c50..404a1f35744df610d36602212ae9f6ff70948e3e 100644 --- a/src/plugins/value/engine/mem_exec2.ml +++ b/src/plugins/value/engine/mem_exec.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,7 +30,7 @@ end module SaveCounter = - State_builder.SharedCounter(struct let name = "Mem_exec2.save_counter" end) + State_builder.SharedCounter(struct let name = "Mem_exec.save_counter" end) let new_counter, current_counter = let cur = ref (-1) in @@ -78,7 +78,7 @@ module Make (* List of the arguments of a call. *) module ActualArgs = Datatype.List_with_collections (Datatype.Option (Value)) (* None is bottom *) - (struct let module_name = "Mem_exec2.ActualArgs(" + (struct let module_name = "Mem_exec.ActualArgs(" ^ string_of_int !counter ^ ")" end) @@ -91,7 +91,7 @@ module Make (struct let size = 17 let dependencies = [Db.Value.self] - let name = "Mem_exec2.PreviousCalls(" ^ string_of_int !counter ^ ")" + let name = "Mem_exec.PreviousCalls(" ^ string_of_int !counter ^ ")" end) let cleanup = !cleanup_ref @@ -100,7 +100,7 @@ module Make (** [diff_base_full_zone bases zones] remove from the set of bases [bases] those of which all bits are present in [zones] *) let diff_base_full_zone = - let cache = Hptmap_sig.PersistentCache "Mem_exec2.diff_base_full_zone" in + let cache = Hptmap_sig.PersistentCache "Mem_exec.diff_base_full_zone" in let empty_left _ = Base.Hptset.empty (* nothing left to clear *) in let empty_right v = v (* return all bases unchanged *) in (* Check whether [range] covers the validity of [b]. If so, remove [b] diff --git a/src/plugins/value/engine/mem_exec2.mli b/src/plugins/value/engine/mem_exec.mli similarity index 97% rename from src/plugins/value/engine/mem_exec2.mli rename to src/plugins/value/engine/mem_exec.mli index 030beb3a60f7baea91a4000c371fe76ba36faa40..1239c60a15999062e4df0caf2a8b7d3a03016cec 100644 --- a/src/plugins/value/engine/mem_exec2.mli +++ b/src/plugins/value/engine/mem_exec.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/engine/partitioned_dataflow.ml b/src/plugins/value/engine/partitioned_dataflow.ml index a9f152a3c15b8a4b691e6723db929ee07a2af531..1c087a2d0ea3b35178268b71cb319d59b0b32156 100644 --- a/src/plugins/value/engine/partitioned_dataflow.ml +++ b/src/plugins/value/engine/partitioned_dataflow.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -36,12 +36,19 @@ let check_signals, signal_abort = let dkey_callbacks = Value_parameters.register_category "callbacks" +(* Reference to the current statement processed by the analysis. + Only needed when the analysis aborts, to mark the current statement + as the degeneration point.*) +let current_ki = ref Kglobal + module Make_Dataflow (Domain : Abstract_domain.External) (States : Powerset.S with type state = Domain.t) (Transfer : Transfer_stmt.S with type state = Domain.t) + (Init: Initialization.S with type state := Domain.state) (Logic : Transfer_logic.S with type state = Domain.t and type states = States.t) + (Spec: sig val treat_statement_assigns: assigns -> Domain.t -> Domain.t end) (AnalysisParam : sig val kf: kernel_function val call_kinstr: kinstr @@ -49,14 +56,12 @@ module Make_Dataflow end) = struct - let with_alarms = Value_util.warn_all_quiet_mode () - module Partition = Partitioning.Make (Domain) (States) let current_kf = AnalysisParam.kf let current_fundec = Kernel_function.get_definition current_kf - let return = Kernel_function.find_return current_kf - let return_lv = match return.skind with + let return_stmt = Kernel_function.find_return current_kf + let return_lv = match return_stmt.skind with | Return (Some ({enode = Lval ((Var v, NoOffset) as lv)} as exp), _) -> Some (exp, lv, v) | Return (None, _) -> None @@ -106,17 +111,23 @@ module Make_Dataflow let active_behaviors = Logic.create AnalysisParam.initial_state current_kf + (* Compute the locals that we must enter in scope when we start the analysis + of [block]. The other ones will be introduced on the fly, when we + encounter a [Local_init] instruction. *) + let block_toplevel_locals block = + List.filter (fun vi -> not vi.vdefined) block.blocals + let initial_states = let state = AnalysisParam.initial_state and kf = current_kf and call_kinstr = AnalysisParam.call_kinstr and ab = active_behaviors in - let locals = current_fundec.sbody.blocals in + let locals = block_toplevel_locals (current_fundec.sbody) in let state = Domain.enter_scope current_kf locals state in (* Remark: the pre-condition cannot talk about the locals. BUT check_fct_preconditions split the state into a stateset, hence it is simpler to apply it to the (unique) state with locals *) - Logic.check_fct_preconditions kf ab call_kinstr state + Logic.check_fct_preconditions call_kinstr kf ab state let initial_state = match initial_states with @@ -144,7 +155,15 @@ module Make_Dataflow [widening_state] is decremented each time we visit the statement, unless it is equal to zero. (In which case we widen, and set [widening_state] to a non-zero value, currently 1.) *) - mutable widening : int; + mutable widening_counter : int; + + (* For the n first widening, the widened state is reduced by the loop + invariant. This can correct the extrapolations made by the widening, + but also impedes the convergence of the analysis. After n reduced + widening, the standard widening is used instead. The propagated state + is still reduced by the invariant, but the widened state recorded at + the loop head is not. *) + mutable reduced_widening_counter : int; (* Number of states that were put in [superposition]; i.e. the sum of the cardinals of the state sets that were added with @@ -156,7 +175,8 @@ module Make_Dataflow let empty_record () = { superposition = Partition.empty () ; - widening = Value_parameters.WideningLevel.get () ; + widening_counter = Value_parameters.WideningLevel.get () ; + reduced_widening_counter = 4; widening_state = `Bottom ; counter_unroll = 0; } @@ -178,34 +198,21 @@ module Make_Dataflow StmtHtbl.add current_table s record; record - let stmt_widening_info s = - let r = stmt_state s in - r.widening, r.widening_state - (* merges [set] into the state associated to [stmt], and returns the subset of [set] that was not already in the superposition. *) - let update_stmt_states stmt set = - let record = stmt_state stmt in + let merge_stmt_states record set = match record.widening_state with - | `Bottom -> - Partition.merge_set_return_new set record.superposition + | `Bottom -> Partition.merge_set_return_new set record.superposition | `Value widening_state -> match States.join set with | `Bottom -> States.empty | `Value state -> if Domain.is_included state widening_state then States.empty - else ( - let join = Domain.join widening_state state in - record.widening_state <-`Value join; - States.singleton join - ) + else States.singleton (Domain.join widening_state state) - let update_stmt_widening_info stmt wcounter wstate = - let record = stmt_state stmt in - record.widening <- wcounter; - record.widening_state <- - Bottom.join Domain.join record.widening_state wstate + let join_incoming_states record state = + record.widening_state <- Bottom.join Domain.join record.widening_state state let states_unmerged s = @@ -318,62 +325,87 @@ module Make_Dataflow Cil.CurrentLoc.set old_loc; r - - let interp_call stmt lval_option funcexp args state acc = - let results, call_cacheable = - Transfer.call with_alarms stmt lval_option funcexp args state - in - if call_cacheable = Value_types.NoCacheCallers then - (* Propagate info that the current call cannot be cached either *) - cacheable := Value_types.NoCacheCallers; - List.fold_left - (fun acc state -> States.add state acc) - acc (Bottom.list_of_bot results) + (* Tries to evaluate \assigns … \from … clauses for assembly code. *) + let doAsm stmt d = + let asm_contracts = Annotations.code_annot stmt in + match Logic_utils.extract_contract asm_contracts with + | [] -> + Value_util.warning_once_current + "assuming assembly code has no effects in function %t" + Value_util.pretty_current_cfunction_name; + d + (* There should be only one statement contract, if any. *) + | (_, spec) :: _ -> + let assigns = Ast_info.merge_assigns_from_spec ~warn:false spec in + let transfer = Spec.treat_statement_assigns assigns in + let process state acc = States.add (transfer state) acc in + let states = States.fold process d.to_propagate States.empty in + { to_propagate = states } let doInstr stmt (i: instr) (d: t) = !Db.progress (); - Valarms.start_stmt (Kstmt stmt); + current_ki := Kstmt stmt; let d_states = d.to_propagate in let unreachable = States.is_empty d_states in - let result = if unreachable then d else begin - let propagate states = - (* Create a transient propagation result, that will be passed - to the successors of stmt by the dataflow module *) - { to_propagate = states } + (* Analysis of one call on [state]. Returns a list of states *) + let interp_call stmt lval_option funcexp args state = + let results, call_cacheable = + Transfer.call stmt lval_option funcexp args state + in + if call_cacheable = Value_types.NoCacheCallers then + (* Propagate info that the current call cannot be cached either *) + cacheable := Value_types.NoCacheCallers; + Bottom.list_of_bot results in - let apply_each_state f = + (* higher-order function that applies [f] to each state of [d_states], + and adds the result(s) in a list computed using [add]. *) + let apply_each_state add f = let states_after_i = - States.fold - (fun state acc -> States.add' (f state) acc) + States.fold (fun state acc -> add (f state) acc) d_states States.empty in - propagate states_after_i + (* Create a transient propagation result, that will be passed + to the successors of stmt by the dataflow module *) + { to_propagate = states_after_i } + in + (* appropriate function for the first argument of [apply_each_state]*) + let add_list_to_states states acc = + List.fold_left (Extlib.swap States.add) acc states in - (* update current statement *) match i with + | Local_init (v, AssignInit i, _loc) -> + let process state = + let state = Domain.enter_scope current_kf [v] state in + Init.initialize_local_variable stmt v i state + in + apply_each_state States.add' process | Set (lv,exp,_loc) -> - apply_each_state - (fun s -> - Transfer.assign ~with_alarms s current_kf stmt lv exp) + let process state = Transfer.assign state (Kstmt stmt) lv exp in + apply_each_state States.add' process | Call (lval_option, funcexp, args, _loc) -> let process = interp_call stmt lval_option funcexp args in - propagate (States.fold process d_states States.empty) - | Asm _ -> - Value_util.warning_once_current - "assuming assembly code has no effects in function %t" - Value_util.pretty_current_cfunction_name; - d + apply_each_state add_list_to_states process + | Local_init (v, ConsInit (f, args, k), l) -> + (* argument for {!Cil.treat_constructor_as_func} *) + let as_func lv e args _loc state = + (* This variable enters the scope too early, as it should + be introduced after the call to [f] but before the assignment + to [v]. This is currently not possible, at least without + splitting Transfer.call in two. *) + let state = Domain.enter_scope current_kf [v] state in + interp_call stmt lv e args state + in + let process = Cil.treat_constructor_as_func as_func v f args k l in + apply_each_state add_list_to_states process + | Asm _ -> doAsm stmt d | Skip _ -> d | Code_annot (_,_) -> d (* processed directly in doStmt from the annotation table *) end - in - Valarms.end_stmt (); - result - let doStmtSpecific stmt _d states = + let doStmtSpecific stmt states = match stmt.skind with | Loop _ -> let current_info = stmt_state stmt in @@ -385,10 +417,9 @@ module Make_Dataflow | UnspecifiedSequence seq -> if Kernel.UnspecifiedAccess.get () then - let with_alarms = Value_util.warn_all_mode in let check = Transfer.check_unspecified_sequence in States.fold - (fun s acc -> match check ~with_alarms stmt s seq with + (fun s acc -> match check stmt s seq with | `Bottom -> acc | `Value () -> States.add s acc) states @@ -396,122 +427,123 @@ module Make_Dataflow else states | _ -> states + (* Builds the function that interprets the annotation of a statement. *) + let do_annotation stmt slevel = + (* We do not interpret annotations that come from statement contracts + and everything previously emitted by Value (currently, alarms) *) + let annots = Annotations.fold_code_annot + (fun e ca acc -> + if Logic_utils.is_contract ca || Emitter.equal e Value_util.emitter + then acc + else ca :: acc + ) stmt [] + in + (* [record] indicates whether the logical status are recorded. *) + fun record states -> + List.fold_left + (fun states annot -> Logic.interp_annot ~limit:slevel ~record + current_kf active_behaviors stmt annot ~initial_state states ) + states annots + + (* Loop head: widen or decrement widen counter. *) + let do_loop_widening stmt do_annotation prev_wstate record joined = + let wcounter = record.widening_counter in + if wcounter > 0 + then (record.widening_counter <- pred wcounter; States.singleton' joined) + else + (* Widening *) + let widen = Domain.widen current_kf stmt in + let widened_state = Bottom.join widen prev_wstate record.widening_state in + (* One normal join between two widenings. *) + record.widening_counter <- 1; + if Bottom.equal Domain.equal widened_state record.widening_state + then States.singleton' joined + else + (* Records the new widened state as a propagated state, + and interprets the annotations accordingly. *) + let propagate_new_state new_state = + join_incoming_states record new_state; + do_annotation true (States.singleton' new_state) + in + (* Reduces only the first widenings. *) + let reduced_wcounter = record.reduced_widening_counter in + if reduced_wcounter = 0 + then propagate_new_state widened_state + else + begin + (* Correct over-widening by reducing the widened state by the + annotation, without recording the status; then, interpret the + annotation and record the status for the reduced widened + state. Thus, status are recorded for incoming states before + the widening and for the state propagated after widening. *) + let widened_states = States.singleton' widened_state in + let new_states = do_annotation false widened_states in + record.reduced_widening_counter <- pred reduced_wcounter; + propagate_new_state (States.join new_states) + end + + let do_stmt_aux stmt states = + let (>>) states cont = + if States.is_empty states then Dataflow2.SDefault else cont states + in + states >> fun states -> + let slevel = slevel stmt in + let is_return = is_return stmt in + let do_annotation = do_annotation stmt slevel in + let record = stmt_state stmt in + let pre_states = + if obviously_terminates + then begin + if is_return + then join_incoming_states record (States.join states); + states + end + (* Remove the states that have already been propagated. *) + else merge_stmt_states record states + in + pre_states >> fun pre_states -> + (* Interprets the annotation and reduces the state accordingly. *) + do_annotation true pre_states >> fun states -> + let new_states = + if record.counter_unroll <= slevel || is_return + then states + else + (* No slevel left: performs some join and/or widening, + and fills the record.widening_state with the pre_states. *) + let prev_wstate = record.widening_state in + record.widening_state <- (States.join pre_states); + let joined = States.join states in + (* On a loop head, widens further the joined state. *) + if not (is_loop stmt) || obviously_terminates + then States.singleton' joined + else do_loop_widening stmt do_annotation prev_wstate record joined + in + let new_states = doStmtSpecific stmt new_states in + Dataflow2.SUse { to_propagate = new_states } + + let get_cvalue = Domain.get Cvalue_domain.key let gather_cvalue = match get_cvalue with | Some get -> fun state acc -> get state :: acc | None -> fun _ acc -> acc - let doStmt (s: stmt) (d: t) = - Valarms.start_stmt (Kstmt s); + let doStmt (stmt: stmt) (d: t) = + current_ki := Kstmt stmt; check_signals (); (* Merge incoming states if the user requested it *) - if merge s then + if merge stmt then d.to_propagate <- States.singleton' (States.join d.to_propagate); let states = d.to_propagate in - (* TODO: apply on all domains. *) let cvalue_states = States.fold gather_cvalue states [] in Db.Value.Compute_Statement_Callbacks.apply - (s, Value_util.call_stack (), cvalue_states); - (* Cleanup function, to be called on all exit paths *) - let ret result = - (* Do this as late as possible, as a non-empty to_propagate field - is shown in a special way in case of degeneration *) - d.to_propagate <- States.empty; - Valarms.end_stmt (); - result - in - if States.is_empty states then ret Dataflow2.SDefault - else - (* Snapshot the currently propagated state (curr_wstate) here, - because this information is modified imperatively by - [update_stmt_states] *) - let curr_wcounter, curr_wstate = stmt_widening_info s in - let states = - if obviously_terminates - then states - else - (* store the states that we are propagating, and remove the states - that have already been propagated. Notice that, if the slevel - is exhausted, the field [widening_state] will contain the - join of [states], but in practice we may propagate *less*, - because the states are reduced by assertions/loop invariants. *) - update_stmt_states s states - in - if States.is_empty states then ret Dataflow2.SDefault - else - (* We do not interpret annotations that come from statement contracts - and everything previously emitted by Value (currently, alarms) *) - let annots = Annotations.fold_code_annot - (fun e ca acc -> - if Logic_utils.is_contract ca || Emitter.equal e Value_util.emitter - then acc - else ca :: acc - ) s [] - in - let slevel = slevel s in - let interp_annot record states annot = - Logic.interp_annot - ~limit:slevel ~record - current_kf active_behaviors s annot - ~initial_state states - in - let states = List.fold_left (interp_annot true) states annots in - if States.is_empty states then ret Dataflow2.SDefault - else - let is_return = is_return s in - let current_info = stmt_state s in - let old_counter = current_info.counter_unroll in - let new_states = - if (old_counter > slevel && not is_return) - || (is_return && obviously_terminates) - then (* No slevel left, perform some join and/or widening *) - let state = States.join states in - let joined = Bottom.join Domain.join curr_wstate state in - if Bottom.equal Domain.equal joined curr_wstate then - States.empty (* [state] is included in the last propagated - state. Nothing remains to do *) - else - if obviously_terminates - then begin (* User thinks the analysis will terminate: do not widen *) - update_stmt_widening_info s 0 joined; - states - end - else - let r = - if is_loop s && curr_wcounter = 0 then - Bottom.join (Domain.widen current_kf s) curr_wstate joined - else - joined - in - let new_wcounter = - if curr_wcounter = 0 then 1 else pred curr_wcounter - in - let new_state = States.singleton' r in - if Bottom.equal Domain.equal r joined then ( - update_stmt_widening_info s new_wcounter r; - new_state) - else begin (* Try to correct over-widenings *) - let new_states = - (* Do *not* record the status after interpreting the annotation - here. Possible unproven assertions have already been recorded - when the assertion has been interpreted the first time higher - in this function. *) - List.fold_left (interp_annot false) new_state annots - in - let new_joined = States.join new_states in - update_stmt_widening_info s new_wcounter new_joined; - States.singleton' new_joined - end - else states - in - let new_states = doStmtSpecific s d new_states in - (* This temporary propagation value will be passed on to the successors - of [s] *) - ret (Dataflow2.SUse { to_propagate = new_states }) + (stmt, Value_util.call_stack (), cvalue_states); + let stmt_action = do_stmt_aux stmt states in + d.to_propagate <- States.empty; + stmt_action let doEdge s succ d = let states = d.to_propagate in - Valarms.start_stmt (Kstmt s); + current_ki := Kstmt s; (* We store the state after the execution of [s] for the callback {Value.Record_Value_After_Callbacks}. This is done here because we want to see the values of the variables local to the block *) @@ -542,7 +574,7 @@ module Make_Dataflow the two of them. *) let do_edge state = let enter_block state block = - Domain.enter_scope current_kf block.blocals state + Domain.enter_scope current_kf (block_toplevel_locals block) state in let close_block state block = Domain.leave_scope current_kf block.blocals state @@ -563,7 +595,6 @@ module Make_Dataflow (* We do a simple 'map' here. Duplicates will be removed by States.merge later on. *) let states = States.map do_edge states in - Valarms.end_stmt (); d.to_propagate <- states; d @@ -571,17 +602,16 @@ module Make_Dataflow if States.is_empty (t.to_propagate) then Dataflow2.GUnreachable else begin - Valarms.start_stmt (Kstmt stmt); + current_ki := Kstmt stmt; let new_values = States.fold (fun state acc -> - match Transfer.assume ~with_alarms state stmt exp positive with + match Transfer.assume state stmt exp positive with | `Bottom -> acc | `Value state -> States.add state acc) t.to_propagate States.empty in - Valarms.end_stmt (); if States.is_empty new_values then Dataflow2.GUnreachable else Dataflow2.GUse { to_propagate = new_values} end @@ -623,7 +653,7 @@ module Make_Dataflow in if new_status <> 0 then StmtHtbl.replace conditions_table stmt new_status; - Separate.filter_if stmt thel + thel end @@ -634,7 +664,21 @@ module Make_Dataflow let vi_ret = Extlib.the (Library_functions.get_retres_vi current_kf) in let lv = Var vi_ret, NoOffset in let state = Domain.enter_scope current_kf [vi_ret] state in - Transfer.assign ~with_alarms state current_kf return lv exp + Transfer.assign state (Kstmt return_stmt) lv exp + + (* Leave the scope of the blocks closed by the return, _except_ the + outermost block of the function (which is closed directly in + Transfer_stmt). *) + let leave_scope_return state = + let closed = Kernel_function.find_all_enclosing_blocks return_stmt in + let rec close state = function + | [] -> assert false + | [_] -> state (* outermost block *) + | b :: q -> + let state = Domain.leave_scope current_kf b.blocals state in + close state q + in + close state closed (* Check that the dataflow is indeed finished *) let checkConvergence () = @@ -652,13 +696,12 @@ module Make_Dataflow (fun stmt v -> if not (States.is_empty v.to_propagate) then Value_util.DegenerationPoints.replace stmt false); - match Valarms.current_stmt () with + match !current_ki with | Kglobal -> () | Kstmt s -> let kf = Kernel_function.find_englobing_kf s in - if Kernel_function.equal kf current_kf then ( - Value_util.DegenerationPoints.replace s true; - Valarms.end_stmt ()) + if Kernel_function.equal kf current_kf then + Value_util.DegenerationPoints.replace s true let join_final_states states = let split i = @@ -683,9 +726,10 @@ module Make_Dataflow | Split_strategy.FullSplit -> `Value states | Split_strategy.SplitAuto -> assert false (* transformed into SplitEqList*) - let results_aux () = + let results () = + current_ki := Kstmt return_stmt; if DataflowArg.debug then checkConvergence (); - let final_states = states_unmerged return in + let final_states = states_unmerged return_stmt in (* Reduce final states according to the function postcondition *) let result = match return_lv with | Some (_, _, varinfo) -> Some varinfo @@ -698,14 +742,9 @@ module Make_Dataflow join_final_states states >>- fun states -> (* copy return code into proper variable *) let states = States.map_or_bottom copy_return states in + let states = States.map leave_scope_return states in Bottom.bot_of_list (States.to_list states) - let results () = - Valarms.start_stmt (Kstmt return); - let r = results_aux () in - Valarms.end_stmt (); - r - module Computer = Dataflow2.Forwards (DataflowArg) let compute () = @@ -757,8 +796,8 @@ module Make_Dataflow (* Since the return instruction has no successor, it is not visited by the iter above. We fill it manually *) (try - let s = StmtHtbl.find states_before return in - StmtHtbl.add states_after return s + let s = StmtHtbl.find states_before return_stmt in + StmtHtbl.add states_after return_stmt s with Kernel_function.No_Statement | Not_found -> () ); states_after @@ -837,7 +876,7 @@ module Make_Dataflow Db.Value.Record_Value_Callbacks_New.apply (stack_for_callbacks, Value_types.NormalStore ((superposed, after_full), - (Mem_exec2.new_counter ()))) + (Mem_exec.new_counter ()))) else Db.Value.Record_Value_Callbacks_New.apply (stack_for_callbacks, @@ -860,17 +899,16 @@ module Computer (States : Powerset.S with type state = Domain.t) (Transfer : Transfer_stmt.S with type state = Domain.t and type value = Domain.value) + (Init: Initialization.S with type state := Domain.state) (Logic : Transfer_logic.S with type state = Domain.t and type states = States.t) + (Spec: sig val treat_statement_assigns: assigns -> Domain.t -> Domain.t end) = struct let compute kf call_kinstr state = let module Dataflow = Make_Dataflow - (Domain) - (States) - (Transfer) - (Logic) + (Domain) (States) (Transfer) (Init) (Logic) (Spec) (struct let kf = kf let call_kinstr = call_kinstr diff --git a/src/plugins/value/engine/partitioned_dataflow.mli b/src/plugins/value/engine/partitioned_dataflow.mli index d4ce8d2a3ae93c97cf6ebd9b85049003a1833ebf..d91f4c832311f5683ab9fe9a5148defbfc853824 100644 --- a/src/plugins/value/engine/partitioned_dataflow.mli +++ b/src/plugins/value/engine/partitioned_dataflow.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,9 +34,12 @@ module Computer (* Transfer functions for statement on the abstract domain. *) (Transfer : Transfer_stmt.S with type state = Domain.t and type value = Domain.value) + (* Initialization of local variables. *) + (Init: Initialization.S with type state := Domain.state) (* Transfer functions for the logic on the abstract domain. *) (Logic : Transfer_logic.S with type state = Domain.t and type states = States.t) + (Spec: sig val treat_statement_assigns: assigns -> Domain.t -> Domain.t end) : sig val compute: diff --git a/src/plugins/value/engine/partitioning.ml b/src/plugins/value/engine/partitioning.ml index 3c2e1ab2469a09d1b139c57e88cd1374087371f9..88d3417e41a88c96b992e4061e53d656aab7a1be 100644 --- a/src/plugins/value/engine/partitioning.ml +++ b/src/plugins/value/engine/partitioning.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,7 +34,6 @@ module type S = sig type t val empty: unit -> t - val fold: (state -> 'a -> 'a) -> t -> 'a -> 'a val merge_set_return_new: state_set -> t -> state_set val join: t -> state or_bottom val to_set: t -> state_set diff --git a/src/plugins/value/engine/partitioning.mli b/src/plugins/value/engine/partitioning.mli index 43f98e3312a47d34cf39098f505355155ee32603..ceb06f63a53353f57c7592a01ab170c6f438c97f 100644 --- a/src/plugins/value/engine/partitioning.mli +++ b/src/plugins/value/engine/partitioning.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -35,8 +35,6 @@ module type S = sig val empty: unit -> t - val fold: (state -> 'a -> 'a) -> t -> 'a -> 'a - val merge_set_return_new: state_set -> t -> state_set val join: t -> state or_bottom diff --git a/src/plugins/value/engine/recursion.ml b/src/plugins/value/engine/recursion.ml new file mode 100644 index 0000000000000000000000000000000000000000..2e04745d77b74e82a423095b4a0622ec7771f5f0 --- /dev/null +++ b/src/plugins/value/engine/recursion.ml @@ -0,0 +1,106 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types + +(** Recursion *) + +(* Our current treatment for recursion -- use the specification for + the function that begins the recursive cycle -- is incorrect for + function with formals whose address is taken. Indeed, we do not know + which "instance" of the formal is updated by the specification. In + this case, warn the user. *) +let check_formals_non_referenced kf = + let formals = Kernel_function.get_formals kf in + if List.exists (fun vi -> vi.vaddrof) formals then + Value_parameters.error ~current:true ~once:true + "function '%a' (involved in a recursive call) has a formal parameter \ + whose address is taken. Analysis may be unsound." + Kernel_function.pretty kf + +let warn_recursive_call kf call_stack = + if Value_parameters.IgnoreRecursiveCalls.get () + then begin + Value_parameters.error ~current:true ~once:true + "@[recursive call@ during@ value@ analysis@ of %a \ + @[(%a <- %a)@].@ Assuming@ the call@ has@ no effect.@ \ + The analysis@ will@ be@ unsound.]" + Kernel_function.pretty kf Kernel_function.pretty kf + Value_types.Callstack.pretty call_stack ; + check_formals_non_referenced kf; + Db.Value.recursive_call_occurred kf; + end + else begin + Value_util.warning_once_current + "@[@[detected@ recursive@ call@ (%a <- %a)@]@;@[Use %s@ to@ \ + ignore@ (beware@ this@ will@ make@ the analysis@ unsound)@]@]" + Kernel_function.pretty kf Value_types.Callstack.pretty call_stack + Value_parameters.IgnoreRecursiveCalls.option_name; + raise Db.Value.Aborted + end + +(* Check whether the function at the top of the call-stack starts a + recursive call. *) +let is_recursive_call kf = + let call_stack = Value_util.call_stack () in + if List.exists (fun (f, _) -> f == kf) call_stack + then (warn_recursive_call kf call_stack; true) + else false + +(* Find a spec for a function [kf] that begins a recursive call. If [kf] + has no existing specification, generate (an incorrect) one, and warn + loudly. *) +let _spec_for_recursive_call kf = + let initial_spec = Annotations.funspec ~populate:false kf in + match Cil.find_default_behavior initial_spec with + | Some bhv when bhv.b_assigns <> WritesAny -> initial_spec + | _ -> + let assigns = Infer_annotations.assigns_from_prototype kf in + let bhv = Cil.mk_behavior ~assigns:(Writes assigns) () in + let spec = { (Cil.empty_funspec ()) with spec_behavior = [bhv] } in + Value_parameters.error ~once:true + "@[recursive@ call@ on@ an unspecified@ \ + function.@ Using@ potentially@ invalid@ inferred assigns '%t'@]" + (fun fmt -> match assigns with + | [] -> Format.pp_print_string fmt "assigns \\nothing" + | _ :: _ -> + Pretty_utils.pp_list ~sep:"@ " Printer.pp_from fmt assigns); + (* Merge existing spec into our custom one with assigns *) + Logic_utils.merge_funspec + ~silent_about_merging_behav:true spec initial_spec; + spec + +let empty_spec_for_recursive_call kf = + let typ_res = Kernel_function.get_return_type kf in + let empty = Cil.empty_funspec () in + let assigns = + if Cil.isVoidType typ_res then + Writes [] + else + let res = TResult typ_res, TNoOffset in + let res = Logic_const.term (TLval res) (Ctype typ_res) in + let res = Logic_const.new_identified_term res in + Writes [res, From []] + in + let bhv = Cil.mk_behavior ~assigns ~name:Cil.default_behavior_name () in + empty.spec_behavior <- [bhv]; + empty diff --git a/src/plugins/value/engine/recursion.mli b/src/plugins/value/engine/recursion.mli new file mode 100644 index 0000000000000000000000000000000000000000..e7be56f77cd106646f50969dec4bd383e612a247 --- /dev/null +++ b/src/plugins/value/engine/recursion.mli @@ -0,0 +1,34 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Handling of recursion cycles in the callgraph *) + +open Cil_types + +val is_recursive_call: kernel_function -> bool +(** Given the current state of the call stack, detect whether the + given given function would start a recursive cycle. *) + +val empty_spec_for_recursive_call: kernel_function -> spec +(** Generate an empty spec [assigns \nothing] or + [assigns \result \from \nothing], to be used to "approximate" the + results of a recursive call. *) diff --git a/src/plugins/value/legacy/split_return.ml b/src/plugins/value/engine/split_return.ml similarity index 84% rename from src/plugins/value/legacy/split_return.ml rename to src/plugins/value/engine/split_return.ml index d41d64a1311fe545b6a0fad8067fd45359b42c51..864584e64fd26f2d44814b4b87f849c25ed5c5f6 100644 --- a/src/plugins/value/legacy/split_return.ml +++ b/src/plugins/value/engine/split_return.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -22,7 +22,6 @@ open Cil_types open Abstract_interp -open Cvalue (* Auxiliary module for inference of split criterion. We collect all the usages of a function call, and all places where they are compared against @@ -179,7 +178,18 @@ module ReturnUsage = struct usage <- add_alias usage lv e | Call (lv_opt, e, _, _) -> usage <- add_call usage lv_opt e - | _ -> () + | Local_init(v, AssignInit i, _) -> + let rec aux lv i = + match i with + | SingleInit e -> usage <- add_alias usage lv e + | CompoundInit (_, l) -> + List.iter (fun (o,i) -> aux (Cil.addOffsetLval o lv) i) l + in + aux (Cil.var v) i + | Local_init(v, ConsInit(f,_,Plain_func), _) -> + usage <- add_call usage (Some (Cil.var v)) (Cil.evar f) + | Local_init(_, ConsInit _,_) -> () (* not a real assignment. *) + | Asm _ | Skip _ | Code_annot _ -> () ); Cil.DoChildren @@ -268,68 +278,6 @@ let kf_strategy = | s -> s ) -let default states = - let (joined,_) = State_set.join states in - if Model.is_reachable joined then [joined] else [] - -let split_eq_aux kf return_lv i states = - let with_alarms = CilE.warn_none_mode in - let loc = Eval_exprs.lval_to_loc ~with_alarms Model.top return_lv in - let v_i = V.inject_int i in - let (eq, neq, mess) = List.fold_left - (fun (eq, neq, mess) state -> - if Model.is_reachable state then - let _, v' = Model.find state loc in - (*Format.printf "## vi %a, v %a@." V.pretty v_i V.pretty v'; *) - if V.equal v_i v' then - (Model.join state eq, neq, mess) - else - if V.is_included v_i v' then - (eq, state :: neq, true) - else - (eq, state :: neq, mess) - else - (eq, neq, mess) - ) (Model.bottom, [], false) states - in - if mess then - Value_parameters.result ~once:true ~current:true - "%a: cannot properly split on \\result == %a" - Kernel_function.pretty kf Abstract_interp.Int.pretty i; - (eq, neq) - -let split_eq_multiple kf_name return_lv li states = - let rec aux states li = match li with - | [] -> - (match states with - | [] -> [] - | e :: q -> [List.fold_left Model.join e q]) - | i :: qli -> - let eq, neq = split_eq_aux kf_name return_lv i states in - let rq = aux neq qli in - if Model.is_reachable eq then eq :: rq else rq - in - aux (State_set.to_list states) li - - -let join_final_states kf ~return_lv states = - let split i = - match return_lv with - | None -> default states - | Some (Var v, NoOffset as lv) -> - if Cil.isIntegralOrPointerType v.vtype then - split_eq_multiple kf lv i states - else - default states - | Some _ -> assert false (* Cil invariant *) - in - match kf_strategy kf with - | Split_strategy.SplitEqList i -> split i - | Split_strategy.NoSplit -> default states - | Split_strategy.FullSplit -> State_set.to_list states - | Split_strategy.SplitAuto -> assert false (* transformed into SplitEqList*) - - let pretty_strategies fmt = Format.fprintf fmt "@[<v>"; let open Split_strategy in diff --git a/src/plugins/value/legacy/split_return.mli b/src/plugins/value/engine/split_return.mli similarity index 86% rename from src/plugins/value/legacy/split_return.mli rename to src/plugins/value/engine/split_return.mli index 78306366c9d144ab46c722558c206dfff5340fa4..2d6972312387069bb915c7f1d88657e321f96af5 100644 --- a/src/plugins/value/legacy/split_return.mli +++ b/src/plugins/value/engine/split_return.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,14 +23,6 @@ (** This module is used to merge together the final states of a function according to a given strategy. Default is to merge all states together *) -(** Join the given state_set. The strategy is defined according to - the name of the function. *) -val join_final_states: - Cil_types.kernel_function -> - return_lv:Cil_types.lval option -> - State_set.t -> - Cvalue.Model.t list - val pretty_strategies: unit -> unit val kf_strategy: Kernel_function.t -> Split_strategy.t diff --git a/src/plugins/value/engine/non_linear_evaluation.ml b/src/plugins/value/engine/subdivided_evaluation.ml similarity index 66% rename from src/plugins/value/engine/non_linear_evaluation.ml rename to src/plugins/value/engine/subdivided_evaluation.ml index 1df0c77a4272d4e5f04fa783470a71fe3fe08b2a..a91c37b03121f737cb56e1c1081f1f16b28dfe7f 100644 --- a/src/plugins/value/engine/non_linear_evaluation.ml +++ b/src/plugins/value/engine/subdivided_evaluation.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -72,7 +72,7 @@ let gather_non_linear expr = (* Map from subexpressions to the list of their non-linear lvalues. *) module ExpMap = struct - include Cil_datatype.Exp.Map + include Cil_datatype.ExpStructEq.Map let add expr lv map = try let list = find expr map in @@ -115,9 +115,9 @@ module NonLinear = Datatype.Pair (Cil_datatype.Exp) (LvalList) module NonLinears = Datatype.List (NonLinear) module Non_linear_expressions = - State_builder.Hashtbl (Cil_datatype.Exp.Hashtbl) (NonLinears) + State_builder.Hashtbl (Cil_datatype.ExpStructEq.Hashtbl) (NonLinears) (struct - let name = "Non_linear_evaluation" + let name = "Value.Subdivided_evaluation.Non_linear_expressions" let size = 16 let dependencies = [ Ast.self ] end) @@ -135,7 +135,7 @@ let compute_non_linear expr = (fun (e, lval) -> Value_parameters.result ~current:true ~once:true ~dkey "non-linear '%a', lv '%a'" Printer.pp_exp e - (Pretty_utils.pp_list Printer.pp_lval) lval) + (Pretty_utils.pp_list ~sep:", " Printer.pp_lval) lval) list; Non_linear_expressions.replace expr list; list @@ -150,7 +150,7 @@ let min_and_max_float v = V.inject_float f1, V.inject_float f2 with V.Not_based_on_null -> assert false -let subdiv_float ~size v = +let subdiv_float_interval ~size v = try let v_ival = V.project_ival v in let ival1, ival2 = Ival.subdiv_float_interval ~size v_ival in @@ -165,33 +165,61 @@ let min_and_max_int v = | Some i1, Some i2 -> V.inject_int i1, V.inject_int i2 with V.Not_based_on_null -> assert false -let subdiv_int ~size:_ v = +let subdiv_int v = try let i = V.project_ival v in let l, h = Ival.subdiv_int i in V.inject_ival l, V.inject_ival h with V.Not_based_on_null -> assert false - -(* [make_split lval loc value] makes a split function for the lval [lval] - with location [loc] and abstract value [value]. - Raise Too_linear if the value contains pointer. *) -let make_split _lval size value = +let subdiv_float size v = let size = - if Value_parameters.AllRoundingModes.get () then 0 - else Integer.to_int size + match Integer.to_int size with + | 32 -> Some Fval.Float32 + | 64 -> Some Fval.Float64 + | s -> + if s = Cil.(theMachine.theMachine.sizeof_longdouble) then + (* for long doubles, we currently consider as "all rounding modes" *) + None + else + Kernel.fatal ~current:true "invalid float size: %a" + Abstract_interp.Int.pretty size in - if V.is_included value V.top_float then subdiv_float ~size - else if V.is_included value V.top_int then subdiv_int ~size - else raise Too_linear (* pointers *) + subdiv_float_interval ~size v + +(* [make_split lval value] makes a split function for the lval [lval] + containing the abstract value [value]. + Raise Too_linear if the value contains pointer. *) +let make_split size value = + try + let b, i = Cvalue.V.find_lonely_key value in + if Base.is_null b then + match i with + | Ival.Set _ | Ival.Top _ -> subdiv_int + | Ival.Float _ -> subdiv_float size + else + raise Too_linear (* pointers *) + with Not_found -> raise Too_linear (* multiple bases -> pointers *) + + +module type Forward_Evaluation = sig + type value + type valuation + type state + val evaluate: + ?valuation:valuation -> fuel:int -> + state -> exp -> (valuation * value) evaluated +end module Make (Value : Abstract_value.External) - (Eva: Evaluation.S with type value = Value.t) + (Loc : Abstract_location.S with type value = Value.t) + (Valuation: Valuation with type value = Value.t + and type loc = Loc.location) + (Eva: Forward_Evaluation with type value := Value.t + and type valuation := Valuation.t) = struct - include Eva - (* Values are converted to {!Cvalue.V.t}, because those are currently the only values on which we can split. *) @@ -203,6 +231,8 @@ module Make let set = Value.set Main_values.cvalue_key in fun cval v -> set cval v + let activated = Value.mem Main_values.cvalue_key + (* A subdivision of the evaluation of an expression according to an lvalue [lval] is stored by a working list (implemented as a heap), where each disjunct of the abstract value for [lval] is associated to the result of @@ -289,7 +319,7 @@ module Make They are all worse than [!bound], which must be in the final result. Thus, there is no point in subdividing [value]. Furthermore, since [working_list] is sorted, all the - other subdivisions also have a worse bound. Thus, we stop. *) + other subdivisions also have a worse bound. Thus, we stop. *) raise Abstract_interp.Can_not_subdiv; let subvalue1, subvalue2 = split value in let s1 = compute_subvalue subvalue1 s in @@ -309,7 +339,9 @@ module Make let compare_min, compare_max = if V.is_included result_value V.top_float then V.compare_min_float, V.compare_max_float - else V.compare_min_int, V.compare_max_int + else if V.is_included result_value V.top_int + then V.compare_min_int, V.compare_max_int + else raise Too_linear in let better_bound compare_bound e1 e2 = match e1, e2 with @@ -320,15 +352,15 @@ module Make in better_bound compare_min, better_bound compare_max - module Clear = Clear_Valuation (Eva.Valuation) + module Clear = Clear_Valuation (Valuation) (* These two functions assume that the given expression or lvalue have been evaluated in the valuation. *) - let find_val valuation expr = match Eva.Valuation.find valuation expr with + let find_val valuation expr = match Valuation.find valuation expr with | `Value record -> record | `Top -> assert false - let find_loc valuation lval = match Eva.Valuation.find_loc valuation lval with + let find_loc valuation lval = match Valuation.find_loc valuation lval with | `Value record -> record | `Top -> assert false @@ -342,10 +374,10 @@ module Make [result] and [alarms] are the result of the evaluation of [subexpr]. This function returns the alarms and the valuation resulting from the subdivision. *) - let subdiv_lval subdivnb state expr subexpr lval result alarms = + let subdiv_lval ~fuel subdivnb state expr subexpr lval result alarms = let valuation, value = result in (* Abstract value of [lval]. *) - let lv_exp = Cil.new_exp ~loc:subexpr.Cil_types.eloc (Cil_types.Lval lval) in + let lv_exp = Value_util.lval_to_exp lval in let lv_record = find_val valuation lv_exp in match lv_record.value.v with | `Bottom -> raise Too_linear @@ -355,12 +387,12 @@ module Make (* The size is defined, as [lv] is a scalar *) let size = Int_Base.project (Eval_typ.sizeof_lval_typ record.typ) in (* Split function for this abstract value. *) - let split = make_split lval size lv_cval in + let split = make_split size lv_cval in (* Clear the valuation to force the evaluation on top of [lval]. *) let cleared_valuation = Clear.clear_englobing_exprs valuation ~expr ~subexpr:lv_exp in - let eq_equal_subexpr = Cil_datatype.Exp.equal expr subexpr in + let eq_equal_subexpr = Cil_datatype.ExpStructEq.equal expr subexpr in (* Computes the value of [subexpr] when [lval] has the value [subvalue]. Returns [Bottom] if the complete evaluation of [expr] is bottom for this subvalue. *) @@ -368,8 +400,8 @@ module Make let subvalue = set_cval sub_cval lv_value in let value = { lv_record.value with v = `Value subvalue } in let record = { lv_record with value = value } in - let valuation = Eva.Valuation.(add cleared_valuation lv_exp record) in - let eval = Eva.evaluate ~valuation state expr in + let valuation = Valuation.(add cleared_valuation lv_exp record) in + let eval = Eva.evaluate ~fuel ~valuation state expr in (* Retrieve the value of [subexpr] from [eval]. Also returns the alarms for the evaluation of [expr], which ensure the soundness of the bottom case. *) @@ -396,14 +428,14 @@ module Make let valuation = (* Update for lv *) let v = `Value (set_cval reduced_lv lv_value) in let value = { lv_record.value with v } in - Eva.Valuation.add valuation lv_exp + Valuation.add valuation lv_exp {lv_record with value; reductness = Reduced} in result_subexpr >>-: fun result_subexpr -> let valuation = (* Update for subexp *) let record = find_val valuation subexpr in let value = { record.value with v = `Value result_subexpr } in - Eva.Valuation.add valuation subexpr + Valuation.add valuation subexpr { record with value; val_alarms } in valuation @@ -420,9 +452,9 @@ module Make (* Evaluation of [expr] in state [state], with at most (2 * [subdivnb]) subdivisions for each lvalue. *) - let subdivides_evaluation subdivnb valuation state expr = + let subdivides_evaluation ~fuel subdivnb valuation state expr = (* Evaluation of [expr] without subdivision. *) - let default = Eva.evaluate ~valuation state expr in + let default = Eva.evaluate ~fuel ~valuation state expr in default >>> fun (valuation, value) -> if not (Value.is_included value Value.top_int) then begin Value_parameters.debug ~level:2 @@ -438,25 +470,31 @@ module Make match vars with | [] -> (* No more subdivision: finally evaluate the complete expression. *) - Eva.evaluate ~valuation state expr + Eva.evaluate ~fuel ~valuation state expr | (_subexpr, []) :: tail -> (* No more lvalue on which to subdivide for [subexpr]. *) try_sub tail valuation | (subexpr, lval :: lvs) :: tail -> let tail = (subexpr, lvs) :: tail in try + Value_parameters.result ~current:true ~once:true ~dkey + "subdividing on %a" Printer.pp_lval lval; (* Result for the evaluation of the subexpression [subexpr]. *) let _, alarms as res = - Eva.evaluate ~valuation state subexpr + Eva.evaluate ~fuel ~valuation state subexpr in res >>> fun result -> + (* Do not try to subdivide if [subexpr] contains some pointers: + the {!better_bound} heuristic only works on numerical values. *) + if not Cvalue.V.(is_included (get_cval (snd result)) top_int) + then raise Too_linear; (* If the evaluation of the complete expression [expr] raises some alarms, then force the evaluation of [expr] for the subdivision: some subvalues of [lval] could lead to bottom and be removed. Otherwise, only evaluate [subexpr] in the subdivision. *) let e = if no_alarm then subexpr else expr in (* Subdivide on the value of [lval]. *) - subdiv_lval subdivnb state e subexpr lval result alarms + subdiv_lval ~fuel subdivnb state e subexpr lval result alarms >>> fun valuation -> (* Clear the valuation on top of [subexpr], to force the future reevaluation of the complete expression [expr] with the updated @@ -467,41 +505,153 @@ module Make in try_sub vars valuation - let activated = Value.mem Main_values.cvalue_key - - let evaluate - ?(valuation=Eva.Valuation.empty) ?(reduction=true) - state expr = + let evaluate ?(valuation=Valuation.empty) ~fuel state expr = let subdivnb = Value_parameters.LinearLevel.get () in - if subdivnb = 0 || not reduction || not activated + if subdivnb = 0 || not activated then - Eva.evaluate ~valuation ~reduction state expr + Eva.evaluate ~valuation ~fuel state expr else - subdivides_evaluation subdivnb valuation state expr + subdivides_evaluation ~fuel subdivnb valuation state expr - let rec evaluate_offsets valuation state = function - | NoOffset -> `Value valuation, Alarmset.none - | Field (_, offset) -> evaluate_offsets valuation state offset - | Index (expr, offset) -> - evaluate ~valuation state expr >>= fun (valuation, _value) -> - evaluate_offsets valuation state offset + (* ---------------------- Reduction by enumeration ------------------------ *) - let evaluate_host valuation state = function - | Var _ -> `Value valuation, Alarmset.none - | Mem expr -> evaluate ~valuation state expr >>=: fst + (* Reduce by cond enumerate : when a backward evaluation is not precise + enough, tries to reduce further by enumerating the value of some + "influential" lvalues. As we can enumerate only on cvalues, extracts + the cvalue component of the value module. *) - let lvaluate ?(valuation=Eva.Valuation.empty) ~for_writing state lval = - let subdivnb = Value_parameters.LinearLevel.get () in - if subdivnb = 0 || not activated - then - Eva.lvaluate ~valuation ~for_writing state lval - else - let host, offset = lval in - evaluate_host valuation state host >>> fun valuation -> - evaluate_offsets valuation state offset >>> fun valuation -> - Eva.lvaluate ~valuation ~for_writing state lval + (* Find the value of a previously evaluated expression. *) + let find_val valuation expr = + match Valuation.find valuation expr with + | `Value record -> record.value.v + | `Top -> assert false (* [expr] must have been evaluated already. *) + + let find_loc valuation lval = + match Valuation.find_loc valuation lval with + | `Value record -> record.loc + | `Top -> assert false + + (* We want to enumerate on imprecise but non-completely imprecise Cvalues. *) + let is_enumerable value = + not (Cvalue.V.cardinal_zero_or_one value || Cvalue.V.is_imprecise value) + (* split on a value if it has less than [upto] abstract values, or + enumerate only on its bounds. *) + let fold_enumerate upto op v acc = + try + ignore (Cvalue.V.cardinal_less_than v upto); + Cvalue.V.fold_enum op v acc + with Abstract_interp.Not_less_than -> + (* Enumerate on the possible bases, then on the min and max of the + offsets *) + Cvalue.V.fold_i + (fun b i acc -> + Ival.fold_int_bounds + (fun i acc -> op (Cvalue.V.inject b i) acc) + i acc) + v acc + + (* Find locations on which it is interesting to proceed by case disjunction + to evaluate the expression: locations which are singletons (on which the + cvalue domain can reduce) and has an enumerable value. *) + let rec get_influential_vars valuation exp acc = + match exp.enode with + | Lval (host, off as lval) -> + if Cil.typeHasQualifier "volatile" (Cil.typeOfLval lval) then `Value acc + else + let loc = find_loc valuation lval in + if Cvalue.V.cardinal_zero_or_one (get_cval (Loc.to_value loc)) + then + (* no variable in the host or in the offset can be influential. Check + the contents of the location, on which we might want to enumerate*) + find_val valuation exp >>-: fun contents -> + if is_enumerable (get_cval contents) + then exp :: acc + else acc + else + (* A variable in the host or in the offset may be influential. The + contents themselves are not influential, because we would need to + split both on the location and by content in sync. *) + get_vars_host valuation host acc >>- fun acc -> + get_vars_offset valuation off acc + | BinOp (_, e1, e2, _) -> + get_influential_vars valuation e1 acc >>- fun acc -> + get_influential_vars valuation e2 acc + | UnOp (_, e, _) -> get_influential_vars valuation e acc + | CastE (_, exp) -> get_influential_vars valuation exp acc + | _ -> `Value acc + + and get_vars_host valuation host acc = match host with + | Var _v -> `Value acc + | Mem e -> get_influential_vars valuation e acc + + and get_vars_offset valuation offset acc = match offset with + | NoOffset -> `Value acc + | Field (_, off) -> get_vars_offset valuation off acc + | Index (ind, off) -> + get_influential_vars valuation ind acc >>- fun acc -> + get_vars_offset valuation off acc + + let get_influential_exprs valuation expr = + get_influential_vars valuation expr [] + + let reduce_by_cond_enumerate valuation state cond positive influentials = + (* Test whether the condition [expr] may still be true when the + sub-expression [e] has the value [v]. *) + let condition_may_still_be_true valuation expr record value = + let value = { record.value with v = `Value value } in + let valuation = Valuation.add valuation expr { record with value } in + let eval, _alarms = Eva.evaluate ~valuation ~fuel:0 state cond in + match eval with + | `Bottom -> false + | `Value (_valuation, value) -> + let v = get_cval value in + if positive + then Cvalue.V.contains_non_zero v + else if Value_parameters.UndefinedPointerComparisonPropagateAll.get () + then Cvalue.V.contains_zero v + else Cvalue.V.is_included Cvalue.V.singleton_zero v + in + let enumerate subexpr = + match Valuation.find valuation subexpr with + | `Top -> `Value valuation + | `Value record -> + record.value.v >>- fun v -> + let cleared_valuation = + Clear.clear_englobing_exprs valuation ~expr:cond ~subexpr + in + let process sub_cvalue acc = + let subvalue = set_cval sub_cvalue v in + if condition_may_still_be_true cleared_valuation subexpr record subvalue + then Bottom.join Value.join (`Value subvalue) acc else acc + in + let cvalue = get_cval v in + let upto = succ (Ival.get_small_cardinal ()) in + fold_enumerate upto process cvalue `Bottom >>-: fun value -> + if Value.equal v value + then valuation + else + let reductness = + if record.reductness = Created then Created else Reduced + in + let value = { record.value with v = `Value value } in + let record = { record with value; reductness } in + Valuation.add valuation subexpr record + in + match influentials with + | [] -> `Value valuation + | expr :: _ -> enumerate expr + + (* If the value module contains no cvalue component, this function is + inoperative. Otherwise, it calls reduce_by_cond_enumerate with the + value accessor for the cvalue component. *) + let reduce_by_enumeration valuation state expr positive = + if activated && Value_parameters.EnumerateCond.get () + then + get_influential_exprs valuation expr >>- fun split_on -> + reduce_by_cond_enumerate valuation state expr positive split_on + else `Value valuation end diff --git a/src/plugins/value/engine/non_linear_evaluation.mli b/src/plugins/value/engine/subdivided_evaluation.mli similarity index 65% rename from src/plugins/value/engine/non_linear_evaluation.mli rename to src/plugins/value/engine/subdivided_evaluation.mli index fc72d2ddace3c24aa2d0e0641a6821635876f5ef..33423913b5f6f659e17aa6aade0a906cb5f1b43e 100644 --- a/src/plugins/value/engine/non_linear_evaluation.mli +++ b/src/plugins/value/engine/subdivided_evaluation.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,18 +20,37 @@ (* *) (**************************************************************************) -(** Evaluation of non-linear expressions. *) - -(** Same functionalities as Eva. - For expressions in which some l-values appear multiple times, proceed +(** Subdivision of the evaluation on non-linear expressions: + for expressions in which some l-values appear multiple times, proceed by disjunction on their abstract value, in order to gain precision. *) + +open Cil_types + +module type Forward_Evaluation = sig + type value + type valuation + type state + val evaluate: + ?valuation:valuation -> fuel:int -> + state -> exp -> (valuation * value) Eval.evaluated +end + module Make (Value : Abstract_value.External) - (Eva: Evaluation.S with type value = Value.t) - : Evaluation.S with type value = Value.t - and type origin = Eva.origin - and type loc = Eva.loc - and type state = Eva.state + (Loc: Abstract_location.S with type value = Value.t) + (Valuation: Eval.Valuation with type value = Value.t + and type loc = Loc.location) + (Eva: Forward_Evaluation with type value := Value.t + and type valuation := Valuation.t) + : sig + + val evaluate: + ?valuation:Valuation.t -> fuel:int -> + Eva.state -> exp -> (Valuation.t * Value.t) Eval.evaluated + + val reduce_by_enumeration: + Valuation.t -> Eva.state -> exp -> bool -> Valuation.t Eval.or_bottom + end (* diff --git a/src/plugins/value/engine/transfer_logic.ml b/src/plugins/value/engine/transfer_logic.ml index 84cd4abe002d0de845d754769f15990422800414..c6365c469106b4f8a7c0b7c771a7c9e4403ab5e9 100644 --- a/src/plugins/value/engine/transfer_logic.ml +++ b/src/plugins/value/engine/transfer_logic.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -99,6 +99,12 @@ let emit_message_and_status kind kf behavior active property named_pred status = (* No statuses are emitted for 'assumes' clauses, and for the moment we do not emit text either *) () +let create_conjunction l= + let loc = match l with + | [] -> None + | p :: _ -> Some p.ip_content.pred_loc + in + Logic_const.(List.fold_right (fun p1 p2 -> pand ?loc (p1, p2)) (List.map pred_of_id_pred l) ptrue) (* -------------------------- Active behaviors ------------------------------ *) @@ -117,7 +123,7 @@ module ActiveBehaviors = struct end) let is_active eval_predicate b = - let assumes = Logic_const.(pands (List.map pred_of_id_pred b.b_assumes)) in + let assumes = create_conjunction b.b_assumes in eval_predicate assumes let create eval_predicate funspec = @@ -144,6 +150,20 @@ module ActiveBehaviors = struct with Not_found -> raise No_such_behavior end +let () = + Db.Value.valid_behaviors := + (fun kf state -> + let funspec = Annotations.funspec kf in + let eval_predicate pred = + match Eval_terms.(eval_predicate (env_pre_f ~pre:state ()) pred) with + | Eval_terms.True -> Alarmset.True + | Eval_terms.False -> Alarmset.False + | Eval_terms.Unknown -> Alarmset.Unknown + in + let ab = ActiveBehaviors.create eval_predicate funspec in + ActiveBehaviors.active_behaviors ab + ) + let ip_from_precondition kf call_ki b pre = let ip_precondition = Property.ip_of_requires kf Kglobal b pre in match call_ki with @@ -179,12 +199,8 @@ let process_inactive_behavior kf call_ki behavior = "%a: assumes got status invalid; behavior not evaluated.%t" (pp_header kf) behavior Value_util.pp_callstack -(* Emits informative messages about inactive behaviors, and emits a valid - status for requires and ensures that have not been evaluated. *) -let process_inactive_behaviors kf call_ki ab = - List.iter (process_inactive_behavior kf call_ki) - (List.filter (fun b -> ab.ActiveBehaviors.is_active b = Alarmset.False) - ab.ActiveBehaviors.funspec.spec_behavior) +let process_inactive_behaviors call_ki kf behaviors = + List.iter (process_inactive_behavior kf call_ki) behaviors (* Emits informative messages about behavior postconditions not evaluated because the _requires_ of the behavior are invalid. *) @@ -208,11 +224,6 @@ let process_inactive_postconds kf inactive_bhvs = (* -------------------------------- Functor --------------------------------- *) -module type Domain = sig - include Abstract_domain.Logic - include Datatype.S with type t = state -end - module type S = sig type state type states @@ -220,16 +231,15 @@ module type S = sig val create: state -> kernel_function -> ActiveBehaviors.t val create_from_spec: state -> spec -> ActiveBehaviors.t - val check_fct_preconditions_for_behavior: - kernel_function -> ActiveBehaviors.t -> per_behavior:bool -> kinstr -> - states -> behavior -> states + val check_fct_preconditions_for_behaviors: + kinstr -> kernel_function -> behavior list -> Alarmset.status -> + states -> states val check_fct_preconditions: - kernel_function -> ActiveBehaviors.t -> kinstr -> state -> states or_bottom + kinstr -> kernel_function -> ActiveBehaviors.t -> state -> states or_bottom val check_fct_postconditions_for_behaviors: - kernel_function -> ActiveBehaviors.t -> behavior list -> termination_kind -> - per_behavior:bool -> + kernel_function -> behavior list -> Alarmset.status -> pre_state:state -> post_states:states -> result:varinfo option -> states val check_fct_postconditions: @@ -237,8 +247,7 @@ module type S = sig pre_state:state -> post_states:states -> result:varinfo option -> states or_bottom - val reduce_by_assumes_of_behavior: - kernel_function -> behavior -> states -> states + val evaluate_assumes_of_behavior: state -> behavior -> Alarmset.status val interp_annot: limit:int -> record:bool -> @@ -246,17 +255,55 @@ module type S = sig initial_state:state -> states -> states end +module type LogicDomain = sig + type t + val top: t + val equal: t -> t -> bool + val evaluate_predicate: + t Abstract_domain.logic_environment -> t -> predicate -> Alarmset.status + val reduce_by_predicate: + t Abstract_domain.logic_environment -> t -> predicate -> bool -> t or_bottom +end module Make - (Domain: Domain) + (Domain: LogicDomain) (States: Powerset.S with type state = Domain.t) = struct type state = Domain.t type states = States.t + let pre_env ~pre = + let states = function + | BuiltinLabel (None, Pre) -> pre + | BuiltinLabel (None, Here) -> pre + | BuiltinLabel (Some _, (Pre | Here)) -> Domain.top + | BuiltinLabel _ | FormalLabel _ | StmtLabel _ -> Domain.top + in + Abstract_domain.{ states; result = None } + + let post_env ~pre ~post ~result = + let states = function + | BuiltinLabel (None, Pre) -> pre + | BuiltinLabel (None, Old) -> pre + | BuiltinLabel (None, Post) -> post + | BuiltinLabel (None, Here) -> post + | BuiltinLabel (Some _, (Pre | Old | Post | Here)) -> Domain.top + | BuiltinLabel _ | FormalLabel _ | StmtLabel _ -> Domain.top + in + Abstract_domain.{ states; result } + + let here_env ~pre ~here = + let states = function + | BuiltinLabel (None, Pre) -> pre + | BuiltinLabel (None, Here) -> here + | BuiltinLabel (Some _, (Pre | Here)) -> Domain.top + | BuiltinLabel _ | FormalLabel _ | StmtLabel _ -> Domain.top + in + Abstract_domain.{ states; result = None } + let create_from_spec pre funspec = - let eval_predicate = Domain.eval_predicate (Domain.env_pre_f ~pre ()) in + let eval_predicate = Domain.evaluate_predicate (pre_env ~pre) pre in ActiveBehaviors.create eval_predicate funspec let create init_state kf = @@ -279,8 +326,7 @@ module Make else if nb <= limit then begin (* Can split and maybe reduce *) let treat_subpred pred acc = - let r = Domain.reduce_by_predicate env true pred in - match Domain.env_current_state r with + match Domain.reduce_by_predicate env state pred true with | `Bottom -> acc | `Value current_state -> if Domain.equal current_state state then @@ -296,8 +342,7 @@ module Make end else if reduce then (* Not enough slevel to split, but we should reduce in a global way *) - let reduced = Domain.reduce_by_predicate env true pred in - match Domain.env_current_state reduced with + match Domain.reduce_by_predicate env state pred true with | `Bottom -> States.empty | `Value s -> States.singleton s else (* Not enough slevel to split, and reduction not required *) @@ -305,7 +350,7 @@ module Make let eval_split_and_reduce limit active pred build_env state = let env = build_env state in - let status = Domain.eval_predicate env pred in + let status = Domain.evaluate_predicate env state pred in let reduced_states = if active then match status with @@ -354,10 +399,10 @@ module Make (* [per_behavior] indicates if we are processing each behavior separately. If this is the case, then [Unknown] and [True] behaviors are treated in the same way. *) - let refine_active ab b ~per_behavior = - match ActiveBehaviors.is_active ab b with + let refine_active ~per_behavior behavior status = + match status with | Alarmset.True -> Some true - | Alarmset.Unknown -> Some (per_behavior || Cil.is_default_behavior b) + | Alarmset.Unknown -> Some (per_behavior || Cil.is_default_behavior behavior) | Alarmset.False -> None (* [eval_and_reduce_p_kind kf b active p_kind ips states build_prop build_env] @@ -421,16 +466,16 @@ module Make (** Check the postcondition of [kf] for the list of [behaviors]. This may result in splitting [post_states] if the postconditions contain disjunctions. *) - let check_fct_postconditions_of_behaviors kf ab behaviors kind + let check_fct_postconditions_of_behaviors kf behaviors is_active kind ~per_behavior ~pre_state ~post_states ~result = if behaviors = [] then post_states else - let build_env s = Domain.env_post_f ~post:s ~pre:pre_state ~result () in + let build_env s = post_env ~pre:pre_state ~post:s ~result in let k = Postcondition (post_kind kf) in let check_one_behavior states b = let posts = List.filter (fun (x, _) -> x = kind) b.b_post_cond in let posts = List.map snd posts in - let refine = refine_active ab b per_behavior in + let refine = refine_active ~per_behavior b (is_active b) in let build_prop p = Property.ip_of_ensures kf Kglobal b (kind, p) in eval_and_reduce kf b refine k posts states build_prop build_env in @@ -439,62 +484,82 @@ module Make (** Check the postcondition of [kf] for the list [behaviors] and for the default behavior, treating them separately if [per_behavior] is [true], merging them otherwise. *) - let check_fct_postconditions_for_behaviors kf ab behaviors kind - ~per_behavior ~pre_state ~post_states ~result = + let check_fct_postconditions_for_behaviors kf behaviors status + ~pre_state ~post_states ~result = let behaviors = if List.exists Cil.is_default_behavior behaviors && behaviors <> [] then behaviors - else match Cil.find_default_behavior ab.ActiveBehaviors.funspec with + else match Cil.find_default_behavior kf.spec with | None -> behaviors | Some default -> default :: behaviors in - check_fct_postconditions_of_behaviors kf ab behaviors kind - ~per_behavior ~pre_state ~post_states ~result + let is_active _ = status in + let kind = Normal in + check_fct_postconditions_of_behaviors kf behaviors is_active kind + ~per_behavior:true ~pre_state ~post_states ~result (** Check the postcondition of [kf] for every behavior. The postcondition of the global behavior is applied for each behavior, to help reduce the final state. *) let check_fct_postconditions kf ab kind ~pre_state ~post_states ~result = let behaviors = Annotations.behaviors kf in + let is_active = ActiveBehaviors.is_active ab in let states = check_fct_postconditions_of_behaviors - kf ab behaviors kind ~per_behavior:false ~pre_state ~post_states ~result + kf behaviors is_active kind ~per_behavior:false + ~pre_state ~post_states ~result in if States.is_empty states then `Bottom else `Value states + let check_fct_preconditions_of_behaviors call_ki kf ~per_behavior behaviors + is_active states = + if behaviors = [] then states + else + let build_env pre = pre_env ~pre in + let k = Precondition in + let check_one_behavior states b = + let refine = refine_active ~per_behavior b (is_active b) in + let build_prop assume = Property.ip_of_assumes kf Kglobal b assume in + let states = + eval_and_reduce kf b refine Assumes b.b_assumes states build_prop build_env + in + if refine = None then process_inactive_behavior kf call_ki b; + let build_prop = ip_from_precondition kf call_ki b in + let states = + eval_and_reduce kf b refine k b.b_requires states build_prop build_env + in + if States.is_empty states + then process_inactive_postconds kf [b]; + states + in + List.fold_left check_one_behavior states behaviors + (** Check the precondition of [kf] for a given behavior [b]. This may result in splitting [states] if the precondition contains disjunctions. *) - let check_fct_preconditions_for_behavior kf ab ~per_behavior call_ki states b = - let build_env pre = Domain.env_pre_f ~pre () in - let refine = refine_active ab b per_behavior in - let k = Precondition in - if refine = None then process_inactive_behavior kf call_ki b; - let ip = ip_from_precondition kf call_ki b in - eval_and_reduce kf b refine k b.b_requires states ip build_env + let check_fct_preconditions_for_behaviors call_ki kf behaviors status states = + let is_active _ = status in + check_fct_preconditions_of_behaviors call_ki kf ~per_behavior:true + behaviors is_active states (* Check the precondition of [kf]. This may result in splitting [init_state] into multiple states if the precondition contains disjunctions. *) - let check_fct_preconditions kf ab call_ki init_state = + let check_fct_preconditions call_ki kf ab init_state = let init_states = States.singleton init_state in - let spec = Annotations.funspec kf in + let behaviors = Annotations.behaviors kf in + let is_active = ActiveBehaviors.is_active ab in let states = - List.fold_left - (check_fct_preconditions_for_behavior ~per_behavior:false kf ab call_ki) - init_states spec.spec_behavior + check_fct_preconditions_of_behaviors call_ki kf ~per_behavior:false + behaviors is_active init_states in if States.is_empty states then `Bottom else `Value states - - (* Applies the given [assumes] clauses of a given behavior [b] to the states - passed as argument, in order to reduce them (no status is emitted). *) - let reduce_by_assumes_of_behavior kf b states = - let build_prop assume = Property.ip_of_assumes kf Kglobal b assume in - let build_env pre = Domain.env_pre_f ~pre () in - eval_and_reduce_p_kind - kf b true Assumes b.b_assumes states build_prop build_env - + let evaluate_assumes_of_behavior state = + let pre_env = pre_env ~pre:state in + fun behavior -> + let assumes = create_conjunction behavior.b_assumes in + Domain.evaluate_predicate pre_env state assumes let code_annotation_text ca = match ca.annot_content with @@ -558,8 +623,8 @@ module Make let reduced_states = States.fold (fun (here: Domain.t) accstateset -> - let env = Domain.env_annot ~pre:initial_state ~here () in - let res = Domain.eval_predicate env p in + let env = here_env ~pre:initial_state ~here in + let res = Domain.evaluate_predicate env here p in (* if record [holds], emit statuses in the Kernel, and print a message *) if record then emit res; @@ -572,7 +637,7 @@ module Make accstateset | (Alarmset.Unknown | Alarmset.True), `True -> - let env = Domain.env_annot ~pre:initial_state ~here () in + let env = here_env ~pre:initial_state ~here in (* Reduce by p if it is a disjunction, or if it did not evaluate to True *) let reduce = res = Alarmset.Unknown in diff --git a/src/plugins/value/engine/transfer_logic.mli b/src/plugins/value/engine/transfer_logic.mli index daf14970010d475bd504d11d264bb50ff27d928d..771038b548a4b6589a6a1de0bbb3026673902b79 100644 --- a/src/plugins/value/engine/transfer_logic.mli +++ b/src/plugins/value/engine/transfer_logic.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,24 +23,17 @@ open Cil_types open Eval -module type Domain = sig - include Abstract_domain.Logic - include Datatype.S with type t = state -end - module ActiveBehaviors : sig type t val is_active: t -> behavior -> Alarmset.status val active_behaviors: t -> behavior list val behavior_from_name: t -> string -> behavior + val create: (predicate -> Alarmset.status) -> spec -> t end +(* Marks all behaviors of the list as inactive. *) val process_inactive_behaviors: - kernel_function -> kinstr -> ActiveBehaviors.t -> unit - -val process_inactive_postconds: - kernel_function -> behavior list -> unit - + kinstr -> kernel_function -> behavior list -> unit module type S = sig type state @@ -49,16 +42,15 @@ module type S = sig val create: state -> kernel_function -> ActiveBehaviors.t val create_from_spec: state -> spec -> ActiveBehaviors.t - val check_fct_preconditions_for_behavior: - kernel_function -> ActiveBehaviors.t -> per_behavior:bool -> kinstr -> - states -> behavior -> states + val check_fct_preconditions_for_behaviors: + kinstr -> kernel_function -> behavior list -> Alarmset.status -> + states -> states val check_fct_preconditions: - kernel_function -> ActiveBehaviors.t -> kinstr -> state -> states or_bottom + kinstr -> kernel_function -> ActiveBehaviors.t -> state -> states or_bottom val check_fct_postconditions_for_behaviors: - kernel_function -> ActiveBehaviors.t -> behavior list -> termination_kind -> - per_behavior:bool -> + kernel_function -> behavior list -> Alarmset.status -> pre_state:state -> post_states:states -> result:varinfo option -> states val check_fct_postconditions: @@ -66,8 +58,7 @@ module type S = sig pre_state:state -> post_states:states -> result:varinfo option -> states or_bottom - val reduce_by_assumes_of_behavior: - kernel_function -> behavior -> states -> states + val evaluate_assumes_of_behavior: state -> behavior -> Alarmset.status val interp_annot: limit:int -> record:bool -> @@ -75,9 +66,18 @@ module type S = sig initial_state:state -> states -> states end +module type LogicDomain = sig + type t + val top: t + val equal: t -> t -> bool + val evaluate_predicate: + t Abstract_domain.logic_environment -> t -> predicate -> Alarmset.status + val reduce_by_predicate: + t Abstract_domain.logic_environment -> t -> predicate -> bool -> t or_bottom +end module Make - (Domain: Domain) + (Domain: LogicDomain) (States: Powerset.S with type state = Domain.t) : S with type state = Domain.t and type states = States.t diff --git a/src/plugins/value/engine/transfer_specification.ml b/src/plugins/value/engine/transfer_specification.ml new file mode 100644 index 0000000000000000000000000000000000000000..6183538071143c0f5a4da1a43c874a6cc83f021b --- /dev/null +++ b/src/plugins/value/engine/transfer_specification.ml @@ -0,0 +1,476 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types +open Eval + +(* Applied to the list of behaviors of a function specification, returns the + default behavior and the list of non-default behaviors. The incoming list + should not be empty (it contains at least the default behavior). *) +let extract_default_behavior = + let rec extract acc = function + | [] -> assert false + | behavior :: tail -> + if behavior.b_name = Cil.default_behavior_name + then behavior, acc @ tail + else extract (behavior :: acc) tail + in + extract [] + +(* Returns the assigns clause to be used during per-behavior processing. + The specification states that, if a behavior has no assigns clause, + then the assigns clause of the default behavior must be used instead. *) +let get_assigns_for_behavior spec b = + match b.b_assigns with + | WritesAny -> (* no assigns clause, using the default behavior's *) + let behaviors = spec.spec_behavior in + let name = Cil.default_behavior_name in + let def_b = List.find (fun b' -> b'.b_name = name) behaviors in + def_b.b_assigns + | _ -> b.b_assigns + +let pp_eval_error fmt e = + if e <> Eval_terms.CAlarm then + Format.fprintf fmt "@ (%a)" Eval_terms.pretty_logic_evaluation_error e + +let warn_on_imprecise_assigns assigns = + match assigns with + | WritesAny -> + Value_util.warning_once_current + "Cannot handle empty assigns clause. Assuming assigns \\nothing: \ + be aware this is probably incorrect." + | Writes l -> + (* Warn for clauses without \from *) + let no_from = List.filter (fun (_, from) -> from = FromAny) l in + match no_from with + | [] -> () + | (out, _) :: _ -> + let source = fst out.it_content.term_loc in + Value_parameters.warning ~source ~once:true + "@[no \\from part@ for clause '%a'@]" + Printer.pp_assigns (Writes no_from) + +(* Warns in case the 'assigns \result' clause is missing in a behavior + (only if the return is used at the call site). *) +let warn_on_missing_result_assigns kinstr kf spec = + let return_used = match kinstr with + | Kglobal -> true + | Kstmt {skind = Instr (Call (lv, _, _, _))} -> + lv <> None || Value_util.postconditions_mention_result spec + | Kstmt {skind = Instr (Local_init(_,ConsInit(_,_,Constructor),_)) } -> + Value_util.postconditions_mention_result spec + | Kstmt {skind=Instr(Local_init(_,ConsInit(_,_,Plain_func),_))} -> true + | _ -> assert false + in + let for_result (out, _) = Logic_utils.is_result out.it_content in + let assigns_result behavior = + match behavior.b_assigns with + | WritesAny -> true + | Writes l -> List.exists for_result l + in + if return_used && not (List.for_all assigns_result spec.spec_behavior) + then + let source = fst (Kernel_function.get_location kf) in + Value_parameters.warning ~once:true ~source + "@[no 'assigns \\result@ \\from ...'@ clause@ specified for@ function %a@]" + Kernel_function.pretty kf + +let reduce_to_valid_location out loc = + if Locations.(Location_Bits.(equal top loc.loc)) then + begin + Value_parameters.error ~once:true ~current:true + "Cannot@ handle@ assigns@ for %a,@ location@ is@ too@ imprecise@ \ + (%a).@ Assuming@ it@ is@ not@ assigned,@ but@ be@ aware@ this\ + @ is@ incorrect." Printer.pp_term out Locations.pretty loc; + `Ignored + end + else + let valid = Locations.valid_part ~for_writing:true loc in + if Locations.is_bottom_loc valid then + begin + if not (Locations.is_bottom_loc loc) then + Value_parameters.warning ~current:true ~once:true + "@[Completely invalid destination@ for assigns@ clause %a.@ \ + Ignoring.@]" Printer.pp_term out; + `Ignored + end + else `Result loc + +let precise_loc_of_from_clause env out = + try + (* TODO: warn about errors during evaluation. *) + let alarm_mode = Eval_terms.Ignore in + let loc = Eval_terms.eval_tlval_as_location ~alarm_mode env out in + reduce_to_valid_location out loc + with Eval_terms.LogicEvalError e -> + Value_util.warning_once_current + "cannot interpret assigns %a%a; effects will be ignored" + Printer.pp_term out pp_eval_error e; + `Ignored + + +module Make + (Value: Abstract_value.External) + (Location: Abstract_location.External) + (Domain: Abstract_domain.External with type value = Value.t + and type location = Location.location) + (States: Powerset.S with type state = Domain.t) + (Logic : Transfer_logic.S with type state = Domain.t + and type states = States.t) += struct + + (* Most transfer functions about logic return a set of states instead of a + single state, and States.empty instead of bottom. We thus use this monad + to turn `Bottom into States.empty in the following for consistency. *) + let (>>-) state f = match state with + | `Bottom -> States.empty + | `Value state -> f state + + (* The precise narrowing of disjunctive sets of states is the disjunction + between the narrowing of each combination of states from each sets. The + complexity is quadratic. *) + let precise_narrow_states_list states_list = + let fold = States.fold in + let fold2 f set1 set2 acc = + fold (fun s1 acc -> fold (fun s2 acc -> f s1 s2 acc) set2 acc) set1 acc + in + let rec disjunctive_narrow states = function + | [] -> states + | set :: tail -> + let narrow s s' acc = States.add' (Domain.narrow s s') acc in + let states = fold2 narrow states set States.empty in + disjunctive_narrow states tail + in + disjunctive_narrow (List.hd states_list) (List.tl states_list) + + (* Approximate narrowing of disjunctive sets: we narrow the join of each set, + and we use this single state to reduce each state of one set, chosen + arbitrarily. + TODO: it would be useful to have an heuristic to choose the set to + be kept. *) + let approximate_narrow_states_list states_list = + let joined_list = List.map States.join states_list in + let narrowed_state = match joined_list with + | [] -> assert false + | hd :: tl -> List.fold_left (Bottom.narrow Domain.narrow) hd tl + in + narrowed_state >>- fun narrowed_state -> + States.fold + (fun state acc -> States.add' (Domain.narrow state narrowed_state) acc) + (List.hd states_list) + States.empty + + (* Narrowing of a list of disjunctive sets of states. *) + let narrow_states_list = function + | [] -> States.empty + | [x] -> x + | states_list -> + if true + then approximate_narrow_states_list states_list + else precise_narrow_states_list states_list + + (* Extraction of the precise location and of the cvalue domain: + needed to evaluate the location of an assigns clause. *) + let set_ploc = Location.set Main_locations.ploc_key + let set_location loc = set_ploc (Main_locations.PLoc.make loc) + let get_cvalue_state = match Domain.get Cvalue_domain.key with + | None -> fun _ -> Cvalue.Model.top + | Some get -> get + + let make_env state = Eval_terms.env_assigns (get_cvalue_state state) + + (* Applies one assign clause. Returns the updated state, and a boolean + indicating whether the clause has really been processed (it is false if + the clause has been ignored because too imprecise). *) + let treat_assign env ~pre state ({it_content = out}, _ as assigns) = + (* Treats the output part of the assigns clause. *) + match precise_loc_of_from_clause env out with + | `Ignored -> state + | `Result location -> + let froms_locations = set_location location Location.top in + Domain.logic_assign assigns froms_locations ~pre state + + let treat_statement_assigns assigns state = + warn_on_imprecise_assigns assigns; + match assigns with + | WritesAny -> state (* The assign is ignored; a warning has been emitted. *) + | Writes l -> + let env = make_env state in + List.fold_left (treat_assign env ~pre:state) state l + + let is_result ({it_content = out}, _) = Logic_utils.is_result out + + (* Interprets one function assign, with a special case for assigns \result. *) + let treat_function_assign retres_loc env ~pre state assigns = + if is_result assigns + then + match retres_loc with + | None -> state + | Some loc -> Domain.logic_assign assigns loc ~pre state + else treat_assign env state ~pre assigns + + (* Interprets all the assigns of a function. *) + let treat_function_assigns retres_vi assigns state = + warn_on_imprecise_assigns assigns; + match assigns with + | WritesAny -> state + | Writes l -> + let env = make_env state in + let retres_loc = Extlib.opt_map Location.eval_varinfo retres_vi in + List.fold_left (treat_function_assign retres_loc env ~pre:state) state l + + + (* Reduces the [states] by the assumes and requires clauses of the [behavior] + of function [kf]. Warns about inactive postconditions if [states] are + reduced to bottom. *) + let reduce_by_preconditions = Logic.check_fct_preconditions_for_behaviors + + (* Computes the effects of the assigns clauses of the [behavior] and reduces + the resulting states by its ensures clauses. [kf) is the called function, + and [result] is the \result varinfo it returns, if any. *) + let compute_effects kf spec result behavior status states = + States.join states >>- fun pre_state -> + let assigns = get_assigns_for_behavior spec behavior in + let states = States.map (treat_function_assigns result assigns) states in + Logic.check_fct_postconditions_for_behaviors kf [behavior] status + ~result ~pre_state ~post_states:states + + module Behaviors = struct + type t = funbehavior + let equal b1 b2 = b1.b_name = b2.b_name + let hash b = Hashtbl.hash b.b_name + end + module HashBehaviors = Hashtbl.Make (Behaviors) + + (* [behaviors] is a list of complete sets of behaviors. This function + interprets each complete set of behaviors in [states], and thus returns a + list of sets of states (each one being the result of a complete set). + [kf] is the related function, [kinstr] the call site, and [result] the + \result varinfo returned by the function, if any. + All behaviors in [behaviors] must have an Unknown status. False behaviors + should have been removed, and true behaviors should be interpreted by + [compute_true_behaviors]. *) + let compute_complete_behaviors kinstr kf spec result behaviors states = + (* As a behavior may be included in several complete sets, we use a local + cache for the interpretation of each behavior. *) + let cache = HashBehaviors.create 3 in + let compute_behavior behavior = + try HashBehaviors.find cache behavior + with Not_found -> + let s = Alarmset.Unknown in + let states = reduce_by_preconditions kinstr kf [behavior] s states in + let states = compute_effects kf spec result behavior s states in + HashBehaviors.add cache behavior states; + states + in + let compute_complete_set behaviors = + List.fold_left + (fun acc b -> fst (States.merge (compute_behavior b) ~into:acc)) + States.empty behaviors + in + List.map compute_complete_set behaviors + + (* Interprets a list of behaviors as if they was merged into a single + behavior. Uses all the preconditions and postconditinos at once to + reduce the states, and uses the assigns clauses of the first behavior + only (ideally, we want the intersection of assigns clauses). *) + let compute_true_behaviors kinstr kf spec result behaviors states = + let status = Alarmset.True in + let states = reduce_by_preconditions kinstr kf behaviors status states in + States.join states >>- fun pre_state -> + let assigns = get_assigns_for_behavior spec (List.hd behaviors) in + let states = States.map (treat_function_assigns result assigns) states in + Logic.check_fct_postconditions_for_behaviors kf behaviors Alarmset.True + ~result ~pre_state ~post_states:states + + + (* Auxiliary function for promote_complete_behaviors. Replaces the status of + a behavior in an association list binding behaviors to statuses. *) + let rec replace_in_list elt assoc = function + | [] -> [] + | (key, data) :: tail -> + if String.compare key.b_name elt.b_name = 0 + then (elt, assoc) :: tail + else (key, data) :: replace_in_list elt assoc tail + + (* If a complete set of behaviors contains only one active behavior (whose + assumes clauses are not false), then this behavior is true. + If [behaviors] is an association list binding each behavior to the status + of its assumes clauses, and [complete_list] is the list of complete sets + of behaviors, then [promote_complete_behaviors] removes false behaviors + from [complete_list], and binds single active behaviors from complete sets + to true in [behaviors]. + Returns `Bottom if a all the behaviors of a complete set have a false + \assumes clause. *) + let promote_complete_behaviors behaviors complete_list = + let module E = struct exception Bottom end in + let is_not_false b = List.assoc b behaviors <> Alarmset.False in + let complete_list = List.map (List.filter is_not_false) complete_list in + let promote acc = function + (* If a complete set of behaviors is empty here, then it contains only + false behaviors, and thus its interpretation is bottom. *) + | [] -> raise E.Bottom + | [b] -> replace_in_list b Alarmset.True acc + | _ -> acc + in + try `Value (List.fold_left promote behaviors complete_list, complete_list) + with E.Bottom -> `Bottom + + (* Evaluates the \assumes of each behavior, and returns an association list + between behaviors and their status. Also removes false behaviors from + the list of complete behaviors [complete_behaviors], and promotes complete + sets of one behavior as true behaviors. + This function also evaluates the \requires clauses of the behaviors that + will not be used in the interpretation of the specification: false + behaviors, and unknown behaviors that do not belong to any complete set. + This ensures that the preconditions of all behaviors will have been + evaluated, and that consistent status will have been emitted at the end + of the interpretation of the specification. *) + let evaluate_preconditions kinstr kf behaviors complete_behaviors states = + (* Processes all behaviors as inactive and returns bottom. *) + let all_inactive () = + Transfer_logic.process_inactive_behaviors kinstr kf behaviors; + `Bottom + in + match States.join states with + (* If the preconditions of the default behavior led to bottom, all other + behaviors are inactive. *) + | `Bottom -> all_inactive () + | `Value pre_state -> + (* Evaluate all assumes clauses, and compute the association list between + behaviors and their status. *) + let evaluate = Logic.evaluate_assumes_of_behavior pre_state in + let behaviors = List.map (fun b -> b, evaluate b) behaviors in + (* Remove false behaviors from complete sets of behaviors, and promotes + complete sets of one behavior as true behaviors. *) + match promote_complete_behaviors behaviors complete_behaviors with + (* If all behaviors of a complete set have false \assumes, all behaviors + are inactive. *) + | `Bottom -> all_inactive () + | `Value (behaviors, complete_behaviors) -> + (* Evaluates \requires for false or non-complete unknown behaviors. *) + let evaluate_requires (behavior, status) = + if status = Alarmset.False + then Transfer_logic.process_inactive_behaviors kinstr kf [behavior] + else if status = Alarmset.Unknown + && not (List.exists (List.mem behavior) complete_behaviors) + then + ignore (reduce_by_preconditions kinstr kf [behavior] status states) + in + List.iter evaluate_requires behaviors; + `Value (behaviors, complete_behaviors) + + (* Sound over-approximations of the effects of a function can be computed + through its specification in three different ways: + - the default behavior is always an over-approximation of the function + effects, but can be very imprecise. We use it only if the two other ways + are inapplicable (both are strictly more precise). + - any behavior whose assumes clause is true in the current state is also a + sound approximation of the function effects applied to this state. + - the union of any complete set of behaviors is an over-approximation of + the function effects. + To obtain the highest precision, the states resulting from the + interpretation of any true behavior and of any complete set should be + intersected. *) + let compute_specification kinstr kf result spec state = + (* The default behavior, and the list of other behaviors. *) + let default_bhv, behaviors = extract_default_behavior spec.spec_behavior in + let find_behavior name = List.find (fun b -> b.b_name = name) behaviors in + (* List of complete sets of behaviors. *) + let complete_behaviors = + List.map (List.map find_behavior) spec.spec_complete_behaviors + in + (* Reduction by the preconditions of the default behavior. The resulting + state is the pre state for any further computation. *) + let states = + Logic.check_fct_preconditions_for_behaviors + kinstr kf [default_bhv] Alarmset.True (States.singleton state) + in + evaluate_preconditions kinstr kf behaviors complete_behaviors states + >>- fun (behaviors, complete_behaviors) -> + (* List of true behaviors other than the default behavior. *) + let true_behaviors = + Extlib.filter_map (fun (_b, st) -> st = Alarmset.True) fst behaviors + in + (* Without any true behaviors or complete sets, compute the effects of + the default behavior. *) + if true_behaviors = [] && spec.spec_complete_behaviors = [] + then compute_effects kf spec result default_bhv Alarmset.True states + else + (* Remove complete sets that contain a true behavior: such behaviors are + treated afterwards. *) + let is_true b = List.assoc b behaviors = Alarmset.True in + let complete_behaviors = + List.filter (fun l -> not (List.exists is_true l)) complete_behaviors + in + (* Interpret each complete set of behaviors. The result is a list of + state sets, one for each set. The join of each state set is a sound + approximation at the end of the function call. *) + let complete_states = + compute_complete_behaviors + kinstr kf spec result complete_behaviors states + in + (* If there is some true behaviors, interpret them and add the resulting + state set to the list. All true behaviors have their clauses computed + as in the case of a single specification. *) + let sound_states = + if true_behaviors = [] + then complete_states + else + let true_states = + compute_true_behaviors kinstr kf spec result true_behaviors states + in + true_states :: complete_states + in + (* As each state set in this list is a sound approximation, narrow them. *) + narrow_states_list sound_states + + (* Interprets the [call] at [kinstr] in [state], using the specification + [spec] of the called function. It first reduces by the preconditions, then + evaluates the assigns, and finally reduces by the post-conditions. *) + let compute_using_specification kinstr call spec state = + if Value_parameters.InterpreterMode.get () + then Value_parameters.abort "Library function call. Stopping."; + Value_parameters.feedback ~once:true + "@[using specification for function %a@]" Kernel_function.pretty call.kf; + let vi = Kernel_function.get_vi call.kf in + if Cil.hasAttribute "noreturn" vi.vattr + then `Bottom + else + (* Initializes the variable returned by the function. *) + let state = match call.return with + | None -> state + | Some retres_vi -> + (* Notify the user about missing assigns \result. *) + warn_on_missing_result_assigns kinstr call.kf spec; + let state = Domain.enter_scope call.kf [retres_vi] state in + let init_kind = Abstract_domain.Spec_Return call.kf in + Domain.initialize_variable_using_type init_kind retres_vi state + in + let states = + compute_specification kinstr call.kf call.return spec state + in + if States.is_empty states + then `Bottom + else `Value (States.to_list states) + +end diff --git a/src/plugins/value/legacy/eval_non_linear.mli b/src/plugins/value/engine/transfer_specification.mli similarity index 70% rename from src/plugins/value/legacy/eval_non_linear.mli rename to src/plugins/value/engine/transfer_specification.mli index 36e66cf36e854fc43dee4d0167c57301cdf67284..4b576283de0fe59f7ab98c489e33b8e65e7e24c7 100644 --- a/src/plugins/value/legacy/eval_non_linear.mli +++ b/src/plugins/value/engine/transfer_specification.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,27 +20,23 @@ (* *) (**************************************************************************) -(** Evaluation of non-linear expressions. *) - open Cil_types -open Locations +open Eval + +module Make + (Value: Abstract_value.External) + (Location: Abstract_location.External) + (Domain: Abstract_domain.External with type value = Value.t + and type location = Location.location) + (States: Powerset.S with type state = Domain.t) + (Logic : Transfer_logic.S with type state = Domain.t + and type states = States.t) + : sig -(** Same functionality as {!Eval_exprs.eval_expr_with_deps_state}. For - expressions in which some l-values appear multiple times, proceed - by disjunction on their abstract value, in order to gain precision. *) -val eval_expr_with_deps_state : - with_alarms:CilE.warn_mode -> - Zone.t option -> - Cvalue.Model.t -> - Cil_types.exp -> - Cvalue.Model.t * Zone.t option * Location_Bytes.t + val treat_statement_assigns: assigns -> Domain.t -> Domain.t -val compute_non_linear: - exp -> (lval * Locations.location option) list + val compute_using_specification: + kinstr -> Value.t call -> spec -> Domain.t -> Domain.t list or_bottom -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) + end diff --git a/src/plugins/value/engine/transfer_stmt.ml b/src/plugins/value/engine/transfer_stmt.ml index eed73a64e6eec1aa533249cdd4d633d8a2892466..5f48c8904a5742bf042e34d473a72d015dfe8b61 100644 --- a/src/plugins/value/engine/transfer_stmt.ml +++ b/src/plugins/value/engine/transfer_stmt.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -27,29 +27,22 @@ open Eval module type S = sig type state type value - val assign: with_alarms:CilE.warn_mode -> - state -> kernel_function -> stmt -> lval -> exp -> state or_bottom - val assume: with_alarms:CilE.warn_mode -> - state -> stmt -> exp -> bool -> state or_bottom - val call: with_alarms:CilE.warn_mode -> + val assign: state -> kinstr -> lval -> exp -> state or_bottom + val assume: state -> stmt -> exp -> bool -> state or_bottom + val call: stmt -> lval option -> exp -> exp list -> state -> state list or_bottom * Value_types.cacheable val split_final_states: kernel_function -> exp -> Integer.t list -> state list -> state list list val check_unspecified_sequence: - with_alarms:CilE.warn_mode -> stmt -> state -> (stmt * lval list * lval list * lval list * stmt ref list) list -> unit or_bottom - type res = state list or_bottom * Value_types.cacheable - val compute_call_ref: (kinstr -> value call -> state -> res) ref -end - -module type Domain = sig - include Abstract_domain.Transfer - val leave_scope: kernel_function -> varinfo list -> state -> state - module Store: Abstract_domain.Store with type state := state - include Datatype.S with type t = state + type call_result = { + states: state list or_bottom; + cacheable: Value_types.cacheable; + } + val compute_call_ref: (kinstr -> value call -> state -> call_result) ref end (* Reference filled in by the callwise-inout callback *) @@ -69,19 +62,22 @@ let () = Cmdline.run_after_configuring_stage register_callback let current_kf_inout = InOutCallback.get_option module Make - (Value: Abstract_value.S) + (Value: Abstract_value.External) (Location: Abstract_location.External) - (Domain: Domain with type value = Value.t - and type location = Location.location) + (Domain: Abstract_domain.External with type value = Value.t + and type location = Location.location) (Eva: Evaluation.S with type state = Domain.state and type value = Domain.value and type loc = Domain.location - and type Valuation.t = Domain.valuation) + and type origin = Domain.origin) = struct type state = Domain.state type value = Domain.value + (* Transfer functions. *) + module TF = Domain.Transfer (Eva.Valuation) + (* Emits a warning if the evaluation of an argument leads to a bottom state. *) let warn_if_bottom v warn = match v with | `Value _ -> () @@ -107,20 +103,6 @@ module Make r >>=: fun (valuation, value) -> Copy (lval, value), valuation - (* Should this l-value be evaluated, as opposed to being copied. *) - let should_eval_lval kf lval = - Value_util.warn_indeterminate kf - && Cil.isArithmeticOrPointerType (Cil.typeOfLval lval) - - (* Find a lvalue hidden under identity casts. This function correctly detects - bitfields, and will never expose the underlying field. *) - let rec find_lv expr = match expr.enode with - | Lval lv -> Some lv - | CastE (typ, e) -> - if Eval_typ.need_cast typ (Cil.typeOf e) then None else find_lv e - | _ -> None - - (* At a call site, if the return value of a function can be infinite or NaN, the corresponding alarm cannot be emitted. Instead, we replace the return value by top_int (that contains the infinite and NaN values). @@ -146,17 +128,23 @@ module Make false in the called function. *) let check_undeterminate_return alarms expr eval = let is_infinite = ref false in + let is_returned_value lv = + Cil_datatype.ExpStructEq.equal expr (Value_util.lval_to_exp lv) + in let inspects alarm status = match alarm with | Alarms.Is_nan_or_infinite _ -> is_infinite := !is_infinite || status <> Alarmset.True - | Alarms.Uninitialized _ -> - Value_messages.warning "@[returned value may be uninitialized:@ \ - assert \\initialized(\\returned_value)@]" - | Alarms.Dangling _ -> - Value_messages.warning "@[returned value may be contain escaping addresses:@ \ - assert \\dangling(\\returned_value)@]" - | _ -> assert false + | Alarms.Uninitialized lv when is_returned_value lv -> + Value_parameters.warning ~current:true ~once:true + "@[returned value may be uninitialized:@ \ + assert \\initialized(\\returned_value)@]" + | Alarms.Dangling lv when is_returned_value lv -> + Value_parameters.warning ~current:true ~once:true + "@[returned value may contain escaping addresses:@ \ + assert \\dangling(\\returned_value)@]" + | _ -> () (* There might be alarms coming from evaluation of the lhs + of the assignment. We don't treat them here. *) in Alarmset.iter inspects alarms; if !is_infinite @@ -167,43 +155,43 @@ module Make else eval + (* For an initialization, use for_writing:false for the evaluation of + the left location, as the written variable could be const. This is only + useful for local initializations through function calls, as other + initializations are handled by initialization.ml. *) + let for_writing kinstr = match kinstr with + | Kglobal -> false + | Kstmt stmt -> match stmt.skind with + | Instr (Local_init _) -> false + | _ -> true + (* Assignment. *) - let assign_lv_or_ret ~with_alarms ~is_ret state kf stmt lval expr = - let eval, alarms_loc = Eva.lvaluate ~for_writing:true state lval in - Alarmset.emit with_alarms (Kstmt stmt) alarms_loc; + let assign_lv_or_ret ~is_ret state kinstr lval expr = + let for_writing = for_writing kinstr in + let eval, alarms_loc = Eva.lvaluate ~for_writing state lval in + Alarmset.emit kinstr alarms_loc; warn_if_bottom eval (fun () -> - Valarms.do_warn with_alarms.CilE.imprecision_tracing - (fun () -> Kernel.warning ~current:true ~once:true - "@[<v>@[all target addresses were invalid. This path is \ - assumed to be dead.@]%t@]" Value_util.pp_callstack)); + Kernel.warning ~current:true ~once:true + "@[<v>@[all target addresses were invalid. This path is \ + assumed to be dead.@]%t@]" Value_util.pp_callstack); eval >>- fun (valuation, lloc, ltyp) -> let eval, alarms = - if not is_ret && should_eval_lval kf lval then - assign_by_eval state valuation expr - else - match find_lv expr with - | Some right_lval -> - Eva.lvaluate ~for_writing:false ~valuation state right_lval - >>= fun (valuation, right_loc, _right_typ) -> - Eva.check_copy_lval (lval, lloc) (right_lval, right_loc) - >>= fun compatible_locations -> - (* TODO: safety check. should always be true if the AST is explicit - enough. *) - if compatible_locations - then assign_by_copy state valuation right_lval - else assign_by_eval state valuation expr - | None -> - assign_by_eval state valuation expr + Eva.can_copy ~valuation state ~is_ret kinstr lval expr + >>= fun (right_lv, valuation) -> + match right_lv with + | Some right_lval -> + assign_by_copy state valuation right_lval + | None -> assign_by_eval state valuation expr in let eval = (* At a call site, do not emit alarms about the fake variable used for the return of the called function. *) if is_ret then check_undeterminate_return alarms expr eval - else (Alarmset.emit with_alarms (Kstmt stmt) alarms; eval) + else (Alarmset.emit kinstr alarms; eval) in eval >>- fun (assigned, valuation) -> - Domain.assign (Kstmt stmt) {lval; ltyp; lloc} expr assigned valuation state + TF.assign kinstr {lval; ltyp; lloc} expr assigned valuation state let assign = assign_lv_or_ret ~is_ret:false let assign_ret = assign_lv_or_ret ~is_ret:true @@ -213,30 +201,33 @@ module Make (* ------------------------------------------------------------------------ *) (* Assumption. *) - let assume ~with_alarms state stmt expr positive = + let assume state stmt expr positive = let eval, alarms = Eva.reduce state expr positive in (* TODO: check not comparable. *) - Alarmset.emit with_alarms (Kstmt stmt) alarms; + Alarmset.emit (Kstmt stmt) alarms; eval >>- fun valuation -> - Domain.assume stmt expr positive valuation state + TF.assume stmt expr positive valuation state (* ------------------------------------------------------------------------ *) (* Function Calls *) (* ------------------------------------------------------------------------ *) - type res = state list or_bottom * Value_types.cacheable + type call_result = { + states: state list or_bottom; + cacheable: Value_types.cacheable; + } (* Forward reference to [Eval_funs.compute_call] *) let compute_call_ref - : (kinstr -> value call -> Domain.state -> res) ref + : (kinstr -> value call -> Domain.state -> call_result) ref = ref (fun _ -> assert false) let process_call call_kinstr call = function | Compute (Continue state, _) -> Domain.Store.register_initial_state (Value_util.call_stack ()) state; !compute_call_ref call_kinstr call state - | Result (res, cacheable) -> res, cacheable + | Result (states, cacheable) -> { states; cacheable } | _ -> assert false (* TODO! *) (* ------------------- Retro propagation on formals ----------------------- *) @@ -334,21 +325,21 @@ module Make Eva.assume ~valuation state argument.concrete post_value in List.fold_left reduce_one_argument valuation reductions >>-: fun valuation -> - Domain.update valuation state + TF.update valuation state (* -------------------- Treat the results of a call ----------------------- *) (* Treat the assignment of the return value in the caller: if the function has a non-void type, perform the assignment if there is a lvalue at the callsite, and in all cases, remove the pseudo-variable from scope. *) - let treat_return with_alarms ~kf_caller ~kf_callee lv return stmt state = + let treat_return ~kf_callee lv return stmt state = match lv, return with | None, None -> `Value state | None, Some vi_ret -> `Value (Domain.leave_scope kf_callee [vi_ret] state) | Some _, None -> assert false | Some lval, Some vi_ret -> - let exp_ret_caller = Cil.dummy_exp (Lval (Var vi_ret, NoOffset)) in - assign_ret ~with_alarms state kf_caller stmt lval exp_ret_caller + let exp_ret_caller = Value_util.lval_to_exp (Var vi_ret, NoOffset) in + assign_ret state (Kstmt stmt) lval exp_ret_caller >>-: fun state -> Domain.leave_scope kf_callee [vi_ret] state (* ---------------------- Make a one function call ------------------------ *) @@ -365,46 +356,62 @@ module Make Kernel_function.get_formals kf @ locals (* Do the call to one function. *) - let do_one_call with_alarms valuation (kf_caller, stmt) lv call state = + let do_one_call valuation stmt lv call state = let kf_callee = call.kf in + Value_util.push_call_stack kf_callee (Kstmt stmt); + let cleanup () = + Value_util.pop_call_stack (); + (* Changed by compute_call_ref, called from process_call *) + Cil.CurrentLoc.set (Cil_datatype.Stmt.loc stmt); + in (* Choice of the action to performed by the domain. *) - let call_action = Domain.start_call stmt call valuation state in + let call_action = TF.start_call stmt call valuation state in (* Process the call according to the domain decision. *) - let res, cacheable = - try process_call (Kstmt stmt) call call_action + let call_result = + try + let result = process_call (Kstmt stmt) call call_action in + cleanup (); + result with Db.Value.Aborted as e -> - Value_util.pop_call_stack (); InOutCallback.clear (); + cleanup (); raise e in - Value_util.pop_call_stack (); - Cil.CurrentLoc.set (Cil_datatype.Stmt.loc stmt); (* Changed by compute_call_ref *) - cacheable, - res >>- fun result -> + call_result.cacheable, + call_result.states >>- fun result -> let leaving_vars = leaving_vars kf_callee in let pre = state in (* Treat each result one by one. *) - let process_result res = + let process state = (* Gathers the possible reductions on the value of the concrete arguments at the call site, according to the value of the formals at the post state of the called function. This obviously requires the formals to still be in the post_state. *) - gather_reduced_arguments call_action call valuation res + gather_reduced_arguments call_action call valuation state >>- fun reductions -> (* The formals (and the locals) of the called function leave scope. *) - let post = Domain.leave_scope kf_callee leaving_vars res in + let post = Domain.leave_scope kf_callee leaving_vars state in (* Computes the state after the call, from the post state at the end of the called function, and the pre state at the call site. *) - Domain.finalize_call stmt call ~pre ~post >>- fun state -> + TF.finalize_call stmt call ~pre ~post >>- fun state -> (* Backward propagates the [reductions] on the concrete arguments. *) reduce_arguments reductions state >>- fun state -> - treat_return with_alarms ~kf_caller ~kf_callee lv call.return stmt state + treat_return ~kf_callee lv call.return stmt state + and process_recursive state = + (* When the call is recursive, formals have not been added to the + domains. Do not reduce them, and more importantly, do not remove + them from the scope. (Because the instance from the initial, + non-recursive, call are still present.) *) + TF.finalize_call stmt call ~pre ~post:state >>- fun state -> + treat_return ~kf_callee lv call.return stmt state in let states = + let process = if call.recursive then process_recursive else process in List.fold_left - (fun acc return -> Bottom.add_to_list (process_result return) acc) + (fun acc return -> Bottom.add_to_list (process return) acc) [] result in + InOutCallback.clear (); Bottom.bot_of_list states @@ -419,7 +426,7 @@ module Make | Lval lv -> Eva.lvaluate ~for_writing:false ~valuation state lv >>= fun (valuation, loc, _) -> - if Int_Base.is_top (Eva.loc_size loc) + if Int_Base.is_top (Location.size loc) then Value_parameters.abort ~current:true "Function argument %a has unknown size. Aborting" @@ -433,19 +440,14 @@ module Make (* Evaluates the list of the actual arguments of a call. Returns the list of each argument expression associated to its assigned value, and the valuation resulting of the evaluations. *) - let compute_actuals with_alarms ki determinate valuation state arguments = + let compute_actuals determinate valuation state arguments = let process expr acc = acc >>= fun (args, valuation) -> evaluate_actual ~determinate valuation state expr >>=: fun (assigned, valuation) -> (expr, assigned) :: args, valuation in - let eval, alarms = - List.fold_right process arguments (`Value ([], valuation), Alarmset.none) - in - Alarmset.emit with_alarms ki alarms; - eval - + List.fold_right process arguments (`Value ([], valuation), Alarmset.none) (* ------------------------- Make an Eval.call ---------------------------- *) @@ -461,77 +463,213 @@ module Make (* Create an Eval.call *) let create_call kf args = - let formals = Kernel_function.get_formals kf in - let rec format_arguments acc args formals = match args, formals with - | _, [] -> acc, args - | [], _ -> raise InvalidCall - | (concrete, avalue) :: args, formal :: formals -> - let argument = { formal ; concrete; avalue } in - format_arguments (argument :: acc) args formals - in - let arguments, rest = format_arguments [] args formals in - let arguments = List.rev arguments in + let recursive = Recursion.is_recursive_call kf in let return = Library_functions.get_retres_vi kf in - {kf; arguments; rest; return} + let arguments, rest = + if recursive then + (* For recursive calls, we evaluate 'assigns \result \from \nothing' + using a specification. We generate a dummy [call] object in which + formals are not present. This way, domains will not overwrite + the formals of the recursive function (which would be present + in scope twice). *) + [], [] + else + let formals = Kernel_function.get_formals kf in + let rec format_arguments acc args formals = match args, formals with + | _, [] -> acc, args + | [], _ -> raise InvalidCall + | (concrete, avalue) :: args, formal :: formals -> + let argument = { formal ; concrete; avalue } in + format_arguments (argument :: acc) args formals + in + let arguments, rest = format_arguments [] args formals in + let arguments = List.rev arguments in + arguments, rest + in + {kf; arguments; rest; return; recursive} - let make_call with_alarms kf ki arguments valuation state = + let make_call kf arguments valuation state = (* Evaluate the arguments of the call. *) let determinate = is_determinate kf in - compute_actuals with_alarms ki determinate valuation state arguments - >>-: fun (args, valuation) -> + compute_actuals determinate valuation state arguments + >>=: fun (args, valuation) -> let call = create_call kf args in call, valuation + (* ----------------- show_each and dump_each directives ------------------- *) + + let extract_cvalue = match Domain.get Cvalue_domain.key with + | None -> fun _ -> Cvalue.Model.top + | Some get -> get + + (* The product of domains formats the printing of each leaf domains, by + checking their log_category and adding their name before the dump. If the + domain is not a product, this needs to be done here. *) + let print_state = + if Domain.log_category = Domain_product.product_category + then Domain.pretty + else if Value_parameters.is_debug_key_enabled Domain.log_category + then + fun fmt state -> + Format.fprintf fmt "# %s:@ @[<hv>%a@]@ " Domain.name Domain.pretty state + else fun _ _ -> () + + (* Frama_C_dump_each functions. *) + let dump_state name state = + Value_parameters.result ~current:true + "%s:@\n@[<v>%a@]==END OF DUMP==%t" + name print_state state Value_util.pp_callstack + + (* Idem as for [print_state]. *) + let show_expr = + if Domain.log_category = Domain_product.product_category + then TF.show_expr + else if Value_parameters.is_debug_key_enabled Domain.log_category + then + fun valuation state fmt exp -> + Format.fprintf fmt "# %s: @[<hov>%a@]" + Domain.name (TF.show_expr valuation state) exp + else fun _ _ _ _ -> () + + (* Frama_C_domain_show_each functions. *) + let domain_show_each name arguments state = + let pretty fmt expr = + let pp fmt = + match fst (Eva.evaluate state expr) with + | `Bottom -> Format.fprintf fmt "%s" (Unicode.bottom_string ()) + | `Value (valuation, _value) -> show_expr valuation state fmt expr + in + Format.fprintf fmt "%a : @[<h>%t@]" Printer.pp_exp expr pp + in + let pp = Pretty_utils.pp_list ~pre:"@[<v>" ~sep:"@ " ~suf:"@]" pretty in + Value_parameters.result ~current:true + "@[<v>%s:@ %a@]%t" + name pp arguments Value_util.pp_callstack + + (* For non scalar expressions, prints the offsetmap of the cvalue domain. *) + let show_offsm = + match Domain.get Cvalue_domain.key, Location.get Main_locations.ploc_key with + | None, _ | _, None -> + fun fmt _ _ -> Format.fprintf fmt "%s" (Unicode.top_string ()) + | Some get_cvalue, Some get_ploc -> + fun fmt expr state -> + match expr.enode with + | Lval lval -> + begin + try + let offsm = + fst (Eva.lvaluate ~for_writing:false state lval) + >>- fun (_, loc, _) -> + let ploc = get_ploc loc + and cvalue_state = get_cvalue state in + Eval_op.offsetmap_of_loc ploc cvalue_state + in + let typ = Cil.typeOf expr in + (Bottom.pretty (Eval_op.pretty_offsetmap typ)) fmt offsm + with Abstract_interp.Error_Top -> + Format.fprintf fmt "%s" (Unicode.top_string ()) + end + | _ -> assert false + + (* For scalar expressions, prints the cvalue component of their values. *) + let show_value = + match Value.get Main_values.cvalue_key with + | None -> fun fmt _ _ -> Format.fprintf fmt "%s" (Unicode.top_string ()) + | Some get_cval -> + fun fmt expr state -> + let value = fst (Eva.evaluate state expr) >>-: snd >>-: get_cval in + (Bottom.pretty Cvalue.V.pretty) fmt value + + (* Frama_C_show_each functions. *) + let show_each name arguments state = + let pretty fmt expr = + if Cil.isArithmeticOrPointerType (Cil.typeOf expr) + then show_value fmt expr state + else show_offsm fmt expr state + in + let pp = Pretty_utils.pp_list ~pre:"@[<hv>" ~sep:",@ " ~suf:"@]" pretty in + Value_parameters.result ~current:true + "@[<hv>%s:@ %a@]%t" + name pp arguments Value_util.pp_callstack + + (** Applies the show_each or dump_each directives. *) + let apply_special_directives kf arguments state = + let name = Kernel_function.get_name kf in + if Ast_info.can_be_cea_function name + then + if Ast_info.is_cea_dump_function name + then (dump_state name state; true) + else if Ast_info.is_cea_function name + then (show_each name arguments state; true) + else if Ast_info.is_cea_domain_function name + then (domain_show_each name arguments state; true) + else false + else false + + (* Legacy callbacks for the cvalue domain, usually called by + {Cvalue_transfer.start_call}. *) + let apply_cvalue_callback kf ki_call state = + let stack_with_call = (kf, ki_call) :: Value_util.call_stack () in + let cvalue_state = extract_cvalue state in + Db.Value.Call_Value_Callbacks.apply (cvalue_state, stack_with_call); + Db.Value.merge_initial_state (Value_util.call_stack ()) cvalue_state; + let result = + { Value_types.c_values = [ None, cvalue_state] ; + c_clobbered = Base.SetLattice.bottom; + c_from = None; + c_cacheable = Value_types.Cacheable; + } + in + Db.Value.Call_Type_Value_Callbacks.apply + (`Builtin result, cvalue_state, stack_with_call) + + (* --------------------- Process the call statement ---------------------- *) (* We cannot statically check that a call through a function pointer is correct wrt the number of arguments and their types (see the examples at the end of tests/misc/fun_ptr.i). Thus, we make additional checks here. *) - let check_call call = + let check_formals_types call = let check_one_formal arg = let expr = arg.concrete and formal = arg.formal in try Cil.bitsSizeOf (Cil.typeOf expr) = Cil.bitsSizeOf (formal.vtype) with Cil.SizeOfError _ -> false in - if Warn.check_no_recursive_call call.kf - then - if List.for_all check_one_formal call.arguments - then () - else raise InvalidCall - else - (* TODO: recursive call. *) - Value_parameters.abort ~current:true ~once:true - "Recursive call to a function." + if not (List.for_all check_one_formal call.arguments) then + raise InvalidCall - let call ~with_alarms stmt lval_option funcexp arguments state = + let call stmt lval_option funcexp arguments state = let ki_call = Kstmt stmt in let cacheable = ref Value_types.Cacheable in let eval = (* Resolve [funcexp] into the called kernel functions. *) let functions, alarms = Eva.eval_function_exp funcexp state in - Alarmset.emit with_alarms ki_call alarms; + Alarmset.emit ki_call alarms; functions >>- fun functions -> let current_kf = Value_util.current_kf () in let process_one_function kf valuation = - (* Create the call. *) - make_call with_alarms kf ki_call arguments valuation state - >>- fun (call, valuation) -> - (* Check the call. *) - check_call call; - (* Register the call. *) - Value_results.add_kf_caller call.kf ~caller:(current_kf, stmt); - Value_util.push_call_stack call.kf (Kstmt stmt); - (* Do the call. *) - let c, states = - do_one_call with_alarms valuation (current_kf, stmt) - lval_option call state - in - InOutCallback.clear (); - (* If needed, propagate that callers cannot be cached. *) - if c = Value_types.NoCacheCallers then - cacheable := Value_types.NoCacheCallers; - states + (* The special Frama_C_ functions to print states are handled here. *) + if apply_special_directives kf arguments state + then + let () = apply_cvalue_callback kf ki_call state in + `Value ([state]) + else + (* Create the call. *) + let eval, alarms = make_call kf arguments valuation state in + Alarmset.emit ki_call alarms; + eval >>- fun (call, valuation) -> + (* Check that formals are properly typed. raise [InvalidCall] + otherwise. *) + check_formals_types call; + (* Register the call. *) + Value_results.add_kf_caller call.kf ~caller:(current_kf, stmt); + (* Do the call. *) + let c, states = do_one_call valuation stmt lval_option call state in + (* If needed, propagate that callers cannot be cached. *) + if c = Value_types.NoCacheCallers then + cacheable := Value_types.NoCacheCallers; + states in (* Process each possible function apart, and append the result list. *) let process acc (kf, valuation) = @@ -540,10 +678,8 @@ module Make (Bottom.list_of_bot res) @ acc with | InvalidCall -> - Value_util.warning_once_current - "Function type must match type at call site: \ - assert(function type matches)"; - Value_util.stop_if_stop_at_first_alarm_mode (); + let alarm = Alarmset.singleton (Alarms.Function_pointer funcexp) in + Alarmset.emit ki_call alarm; acc in let states_list = List.fold_left process [] functions in @@ -582,7 +718,7 @@ module Make (* Not currently taking advantage of calls information. But see plugin Undefined Order by VP. *) - let check_unspecified_sequence ~with_alarms stmt state seq = + let check_unspecified_sequence stmt state seq = let rec check_one_stmt ((stmt1, _, writes1, _, _) as stmt) = function | [] -> `Value (), Alarmset.none | (stmt2, _, _, _, _) :: seq when stmt1 == stmt2 -> check_one_stmt stmt seq @@ -608,7 +744,7 @@ module Make (`Value (), Alarmset.none) seq in - Alarmset.emit with_alarms (Kstmt stmt) alarms; + Alarmset.emit (Kstmt stmt) alarms; res end diff --git a/src/plugins/value/engine/transfer_stmt.mli b/src/plugins/value/engine/transfer_stmt.mli index 3e15f872a09899ea47c17692810d43e8394e212d..15554215797a200b86245b6f940f6a7f4dae2530 100644 --- a/src/plugins/value/engine/transfer_stmt.mli +++ b/src/plugins/value/engine/transfer_stmt.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,13 +30,11 @@ module type S = sig type state type value - val assign: with_alarms:CilE.warn_mode -> - state -> kernel_function -> stmt -> lval -> exp -> state or_bottom + val assign: state -> kinstr -> lval -> exp -> state or_bottom - val assume: with_alarms:CilE.warn_mode -> - state -> stmt -> exp -> bool -> state or_bottom + val assume: state -> stmt -> exp -> bool -> state or_bottom - val call: with_alarms:CilE.warn_mode -> + val call: stmt -> lval option -> exp -> exp list -> state -> state list or_bottom * Value_types.cacheable @@ -44,34 +42,29 @@ module type S = sig kernel_function -> exp -> Integer.t list -> state list -> state list list val check_unspecified_sequence: - with_alarms:CilE.warn_mode -> Cil_types.stmt -> state -> (* TODO *) (stmt * lval list * lval list * lval list * stmt ref list) list -> unit or_bottom - type res = state list or_bottom * Value_types.cacheable + type call_result = { + states: state list or_bottom; + cacheable: Value_types.cacheable; + } - val compute_call_ref: (kinstr -> value call -> state -> res) ref -end - -module type Domain = sig - include Abstract_domain.Transfer - val leave_scope: kernel_function -> varinfo list -> state -> state - module Store: Abstract_domain.Store with type state := state - include Datatype.S with type t = state + val compute_call_ref: (kinstr -> value call -> state -> call_result) ref end module Make - (Value: Abstract_value.S) + (Value: Abstract_value.External) (Location: Abstract_location.External) - (Domain: Domain with type value = Value.t - and type location = Location.location) + (Domain: Abstract_domain.External with type value = Value.t + and type location = Location.location) (Eva: Evaluation.S with type state = Domain.state and type value = Domain.value and type loc = Domain.location - and type Valuation.t = Domain.valuation) + and type origin = Domain.origin) : S with type state = Domain.state and type value = Domain.value diff --git a/src/plugins/value/eval.ml b/src/plugins/value/eval.ml index 635dcd1d793ef70075accd40fc312fb2322c5072..34f3e127dea061a6b11d89dba4b470f4e1ab50f1 100644 --- a/src/plugins/value/eval.ml +++ b/src/plugins/value/eval.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,6 +31,7 @@ open Cil_types include Bottom.Type type 'a or_top = [ `Value of 'a | `Top ] +type 'a or_top_or_bottom = [ `Value of 'a | `Top | `Bottom ] (* -------------------------------------------------------------------------- *) (** {2 Types for the evaluations } *) @@ -66,7 +67,6 @@ type 'a reduced = [ `Bottom | `Unreduced | `Value of 'a ] expressions needed to create the appropriate alarms. *) type unop_context = { operand: exp; - result: exp; } (** Context for the evaluation of a binary operator: contains the expressions @@ -76,7 +76,6 @@ type binop_context = { left_operand: exp; right_operand: exp; binary_result: exp; - result_typ: typ } @@ -98,6 +97,32 @@ type 'a flagged_value = { escaping: bool; } +module Flagged_Value = struct + + let bottom = {v = `Bottom; initialized=true; escaping=false; } + let equal equal v1 v2 = + Bottom.equal equal v1.v v2.v && + v1.initialized = v2.initialized && v1.escaping = v2.escaping + let join join v1 v2 = + { v = Bottom.join join v1.v v2.v; + initialized = v1.initialized && v2.initialized; + escaping = v1.escaping || v2.escaping } + + let pretty_flags fmt value = match value.initialized, value.escaping with + | false, true -> Format.pp_print_string fmt "UNINITIALIZED or ESCAPINGADDR" + | false, false -> Format.pp_print_string fmt "UNINITIALIZED" + | true, true -> Format.pp_print_string fmt "ESCAPINGADDR" + | true, false -> Format.pp_print_string fmt "BOTTOM" + + let pretty pp fmt value = match value.v with + | `Bottom -> pretty_flags fmt value + | `Value v -> + if value.initialized && not value.escaping + then pp fmt v + else Format.fprintf fmt "%a or %a" pp v pretty_flags value + +end + (* Data record associated to each evaluated expression. *) type ('a, 'origin) record_val = { value : 'a flagged_value; (* The resulting abstract value *) @@ -165,14 +190,14 @@ let compute_englobing_subexpr ~subexpr ~expr = Extlib.opt_conv [] (compute expr) module Englobing = - Datatype.Pair_with_collections (Cil_datatype.Exp) (Cil_datatype.Exp) + Datatype.Pair_with_collections (Cil_datatype.ExpStructEq) (Cil_datatype.ExpStructEq) (struct let module_name = "Subexpressions" end) module SubExprs = Datatype.List (Cil_datatype.Exp) module EnglobingSubexpr = State_builder.Hashtbl (Englobing.Hashtbl) (SubExprs) (struct - let name = "Englobing_subexpressions" + let name = "Value.Eval.Englobing_subexpressions" let size = 32 let dependencies = [ Ast.self ] end) @@ -230,6 +255,7 @@ type 'value call = { arguments: 'value argument list; rest: (exp * 'value assigned) list; return: varinfo option; + recursive: bool; } (* Initialization of a dataflow analysis, by defining the initial value of diff --git a/src/plugins/value/eval.mli b/src/plugins/value/eval.mli index 7404b61fd3e69ab1d02d6dff17f2a86d8f2373df..4603979dfa0b3edb7f9eab6be3714b5ee1be099f 100644 --- a/src/plugins/value/eval.mli +++ b/src/plugins/value/eval.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -37,6 +37,8 @@ include module type of Bottom.Type is managed separately. *) type 'a or_top = [ `Value of 'a | `Top ] +type 'a or_top_or_bottom = [ `Value of 'a | `Top | `Bottom ] + (* -------------------------------------------------------------------------- *) (** {2 Types for the evaluations } *) @@ -74,7 +76,6 @@ type 'a reduced = [ `Bottom | `Unreduced | `Value of 'a ] expressions needed to create the appropriate alarms. *) type unop_context = { operand: exp; - result: exp; } (** Context for the evaluation of a binary operator: contains the expressions @@ -84,7 +85,6 @@ type binop_context = { left_operand: exp; right_operand: exp; binary_result: exp; - result_typ: typ; } @@ -134,6 +134,19 @@ type 'a flagged_value = { escaping: bool; } +module Flagged_Value : sig + val bottom: 'a flagged_value + val equal: + ('a -> 'a -> bool) -> + 'a flagged_value -> 'a flagged_value -> bool + val join: + ('a -> 'a -> 'a) -> + 'a flagged_value -> 'a flagged_value -> 'a flagged_value + val pretty: + (Format.formatter -> 'a -> unit) -> + Format.formatter -> 'a flagged_value -> unit +end + (** Data record associated to each evaluated expression. *) type ('a, 'origin) record_val = { value: 'a flagged_value; (** The resulting abstract value *) @@ -216,6 +229,7 @@ type 'value call = { rest: (exp * 'value assigned) list; (** Extra-arguments. *) return: varinfo option; (** Fake varinfo to store the return value of the call. *) + recursive: bool; } (** Initialization of a dataflow analysis, by defining the initial value of diff --git a/src/plugins/value/gen_test_config.sh b/src/plugins/value/gen_test_config.sh new file mode 100755 index 0000000000000000000000000000000000000000..128b413acd0d348bc21ba0604288953db6f93162 --- /dev/null +++ b/src/plugins/value/gen_test_config.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# This scripts creates the ptests config files for the alternative testing +# configurations of Eva. You must create the tests/test_config and +# tests/non-free/test_config yourselves. The other files are created +# accordingly. The syntax for the root test_config files is as follows +# (2 lines): +# +# MACRO: VALUECONFIG <options inherited in all tests> +# OPT: @VALUECONFIG@ <default options, inherited in tests that use STDOPT> + +# All tested domains +declare -a domains=( + "apron" + "bitwise" + "equalities" + "gauges" + "symblocs" +) +# Option(s) corresponding to each domain +declare -a opts=( + "-eva-apron-oct -value-msg-key experimental-ok" + "-eva-bitwise-domain" + "-eva-equality-domain" + "-eva-gauges-domain" + "-eva-symbolic-locations-domain" +) + +arraylength=${#domains[@]} + +cd tests +CUR=`pwd` + +#TODO: générer le test_config de non-free à partir de celui racine ? + +for A in . non-free +do + cd $CUR/$A + + for (( i=0; i<${arraylength}; i++ )); + do + echo "`head -1 test_config` ${opts[$i]}" > test_config_${domains[$i]} + tail -1 test_config >> test_config_${domains[$i]} + done +done diff --git a/src/plugins/value/gui_files/gui_callstacks_filters.ml b/src/plugins/value/gui_files/gui_callstacks_filters.ml index d33536d55b0e9898a58fbde1ac0983cd7640a655..0cd1aa9ce2b6357f8a9d23d317e7d94c78bc756d 100644 --- a/src/plugins/value/gui_files/gui_callstacks_filters.ml +++ b/src/plugins/value/gui_files/gui_callstacks_filters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -51,73 +51,85 @@ let callsite_matches csf stmt = | None -> true | Some lrcs -> List.exists (callsite_matches_callstack stmt) lrcs -let is_reachable_stmt csf stmt = - match csf with - | None -> Db.Value.is_reachable_stmt stmt - | Some _ as csf -> +let focus = ref None +let focused_callstacks () = !focus +let focus_on_callstacks cs = focus := cs + +let has_matching_callstack ~after csf stmt = + let module Results = (val Analysis.current_analyzer ()) in + match Results.get_stmt_state_by_callstack ~after stmt with + | `Top -> true + | `Bottom -> false + | `Value h -> try - let h = Db.Value.Table_By_Callstack.find stmt in Value_types.Callstack.Hashtbl.iter - (fun cs' state -> + (fun cs' _state -> let rcs' = from_callstack cs' in - if callstack_matches csf rcs' && Db.Value.is_reachable state - then raise Exit + if callstack_matches csf rcs' then raise Exit ) h; false with - | Not_found -> false | Exit -> true -exception Terminates +let is_reachable_stmt csf stmt = + has_matching_callstack ~after:false csf stmt (* Called only when the statement is reachable *) let is_non_terminating_instr csf stmt = - match csf with - | None -> Value_results.is_non_terminating_instr stmt - | Some _ as csf -> + not (has_matching_callstack ~after:true csf stmt) + + +(* The two functions below depends on the abstractions used in the Eva analysis, + but must be registered only once through the Dynamic module. We thus use + references to the function, that are changed by the Make functor. *) +let lval_to_zone_callstacks_ref = ref (fun _ _ _ -> Locations.Zone.top) +let tlval_to_zone_callstacks_ref = ref (fun _ _ _ -> Locations.Zone.top) + +exception Top + +let register_to_zone_functions (module Eval: Gui_eval.S) = + (* This function evaluates [v] using [ev] at [stmt] (in the pre-state), but + only for the callstacks matching [csf]. *) + let eval_filter csf stmt ev v = + match Eval.Analysis.get_stmt_state_by_callstack ~after:false stmt with + | `Value h -> + Value_types.Callstack.Hashtbl.fold + (fun cs state acc -> + let rcs' = from_callstack cs in + if callstack_matches csf rcs' then + let env = ev.Eval.env state cs in + let r, _ = ev.Eval.eval_and_warn env v in + ev.Eval.join acc r + else acc + ) h ev.Eval.bottom + | `Bottom -> ev.Eval.bottom + | `Top -> raise Top + in + let lval_to_zone_callstacks csf stmt lv = + try eval_filter csf stmt Eval.lval_zone_ev lv + with Top -> Locations.Zone.top + and tlval_to_zone_callstacks csf stmt tlv = try - let h = Db.Value.AfterTable_By_Callstack.find stmt in - Value_types.Callstack.Hashtbl.iter - (fun cs' state -> - if Cvalue.Model.is_reachable state && - callstack_matches csf (from_callstack cs') - then raise Terminates - ) h; - true - with - | Not_found -> true - | Terminates -> false - -(* This function evaluates [v] using [ev] at [stmt] (in the pre-state), but - only for the callstacks matching [csf]. *) -let eval_filter csf stmt ev v = - try - let h = Db.Value.Table_By_Callstack.find stmt in - Value_types.Callstack.Hashtbl.fold - (fun cs state acc -> - let rcs' = from_callstack cs in - if callstack_matches csf rcs' then - let env = ev.Gui_eval.env state cs in - let r, _ = ev.Gui_eval.eval_and_warn env v in - ev.Gui_eval.join acc r - else acc - ) h ev.Gui_eval.bottom - with - | Not_found -> ev.Gui_eval.bottom - -let lval_to_zone_callstacks csf stmt lv = - eval_filter csf stmt Gui_eval.lval_zone_ev lv - -let tlval_to_zone_callstacks csf stmt tlv = - let kf = Kernel_function.find_englobing_kf stmt in - let ev = Gui_eval.tlval_zone_ev (Gui_types.GL_Stmt (kf, stmt)) in - eval_filter csf stmt ev tlv - -let set_callstacks_filter = - let lcs = ref None in + let kf = Kernel_function.find_englobing_kf stmt in + let ev = Eval.tlval_zone_ev (Gui_types.GL_Stmt (kf, stmt)) in + eval_filter csf stmt ev tlv + with Top -> Locations.Zone.top + in + lval_to_zone_callstacks_ref := lval_to_zone_callstacks; + tlval_to_zone_callstacks_ref := tlval_to_zone_callstacks + +(* Register evaluation functions that depend on the currently focused + callstacks. *) +let () = let open Cil_datatype in - let lval_to_zone_gui stmt lv = lval_to_zone_callstacks !lcs stmt lv in - let tlval_to_zone_gui stmt tlv = tlval_to_zone_callstacks !lcs stmt tlv in + let lval_to_zone_gui stmt lv = + let filter = focused_callstacks () in + !lval_to_zone_callstacks_ref filter stmt lv + in + let tlval_to_zone_gui stmt tlv = + let filter = focused_callstacks () in + !tlval_to_zone_callstacks_ref filter stmt tlv + in let _eval_lv = Dynamic.register ~comment:"Evaluation of a l-value on the callstacks focused in the GUI" @@ -132,4 +144,4 @@ let set_callstacks_filter = (Datatype.func2 Stmt.ty Term.ty Locations.Zone.ty) ~journalize:false tlval_to_zone_gui in - (fun l -> lcs := l) + () diff --git a/src/plugins/value/gui_files/gui_callstacks_filters.mli b/src/plugins/value/gui_files/gui_callstacks_filters.mli index eba2d1914f6e70fab1b1d11879eefa175c2c9427..5bba8db88cd60abb5564584d565309f320ba0717 100644 --- a/src/plugins/value/gui_files/gui_callstacks_filters.mli +++ b/src/plugins/value/gui_files/gui_callstacks_filters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,9 +34,18 @@ type filter = rcallstack list option val callstack_matches: filter -> rcallstack -> bool val callsite_matches: filter -> Cil_types.stmt -> bool + +(* Callstacks currently being focused. *) +val focused_callstacks: unit -> filter + +(* Focuses on the given callstacks. *) +val focus_on_callstacks: filter -> unit + val is_reachable_stmt: filter -> Cil_types.stmt -> bool val is_non_terminating_instr: filter -> Cil_types.stmt -> bool -(** This function must be called when callstacks are focused. The callstacks - are used by some dynamic functions like [lval_to_zone_gui] *) -val set_callstacks_filter: filter -> unit +(* This function must be called each time a new Gui_eval.S is built over the + abstractions used for an Eva analysis. It registers the two functions + [lval_to_zone_gui] and [tlval_to_zone_gui], that depend on the abstractions + used by the analysis and on the focused callstacks. *) +val register_to_zone_functions : (module Gui_eval.S) -> unit diff --git a/src/plugins/value/gui_files/gui_callstacks_manager.ml b/src/plugins/value/gui_files/gui_callstacks_manager.ml new file mode 100644 index 0000000000000000000000000000000000000000..fc56785594bbcba03829c8f72481f538ab235eae --- /dev/null +++ b/src/plugins/value/gui_files/gui_callstacks_manager.ml @@ -0,0 +1,1041 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Gui_types + +type main_ui = Design.main_window_extension_points + +type 'v data_by_callstack = + (gui_callstack * 'v Gui_eval.gui_selection_data) list + +type 'v display_data_by_callstack = + gui_loc -> gui_selection -> 'v data_by_callstack -> unit + +module type Input = sig + include Gui_types.S + + val make_data_for_lvalue : + Cil_types.lval -> gui_loc -> value data_by_callstack +end + + +let rec list_assoc f e = function + | [] -> raise Not_found + | (e', v) :: q -> if f e e' then v else list_assoc f e q + +let rec list_mem f e = function + | [] -> false + | e' :: q -> f e e' || list_mem f e q + +let rec list_remove f e = function + | [] -> [] + | e' :: q -> if f e e' then list_remove f e q else e' :: list_remove f e q + +let rec list_mem_assoc f e = function + | [] -> false + | (e', _) :: q -> f e e' || list_mem_assoc f e q + + +(* Selection of a row; [RSelectedCallstackCol] corresponds to the fact + that both the row _and_ the 'Callstacks' column are selected. *) +type row_selected = RUnselected | RSelected | RSelectedCallstackCol + +(* Information shown in a single row *) +type 'value row = { + callstack: gui_callstack; + rev_callstack: Gui_callstacks_filters.rcallstack (* cache *); + mutable exprs: (gui_selection * 'value Gui_eval.gui_selection_data) list +(* if a column exists in the view, it expects to find some data for + itself in each row here. *); + mutable selected: row_selected; +} + +let row_unfocused () = { + callstack = GC_Filtered; + rev_callstack = Gui_callstacks_filters.empty; + exprs = []; + selected = RUnselected; +} + +type 'value rows = 'value row GCallstackMap.t + +let find_data row expr = + try list_assoc gui_selection_equal expr row.exprs + with Not_found -> + (* should happen only for the "results hidden" special row, and + in case of an evaluation error *) + Gui_eval.gui_selection_data_empty + +let (!!) = Lazy.force + +let add_expr_to_row row expr data = + if not (list_mem_assoc gui_selection_equal expr row.exprs) then + row.exprs <- (expr, data) :: row.exprs + +let add_data_to_rows rows callstack expr data = + try + let cur_row = GCallstackMap.find callstack rows in + add_expr_to_row cur_row expr data; + rows + with Not_found -> + let row = { + callstack; exprs = []; selected = RUnselected; + rev_callstack = (match callstack with + | GC_Consolidated | GC_Filtered -> Gui_callstacks_filters.empty + | GC_Single s | GC_Callstack s -> + Gui_callstacks_filters.from_callstack s); + } in + add_expr_to_row row expr data; + GCallstackMap.add callstack row rows + +type 'value filter_column = + | FilterAlarm of bool + | FilterBefore of 'value gui_res + | FilterAfter of 'value gui_after + +type 'value filter = gui_selection * bool * 'value filter_column + +let rec remove_filter e : 'v filter list -> _ = function + | [] -> [] + | (e', _, _ as hd) :: q as l -> + let q' = remove_filter e q in + if gui_selection_equal e e' then q' else if q == q' then l else hd :: q' + +module GColumn = struct + type t = GTree.view_column + let hash c = c#misc#get_oid + let equal c1 c2 = (c1#misc#get_oid = c2#misc#get_oid) +end + +(* Hash tables indexed by GTree columns *) +module HColumns = FCHashtbl.Make(GColumn) + +(* Description of the columns of the widget. The [gui_selection] information + refers to what the column is displaying *) +type column_type = + | CCallstack + | CBefore of gui_selection + | CAfter of gui_selection + | CAlarm of gui_selection + | CEmpty (* empty column at the end, for aesthetic purposes *) + +let equal_column_type ct1 ct2 = match ct1, ct2 with + | CCallstack, CCallstack | CEmpty, CEmpty -> true + | CBefore e1, CBefore e2 | CAfter e1, CAfter e2 | CAlarm e1, CAlarm e2 -> + gui_selection_equal e1 e2 + | _ -> false + +(* This is an hybrid between the model and the view. *) +type 'value model = { + mutable loc: gui_loc option (* model: loc which is being visualized *); + mutable all_exprs: gui_selection list (* G expressions that are currently + being displayed *); + mutable columns_type: (column_type * (filtered:bool -> unit)) HColumns.t +(* mapping from GTK columns to the data they display, plus a function + whose argument indicates whether the column is filtered *); + mutable rows: 'value rows (* model: rows to display. Sorted, unfiltered + (the view does the filtering *); + mutable row_selected: (int * 'value row) option (* view: row currently selected *); + mutable focused_rev_callstacks: Gui_callstacks_filters.filter +(* reverse of the callstacks currently being focused. On all tabs, + the focused callstacks are the only ones that are shown. On the + 'Selection' tab, they are also used to refine the states that + are being shown, as well as 'go to callers', etc. *); + mutable filters: 'value filter list; + mutable full_callstacks_height: bool (* Set to 'true' to expand rows so + that the entire callstacks are shown *); + mutable show_consolidated: bool (* show results in consolidated state *); + mutable show_by_callstacks: bool (* show results by callstacks *); + mutable hidden_columns: column_type list (* columns hidden by the user *); +} + +(* Is there a filter on the column? *) +let column_has_filter model col_type = + match col_type with + | CEmpty -> false + | CCallstack -> model.focused_rev_callstacks <> None + | CBefore e | CAfter e | CAlarm e -> + let has (e', _, f) = + gui_selection_equal e e' && + (match f, col_type with + | FilterBefore _, CBefore _ | FilterAfter _, CAfter _ + | FilterAlarm _, CAlarm _ -> true + | _ -> false) + in + List.exists has model.filters + + +class type ['value] cm_panel = object + method model: 'value model + + method start_session: gui_loc -> multiple:bool -> unit + (* clear the model, except in "multiple" view, in which case multiple + localizable on the same location are stacked *) + + method add_data: + gui_selection -> gui_callstack -> 'value Gui_eval.gui_selection_data -> unit + + method render_session: unit -> unit + (* display the current model, taking current filter settings into account *) + + method clear: unit -> unit (* reset both model and widget *) + + method expand_row_for_callstacks: bool -> unit + method show_consolidated: bool -> unit + method show_by_callstacks: bool -> unit + (* These three methods are called by the 'Values' panel when the + corresponding checkboxes are set or unset *) + + method clone: 'value model -> unit +end + +(* Fetch the internal (hidden) GtkButton of the column header. *) +let get_column_header_button (col: GTree.view_column) = + let rec get_button = function + | None -> None + | Some w -> + if w#misc#get_type = "GtkButton" + then + let but_props = GtkButtonProps.Button.cast w#as_widget in + Some (new GButton.button but_props) + else get_button w#misc#parent + in + get_button col#widget + +let show_icon (icon: GMisc.image) = fun ~filtered -> match filtered with + | true -> icon#misc#show () + | false -> icon#misc#hide () + + +module Make (Input: Input) = struct + type value = Input.value + + let pretty_filter_column fmt = function + | FilterAlarm b -> Format.fprintf fmt "%s" (if b then "!" else " ") + | FilterBefore r -> Format.fprintf fmt "%a" Input.pretty_gui_res r + | FilterAfter r -> Format.fprintf fmt "%a" Input.pretty_gui_after r + + let data_matches_filter data pos col = + let ok = + match col with + | FilterAlarm a -> data.Gui_eval.alarm = a + | FilterBefore r -> Input.equal_gui_res r data.Gui_eval.before + | FilterAfter r -> Input.equal_gui_after r data.Gui_eval.after + in + if pos then ok else not ok + + let row_matches_filter row (expr, pos, col: value filter) = + try + let data = list_assoc gui_selection_equal expr row.exprs in + data_matches_filter data pos col + with Not_found -> (* should not happen *) false + + let filters_match row filters = + List.for_all (row_matches_filter row) filters + + module Data = Indexer.Make( + struct + type t = int * value row + let compare (x,_) (y,_) = Pervasives.compare x y + end) + + (* This function creates a single GTree that displays per-callstack + results *) + let make_panel (main_ui:main_ui) ~callback_focus_callstack ~show_consolidated ~show_by_callstacks ~full_callstacks_height = + let gtk_model = + object(self) + val mutable m = Data.empty + val mutable age = 0 + method data = m + method size = Data.size m + method index i = Data.index i m + method get i = Data.get i m + method add i = age<-age+1; m <- Data.add (age,i) m;age,i + method reload = age<-0; m <- Data.empty + method coerce = (self:> (int * value row) Wtable.listmodel) + end + in + let frame = GBin.frame ~shadow_type:`ETCHED_OUT () in + let w = new Wtable.list + ~packing:frame#add ~headers:true ~rules:true gtk_model#coerce + in + w#view#set_fixed_height_mode false; + let model = { + loc = None; rows = GCallstackMap.empty; + row_selected = None; focused_rev_callstacks = None; filters = []; + full_callstacks_height; all_exprs = []; + columns_type = HColumns.create 8; show_by_callstacks; + show_consolidated; hidden_columns = []; + } in + let row_is_visible row = + match row.callstack, + model.show_consolidated, + model.show_by_callstacks, + model.focused_rev_callstacks + with + | GC_Consolidated, false, _, _ + | GC_Callstack _, _, false, _ + | GC_Single _, false, false, _ + | GC_Consolidated, _, _, Some _ -> false + | (GC_Single _ | GC_Callstack _), _, _, (Some _ as cs') -> + Gui_callstacks_filters.callstack_matches cs' row.rev_callstack && + filters_match row model.filters + | _ -> filters_match row model.filters + in + (* Context menu to hide and show columns *) + let filter_menu (menu: GMenu.menu Lazy.t) = + let process column (col_type, _icon) = + try + let txt = match col_type with + | CBefore e -> + Format.asprintf "'%a' (before)" pretty_gui_selection e + | CAfter e -> + Format.asprintf "'%a' (after)" pretty_gui_selection e + | CAlarm e -> + Format.asprintf "'%a' (alarms)" pretty_gui_selection e + | CCallstack | CEmpty -> raise Not_found + in + if column#visible || + list_mem equal_column_type col_type model.hidden_columns + then + let show = GMenu.check_menu_item ~label:txt () in + show#set_show_toggle true; + show#set_active column#visible; + (* Hide this column. Keep it alive for filters and co. *) + let callback_show_hide () = + if column#visible then begin + model.hidden_columns <- col_type :: model.hidden_columns; + column#set_visible false + end else begin + model.hidden_columns <- + list_remove equal_column_type col_type model.hidden_columns; + column#set_visible true + end; + in + ignore (show#connect#activate callback_show_hide); + (!!menu)#add (show :> GMenu.menu_item); + with Not_found -> () + in + HColumns.iter process model.columns_type; + in + (* Add a custom title to the column: a text, an icon indicating that + the column is filtered, and a tooltip. Returns the filter icon *) + let add_column_header (col: GTree.view_column) text tooltip = + col#set_min_width 25; + col#set_clickable true; + let h = GPack.hbox () in + let _lbl = GMisc.label ~text ~packing:h#pack () in + let icon = GMisc.image ~xpad:10 ~stock:`COLOR_PICKER ~packing:h#pack () in + icon#misc#hide (); + let tooltip_before = GData.tooltips () in + tooltip_before#set_tip ~text:tooltip h#coerce; + (* set_widget forces Gtk to create a header button for the view_column. *) + col#set_widget (Some h#coerce); + icon + in + let add_column_header_callback col mk_menu = + let pop_menu () = + let menu = lazy (GMenu.menu ()) in + List.iter (fun elem -> elem menu) mk_menu; + if Lazy.is_val menu then begin + let time = GtkMain.Main.get_current_event_time () in + (!!menu)#popup ~button:3 ~time + end + in + match get_column_header_button col with + | None -> ignore (col#connect#clicked pop_menu) (* TODO: warn *) + | Some button -> + (* Connect the callback to a right-click *) + let callback evt = + if GdkEvent.Button.button evt = 3 then begin + pop_menu (); true + end else false + in + ignore (button#event#connect#button_release ~callback) + in + let col_callstack = + w#add_column_text ~title:"Callstack" [`YALIGN 0.0] + (fun (_,{callstack=stack; selected}) -> + let height = + if selected <> RUnselected || model.full_callstacks_height + then -1 else 1 + in + let text = match stack with + | GC_Filtered -> [`TEXT "filters active"; `STYLE `ITALIC] + | GC_Consolidated -> [`TEXT "all"; `STYLE `ITALIC] + | GC_Single stack | GC_Callstack stack -> + let pp_text = if selected = RSelectedCallstackCol + then Pretty_utils.to_string pretty_callstack + else Pretty_utils.to_string ~margin:50 pretty_callstack_short + in + [`TEXT (pp_text stack); `STYLE `NORMAL] + in + [`HEIGHT height] @ text) + in + let col_empty = w#add_column_empty in + let clear_widget remove_columns = + Extlib.may (fun (_, r) -> r.selected <- RUnselected) model.row_selected; + model.row_selected <- None; + if remove_columns then begin + model.all_exprs <- []; + (* Clear out all columns except 'Callstacks' and "empty": clear + everything, then restore those two. *) + let data_col_cs = HColumns.find model.columns_type col_callstack in + let data_col_empty = HColumns.find model.columns_type col_empty in + HColumns.iter (fun column (col_typ, _) -> + if col_typ <> CCallstack && col_typ <> CEmpty then + ignore (w#view#remove_column column) + ) model.columns_type; + HColumns.clear model.columns_type; + HColumns.add model.columns_type col_callstack data_col_cs; + HColumns.add model.columns_type col_empty data_col_empty; + end; + (* Post a reload request before clearing. + The current model is used to know how many rows + must be deleted. *) + w#reload ; + in + let clear_model () = + clear_widget true; + model.loc <- None; + model.rows <- GCallstackMap.empty; + model.filters <- []; + model.hidden_columns <- []; + in + let start_session loc ~multiple = + if not (multiple && Extlib.opt_equal gui_loc_equal (Some loc) model.loc) + then begin + clear_model (); + model.loc <- Some loc; + end + in + let rec add_columns expr = + let expr_string = Pretty_utils.to_string pretty_gui_selection expr in + let _expr_string_short = + if String.length expr_string >= 15 then + String.sub expr_string 0 15 ^ ".." + else expr_string + in + (* 'Before' column *) + let col_before = w#add_column_text [`YALIGN 0.0] + (fun (_, row) -> + let data = find_data row expr in + [`TEXT !!(data.Gui_eval.before_string)]) + in + let tip_before = + Printf.sprintf "Value of '%s' before the current point" expr_string + in + (* 'Alarm column *) + let show_alarm_col = ref (fun () -> ()) in + let col_alarm = + w#add_column_pixbuf [`YALIGN 0.0;`XALIGN 0.5] + (fun (_, row) -> + let data = find_data row expr in + if data.Gui_eval.alarm then begin + !show_alarm_col (); + [`STOCK_ID "gtk-dialog-warning"] + end else [`STOCK_ID ""]) + in + show_alarm_col := (fun () -> + let ct = CAlarm expr in + if not (list_mem equal_column_type ct model.hidden_columns) then + col_alarm#set_visible true); + col_alarm#set_visible false; + let tip_alarm = + Printf.sprintf "Does evaluation of '%s' always succeed?" expr_string + in + (* 'After column *) + let show_after_col = ref (fun () -> ()) in + let col_after = w#add_column_text [`YALIGN 0.0] + (fun (_, row) -> + let data = find_data row expr in + match data.Gui_eval.after with + | GA_Bottom -> [`TEXT "BOTTOM"; `STYLE `NORMAL] + | GA_NA -> [`TEXT "n/a"; `STYLE `ITALIC] + | GA_Unchanged -> [`TEXT "unchanged"; `STYLE `ITALIC] + | GA_After _ -> + !show_after_col (); + [`TEXT !!(data.Gui_eval.after_string); `STYLE `NORMAL]) + in + col_after#set_visible false; + let title_after = expr_string ^ " (after)" in + let tip_after = + Printf.sprintf "Value of '%s' after the current point" expr_string + in + show_after_col := (fun () -> + let ct = CAfter expr in + if not (list_mem equal_column_type ct model.hidden_columns) then + col_after#set_visible true); + (* This is the menu displayed when the user left-clicks on the header of + one of the three columns *) + let menu_on_expr col_type (icon: GMisc.image) (menu: GMenu.menu Lazy.t)= + let has_filters = column_has_filter model col_type in + let txt_remove_col = + Format.asprintf "Remove all columns for '%a'%s" + pretty_gui_selection expr + (if has_filters then " (including filters)" else "") + in + let remove = GMenu.menu_item ~label:txt_remove_col () in + (!!menu)#add remove; + let callback_remove_filters () = + icon#misc#hide (); + let filters' = remove_filter expr model.filters in + let filters_changed = filters' != model.filters in + model.filters <- filters'; + if filters_changed then render_session () + in + (* Remove all the columns related to 'expr' *) + let callback_remove () = + model.all_exprs <- + list_remove gui_selection_equal expr model.all_exprs; + HColumns.iter + (fun col (col_type, _) -> + match col_type with + | CBefore e | CAfter e | CAlarm e + when gui_selection_equal expr e -> + ignore (w#view#remove_column col); + HColumns.remove model.columns_type col; + | _ -> () + ) model.columns_type; + callback_remove_filters (); + in + ignore (remove#connect#activate callback_remove); + if has_filters then begin + let txt_unfilter = "Remove filters on this column" in + let unfilter = GMenu.menu_item ~label:txt_unfilter () in + (!!menu)#add unfilter; + ignore (unfilter#connect#activate callback_remove_filters); + end; + in + let aux_expr_column (col: GTree.view_column) coltype txt tip = + let icon = add_column_header col txt tip in + let mk_menu = [ + menu_on_expr coltype icon; + filter_menu + ] in + add_column_header_callback col mk_menu; + HColumns.add model.columns_type col (coltype, show_icon icon); + in + aux_expr_column col_before (CBefore expr) expr_string tip_before; + aux_expr_column col_alarm (CAlarm expr) " " tip_alarm; + aux_expr_column col_after (CAfter expr) title_after tip_after; + and add_data expr callstack data = + (* If the expression has never been displayed before, create the + columns *) + if not (list_mem gui_selection_equal expr model.all_exprs) then begin + add_columns expr; + model.all_exprs <- expr :: model.all_exprs + end; + model.rows <- add_data_to_rows model.rows callstack expr data + and render_session () = + clear_widget false; + let has_visible_row = ref false in + GCallstackMap.iter (fun _cs row -> + if row_is_visible row then begin + has_visible_row := true; + w#insert_row (gtk_model#add row); + end; + ) model.rows; + if not !has_visible_row && not (GCallstackMap.is_empty model.rows) then + (* Add a special row to indicate that some things are hidden by + filters. This row is intentionally only added to the view, but + not to the model *) + w#insert_row (gtk_model#add (row_unfocused ())); + GtkTree.TreeView.columns_autosize w#view#as_tree_view; + in + (* Callback called when a callstack is focused or unfocused *) + let callback_focus_unfocus lcs icon () = + let conv = List.map Gui_callstacks_filters.from_callstack in + let lrcs = Extlib.opt_map conv lcs in + callback_focus_callstack lrcs; + icon ~filtered:(lcs <> None); + model.focused_rev_callstacks <- lrcs; + render_session (); + in + (* Add 'Unfocus callstacks' option to menu. *) + let add_unfocus_callstacks menu icon = + if Extlib.has_some model.focused_rev_callstacks then begin + let unfocus = GMenu.menu_item ~label:"Unfocus callstack(s)" () in + (!!menu)#add unfocus; + ignore (unfocus#connect#activate (callback_focus_unfocus None icon)) + end; + in + (* Add 'Focus on all displayed callstacks' to menu *) + let add_focus_all_callstacks menu icon = + let visible_callstack cs row acc = + match cs with + | GC_Single cs | GC_Callstack cs -> + if row_is_visible row then cs :: acc else acc + | _ -> acc + in + let callstacks = GCallstackMap.fold visible_callstack model.rows [] in + if List.length callstacks > 1 then + let focus_all = GMenu.menu_item ~label:"Focus on all \ + displayed callstacks" () in + (!!menu)#add focus_all; + ignore (focus_all#connect#activate + (callback_focus_unfocus (Some callstacks) icon)); + in + let tip_callstack = "Callstacks at which the selection was analyzed" in + let icon_callstack = + add_column_header col_callstack "Callstack" tip_callstack + in + let mk_menu_header_callstack menu = + add_unfocus_callstacks menu (show_icon icon_callstack); + add_focus_all_callstacks menu (show_icon icon_callstack); + filter_menu menu; + in + add_column_header_callback col_callstack [mk_menu_header_callstack]; + HColumns.add model.columns_type col_callstack + (CCallstack, show_icon icon_callstack); + HColumns.add model.columns_type col_empty + (CEmpty, (fun ~filtered:_ -> ())); + let clone model' = + clear_model () (* resets row_selected + the widget itself *); + model.loc <- model'.loc; + model.all_exprs <- model'.all_exprs; + (* Recreate the columns, in particular the field 'columns_type' *) + List.iter add_columns (List.rev model'.all_exprs); + model.rows <- + GCallstackMap.map + (fun r -> { r with selected = RUnselected}) model'.rows; + model.focused_rev_callstacks <- model'.focused_rev_callstacks; + model.filters <- model'.filters; + HColumns.iter (fun _col (coltype, icon) -> + icon ~filtered:(column_has_filter model' coltype) + ) model.columns_type; + model.full_callstacks_height <- model'.full_callstacks_height; + model.show_consolidated <- model'.show_consolidated; + model.show_by_callstacks <- model'.show_by_callstacks; + render_session () + in + (* This is the menu which is displayed when the user right-clicks + on a data column. It can be used to filter lines *) + let popup_menu_filter expr v icon vars_to_display = + let menu = GMenu.menu () in + let callback_copy () = + (* we copy to both PRIMARY and CLIPBOARD clipboards, + for easier pasting *) + (* for a more readable result, add a separator between + the expression and its value when necessary *) + let value_str = Format.asprintf "%a" pretty_filter_column v in + let text = + Format.asprintf "%a%s%a" + pretty_gui_selection expr + (if String.get value_str 0 = ' ' then "" else " -> ") + pretty_filter_column v + in + let clipboard = GtkBase.Clipboard.get Gdk.Atom.clipboard in + GtkBase.Clipboard.set_text clipboard text; + let primary = GtkBase.Clipboard.get Gdk.Atom.primary in + GtkBase.Clipboard.set_text primary text + in + let callback_only_except oe () = + let filter = expr, oe, v in + model.filters <- filter :: model.filters; + icon ~filtered:true; + render_session (); + in + let copy = GMenu.menu_item ~label:"Copy to clipboard" () in + let equal = GMenu.menu_item ~label:"Only equal" () in + let different = GMenu.menu_item ~label:"Only different" () in + menu#add copy; + menu#add (GMenu.separator_item ()); + menu#add equal; + menu#add different; + ignore (copy#connect#activate callback_copy); + ignore (equal#connect#activate (callback_only_except true)); + ignore (different#connect#activate (callback_only_except false)); + (* add menu items for variables present in the selected expression *) + let callback_display_var vi () = + Extlib.may (fun loc -> + let lval = Cil.var vi in + let selection = GS_LVal lval in + let list = Input.make_data_for_lvalue lval loc in + let append (callstack, data) = add_data selection callstack data in + List.iter append list; + render_session () + ) model.loc + in + List.iter (fun vi -> + let label = Format.asprintf "Display values for '%a'" + Printer.pp_varinfo vi in + let varmenuitem = GMenu.menu_item ~label () in + menu#add varmenuitem; + ignore (varmenuitem#connect#activate (callback_display_var vi)); + ) vars_to_display; + let time = GtkMain.Main.get_current_event_time () in + menu#popup ~button:3 ~time + in + (* Updates the selection state of the given row. *) + let update_selected select (_, row as irow) = + row.selected <- select; + w#update_row irow; + in + w#on_click + (fun (_, row as irow) column -> + (* Update the height of the selected and deselected rows. *) + (* First, unselect the previous row, if it was not 'row' itself + (avoids flickering *) + begin match model.row_selected with + | Some (_, row_old as irow_old) when row_old != row -> + update_selected RUnselected irow_old; + | _ -> () + end; + (* Newt, update 'row' *) + update_selected (if GColumn.equal column col_callstack + then RSelectedCallstackCol + else RSelected) irow; + model.row_selected <- Some irow; + (* Dump the clicked cell on the "Information" tab, for copy-pasting + and/or selection *) + let dump s pp v = main_ui#pretty_information "@.%s:@.%a@." s pp v in + match HColumns.find model.columns_type column with + | CCallstack, _ -> begin + match row.callstack with + | GC_Single stack | GC_Callstack stack -> + dump "Stack" pretty_callstack stack + | GC_Consolidated | GC_Filtered -> () + end + | CBefore expr, _ -> + let data = find_data row expr in + dump "Value before" Input.pretty_gui_res data.Gui_eval.before + | CAfter expr, _ -> begin + let data = find_data row expr in + match data.Gui_eval.after with + | GA_After after -> dump "Value after" Input.pretty_gui_res after + | GA_NA | GA_Unchanged | GA_Bottom -> () + end + | CAlarm _, _ | CEmpty, _ -> () + ); + let gui_res_of_after f after = + match after with + | GA_After r -> f r + | GA_NA | GA_Unchanged | GA_Bottom -> [] + in + w#on_right_click + (fun (_, row) column -> + match HColumns.find model.columns_type column with + | CCallstack, icon -> begin + let menu = lazy (GMenu.menu ()) in + (* Add 'Focus' option when a callstack is selected *) + begin match row.callstack with + | GC_Single cs | GC_Callstack cs -> + let focus = GMenu.menu_item ~label:"Focus on this callstack"() in + (!!menu)#add focus; + ignore (focus#connect#activate + (callback_focus_unfocus (Some [cs]) icon)); + | GC_Filtered | GC_Consolidated -> () + end; + add_focus_all_callstacks menu icon; + add_unfocus_callstacks menu icon; + (* Popup the menu only if something as been added *) + if Lazy.is_val menu then + let time = GtkMain.Main.get_current_event_time () in + (!!menu)#popup ~button:3 ~time + end + | CBefore expr, icon -> + let data = find_data row expr in + if data.Gui_eval.before <> GR_Empty then + popup_menu_filter expr (FilterBefore data.Gui_eval.before) icon + (Input.vars_in_gui_res data.Gui_eval.before); + | CAfter expr, icon -> + let data = find_data row expr in + if data.Gui_eval.before <> GR_Empty then + popup_menu_filter expr (FilterAfter data.Gui_eval.after) icon + (gui_res_of_after Input.vars_in_gui_res data.Gui_eval.after) + | CAlarm expr, icon -> + let data = find_data row expr in + if data.Gui_eval.before <> GR_Empty then + popup_menu_filter expr (FilterAlarm data.Gui_eval.alarm) icon [] + | CEmpty, _ -> () + ); + frame, + (object + method model = model + method add_data = add_data + method render_session = render_session + method start_session = start_session + method clear = clear_model + method clone = clone + + method expand_row_for_callstacks expand = + if model.full_callstacks_height <> expand then begin + model.full_callstacks_height <- expand; + render_session () + end + + method show_by_callstacks show = + if model.show_by_callstacks <> show then begin + model.show_by_callstacks <- show; + render_session () + end + + method show_consolidated show = + if model.show_consolidated <> show then begin + model.show_consolidated <- show; + render_session () + end + end: value cm_panel) + +end + + +module HWidget = Hashtbl.Make(struct + type t = GObj.widget + let hash w = Gobject.get_oid w#as_widget + let equal w1 w2 = + Gobject.get_oid w1#as_widget = Gobject.get_oid w2#as_widget + end) + +type 'v result = + { widget: GObj.widget; + reset: unit -> unit; + clear_default: unit -> unit; + focus_selection_tab: unit -> unit; + display_data_by_callstack: 'v display_data_by_callstack + } + +(* This function creates the buttons at the top of "Values" tab, plus + a tab control suitable for displaying multiple cm_panel *) +let make_widget (main_ui:main_ui) ~packing make_panel = + let vpaned = GPack.vbox ~homogeneous:false () ~packing in + let hbox_filters = GPack.hbox ~packing:(vpaned#pack ~expand:false) () in + let chk_multiple = new Widget.checkbox ~label:"Multiple selections" + ~tooltip:"Allow the selection of multiple expressions on the same \ + statement" () + in + let chk_consolidated = new Widget.checkbox ~label:"Consolidated value" + ~tooltip:"Show values consolidated across all callstacks" () + in + let chk_callstacks = new Widget.checkbox ~label:"Per callstack" + ~tooltip:"Show values per callstack" () + in + let chk_rows_height = new Widget.checkbox ~label:"Expand rows" + ~tooltip:"Expand rows to fit the 'Callstack' column" () + in + let key_multiple = "Value.multiple_selections" in + let key_consolidated = "Value.show_consolidated" in + let key_by_callstacks = "Value.show_by_callstacks" in + let key_rows_height = "Value.expand_rows" in + let get_bool k default = Gtk_helper.Configuration.find_bool ~default k in + let save_bool k v = Gtk_helper.Configuration.(set k (ConfBool v)) in + chk_multiple#set (get_bool key_multiple false); + chk_consolidated#set (get_bool key_consolidated true); + chk_callstacks#set (get_bool key_by_callstacks true); + chk_rows_height#set (get_bool key_rows_height false); + hbox_filters#pack chk_multiple#coerce; + hbox_filters#pack ~from:`END chk_callstacks#coerce; + hbox_filters#pack ~from:`END chk_consolidated#coerce; + (* let lbl_filters = GMisc.label ~markup:"Filters: " () in + hbox_filters#pack ~from:`END lbl_filters#coerce; *) + hbox_filters#pack ~from:`END chk_rows_height#coerce; + let tabs = + GPack.notebook ~scrollable:true ~packing:(vpaned#pack ~expand:true) () + in + vpaned#misc#set_sensitive (Db.Value.is_computed ()); + let pack_tab ?lbl w = ignore (tabs#insert_page ?tab_label:lbl w) in + let lbl_pane_default = GPack.hbox () in + let clear_button = new Widget.button ~icon:`CLEAR ~tooltip:"Clear" () in + clear_button#set_enabled false; + let save_button = new Widget.button ~icon:`SAVE ~tooltip:"Save" () in + save_button#set_enabled false; + let lbl = GMisc.label ~markup:"Selection" () in + lbl_pane_default#pack lbl#coerce; + lbl_pane_default#pack clear_button#coerce; + lbl_pane_default#pack save_button#coerce; + let focus_selection_tab () = + let n = main_ui#lower_notebook#page_num vpaned#coerce in + main_ui#lower_notebook#goto_page n; + tabs#goto_page 0 + in + (* Callback for the "Selection" tab: set the selected callstacks as filters, + plus rehighlight the source text (for dead code, etc) *) + let callback_focus_callstack lrcs = + Gui_callstacks_filters.focus_on_callstacks lrcs; + main_ui#rehighlight () + in + let make_panel ?(callback_focus_callstack=fun _ -> ()) () = + make_panel main_ui + ~callback_focus_callstack + ~show_consolidated:chk_consolidated#get + ~show_by_callstacks:chk_callstacks#get + ~full_callstacks_height:chk_rows_height#get + in + let pane_default, model_default = make_panel ~callback_focus_callstack () in + pack_tab ~lbl:lbl_pane_default#coerce pane_default#coerce; + let hash_tabs = HWidget.create 16 in + let notify_switch_page n = + (* Hide the buttons of all the tabs not focused *) + HWidget.iter (fun _ (_, bt1, bt2) -> bt1#hide (); bt2#hide ()) hash_tabs; + if n = 0 then begin (* 'Selection' tab is focused *) + clear_button#coerce#misc#show (); + save_button#coerce#misc#show (); + end else + let w = tabs#get_nth_page n in + clear_button#coerce#misc#hide (); + save_button#coerce#misc#hide (); + try + (* Show the buttons of the current tab *) + let _, bt1, bt2 = HWidget.find hash_tabs w in + bt1#show (); bt2#show (); + with Not_found -> () (* should not happen *) + in + ignore (tabs#connect#switch_page ~callback:notify_switch_page); + let callback_save_button () = + let model = model_default#model in + match model.loc with + | Some loc -> + let txt = match loc with + | GL_Stmt (kf, stmt) -> + Format.asprintf "%a:%d" + Kernel_function.pretty kf + (fst (Cil_datatype.Stmt.loc stmt)).Lexing.pos_lnum + | GL_Pre kf -> + Format.asprintf "pre %a" Kernel_function.pretty kf + | GL_Post kf -> + Format.asprintf "post %a" Kernel_function.pretty kf + in + let hb = GPack.hbox () in + ignore (GMisc.label ~packing:hb#pack ~markup:txt ()); + let button_delete = + new Widget.button ~icon:`DELETE ~tooltip:"Delete" () + in + hb#pack button_delete#coerce; + button_delete#coerce#misc#hide (); + let button_edit = + new Widget.button ~icon:`EDIT ~tooltip:"Edit" () + in + hb#pack button_edit#coerce; + button_edit#coerce#misc#hide (); + let tab, model_tab = make_panel () in + button_delete#connect (fun () -> + let n = tabs#page_num tab#coerce in + tabs#remove_page n + ); + button_edit#connect (fun () -> + let loc = match loc with + | GL_Stmt (kf, stmt) -> + Pretty_source.PStmt (kf, stmt) + | GL_Pre kf | GL_Post kf -> + let vi = Kernel_function.get_vi kf in + Pretty_source.PVDecl (Some kf, Cil_types.Kglobal, vi) + in + main_ui#scroll loc; + model_default#clone model_tab#model; + tabs#goto_page 0; + callback_focus_callstack model_default#model.focused_rev_callstacks; + ); + HWidget.add hash_tabs tab#coerce + (model_tab, button_edit#coerce#misc, button_delete#coerce#misc); + pack_tab ~lbl:hb#coerce tab#coerce; + model_tab#clone model_default#model + | None -> () + in + save_button#connect callback_save_button; + let on_all f = + f model_default; + HWidget.iter (fun _ (model, _, _) -> f model) hash_tabs; + in + (* Clear the 'default' tab *) + let clear_default () = + clear_button#set_enabled false; + save_button#set_enabled false; + model_default#clear () + in + clear_button#connect clear_default; + chk_multiple#connect (fun b -> save_bool key_multiple b); + chk_consolidated#connect (fun b -> + save_bool key_consolidated b; + on_all (fun model -> model#show_consolidated b)); + chk_callstacks#connect (fun b -> + save_bool key_by_callstacks b; + on_all (fun model -> model#show_by_callstacks b)); + chk_rows_height#connect (fun b -> + save_bool key_rows_height b; + on_all (fun model -> model#expand_row_for_callstacks b)); + (* Clear all the tabs *) + let reset () = + (* the method get_n_pages is missing in Lablgtk. Instead, we iterate + over the hash tables of panels to remove the non-'Selection' ones *) + HWidget.iter (fun w _ -> tabs#remove_page (tabs#page_num w)) hash_tabs; + HWidget.clear hash_tabs; + clear_default (); + vpaned#misc#set_sensitive (Db.Value.is_computed ()); + in + let display_data_by_callstack loc selection content = + clear_button#set_enabled true; + save_button#set_enabled true; + model_default#start_session loc ~multiple:chk_multiple#get; + let append (callstack, data) = + model_default#add_data selection callstack data + in + List.iter append content; + model_default#render_session () + in + { widget = vpaned#coerce; + reset; + clear_default; + focus_selection_tab; + display_data_by_callstack } + +(* Reference to the final widget. Used to remove it properly when rebuilding + the panel for a new analysis. *) +let widget_ref: GObj.widget option ref = ref None + +let reset_ref = ref (fun () -> ()) +let clear_default_ref = ref (fun () -> ()) +let focus_selection_tab_ref = ref (fun _ -> ()) + +let reset () = !reset_ref () +let clear_default () = !clear_default_ref () +let focus_selection_tab () = !focus_selection_tab_ref () + +(* Removes the previous panel, if any. Returns the position of the panel + in the lower notebook, and a boolean indicating whether the panel had the + focus before being removed. Used to keep the same position and focus when + renewing the panel. *) +let remove main_ui = + match !widget_ref with + | None -> -1, false + | Some widget -> + let num = main_ui#lower_notebook#page_num widget in + let focused = main_ui#lower_notebook#current_page = num in + if num <> -1 then main_ui#lower_notebook#remove_page num; + num, focused + +(* Creates the panel, sets the references to widget, clear_default and + focus_selection_tab, and returns the display_by_callstack function. *) +let create (type v) (main_ui: main_ui) (module I: Input with type value = v) = + let num, focused = remove main_ui in + let module CM = Make (I) in + let packing w = + let tab_label = (GMisc.label ~text:"Values" ())#coerce in + ignore (main_ui#lower_notebook#insert_page ~pos:num ~tab_label w#coerce) + in + let result = make_widget main_ui ~packing CM.make_panel in + if focused then main_ui#lower_notebook#goto_page num; + widget_ref := Some result.widget; + reset_ref := result.reset; + clear_default_ref := result.clear_default; + focus_selection_tab_ref := result.focus_selection_tab; + result.display_data_by_callstack diff --git a/src/plugins/value/gui_files/gui_callstacks_manager.mli b/src/plugins/value/gui_files/gui_callstacks_manager.mli new file mode 100644 index 0000000000000000000000000000000000000000..c5f917f3742f1b067117f7e2eefdcc72b7b00f86 --- /dev/null +++ b/src/plugins/value/gui_files/gui_callstacks_manager.mli @@ -0,0 +1,70 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** This module creates and manages the "Values" panel on the lower notebook + of the GUI. It mainly displays the values computed by the analysis + for selected expressions and lvalues, and thus depends on the value + abstractions used for the analysis. + It is able to display different values by callstacks in a table, + in accordance with the callstacks focused by the user (handled in + gui_callstacks_filters.ml). *) + +open Gui_types + +(* List associating callstacks and data related to them. + Each element of such a list is intended to be displayed in a separate row. *) +type 'v data_by_callstack = + (gui_callstack * 'v Gui_eval.gui_selection_data) list + +(* Type of the function that displays some data by callstacks for a selection + (expression, lvalue or term) at a location (statement, precondition or + postcondition of a function). + This is the main feature of the "Values" panel, returned by the [create] + function below. *) +type 'v display_data_by_callstack = + gui_loc -> gui_selection -> 'v data_by_callstack -> unit + +(* Module needed to create the panel. *) +module type Input = sig + include Gui_types.S + + val make_data_for_lvalue : + Cil_types.lval -> gui_loc -> value data_by_callstack +end + +(** Creates the panel, attaches it to the lower notebook, and returns the + display_by_callstack function allowing to display data on it. + If a previous panel was previously created through this function, the new + panel replaces it. *) +val create: + Design.main_window_extension_points -> + (module Input with type value = 'v) -> + 'v display_data_by_callstack + +(* Should be called when the main_ui is reset. *) +val reset: unit -> unit + +(* Clear the 'default' tab of the panel, for example on selection change. *) +val clear_default: unit -> unit + +(* Set focus on the 'Selection' tab of the panel. *) +val focus_selection_tab: unit -> unit diff --git a/src/plugins/value/gui_files/gui_eval.ml b/src/plugins/value/gui_files/gui_eval.ml index 67f94273a1cf64ba97d72ab4c52ccf480870c440..7cb1fe213c252771058f1021ea8f51c103a0e32d 100644 --- a/src/plugins/value/gui_files/gui_eval.ml +++ b/src/plugins/value/gui_files/gui_eval.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -37,233 +37,6 @@ let term_c_type t = | _ -> None ) (Logic_utils.unroll_type t.term_type) -type ('env, 'expr, 'v) evaluation_functions = { - eval_and_warn: 'env -> 'expr -> 'v * bool; - env: Cvalue.Model.t -> Value_types.callstack -> 'env; - equal: 'v -> 'v -> bool; - bottom: 'v; - join: 'v -> 'v -> 'v; - expr_to_gui_selection: 'expr -> gui_selection; - res_to_gui_res: 'expr -> 'v -> gui_res; -} - -(* special [with_alarms] value that logs important alarms, but allows execution - to continue *) -let log_alarms () = - let ok = ref true in - let not_ok () = ok := false in - let with_alarms = { - CilE.others = {CilE.a_ignore with CilE.a_call=not_ok}; - unspecified = {CilE.a_ignore with CilE.a_call=not_ok}; - defined_logic = CilE.a_ignore; - imprecision_tracing = CilE.a_ignore; - } in - with_alarms, ok - -(* Special function for l-values (Var vi, NoOffset). Since allocated variables - may have an incomplete array type, it is simpler to extract the entire - offsetmap and return it (instead of performing a copy of the offsetmap with - a wacky size). For "normal" variables, this code is correct too. *) -let extract_single_var state vi = - let b = Base.of_varinfo vi in - try - match Cvalue.Model.find_base b state with - | `Bottom -> GO_InvalidLoc, false - | `Value m -> GO_Offsetmap m, true - | `Top -> GO_Top, true - with Not_found -> - GO_InvalidLoc, false - -(* Evaluate the given location in [state]. Catch an unreachable state, an - invalid location, or another error during the evaluation. *) -let reduce_loc_and_eval ~with_alarms state ref_ok loc = - if Cvalue.Model.is_top state then - GO_Top, true - else - if Cvalue.Model.is_reachable state then - if Int_Base.(equal loc.Locations.size zero) then GO_Empty, true - else - let loc' = Locations.valid_part ~for_writing:false loc in - if Locations.is_bottom_loc loc' then - GO_InvalidLoc, false - else - try - let size = Int_Base.project loc'.Locations.size in - match Eval_op.copy_offsetmap - ~with_alarms loc'.Locations.loc size state - with - | `Bottom -> GO_Bottom, false - | `Value offsm -> - let ok = !ref_ok && (Locations.loc_equal loc loc') in - GO_Offsetmap offsm, ok - with Int_Base.Error_Top -> GO_Top, true - else - GO_Bottom, true - -let lval_to_offsetmap state lv = - let with_alarms, ok = log_alarms () in - let ploc = Eval_exprs.lval_to_precise_loc ~with_alarms state lv in - let aux loc (acc_res, acc_ok) = - let res, ok = - match lv with (* catch simplest pattern *) - | Var vi, NoOffset -> extract_single_var state vi - | _ -> reduce_loc_and_eval ~with_alarms state ok loc - in - match acc_res, res with - | GO_Offsetmap o1, GO_Offsetmap o2 -> - GO_Offsetmap (Cvalue.V_Offsetmap.join o1 o2), acc_ok && ok - | GO_Bottom, v | v, GO_Bottom -> v, acc_ok && ok - | GO_Empty, v | v, GO_Empty -> v, acc_ok && ok - | GO_Top, GO_Top -> GO_Top, acc_ok && ok - | GO_InvalidLoc, GO_InvalidLoc -> GO_InvalidLoc, false - | GO_InvalidLoc, GO_Offsetmap _ -> res, false - | GO_Offsetmap _, GO_InvalidLoc -> acc_res, false - | GO_Top, (GO_InvalidLoc | GO_Offsetmap _ as r) - | (GO_InvalidLoc | GO_Offsetmap _ as r), GO_Top -> - r, acc_ok && ok (* cannot happen, we should get Top everywhere *) - in - Precise_locs.fold aux ploc (GO_Bottom, true) - -let lv_offsetmap_res_to_gui_res lv offsm = - let typ = Some (Cil.unrollType (Cil.typeOfLval lv)) in - GR_Offsm (offsm, typ) - -let id_env state _ = state - -let lval_ev = - {eval_and_warn=lval_to_offsetmap; - env = id_env; - equal=equal_gui_offsetmap_res; - bottom=GO_Bottom; - join=join_gui_offsetmap_res; - expr_to_gui_selection = (fun lv -> GS_LVal lv); - res_to_gui_res = lv_offsetmap_res_to_gui_res; - } - -let lval_zone_ev = - let lv_to_zone state lv = - let with_alarms = CilE.warn_none_mode in - let ploc = Eval_exprs.lval_to_precise_loc ~with_alarms state lv in - let z = Precise_locs.enumerate_valid_bits ~for_writing:false ploc in - z, false - in - {eval_and_warn=lv_to_zone; - env = id_env; - equal=Locations.Zone.equal; - bottom=Locations.Zone.bottom; - join=Locations.Zone.join; - expr_to_gui_selection = (fun lv -> GS_LVal lv); - res_to_gui_res = (fun _ z -> GR_Zone z); - } - -let null_to_offsetmap state (_:unit) = - match Cvalue.Model.find_base_or_default Base.null state with - | `Bottom -> GO_InvalidLoc, true - | `Top -> GO_Top, true - | `Value m -> GO_Offsetmap m, true - -let null_ev = - {eval_and_warn=null_to_offsetmap; - env = id_env; - equal=equal_gui_offsetmap_res; - bottom=GO_Bottom; - join=join_gui_offsetmap_res; - expr_to_gui_selection = (fun _ -> GS_AbsoluteMem); - res_to_gui_res = (fun _ offsm -> GR_Offsm (offsm, None)); - } - -let exp_ev = - let eval_exp_and_warn state e = - let with_alarms,ok = log_alarms () in - let r = !Db.Value.eval_expr ~with_alarms state e in - r, !ok - in - {eval_and_warn=eval_exp_and_warn; - env = id_env; - equal=Cvalue.V.equal; - bottom=Cvalue.V.bottom; - join=Cvalue.V.join; - expr_to_gui_selection = (fun e -> GS_Expr e); - res_to_gui_res = (fun e v -> GR_Value (v, Some (Cil.typeOf e))); - } - -let pre_kf kf callstack = - match Db.Value.get_initial_state_callstack kf with - | None -> Cvalue.Model.top (* should not happen *) - | Some h -> - try Value_types.Callstack.Hashtbl.find h callstack - with Not_found -> Cvalue.Model.top (* should not happen either *) - -let env_here kf here callstack = - let pre = pre_kf kf callstack in - let c_labels = Eval_annots.c_labels kf callstack in - Eval_terms.env_annot ~c_labels ~pre ~here () - -let env_pre _kf here _callstack = - Eval_terms.env_pre_f ~pre:here () - -let env_post kf post callstack = - let pre = pre_kf kf callstack in - let result = - if !Db.Value.use_spec_instead_of_definition kf then - None - else - let ret_stmt = Kernel_function.find_return kf in - match ret_stmt.skind with - | Return (Some ({enode = Lval (Var vi, NoOffset)}),_) -> Some vi - | Return (None,_) -> None - | _ -> assert false - in - let c_labels = Eval_annots.c_labels kf callstack in - Eval_terms.env_post_f ~c_labels ~pre ~post ~result () - -type states_by_callstack = { - states_before: Cvalue.Model.t Value_types.Callstack.Hashtbl.t; - states_after: Cvalue.Model.t Value_types.Callstack.Hashtbl.t option; -} - -let callstacks_at_stmt kf stmt = - if results_kf_computed kf then - (* Show 'after' states only in instructions. On blocks and if/switch - statements, the notion of 'after' is counter-intuitive. *) - let is_instr = match stmt.skind with Instr _ -> true | _ -> false in - match Db.Value.get_stmt_state_callstack ~after:false stmt with - | Some states_before -> - let states_after = - if is_instr - then Db.Value.get_stmt_state_callstack ~after:true stmt - else None - in - Some {states_before; states_after} - | None -> None - else None -;; - -let callstacks_at_pre kf = - if results_kf_computed kf then - match Db.Value.get_initial_state_callstack kf with - | Some states_before -> Some { states_before; states_after = None} - | None -> None - else None -;; - -let callstacks_at_post kf = - if not (!Db.Value.use_spec_instead_of_definition kf) && results_kf_computed kf - then - let ret = Kernel_function.find_return kf in - match Db.Value.get_stmt_state_callstack ~after:true ret with - | Some states_before -> Some { states_before; states_after = None} - | None -> None - else - None -;; - -let callstacks_at_gui_loc = function - | GL_Stmt (kf, stmt) -> callstacks_at_stmt kf stmt - | GL_Pre kf -> callstacks_at_pre kf - | GL_Post kf -> callstacks_at_post kf - - let classify_pre_post kf ip = let open Property in match ip with @@ -283,82 +56,26 @@ let classify_pre_post kf ip = | IPComplete _ | IPDisjoint _ | IPAssigns _ | IPFrom _ | IPDecrease _ -> Some (GL_Pre kf) -let env_gui_loc = function - | GL_Stmt (kf, _) -> env_here kf - | GL_Pre kf -> env_pre kf - | GL_Post kf -> env_post kf - -let tlval_ev lm = - let tlval_to_offsetmap env tlv = - let with_alarms, ok = log_alarms () in - let loc = Eval_terms.eval_tlval_as_location env ~with_alarms tlv in - let state = Eval_terms.env_current_state env in - reduce_loc_and_eval ~with_alarms state ok loc - in - {eval_and_warn=tlval_to_offsetmap; - env = env_gui_loc lm; - equal=equal_gui_offsetmap_res; - bottom=GO_Bottom; - join=join_gui_offsetmap_res; - expr_to_gui_selection = (fun tlv -> GS_TLVal tlv); - res_to_gui_res = (fun tlv offsm -> GR_Offsm (offsm, term_c_type tlv)) - } - -let tlval_zone_ev gl = - let tlv_to_zone env tlv = - let with_alarms, ok = log_alarms () in - let z = Eval_terms.eval_tlval_as_zone - ~for_writing:false env ~with_alarms tlv - in - z, !ok - in - {eval_and_warn=tlv_to_zone; - env = env_gui_loc gl; - equal=Locations.Zone.equal; - bottom=Locations.Zone.bottom; - join=Locations.Zone.join; - expr_to_gui_selection = (fun tlv -> GS_TLVal tlv); - res_to_gui_res = (fun _ z -> GR_Zone z); - } - -let term_ev lm = - let eval_term_and_warn env t = - let with_alarms,ok = log_alarms () in - let r = Eval_terms.((eval_term ~with_alarms env t).eover) in - r, !ok +let gui_loc_logic_env lm = + (* According to the ACSL spec, 'Pre' is not available in preconditions, + but in practice it is parsed *) + let pre () = + let e = Logic_typing.Lenv.empty () in + Logic_typing.(append_pre_label (append_init_label (append_here_label e))) in - {eval_and_warn=eval_term_and_warn; - env = env_gui_loc lm; - equal=Cvalue.V.equal; - bottom=Cvalue.V.bottom; - join=Cvalue.V.join; - expr_to_gui_selection = (fun t -> GS_Term t); - res_to_gui_res = (fun t v -> GR_Value (v, term_c_type t)); -} + let stmt () = pre () in (*TODO: add LoopEntry and LoopCurrent when supported*) + let post () = Logic_typing.append_old_and_post_labels (stmt ()) in + match lm with + | GL_Stmt _ -> stmt () + | GL_Pre _ -> pre () + | GL_Post _ -> post () -let predicate_ev lm = - let eval_predicate_and_warn env t = - let r = Eval_terms.eval_predicate env t in - `Value r, true (* TODO *) - in - let to_status = function - | `Bottom -> Eval_terms.True - | `Value s -> s - in - {eval_and_warn = eval_predicate_and_warn; - env = env_gui_loc lm; - equal = (=); - bottom = `Bottom; - join = Bottom.join Eval_terms.join_predicate_status; - expr_to_gui_selection = (fun p -> GS_Predicate p); - res_to_gui_res = (fun _ s -> GR_Status (to_status s)); -} -type gui_selection_data = { +type 'a gui_selection_data = { alarm: bool; - before: gui_res; + before: 'a gui_res; before_string: string Lazy.t; - after: gui_after; + after: 'a gui_after; after_string: string Lazy.t; } @@ -370,108 +87,503 @@ let gui_selection_data_empty = { after_string = lazy ""; } -let data ~ok ~before ~after = { - before; after; alarm = not ok; - before_string = lazy (Pretty_utils.to_string pretty_gui_res before); - after_string = (match after with - | GA_NA | GA_Unchanged -> lazy "" (* won't be used *) - | GA_After after -> lazy (Pretty_utils.to_string pretty_gui_res after)); -} +let clear_caches () = + Cvalue.V_Offsetmap.clear_caches (); + Cvalue.Model.clear_caches (); + Locations.Location_Bytes.clear_caches (); + Locations.Zone.clear_caches (); + Function_Froms.Memory.clear_caches () + +module type S = sig + module Analysis : Analysis.S + + type ('env, 'expr, 'v) evaluation_functions = { + eval_and_warn: 'env -> 'expr -> 'v * bool; + env: Analysis.Dom.t -> Value_types.callstack -> 'env; + equal: 'v -> 'v -> bool; + bottom: 'v; + join: 'v -> 'v -> 'v; + expr_to_gui_selection: 'expr -> gui_selection; + res_to_gui_res: 'expr -> 'v -> Analysis.Val.t gui_res; + } + + val lval_as_offsm_ev: (Analysis.Dom.t, lval, gui_offsetmap_res) evaluation_functions + val lval_zone_ev: (Analysis.Dom.t, lval, Locations.Zone.t) evaluation_functions + val null_ev: (Analysis.Dom.t, unit, gui_offsetmap_res) evaluation_functions + val exp_ev: (Analysis.Dom.t, exp, Analysis.Val.t Bottom.or_bottom) evaluation_functions + val lval_ev: (Analysis.Dom.t, lval, Analysis.Val.t Eval.flagged_value) evaluation_functions + + val tlval_ev: + gui_loc -> (Eval_terms.eval_env, term, gui_offsetmap_res) evaluation_functions + val tlval_zone_ev: + gui_loc -> (Eval_terms.eval_env, term, Locations.Zone.t) evaluation_functions + val term_ev: + gui_loc -> + (Eval_terms.eval_env, term, Analysis.Val.t Bottom.or_bottom) evaluation_functions + + val predicate_ev: + gui_loc -> + (Eval_terms.eval_env, + predicate, + Eval_terms.predicate_status Bottom.or_bottom + ) evaluation_functions + + val make_data_all_callstacks: + ('a, 'b, 'c) evaluation_functions -> gui_loc -> 'b -> + (gui_callstack * Analysis.Val.t gui_selection_data) list * exn list +end + + +module Make (X: Analysis.S) = struct + + module Analysis = X + + let get_cvalue_state = + match X.Dom.get Cvalue_domain.key with + | None -> fun _ -> Cvalue.Model.top + | Some get -> fun state -> get state + + let get_precise_loc = + match X.Loc.get Main_locations.ploc_key with + | None -> fun _ -> Precise_locs.loc_top + | Some get -> fun loc -> get loc + + + module AGui_types = Gui_types.Make (X.Val) + open AGui_types + + type ('env, 'expr, 'v) evaluation_functions = { + eval_and_warn: 'env -> 'expr -> 'v * bool; + env: X.Dom.t -> Value_types.callstack -> 'env; + equal: 'v -> 'v -> bool; + bottom: 'v; + join: 'v -> 'v -> 'v; + expr_to_gui_selection: 'expr -> gui_selection; + res_to_gui_res: 'expr -> 'v -> X.Val.t gui_res; + } -type before_after = BABefore | BAAfter - -(* Evaluation of [exp] in [before] and [after] using [ev]. [set_ba] must - be called before each evaluation, with the state in which the evaluation - will be done. *) -let make_data ev set_ba ~before ~after exp = - set_ba BABefore; - let vbefore, okbef = ev.eval_and_warn before exp in - set_ba BAAfter; - let res_after = Extlib.opt_map (fun a -> ev.eval_and_warn a exp) after in - let ok = okbef (* currently, we do not warn for alarms in the post-state *) in - match res_after with - | Some (vafter, _okafter) -> - if ev.equal vbefore vafter then - data ~before:(ev.res_to_gui_res exp vbefore) ~after:GA_Unchanged ~ok + (* Special function for l-values (Var vi, NoOffset). Since allocated variables + may have an incomplete array type, it is simpler to extract the entire + offsetmap and return it (instead of performing a copy of the offsetmap with + a wacky size). For "normal" variables, this code is correct too. + The returned boolean 'ok' means that the operation was possible. *) + let extract_single_var state vi = + let b = Base.of_varinfo vi in + try + match Cvalue.Model.find_base b state with + | `Bottom -> GO_InvalidLoc, false + | `Value m -> GO_Offsetmap m, true + | `Top -> GO_Top, false + with Not_found -> + GO_InvalidLoc, false + + (* Evaluate the given location in [state]. Catch an unreachable state, an + invalid location, or another error during the evaluation. The returned + boolean means 'ok', i.e. that no error occurred. *) + let reduce_loc_and_eval state loc = + if Cvalue.Model.is_top state then + GO_Top, false else - data ~before:(ev.res_to_gui_res exp vbefore) - ~after:(GA_After (ev.res_to_gui_res exp vafter)) ~ok - | None -> data ~before:(ev.res_to_gui_res exp vbefore) ~after:GA_NA ~ok - -let make_data_all_callstacks append ev ~before ~after expr = - let exn = ref [] in - let single_callstack = (Value_types.Callstack.Hashtbl.length before) = 1 in - let v_join_before = ref ev.bottom in - let v_join_after = ref ev.bottom in - let ok_join = ref true in - let rba = ref BABefore in - let set_ba ba = rba := ba in - (* Change [ev] to store intermediate results for 'consolidated' line *) - let eval_and_warn states e = - let v, ok as r = ev.eval_and_warn states e in - begin match !rba with - | BABefore -> - v_join_before := ev.join !v_join_before v; - ok_join := !ok_join && ok; - | BAAfter -> - v_join_after := ev.join !v_join_after v; - end; - r - in - let ev = { ev with eval_and_warn } in - (* Rows by callstack *) - Value_types.Callstack.Hashtbl.iter - (fun callstack before -> - let before = ev.env before callstack in - let after = - Extlib.opt_map - (fun cafter -> - let after = - try Value_types.Callstack.Hashtbl.find cafter callstack - with Not_found -> Cvalue.Model.bottom - in - ev.env after callstack) - after - in - let callstack = if single_callstack - then GC_Single callstack - else GC_Callstack callstack - in - let cmexpr = ev.expr_to_gui_selection expr in - try append cmexpr callstack (make_data ev set_ba ~before ~after expr) - with e -> exn := e :: !exn - ) before; - (* Consolidated row, only if there are multiple callstacks *) - if not single_callstack then begin - let callstack = GC_Consolidated in - let before = ev.res_to_gui_res expr !v_join_before in - let after = match after with - | None -> GA_NA - | Some _ -> - if ev.equal !v_join_before !v_join_after - then GA_Unchanged - else GA_After (ev.res_to_gui_res expr !v_join_after) + if Cvalue.Model.is_reachable state then + if Int_Base.(equal loc.Locations.size zero) then GO_Empty, true + else + let loc' = Locations.valid_part ~for_writing:false loc in + if Locations.is_bottom_loc loc' then + GO_InvalidLoc, false + else + try + let size = Int_Base.project loc'.Locations.size in + match Cvalue.Model.copy_offsetmap loc'.Locations.loc size state with + | `Bottom -> GO_Bottom, false + | `Value offsm -> + let ok = Locations.is_valid ~for_writing:false loc in + GO_Offsetmap offsm, ok + with Abstract_interp.Error_Top -> GO_Top, false + else (* Bottom state *) + GO_Bottom, true + + let lval_to_offsetmap state lv = + let loc, alarms = X.eval_lval_to_loc state lv in + let ok = Alarmset.is_empty alarms in + let state = get_cvalue_state state in + let aux loc (acc_res, acc_ok) = + let res, ok = + match lv with (* catch simplest pattern *) + | Var vi, NoOffset -> extract_single_var state vi + | _ -> reduce_loc_and_eval state loc + in + match acc_res, res with + | GO_Offsetmap o1, GO_Offsetmap o2 -> + GO_Offsetmap (Cvalue.V_Offsetmap.join o1 o2), acc_ok && ok + | GO_Bottom, v | v, GO_Bottom -> v, acc_ok && ok + | GO_Empty, v | v, GO_Empty -> v, acc_ok && ok + | GO_Top, GO_Top -> GO_Top, acc_ok && ok + | GO_InvalidLoc, GO_InvalidLoc -> GO_InvalidLoc, false + | GO_InvalidLoc, GO_Offsetmap _ -> res, false + | GO_Offsetmap _, GO_InvalidLoc -> acc_res, false + | GO_Top, (GO_InvalidLoc | GO_Offsetmap _ as r) + | (GO_InvalidLoc | GO_Offsetmap _ as r), GO_Top -> + r, acc_ok && ok (* cannot happen, we should get Top everywhere *) in - let expr = ev.expr_to_gui_selection expr in - append expr callstack (data ~before ~after ~ok:!ok_join) - end; - !exn -;; + match loc with + | `Bottom -> GO_InvalidLoc, ok + | `Value loc -> + let ploc = get_precise_loc loc in + Precise_locs.fold aux ploc (GO_Bottom, ok) + + let lv_offsetmap_res_to_gui_res lv offsm = + let typ = Some (Cil.unrollType (Cil.typeOfLval lv)) in + GR_Offsm (offsm, typ) + + let id_env state _ = state + + let lval_as_offsm_ev = + {eval_and_warn=lval_to_offsetmap; + env = id_env; + equal=equal_gui_offsetmap_res; + bottom=GO_Bottom; + join=join_gui_offsetmap_res; + expr_to_gui_selection = (fun lv -> GS_LVal lv); + res_to_gui_res = lv_offsetmap_res_to_gui_res; + } + + let lval_zone_ev = + let lv_to_zone state lv = + let loc, _alarms = X.eval_lval_to_loc state lv in + match loc with + | `Bottom -> Locations.Zone.bottom, false + | `Value loc -> + let ploc = get_precise_loc loc in + let z = Precise_locs.enumerate_valid_bits ~for_writing:false ploc in + z, false + in + {eval_and_warn=lv_to_zone; + env = id_env; + equal=Locations.Zone.equal; + bottom=Locations.Zone.bottom; + join=Locations.Zone.join; + expr_to_gui_selection = (fun lv -> GS_LVal lv); + res_to_gui_res = (fun _ z -> GR_Zone z); + } + + let null_to_offsetmap state (_:unit) = + let state = get_cvalue_state state in + match Cvalue.Model.find_base_or_default Base.null state with + | `Bottom -> GO_InvalidLoc, false + | `Top -> GO_Top, false + | `Value m -> GO_Offsetmap m, true -let gui_loc_logic_env lm = - (* According to the ACSL spec, 'Pre' is not available in preconditions, - but in practice it is parsed *) - let pre () = - let e = Logic_typing.Lenv.empty () in - Logic_typing.(append_pre_label (append_init_label (append_here_label e))) - in - let stmt () = pre () in (* TODO: add LoopInit and LoopCurrent when supported*) - let post () = Logic_typing.append_old_and_post_labels (stmt ()) in - match lm with - | GL_Stmt _ -> stmt () - | GL_Pre _ -> pre () - | GL_Post _ -> post () + let null_ev = + {eval_and_warn=null_to_offsetmap; + env = id_env; + equal=equal_gui_offsetmap_res; + bottom=GO_Bottom; + join=join_gui_offsetmap_res; + expr_to_gui_selection = (fun _ -> GS_AbsoluteMem); + res_to_gui_res = (fun _ offsm -> GR_Offsm (offsm, None)); + } + + let exp_ev = + let eval_exp_and_warn state e = + let r = X.eval_expr state e in + fst r, Alarmset.is_empty (snd r) + in + let res_to_gui_res e v = + let flagged_value = Eval.{v; initialized=true; escaping=false; } in + GR_Value (flagged_value, Some (Cil.typeOf e)) + in + {eval_and_warn=eval_exp_and_warn; + env = id_env; + equal=Bottom.equal X.Val.equal; + bottom=`Bottom; + join=Bottom.join X.Val.join; + expr_to_gui_selection = (fun e -> GS_Expr e); + res_to_gui_res; + } + + let lval_ev = + let eval_and_warn state lval = + let r = X.copy_lvalue state lval in + let flagged_value = match fst r with + | `Bottom -> Eval.Flagged_Value.bottom + | `Value v -> v + in + flagged_value, Alarmset.is_empty (snd r) + in + { + eval_and_warn; + env = id_env; + bottom = Eval.Flagged_Value.bottom; + equal = Eval.Flagged_Value.equal X.Val.equal; + join = Eval.Flagged_Value.join X.Val.join; + expr_to_gui_selection = (fun lv -> GS_LVal lv); + res_to_gui_res = (fun lv v -> GR_Value (v, Some (Cil.typeOfLval lv))); + } + + let pre_kf kf callstack = + match Db.Value.get_initial_state_callstack kf with + | None -> Cvalue.Model.top (* should not happen *) + | Some h -> + try Value_types.Callstack.Hashtbl.find h callstack + with Not_found -> Cvalue.Model.top (* should not happen either *) + + let env_here kf here callstack = + let pre = pre_kf kf callstack in + let here = get_cvalue_state here in + let c_labels = Eval_annots.c_labels kf callstack in + Eval_terms.env_annot ~c_labels ~pre ~here () + + let env_pre _kf here _callstack = + let here = get_cvalue_state here in + Eval_terms.env_pre_f ~pre:here () + + let env_post kf post callstack = + let pre = pre_kf kf callstack in + let post = get_cvalue_state post in + let result = + if !Db.Value.use_spec_instead_of_definition kf then + None + else + let ret_stmt = Kernel_function.find_return kf in + match ret_stmt.skind with + | Return (Some ({enode = Lval (Var vi, NoOffset)}),_) -> Some vi + | Return (None,_) -> None + | _ -> assert false + in + let c_labels = Eval_annots.c_labels kf callstack in + Eval_terms.env_post_f ~c_labels ~pre ~post ~result () + + (* Maps from callstacks to Value states before and after a GUI location. + The 'after' map is not always available. *) + type states_by_callstack = { + states_before: X.Dom.t Value_types.Callstack.Hashtbl.t Eval.or_top_or_bottom; + states_after: X.Dom.t Value_types.Callstack.Hashtbl.t Eval.or_top_or_bottom; + } + let top_states_by_callstacks = { states_before = `Top; states_after = `Top } + + (* For statements: results are available only if the statement is reachable. + After states are available only for instructions. *) + let callstacks_at_stmt kf stmt = + if results_kf_computed kf then + (* Show 'after' states only in instructions. On blocks and if/switch + statements, the notion of 'after' is counter-intuitive. *) + let is_instr = match stmt.skind with Instr _ -> true | _ -> false in + let states_before = X.get_stmt_state_by_callstack ~after:false stmt in + let states_after = match states_before with + | `Top | `Bottom as x -> x + | `Value _ -> + if is_instr + then X.get_stmt_state_by_callstack ~after:true stmt + else `Top + in + { states_before; states_after } + else top_states_by_callstacks + + (* For pre-states: results are available only if the function is called, + and correspond to the states before reduction by any precondition. + After states are not available. *) + let callstacks_at_pre kf = + if results_kf_computed kf then + let states_before = X.get_initial_state_by_callstack kf in + { states_before; states_after = `Top } + else top_states_by_callstacks + + (* For post-states: results are available only for functions with a body, for + normal termination, and only when the function is called. + After states are not available. *) + let callstacks_at_post kf = + if not (!Db.Value.use_spec_instead_of_definition kf) && results_kf_computed kf + then + let ret = Kernel_function.find_return kf in + let states_before = X.get_stmt_state_by_callstack ~after:true ret in + { states_before; states_after = `Top } + else top_states_by_callstacks + + let callstacks_at_gui_loc = function + | GL_Stmt (kf, stmt) -> callstacks_at_stmt kf stmt + | GL_Pre kf -> callstacks_at_pre kf + | GL_Post kf -> callstacks_at_post kf + + let env_gui_loc = function + | GL_Stmt (kf, _) -> env_here kf + | GL_Pre kf -> env_pre kf + | GL_Post kf -> env_post kf + + let tlval_ev lm = + let tlval_to_offsetmap env tlv = + let alarms = ref false in + let alarm_mode = Eval_terms.Track alarms in + let loc = Eval_terms.eval_tlval_as_location env ~alarm_mode tlv in + let state = Eval_terms.env_current_state env in + let offsm, ok = reduce_loc_and_eval state loc in + offsm, not !alarms && ok + in + {eval_and_warn=tlval_to_offsetmap; + env = env_gui_loc lm; + equal=equal_gui_offsetmap_res; + bottom=GO_Bottom; + join=join_gui_offsetmap_res; + expr_to_gui_selection = (fun tlv -> GS_TLVal tlv); + res_to_gui_res = (fun tlv offsm -> GR_Offsm (offsm, term_c_type tlv)) + } + + let tlval_zone_ev gl = + let tlv_to_zone env tlv = + let alarms = ref false in + let alarm_mode = Eval_terms.Track alarms in + let for_writing = false in + let z = Eval_terms.eval_tlval_as_zone ~for_writing env ~alarm_mode tlv in + z, not !alarms + in + {eval_and_warn=tlv_to_zone; + env = env_gui_loc gl; + equal=Locations.Zone.equal; + bottom=Locations.Zone.bottom; + join=Locations.Zone.join; + expr_to_gui_selection = (fun tlv -> GS_TLVal tlv); + res_to_gui_res = (fun _ z -> GR_Zone z); + } + + let term_ev lm = + let eval_term_and_warn env t = + let alarms = ref false in + let alarm_mode = Eval_terms.Track alarms in + let r = Eval_terms.(eval_term ~alarm_mode env t) in + `Value (from_cvalue r.Eval_terms.eover), not !alarms + in + let res_to_gui_res t v = + let flagged_value = Eval.{v; initialized=true; escaping=false; } in + GR_Value (flagged_value, term_c_type t) + in + {eval_and_warn=eval_term_and_warn; + env = env_gui_loc lm; + equal=Bottom.equal X.Val.equal; + bottom=`Bottom; + join=Bottom.join X.Val.join; + expr_to_gui_selection = (fun t -> GS_Term t); + res_to_gui_res; + } + + let predicate_ev lm = + let eval_predicate_and_warn env t = + let r = Eval_terms.eval_predicate env t in + `Value r, true (* TODO *) + in + let to_status = function + | `Bottom -> Eval_terms.True + | `Value s -> s + in + {eval_and_warn = eval_predicate_and_warn; + env = env_gui_loc lm; + equal = (=); + bottom = `Bottom; + join = Bottom.join Eval_terms.join_predicate_status; + expr_to_gui_selection = (fun p -> GS_Predicate p); + res_to_gui_res = (fun _ s -> GR_Status (to_status s)); + } + + let data ~ok ~before ~after = { + before; after; alarm = not ok; + before_string = lazy (Pretty_utils.to_string pretty_gui_res before); + after_string = (match after with + | GA_NA | GA_Unchanged | GA_Bottom -> lazy "" (* won't be used *) + | GA_After after -> lazy (Pretty_utils.to_string pretty_gui_res after)); + } + + type before_after = BABefore | BAAfter + + (* Evaluation of [exp] in [before] and [after] using [ev]. [set_ba] must + be called before each evaluation, with the state in which the evaluation + will be done. *) + let make_data ev set_ba ~before ~after exp = + set_ba BABefore; + let vbefore, ok = ev.eval_and_warn before exp in + let before = ev.res_to_gui_res exp vbefore in + match after with + | `Top -> data ~before ~after:GA_NA ~ok + | `Bottom -> data ~before ~after:(GA_Bottom) ~ok + | `Value after -> + set_ba BAAfter; + (* Currently, we do not warn for alarms in the post-state. *) + let vafter, _okafter = ev.eval_and_warn after exp in + if ev.equal vbefore vafter + then data ~before ~after:GA_Unchanged ~ok + else data ~before ~after:(GA_After (ev.res_to_gui_res exp vafter)) ~ok + + let make_data_all_callstacks_from_states ev ~before ~after expr = + let exn = ref [] in + let single_callstack = (Value_types.Callstack.Hashtbl.length before) = 1 in + let v_join_before = ref ev.bottom in + let v_join_after = ref ev.bottom in + let ok_join = ref true in + let rba = ref BABefore in + let set_ba ba = rba := ba in + (* Change [ev] to store intermediate results for 'consolidated' line *) + let eval_and_warn states e = + let v, ok as r = ev.eval_and_warn states e in + begin match !rba with + | BABefore -> + v_join_before := ev.join !v_join_before v; + ok_join := !ok_join && ok; + | BAAfter -> + v_join_after := ev.join !v_join_after v; + end; + r + in + let ev = { ev with eval_and_warn } in + (* Rows by callstack *) + let list = + Value_types.Callstack.Hashtbl.fold + (fun callstack before acc -> + let before = ev.env before callstack in + let after = match after with + | `Top | `Bottom as x -> x + | `Value after -> + try + let after = Value_types.Callstack.Hashtbl.find after callstack in + `Value (ev.env after callstack) + (* If a callstack exists before the statement but is not found + after, then the post state for this callstack is bottom. *) + with Not_found -> `Bottom + in + let callstack = if single_callstack + then GC_Single callstack + else GC_Callstack callstack + in + try (callstack, (make_data ev set_ba ~before ~after expr)) :: acc + with e -> exn := e :: !exn; acc + ) before [] + in + (* Consolidated row, only if there are multiple callstacks *) + let list = + if single_callstack + then list + else + let callstack = GC_Consolidated in + let before = ev.res_to_gui_res expr !v_join_before in + let after = match after with + | `Top | `Bottom -> GA_NA + | `Value _ -> + if ev.equal !v_join_before !v_join_after + then GA_Unchanged + else GA_After (ev.res_to_gui_res expr !v_join_after) + in + (callstack, (data ~before ~after ~ok:!ok_join)) :: list + in + list, !exn + + let make_data_all_callstacks ev loc v = + let {states_before; states_after} = callstacks_at_gui_loc loc in + match states_before with + | `Top -> [], [] (* Happens if none of the domains has saved its states. + In this case, nothing is displayed by the GUI. *) + | `Bottom -> [], [] (* Bottom case: nothing is displayed either. *) + | `Value before -> + Cil.CurrentLoc.set (gui_loc_loc loc); + clear_caches (); + make_data_all_callstacks_from_states ev ~before ~after:states_after v +end (* diff --git a/src/plugins/value/gui_files/gui_eval.mli b/src/plugins/value/gui_files/gui_eval.mli index f1ccd791720440471db91de0511b94c3858c4210..044888408111b241a3174175926f0f4c7b50ddbb 100644 --- a/src/plugins/value/gui_files/gui_eval.mli +++ b/src/plugins/value/gui_files/gui_eval.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,101 +28,86 @@ open Cil_types open Gui_types (** Catch the fact that we are in a function for which [-no-results] or one - of its variants is set. Without this check, we would display - much non-sensical information. *) + of its variants is set. Without this check, we would display + much non-sensical information. *) val results_kf_computed: kernel_function -> bool -(** This is the record that encapsulates all evaluation functions *) -type ('env, 'expr, 'v) evaluation_functions = { - eval_and_warn: 'env -> 'expr -> 'v * bool; - env: Cvalue.Model.t -> Value_types.callstack -> 'env; - equal: 'v -> 'v -> bool; - bottom: 'v; - join: 'v -> 'v -> 'v; - expr_to_gui_selection: 'expr -> gui_selection; - res_to_gui_res: 'expr -> 'v -> gui_res; -} - -val lval_ev: - (Cvalue.Model.t, lval, Gui_types.gui_offsetmap_res) evaluation_functions - -val lval_zone_ev: - (Cvalue.Model.t, lval, Locations.Zone.t) evaluation_functions - -val null_ev: - (Cvalue.Model.t, unit, Gui_types.gui_offsetmap_res) evaluation_functions +(** State in which the predicate, found in the given function, + should be evaluated *) +val classify_pre_post: kernel_function -> Property.t -> gui_loc option -val exp_ev: - (Cvalue.Model.t, exp, Cvalue.V.t) evaluation_functions +val gui_loc_logic_env: gui_loc -> Logic_typing.Lenv.t +(** Logic labels valid at the given location. C labels are _not_ added, + even if the location is a statement. *) -(** Evaluation of logic-originating objects is parameterized by a location - information, which is used to build the evaluation environment *) +type 'a gui_selection_data = { + alarm: bool; + before: 'a gui_res; + before_string: string Lazy.t; + after: 'a gui_after; + after_string: string Lazy.t; +} -val tlval_ev: - Gui_types.gui_loc -> - (Eval_terms.eval_env, term, Gui_types.gui_offsetmap_res) evaluation_functions +val gui_selection_data_empty: 'a gui_selection_data +(** Default value. All the fields contain empty or dummy values *) -val tlval_zone_ev: - Gui_types.gui_loc -> - (Eval_terms.eval_env, term, Locations.Zone.t) evaluation_functions +(** The types and function below depend on the abstract domains and values + currently available in EVA. *) +module type S = sig -val term_ev: - Gui_types.gui_loc -> - (Eval_terms.eval_env, term, Cvalue.V.t) evaluation_functions + module Analysis : Analysis.S -val predicate_ev: - Gui_types.gui_loc -> - (Eval_terms.eval_env, - predicate, - Eval_terms.predicate_status Bottom.or_bottom - ) evaluation_functions + (** This is the record that encapsulates all evaluation functions *) + type ('env, 'expr, 'v) evaluation_functions = { + eval_and_warn: 'env -> 'expr -> 'v * bool; + env: Analysis.Dom.t -> Value_types.callstack -> 'env; + equal: 'v -> 'v -> bool; + bottom: 'v; + join: 'v -> 'v -> 'v; + expr_to_gui_selection: 'expr -> gui_selection; + res_to_gui_res: 'expr -> 'v -> Analysis.Val.t gui_res; + } + val lval_as_offsm_ev: + (Analysis.Dom.t, lval, gui_offsetmap_res) evaluation_functions -type gui_selection_data = { - alarm: bool; - before: gui_res; - before_string: string Lazy.t; - after: gui_after; - after_string: string Lazy.t; -} + val lval_zone_ev: + (Analysis.Dom.t, lval, Locations.Zone.t) evaluation_functions -val gui_selection_data_empty: gui_selection_data -(** Default value. All the fields contain empty or dummy values *) + val null_ev: + (Analysis.Dom.t, unit, gui_offsetmap_res) evaluation_functions -val make_data_all_callstacks: - (Gui_types.gui_selection -> Gui_types.gui_callstack -> gui_selection_data -> - unit) -> - ('a, 'b, 'c) evaluation_functions -> - before:Cvalue.Model.t Value_types.Callstack.Hashtbl.t -> - after:Cvalue.Model.t Value_types.Callstack.Hashtbl.t option -> - 'b -> - exn list + val exp_ev: + (Analysis.Dom.t, exp, Analysis.Val.t Bottom.or_bottom) evaluation_functions + val lval_ev: + (Analysis.Dom.t, lval, Analysis.Val.t Eval.flagged_value) evaluation_functions -(** State in which the predicate, found in the given function, - should be evaluated *) -val classify_pre_post: kernel_function -> Property.t -> gui_loc option + (** Evaluation of logic-originating objects is parameterized by a location + information, which is used to build the evaluation environment *) + val tlval_ev: + gui_loc -> + (Eval_terms.eval_env, term, gui_offsetmap_res) evaluation_functions -(** Maps from callstacks to Value states before and after a GUI location. - The 'after' map is not always available. *) -type states_by_callstack = { - states_before: Cvalue.Model.t Value_types.Callstack.Hashtbl.t; - states_after: Cvalue.Model.t Value_types.Callstack.Hashtbl.t option; -} + val tlval_zone_ev: + gui_loc -> + (Eval_terms.eval_env, term, Locations.Zone.t) evaluation_functions -val callstacks_at_gui_loc: gui_loc -> states_by_callstack option -(** For statements: results are available only if the statement is reachable. - After states are available only for instructions. + val term_ev: + gui_loc -> + (Eval_terms.eval_env, term, Analysis.Val.t Bottom.or_bottom) evaluation_functions - For pre-states: results are available only if the function is called, - and correspond to the states before reduction by any precondition. - After states are not available + val predicate_ev: + gui_loc -> + (Eval_terms.eval_env, + predicate, + Eval_terms.predicate_status Bottom.or_bottom + ) evaluation_functions - For post-states: results are available only for functions with a body, for - normal termination, and only when the function is called. - After states are not available. *) + val make_data_all_callstacks: + ('a, 'b, 'c) evaluation_functions -> gui_loc -> 'b -> + (gui_callstack * Analysis.Val.t gui_selection_data) list * exn list +end -val gui_loc_logic_env: gui_loc -> Logic_typing.Lenv.t -(** Logic labels valid at the given location. C labels are _not_ added, - even if the location is a statement. *) +module Make (X: Analysis.S) : S with module Analysis = X diff --git a/src/plugins/value/gui_files/gui_types.ml b/src/plugins/value/gui_files/gui_types.ml index fad0659fc19f6db0e1b6ee5250777d32578a489b..be76d7c6f3bb077380fc3b6d9ca5584a3da53ed9 100644 --- a/src/plugins/value/gui_files/gui_types.ml +++ b/src/plugins/value/gui_files/gui_types.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -111,42 +111,102 @@ let join_gui_offsetmap_res r1 r2 = match r1, r2 with | GO_Offsetmap o1, GO_Offsetmap o2 -> GO_Offsetmap (Cvalue.V_Offsetmap.join o1 o2) -type gui_res = +type 'a gui_res = | GR_Empty - | GR_Offsm of gui_offsetmap_res * typ option - | GR_Value of Cvalue.V.t * typ option + | GR_Offsm of gui_offsetmap_res * Cil_types.typ option + | GR_Value of 'a Eval.flagged_value * Cil_types.typ option | GR_Status of Eval_terms.predicate_status | GR_Zone of Locations.Zone.t -let pretty_gui_res fmt = function - | GR_Empty -> () - | GR_Offsm (offsm, typ) -> pretty_gui_offsetmap_res ?typ fmt offsm - | GR_Value (v, typ) -> Cvalue.V.pretty_typ typ fmt v - | GR_Status s -> Eval_terms.pretty_predicate_status fmt s - | GR_Zone z -> Locations.Zone.pretty fmt z - -let equal_gui_res r1 r2 = match r1, r2 with - | GR_Empty, GR_Empty -> true - | GR_Offsm (o1, typ1), GR_Offsm (o2, typ2) -> - equal_gui_offsetmap_res o1 o2 && - Extlib.opt_equal Cil_datatype.Typ.equal typ1 typ2 - | GR_Value (v1, typ1), GR_Value (v2, typ2) -> - Cvalue.V.equal v1 v2 && Extlib.opt_equal Cil_datatype.Typ.equal typ1 typ2 - | GR_Status s1, GR_Status s2 -> Extlib.compare_basic s1 s2 = 0 - | GR_Zone z1, GR_Zone z2 -> Locations.Zone.equal z1 z2 - | (GR_Empty | GR_Offsm _ | GR_Value _ | GR_Status _ | GR_Zone _), _ -> false - -type gui_after = GA_After of gui_res | GA_NA | GA_Unchanged - -let pretty_gui_after fmt = function - | GA_After r -> Format.fprintf fmt "%a" pretty_gui_res r - | GA_NA -> Format.fprintf fmt "n/a" - | GA_Unchanged -> Format.fprintf fmt "unchanged" - -let equal_gui_after a1 a2 = match a1, a2 with - | GA_NA, GA_NA | GA_Unchanged, GA_Unchanged -> true - | GA_After r1, GA_After r2 -> equal_gui_res r1 r2 - | (GA_After _ | GA_NA | GA_Unchanged), _ -> false +type 'a gui_after = + | GA_After of 'a gui_res + | GA_Bottom + | GA_NA + | GA_Unchanged + +module type S = sig + type value + + val pretty_gui_res : Format.formatter -> value gui_res -> unit + val equal_gui_res : value gui_res -> value gui_res -> bool + val vars_in_gui_res : value gui_res -> Cil_types.varinfo list + + val pretty_gui_after : Format.formatter -> value gui_after -> unit + val equal_gui_after : value gui_after -> value gui_after -> bool +end + +module Make (V: Abstractions.Value) = struct + + let pretty_gui_res fmt = function + | GR_Empty -> () + | GR_Offsm (offsm, typ) -> pretty_gui_offsetmap_res ?typ fmt offsm + | GR_Value (v, typ) -> Eval.Flagged_Value.pretty (V.pretty_typ typ) fmt v + | GR_Status s -> Eval_terms.pretty_predicate_status fmt s + | GR_Zone z -> Locations.Zone.pretty fmt z + + let equal_gui_res r1 r2 = match r1, r2 with + | GR_Empty, GR_Empty -> true + | GR_Offsm (o1, typ1), GR_Offsm (o2, typ2) -> + equal_gui_offsetmap_res o1 o2 && + Extlib.opt_equal Cil_datatype.Typ.equal typ1 typ2 + | GR_Value (v1, typ1), GR_Value (v2, typ2) -> + Eval.Flagged_Value.equal V.equal v1 v2 && + Extlib.opt_equal Cil_datatype.Typ.equal typ1 typ2 + | GR_Status s1, GR_Status s2 -> Extlib.compare_basic s1 s2 = 0 + | GR_Zone z1, GR_Zone z2 -> Locations.Zone.equal z1 z2 + | (GR_Empty | GR_Offsm _ | GR_Value _ | GR_Status _ | GR_Zone _), _ -> false + + let pretty_gui_after fmt = function + | GA_After r -> Format.fprintf fmt "%a" pretty_gui_res r + | GA_Bottom -> Format.fprintf fmt "BOTTOM" + | GA_NA -> Format.fprintf fmt "n/a" + | GA_Unchanged -> Format.fprintf fmt "unchanged" + + let equal_gui_after a1 a2 = match a1, a2 with + | GA_NA, GA_NA | GA_Unchanged, GA_Unchanged | GA_Bottom, GA_Bottom -> true + | GA_After r1, GA_After r2 -> equal_gui_res r1 r2 + | (GA_After _ | GA_NA | GA_Unchanged | GA_Bottom), _ -> false + + let get_cvalue = V.get Main_values.cvalue_key + let from_cvalue v = V.set Main_values.cvalue_key v V.top + + let var_of_base base acc = + try + let vi = Base.to_varinfo base in + (* if it is a function, do not add it *) + if Cil.isFunctionType vi.vtype then acc else vi :: acc + with Base.Not_a_C_variable -> acc + + (* [vars_in_gui_res r] returns a list of non-function C variables + present in [r]. *) + let vars_in_gui_res r = + let rev_vars = match r with + | GR_Offsm (m_res, _) -> + begin + match m_res with + | GO_Offsetmap m -> + Cvalue.V_Offsetmap.fold_on_values (fun vu acc -> + Cvalue.V.fold_bases var_of_base + (Cvalue.V_Or_Uninitialized.get_v vu) acc + ) m [] + | _ -> [] + end + | GR_Value (value, _) -> + begin + match value.Eval.v with + | `Bottom -> [] + | `Value v -> + match get_cvalue with + | None -> [] + | Some get -> Cvalue.V.fold_bases var_of_base (get v) [] + end + | GR_Zone z -> Locations.Zone.fold_bases var_of_base z [] + | GR_Status _ | GR_Empty -> [] + in + (* inverse the list to preserve the order of the offsetmap *) + List.rev rev_vars + +end type gui_loc = | GL_Stmt of kernel_function * stmt @@ -205,29 +265,6 @@ let pretty_callstack_short fmt cs = (fun fmt (kf, _) -> Kernel_function.pretty fmt kf) fmt q | _ -> assert false -let var_of_base base acc = - try (Base.to_varinfo base) :: acc - with Base.Not_a_C_variable -> acc - -(* [vars_in_gui_res r] returns a list of C variables present in [r]. *) -let vars_in_gui_res r = - let rev_vars = match r with - | GR_Offsm (m_res, _) -> - begin - match m_res with - | GO_Offsetmap m -> - Cvalue.V_Offsetmap.fold_on_values (fun vu acc -> - Cvalue.V.fold_bases var_of_base - (Cvalue.V_Or_Uninitialized.get_v vu) acc - ) m [] - | _ -> [] - end - | GR_Value (v, _) -> Cvalue.V.fold_bases var_of_base v [] - | GR_Zone z -> Locations.Zone.fold_bases var_of_base z [] - | GR_Status _ | GR_Empty -> [] - in - (* inverse the list to preserve the order of the offsetmap *) - List.rev rev_vars (* Local Variables: diff --git a/src/plugins/value/gui_files/gui_types.mli b/src/plugins/value/gui_files/gui_types.mli new file mode 100644 index 0000000000000000000000000000000000000000..d42ccca859f6561da486c37dfa4dd3c7d13751f7 --- /dev/null +++ b/src/plugins/value/gui_files/gui_types.mli @@ -0,0 +1,107 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +type gui_callstack = + | GC_Filtered + | GC_Consolidated + | GC_Single of Value_types.callstack + | GC_Callstack of Value_types.callstack + +val hash_gui_callstack : gui_callstack -> int +val compare_gui_callstack : gui_callstack -> gui_callstack -> int + +module GCallstackMap : FCMap.S with type key = gui_callstack + + +type gui_selection = + | GS_TLVal of Cil_types.term + | GS_LVal of Cil_types.lval + | GS_AbsoluteMem + | GS_Expr of Cil_types.exp + | GS_Term of Cil_types.term + | GS_Predicate of Cil_types.predicate + +val pretty_gui_selection : Format.formatter -> gui_selection -> unit +val gui_selection_equal : gui_selection -> gui_selection -> bool + + +type gui_offsetmap_res = + | GO_Bottom + | GO_Empty + | GO_Top + | GO_InvalidLoc + | GO_Offsetmap of Cvalue.V_Offsetmap.t + +val equal_gui_offsetmap_res : + gui_offsetmap_res -> gui_offsetmap_res -> bool +val pretty_gui_offsetmap_res : + ?typ:Cil_types.typ -> Format.formatter -> gui_offsetmap_res -> unit +val join_gui_offsetmap_res : + gui_offsetmap_res -> gui_offsetmap_res -> gui_offsetmap_res + + +type gui_loc = + | GL_Stmt of Cil_types.kernel_function * Cil_types.stmt + | GL_Pre of Cil_types.kernel_function + | GL_Post of Cil_types.kernel_function + +val gui_loc_equal : gui_loc -> gui_loc -> bool +val gui_loc_loc : gui_loc -> Cil_types.location +val kf_of_gui_loc : gui_loc -> Cil_types.kernel_function + +val pretty_callstack : + Format.formatter -> Value_types.callstack -> unit +val pretty_callstack_short : + Format.formatter -> Value_types.callstack -> unit + +type 'a gui_res = + | GR_Empty + | GR_Offsm of gui_offsetmap_res * Cil_types.typ option + | GR_Value of 'a Eval.flagged_value * Cil_types.typ option + | GR_Status of Eval_terms.predicate_status + | GR_Zone of Locations.Zone.t + +type 'a gui_after = + | GA_After of 'a gui_res + | GA_Bottom + | GA_NA + | GA_Unchanged + + +module type S = sig + type value + + val pretty_gui_res : Format.formatter -> value gui_res -> unit + val equal_gui_res : value gui_res -> value gui_res -> bool + val vars_in_gui_res : value gui_res -> Cil_types.varinfo list + + val pretty_gui_after : Format.formatter -> value gui_after -> unit + val equal_gui_after : value gui_after -> value gui_after -> bool +end + +(** The types below depend on the abstract values currently available. *) +module Make (V : Abstractions.Value) : sig + include S with type value := V.t + + val get_cvalue : (V.t -> Main_values.CVal.t) option + val from_cvalue : Main_values.CVal.t -> V.t +end diff --git a/src/plugins/value/gui_files/register_gui.ml b/src/plugins/value/gui_files/register_gui.ml index 0a4afd734caf1b5ac1e8988e22410c98311209db..0f379125acd1a874ff98e32646181cba5133d320 100644 --- a/src/plugins/value/gui_files/register_gui.ml +++ b/src/plugins/value/gui_files/register_gui.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -21,1280 +21,13 @@ (**************************************************************************) open Cil_types -open Cil open Pretty_source -open Gtk_helper open Gui_types type main_ui = Design.main_window_extension_points type menu = GMenu.menu GMenu.factory -let rec list_assoc f e = function - | [] -> raise Not_found - | (e', v) :: q -> if f e e' then v else list_assoc f e q - -let rec list_mem f e = function - | [] -> false - | e' :: q -> f e e' || list_mem f e q - -let rec list_remove f e = function - | [] -> [] - | e' :: q -> if f e e' then list_remove f e q else e' :: list_remove f e q - -let rec list_mem_assoc f e = function - | [] -> false - | (e', _) :: q -> f e e' || list_mem_assoc f e q - -module Callstacks_manager = struct - - (* Selection of a row; [RSelectedCallstackCol] corresponds to the fact - that both the row _and_ the 'Callstacks' column are selected. *) - type row_selected = RUnselected | RSelected | RSelectedCallstackCol - - (* Information shown in a single row *) - type row = { - callstack: gui_callstack; - rev_callstack: Gui_callstacks_filters.rcallstack (* cache *); - mutable exprs: (gui_selection * Gui_eval.gui_selection_data) list - (* if a column exists in the view, it expects to find some data for - itself in each row here. *); - mutable selected: row_selected; - } - - let row_unfocused () = { - callstack = GC_Filtered; - rev_callstack = Gui_callstacks_filters.empty; - exprs = []; - selected = RUnselected; - } - - type rows = row GCallstackMap.t - - let find_data row expr = - try list_assoc gui_selection_equal expr row.exprs - with Not_found -> - (* should happen only for the "results hidden" special row, and - in case of an evaluation error *) - Gui_eval.gui_selection_data_empty - - let (!!) = Lazy.force - - let add_expr_to_row row expr data = - if not (list_mem_assoc gui_selection_equal expr row.exprs) then - row.exprs <- (expr, data) :: row.exprs - - let add_data_to_rows rows callstack expr data = - try - let cur_row = GCallstackMap.find callstack rows in - add_expr_to_row cur_row expr data; - rows - with Not_found -> - let row = { - callstack; exprs = []; selected = RUnselected; - rev_callstack = (match callstack with - | GC_Consolidated | GC_Filtered -> Gui_callstacks_filters.empty - | GC_Single s | GC_Callstack s -> - Gui_callstacks_filters.from_callstack s); - } in - add_expr_to_row row expr data; - GCallstackMap.add callstack row rows - - type filter_column = - FilterAlarm of bool | FilterBefore of gui_res | FilterAfter of gui_after - type filter = gui_selection * bool * filter_column - - let pretty_filter_column fmt = function - | FilterAlarm b -> Format.fprintf fmt "%s" (if b then "!" else " ") - | FilterBefore r -> Format.fprintf fmt "%a" pretty_gui_res r - | FilterAfter r -> Format.fprintf fmt "%a" pretty_gui_after r - - let rec remove_filter e : filter list -> _ = function - | [] -> [] - | (e', _, _ as hd) :: q as l -> - let q' = remove_filter e q in - if gui_selection_equal e e' then q' else if q == q' then l else hd :: q' - - module GColumn = struct - type t = GTree.view_column - let hash c = c#misc#get_oid - let equal c1 c2 = (c1#misc#get_oid = c2#misc#get_oid) - end - - (* Hash tables indexed by GTree columns *) - module HColumns = FCHashtbl.Make(GColumn) - - (* Description of the columns of the widget. The [gui_selection] information - refers to what the column is displaying *) - type column_type = - | CCallstack - | CBefore of gui_selection - | CAfter of gui_selection - | CAlarm of gui_selection - | CEmpty (* empty column at the end, for aesthetic purposes *) - - let equal_column_type ct1 ct2 = match ct1, ct2 with - | CCallstack, CCallstack | CEmpty, CEmpty -> true - | CBefore e1, CBefore e2 | CAfter e1, CAfter e2 | CAlarm e1, CAlarm e2 -> - gui_selection_equal e1 e2 - | _ -> false - - (* This is an hybrid between the model and the view. *) - type model = { - mutable loc: gui_loc option (* model: loc which is being visualized *); - mutable all_exprs: gui_selection list (* G expressions that are currently - being displayed *); - mutable columns_type: (column_type * (filtered:bool -> unit)) HColumns.t - (* mapping from GTK columns to the data they display, plus a function - whose argument indicates whether the column is filtered *); - mutable rows: rows (* model: rows to display. Sorted, unfiltered - (the view does the filtering *); - mutable row_selected: (int * row) option (* view: row currently selected *); - mutable focused_rev_callstacks: Gui_callstacks_filters.filter - (* reverse of the callstacks currently being focused. On all tabs, - the focused callstacks are the only ones that are shown. On the - 'Selection' tab, they are also used to refine the states that - are being shown, as well as 'go to callers', etc. *); - mutable filters: filter list; - mutable full_callstacks_height: bool (* Set to 'true' to expand rows so - that the entire callstacks are shown *); - mutable show_consolidated: bool (* show results in consolidated state *); - mutable show_by_callstacks: bool (* show results by callstacks *); - mutable hidden_columns: column_type list (* columns hidden by the user *); - } - - (* Is there a filter on the column? *) - let column_has_filter model col_type = - match col_type with - | CEmpty -> false - | CCallstack -> model.focused_rev_callstacks <> None - | CBefore e | CAfter e | CAlarm e -> - let has (e', _, f) = - gui_selection_equal e e' && - (match f, col_type with - | FilterBefore _, CBefore _ | FilterAfter _, CAfter _ - | FilterAlarm _, CAlarm _ -> true - | _ -> false) - in - List.exists has model.filters - - let data_matches_filter data pos col = - let ok = - match col with - | FilterAlarm a -> data.Gui_eval.alarm = a - | FilterBefore r -> equal_gui_res r data.Gui_eval.before - | FilterAfter r -> equal_gui_after r data.Gui_eval.after - in - if pos then ok else not ok - - let row_matches_filter row (expr, pos, col: filter) = - try - let data = list_assoc gui_selection_equal expr row.exprs in - data_matches_filter data pos col - with Not_found -> (* should not happen *) false - - let filters_match row filters = - List.for_all (row_matches_filter row) filters - - class type cm_panel = object - method model: model - - method start_session: gui_loc -> multiple:bool -> unit - (* clear the model, except in "multiple" view, in which case multiple - localizable on the same location are stacked *) - - method add_data: - gui_selection -> gui_callstack -> Gui_eval.gui_selection_data -> unit - - method render_session: unit -> unit - (* display the current model, taking current filter settings into account *) - - method clear: unit -> unit (* reset both model and widget *) - - method expand_row_for_callstacks: bool -> unit - method show_consolidated: bool -> unit - method show_by_callstacks: bool -> unit - (* These three methods are called by the 'Values' panel when the - corresponding checkboxes are set or unset *) - - method clone: model -> unit - end - - (* Fetch the internal (hidden) GtkButton of the column header. *) - let get_column_header_button (col: GTree.view_column) = - let rec get_button = function - | None -> None - | Some w -> - if w#misc#get_type = "GtkButton" - then - let but_props = GtkButtonProps.Button.cast w#as_widget in - Some (new GButton.button but_props) - else get_button w#misc#parent - in - get_button col#widget - - let show_icon (icon: GMisc.image) = fun ~filtered -> match filtered with - | true -> icon#misc#show () - | false -> icon#misc#hide () - - - module Data = Indexer.Make( - struct - type t = int*row - let compare (x,_) (y,_) = Pervasives.compare x y - end) - - (* This function creates a single GTree that displays per-callstack - results *) - let make_panel (main_ui:main_ui) ~callback_focus_callstack ~show_consolidated ~show_by_callstacks ~full_callstacks_height = - let gtk_model = - object(self) - val mutable m = Data.empty - val mutable age = 0 - method data = m - method size = Data.size m - method index i = Data.index i m - method get i = Data.get i m - method add i = age<-age+1; m <- Data.add (age,i) m;age,i - method reload = age<-0; m <- Data.empty - method coerce = (self:> (int*row) Wtable.listmodel) - end - in - let frame = GBin.frame ~shadow_type:`ETCHED_OUT () in - let w = new Wtable.list - ~packing:frame#add ~headers:true ~rules:true gtk_model#coerce - in - w#view#set_fixed_height_mode false; - let model = { - loc = None; rows = GCallstackMap.empty; - row_selected = None; focused_rev_callstacks = None; filters = []; - full_callstacks_height; all_exprs = []; - columns_type = HColumns.create 8; show_by_callstacks; - show_consolidated; hidden_columns = []; - } in - let row_is_visible row = - match row.callstack, - model.show_consolidated, - model.show_by_callstacks, - model.focused_rev_callstacks - with - | GC_Consolidated, false, _, _ - | GC_Callstack _, _, false, _ - | GC_Single _, false, false, _ - | GC_Consolidated, _, _, Some _ -> false - | (GC_Single _ | GC_Callstack _), _, _, (Some _ as cs') -> - Gui_callstacks_filters.callstack_matches cs' row.rev_callstack && - filters_match row model.filters - | _ -> filters_match row model.filters - in - (* Context menu to hide and show columns *) - let filter_menu (menu: GMenu.menu Lazy.t) = - let process column (col_type, _icon) = - try - let txt = match col_type with - | CBefore e -> - Format.asprintf "'%a' (before)" pretty_gui_selection e - | CAfter e -> - Format.asprintf "'%a' (after)" pretty_gui_selection e - | CAlarm e -> - Format.asprintf "'%a' (alarms)" pretty_gui_selection e - | CCallstack | CEmpty -> raise Not_found - in - if column#visible || - list_mem equal_column_type col_type model.hidden_columns - then - let show = GMenu.check_menu_item ~label:txt () in - show#set_show_toggle true; - show#set_active column#visible; - (* Hide this column. Keep it alive for filters and co. *) - let callback_show_hide () = - if column#visible then begin - model.hidden_columns <- col_type :: model.hidden_columns; - column#set_visible false - end else begin - model.hidden_columns <- - list_remove equal_column_type col_type model.hidden_columns; - column#set_visible true - end; - in - ignore (show#connect#activate callback_show_hide); - (!!menu)#add (show :> GMenu.menu_item); - with Not_found -> () - in - HColumns.iter process model.columns_type; - in - (* Add a custom title to the column: a text, an icon indicating that - the column is filtered, and a tooltip. Returns the filter icon *) - let add_column_header (col: GTree.view_column) text tooltip = - col#set_min_width 25; - col#set_clickable true; - let h = GPack.hbox () in - let _lbl = GMisc.label ~text ~packing:h#pack () in - let icon = GMisc.image ~xpad:10 ~stock:`COLOR_PICKER ~packing:h#pack () in - icon#misc#hide (); - let tooltip_before = GData.tooltips () in - tooltip_before#set_tip ~text:tooltip h#coerce; - (* set_widget forces Gtk to create a header button for the view_column. *) - col#set_widget (Some h#coerce); - icon - in - let add_column_header_callback col mk_menu = - let pop_menu () = - let menu = lazy (GMenu.menu ()) in - List.iter (fun elem -> elem menu) mk_menu; - if Lazy.is_val menu then begin - let time = GtkMain.Main.get_current_event_time () in - (!!menu)#popup ~button:3 ~time - end - in - match get_column_header_button col with - | None -> ignore (col#connect#clicked pop_menu) (* TODO: warn *) - | Some button -> - (* Connect the callback to a right-click *) - let callback evt = - if GdkEvent.Button.button evt = 3 then begin - pop_menu (); true - end else false - in - ignore (button#event#connect#button_release ~callback) - in - let col_callstack = - w#add_column_text ~title:"Callstack" [`YALIGN 0.0] - (fun (_,{callstack=stack; selected}) -> - let height = - if selected <> RUnselected || model.full_callstacks_height - then -1 else 1 - in - let text = match stack with - | GC_Filtered -> [`TEXT "filters active"; `STYLE `ITALIC] - | GC_Consolidated -> [`TEXT "all"; `STYLE `ITALIC] - | GC_Single stack | GC_Callstack stack -> - let pp_text = if selected = RSelectedCallstackCol - then Pretty_utils.to_string pretty_callstack - else Pretty_utils.to_string ~margin:50 pretty_callstack_short - in - [`TEXT (pp_text stack); `STYLE `NORMAL] - in - [`HEIGHT height] @ text) - in - let col_empty = w#add_column_empty in - let clear_widget remove_columns = - Extlib.may (fun (_, r) -> r.selected <- RUnselected) model.row_selected; - model.row_selected <- None; - if remove_columns then begin - model.all_exprs <- []; - (* Clear out all columns except 'Callstacks' and "empty": clear - everything, then restore those two. *) - let data_col_cs = HColumns.find model.columns_type col_callstack in - let data_col_empty = HColumns.find model.columns_type col_empty in - HColumns.iter (fun column (col_typ, _) -> - if col_typ <> CCallstack && col_typ <> CEmpty then - ignore (w#view#remove_column column) - ) model.columns_type; - HColumns.clear model.columns_type; - HColumns.add model.columns_type col_callstack data_col_cs; - HColumns.add model.columns_type col_empty data_col_empty; - end; - (* Post a reload request before clearing. - The current model is used to know how many rows - must be deleted. *) - w#reload ; - in - let clear_model () = - clear_widget true; - model.loc <- None; - model.rows <- GCallstackMap.empty; - model.filters <- []; - model.hidden_columns <- []; - in - let start_session loc ~multiple = - if not (multiple && Extlib.opt_equal gui_loc_equal (Some loc) model.loc) - then begin - clear_model (); - model.loc <- Some loc; - end - in - let rec add_columns expr = - let expr_string = Pretty_utils.to_string pretty_gui_selection expr in - let _expr_string_short = - if String.length expr_string >= 15 then - String.sub expr_string 0 15 ^ ".." - else expr_string - in - (* 'Before' column *) - let col_before = w#add_column_text [`YALIGN 0.0] - (fun (_, row) -> - let data = find_data row expr in - [`TEXT !!(data.Gui_eval.before_string)]) - in - let tip_before = - Printf.sprintf "Value of '%s' before the current point" expr_string - in - (* 'Alarm column *) - let show_alarm_col = ref (fun () -> ()) in - let col_alarm = - w#add_column_pixbuf [`YALIGN 0.0;`XALIGN 0.5] - (fun (_, row) -> - let data = find_data row expr in - if data.Gui_eval.alarm then begin - !show_alarm_col (); - [`STOCK_ID "gtk-dialog-warning"] - end else []) - in - show_alarm_col := (fun () -> - let ct = CAlarm expr in - if not (list_mem equal_column_type ct model.hidden_columns) then - col_alarm#set_visible true); - col_alarm#set_visible false; - let tip_alarm = - Printf.sprintf "Does evaluation of '%s' always succeed?" expr_string - in - (* 'After column *) - let show_after_col = ref (fun () -> ()) in - let col_after = w#add_column_text [`YALIGN 0.0] - (fun (_, row) -> - let data = find_data row expr in - match data.Gui_eval.after with - | GA_NA -> [`TEXT "n/a"; `STYLE `ITALIC] - | GA_Unchanged -> [`TEXT "unchanged"; `STYLE `ITALIC] - | GA_After _ -> - !show_after_col (); - [`TEXT !!(data.Gui_eval.after_string); `STYLE `NORMAL]) - in - col_after#set_visible false; - let title_after = expr_string ^ " (after)" in - let tip_after = - Printf.sprintf "Value of '%s' after the current point" expr_string - in - show_after_col := (fun () -> - let ct = CAfter expr in - if not (list_mem equal_column_type ct model.hidden_columns) then - col_after#set_visible true); - (* This is the menu displayed when the user left-clicks on the header of - one of the three columns *) - let menu_on_expr col_type (icon: GMisc.image) (menu: GMenu.menu Lazy.t)= - let has_filters = column_has_filter model col_type in - let txt_remove_col = - Format.asprintf "Remove all columns for '%a'%s" - pretty_gui_selection expr - (if has_filters then " (including filters)" else "") - in - let remove = GMenu.menu_item ~label:txt_remove_col () in - (!!menu)#add remove; - let callback_remove_filters () = - icon#misc#hide (); - let filters' = remove_filter expr model.filters in - let filters_changed = filters' != model.filters in - model.filters <- filters'; - if filters_changed then render_session () - in - (* Remove all the columns related to 'expr' *) - let callback_remove () = - model.all_exprs <- - list_remove gui_selection_equal expr model.all_exprs; - HColumns.iter - (fun col (col_type, _) -> - match col_type with - | CBefore e | CAfter e | CAlarm e - when gui_selection_equal expr e -> - ignore (w#view#remove_column col); - HColumns.remove model.columns_type col; - | _ -> () - ) model.columns_type; - callback_remove_filters (); - in - ignore (remove#connect#activate callback_remove); - if has_filters then begin - let txt_unfilter = "Remove filters on this column" in - let unfilter = GMenu.menu_item ~label:txt_unfilter () in - (!!menu)#add unfilter; - ignore (unfilter#connect#activate callback_remove_filters); - end; - in - let aux_expr_column (col: GTree.view_column) coltype txt tip = - let icon = add_column_header col txt tip in - let mk_menu = [ - menu_on_expr coltype icon; - filter_menu - ] in - add_column_header_callback col mk_menu; - HColumns.add model.columns_type col (coltype, show_icon icon); - in - aux_expr_column col_before (CBefore expr) expr_string tip_before; - aux_expr_column col_alarm (CAlarm expr) " " tip_alarm; - aux_expr_column col_after (CAfter expr) title_after tip_after; - and add_data expr callstack data = - (* If the expression has never been displayed before, create the - columns *) - if not (list_mem gui_selection_equal expr model.all_exprs) then begin - add_columns expr; - model.all_exprs <- expr :: model.all_exprs - end; - model.rows <- add_data_to_rows model.rows callstack expr data - and render_session () = - clear_widget false; - let has_visible_row = ref false in - GCallstackMap.iter (fun _cs row -> - if row_is_visible row then begin - has_visible_row := true; - w#insert_row (gtk_model#add row); - end; - ) model.rows; - if not !has_visible_row && not (GCallstackMap.is_empty model.rows) then - (* Add a special row to indicate that some things are hidden by - filters. This row is intentionally only added to the view, but - not to the model *) - w#insert_row (gtk_model#add (row_unfocused ())); - GtkTree.TreeView.columns_autosize w#view#as_tree_view; - in - (* Callback called when a callstack is focused or unfocused *) - let callback_focus_unfocus lcs icon () = - let conv = List.map Gui_callstacks_filters.from_callstack in - let lrcs = Extlib.opt_map conv lcs in - callback_focus_callstack lrcs; - icon ~filtered:(lcs <> None); - model.focused_rev_callstacks <- lrcs; - render_session (); - in - (* Add 'Unfocus callstacks' option to menu. *) - let add_unfocus_callstacks menu icon = - if Extlib.has_some model.focused_rev_callstacks then begin - let unfocus = GMenu.menu_item ~label:"Unfocus callstack(s)" () in - (!!menu)#add unfocus; - ignore (unfocus#connect#activate (callback_focus_unfocus None icon)) - end; - in - (* Add 'Focus on all displayed callstacks' to menu *) - let add_focus_all_callstacks menu icon = - let visible_callstack cs row acc = - match cs with - | GC_Single cs | GC_Callstack cs -> - if row_is_visible row then cs :: acc else acc - | _ -> acc - in - let callstacks = GCallstackMap.fold visible_callstack model.rows [] in - if List.length callstacks > 1 then - let focus_all = GMenu.menu_item ~label:"Focus on all \ - displayed callstacks" () in - (!!menu)#add focus_all; - ignore (focus_all#connect#activate - (callback_focus_unfocus (Some callstacks) icon)); - in - let tip_callstack = "Callstacks at which the selection was analyzed" in - let icon_callstack = - add_column_header col_callstack "Callstack" tip_callstack - in - let mk_menu_header_callstack menu = - add_unfocus_callstacks menu (show_icon icon_callstack); - add_focus_all_callstacks menu (show_icon icon_callstack); - filter_menu menu; - in - add_column_header_callback col_callstack [mk_menu_header_callstack]; - HColumns.add model.columns_type col_callstack - (CCallstack, show_icon icon_callstack); - HColumns.add model.columns_type col_empty - (CEmpty, (fun ~filtered:_ -> ())); - let clone model' = - clear_model () (* resets row_selected + the widget itself *); - model.loc <- model'.loc; - model.all_exprs <- model'.all_exprs; - (* Recreate the columns, in particular the field 'columns_type' *) - List.iter add_columns (List.rev model'.all_exprs); - model.rows <- - GCallstackMap.map - (fun r -> { r with selected = RUnselected}) model'.rows; - model.focused_rev_callstacks <- model'.focused_rev_callstacks; - model.filters <- model'.filters; - HColumns.iter (fun _col (coltype, icon) -> - icon ~filtered:(column_has_filter model' coltype) - ) model.columns_type; - model.full_callstacks_height <- model'.full_callstacks_height; - model.show_consolidated <- model'.show_consolidated; - model.show_by_callstacks <- model'.show_by_callstacks; - render_session () - in - (* This is the menu which is displayed when the user right-clicks - on a data column. It can be used to filter lines *) - let popup_menu_filter expr v icon vars_to_display = - let menu = GMenu.menu () in - let callback_copy () = - (* we copy to both PRIMARY and CLIPBOARD clipboards, - for easier pasting *) - (* for a more readable result, add a separator between - the expression and its value when necessary *) - let value_str = Format.asprintf "%a" pretty_filter_column v in - let text = - Format.asprintf "%a%s%a" - pretty_gui_selection expr - (if String.get value_str 0 = ' ' then "" else " -> ") - pretty_filter_column v - in - let clipboard = GtkBase.Clipboard.get Gdk.Atom.clipboard in - GtkBase.Clipboard.set_text clipboard text; - let primary = GtkBase.Clipboard.get Gdk.Atom.primary in - GtkBase.Clipboard.set_text primary text - in - let callback_only_except oe () = - let filter = expr, oe, v in - model.filters <- filter :: model.filters; - icon ~filtered:true; - render_session (); - in - let copy = GMenu.menu_item ~label:"Copy to clipboard" () in - let equal = GMenu.menu_item ~label:"Only equal" () in - let different = GMenu.menu_item ~label:"Only different" () in - menu#add copy; - menu#add (GMenu.separator_item ()); - menu#add equal; - menu#add different; - ignore (copy#connect#activate callback_copy); - ignore (equal#connect#activate (callback_only_except true)); - ignore (different#connect#activate (callback_only_except false)); - (* add menu items for variables present in the selected expression *) - let callback_display_var vi () = - Extlib.may (fun loc -> - let opt_states = Gui_eval.callstacks_at_gui_loc loc in - Extlib.may - (fun { Gui_eval.states_before = before; states_after = after } -> - let lval = (Var vi, NoOffset) in - let _errors = Gui_eval.make_data_all_callstacks add_data - Gui_eval.lval_ev ~before ~after lval - in - render_session () - ) opt_states - ) model.loc - in - List.iter (fun vi -> - let label = Format.asprintf "Display values for '%a'" - Printer.pp_varinfo vi in - let varmenuitem = GMenu.menu_item ~label () in - menu#add varmenuitem; - ignore (varmenuitem#connect#activate (callback_display_var vi)); - ) vars_to_display; - let time = GtkMain.Main.get_current_event_time () in - menu#popup ~button:3 ~time - in - (* Updates the selection state of the given row. *) - let update_selected select (_, row as irow) = - row.selected <- select; - w#update_row irow; - in - w#on_click - (fun (_, row as irow) column -> - (* Update the height of the selected and deselected rows. *) - (* First, unselect the previous row, if it was not 'row' itself - (avoids flickering *) - begin match model.row_selected with - | Some (_, row_old as irow_old) when row_old != row -> - update_selected RUnselected irow_old; - | _ -> () - end; - (* Newt, update 'row' *) - update_selected (if GColumn.equal column col_callstack - then RSelectedCallstackCol - else RSelected) irow; - model.row_selected <- Some irow; - (* Dump the clicked cell on the "Information" tab, for copy-pasting - and/or selection *) - let dump s pp v = main_ui#pretty_information "@.%s:@.%a@." s pp v in - match HColumns.find model.columns_type column with - | CCallstack, _ -> begin - match row.callstack with - | GC_Single stack | GC_Callstack stack -> - dump "Stack" pretty_callstack stack - | GC_Consolidated | GC_Filtered -> () - end - | CBefore expr, _ -> - let data = find_data row expr in - dump "Value before" pretty_gui_res data.Gui_eval.before - | CAfter expr, _ -> begin - let data = find_data row expr in - match data.Gui_eval.after with - | GA_After after -> dump "Value after" pretty_gui_res after - | GA_NA | GA_Unchanged -> () - end - | CAlarm _, _ | CEmpty, _ -> () - ); - let gui_res_of_after f after = - match after with - | GA_After r -> f r - | GA_NA | GA_Unchanged -> [] - in - w#on_right_click - (fun (_, row) column -> - match HColumns.find model.columns_type column with - | CCallstack, icon -> begin - let menu = lazy (GMenu.menu ()) in - (* Add 'Focus' option when a callstack is selected *) - begin match row.callstack with - | GC_Single cs | GC_Callstack cs -> - let focus = GMenu.menu_item ~label:"Focus on this callstack"() in - (!!menu)#add focus; - ignore (focus#connect#activate - (callback_focus_unfocus (Some [cs]) icon)); - | GC_Filtered | GC_Consolidated -> () - end; - add_focus_all_callstacks menu icon; - add_unfocus_callstacks menu icon; - (* Popup the menu only if something as been added *) - if Lazy.is_val menu then - let time = GtkMain.Main.get_current_event_time () in - (!!menu)#popup ~button:3 ~time - end - | CBefore expr, icon -> - let data = find_data row expr in - if data.Gui_eval.before <> GR_Empty then - popup_menu_filter expr (FilterBefore data.Gui_eval.before) icon - (Gui_types.vars_in_gui_res data.Gui_eval.before); - | CAfter expr, icon -> - let data = find_data row expr in - if data.Gui_eval.before <> GR_Empty then - popup_menu_filter expr (FilterAfter data.Gui_eval.after) icon - (gui_res_of_after Gui_types.vars_in_gui_res data.Gui_eval.after) - | CAlarm expr, icon -> - let data = find_data row expr in - if data.Gui_eval.before <> GR_Empty then - popup_menu_filter expr (FilterAlarm data.Gui_eval.alarm) icon [] - | CEmpty, _ -> () - ); - frame, - (object - method model = model - method add_data = add_data - method render_session = render_session - method start_session = start_session - method clear = clear_model - method clone = clone - - method expand_row_for_callstacks expand = - if model.full_callstacks_height <> expand then begin - model.full_callstacks_height <- expand; - render_session () - end - - method show_by_callstacks show = - if model.show_by_callstacks <> show then begin - model.show_by_callstacks <- show; - render_session () - end - - method show_consolidated show = - if model.show_consolidated <> show then begin - model.show_consolidated <- show; - render_session () - end - end: cm_panel) - - class type t = object - (* Add something to view on the 'Selection' tab for the given statement *) - method display_at_loc: - gui_loc -> (* append * display *) - (gui_selection -> gui_callstack -> Gui_eval.gui_selection_data -> unit) * - (unit -> unit) - - (* Full reset, that should be called on project change *) - method reset: unit -> unit - - (* Clear the 'default' tab, for example on selection change. *) - method clear_default: unit -> unit - - method focused_rev_callstacks: Gui_callstacks_filters.filter - - (* Set focus on the 'Selection' tab, itself in the 'Values tab *) - method focus_selection_tab: unit -> unit - end - - module HWidget = Hashtbl.Make(struct - type t = GObj.widget - let hash w = Gobject.get_oid w#as_widget - let equal w1 w2 = - Gobject.get_oid w1#as_widget = Gobject.get_oid w2#as_widget - end) - - (* This function creates the buttons at the top of "Values" tab, plus - a tab control suitable for displaying multiple cm_panel *) - let make (main_ui:main_ui) ~packing = - let vpaned = GPack.vbox ~packing ~homogeneous:false () in - let hbox_filters = GPack.hbox ~packing:(vpaned#pack ~expand:false) () in - let chk_multiple = new Widget.checkbox ~label:"Multiple selections" - ~tooltip:"Allow the selection of multiple expressions on the same \ - statement" () - in - let chk_consolidated = new Widget.checkbox ~label:"Consolidated value" - ~tooltip:"Show values consolidated across all callstacks" () - in - let chk_callstacks = new Widget.checkbox ~label:"Per callstack" - ~tooltip:"Show values per callstack" () - in - let chk_rows_height = new Widget.checkbox ~label:"Expand rows" - ~tooltip:"Expand rows to fit the 'Callstack' column" () - in - let key_multiple = "Value.multiple_selections" in - let key_consolidated = "Value.show_consolidated" in - let key_by_callstacks = "Value.show_by_callstacks" in - let key_rows_height = "Value.expand_rows" in - let get_bool k default = Gtk_helper.Configuration.find_bool ~default k in - let save_bool k v = Gtk_helper.Configuration.(set k (ConfBool v)) in - chk_multiple#set (get_bool key_multiple false); - chk_consolidated#set (get_bool key_consolidated true); - chk_callstacks#set (get_bool key_by_callstacks true); - chk_rows_height#set (get_bool key_rows_height false); - hbox_filters#pack chk_multiple#coerce; - hbox_filters#pack ~from:`END chk_callstacks#coerce; - hbox_filters#pack ~from:`END chk_consolidated#coerce; -(* let lbl_filters = GMisc.label ~markup:"Filters: " () in - hbox_filters#pack ~from:`END lbl_filters#coerce; *) - hbox_filters#pack ~from:`END chk_rows_height#coerce; - let tabs = - GPack.notebook ~scrollable:true ~packing:(vpaned#pack ~expand:true) () - in - vpaned#misc#set_sensitive (Db.Value.is_computed ()); - let pack_tab ?lbl w = ignore (tabs#insert_page ?tab_label:lbl w) in - let lbl_pane_default = GPack.hbox () in - let clear_button = new Widget.button ~icon:`CLEAR ~tooltip:"Clear" () in - clear_button#set_enabled false; - let save_button = new Widget.button ~icon:`SAVE ~tooltip:"Save" () in - save_button#set_enabled false; - let lbl = GMisc.label ~markup:"Selection" () in - lbl_pane_default#pack lbl#coerce; - lbl_pane_default#pack clear_button#coerce; - lbl_pane_default#pack save_button#coerce; - let focus_selection_tab () = - let n = main_ui#lower_notebook#page_num vpaned#coerce in - main_ui#lower_notebook#goto_page n; - tabs#goto_page 0 - in - let focused_rev_callstacks = ref None in - (* Callback for the "Selection" tab: set the selected callstacks as filters, - plus rehighlight the source text (for dead code, etc) *) - let callback_focus_callstack lrcs = - Gui_callstacks_filters.set_callstacks_filter lrcs; - focused_rev_callstacks := lrcs; - main_ui#rehighlight () - in - let make_panel ?(callback_focus_callstack=fun _ -> ()) () = - make_panel main_ui - ~callback_focus_callstack - ~show_consolidated:chk_consolidated#get - ~show_by_callstacks:chk_callstacks#get - ~full_callstacks_height:chk_rows_height#get - in - let pane_default, model_default = make_panel ~callback_focus_callstack () in - pack_tab ~lbl:lbl_pane_default#coerce pane_default#coerce; - let hash_tabs = HWidget.create 16 in - let notify_switch_page n = - (* Hide the buttons of all the tabs not focused *) - HWidget.iter (fun _ (_, bt1, bt2) -> bt1#hide (); bt2#hide ()) hash_tabs; - if n = 0 then begin (* 'Selection' tab is focused *) - clear_button#coerce#misc#show (); - save_button#coerce#misc#show (); - end else - let w = tabs#get_nth_page n in - clear_button#coerce#misc#hide (); - save_button#coerce#misc#hide (); - try - (* Show the buttons of the current tab *) - let _, bt1, bt2 = HWidget.find hash_tabs w in - bt1#show (); bt2#show (); - with Not_found -> () (* should not happen *) - in - ignore (tabs#connect#switch_page ~callback:notify_switch_page); - let callback_save_button () = - let model = model_default#model in - match model.loc with - | Some loc -> - let txt = match loc with - | GL_Stmt (kf, stmt) -> - Format.asprintf "%a:%d" - Kernel_function.pretty kf - (fst (Cil_datatype.Stmt.loc stmt)).Lexing.pos_lnum - | GL_Pre kf -> - Format.asprintf "pre %a" Kernel_function.pretty kf - | GL_Post kf -> - Format.asprintf "post %a" Kernel_function.pretty kf - in - let hb = GPack.hbox () in - ignore (GMisc.label ~packing:hb#pack ~markup:txt ()); - let button_delete = - new Widget.button ~icon:`DELETE ~tooltip:"Delete" () - in - hb#pack button_delete#coerce; - button_delete#coerce#misc#hide (); - let button_edit = - new Widget.button ~icon:`EDIT ~tooltip:"Edit" () - in - hb#pack button_edit#coerce; - button_edit#coerce#misc#hide (); - let tab, model_tab = make_panel () in - button_delete#connect (fun () -> - let n = tabs#page_num tab#coerce in - tabs#remove_page n - ); - button_edit#connect (fun () -> - let loc = match loc with - | GL_Stmt (kf, stmt) -> - Pretty_source.PStmt (kf, stmt) - | GL_Pre kf | GL_Post kf -> - let vi = Kernel_function.get_vi kf in - Pretty_source.PVDecl (Some kf, vi) - in - main_ui#scroll loc; - model_default#clone model_tab#model; - tabs#goto_page 0; - callback_focus_callstack model_default#model.focused_rev_callstacks; - ); - HWidget.add hash_tabs tab#coerce - (model_tab, button_edit#coerce#misc, button_delete#coerce#misc); - pack_tab ~lbl:hb#coerce tab#coerce; - model_tab#clone model_default#model - | None -> () - in - save_button#connect callback_save_button; - let on_all f = - f model_default; - HWidget.iter (fun _ (model, _, _) -> f model) hash_tabs; - in - (* Clear the 'default' tab *) - let clear_default () = - clear_button#set_enabled false; - save_button#set_enabled false; - model_default#clear () - in - clear_button#connect clear_default; - chk_multiple#connect (fun b -> save_bool key_multiple b); - chk_consolidated#connect (fun b -> - save_bool key_consolidated b; - on_all (fun model -> model#show_consolidated b)); - chk_callstacks#connect (fun b -> - save_bool key_by_callstacks b; - on_all (fun model -> model#show_by_callstacks b)); - chk_rows_height#connect (fun b -> - save_bool key_rows_height b; - on_all (fun model -> model#expand_row_for_callstacks b)); - (* Clear all the tabs *) - let reset () = - (* the method get_n_pages is missing in Lablgtk. Instead, we iterate - over the hash tables of panels to remove the non-'Selection' ones *) - HWidget.iter (fun w _ -> tabs#remove_page (tabs#page_num w)) hash_tabs; - HWidget.clear hash_tabs; - clear_default (); - vpaned#misc#set_sensitive (Db.Value.is_computed ()); - in - (object - method display_at_loc loc = - clear_button#set_enabled true; - save_button#set_enabled true; - model_default#start_session loc ~multiple:chk_multiple#get; - model_default#add_data, (fun () -> model_default#render_session ()) - - method reset = reset - - method clear_default = clear_default - - method focused_rev_callstacks = !focused_rev_callstacks - - method focus_selection_tab = focus_selection_tab - end : t) - -end - -let display_eval_errors (main_ui:main_ui) l = - let pp = function - | Eval_terms.LogicEvalError ee -> - main_ui#pretty_information "Cannot evaluate: %a@." - Eval_terms.pretty_logic_evaluation_error ee - | e -> - main_ui#pretty_information "Unknown error during evaluation (%s)@." - (Printexc.to_string e) - in - List.iter pp l - -let select_loc main_ui (cm: Callstacks_manager.t) ev loc v = - match Gui_eval.callstacks_at_gui_loc loc with - | None -> () - | Some { Gui_eval.states_before = before; states_after = after } -> - let append, display = cm#display_at_loc loc in - let errors = Gui_eval.make_data_all_callstacks append ev ~before ~after v in - display_eval_errors main_ui errors; - display (); -;; - -let select_lv main_ui cm loc lv = - select_loc main_ui cm Gui_eval.lval_ev loc lv -let select_null main_ui cm loc = - select_loc main_ui cm Gui_eval.null_ev loc () -let select_exp main_ui cm loc exp = - select_loc main_ui cm Gui_eval.exp_ev loc exp -let select_term main_ui cm loc t = - select_loc main_ui cm (Gui_eval.term_ev loc) loc t -let select_tlv main_ui cm loc tlv = - select_loc main_ui cm (Gui_eval.tlval_ev loc) loc tlv -let select_predicate main_ui cm loc p = - select_loc main_ui cm (Gui_eval.predicate_ev loc) loc p - -(* Core of the graphical interface. *) - -let gui_compute_values (main_ui:main_ui) = - if not (Db.Value.is_computed ()) - then main_ui#launcher () - -let cleaned_outputs kf s = - let outs = Db.Outputs.kinstr (Kstmt s) in - let accept = - Callgraph.Uses.accept_base ~with_formals:true ~with_locals:true kf - in - let filter = Locations.Zone.filter_base accept in - Extlib.opt_map filter outs - -type term_or_pred = Term | Pred - -let pp_term_or_pred fmt = function - | Term -> Format.pp_print_string fmt "term" - | Pred -> Format.pp_print_string fmt "predicate" - -(* Evaluate the user-supplied term contained in the string [txt] *) -let eval_user_term_predicate (main_ui:main_ui) cm loc tp txt = - let kf = kf_of_gui_loc loc in - Cil.CurrentLoc.set (gui_loc_loc loc); - try - cm#focus_selection_tab (); - let env = Gui_eval.gui_loc_logic_env loc in - match tp with - | Term -> begin - if txt = "NULL" then - select_null main_ui cm loc - else - let term = !Db.Properties.Interp.term ~env kf txt in - match term.term_node with - | TLval _ | TStartOf _ -> select_tlv main_ui cm loc term - | _ -> select_term main_ui cm loc term - end - | Pred -> - let pred = !Db.Properties.Interp.predicate ~env kf txt in - select_predicate main_ui cm loc pred - with - | Logic_interp.Error (_, mess) -> - main_ui#error "Invalid %a: %s" pp_term_or_pred tp mess - | Parsing.Parse_error -> - main_ui#error "Invalid %a: Parse error" pp_term_or_pred tp - | Eval_terms.LogicEvalError ee -> - main_ui#error "Cannot evaluate %a (%a)" - pp_term_or_pred tp Eval_terms.pretty_logic_evaluation_error ee - | Log.AbortFatal s when s = "kernel" -> - let bt = Printexc.get_backtrace () in - (* possibly a typing error, avoid an error message too drastic *) - main_ui#error "Invalid %a (see the 'Console' tab for more details)." - pp_term_or_pred tp; - (* print the backtrace only if in debugging mode *) - Gui_parameters.debug "%s" bt - | e -> - main_ui#error "Invalid %a: %s" pp_term_or_pred tp (Cmdline.protect e) - -let last_evaluate_acsl_request = ref "" - -(* Opens a modal dialog asking for an ACSL expression and evaluates it - at location [loc]. *) -let eval_acsl_term_pred main_ui cm loc tp () = - let txt = - GToolbox.input_string ~title:"Evaluate" - ~text:!last_evaluate_acsl_request - (Format.asprintf " Enter an ACSL %a to evaluate " - pp_term_or_pred tp) - (* the spaces at beginning and end should not be necessary - but are the quickest fix for an aesthetic GTK problem *) - in - match txt with - | None -> () - | Some txt -> - last_evaluate_acsl_request:=txt; - eval_user_term_predicate main_ui cm loc tp txt - -let pretty_kf_escaped kf = - Pretty_utils.(escape_underscores (to_string Kernel_function.pretty kf)) - -(* popup a menu to jump the definitions of the given functions *) -let menu_go_to_fun_definition (main_ui:main_ui) (popup_factory:menu) funs = - let aux kf = - try - let g = Kernel_function.get_global kf in - ignore - (popup_factory#add_item - ("Go to definition of " ^ pretty_kf_escaped kf ^ " (indirect)") - ~callback:(fun () -> main_ui#select_or_display_global g)) - with Not_found -> () - in - Kernel_function.Hptset.iter aux funs - -(* popup a menu to jump to the definitions of the callers *) -let menu_go_to_callers (main_ui:main_ui) (menu:menu) csf kf = - try - let aux (menu:menu) (kf, call_sites) = - let nb_sites = List.length call_sites in - let label = "Go to caller " ^ pretty_kf_escaped kf in - let label = - if nb_sites > 1 then - label ^ " (" ^ (string_of_int nb_sites) ^ " call sites)" - else label - in - let callback () = - let g = Kernel_function.get_global kf in - main_ui#select_or_display_global g; - (* We put the cursor in the first call site and add the others (if any) - to the forward history. *) - match call_sites with - | first_call_site :: rest -> - main_ui#view_stmt first_call_site; - let other_call_sites = - List.map (fun call -> - let kf = Kernel_function.find_englobing_kf call in - History.Localizable (PStmt (kf, call)) - ) rest - in - History.set_forward other_call_sites - | [] -> assert false (* list was not empty *) - in - ignore (menu#add_item ~callback label) - in - let aux_focus (acc_focus, acc_unfocus) (kf, call_sites) = - let focus, unfocus = - List.partition (Gui_callstacks_filters.callsite_matches csf) call_sites - in - (if focus <> [] then (kf, focus) :: acc_focus else acc_focus), - (if unfocus <> [] then (kf, unfocus) :: acc_unfocus else acc_unfocus) - in - let focused, unfocused = - List.fold_left aux_focus ([], []) (!Db.Value.callers kf) - in - List.iter (aux menu) focused; - if unfocused <> [] then - let submenu = GMenu.menu () in - let item = - GMenu.menu_item ~label:"Callers in unselected callstack(s)" () - in - item#set_submenu submenu; - menu#menu#add item; - let factory = new GMenu.factory submenu in - List.iter (aux factory) unfocused - with Not_found -> () - -let pretty_stmt_info (main_ui:main_ui) kf stmt = - (* Is it an accessible statement ? *) - if Db.Value.is_reachable_stmt stmt then begin - if Value_results.is_non_terminating_instr stmt then - match stmt.skind with - | Instr (Call (_lvopt, _, _, _)) -> - (* This is not 100% accurate: the instr can also fail - when storing the result in [lvopt] *) - main_ui#pretty_information "This call never terminates.@." - | Instr _ -> - main_ui#pretty_information "This instruction always fail.@." - | _ -> () - else - (* Out for this statement *) - let outs = cleaned_outputs kf stmt in - match outs with - | Some outs -> - main_ui#pretty_information - "Modifies @[<hov>%a@]@." Db.Outputs.pretty outs - | _ -> () - end - else main_ui#pretty_information "This code is dead@." - -(* Actions to perform when the user has left-clicked, and Value is computed. - Maintain synchronized with [can_eval_acsl_expr_selector] later in this file.*) -let left_click_values_computed main_ui cm localizable = - try - let open Property in - match localizable with - | PStmt (kf,stmt) -> - if Gui_eval.results_kf_computed kf then - pretty_stmt_info main_ui kf stmt - | PLval (Some kf, Kstmt stmt,lv) -> - if not (isFunctionType (typeOfLval lv)) then - select_lv main_ui cm (GL_Stmt (kf, stmt)) lv - | PLval (Some kf, Kglobal, lv) -> (* see can_eval_acsl_expr_selector *) - if not (isFunctionType (typeOfLval lv)) then - select_lv main_ui cm (GL_Pre kf) lv - | PExp (Some kf, Kstmt stmt,e) -> - select_exp main_ui cm (GL_Stmt (kf, stmt)) e - | PTermLval (Some kf, Kstmt stmt, _, tlv) -> - let term = Logic_const.term (TLval tlv) (Cil.typeOfTermLval tlv) in - select_tlv main_ui cm (GL_Stmt (kf, stmt)) term - | PTermLval (Some kf, Kglobal, ip, tlv) -> begin - match Gui_eval.classify_pre_post kf ip with - | Some loc -> - let term = Logic_const.term (TLval tlv) (Cil.typeOfTermLval tlv) in - select_tlv main_ui cm loc term - | None -> () - end - | PVDecl (Some kf, vi) when vi.vformal -> - let lv = (Var vi, NoOffset) in - select_lv main_ui cm (GL_Pre kf) lv - | PIP (IPCodeAnnot (kf, stmt, - {annot_content = AAssert (_, p) | AInvariant (_, true, p)} )) -> - select_predicate main_ui cm (GL_Stmt (kf, stmt)) p - | PIP (IPPredicate (_, kf, Kglobal, p) as ip) -> begin - match Gui_eval.classify_pre_post kf ip with - | None -> () - | Some loc -> - select_predicate main_ui cm loc (Logic_const.pred_of_id_pred p) - end - | PLval (None , _, _) - | PExp ((_,Kglobal,_) | (None, Kstmt _, _)) - | PTermLval (None, _, _, _)-> () - | PVDecl (_kf,_vi) -> () - | PGlobal _ | PIP _ -> () - with - | Eval_terms.LogicEvalError ee -> - main_ui#pretty_information "Cannot evaluate term: %a@." - Eval_terms.pretty_logic_evaluation_error ee - -(* Actions to perform when the user has right-clicked, and Value is computed *) -let right_click_values_computed main_ui menu (cm: Callstacks_manager.t) localizable = - match localizable with - | PVDecl (Some kf, _) -> - menu_go_to_callers main_ui menu cm#focused_rev_callstacks kf - | PStmt (kf,stmt) -> - if Gui_eval.results_kf_computed kf then - ignore - (menu#add_item "_Evaluate ACSL term" - ~callback:(eval_acsl_term_pred main_ui cm (GL_Stmt (kf, stmt)) Term)) - | PLval (_kfopt, ki, lv) -> - let ty = typeOfLval lv in - (* Do special actions for functions *) - begin - (match lv with - | Var _,NoOffset when isFunctionType ty -> - () (* direct calls are handled by [Design]. *) - | Mem _, NoOffset when isFunctionType ty -> begin - (* Function pointers *) - (* get the list of functions in the values *) - let e = Cil.dummy_exp (Lval lv) in - let funs, _ = Eval_exprs.resolv_func_vinfo - ~with_alarms:CilE.warn_none_mode None - (Db.Value.get_state ki) e - in - menu_go_to_fun_definition main_ui menu funs - end - | _ -> () - ) - end - | PVDecl (None, _) | PExp _ | PTermLval _ | PGlobal _ | PIP _ -> () - -let _right_click_value_not_computed (main_ui:main_ui) (menu:menu) localizable = - match localizable with - | PVDecl (_,_) -> begin - ignore - (menu#add_item "Compute callers" - ~callback:(fun () -> (gui_compute_values main_ui))) - end - | _ -> () - -let to_do_on_select cm (menu:menu) (main_ui:main_ui) ~button selected = - if Db.Value.is_computed () then - if button = 1 then - left_click_values_computed main_ui cm selected - else if button = 3 then - right_click_values_computed main_ui menu cm selected +(* ------------------------ Eva panel and filetree -------------------------- *) module UsedVarState = Cil_state_builder.Varinfo_hashtbl @@ -1363,16 +96,15 @@ let sync_filetree (filetree:Filetree.t) = but the method reset of design.ml already does this. *) () - let hide_unused_function_or_var g = !hide_unused () && Db.Value.is_computed () && (match g with - | GFun ({svar = vi}, _) | GFunDecl (_, vi, _) -> - let kf = Globals.Functions.get vi in - not (!Db.Value.is_called kf) - | GVarDecl (vi, _) | GVar (vi, _, _) -> - not (used_var vi) - | _ -> false + | GFun ({svar = vi}, _) | GFunDecl (_, vi, _) -> + let kf = Globals.Functions.get vi in + not (!Db.Value.is_called kf) + | GVarDecl (vi, _) | GVar (vi, _, _) -> + not (used_var vi) + | _ -> false ) let value_panel (main_ui:main_ui) = @@ -1409,6 +141,395 @@ let value_panel (main_ui:main_ui) = )); "Value", box#coerce, Some refresh +(* ---------------------------- Highlighter --------------------------------- *) + +let active_highlighter buffer localizable ~start ~stop = + let open Gtk_helper in + let buffer = buffer#buffer in + (* highlight dead code areas, non-terminating calls, and degeneration + points if Value has run.*) + if Db.Value.is_computed () then + match localizable with + | PStmt (kf, stmt) -> begin + let degenerate = + try + Some ( + if Value_util.DegenerationPoints.find stmt + then (make_tag buffer ~name:"degeneration" [`BACKGROUND "orange"]) + else (make_tag buffer ~name:"unpropagated" [`BACKGROUND "yellow"]) + ) + with Not_found -> None + in + match degenerate with + | Some color_area -> + apply_tag buffer color_area start stop + | None -> + if Gui_eval.results_kf_computed kf then begin + let csf = Gui_callstacks_filters.focused_callstacks () in + if Gui_callstacks_filters.is_reachable_stmt csf stmt then begin + if Gui_callstacks_filters.is_non_terminating_instr csf stmt then + let non_terminating = + Gtk_helper.make_tag + buffer ~name:"value_non_terminating" + [`BACKGROUND "tomato"] + in + apply_tag buffer non_terminating (stop-1) stop + end + else + let dead_code_area = + make_tag buffer "deadcode" [`BACKGROUND "tomato";`STYLE `ITALIC] + in + apply_tag buffer dead_code_area start stop + end + end + | _ -> () + +(* ------------------------ Responses to selections ------------------------- *) + +let display_eval_errors (main_ui:main_ui) l = + let pp = function + | Eval_terms.LogicEvalError ee -> + main_ui#pretty_information "Cannot evaluate: %a@." + Eval_terms.pretty_logic_evaluation_error ee + | e -> + main_ui#pretty_information "Unknown error during evaluation (%s)@." + (Printexc.to_string e) + in + List.iter pp l + +let pretty_kf_escaped kf = + Pretty_utils.(escape_underscores (to_string Kernel_function.pretty kf)) + +(* popup a menu to jump the definitions of the given functions *) +let menu_go_to_fun_definition (main_ui:main_ui) (popup_factory:menu) funs = + let aux kf = + try + let g = Kernel_function.get_global kf in + ignore + (popup_factory#add_item + ("Go to definition of " ^ pretty_kf_escaped kf ^ " (indirect)") + ~callback:(fun () -> main_ui#select_or_display_global g)) + with Not_found -> () + in + List.iter aux funs + +let gui_compute_values (main_ui:main_ui) = + if not (Db.Value.is_computed ()) + then main_ui#launcher () + +let cleaned_outputs kf s = + let outs = Db.Outputs.kinstr (Kstmt s) in + let accept = + Callgraph.Uses.accept_base ~with_formals:true ~with_locals:true kf + in + let filter = Locations.Zone.filter_base accept in + Extlib.opt_map filter outs + +let pretty_stmt_info (main_ui:main_ui) kf stmt = + (* Is it an accessible statement ? *) + if Db.Value.is_reachable_stmt stmt then begin + if Value_results.is_non_terminating_instr stmt then + match stmt.skind with + | Instr (Call (_, _, _, _) + | Local_init (_, ConsInit _, _)) -> + (* This is not 100% accurate: the instr can also fail + when storing the result in [lvopt] *) + main_ui#pretty_information "This call never terminates.@." + | Instr _ -> + main_ui#pretty_information "This instruction always fail.@." + | _ -> () + else + (* Out for this statement *) + let outs = cleaned_outputs kf stmt in + match outs with + | Some outs -> + main_ui#pretty_information + "Modifies @[<hov>%a@]@." Db.Outputs.pretty outs + | _ -> () + end + else main_ui#pretty_information "This code is dead@." + +type term_or_pred = Term | Pred + +let pp_term_or_pred fmt = function + | Term -> Format.pp_print_string fmt "term" + | Pred -> Format.pp_print_string fmt "predicate" + +let last_evaluate_acsl_request = ref "" + +(* ------- Make the responses from the abstractions used in analysis ------- *) + +(** Responses of the GUI to user actions. Built by the Select functor. *) +module type Responses = sig + val eval_acsl_term_pred: main_ui -> gui_loc -> term_or_pred -> unit -> unit + val left_click_values_computed: main_ui -> localizable -> unit + val right_click_values_computed: main_ui -> menu -> localizable -> unit +end + +(** A "no response" module, when the GUI has not been built. *) +module No_Response = struct + let eval_acsl_term_pred _ _ _ () = () + let left_click_values_computed _ _ = () + let right_click_values_computed _ _ _ = () +end + +(* Module argument of the Select functor: it is the module resulting + from Gui_eval.A, plus the function display_at_loc coming from + gui_callstacks_manager. *) +module type Eval = sig + include Gui_eval.S + val display_data_by_callstack: + Analysis.Val.t Gui_callstacks_manager.display_data_by_callstack +end + +(* Builds the responses of the GUI to user actions. *) +module Select (Eval: Eval) = struct + + let select_loc main_ui ev loc v = + let data, errors = Eval.make_data_all_callstacks ev loc v in + display_eval_errors main_ui errors; + let selection = ev.Eval.expr_to_gui_selection v in + Eval.display_data_by_callstack loc selection data + + let is_scalar typ = + match Cil.unrollType typ with + | TInt _ | TEnum _ | TPtr _ | TFloat _ -> true + | _ -> false + + let select_lv main_ui loc lv = + if is_scalar (Cil.typeOfLval lv) + then select_loc main_ui Eval.lval_ev loc lv + else select_loc main_ui Eval.lval_as_offsm_ev loc lv + let select_null main_ui loc = + select_loc main_ui Eval.null_ev loc () + let select_exp main_ui loc exp = + select_loc main_ui Eval.exp_ev loc exp + let select_term main_ui loc t = + select_loc main_ui (Eval.term_ev loc) loc t + let select_tlv main_ui loc tlv = + select_loc main_ui (Eval.tlval_ev loc) loc tlv + let select_predicate main_ui loc p = + select_loc main_ui (Eval.predicate_ev loc) loc p + + (* Evaluate the user-supplied term contained in the string [txt] *) + let eval_user_term_predicate (main_ui:main_ui) loc tp txt = + let kf = kf_of_gui_loc loc in + try + Gui_callstacks_manager.focus_selection_tab (); + let env = Gui_eval.gui_loc_logic_env loc in + match tp with + | Term -> begin + if txt = "NULL" then + select_null main_ui loc + else + let term = !Db.Properties.Interp.term ~env kf txt in + match term.term_node with + | TLval _ | TStartOf _ -> select_tlv main_ui loc term + | _ -> select_term main_ui loc term + end + | Pred -> + let pred = !Db.Properties.Interp.predicate ~env kf txt in + select_predicate main_ui loc pred + with + | Logic_interp.Error (_, mess) -> + main_ui#error "Invalid %a: %s" pp_term_or_pred tp mess + | Parsing.Parse_error -> + main_ui#error "Invalid %a: Parse error" pp_term_or_pred tp + | Eval_terms.LogicEvalError ee -> + main_ui#error "Cannot evaluate %a (%a)" + pp_term_or_pred tp Eval_terms.pretty_logic_evaluation_error ee + | Log.AbortFatal s when s = "kernel" -> + let bt = Printexc.get_backtrace () in + (* possibly a typing error, avoid an error message too drastic *) + main_ui#error "Invalid %a (see the 'Console' tab for more details)." + pp_term_or_pred tp; + (* print the backtrace only if in debugging mode *) + Gui_parameters.debug "%s" bt + | e -> + main_ui#error "Invalid %a: %s" pp_term_or_pred tp (Cmdline.protect e) + + (* Opens a modal dialog asking for an ACSL expression and evaluates it + at location [loc]. *) + let eval_acsl_term_pred main_ui loc tp () = + let txt = + Gtk_helper.input_string ~title:"Evaluate" + ~text:!last_evaluate_acsl_request + (Format.asprintf " Enter an ACSL %a to evaluate " + pp_term_or_pred tp) + (* the spaces at beginning and end should not be necessary + but are the quickest fix for an aesthetic GTK problem *) + in + match txt with + | None -> () + | Some txt -> + last_evaluate_acsl_request:=txt; + eval_user_term_predicate main_ui loc tp txt + + (* popup a menu to jump to the definitions of the callers *) + let menu_go_to_callers (main_ui:main_ui) (menu:menu) csf kf = + try + let aux (menu:menu) (kf, call_sites) = + let nb_sites = List.length call_sites in + let label = "Go to caller " ^ pretty_kf_escaped kf in + let label = + if nb_sites > 1 then + label ^ " (" ^ (string_of_int nb_sites) ^ " call sites)" + else label + in + let callback () = + let g = Kernel_function.get_global kf in + main_ui#select_or_display_global g; + (* We put the cursor in the first call site and add the others (if any) + to the forward history. *) + match call_sites with + | first_call_site :: rest -> + main_ui#view_stmt first_call_site; + let other_call_sites = + List.map (fun call -> + let kf = Kernel_function.find_englobing_kf call in + History.Localizable (PStmt (kf, call)) + ) rest + in + History.set_forward other_call_sites + | [] -> assert false (* list was not empty *) + in + ignore (menu#add_item ~callback label) + in + let aux_focus (acc_focus, acc_unfocus) (kf, call_sites) = + let focus, unfocus = + List.partition (Gui_callstacks_filters.callsite_matches csf) call_sites + in + (if focus <> [] then (kf, focus) :: acc_focus else acc_focus), + (if unfocus <> [] then (kf, unfocus) :: acc_unfocus else acc_unfocus) + in + let focused, unfocused = + List.fold_left aux_focus ([], []) (!Db.Value.callers kf) + in + List.iter (aux menu) focused; + if unfocused <> [] then + let submenu = GMenu.menu () in + let item = + GMenu.menu_item ~label:"Callers in unselected callstack(s)" () + in + item#set_submenu submenu; + menu#menu#add item; + let factory = new GMenu.factory submenu in + List.iter (aux factory) unfocused + with Not_found -> () + + (* Actions to perform when the user has left-clicked, and Value is computed. + Maintain synchronized with [can_eval_acsl_expr_selector] later in this file.*) + let left_click_values_computed main_ui localizable = + try + let open Property in + match localizable with + | PStmt (kf,stmt) -> + if Gui_eval.results_kf_computed kf then + pretty_stmt_info main_ui kf stmt + | PLval (Some kf, Kstmt stmt,lv) -> + if not (Cil.isFunctionType (Cil.typeOfLval lv)) then + select_lv main_ui (GL_Stmt (kf, stmt)) lv + | PLval (Some kf, Kglobal, lv) -> (* see can_eval_acsl_expr_selector *) + if not (Cil.isFunctionType (Cil.typeOfLval lv)) then + select_lv main_ui (GL_Pre kf) lv + | PExp (Some kf, Kstmt stmt,e) -> + select_exp main_ui (GL_Stmt (kf, stmt)) e + | PTermLval (Some kf, Kstmt stmt, _, tlv) -> + let term = Logic_const.term (TLval tlv) (Cil.typeOfTermLval tlv) in + select_tlv main_ui (GL_Stmt (kf, stmt)) term + | PTermLval (Some kf, Kglobal, ip, tlv) -> begin + match Gui_eval.classify_pre_post kf ip with + | Some loc -> + let term = Logic_const.term (TLval tlv) (Cil.typeOfTermLval tlv) in + select_tlv main_ui loc term + | None -> () + end + | PVDecl (Some kf, _, vi) when vi.vformal -> + let lv = (Var vi, NoOffset) in + select_lv main_ui (GL_Pre kf) lv + | PVDecl (Some kf, Kstmt stmt, vi) -> + let lv = (Var vi, NoOffset) in + select_lv main_ui (GL_Stmt (kf, stmt)) lv + | PIP (IPCodeAnnot (kf, stmt, + {annot_content = AAssert (_, p) | AInvariant (_, true, p)} )) -> + select_predicate main_ui (GL_Stmt (kf, stmt)) p + | PIP (IPPredicate (_, kf, Kglobal, p) as ip) -> begin + match Gui_eval.classify_pre_post kf ip with + | None -> () + | Some loc -> + select_predicate main_ui loc (Logic_const.pred_of_id_pred p) + end + | PLval (None , _, _) + | PExp ((_,Kglobal,_) | (None, Kstmt _, _)) + | PTermLval (None, _, _, _)-> () + | PVDecl (_kf,_ki,_vi) -> () + | PGlobal _ | PIP _ -> () + with + | Eval_terms.LogicEvalError ee -> + main_ui#pretty_information "Cannot evaluate term: %a@." + Eval_terms.pretty_logic_evaluation_error ee + + (* Actions to perform when the user has right-clicked, and Value is computed *) + let right_click_values_computed main_ui menu localizable = + match localizable with + | PVDecl (Some kf, _, _) -> + let filter = Gui_callstacks_filters.focused_callstacks () in + menu_go_to_callers main_ui menu filter kf + | PStmt (kf,stmt) -> + if Gui_eval.results_kf_computed kf then + ignore + (menu#add_item "_Evaluate ACSL term" + ~callback:(eval_acsl_term_pred main_ui (GL_Stmt (kf, stmt)) Term)) + | PLval (_kfopt, ki, lv) -> + let ty = Cil.typeOfLval lv in + (* Do special actions for functions *) + begin + (match lv with + | Var _,NoOffset when Cil.isFunctionType ty -> + () (* direct calls are handled by [Design]. *) + | Mem _, NoOffset when Cil.isFunctionType ty -> begin + (* Function pointers *) + (* get the list of functions in the values *) + let e = Value_util.lval_to_exp lv in + match Eval.Analysis.get_kinstr_state ki with + | `Bottom -> () + | `Value state -> + let funs, _ = Eval.Analysis.eval_function_exp state e in + match funs with + | `Bottom -> () + | `Value funs -> + menu_go_to_fun_definition main_ui menu funs + end + | _ -> () + ) + end + | PVDecl (None, _, _) | PExp _ | PTermLval _ | PGlobal _ | PIP _ -> () + + let _right_click_value_not_computed (main_ui:main_ui) (menu:menu) localizable = + match localizable with + | PVDecl (_,_,_) -> begin + ignore + (menu#add_item "Compute callers" + ~callback:(fun () -> (gui_compute_values main_ui))) + end + | _ -> () + +end + +(* ----------------- Reference to responses, and use it -------------------- *) + +(* This reference contains the responses of the GUI built by the Select + functor. It is updated each time the abstractions used in Eva are changed. *) +let responses_ref = ref (module No_Response: Responses) + +let to_do_on_select (menu:menu) (main_ui:main_ui) ~button selected = + let module Responses = (val !responses_ref) in + if Db.Value.is_computed () then + if button = 1 then + Responses.left_click_values_computed main_ui selected + else if button = 3 then + Responses.right_click_values_computed main_ui menu selected + (* Find a location in which to evaluate things, when the given block is selected. *) let find_loc kf fdec block = @@ -1419,28 +540,28 @@ let find_loc kf fdec block = | [] -> None | s :: _ -> Some (GL_Stmt (kf, s)) -let add_keybord_shortcut_evaluate (main_ui:main_ui) cm = +let add_keybord_shortcut_evaluate main_ui = (* The currently selected statement is stored to enable a keyboard shortcut to activate it. [None] means that there is no selection or the selected element is not part of a statement. *) let selected_loc_for_acsl = ref None in - (* We add a selector to enable a keyboard shortcut for evaluating ACSL - expressions. This selector listens to modification events and - updates selected_loc_for_acsl to the stmt of the selected element. *) - let clear () = cm#clear_default () in - let select new_loc = - begin - match new_loc, !selected_loc_for_acsl with - | None, None -> () - | None, Some _ | Some _, None -> clear () - | Some new_loc, Some old_loc -> - if not (gui_loc_equal new_loc old_loc) then clear (); - end; - selected_loc_for_acsl := new_loc - in (* This function must be maintained synchronized with [left_click_values_computed] above. *) - let can_eval_acsl_expr_selector _menu (_main_ui:main_ui) ~button:_ selected = + let can_eval_acsl_expr_selector _menu _main ~button:_ selected = + (* We add a selector to enable a keyboard shortcut for evaluating ACSL + expressions. This selector listens to modification events and + updates selected_loc_for_acsl to the stmt of the selected element. *) + let clear () = Gui_callstacks_manager.clear_default () in + let select new_loc = + begin + match new_loc, !selected_loc_for_acsl with + | None, None -> () + | None, Some _ | Some _, None -> clear () + | Some new_loc, Some old_loc -> + if not (gui_loc_equal new_loc old_loc) then clear (); + end; + selected_loc_for_acsl := new_loc + in match selected with | PStmt (kf, stmt) | PLval (Some kf, Kstmt stmt, _) @@ -1457,17 +578,24 @@ let add_keybord_shortcut_evaluate (main_ui:main_ui) cm = else select None | PTermLval (Some kf, Kglobal, ip, _) -> select (Gui_eval.classify_pre_post kf ip) - | PVDecl (Some kf, vi) when vi.vformal -> + | PVDecl (Some kf, _, vi) when vi.vformal -> select (Some (GL_Pre kf)) - | PVDecl (Some kf, vi) when not (vi.vformal || vi.vglob) (* local *) -> - (* Notice that Pretty_source focuses on the statement containing the block - itself most of the time. This case only happens when you directly - select the declaration of a variable, between the type and the name *) - let fdec = Kernel_function.get_definition kf in - let bl = Ast_info.block_of_local fdec vi in - select (find_loc kf fdec bl) + | PVDecl (Some kf, ki, vi) when not (vi.vformal || vi.vglob) (* local *) -> + begin + match ki with + | Kstmt stmt -> (* local with initializers *) + select (Some (GL_Stmt (kf, stmt))) + | Kglobal -> (* no initializer. Find the declaration block *) + (* Notice that Pretty_source focuses on the statement containing the + block itself most of the time. The case handled here happens only + when you directly select the declaration of a variable, between + the type and the name *) + let fdec = Kernel_function.get_definition kf in + let bl = Ast_info.block_of_local fdec vi in + select (find_loc kf fdec bl) + end | PIP (Property.IPCodeAnnot (kf, stmt, - {annot_content = AAssert (_, _) | AInvariant (_, true, _)} )) -> + {annot_content = AAssert (_, _) | AInvariant (_, true, _)} )) -> select (Some (GL_Stmt (kf, stmt))) | PIP (Property.IPPredicate (_, kf, Kglobal, _) as ip) -> select (Gui_eval.classify_pre_post kf ip) @@ -1484,7 +612,9 @@ let add_keybord_shortcut_evaluate (main_ui:main_ui) cm = ~callback:(fun _ -> match !selected_loc_for_acsl with | None -> () - | Some loc -> eval_acsl_term_pred main_ui cm loc kind () + | Some loc -> + let module Responses = (val !responses_ref) in + Responses.eval_acsl_term_pred main_ui loc kind () ); in register_accel [`CONTROL] Term; @@ -1492,53 +622,40 @@ let add_keybord_shortcut_evaluate (main_ui:main_ui) cm = main_ui#main_window#add_accel_group accel_group ;; -let add_callstacks_manager (main_ui:main_ui) = - let callstacks_tab_label = (GMisc.label ~text:"Values" ())#coerce in - let packing w = - ignore - (main_ui#lower_notebook#insert_page ~tab_label:callstacks_tab_label w); +(* ----------------------------- Build the GUI ------------------------------ *) + +(* Resets the GUI parts that depend on the abstractions used for the Eva + analysis. This needs to be done each time the abstractions are changed. + The module [A] is the current analysis module; it contains the + abstractions used by Eva for the current analysis. *) +let reset (main_ui:main_ui) (module A: Analysis.S) = + (* Types of the GUI depending on the abstractions used for the analysis. *) + let module Gui_Types = Gui_types.Make (A.Val) in + (* Evaluation functions for the GUI. *) + let module Gui_Eval = Gui_eval.Make (A) in + (* Mandatory: registers the functions that perform an evaluation by + callstack. *) + Gui_callstacks_filters.register_to_zone_functions (module Gui_Eval); + (* Input module for building the callstack manager. *) + let module Input = struct + type value = A.Val.t + include Gui_Types + let make_data_for_lvalue lval loc = + fst (Gui_Eval.make_data_all_callstacks Gui_Eval.lval_as_offsm_ev loc lval) + end in + (* Builds the "Values" panel on the lower notebook of the GUI. The resulting + function is used to display data by callstacks on the user demand. *) + let display_data_by_callstack = + Gui_callstacks_manager.create main_ui (module Input) in - Callstacks_manager.make main_ui ~packing - -let highlighter csf (buffer:Design.reactive_buffer) localizable ~start ~stop= - let buffer = buffer#buffer in - (* highlight dead code areas, non-terminating calls, and degeneration - points if Value has run.*) - if Db.Value.is_computed () then - match localizable with - | PStmt (kf, stmt) -> begin - let degenerate = - try - Some ( - if Value_util.DegenerationPoints.find stmt - then (make_tag buffer ~name:"degeneration" [`BACKGROUND "orange"]) - else (make_tag buffer ~name:"unpropagated" [`BACKGROUND "yellow"]) - ) - with Not_found -> None - in - match degenerate with - | Some color_area -> - apply_tag buffer color_area start stop - | None -> - if Gui_eval.results_kf_computed kf then begin - let csf = csf () in - if Gui_callstacks_filters.is_reachable_stmt csf stmt then begin - if Gui_callstacks_filters.is_non_terminating_instr csf stmt then - let non_terminating = - Gtk_helper.make_tag - buffer ~name:"value_non_terminating" - [`BACKGROUND "tomato"] - in - apply_tag buffer non_terminating (stop-1) stop - end - else - let dead_code_area = - make_tag buffer "deadcode" [`BACKGROUND "tomato";`STYLE `ITALIC] - in - apply_tag buffer dead_code_area start stop - end - end - | _ -> () + (* Input module for builting the responses of the GUI. *) + let module Eval : Eval = struct + include Gui_Eval + let display_data_by_callstack = display_data_by_callstack + end in + let module Responses = Select (Eval) in + (* Stores the Responses module as a reference. *) + responses_ref := (module Responses) let main (main_ui:main_ui) = (* Hide unused functions and variables. Must be registered only once *) @@ -1554,19 +671,18 @@ let main (main_ui:main_ui) = main_ui#file_tree#reset () else sync_filetree main_ui#file_tree; - let cm = add_callstacks_manager main_ui in - Design.register_reset_extension (fun _ -> cm#reset ()); - main_ui#register_source_selector (to_do_on_select cm); - let callstacks_filter () = cm#focused_rev_callstacks in - main_ui#register_source_highlighter (highlighter callstacks_filter); + reset main_ui (Analysis.current_analyzer ()); + Analysis.register_hook (reset main_ui); + Design.register_reset_extension (fun _ -> Gui_callstacks_manager.reset ()); + main_ui#register_source_selector (to_do_on_select ); + main_ui#register_source_highlighter active_highlighter; main_ui#register_panel value_panel; - add_keybord_shortcut_evaluate main_ui cm; + add_keybord_shortcut_evaluate main_ui; ;; let () = Design.register_extension main ;; - (* Local Variables: compile-command: "make -C ../../../.." diff --git a/src/plugins/value/gui_files/register_gui.mli b/src/plugins/value/gui_files/register_gui.mli index e5f00c61802e0f3424a3a82b508779034f5106e5..650940098328d4985904844b759dfc1a5ae54350 100644 --- a/src/plugins/value/gui_files/register_gui.mli +++ b/src/plugins/value/gui_files/register_gui.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/legacy/TOREMOVE b/src/plugins/value/legacy/TOREMOVE new file mode 100644 index 0000000000000000000000000000000000000000..5290b0e4ea8f40a27e93c8183f0020edcd78e4d9 --- /dev/null +++ b/src/plugins/value/legacy/TOREMOVE @@ -0,0 +1,15 @@ +**Function_args**: only there to fill Db.Value.add_formals_to_state, itself used + by Inout/Cumulative_analysis. [compute_actual] is now in [Transfer_stmt], + [actualize_formals] is in [Cvalue_transfer] + +**Eval_annots**: ActiveBehaviors only there to fill Db.Value.valid_behaviors. + The same functionality is available inside transfer_logic, but under a + state-parameterized functor. + +**Eval_terms**: needed for the evaluation of the logic + +**Eval_op**: multiple dependencies in Eval_terms and builtins. Must be rewritten + into the corresponding functionality in Cvalue_forward. This requires having + contexts for logic terms, though. + +**Warn**: used in Eval_op, Eval_terms, and builtins (for specific alarms). diff --git a/src/plugins/value/legacy/eval_annots.ml b/src/plugins/value/legacy/eval_annots.ml index ce9493c6a0d535eb4df942a7bd199652a9479130..1a0d30e1fedf3f51b2185c661ff0b731e6286665 100644 --- a/src/plugins/value/legacy/eval_annots.ml +++ b/src/plugins/value/legacy/eval_annots.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,512 +29,10 @@ open Eval_terms let emit_status ppt status = Property_status.emit ~distinct:true Value_util.emitter ~hyps:[] ppt status - -(* Display the message as result/warning depending on [status] *) -let msg_status status ?current ?once ?source fmt = - if status = True then - if Value_parameters.ValShowProgress.get () - then Value_parameters.result ?current ?once ?source fmt - else Value_parameters.result ?current ?once ?source ~level:2 fmt - else - if Value_parameters.AlarmsWarnings.get () then - Value_parameters.warning ?current ?once ?source fmt - else - Value_parameters.result - ?current ?once ?source ~dkey:Value_parameters.dkey_alarm fmt - - -module ActiveBehaviors = struct - - let header b = - if Cil.is_default_behavior b then "" - else ", behavior " ^ b.b_name - - - let pp_bhv fmt b = - if not (Cil.is_default_behavior b) - then Format.fprintf fmt ", behavior %s" b.b_name - - let is_active_aux pre_state b = - let assumes = - (Logic_const.pands - (List.map Logic_const.pred_of_id_pred b.b_assumes)) - in - eval_predicate (env_pre_f ~pre:pre_state ()) assumes - - type t = { - init_state: Cvalue.Model.t; - funspec: funspec; - is_active: funbehavior -> predicate_status - } - - module HashBehaviors = Hashtbl.Make( - struct - type t = funbehavior - let equal b1 b2 = b1.b_name = b2.b_name - let hash b = Hashtbl.hash b.b_name - end) - - let create_from_spec init_state funspec = - let h = HashBehaviors.create 3 in - { is_active = - (fun b -> - try HashBehaviors.find h b - with Not_found -> - let active = is_active_aux init_state b in - HashBehaviors.add h b active; - active - ); - init_state = init_state; - funspec = funspec; - } - - let create init_state kf = - let funspec = Annotations.funspec kf in - create_from_spec init_state funspec - - let active ba = ba.is_active - - let is_active ba b = active ba b != False - - exception No_such_behavior - - let behavior_from_name ab b = - try List.find (fun b' -> b'.b_name = b) ab.funspec.spec_behavior - with Not_found -> raise No_such_behavior - - let active_behaviors ab = - List.filter (is_active ab) ab.funspec.spec_behavior - -end - let has_requires spec = let behav_has_requires b = b.b_requires <> [] in List.exists behav_has_requires spec.spec_behavior -let conv_status = function - | False -> Property_status.False_if_reachable; - | True -> Property_status.True; - | Unknown -> Property_status.Dont_know - -let behavior_inactive fmt = - Format.fprintf fmt " (Behavior may be inactive, no reduction performed.)" - -let pp_header kf fmt b = - Format.fprintf fmt "function %a%a" - Kernel_function.pretty kf ActiveBehaviors.pp_bhv b - - -(* The function that puts statuses on pre- and post-conditions is essentially - agnostic as to which kind of property it operates on. However, the messages - that get emitted are quite different. The types below distinguish between - the various possibilities. *) -type postcondition_kf_kind = -| PostLeaf (* The function has no body in the AST *) -| PostBody (* The function has a body, which is used for the evaluation *) -| PostUseSpec (* The function has a body, but its specification is used - instead *) -and p_kind = Precondition | Postcondition of postcondition_kf_kind | Assumes - -let pp_p_kind fmt = function - | Precondition -> Format.pp_print_string fmt "precondition" - | Postcondition _ -> Format.pp_print_string fmt "postcondition" - | Assumes -> Format.pp_print_string fmt "assumes" - -let post_kind kf = - if !Db.Value.use_spec_instead_of_definition kf then - if Kernel_function.is_definition kf then - PostUseSpec - else - PostLeaf - else - PostBody - -let ip_from_precondition kf call_ki b pre = - let ip_precondition = Property.ip_of_requires kf Kglobal b pre in - match call_ki with - | Kglobal -> (* status of the main function. We update the global - status, and pray that there is no recursion. - TODO: check what the WP does.*) - ip_precondition - | Kstmt stmt -> - (* choose the copy of the precondition on the call point [stmt]. *) - Statuses_by_call.setup_precondition_proxy kf ip_precondition; - Statuses_by_call.precondition_at_call kf ip_precondition stmt - -let emit_message_and_status kf bhv behav_active ip pre_post pred_status pred named_pred ~source = - let pp_header = pp_header kf in - match pre_post with - | Precondition | Postcondition PostBody -> - msg_status ~once:true ~source pred_status - "%a: %a%a got status %a.%t%t" - pp_header bhv pp_p_kind pre_post Description.pp_named named_pred - pretty_predicate_status pred_status - (if behav_active then (fun _ -> ()) else behavior_inactive) - Value_util.pp_callstack; - emit_status ip (conv_status pred_status); - | Postcondition (PostLeaf | PostUseSpec as postk) -> - (* Do not display anything for postconditions of leaf functions that - receive status valid (very rare) or unknown: this brings no - information. However, warn the user if the status is invalid. - (unless this is on purpose, using [assert \false]) *) - let pp_behavior_inactive fmt = - Format.fprintf fmt ",@ the behavior@ was@ inactive" - in - if pred_status = False && pred.ip_content.pred_content <> Pfalse then - Value_parameters.warning ~once:true ~source - "@[%a:@ this postcondition@ evaluates to@ false@ in this@ context.\ - @ If it is valid,@ either@ a precondition@ was not@ verified@ \ - for this@ call%t,@ or some assigns/from@ clauses@ are \ - incomplete@ (or incorrect).@]%t" - pp_header bhv - (if behav_active then (fun _ -> ()) else pp_behavior_inactive) - Value_util.pp_callstack; - (* Only emit a status if the function has a body. Otherwise, we would - overwrite the "considered valid" status of the kernel. *) - if postk = PostUseSpec then - emit_status ip (conv_status pred_status); - | Assumes -> - (* No statuses are emitted for 'assumes' clauses, and for the moment we - do not emit text either *) () - -(* Emits informative messages about inactive behaviors, and emits a valid - status for requires and ensures that have not been evaluated. *) -let process_inactive_behavior kf call_ki behavior = - let emitted = ref false in - (* We emit a valid status for every requires and ensures of the behavior. *) - List.iter (fun (tk, _ as post) -> - if tk = Normal then begin - emitted := true; - if post_kind kf <> PostLeaf then - let ip = Property.ip_of_ensures kf Kglobal behavior post in - emit_status ip Property_status.True; - end - ) behavior.b_post_cond; - List.iter (fun pre -> - emitted := true; - let ip = ip_from_precondition kf call_ki behavior pre in - emit_status ip Property_status.True; - ) behavior.b_requires; - if !emitted then - Value_parameters.result ~once:true ~current:true ~level:2 - "%a: assumes got status invalid; behavior not evaluated.%t" - (pp_header kf) behavior Value_util.pp_callstack - -(* Emits informative messages about inactive behaviors, and emits a valid - status for requires and ensures that have not been evaluated. *) -let process_inactive_behaviors kf call_ki ab = - List.iter (process_inactive_behavior kf call_ki) - (List.filter (fun b -> ab.ActiveBehaviors.is_active b = Eval_terms.False) - ab.ActiveBehaviors.funspec.spec_behavior) - -(* Emits informative messages about behavior postconditions not evaluated - because the _requires_ of the behavior are invalid. *) -let process_inactive_postconds kf inactive_bhvs = - List.iter - (fun b -> - let emitted = ref false in - List.iter (fun (tk, _ as post) -> - if tk = Normal then begin - emitted := true; - if post_kind kf <> PostLeaf then - let ip = Property.ip_of_ensures kf Kglobal b post in - emit_status ip Property_status.True; - end - ) b.b_post_cond; - if !emitted then - Value_parameters.result ~once:true ~current:true ~level:2 - "%a: requires got status invalid; postconditions not evaluated.%t" - (pp_header kf) b Value_util.pp_callstack; - ) inactive_bhvs - -let warn_inactive kf b pre_post ip = - let source = fst ip.ip_content.pred_loc in - Value_parameters.result ~once:true ~source ~level:2 - "%a: assumes got status invalid; %a not evaluated.%t" - (pp_header kf) b pp_p_kind pre_post Value_util.pp_callstack - -(* [per_behavior] indicates if we are processing each behavior separately. - If this is the case, then [Unknown] and [True] behaviors are treated - in the same way. *) -let refine_active ab b ~per_behavior = - match ActiveBehaviors.active ab b with - | True -> Some true - | Unknown -> Some per_behavior - | False -> None - - -(* [eval_and_reduce_p_kind kf b active p_kind ips states build_prop build_env] - evaluates the identified predicates [ips] of [kf] in the states [states]. - The states are used simultaneously for evaluation and reduction: if one - predicate is not valid in one of the states, the status of the predicate is - set to [Unknown] or [Invalid]. In this case, the state is simultaneously - reduced (when possible). - [p_pkind] indicates the kind of clause being evaluated. - [b] is the behavior to which [ips] belong. - [active] indicates whether [b] is guaranteed to be active, or maybe active. - [build_prop] builds the [Property.t] that corresponds to the pre/post being - evaluated. - [build_env] is used to build the environment evaluation, in particular - the pre- and post-states. - *) -let eval_and_reduce_p_kind kf b ~active p_kind ips build_prop build_env states = - let pp_header = pp_header kf in - let slevel = Value_util.get_slevel kf in - let aux_pred behav_active states pred = - let pr = Logic_const.pred_of_id_pred pred in - let source = fst pr.pred_loc in - if State_set.is_empty states then - (Value_parameters.result ~once:true ~source ~level:2 - "%a: no state left in which to evaluate %a, status%a not \ - computed.%t" pp_header b pp_p_kind p_kind - Description.pp_named pr Value_util.pp_callstack; - states) - else - let ip = build_prop pred in - State_set.fold - (fun accstateset (state, _trace as stt) -> - let env = build_env state in - let res = eval_predicate env pr in - emit_message_and_status kf b behav_active ip p_kind res pred pr ~source; - let reduced_states = - if behav_active then - match res with - | False -> - State_set.empty - | True -> - (* Reduce in case [pre] is a disjunction *) - split_disjunction_and_reduce - ~reduce:false ~env stt ~slevel pr ip - | Unknown -> - (* Reduce in all cases *) - split_disjunction_and_reduce - ~reduce:true ~env stt ~slevel pr ip - else - State_set.singleton stt - in - (State_set.merge reduced_states accstateset) - ) State_set.empty states - in - List.fold_left (aux_pred active) states ips - -(** Check the postcondition of [kf] for a given behavior [b]. - This may result in splitting [post_states] if the postconditions contain - disjunctions. *) -let check_fct_postconditions_of_behavior kf ab b kind ~per_behavior ~result ~pre_state ~post_states = - let post_conds = b.b_post_cond in - let posts = List.filter (fun (x,_) -> x = kind) post_conds in - let posts = List.map snd posts in - match posts with - | [] -> post_states - | ip :: _ -> - let k = Postcondition (post_kind kf) in - match refine_active ab b per_behavior with - | None -> - warn_inactive kf b k ip; - post_states - | Some active -> - let build_prop p = Property.ip_of_ensures kf Kglobal b (kind, p) in - let build_env s = env_post_f ~post:s ~pre:pre_state ~result () in - eval_and_reduce_p_kind - kf b active k posts build_prop build_env post_states - -(* per-behavior is not useful: the default behavior is always active *) -let check_fct_postconditions_default_behavior kf ab kind ~result ~pre_state ~post_states = - try - let b = ActiveBehaviors.behavior_from_name ab Cil.default_behavior_name in - check_fct_postconditions_of_behavior - kf ab b kind ~per_behavior:true ~result ~pre_state ~post_states - with ActiveBehaviors.No_such_behavior -> post_states - -(** Checks the postconditions of [b] and of the default behavior if it is not - [b] *) -let check_fct_postconditions_for_behavior kf ab b kind ~result ~per_behavior ~pre_state post_states = - let post_states = - check_fct_postconditions_of_behavior kf ab b kind ~per_behavior - ~result ~pre_state ~post_states - in - if Cil.is_default_behavior b then - post_states - else - (* Applies the ensures clause of the global behavior on a given state set - (this clause is inherited by each behavior). *) - check_fct_postconditions_default_behavior kf ab kind ~result - ~pre_state ~post_states - -(** Check the postcondition of [kf] for every behavior, treating them - separately if [per_behavior] is [true], merging them otherwise. - The postcondition of the global behavior is applied for each behavior, - to help reduce the final state. The default behavior is done once, - at the end. *) -let check_fct_postconditions kf ab behaviors kind ~result ~per_behavior ~pre_state post_states = - let post_states = List.fold_left - (fun post_states b -> - if b.b_name <> Cil.default_behavior_name then - check_fct_postconditions_of_behavior kf ab b kind ~per_behavior - ~result ~pre_state ~post_states - else post_states - ) post_states behaviors - in - if behaviors <> [] then - check_fct_postconditions_default_behavior kf ab kind ~result - ~pre_state ~post_states - else post_states - - -(* Eval: under-approximation of the term. Note that ACSL states - that assigns clauses are evaluated in the pre-state. - We skip [\result]: it is meaningless when evaluating the 'assigns' part, - and a special treatment must be done in [from] clauses anyway. *) -let eval_assigns_from pre_state it = - let term = it.it_content in - if Logic_utils.is_result it.it_content then - Locations.Zone.bottom - else - let eval_env = Eval_terms.env_assigns pre_state in - fst (Eval_terms.eval_tlval_as_zone_under_over - ~with_alarms:CilE.warn_none_mode ~for_writing:false eval_env term) - -(** Compute the validity status for [from] in [pre_state], assuming the - entire clause is [assigns asgn \from from]. The inferred dependencies - are [found_froms], while [asgn] evaluates to [assigns_zone]. *) -let check_from pre_state asgn assigns_zone from found_froms = - let open Locations in - let found_deps = - let open Function_Froms in - if Logic_utils.is_result asgn.it_content then - found_froms.deps_return - else - Memory.find_precise found_froms.deps_table assigns_zone - in - let (indirect_deps,direct_deps) = - let filter x = List.mem "indirect" x.it_content.term_name in - List.partition filter from - in - (* Under-approximation of the union. *) - let link zones = List.fold_left Zone.link Zone.bottom zones in - let eval = eval_assigns_from pre_state in - let stated_indirect_deps = link (List.map eval indirect_deps) in - let stated_direct_deps = link (List.map eval direct_deps) in - let found_direct_deps = found_deps.Function_Froms.Deps.data in - let found_indirect_deps = found_deps.Function_Froms.Deps.indirect in - let res_for_unknown txt = - Value_parameters.debug "found_direct deps %a stated_direct_deps %a \ - found_indirect_deps %a stated_indirect_deps %a" - Zone.pretty found_direct_deps Zone.pretty stated_direct_deps - Zone.pretty found_indirect_deps Zone.pretty stated_indirect_deps; - "unknown (cannot validate "^txt^" dependencies)", - Unknown - in - match (Zone.is_included found_direct_deps stated_direct_deps, - Zone.is_included found_indirect_deps stated_indirect_deps) with - | true,true -> "valid", True - | false,true -> res_for_unknown "direct" - | false,false -> res_for_unknown "direct and indirect" - | true,false -> res_for_unknown "indirect" - - -let check_fct_assigns kf ab ~pre_state found_froms = - let open Locations in - let behaviors = Annotations.behaviors kf in - (* Under-approximation of the union. *) - let link zones = List.fold_left Zone.link Zone.bottom zones in - let outputs = Function_Froms.outputs found_froms in - let check_for_behavior b = - let activity = ActiveBehaviors.active ab b in - match activity with - | False -> () - | True | Unknown -> - let pp_activity fmt activity = match activity with - | False -> assert false - | True -> () - (* If unknown, the error may be because we did not notice - that the behavior is inactive. *) - | Unknown -> Format.fprintf fmt "(the behavior may be inactive)" - in - (match b.b_assigns with - | WritesAny -> () - | Writes(assigns_deps) -> - let bol = Property.Id_contract (Datatype.String.Set.empty,b) in - let ip = Extlib.the (Property.ip_of_assigns kf Kglobal bol b.b_assigns) - in - let source = fst (Property.location ip) in - (* First, check the assigns. *) - let assigns = List.map fst assigns_deps in - let assigns_zones = List.map (eval_assigns_from pre_state) assigns in - let assigns_union = link assigns_zones in - let status_txt, vstatus, status = - if not (Zone.is_included outputs assigns_union) - then ( - Value_parameters.debug "found_assigns %a stated_assigns %a" - Zone.pretty outputs Zone.pretty assigns_union; - "unknown", Unknown, Property_status.Dont_know) - else "valid", True, Property_status.True - in - msg_status vstatus ~once:true ~source - "%a: assigns got status %s.%a%t" - (pp_header kf) b - status_txt - pp_activity activity - Value_util.pp_callstack; - emit_status ip status; - (* Now, checks the individual froms. *) - let check_from ((asgn,deps) as from) assigns_zone = - match deps with - | FromAny -> () - | From deps -> - let status_txt, status = - check_from pre_state asgn assigns_zone deps found_froms - in - let ip = Extlib.the (Property.ip_of_from kf Kglobal bol from) in - let source = fst (asgn.it_content.term_loc) in - msg_status status ~once:true ~source - "%a: \\from ... part in assign clause got status %s.%a%t" - (pp_header kf) b - status_txt - pp_activity activity - Value_util.pp_callstack; - emit_status ip (conv_status status) - in - List.iter2 check_from assigns_deps assigns_zones) - in List.iter check_for_behavior behaviors -;; - -let verify_assigns_from kf ~pre froms = - let ab = ActiveBehaviors.create pre kf in - check_fct_assigns kf ab ~pre_state:pre froms -;; - -Db.Value.verify_assigns_froms := verify_assigns_from;; - -(** Check the precondition of [kf] for a given behavior [b]. - This may result in splitting [states] if the precondition contains - disjunctions. *) -let check_fct_preconditions_for_behavior kf ab ~per_behavior call_ki states b = - match b.b_requires with - | [] -> states - | ip :: _ -> - let k = Precondition in - match refine_active ab b per_behavior with - | None -> - process_inactive_behavior kf call_ki b; - warn_inactive kf b k ip; - states - | Some active -> - let build_env pre = env_pre_f ~pre () in - eval_and_reduce_p_kind - kf b ~active k b.b_requires (ip_from_precondition kf call_ki b) build_env states - -(* Check the precondition of [kf]. This may result in splitting [init_state] - into multiple states if the precondition contains disjunctions. *) -let check_fct_preconditions kf ab call_ki init_state = - let init_trace = Trace.initial kf in - let init_states = State_set.singleton (init_state, init_trace) in - let spec = Annotations.funspec kf in - List.fold_left - (check_fct_preconditions_for_behavior ~per_behavior:false kf ab call_ki) - init_states spec.spec_behavior - let code_annotation_text ca = match ca.annot_content with | AAssert _ -> "assertion" @@ -550,105 +48,6 @@ let code_annotation_loc ca stmt = | Some loc when not (Cil_datatype.Location.(equal loc unknown)) -> loc | _ -> Cil_datatype.Stmt.loc stmt -(* Reduce the given states according to the given code annotations. - If [record] is true, update the proof state of the code annotation. - DO NOT PASS record=false unless you know what your are doing *) -let interp_annot kf ab initial_state slevel states stmt ca record = - let ips = Property.ip_of_code_annot kf stmt ca in - let source, _ = code_annotation_loc ca stmt in - let aux_interp ca behav p = - let ip = Property.ip_of_code_annot_single kf stmt ca in - let text = code_annotation_text ca in - let in_behavior = - match behav with - | [] -> `True - | behavs -> - let aux acc b = - let b = ActiveBehaviors.behavior_from_name ab b in - match ActiveBehaviors.active ab b with - | True -> `True - | Unknown -> if acc = `True then `True else `Unknown - | False -> acc - in - List.fold_left aux `False behavs - in - match in_behavior with - | `False -> states - | `True | `Unknown as in_behavior -> - (* if record [holds], emit statuses in the Kernel, and print a message *) - let emit status = - if record then begin - let change_status st = - List.iter (fun p -> emit_status p st) ips - in - let message = - match status, in_behavior with - | Unknown, _ -> - change_status Property_status.Dont_know; - "unknown" - | True, _ -> - change_status Property_status.True; - "valid" - | False, `True -> - change_status Property_status.False_if_reachable; - "invalid (stopping propagation)" - | False, `Unknown -> - change_status Property_status.False_if_reachable; - "invalid" - in - msg_status status ~once:true ~source - "%s%a got status %s." text Description.pp_named p message; - end; - in - let reduced_states = - State_set.fold - (fun accstateset (here, _trace as ht) -> - let env = env_annot ~pre:initial_state ~here () in - let res = eval_predicate env p in - emit res; - match res, in_behavior with - | _, `Unknown -> - (* Cannot conclude because behavior might be inactive *) - State_set.add ht accstateset - - | False, `True -> (* Dead/invalid branch *) - accstateset - - | (Unknown | True), `True -> - let env = env_annot ~pre:initial_state ~here () in - (* Reduce by p if it is a disjunction, or if it did not - evaluate to True *) - let reduce = res = Unknown in - let reduced_states = - split_disjunction_and_reduce ~reduce ~env ht ~slevel p ip - in - State_set.merge reduced_states accstateset - ) State_set.empty states - in - (* States resulting from disjunctions are reversed compared to the - 'nice' ordering *) - State_set.reorder reduced_states - in - let aux ca behav p = - if State_set.is_empty states then ( - if record then begin - let text = code_annotation_text ca in - Value_parameters.result ~once:true ~source ~level:2 - "no state left in which to evaluate %s, status not computed.%t" - (Transitioning.String.lowercase_ascii text) Value_util.pp_callstack; - end; - states - ) else - aux_interp ca behav p - in - match ca.annot_content with - | AAssert (behav,p) - | AInvariant (behav, true, p) -> aux ca behav p - | APragma _ - | AInvariant (_, false, _) - | AVariant _ | AAssigns _ | AAllocation _ | AExtended _ - | AStmtSpec _ (*TODO*) -> states - let mark_unreachable () = let mark ppt = @@ -677,29 +76,31 @@ let mark_unreachable () = method! vstmt_aux stmt = if not (Db.Value.is_reachable_stmt stmt) then begin + let mark_status kf = + (* Do not put "unreachable" statuses on preconditions of + functions overridden by builtins. We do not evaluate those + preconditions on reachable calls, and the consolidation + gives very bad results when reachable and unreachable calls + coexist (untried+dead -> unknown). *) + if Builtins.find_builtin_override kf = None + then begin + (* Setup all precondition statuses for [kf]: maybe it has + never been called anywhere. *) + Statuses_by_call.setup_all_preconditions_proxies kf; + (* Now mark the statuses at this particular statement as dead*) + let preconds = + Statuses_by_call.all_call_preconditions_at + ~warn_missing:false kf stmt + in + List.iter (fun (_, p) -> mark p) preconds + end + in match stmt.skind with - | Instr (Call (_, e, _, _)) -> - (match Kernel_function.get_called e with - | Some kf -> - (* Do not put "unreachable" statuses on preconditions of - functions overridden by builtins. We do not evaluate those - preconditions on reachable calls, and the consolidation - gives very bad results when reachable and unreachable calls - coexist (untried+dead -> unknown). *) - if Builtins.find_builtin_override kf = None - then begin - (* Setup all precondition statuses for [kf]: maybe it has - never been called anywhere. *) - Statuses_by_call.setup_all_preconditions_proxies kf; - (* Now mark the statuses at this particular statement as dead*) - let preconds = - Statuses_by_call.all_call_preconditions_at - ~warn_missing:false kf stmt - in - List.iter (fun (_, p) -> mark p) preconds - end - | None -> ()) - | _ -> () + | Instr (Call (_, e, _, _)) -> + Extlib.may mark_status (Kernel_function.get_called e) + | Instr(Local_init(_, ConsInit(f,_,_),_)) -> + mark_status (Globals.Functions.get f) + | _ -> () end; Cil.DoChildren @@ -717,14 +118,12 @@ let mark_rte () = let _, signed_downcast, _ = !Db.RteGen.get_signed_downCast_status () in let _, unsigned_downcast, _ = !Db.RteGen.get_unsignedDownCast_status () in let _, pointer_call, _ = !Db.RteGen.get_pointerCall_status () in + let _, float_to_int, _ = !Db.RteGen.get_float_to_int_status () in + let _, finite_float, _ = !Db.RteGen.get_finite_float_status () in let b_signed_ovf = Kernel.SignedOverflow.get () in let b_unsigned_ovf = Kernel.UnsignedOverflow.get () in - let b_signed_downcast = - Value_parameters.Eva.get () && Kernel.SignedDowncast.get () - in - let b_unsigned_downcast = - Value_parameters.Eva.get () && Kernel.UnsignedDowncast.get () - in + let b_signed_downcast = Kernel.SignedDowncast.get () in + let b_unsigned_downcast = Kernel.UnsignedDowncast.get () in Globals.Functions.iter (fun kf -> if !Db.Value.is_called kf then ( @@ -734,7 +133,9 @@ let mark_rte () = if b_signed_ovf then signed_ovf kf true; if b_unsigned_ovf then unsigned_ovf kf true; if b_signed_downcast then signed_downcast kf true; - if b_unsigned_downcast then unsigned_downcast kf true + if b_unsigned_downcast then unsigned_downcast kf true; + float_to_int kf true; + finite_float kf true; ) ) @@ -869,14 +270,6 @@ let mark_invalid_initializers () = in Annotations.iter_code_annot do_code_annot first_stmt - -let () = - Db.Value.valid_behaviors := - (fun kf state -> - let ab = ActiveBehaviors.create state kf in - ActiveBehaviors.active_behaviors ab - ); - (* Local Variables: compile-command: "make -C ../../../.." diff --git a/src/plugins/slicing/register.mli b/src/plugins/value/legacy/eval_annots.mli similarity index 82% rename from src/plugins/slicing/register.mli rename to src/plugins/value/legacy/eval_annots.mli index 4b72cdaf603f73dbc492dbc57bc2706503c7d55b..7b44b5d682c2307c764ad0a33cfeef7d0b884ead 100644 --- a/src/plugins/slicing/register.mli +++ b/src/plugins/value/legacy/eval_annots.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,10 +20,11 @@ (* *) (**************************************************************************) -(** -* This file should be empty because every API functions of the slicing module -* should be registered in {!Db.Slicing}. +open Cil_types -If you are more interested in the internal point of view of this module, -please look at {{:../code_slicing/index.html}here}. -*) +val has_requires: spec -> bool +val mark_invalid_initializers: unit -> unit +val mark_unreachable: unit -> unit +val mark_green_and_red: unit -> unit +val mark_rte: unit -> unit +val c_labels: kernel_function -> Value_types.callstack -> Eval_terms.labels_states diff --git a/src/plugins/value/legacy/eval_behaviors.ml b/src/plugins/value/legacy/eval_behaviors.ml deleted file mode 100644 index 36c10680aa6ebfea4b244d4fc80c7ecb34f89d2c..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_behaviors.ml +++ /dev/null @@ -1,460 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Cil -open Value_util -open Eval_annots - -module AB = Eval_annots.ActiveBehaviors - -(** Evaluate the assigns [assigns] of [kf] (for one or more behaviors) - in the state [with_formals]. - [per_behavior] indicates that the assigns clause is computed separately - for each behavior. It is used to control the emission of warnings. *) -let compute_assigns kf assigns return_used sclob ~with_formals ~per_behavior = - let with_alarms = CilE.warn_none_mode in - let vi = Kernel_function.get_vi kf in - if (not (Cvalue.Model.is_reachable with_formals)) || - Cil.hasAttribute "noreturn" vi.vattr - then - None, Cvalue.Model.bottom - else - let returned_value, with_formals = - Library_functions.returned_value kf with_formals - in - let returned_value = ref returned_value in - let env = Eval_terms.env_assigns with_formals in - let pp_eval_error fmt e = - if e <> Eval_terms.CAlarm then - Format.fprintf fmt "@ (%a)" Eval_terms.pretty_logic_evaluation_error e - in - (* Treat one assign ... \from ... clause. Update [state] accordingly, - as well as [returned_value] and [sclob] *) - let treat_assign state ({it_content = out}, ins as asgn) = - (* Evaluate the contents of one element of the from clause, topify them, - and add them to the current state of the evaluation in acc *) - let one_from_contents acc { it_content = t } = - let r = Eval_terms.eval_term ~with_alarms env t in - Cvalue.V.join acc (Cvalue.V.topify_leaf_origin r.Eval_terms.eover) - in - (* evaluation of the entire from clause *) - let froms_contents = - match ins with - | FromAny -> Cvalue.V.top_int - | From l -> - try - let filter x = not(List.mem "indirect" x.it_content.term_name) in - let direct = List.filter filter l in - List.fold_left one_from_contents Cvalue.V.top_int direct - with Eval_terms.LogicEvalError e -> - warning_once_current "cannot interpret@ 'from' clause@ \ - '%a'@ of function %a%a" Printer.pp_from asgn - Kernel_function.pretty kf pp_eval_error e; - Cvalue.V.top - in - (* Treat one location coming from the evaluation of [out] *) - let treat_output_loc acc loc = - let valid = Locations.valid_part ~for_writing:true loc in - if Locations.is_bottom_loc valid then - (if (not (Locations.is_bottom_loc loc)) - then (Value_parameters.warning ~current:true ~once:true - "@[Completely invalid destination@ for assigns@ clause %a.@ \ - Ignoring.@]" Printer.pp_term out); - acc) - else ( - Locals_scoping.remember_if_locals_in_value sclob loc froms_contents; - let state' = - snd (Cvalue.Model.add_binding ~exact:false acc loc froms_contents) - in - if Cvalue.Model.equal Cvalue.Model.top state' then ( - Value_parameters.error ~once:true ~current:true - "Cannot@ handle@ assigns@ for %a,@ location@ is@ too@ imprecise@ \ - (%a).@ Assuming@ it@ is@ not@ assigned,@ but@ be@ aware@ this\ - @ is@ incorrect." Printer.pp_term out Locations.pretty loc; - acc) - else state') - in - (* Treat the output part of the assigns clause *) - if Logic_utils.is_result out then ( - (* Special case for \result *) - returned_value := Cvalue.V.join froms_contents !returned_value; - state - ) else - try - (* TODO: warn about errors during evaluation *) - let loc = Eval_terms.eval_tlval_as_location ~with_alarms env out in - treat_output_loc state loc - with - | Eval_terms.LogicEvalError e -> - warning_once_current - "cannot interpret assigns %a@ in function %a%a; effects will be \ - ignored" - Printer.pp_term out Kernel_function.pretty kf pp_eval_error e; - state - in - (* Treat all the assigns for the function *) - let state = - match assigns with - | WritesAny -> - (* No need to warn for missing assigns when evaluating a behavior, - we can always use those of the default behavior as a fallback. *) - if not per_behavior then - warning_once_current "Cannot handle empty assigns clause. Assuming assigns \\nothing: be aware this is probably incorrect."; - with_formals - | Writes l -> - (* Warn for clauses without \from *) - let no_from = List.filter (fun (_, from) -> from = FromAny) l in - (match no_from with - | (out, _) :: _ as l -> - let source = fst out.it_content.term_loc in - Value_parameters.warning ~source ~once:true - "@[no \\from part@ for clause '%a' of@ function %a@]" - Printer.pp_assigns (Writes l) Kernel_function.pretty kf - | [] -> () - ); - (* Warn in case the 'assigns \result' clause is missing *) - (if return_used then - let for_result (out, _) = Logic_utils.is_result out.it_content in - let result = List.filter for_result l in - if result = [] then - let source = fst (Kernel_function.get_location kf) in - Value_parameters.warning ~once:true ~source - "@[no 'assigns \\result@ \\from ...'@ clause@ specified \ - for@ function %a@]" Kernel_function.pretty kf - ); - (* Compute the effects of the assigns clause *) - List.fold_left treat_assign with_formals l - in - let retres_vi, state = - match Library_functions.get_retres_vi kf with - | None -> None, state - | Some retres_vi -> - let return_type = getReturnType vi.vtype in - let offsetmap = Eval_op.offsetmap_of_v return_type !returned_value in - let retres_base = Base.of_varinfo retres_vi in - let state = Cvalue.Model.add_base retres_base offsetmap state in - Some retres_vi, state - in - retres_vi, state - -(* Performs the join of two varinfo option, used for the return value. - If both are Some, then they should be the same. *) -let join_rvi rvi1 rvi2 = Extlib.merge_opt - (fun () vi1 vi2 -> - assert (Cil_datatype.Varinfo.equal vi1 vi2); - vi1 - ) () rvi1 rvi2 - -(* Returns the assigns clause to be used during per-behavior processing. - The specification states that, if a behavior has no assigns clause, - then the assigns clause of the default behavior must be used instead. *) -let get_assigns_for_behavior ab b = - match b.b_assigns with - | WritesAny -> (* no assigns clause, using the default behavior's *) - let def_b = AB.behavior_from_name ab Cil.default_behavior_name in - def_b.b_assigns - | _ -> b.b_assigns - -let compute_assigns_and_post_conds_for_behavior kf ab ~with_formals bhv_states_after_requires return_used sclob b_name = - let b = AB.behavior_from_name ab b_name in - let states_after_requires = List.assoc b_name bhv_states_after_requires in - let retres_vi = ref None in - let states_after_assigns = - State_set.fold (fun acc_st (state, trace) -> - let rvi, state_after_assigns = - let assigns = get_assigns_for_behavior ab b in - compute_assigns kf assigns return_used sclob state true - in - retres_vi := join_rvi !retres_vi rvi; - State_set.add (state_after_assigns, trace) acc_st - ) State_set.empty states_after_requires - in - let states_after_post_conds = - Eval_annots.check_fct_postconditions_for_behavior kf ab b Normal - ~result:!retres_vi ~per_behavior:true ~pre_state:with_formals - states_after_assigns - in - (b_name, states_after_post_conds) - -(* When there is at least one behavior whose active status is [True], we can - perform the intersection of the states and assigns clauses, and compute the - result for every [True] state at once. Here, [b_names] is a list of True - behaviors. *) -let compute_merged_assigns_and_post_conds_for_behaviors kf ab bhv_states_after_requires return_used sclob b_names = - if b_names = [] then State_set.empty - else - let bs = List.map (AB.behavior_from_name ab) b_names in - let states_after_requires_list = - Extlib.filter_map (fun (b_name, _) -> List.mem b_name b_names) snd - bhv_states_after_requires - in - let state_after_requires, trace = - State_set.(join (narrow_list states_after_requires_list)) - in - let retres_vi = ref None in - let state_after_assigns = - List.fold_left (fun st0 b -> - let rvi, state_after_assigns = - let assigns = get_assigns_for_behavior ab b in - compute_assigns kf assigns return_used sclob st0 true - in - retres_vi := join_rvi !retres_vi rvi; - state_after_assigns - ) state_after_requires bs - in - let states_after_post_conds = - Eval_annots.check_fct_postconditions kf ab bs Normal ~result:!retres_vi - ~per_behavior:true ~pre_state:state_after_requires - (State_set.singleton (state_after_assigns, trace)) - in - let l = State_set.to_list states_after_post_conds in - let lr = List.map (fun s -> s,trace) l in - State_set.of_list lr - -(** Computes and returns three disjoint sets, [b_t], [b_u] and [b_f], - where [b_t] contains all behaviors which are certainly active - (status [True], and not empty after requires), [b_u] contains - behaviors which are possibly active (status [Unknown], and - not empty after requires), and [b_f] contains behaviors which - are empty. - The default behavior is never included in the returned sets. - Note that [b_f] does NOT contain behaviors which were previously - known to be inactive (set to [False] by the assumes clause). - [bhv_states_post_requires] is an association list from - behaviors to their states after applying requires clauses. -*) -let partition_behaviors_after_requires ab bhv_states_after_requires = - (* We filter the default behavior here *) - let bhv_states_after_requires' = - List.filter - (fun (b_name, _) -> b_name <> Cil.default_behavior_name) - bhv_states_after_requires - in - List.fold_left (fun (b_t0, b_u0, b_f0) (b_name, stateset) -> - if State_set.is_empty stateset then - (* falsely active behavior: requires clauses not satisfied *) - (b_t0, b_u0, b_name :: b_f0) - else - (* requires clauses did not change the behavior's status *) - match ab.AB.is_active (AB.behavior_from_name ab b_name) with - | Eval_terms.True -> (b_name :: b_t0, b_u0, b_f0) - | Eval_terms.Unknown -> (b_t0, b_name :: b_u0, b_f0) - | Eval_terms.False -> (b_t0, b_u0, b_name :: b_f0) - ) ([],[],[]) bhv_states_after_requires' - -(** - Promotes [Unknown] behaviors from [b_u] to [True] when they are the only - possible choice in a given complete set. - Returns the new sets [b_t] and [b_u], of [True] and [Unknown] behaviors. -*) -let promote_complete_unknown_behaviors comp_lists b_t b_u = - ListLabels.fold_left ~init:(b_t,b_u) comp_lists - ~f:(fun (acc_t,acc_u as acc) comp_set -> - let unk_bhvs_in_set = List.filter (ListLabels.mem ~set:b_u) comp_set in - match unk_bhvs_in_set with - | [] -> (* no Unknown behaviors, nothing to promote *)acc - | [b_unk] -> (* a single Unknown behavior, will be promoted to True *) - b_unk :: acc_t,List.filter (fun b -> b <> b_unk) acc_u - | _ -> (* more than one Unknown behavior, cannot promote *) - acc_t,acc_u - ) - -(* Applies the given [assumes] clauses of a given behavior [b] to the states - passed as argument, in order to reduce them (no status is emitted). *) -let reduce_by_assumes_of_behavior kf states b = - let build_prop assume = Property.ip_of_assumes kf Kglobal b assume in - let build_env pre = Eval_terms.env_pre_f ~pre () in - eval_and_reduce_p_kind - kf b ~active:true Assumes b.b_assumes build_prop build_env states - -(* Reduce the state by the assumes and requires clauses for behavior [b], - and emit statuses for the requires. *) -let compute_assumes_and_requires_for_behavior kf ab b call_kinstr states = - let states_after_assumes = reduce_by_assumes_of_behavior kf states b in - check_fct_preconditions_for_behavior kf ab ~per_behavior:true - call_kinstr states_after_assumes b - -let compute_using_specification kf spec ~call_kinstr ~with_formals = - let ab = AB.create_from_spec with_formals spec in - let sclob = Locals_scoping.bottom () in - let complete_bhvs_lists = ab.AB.funspec.spec_complete_behaviors in - let maybe_active_behaviors = - ListLabels.filter ab.AB.funspec.spec_behavior - ~f:(fun b -> ab.AB.is_active b <> Eval_terms.False && - not (Cil.is_default_behavior b)) - in - let def_bhv = AB.behavior_from_name ab Cil.default_behavior_name in - (* TODO: integrate slevel *) - let init_trace = Trace.initial kf in - let init_state_set = State_set.singleton (with_formals, init_trace) in - let states_after_global_requires = - Eval_annots.check_fct_preconditions_for_behavior kf ab - ~per_behavior:true call_kinstr init_state_set - def_bhv - in - (* joined_state_after_global_requires is an overapproximation of the - disjunction of states after the global requires clause. It is used - in some places, but the actual disjunction is more precise and should be - used when possible. *) - let (joined_state_after_global_requires,_trace) = - State_set.join states_after_global_requires in - (* Notify user about inactive behaviors *) - Eval_annots.process_inactive_behaviors kf call_kinstr ab; - (* In order to know which behaviors will be considered by the analysis, - we need to compute the \requires clause to eliminate empty behaviors, - such as "assumes x < 0; requires x > 0;". Otherwise, we will later - incorrectly consider such cases as if we had Bottom (empty state sets), - and the narrow operator will give an incorrect result. *) - let final_states = - (* bhv_states_after_requires: association list (name, stateset), - from (possibly active) behavior names to their post-requires - sets of disjoint states. *) - let bhv_states_after_requires = - (* requires for default behavior already computed *) - (Cil.default_behavior_name, states_after_global_requires) :: - ListLabels.map maybe_active_behaviors - ~f:(fun b -> b.b_name, - compute_assumes_and_requires_for_behavior - kf ab b call_kinstr states_after_global_requires) - in - let return_used = match call_kinstr with - | Kglobal -> true - | Kstmt {skind = Instr (Call (lv, _, _, _))} -> - lv <> None || Value_util.postconditions_mention_result spec - | _ -> assert false - in - let (b_t, b_u, b_f) = - partition_behaviors_after_requires ab bhv_states_after_requires - in - (* If there are behaviors with invalid preconditions, notify the - user. *) - Eval_annots.process_inactive_postconds kf - (Extlib.filter_map (fun (b,_st) -> List.mem b b_f) - (fun (b,_st) -> AB.behavior_from_name ab b) - bhv_states_after_requires); - (* To obtain maximum precision, we consider behaviors according to - these rules: - 1) Inactive behaviors are never considered. - 3) All behaviors which are [True] (including the default behavior) - have their assigns/ensures clauses computed as in the case of a - single specification, to avoid a combinatorial explosion and to - obtain the equivalent of a narrowed state S_t. - 4) [Unknown] behaviors are added to S_t. For each set of complete - behaviors, we join its [Unknown] states. We obtain different - states S_c_1, S_c_2, etc., for each set of complete states c_i. - We then narrow these states to obtain the final result. - *) - let b_t,b_u = - promote_complete_unknown_behaviors - ab.AB.funspec.spec_complete_behaviors b_t b_u - in - (* If there is at least one "complete behaviors" clause, then we ignore - the default behavior when computing a "true state" - (intersection of True behaviors). - Otherwise, we add the default behavior to the set of True behaviors. - *) - let b_t = - if complete_bhvs_lists = [] then Cil.default_behavior_name :: b_t - else b_t - in - let true_states = - compute_merged_assigns_and_post_conds_for_behaviors - kf ab bhv_states_after_requires return_used sclob b_t - in - (* If there are no "complete behaviors" clauses, we add a set - containing the default behavior. *) - let complete_sets = - if complete_bhvs_lists = [] - then [[Cil.default_behavior_name]] - else complete_bhvs_lists - in - (* From now on, we compute the state corresponding to the behaviors - with status Unknown *) - (* We only compute states for useful behaviors: those that are present - in some of the complete_bhvs_lists and that are [Unknown] (because - they are in the true state), plus the default behavior. *) - let bhvs_to_compute = - Extlib.sort_unique Pervasives.compare - (List.filter (ListLabels.mem ~set:b_u) (List.flatten complete_sets)) - in - let bhv_states_after_post_conds = - List.map - (compute_assigns_and_post_conds_for_behavior kf ab - ~with_formals:joined_state_after_global_requires - bhv_states_after_requires return_used sclob) bhvs_to_compute - in - (* For each set [c_i] of complete behaviors, compute a state set - [stateset_per_c_i] with its unknown behaviors, then narrow the - resulting state sets to obtain a more precise result. *) - let stateset_per_c_i_list = - List.map ( - Extlib.filter_map - (fun b -> List.mem b bhvs_to_compute) - (fun b -> List.assoc b bhv_states_after_post_conds) - ) complete_sets - in - let stateset_per_c_i = - List.map - (fun c_i_stateset_list -> - List.fold_left - (fun acc_st stateset -> - State_set.merge stateset acc_st) - State_set.empty c_i_stateset_list - ) stateset_per_c_i_list in - (* Finally, we narrow the result obtained for each set c_i of complete - behaviors. The more sets there are, the more precise the final result - will be. *) - let unk_state = - State_set.narrow_list stateset_per_c_i - in - (* Finally, we merge the states for the behaviors with status True - and Unknown*) - State_set.merge true_states unk_state - in - let rvi = Kernel_function.get_vi kf in - let return_type = getReturnType rvi.vtype in - let infer_rvi state = - if isVoidType return_type || Cil.hasAttribute "noreturn" rvi.vattr - || not (Cvalue.Model.is_reachable state) - then None - else Library_functions.get_retres_vi kf - in - let aux state = - match infer_rvi state with - | None -> None, state - | Some vi -> - match state with - | Cvalue.Model.Bottom -> None, state - | Cvalue.Model.Top -> Warn.warn_top () - | Cvalue.Model.Map _ -> - let retres_base = Base.of_varinfo vi in - let without_ret = Cvalue.Model.remove_base retres_base state in - match Cvalue.Model.find_base retres_base state with - | `Value m -> Some m, without_ret - | `Bottom (*tested above*) | `Top (*state is not top*)-> assert false - in - { Value_types.c_values = List.map aux (State_set.to_list final_states); - c_clobbered = sclob.Locals_scoping.clob; - c_cacheable = Value_types.Cacheable; - c_from = None; - } diff --git a/src/plugins/value/legacy/eval_exprs.ml b/src/plugins/value/legacy/eval_exprs.ml deleted file mode 100644 index 81f91d69fb8197b27185eefeb1da8ae207770f0b..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_exprs.ml +++ /dev/null @@ -1,1151 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Cil -open Abstract_interp -open Locations -open Cvalue -open Bit_utils -open Value_util - - -exception Not_an_exact_loc -let not_an_exact_loc = Not_an_exact_loc - -exception Reduce_to_bottom -let reduce_to_bottom = Reduce_to_bottom - -exception Offset_not_based_on_Null of - Locations.Zone.t option * Location_Bytes.t * typ - -exception Cannot_find_lv -let cannot_find_lv = Cannot_find_lv - -type cond = - { exp: exp; (* The condition of the branch*) - positive: bool; (* true: normal false: negated *)} - - -let do_promotion_c ~with_alarms ~src_typ ~dst_typ v e_src = - let rounding_mode = get_rounding_mode() in - let msg fmt = - Format.fprintf fmt "%a (%a)" Printer.pp_exp e_src Cvalue.V.pretty v - in - Valarms.set_syntactic_context (Valarms.SyUnOp e_src); - Eval_op.do_promotion ~with_alarms rounding_mode ~src_typ ~dst_typ v msg - -let rec lval_to_loc ~with_alarms state lv = - let _, r, _typ = lval_to_loc_state ~with_alarms state lv in - r - -and lval_to_precise_loc ~with_alarms state lv = - let _, r, _typ = lval_to_precise_loc_state ~with_alarms state lv in - r - -and lval_to_loc_state ~with_alarms state lv = - let state,_,r, typ = - lval_to_loc_deps_state - ~with_alarms - ~deps:None - ~reduce_valid_index:(Kernel.SafeArrays.get ()) - state - lv - in - state, r, typ - -and lval_to_precise_loc_state ~with_alarms state lv = - let state,_,r, typ = - lval_to_precise_loc_deps_state - ~with_alarms - ~deps:None - ~reduce_valid_index:(Kernel.SafeArrays.get ()) - state - lv - in - state, r, typ - -and lval_to_loc_deps_state ~with_alarms ~deps state ~reduce_valid_index lv = - let state, deps, pl, typ = - lval_to_precise_loc_deps_state - ~with_alarms ~deps state ~reduce_valid_index lv - in - (*match fst pl with - | PLVarOffset _ | PLLocOffset _ -> - Value_parameters.result ~current:true "##Precise %a@." pretty_loc (fst pl) - | _ -> ()*) - state, deps, Precise_locs.imprecise_location pl, typ - -and lval_to_precise_loc_deps_state ~with_alarms ~deps state ~reduce_valid_index (host,offset as lv) = - if not (Cvalue.Model.is_reachable state) then - state, deps, Precise_locs.loc_bottom, typeOfLval lv - else - let typ = match host with - | Var host -> host.vtype - | Mem x -> typeOf_pointed (typeOf x) - in - try - let state, deps, offs, typ_offs = - eval_offset ~with_alarms ~reduce_valid_index deps typ state offset - in - let state, deps, loc = eval_host ~with_alarms ~deps state host offs in - let size = Eval_typ.sizeof_lval_typ typ_offs in - let loc = Precise_locs.make_precise_loc loc ~size in - state, deps, loc, typ_offs - with Offset_not_based_on_Null(deps,offset,typ_offs) -> - let state, deps, loc_no_offset = - eval_host ~with_alarms ~deps state host Precise_locs.offset_zero - in - let imprecise = Precise_locs.imprecise_location_bits loc_no_offset in - let loc = Location_Bits.join (loc_bytes_to_loc_bits offset) imprecise in - let size = Eval_typ.sizeof_lval_typ typ_offs in - let loc = - Precise_locs.(make_precise_loc (inject_location_bits loc) ~size) - in - state, deps, loc, typ_offs - -(* Combination of the evaluation of the right part of an lval (an host) with - an offset, to obtain a location *) -and eval_host ~with_alarms ~deps state host offs = - if Precise_locs.is_bottom_offset offs - then - Cvalue.Model.bottom, deps, Precise_locs.bottom_location_bits - else ( - match host with - | Var host -> - let base = Base.of_varinfo host in - state, deps, Precise_locs.combine_base_precise_offset base offs - | Mem x -> - let state, deps, loc_lv = - eval_expr_with_deps_state ~with_alarms deps state x - in - let loc_bits = loc_bytes_to_loc_bits loc_lv in - let loc_p = Precise_locs.combine_loc_precise_offset loc_bits offs in - state, deps, loc_p - ) - -(* Detects if an expression can be considered as a lvalue even though it is - hidden by a cast that does not change the lvalue. Raises [exn] if it cannot. - - TODO: When the goal is to recognize the form (cast)l-value == expr, - it would be better and more powerful to have chains of inverse functions *) -and pass_cast state exn typ e = - let typeofe = typeOf e in -(* Format.printf "pass_cast %a as %a@." Printer.pp_exp e Printer.pp_typ typ; *) - match unrollType typ, unrollType typeofe with - | (TInt _ | TEnum _), (TInt _ | TEnum _) -> - let sztyp = sizeof typ in - let szexpr = sizeof typeofe in - let styp, sexpr = - match sztyp, szexpr with - | Int_Base.Value styp, Int_Base.Value sexpr -> styp, sexpr - | _ -> raise exn - in - let sityp = is_signed_int_enum_pointer typ in - let sisexpr = is_signed_int_enum_pointer typeofe in - if (Int.ge styp sexpr && sityp = sisexpr) (* larger, same signedness *) - || (Int.gt styp sexpr && sityp) (* strictly larger and signed *) - then () - else - (* try to ignore the cast if it acts as identity on the value [e] *) - let size = bitsSizeOf typ in - let all_values = V.create_all_values ~size ~signed:sityp in - let with_alarms = Value_util.with_alarms_raise_exn exn in - if not (V.is_included (eval_expr ~with_alarms state e) all_values) - then raise exn - - | TPtr _, TPtr _ -> () - | TPtr _, TInt (ik, _) | TInt (ik, _), TPtr _ - when Cil.theMachine.upointKind = ik -> () - - | TFloat (f1,_), TFloat (f2, _) -> - if Cil.frank f1 < Cil.frank f2 - then raise exn (* TODO: check value inclusion as in the integer case *) - - | _ -> raise exn (* Not a scalar type *) - -and find_lv state ee = - match ee.enode with - | Lval lv -> lv - | CastE (typ,e) -> - pass_cast state cannot_find_lv typ e; - find_lv state e - | _ -> raise cannot_find_lv - -(* If possible, decomposes [e] into [lval+offset]; where [lval] is a Cil - expression, and [offset] is an Ival.t, in bytes. - - @raises Cannot_find_lv if the expression cannot be decomposed *) -and find_lv_plus_offset state e = - let acc = ref None in - let rec aux e current_offs = - try - let lv = find_lv state e in - if not (typeHasQualifier "volatile" (Cil.typeOfLval lv)) - then acc := Some (lv,current_offs) - with Cannot_find_lv -> - match e.enode with - | BinOp((MinusPI|PlusPI|IndexPI as op), p, offs, typ) -> - let offs = eval_expr ~with_alarms:CilE.warn_none_mode state offs in - (try - let offs = V.project_ival offs in - let offs = - Ival.scale (Int_Base.project (osizeof_pointed typ)) offs in - let offs = if op = MinusPI then Ival.neg_int offs else offs in - aux p (Ival.add_int current_offs offs) - with V.Not_based_on_null | Int_Base.Error_Top-> ()); - | _ -> () - in - aux e Ival.zero; - (* Extlib.may - (fun (lv,ival) -> Format.printf "find_lv_plus %a=%a+%a\n" - Printer.pp_exp e !d_lval lv Ival.pretty ival - ) !acc; *) - match !acc with - | None -> raise cannot_find_lv - | Some (lv, offs) -> lv, offs - -(* Find locations on which it is interesting to proceed by case disjunction - to evaluate the expression *) -and get_influential_vars state exp = - let with_alarms = CilE.warn_none_mode in - (* Format.printf "get_influential cond:%a@.state:%a@." - Printer.pp_exp cond - Cvalue.Model.pretty state; *) - let rec get_vars acc exp = - let eval_offset off t = - try - let _, _, offset, _ = - eval_offset ~reduce_valid_index:true ~with_alarms None t state off - in - Precise_locs.imprecise_offset offset - with Offset_not_based_on_Null _ -> Ival.top - in - match exp.enode with - | Lval (Var v, off as lv) -> - let offsb = eval_offset off v.vtype in - if Ival.cardinal_zero_or_one offsb - then - (* no variable in offset can be influential. Check the - contents of the location, on which we might want to enumerate *) - let b = Base.of_varinfo v in - if Base.is_weak b then - acc (* the variable is weak, the location cannot be reduced *) - else - let loc = make_loc (Location_Bits.inject b offsb) (sizeof_lval lv)in - let contents = snd (Cvalue.Model.find state loc) in - if Location_Bytes.cardinal_zero_or_one contents - then acc (* already exact: not influential *) - else loc :: acc - else - (* A variable in offset may be influential. The contents themselves - are not influential, because we would need to split both by - offset and by content in sync. *) - get_vars_offset acc off - | Lval (Mem e, off as lv) -> - let t = typeOf_pointed (typeOf e) in - let offset = eval_offset off t in - if Ival.cardinal_zero_or_one offset then - let v = eval_expr ~with_alarms state e in - if Location_Bytes.cardinal_zero_or_one v then - let locbi = loc_bytes_to_loc_bits v in - let locbi' = Location_Bits.shift offset locbi in - let loc = Locations.make_loc locbi' (sizeof_lval lv) in - loc :: acc - else get_vars acc e - else - (* variables in expr or offset can be influential *) - get_vars_offset (get_vars acc e) off - | BinOp(_,v1,v2,_) -> - get_vars (get_vars acc v1) v2 - | UnOp(_,v1,_) -> - get_vars acc v1 - | CastE (_typ,exp) -> - get_vars acc exp - | _ -> acc - and get_vars_offset acc offset = - match offset with - NoOffset -> acc - | Field (_,off) -> get_vars_offset acc off - | Index (ind,off) -> get_vars (get_vars_offset acc off) ind - in - get_vars [] exp - - -and eval_binop ~with_alarms e deps state = - match e.enode with - | BinOp (op, e1, e2, typ) -> - let state, deps, ev1 = - eval_expr_with_deps_state ~with_alarms deps state e1 - in - if V.is_bottom ev1 then - Cvalue.Model.bottom, deps, V.bottom - else - let state, deps, ev2 = - eval_expr_with_deps_state ~with_alarms deps state e2 - in - if V.is_bottom ev2 then - Cvalue.Model.bottom, deps, V.bottom - else begin - match unrollType (typeOf e1) with - | TFloat (fkind, _) -> - Valarms.set_syntactic_context (Valarms.SyUnOp e); - let r = Eval_op.eval_binop_float ~with_alarms - (get_rounding_mode ()) (Some fkind) - ev1 op ev2 - in - state, deps, r - | TInt _ | TPtr (_, _) | _ as te1 -> - Valarms.set_syntactic_context (Valarms.SyBinOp(e, op, e1, e2)); - (* Implicit preconditions of [op] *) - let state, ev1, ev2 = match op with - | Mod | Div -> - Warn.maybe_warn_div ~with_alarms ev2; - state, ev1, ev2 (* TODO: we could reduce ev2 *) - | Shiftlt -> - warn_reduce_shift_left ~with_alarms state te1 e1 ev1 e2 ev2 - | Shiftrt -> - let state, ev2 = - warn_reduce_shift_rhs ~with_alarms state te1 e2 ev2 - in - state, ev1, ev2 - | _ -> state, ev1, ev2 - in - let v = - Eval_op.eval_binop_int ~with_alarms ~te1 ev1 op ev2 - in - (* Warn if overflow during a non-bitwise operation *) - let v = match op with - | Shiftlt | Mult | MinusPP | MinusPI | IndexPI | PlusPI - | PlusA | Div | Mod | MinusA -> - let warn_unsigned = op <> Shiftlt in - Eval_op.handle_overflow ~with_alarms ~warn_unsigned typ v - | _ -> v - in - state, deps, v - end - | _ -> assert false - -and eval_expr ~with_alarms state e = - let _, _, r = eval_expr_with_deps_state ~with_alarms None state e in r - -and eval_expr_with_deps_state ~with_alarms deps state e = - let state, deps, r = - let orig_expr = Cil.stripInfo e in - match orig_expr.enode with - | Info _ -> assert false - | Const v -> - let r = - begin match v with - | CInt64 (i,_k,_s) -> - V.inject_int i (* TODO: missing checks for overflow *) - | CChr c -> V.inject_int (charConstToInt c) - | CReal (f, fkind, fstring) -> - Valarms.set_syntactic_context (Valarms.SyUnOp e); - Eval_op.eval_float_constant ~with_alarms f fkind fstring - | CWStr _ | CStr _ -> - V.inject (Base.of_string_exp e) Ival.zero - | CEnum {eival = e} -> - eval_expr ~with_alarms state e - end - in - state, deps, r - | BinOp _ -> - eval_binop ~with_alarms orig_expr deps state - | Lval lv -> - eval_lval_and_convert ~with_alarms deps state (e, lv) - | AddrOf v | StartOf v -> - let state, deps, r, _ = - lval_to_loc_deps_state ~with_alarms - ~deps state v ~reduce_valid_index:false - in - state, deps, loc_to_loc_without_size r - - | CastE (typ, e) -> - let state, deps, evaled_expr = - eval_expr_with_deps_state ~with_alarms deps state e - in - let r = do_promotion_c ~with_alarms - ~dst_typ:typ ~src_typ:(typeOf e) evaled_expr e in - state, deps, r - - | SizeOf _ | SizeOfE _ | SizeOfStr _ | AlignOf _ | AlignOfE _ -> - let r = match Cil.constFoldToInt orig_expr with - | Some v -> Cvalue.V.inject_int v - | _ -> V.top_int - in - state, deps, r - - | UnOp (op, e, _t_res) -> - let state, deps, expr = - eval_expr_with_deps_state ~with_alarms deps state e in - let syntactic_context = match op with - | Neg -> Valarms.SyUnOp orig_expr (* Can overflow *) - | BNot -> Valarms.SyUnOp orig_expr(* does in fact never raise an alarm*) - | LNot -> Valarms.SyUnOp e - (* Can raise a pointer comparison. Valarms needs [e] there *) - in - let t = unrollType (typeOf e) in - Valarms.set_syntactic_context syntactic_context; - let result = - Eval_op.eval_unop ~check_overflow:true ~with_alarms expr t op - in - state, deps, result - in - Valarms.set_syntactic_context (Valarms.SyUnOp e); - (* TODO: the functions called above should respect the destination type. - Calling reinterpret should be useless *) - let rr = Eval_op.reinterpret ~with_alarms (typeOf e) r in - (if Cvalue.V.is_bottom rr then Cvalue.Model.bottom else state), deps, rr - -(* [loc] is the location pointed to by [lv]. If [lv] is precise enough, we - reduce it to the parts of [loc] that are valid for a read/write operation *) -and reduce_by_accessed_loc ~for_writing state lv loc = - let with_alarms = CilE.warn_none_mode in - let valid_loc = Locations.valid_part ~for_writing loc in - let state = - if Location_Bits.equal loc.loc valid_loc.loc - then state - else try - match lv with - | Mem (exp_mem), offs -> - let state = - if Cil.isConstantOffset offs - then - (* offset coming from [offs] *) - let offs = match offs with - | NoOffset -> Ival.zero - | _ -> - let typ_exp = Cil.typeOf_pointed (typeOf exp_mem) in - let offs_bytes = fst (Cil.bitsOffset typ_exp offs) / 8 in - Ival.inject_singleton (Int.of_int offs_bytes) - in - (try - (* Decompose [exp_mem] into a base lvalue and an offset *) - let lv_mem, plus = find_lv_plus_offset state exp_mem in - (* Total offset, still in bytes *) - let plus = Ival.add_int plus offs in - let state, loc_mem, _typ_plus = - lval_to_loc_state ~with_alarms state lv_mem - in - let loc_mem = - (* Writing or reading to *p -> - in any case, p needs to be valid for reading *) - Locations.valid_part ~for_writing:false loc_mem - in - if Location_Bits.is_relationable loc_mem.Locations.loc - then - (* is_relationable guarantees that [loc_mem] is a single binding, - that can be safely reduced. The valid (reduced) value - the original location shifted by [-plus] *) - let new_val = - Location_Bytes.shift - (Ival.neg_int plus)(loc_bits_to_loc_bytes valid_loc.loc) - in - (* [new_val] may have been shifted too much on the left, - intersect with the current content of [loc_mem] *) - let _, v_loc_mem = Model.find state loc_mem in - let new_val = V.narrow new_val v_loc_mem in - Cvalue.Model.reduce_previous_binding state loc_mem new_val - else state - with Cannot_find_lv (* find_lval_plus_offset *) -> - state) - else state - in - let rec aux e = - ( match e.enode with - | BinOp((PlusPI|IndexPI), p, - exp_index , typ) -> - let base_pointer = eval_expr ~with_alarms state p in - if Cvalue.V.cardinal_zero_or_one base_pointer - then begin - let lv_index = find_lv state exp_index in - let loc_index = lval_to_loc state ~with_alarms lv_index in - if Location_Bits.is_relationable loc_index.Locations.loc - then - let _, old_index_val = Cvalue.Model.find state loc_index - in - if Cvalue.V.is_included old_index_val Cvalue.V.top_int - then - let size_pointed = - Int.of_int ((bitsSizeOf (Cil.typeOf_pointed typ))) - in - let size_pointed_bytes = - Int.div size_pointed (Bit_utils.sizeofchar()) - in - let old_index_ival = - Cvalue.V.project_ival - old_index_val - in - let old_index_ival = Ival.scale size_pointed_bytes old_index_ival in - let accessed_loc = - Location_Bytes.shift old_index_ival base_pointer - in - let accessed_loc = - Locations.make_loc - (loc_bytes_to_loc_bits accessed_loc) - (Int_Base.inject size_pointed) - in - let valid_accessed_loc = - Locations.valid_part ~for_writing accessed_loc - in - if not (Location_Bits.equal valid_accessed_loc.loc accessed_loc.loc) - then - if Locations.is_bottom_loc valid_accessed_loc then - Cvalue.Model.bottom - else - let new_index_val = (* in bytes *) - V.add_untyped Int_Base.minus_one - (loc_bits_to_loc_bytes valid_accessed_loc.Locations.loc) - base_pointer - in - let new_index_val = - ( try - let i = Cvalue.V.project_ival new_index_val in - let mi, ma = Ival.min_and_max i in - let mi = match mi with - None -> None - | Some mi -> - Some (Int.pos_div - (Int.add mi (Int.pred size_pointed_bytes)) - size_pointed_bytes) - in - let ma = match ma with - None -> None - | Some ma -> - Some (Int.pos_div - ma - size_pointed_bytes) - in - Ival.inject_range mi ma - with Cvalue.V.Not_based_on_null -> - Value_parameters.fatal ~current:true - "REDUCE by ACCESSED LOC: loc %a, lv %a, \ - for_writing: %b,state@ %a, new_index_val %a" - Locations.pretty loc Printer.pp_lval lv for_writing - Cvalue.Model.pretty state - Cvalue.V.pretty new_index_val; - ) - in - let new_index_val = Cvalue.V.inject_ival new_index_val in - Cvalue.Model.reduce_previous_binding - state loc_index new_index_val - else - state - - else state - else state - end - else state - - | CastE(typ,e) -> - pass_cast state cannot_find_lv typ e; - aux e - | _ -> state) - in - if offs = NoOffset (* TODO: improve *) - then - ( try - aux exp_mem - with Cannot_find_lv -> state) - else state - | _ -> state - with Cil.SizeOfError _ (* from Cil.bits... and others *) -> state - in state, valid_loc - - (* Auxiliary function for [eval_lval] below. We are evaluating the location - [loc] that resulted from the evaluation of [lv]. *) - and eval_lval_one_loc ~with_alarms deps state lv typ_lv loc = - Valarms.set_syntactic_context (Valarms.SyMem lv); - (* ignore alarm, which will be emitted by warn_reduce_by_accessed_loc *) - let _alarm_loc, v = Model.find_unspecified state loc in - let result = V_Or_Uninitialized.get_v v in - let indeterminate = Warn.maybe_warn_indeterminate ~with_alarms v in - let state = (* If v is indeterminate then warn, and reduce when possible *) - if indeterminate then - Eval_op.reduce_by_initialized_defined - V_Or_Uninitialized.remove_indeterminateness loc state - else state - in - let result = Eval_op.make_volatile ~typ:typ_lv result in - let result = Eval_typ.cast_lval_if_bitfield typ_lv loc.size result in - let state, loc = - warn_reduce_by_accessed_loc ~with_alarms ~for_writing:false state loc lv - in - let new_deps = - match deps with - | None -> None - | Some deps -> - Some (Zone.join deps (enumerate_valid_bits ~for_writing:false loc)) - in - state, new_deps, result - - and eval_lval ~with_alarms deps state lv = - let state, deps, precise_loc, typ_lv = - lval_to_precise_loc_deps_state ~with_alarms - ~deps state lv ~reduce_valid_index:(Kernel.SafeArrays.get ()) - in - if Precise_locs.is_bottom_loc precise_loc then - Model.bottom, deps, V.bottom, typ_lv - else - let aux loc (res_state, res_deps, res_result) = - let state', deps, res' = - eval_lval_one_loc ~with_alarms res_deps state lv typ_lv loc - in - Model.join res_state state', deps, V.join res' res_result - in - let state, deps, res = - Precise_locs.fold aux precise_loc (Model.bottom, deps, V.bottom) - in - state, deps, res, typ_lv - - and eval_lval_and_convert ~with_alarms deps state (e, lv) = - let state, deps, oldv, typ = eval_lval ~with_alarms deps state lv in - Valarms.set_syntactic_context (Valarms.SyUnOp e); - let newv = Eval_op.reinterpret ~with_alarms typ oldv in - (* Reduce if the conversion has really improved the result; in particular - float that are top_int are reduced there. On the other hand, we do not - want to take into account conversions unsigned -> signed, etc. *) - let state' = - (* Currently, we only store the reduction infinite float -> finite. *) - if V.equal oldv V.top_int && isFloatingType typ then - reduce_previous_value state e newv - else state - in - state', deps, newv - - (* We are accessing an array of size [array_size] at indexes [index] in state - [state]. If index causes an out-of-bounds access, emit an informative - alarm, reduce [index], and if possible reduce [index_exp] in [state]. *) - and warn_reduce_index ~with_alarms array_size_exp array_size index_exp index state = - let array_range = - Ival.inject_range (Some Int.zero) (Some (Integer.pred array_size)) - in - let new_index = Ival.narrow index array_range in - if Ival.equal new_index index - then state, index - else begin - Valarms.do_warn with_alarms.CilE.others - (fun () -> - let range = Pretty_utils.to_string Ival.pretty index in - let positive = match Ival.min_int index with - | None -> false - | Some min -> Int.ge min Int.zero - in - let size = Extlib.the array_size_exp (* array_size exists *) in - (* first [index_exp] is unused *) - let sc = Valarms.SyBinOp (index_exp, IndexPI, index_exp, size) in - Valarms.set_syntactic_context sc; - Valarms.warn_index with_alarms ~positive ~range - ); - let new_index_v = V.inject_ival new_index in - let state = reduce_previous_value state index_exp new_index_v in - state, new_index - end - - and eval_offset ~with_alarms ~reduce_valid_index deps typ state offset = - match offset with - | NoOffset -> - state, deps, Precise_locs.offset_zero, typ - | Index (exp,remaining) -> - let typ_pointed,array_size = match (unrollType typ) with - | TArray (t,size,_,_) -> t, size - | t -> - Value_parameters.fatal ~current:true "Got type '%a'" Printer.pp_typ t - in - let state, deps, index = - eval_expr_with_deps_state ~with_alarms deps state exp - in - if V.is_bottom index - then - let typ_offset = typeOffset typ_pointed remaining in - Cvalue.Model.bottom, deps, Precise_locs.offset_bottom, typ_offset - else begin - try - let index_i = V.project_ival index in - let state, index_i = - try - if reduce_valid_index then - let array_size_i = lenOfArray64 array_size in - (* Handle the special GCCism of zero-sized arrays: - Frama-C pretends their size is unknown, exactly like - GCC. *) - if Integer.is_zero array_size_i then - state,index_i - else - warn_reduce_index ~with_alarms - array_size array_size_i exp index_i state - else state, index_i - with LenOfArray -> state, index_i (* unknown array size *) - in - (* Index offsets expressed in terms of the array elements size *) - let index_i = Ival.scale_int_base (sizeof typ_pointed) index_i in - (* offset(s) for each cell *) - let state, deps, roffset, typ_offs = - eval_offset ~reduce_valid_index ~with_alarms - deps typ_pointed state remaining - in - (* Combine the two offsets *) - state,deps, Precise_locs.shift_offset index_i roffset, typ_offs - with V.Not_based_on_null -> - (* result will be a garbled mix: collect all the bases involved in - the evaluation of [offset], and raise an exception *) - let bases_index = Cvalue.V.topify_arith_origin index in - let deps, bases = - topify_offset ~with_alarms deps state bases_index remaining - in - let typ_offset = typeOffset typ_pointed remaining in - raise (Offset_not_based_on_Null (deps, bases, typ_offset)) - end - | Field (fi,remaining) -> - let attrs = filter_qualifier_attributes (typeAttrs typ) in - let typ_fi = typeAddAttributes attrs fi.ftype in - let state, deps, r, typ_res = - eval_offset ~with_alarms - ~reduce_valid_index deps typ_fi state remaining - in - let off = - try - let field = fst (bitsOffset typ (Field(fi,NoOffset))) in - Precise_locs.shift_offset_by_singleton (Int.of_int field) r - with Cil.SizeOfError _ -> Precise_locs.offset_top - in - state, deps, off, typ_res - and topify_offset ~with_alarms deps state acc offset = - match offset with - | NoOffset -> deps,acc - | Field (_fi,remaining) -> - topify_offset ~with_alarms deps state acc remaining - | Index (exp,remaining) -> - let _, deps, loc_index = - eval_expr_with_deps_state ~with_alarms deps state exp - in - let acc = Location_Bytes.join - (Cvalue.V.topify_arith_origin loc_index) - acc - in - topify_offset ~with_alarms deps state acc remaining - - (* Set [locv] to [true] if you want to compute the value pointed to by - [loc] simultaneously. *) - and eval_as_exact_loc ?(locv=true) state e = - let with_alarms = CilE.warn_none_mode in - try - let lv = find_lv state e in - (* eval_as_exact_loc is only used for reducing values, and we must NOT - reduce volatile locations. *) - if typeHasQualifier "volatile" (typeOfLval lv) then - raise Not_an_exact_loc; - let _, loc, typ = lval_to_loc_state ~with_alarms state lv in - let loc = Locations.valid_part ~for_writing:false loc in - if not (cardinal_zero_or_one loc) then raise not_an_exact_loc; - let v = - if locv then begin - Valarms.set_syntactic_context (Valarms.SyMem lv); - let _, v = Cvalue.Model.find state loc in - Valarms.set_syntactic_context (Valarms.SyUnOp e); - let v' = Eval_op.reinterpret ~with_alarms typ v in - let v' = Eval_typ.cast_lval_if_bitfield typ loc.size v' in - v' - end else - V.bottom - in - loc, v, typ - with Cannot_find_lv -> - raise not_an_exact_loc - -and warn_reduce_by_accessed_loc ~with_alarms ~for_writing state loc lv = - let warn = not (Locations.is_valid ~for_writing loc) in - if warn then begin - Valarms.set_syntactic_context (Valarms.SyMem lv); - (if for_writing then Valarms.warn_mem_write else Valarms.warn_mem_read) - with_alarms; - (* The calls to [is_valid] and to [reduce_by_accessed_loc] below cannot be - fused because of bases with validity unknown *) - reduce_by_accessed_loc ~for_writing state lv loc - end - else - state, loc - -(* Reduce the rhs argument of a shift so that it fits inside [size] bits. - Also reduce the state when possible *) -and warn_reduce_shift_rhs ~with_alarms state typ e ve = - let size = Cil.bitsSizeOf typ in - let size_int = Int.of_int size in - let valid_range_rhs = - V.inject_ival - (Ival.inject_range (Some Int.zero) (Some (Int.pred size_int))) - in - if not (V.is_included ve valid_range_rhs) then begin - Valarms.warn_shift with_alarms (Some size); - let ve = V.narrow ve valid_range_rhs in - reduce_previous_value state e ve, ve - end else state, ve - -(* Reduce both arguments of a left shift, and the state if possible *) -and warn_reduce_shift_left ~with_alarms state typ e1 v1 e2 v2 = - let state, v2 = warn_reduce_shift_rhs ~with_alarms state typ e2 v2 in - let warn_negative = - Value_parameters.WarnLeftShiftNegative.get() && - Bit_utils.is_signed_int_enum_pointer typ - in - let state, v1 = (* Cannot left-shift a negative value *) - if warn_negative then begin - let valid_range_lhs = - V.inject_ival (Ival.inject_range (Some Int.zero) None) - in - if not (V.is_included v1 valid_range_lhs) then begin - Valarms.warn_shift_left_positive with_alarms; - let v1 = V.narrow v1 valid_range_lhs in - reduce_previous_value state e1 v1, v1 - end else - state, v1 - end - else state, v1 - in - state, v1, v2 - -and reduce_previous_value state e newv = - try - let loc, _, _ = eval_as_exact_loc ~locv:false state e in - Model.reduce_previous_binding state loc newv - with Not_an_exact_loc -> state - -(* Reduce the state by comparisons of the form 'v Rel k', where v - evaluates to a location, and k to some value *) -let reduce_by_left_comparison_abstract pos expl binop expr state = - try - let loc, val_for_loc, invert, val_compared, typ_loc = - try - let loc, value, typ = - eval_as_exact_loc state expl - in - loc, value, (fun x -> Some x), value, typ - with - Not_an_exact_loc -> - let invert_cast e1 typ_loc = - let loc, val_for_loc, typ_for_loc = - eval_as_exact_loc state e1 - in - ( match Cil.unrollType typ_for_loc with - | TFloat ((FDouble|FFloat) as fk, _) -> - let single_precision = fk = FFloat in - let size = bitsSizeOf typ_loc in - let signed = isSignedInteger typ_loc in - let _, _, _, val_compared = - V.cast_float_to_int ~signed ~size val_for_loc - in - loc, val_for_loc, - (V.cast_float_to_int_inverse ~single_precision), - val_compared, typ_loc - | _ -> raise not_an_exact_loc) - in - ( match expl.enode with - | CastE (typ_larger, { enode = CastE(typ_loc,e1) } ) - when isIntegralType typ_loc && isIntegralType typ_larger && -( bitsSizeOf typ_larger > bitsSizeOf typ_loc && - isSignedInteger typ_loc ) (* TODOBY: this should be - implemented using pass_cast *) - -> - invert_cast e1 typ_loc - | CastE (typ_loc, e1) when isIntegralType typ_loc -> - invert_cast e1 typ_loc - | _ -> raise not_an_exact_loc) - - in - let reduce = Eval_op.backward_comp_left_from_type typ_loc in - let v_reduced = reduce pos binop val_compared expr in -(* Format.printf "reduce_by_left %a -> %a -> %a@." - Cvalue.V.pretty val_for_loc - Cvalue.V.pretty val_compared - Cvalue.V.pretty v_reduced; *) - if V.equal v_reduced V.bottom then raise reduce_to_bottom; - if V.equal v_reduced val_compared - then state - else ( - let new_val_for_loc = Extlib.the (invert v_reduced) in - let new_val_for_loc = V.narrow new_val_for_loc val_for_loc in - if V.equal new_val_for_loc val_for_loc - then state - else begin -(* Format.printf "reduce_by_left %a -> %a -> %a -> %a@." - Cvalue.V.pretty val_for_loc - Cvalue.V.pretty val_compared - Cvalue.V.pretty v_reduced - Cvalue.V.pretty new_val_for_loc; *) - Cvalue.Model.reduce_previous_binding state loc new_val_for_loc - end ) - with - | Not_an_exact_loc | Cil.SizeOfError _ -> state - -let reduce_by_left_comparison pos expl binop expr state = - let expr = eval_expr ~with_alarms:CilE.warn_none_mode state expr in - reduce_by_left_comparison_abstract pos expl binop expr state - -(* Reduce the state for comparisons of the form - 'v Rel k', 'k Rel v' or 'v = w' *) -let reduce_by_comparison pos exp1 binop exp2 state = - let comp = Value_util.conv_comp binop in -(* Format.printf "red_by_comparison %a@." Cvalue.Model.pretty state; *) - let state = reduce_by_left_comparison pos exp1 comp exp2 state in - let sym_comp = Comp.sym comp in - reduce_by_left_comparison pos exp2 sym_comp exp1 state - -(* Try to make the condition true by evaluating important locations, proceeding - by case disjunction on them, and removing values that make the condition - false. Raises [Reduce_to_bottom] instead of returning [Model.bottom] *) -let reduce_by_cond_enumerate state cond locs = - let with_alarms = CilE.warn_none_mode in - let condition_may_still_be_true_in_state state = - let vcond = eval_expr ~with_alarms state cond.exp in - if cond.positive - then V.contains_non_zero vcond - else - if Value_parameters.UndefinedPointerComparisonPropagateAll.get() - then V.contains_zero vcond - else V.is_included V.singleton_zero vcond - in - let is_enumerable loc = - let _, v = Cvalue.Model.find state loc in - let upto = succ (Ival.get_small_cardinal()) in - ignore (Location_Bytes.cardinal_less_than v upto); - v - in - let rec enumerate_one_var l = - match l with - | [] -> raise Not_found - | loc :: q -> - try - let v = is_enumerable loc in - loc, v, q - with Abstract_interp.Not_less_than -> enumerate_one_var q - in - try - let loc, vloc, _tail = enumerate_one_var locs in - (* Format.printf "enumerate %a %a@." Location.pretty loc V.pretty vloc;*) - let f one_val acc = - (* interpret cond in an environment where v -> one_val *) - let env = - Cvalue.Model.reduce_previous_binding state loc one_val - in - let stays = condition_may_still_be_true_in_state env in - (* Format.printf "enumerate %a stays:%B@." V.pretty one_val stays; *) - if stays then Location_Bytes.join one_val acc else acc - in - let newv = - Location_Bytes.fold_enum f vloc Location_Bytes.bottom - in - if V.is_bottom newv - then raise reduce_to_bottom - else if V.equal newv vloc - then state - else - Cvalue.Model.reduce_previous_binding state loc newv - with Not_found -> state - -(* [state cond eqop exp1lv exp1mod exp2] reduces [state] by the property - [exp1lv mod exp1mod =!= exp2], [=!=] being the conjunct of [eqop] (which - must be either [==] or [!=]) and [cond.positive]. Currently, only the - location pointed to by [exp1lv] (if any) is reduced, and only when [exp1mod] - and [exp2] are constants. *) -let reduce_by_modulo state cond exp1lv exp1mod eqop exp2 = - try - let with_alarms = CilE.warn_none_mode in - let vmodu = V.project_ival (eval_expr ~with_alarms state exp1mod) in - let modu = Ival.project_int vmodu in - let v2 = V.project_ival (eval_expr ~with_alarms state exp2) in - let r = Ival.project_int v2 in - let loc, value, _ = eval_as_exact_loc state exp1lv in - (* Format.printf "loc:%a value:%a == %a %% %a\n" - Locations.pretty loc V.pretty value Int.pretty i2 Int.pretty modu; *) - let av = V.project_ival value in - match av with - | Ival.Top _ | Ival.Set _ -> - if Int.le modu Int.zero then raise Exit; (* TODOPC *) - let min, max, r = - if (eqop = Ne) = cond.positive then begin (* Testing for Ne *) - if Int.equal modu Int.two && Int.is_zero r - then None, None, Int.one - else raise Exit - end else begin (* Testing for Eq *) - if Int.is_zero r - then None, None, r - else - if Int.gt r Int.zero - then Some (Int.round_up_to_r ~min:Int.zero ~r ~modu), None, r - else raise Exit (* TODOPC *) - end - in - if Int.ge (Int.abs r) modu then raise Reduce_to_bottom; - let reducer = Ival.inject_top min max r modu in - let reduced_value = Ival.meet (* exact here *) reducer av in - Model.reduce_previous_binding state loc (V.inject_ival reduced_value) - | Ival.Float _ -> raise Exit - with Not_an_exact_loc | V.Not_based_on_null | Ival.Not_Singleton_Int | Exit -> - state - -(* raises [Reduce_to_bottom] and never returns [Cvalue.Model.bottom]*) -let reduce_by_cond state cond = - let rec aux cond state = - (*Format.printf "eval_cond_aux %B %a@." cond.positive - Printer.pp_exp cond.exp;*) - match cond.positive, cond.exp.enode with - | _, (BinOp ((Eq | Ne as eqop), - ({enode = BinOp (Mod,exp1lv,exp1mod,_)} as exp1), exp2, _)) - | _, (BinOp ((Eq | Ne as eqop), - exp2,({enode = BinOp (Mod,exp1lv,exp1mod, _)} as exp1), _)) - -> (* This case overlaps with the BinOp case just after. For the moment, - we call the second case ourselves. *) - let state = reduce_by_modulo state cond exp1lv exp1mod eqop exp2 in - reduce_by_comparison cond.positive exp1 eqop exp2 state - - | _positive, BinOp ((Le|Ne|Eq|Gt|Lt|Ge as binop), exp1, exp2, _typ) -> - reduce_by_comparison cond.positive exp1 binop exp2 state - - (* Strict or lazy operators can be handled uniformly here: there are - no side effects inside expressions, and alarms should have been emitted - prior to reducing *) - | true, - ( BinOp (LAnd, exp1, exp2, _) - | BinOp (BAnd, (* 'cond1 & cond2' can be treated as 'e1 && e2' *) - ({ enode = BinOp ((Le|Ne|Eq|Gt|Lt|Ge), _, _, _)} as exp1), - ({ enode = BinOp ((Le|Ne|Eq|Gt|Lt|Ge), _, _, _)} as exp2), - _)) - | false, - ( BinOp (LOr, exp1, exp2, _) - | BinOp (BOr, (* '!(cond1 | cond2)' can be treated as '!(e1 || e2)' *) - ({ enode = BinOp ((Le|Ne|Eq|Gt|Lt|Ge), _, _, _)} as exp1), - ({ enode = BinOp ((Le|Ne|Eq|Gt|Lt|Ge), _, _, _)} as exp2), - _)) - -> - let new_state = aux {cond with exp = exp1} state in - let result = aux {cond with exp = exp2} new_state in - result - - | false, BinOp (LAnd, exp1, exp2, _) - | true, BinOp (LOr, exp1, exp2, _) -> - let new_v1 = try aux {cond with exp = exp1} state - with Reduce_to_bottom -> Cvalue.Model.bottom - in let new_v2 = try aux {cond with exp = exp2} state - with Reduce_to_bottom -> Cvalue.Model.bottom - in let r = Cvalue.Model.join new_v1 new_v2 in - if Db.Value.is_reachable r then r else raise reduce_to_bottom - - | _, UnOp(LNot,exp,_) -> - aux { positive = not cond.positive; exp = exp; } state - - | _, CastE (typ, e) -> - (try - pass_cast state Exit typ e; - aux { cond with exp = e} state - with Exit -> - if isIntegralType typ || isPointerType typ - then - reduce_by_left_comparison_abstract - cond.positive cond.exp Comp.Ne V.singleton_zero state - else state) - | _, Lval _ when (let t = typeOf cond.exp in - isIntegralType t || isPointerType t) - -> (* "if (c)" is equivalent to "if(!(c==0))" *) - reduce_by_left_comparison_abstract - cond.positive cond.exp Comp.Ne V.singleton_zero state - | _ -> state - in - let result = aux cond state in - (* If the condition does not evaluate exactly to true (or false if [cond] is - negative), we reduce more aggressively by splitting on some variables *) - let evaled = eval_expr ~with_alarms:CilE.warn_none_mode result cond.exp in - let reduce_more = - if cond.positive - then V.contains_zero evaled - else V.contains_non_zero evaled - in - if reduce_more then - let split_on = get_influential_vars result cond.exp in - reduce_by_cond_enumerate result cond split_on - else - result - - -let resolv_func_vinfo ~with_alarms deps state funcexp = - match funcexp.enode with - | Lval (Var vinfo,NoOffset) -> - Kernel_function.Hptset.singleton (Globals.Functions.get vinfo), deps - | Lval (Mem fptr,NoOffset) -> begin - let _, deps, loc = eval_expr_with_deps_state ~with_alarms deps state fptr in - let typ_pointer = Cil.typeOf funcexp in - let funs, warn = Eval_typ.resolve_functions ~typ_pointer loc in - match funs with - | `Value kfs -> - if warn then begin - let completely = Kernel_function.Hptset.is_empty kfs in - Valarms.(set_syntactic_context (SyUnOp fptr)); - Valarms.warn_incompatible_fun_pointer ~completely with_alarms; - end; - kfs, deps - | `Top -> - if Mark_noresults.no_memoization_enabled () then - Value_parameters.abort ~current:true - "Function pointer evaluates to anything. Try deactivating \ - option(s) -no-results, -no-results-function and \ - -obviously-terminates@." - else - Value_parameters.fatal ~current:true - "Function pointer evaluates to anything: " - V.pretty loc - end - | _ -> assert false - -let offsetmap_of_lv ~with_alarms state lv = - let state, loc_to_read, _typ = - lval_to_precise_loc_state ~with_alarms state lv - in - Valarms.set_syntactic_context (Valarms.SyMem lv); - let aux loc offsm_res = - let size = Int_Base.project loc.size in - let alarm, copy = Cvalue.Model.copy_offsetmap loc.loc size state in - if alarm then Valarms.warn_mem_read with_alarms; - Bottom.join V_Offsetmap.join copy offsm_res - in - loc_to_read, - state, - Precise_locs.fold aux loc_to_read `Bottom - - - -(* -------------------------------------------------------------------------- *) -(* --- Registration inside Db --- *) -(* -------------------------------------------------------------------------- *) - -let () = - Db.Value.find_lv_plus := - (fun state e -> - try [find_lv_plus_offset state e] - with Cannot_find_lv -> []); -;; - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_exprs.mli b/src/plugins/value/legacy/eval_exprs.mli deleted file mode 100644 index 9f6a70eba8e73c18e9a85c41d8b417ce01a996a8..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_exprs.mli +++ /dev/null @@ -1,151 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Locations - -(* Evaluation of expressions and l-values. *) - -val eval_expr : - with_alarms:CilE.warn_mode -> Cvalue.Model.t -> exp -> Cvalue.V.t - -val eval_expr_with_deps_state : - with_alarms:CilE.warn_mode -> - Zone.t option -> - Cvalue.Model.t -> - exp -> - Cvalue.Model.t * Zone.t option * Location_Bytes.t - -val eval_lval : - with_alarms:CilE.warn_mode -> - Zone.t option -> - Cvalue.Model.t -> - lval -> Cvalue.Model.t * Zone.t option * Cvalue.V.t * typ - - -(* -------------------------------------------------------------------------- *) -(* --- Evaluation to locations --- *) -(* -------------------------------------------------------------------------- *) - -val lval_to_loc : - with_alarms:CilE.warn_mode -> - Cvalue.Model.t -> lval -> location - -val lval_to_precise_loc : - with_alarms:CilE.warn_mode -> - Cvalue.Model.t -> lval -> Precise_locs.precise_location - - -val lval_to_loc_state : - with_alarms:CilE.warn_mode -> - Cvalue.Model.t -> lval -> Cvalue.Model.t * location * typ - -val lval_to_precise_loc_state : - with_alarms:CilE.warn_mode -> - Cvalue.Model.t -> lval -> Cvalue.Model.t * Precise_locs.precise_location * typ - - -val lval_to_loc_deps_state : - with_alarms:CilE.warn_mode -> - deps:Zone.t option -> - Cvalue.Model.t -> - reduce_valid_index:Kernel.SafeArrays.t -> - lval -> - Cvalue.Model.t * Zone.t option * location * typ - -val lval_to_precise_loc_deps_state : - with_alarms:CilE.warn_mode -> - deps:Zone.t option -> - Cvalue.Model.t -> - reduce_valid_index:Kernel.SafeArrays.t -> - lval -> - Cvalue.Model.t * Zone.t option * Precise_locs.precise_location * typ - - -(* -------------------------------------------------------------------------- *) -(* --- Reduction --- *) -(* -------------------------------------------------------------------------- *) - -(** Reduction by operators condition *) - -type cond = { exp : exp; positive : bool; } - -exception Reduce_to_bottom -val reduce_by_cond : Cvalue.Model.t -> cond -> Cvalue.Model.t -(** Never returns [Model.bottom]. Instead, raises [Reduce_to_bottom] *) - -(** Reduction by accesses *) - -val reduce_by_accessed_loc : - for_writing:bool -> - Cvalue.Model.t -> Cil_types.lval -> Locations.location -> - Cvalue.Model.t * Locations.location - - -(** Misc functions related to reduction *) - -exception Cannot_find_lv - -val find_lv : Cvalue.Model.t -> exp -> lval - -val get_influential_vars : - Cvalue.Model.t -> exp -> location list - - -(* -------------------------------------------------------------------------- *) -(* --- Alarms and imprecision --- *) -(* -------------------------------------------------------------------------- *) - - - - -(* -------------------------------------------------------------------------- *) -(* --- Alarms and reduction --- *) -(* -------------------------------------------------------------------------- *) - -val warn_reduce_by_accessed_loc: - with_alarms:CilE.warn_mode -> - for_writing:bool -> - Cvalue.Model.t -> Locations.location -> Cil_types.lval -> - Cvalue.Model.t * Locations.location - -(* -------------------------------------------------------------------------- *) -(* --- Misc --- *) -(* -------------------------------------------------------------------------- *) - -val resolv_func_vinfo : - with_alarms:CilE.warn_mode -> - Zone.t option -> - Cvalue.Model.t -> - exp -> Kernel_function.Hptset.t * Zone.t option - -val offsetmap_of_lv: - with_alarms:CilE.warn_mode -> - Cvalue.Model.t -> lval -> - Precise_locs.precise_location * Cvalue.Model.t * Cvalue.V_Offsetmap.t Bottom.or_bottom -(** May raise [Int_Base.Error_Top] *) - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_funs.ml b/src/plugins/value/legacy/eval_funs.ml deleted file mode 100644 index e256e495c3166747dd1a0899131adf3452a01605..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_funs.ml +++ /dev/null @@ -1,527 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(* Value analysis of entire functions *) - -open Cil_types -open Cil -open Value_util - -module AB = Eval_annots.ActiveBehaviors - -let dkey = Value_parameters.register_category "callbacks" - - -(* Compute [kf] in state [with_formals] according to the body [f] of [kf]. - Checks the preconditions of [kf], assuming the call took place at - [call_kinstr]. The postconditions are checked within the call to - [Computer.compute]. *) -let compute_using_body (kf, f) ~call_kinstr ~with_formals = - let with_locals = - List.fold_left - (fun acc local -> - let loc = Locations.loc_of_varinfo local in - Cvalue.Model.add_initial_binding - acc loc Cvalue.V_Or_Uninitialized.uninitialized - ) with_formals f.slocals - in - (* Remark: the pre-condition cannot talk about the locals. BUT - check_fct_preconditions split the state into a stateset, hence - it is simpler to apply it to the (unique) state with locals *) - let ab = AB.create with_locals kf in - let with_locals = - Eval_annots.check_fct_preconditions kf ab call_kinstr with_locals - in - let module Computer = - Eval_slevel.Computer - (struct - let kf = kf - let initial_states = with_locals (* for future reference *) - let active_behaviors = ab - end) - in - begin - try Computer.compute with_locals - with Db.Value.Aborted as e -> - (* analysis was aborted: pop the call stack and inform the caller *) - Computer.mark_degeneration (); - Computer.merge_results (); - Db.Value.mark_as_computed (); - raise e - end; - (* Merge consolidated results, call callbacks *) - let result = Computer.results () in - if Value_parameters.ValShowProgress.get() then - Value_parameters.feedback "Recording results for %a" - Kernel_function.pretty kf; - Computer.merge_results (); - (match result.Value_types.c_values with - | _ :: _ when hasAttribute "noreturn" f.svar.vattr -> - warning_once_current - "function %a may terminate but has the noreturn attribute" - Kernel_function.pretty kf; - | _ -> ()); - result - -(** Evaluate [kf] in state [with_formals], first by reducing by the - preconditions, then by evaluating the assigns, then by reducing - by the post-conditions. - The computation varies depending on the number of behaviors - (single or multiple). Both methods are correct for any number - of behaviors, but one is more efficient and the other is more precise. *) -let compute_using_specification (kf, spec) ~call_kinstr ~with_formals () = - if Value_parameters.InterpreterMode.get() - then begin - warning_once_current "Library function call. Stopping."; - exit 0 - end; - Value_parameters.feedback ~once:true "@[using specification for function %a@]" - Kernel_function.pretty kf; - Eval_behaviors.compute_using_specification kf spec ~call_kinstr ~with_formals - -(* Compute a call to [kf] in the state [with_formals]. The evaluation will - be done either using the body of [kf] or its specification, depending - on whether the body exists and on option [-val-use-spec]. [call_kinstr] - is the instruction at which the call takes place, and is used to update - the statuses of the preconditions of [kf]. If [show_progress] is true, - the callstack and additional information are printed. *) -let compute_using_spec_or_body ~with_formals ~call_kinstr ~show_progress kf = - Value_results.mark_kf_as_called kf; - let pp = show_progress && Value_parameters.ValShowProgress.get() in - if pp then - Value_parameters.feedback - "@[computing for function %a.@\nCalled from %a.@]" - Value_types.Callstack.pretty_short (call_stack ()) - Cil_datatype.Location.pretty (Cil_datatype.Kinstr.loc call_kinstr); - let use_spec = match kf.fundec with - | Declaration (_,_,_,_) -> `Spec (Annotations.funspec kf) - | Definition (def, _) -> - if Kernel_function.Set.mem kf (Value_parameters.UsePrototype.get ()) - then `Spec (Annotations.funspec kf) - else `Def def - in - let result = match use_spec with - | `Spec spec -> - Db.Value.Call_Type_Value_Callbacks.apply (`Spec, with_formals, call_stack()); - compute_using_specification (kf, spec) ~call_kinstr ~with_formals () - | `Def f -> - Db.Value.Call_Type_Value_Callbacks.apply (`Def, with_formals, call_stack()); - compute_using_body (kf, f) ~call_kinstr ~with_formals - in - if pp then - Value_parameters.feedback "Done for function %a" Kernel_function.pretty kf; - result - - -(* Compute a call to the main function. The initial state is generated - according to options such as [-lib-entry] and the options of Value governing - the shape of this state. *) -let compute_from_entry_point () = - let kf, library = Globals.entry_point () in - clear_call_stack (); - Stop_at_nth.clear (); - Value_results.mark_kf_as_called kf; - Value_parameters.feedback "Analyzing a%scomplete application starting at %a" - (if library then "n in" else " ") - Kernel_function.pretty kf; - Separate.prologue(); - let initial_state_globals = - if Db.Value.globals_use_supplied_state () then ( - let r = Db.Value.globals_state () in - Value_parameters.feedback "Initial state supplied by user"; - Value_parameters.printf - ~header:(fun fmt -> Format.pp_print_string fmt - "Values of globals") - ~level:2 "@[ %a@]" Db.Value.pretty_state r; - r) - else - (Value_parameters.feedback "Computing initial state"; - let r = Db.Value.globals_state () in - Value_parameters.feedback "Initial state computed"; - Value_parameters.printf ~dkey:Value_parameters.dkey_initial_state - ~header:(fun fmt -> Format.pp_print_string fmt - "Values of globals at initialization") - "@[ %a@]" Db.Value.pretty_state r; - r - ) in - if not (Db.Value.is_reachable initial_state_globals) - then begin - Value_parameters.result "Value analysis not started because globals \ - initialization is not computable."; - end - else begin - let with_formals = - match Db.Value.fun_get_args () with - | None -> - Function_args.main_initial_state_with_formals kf initial_state_globals - | Some actuals -> - let formals = Kernel_function.get_formals kf in - if (List.length formals) <> List.length actuals then - raise Db.Value.Incorrect_number_of_arguments; - let treat_one_formal f a = - (), Eval_op.offsetmap_of_v ~typ:f.vtype a - in - Function_args.actualize_formals - kf - initial_state_globals - (List.map2 treat_one_formal formals actuals) - in - push_call_stack kf Kglobal; - Db.Value.merge_initial_state (call_stack ()) with_formals; - Db.Value.Call_Value_Callbacks.apply (with_formals, [ kf, Kglobal ]); - ignore(compute_using_spec_or_body kf - ~call_kinstr:Kglobal ~with_formals ~show_progress:false); - pop_call_stack (); - Value_parameters.feedback "done for function %a" Kernel_function.pretty kf; - Separate.epilogue(); - end - - -(* Compute a call to a possible builtin [kf] in state [state]. [actuals] are - the arguments of [kf], and have not been bound to its formals. Returns - [None] if the call must be computed using the Cil function for [kf]. *) -let compute_maybe_builtin kf ~state actuals = - (* Actuals for builtins include a Cvalue.V arg, which is more convenient - than the entire offsetmap *) - let conv_arg with_alarms (exp, offsm) = - let typ = typeOf exp in - Valarms.set_syntactic_context (Valarms.SyUnOp exp); - let v = Eval_op.v_of_offsetmap ~with_alarms ~typ offsm in - (exp, v, offsm) - in - let actuals = lazy ( - let with_alarms = warn_all_quiet_mode () in - List.map (conv_arg with_alarms) actuals - ) - in - let (!!) = Lazy.force in - let name = Kernel_function.get_name kf in - match Builtins.find_builtin_override kf with - | Some abstract_function -> - (* Mark the function as called, otherwise it would get skipped, eg. from - the Gui. *) - Value_results.mark_kf_as_called kf; - begin - try - Some (abstract_function state !!actuals) - with - | Builtins.Invalid_nb_of_args n -> - Value_parameters.error ~current:true - "Invalid number of arguments for builtin %s: %d expected, %d found" - name n (List.length !!actuals); - raise Db.Value.Aborted - | Db.Value.Outside_builtin_possibilities -> - Value_parameters.warning ~once:true ~current:true - "Call to builtin %s failed, aborting." name; - raise Db.Value.Aborted - end - | None -> - (* Special builtins, such as Frama_C_show_each_foo *) - if Ast_info.can_be_cea_function name then - (* A few special functions that are not registered in the builtin table *) - if Ast_info.is_cea_dump_function name then - Some (Builtins_misc.dump_state state !!actuals) - else if Ast_info.is_cea_function name then - Some (Builtins_misc.dump_args name state !!actuals) - else if Ast_info.is_cea_dump_file_function name then - Some (Builtins_misc.dump_state_file name state !!actuals) - else - None - else None - -(* Compute a call to [kf] from [call_kinstr], assuming [kf] is not yet present - in the callstack. In [state], the value of actuals in [actuals] are not - yet bound to formals.*) -let compute_non_recursive_call kf ~call_kinstr state actuals = - let with_formals = - Function_args.actualize_formals - ~check:Function_args.check_arg_size kf state actuals - in - push_call_stack kf call_kinstr; - (* Store the initial state, but do not called mark_as_called. Uninteresting - Value builtins are intentionally skipped *) - Db.Value.merge_initial_state (call_stack ()) with_formals; - try - let stack_with_call = call_stack () in - Db.Value.Call_Value_Callbacks.apply (with_formals, stack_with_call); - let default () = - let r = compute_maybe_builtin kf ~state actuals in - match r with - | Some r -> - Db.Value.Call_Type_Value_Callbacks.apply - (`Builtin r, with_formals, stack_with_call); - r - | None -> - compute_using_spec_or_body kf - ~with_formals ~call_kinstr ~show_progress:true - in - let r = - let call_site = (kf, call_kinstr) in - if Value_parameters.MemExecAll.get () then - match Mem_exec.reuse_previous_call call_site with_formals actuals with - | None -> - let res = default () in - if not (!Db.Value.use_spec_instead_of_definition kf) then - Mem_exec.store_computed_call call_site with_formals actuals res; - res - | Some (res, i) -> - Db.Value.Call_Type_Value_Callbacks.apply - (`Memexec, with_formals, stack_with_call); - (* Evaluate the preconditions of kf, to update the statuses - at this call. *) - let spec = Annotations.funspec kf in - if Eval_annots.has_requires spec then begin - let ab = - AB.create_from_spec with_formals spec - in - ignore (Eval_annots.check_fct_preconditions - kf ab call_kinstr with_formals); - end; - if Value_parameters.ValShowProgress.get () then begin - Value_parameters.feedback ~current:true - "Reusing old results for call to %a" Kernel_function.pretty kf; - Value_parameters.debug ~dkey - "calling Record_Value_New callbacks on saved previous result"; - end; - Db.Value.Record_Value_Callbacks_New.apply - (stack_with_call, Value_types.Reuse i); - res - else - default () - in - pop_call_stack (); - r - with Db.Value.Aborted as e -> - pop_call_stack (); - raise e - -let compute_recursive_call kf ~call_kinstr state actuals = - push_call_stack kf call_kinstr; - let with_formals = - Function_args.actualize_formals - ~check:Function_args.check_arg_size kf state actuals - in - (* For formals that might be referenced, we must perform a join with the - previous values *) - let with_formals = - Function_args.merge_referenced_formals kf state with_formals - in - Db.Value.merge_initial_state (call_stack ()) with_formals; - let initial_spec = Annotations.funspec ~populate:false kf in - let assigns_spec () = - let assigns = Infer_annotations.assigns_from_prototype kf in - let bhv = Cil.mk_behavior ~assigns:(Writes assigns) () in - { (Cil.empty_funspec ()) with spec_behavior = [bhv] }, assigns - in - let spec = match Cil.find_default_behavior initial_spec with - | Some bhv when bhv.b_assigns <> WritesAny -> initial_spec - | _ -> - let spec, assigns = assigns_spec () in - Value_parameters.error ~once:true - "@[Recursive@ call@ on@ an unspecified@ \ - function.@ Using@ potentially@ invalid@ inferred assigns '%t'@]" - (fun fmt -> match assigns with - | [] -> Format.pp_print_string fmt "assigns \\nothing" - | _ :: _ -> - Pretty_utils.pp_list ~sep:"@ " Printer.pp_from fmt assigns); - (* Merge existing spec into our custom one with assigns *) - Logic_utils.merge_funspec - ~silent_about_merging_behav:true spec initial_spec; - spec - in - let r = compute_using_specification (kf, spec) ~call_kinstr ~with_formals() in - pop_call_stack (); - (* Restore one formal of [kf] to a correct value: either the value before - the call if the variable cannot have been modified during this call, - or a sound approximation *) - let restore_formal post_state vi = - let b = Base.of_varinfo vi in - let old = Cvalue.Model.find_base b state (* Value in previous calls *) in - let offsm = - if vi.vaddrof then - (* Any copy of the formal may have been modified by the call, join - the possible values *) - let post = Cvalue.Model.find_base b post_state in - let r = Bottom.Top.join Cvalue.V_Offsetmap.join old post in - r - else - old - in - match offsm with - | `Top | `Bottom -> assert false - | `Value offsm -> Cvalue.Model.add_base b offsm post_state - in - let formals = Kernel_function.get_formals kf in - let restore_formals state = List.fold_left restore_formal state formals in - let restore = - List.map (fun (retres, state) -> (retres, restore_formals state)) - in - { r with Value_types.c_values = restore r.Value_types.c_values } - - -(* Compute a call to [kf], called from [call_kinstr], in the state [state]. In - this state, the value of actuals in [actuals] are not yet bound to formals. - [recursive] means that the call is recursive. *) -let compute_call kf ~recursive ~call_kinstr state actuals = - if recursive then - compute_recursive_call kf ~call_kinstr state actuals - else - compute_non_recursive_call kf ~call_kinstr state actuals - - -let () = Eval_stmt.compute_call_ref := compute_call - -let floats_ok () = - let u = min_float /. 2. in - let u = u /. 2. in - 0. < u && u < min_float - -let need_assigns kf = - let spec = Annotations.funspec ~populate:false kf in - match Cil.find_default_behavior spec with - | None -> true - | Some bhv -> bhv.b_assigns = WritesAny - -let options_ok () = - (* Check that we can parse the values specified for the options that require - advanced parsing. Just make a query, as this will force the kernel to - parse them. *) - let check f = try ignore (f ()) with Not_found -> () in - check Value_parameters.SplitReturnFunction.get; - check Value_parameters.BuiltinsOverrides.get; - check Value_parameters.SlevelFunction.get; - let check_assigns kf = - if need_assigns kf then - Value_parameters.error "@[no assigns@ specified@ for function '%a',@ for \ - which@ a builtin@ or the specification@ will be used.@ \ - Potential unsoundness.@]" Kernel_function.pretty kf - in - Value_parameters.BuiltinsOverrides.iter (fun (kf, _) -> check_assigns kf); - Value_parameters.UsePrototype.iter (fun kf -> check_assigns kf); - -;; - -(* Preliminary checks before Value starts *) -let check () = - assert (floats_ok ()); - options_ok (); - Split_return.pretty_strategies (); -;; - -(* Do something tasteless in case the user did not put a spec on functions - for which he set [-val-use-spec]: generate an incorrect one ourselves *) -let generate_specs () = - let aux kf = - if need_assigns kf then begin - let spec = Annotations.funspec ~populate:false kf in - Value_parameters.warning "Generating potentially incorrect assigns \ - for function '%a' for which option %s is set" - Kernel_function.pretty kf Value_parameters.UsePrototype.option_name; - (* The function populate_spec may emit a warning. Position a loc. *) - Cil.CurrentLoc.set (Kernel_function.get_location kf); - ignore (!Annotations.populate_spec_ref kf spec) - end - in - Value_parameters.UsePrototype.iter aux - - -let pre () = - generate_specs (); - Widen.precompute_widen_hints (); - Value_perf.reset(); - (* We may be resuming Value from a previously crashed analysis. Clear - degeneration states *) - Value_util.DegenerationPoints.clear (); - Cvalue.V.clear_garbled_mix (); -;; - -let post_cleanup ~aborted = - Value_util.clear_call_stack (); - (* Precompute consolidated states if required *) - if Value_parameters.JoinResults.get () then - Db.Value.Table_By_Callstack.iter - (fun s _ -> ignore (Db.Value.get_stmt_state s)); - if not aborted then begin - (* Keep memexec results for users that want to resume the analysis *) - Mem_exec.cleanup_results (); - if not (Value_parameters.SaveFunctionState.is_empty ()) then - State_import.save_globals_state (); - end; -;; - -(* Register a signal handler for SIGUSR1, that will be used to abort Value *) -let () = - let prev = ref (fun _ -> ()) in - let handler (_signal: int) = - !prev Sys.sigusr1; (* Call previous signal handler *) - Value_parameters.warning "Stopping analysis at user request@."; - Eval_slevel.signal_abort () - in - try - match Sys.signal Sys.sigusr1 (Sys.Signal_handle handler) with - | Sys.Signal_default | Sys.Signal_ignore -> () - | Sys.Signal_handle f -> prev := f - with Invalid_argument _ -> () (* Ignore: SIGURSR1 is not available on Windows, - and possibly on other platforms. *) - - -let force_compute () = - Ast.compute (); - check (); - try - pre (); - ignore (compute_from_entry_point ()); - Db.Value.mark_as_computed (); - (* Mark unreachable and RTE statuses. Only do this there, not when the - analysis was aborted (hence, not in post_cleanup), because the - propagation is incomplete. Also do not mark unreachable statutes if - there is an alarm in the initialisers (bottom initial state), as we - would end up marking the alarm as dead. *) - if (Cvalue.Model.is_reachable (Db.Value.globals_state ())) - then Eval_annots.mark_unreachable () - else Eval_annots.mark_invalid_initializers (); - Value_util.dump_garbled_mix (); - (* Try to refine the 'Unknown' statuses that have been emitted during - this analysis. *) - Eval_annots.mark_green_and_red (); - Eval_annots.mark_rte (); - post_cleanup ~aborted:false; - (* Remove redundant alarms *) - if Value_parameters.RmAssert.get() then !Db.Scope.rm_asserts () - with - | Db.Value.Aborted -> - Db.Value.mark_as_computed (); - post_cleanup ~aborted:true; - (* Signal that a degeneration occurred *) - if Value_util.DegenerationPoints.length () > 0 then - Value_parameters.error - "Degeneration occurred:@\nresults are not correct for lines of code \ -that can be reached from the degeneration point.@." - | Globals.No_such_entry_point _ as exn -> raise exn - | exn -> Db.Value.mark_as_computed (); raise exn - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_non_linear.ml b/src/plugins/value/legacy/eval_non_linear.ml deleted file mode 100644 index 5b4ac81731e3c4091c2765107c6f19b004933fde..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_non_linear.ml +++ /dev/null @@ -1,309 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Cil -open Locations -open Abstract_interp -open Cvalue - -let dkey = Value_parameters.register_category "nonlin" - -(* (lval * location option) list *) -module LvalLocOpt_list = - Datatype.List (Datatype.Pair(Cil_datatype.LvalStructEq) - (Datatype.Option(Location))) - -module Non_linear_expressions = - State_builder.Hashtbl(Cil_datatype.Exp.Hashtbl)(LvalLocOpt_list) - (struct - let name = "Eval_non_linear" - let size = 16 - let dependencies = [ Ast.self ] - end) - -class do_non_linear_assignments = object(self) - inherit Visitor.frama_c_inplace - - val found = Cil_datatype.LvalStructEq.Hashtbl.create 16 - - method private store_non_linear e = - let res = ref [] in - let with_alarms = CilE.warn_none_mode in - let aux lv count = - (* Format.printf "LV %a %d@." Printer.pp_lval lv count; *) - if count > 1 then - let loc = Eval_exprs.lval_to_loc ~with_alarms Model.top lv in - let loc = - if Location_Bits.(equal top loc.loc) then None else Some loc - in - Value_parameters.result ~current:true ~once:true ~dkey - "non-linear '%a', lv '%a'" Printer.pp_exp e Printer.pp_lval lv; - res := (lv, loc) :: !res in - Cil_datatype.LvalStructEq.Hashtbl.iter aux found; - Cil_datatype.LvalStructEq.Hashtbl.clear found; - Non_linear_expressions.replace e !res - - method! vstmt s = - match s.skind with - | Instr (Set (_lv,exp,_)) -> - (* Currently, we do a special treatment for non-linear expressions - only in this case *) - self#v_full_exp exp; - SkipChildren - | _ -> SkipChildren - - method! vlval lv = - let cur = - try Cil_datatype.LvalStructEq.Hashtbl.find found lv - with Not_found -> 0 - in - Cil_datatype.LvalStructEq.Hashtbl.replace found lv (cur+1); - DoChildren (* visit the l-values inside e.g. t[i] *) - - method! vexpr exp = - match exp.enode with - | Lval _ | UnOp _ | BinOp _ | CastE _ | Info _ -> Cil.DoChildren - | _ -> (* None other expr contain a dereferenced l-value *) - Cil.SkipChildren - - method v_full_exp exp = - Cil_datatype.LvalStructEq.Hashtbl.clear found; - ignore (Visitor.visitFramacExpr (self:>Visitor.frama_c_inplace) exp); - self#store_non_linear exp - - method! vtype _ = SkipChildren - -end - -let compute_non_linear exp = - try Non_linear_expressions.find exp - with Not_found -> - let c = new do_non_linear_assignments in - c#v_full_exp exp; - Non_linear_expressions.find exp - -exception Too_linear - -(* Functions used to split an abstract value of a given 'type' (float or - integer.) *) -type split = { - min_and_max: V.t -> V.t * V.t (* extrema of an abstract value *); - subdiv: size:int -> V.t -> V.t * V.t (* split an abstract value in two *); -} - -let min_and_max_float v = - try - let i = V.project_ival v in - let f1, f2 = Ival.min_and_max_float i in - V.inject_float f1, V.inject_float f2 - with V.Not_based_on_null -> assert false - -let subdiv_float ~size v = - try - let v_ival = V.project_ival v in - let ival1, ival2 = Ival.subdiv_float_interval ~size v_ival in - V.inject_ival ival1, V.inject_ival ival2 - with V.Not_based_on_null -> assert false - -(* Splitting over floating-point values *) -let split_float = { min_and_max = min_and_max_float; subdiv = subdiv_float; } - -let min_and_max_int v = - try - let i = V.project_ival v in - match Ival.min_and_max i with - | None, _ | _, None -> raise Too_linear - | Some i1, Some i2 -> V.inject_int i1, V.inject_int i2 - with V.Not_based_on_null -> assert false - -let subdiv_int ~size:_ v = - try - let i = V.project_ival v in - let l, h = Ival.subdiv_int i in - V.inject_ival l, V.inject_ival h - with V.Not_based_on_null -> assert false - -(* Splitting over integer values *) -let split_int = { min_and_max = min_and_max_int; subdiv = subdiv_int } - -let eval_expr_with_deps_state_subdiv subdivnb ~with_alarms deps state e = - (* We are going to proceed by disjunction. Avoid using the supplied - ~with_alarms whenever possible, as splitting more might allow - avoiding the alarm *) - let (state_without_subdiv, deps_without_subdiv, result_without_subdiv) = - Eval_exprs.eval_expr_with_deps_state - ~with_alarms:CilE.warn_none_mode deps state e - in - if not (V.is_included result_without_subdiv V.top_int) then begin - Value_parameters.debug ~level:2 - "subdivfloatvar: expression evaluates to an address"; - Eval_exprs.eval_expr_with_deps_state ~with_alarms deps state e - end - else - let compare_min, compare_max = - if V.is_included result_without_subdiv V.top_float - then V.compare_min_float, V.compare_max_float - else V.compare_min_int, V.compare_max_int - in - let vars = List.rev (compute_non_linear e) in - let rec try_sub vars = - match vars with - | [] -> - Eval_exprs.eval_expr_with_deps_state ~with_alarms deps state e - | (lv, locopt) :: tail -> - let loc = match locopt with - | Some loc -> loc - | None -> - Eval_exprs.lval_to_loc ~with_alarms:CilE.warn_none_mode state lv - in - if not (Locations.cardinal_zero_or_one loc) then - try_sub tail - else - try - let typ_lv = Cil.typeOfLval lv in - let _, v_value = Cvalue.Model.find state loc in - let v_value = Eval_op.reinterpret ~with_alarms typ_lv v_value in - let split = - if V.is_included v_value V.top_float then split_float - else if V.is_included v_value V.top_int then split_int - else raise Too_linear (* pointers *) - in - let working_list = ref [ (v_value, result_without_subdiv) ] in - let compute ?(with_alarms=CilE.warn_none_mode) subvalue = - let substate = - Cvalue.Model.reduce_previous_binding state loc subvalue - in - Eval_exprs.eval_expr ~with_alarms substate e - in - let bound1, bound2 = split.min_and_max v_value in - let r1 = compute bound1 in - let r2 = compute bound2 in - (* This function assumes the result of the computation will be - stored as an interval. (This is not the case for integers, - but the default cardinality of small sets is so small that - we would gain little anyway.) Thus, we know the result will - be at least the interval [r1 .. r2]. Any subrange of - [bound1..bound2] whose image is already in [r1 .. f2] will not - be refined further. *) - let wont_find_better = - ref (if compare_min r2 r1 >= 0 then r1 else r2) - in - let had_bottom = ref false in - let size = - if Value_parameters.AllRoundingModes.get () - then 0 - else Int.to_int (Int_Base.project loc.Locations.size) - in - let subdiv_for_bound better_bound = - let insert_subvalue_in_list (_, exp_value as p) l = - let wont = !wont_find_better in - let bound_to_test = - if better_bound exp_value wont <= 0 - then exp_value - else wont - in - let rec aux l = - match l with - | [] -> [p] - | (_, exp_value1 as p1) :: tail -> - if better_bound exp_value1 bound_to_test >= 0 - then p :: l - else p1 :: (aux tail) - in - aux l - in - let exp_subvalue subvalue l = - let subexpr = compute subvalue in - if V.is_bottom subexpr then had_bottom := true; - insert_subvalue_in_list (subvalue, subexpr) l - in - let subdiv l = - match l with - | [] -> raise Can_not_subdiv - | (value, exp_value) :: tail -> - let subvalue1, subvalue2 = split.subdiv ~size value in - if better_bound !wont_find_better exp_value = 0 - then raise Can_not_subdiv; - let s = exp_subvalue subvalue1 tail in - exp_subvalue subvalue2 s - in - try - for _i = 1 to subdivnb do - working_list := subdiv !working_list; - done - with Can_not_subdiv -> () - in - subdiv_for_bound compare_min ; - (* Now sort working_list in decreasing order - on the upper bounds of exp_value *) - let comp_exp_value (_value1,exp_value1) (_value2,exp_value2) = - compare_max exp_value1 exp_value2 - in - working_list := List.sort comp_exp_value !working_list ; - wont_find_better := if compare_max r2 r1 >= 0 then r1 else r2; - subdiv_for_bound compare_max ; - let working_list = !working_list in - (* Replay evaluation to emit alarms. This is a hack... *) - let emit_alarms value = ignore (compute ~with_alarms value) in - let reduced_state, optimized_exp_value = - if !had_bottom - then - let reduced_var, optimized_exp_value = - List.fold_left - (fun (accv, acce) (value, exp_value) -> - emit_alarms value; - if V.is_bottom exp_value - then accv, acce - else V.join value accv, V.join exp_value acce) - (V.bottom, V.bottom) working_list - in - Cvalue.Model.reduce_previous_binding state loc reduced_var, - optimized_exp_value - else - state_without_subdiv, - List.fold_left - (fun acc (value, exp_value) -> - emit_alarms value; - V.join exp_value acc) - V.bottom working_list - in - reduced_state, deps_without_subdiv, optimized_exp_value - with Too_linear -> try_sub tail - in - try_sub vars - -let eval_expr_with_deps_state ~with_alarms deps state e = - let subdivnb = Value_parameters.LinearLevel.get () in - if subdivnb = 0 then - Eval_exprs.eval_expr_with_deps_state ~with_alarms deps state e - else - eval_expr_with_deps_state_subdiv subdivnb ~with_alarms deps state e - - - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_op.ml b/src/plugins/value/legacy/eval_op.ml index b713a7c19be96463151c47a2e162d73000a0406f..013de6d6ac01b3e810b8aeadeb370e81f1e6db80 100644 --- a/src/plugins/value/legacy/eval_op.ml +++ b/src/plugins/value/legacy/eval_op.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -22,15 +22,22 @@ open Cvalue -let pp_v v fmt = V.pretty fmt v - open Cil_types open Abstract_interp let offsetmap_of_v ~typ v = let size = Int.of_int (Cil.bitsSizeOf typ) in let v = V_Or_Uninitialized.initialized v in - V_Offsetmap.create ~size v ~size_v:size + V_Offsetmap.create ~size v ~size_v:size + +let offsetmap_of_loc location state = + let aux loc offsm_res = + let open Locations in + let size = Int_Base.project loc.size in + let copy = Cvalue.Model.copy_offsetmap loc.loc size state in + Bottom.join Cvalue.V_Offsetmap.join copy offsm_res + in + Precise_locs.fold aux location `Bottom let wrap_int i = Some (offsetmap_of_v ~typ:Cil.intType i) let wrap_ptr p = Some (offsetmap_of_v ~typ:Cil.intPtrType p) @@ -39,317 +46,21 @@ let wrap_float d = Some (offsetmap_of_v ~typ:Cil.floatType d) let wrap_size_t i = Some (offsetmap_of_v ~typ:(Cil.theMachine.Cil.typeOfSizeOf) i) - -let reinterpret_int ~with_alarms:_ ikind attrs v = - let range = Eval_typ.ik_attrs_range ikind attrs in - let size = Integer.of_int (range.Eval_typ.i_bits) in - let signed = range.Eval_typ.i_signed in - let v', _ok = V.cast ~signed ~size v in - v' - -let reinterpret_float ~with_alarms fkind v = - let conv = match Value_util.float_kind fkind with - | Fval.Float32 -> - let rounding_mode = Value_util.get_rounding_mode () in - Cvalue.V.cast_float ~rounding_mode - | Fval.Float64 -> Cvalue.V.cast_double - in - let addresses, overflow, r = conv v in - if overflow || addresses - then begin - Valarms.warn_nan_infinite - with_alarms (Some fkind) (fun fmt -> V.pretty fmt v); - end; - r - -let reinterpret ~with_alarms t v = - match Cil.unrollType t with - | TInt (ikind, attrs) | TEnum ({ekind=ikind}, attrs) -> - reinterpret_int ~with_alarms ikind attrs v - | TPtr _ -> reinterpret_int ~with_alarms Cil.theMachine.Cil.upointKind [] v - | TFloat (fkind, _) -> - reinterpret_float ~with_alarms fkind v - | TBuiltin_va_list _ -> - V.topify_arith_origin v - | TComp _ | TArray _ | TFun _ -> - (* Nothing can/should be done on struct and arrays, that are either already - imprecise as a Cvalue.V, or read in a precise way. It is not clear - that a TFun can be obtained here, but one never knows. *) - v - | TNamed _ -> assert false - | TVoid _ -> assert false - - -let v_uninit_of_offsetmap ~with_alarms ~typ offsm = +let v_uninit_of_offsetmap ~typ offsm = let size = Eval_typ.sizeof_lval_typ typ in match size with | Int_Base.Top -> V_Offsetmap.find_imprecise_everywhere offsm | Int_Base.Value size -> let validity = Base.validity_from_size size in let offsets = Ival.zero in - let alarm, r = + let _alarm, r = V_Offsetmap.find ~validity ~conflate_bottom:false ~offsets ~size offsm in - if alarm then Valarms.warn_mem_read with_alarms; - r - -let v_of_offsetmap ~with_alarms ~typ offsm = - let v_uninit = v_uninit_of_offsetmap ~with_alarms ~typ offsm in - let v = V_Or_Uninitialized.get_v v_uninit in - reinterpret ~with_alarms typ v - - -let do_promotion ~with_alarms rounding_mode ~src_typ ~dst_typ v msg = - match Cil.unrollType dst_typ, Cil.unrollType src_typ with - | TFloat _, TInt _ -> - (* Cannot overflow with 32 bits float *) - let v, _ok = Cvalue.V.cast_int_to_float rounding_mode v in - v - | TInt (kind,_), TFloat (fkind, _) -> - let size = Cil.bitsSizeOfInt kind in - let signed = Cil.isSigned kind in - let addr, non_finite, overflows, r = - Cvalue.V.cast_float_to_int ~signed ~size v - in - Warn.warn_float ~with_alarms ~non_finite ~addr (Some fkind) msg; - if overflows <> (false, false) - then begin - let dst_range = Ival.create_all_values ~signed ~size in - let mn, mx = Ival.min_and_max dst_range in - let mn = if fst overflows then mn else None in - let mx = if snd overflows then mx else None in - Valarms.warn_float_to_int_overflow with_alarms mn mx msg; - end; r - | TInt (ikind, attrs), TInt _ -> - reinterpret_int ~with_alarms ikind attrs v - | TFloat (fkind, _), TFloat _ -> - reinterpret_float ~with_alarms fkind v - | _, _ -> v - -let handle_overflow ~with_alarms ~warn_unsigned typ interpreted_e = - match Cil.unrollType typ with - | TInt(kind, _) -> - let signed = Cil.isSigned kind in - let size = Cil.bitsSizeOfInt kind in - let mn, mx = - if signed then - let b = Int.two_power_of_int (size-1) in - Int.neg b, Int.pred b - else - Int.zero, Int.pred (Int.two_power_of_int size) - in - let warn_under, warn_over = - try - let i = V.project_ival interpreted_e in - let imn, imx = Ival.min_and_max i in - let u = - match imn with - | Some bound when Int.ge bound mn -> None - | _ -> Some mn - in - let o = - match imx with - | Some bound when Int.le bound mx -> None - | _ -> Some mx - in - u, o - with V.Not_based_on_null -> - (* Catch bottom case here: there is no overflow in this case. *) - if V.is_bottom interpreted_e then - None, None - else - Some mn, Some mx - in - (match warn_under, warn_over with - | None, None -> - interpreted_e - | _ -> - if (signed && Kernel.SignedOverflow.get ()) || - (not signed && warn_unsigned && Kernel.UnsignedOverflow.get()) - then - let all_values = - Cvalue.V.inject_ival - (Ival.inject_range (Some mn) (Some mx)) - in - Valarms.warn_integer_overflow with_alarms - ~signed ~min:warn_under ~max:warn_over; - (* Take care of pointers addresses that may have crept in, - as they may alias with the NULL base *) - try - ignore (V.project_ival interpreted_e); - V.narrow all_values interpreted_e - with V.Not_based_on_null -> interpreted_e - else begin (* [interpreted_e] has been computed modulo [size] *) - if signed then - Value_util.warning_once_current - "2's complement assumed for overflow"; - interpreted_e; - end) - | _ -> interpreted_e - -let eval_binop_float ~with_alarms round flkind ev1 op ev2 = - let conv v = - try Ival.project_float (V.project_ival v) - with - | V.Not_based_on_null - | Ival.Nan_or_infinite (* raised by project_ival. probably useless *) -> - Fval.top - in - let f1 = conv ev1 in - let f2 = conv ev2 in - let binary_float_floats (_name: string) f = - try - let alarm, f = f round f1 f2 in - if alarm then - Valarms.warn_nan_infinite with_alarms - flkind (fun fmt -> Fval.pretty_overflow fmt f); - V.inject_ival (Ival.inject_float f) - with - | Fval.Non_finite -> - Valarms.warn_nan_infinite with_alarms flkind (pp_v V.top_int); - V.bottom - in - match op with - | PlusA -> binary_float_floats "+." Fval.add - | MinusA -> binary_float_floats "-." Fval.sub - | Mult -> binary_float_floats "*." Fval.mul - | Div -> binary_float_floats "/." Fval.div - | Eq | Ne | Lt | Gt | Le | Ge -> - let op = Value_util.conv_comp op in - V.inject_comp_result (Fval.forward_comp op f1 f2) - | _ -> assert false - -let eval_minus_pp ~with_alarms ~te1 ev1 ev2 = - (* Difference between the two pointers is [minus_offs] bytes, convert - to pointer difference. *) - let conv minus_offs = - try - let size = Int_Base.project (Bit_utils.osizeof_pointed te1) in - if Int.is_one size then - minus_offs - else - Ival.scale_div ~pos:true size minus_offs - with Int_Base.Error_Top -> Ival.top - in - if not (Value_parameters.WarnPointerSubstraction.get ()) then begin - (* Generate garbled mix if the two pointers disagree on their base *) - let minus_val = V.add_untyped Int_Base.minus_one ev1 ev2 in - try - V.inject_ival (conv (Cvalue.V.project_ival minus_val)) - with Cvalue.V.Not_based_on_null -> - V.join (V.topify_arith_origin ev1) (V.topify_arith_origin ev2) - end else begin - (* Pointwise arithmetics.*) - (* TODO: we may be able to reduce the bases that appear only on one side *) - let minus_offs, warn = V.sub_untyped_pointwise ev1 ev2 in - if warn then Valarms.warn_pointer_subtraction with_alarms; - let offs = conv minus_offs in - V.inject_ival offs - end - -(* eval some operations on location_bytes. This function is more low-level - than eval_binop, that evaluates the expressions in the given state. Here, - we suppose someone else has done the evaluation, and combine the results. - [te1] is the type of [ev1]. The function must behave as if it was acting on - unbounded integers *) -let eval_binop_int ~with_alarms ~te1 ev1 op ev2 = - match op with - | PlusPI | IndexPI -> V.add_untyped (Bit_utils.osizeof_pointed te1) ev1 ev2 - | MinusPI -> - V.add_untyped (Int_Base.neg (Bit_utils.osizeof_pointed te1)) ev1 ev2 - | PlusA -> V.add_untyped (Int_Base.one) ev1 ev2 - | MinusA -> V.add_untyped Int_Base.minus_one ev1 ev2 - | MinusPP -> eval_minus_pp ~with_alarms ~te1 ev1 ev2 - | Mod -> V.c_rem ev1 ev2 - | Div -> V.div ev1 ev2 - | Mult -> V.mul ev1 ev2 - | BXor -> V.bitwise_xor ev1 ev2 - | BOr -> V.bitwise_or ev1 ev2 - | BAnd -> - let size = Cil.bitsSizeOf te1 in - let signed = Bit_utils.is_signed_int_enum_pointer te1 in - V.bitwise_and ~size ~signed ev1 ev2 - | Eq | Ne | Ge | Le | Gt | Lt as op -> - let op = Value_util.conv_comp op in - let warn = not (Warn.are_comparable op ev1 ev2) in - if warn then Valarms.warn_pointer_comparison te1 with_alarms; - if warn && Value_parameters.UndefinedPointerComparisonPropagateAll.get () - then V.zero_or_one - else - let signed = Bit_utils.is_signed_int_enum_pointer te1 in - V.inject_comp_result (V.forward_comp_int ~signed op ev1 ev2) - | Shiftrt -> V.shift_right ev1 ev2 - | Shiftlt -> V.shift_left ev1 ev2 - (* Strict evaluation. The caller of this function is supposed to take - into account the laziness of those operators itself *) - | LOr -> V.interp_boolean - ~contains_zero:(V.contains_zero ev1 && V.contains_zero ev2) - ~contains_non_zero:(V.contains_non_zero ev1 || V.contains_non_zero ev2) - | LAnd -> V.interp_boolean - ~contains_zero: (V.contains_zero ev1 || V.contains_zero ev2) - ~contains_non_zero:(V.contains_non_zero ev1 && V.contains_non_zero ev2) - -(* This function evaluates a unary minus, but does _not_ check for overflows. - This is left to the caller *) -and eval_uneg ~with_alarms v t = - match Cil.unrollType t with - | TFloat (fkind, _) -> - (try - let v = V.project_ival_bottom v in - let f = Ival.project_float v in - V.inject_ival - (Ival.inject_float (Fval.neg f)) - with - | V.Not_based_on_null -> - Warn.warn_float ~with_alarms ~addr:true (Some fkind) (pp_v v); - V.topify_arith_origin v - | Ival.Nan_or_infinite (* raised by project_float; probably useless*) -> - if V.is_bottom v then v - else begin - Warn.warn_float ~with_alarms ~non_finite:true (Some fkind) (pp_v v); - V.top_float - end - ) - | _ -> - try - let v = V.project_ival v in - V.inject_ival (Ival.neg_int v) - with V.Not_based_on_null -> V.topify_arith_origin v - - -let eval_unop ~check_overflow ~with_alarms v t op = - match op with - | Neg -> - let r = eval_uneg ~with_alarms v t in - if check_overflow - then handle_overflow ~with_alarms ~warn_unsigned:true t r - else r - | BNot -> V.bitwise_not v - - | LNot -> - let warn = not (Warn.are_comparable Comp.Eq V.singleton_zero v) in - if warn then Valarms.warn_pointer_comparison t with_alarms; - if (warn && - Value_parameters.UndefinedPointerComparisonPropagateAll.get ()) - then - V.zero_or_one - else - (* [!c] holds iff [c] is equal to [O] *) - if Cil.isFloatingType t then - try - let i = V.project_ival v in - let f = Ival.project_float i in - V.inject_comp_result (Fval.forward_comp Comp.Eq f Fval.zero) - with V.Not_based_on_null | Ival.Nan_or_infinite -> V.zero_or_one - else - let signed = Bit_utils.is_signed_int_enum_pointer t in - V.inject_comp_result - (V.forward_comp_int ~signed Comp.Eq v V.singleton_zero) let backward_comp_int_left positive comp l r = if (Value_parameters.UndefinedPointerComparisonPropagateAll.get()) - && not (Warn.are_comparable comp l r) + && not (Cvalue_forward.are_comparable comp l r) then l else let binop = if positive then comp else Comp.inv comp in @@ -367,94 +78,6 @@ let backward_comp_left_from_type t = (Value_parameters.AllRoundingModes.get ()) (Value_util.float_kind fk) | _ -> (fun _ _ v _ -> v) (* should never occur anyway *) -let eval_float_constant ~with_alarms f fkind fstring = - let fl, fu = - match fstring with - | Some string when Value_parameters.AllRoundingModesConstants.get ()-> - let parsed_f = Floating_point.parse_kind fkind string in - parsed_f.Floating_point.f_lower, parsed_f.Floating_point.f_upper - | None | Some _ -> f, f - in - let fl = Fval.F.of_float fl in - let fu = Fval.F.of_float fu in - try - let non_finite, af = Fval.inject_r fl fu in - let v = V.inject_ival (Ival.inject_float af) in - if non_finite then begin - Warn.warn_float ~with_alarms ~non_finite (Some fkind) (pp_v v) - end; - v - with Fval.Non_finite -> - Warn.warn_float ~with_alarms ~non_finite:true (Some fkind) - (fun fmt -> Format.pp_print_string fmt "INFINITY"); - V.bottom - -let make_volatile ?typ v = - let is_volatile = match typ with - | None -> true - | Some typ -> Cil.typeHasQualifier "volatile" typ - in - if is_volatile && not (Cvalue.V.is_bottom v) - then - match v with - | V.Top _ -> v - | V.Map m -> - let aux b _ acc = V.join acc (V.inject b Ival.top) in - V.M.fold aux m V.bottom - else v - -let add_binding_unspecified ~with_alarms ?(remove_invalid=false) ~exact state loc value = - let loc', reduced_loc = - if remove_invalid then - let loc' = Locations.valid_part ~for_writing:true loc in - loc', not (Locations.Location.equal loc loc') - else loc, false - in - let alarm, state = Model.add_binding_unspecified ~exact state loc' value in - if alarm || reduced_loc then Valarms.warn_mem_write with_alarms; - state - -let add_binding ~with_alarms ?(remove_invalid=false) ~exact state loc value = - let value = V_Or_Uninitialized.initialized value in - add_binding_unspecified ~with_alarms ~remove_invalid ~exact state loc value - -let copy_offsetmap ~with_alarms src_loc size mm = - let alarm, r = Model.copy_offsetmap src_loc size mm in - if alarm then Valarms.warn_mem_read with_alarms; - r - -let paste_offsetmap ~with_alarms ?(remove_invalid=false) ~reducing ~from ~dst_loc ~size ~exact m = - let dst_loc, reduced_loc = - if remove_invalid then - let loc = Locations.make_loc dst_loc (Int_Base.inject size) in - let for_writing = not reducing in - let loc' = Locations.valid_part ~for_writing loc in - let dst_loc' = loc'.Locations.loc in - dst_loc', not (Locations.Location_Bits.equal dst_loc dst_loc') - else dst_loc, false - in - let alarm, r = - Cvalue.Model.paste_offsetmap ~reducing ~from ~dst_loc ~size ~exact m - in - if alarm || reduced_loc then Valarms.warn_mem_write with_alarms; - r - -let project_with_alarms ~with_alarms ~conflate_bottom _loc v = - let v_v = V_Or_Uninitialized.get_v v in - (* Warn about indeterminateness only when [conflate_bottom] is true. - Otherwise, the alarm [\initialized(loc)] or [\dangling_bits(loc)] may be - emitted for padding bits, and will be unprovable. This is a bit of - a hack, though. *) - if conflate_bottom then ignore (Warn.maybe_warn_indeterminate ~with_alarms v); - v_v - - -let find ~with_alarms ?(conflate_bottom=true) state loc = - let alarm, v = Model.find_unspecified ~conflate_bottom state loc in - if alarm then Valarms.warn_mem_read with_alarms; - project_with_alarms ~with_alarms ~conflate_bottom loc v - - exception Unchanged exception Reduce_to_bottom @@ -502,14 +125,14 @@ let reduce_by_initialized_defined f loc state = with | Reduce_to_bottom -> Model.bottom | Unchanged -> state - | Int_Base.Error_Top (* from Int_Base.project *) + | Abstract_interp.Error_Top (* from Int_Base.project *) | Not_found (* from find_lonely_key *) | Ival.Not_Singleton_Int (* from Ival.project_int *) -> state let reduce_by_valid_loc ~positive ~for_writing loc typ state = try - let _, value = Cvalue.Model.find state loc in + let value = Cvalue.Model.find state loc in if Cvalue.V.is_imprecise value then (* we won't reduce anything anyway, and we may lose information if loc contains misaligned data *) @@ -559,30 +182,7 @@ let apply_on_all_locs f loc state = ignore (Locations.Location_Bits.cardinal_less_than loc plevel); Locations.Location_Bits.fold_enum (fun l acc -> f (Locations.make_loc l size) acc) loc state - with Not_less_than | Locations.Location_Bits.Error_Top -> state - - -let write_abstract_value ~with_alarms state lv typ_lv loc_lv v = - let v = - if Cil.typeHasQualifier "volatile" typ_lv then - make_volatile v (* Do not cast further, the offsetmap layer - prefers this form. *) - else - Eval_typ.cast_lval_if_bitfield typ_lv loc_lv.Locations.size v - in - match loc_lv.Locations.loc with - | Locations.Location_Bits.Top (Base.SetLattice.Top, orig) -> - Value_parameters.result - "State before degeneration:@\n======%a@\n=======" - Cvalue.Model.pretty state; - Value_util.warning_once_current - "writing at a completely unknown address@[%a@].@\nAborting." - Origin.pretty_as_reason orig; - raise Db.Value.Aborted - | _ -> - let exact = Locations.cardinal_zero_or_one loc_lv in - Valarms.set_syntactic_context (Valarms.SyMem lv); - add_binding ~with_alarms ~exact state loc_lv v + with Not_less_than | Abstract_interp.Error_Top -> state (* Display [o] as a single value, when this is more readable and more precise than the standard display. *) @@ -590,14 +190,26 @@ let pretty_stitched_offsetmap fmt typ o = if Cil.isArithmeticOrPointerType typ && not (Cvalue.V_Offsetmap.is_single_interval o) then - let v = - v_uninit_of_offsetmap ~with_alarms:CilE.warn_none_mode ~typ o - in + let v = v_uninit_of_offsetmap ~typ o in if not (Cvalue.V_Or_Uninitialized.is_isotropic v) then Format.fprintf fmt "@\nThis amounts to: %a" Cvalue.V_Or_Uninitialized.pretty v +let pretty_offsetmap typ fmt offsm = + (* YYY: catch pointers to arrays, and print the contents of the array *) + Format.fprintf fmt "@["; + if Cvalue.V_Offsetmap.(equal empty offsm) + then Format.fprintf fmt "%s" (Unicode.emptyset_string ()) + else begin + match Cvalue.V_Offsetmap.single_interval_value offsm with + | Some value -> Cvalue.V_Or_Uninitialized.pretty fmt value; + | None -> + Cvalue.V_Offsetmap.pretty_generic ~typ () fmt offsm; + pretty_stitched_offsetmap fmt typ offsm + end; + Format.fprintf fmt "@]" + (* Local Variables: compile-command: "make -C ../../../.." diff --git a/src/plugins/value/legacy/eval_op.mli b/src/plugins/value/legacy/eval_op.mli index 0573189845a5c8c1d8a33dfe55f265b5438fc6d8..62c0921663f1682ea70b77404318feb1e85d5d7d 100644 --- a/src/plugins/value/legacy/eval_op.mli +++ b/src/plugins/value/legacy/eval_op.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,6 +28,11 @@ open Cvalue (** Transformation a value into an offsetmap of size [sizeof(typ)] bytes. *) val offsetmap_of_v: typ:Cil_types.typ -> V.t -> V_Offsetmap.t +(** Returns the offsetmap at a precise_location from a state. + May raise Abstract_interp.Error_Top. *) +val offsetmap_of_loc: + Precise_locs.precise_location -> Model.t -> V_Offsetmap.t Eval.or_bottom + (** Specialization of the function above for standard types *) val wrap_size_t: V.t -> V_Offsetmap.t option val wrap_int: V.t -> V_Offsetmap.t option @@ -35,68 +40,6 @@ val wrap_ptr: V.t -> V_Offsetmap.t option val wrap_double: V.t -> V_Offsetmap.t option val wrap_float: V.t -> V_Offsetmap.t option -(** Reads the contents of the offsetmap (assuming it contains [sizeof(typ)] - bytes), and return them as an uninterpreted value. *) -val v_uninit_of_offsetmap: - with_alarms:CilE.warn_mode -> - typ:Cil_types.typ -> V_Offsetmap.t -> V_Or_Uninitialized.t - -(** Reads the contents of the offsetmap (assuming it contains [sizeof(typ)] - bytes) as a value of type V.t, then convert the result to type [typ] *) -val v_of_offsetmap: - with_alarms:CilE.warn_mode -> - typ:Cil_types.typ -> V_Offsetmap.t -> V.t - -val reinterpret_float: - with_alarms:CilE.warn_mode -> Cil_types.fkind -> V.t -> V.t -(** Read the given value value as a float int of the given [fkind]. Warn if the - value contains an address, or is not representable as a finite float. *) - -val reinterpret: - with_alarms:CilE.warn_mode -> Cil_types.typ -> V.t -> V.t - - -val eval_binop_float : - with_alarms:CilE.warn_mode -> - Fval.rounding_mode -> - Cil_types.fkind option -> - Cvalue.V.t -> binop -> Cvalue.V.t -> Cvalue.V.t - -val eval_binop_int : - with_alarms:CilE.warn_mode -> - te1:typ -> - Cvalue.V.t -> binop -> Cvalue.V.t -> Cvalue.V.t - -val eval_unop: - check_overflow:bool -> - with_alarms:CilE.warn_mode -> - Cvalue.V.t -> - typ (** Type of the expression under the unop *) -> - Cil_types.unop -> Cvalue.V.t - -val handle_overflow: - with_alarms:CilE.warn_mode -> - warn_unsigned:bool -> Cil_types.typ -> Cvalue.V.t -> Cvalue.V.t - -val do_promotion: - with_alarms:CilE.warn_mode -> - Fval.rounding_mode -> - src_typ:Cil_types.typ -> - dst_typ:Cil_types.typ -> - Cvalue.V.t -> (Format.formatter -> unit) -> Cvalue.V.t - -val eval_float_constant: - with_alarms:CilE.warn_mode -> float -> fkind -> string option -> Cvalue.V.t -(** The arguments are the approximate float value computed during parsing, the - size of the floating-point type, and the string representing the initial - constant if available. Return an abstract value that may be bottom if the - constant is outside of the representable range, or that may be imprecise - if it is not exactly representable. *) - -val make_volatile: ?typ:typ -> V.t -> V.t -(** [make_volatile ?typ v] makes the value [v] more general (to account for - external modifications), whenever [typ] is [None] or when it has type - qualifier [volatile] *) val backward_comp_left_from_type: Cil_types.typ -> @@ -105,54 +48,6 @@ val backward_comp_left_from_type: [backward_comp_left_from_type positive op l r] reduces [l] so that the relation [l op r] holds. [typ] is the type of [l]. *) -val find: - with_alarms:CilE.warn_mode -> - ?conflate_bottom:bool -> Model.t -> Locations.location -> V.t -(** Temporary. Re-export of [Cvalue.Model.find] with a [~with_alarms] argument *) - -val add_binding : - with_alarms:CilE.warn_mode -> - ?remove_invalid:bool -> - exact:bool -> - Model.t -> - Locations.location -> - V.t -> - Model.t -(** Temporary. Re-export of [Cvalue.Model.add_binding] with a [with_alarms] - argument *) - -val add_binding_unspecified : - with_alarms:CilE.warn_mode -> - ?remove_invalid:bool -> - exact:bool -> - Model.t -> - Locations.location -> - V_Or_Uninitialized.t -> - Model.t -(** Temporary. Re-export of [Cvalue.Model.add_binding_unspecifed] with a - [with_alarms] argument *) - -val copy_offsetmap : - with_alarms:CilE.warn_mode -> - Locations.Location_Bits.t -> Integer.t -> Model.t -> - V_Offsetmap.t Bottom.or_bottom -(** Temporary. Re-export of [Cvalue.Model.copy_offsetmap] with a [with_alarms] - argument *) - -val paste_offsetmap: - with_alarms:CilE.warn_mode -> - ?remove_invalid:bool -> - reducing:bool -> - from:V_Offsetmap.t -> - dst_loc:Locations.Location_Bits.t -> - size:Integer.t -> - exact:bool -> - Model.t -> Model.t -(** Temporary. Re-exportation of [Cvalue.Model.paste_offsetmap] with a - [~with_alarms] argument. If [remove_invalid] is set to [true] (default - is [false], [dst_loc] will be pre-reduced to its valid part. Should be - set unless you reduce [dst_loc] yourself. *) - val reduce_by_initialized_defined : (V_Or_Uninitialized.t -> V_Or_Uninitialized.t) -> Locations.location -> Model.t -> Model.t @@ -171,24 +66,13 @@ val reduce_by_valid_loc: [state] so that [loc] contains a pointer [p] such that [(typ* )p] is valid if [positive] holds (or invalid otherwise). *) - -(** [write_abstract_value ~with_alarms state lv typ_lv loc_lv v] - writes [v] at [loc_lv] in [state], casting [v] to respect the type - [typ_lv] of [lv]. Currently Does 4 things: - - cast the value to the type of the bitfield it is written into, if needed - - honor an eventual "volatile" qualifier on [lv] - - check that [loc_lv] is not catastrophically imprecise. - - perform the actual abstract write -*) -val write_abstract_value: with_alarms:CilE.warn_mode -> - Model.t -> lval -> typ -> Locations.Location.t -> V.t -> Model.t - val make_loc_contiguous: Locations.location -> Locations.location (** 'Simplify' the location if it represents a contiguous zone: instead of multiple offsets with a small size, change it into a single offset with a size that covers the entire range. *) val pretty_stitched_offsetmap: Format.formatter -> typ -> V_Offsetmap.t -> unit +val pretty_offsetmap: typ -> Format.formatter -> V_Offsetmap.t -> unit (* Local Variables: diff --git a/src/plugins/value/legacy/eval_slevel.ml b/src/plugins/value/legacy/eval_slevel.ml deleted file mode 100644 index 74f5def0c1e94ae4431f0d3392303447e77b1887..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_slevel.ml +++ /dev/null @@ -1,831 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Cil -open Cil_datatype -open Cvalue -open Value_util -open Eval_exprs - -let dkey_callbacks = Value_parameters.register_category "callbacks" - -let check_signals, signal_abort = - let signal_emitted = ref false in - (fun () -> - if !signal_emitted then begin - signal_emitted := false; - raise Db.Value.Aborted - end), - (fun () -> signal_emitted := true) - -module type Arg = sig - val kf: kernel_function - val initial_states : State_set.t - val active_behaviors: Eval_annots.ActiveBehaviors.t -end - -module Computer(AnalysisParam: Arg) = -struct - - let current_kf = AnalysisParam.kf - let current_fundec = Kernel_function.get_definition current_kf - let return = Kernel_function.find_return current_kf - let return_lv = - match return.skind with - | Return (Some ({enode = Lval lv}),_) -> Some lv - | Return (None,_) -> None - | _ -> assert false (* Cil invariant *) - - let is_natural_loop = Loop.is_natural current_kf - let is_basic_loop s = match s.skind with Loop _ -> true | _ -> false - (* Widening will be performed the statements verifying this predicate. *) - let is_loop = - let non_natural = Loop.get_non_naturals current_kf in - if Stmt.Set.is_empty non_natural then - (fun s -> is_natural_loop s || is_basic_loop s) - else - (fun s -> - is_natural_loop s || is_basic_loop s || Stmt.Set.mem s non_natural) - - let obviously_terminates = - Value_parameters.ObviouslyTerminatesAll.get() (* TODO: by function *) - - let slevel = - if obviously_terminates - then Per_stmt_slevel.Global max_int - else Per_stmt_slevel.local current_kf - - let slevel stmt = match slevel with - | Per_stmt_slevel.Global i -> i - | Per_stmt_slevel.PerStmt f -> f stmt - - (* This function decides whether we should merge all incoming states - on the given statement before treating it. *) - let merge = - (* Ideally, we would like to merge only the states propagated along the - back edges of the loop. Since this is not currently easy, we - use an approximation that consists in merging all the states on the - loop node. *) - let after_loop = - Kernel_function.Set.mem current_kf - (Value_parameters.SlevelMergeAfterLoop.get ()) - in - match Per_stmt_slevel.merge current_kf with - | Per_stmt_slevel.NoMerge -> - if after_loop then - (fun stmt -> match stmt.skind with - | Loop _ -> true - | _ -> false) - else (fun _ -> false) - | Per_stmt_slevel.Merge fun_s -> - (fun stmt -> - fun_s stmt || - (after_loop && match stmt.skind with Loop _ -> true | _ -> false)) - - - let (initial_state,_) = State_set.join AnalysisParam.initial_states - - (* State propagated by the dataflow, that contains only 'new' states - (i.e. not propagated before). *) - type diff = { mutable to_propagate : State_set.t ; } - - (* The real state for a given statement, used in particular to detect - convergence. Stored by us, not by the dataflow itself. *) - type stmt_state = { - (* All the state that have been propagated separately, by slevel *) - superposition : State_imp.t; - - (* Bottom if we have never consumed all the slevel allocated. If no - more slevel is available, the state that is being propagated. This - state is *not* present in [superposition]. *) - mutable widening_state : Cvalue.Model.t ; - - (* should we widen the statement at the current iteration. - [widening_state] is decremented each time we visit the statement, - unless it is equal to zero. (In which case we widen, and set - [widening_state] to a non-zero value, currently 1.) *) - mutable widening : int; - - (* Number of states that were put in [superposition]; i.e. the - sum of the cardinals of the state sets that were added with - [update_and_tell_if_changed]. It may be different - (i.e. larger) from the cardinal of [state_imp], that merge - states that are equal. *) - mutable counter_unroll : int ; - } - - let empty_record () = { - superposition = State_imp.empty () ; - widening = Value_parameters.WideningLevel.get () ; - widening_state = Cvalue.Model.bottom ; - counter_unroll = 0; - } - - type t = stmt_state Stmt.Hashtbl.t - - let current_table : t = Stmt.Hashtbl.create 128 - - let stmt_state s = - try Stmt.Hashtbl.find current_table s - with Not_found -> - let record = empty_record () in - Stmt.Hashtbl.add current_table s record; - record - - let stmt_widening_info s = - let r = stmt_state s in - r.widening, r.widening_state - - (* merges [set] into the state associated to [stmt], and returns the subset - of [set] that was not already in the superposition. *) - let update_stmt_states stmt set = - let record = stmt_state stmt in - if Cvalue.Model.is_reachable record.widening_state - then - let (state, tr) = State_set.join set in - if Cvalue.Model.is_included state record.widening_state - then State_set.empty - else State_set.singleton (state, tr) - else - State_imp.merge_set_return_new set record.superposition - - let update_stmt_widening_info stmt wcounter wstate = - let record = stmt_state stmt in - record.widening <- wcounter; - record.widening_state <- wstate - - let states_unmerged_for_callbacks () = - let r = Stmt.Hashtbl.create (Stmt.Hashtbl.length current_table) in - let aux stmt record = - let states = State_imp.to_list record.superposition in - let states = - if Cvalue.Model.is_reachable record.widening_state - then record.widening_state :: states - else states - in - Stmt.Hashtbl.add r stmt states - in - Stmt.Hashtbl.iter aux current_table; - r - - let states_for_callbacks () = - let r = Stmt.Hashtbl.create (Stmt.Hashtbl.length current_table) in - let aux stmt record = - Stmt.Hashtbl.add r stmt - (Cvalue.Model.join - (State_imp.join record.superposition) - record.widening_state) - in - Stmt.Hashtbl.iter aux current_table; - r - - let states_unmerged s = - let record = stmt_state s in - let s = State_imp.to_set record.superposition in - if Cvalue.Model.is_reachable record.widening_state - (* Forget about the trace. TODO: preserve the trace. *) - then State_set.add (record.widening_state, Trace.top) s - else s - - let states_after = Cil_datatype.Stmt.Hashtbl.create 5 - - (* During the dataflow analysis, if required by a callback, we store the - state after a statement, but only if either the following conditions - is met ([succ] being a successor of [s]) - - [s] is an instr (the control flow statements such as [goto] and [if] - do not change the state (union of the states in the case of if)) - AND there is a control-flow join on [succ] - - [s] is the last instruction of a block that contains - local variables - For statements for which the function below returns false, we deduce - the state after by the state before [succ] or another successor of [s]. - This avoids potentially useless computations - *) - let store_state_after_during_dataflow s succ = - ((match s.skind with Instr _ -> true | _ -> false) && - (match succ.preds with [_] -> false | _ -> true)) - || (let b1 = Kernel_function.find_enclosing_block s - and b2 = Kernel_function.find_enclosing_block succ in - not (Cil_datatype.Block.equal b1 b2) && b1.blocals <> []) - - (* Computation of the per-function 'after statement' states *) - let local_after_states superposed = - lazy ( - let superposed = Lazy.force superposed in - Stmt.Hashtbl.iter - (fun stmt state -> - List.iter - (fun pred -> - if not (store_state_after_during_dataflow pred stmt) then - try - let cur = Stmt.Hashtbl.find states_after pred in - Stmt.Hashtbl.replace states_after pred - (Cvalue.Model.join state cur) - with Not_found -> Stmt.Hashtbl.add states_after pred state - ) stmt.preds; - ) superposed; - (* Since the return instruction has no successor, it is not visited - by the iter above. We fill it manually *) - (try - let s = Stmt.Hashtbl.find superposed return in - Stmt.Hashtbl.add states_after return s - with Kernel_function.No_Statement | Not_found -> () - ); - states_after - ) - - (* Table storing whether conditions on 'if' have been evaluated - to true or false *) - let conditions_table = Cil_datatype.Stmt.Hashtbl.create 5 - - let merge_results () = - let superposed = lazy (states_for_callbacks ()) in - let after_full = local_after_states superposed in - let stack_for_callbacks = call_stack () in - if Mark_noresults.should_memorize_function current_fundec then begin - Value_results.merge_states_in_db superposed stack_for_callbacks; - Db.Value.merge_conditions conditions_table; - Value_results.merge_after_states_in_db after_full stack_for_callbacks; - end; - if not (Db.Value.Record_Value_Superposition_Callbacks.is_empty ()) - then begin - let current_superpositions = lazy (states_unmerged_for_callbacks ()) in - if Value_parameters.ValShowProgress.get () then - Value_parameters.debug ~dkey:dkey_callbacks - "now calling Record_Value_Superposition callbacks"; - Db.Value.Record_Value_Superposition_Callbacks.apply - (stack_for_callbacks, current_superpositions); - end ; - if not (Db.Value.Record_Value_Callbacks.is_empty ()) - then begin - if Value_parameters.ValShowProgress.get () then - Value_parameters.debug ~dkey:dkey_callbacks - "now calling Record_Value callbacks"; - Db.Value.Record_Value_Callbacks.apply - (stack_for_callbacks, superposed) - end; - if not (Db.Value.Record_Value_Callbacks_New.is_empty ()) - then begin - if Value_parameters.ValShowProgress.get () then - Value_parameters.debug ~dkey:dkey_callbacks - "now calling Record_Value_New callbacks"; - if Value_parameters.MemExecAll.get () then - Db.Value.Record_Value_Callbacks_New.apply - (stack_for_callbacks, - Value_types.NormalStore ((superposed, after_full), - (Mem_exec.new_counter ()))) - else - Db.Value.Record_Value_Callbacks_New.apply - (stack_for_callbacks, - Value_types.Normal (superposed, after_full)) - end; - if not (Db.Value.Record_Value_After_Callbacks.is_empty ()) - then begin - if Value_parameters.ValShowProgress.get () then - Value_parameters.debug ~dkey:dkey_callbacks - "now calling Record_After_Value callbacks"; - Db.Value.Record_Value_After_Callbacks.apply - (stack_for_callbacks, after_full); - end; - ;; - - (* Clobbered list for bases containing addresses of local variables. *) - let clob = Locals_scoping.bottom () - - let cacheable = ref Value_types.Cacheable - - module DataflowArg: Dataflow2.ForwardsTransfer - with type t = diff - = struct - - let debug = false - let name = "Values analysis" - - module StmtStartData = - Dataflow2.StartData(struct type t = diff let size = 107 end) - - type t = diff - - let copy (d: t) = d - - let display_one fmt v = - State_set.iter (fun (values, trace) -> - if not (Cvalue.Model.is_reachable values) then - Format.fprintf fmt "Statement (x) with trace %a : UNREACHABLE@\n" - Trace.pretty trace - else - Format.fprintf fmt "Statement (x) with trace %a : @\n%a" - Trace.pretty trace Cvalue.Model.pretty values - ) v.to_propagate - - let pretty fmt (d: t) = display_one fmt d - - let computeFirstPredecessor (s: stmt) states = - let v = states.to_propagate in - let v = State_set.add_statement v s in - (stmt_state s).counter_unroll <- State_set.length v; - (* Create an impure state for this statement. It will be mutated by - the other functions *) - { to_propagate = v;} - - let counter_unroll_target = ref (Value_parameters.ShowSlevel.get()) - - let is_return s = match s.skind with Return _ -> true | _ -> false - - let combinePredecessors (s: stmt) ~old new_ = - let new_v = new_.to_propagate in - if State_set.is_empty new_v - then None - else begin - (* Update loc, which can appear in garbled mix origins. *) - let old_loc = Cil.CurrentLoc.get () in - Cil.CurrentLoc.set (Cil_datatype.Stmt.loc s); - (* Note: When we join traces, they must lead to the same statement; - thus we need to add the statement here (instead of e.g. in doStmt, - which would be too late). *) - let new_v = State_set.add_statement new_v s in - let current_info = stmt_state s in - let old_counter = current_info.counter_unroll in - (* Check whether there is enough slevel available. If not, merge all - states together. However, do not perform merge on return - instructions. This needlessly degrades precision for - postconditions and option -split-return. *) - let r = - if old_counter > slevel s && not (is_return s) - then - let new_state, new_trace = State_set.join new_v in - let old_state, old_trace = State_set.join old.to_propagate in - let join = - Model.join new_state old_state, - Trace.join new_trace old_trace - in - old.to_propagate <- State_set.singleton join; - Some old - else begin - try - let merged = State_set.merge_into new_v ~into:old.to_propagate in - let length_new = State_set.length new_v in - let new_counter_unroll = old_counter + length_new in - if new_counter_unroll >= !counter_unroll_target - then begin - let period = Value_parameters.ShowSlevel.get() in - let reached = new_counter_unroll / period * period in - Value_parameters.feedback ~once:true - "Semantic level unrolling superposing up to %d states" - reached; - counter_unroll_target := reached + period; - end; - current_info.counter_unroll <- new_counter_unroll; - old.to_propagate <- merged; - Some old - with State_set.Unchanged -> None - end - in - Cil.CurrentLoc.set old_loc; - r - end - - let interp_call stmt lval_to_assign funcexp argl d_value = - let with_alarms = warn_all_quiet_mode () in - let aux state = - Eval_stmt.interp_call - ~with_alarms clob stmt lval_to_assign funcexp argl state - in - State_set.fold - (fun acc (state, trace) -> - let results, call_cacheable = aux state (* xxx: add trace argument. *) in - if call_cacheable = Value_types.NoCacheCallers then - (* Propagate info that the current call cannot be cached either *) - cacheable := Value_types.NoCacheCallers; - List.fold_left - (fun acc state -> State_set.add (state, trace) acc) acc results - ) State_set.empty d_value - - let doInstr stmt (i: instr) (d: t) = - !Db.progress (); - Valarms.start_stmt (Kstmt stmt); - let d_states = d.to_propagate in - let unreachable = State_set.is_empty d_states in - let result = - if unreachable then d - else begin - let with_alarms = warn_all_quiet_mode () in - let propagate states = - (* Create a transient propagation result, that will be passed - to the successors of stmt by the dataflow module *) - { to_propagate = states } - in - let apply_each_state f = - let states_after_i = - State_set.fold - (fun acc (state, trace) -> - State_set.add (f state, trace) acc - ) State_set.empty d_states - in - propagate states_after_i - in - (* update current statement *) - match i with - | Set (lv,exp,_loc) -> - apply_each_state - (fun state_value -> - Eval_stmt.do_assign ~with_alarms - current_kf clob state_value lv exp) - (* TODOBY: this should be transferred as a builtin. However, this - is not possible for va_arg currently *) - | Call (_, - {enode = Lval (Var {vname=("__builtin_va_start"| - "__builtin_va_end")},NoOffset)}, - [{enode = Lval lv}],_loc) -> - apply_each_state - (fun state -> - let loc = Eval_exprs.lval_to_loc ~with_alarms state lv in - Valarms.set_syntactic_context (Valarms.SyMem lv); - Eval_op.add_binding ~with_alarms - ~exact:true state loc V.top_int - ) - | Call (_, - {enode = Lval (Var {vname=("__builtin_va_arg")},NoOffset)}, - [_; size; dst],_loc) -> - apply_each_state - (fun state -> - let vsize = eval_expr ~with_alarms state size in - let size = - try - let i = V.project_ival vsize in - let i = Ival.project_int i in - let ibytes = Integer.mul i (Bit_utils.sizeofchar ()) in - Int_Base.inject ibytes - with V.Not_based_on_null | Ival.Not_Singleton_Int -> - Int_Base.top - in - let locbytes = eval_expr ~with_alarms state dst in - let locbits = Locations.loc_bytes_to_loc_bits locbytes in - let loc = Locations.make_loc locbits size in - Eval_op.add_binding ~with_alarms - ~exact:true state loc V.top_int - ) - | Call (lval_to_assign,funcexp,argl,_loc) -> - propagate (interp_call stmt lval_to_assign funcexp argl d_states) - | Asm _ -> - warning_once_current - "assuming assembly code has no effects in function %t" - pretty_current_cfunction_name; - d - | Skip _ -> d - | Code_annot (_,_) -> d (* processed directly in doStmt from the - annotation table *) - end - in - Valarms.end_stmt (); - result - - let doStmtSpecific s _d states = - match s.skind with - | Loop _ -> - let current_info = stmt_state s in - let counter = current_info.counter_unroll in - if counter > slevel s then - Value_parameters.feedback ~level:1 ~once:true ~current:true - "entering loop for the first time"; - states - - | UnspecifiedSequence seq -> - (try - if Kernel.UnspecifiedAccess.get () - then begin - State_set.iter - (fun (state, _trace) -> - Eval_stmt.check_unspecified_sequence state seq - ) states; - end; - states - with Eval_stmt.AlwaysOverlap -> State_set.empty - ) - | _ -> states - - let doStmt (s: stmt) (d: t) = - Valarms.start_stmt (Kstmt s); - check_signals (); - (* Merge incoming states if the user requested it *) - if merge s then - d.to_propagate <- State_set.singleton (State_set.join d.to_propagate); - let states = d.to_propagate in - Db.Value.Compute_Statement_Callbacks.apply (s, call_stack(), - State_set.to_list states); - (* Cleanup function, to be called on all exit paths *) - let ret result = - (* Do this as late as possible, as a non-empty to_propagate field - is shown in a special way in case of degeneration *) - d.to_propagate <- State_set.empty; - Valarms.end_stmt (); - result - in - if State_set.is_empty states then ret Dataflow2.SDefault - else - let states = - if obviously_terminates - then states - else update_stmt_states s states (* Remove states already present *) - in - if State_set.is_empty states then ret Dataflow2.SDefault - else - (* We do not interpret annotations that come from statement contracts - and everything previously emitted by Value (currently, alarms) *) - let annots = Annotations.fold_code_annot - (fun e ca acc -> - if Logic_utils.is_contract ca || Emitter.equal e Value_util.emitter - then acc - else ca :: acc - ) s [] - in - let slevel = slevel s in - let interp_annot record states annot = - Eval_annots.interp_annot - current_kf AnalysisParam.active_behaviors initial_state slevel - states s annot record - in - let states = List.fold_left (interp_annot true) states annots in - if State_set.is_empty states then ret Dataflow2.SDefault - else - let is_return = is_return s in - let current_info = stmt_state s in - let old_counter = current_info.counter_unroll in - let new_states = - if (old_counter > slevel && not is_return) - || (is_return && obviously_terminates) - then (* No slevel left, perform some join and/or widening *) - let curr_wcounter, curr_wstate = stmt_widening_info s in - (* Note: curr_wstate is the previous widening state, so there is no - need to attach any trace to it: it would just be a prefix of the - currently propagated trace. *) - let (state,trace) = State_set.join states in - let joined = Cvalue.Model.join curr_wstate state in - if Model.equal joined curr_wstate then - State_set.empty (* [state] is included in the last propagated state. - Nothing remains to do *) - else - if obviously_terminates - then begin (* User thinks the analysis will terminate: do not widen *) - update_stmt_widening_info s 0 joined; - states - end - else - let r = - if is_loop s && curr_wcounter = 0 then - let widen_hints = Widen.getWidenHints current_kf s in - Cvalue.Model.widen widen_hints curr_wstate joined - else - joined - in - let new_wcounter = - if curr_wcounter = 0 then 1 else pred curr_wcounter - in - let new_state = State_set.singleton (r, trace) in - if Cvalue.Model.equal r joined then ( - update_stmt_widening_info s new_wcounter r; - new_state) - else begin (* Try to correct over-widenings *) - let new_states = - (* Do *not* record the status after interpreting the annotation - here. Possible unproven assertions have already been recorded - when the assertion has been interpreted the first time higher - in this function. *) - List.fold_left (interp_annot false) new_state annots - in - let (new_joined,tr) = State_set.join new_states in - update_stmt_widening_info s new_wcounter new_joined; - State_set.singleton (new_joined,tr) - end - else states - in - let states = doStmtSpecific s d new_states in - (* This temporary propagation value will be passed on to the successors - of [s] *) - ret (Dataflow2.SUse { to_propagate = states }) - - let doEdge s succ d = - let kinstr = Kstmt s in - let states = d.to_propagate in - Valarms.start_stmt kinstr; - (* We store the state after the execution of [s] for the callback - {Value.Record_Value_After_Callbacks}. This is done here - because we want to see the values of the variables local to the block *) - if store_state_after_during_dataflow s succ - then ( - let old = - try Cil_datatype.Stmt.Hashtbl.find states_after s - with Not_found -> Cvalue.Model.bottom - in - let updated = State_set.fold - (fun acc (state, _trace) -> - Cvalue.Model.join acc state) old states in - Cil_datatype.Stmt.Hashtbl.replace states_after s updated - ); - (* Variables exiting their scope *) - let states = - match Kernel_function.blocks_closed_by_edge s succ with - | [] -> states - | closed_blocks -> - (* Partial application is useful, do not inline *) - let block_top = - Locals_scoping.block_top_addresses_of_locals - current_fundec clob closed_blocks - in - State_set.fold - (fun set (state, trace) -> - let state = - Cvalue.Model.uninitialize_blocks_locals closed_blocks state - in - State_set.add (block_top state, trace) set) - State_set.empty - states; - in - (* Variables entering in scope *) - let opened_blocks = Kernel_function.blocks_opened_by_edge s succ in - let states = List.fold_left bind_block_locals states opened_blocks in - Valarms.end_stmt (); - d.to_propagate <- states; - d - - let doGuardOneCond stmt context exp t = - if State_set.is_empty (t.to_propagate) - then Dataflow2.GUnreachable - else begin - Valarms.start_stmt (Kstmt stmt); - let with_alarms = warn_all_quiet_mode () in - let new_values = - State_set.fold - (fun acc (state, trace) -> - let state, _, test = - eval_expr_with_deps_state None ~with_alarms state exp - in - Valarms.set_syntactic_context context; - let warn = not (Warn.are_comparable Abstract_interp.Comp.Eq - V.singleton_zero test) in - let do_it = - (warn && Value_parameters.UndefinedPointerComparisonPropagateAll.get ()) || - let t1 = unrollType (typeOf exp) in - if isIntegralType t1 || isPointerType t1 - then V.contains_non_zero test - else true (* TODO: a float condition is true iff != 0.0 *) - in - if do_it then - try - State_set.add - (reduce_by_cond state {positive = true; exp = exp}, trace) - acc - with Reduce_to_bottom -> acc - else acc) - State_set.empty - t.to_propagate - in - let result = - if State_set.is_empty new_values then Dataflow2.GUnreachable - else Dataflow2.GUse { to_propagate = new_values} - in - Valarms.end_stmt (); - result - end - - let mask_then = Db.Value.mask_then - let mask_else = Db.Value.mask_else - let mask_both = mask_then lor mask_else - - let doGuard stmt exp t = - let not_exp = new_exp ~loc:exp.eloc (UnOp(LNot, exp, intType)) in - let th, el as thel = - let context = Valarms.SyUnOp exp in - doGuardOneCond stmt context exp t, doGuardOneCond stmt context not_exp t - in - let th_reachable = - match th with - Dataflow2.GUse _ | Dataflow2.GDefault -> mask_then - | Dataflow2.GUnreachable -> 0 - in - let el_reachable = - match el with - Dataflow2.GUse _ | Dataflow2.GDefault -> mask_else - | Dataflow2.GUnreachable -> 0 - in - let reachable = th_reachable lor el_reachable in - if Value_parameters.InterpreterMode.get() && (reachable = mask_both) - then begin - warning_once_current "Do not know which branch to take. Stopping."; - exit 0 - end; - let current_condition_status = - try - Cil_datatype.Stmt.Hashtbl.find conditions_table stmt - with Not_found -> 0 - in - let new_status = - current_condition_status lor reachable - in - if new_status <> 0 - then Cil_datatype.Stmt.Hashtbl.replace conditions_table stmt new_status; - Separate.filter_if stmt thel - - end - - module Dataflow = Dataflow2.Forwards(DataflowArg) - - (* Walk through all the statements for which [to_propagate] is not empty. - Those statements are marked as "not fully propagated", for ulterior - display in the gui. Also mark the current statement as root if relevant.*) - let mark_degeneration () = - DataflowArg.StmtStartData.iter - (fun stmt v -> - if not (State_set.is_empty v.to_propagate) then - Value_util.DegenerationPoints.replace stmt false); - match Valarms.current_stmt () with - | Kglobal -> () - | Kstmt s -> - let kf = Kernel_function.find_englobing_kf s in - if Kernel_function.equal kf current_kf then ( - Value_util.DegenerationPoints.replace s true; - Valarms.end_stmt ()) - - - (* Check that the dataflow is indeed finished *) - let checkConvergence () = - DataflowArg.StmtStartData.iter (fun k v -> - if not (State_set.is_empty (v.to_propagate)) then - Value_parameters.fatal "sid:%d@\n%a@\n" - k.sid State_set.pretty v.to_propagate - ) - - (* Final states of the function, reduced by the post-condition *) - let final_states () = - let states = states_unmerged return in - (* Reduce final states according to the function postcondition *) - let result = match return_lv with - | Some (Var v, NoOffset) -> Some v - | Some _ -> assert false - | None -> None - in - Eval_annots.check_fct_postconditions - current_kf AnalysisParam.active_behaviors - (Annotations.behaviors current_kf) ~result ~per_behavior:false - Normal (* termination kind*) ~pre_state:initial_state states - - let externalize states = - Valarms.start_stmt (Kstmt return); - let with_alarms = warn_all_quiet_mode () in - (* Partial application is useful, do not inline *) - let externalize = - Eval_stmt.externalize ~with_alarms current_kf ~return_lv clob - in - let states = Split_return.join_final_states current_kf ~return_lv states in - let r = List.map externalize states in - Valarms.end_stmt (); - r - - let results () = - if DataflowArg.debug then checkConvergence (); - let final_states = final_states () in - let externalized = externalize final_states in { - Value_types.c_values = externalized; - c_clobbered = clob.Locals_scoping.clob; - c_cacheable = !cacheable; - c_from = None; - } - - let compute states = - let start = Kernel_function.find_first_stmt AnalysisParam.kf in - let states = bind_block_locals states current_fundec.sbody in - (* Init the dataflow state for the first statement *) - let dinit = { to_propagate = states} in - let dinit = DataflowArg.computeFirstPredecessor start dinit in - DataflowArg.StmtStartData.add start dinit; - Dataflow.compute [start] - -end - - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_slevel.mli b/src/plugins/value/legacy/eval_slevel.mli deleted file mode 100644 index 774dc38f3f86a02ed6ae5fb8ea45b6d74f17d2ca..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_slevel.mli +++ /dev/null @@ -1,40 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Value analysis of statements and functions bodies with slevel. *) - -(** Mark the analysis as aborted. It will be stopped at the next safe point *) -val signal_abort: unit -> unit - -module Computer - (AnalysisParam : sig - val kf : Cil_types.kernel_function - val initial_states : State_set.t - val active_behaviors : Eval_annots.ActiveBehaviors.t - end) : -sig - val compute: State_set.t -> unit - - val results: unit -> Value_types.call_result - val merge_results : unit -> unit - val mark_degeneration : unit -> unit -end diff --git a/src/plugins/value/legacy/eval_stmt.ml b/src/plugins/value/legacy/eval_stmt.ml deleted file mode 100644 index ea5f1e870830549c0441b58b066803f480cf7946..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_stmt.ml +++ /dev/null @@ -1,524 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Cil_datatype -open Cil -open Locations -open Abstract_interp -open Cvalue -open Value_util -open Eval_exprs - -(* Forward reference to [Eval_funs.compute_call] *) -let compute_call_ref = ref (fun _ -> assert false) - - - exception Do_assign_imprecise_copy - - (* Assigns [exp] to [lv] in [state]. [typ_lv] is the type if [lv]. [left_loc] - is one of the locations [lv] evaluates to. Returns [state] modified by - the assignment, and whether [left_loc] was at least partially valid. - If [warn_indeterminate] is [true], indetermine values inside [exp] are - caught, signaled to the user, and removed. *) - let do_assign_one_loc ~with_alarms clob ~warn_indeterminate state lv typ_lv exp left_loc = - let state, left_loc = - if Locations.is_bottom_loc left_loc then - Model.bottom, left_loc - else - Eval_exprs.warn_reduce_by_accessed_loc ~with_alarms - ~for_writing:true state left_loc lv - in - if not (Cvalue.Model.is_reachable state) then (state, false) - else - (* First mode, used when [exp] is not a lval, when a conversion is - needed between [exp] and [lv], or as backup *) - let default () = - let state, _, v = - Eval_non_linear.eval_expr_with_deps_state ~with_alarms None state exp - in - Locals_scoping.remember_if_locals_in_value clob left_loc v; - Warn.warn_right_exp_imprecision ~with_alarms lv left_loc v; - if Cvalue.V.is_bottom v || - Locations.is_bottom_loc left_loc || - not (Cvalue.Model.is_reachable state) - then Cvalue.Model.bottom - else Eval_op.write_abstract_value ~with_alarms state lv typ_lv left_loc v - in - (* More precise copy, in case exp is in fact an lval (and has a known size). - We copy the entire lval in one operation. This is typically useful for - struct assignment *) - let right_is_lval exp_lv = - (* Copy one location to which [exp_lv] points to, in [state] *) - let aux_one_loc right_loc state = - let state, right_loc = - Eval_exprs.warn_reduce_by_accessed_loc ~with_alarms - ~for_writing:false state right_loc exp_lv - in - (* Warn if right_loc is imprecise *) - Warn.warn_imprecise_lval_read ~with_alarms - exp_lv right_loc (* Dummy value:*)V.bottom; - (* Warn if both sides overlap *) - Warn.warn_overlap ~with_alarms (lv, left_loc) (exp_lv, right_loc); - if not (Cvalue.Model.is_reachable state) - then Cvalue.Model.bottom - else begin - (* top size is tested before this function is called, in which case - the imprecise copy mode is used *) - let size = Int_Base.project right_loc.size in - Valarms.set_syntactic_context (Valarms.SyMem exp_lv); - let offsetmap = - Eval_op.copy_offsetmap ~with_alarms right_loc.loc size state - in - let make_volatile = - typeHasQualifier "volatile" typ_lv || - typeHasQualifier "volatile" (Cil.typeOfLval exp_lv) - in - let offsetmap_state = match offsetmap with - | `Value o -> - let o = - (* TODO: this is the good place to handle partially volatile - struct, whether as source or destination *) - if make_volatile then begin - V_Offsetmap.map_on_values - (V_Or_Uninitialized.map Eval_op.make_volatile) o - end else o - in - if not (Eval_typ.offsetmap_matches_type typ_lv o) then - raise Do_assign_imprecise_copy; - (* Warn for uninitialized/escaping addresses. May return bottom - when a part of the offsetmap contains no value. *) - if warn_indeterminate then - Warn.warn_reduce_indeterminate_offsetmap - ~with_alarms typ_lv o (`Loc right_loc) state - else `Res (o, state) - | `Bottom -> `Bottom - in - match offsetmap_state with - | `Bottom -> Model.bottom - | `Res (offsetmap, state) -> - Locals_scoping.remember_if_locals_in_offsetmap - clob left_loc offsetmap; - (match Warn.offsetmap_contains_imprecision offsetmap with - | Some v -> - Warn.warn_right_exp_imprecision ~with_alarms lv left_loc v - | _ -> ()); - Valarms.set_syntactic_context (Valarms.SyMem lv); - Eval_op.paste_offsetmap ~reducing:false ~with_alarms - ~from:offsetmap ~dst_loc:left_loc.loc ~size ~exact:true state - end - in - if Locations.is_bottom_loc left_loc - || not (Cvalue.Model.is_reachable state) - then Model.bottom - else - let state, p_right_loc, _ = - lval_to_precise_loc_state ~with_alarms state exp_lv - in - if Model.is_reachable state then - (* Size mismatch between left and right size, or imprecise size. - This cannot be done by copies, but require a conversion *) - let size = Precise_locs.loc_size p_right_loc in - if not (Int_Base.equal size left_loc.size) || Int_Base.is_top size - then raise Do_assign_imprecise_copy; - let aux loc acc_state = - Model.join acc_state (aux_one_loc loc state) - in - Precise_locs.fold aux p_right_loc Model.bottom - else - Model.bottom - in - let state_res = - try - if Eval_typ.is_bitfield typ_lv - then default () - else - (* An lval assignment might be hidden by a dummy cast *) - let exp_lv = find_lv state exp in - right_is_lval exp_lv - with Cannot_find_lv | Do_assign_imprecise_copy -> default () - in - state_res, not (Locations.is_bottom_loc left_loc) - - (* Evaluate a location with the intent of writing in it. Signal an error - if the lvalue is constant *) - let lval_to_precise_loc_state_for_writing ~with_alarms state lv = - let (_, _, typ as r) = lval_to_precise_loc_state ~with_alarms state lv in - if Value_util.is_const_write_invalid typ then begin - Valarms.set_syntactic_context (Valarms.SyMem lv); - Valarms.warn_mem_write with_alarms; - Model.bottom, Precise_locs.loc_bottom, typ - end else - r - - (* Assigns [exp] to [lv] in [state] *) - let do_assign ~with_alarms kf clob state lv exp = - assert (Cvalue.Model.is_reachable state); - let state, precise_left_loc, typ_lv = - lval_to_precise_loc_state_for_writing ~with_alarms state lv - in - let warn_indeterminate = Value_util.warn_indeterminate kf in - let aux_loc loc (acc_state, acc_non_bottom_loc) = - let state', non_bottom_loc = - do_assign_one_loc ~with_alarms - clob ~warn_indeterminate state lv typ_lv exp loc - in - Model.join acc_state state', non_bottom_loc || acc_non_bottom_loc - in - let res, non_bottom_loc = - Precise_locs.fold aux_loc precise_left_loc (Model.bottom, false) - in - if not non_bottom_loc then - Valarms.do_warn with_alarms.CilE.imprecision_tracing - (fun () -> Kernel.warning ~current:true ~once:true - "@[<v>@[all target addresses were invalid. This path is \ - assumed to be dead.@]%t@]" pp_callstack - ); - res - - (* This functions stores the result of call, represented by offsetmap - [return], into [lv]. It is not trivial because we must handle the - possibility of casts between the type of the result [rettyp] and the type - of [lv]. With option [-no-collapse-call-cast], we only need the first part - of the function. This function handles one possible location in [lv]. *) - let assign_return_to_lv_one_loc ~with_alarms clob rettype (lv, loc, lvtyp) return state = - let state, loc = - Eval_exprs.warn_reduce_by_accessed_loc ~with_alarms - ~for_writing:true state loc lv - in - if Locations.is_bottom_loc loc then - state - else - if not (Eval_typ.is_bitfield lvtyp) && - not (Eval_typ.need_cast lvtyp rettype) - then - (* Direct paste *) - let size = Int_Base.project loc.size in - Valarms.set_syntactic_context (Valarms.SyMem lv); - let result = - Eval_op.paste_offsetmap ~with_alarms ~reducing:false - ~from:return ~dst_loc:loc.loc ~size ~exact:true state - in - Locals_scoping.remember_if_locals_in_offsetmap clob loc return; - result - else (* Size mismatch. We read then cast the returned value *) - let size = Int.of_int (bitsSizeOf rettype) in - let validity = Base.validity_from_size size in - let alarm, value_with_init = - V_Offsetmap.find ~validity ~offsets:Ival.zero ~size return - in - if alarm then Valarms.warn_mem_read with_alarms; - let value = V_Or_Uninitialized.get_v value_with_init in - (* Cf. bts #997 and #1024 for the syntactic context below *) - Valarms.set_syntactic_context Valarms.SyCallResult; - let evaled_exp = Eval_op.reinterpret ~with_alarms rettype value in - ignore (Warn.maybe_warn_indeterminate ~with_alarms value_with_init); - (* Type of [lv] and [return] might differ, perform a cast (bug #798) *) - let v_exp = - let msg fmt = - Format.fprintf fmt "call result (%a)" V.pretty evaled_exp - in - Eval_op.do_promotion ~with_alarms (get_rounding_mode()) - ~src_typ:rettype ~dst_typ:lvtyp evaled_exp msg - in - Locals_scoping.remember_if_locals_in_value clob loc v_exp; - Eval_op.write_abstract_value ~with_alarms state lv lvtyp loc v_exp - - (* Same as function above, but for multiple locations. *) - let assign_return_to_lv ~with_alarms clob rettype (lv, ploc, lvtyp) return state = - let aux loc acc_state = - let state = - assign_return_to_lv_one_loc ~with_alarms - clob rettype (lv, loc, lvtyp) return state - in - Model.join acc_state state - in - Precise_locs.fold aux ploc Model.bottom - - (* This function unbinds [formals] in [state]. Also, when possible, given - a formal [f], it reduces the corresponding actual [act_f] to the value - of [f] in [state]. It it is used after a call to clean up the state, - and to gain some informations on the actuals. *) - let reduce_actuals_by_formals formals actuals state = - let rec find_actual_varinfo e = match e.enode with - | Lval (Var vi, NoOffset) -> - if not vi.vaddrof && not (Cil.typeHasQualifier "volatile" vi.vtype) - then Some vi else None - | CastE (typ, e') -> begin - match find_actual_varinfo e' with - | None -> None - | Some vi as ovi -> - (* we can ignore casts, but only if they have no effect on the - abstract value *) - match Cil.unrollType typ, Cil.unrollType vi.vtype with - | (TInt (ik, _) | TEnum ({ekind = ik}, _)), - (TInt (ik', _) | TEnum ({ekind = ik'}, _)) -> - if Cil.bytesSizeOfInt ik = Cil.bytesSizeOfInt ik' && - Cil.isSigned ik = Cil.isSigned ik' - then ovi else None - | TPtr _, TPtr _ -> ovi - | TFloat (fk, _), TFloat (fk', _) -> - if fk = fk' then ovi else None - | _ -> None - end - | _ -> None - in - let cleanup acc exp v = - let b = Base.of_varinfo v in - let reduced = match find_actual_varinfo exp with - | Some vi -> begin - (* Replace [vi] by [b] when the latter is is bound in [state]. This - is sound because, had [b] been written during the call, it would - have been removed. (see {!externalize} below). Thus, either [b] - is equal to [vi], or it has been reduced during the call (in which - case it is useful to reduce [vi]). *) - try - match Model.find_base b acc with - | `Bottom | `Top -> acc - | `Value offsm -> Model.add_base (Base.of_varinfo vi) offsm acc - with Not_found -> acc - end - | None -> acc - in - Cvalue.Model.remove_base b reduced - in - Function_args.fold_left2_best_effort cleanup state actuals formals - - let interp_call ~with_alarms clob stmt lval_to_assign funcexp argl state = - let cacheable = ref Value_types.Cacheable in - let call_site_loc = CurrentLoc.get () in - try - let functions, _ = resolv_func_vinfo ~with_alarms None state funcexp in - let caller = current_kf (), stmt in - (* Remove bottom state from results, assigns result to retlv *) - let treat_one_result formals res (return, state) = - if not (Cvalue.Model.is_reachable state) - then res - else - let state = reduce_actuals_by_formals formals argl state in - match lval_to_assign with - | None -> state :: res - | Some lv -> - let state, ploc, typlv = - lval_to_precise_loc_state_for_writing ~with_alarms state lv - in - let return = - ( match return with - None -> - Value_parameters.abort ~current:true ~once:true - "Return value expected but none present. Did you misuse a builtin?" - | Some return -> return ) - in - let rettype = getReturnType (typeOf funcexp) in - let state = - assign_return_to_lv ~with_alarms - clob rettype (lv, ploc, typlv) return state - in - state :: res - in - (* For pointer calls, we retro-propagate which function is being called - in the abstract state. This may be useful: - - inside the call for languages with OO (think 'self') - - everywhere, because we may remove invalid values for the pointer - - after if enough slevel is available, as states obtained in - different functions are not merged by default. *) - let by_ptr = match funcexp.enode with - | Lval (Var _,NoOffset) -> None - | Lval (Mem v, NoOffset) -> Some v - | _ -> assert false - in - let treat_one_function f acc_rt_res = - try - let state = match by_ptr with - | None -> state - | Some exp_f -> (* the call is [( *exp_f)(...)] *) - let vi_f = Kernel_function.get_vi f in - (* Build the expression [exp_f == &f] and reduce accordingly *) - let addr = Cil.mkAddrOfVi vi_f in - let exp = Cil.mkBinOp ~loc:exp_f.eloc Eq exp_f addr in - let cond = { exp; positive = true} in - Eval_exprs.reduce_by_cond state cond - in - Value_results.add_kf_caller f ~caller; - let call_kinstr = Kstmt stmt in - let recursive = not (Warn.check_no_recursive_call f) in - (* Warn for arguments that contain uninitialized/escaping if: - - kf is a non-special leaf function (TODO: should we keep this?) - - the user asked for this *) - let warn_indeterminate = - not - (Kernel_function.is_definition f (* Should we keep this? *) - || let name = Kernel_function.get_name f in - (name >= "Frama_C" && name < "Frama_D") - || Builtins.find_builtin_override f <> None) - || Value_util.warn_indeterminate f - in - let aux_actual e (state, actuals) = - let offsm, state = - Function_args.compute_actual - ~with_alarms ~warn_indeterminate state e - in - state, (e, offsm) :: actuals - in - let state, actuals = List.fold_right aux_actual argl (state, []) in - let res = - !compute_call_ref f ~recursive ~call_kinstr state actuals in - CurrentLoc.set call_site_loc; (* Changed by compute_call_ref *) - if res.Value_types.c_cacheable = Value_types.NoCacheCallers then - (* Propagate info that callers cannot be cached either *) - cacheable := Value_types.NoCacheCallers; - Locals_scoping.remember_bases_with_locals - clob res.Value_types.c_clobbered; - (* If the call is recursive, we must not remove the formals: they - have been restored to their values during the original call. *) - let formals = - if recursive then [] else Kernel_function.get_formals f in - let treat = treat_one_result formals in - List.fold_left treat acc_rt_res res.Value_types.c_values - with - | Function_args.WrongFunctionType -> - warning_once_current - "Function type must match type at call site: \ - assert(function type matches)"; - Value_util.stop_if_stop_at_first_alarm_mode (); - acc_rt_res - in - let results = - Kernel_function.Hptset.fold treat_one_function functions [] - in - results, !cacheable - with - | Function_args.Actual_is_bottom -> (* from compute_actual *) - CurrentLoc.set call_site_loc; - [], !cacheable - - - exception AlwaysOverlap - - let check_non_overlapping state lvs1 lvs2 = - let conv lv = - let loc = lval_to_precise_loc ~with_alarms:CilE.warn_none_mode state lv in - let for_writing = false in - let exact = - lazy (Precise_locs.valid_cardinal_zero_or_one ~for_writing loc) - in - let z = Precise_locs.enumerate_valid_bits ~for_writing loc in - lv, exact, z - in - let l1 = List.map conv lvs1 in - let l2 = List.map conv lvs2 in - List.iter - (fun (lv1, exact1, z1) -> - List.iter - (fun (lv2, exact2, z2) -> - if Locations.Zone.intersects z1 z2 then begin - Valarms.set_syntactic_context (Valarms.SySep(lv1, lv2)); - Valarms.warn_separated warn_all_mode; - if Lazy.force exact1 && Lazy.force exact2 then - raise AlwaysOverlap - end; - ) - l2) - l1 - - (* Not currently taking advantage of calls information. But see - plugin Undefined Order by VP. *) - let check_unspecified_sequence state seq = - let rec check_one_stmt ((stmt1,_,writes1,_,_) as my_stmt) = function - [] -> () - | (stmt2,_,_,_,_)::seq when stmt1 == stmt2 -> check_one_stmt my_stmt seq - | (stmt2,modified2,writes2,reads2,_) :: seq -> - (* Values that cannot be read, as they are modified in the statement - (but not by the whole sequence itself) *) - let unauthorized_reads = - List.filter - (fun x -> List.for_all - (fun y -> not (LvalStructEq.equal x y)) modified2) - writes1 - in - check_non_overlapping state unauthorized_reads reads2; - if stmt1.sid < stmt2.sid then - check_non_overlapping state writes1 writes2; - check_one_stmt my_stmt seq - in - List.iter (fun x -> check_one_stmt x seq) seq - - - (* Remove locals and overwritten variables from the given state, and extract - the content of \result. *) - let externalize ~with_alarms kf ~return_lv clob = - let fundec = Kernel_function.get_definition kf in - let offsetmap_top_addresses_of_locals, state_top_addresses_of_locals = - Locals_scoping.top_addresses_of_locals fundec clob - in - fun state -> - let state, ret_val = - match return_lv with - | None -> - state, None - | Some lv -> - let typ_ret = Cil.typeOfLval lv in - let _loc, state, oret = - try - Eval_exprs.offsetmap_of_lv ~with_alarms state lv - with Int_Base.Error_Top -> - Value_parameters.abort ~current:true - "Function %a returns a value of unknown size. Aborting" - Kernel_function.pretty kf - in - match oret with - | `Bottom -> - assert (Model.equal Model.bottom state); - state, None - | `Value oret -> - Valarms.set_syntactic_context (Valarms.SyMem lv); - let offsetmap_state = - if Value_util.warn_indeterminate kf then - Warn.warn_reduce_indeterminate_offsetmap - ~with_alarms typ_ret oret `NoLoc state - else `Res (oret, state) - in - match offsetmap_state with - | `Bottom -> (* Completely indeterminate return *) - Model.bottom, None - | `Res (ret_val, state) -> - let locals, r = offsetmap_top_addresses_of_locals ret_val in - if not (Cvalue.V_Offsetmap.equal r ret_val) then - Warn.warn_locals_escape_result fundec locals; - state, Some r - in - let state = Cvalue.Model.remove_variables fundec.slocals state in - (* We only remove from [state] the formals that have been overwritten - during the call. The other ones will be used by the caller. See - {!reduce_actuals_by_formals} above. *) - let written_formals = Backward_formals.written_formals kf in - let written_formals = Cil_datatype.Varinfo.Set.elements written_formals in - let state = Cvalue.Model.remove_variables written_formals state in - let state = state_top_addresses_of_locals state in - ret_val, state - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_stmt.mli b/src/plugins/value/legacy/eval_stmt.mli deleted file mode 100644 index 9a44137abf06f9d1a36beea20f96cb54dfee9f4e..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/eval_stmt.mli +++ /dev/null @@ -1,74 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Value analysis of statements and functions bodies. *) - -open Cil_types -open Cvalue - -val compute_call_ref : - (kernel_function -> - recursive:bool -> - call_kinstr:kinstr -> - Model.t -> - (exp * V_Offsetmap.t) list -> - Value_types.call_result) - ref - -val do_assign : - with_alarms:CilE.warn_mode -> - kernel_function -> - Locals_scoping.clobbered_set -> - Model.t -> lval -> exp -> Model.t - -val interp_call : - with_alarms:CilE.warn_mode -> - Locals_scoping.clobbered_set -> - stmt -> - lval option -> - exp -> - exp list -> - Model.t -> Model.t list * Value_types.cacheable - -exception AlwaysOverlap - -val check_non_overlapping : - Model.t -> lval list -> lval list -> unit - -val check_unspecified_sequence : - Model.t -> - (stmt * lval list * lval list * lval list * stmt ref list) list -> - unit - -val externalize : - with_alarms:CilE.warn_mode -> - kernel_function -> - return_lv:lval option -> - Locals_scoping.clobbered_set -> - Model.t -> - V_Offsetmap.t option * Model.t - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/eval_terms.ml b/src/plugins/value/legacy/eval_terms.ml index 64cb0561e3d02b2678cc0c81e210f5bdec1d8f91..80071bb8959653c0b08205e99c196c03d7e01f2b 100644 --- a/src/plugins/value/legacy/eval_terms.ml +++ b/src/plugins/value/legacy/eval_terms.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -48,10 +48,10 @@ let join_predicate_status x y = match x, y with exception Stop -let join_list_predicate_status l = +let _join_list_predicate_status l = try let r = - List.fold_left + List.fold_left (fun acc e -> match e, acc with | Unknown, _ -> raise Stop @@ -78,8 +78,11 @@ let pretty_logic_evaluation_error fmt = function | UnsupportedLogicVar tv -> Format.fprintf fmt "unsupported logic var %s" tv.lv_name | AstError s -> Format.fprintf fmt "error in AST: %s; please report" s - | NoEnv (LogicLabel (_, s)) -> - Format.fprintf fmt "no environment to evaluate \\at(_,%s)" s + | NoEnv (FormalLabel s) -> + Format.fprintf fmt "no environment to evaluate \\at(_,%s)" s + | NoEnv (BuiltinLabel (_, l)) -> + Format.fprintf fmt "no environment to evaluate \\at(_,%a)" + Printer.pp_logic_builtin_label l | NoEnv (StmtLabel _) -> Format.fprintf fmt "\\at() on a C label is unsupported" | NoResult -> Format.fprintf fmt "meaning of \\result not specified" @@ -94,30 +97,69 @@ let no_env lbl = raise (LogicEvalError (NoEnv lbl)) let no_result () = raise (LogicEvalError NoResult) let c_alarm () = raise (LogicEvalError CAlarm) -let display_evaluation_error = function +(** Three modes to handle the alarms when evaluating a logical term. *) +type alarm_mode = + | Ignore (* Ignores all alarms. *) + | Fail (* Raises a LogicEvalError when an alarm is encountered. *) + | Track of bool ref (* Tracks the possibility of an alarm in the boolean. *) + +let is_logic_defined alarm status = + if status = Alarmset.True + then true + else + match alarm with + | Alarms.Valid_string _ | Alarms.Differing_blocks _ + | Alarms.Pointer_comparison _ -> true + | _ -> false + +(* Process an alarm map according to the alarm_mode. *) +let check_alarms alarms = + let default status = status = Alarmset.True in + function + | Ignore -> () + | Fail -> + if not (Alarmset.for_all is_logic_defined ~default alarms) + then c_alarm () + | Track b -> + if not (Alarmset.for_all is_logic_defined ~default alarms) + then b := true + +(* Process the possibility of an alarm according to the alarm_mode. + The boolean [b] is true when an alarm is possible. *) +let track_alarms b = function + | Ignore -> () + | Fail -> if b then c_alarm () + | Track bref -> if b then bref := true + +(* A fake expression used for the evaluation functions that produce alarms. + Such alarms must not be emitted! *) +let fake_expr = + Cil.dummy_exp (Const (CStr "fake_expression_for_logic_evaluations")) + +let unop_context = { Eval.operand = fake_expr } +let binop_context = Eval.{ left_operand = fake_expr; + right_operand = fake_expr; + binary_result = fake_expr } + +let display_evaluation_error ~loc = function | CAlarm -> () | pa -> - Value_parameters.result ~once:true ~current:true + Value_parameters.result ~source:(fst loc) ~once:true "cannot evaluate ACSL term, %a" pretty_logic_evaluation_error pa - -let warn_raise_mode = - { CilE.imprecision_tracing = CilE.a_ignore ; - defined_logic = CilE.a_ignore; - - unspecified = {CilE.a_ignore with CilE.a_call=c_alarm}; - others = {CilE.a_ignore with CilE.a_call=c_alarm}; - } - (* Warning mode use when performing _reductions_ in the logic ( ** not ** evaluation). "Logic alarms" are ignored, and the reduction proceeds as if they had not occurred. *) -let warn_reduce_mode () = - if Value_parameters.ReduceOnLogicAlarms.get () then - CilE.warn_none_mode - else - warn_raise_mode +let alarm_reduce_mode () = + if Value_parameters.ReduceOnLogicAlarms.get () then Ignore else Fail +let find_or_alarm ~alarm_mode state loc = + let is_invalid = not (Locations.is_valid ~for_writing:false loc) in + track_alarms is_invalid alarm_mode; + let v = Model.find_indeterminate ~conflate_bottom:true state loc in + let is_indeterminate = Cvalue.V_Or_Uninitialized.is_indeterminate v in + track_alarms is_indeterminate alarm_mode; + V_Or_Uninitialized.get_v v (* Evaluation environments. Used to evaluate predicate on \at nodes *) @@ -204,6 +246,21 @@ let add_old = add_logic Logic_const.old_label let add_init state = add_logic Logic_const.init_label (Db.Value.globals_state ()) state +let make_env logic_env state = + let transfer label map = + Logic_label.Map.add label (logic_env.Abstract_domain.states label) map + in + let map = + Logic_label.Map.add lbl_here state + (transfer Logic_const.pre_label + (transfer Logic_const.old_label + (transfer Logic_const.post_label + (add_init Logic_label.Map.empty)))) + in + { e_cur = lbl_here; + e_states = map; + result = logic_env.Abstract_domain.result } + let env_pre_f ~pre () = { e_cur = lbl_here; e_states = add_here pre (add_pre pre (add_init Logic_label.Map.empty)); @@ -213,7 +270,7 @@ let env_pre_f ~pre () = { let env_post_f ?(c_labels=Logic_label.Map.empty) ~pre ~post ~result () = { e_cur = lbl_here; e_states = add_post post - (add_here post (add_pre pre (add_old pre (add_init c_labels)))); + (add_here post (add_pre pre (add_old pre (add_init c_labels)))); result = result; } @@ -253,7 +310,8 @@ let bind_logic_vars env lvs = try let b, cty = supported_logic_var lv in let size = Int.of_int (Cil.bitsSizeOf cty) in - Model.add_new_base b ~size V.top_int ~size_v:Int.one state + let v = Cvalue.V_Or_Uninitialized.initialized V.top_int in + Model.add_base_value b ~size v ~size_v:Int.one state with Cil.SizeOfError _ -> unsupported_lvar lv in let state = env_current_state env in @@ -409,32 +467,30 @@ let einteger v = { etype = Cil.intType; eunder = under_from_over v; eover = v; - ldeps = empty_logic_deps} + ldeps = empty_logic_deps } (* Note: some reals cannot be exactly represented as floats; in which case we do not know their under-approximation. *) let ereal v = let eunder = under_from_over v in - { etype = Cil.doubleType; eunder; eover = v; ldeps = empty_logic_deps} + { etype = Cil.doubleType; eunder; eover = v; ldeps = empty_logic_deps } (* Check "logic alarms" when evaluating [v1 op v2]. All operators except the four below are defined unambiguously in ACSL. *) -let check_logic_alarms ~with_alarms (_v1: V.t eval_result) op v2 = +let check_logic_alarms ~alarm_mode (_v1: V.t eval_result) op v2 = match op with | Div | Mod -> (* This captures floating-point division by 0, which is ok because it is also a logic alarm for Value. *) - if V.contains_zero v2.eover then - Valarms.warn_div with_alarms ~addresses:false + track_alarms (V.contains_zero v2.eover) alarm_mode | Shiftlt | Shiftrt -> begin (* Check that [e2] is positive. [e1] can be arbitrary, we use the arithmetic vision of shifts *) try let i2 = Cvalue.V.project_ival_bottom v2.eover in - if not (Ival.is_included i2 Ival.positive_integers) then - Valarms.warn_shift with_alarms None; - with Cvalue.V.Not_based_on_null -> - Valarms.warn_shift with_alarms None; + let valid = Ival.is_included i2 Ival.positive_integers in + track_alarms (not valid) alarm_mode + with Cvalue.V.Not_based_on_null -> track_alarms true alarm_mode end | _ -> () @@ -462,17 +518,107 @@ let constraint_trange idx size_arr = | _ -> idx else idx -let rec eval_term ~with_alarms env t = +(* Note: "charlen" stands for either strlen or wcslen *) + +(* Evaluates the logical predicates [strlen/wcslen] using str* builtins. + Returns [res, alarms], where [res] is the return value of [strlen] + ([None] the evaluation results in [bottom]). *) +let logic_charlen_builtin wrapper state arg v = + let args = [ (Builtins_string.Term arg, v) ] in + (* the call below could in theory return Builtins.Invalid_nb_of_args, + but logic typing constraints prevent that. *) + let res, alarms = wrapper state args in + match res.Value_types.c_values with + | [(opt_offsm, _state)] -> begin + match opt_offsm with + | None -> None + | Some offsm -> Some (offsm, alarms) + end + | l -> Kernel.fatal "builtin should always return a singleton \ + (got %d states)" (List.length l) + +(* Never raises exceptions; instead, returns [-1,+oo] in case of alarms + (most imprecise result possible for the logic strlen/wcslen predicates). *) +let eval_logic_charlen wrapper env arg v ldeps = + let eover = + match logic_charlen_builtin wrapper (env_current_state env) arg v with + | None -> Cvalue.V.bottom + | Some (offsm, alarms) -> + if Builtins_string.String_alarms.Set.is_empty alarms + then + let v = Extlib.the (Cvalue.V_Offsetmap.single_interval_value offsm) in + Cvalue.V_Or_Uninitialized.get_v v + else Cvalue.V.inject_ival (Ival.inject_range (Some Int.minus_one) None) + in + let eunder = under_from_over eover in + (* the C strlen function has type size_t, but the logic strlen predicate has + type ℤ (signed) *) + let etype = Cil.intType in + { etype; ldeps; eover; eunder } + +(* Evaluates the logical predicate is_allocable, according to the following + logic: + - if the size to allocate is always too large (> SIZE_MAX), allocation fails; + - otherwise, if MallocReturnsNull is true or if the size may exceed SIZE_MAX, + returns Unknown (to simulate non-determinism); + - otherwise, allocation always succeeds. *) +let eval_is_allocable size = + let size_ok = Builtins_malloc.alloc_size_ok size in + match size_ok, Value_parameters.MallocReturnsNull.get () with + | Alarmset.False, _ -> False + | Alarmset.Unknown, _ | _, true -> Unknown + | Alarmset.True, false -> True + +(* returns true iff the logic variable is defined by the + Frama-C standard library *) +let comes_from_fc_stdlib lvar = + Cil.hasAttribute "fc_stdlib" lvar.lv_attr || + match lvar.lv_origin with + | None -> false + | Some vi -> + Cil.hasAttribute "fc_stdlib" vi.vattr + + +(* This is a bit tricky: [do_promotion] needs to ignore the size of src_typ. + In Cvalue_forward, this is the case for the casts between float and integers, + but not between float or between integers. Thus, we call spefically + [reinterpret_float] and [rewrap_integer] respectively. + This should be resolved by an unified AST between C and logic. *) +let do_promotion ~rounding_mode ~src_typ ~dst_typ expr v = + let open Eval_typ in + match Eval_typ.classify_as_scalar dst_typ, + Eval_typ.classify_as_scalar src_typ with + | TSFloat _, (TSInt _ | TSPtr _) + | (TSInt _ | TSPtr _), TSFloat _ -> + Cvalue_forward.do_promotion ~rounding_mode ~src_typ ~dst_typ expr v + | (TSInt dst | TSPtr dst), (TSInt _ | TSPtr _) -> + (* TODO: this is [Cvalue_forward.rewrap_integer] without emission of the + message about 2's complement for overflow. *) + let size = Integer.of_int dst.Eval_typ.i_bits in + fst (V.cast ~signed:dst.Eval_typ.i_signed ~size v), Alarmset.none + | TSFloat fkind, TSFloat _ -> + Cvalue_forward.cast_float expr fkind v + | (TSNotScalar, _) | (_, TSNotScalar) -> + v, Alarmset.none + + +(* -------------------------------------------------------------------------- *) +(* --- Evaluation of terms --- *) +(* -------------------------------------------------------------------------- *) + +let rec eval_term ~alarm_mode env t = match t.term_node with | Tat (t, lab) -> - eval_term ~with_alarms { env with e_cur = lab } t + ignore (env_state env lab); + eval_term ~alarm_mode { env with e_cur = lab } t | TConst (Integer (v, _)) -> einteger (Cvalue.V.inject_int v) | TConst (LEnum e) -> (match Cil.constFoldToInt e.eival with | Some v -> einteger (Cvalue.V.inject_int v) | _ -> ast_error "non-evaluable constant") - | TConst (LChr c) -> einteger (Cvalue.V.inject_int (Cil.charConstToInt c)) + | TConst (LChr c) -> + einteger (Cvalue.V.inject_int (Cil.charConstToInt c)) | TConst (LReal { r_lower ; r_upper }) -> begin try let r_lower = Fval.F.of_float r_lower in @@ -486,67 +632,69 @@ let rec eval_term ~with_alarms env t = (* | TConst ((CStr | CWstr) Missing cases *) | TAddrOf (thost, toffs) -> - let r = eval_thost_toffset ~with_alarms env thost toffs in + let r = eval_thost_toffset ~alarm_mode env thost toffs in { etype = TPtr (r.etype, []); ldeps = r.ldeps; - eunder = loc_bits_to_loc_bytes_under r.eunder; - eover = loc_bits_to_loc_bytes r.eover } + eunder = loc_bits_to_loc_bytes_under r.eunder; + eover = loc_bits_to_loc_bytes r.eover } | TStartOf (thost, toffs) -> - let r = eval_thost_toffset ~with_alarms env thost toffs in + let r = eval_thost_toffset ~alarm_mode env thost toffs in { etype = TPtr (Cil.typeOf_array_elem r.etype, []); ldeps = r.ldeps; - eunder = loc_bits_to_loc_bytes_under r.eunder; - eover = loc_bits_to_loc_bytes r.eover } + eunder = loc_bits_to_loc_bytes_under r.eunder; + eover = loc_bits_to_loc_bytes r.eover } | TLval _ -> - let lval = eval_tlval ~with_alarms env t in - let typ = lval.etype in - let size = Eval_typ.sizeof_lval_typ typ in - let state = env_current_state env in - let eover_loc = make_loc (lval.eover) size in - let eover = Eval_op.find ~with_alarms state eover_loc in - let eover = Eval_op.make_volatile ~typ eover in - let eover = Eval_op.reinterpret ~with_alarms typ eover in - (* Skip dependencies if state is dead *) - let deps = - if Cvalue.Model.is_reachable state then - add_deps env.e_cur empty_logic_deps - (enumerate_valid_bits ~for_writing:false eover_loc) - else empty_logic_deps - in - - (* TODO: This is a rough evaluation of the - underapproximation. A better one can be obtained as - follows: whenever a memory case in the under-approximation - contains a singleton in [state] (which is an - overapproximation), it can be added to the resulting - [eunder]. This requires a new special "Eval_op.find" - operation. *) - let eunder = under_from_over eover in - { etype = typ; - ldeps = join_logic_deps deps (lval.ldeps); - eunder; eover } + let lval = eval_tlval ~alarm_mode env t in + let typ = lval.etype in + let size = Eval_typ.sizeof_lval_typ typ in + let state = env_current_state env in + let eover_loc = make_loc (lval.eover) size in + let eover = find_or_alarm ~alarm_mode state eover_loc in + let eover = Cvalue_forward.make_volatile ~typ eover in + let eover, alarms = Cvalue_forward.reinterpret fake_expr typ eover in + check_alarms alarms alarm_mode; + (* Skip dependencies if state is dead *) + let deps = + if Cvalue.Model.is_reachable state then + add_deps env.e_cur empty_logic_deps + (enumerate_valid_bits ~for_writing:false eover_loc) + else empty_logic_deps + in + (* TODO: This is a rough evaluation of the + underapproximation. A better one can be obtained as + follows: whenever a memory case in the under-approximation + contains a singleton in [state] (which is an + overapproximation), it can be added to the resulting + [eunder]. This requires a new special "Eval_op.find" + operation. *) + let eunder = under_from_over eover in + { etype = typ; + ldeps = join_logic_deps deps (lval.ldeps); + eunder; eover } (* TBinOp ((LOr | LAnd), _t1, _t2) -> TODO: a special case would be useful. But this requires reducing the state after having evaluated t1 by a term that is in fact a predicate *) - | TBinOp (op,t1,t2) -> eval_binop ~with_alarms env op t1 t2 + | TBinOp (op,t1,t2) -> eval_binop ~alarm_mode env op t1 t2 | TUnOp (op, t) -> - let r = eval_term ~with_alarms env t in + let r = eval_term ~alarm_mode env t in let typ' = match op with | Neg -> r.etype | BNot -> r.etype (* can only be used on an integer type *) | LNot -> Cil.intType in - let eval v = - Eval_op.eval_unop ~check_overflow:false ~with_alarms v r.etype op + let v, alarms = + Cvalue_forward.forward_unop ~context:unop_context r.etype op r.eover in - let eover = eval r.eover in + check_alarms alarms alarm_mode; + let eover = v in { etype = typ'; ldeps = r.ldeps; - eover; eunder = under_from_over eover } + eover; eunder = under_from_over eover } + | Trange(otlow, othigh) -> (* The overapproximation is the range [min(low.eover)..max(high.eover)]. The underapproximation is the range [max(low.eover)..min(high.eover)]. @@ -580,14 +728,14 @@ let rec eval_term ~with_alarms env t = | None -> sure_bound_under, `Approx | Some(result) -> try - let result = eval_term ~with_alarms env result in + let result = eval_term ~alarm_mode env result in deps := join_logic_deps !deps result.ldeps; let under = min_max_under result.eover in let over = min_max_over result.eover in under, over with LogicEvalError e -> if e <> CAlarm then - Value_parameters.result ~current:true ~once:true + Value_parameters.result ~source:(fst t.term_loc) ~once:true "Cannot evaluate@ range bound %a@ (%a). Approximating" Printer.pp_term result pretty_logic_evaluation_error e; `Approx, `Approx @@ -609,34 +757,27 @@ let rec eval_term ~with_alarms env t = (Ival.inject_range (to_bound min_over) (to_bound max_over)) in { ldeps = !deps; - etype = Cil.intType; - eunder; eover } + etype = Cil.intType; + eunder; eover } | TCastE (typ, t) -> - let r = eval_term ~with_alarms env t in - let conv v = - let msg fmt = - Format.fprintf fmt "%a (%a)" Printer.pp_term t V.pretty v + let r = eval_term ~alarm_mode env t in + let eover, eunder = + (* See if the cast does something. If not, we can keep eunder as is.*) + if is_noop_cast ~src_typ:t.term_type ~dst_typ:typ + then r.eover, r.eunder + else + let eover, alarms = + do_promotion ~rounding_mode:real_mode + ~src_typ:r.etype ~dst_typ:typ fake_expr r.eover in - (* This is a bit tricky. do_promotion ignores the *size* of src_typ, - and is only interested in the distinction between float and - integer/pointers. Thus, we can use r.etype as its argument. *) - Eval_op.do_promotion ~with_alarms - real_mode ~src_typ:r.etype ~dst_typ:typ v msg - in - let eover, eunder = - (* See if the cast does something. If not, we can keep eunder as is.*) - if is_noop_cast ~src_typ:t.term_type ~dst_typ:typ - then r.eover, r.eunder - else - let eover = conv r.eover in - eover, under_from_over eover - in - { etype = typ; - ldeps = r.ldeps; eunder; eover } + check_alarms alarms alarm_mode; + eover, under_from_over eover + in + { etype = typ; ldeps = r.ldeps; eunder; eover } | Tif (tcond, ttrue, tfalse) -> - eval_tif eval_term Cvalue.V.join Cvalue.V.meet ~with_alarms env + eval_tif eval_term Cvalue.V.join Cvalue.V.meet ~alarm_mode env tcond ttrue tfalse | TSizeOf _ | TSizeOfE _ | TSizeOfStr _ | TAlignOf _ | TAlignOfE _ -> @@ -648,32 +789,31 @@ let rec eval_term ~with_alarms env t = einteger v | Tunion l -> - let eunder, eover, deps = List.fold_left + let eunder, eover, deps = List.fold_left (fun (accunder, accover, accdeps) t -> - let r = eval_term ~with_alarms env t in - (Cvalue.V.link accunder r.eunder, - Cvalue.V.join accover r.eover, - join_logic_deps accdeps r.ldeps)) + let r = eval_term ~alarm_mode env t in + (Cvalue.V.link accunder r.eunder, + Cvalue.V.join accover r.eover, + join_logic_deps accdeps r.ldeps)) (Cvalue.V.bottom, Cvalue.V.bottom, empty_logic_deps) l - in - { etype = infer_type t.term_type; - ldeps = deps; eunder; eover } + in + { etype = infer_type t.term_type; + ldeps = deps; eunder; eover } | Tempty_set -> { etype = infer_type t.term_type; - ldeps = empty_logic_deps; - eunder = Cvalue.V.bottom; - eover = Cvalue.V.bottom } + ldeps = empty_logic_deps; + eunder = Cvalue.V.bottom; + eover = Cvalue.V.bottom } | Tnull -> { etype = Cil.voidPtrType; ldeps = empty_logic_deps; eunder = Cvalue.V.singleton_zero; - eover = Cvalue.V.singleton_zero; - } + eover = Cvalue.V.singleton_zero } | TLogic_coerce(ltyp, t) -> - let r = eval_term ~with_alarms env t in + let r = eval_term ~alarm_mode env t in (* we must handle coercion from singleton to set, for which there is nothing to do, AND coercion from an integer type to a floating-point type, that require a conversion. *) @@ -692,8 +832,8 @@ let rec eval_term ~with_alarms env t = in { etype = Cil.doubleType; ldeps = r.ldeps; - eunder = under_from_over r.eover; - eover = conv r.eover } + eunder = under_from_over r.eover; + eover = conv r.eover } else r (* already a floating-point number (hopefully) *) | _ -> unsupported (Format.asprintf "logic coercion %a -> %a@." @@ -703,26 +843,26 @@ let rec eval_term ~with_alarms env t = (* TODO: the meaning of the label in \offset and \base_addr is not obvious at all *) | Toffset (_lbl, t) -> - let r = eval_term ~with_alarms env t in + let r = eval_term ~alarm_mode env t in let add_offset _ offs acc = Ival.join offs acc in let offs = Location_Bytes.fold_topset_ok add_offset r.eover Ival.bottom in let eover = Cvalue.V.inject_ival offs in { etype = Cil.intType; ldeps = r.ldeps; - eover; - eunder = under_from_over eover } + eover; + eunder = under_from_over eover } | Tbase_addr (_lbl, t) -> - let r = eval_term ~with_alarms env t in + let r = eval_term ~alarm_mode env t in let add_base b acc = V.join acc (V.inject b Ival.zero) in let eover = Location_Bytes.fold_bases add_base r.eover V.bottom in { etype = Cil.charPtrType; ldeps = r.ldeps; - eover; - eunder = under_from_over eover } + eover; + eunder = under_from_over eover } | Tblock_length (_lbl, t) -> (* TODO: take label into account for locals *) - let r = eval_term ~with_alarms env t in + let r = eval_term ~alarm_mode env t in let add_block_length b acc = let bl = (* Convert the validity frontiers into a range of bytes. The @@ -751,9 +891,19 @@ let rec eval_term ~with_alarms env t = let eover = V.inject_ival bl in { etype = Cil.charPtrType; ldeps = r.ldeps; - eover; - eunder = under_from_over eover } + eover; + eunder = under_from_over eover } + | Tapp (li, labels, args) when + li.l_var_info.lv_name = "strlen" && comes_from_fc_stdlib li.l_var_info -> + begin + match labels, args with + | [lbl], [arg] -> + let r = eval_term ~alarm_mode env arg in + eval_logic_charlen Builtins_string.frama_c_strlen_wrapper + { env with e_cur = lbl } arg r.eover r.ldeps + | _ -> assert false (* length previously checked *) + end | Tapp _ | Tlambda _ -> unsupported "logic functions or predicates" | TDataCons _ -> unsupported "logic inductive types" | TUpdate _ -> unsupported "functional updates" @@ -766,7 +916,7 @@ let rec eval_term ~with_alarms env t = | TConst (LStr _) -> unsupported "constant strings" | TConst (LWStr _) -> unsupported "wide constant strings" -and eval_binop ~with_alarms env op t1 t2 = +and eval_binop ~alarm_mode env op t1 t2 = if not (isLogicNonCompositeType t1.term_type) then if Value_parameters.debug_atleast 1 then unsupported (Format.asprintf @@ -781,27 +931,31 @@ and eval_binop ~with_alarms env op t1 t2 = Printer.pp_binop op Printer.pp_logic_type t1.term_type) else - let r1 = eval_term ~with_alarms env t1 in - let r2 = eval_term ~with_alarms env t2 in + let r1 = eval_term ~alarm_mode env t1 in + let r2 = eval_term ~alarm_mode env t2 in let te1 = Cil.unrollType r1.etype in (* We use the type of t1 to determine whether we are performing an int or float operation.*) let int_or_float_op int_op float_op = match te1 with | TInt _ | TPtr _ | TEnum _ -> int_op - | TFloat _ -> float_op + | TFloat (fkind, _) -> float_op fkind | _ -> ast_error (Format.asprintf "binop on incorrect type %a" Printer.pp_typ te1) in - let kop = int_or_float_op - (Eval_op.eval_binop_int ~with_alarms ~te1) - (Eval_op.eval_binop_float ~with_alarms real_mode None) - in - check_logic_alarms ~with_alarms r1 op r2; - let kop v1 v2 = kop v1 op v2 in + check_logic_alarms ~alarm_mode r1 op r2; let typ_res = infer_binop_res_type op te1 in - let eover = kop r1.eover r2.eover in - let default _r1 _r2 = under_from_over eover in + let forward_integer = + Cvalue_forward.forward_binop_int + ~context:binop_context ~logic:true ~typ:te1 + and forward_float = + Cvalue_forward.forward_binop_float_alarm + ~context:binop_context real_mode + in + let kop = int_or_float_op forward_integer forward_float in + let eover, alarms = kop r1.eover op r2.eover in + check_alarms alarms alarm_mode; + let default _fk _r1 _r2 = under_from_over eover in let add_untyped_op factor = int_or_float_op (V.add_untyped_under ~factor) default in @@ -813,22 +967,21 @@ and eval_binop ~with_alarms env op t1 t2 = end | PlusA -> add_untyped_op (Int_Base.one) | MinusA -> add_untyped_op (Int_Base.minus_one) - | _ -> default + | _ -> fun _ _ -> under_from_over eover in let eunder = eunder_op r1.eunder r2.eunder in { etype = typ_res; ldeps = join_logic_deps r1.ldeps r2.ldeps; eunder; eover } -and eval_tlhost ~with_alarms env lv = +and eval_tlhost ~alarm_mode env lv = match lv with | TVar { lv_origin = Some v } -> let loc = Location_Bits.inject (Base.of_varinfo v) Ival.zero in { etype = v.vtype; ldeps = empty_logic_deps; eover = loc; - eunder = under_loc_from_over loc; - } + eunder = under_loc_from_over loc } | TResult typ -> (match env.result with | Some v -> @@ -843,34 +996,33 @@ and eval_tlhost ~with_alarms env lv = { etype = ty; ldeps = empty_logic_deps; eover = loc; - eunder = under_loc_from_over loc; - } + eunder = under_loc_from_over loc } | TMem t -> - let r = eval_term ~with_alarms env t in + let r = eval_term ~alarm_mode env t in let tres = match Cil.unrollType r.etype with | TPtr (t, _) -> t | _ -> ast_error "*p where p is not a pointer" in { etype = tres; ldeps = r.ldeps; - eunder = loc_bytes_to_loc_bits r.eunder; - eover = loc_bytes_to_loc_bits r.eover } + eunder = loc_bytes_to_loc_bits r.eunder; + eover = loc_bytes_to_loc_bits r.eover } -and eval_toffset ~with_alarms env typ toffset = +and eval_toffset ~alarm_mode env typ toffset = match toffset with | TNoOffset -> { etype = typ; ldeps = empty_logic_deps; - eunder = Ival.zero; - eover = Ival.zero } + eunder = Ival.zero; + eover = Ival.zero } | TIndex (idx, remaining) -> let typ_pointed, size = match Cil.unrollType typ with | TArray (t, size, _, _) -> t, size | _ -> ast_error "index on a non-array" in let idx = constraint_trange idx size in - let idxs = eval_term ~with_alarms env idx in - let offsrem = eval_toffset ~with_alarms env typ_pointed remaining in + let idxs = eval_term ~alarm_mode env idx in + let offsrem = eval_toffset ~alarm_mode env typ_pointed remaining in let eover = let offset = try Cvalue.V.project_ival_bottom idxs.eover @@ -896,39 +1048,38 @@ and eval_toffset ~with_alarms env typ toffset = in { etype = offsrem.etype; ldeps = join_logic_deps idxs.ldeps offsrem.ldeps; - eunder; eover } + eunder; eover } | TField (fi, remaining) -> let current default = try Ival.of_int (fst (Cil.bitsOffset typ (Field(fi, NoOffset)))) with Cil.SizeOfError _ -> default in - let offsrem = eval_toffset ~with_alarms env fi.ftype remaining in + let offsrem = eval_toffset ~alarm_mode env fi.ftype remaining in { etype = offsrem.etype; ldeps = offsrem.ldeps; - eover = Ival.add_int (current Ival.top) offsrem.eover; - eunder = Ival.add_int_under (current Ival.bottom) offsrem.eunder } - + eover = Ival.add_int (current Ival.top) offsrem.eover; + eunder = Ival.add_int_under (current Ival.bottom) offsrem.eunder } | TModel _ -> unsupported "model fields" -and eval_thost_toffset ~with_alarms env thost toffs = - let rhost = eval_tlhost ~with_alarms env thost in - let roffset = eval_toffset ~with_alarms env rhost.etype toffs in +and eval_thost_toffset ~alarm_mode env thost toffs = + let rhost = eval_tlhost ~alarm_mode env thost in + let roffset = eval_toffset ~alarm_mode env rhost.etype toffs in { etype = roffset.etype; ldeps = join_logic_deps rhost.ldeps roffset.ldeps; eunder = Location_Bits.shift_under roffset.eunder rhost.eunder; eover = Location_Bits.shift roffset.eover rhost.eover; } -and eval_tlval ~with_alarms env t = +and eval_tlval ~alarm_mode env t = match t.term_node with | TLval (thost, toffs) -> - eval_thost_toffset ~with_alarms env thost toffs + eval_thost_toffset ~alarm_mode env thost toffs | Tunion l -> let eunder, eover, deps = List.fold_left (fun (accunder, accover, accdeps) t -> - let r = eval_tlval ~with_alarms env t in + let r = eval_tlval ~alarm_mode env t in Location_Bits.link accunder r.eunder, Location_Bits.join accover r.eover, join_logic_deps accdeps r.ldeps @@ -939,29 +1090,30 @@ and eval_tlval ~with_alarms env t = eover; eunder } | Tempty_set -> { etype = infer_type t.term_type; - ldeps = empty_logic_deps; - eunder = Location_Bits.bottom; - eover = Location_Bits.bottom } + ldeps = empty_logic_deps; + eunder = Location_Bits.bottom; + eover = Location_Bits.bottom } | Tat (t, lab) -> - eval_tlval ~with_alarms { env with e_cur = lab } t + ignore (env_state env lab); + eval_tlval ~alarm_mode { env with e_cur = lab } t | TLogic_coerce (_lt, t) -> (* Logic coerce on locations (that are pointers) can only introduce sets, that do not change the abstract value. *) - eval_tlval ~with_alarms env t + eval_tlval ~alarm_mode env t | Tif (tcond, ttrue, tfalse) -> - eval_tif eval_tlval Location_Bits.join Location_Bits.meet ~with_alarms env + eval_tif eval_tlval Location_Bits.join Location_Bits.meet ~alarm_mode env tcond ttrue tfalse | _ -> ast_error (Format.asprintf "non-lval term %a" Printer.pp_term t) -and eval_tif : 'a. (with_alarms:_ -> _ -> _ -> 'a eval_result) -> ('a -> 'a -> 'a) -> ('a -> 'a -> 'a) -> with_alarms:_ -> _ -> _ -> _ -> _ -> 'a eval_result = - fun eval join meet ~with_alarms env tcond ttrue tfalse -> - let r = eval_term ~with_alarms env tcond in +and eval_tif : 'a. (alarm_mode:_ -> _ -> _ -> 'a eval_result) -> ('a -> 'a -> 'a) -> ('a -> 'a -> 'a) -> alarm_mode:_ -> _ -> _ -> _ -> _ -> 'a eval_result = + fun eval join meet ~alarm_mode env tcond ttrue tfalse -> + let r = eval_term ~alarm_mode env tcond in let ctrue = Cvalue.V.contains_non_zero r.eover and cfalse = Cvalue.V.contains_zero r.eover in match ctrue, cfalse with | true, true -> - let vtrue = eval ~with_alarms env ttrue in - let vfalse = eval ~with_alarms env tfalse in + let vtrue = eval ~alarm_mode env ttrue in + let vfalse = eval ~alarm_mode env tfalse in if not (same_etype vtrue.etype vfalse.etype) then Value_parameters.failure ~current:true "Incoherent types in conditional: %a vs. %a. \ @@ -972,32 +1124,34 @@ and eval_tif : 'a. (with_alarms:_ -> _ -> _ -> 'a eval_result) -> ('a -> 'a -> ' { etype = vtrue.etype; ldeps = join_logic_deps vtrue.ldeps vfalse.ldeps; eunder; eover } - | true, false -> eval ~with_alarms env ttrue - | false, true -> eval ~with_alarms env tfalse - | false, false -> - assert false (* a logic alarm would have been raised*) + | true, false -> eval ~alarm_mode env ttrue + | false, true -> eval ~alarm_mode env tfalse + | false, false -> assert false (* a logic alarm would have been raised*) -let eval_tlval_as_location ~with_alarms env t = - let r = eval_tlval ~with_alarms env t in +let eval_tlval_as_location ~alarm_mode env t = + let r = eval_tlval ~alarm_mode env t in let s = Eval_typ.sizeof_lval_typ r.etype in make_loc r.eover s -let eval_tlval_as_location_with_deps ~with_alarms env t = - let r = eval_tlval ~with_alarms env t in +let eval_tlval_as_location_with_deps ~alarm_mode env t = + let r = eval_tlval ~alarm_mode env t in let s = Eval_typ.sizeof_lval_typ r.etype in (make_loc r.eover s, r.ldeps) (* Return a pair of (under-approximating, over-approximating) zones. *) -let eval_tlval_as_zone_under_over ~with_alarms ~for_writing env t = - let r = eval_tlval ~with_alarms env t in +let eval_tlval_as_zone_under_over ~alarm_mode ~for_writing env t = + let r = eval_tlval ~alarm_mode env t in let s = Eval_typ.sizeof_lval_typ r.etype in let under = enumerate_valid_bits_under ~for_writing (make_loc r.eunder s) in let over = enumerate_valid_bits ~for_writing (make_loc r.eover s) in (under, over) -let eval_tlval_as_zone ~with_alarms ~for_writing env t = - snd (eval_tlval_as_zone_under_over ~with_alarms ~for_writing env t) +let eval_tlval_as_zone ~alarm_mode ~for_writing env t = + let _under, over = + eval_tlval_as_zone_under_over ~alarm_mode ~for_writing env t + in + over (* If casting [trm] to [typ] has no effect in terms of the values contained in [trm], do nothing. Otherwise, raise [exn]. Adapted from [pass_cast] *) @@ -1015,7 +1169,7 @@ let pass_logic_cast exn typ trm = let sityp = is_signed_int_enum_pointer typ in let sisexpr = is_signed_int_enum_pointer typeoftrm in if (Int.ge styp sexpr && sityp = sisexpr) (* larger, same signedness *) - || (Int.gt styp sexpr && sityp) (* strictly larger and signed *) + || (Int.gt styp sexpr && sityp) (* strictly larger and signed *) then () else raise exn @@ -1031,10 +1185,10 @@ exception Not_an_exact_loc (* Evaluate a term as a non-empty under-approximated location, or raise [Not_an_exact_loc]. *) -let rec eval_term_as_exact_locs ~with_alarms env t = +let rec eval_term_as_exact_locs ~alarm_mode env t = match t with | { term_node = TLval _ } -> - let loc = eval_tlval ~with_alarms env t in + let loc = eval_tlval ~alarm_mode env t in let typ = loc.etype in (* eval_term_as_exact_loc is only used for reducing values, and we must NOT reduce volatile locations. *) @@ -1046,17 +1200,20 @@ let rec eval_term_as_exact_locs ~with_alarms env t = | { term_node = TLogic_coerce(_, t)} -> (* It is always ok to pass through a TLogic_coerce, as the destination type is always a supertype *) - eval_term_as_exact_locs ~with_alarms env t + eval_term_as_exact_locs ~alarm_mode env t | { term_node = TCastE (ctype, t') } -> pass_logic_cast Not_an_exact_loc (Ctype ctype) t'; - eval_term_as_exact_locs ~with_alarms env t' + eval_term_as_exact_locs ~alarm_mode env t' | _ -> raise Not_an_exact_loc -exception DoNotReduce -exception Reduce_to_bottom +(* -------------------------------------------------------------------------- *) +(* --- Evaluation and reduction by predicates --- *) +(* -------------------------------------------------------------------------- *) + +(** Auxiliary functions *) let is_same_term_coerce t1 t2 = match t1.term_node, t2.term_node with @@ -1065,194 +1222,163 @@ let is_same_term_coerce t1 t2 = | _, TLogic_coerce(_,t2) -> Logic_utils.is_same_term t1 t2 | _ -> Logic_utils.is_same_term t1 t2 -let rec reduce_by_predicate ~with_alarms env positive p = - reduce_by_predicate_content ~with_alarms env positive p.pred_content - -and reduce_by_predicate_content ~with_alarms env positive p_content = - match positive,p_content with - | true,Ptrue | false,Pfalse -> env - - | true,Pfalse | false,Ptrue -> - overwrite_current_state env Cvalue.Model.bottom - (* desugared form of a <= b <= c <= d *) - | true, Pand ( - {pred_content=Pand ( - {pred_content=Prel ((Rlt | Rgt | Rle | Rge | Req as op),_ta,tb) as p1}, - {pred_content=Prel (op', tb',tc) as p2})}, - {pred_content=Prel (op'',tc',_td) as p3}) - when - op = op' && op' = op'' && - is_same_term_coerce tb tb' && - is_same_term_coerce tc tc' - -> - let red env p = reduce_by_predicate_content ~with_alarms env positive p in - let env = red env p1 in - let env = red env p3 in - let env = red env p2 in - (*Not really useful in practice*) - (*let env = red env (Prel (op, ta, tc)) in - let env = red env (Prel (op, tb, td)) in *) - env - - | true,Pand (p1,p2) | false,Por(p1,p2)-> - let r1 = reduce_by_predicate ~with_alarms env positive p1 in - reduce_by_predicate ~with_alarms r1 positive p2 - - | true,Por (p1,p2 ) | false,Pand (p1, p2) -> - join_env - (reduce_by_predicate ~with_alarms env positive p1) - (reduce_by_predicate ~with_alarms env positive p2) - - | true,Pimplies (p1,p2) -> - join_env - (reduce_by_predicate ~with_alarms env false p1) - (reduce_by_predicate ~with_alarms env true p2) - - | false,Pimplies (p1,p2) -> - reduce_by_predicate ~with_alarms - (reduce_by_predicate ~with_alarms env true p1) - false - p2 - - | _,Pnot p -> reduce_by_predicate ~with_alarms env (not positive) p - - | true,Piff (p1, p2) -> - let red1 = - reduce_by_predicate_content ~with_alarms env true (Pand (p1, p2)) in - let red2 = - reduce_by_predicate_content ~with_alarms env false (Por (p1, p2)) in - join_env red1 red2 - - | false,Piff (p1, p2) -> - reduce_by_predicate ~with_alarms env true - (Logic_const.por - (Logic_const.pand (p1, Logic_const.pnot p2), - Logic_const.pand (Logic_const.pnot p1, p2))) - - | _,Pxor(p1,p2) -> - reduce_by_predicate ~with_alarms env - (not positive) (Logic_const.piff(p1, p2)) - - | _,Prel (op,t1,t2) -> - begin - try - reduce_by_relation ~with_alarms env positive t1 op t2 - with - | DoNotReduce -> env - | LogicEvalError ee -> display_evaluation_error ee; env - | Reduce_to_bottom -> - overwrite_current_state env Cvalue.Model.bottom - (* if the exception was obtained without an alarm emitted, - it is correct to return the bottom state *) - end - - | _,Pvalid (_label,tsets) -> - (* TODO: label should not be ignored. Instead, we should clear - variables that are not in scope at the label. *) - reduce_by_valid ~with_alarms env positive ~for_writing:true tsets - | _,Pvalid_read (_label,tsets) -> - reduce_by_valid ~with_alarms env positive ~for_writing:false tsets +(* Evaluates a [valid_read_string] or [valid_read_wstring] predicate + using str* builtins. + - if [bottom] is obtained, return False; + - otherwise, if no alarms are emitted, return True; + - otherwise, return [Unknown]. *) +let eval_valid_read_str ~wide env arg v = + let wrapper = + if wide then (Builtins_string.frama_c_wcslen_wrapper ()) + else Builtins_string.frama_c_strlen_wrapper + in + match logic_charlen_builtin wrapper (env_current_state env) arg v with + | None -> (* bottom state => string always invalid *) False + | Some (_res, alarms) -> + if Builtins_string.String_alarms.Set.is_empty alarms + then (* no alarm => string always valid for reading *) True + else (* alarm => string possibly invalid *) Unknown + +(* Evaluates a [valid_string] or [valid_wstring] predicate. + First, we check the constness of the arguments. + Then, we evaluate [valid_read_string/valid_read_wstring] on non-const ones. *) +let eval_valid_str ~wide env arg v = + assert (not (Cvalue.V.is_bottom v)); + (* filter const bases *) + let v' = Cvalue.V.filter_base (fun b -> not (Base.is_read_only b)) v in + if Cvalue.V.is_bottom v' then False (* all bases were const *) + else + if Cvalue.V.equal v v' then + eval_valid_read_str ~wide env arg v (* all bases non-const *) + else (* at least one base was const *) + match eval_valid_read_str ~wide env arg v with + | True -> Unknown (* weaken result *) + | False | Unknown as r -> r + + +(* Do all the possible values of a location in [state] satisfy [test]? [loc] is + an over-approximation of the location, so the answer cannot be [False] even + if some parts of [loc] do not satisfy [test]. Thus, this function does not + fold the location, but instead applies [test] to the join of all values + stored in [loc] in [state]. *) +let forall_in_over_location state loc test = + let v = Model.find_indeterminate state loc in + test v + +exception EFalse + +(* Do all the possible values of a location in [state] satisfy [test]? [loc] is + an under-approximation of the location, so the answer cannot be [True], as + the values of some other parts of the location may not satisfy [test]. + However, it is [False] as soon as some part of [loc] contradicts [test]. *) +let forall_in_under_location state loc test = + let inspect_value (_, _) (value, _, _) acc = + match test value with + | True | Unknown -> acc + | False -> raise EFalse + in + let inspect_itv base itv acc = + match Cvalue.Model.find_base_or_default base state with + | `Top | `Bottom -> Unknown + | `Value offsm -> + Cvalue.V_Offsetmap.fold_between ~entire:true itv inspect_value offsm acc + in + let inspect_base base intervals acc = + Int_Intervals.fold (inspect_itv base) intervals acc + in + let zone = Locations.enumerate_bits loc in + try Zone.fold_i inspect_base zone Unknown + with EFalse -> False + | Abstract_interp.Error_Top -> Unknown + +(* Evaluates an universal predicate about the values of a location evaluated to + [r] in [state]. The predicates holds whenever all the possible values at the + location satisfy [test]. *) +let eval_forall_predicate state r test = + let make_loc loc = + make_loc (loc_bytes_to_loc_bits loc) (sizeof_pointed r.etype) + in + let over_loc = make_loc r.eover in + if not (Locations.is_valid ~for_writing:false over_loc) then c_alarm (); + match forall_in_over_location state over_loc test with + | Unknown -> + let under_loc = make_loc r.eunder in + forall_in_under_location state under_loc test + | True -> True + | False -> False + +(* Evaluation of an \initialized predicate on a location evaluated to [r] + in the state [state]. *) +let eval_initialized state r = + let test = function + | V_Or_Uninitialized.C_init_esc _ + | V_Or_Uninitialized.C_init_noesc _ -> True + | V_Or_Uninitialized.C_uninit_esc _ -> Unknown + | V_Or_Uninitialized.C_uninit_noesc v -> + if Location_Bytes.is_bottom v then False else Unknown + in + eval_forall_predicate state r test + +(* Evaluation of a \dangling predicate on a location evaluated to [r] + in the state [state]. *) +let eval_dangling state r = + let test = function + | V_Or_Uninitialized.C_init_esc v -> + if Location_Bytes.is_bottom v then True else Unknown + | V_Or_Uninitialized.C_uninit_esc _ -> Unknown + | V_Or_Uninitialized.C_init_noesc _ + | V_Or_Uninitialized.C_uninit_noesc _ -> False + in + eval_forall_predicate state r test - | _,Pvalid_function _tsets -> env (* TODO *) +let is_rel_binop = function + | Lt + | Gt + | Le + | Ge + | Eq + | Ne -> true + | _ -> false - | _,(Pinitialized (lbl_initialized,tsets) - | Pdangling (lbl_initialized,tsets)) -> - begin try - let rlocb = eval_term ~with_alarms env tsets in - let size = Bit_utils.sizeof_pointed rlocb.etype in - let state = env_state env lbl_initialized in - let fred = match p_content with - | Pinitialized _ -> V_Or_Uninitialized.reduce_by_initializedness - | Pdangling _ -> V_Or_Uninitialized.reduce_by_danglingness +let rel_of_binop = function + | Lt -> Rlt + | Gt -> Rgt + | Le -> Rle + | Ge -> Rge + | Eq -> Req + | Ne -> Rneq | _ -> assert false - in - let fred = Eval_op.reduce_by_initialized_defined (fred positive) in - let state_reduced = - let loc_bits = loc_bytes_to_loc_bits rlocb.eunder in - let loc = make_loc loc_bits size in - let loc = Eval_op.make_loc_contiguous loc in - Eval_op.apply_on_all_locs fred loc state - in - overwrite_state env state_reduced lbl_initialized - with - | LogicEvalError ee -> display_evaluation_error ee; env - end - | _,Pat (p, lbl) -> - (try - let env_at = { env with e_cur = lbl } in - let env' = reduce_by_predicate ~with_alarms env_at positive p in - { env' with e_cur = env.e_cur } - with LogicEvalError ee -> display_evaluation_error ee; env) - - | true, Pforall (varl, p) | false, Pexists (varl, p) -> - begin - try - (* TODO: add case analysis on the variables of the quantification - that are constrained *) - let env = bind_logic_vars env varl in - let env_result = reduce_by_predicate ~with_alarms env true p in - unbind_logic_vars env_result varl - with LogicEvalError _ -> env - end - - | _,Papp (li, labels, args) -> - reduce_by_papp ~with_alarms env positive li labels args - | _,Pif (tcond, ptrue, pfalse) -> - begin - let reduce = reduce_by_predicate ~with_alarms in - let r = eval_term ~with_alarms env tcond in - let ctrue = Cvalue.V.contains_non_zero r.eover - and cfalse = Cvalue.V.contains_zero r.eover in - match ctrue, cfalse with - | true, true -> - let reduce_by_rel = reduce_by_relation ~with_alarms env positive tcond in - let env_true = reduce_by_rel Cil_types.Rneq (Cil.lzero ()) in - let env_false = reduce_by_rel Cil_types.Req (Cil.lzero ()) in - join_env (reduce env_true positive ptrue) (reduce env_false positive pfalse) - | true, false -> reduce env positive ptrue - | false, true -> reduce env positive pfalse - | false, false -> assert false (* a logic alarm would have been raised*) - end - | true, Pexists (_, _) | false, Pforall (_, _) - | _,Plet (_, _) - | _,Pallocable (_,_) | _,Pfreeable (_,_) | _,Pfresh (_,_,_,_) - | _,Psubtype _ - | _, Pseparated _ - -> env +exception DoNotReduce +exception Reduce_to_bottom -and reduce_by_papp ~with_alarms env positive li _labels args = +let reduce_by_papp env positive li _labels args = match positive, li.l_var_info.lv_name, args with | true, "\\is_finite", [arg] -> begin try - let typ_loc, locs = eval_term_as_exact_locs ~with_alarms env arg in - let fkind = match (Cil.unrollType typ_loc) with - | TFloat( fkind, _) -> fkind - | _ -> assert false - in + let alarm_mode = alarm_reduce_mode () in + let typ_loc, locs = eval_term_as_exact_locs ~alarm_mode + env arg in let aux loc env = let state = env_current_state env in - let v = Eval_op.find ~with_alarms state loc in - let v = - Eval_op.reinterpret_float ~with_alarms:CilE.warn_none_mode fkind v - in + let v = find_or_alarm ~alarm_mode state loc in + let v = Cvalue_forward.unsafe_reinterpret typ_loc v in let state' = Cvalue.Model.reduce_previous_binding state loc v in overwrite_current_state env state' in Eval_op.apply_on_all_locs aux locs env - with - | LogicEvalError ee -> display_evaluation_error ee; env - | Not_an_exact_loc -> env + with LogicEvalError _ | Not_an_exact_loc -> env end | true, "\\subset", [argl;argr] -> begin try - let vr = (eval_term ~with_alarms env argr).eover in - let _typ, locsl = eval_term_as_exact_locs ~with_alarms env argl in + let alarm_mode = alarm_reduce_mode () in + let vr = (eval_term ~alarm_mode env argr).eover in + let _typ, locsl = eval_term_as_exact_locs ~alarm_mode env argl in let aux locl env = let state = env_current_state env in - let vl = Eval_op.find ~with_alarms state locl in + let vl = find_or_alarm ~alarm_mode state locl in let reduced = V.narrow vl vr in if V.equal V.bottom reduced then raise Reduce_to_bottom; let state' = @@ -1262,14 +1388,13 @@ and reduce_by_papp ~with_alarms env positive li _labels args = in Eval_op.apply_on_all_locs aux locsl env with - | LogicEvalError ee -> display_evaluation_error ee; env - | Not_an_exact_loc -> env + | LogicEvalError _ | Not_an_exact_loc -> env | Reduce_to_bottom -> overwrite_current_state env Model.bottom end | _ -> env -and reduce_by_valid ~with_alarms env positive ~for_writing (tset: term) = +let reduce_by_valid env positive ~for_writing (tset: term) = (* Auxiliary function that reduces \valid(lv+offs), where lv is atomic (no more tsets), and offs is a bits-expressed constant offset. [offs_typ] is supposed to be the type of the pointed location after [offs] @@ -1283,7 +1408,8 @@ and reduce_by_valid ~with_alarms env positive ~for_writing (tset: term) = let state = env_current_state env in let lvloc = make_loc lv.eover (Eval_typ.sizeof_lval_typ lv.etype) in (* [p] is the range that we attempt to reduce *) - let p_orig = Eval_op.find ~with_alarms state lvloc in + let alarm_mode = alarm_reduce_mode () in + let p_orig = find_or_alarm ~alarm_mode state lvloc in let pb = Locations.loc_bytes_to_loc_bits p_orig in let shifted_p = Location_Bits.shift offs pb in let lshifted_p = make_loc shifted_p (Eval_typ.sizeof_lval_typ offs_typ) in @@ -1304,8 +1430,8 @@ and reduce_by_valid ~with_alarms env positive ~for_writing (tset: term) = let state = Model.reduce_previous_binding state lvloc p in overwrite_current_state env state with - | DoNotReduce | V.Not_based_on_null | Cil.SizeOfError _ -> env - | LogicEvalError ee -> display_evaluation_error ee; env + | DoNotReduce | V.Not_based_on_null | Cil.SizeOfError _ | LogicEvalError _ + -> env in (* Auxiliary function to reduce by the under-approximation of an offset. Since validities are contiguous, we simply reduce by the minimum and @@ -1319,14 +1445,14 @@ and reduce_by_valid ~with_alarms env positive ~for_writing (tset: term) = match Ival.max_int off with | None -> env | Some max -> f env (Ival.inject_singleton max) - with Ival.Error_Bottom -> env + with Abstract_interp.Error_Bottom -> env in let rec do_one env t = match t.term_node with | Tunion l -> List.fold_left do_one env l - | TLval _ -> + | TLval _ -> let aux typ loc env = try let state = @@ -1334,34 +1460,35 @@ and reduce_by_valid ~with_alarms env positive ~for_writing (tset: term) = loc typ (env_current_state env) in overwrite_current_state env state - with LogicEvalError ee -> - display_evaluation_error ee; env + with LogicEvalError _ -> env in - (try - let r = eval_tlval ~with_alarms env t in + (try + let alarm_mode = alarm_reduce_mode () in + let r = eval_tlval ~alarm_mode env t in let loc = make_loc r.eunder (Eval_typ.sizeof_lval_typ r.etype) in let r = Eval_op.apply_on_all_locs (aux r.etype) loc env in r - - with LogicEvalError ee -> display_evaluation_error ee; env) + with LogicEvalError _ -> env) | TAddrOf (TMem ({term_node = TLval _} as t), offs) -> (try - let lt = eval_tlval ~with_alarms env t in + let alarm_mode = alarm_reduce_mode () in + let lt = eval_tlval ~alarm_mode env t in let typ = lt.etype in (* Compute the offsets, that depend on the type of the lval. The computed list is exactly what [aux] requires *) let roffs = - eval_toffset ~with_alarms env (Cil.typeOf_pointed typ) offs + eval_toffset ~alarm_mode env (Cil.typeOf_pointed typ) offs in let aux env offs = aux lt env (roffs.etype, offs) in aux_min_max_offset aux env roffs.eunder - with LogicEvalError ee -> display_evaluation_error ee; env) + with LogicEvalError _ -> env) | TBinOp ((PlusPI | MinusPI) as op, ({term_node = TLval _} as tlv), i) -> (try - let rtlv = eval_tlval ~with_alarms env tlv in - let ri = eval_term ~with_alarms env i in + let alarm_mode = alarm_reduce_mode () in + let rtlv = eval_tlval ~alarm_mode env tlv in + let ri = eval_term ~alarm_mode env i in (* Convert offsets to a simpler form if [op] is [MinusPI] *) let li = try V.project_ival ri.eunder @@ -1377,66 +1504,48 @@ and reduce_by_valid ~with_alarms env positive ~for_writing (tset: term) = let aux env offs = aux rtlv env (typ_p, offs) in aux_min_max_offset aux env li with - | LogicEvalError ee -> display_evaluation_error ee; env - | Exit -> env + | LogicEvalError _ | Exit -> env ) | _ -> env in do_one env tset -and is_rel_binop = function - | Lt - | Gt - | Le - | Ge - | Eq - | Ne -> true - | _ -> false - -and rel_of_binop = function - | Lt -> Rlt - | Gt -> Rgt - | Le -> Rle - | Ge -> Rge - | Eq -> Req - | Ne -> Rneq - | _ -> assert false - -and reduce_by_relation ~with_alarms env positive t1 rel t2 = +let rec reduce_by_relation ~alarm_mode env positive t1 rel t2 = (* special case: t1 is a term of the form "a rel' b", and is compared to "== 0" or "!= 0" => evaluate t1 directly; note: such terms may be created by other evaluation/reduction functions e.g. eval_predicate, reduce_by_predicate_content *) match t1.term_node, rel with | TBinOp (bop, t1', t2'), Rneq when is_rel_binop bop && Cil.isLogicZero t2 -> - reduce_by_relation ~with_alarms env positive t1' (rel_of_binop bop) t2' + reduce_by_relation ~alarm_mode env positive t1' (rel_of_binop bop) t2' | TBinOp (bop, t1', t2'), Req when is_rel_binop bop && Cil.isLogicZero t2 -> - reduce_by_relation ~with_alarms env (not positive) t1' (rel_of_binop bop) t2' + reduce_by_relation ~alarm_mode env (not positive) t1' (rel_of_binop bop) t2' | _ -> - let env = reduce_by_left_relation ~with_alarms env positive t1 rel t2 in + let env = reduce_by_left_relation ~alarm_mode env positive t1 rel t2 in let sym_rel = match rel with | Rgt -> Rlt | Rlt -> Rgt | Rle -> Rge | Rge -> Rle | Req -> Req | Rneq -> Rneq in - reduce_by_left_relation ~with_alarms env positive t2 sym_rel t1 + reduce_by_left_relation ~alarm_mode env positive t2 sym_rel t1 (* reduce [tl] so that [rl rel tr] holds *) -and reduce_by_left_relation ~with_alarms env positive tl rel tr = +and reduce_by_left_relation ~alarm_mode env positive tl rel tr = try let debug = false in if debug then Format.printf "#Left term %a@." Printer.pp_term tl; - let typ_loc, locs = eval_term_as_exact_locs ~with_alarms env tl in + let typ_loc, locs = eval_term_as_exact_locs ~alarm_mode env tl in let reduce = Eval_op.backward_comp_left_from_type typ_loc in - let rtl = eval_term ~with_alarms env tr in + let rtl = eval_term ~alarm_mode env tr in let cond_v = rtl.eover in if debug then Format.printf "#Val right term %a@." V.pretty cond_v; let aux loc env = let state = env_current_state env in if debug then Format.printf "#Left term as lv loc %a, typ %a@." Locations.pretty loc Printer.pp_typ typ_loc; - let v = Eval_op.find ~with_alarms state loc in + let v = find_or_alarm ~alarm_mode state loc in if debug then Format.printf "#Val left lval %a@." V.pretty v; - let v = Eval_op.reinterpret ~with_alarms typ_loc v in + let v, alarms = Cvalue_forward.reinterpret fake_expr typ_loc v in + let _ = check_alarms alarms alarm_mode in if debug then Format.printf "#Cast left lval %a@." V.pretty v; let comp = Value_util.conv_relation rel in let v' = reduce positive comp v cond_v in @@ -1454,47 +1563,182 @@ and reduce_by_left_relation ~with_alarms env positive tl rel tr = overwrite_current_state env state' in Eval_op.apply_on_all_locs aux locs env - with - | Not_an_exact_loc -> env - | LogicEvalError ee -> display_evaluation_error ee; env + with Not_an_exact_loc | LogicEvalError _ -> env -(* Evaluates a [valid_read_string] predicate using str* builtins. - - if [bottom] is obtained, return False; - - otherwise, if no alarms are emitted, return True; - - otherwise, return [Unknown]. -*) -let eval_valid_read_string env arg v = - let args = [ (Builtins_string.Term arg, v) ] in - let state = env_current_state env in - let res, alarms = Builtins_string.frama_c_strlen_wrapper state args in - let is_bottom vs = - List.for_all (fun (_ret, s) -> Cvalue.Model.(equal s bottom)) vs - in - match is_bottom res.Value_types.c_values, - Builtins_string.String_alarms.Set.is_empty alarms - with - | true, _ -> (* bottom state => string always invalid *) False - | false, false -> (* alarm => string possibly invalid *) Unknown - | false, true -> (* no alarm => string always valid for reading *) True - -(* Evaluates a [valid_string] predicate. First, we check the constness of - the arguments. Then, we evaluate [valid_read_string] on non-const ones. *) -let eval_valid_string env arg v = - assert (not (Cvalue.V.is_bottom v)); - (* filter const bases *) - let v' = Cvalue.V.filter_base (fun b -> not (Base.is_read_only b)) v in - if Cvalue.V.is_bottom v' then False (* all bases were const *) - else - if Cvalue.V.equal v v' then - eval_valid_read_string env arg v (* all bases non-const *) - else (* at least one base was const *) - match eval_valid_read_string env arg v with - | True -> Unknown (* weaken result *) - | False | Unknown as r -> r +(** Big recursive functions for predicates *) + +let rec reduce_by_predicate ~alarm_mode env positive p = + let loc = p.pred_loc in + let rec reduce_by_predicate_content env positive p_content = + match positive,p_content with + | true,Ptrue | false,Pfalse -> env + + | true,Pfalse | false,Ptrue -> + overwrite_current_state env Cvalue.Model.bottom + + (* desugared form of a <= b <= c <= d *) + | true, Pand ( + {pred_content=Pand ( + {pred_content=Prel ((Rlt | Rgt | Rle | Rge | Req as op),_ta,tb) as p1}, + {pred_content=Prel (op', tb',tc) as p2})}, + {pred_content=Prel (op'',tc',_td) as p3}) + when + op = op' && op' = op'' && + is_same_term_coerce tb tb' && + is_same_term_coerce tc tc' + -> + let red env p = reduce_by_predicate_content env positive p in + let env = red env p1 in + let env = red env p3 in + let env = red env p2 in + (*Not really useful in practice*) + (*let env = red env (Prel (op, ta, tc)) in + let env = red env (Prel (op, tb, td)) in *) + env + + | true,Pand (p1,p2) | false,Por(p1,p2)-> + let r1 = reduce_by_predicate ~alarm_mode env positive p1 in + reduce_by_predicate ~alarm_mode r1 positive p2 -let eval_predicate env pred = - let with_alarms = warn_raise_mode in + | true,Por (p1,p2 ) | false,Pand (p1, p2) -> + let env1 = reduce_by_predicate ~alarm_mode env positive p1 in + let env2 = reduce_by_predicate ~alarm_mode env positive p2 in + join_env env1 env2 + + | true,Pimplies (p1,p2) -> + let env1 = reduce_by_predicate ~alarm_mode env false p1 in + let env2 = reduce_by_predicate ~alarm_mode env true p2 in + join_env env1 env2 + + | false,Pimplies (p1,p2) -> + reduce_by_predicate ~alarm_mode + (reduce_by_predicate ~alarm_mode env true p1) + false + p2 + + | _,Pnot p -> reduce_by_predicate ~alarm_mode env (not positive) p + + | true,Piff (p1, p2) -> + let red1 = reduce_by_predicate_content env true (Pand (p1, p2)) in + let red2 = reduce_by_predicate_content env false (Por (p1, p2)) in + join_env red1 red2 + + | false,Piff (p1, p2) -> + reduce_by_predicate ~alarm_mode env true + (Logic_const.por ~loc + (Logic_const.pand ~loc (p1, Logic_const.pnot ~loc p2), + Logic_const.pand ~loc (Logic_const.pnot ~loc p1, p2))) + + | _,Pxor(p1,p2) -> + reduce_by_predicate ~alarm_mode env + (not positive) (Logic_const.piff ~loc (p1, p2)) + + | _,Prel (op,t1,t2) -> + begin + try + (* ugly, but eval_predicate_content does not exist yet *) + let p = Logic_const.unamed ~loc p_content in + let p' = if positive then p else Logic_const.pnot ~loc p in + (* Evaluate the predicate before reducing. In some cases, although + evaluation results in Bottom, reduction fails to reduce the + resulting env to Bottom, and we lose precision. *) + match eval_predicate env p' with + | True -> env + | False -> overwrite_current_state env Cvalue.Model.bottom + | Unknown -> reduce_by_relation ~alarm_mode env positive t1 op t2 + with + | DoNotReduce | LogicEvalError _ -> env + | Reduce_to_bottom -> + overwrite_current_state env Cvalue.Model.bottom + (* if the exception was obtained without an alarm emitted, + it is correct to return the bottom state *) + end + + | _,Pvalid (_label,tsets) -> + (* TODO: label should not be ignored. Instead, we should clear + variables that are not in scope at the label. *) + reduce_by_valid env positive ~for_writing:true tsets + | _,Pvalid_read (_label,tsets) -> + reduce_by_valid env positive ~for_writing:false tsets + + | _,Pvalid_function _tsets -> env (* TODO *) + + | _,(Pinitialized (lbl_initialized,tsets) + | Pdangling (lbl_initialized,tsets)) -> + begin + try + let alarm_mode = alarm_reduce_mode () in + let rlocb = eval_term ~alarm_mode env tsets in + let size = Bit_utils.sizeof_pointed rlocb.etype in + let state = env_state env lbl_initialized in + let fred = match p_content with + | Pinitialized _ -> V_Or_Uninitialized.reduce_by_initializedness + | Pdangling _ -> V_Or_Uninitialized.reduce_by_danglingness + | _ -> assert false + in + let fred = Eval_op.reduce_by_initialized_defined (fred positive) in + let state_reduced = + let loc_bits = loc_bytes_to_loc_bits rlocb.eunder in + let loc = make_loc loc_bits size in + let loc = Eval_op.make_loc_contiguous loc in + Eval_op.apply_on_all_locs fred loc state + in + overwrite_state env state_reduced lbl_initialized + with LogicEvalError _ -> env + end + + | _,Pat (p, lbl) -> + (try + let env_at = { env with e_cur = lbl } in + let env' = reduce_by_predicate ~alarm_mode env_at positive p in + { env' with e_cur = env.e_cur } + with LogicEvalError _ -> env) + + | true, Pforall (varl, p) | false, Pexists (varl, p) -> + begin + try + (* TODO: add case analysis on the variables of the quantification + that are constrained *) + let env = bind_logic_vars env varl in + let env_result = reduce_by_predicate ~alarm_mode env true p in + unbind_logic_vars env_result varl + with LogicEvalError _ -> env + end + | _,Papp (li, labels, args) -> + reduce_by_papp env positive li labels args + | _,Pif (tcond, ptrue, pfalse) -> + begin + let reduce = reduce_by_predicate ~alarm_mode in + let r = eval_term ~alarm_mode env tcond in + let ctrue = Cvalue.V.contains_non_zero r.eover in + let cfalse = Cvalue.V.contains_zero r.eover in + match ctrue, cfalse with + | true, true -> + let reduce_by_rel = + reduce_by_relation ~alarm_mode env positive tcond + in + let env_true = reduce_by_rel Cil_types.Rneq (Cil.lzero ()) in + let env_false = reduce_by_rel Cil_types.Req (Cil.lzero ()) in + let env_true = reduce env_true positive ptrue in + let env_false = reduce env_false positive pfalse in + join_env env_true env_false + | true, false -> reduce env positive ptrue + | false, true -> reduce env positive pfalse + | false, false -> assert false (* a logic alarm would have been raised*) + end + | true, Pexists (_, _) | false, Pforall (_, _) + | _,Plet (_, _) + | _,Pallocable (_,_) | _,Pfreeable (_,_) | _,Pfresh (_,_,_,_) + | _,Psubtype _ + | _, Pseparated _ + -> env + in + reduce_by_predicate_content env positive p.pred_content + +and eval_predicate env pred = + let alarm_mode = Fail in + let loc = pred.pred_loc in let rec do_eval env p = match p.pred_content with | Ptrue -> True @@ -1504,7 +1748,7 @@ let eval_predicate env pred = | True -> do_eval env p2 | False -> False | Unknown -> - let reduced = reduce_by_predicate ~with_alarms env true p1 in + let reduced = reduce_by_predicate ~alarm_mode env true p1 in match do_eval reduced p2 with | False -> False | _ -> Unknown @@ -1518,7 +1762,7 @@ let eval_predicate env pred = | True -> True | False -> do_eval env p2 | Unknown -> begin - let reduced_state = reduce_by_predicate ~with_alarms env false p1 in + let reduced_state = reduce_by_predicate ~alarm_mode env false p1 in (* Format.printf "Disjunction: reduced to %a to eval %a@." Cvalue.Model.pretty (env_current_state reduced_state) Printer.pp_predicate p2; *) @@ -1541,8 +1785,9 @@ let eval_predicate env pred = | _ -> False end | Pat (p, lbl) -> begin + ignore (env_state env lbl); try do_eval { env with e_cur = lbl } p - with LogicEvalError ee -> display_evaluation_error ee; Unknown + with LogicEvalError ee -> display_evaluation_error ~loc:p.pred_loc ee; Unknown end | Pvalid (_label, tsets) | Pvalid_read (_label, tsets) -> begin @@ -1586,9 +1831,10 @@ let eval_predicate env pred = | TLval _ -> (* Evaluate the left-value, and check that it is initialized and not an escaping pointer *) - let loc = eval_tlval_as_location ~with_alarms env tsets in - let alarm, v = Model.find_unspecified state loc in - if alarm then c_alarm (); + let loc = eval_tlval_as_location ~alarm_mode env tsets in + if not (Locations.is_valid ~for_writing:false loc) then + c_alarm (); + let v = Model.find_indeterminate state loc in let v, ok = match v with | Cvalue.V_Or_Uninitialized.C_uninit_esc v | Cvalue.V_Or_Uninitialized.C_uninit_noesc v @@ -1599,19 +1845,19 @@ let eval_predicate env pred = valid ~over:v ~under:V.bottom (*No precise under-approximation*); if not ok then raise DoNotReduce | _ -> - let v = eval_term ~with_alarms env tsets in + let v = eval_term ~alarm_mode env tsets in valid ~over:v.eover ~under:v.eunder ); True with | DoNotReduce -> Unknown - | LogicEvalError ee -> display_evaluation_error ee; Unknown + | LogicEvalError ee -> display_evaluation_error ~loc:p.pred_loc ee; Unknown | Stop -> False end | Pvalid_function tsets -> begin try - let v = eval_term ~with_alarms env tsets in + let v = eval_term ~alarm_mode env tsets in let typ_pointer = Cil.typeOf_pointed v.etype in let funs, warn = Eval_typ.resolve_functions ~typ_pointer v.eover in if warn then @@ -1624,52 +1870,33 @@ let eval_predicate env pred = else True with - | LogicEvalError ee -> display_evaluation_error ee; Unknown + | LogicEvalError ee -> display_evaluation_error ~loc:p.pred_loc ee; Unknown end | Pinitialized (label,tsets) | Pdangling (label,tsets) -> begin try - let locb = eval_term ~with_alarms env tsets in + let locb = eval_term ~alarm_mode env tsets in let state = env_state env label in - let typ = locb.etype in - if not (Cil.isPointerType typ) then + if not (Cil.isPointerType locb.etype) then ast_error "\\initialized or \\dangling on \ - incorrect location"; - let locbi = loc_bytes_to_loc_bits locb.eover in - let loc = make_loc locbi (sizeof_pointed typ) in - let alarm, value = Model.find_unspecified state loc in - if alarm then c_alarm (); + incorrect location"; match p.pred_content with - | Pinitialized _ -> begin - match value with - | V_Or_Uninitialized.C_uninit_esc _ -> Unknown - | V_Or_Uninitialized.C_uninit_noesc v -> - if Location_Bytes.is_bottom v then False else Unknown - | V_Or_Uninitialized.C_init_esc _ - | V_Or_Uninitialized.C_init_noesc _ -> True - end - | Pdangling _ -> begin - match value with - | V_Or_Uninitialized.C_init_esc v -> - if Location_Bytes.is_bottom v then True else Unknown - | V_Or_Uninitialized.C_uninit_esc _ -> Unknown - | V_Or_Uninitialized.C_init_noesc _ - | V_Or_Uninitialized.C_uninit_noesc _ -> False - end - | _ -> assert false + | Pinitialized _ -> eval_initialized state locb + | Pdangling _ -> eval_dangling state locb + | _ -> assert false with - | LogicEvalError ee -> display_evaluation_error ee; Unknown + | LogicEvalError ee -> display_evaluation_error ~loc:p.pred_loc ee; Unknown end | Prel (op,t1,t2) -> begin try - let r = eval_binop ~with_alarms env (lop_to_cop op) t1 t2 in + let r = eval_binop ~alarm_mode env (lop_to_cop op) t1 t2 in if V.equal V.singleton_zero r.eover then False else if V.equal V.singleton_one r.eover then True else Unknown with - | LogicEvalError ee -> display_evaluation_error ee; Unknown + | LogicEvalError ee -> display_evaluation_error ~loc:p.pred_loc ee; Unknown end | Pforall (varl, p') | Pexists (varl, p') -> @@ -1682,7 +1909,7 @@ let eval_predicate env pred = | Pforall _ -> if r = True then True else Unknown | _ -> assert false with - | LogicEvalError _ee -> (*display_evaluation_error ee;*) Unknown + | LogicEvalError _ee -> (*display_evaluation_error ~loc ee;*) Unknown end | Pnot p -> begin match do_eval env p with @@ -1692,12 +1919,12 @@ let eval_predicate env pred = end | Pimplies (p1,p2) -> - do_eval env (Logic_const.por ((Logic_const.pnot p1), p2)) + do_eval env (Logic_const.por ~loc ((Logic_const.pnot ~loc p1), p2)) | Pseparated ltsets -> (try let to_zones tset = - let rtset = eval_term ~with_alarms env tset in + let rtset = eval_term ~alarm_mode env tset in let typ = rtset.etype in if not (Cil.isPointerType typ) then ast_error "separated on non-pointers"; @@ -1729,17 +1956,17 @@ let eval_predicate env pred = if !unknown then Unknown else True with | Exit -> False - | LogicEvalError ee -> display_evaluation_error ee; Unknown) + | LogicEvalError ee -> display_evaluation_error ~loc:p.pred_loc ee; Unknown) | Papp (li, labels, args) -> eval_papp env li labels args | Pif (tcond, ptrue, pfalse) -> begin - let r = eval_term ~with_alarms env tcond in + let r = eval_term ~alarm_mode env tcond in let ctrue = Cvalue.V.contains_non_zero r.eover and cfalse = Cvalue.V.contains_zero r.eover in match ctrue, cfalse with | true, true -> - let reduce_by_rel = reduce_by_relation ~with_alarms env true tcond in + let reduce_by_rel = reduce_by_relation ~alarm_mode env true tcond in let env_true = reduce_by_rel Cil_types.Rneq (Cil.lzero ()) in let env_false = reduce_by_rel Cil_types.Req (Cil.lzero ()) in join_predicate_status (do_eval env_true ptrue) (do_eval env_false pfalse) @@ -1766,19 +1993,19 @@ let eval_predicate env pred = end | "\\is_finite", [arg] -> begin try - let eval_result = eval_term ~with_alarms env arg in + let eval_result = eval_term ~alarm_mode env arg in (try let ival = V.project_ival eval_result.eover in ignore (Ival.project_float ival); True with | Ival.Nan_or_infinite | Cvalue.V.Not_based_on_null -> Unknown) - with LogicEvalError ee -> display_evaluation_error ee; Unknown + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown end | "\\subset", [argl;argr] -> begin try - let l = eval_term ~with_alarms env argl in - let r = eval_term ~with_alarms env argr in + let l = eval_term ~alarm_mode env argl in + let r = eval_term ~alarm_mode env argr in if V.is_included l.eover r.eunder then True (* all elements of [l] are included in the guaranteed elements of [r] *) @@ -1790,29 +2017,52 @@ let eval_predicate env pred = as [V.is_included bottom r.eunder] holds. *) else Unknown with - | LogicEvalError ee -> display_evaluation_error ee; Unknown + | LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown end | "valid_read_string", [arg] -> begin try - let r = eval_term ~with_alarms env arg in - eval_valid_read_string env arg r.eover - with LogicEvalError ee -> display_evaluation_error ee; Unknown + let r = eval_term ~alarm_mode env arg in + eval_valid_read_str ~wide:false env arg r.eover + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown end | "valid_string", [arg] -> begin try - let r = eval_term ~with_alarms env arg in - eval_valid_string env arg r.eover - with LogicEvalError ee -> display_evaluation_error ee; Unknown + let r = eval_term ~alarm_mode env arg in + eval_valid_str ~wide:false env arg r.eover + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown + end + | "valid_read_wstring", [arg] -> begin + try + let r = eval_term ~alarm_mode env arg in + eval_valid_read_str ~wide:true env arg r.eover + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown + end + | "valid_wstring", [arg] -> begin + try + let r = eval_term ~alarm_mode env arg in + eval_valid_str ~wide:true env arg r.eover + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown + end + | "is_allocable", [arg] when comes_from_fc_stdlib li.l_var_info -> begin + try + let r = eval_term ~alarm_mode env arg in + eval_is_allocable r.eover + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown end | _, _ -> Unknown in try (* Each case of the matching above should handle evaluation errors. This is just an additional security. *) do_eval env pred - with LogicEvalError ee -> display_evaluation_error ee; Unknown + with LogicEvalError ee -> display_evaluation_error ~loc ee; Unknown + + +(* -------------------------------------------------------------------------- *) +(* --- Dependencies of predicates --- *) +(* -------------------------------------------------------------------------- *) let predicate_deps env pred = - let with_alarms = CilE.warn_none_mode in + let alarm_mode = Ignore in let rec do_eval env p = match p.pred_content with | Ptrue | Pfalse -> empty_logic_deps @@ -1822,29 +2072,29 @@ let predicate_deps env pred = join_logic_deps (do_eval env p1) (do_eval env p2) | Prel (_, t1, t2) -> - join_logic_deps (eval_term ~with_alarms env t1).ldeps - (eval_term ~with_alarms env t2).ldeps + join_logic_deps (eval_term ~alarm_mode env t1).ldeps + (eval_term ~alarm_mode env t2).ldeps | Pif (c, p1, p2) -> - join_logic_deps (eval_term ~with_alarms env c).ldeps + join_logic_deps (eval_term ~alarm_mode env c).ldeps (join_logic_deps (do_eval env p1) (do_eval env p2)) | Pat (p, lbl) -> do_eval { env with e_cur = lbl } p | Pvalid (_, tsets) | Pvalid_read (_, tsets) | Pvalid_function tsets-> - (eval_tlval ~with_alarms env tsets).ldeps + (eval_tlval ~alarm_mode env tsets).ldeps | Pinitialized (lbl, tsets) | Pdangling (lbl, tsets) -> let loc, deploc = - eval_tlval_as_location_with_deps ~with_alarms env tsets in + eval_tlval_as_location_with_deps ~alarm_mode env tsets in let zone = enumerate_valid_bits ~for_writing:false loc in Logic_label.Map.add lbl zone deploc | Pnot p -> do_eval env p | Pseparated ltsets -> - let evaled = List.map (eval_tlval ~with_alarms env) ltsets in + let evaled = List.map (eval_tlval ~alarm_mode env) ltsets in List.fold_left (fun acc e -> join_logic_deps acc e.ldeps) empty_logic_deps evaled @@ -1864,68 +2114,30 @@ let predicate_deps env pred = in do_eval env pred -exception Does_not_improve - -let rec fold_on_disjunction f p acc = - match p.pred_content with - | Por (p1,p2 ) -> fold_on_disjunction f p2 (fold_on_disjunction f p1 acc) - | _ -> f p acc -let count_disjunction p = fold_on_disjunction (fun _pred -> succ) p 0 - -let split_disjunction_and_reduce ~reduce ~env state_trace ~slevel p ip = - let with_alarms = warn_reduce_mode () in - let (state,trace) = state_trace in - if not (Model.is_reachable state) then State_set.empty - else - let nb = count_disjunction p in - if nb <= 1 && not reduce then - State_set.singleton state_trace (* reduction not required, nothing to split *) - else if nb <= slevel - then begin (* Can split and maybe reduce *) - let treat_subpred pred acc = - let r = reduce_by_predicate ~with_alarms env true pred in - if Cvalue.Model.equal (env_current_state r) state then - (* This part of the disjunction will contain the entire state. - Reduction has failed, there is no point in propagating the - smaller states in acc, that are contained in this one. *) - raise Does_not_improve - else - let trace = - if nb <= 1 then trace else Trace.add_disjunction ip pred trace - in - State_set.add (env_current_state r, trace) acc - in - try fold_on_disjunction treat_subpred p State_set.empty - with Does_not_improve -> State_set.singleton state_trace - end - else if reduce then - (* Not enough slevel to split, but we should reduce in a global way *) - let reduced = reduce_by_predicate ~with_alarms env true p in - State_set.singleton (env_current_state reduced, trace) - else (* Not enough slevel to split, and reduction not required *) - State_set.singleton state_trace -;; +(* -------------------------------------------------------------------------- *) +(* --- Export --- *) +(* -------------------------------------------------------------------------- *) -(* Position default value for ~with_alarms *) +(* Position default value for ~alarm_mode *) let reduce_by_predicate env positive p = - reduce_by_predicate ~with_alarms:(warn_reduce_mode ()) env positive p + let alarm_mode = alarm_reduce_mode () in + reduce_by_predicate ~alarm_mode env positive p let () = (* TODO: deprecate loc_to_loc, move loc_to_locs into Value *) Db.Properties.Interp.loc_to_loc := (fun ~result state t -> let env = env_post_f ~pre:state ~post:state ~result () in - try eval_tlval_as_location ~with_alarms:CilE.warn_none_mode env t + try eval_tlval_as_location ~alarm_mode:Ignore env t with LogicEvalError _ -> raise Db.Properties.Interp.No_conversion ); (* TODO: specify better evaluation environment *) Db.Properties.Interp.loc_to_loc_under_over := (fun ~result state t -> let env = env_post_f ~pre:state ~post:state ~result () in - let with_alarms = CilE.warn_none_mode in try - let r= eval_tlval ~with_alarms env t in + let r= eval_tlval ~alarm_mode:Ignore env t in let s = Eval_typ.sizeof_lval_typ r.etype in make_loc r.eunder s, make_loc r.eover s, deps_at lbl_here r.ldeps with LogicEvalError _ -> raise Db.Properties.Interp.No_conversion diff --git a/src/plugins/value/legacy/eval_terms.mli b/src/plugins/value/legacy/eval_terms.mli index 7aed4a33de8f02a330dea1c06104baaf0aa2fae6..82bf4b9f21cf5e8fcf13f271b29c7c28971789ad 100644 --- a/src/plugins/value/legacy/eval_terms.mli +++ b/src/plugins/value/legacy/eval_terms.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -32,8 +32,8 @@ val pretty_predicate_status : Format.formatter -> predicate_status -> unit val join_predicate_status : predicate_status -> predicate_status -> predicate_status -val join_list_predicate_status : - predicate_status list -> predicate_status +(* val join_list_predicate_status : + predicate_status list -> predicate_status *) (** Error during the evaluation of a term or a predicate *) @@ -55,6 +55,8 @@ type labels_states = Cvalue.Model.t Cil_datatype.Logic_label.Map.t the environment to evaluate an annotation *) type eval_env +val make_env: Model.t Abstract_domain.logic_environment -> Model.t -> eval_env + val env_pre_f : pre:Model.t -> unit -> eval_env val env_annot : ?c_labels:labels_states -> pre:Model.t -> here:Model.t -> unit -> eval_env @@ -71,11 +73,16 @@ val env_current_state: eval_env -> Model.t (** Dependencies needed to evaluate a term or a predicate *) type logic_deps = Zone.t Cil_datatype.Logic_label.Map.t - +(** Three modes to handle the alarms when evaluating a logical term. *) +type alarm_mode = + | Ignore (* Ignores all alarms. *) + | Fail (* Raises a LogicEvalError when an alarm is encountered. *) + | Track of bool ref (* Tracks the possibility of an alarm in the boolean: the + boolean is set to true if an alarm is encountered. *) (** Return a pair of (under-approximating, over-approximating) zones. *) val eval_tlval_as_zone_under_over: - with_alarms:CilE.warn_mode -> + alarm_mode:alarm_mode -> for_writing:bool -> eval_env -> term -> Zone.t * Zone.t (* ML: Should not be exported. *) @@ -86,27 +93,19 @@ type 'a eval_result = { ldeps: logic_deps; } + val eval_term : - with_alarms:CilE.warn_mode -> + alarm_mode:alarm_mode -> eval_env -> term -> V.t eval_result -val eval_tlval : - with_alarms:CilE.warn_mode -> - eval_env -> term -> Location_Bits.t eval_result - val eval_tlval_as_location : - with_alarms:CilE.warn_mode -> + alarm_mode:alarm_mode -> eval_env -> term -> location val eval_tlval_as_zone : - with_alarms:CilE.warn_mode -> + alarm_mode:alarm_mode -> for_writing:bool -> eval_env -> term -> Zone.t -exception Not_an_exact_loc -val eval_term_as_exact_locs : - with_alarms:CilE.warn_mode -> - eval_env -> term -> Cil_datatype.Typ.t * location - val eval_predicate : eval_env -> predicate -> predicate_status @@ -114,15 +113,3 @@ val predicate_deps: eval_env -> predicate -> logic_deps val reduce_by_predicate : eval_env -> bool -> predicate -> eval_env - -(** If [reduce] is true, reduce in all cases. Otherwise, reduce only - when [p] is a disjunction, ie. split by this disjunction. - The Property is the one in which is [p]. *) -val split_disjunction_and_reduce : - reduce:bool -> - env:eval_env -> - (Cvalue.Model.t * Trace.t) -> - slevel:int -> - predicate -> - Property.t -> - State_set.t diff --git a/src/plugins/value/legacy/function_args.ml b/src/plugins/value/legacy/function_args.ml index 1b32c3b7815db1355c0509011223488e10f44737..b19faf212c61b753658fefe73e36812eafdce0ef 100644 --- a/src/plugins/value/legacy/function_args.ml +++ b/src/plugins/value/legacy/function_args.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,113 +25,53 @@ open Cil_types exception Actual_is_bottom exception WrongFunctionType (* at a call through a pointer *) -(* We cannot statically check that a call through a function pointer is - correct wrt the number of arguments and their types (see the examples at - the end of tests/misc/fun_ptr.i). Thus, we make additional checks here: - the arguments size are correct, and the number of arguments is sufficient.*) -let check_arg_size expr formal = - try - if Cil.bitsSizeOf (Cil.typeOf expr) <> Cil.bitsSizeOf (formal.vtype) - then raise WrongFunctionType - with Cil.SizeOfError _ -> raise WrongFunctionType - let rec fold_left2_best_effort f acc l1 l2 = match l1,l2 with | _,[] -> acc | [],_ -> raise WrongFunctionType (* Too few arguments *) | (x1::r1),(x2::r2) -> fold_left2_best_effort f (f acc x1 x2) r1 r2 -let actualize_formals ?(check = fun _ _ -> ()) kf state actuals = +let actualize_formals kf state actuals = let formals = Kernel_function.get_formals kf in - let treat_one_formal acc (expr, actual_o) formal = - (check expr formal: unit); + let treat_one_formal acc actual_o formal = Cvalue.Model.add_base (Base.of_varinfo formal) actual_o acc in fold_left2_best_effort treat_one_formal state actuals formals -(* For all formals of [kf] whose address is taken, merge their values - in [prev_state] and [new_state], and update [new_state]. This is - useful to handle recursive calls. *) -let merge_referenced_formals kf prev_state new_state = - let formals = Kernel_function.get_formals kf in - let aux state vi = - if vi.vaddrof then - let b = Base.of_varinfo vi in - let prev_offsm = Cvalue.Model.find_base b prev_state in - let new_offsm = Cvalue.Model.find_base b new_state in - match Bottom.Top.join Cvalue.V_Offsetmap.join prev_offsm new_offsm with - | `Top -> assert false - | `Bottom -> Cvalue.Model.bottom - | `Value m -> Cvalue.Model.add_base b m state - else state +let offsetmap_of_lv state lv = + let open Locations in + let state, loc_to_read, _typ = !Db.Value.lval_to_precise_loc_state state lv in + let aux loc offsm_res = + let size = Int_Base.project loc.size in + let copy = Cvalue.Model.copy_offsetmap loc.loc size state in + Bottom.join Cvalue.V_Offsetmap.join copy offsm_res in - List.fold_left aux new_state formals - -let main_initial_state_with_formals kf (state:Cvalue.Model.t) = - match kf.fundec with - | Declaration (_, _, None, _) -> state - | Declaration (_, _, Some l, _) - | Definition ({ sformals = l }, _) -> - if l <> [] && Value_parameters.InterpreterMode.get() - then begin - Value_parameters.error "Entry point %a has arguments" - Kernel_function.pretty kf; - exit 0; - end; - List.fold_right - Initial_state.initialize_var_using_type - l - state - + Precise_locs.fold aux loc_to_read `Bottom -let compute_actual ~with_alarms ~warn_indeterminate state e = +let compute_actual state e = match e with | { enode = Lval lv } when not (Eval_typ.is_bitfield (Cil.typeOfLval lv)) -> - let ploc, state, o = - try Eval_exprs.offsetmap_of_lv ~with_alarms state lv - with Int_Base.Error_Top -> + let o = + try offsetmap_of_lv state lv + with Abstract_interp.Error_Top -> Value_parameters.abort ~current:true "Function argument %a has \ unknown size. Aborting" Printer.pp_exp e; in begin match o with - | `Value o -> - let typ_lv = Cil.typeOfLval lv in - let o, state = - if warn_indeterminate then - match Warn.warn_reduce_indeterminate_offsetmap - ~with_alarms typ_lv o (`PreciseLoc ploc) state - with - | `Bottom -> raise Actual_is_bottom - | `Res r -> r - else o, state - in - begin match Warn.offsetmap_contains_imprecision o with - | Some v -> - let loc = Precise_locs.imprecise_location ploc in - Warn.warn_imprecise_lval_read ~with_alarms lv loc v - | None -> () - end; - o, state + | `Value o -> o | `Bottom -> raise Actual_is_bottom end | _ -> - let state, _, interpreted_expr = - Eval_exprs.eval_expr_with_deps_state ~with_alarms None state e - in + let interpreted_expr = !Db.Value.eval_expr state e in if Cvalue.V.is_bottom interpreted_expr then raise Actual_is_bottom; let typ = Cil.typeOf e in - Eval_op.offsetmap_of_v ~typ interpreted_expr, state + Eval_op.offsetmap_of_v ~typ interpreted_expr let () = Db.Value.add_formals_to_state := (fun state kf exps -> try - let compute_actual = - compute_actual ~with_alarms:CilE.warn_none_mode ~warn_indeterminate:false - in - let actuals = - List.map (fun e -> e, fst (compute_actual state e)) exps - in + let actuals = List.map (fun e -> compute_actual state e) exps in actualize_formals kf state actuals with Actual_is_bottom -> Cvalue.Model.bottom) diff --git a/src/plugins/value/slevel/stop_at_nth.mli b/src/plugins/value/legacy/function_args.mli similarity index 90% rename from src/plugins/value/slevel/stop_at_nth.mli rename to src/plugins/value/legacy/function_args.mli index eaa60740d3d3be4a72f3c834d71632630958b8dd..9f71d56d48e6c8bbd44e6aabb5a995dad144d5e2 100644 --- a/src/plugins/value/slevel/stop_at_nth.mli +++ b/src/plugins/value/legacy/function_args.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,5 +20,5 @@ (* *) (**************************************************************************) -val clear: unit -> unit -val incr: unit -> bool +(** Nothing is exported; the function [compute_atual] is registered + in {!Db.Value}. *) diff --git a/src/plugins/value/legacy/initial_state.ml b/src/plugins/value/legacy/initial_state.ml deleted file mode 100644 index f8de88297a3b7f229eb738b8cbf5855e04aea733..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/initial_state.ml +++ /dev/null @@ -1,630 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Abstract_interp -open Cvalue -open Locations -open Value_util - -let dkey = Value_parameters.register_category "initial_state" - -exception Initialization_failed - -(* Those functions intentionally ignore 'const' attributes. Functions of - Eval_op should not be used in this module, unless they have a 'reducing' - argument. *) -let add_initialized state loc v = - Cvalue.Model.add_initial_binding state loc (V_Or_Uninitialized.initialized v) - -let make_well hidden_base state loc = - let size = Bit_utils.max_bit_size () in - let well = - Cvalue.V.inject_top_origin Origin.Well (Base.Hptset.singleton hidden_base) - in - let well_loc = - Locations.make_loc - (Location_Bits.inject hidden_base Ival.zero) - (Int_Base.inject size) - in - let state = add_initialized state well_loc well in - add_initialized state loc well - - -let warn_unknown_size_aux pp v (messt, t) = - Value_parameters.warning ~once:true ~current:true - "@[during initialization@ of %a,@ size of@ type '%a'@ cannot be@ computed@ \ - (%s)@]" pp v Printer.pp_typ t messt - -let warn_unknown_size = - warn_unknown_size_aux - (fun fmt v -> Format.fprintf fmt "variable '%a'" Printer.pp_varinfo v) - -type validity_hidden_base = - | UnknownValidity (* Base is maybe invalid on its entire validity *) - | KnownThenUnknownValidity of Integer.t (* Base is valid on i bits, then - maybe invalid on the remainder of its validity *) - -let create_hidden_base ~valid ~hidden_var_name ~name_desc pointed_typ = - let hidden_var = Value_util.create_new_var hidden_var_name pointed_typ in - hidden_var.vdescr <- Some name_desc; - let validity = - (* Add a special case for void* pointers: we do not want to compute the - size of void *) - let validity = match Cil.unrollType pointed_typ with - | TVoid _ -> Base.Unknown (Int.zero, None, Bit_utils.max_bit_address ()) - | _ -> Base.validity_from_type hidden_var - in - match validity with - | Base.Known (a,b) - when not (Value_parameters.AllocatedContextValid.get ()) -> - (* Weaken validity, because the created variables are not supposed - to be valid *) - (match valid with - | KnownThenUnknownValidity size -> (*except here, for size bits*) - let size = Integer.pred size in - assert (Integer.le size b); - Base.Unknown (a, Some size, b) - | UnknownValidity -> Base.Unknown (a, None, b) - ) - | Base.Unknown _ -> (* Unknown validity is caused by strange type *) - Value_parameters.result ~dkey "creating variable %s with imprecise \ - size (type %a)" hidden_var_name Printer.pp_typ pointed_typ; - validity - | Base.Empty | Base.Known _ | Base.Invalid -> validity - | Base.Variable _ -> (* should never happen (validity_from_type cannot - return Weak) *) assert false - in - Base.register_memory_var hidden_var validity - -let check_empty_composite b offset typ = - match Cil.unrollType typ with - | TComp (ci, _, _) -> - if ci.cfields = [] && ci.cdefined && - not (Cil.gccMode () || Cil.msvcMode ()) then - Value_parameters.abort ~current:true - "@[empty %ss@ are unsupported@ (type '%a',@ location %a%a)@ \ - in C99 (only allowed as GCC/MSVC extension).@ Aborting.@]" - (if ci.cstruct then "struct" else "union") - Printer.pp_typ typ Base.pretty b Printer.pp_offset offset - | _ -> () - - -(* [initialize_var_using_type varinfo state] uses the type of [varinfo] - to create an initial value in [state]. *) -let initialize_var_using_type varinfo state = - let with_alarms = CilE.warn_none_mode in - Cil.CurrentLoc.set varinfo.vdecl; - let rec add_offsetmap depth b name_desc name typ offset_orig typ_orig state = - let typ = Cil.unrollType typ in - let loc = lazy (loc_of_typoffset b typ_orig offset_orig) in - let bind_entire_loc ?(state=state) v = (* Shortcut *) - add_initialized state (Lazy.force loc) v - in - match typ with - | TInt _ | TEnum (_, _)-> - bind_entire_loc Cvalue.V.top_int - - | TFloat (fkind, _) -> begin - match Value_util.float_kind fkind with - | Fval.Float32 -> - bind_entire_loc Cvalue.V.top_single_precision_float - | Fval.Float64 -> - bind_entire_loc Cvalue.V.top_float - end - - | TFun _ -> state - - | TPtr (typ, _) as full_typ - when depth <= Value_parameters.AutomaticContextMaxDepth.get () -> - let attr = Cil.typeAttrs full_typ in - let context_max_width = - Value_parameters.AutomaticContextMaxWidth.get () - in begin - match Cil.isVoidType typ, Cil.isFunctionType typ with - | false, false -> (* non-void, non-function *) - let i = - match Cil.findAttribute "arraylen" attr with - | [AInt i] -> i - | _ -> Integer.of_int context_max_width - in - let arr_pointed_typ = - TArray(typ, - Some (Cil.kinteger64 ~loc:varinfo.vdecl i), - Cil.empty_size_cache (), - []) - in - let hidden_var_name = - Cabs2cil.fresh_global ("S_" ^ name) - in - let name_desc = "*"^name_desc in - (* Make first cell of the array valid. The NULL pointer takes - care of a potential invalid pointer. *) - let valid = - try KnownThenUnknownValidity (Integer.of_int (Cil.bitsSizeOf typ)) - with Cil.SizeOfError _ -> UnknownValidity - in - let hidden_base = - create_hidden_base - ~valid ~hidden_var_name ~name_desc arr_pointed_typ - in - let state = - add_offsetmap - (depth + 1) - hidden_base - name_desc - hidden_var_name - arr_pointed_typ - NoOffset - arr_pointed_typ - state - in - let value = Cvalue.V.inject hidden_base (Ival.zero) in - let value = - if Value_parameters.AllocatedContextValid.get () - then value - else Cvalue.V.join Cvalue.V.singleton_zero value - in - bind_entire_loc ~state value - | true, false -> (* void *) - let hidden_var_name = Cabs2cil.fresh_global ("S_" ^ name) in - let name_desc = "*"^name_desc in - let valid = UnknownValidity in - let hidden_base = - create_hidden_base ~valid ~hidden_var_name ~name_desc typ - in - make_well hidden_base state (Lazy.force loc) - | false, true -> (* function *) - (* Generating functions is next to useless for the user (what - does the function do), and too dangerous for the AST. *) - bind_entire_loc ~state V.singleton_zero - | true, true -> assert false (* inconsistent *) - end - - | TArray (typ, len, _, _) -> - begin try - let size = Cil.lenOfArray len in - let size_elt = Int.of_int (Cil.bitsSizeOf typ) in - let psize = pred size in - let state = ref state in - let typ = Cil.unrollType typ in - let max_precise_size = - Value_parameters.AutomaticContextMaxWidth.get () - in - let locs = ref [] in - for i = 0 to min psize (pred max_precise_size) do - (* Cells that are treated really precisely. We create new - pointers (if needed) for each distinct cell *) - let offset = - Cil.addOffset - (Index (Cil.integer ~loc:varinfo.vdecl i, NoOffset)) - offset_orig - in - let name = string_of_int i ^ "_" ^ name in - let name_desc = name_desc ^ "[" ^ string_of_int i ^ "]" in - state := - add_offsetmap depth b name_desc name typ offset typ_orig !state; - let loc = loc_of_typoffset b typ_orig offset in - locs := loc :: !locs; - done; - if max_precise_size < size then begin - (* Some elements remain to be initialized *) - let offsm_of_loc loc = (* This rereads one of the first cells*) - let _alarm, offsm = - Cvalue.Model.copy_offsetmap loc size_elt !state - in - match offsm with `Bottom -> assert false | `Value m -> m - in - let last_loc, locs = match !locs with - | [] -> assert false (* AutomaticContextMaxWidth is at least 1*) - | l :: ll -> l, ll - in - let last_offsm = offsm_of_loc last_loc.loc in - (* Join of the contents of the first elements *) - let aux_loc offsm loc = - Cvalue.V_Offsetmap.join offsm (offsm_of_loc loc.loc) - in - let offsm_joined = List.fold_left aux_loc last_offsm locs in - (* TODO: add Offsetmap.paste_repeated_slices to Offsetmap, and - replace everything below by a call to it. *) - let nb_fields = - Cvalue.V_Offsetmap.fold (fun _itv _ -> succ) offsm_joined 0 - in - if nb_fields = 1 then - (* offsm_joined is very regular (typically Top_int, or some - pointers). We read its contents and copy it everywhere else. - The periodicity of the contents may be smaller than the size - of a cell; take this into account. *) - let v, modu, offset = - Extlib.the (Cvalue.V_Offsetmap.fold - (fun _itv v _ -> Some v) offsm_joined None) - in - assert (Rel.equal offset Rel.zero); - let ncells = size - max_precise_size in - let total_size = Int.mul size_elt (Int.of_int ncells) in - let offsm_repeat = V_Offsetmap.create - ~size_v:modu ~size:total_size v in - let loc = Location_Bits.shift - (Ival.inject_singleton size_elt) last_loc.loc; - in - (* paste [size - max_precise_size] elements, starting from - the last location initialized + 1 *) - state := - Eval_op.paste_offsetmap ~reducing:true ~with_alarms - ~from:offsm_repeat - ~dst_loc:loc - ~size:total_size - ~exact:true - !state - else ( - (* We have probably initialized a struct with different fields. - We must perform offsetmap copies, that are slower *) - if nb_fields * psize >= 5000 then - Value_parameters.result ~once:true ~current:true - "Initializing a complex array of %d elements. This may \ - take some time" size; - let loc = ref last_loc.loc in - for _i = max_precise_size to psize do - loc := Location_Bits.shift - (Ival.inject_singleton size_elt) !loc; - state := - Eval_op.paste_offsetmap ~reducing:true ~with_alarms - ~from:offsm_joined - ~dst_loc:!loc - ~size:size_elt - ~exact:true - !state - done); - end; - !state - with - | Cil.LenOfArray -> - Value_parameters.result ~once:true ~current:true - "no size specified for array, assuming 0"; - (* This is either a flexible array member (for which Cil - implicitly returns a size of 0, so we are doing the proper - thing), or an incomplete array (which is forbidden) *) - state - | Cil.SizeOfError (s, t) -> - warn_unknown_size varinfo (s, t); - bind_entire_loc Cvalue.V.top_int; - end - - | TComp ({cstruct=true;} as compinfo, _, _) -> (* Struct *) - check_empty_composite b offset_orig typ; - let treat_field state field = - match field.fbitfield with - | Some 0 -> state (* skip the field, nothing to initialize *) - | _ -> - let new_offset = Field (field, NoOffset) in - let offset = Cil.addOffset new_offset offset_orig in - let nd = name_desc ^ "." ^ field.fname in - let n = field.fname ^ "_" ^ name in - add_offsetmap depth b nd n field.ftype offset typ_orig state - in - begin - try - List.fold_left treat_field state compinfo.cfields - with Cil.SizeOfError (s, t) -> - warn_unknown_size varinfo (s, t); - bind_entire_loc Cvalue.V.top_int; - end - - | TComp ({cstruct=false}, _, _) when Cil.is_fully_arithmetic typ -> - check_empty_composite b offset_orig typ; - (* Union of arithmetic types *) - bind_entire_loc Cvalue.V.top_int - - | TPtr _ when Value_parameters.AllocatedContextValid.get () -> - (* deep pointers map to NULL in this case *) - bind_entire_loc Cvalue.V.singleton_zero - - | TBuiltin_va_list _ | TComp _ | TVoid _ | TPtr _ -> - check_empty_composite b offset_orig typ; - (* variable arguments or union with non-arithmetic type - or deep pointers *) - (* first create a new varid and offsetmap for the - "hidden location" *) - let hidden_var_name = - Cabs2cil.fresh_global ("WELL_"^name) - in - let hidden_var = - Value_util.create_new_var hidden_var_name Cil.charType - in - hidden_var.vdescr <- Some (name_desc^"_WELL"); - let validity = Base.Known (Int.zero, Bit_utils.max_bit_address ()) in - let hidden_base = Base.register_memory_var hidden_var validity in - make_well hidden_base state (Lazy.force loc) - | TNamed (_, _) -> assert false - in - add_offsetmap - 0 - (Base.of_varinfo varinfo) - varinfo.vname varinfo.vname varinfo.vtype NoOffset varinfo.vtype state - - -(* Fill [vi] everywhere with padding. The exact contents (bottom | zero | - top_int), initialized or not, is determined from [lib_entry] and option - [-val-initialization-padding-globals] *) -let init_var_padding ~lib_entry vi state = - let loc = Locations.loc_of_varinfo vi in - match Value_parameters.InitializationPaddingGlobals.get () with - | "yes" -> - let v = if lib_entry then V.top_int else V.singleton_zero in - Cvalue.Model.add_initial_binding state loc - (V_Or_Uninitialized.C_init_noesc v) - | "no" -> - Cvalue.Model.add_initial_binding state loc - V_Or_Uninitialized.uninitialized - | "maybe" -> - let v = if lib_entry then V.top_int else V.singleton_zero in - Cvalue.Model.add_initial_binding state loc - (V_Or_Uninitialized.C_uninit_noesc v) - | _ -> assert false - -let warn_size vi = - try - ignore (Cil.bitsSizeOf vi.vtype); - false - with Cil.SizeOfError (s, t)-> - warn_unknown_size vi (s, t); - true - -let init_var_zero vi state = - ignore (warn_size vi); - let loc = Locations.loc_of_varinfo vi in - add_initialized state loc V.singleton_zero - -let init_var_volatile vi state = - ignore (warn_size vi); - let loc = Locations.loc_of_varinfo vi in - add_initialized state loc V.top_int - -let init_var_lib_entry vi state = - let loc = Locations.loc_of_varinfo vi in - if warn_size vi then - add_initialized state loc V.top_int - else - (* add padding everywhere *) - let state = init_var_padding ~lib_entry:true vi state in - (* then initialize non-padding bits according to the type *) - initialize_var_using_type vi state - - -(* Is the padding filled with fully initialized values. In this case, we - can speed up the generation of the initial state in a few cases. *) -let fully_initialized_padding () = - Value_parameters.InitializationPaddingGlobals.get () = "yes" - -let eval_lval_to_loc lval = - let with_alarms = CilE.warn_none_mode in - (* Eval in Top state. We do not want the location to depend on other globals*) - let _, loc, typ_lval = - Eval_exprs.lval_to_loc_state ~with_alarms Cvalue.Model.top lval - in - loc, typ_lval - -(* Evaluation of a [SingleInit] in Cil parlance *) -let init_single_initializer state lval exp = - let loc, typ_lval = eval_lval_to_loc lval in - let value = - Eval_exprs.eval_expr ~with_alarms:(warn_all_quiet_mode ()) state exp - in - if Cvalue.V.equal value V.bottom then ( - Value_parameters.result ~source:(fst exp.eloc) - "Evaluation of initializer '%a' failed@." Printer.pp_exp exp; - raise Initialization_failed); - let v = - if Cil.typeHasQualifier "volatile" typ_lval - then V.top_int - else Eval_typ.cast_lval_if_bitfield typ_lval loc.Locations.size value - in - add_initialized state loc v - -(* Apply an initializer (not recursively). Take volatile qualifiers into - account. If [warn] holds, we warn when an initializer is ignored - because it points to a volatile location. *) -let rec init_initializer_or_volatile state lval init warn = - if Cil.typeHasQualifier "volatile" (Cil.typeOfLval lval) then begin - if warn then - warning_once_current "global initialization of volatile zone %a ignored" - Printer.pp_lval lval; - let loc, _ = eval_lval_to_loc lval in - add_initialized state loc V.top_int - end - else - match init with - | SingleInit exp -> init_single_initializer state lval exp - | CompoundInit (base_typ, l) -> - Cil.foldLeftCompound - ~implicit:false - ~doinit: - (fun off init _typ state -> - let lval' = Cil.addOffsetLval off lval in - init_initializer_or_volatile state lval' init warn) - ~ct:base_typ - ~initl:l - ~acc:state - -(* Special initializers. Only lval with attributes 'const' and non-volatile - are initialized *) -let rec init_const_initializer state lval init = - match init with - | SingleInit exp -> - let typ_lval = Cil.typeOfLval lval in - if Cil.typeHasQualifier "const" typ_lval && - not (Cil.typeHasQualifier "volatile" typ_lval) - then - init_single_initializer state lval exp - else state - - | CompoundInit (base_typ, l) -> - if Cil.typeHasQualifier "volatile" base_typ || - not (Cil.typeHasAttributeDeep "const" base_typ) - then state (* initializer is not useful *) - else - Cil.foldLeftCompound - ~implicit:true - ~doinit: - (fun off init _typ state -> - init_const_initializer state (Cil.addOffsetLval off lval) init) - ~ct:base_typ - ~initl:l - ~acc:state - -(* Bind the declared range for NULL to top int *) -let initialize_null state = - let min_valid = Base.min_valid_absolute_address () in - let max_valid = Base.max_valid_absolute_address () in - if Int.le min_valid max_valid - then begin - (* Bind everything between [0..max] to bottom. Offsetmaps cannot - contain holes, which can happen when min > 0 holds. *) - let bot = V_Offsetmap.create_isotropic - ~size:max_valid (V_Or_Uninitialized.initialized V.bottom) - in - let v = if true (* TODO: command line option *) - then V_Or_Uninitialized.initialized V.top_int - else V_Or_Uninitialized.uninitialized - in - let offsm = - V_Offsetmap.add (min_valid, max_valid) (v, Int.one, Rel.zero) bot - in - Cvalue.Model.add_base Base.null offsm state - end - else state - -(* initialize [vi] when [-lib-entry] is not set, by writing successively - the padding, zero, and the initializers. *) -let init_var_not_lib_entry_initializer vi init state = - Cil.CurrentLoc.set vi.vdecl; - let volatile_somewhere = Cil.typeHasAttributeDeep "volatile" vi.vtype in - let volatile_everywhere = Cil.typeHasQualifier "volatile" vi.vtype in - if fully_initialized_padding () && - (volatile_everywhere || not volatile_somewhere) - then - (* shortcut: padding and volatile won't interfere, we can do a global - initialisation, then write the initializer on top if there is one. *) - if volatile_everywhere then begin - if init <> None then - warning_once_current - "global initialization of volatile variable %a ignored" - Printer.pp_varinfo vi; - init_var_volatile vi state - end - else - let state = init_var_zero vi state in - match init with - | None -> state - | Some init -> - init_initializer_or_volatile state (Var vi,NoOffset) init true - else (* "slow" initialization *) - let state = init_var_padding ~lib_entry:false vi state in - let typ = vi.vtype in - let loc = Cil_datatype.Location.unknown in - let zi = Cil.makeZeroInit ~loc typ in - (* initialise everything (except padding) to zero). Do not warn, as - most of the initializer is generated. *) - let state = init_initializer_or_volatile state (Var vi,NoOffset) zi false in - (* then write the real initializer on top *) - match init with - | None -> state - | Some init -> - init_initializer_or_volatile state (Var vi,NoOffset) init true - - -(* initialize [vi] as if in [-lib-entry] mode. Active when [-lib-entry] is set, - or when [vi] is extern. [const] initializers, explicit or implicit, are - taken into account *) -let init_var_lib_entry_initializer vi init state = - Cil.CurrentLoc.set vi.vdecl; - if Cil.typeHasQualifier "const" vi.vtype && not (vi.vstorage = Extern) - then (* Fully const base. Ignore -lib-entry altogether *) - init_var_not_lib_entry_initializer vi init state - else - (* Fill padding + contents of non-padding bits according to the type *) - let state = init_var_lib_entry vi state in - (* if needed, initialize const fields according to the initialiser - (or generate one if there are none). In the first phase, they have been - set to generic values *) - if Cil.typeHasAttributeDeep "const" vi.vtype && not (vi.vstorage = Extern) - then - let init = match init with - | None -> Cil.makeZeroInit ~loc:vi.vdecl vi.vtype - | Some init -> init - in - init_const_initializer state (Var vi, NoOffset) init - else state - - -module NotLibEntryGlobals = - State_builder.Option_ref - (Cvalue.Model) - (struct - let name = "Value.Initial_state.NotLibEntryGlobals" - let dependencies = - [ Ast.self; Kernel.AbsoluteValidRange.self; - Value_parameters.InitializationPaddingGlobals.self ] - end) - -module LibEntryGlobals = - State_builder.Option_ref - (Cvalue.Model) - (struct - let name = "Value.Initial_state.LibEntryGlobals" - open Value_parameters - let dependencies = - [ Ast.self; Kernel.AbsoluteValidRange.self; - InitializationPaddingGlobals.self; AllocatedContextValid.self; - AutomaticContextMaxWidth.self; AutomaticContextMaxDepth.self; - ] - end) -let () = Ast.add_monotonic_state LibEntryGlobals.self - -let initial_state ~lib_entry () = - Value_parameters.debug ~level:2 "Computing globals values"; - try - Globals.Vars.fold_in_file_order - (fun vi init state -> - if vi.vsource then begin - let initialize = - if lib_entry || (vi.vstorage = Extern (* use -lib-entry mode. *)) - then init_var_lib_entry_initializer - else init_var_not_lib_entry_initializer - in - initialize vi init.init state - end - else state - ) (initialize_null Cvalue.Model.empty_map) - with Initialization_failed -> Cvalue.Model.bottom - -let initial_state_not_lib_entry () = - NotLibEntryGlobals.memo (initial_state ~lib_entry:false) - -let initial_state_lib_entry () = - LibEntryGlobals.memo (initial_state ~lib_entry:true) - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/mem_exec.ml b/src/plugins/value/legacy/mem_exec.ml deleted file mode 100644 index 0fc8505a9cb7daf7a7e1c63db202bb404c2ed217..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/mem_exec.ml +++ /dev/null @@ -1,326 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -exception TooImprecise - -(* Extract all the bases from a zone *) -let bases = function - | Locations.Zone.Top (Base.SetLattice.Top, _) -> raise TooImprecise - | Locations.Zone.Top (Base.SetLattice.Set s, _) -> s - | Locations.Zone.Map m -> Base.Hptset.from_shape (Locations.Zone.shape m) - - -(* Auxiliary function that keeps only some bases inside a memory state *) -let filter_state bases state = - Cvalue.Model.filter_by_shape (Base.Hptset.shape bases) state - - -module ValueOutputs = Datatype.Pair - (Datatype.List( - Datatype.Pair - (Datatype.Option(Cvalue.V_Offsetmap)) (* Return *) - (Cvalue.Model) (* Memory state *))) - (Base.SetLattice) (* clobbered set for local variables *) - -(* let pretty fmt (((bin, stin), (_, stout, _), _i) : PreviousState.t) = - Format.fprintf fmt - "@[<v>@[Inputs contained in %a]@ \ - @[Values of inputs:@]@ %a\ - @[Values of outputs:@]@ %a@]" - Base.Hptset.pretty bin Cvalue.Model.pretty stin Cvalue.Model.pretty stout -*) - -module PreviousState = - Datatype.Pair - (ValueOutputs (* Outputs *)) - (Datatype.Int(* Call number, for plugins *)) - -module Actuals = struct - include Datatype.Pair(Cil_datatype.Exp)(Cvalue.V_Offsetmap) - let compare (_, o1 : t) (_, o2 : t) = Cvalue.V_Offsetmap.compare o1 o2 -end - -module ActualsList = - Datatype.List_with_collections(Actuals) - (struct let module_name = "Mem_exec.ActualsList" end) - -(* Map input states filtered on relevant bases to the relevant data *) -module MapInputsPrevious = - Cvalue.Model.Hashtbl.Make(PreviousState) - -(* Map from useful inputs to stored previous results *) -module MapBasesInputsPrevious = - Base.Hptset.Hashtbl.Make(MapInputsPrevious) - -(* Map from actuals to useful inputs to stored previous results *) -module MapActualsBasesInputsPrevious = - ActualsList.Map.Make(MapBasesInputsPrevious) - -module PreviousStates = - State_builder.Hashtbl(Kernel_function.Hashtbl)(MapActualsBasesInputsPrevious) - (struct - let size = 17 - let dependencies = [Db.Value.self] - let name = "Mem_exec.PreviousStates" - end) - -(* Reference filled in by the callwise-inout callback *) -module ResultFromCallback = - State_builder.Option_ref(Datatype.Pair(Value_types.Callstack)(Inout_type)) - (struct - let dependencies = [Db.Value.self] - let name = "Mem_exec.ResultFromCallback" - end) - - -(* TODO: it would be great to clear also the tables within the plugins. Export - self and add dependencies *) -let cleanup_results () = - PreviousStates.clear (); - ResultFromCallback.clear (); -;; - - -let map_to_outputs f = - List.map - (fun ((res: Cvalue.V_Offsetmap.t option), (out: Cvalue.Model.t)) -> - (res, f out)) - -let register_callback () = - if Value_parameters.MemExecAll.get () then - Db.Operational_inputs.Record_Inout_Callbacks.extend_once - (fun (_stack, _inout as v) -> - ResultFromCallback.set v) - -let () = Cmdline.run_after_configuring_stage register_callback - - -module SaveCounter = - State_builder.SharedCounter(struct let name = "Mem_exec.save_counter" end) - -let new_counter, current_counter = - let cur = ref (-1) in - (fun () -> cur := SaveCounter.next (); !cur), - (fun () -> !cur) - -(* [diff_base_full_zone bases zones] remove from the set of bases [bases] - those of which all bits are present in [zones] *) -let diff_base_full_zone = - let cache = Hptmap_sig.PersistentCache "Mem_exec.diff_base_full_zone" in - let empty_left _ = Base.Hptset.empty (* nothing left to clear *) in - let empty_right v = v (* return all bases unchanged *) in - (* Check whether [range] covers the validity of [b]. If so, remove [b] - (hence, return an empty set). Otherwise, keep [b]. Variable bases are - always kept, because they may be changed into weak variables later. - This is specific to the way this function is used later in this file. *) - let both b range = begin - match Base.validity b with - | Base.Invalid -> assert false - | Base.Empty -> Base.Hptset.empty - | Base.Variable _ -> Base.Hptset.singleton b - | Base.Known (min, max) | Base.Unknown (min, _, max) -> - match Int_Intervals.project_singleton range with - | Some (min', max') -> - if Integer.equal min min' && Integer.equal max max' then - Base.Hptset.empty - else - Base.Hptset.singleton b - | None -> Base.Hptset.singleton b - end in - let join = Base.Hptset.union in - let empty = Base.Hptset.empty in - let f = Base.Hptset.fold2_join_heterogeneous - ~cache ~empty_left ~empty_right ~both ~join ~empty - in - fun bases z -> - match z with - | Locations.Zone.Map m -> f bases (Locations.Zone.shape m) - | Locations.Zone.Top _ -> bases (* Never happens anyway *) - -let store_computed_call (callsite: Value_types.call_site) input_state actuals callres = - if callres.Value_types.c_cacheable = Value_types.Cacheable then - match ResultFromCallback.get_option () with - | None -> () - | Some (_stack, inout) -> - try - let kf, _ki = callsite in - let input_bases = bases inout.Inout_type.over_inputs - and output_bases = bases inout.Inout_type.over_outputs_if_termination in - (* There are two strategies to compute the 'inputs' for a memexec - function: either we take all inputs_bases+outputs_bases - (outputs_bases are important because of weak updates), or we - remove the sure outputs from the outputs, as sure outputs by - definition strong updated. The latter will enable memexec to fire - more often, but requires more computations. *) - let remove_sure_outputs = true in - let input_bases = - if remove_sure_outputs then - let uncertain_output_bases = - (* Remove outputs whose base is completely overwritten *) - diff_base_full_zone - output_bases inout.Inout_type.under_outputs_if_termination - in - Base.Hptset.union input_bases uncertain_output_bases - else - Base.Hptset.union input_bases output_bases - in - let state_input = filter_state input_bases input_state in - (* Outputs bases, that is bases that are copy-pasted, also include - input bases. Indeed, those may get reduced during the call. *) - let all_output_bases = - if remove_sure_outputs - then Base.Hptset.union input_bases output_bases - else input_bases - in - let clear state = filter_state all_output_bases state in - let outputs = map_to_outputs clear callres.Value_types.c_values in - let call_number = current_counter () in - let map_a = - try PreviousStates.find kf - with Not_found -> ActualsList.Map.empty - in - let hkf = - try ActualsList.Map.find actuals map_a - with Not_found -> - let h = Base.Hptset.Hashtbl.create 11 in - let map_a = ActualsList.Map.add actuals h map_a in - PreviousStates.replace kf map_a; - h - in - let hkb = - try Base.Hptset.Hashtbl.find hkf input_bases - with Not_found -> - let h = Cvalue.Model.Hashtbl.create 11 in - Base.Hptset.Hashtbl.add hkf input_bases h; - h - in - Cvalue.Model.Hashtbl.add hkb state_input - ((outputs, callres.Value_types.c_clobbered), call_number); - ResultFromCallback.clear () - with - | TooImprecise - | Kernel_function.No_Statement - | Not_found -> ResultFromCallback.clear () - - -exception Result_found of ValueOutputs.t * int - -(* Find a previous execution in [map_inputs] that matches [st]. - raise [Result_found] when this execution exists, or do nothing. *) -let find_match_in_previous (map_inputs: MapBasesInputsPrevious.t) state = - let aux_previous_call binputs hstates = - (* restrict [state] to the inputs of this call *) - let st_filtered = filter_state binputs state in - try - let (outputs, clobbered), i = - Cvalue.Model.Hashtbl.find hstates st_filtered - in - (* We have found a previous execution, in which the outputs are - [outputs]. Copy them in [state] and return this result. *) - let aux = function - | Cvalue.Model.Bottom | Cvalue.Model.Top as state -> state - | Cvalue.Model.Map outputs -> - Cvalue.Model.fold Cvalue.Model.add_base outputs state(*=acc*) - in - let outputs = map_to_outputs aux outputs in - raise (Result_found ((outputs, clobbered), i)) - with Not_found -> () - in - Base.Hptset.Hashtbl.iter aux_previous_call map_inputs - - -let reuse_previous_call (kf, _ as _callsite: Value_types.call_site) state actuals = - try - let previous_kf = PreviousStates.find kf in - let previous = ActualsList.Map.find actuals previous_kf in - find_match_in_previous previous state; - None - with - | Not_found -> None - | Result_found ((out, clob), i) -> - let res_call = { - Value_types.c_values = out; - c_clobbered = clob; - c_from = None; - c_cacheable = Value_types.Cacheable - (* call can be cached since it was cached once *); - } in - Some (res_call, i) - - -(* TEST code, to be pasted in eval_funs, below the call to reuse_previous_state - let res = match compute_call_to_builtin kf initial_state actuals with - | Some r -> r - | None -> - let res = compute_call_to_cil_function kf with_formals call_kinstr in - res - in - match Mem_exec.reuse_previous_state with_formals (kf, call_kinstr) with - | None -> - Mem_exec.store_previous_state (kf, call_kinstr) with_formals res; - res - | Some res' -> - let _ret, st, _ = res and (_ret', st', _ as res'), _, out, in_ = res' in - if not (Cvalue.Model.equal st st') then begin - begin - (match st with - | Cvalue.Model.Top | Cvalue.Model.Bottom -> assert false - | Cvalue.Model.Map lb -> - Cvalue.Model.LBase.iter - (fun b offsm -> - let offsm' = Cvalue.Model.find_base b st' in - if not (V_Offsetmap.equal offsm offsm') then ( - Format.printf "Different offsm for %a@\n%a@\n%a@." - Base.pretty b - V_Offsetmap.pretty offsm - V_Offsetmap.pretty offsm' - ) - ) lb); - (match st' with - | Cvalue.Model.Top | Cvalue.Model.Bottom -> assert false - | Cvalue.Model.Map lb' -> - Cvalue.Model.LBase.iter - (fun b offsm' -> - let offsm = Cvalue.Model.find_base b st in - if not (V_Offsetmap.equal offsm offsm') then - Format.printf "Different offsm2 for %a@." Base.pretty b - ) lb'); - end; - let fmti = Format.formatter_of_out_channel (open_out "stinit") - and fmt1 = Format.formatter_of_out_channel (open_out "st1") - and fmt2 = Format.formatter_of_out_channel (open_out "st2") in - Format.fprintf fmti "###INITIAL STATE@.%a@." Cvalue.Model.pretty with_formals; - Format.fprintf fmt1 "###RESULT NORMAL@.%a@." Cvalue.Model.pretty st; - Format.fprintf fmt2 "###RESULT CACHED@.%a@." Cvalue.Model.pretty st'; - Value_parameters.result "Caching failed for function %a,@.out %a@.in %a" - Kernel_function.pretty kf Cvalue.Model.pretty out Cvalue.Model.pretty in_; - do_degenerate None - end; - res' -*) - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/mem_exec.mli b/src/plugins/value/legacy/mem_exec.mli deleted file mode 100644 index 9d2637332c564114886e977d00e91876c30444be..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/mem_exec.mli +++ /dev/null @@ -1,68 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** This module memorizes the analysis of entire calls to a function, - so that those analyzes can be reused later on. *) - -(** Counter that must be used each time a new call is analyzed, in order - to refer to it later *) -val new_counter : unit -> int - -(** Subtype of {!Value_types.call_res} *) -module ValueOutputs: Datatype.S with type t = - (Cvalue.V_Offsetmap.t option * Cvalue.Model.t) list (** states *) * - Base.SetLattice.t (** clobbered set for local variables *) - - -(** [store_computed_call (kf, ki) init_state actuals outputs] memoizes the fact - that calling [kf] at statement [ki], with initial state [init_state] - and arguments [actuals] resulted in the states [outputs]; the expressions - in the actuals are not used. Those information are intended to be reused - in subsequent calls *) -val store_computed_call : - Value_types.call_site -> - Cvalue.Model.t -> - (Cil_types.exp * Cvalue.Model.offsetmap) list -> - Value_types.call_result -> - unit - -(** [reuse_previous_call (kf, ki) init_state] searches amongst the previous - analyzes of [kf] one that matches the initial state [init_state]. If - none is found, [None] is returned. Otherwise, the results of the analysis - are returned, together with the index of the matching call. (This last - information is intended to be used by the plugins that have registered - Value callbacks.) *) -val reuse_previous_call : - Value_types.call_site -> - Cvalue.Model.t -> - (Cil_types.exp * Cvalue.Model.offsetmap) list -> - (Value_types.call_result * int) option - -(** Clean all previously stored results *) -val cleanup_results: unit -> unit - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/state_imp.ml b/src/plugins/value/legacy/state_imp.ml deleted file mode 100644 index 7c36e02bc7ffc234e4821086d10b559ad4ac319d..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/state_imp.ml +++ /dev/null @@ -1,169 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -module Sindexed = - Hashtbl.Make - (struct - type t = Cvalue.Model.subtree - let hash = Cvalue.Model.hash_subtree - let equal = Cvalue.Model.equal_subtree - end) - -let sentinel = Sindexed.create 1 - -type t = - { mutable t : Cvalue.Model.t Sindexed.t ; - mutable p : Hptmap.prefix ; - mutable o : Cvalue.Model.t list ; - } - -let fold f acc { t = t ; o = o } = - List.fold_left f (Sindexed.fold (fun _k v a -> f a v) t acc) o - -let iter f { t = t ; o = o } = - Sindexed.iter (fun _k v -> f v) t; - List.iter f o - -exception Found - -let empty () = { t = sentinel ; p = Hptmap.sentinel_prefix ; o = [] } - -let is_empty t = t.t == sentinel && t.o = [] - -let exists f s = - try - iter (fun v -> if f v then raise Found) s; - false - with Found -> true - -let length s = List.length s.o + Sindexed.length s.t - -exception Unchanged -let pretty fmt s = - iter - (fun state -> - Format.fprintf fmt "set contains %a@\n" - Cvalue.Model.pretty state) - s - -let add_to_list v s = - if - List.exists - (fun e -> Cvalue.Model.is_included v e) - s - then raise Unchanged; -(* let nl, ns = - filter - (fun e -> not (Cvalue.Model.is_included e v)) - w - in *) - v :: s - -let rec add_exn v s = - if not (Cvalue.Model.is_reachable v) - then raise Unchanged; - if s.t == sentinel - then begin - match s.o with - [ v1 ; v2 ] -> - begin - assert(not (Cvalue.Model.equal v1 v2)); - - try - Cvalue.Model.comp_prefixes v1 v2; - s.o <- add_to_list v s.o - with - Cvalue.Model.Found_prefix (p, subtree1, subtree2) -> -(* - Format.printf "COMP h1 %d@." - (Cvalue.Model.hash_subtree subtree1); - Format.printf "COMP h2 %d@." - (Cvalue.Model.hash_subtree subtree2); -*) - let t = Sindexed.create 13 in - Sindexed.add t subtree1 v1; - Sindexed.add t subtree2 v2; - s.t <- t; - s.p <- p; - s.o <- []; - add_exn v s - end - | _ -> s.o <- add_to_list v s.o - end - else begin - let subtree = Cvalue.Model.find_prefix v s.p in - begin match subtree with - None -> s.o <- add_to_list v s.o - | Some subtree -> - let candidates = Sindexed.find_all s.t subtree in -(* Format.printf "COMP indexed %d %d@." - (List.length candidates) - (List.length s.o); *) - let v_incl = Cvalue.Model.is_included v in - if List.exists v_incl candidates - || List.exists v_incl s.o - then raise Unchanged - else Sindexed.add s.t subtree v - end - end - -let merge_set_return_new set sb = - let f acc (e, trace) = - try - add_exn e sb ; - (e,trace) :: acc - with Unchanged -> - acc - in - let result = State_set.fold f [] set in - State_set.of_list result - - -let add v s = - try - add_exn v s - with Unchanged -> () -;; - -let singleton v = - let r = empty () in - add v r; - r - -let join s = - fold - Cvalue.Model.join - Cvalue.Model.bottom - s - -let fold f acc s = fold (fun acc v -> f v acc) s acc - -let to_list i = Sindexed.fold (fun _k v a -> v :: a) i.t i.o - -let to_set i = - State_set.of_list_forget_history (to_list i) - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/state_set.ml b/src/plugins/value/legacy/state_set.ml deleted file mode 100644 index 022dfae82dcbc87a57f9b9788d8e1a73321532a7..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/state_set.ml +++ /dev/null @@ -1,151 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(* We store model -> trace information as a simple association - list. This suffices because we do not need the find operation. *) -type t = (Cvalue.Model.t * Trace.t) list - -let obviously_terminates = false - -let fold = List.fold_left - -let of_list_forget_history l = List.map (fun v -> (v, Trace.top)) l -let of_list l = l - -let iter = List.iter -let map = List.map - -let empty = [] - -let is_empty t = t = empty - -let exists f = List.exists (fun (v,_) -> f v) - -let length = List.length - -exception Unchanged -let pretty fmt s = - List.iter - (fun (state,_trace) -> - Format.fprintf fmt "set contains %a@\n" - Cvalue.Model.pretty state) - s - -(* TODO: we forget about one trace when doing that. This is not a - problem while traces are being used only for alarms. What should be - done is merging traces, but this cannot be done in the stateset - because of the Unchanged exception; changing this would make the - dataflow propagate the stateset for no reason. So this requires - proper implementation in the state_imp. *) -let add_to_list pair s = - let (v,_) = pair in - if (not (Cvalue.Model.is_reachable v)) - || ((not obviously_terminates) && - (List.exists - (fun (e,_) -> Cvalue.Model.is_included v e) - s)) - then raise Unchanged; - pair :: s - -let add_exn p s = add_to_list p s - -let merge_into sa ~into:sb = - let unchanged = ref true in - let f acc e = - try - let r = add_exn e acc in - unchanged := false; - r - with Unchanged -> - acc - in - let result = List.fold_left f sb sa in - if !unchanged then raise Unchanged; - result - -let merge sa sb = - try merge_into sa ~into:sb - with Unchanged -> sb -;; - -let add p s = - try - add_exn p s - with Unchanged -> s - -let singleton p = add p empty ;; - -let join s = - List.fold_left - (fun (accm,acct) (m,t) -> - Cvalue.Model.join accm m, - Trace.join acct t - ) (Cvalue.Model.bottom, Trace.bottom) - s - -(* Computes a greatest lower bound of two disjoint unions of states. - This computation is not as precise as computing each pairwise - narrow between states, but it avoids a quadratic increase in the number of - computations. *) -let narrow st1 st2 = - let us1, ut1 = join st1 in - let us2, ut2 = join st2 in - let unmerged = - List.map (fun (s1, t1) -> Cvalue.Model.narrow s1 us1, Trace.narrow t1 ut1) st2 @ - List.map (fun (s1, t1) -> Cvalue.Model.narrow s1 us2, Trace.narrow t1 ut2) st1 - in - (* Remove eventual duplicates *) - List.fold_right add unmerged [] - -(* Computes [narrow] with all the state sets in [stl]. - [stl] must not be empty. - Note: defining this function inside State_set avoids list boxing/unboxing. *) -let narrow_list stl = - let s = List.map join stl in - let (snarrow, tnarrow) = - List.fold_left - (fun (acc_s, acc_t) (s, t) -> - Cvalue.Model.narrow s acc_s, Trace.narrow t acc_t - ) (Cvalue.Model.top, Trace.top) s - in - List.fold_left - (fun acc st -> - let narrowed_st = - List.map - (fun (s, t) -> Cvalue.Model.narrow s snarrow, Trace.narrow t tnarrow) - st - in - merge narrowed_st acc) [] stl - -let to_list l = List.map fst l - -let reorder l = List.rev l - -let add_statement states s = - List.map (fun (state,trace) -> (state, Trace.add_statement s trace)) states -;; - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/state_set.mli b/src/plugins/value/legacy/state_set.mli deleted file mode 100644 index 981a7bbef46f1ba875344bfa36999a8b5d9db929..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/state_set.mli +++ /dev/null @@ -1,75 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Functional sets of [Cvalue.Model.t], currently implemented as lists - without repetition. *) - -type t - -val pretty : Format.formatter -> t -> unit - -(** Creation *) -val empty : t -val singleton : (Cvalue.Model.t * Trace.t) -> t -val of_list : (Cvalue.Model.t * Trace.t) list -> t - -(* Temporary. *) -val of_list_forget_history : Cvalue.Model.t list -> t - -(** Information *) -val is_empty : t -> bool -val length : t -> int - -(** Adding elements *) -val add : Cvalue.Model.t * Trace.t -> t -> t -exception Unchanged -val merge_into : t -> into:t -> t (** Raise [Unchanged] if the first set was - already included in [into] *) -val merge : t -> t -> t -(** Merge the two sets together. Has a better complexity if the first state - has less elements than the second. *) - -val add_statement: t -> Cil_types.stmt -> t -(** Update the trace of all the states in the stateset. *) - -(** Iterators *) -val fold : ('a -> Cvalue.Model.t * Trace.t -> 'a) -> 'a -> t -> 'a -val iter : (Cvalue.Model.t * Trace.t -> unit) -> t -> unit -val exists : (Cvalue.Model.t -> bool) -> t -> bool -val map: ((Cvalue.Model.t * Trace.t) -> (Cvalue.Model.t * Trace.t)) -> t -> t - -val reorder: t -> t -(** Invert the order in which the states are iterated over *) - -(** Export *) -val join : t -> Cvalue.Model.t * Trace.t -val narrow : t -> t -> t -val narrow_list: t list -> t - -val to_list: t -> Cvalue.Model.t list - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/valarms.ml b/src/plugins/value/legacy/valarms.ml deleted file mode 100644 index c0364d7eb997882b4682d21fbd95d07fb5abd010..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/valarms.ml +++ /dev/null @@ -1,415 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open CilE - -type syntactic_context = - | SyNone - | SyCallResult - | SyBinOp of Cil_types.exp * Cil_types.binop * Cil_types.exp * Cil_types.exp - | SyUnOp of Cil_types.exp - | SyMem of Cil_types.lval - | SyMemLogic of Cil_types.term - | SySep of Cil_types.lval * Cil_types.lval - -(* Printer that shows additional information about temporaries *) -let local_printer: Printer.extensible_printer = object (self) - inherit Printer.extensible_printer () as super - - (* Temporary variables for which we want to print more information *) - val mutable temporaries = Cil_datatype.Varinfo.Set.empty - - method! code_annotation fmt ca = - temporaries <- Cil_datatype.Varinfo.Set.empty; - match ca.annot_content with - | AAssert(_, p) -> - (* ignore the ACSL name *) - Format.fprintf fmt "@[<v>@[assert@ %a;@]" self#predicate_node p.pred_content; - (* print temporary variables information *) - if not (Cil_datatype.Varinfo.Set.is_empty temporaries) then begin - Format.fprintf fmt "@ @[(%t)@]" self#pp_temporaries - end; - Format.fprintf fmt "@]"; - | _ -> assert false - - method private pp_temporaries fmt = - let pp_var fmt vi = - Format.fprintf fmt "%s from@ @[%s@]" vi.vname (Extlib.the vi.vdescr) - in - Pretty_utils.pp_iter Cil_datatype.Varinfo.Set.iter - ~pre:"" ~suf:"" ~sep:",@ " pp_var fmt temporaries - - method! logic_var fmt lvi = - (match lvi.lv_origin with - | None | Some { vdescr = None }-> () - | Some ({ vdescr = Some _ } as vi) -> - temporaries <- Cil_datatype.Varinfo.Set.add vi temporaries - ); - super#logic_var fmt lvi -end - -let pr_annot = local_printer#code_annotation -let emitter = Value_util.emitter - -let current_stmt_tbl = - let s = Stack.create () in - Stack.push Kglobal s; - s - -let start_stmt ki = - Stack.push ki current_stmt_tbl - -let end_stmt () = - try ignore (Stack.pop current_stmt_tbl) - with Stack.Empty -> assert false - -let current_stmt () = - try Stack.top current_stmt_tbl - with Stack.Empty -> assert false - -let syntactic_context = ref SyNone -let set_syntactic_context e = - syntactic_context := e - -let get_syntactic_context () = current_stmt (),!syntactic_context - -let sc_kinstr_loc ki = - match ki with - | Kglobal -> (* can occur in case of obscure bugs (already happened) - with wacky initializers. Module Initial_state of - value analysis correctly positions the loc *) - assert (Cil_datatype.Kinstr.equal Kglobal - (fst (get_syntactic_context ()))); - Cil.CurrentLoc.get () - | Kstmt s -> Cil_datatype.Stmt.loc s - -let do_warn {a_log; a_call} f = - if a_log then f (); - a_call () - -let register_alarm ?kf ?(status=Property_status.Dont_know) e ki a f = - let annot, _is_new = - Alarms.register ~loc:(sc_kinstr_loc ki) ?kf ~status e ki a - in - let k = - Format.kfprintf - (fun _fmt -> Format.flush_str_formatter ()) Format.str_formatter - in - let str = f annot k Value_util.pp_callstack in - Value_messages.new_alarm ki a status annot str -;; - -let warn_pointer_comparison typ warn_mode = - let warn = - match Value_parameters.WarnPointerComparison.get () with - | "all" -> true - | "none" -> false - | "pointer" -> Cil.isPointerType typ - | _ -> assert false - in - if warn then do_warn warn_mode.defined_logic - (fun () -> - let aux ki e1 e2 = - register_alarm emitter ki (Alarms.Pointer_comparison (e1, e2)) - (fun annot k -> k "@[pointer comparison.@ %a@]%t" pr_annot annot); - in - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyMem _ | SyMemLogic _ | SySep _ | SyCallResult) -> - assert false - | ki, SyUnOp e -> aux ki None e - | ki, SyBinOp (_, (Eq|Ne|Ge|Le|Gt|Lt), e1, e2) -> aux ki (Some e1) e2 - | _, SyBinOp _ -> - assert false) - -(* warn for division by 0. If [addresses] holds, also emit an alarm about the - denominator not being comparable to \null. This is somewhat a hack, made - mandatory because in the logic we are able to prove [&x + 2 != 0], with [x] - having a non-array type. If we give a True status to such an assertion, - no alarm remains for e.g. [1/((int)(&x +2))] .) *) -let warn_div warn_mode ~addresses = - if addresses then begin - (* Warn for the denominator not being comparable to Null *) - do_warn warn_mode.defined_logic - (fun _ -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyUnOp _ | SyMem _ | SyMemLogic _ | SySep _ | SyCallResult) -> - assert false - | _, (SyBinOp (_, (Div|Mod), _, e) as old_sc) -> - (* Extract the relevant part of the syntactic context *) - set_syntactic_context (SyUnOp e); - warn_pointer_comparison Cil.intType warn_mode; - (* Restore it for the 'denominator-non-null' alarm below. *) - set_syntactic_context old_sc - |_, SyBinOp _ -> assert false - ) - end; - (* Warn for a null denominator *) - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyUnOp _ | SyMem _ | SyMemLogic _ | SySep _ | SyCallResult) -> - assert false - | ki, (SyBinOp (_, (Div|Mod), _, e)) -> - register_alarm emitter ki (Alarms.Division_by_zero e) - (fun annot k -> k "@[division by zero.@ %a@]%t" pr_annot annot) - |_, SyBinOp _ -> assert false) - -let warn_integer_overflow warn_mode ~signed ~min:mn ~max:mx = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | ki, (SyUnOp e | SyBinOp(e, _, _, _)) -> - let signed lower bound = - Extlib.may_map ~dft:() (fun n -> - let kind = if signed then Alarms.Signed else Alarms.Unsigned in - register_alarm emitter ki - (Alarms.Overflow(kind, e, n, lower)) - (fun annot k -> - k "@[%s overflow.@ %a@]%t" - (if signed then "signed" else "unsigned") - pr_annot annot)) bound - in - signed Alarms.Lower_bound mn; - signed Alarms.Upper_bound mx - | _ -> assert false) - -let warn_float_to_int_overflow warn_mode mn mx _msg = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | ki, SyUnOp e -> - let aux lower bound = - Extlib.may_map ~dft:() (fun n -> - register_alarm emitter ki (Alarms.Float_to_int(e, n, lower)) - (fun annot k -> - k "@[overflow@ in conversion@ from@ floating-point@ \ - to integer.@ %a@]%t" pr_annot annot)) bound - in - (aux Alarms.Lower_bound mn); - (aux Alarms.Upper_bound mx) - | _ -> assert false) -;; - -let warn_shift warn_mode size = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyUnOp _ | SyMem _ | SyMemLogic _ | SySep _ | SyCallResult) -> - assert false - | ki,SyBinOp (_, (Shiftrt | Shiftlt),_,exp_d) -> - register_alarm emitter ki - (Alarms.Invalid_shift(exp_d, size)) - (fun annot k -> - k "@[invalid RHS operand for shift.@ %a@]%t" - pr_annot annot) - | _, SyBinOp _ -> - assert false) - -let warn_shift_left_positive warn_mode = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _, (SyUnOp _ | SyMem _ | SyMemLogic _ | SySep _ | SyCallResult) -> - assert false - | ki, SyBinOp (_, (Shiftrt | Shiftlt),exp_l,_) -> - register_alarm emitter ki - (Alarms.Invalid_shift(exp_l, None)) - (fun annot k -> - k "@[invalid LHS operand for left shift.@ %a@]%t" - pr_annot annot) - | _, SyBinOp _ -> - assert false) - -let pretty_warn_mem_mode fmt m = - Format.pp_print_string fmt - (match m with Alarms.For_reading -> "read" | Alarms.For_writing -> "write") - -let warn_mem warn_mode wmm = - do_warn warn_mode.others - (fun () -> - let warn_term ki mk_alarm = - let valid = wmm in - register_alarm emitter ki (mk_alarm valid) - (fun annot k -> - k "@[out of bounds %a.@ %a@]%t" - pretty_warn_mem_mode wmm pr_annot annot) - in - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyBinOp _ | SyUnOp _ | SySep _ | SyCallResult) -> assert false - | ki,SyMem lv_d -> - warn_term ki (fun v -> Alarms.Memory_access(lv_d, v)); - | ki,SyMemLogic term -> - warn_term ki (fun v -> Alarms.Logic_memory_access(term, v))) - -let warn_mem_read warn_mode = warn_mem warn_mode Alarms.For_reading -let warn_mem_write warn_mode = warn_mem warn_mode Alarms.For_writing - -let warn_index warn_mode ~positive ~range:_ = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyMem _ | SyMemLogic _ | SyUnOp _ | SySep _ | SyCallResult) -> - assert false - | ki ,SyBinOp (_, IndexPI, e1, e2) -> - let warn a = - register_alarm emitter ki a - (fun annot k -> - k "@[accessing out of bounds index.@ @[%a@]@]%t" pr_annot annot) - in - if not positive then - warn (Alarms.Index_out_of_bound(e1, None)); - warn (Alarms.Index_out_of_bound(e1, Some e2)) - | _, SyBinOp _ -> - assert false) - -let warn_valid_string warn_mode = - do_warn warn_mode.defined_logic - (fun () -> - let aux ki e = - register_alarm emitter ki (Alarms.Valid_string e) - (fun annot k -> - k "@[may not point to a valid string.@ %a@]%t" pr_annot annot;) - in - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyMemLogic _ | SySep _ | SyCallResult | SyMem _ | SyBinOp _) -> - assert false - | ki, SyUnOp e -> - aux ki e) - -let warn_pointer_subtraction warn_mode = - do_warn warn_mode.defined_logic - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyMem _ | SyMemLogic _ | SySep _ | SyCallResult | SyUnOp _) -> - assert false - | ki, SyBinOp (_, _, e1, e2) -> - register_alarm emitter ki (Alarms.Differing_blocks (e1, e2)) - (fun annot k -> - k "@[pointer subtraction.@ %a@]%t" pr_annot annot)) - - -let warn_nan_infinite warn_mode fkind _pp = - let sfkind = match fkind with - | None -> "real" - | Some FFloat -> "float" - | Some FDouble -> "double" - | Some FLongDouble -> "long double" - in - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyBinOp _ | SyMem _ | SyMemLogic _ | SySep _) -> assert false - | _, SyCallResult -> (* cf. bug 997 *) - Value_messages.warning - "@[non-finite@ %s@ value being@ returned:@ \ - assert(\\is_finite(\\returned_value))@]" sfkind; - | ki,SyUnOp (exp_r) -> - (* Should always be called with a non-none fkind, except in logic - mode (in which case this code is not executed) *) - let fkind = Extlib.the fkind in - register_alarm emitter ki - (Alarms.Is_nan_or_infinite (exp_r, fkind)) - (fun annot k -> k "@[non-finite@ %s@ value.@ %a@]%t" - sfkind pr_annot annot)) - -let warn_uninitialized warn_mode = - do_warn warn_mode.unspecified - (fun () -> - match get_syntactic_context () with - | _, SyNone - | _, (SyBinOp _ | SyUnOp _ | SySep _ | SyMemLogic _) -> assert false - | _, SyCallResult -> - Value_messages.warning - "@[returned value may be uninitialized:@ \ - assert \\initialized(\\returned_value)@]"; - | ki, SyMem lv_d -> - register_alarm emitter ki (Alarms.Uninitialized lv_d) - (fun annot k -> - k "@[accessing uninitialized left-value.@ %a@]%t" - pr_annot annot)) - -let warn_escapingaddr warn_mode = - do_warn warn_mode.unspecified - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyBinOp _ | SyUnOp _ | SySep _ | SyMemLogic _) -> assert false - | _, SyCallResult -> - Value_messages.warning - "@[returned value may be contain escaping addresses:@ \ - assert \\dangling(\\returned_value)@]"; - | ki,SyMem lv_d -> - register_alarm emitter ki (Alarms.Dangling lv_d) - (fun annot k -> - k "@[accessing left-value@ that contains@ escaping@ addresses.\ - @ %a@]%t" pr_annot annot)) - -let warn_separated warn_mode = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyBinOp _ | SyUnOp _ | SyMem _ | SyMemLogic _| SyCallResult) -> - assert false - | ki,SySep(lv1,lv2) -> - register_alarm emitter ki (Alarms.Not_separated(lv1, lv2)) - (fun annot k -> - k "@[undefined multiple accesses in expression.@ %a@]%t" - pr_annot annot)) - -let warn_overlap _msg warn_mode = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyBinOp _ | SyUnOp _ | SyMem _ | SyMemLogic _| SyCallResult) -> - assert false - | ki,SySep(lv1,lv2) -> - register_alarm emitter ki (Alarms.Overlap(lv1, lv2)) - (fun annot k -> - k "@[partially overlapping@ lvalue assignment.@ %a@]%t" - pr_annot annot)) - -let warn_incompatible_fun_pointer ~completely warn_mode = - do_warn warn_mode.others - (fun () -> - match get_syntactic_context () with - | _,SyNone -> () - | _,(SyBinOp _ | SySep _ | SyMem _ | SyMemLogic _| SyCallResult) -> - assert false - | ki,SyUnOp e -> - register_alarm emitter ki (Alarms.Function_pointer e) - (fun annot k -> - k "@[Function@ pointer@ and@ pointed@ function@ have@ %s\ - incompatible@ types.@ %a@]%t" - (if completely then "completely " else "") pr_annot annot)) diff --git a/src/plugins/value/legacy/valarms.mli b/src/plugins/value/legacy/valarms.mli deleted file mode 100644 index 0689a7ad77ebdf773e12c3ef4f52e97afff2dbb1..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/valarms.mli +++ /dev/null @@ -1,88 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open CilE - -(** Emission of alarms. *) - -type syntactic_context = - | SyNone - | SyCallResult - | SyBinOp of Cil_types.exp * Cil_types.binop * Cil_types.exp * Cil_types.exp - | SyUnOp of Cil_types.exp - | SyMem of Cil_types.lval - | SyMemLogic of Cil_types.term - | SySep of Cil_types.lval * Cil_types.lval - -val start_stmt : Cil_types.kinstr -> unit -val end_stmt : unit -> unit -val current_stmt : unit -> Cil_types.kinstr - -val set_syntactic_context : syntactic_context -> unit - -val do_warn: alarm_behavior -> (unit -> unit) -> unit - -val warn_div : warn_mode -> addresses:bool -> unit -(** division. If [addresses] holds, also emit an alarm about the denominator - not being comparable to \null. *) - -val warn_shift : warn_mode -> int option -> unit -(** Warn that the RHS of a shift operator must be positive, and optionally - less than the given size. *) - -val warn_shift_left_positive : warn_mode -> unit -(** Warn that the LHS of the left shift operator must be positive. *) - -val warn_mem_read : warn_mode -> unit -val warn_mem_write : warn_mode -> unit -val warn_integer_overflow : - warn_mode -> signed:bool -> min:Integer.t option -> max:Integer.t option -> unit -val warn_float_to_int_overflow: - warn_mode -> - Integer.t option -> Integer.t option -> (Format.formatter -> unit) -> unit - -val warn_index : warn_mode -> positive:bool -> range:string -> unit -(** [warn_index w ~positive ~range] emits a warning signaling an out of bounds - access. The expression used as index is taken from the syntactic context. - [range] is used to display the inferred values for the index. - If [positive] is true, the generated assertion is of the form - [e < upper_bound]; otherwise, two assertions are generated: [0 <= e] - and [e < upper_bound]. -*) - -val warn_pointer_comparison : Cil_types.typ -> warn_mode -> unit -(** warn on invalid pointer comparison. The first argument is the type - of the arguments of the comparison *) - -val warn_valid_string : warn_mode -> unit -val warn_pointer_subtraction : warn_mode -> unit -val warn_nan_infinite: - warn_mode -> Cil_types.fkind option -> (Format.formatter -> unit) -> unit -val warn_uninitialized : warn_mode -> unit -val warn_escapingaddr : warn_mode -> unit -(** warning to be emitted when two incompatible accesses to a location are - done in unspecified order. Must be called in a [SyNone] or [SySep] context. -*) -val warn_separated : warn_mode -> unit -val warn_overlap : (Format.formatter -> unit) -> warn_mode -> unit - -val warn_incompatible_fun_pointer: completely:bool -> warn_mode -> unit diff --git a/src/plugins/value/legacy/value_messages.ml b/src/plugins/value/legacy/value_messages.ml deleted file mode 100644 index 51cca76f153c9a7eed888442e6fdc8e9e9d0f43d..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/value_messages.ml +++ /dev/null @@ -1,66 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - - - -(* Default behaviour: print one alarm per kinstr. *) -module Alarm_key = Datatype.Pair_with_collections - (Cil_datatype.Kinstr)(Alarms)(struct - let module_name = "Alarm_key" - end);; -module Alarm_cache = State_builder.Hashtbl(Alarm_key.Hashtbl)(Datatype.Unit)(struct - let name = "Value_messages.Alarm_cache" - let dependencies = [Db.Value.self] - let size = 35 -end) - -let loc ki = match ki with - | Cil_types.Kglobal -> (* can occur in case of obscure bugs (already happened) - with wacky initializers. Module Initial_state of - value analysis correctly positions the loc *) - Cil.CurrentLoc.get () - | Cil_types.Kstmt s -> Cil_datatype.Stmt.loc s - -let default_alarm_report ki alarm str = - Alarm_cache.memo (fun (_ki,_alarm) -> - let loc = loc ki in - Value_util.alarm_report ~source:(fst loc) "%s" str - ) (ki,alarm) -;; - -let new_alarm ki alarm _property _annot str = - default_alarm_report ki alarm str - -let warning x = - Format.kfprintf (fun _fmt -> - let str = Format.flush_str_formatter() in - Kernel.warning ~once:true ~current:true "%s" str - ) - Format.str_formatter x -;; - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/warn.ml b/src/plugins/value/legacy/warn.ml deleted file mode 100644 index acbe07ceb42e16137c319fd0aceb90cbed4573ec..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/warn.ml +++ /dev/null @@ -1,468 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -open Cil_types -open Value_util -open Locations - - -(* Literal strings can only be compared if their contents are recognizably - different (or the strings are physically the same). *) -let are_comparable_string pointer1 pointer2 = - try - Locations.Location_Bytes.iter_on_strings ~skip:None - (fun base1 s1 offs1 len1 -> - Locations.Location_Bytes.iter_on_strings ~skip:(Some base1) - (fun _ s2 offs2 len2 -> - let delta = offs1 - offs2 in - let start = if delta <= 0 then -delta else 0 - and max = min len2 (len1 - delta) in - let length = max - start + 1 in - let sub1 = String.sub s1 (start + delta) length - and sub2 = String.sub s2 start length in - if String.compare sub1 sub2 = 0 - then raise Not_found) - pointer1) - pointer2; - true - with - | Not_found -> false - | Invalid_argument _s -> assert false - -(* Under-approximation of the fact that a pointer is actually correct w.r.t. - what can be created through pointer arithmetics. See C99 6.5.6 and 6.5.8 - for the definition of possible pointers, and in particular the definition - of "one past". Value does not currently check that all pointers are - possible, but flags impossible ones using pointer_comparable alarms when - performing a comparison. - - In practice, function pointers are considered possible or one past - when their offset is 0. For object pointers, the offset is checked - against the validity of each base, taking past-one into account. *) -let possible_pointer ~one_past location = - try - let location = loc_bytes_to_loc_bits location in - let is_possible_offset base offs = - if Base.is_function base then - if Ival.is_zero offs then () else raise Base.Not_valid_offset - else - let size = if one_past then Integer.zero else Integer.one in - Base.is_valid_offset ~for_writing:false size base offs - in - match location with - | Location_Bits.Top _ -> false - | Location_Bits.Map m -> - Location_Bits.M.iter is_possible_offset m; - true - with - | Int_Base.Error_Top | Base.Not_valid_offset -> false - -(* Are [ev1] and [ev2] safely comparable, or does their comparison involves - invalid pointers, or is undefined (typically pointers in different bases). *) -let are_comparable op ev1 ev2 = - let open Abstract_interp.Comp in - (* If both of the operands have arithmetic type, the comparison is valid. *) - if Location_Bytes.is_included ev1 Location_Bytes.top_int - && Location_Bytes.is_included ev2 Location_Bytes.top_int - then true - else - let null_1, rest_1 = Location_Bytes.split Base.null ev1 - and null_2, rest_2 = Location_Bytes.split Base.null ev2 in - (* Note that here, rest_1 and rest_2 cannot be both bottom. *) - let is_bottom1 = Location_Bytes.is_bottom rest_1 - and is_bottom2 = Location_Bytes.is_bottom rest_2 in - let arith_compare_ok = - if op = Eq || op = Ne - then - (* A pointer can be compared to a null pointer constant - by equality operators. *) - (Ival.is_included null_1 Ival.zero || is_bottom2) - && (Ival.is_included null_2 Ival.zero || is_bottom1) - else - (* Pointers cannot be compared to arithmetic values by - relational operators. *) - Ival.is_bottom null_1 && Ival.is_bottom null_2 - in - if not arith_compare_ok - then false - else - (* Both pointers have to be almost valid (they can be pointers to one past - an array object. *) - if (not (possible_pointer ~one_past:true rest_1)) || - (not (possible_pointer ~one_past:true rest_2)) - then false - else - (* Equality operators allow the comparison between an almost valid pointer - and the null pointer (other cases where is_bottom1 or is_bottom2 have - been managed by arith_compare_ok). *) - if is_bottom1 || is_bottom2 - then true - else - (* If both pointers point to the same base, the comparison is valid. *) - let single_base_ok = - try - let base_1, _ = Location_Bytes.find_lonely_key rest_1 - and base_2, _ = Location_Bytes.find_lonely_key rest_2 in - Base.equal base_1 base_2 - with Not_found -> false - in - if single_base_ok - then true - else if not (op = Eq || op = Ne) - (* For relational operators, the comparison of pointers on different - bases is undefined. *) - then false - else - (* If both addresses are valid, they can be compared for equality. *) - if (possible_pointer ~one_past:false rest_1) && - (possible_pointer ~one_past:false rest_2) - then - (* But beware of the comparisons of literal strings. *) - are_comparable_string rest_1 rest_2 - else false - - -exception Recursive_call - -(* Check that [kf] is not already present in the call stack *) -let check_no_recursive_call kf = - try - List.iter - (function (g,_) -> - if kf == g - then begin - if Value_parameters.IgnoreRecursiveCalls.get() - then begin - warning_once_current - "@[recursive call@ during@ value@ analysis@ of %a @[(%a <- %a)@].@ \ - Using specification of %a.@]" - Kernel_function.pretty kf Kernel_function.pretty kf - Value_types.Callstack.pretty (call_stack ()) - Kernel_function.pretty kf; - Db.Value.recursive_call_occurred kf; - raise Recursive_call - end - else begin - warning_once_current "@[@[detected@ recursive@ call@ (%a <- %a)@]@;@[Use %s@ to@ ignore@ (beware@ this@ will@ make@ the analysis@ unsound)@]@]" - Kernel_function.pretty kf - Value_types.Callstack.pretty (call_stack ()) - Value_parameters.IgnoreRecursiveCalls.option_name; - raise Db.Value.Aborted - - end - end) - (call_stack ()); - true - with Recursive_call -> false - -(* Warn if [lv] changes during a call [lvret = kf()] *) -let warn_modified_result_loc ~with_alarms kf locret state lvret = - if with_alarms.CilE.others != CilE.a_ignore then - match lvret with - | Var _, NoOffset -> () (* Skip trivially constant l-values *) - | _ -> - (* Go through Db.Value to avoid recursivity between modules *) - let locret' = !Db.Value.lval_to_loc_state state lvret in - if not (Location.equal locret locret') then - (* There might be a false warning if the location is partially - invalid before the call, and is reduced to its valid part - during the call *) - let validlocret = valid_part ~for_writing:true locret in - let validlocret' = valid_part ~for_writing:true locret' in - if not (Location.equal validlocret validlocret') then - let loc = Cil_datatype.Location.unknown in - let exp = Cil.mkAddrOrStartOf ~loc lvret in - Valarms.do_warn with_alarms.CilE.others - (fun () -> - Value_parameters.warning ~current:true ~once:true - "@[possible@ side-effect@ modifying %a@ within@ call@ \ - to %a@]%t" Printer.pp_exp exp Kernel_function.pretty kf - Value_util.pp_callstack; - ) - - -let warn_locals_escape is_block fundec k locals = - let pretty_base = Base.pretty in - let pretty_block fmt = Pretty_utils.pp_cond is_block fmt "a block of " in - let sv = fundec.svar in - match locals with - | Base.SetLattice.Top -> - warning_once_current - "locals escaping the scope of %t%a through %a" - pretty_block - Printer.pp_varinfo sv - pretty_base k - | Base.SetLattice.Set _ -> - warning_once_current - "locals %a escaping the scope of %t%a through %a" - Base.SetLattice.pretty locals - pretty_block - Printer.pp_varinfo sv - pretty_base k - -let warn_locals_escape_result fundec locals = - let sv = fundec.svar in - match locals with - | Base.SetLattice.Top -> - warning_once_current - "locals escaping the scope of %a through \\result" - Printer.pp_varinfo sv - | Base.SetLattice.Set _ -> - warning_once_current - "locals %a escaping the scope of %a through \\result" - Base.SetLattice.pretty locals - Printer.pp_varinfo sv - -let warn_imprecise_lval_read ~with_alarms lv loc contents = - if with_alarms.CilE.imprecision_tracing.CilE.a_log then - let pretty_gm fmt s = - let s = Base.SetLattice.(inject (O.remove Base.null s)) in - Base.SetLattice.pretty fmt s - in - let pretty_param fmt param = - match param with - | Base.SetLattice.Top -> Format.fprintf fmt "is imprecise" - | Base.SetLattice.Set s -> - Format.fprintf fmt "is a garbled mix of %a" pretty_gm s - in - let pretty_param_b fmt param = - match param with - | Base.SetLattice.Top -> - Format.fprintf fmt "The contents@ are imprecise" - | Base.SetLattice.Set s -> - Format.fprintf fmt "It contains@ a garbled@ mix@ of@ %a" pretty_gm s - in - let something_to_warn = - match loc.loc with - | Location_Bits.Top _ -> true - | Location_Bits.Map _ -> - match contents with - | Location_Bytes.Top _ -> true - | Location_Bytes.Map _ -> false - in - if something_to_warn then Valarms.do_warn with_alarms.CilE.imprecision_tracing - (fun () -> - Value_parameters.result ~current:true ~once:true - "@[<v>@[Reading left-value %a.@]@ %t%t%t@]" - Printer.pp_lval lv - (fun fmt -> - match loc.loc with - | Location_Bits.Top (param,o) when Origin.equal o Origin.top -> - Format.fprintf fmt "@[The location %a.@]@ " - pretty_param param - | Location_Bits.Top (param,orig) -> - Format.fprintf fmt "@[The location @[%a@]@ because of@ %a.@]@ " - pretty_param param - Origin.pretty orig - | Location_Bits.Map _ -> - match lv with - | Mem _, _ -> - Format.fprintf fmt "@[The location is @[%a@].@]@ " - Location_Bits.pretty loc.loc - | Var _, _ -> () - ) - (fun fmt -> - match contents with - | Location_Bytes.Top (param,o) when Origin.equal o Origin.top -> - Format.fprintf fmt "@[%a.@]" - pretty_param_b param - | Location_Bytes.Top (param,orig) -> - Format.fprintf fmt "@[%a@ because of@ %a.@]" - pretty_param_b param - Origin.pretty orig - | Location_Bytes.Map _ -> ()) - pp_callstack) - -(* Auxiliary function for [do_assign] below. When computing the - result of [lv = exp], warn if the evaluation of [exp] results in - an imprecision. [loc_lv] is the location pointed to by [lv]. - [exp_val] is the part of the evaluation of [exp] that is imprecise. *) -let warn_right_exp_imprecision ~with_alarms lv loc_lv exp_val = - Valarms.do_warn with_alarms.CilE.imprecision_tracing - (fun () -> - match exp_val with - | Location_Bytes.Top(_topparam,origin) -> - Value_parameters.result ~once:true ~current:true - "@[<v>@[Assigning imprecise value to %a%t.@]%a%t@]" - Printer.pp_lval lv - (fun fmt -> match lv with - | (Mem _, _) -> - Format.fprintf fmt "@ (pointing to %a)" - (Locations.pretty_english ~prefix:false) loc_lv - | (Var _, _) -> ()) - (fun fmt org -> - if not (Origin.is_top origin) then - Format.fprintf fmt - "@ @[The imprecision@ originates@ from@ %a@]" - Origin.pretty org) - origin - pp_callstack - | Location_Bytes.Map _ -> ()) - -(* Auxiliary function for do_assign (currently), that warns when the - left-hand side and the right-hand side of an assignment overlap *) -let warn_overlap ~with_alarms (lv, left_loc) (exp_lv, right_loc) = - let big_enough size = - try Integer.gt size (Integer.of_int (Cil.bitsSizeOf Cil.intType)) - with Cil.SizeOfError _ -> true - in - if with_alarms.CilE.others.CilE.a_log then - match right_loc.size with - | Int_Base.Value size when big_enough size -> - if Location_Bits.partially_overlaps size right_loc.loc left_loc.loc - then begin - Valarms.set_syntactic_context (Valarms.SySep (lv, exp_lv)); - let msg fmt = - Format.fprintf fmt "@ (%a,@ size %a bits;@ %a,@ size %a bits)" - (Locations.pretty_english ~prefix:false) left_loc - Int_Base.pretty left_loc.Locations.size - (Locations.pretty_english ~prefix:false) right_loc - Int_Base.pretty right_loc.Locations.size - in - Valarms.warn_overlap msg with_alarms; - end - | _ -> () - - -exception Got_imprecise of Cvalue.V.t -let offsetmap_contains_imprecision offs = - try - Cvalue.V_Offsetmap.iter_on_values - (fun v -> - match Cvalue.V_Or_Uninitialized.get_v v with - | Location_Bytes.Map _ -> () - | Location_Bytes.Top _ as v -> raise (Got_imprecise v) - ) offs; - None - with Got_imprecise v -> Some v - -let warn_reduce_indeterminate_offsetmap ~with_alarms typ offsm loc state = - if Cil.isArithmeticOrPointerType typ then ( - let uninit = ref false in - let escaping = ref false in - let res = ref offsm in - let reduce loc = - let size = Int_Base.project loc.size in - let _alarm, state = - Cvalue.Model.paste_offsetmap ~reducing:true ~from:!res - ~dst_loc:loc.loc ~size ~exact:true state - in - state - in - let reduce () = - match loc with - | `NoLoc -> state - | `PreciseLoc ploc -> - if Precise_locs.cardinal_zero_or_one ploc then - let loc = Precise_locs.imprecise_location ploc in - reduce loc - else state - | `Loc loc -> - if Locations.cardinal_zero_or_one loc then reduce loc else state - in - let warn () = - if !uninit then Valarms.warn_uninitialized with_alarms; - if !escaping then Valarms.warn_escapingaddr with_alarms; - in - try - Cvalue.V_Offsetmap.iter - (fun itv (v, size, offs) -> - let open Cvalue.V_Or_Uninitialized in - match v with - | C_init_noesc _ -> () - | C_init_esc v' | C_uninit_esc v' | C_uninit_noesc v' -> - begin match v with - | C_init_esc _ -> escaping := true - | C_uninit_noesc _ -> uninit := true - | C_uninit_esc _ -> escaping := true; uninit := true - | _ -> assert false - end; - if Cvalue.V.is_bottom v' then raise Exit; - res := Cvalue.V_Offsetmap.add itv (C_init_noesc v', size, offs) !res - ) offsm; - warn (); - let state = if !uninit || !escaping then reduce () else state in - `Res (!res, state) - with Exit -> - warn (); - `Bottom - ) else - `Res (offsm, state) - -let maybe_warn_indeterminate ~with_alarms v = - let open Cvalue.V_Or_Uninitialized in - match v with - | C_uninit_esc _ -> - Valarms.warn_uninitialized with_alarms; - Valarms.warn_escapingaddr with_alarms; - true - | C_uninit_noesc _ -> - Valarms.warn_uninitialized with_alarms; - true - | C_init_esc _ -> - Valarms.warn_escapingaddr with_alarms; - true - | C_init_noesc _ -> false - -let maybe_warn_completely_indeterminate ~with_alarms loc vi v = - if Cvalue.V.is_bottom v && not (Cvalue.V_Or_Uninitialized.is_bottom vi) && - with_alarms.CilE.unspecified.CilE.a_log - then - Valarms.do_warn with_alarms.CilE.unspecified - (fun () -> - Kernel.warning ~current:true ~once:true - "completely indeterminate value %a." - (Locations.pretty_english ~prefix:true) loc) - -let warn_float_addr ~with_alarms msg = - Valarms.do_warn with_alarms.CilE.imprecision_tracing - (fun () -> - Value_parameters.result ~once:true ~current:true - "@[float@ value@ contains@ addresses (%t)]%t" - msg Value_util.pp_callstack - ); -;; - -let warn_float ~with_alarms ?(non_finite=false) ?(addr=false) flkind msg = - if addr then warn_float_addr ~with_alarms msg; - if addr || non_finite then - Valarms.warn_nan_infinite with_alarms flkind msg; -;; - -let maybe_warn_div ~with_alarms e = - if Cvalue.V.contains_zero e then - let addresses = - try ignore (Cvalue.V.project_ival e); false - with Cvalue.V.Not_based_on_null -> true - in - Valarms.warn_div with_alarms ~addresses - -let warn_top () = - Value_parameters.abort ~current:true ~once:true - "completely imprecise state during evaluation. Aborting." - - -(* -Local Variables: -compile-command: "make -C ../../../.." -End: -*) diff --git a/src/plugins/value/legacy/warn.mli b/src/plugins/value/legacy/warn.mli deleted file mode 100644 index 89d24e2e7791cb0e72de62b902a570a17a042f19..0000000000000000000000000000000000000000 --- a/src/plugins/value/legacy/warn.mli +++ /dev/null @@ -1,105 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -(** Alarms and imprecision warnings emitted during the analysis. *) - -open Cil_types -open Locations - - -val are_comparable : - Abstract_interp.Comp.t -> Location_Bytes.t -> Location_Bytes.t -> bool - -val check_no_recursive_call: kernel_function -> bool - -(** This function should be used to treat a call [lv = kf(...)]. - [warn_modified_result_loc alarms loc state lv] checks that evaluating [lv] - in [state] results in [location]. If it is not the case, a warning about - a modification of [lv] during the call to [kf] is emitted *) -val warn_modified_result_loc: - with_alarms:CilE.warn_mode -> - kernel_function -> location -> Cvalue.Model.t -> lval -> unit - -val warn_imprecise_lval_read: - with_alarms:CilE.warn_mode -> - lval -> location -> Location_Bytes.t -> unit - -val warn_locals_escape: - bool -> fundec -> Base.t -> Base.SetLattice.t -> unit - -val warn_locals_escape_result: - fundec -> Base.SetLattice.t -> unit - -val warn_right_exp_imprecision: - with_alarms:CilE.warn_mode -> - Cil_types.lval -> Locations.location -> Cvalue.V.t -> unit - -val warn_overlap: - with_alarms:CilE.warn_mode -> - lval * Locations.location -> lval * Locations.location -> unit - -val warn_float: - with_alarms:CilE.warn_mode -> - ?non_finite:bool -> ?addr:bool -> - fkind option -> (Format.formatter -> unit) -> - unit - -val warn_float_addr: - with_alarms:CilE.warn_mode -> (Format.formatter -> unit) -> unit - -(** Returns the first eventual imprecise part contained in an offsetmap *) -val offsetmap_contains_imprecision: - Cvalue.V_Offsetmap.t -> Cvalue.V.t option - -(** If the supplied offsetmap has an arithmetic type and contains indeterminate - bits (uninitialized, or escaping address), raises the corresponding alarm(s) - and returns the reduced offsetmap and state. The location is the original - source of the offsetmap, and is used to reduce [state]. - The syntactic context must have been positioned by the caller. If - some bits are guaranteed to be indeterminate, returns [`Bottom]; this - indicates completely erroneous code. *) -val warn_reduce_indeterminate_offsetmap: - with_alarms:CilE.warn_mode -> - typ -> Cvalue.V_Offsetmap.t -> - [`PreciseLoc of Precise_locs.precise_location | `Loc of location | `NoLoc] -> - Cvalue.Model.t -> - [`Bottom | `Res of Cvalue.V_Offsetmap.t * Cvalue.Model.t] - -val maybe_warn_div: with_alarms:CilE.warn_mode -> Cvalue.V.t -> unit -(** Emit an alarm about a non-null divisor when the supplied value may - contain zero. *) - -val maybe_warn_indeterminate: - with_alarms:CilE.warn_mode -> Cvalue.V_Or_Uninitialized.t -> bool -(** Warn for uninitialized or escaping bits in the value passed - as argument. Returns [true] when an alarm has been raised *) - -val maybe_warn_completely_indeterminate: - with_alarms:CilE.warn_mode -> - Locations.location -> Cvalue.V_Or_Uninitialized.t -> Cvalue.V.t -> unit -(** Print a message about the given location containing a completely - indeterminate value. *) - -val warn_top: unit -> 'a -(** Abort the analysis, signaling that Top has been found. (Should not - actually appear. No operation should produce Top, or those operations - should be abstracted unsoundly.) *) diff --git a/src/plugins/value/register.ml b/src/plugins/value/register.ml index dc10f81b5a9cc0448ea7b69873943f5c437f813e..90045d7c24347897a603730d0e0782454b1b524b 100644 --- a/src/plugins/value/register.ml +++ b/src/plugins/value/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,10 +29,7 @@ let compute () = (* Nothing to recompute when Value has already been computed. This boolean is automatically cleared when an option of Value changes, because they are registered as dependencies on [Db.Value.self] in {!Value_parameters}.*) - if not (Db.Value.is_computed ()) then - if Value_parameters.Eva.get () - then Analysis.force_compute () - else Eval_funs.force_compute () + if not (Db.Value.is_computed ()) then Analysis.force_compute () let _self = Db.register_compute "Value.compute" [ Db.Value.self ] Db.Value.compute compute @@ -126,10 +123,11 @@ let assigns_inputs_to_zone state assigns = try List.fold_left (fun acc t -> - let z = Eval_terms.eval_tlval_as_zone - ~with_alarms:CilE.warn_none_mode - ~for_writing:false env t.it_content in - Zone.join acc z) + let z = + Eval_terms.eval_tlval_as_zone ~alarm_mode:Eval_terms.Ignore + ~for_writing:false env t.it_content + in + Zone.join acc z) acc l with Eval_terms.LogicEvalError e -> @@ -162,15 +160,20 @@ let assigns_outputs_aux ~eval ~bot ~top ~join state ~result assigns = | Writes l -> List.fold_left treat_asgn bot l let assigns_outputs_to_zone = - assigns_outputs_aux - ~eval:(Eval_terms.eval_tlval_as_zone - ~with_alarms:CilE.warn_none_mode ~for_writing:true) + let eval env term = + Eval_terms.eval_tlval_as_zone + ~alarm_mode:Eval_terms.Ignore ~for_writing:true env term + in + assigns_outputs_aux ~eval ~bot:Locations.Zone.bottom ~top:Locations.Zone.top ~join:Locations.Zone.join let assigns_outputs_to_locations = + let eval env term = + Eval_terms.eval_tlval_as_location + ~alarm_mode:Eval_terms.Ignore env term + in assigns_outputs_aux - ~eval:(Eval_terms.eval_tlval_as_location - ~with_alarms:CilE.warn_none_mode) + ~eval ~bot:[] ~top:(Locations.make_loc Locations.Location_Bits.top Int_Base.top) ~join:(fun v l -> v :: l) @@ -178,11 +181,11 @@ let assigns_outputs_to_locations = (* "access" functions before evaluation, registered in Db.Value *) let access_value_of_lval kinstr lv = let state = Db.Value.get_state kinstr in - snd (!Db.Value.eval_lval ~with_alarms:CilE.warn_none_mode None state lv) + snd (!Db.Value.eval_lval None state lv) let access_value_of_expr kinstr e = let state = Db.Value.get_state kinstr in - !Db.Value.eval_expr ~with_alarms:CilE.warn_none_mode state e + !Db.Value.eval_expr state e let access_value_of_location kinstr loc = let state = Db.Value.get_state kinstr in @@ -191,7 +194,7 @@ let access_value_of_location kinstr loc = let find_deps_term_no_transitivity_state state t = try let env = Eval_terms.env_only_here state in - let r = Eval_terms.eval_term ~with_alarms:CilE.warn_none_mode env t in + let r = Eval_terms.eval_term ~alarm_mode:Eval_terms.Ignore env t in r.Eval_terms.ldeps with Eval_terms.LogicEvalError _ -> raise Db.From.Not_lval @@ -288,7 +291,10 @@ and eval_deps_offset state o = match o with | Index (i, o) -> Locations.Zone.join (eval_deps state i) (eval_deps_offset state o) -let eval_expr_with_valuation ~with_alarms deps state expr = +let notify_opt with_alarms alarms = + Extlib.may (fun mode -> Alarmset.notify mode alarms) with_alarms + +let eval_expr_with_valuation ?with_alarms deps state expr= let state = Cvalue_domain.inject state in let deps = match deps with | None -> None @@ -297,7 +303,7 @@ let eval_expr_with_valuation ~with_alarms deps state expr = Some (Locations.Zone.join deps' deps) in let eval, alarms = Eva.evaluate state expr in - Alarmset.notify with_alarms alarms; + notify_opt with_alarms alarms; match eval with | `Bottom -> (Cvalue.Model.bottom, deps, Cvalue.V.bottom), None | `Value (valuation, result) -> @@ -308,15 +314,15 @@ let eval_expr_with_valuation ~with_alarms deps state expr = scheme. *) module Eval = struct - let eval_expr ~with_alarms state expr = + let eval_expr ?with_alarms state expr = let state = Cvalue_domain.inject state in let eval, alarms = Eva.evaluate ~reduction:false state expr in - Alarmset.notify with_alarms alarms; + notify_opt with_alarms alarms; bot_value (eval >>-: snd) - let eval_lval ~with_alarms deps state lval = - let expr = Cil.dummy_exp (Cil_types.Lval lval) in - let res, valuation = eval_expr_with_valuation ~with_alarms deps state expr in + let eval_lval ?with_alarms deps state lval = + let expr = Value_util.lval_to_exp lval in + let res, valuation = eval_expr_with_valuation ?with_alarms deps state expr in let typ = match valuation with | None -> Cil.typeOfLval lval | Some valuation -> match Eva.Valuation.find_loc valuation lval with @@ -326,21 +332,20 @@ module Eval = struct let state, deps, v = res in state, deps, v, typ - let eval_expr_with_deps_state ~with_alarms deps state expr = - fst (eval_expr_with_valuation ~with_alarms deps state expr) + let eval_expr_with_deps_state ?with_alarms deps state expr = + fst (eval_expr_with_valuation ?with_alarms deps state expr) - let reduce_by_cond state cond = + let reduce_by_cond state expr positive = let state = Cvalue_domain.inject state in let eval, _alarms = - Eva.reduce state cond.Eval_exprs.exp cond.Eval_exprs.positive + Eva.reduce state expr positive in bot_state (eval >>-: fun valuation -> Cvalue_domain.project (Transfer.update valuation state)) - let lval_to_precise_loc_deps_state - ~with_alarms ~deps state ~reduce_valid_index:(_:bool) lval = + let lval_to_precise_loc_deps_state ?with_alarms ~deps state ~reduce_valid_index:(_:bool) lval = if not (Cvalue.Model.is_reachable state) then state, deps, Precise_locs.loc_bottom, (Cil.typeOfLval lval) else @@ -354,45 +359,45 @@ module Eval = struct let eval, alarms = Eva.lvaluate ~for_writing:false state lval in - Alarmset.notify with_alarms alarms; + notify_opt with_alarms alarms; match eval with | `Bottom -> Cvalue.Model.bottom, deps, Precise_locs.loc_bottom, (Cil.typeOfLval lval) | `Value (valuation, loc, typ) -> Cvalue_domain.project (Transfer.update valuation state), deps, loc, typ - let lval_to_loc_deps_state ~with_alarms ~deps state ~reduce_valid_index lv = + let lval_to_loc_deps_state ?with_alarms ~deps state ~reduce_valid_index lv = let state, deps, pl, typ = lval_to_precise_loc_deps_state - ~with_alarms ~deps state ~reduce_valid_index lv + ?with_alarms ~deps state ~reduce_valid_index lv in state, deps, Precise_locs.imprecise_location pl, typ - let lval_to_precise_loc_state ~with_alarms state lv = + let lval_to_precise_loc_state ?with_alarms state lv = let state, _, r, typ = lval_to_precise_loc_deps_state - ~with_alarms ~deps:None ~reduce_valid_index:(Kernel.SafeArrays.get ()) + ?with_alarms ~deps:None ~reduce_valid_index:(Kernel.SafeArrays.get ()) state lv in state, r, typ - and lval_to_loc_state ~with_alarms state lv = + and lval_to_loc_state ?with_alarms state lv = let state, _, r, typ = lval_to_loc_deps_state - ~with_alarms ~deps:None ~reduce_valid_index:(Kernel.SafeArrays.get ()) + ?with_alarms ~deps:None ~reduce_valid_index:(Kernel.SafeArrays.get ()) state lv in state, r, typ - let lval_to_precise_loc ~with_alarms state lv = - let _, r, _typ = lval_to_precise_loc_state ~with_alarms state lv in + let lval_to_precise_loc ?with_alarms state lv = + let _, r, _typ = lval_to_precise_loc_state ?with_alarms state lv in r - let lval_to_loc ~with_alarms state lv = - let _, r, _typ = lval_to_loc_state ~with_alarms state lv in + let lval_to_loc ?with_alarms state lv = + let _, r, _typ = lval_to_loc_state ?with_alarms state lv in r - let resolv_func_vinfo ~with_alarms deps state funcexp = + let resolv_func_vinfo ?with_alarms deps state funcexp = let open Cil_types in let state = Cvalue_domain.inject state in let deps = match funcexp.enode with @@ -407,7 +412,7 @@ module Eval = struct | _ -> assert false in let kfs, alarms = Eva.eval_function_exp funcexp state in - Alarmset.notify with_alarms alarms; + notify_opt with_alarms alarms; let kfs = match kfs with | `Bottom -> Kernel_function.Hptset.empty | `Value kfs -> @@ -419,7 +424,6 @@ module Eval = struct end - module type Eval = module type of Eval (* Functions to register in Db.Value that depend on evaluation functions. *) @@ -427,10 +431,10 @@ module Export (Eval : Eval) = struct open Eval - let lval_to_loc_with_deps_state ~with_alarms state ~deps lv = + let lval_to_loc_with_deps_state ?with_alarms state ~deps lv = let _state, deps, r, _ = lval_to_loc_deps_state - ~with_alarms + ?with_alarms ~deps:(Some deps) ~reduce_valid_index:(Kernel.SafeArrays.get ()) state @@ -438,46 +442,35 @@ module Export (Eval : Eval) = struct in Extlib.opt_conv Locations.Zone.bottom deps, r - let lval_to_loc_with_deps kinstr ~with_alarms ~deps lv = - Valarms.start_stmt kinstr; + let lval_to_loc_with_deps kinstr ?with_alarms ~deps lv = let state = Db.Value.noassert_get_state kinstr in - let result = - lval_to_loc_with_deps_state ~with_alarms state ~deps lv in - Valarms.end_stmt (); - result + lval_to_loc_with_deps_state ?with_alarms state ~deps lv - let lval_to_loc_kinstr kinstr ~with_alarms lv = - Valarms.start_stmt kinstr; + let lval_to_loc_kinstr kinstr ?with_alarms lv = let state = Db.Value.noassert_get_state kinstr in - let r = lval_to_loc ~with_alarms state lv in - Valarms.end_stmt (); - r + lval_to_loc ?with_alarms state lv - let lval_to_precise_loc_with_deps_state_alarm ~with_alarms state ~deps lv = + let lval_to_precise_loc_with_deps_state_alarm ?with_alarms state ~deps lv = let _state, deps, ploc, _ = - lval_to_precise_loc_deps_state ~with_alarms + lval_to_precise_loc_deps_state ?with_alarms ~deps ~reduce_valid_index:(Kernel.SafeArrays.get ()) state lv in let deps = Extlib.opt_conv Locations.Zone.bottom deps in deps, ploc let lval_to_precise_loc_with_deps_state = - lval_to_precise_loc_with_deps_state_alarm ~with_alarms:CilE.warn_none_mode + lval_to_precise_loc_with_deps_state_alarm ?with_alarms:None - let lval_to_zone kinstr ~with_alarms lv = - Valarms.start_stmt kinstr; + let lval_to_zone kinstr ?with_alarms lv = let state_to_joined_zone state acc = let _, r = - lval_to_precise_loc_with_deps_state_alarm ~with_alarms state ~deps:None lv + lval_to_precise_loc_with_deps_state_alarm ?with_alarms state ~deps:None lv in let zone = Precise_locs.enumerate_valid_bits ~for_writing:false r in Locations.Zone.join acc zone in - let zone = Db.Value.fold_state_callstack - state_to_joined_zone Locations.Zone.bottom ~after:false kinstr - in - Valarms.end_stmt (); - zone + Db.Value.fold_state_callstack + state_to_joined_zone Locations.Zone.bottom ~after:false kinstr let lval_to_zone_state state lv = let _, r = lval_to_precise_loc_with_deps_state state ~deps:None lv in @@ -495,52 +488,46 @@ module Export (Eval : Eval) = struct deps, zone, exact - let lval_to_offsetmap_aux ~with_alarms state lv = + let lval_to_offsetmap_aux ?with_alarms state lv = let loc = - Locations.valid_part ~for_writing:false (lval_to_loc ~with_alarms state lv) + Locations.valid_part ~for_writing:false + (lval_to_loc ?with_alarms state lv) in match loc.Locations.size with | Int_Base.Top -> None | Int_Base.Value size -> - match snd (Cvalue.Model.copy_offsetmap loc.Locations.loc size state) with - | `Bottom -> None - | `Value m -> Some m + match Cvalue.Model.copy_offsetmap loc.Locations.loc size state with + | `Bottom -> None + | `Value m -> Some m - let lval_to_offsetmap kinstr lv ~with_alarms = - Valarms.start_stmt kinstr; + let lval_to_offsetmap kinstr ?with_alarms lv = let state = Db.Value.noassert_get_state kinstr in - let r = lval_to_offsetmap_aux ~with_alarms state lv in - Valarms.end_stmt (); - r + lval_to_offsetmap_aux ?with_alarms state lv let lval_to_offsetmap_state state lv = - lval_to_offsetmap_aux ~with_alarms:CilE.warn_none_mode state lv + lval_to_offsetmap_aux state lv - let expr_to_kernel_function_state ~with_alarms state ~deps exp = - let r, deps = resolv_func_vinfo ~with_alarms deps state exp in + let expr_to_kernel_function_state ?with_alarms state ~deps exp = + let r, deps = resolv_func_vinfo ?with_alarms deps state exp in Extlib.opt_conv Locations.Zone.bottom deps, r - let expr_to_kernel_function kinstr ~with_alarms ~deps exp = - Valarms.start_stmt kinstr; + let expr_to_kernel_function kinstr ?with_alarms ~deps exp = let state_to_joined_kernel_function state (z_acc, kf_acc) = let z, kf = - expr_to_kernel_function_state ~with_alarms state ~deps exp + expr_to_kernel_function_state ?with_alarms state ~deps exp in Locations.Zone.join z z_acc, Kernel_function.Hptset.union kf kf_acc in - let r = Db.Value.fold_state_callstack - state_to_joined_kernel_function - ((match deps with None -> Locations.Zone.bottom | Some z -> z), - Kernel_function.Hptset.empty) - ~after:false kinstr - in - Valarms.end_stmt (); - r + Db.Value.fold_state_callstack + state_to_joined_kernel_function + ((match deps with None -> Locations.Zone.bottom | Some z -> z), + Kernel_function.Hptset.empty) + ~after:false kinstr let expr_to_kernel_function_state = - expr_to_kernel_function_state ~with_alarms:CilE.warn_none_mode + expr_to_kernel_function_state ?with_alarms:None end @@ -550,24 +537,25 @@ let register (module Eval: Eval) (module Export: Export) = let open Export in Db.Value.eval_expr := Eval.eval_expr; Db.Value.eval_expr_with_state := - (fun ~with_alarms state expr -> + (fun ?with_alarms state expr -> let (s, _, v) = - Eval.eval_expr_with_deps_state ~with_alarms None state expr + Eval.eval_expr_with_deps_state ?with_alarms None state expr in s, v); + Db.Value.reduce_by_cond := Eval.reduce_by_cond; Db.Value.eval_lval := - (fun ~with_alarms deps state lval -> - let _, deps, r, _ = Eval_exprs.eval_lval ~with_alarms deps state lval in + (fun ?with_alarms deps state lval -> + let _, deps, r, _ = Eval.eval_lval ?with_alarms deps state lval in deps, r); Db.Value.lval_to_loc_with_deps := lval_to_loc_with_deps; Db.Value.lval_to_loc_with_deps_state := - lval_to_loc_with_deps_state ~with_alarms:CilE.warn_none_mode; + lval_to_loc_with_deps_state ?with_alarms:None; Db.Value.lval_to_loc := lval_to_loc_kinstr; - Db.Value.lval_to_loc_state := - Eval.lval_to_loc ~with_alarms:CilE.warn_none_mode; + Db.Value.lval_to_loc_state := Eval.lval_to_loc ?with_alarms:None; Db.Value.lval_to_zone_state := lval_to_zone_state; Db.Value.lval_to_zone := lval_to_zone; Db.Value.lval_to_zone_with_deps_state := lval_to_zone_with_deps_state; + Db.Value.lval_to_precise_loc_state := Eval.lval_to_precise_loc_state; Db.Value.lval_to_precise_loc_with_deps_state := lval_to_precise_loc_with_deps_state; Db.Value.lval_to_offsetmap := lval_to_offsetmap; @@ -577,28 +565,12 @@ let register (module Eval: Eval) (module Export: Export) = () -let compute_initial_state eva = - if eva - then - Db.Value.initial_state_only_globals := - Analysis.cvalue_initial_state - else - Db.Value.initial_state_only_globals := fun () -> - if snd (Globals.entry_point ()) - then Initial_state.initial_state_lib_entry () - else Initial_state.initial_state_not_lib_entry () - -let hook_register _old eva = - let eval = - if eva then (module Eval : Eval) - else (module Eval_exprs : Eval) - in - let export = (module Export ((val eval : Eval)) : Export) in - register eval export; - compute_initial_state eva;; +let () = Db.Value.initial_state_only_globals := Analysis.cvalue_initial_state -Value_parameters.Eva.add_set_hook hook_register;; -hook_register () (Value_parameters.Eva.get ());; +let () = + let eval = (module Eval : Eval) in + let export = (module Export ((val eval : Eval)) : Export) in + register eval export;; (* diff --git a/src/plugins/value/register.mli b/src/plugins/value/register.mli index c762650c5de2b6624beacc32b36b61c53b69180c..9a68b882f7aa9a119891c177a5f92d334af916b4 100644 --- a/src/plugins/value/register.mli +++ b/src/plugins/value/register.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/slevel/per_stmt_slevel.ml b/src/plugins/value/slevel/per_stmt_slevel.ml index e47bb56597483afb806d96688cc3dcd3cbe17090..4448de34cc57d872ab17990a7eb141476b312841 100644 --- a/src/plugins/value/slevel/per_stmt_slevel.ml +++ b/src/plugins/value/slevel/per_stmt_slevel.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/slevel/per_stmt_slevel.mli b/src/plugins/value/slevel/per_stmt_slevel.mli index d3cabe587fdbbe29108446492215a2d5e7711111..12219880dabdcf789ec7a16d163c0efa6c690429 100644 --- a/src/plugins/value/slevel/per_stmt_slevel.mli +++ b/src/plugins/value/slevel/per_stmt_slevel.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/slevel/separate.ml b/src/plugins/value/slevel/separate.ml deleted file mode 100644 index 3eca0897c4d78515b6b444756f5faaabfd55bc49..0000000000000000000000000000000000000000 --- a/src/plugins/value/slevel/separate.ml +++ /dev/null @@ -1,92 +0,0 @@ -(**************************************************************************) -(* *) -(* This file is part of Frama-C. *) -(* *) -(* Copyright (C) 2007-2016 *) -(* CEA (Commissariat à l'énergie atomique et aux énergies *) -(* alternatives) *) -(* *) -(* you can redistribute it and/or modify it under the terms of the GNU *) -(* Lesser General Public License as published by the Free Software *) -(* Foundation, version 2.1. *) -(* *) -(* It is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU Lesser General Public License for more details. *) -(* *) -(* See the GNU Lesser General Public License version 2.1 *) -(* for more details (enclosed in the file licenses/LGPLv2.1). *) -(* *) -(**************************************************************************) - -let mask = ref 0 - -let prologue () = - let sep_of = Value_parameters.SeparateStmtOf.get() in - if sep_of <> 0 - then begin - let sep_case = Value_parameters.SeparateStmtWord.get() in - Value_parameters.feedback "Part of a case analysis: %d of 0..%d" - sep_case - sep_of; - assert (sep_of >= 1); - assert (sep_of <= 1073741823); (* should be enough for anyone *) - assert (sep_of land (succ sep_of) = 0); (* pred of power of two *) - assert (sep_case >= 0); - assert (sep_case <= sep_of); - - mask := (succ sep_of) lsr 1; - end - else begin - mask := 0; - end - -let filter_if stmt (th, el as thel) = - if th = Dataflow2.GUnreachable || el = Dataflow2.GUnreachable - then thel - else - let sep = !mask in - if sep <> 0 && - ( Value_parameters.SeparateStmtStart.is_empty() || - (Value_parameters.SeparateStmtStart.exists - (fun s -> stmt.Cil_types.sid = int_of_string s)) ) - then begin - mask := sep lsr 1; - let c = - (Value_parameters.SeparateStmtWord.get()) land sep <> 0 - in - Value_parameters.warning ~current:true - "Statement %d: only propagating for condition %B" - stmt.Cil_types.sid - c; - if c - then - th, Dataflow2.GUnreachable - else - Dataflow2.GUnreachable, el - end - else thel - -let epilogue () = - let sep = !mask in - let word1 = Value_parameters.SeparateStmtWord.get() in - let next = - if sep <> 0 - then begin - let unimportant = sep lor pred sep in - let important = lnot unimportant in - let c = word1 in - let mn = c land important in - let mx = c lor unimportant in - let next = succ mx in - Value_parameters.feedback "This analysis covers cases %d to %d" mn mx; - next - end - else - succ word1 - in - if next <= Value_parameters.SeparateStmtOf.get() - then - Value_parameters.feedback "Next case to cover in sequential order: %d" - next; diff --git a/src/plugins/value/slevel/split_strategy.ml b/src/plugins/value/slevel/split_strategy.ml index f364be5296106409c8cbbbdda14481dfcd58d50f..82699b31fb48645d1dcd8c6df59d89f7e83d5082 100644 --- a/src/plugins/value/slevel/split_strategy.ml +++ b/src/plugins/value/slevel/split_strategy.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/slevel/split_strategy.mli b/src/plugins/value/slevel/split_strategy.mli index aa1dbc8a4d4eb27ca05229c98043930f84c39e1f..10d805c8ce5c43680141f1440d4d3588e7a366dc 100644 --- a/src/plugins/value/slevel/split_strategy.mli +++ b/src/plugins/value/slevel/split_strategy.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/test.sh b/src/plugins/value/test.sh index 9288269a4f856b60926d6ed4ee5ffa00efb88963..8cfbcc5b403c19145934a1d2ddc19d376ed14a56 100755 --- a/src/plugins/value/test.sh +++ b/src/plugins/value/test.sh @@ -7,7 +7,7 @@ export REPORT=$CSMITH while true do $CSMITH/src/csmith --max-expr-complexity 15 --max-pointer-depth 3 --max-funcs 4 --max-array-dim 2 --max-array-len-per-dim 3 --max-struct-fields 12 --max-union-fields 12 --no-volatiles --no-bitfields --no-argc --unions > t$N.c -gcc -C -E -I$CSMITH/runtime -D__FRAMAC $GCC3264 t$N.c -o t$N.i +gcc -C -E -I$CSMITH/runtime -D__FRAMAC__ $GCC3264 t$N.c -o t$N.i gcc $GCC3264 -pipe t$N.i $CSMITH/show_each-$FRAMAC3264.o -o e$N ( ulimit -S -t 1 ; time ./e$N > res$N.exec ) 2> time$N rcexec=$? diff --git a/src/plugins/value/utests b/src/plugins/value/utests index b026b55275aa493778dbc8a80087475a7ea087d7..64f76fee0f18c577024cc8f6eaa0baa7ab396143 100755 --- a/src/plugins/value/utests +++ b/src/plugins/value/utests @@ -3,7 +3,7 @@ export LC_ALL=C TESTS=(float value idct non-free) -CONFIGS=(apron equalities legacy bitwise symblocs gauges) +CONFIGS=(apron equalities bitwise symblocs gauges) for C in ${CONFIGS[@]} do diff --git a/src/plugins/value/utils/backward_formals.ml b/src/plugins/value/utils/backward_formals.ml index 89141e19d51ca5b83e6720d09b636b3cd3dca701..733676263bd76bf8011ffc398d9b4f76416e1191 100644 --- a/src/plugins/value/utils/backward_formals.ml +++ b/src/plugins/value/utils/backward_formals.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/backward_formals.mli b/src/plugins/value/utils/backward_formals.mli index 783801cadef5ea7694ab6b696feb37fa7570e4c2..8faa259a32713920f409a88985671e8632110d35 100644 --- a/src/plugins/value/utils/backward_formals.mli +++ b/src/plugins/value/utils/backward_formals.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/eval_typ.ml b/src/plugins/value/utils/eval_typ.ml index 8aed2cccff125b81b90ab7da5ca2d6016ddaf80a..057fdaf75ac2e2b0fa27dbcb8732467154ecfdd2 100644 --- a/src/plugins/value/utils/eval_typ.ml +++ b/src/plugins/value/utils/eval_typ.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -21,7 +21,6 @@ (**************************************************************************) open Cil_types -open Abstract_interp open Cvalue let is_bitfield typlv = @@ -37,11 +36,6 @@ let bitfield_size_attributes attrs = | [AInt size] -> Some size | _ -> None -let bitfield_size typlv = - match Cil.unrollType typlv with - | TInt (_, attrs) | TEnum (_, attrs) -> bitfield_size_attributes attrs - | _ -> None - let sizeof_lval_typ typlv = match Cil.unrollType typlv with | TInt (_, attrs) | TEnum (_, attrs) as t -> @@ -50,33 +44,6 @@ let sizeof_lval_typ typlv = | _ -> Bit_utils.sizeof t) | t -> Bit_utils.sizeof t -(* TODO: this should probably be also put directly in reinterpret_int *) -let cast_lval_if_bitfield typlv size v = - match size with - | Int_Base.Top -> v (* Bitfields have known sizes *) - | Int_Base.Value size -> - if is_bitfield typlv then begin - try - ignore (V.project_ival_bottom v); - let signed = Bit_utils.is_signed_int_enum_pointer typlv in - let v, _ok = Cvalue.V.cast ~size ~signed v in - v (* TODO: handle not ok case as a downcast *) - with - | V.Not_based_on_null (* from [project_ival] *) -> - (* [v] is a pointer: check there are enough bits in - the bit-field to contain it. *) - if Int.ge size (Int.of_int (Bit_utils.sizeofpointer ())) || - V.is_imprecise v - then v - else begin - Value_parameters.result - "casting address to a bit-field of %s bits: \ - this is smaller than sizeof(void*)" (Int.to_string size); - V.topify_arith_origin v - end - end - else v - let offsetmap_matches_type typ_lv o = let aux typ_matches = match V_Offsetmap.single_interval_value o with | None -> true (* multiple bindings. Assume that type matches *) @@ -106,16 +73,12 @@ type fct_pointer_compatibility = | Incompatible_but_accepted let compatible_functions ~typ_pointed ~typ_fun = - let really_compatible t1 t2 = - try ignore (Cabs2cil.compatibleTypes t1 t2); true - with Failure _ -> false - in (* our own notion of weak compatibility: - attributes and qualifiers are always ignored - all pointers types are considered compatible - enums and integer types with the same signedness and size are equal *) let weak_compatible t1 t2 = - really_compatible t1 t2 || + Cabs2cil.areCompatibleTypes t1 t2 || match Cil.unrollType t1, Cil.unrollType t2 with | TVoid _, TVoid _ -> true | TPtr _, TPtr _ -> true @@ -128,7 +91,7 @@ let compatible_functions ~typ_pointed ~typ_fun = Cil_datatype.Compinfo.equal ci1 ci2 | _ -> false in - if really_compatible typ_pointed typ_fun then Compatible + if Cabs2cil.areCompatibleTypes typ_pointed typ_fun then Compatible else let continue = match Cil.unrollType typ_pointed, Cil.unrollType typ_fun with | TFun (ret1, args1, var1, _), TFun (ret2, args2, var2, _) -> @@ -177,7 +140,7 @@ let resolve_functions ~typ_pointer v = let acc_init = Kernel_function.Hptset.empty in let kfs = Locations.Location_Bytes.fold_topset_ok aux v acc_init in `Value kfs, !warn - with Locations.Location_Bytes.Error_Top -> `Top, true + with Abstract_interp.Error_Top -> `Top, true let rec expr_contains_volatile expr = diff --git a/src/plugins/value/utils/eval_typ.mli b/src/plugins/value/utils/eval_typ.mli index b5c61c2ad72ac5550042a953263c242f64de7e0d..33a797708e2b71aa9c09cde5af75b4c9bc5c65ac 100644 --- a/src/plugins/value/utils/eval_typ.mli +++ b/src/plugins/value/utils/eval_typ.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -27,13 +27,6 @@ open Cil_types (** Bitfields *) val is_bitfield: typ -> bool -val bitfield_size: typ -> Integer.t option - -val cast_lval_if_bitfield : typ -> Int_Base.t -> Cvalue.V.t -> Cvalue.V.t -(** if needed, cast the given abstract value to the given size. Useful - to handle bitfield. The type given as argument must be the type of - the l-value the abstract value is written into, which is of size [size]. *) - val sizeof_lval_typ: typ -> Int_Base.t (** Size of the type of a lval, taking into account that the lval might have been a bitfield. *) diff --git a/src/plugins/value/utils/library_functions.ml b/src/plugins/value/utils/library_functions.ml index 88584c4a94c5db1ff6ccb7fb741938eaedf28344..0f9681840df635a4851c4867c6126445ac9cd0f7 100644 --- a/src/plugins/value/utils/library_functions.ml +++ b/src/plugins/value/utils/library_functions.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -31,7 +31,7 @@ module Retres = Kernel_function.Make_Table (Datatype.Option(Cil_datatype.Varinfo)) (struct - let name = "retres_variable" + let name = "Value.Library_functions.Retres" let size = 9 let dependencies = [Ast.self] end) @@ -107,7 +107,7 @@ let returned_value kf state = let size_v (* bits *) = try if isVoidType typ then Int.one else Int_Base.project (sizeof typ) - with Int_Base.Error_Top -> + with Abstract_interp.Error_Top -> assert (Cvalue.V.is_isotropic initial_value); Int.one in diff --git a/src/plugins/value/utils/library_functions.mli b/src/plugins/value/utils/library_functions.mli index b068f4a369bc9a481b9aafe37758bee95be33e28..3e73a6551ebd4678768ace8ab60ef6b6ef07e25a 100644 --- a/src/plugins/value/utils/library_functions.mli +++ b/src/plugins/value/utils/library_functions.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/mark_noresults.ml b/src/plugins/value/utils/mark_noresults.ml index f58a6e9b3de7c3ceace0625f03f6282329088854..db5aa97de8859711fe93269dcfea8ddce3e37beb 100644 --- a/src/plugins/value/utils/mark_noresults.ml +++ b/src/plugins/value/utils/mark_noresults.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/state_import.ml b/src/plugins/value/utils/state_import.ml index fe0929cbc672667ca1e1b447a479a0e00c727633..937cb95a3cb6cc1a85f0c2ff517eab122683393b 100644 --- a/src/plugins/value/utils/state_import.ml +++ b/src/plugins/value/utils/state_import.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -61,13 +61,13 @@ let import_varinfo (vi : varinfo) ~importing_value = end else if importing_value then begin (* Variable may be an escaping local value *) - Value_parameters.warning "variable `%a (id %d)' is not global, \ + Value_parameters.warning "variable `%a' is not global, \ possibly an escaping value; ignoring" - Printer.pp_varinfo vi vi.vid; + Printer.pp_varinfo vi; raise Possibly_escaping_value end else - Value_parameters.abort "global not found: `%a' (id %d)" - Printer.pp_varinfo vi vi.vid + Value_parameters.abort "global not found: `%a'" + Printer.pp_varinfo vi let import_validity = function | Base.Empty | Base.Known _ | Base.Unknown _ | Base.Invalid as v -> v @@ -98,12 +98,12 @@ let import_base (base : Base.t) ~importing_value = in let e = Cil.new_exp Cil_datatype.Location.unknown c in Base.of_string_exp e - | Base.Allocated (vi, validity) -> - Value_parameters.feedback ~dkey "recreating allocated base for malloc: `%a'" + | Base.Allocated (vi, deallocation, validity) -> + Value_parameters.feedback ~dkey "recreating allocated base for alloc: `%a'" Printer.pp_varinfo vi; let new_vi = Value_util.create_new_var vi.vname vi.vtype in let validity = import_validity validity in - let new_base = Base.register_allocated_var new_vi validity in + let new_base = Base.register_allocated_var new_vi deallocation validity in Builtins_malloc.register_malloced_base new_base; new_base in @@ -131,7 +131,7 @@ let import_ival (ival : Ival.t) = | Ival.Float _ -> let mn, mx = Ival.min_and_max_float ival in Ival.inject_float_interval (Fval.F.to_float mn) (Fval.F.to_float mx) - | Ival.Top (mn,mx,m,u) -> Ival.inject_top mn mx m u + | Ival.Top (mn,mx,m,u) -> Ival.inject_interval mn mx m u let import_map (m : Cvalue.V.M.t) = let add base ival m = @@ -254,7 +254,8 @@ let load_and_merge_function_state state : Model.t = in let map_with_globals = match merged_globals_state with | Model.Map m -> m - | _ -> assert false + | _ -> Value_parameters.fatal "invalid saved state: %a" + Model.pretty saved_state in let merged_globals_and_locals = Model.fold (fun new_base offsm acc -> @@ -268,7 +269,14 @@ let save_globals_state () : unit = let ret_stmt = Kernel_function.find_return kf in try let ret_state = Db.Value.get_stmt_state ret_stmt in - save_globals_to_file kf ret_state filename + match ret_state with + | Model.Top -> + Value_parameters.abort "cannot save state at return statement of %a \ + (too imprecise)" Kernel_function.pretty kf + | Model.Bottom -> + Value_parameters.abort "cannot save state at return statement of %a \ + (bottom)" Kernel_function.pretty kf + | Model.Map _ -> save_globals_to_file kf ret_state filename with Not_found -> if Value_parameters.LoadFunctionState.is_set () then let (load_kf, _) = Value_parameters.get_LoadFunctionState () in diff --git a/src/plugins/value/utils/state_import.mli b/src/plugins/value/utils/state_import.mli index 9c54f4c838a8bdcc087337762905e35636c198e7..976f042936bd03a4a3ed0958bf66b1d4cd73b50f 100644 --- a/src/plugins/value/utils/state_import.mli +++ b/src/plugins/value/utils/state_import.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/structure.ml b/src/plugins/value/utils/structure.ml index 4126fd94c45eddae2fa4272e5e6eae03ff62059a..af203dfa063e6ce8e39a77ae8c7cfff17919fac2 100644 --- a/src/plugins/value/utils/structure.ml +++ b/src/plugins/value/utils/structure.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/structure.mli b/src/plugins/value/utils/structure.mli index a0a38ae9580659009e47a3f2835aac175c07918d..7139e3770c4e7f011d568c4d0ad2890c19bde738 100644 --- a/src/plugins/value/utils/structure.mli +++ b/src/plugins/value/utils/structure.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/value_perf.ml b/src/plugins/value/utils/value_perf.ml index 3e570d9f81a87219d9dda82f92caa4a6fa9d4be2..69d9ea55ed365caa01ebbcfe7d480423fd08b0c8 100644 --- a/src/plugins/value/utils/value_perf.ml +++ b/src/plugins/value/utils/value_perf.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/value_perf.mli b/src/plugins/value/utils/value_perf.mli index e1e583f37ba96a7f548d5dfbc21be466b5726997..4202aea391cf174d7415f9277a467b0a79b20582 100644 --- a/src/plugins/value/utils/value_perf.mli +++ b/src/plugins/value/utils/value_perf.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/value_results.ml b/src/plugins/value/utils/value_results.ml index f69db2b4996aaab7af37398a2987b1dacfaa19e0..a9e7b5d39d8b422eb18ae37daa86e986fc65611f 100644 --- a/src/plugins/value/utils/value_results.ml +++ b/src/plugins/value/utils/value_results.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,7 +28,7 @@ module Is_Called = Kernel_function.Make_Table (Datatype.Bool) (struct - let name = "is_called" + let name = "Value.Value_results.is_called" let dependencies = [ Db.Value.self ] let size = 17 end) @@ -49,7 +49,7 @@ module Callers = Kernel_function.Make_Table (Kernel_function.Map.Make(Stmt.Set)) (struct - let name = "Callers" + let name = "Value.Value_results.Callers" let dependencies = [ Db.Value.self ] let size = 17 end) @@ -103,24 +103,6 @@ let is_non_terminating_instr stmt = | _, _ -> false -(* {2 Merging results.} *) - -type state_per_stmt = Cvalue.Model.t Cil_datatype.Stmt.Hashtbl.t - -let merge_states_in_db hash_states callstack = - let treat_stmt stmt sum = - Db.Value.update_callstack_table ~after:false stmt callstack sum - in - Stmt.Hashtbl.iter treat_stmt (Lazy.force hash_states) - -(* Merging of 'after statement' states in the global table *) -let merge_after_states_in_db after_full callstack = - Cil_datatype.Stmt.Hashtbl.iter - (fun stmt st -> - Db.Value.update_callstack_table ~after:true stmt callstack st) - (Lazy.force after_full) - - (* {2 Registration.} *) let () = diff --git a/src/plugins/value/utils/value_results.mli b/src/plugins/value/utils/value_results.mli index 30dd74ed2e42fc147a235957fda9bfaa6b040ffe..fad0557a1962fc5ddc11e7b96b11a1d4d641c911 100644 --- a/src/plugins/value/utils/value_results.mli +++ b/src/plugins/value/utils/value_results.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,20 +29,11 @@ open Cil_types val mark_kf_as_called: kernel_function -> unit val add_kf_caller: caller:kernel_function * stmt -> kernel_function -> unit -val partition_terminating_instr: stmt -> Db.Value.callstack list * Db.Value.callstack list -(** Returns the list of terminating callstacks and the list of non-terminating callstacks. - Must be called *only* on statements that are instructions. *) val is_non_terminating_instr: stmt -> bool (** Returns [true] iff there exists executions of the statement that does not always fail/loop (for function calls). Must be called *only* on statements that are instructions. *) -type state_per_stmt = Cvalue.Model.t Cil_datatype.Stmt.Hashtbl.t -val merge_states_in_db: - state_per_stmt Lazy.t -> Db.Value.callstack -> unit -val merge_after_states_in_db: - state_per_stmt Lazy.t -> Db.Value.callstack -> unit - (** {2 Results} *) type results diff --git a/src/plugins/value/utils/value_util.ml b/src/plugins/value/utils/value_util.ml index 05d27127306f6a712d4d68f181f4ba2eb2af5289..c5d8ed41b671d01c572f1ed64b9bedf44af13046 100644 --- a/src/plugins/value/utils/value_util.ml +++ b/src/plugins/value/utils/value_util.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -63,13 +63,6 @@ let get_rounding_mode () = then Fval.Any else Fval.Nearest_Even -let stop_if_stop_at_first_alarm_mode () = - if Stop_at_nth.incr() - then begin - Value_parameters.log "Stopping at nth alarm" ; - raise Db.Value.Aborted - end - (* Assertions emitted during the analysis *) let emitter = @@ -81,47 +74,10 @@ let emitter = let () = Db.Value.emitter := emitter -let warn_all_mode = CilE.warn_all_mode - -let with_alarm_stop_at_first = - let stop = - {warn_all_mode.CilE.others with CilE.a_call = stop_if_stop_at_first_alarm_mode} - in - { - CilE.imprecision_tracing = CilE.a_ignore; - defined_logic = stop; - unspecified = stop; - others = stop; - } - -let with_alarms_raise_exn exn = - let raise_exn () = raise exn in - let stop = { CilE.a_log = false; CilE.a_call = raise_exn } in - { CilE.imprecision_tracing = CilE.a_ignore; - defined_logic = stop; - unspecified = stop; - others = stop; - } - - -let warn_all_quiet_mode () = - if Value_parameters.StopAtNthAlarm.get () <> max_int - then with_alarm_stop_at_first - else - if Value_parameters.verbose_atleast 1 then - warn_all_mode - else - { warn_all_mode with CilE.imprecision_tracing = CilE.a_ignore } - let get_slevel kf = try Value_parameters.SlevelFunction.find kf with Not_found -> Value_parameters.SemanticUnrollingLevel.get () -let set_loc kinstr = - match kinstr with - | Kglobal -> Cil.CurrentLoc.clear () - | Kstmt s -> Cil.CurrentLoc.set (Cil_datatype.Stmt.loc s) - let pretty_actuals fmt actuals = let pp fmt (e,x,_) = Cvalue.V.pretty_typ (Some (Cil.typeOf e)) fmt x in Pretty_utils.pp_flowlist pp fmt actuals @@ -140,19 +96,6 @@ let alarm_report ?(level=1) ?current ?source ?emitwith ?echo ?once ?append = Value_parameters.result ~dkey:Value_parameters.dkey_alarm ?current ?source ?emitwith ?echo ?once ?append ~level -let debug_result kf (last_ret,_,last_clob) = - Value_parameters.debug - "@[RESULT FOR %a <-%a:@\n\\result -> %t@\nClobered set:%a@]" - Kernel_function.pretty kf - Value_types.Callstack.pretty (call_stack ()) - (fun fmt -> - match last_ret with - | None -> () - | Some v -> Cvalue.V_Offsetmap.pretty fmt v) - Base.SetLattice.pretty last_clob - - - module DegenerationPoints = Cil_state_builder.Stmt_hashtbl @@ -187,7 +130,8 @@ let float_kind = function | FLongDouble -> if Cil.theMachine.Cil.theMachine.sizeof_longdouble <> 8 then Value_parameters.error ~once:true - "type long double not implemented. Using double instead"; + "type long double wider than 64 bits not supported.@ \ + Using double instead for the remainder of the analysis."; Fval.Float64 (* Find if a postcondition contains [\result] *) @@ -215,21 +159,6 @@ let postconditions_mention_result spec = Cil.CurrentLoc.set loc; res -let bind_block_locals states b = - (* Bind [vi] in [states] *) - let bind_local_stateset states vi = - let b = Base.of_varinfo vi in - match Cvalue.Default_offsetmap.default_offsetmap b with - | `Bottom -> states - | `Value offsm -> - (* Bind [vi] in [state], and does not modify the trace *) - let bind_local_state (state, trace) = - (Cvalue.Model.add_base b offsm state, trace) - in - State_set.map bind_local_state states - in - List.fold_left bind_local_stateset states b.blocals - let conv_comp op = let module C = Abstract_interp.Comp in match op with @@ -251,59 +180,6 @@ let conv_relation rel = | Rge -> C.Ge | Rgt -> C.Gt -(* Test that two functions types are compatible; used to verify that a call - through a function pointer is ok. In theory, we could only check that - both types are compatible as defined by C99, 6.2.7. However, some industrial - codes do not strictly follow the norm, and we must be more lenient. - Thus, we emit a warning on undefined code, but we also return true - if Value can ignore more or less safely the incompatibleness in the types. *) -let compatible_functions ~with_alarms vi typ_pointer typ_fun = - try - ignore (Cabs2cil.compatibleTypes typ_pointer typ_fun); true - with Failure _ -> - let compatible_sizes t1 t2 = - try Cil.bitsSizeOf t1 = Cil.bitsSizeOf t2 - with Cil.SizeOfError _ -> false - in - let continue = match Cil.unrollType typ_pointer, Cil.unrollType typ_fun with - | TFun (ret1, args1, var1, _), TFun (ret2, args2, var2, _) -> - (* Either both functions are variadic, or none. Otherwise, it - will be too complicated to make the argument match *) - var1 = var2 && - (* Both functions return something of the same size, or nothing*) - (match Cil.unrollType ret1, Cil.unrollType ret2 with - | TVoid _, TVoid _ -> true (* let's avoid relying on the size - of void *) - | TVoid _, _ | _, TVoid _ -> false - | t1, t2 -> compatible_sizes t1 t2 - ) && - (* Argument lists of the same length, with compatible sizes between - the arguments, or unspecified argument lists *) - (match args1, args2 with - | None, None | None, Some _ | Some _, None -> true - | Some lp, Some lf -> - (* See corresponding function fold_left2_best_effort in - Function_args *) - let rec comp lp lf = match lp, lf with - | _, [] -> true (* accept too many arguments passed *) - | [], _ :: _ -> false (* fail on too few arguments *) - | (_, tp, _) :: qp, (_, tf, _) :: qf -> - compatible_sizes tp tf && comp qp qf - in - comp lp lf - ) - | _ -> false - in - if with_alarms.CilE.others.CilE.a_log then - warning_once_current - "@[Function@ pointer@ and@ pointed@ function@ '%a'@ have@ %s\ - incompatible@ types:@ %a@ vs.@ %a.@ assert(function type matches)@]%t" - Printer.pp_varinfo vi - (if continue then "" else "completely ") - Printer.pp_typ typ_pointer Printer.pp_typ typ_fun - pp_callstack; - continue - let loc_dummy_value = let l = { Lexing.dummy_pos with Lexing.pos_fname = "_value_" } in l, l @@ -320,9 +196,66 @@ let zero e = | typ -> Value_parameters.fatal ~current:true "non-scalar type %a" Printer.pp_typ typ +let eq_with_zero positive e = + let op = if positive then Eq else Ne in + let loc = Cil_datatype.Location.unknown in + Cil.new_exp ~loc (BinOp (op, zero e, e, Cil.intType)) + let is_value_zero e = e.eloc == loc_dummy_value + let inv_rel = function + | Gt -> Le + | Lt -> Ge + | Le -> Gt + | Ge -> Lt + | Eq -> Ne + | Ne -> Eq + | _ -> assert false + +(* Transform an expression supposed to be [positive] into an equivalent + one in which the root expression is a comparison operator. *) +let rec normalize_as_cond expr positive = + match expr.enode with + | UnOp (LNot, e, _) -> normalize_as_cond e (not positive) + | BinOp ((Le|Ne|Eq|Gt|Lt|Ge as binop), e1, e2, typ) -> + if positive then + expr + else + let binop = inv_rel binop in + let enode = BinOp (binop, e1, e2, typ) in + Cil.new_exp ~loc:expr.eloc enode + | _ -> + eq_with_zero (not positive) expr + +module PairExpBool = + Datatype.Pair_with_collections(Cil_datatype.Exp)(Datatype.Bool) + (struct let module_name = "Value.Value_util.PairExpBool" end) +module MemoNormalizeAsCond = + State_builder.Hashtbl + (PairExpBool.Hashtbl) + (Cil_datatype.Exp) + (struct + let name = "Value_util.MemoNormalizeAsCond" + let size = 64 + let dependencies = [ Ast.self ] + end) +let normalize_as_cond e pos = + MemoNormalizeAsCond.memo (fun (e, pos) -> normalize_as_cond e pos) (e, pos) + +module MemoLvalToExp = + Cil_state_builder.Lval_hashtbl + (Cil_datatype.Exp) + (struct + let name = "Value_util.MemoLvalToExp" + let size = 64 + let dependencies = [ Ast.self ] + end) + +let lval_to_exp = + MemoLvalToExp.memo + (fun lv -> Cil.new_exp ~loc:Cil_datatype.Location.unknown (Lval lv)) + let dump_garbled_mix () = let l = Cvalue.V.get_garbled_mix () in if l <> [] && Value_parameters.(is_debug_key_enabled dkey_garbled_mix) then @@ -332,30 +265,50 @@ let dump_garbled_mix () = @[<v>%a@]" (Pretty_utils.pp_list ~pre:"" ~suf:"" ~sep:"@ " pp_one) l + +(* Computation of the inputs of an expression. *) let rec zone_of_expr find_loc expr = let rec process expr = match expr.enode with - | Lval lval -> zone_of_lval find_loc lval - | UnOp (_, e, _) | CastE (_, e) | Info (e, _) -> process e - | BinOp (_, e1, e2, _) -> Locations.Zone.join (process e1) (process e2) - | StartOf lv | AddrOf lv -> zone_of_lval find_loc lv - | _ -> Locations.Zone.bottom + | Lval lval -> + (* Dereference of an lvalue. *) + zone_of_lval find_loc lval + | UnOp (_, e, _) | CastE (_, e) | Info (e, _) -> + (* Unary operators. *) + process e + | BinOp (_, e1, e2, _) -> + (* Binary operators. *) + Locations.Zone.join (process e1) (process e2) + | StartOf lv | AddrOf lv -> + (* computation of an address: the inputs of the lvalue whose address + is computed are read to compute said address. *) + indirect_zone_of_lval find_loc lv + | Const _ | SizeOf _ | AlignOf _ | SizeOfStr _ | SizeOfE _ | AlignOfE _ -> + (* static constructs, nothing is read to evaluate them. *) + Locations.Zone.bottom in process expr +(* dereference of an lvalue: first, its address must be computed, + then its contents themselves are read *) and zone_of_lval find_loc lval = let loc = find_loc lval in let zone = Locations.enumerate_bits (Precise_locs.imprecise_location loc) in Locations.Zone.join zone (indirect_zone_of_lval find_loc lval) +(* Computations of the inputs of a lvalue : union of the "host" part and + the offset. *) and indirect_zone_of_lval find_loc (lhost, offset) = (Locations.Zone.join (zone_of_lhost find_loc lhost) (zone_of_offset find_loc offset)) +(* Computation of the inputs of a host. Nothing for a variable, and the + inputs of [e] for a dereference [*e]. *) and zone_of_lhost find_loc = function | Var _ -> Locations.Zone.bottom | Mem e -> zone_of_expr find_loc e +(* Computation of the inputs of an offset. *) and zone_of_offset find_loc = function | NoOffset -> Locations.Zone.bottom | Field (_, o) -> zone_of_offset find_loc o @@ -363,7 +316,6 @@ and zone_of_offset find_loc = function Locations.Zone.join (zone_of_expr find_loc e) (zone_of_offset find_loc o) - (* Local Variables: compile-command: "make -C ../../../.." diff --git a/src/plugins/value/utils/value_util.mli b/src/plugins/value/utils/value_util.mli index e1d3bc04778e00287cefc7a1cb66632720ab1b30..27d1c39e0c5cf8e33b66ba2d1caef6fc02de3735 100644 --- a/src/plugins/value/utils/value_util.mli +++ b/src/plugins/value/utils/value_util.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -45,15 +45,9 @@ val pp_callstack : Format.formatter -> unit (* TODO: Document the rest of this file. *) val get_rounding_mode : unit -> Fval.rounding_mode -val stop_if_stop_at_first_alarm_mode : unit -> unit val emitter : Emitter.t -val warn_all_mode : CilE.warn_mode -val with_alarm_stop_at_first : CilE.warn_mode -val with_alarms_raise_exn : exn -> CilE.warn_mode -val warn_all_quiet_mode : unit -> CilE.warn_mode val get_slevel : Kernel_function.t -> Value_parameters.SlevelFunction.value val warn_indeterminate: Kernel_function.t -> bool -val set_loc : kinstr -> unit val pretty_actuals : Format.formatter -> (Cil_types.exp * Cvalue.V.t * 'b) list -> unit val pretty_current_cfunction_name : Format.formatter -> unit @@ -63,11 +57,6 @@ val warning_once_current : ('a, Format.formatter, unit) format -> 'a option AlarmsWarnings. *) val alarm_report: ?level:int -> 'a Log.pretty_printer -val debug_result : - Kernel_function.t -> - Cvalue.V_Offsetmap.t option * 'a * Base.SetLattice.t -> unit - - (* Statements for which the analysis has degenerated. [true] means that this is the statement on which the degeneration occurred, or a statement above in the callstack *) @@ -92,27 +81,20 @@ val float_kind: Cil_types.fkind -> Fval.float_kind val postconditions_mention_result: Cil_types.funspec -> bool (** Does the post-conditions of this specification mention [\result]? *) -val bind_block_locals: State_set.t -> Cil_types.block -> State_set.t -(** Bind all locals of the block to their default value - (namely UNINITIALIZED) *) - val conv_comp: binop -> Abstract_interp.Comp.t val conv_relation: relation -> Abstract_interp.Comp.t -(* Test that two functions types are compatible; used to verify that a call - through a function pointer is ok. In theory, we could only check that - both types are compatible as defined by C99, 6.2.7. However, some industrial - codes do not strictly follow the norm, and we must be more lenient. - Thus, we emit a warning on undefined code, but we also return true - if Value can ignore more or less safely the incompatibleness in the types. *) -val compatible_functions: - with_alarms:CilE.warn_mode -> varinfo -> typ -> typ -> bool - -val zero: exp -> exp -(** Return a zero constant compatible with the type of the argument *) +val normalize_as_cond: exp -> bool -> exp +(** [normalize_as_cond e positive] returns the expression corresponding to + [e != 0] when [positive] is true, and [e == 0] otherwise. The + resulting expression will always have a comparison operation at its + root. *) val is_value_zero: exp -> bool -(** Return [true] iff the argument has been created by {!zero} *) +(** Return [true] iff the argument has been created by {!normalize_as_cond} *) + +val lval_to_exp: lval -> exp +(** This function is memoized to avoid creating too many expressions *) val dump_garbled_mix: unit -> unit (** print information on the garbled mix created during evaluation *) @@ -131,8 +113,6 @@ val indirect_zone_of_lval: on which the offset and the pointer expression (if any) of an lvalue depend. *) - - (* Local Variables: compile-command: "make -C ../../../.." diff --git a/src/plugins/value/utils/widen.ml b/src/plugins/value/utils/widen.ml index 71e2360ac5a26c0e6aa50913751e2d64e290c19a..1b81db0bc2e18344be1dd07aae11014a8eaada3b 100644 --- a/src/plugins/value/utils/widen.ml +++ b/src/plugins/value/utils/widen.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -414,10 +414,7 @@ module Parsed_Dynamic_Hints = let dynamic_bases_of_lval states e offset = let lv = (Mem e, offset) in List.fold_left (fun acc' state -> - let location = - Eval_exprs.lval_to_loc state - ~with_alarms:CilE.warn_none_mode lv - in + let location = !Db.Value.lval_to_loc_state state lv in Locations.Location_Bits.fold_bases (fun base acc'' -> Base.Hptset.add base acc'') location.Locations.loc acc' diff --git a/src/plugins/value/utils/widen.mli b/src/plugins/value/utils/widen.mli index 95e905dc0ad1878c21fe8b93fb970aa8432cd2a9..d54cbc0b1b9dc913b40385df794cacc2259526d2 100644 --- a/src/plugins/value/utils/widen.mli +++ b/src/plugins/value/utils/widen.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/widen_hints_ext.ml b/src/plugins/value/utils/widen_hints_ext.ml index f3e93d46b2d1c18ff5d7520e2b27b4a745b04600..56f3fb6b806c4ef9c182546deffd81b007101e99 100644 --- a/src/plugins/value/utils/widen_hints_ext.ml +++ b/src/plugins/value/utils/widen_hints_ext.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/utils/widen_hints_ext.mli b/src/plugins/value/utils/widen_hints_ext.mli index 163622813669c5d8282eb7ade0c750a15144f88c..45a8ec2234787380bf74d196433ea805f1bb3704 100644 --- a/src/plugins/value/utils/widen_hints_ext.mli +++ b/src/plugins/value/utils/widen_hints_ext.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,9 +26,6 @@ open Cil_types val dkey: Log.category -(** String used for hints applying to all variables. *) -val all_vars_str : string - type hint_vars = | HintAllVars (* "all" vars: static hint *) | HintVar of varinfo (* static hint *) @@ -46,10 +43,6 @@ type hint_lval = { type t = hint_lval * term list -(** [get_widen_hints_annots s] returns the list terms related to "widen_hints" - annotations in [s]. *) -val get_widen_hints_annots : stmt -> term list list - (** [get_stmt_widen_hint_terms s] returns the list of widen hints associated to [s]. *) val get_stmt_widen_hint_terms : stmt -> t list diff --git a/src/plugins/value/value_parameters.ml b/src/plugins/value/value_parameters.ml index bf0031759ed7734cca4448dc74102ec99471e420..4eb1ec856a729404fa0ad12cc043894a1bcccb93 100644 --- a/src/plugins/value/value_parameters.ml +++ b/src/plugins/value/value_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -34,18 +34,24 @@ let kernel_parameters_correctness = [ Kernel.ConstReadonly.parameter; ] -let parameters_correctness = ref [] -let parameters_tuning = ref [] +let parameters_correctness = ref Typed_parameter.Set.empty +let parameters_tuning = ref Typed_parameter.Set.empty let add_dep p = State_dependency_graph.add_codependencies ~onto:Db.Value.self [State.get p.Typed_parameter.name] let add_correctness_dep p = + if Typed_parameter.Set.mem p !parameters_correctness then + Kernel.abort "adding correctness parameter %a twice" + Typed_parameter.pretty p; add_dep p; - parameters_correctness := p :: !parameters_correctness + parameters_correctness := Typed_parameter.Set.add p !parameters_correctness let add_precision_dep p = + if Typed_parameter.Set.mem p !parameters_tuning then + Kernel.abort "adding tuning parameter %a twice" + Typed_parameter.pretty p; add_dep p; - parameters_tuning := p :: !parameters_tuning + parameters_tuning := Typed_parameter.Set.add p !parameters_tuning let () = List.iter add_correctness_dep kernel_parameters_correctness @@ -54,10 +60,13 @@ let sdkey_final_states = "final-states" let sdkey_alarm = "alarm" let sdkey_garbled_mix = "garbled-mix" (* not activated by default *) let sdkey_pointer_comparison = "pointer-comparison" +let sdkey_cvalue_domain = "d-cvalue" let () = - Plugin.default_msg_keys [sdkey_initial_state; sdkey_final_states; sdkey_alarm] + Plugin.default_msg_keys + [sdkey_initial_state; sdkey_final_states; sdkey_alarm; sdkey_cvalue_domain] + include Plugin.Register (struct let name = "value analysis" @@ -76,14 +85,6 @@ module ForceValues = let output_by_default = true end) -module Eva = - Bool - (struct - let option_name = "-eva" - let help = "Use the new evolved value analysis." - let default = true - end) - let domains = add_group "Abstract Domains" let precision_tuning = add_group "Precision vs. time" let initial_context = add_group "Initial Context" @@ -96,139 +97,141 @@ let malloc = add_group "Dynamic allocation" (* --- Eva domains --- *) (* -------------------------------------------------------------------------- *) -let () = Parameter_customize.set_group domains -module CvalueDomain = - Bool +(* Set of parameters defining the abstractions used in an Eva analysis. *) +let parameters_abstractions = ref Typed_parameter.Set.empty + +(* This functor must be used to create parameters for new domains of Eva. *) +module Domain_Parameter + (X:sig include Parameter_sig.Input val default: bool end) += struct + Parameter_customize.set_group domains; + module Parameter = Bool (X);; + add_precision_dep Parameter.parameter; + parameters_abstractions := + Typed_parameter.Set.add Parameter.parameter !parameters_abstractions; + include Parameter +end + +module CvalueDomain = Domain_Parameter (struct let option_name = "-eva-cvalue-domain" let help = "Use the default domain of eva." let default = true end) -let () = add_precision_dep CvalueDomain.parameter -let () = Parameter_customize.set_group domains -module EqualityDomain = - Bool +module EqualityDomain = Domain_Parameter (struct let option_name = "-eva-equality-domain" let help = "Use the equality domain of eva. Experimental." let default = false end) -let () = add_precision_dep EqualityDomain.parameter -let () = Parameter_customize.set_group domains -module GaugesDomain = - False +module GaugesDomain = Domain_Parameter (struct let option_name = "-eva-gauges-domain" let help = "Use the gauges domain of Eva. Experimental." + let default = false end) -let () = add_precision_dep EqualityDomain.parameter - -let () = Parameter_customize.set_group domains -module EqualityStorage = - Bool - (struct - let option_name = "-eva-equality-storage" - let help = "Stores the states of the equality domain during \ - the analysis." - let default = true - end) -let () = add_precision_dep EqualityStorage.parameter -let () = Parameter_customize.set_group domains -module SymbolicLocsDomain = - False +module SymbolicLocsDomain = Domain_Parameter (struct let option_name = "-eva-symbolic-locations-domain" let help = "Use dedicated domain for symbolic equalities. Experimental." + let default = false end) -let () = add_precision_dep SymbolicLocsDomain.parameter - -let () = Parameter_customize.set_group domains -module SymbolicLocsStorage = - Bool - (struct - let option_name = "-eva-symbolic-locations-storage" - let help = "Stores the states of the symbolic locations domain during \ - the analysis." - let default = true - end) -let () = add_precision_dep SymbolicLocsStorage.parameter let apron_help = "Experimental binding of the numerical domains provided \ by the APRON library: http://apron.cri.ensmp.fr/library \n" -let () = Parameter_customize.set_group domains -module ApronOctagon = - Bool +module ApronOctagon = Domain_Parameter (struct let option_name = "-eva-apron-oct" let help = apron_help ^ "Use the octagon domain of apron." let default = false end) -let () = add_precision_dep ApronOctagon.parameter -let () = Parameter_customize.set_group domains -module ApronBox = - Bool +module ApronBox = Domain_Parameter (struct let option_name = "-eva-apron-box" let help = apron_help ^ "Use the box domain of apron." let default = false end) -let () = add_precision_dep ApronBox.parameter -let () = Parameter_customize.set_group domains -module PolkaLoose = - Bool +module PolkaLoose = Domain_Parameter (struct let option_name = "-eva-polka-loose" let help = apron_help ^ "Use the loose polyhedra domain of apron." let default = false end) -let () = add_precision_dep PolkaLoose.parameter -let () = Parameter_customize.set_group domains -module PolkaStrict = - Bool +module PolkaStrict = Domain_Parameter (struct let option_name = "-eva-polka-strict" let help = apron_help ^ "Use the strict polyhedra domain of apron." let default = false end) -let () = add_precision_dep PolkaStrict.parameter -let () = Parameter_customize.set_group domains -module PolkaEqualities = - Bool +module PolkaEqualities = Domain_Parameter (struct let option_name = "-eva-polka-equalities" let help = apron_help ^ "Use the linear equalities domain of apron." let default = false end) -let () = add_precision_dep PolkaEqualities.parameter -let () = Parameter_customize.set_group domains -module ApronStorage = - Bool +module InoutDomain = Domain_Parameter (struct - let option_name = "-eva-apron-storage" - let help = "Stores the states of the apron domains during the \ - analysis." + let option_name = "-eva-inout-domain" + let help = "Compute inputs and outputs within Eva. Experimental." let default = false end) -let () = add_precision_dep ApronStorage.parameter -let () = Parameter_customize.set_group domains -module BitwiseOffsmDomain = - Bool +module SignDomain = Domain_Parameter + (struct + let option_name = "-eva-sign-domain" + let help = "Use the sign domain of Eva. For demonstration purposes only." + let default = false + end) + +module BitwiseOffsmDomain = Domain_Parameter (struct let option_name = "-eva-bitwise-domain" let help = "Use the bitwise abstractions of eva." let default = false end) -let () = add_precision_dep BitwiseOffsmDomain.parameter + + +let () = Parameter_customize.set_group domains +module EqualityStorage = + Bool + (struct + let option_name = "-eva-equality-storage" + let help = "Stores the states of the equality domain during \ + the analysis." + let default = true + end) +let () = add_precision_dep EqualityStorage.parameter + +let () = Parameter_customize.set_group domains +module SymbolicLocsStorage = + Bool + (struct + let option_name = "-eva-symbolic-locations-storage" + let help = "Stores the states of the symbolic locations domain during \ + the analysis." + let default = true + end) +let () = add_precision_dep SymbolicLocsStorage.parameter + +let () = Parameter_customize.set_group domains +module ApronStorage = + Bool + (struct + let option_name = "-eva-apron-storage" + let help = "Stores the states of the apron domains during the \ + analysis." + let default = true + end) +let () = add_precision_dep ApronStorage.parameter let () = Parameter_customize.set_group domains module BitwiseOffsmStorage = @@ -450,16 +453,6 @@ functions by '=-@all'." let () = add_correctness_dep WarnCopyIndeterminate.parameter let () = WarnCopyIndeterminate.Category.(set_default (all ())) -let () = Parameter_customize.set_group alarms;; -module ShowTrace = - False - (struct - let option_name = "-val-show-trace" - let help = - "Compute and display execution traces together with alarms (experimental)" - end) -let () = ShowTrace.add_update_hook (fun _ b -> Trace.set_compute_trace b) - let () = Parameter_customize.set_group alarms module ReduceOnLogicAlarms = False @@ -470,6 +463,17 @@ module ReduceOnLogicAlarms = end) let () = add_correctness_dep ReduceOnLogicAlarms.parameter +let () = Parameter_customize.set_group alarms +module InitializedLocals = + False + (struct + let option_name = "-val-initialized-locals" + let help = "Local variables enter in scope fully initialized. \ + Only useful for the analysis of programs buggy w.r.t. \ + initialization." + end) +let () = add_correctness_dep InitializedLocals.parameter + (* ------------------------------------------------------------------------- *) (* --- Initial context --- *) (* ------------------------------------------------------------------------- *) @@ -616,7 +620,7 @@ module SlevelMergeAfterLoop = "when set, the different execution paths that originate from the body \ of a loop are merged before entering the next excution. Experimental." end) -let () = add_precision_dep SemanticUnrollingLevel.parameter +let () = add_precision_dep SlevelMergeAfterLoop.parameter let () = Parameter_customize.set_group precision_tuning let () = Parameter_customize.argument_may_be_fundecl () @@ -662,7 +666,11 @@ module SplitGlobalStrategy = State_builder.Ref (Split_strategy) end) let () = SplitReturn.add_set_hook - (fun _ x -> SplitGlobalStrategy.set (Split_strategy.of_string x)) + (fun _ x -> SplitGlobalStrategy.set + (try Split_strategy.of_string x + with Split_strategy.ParseFailure s -> + abort "@[@[incorrect argument for option %s@ (%s).@]" + SplitReturn.name s)) let () = add_precision_dep SplitReturn.parameter let () = Parameter_customize.is_invisible () @@ -717,7 +725,7 @@ let () = add_precision_dep BuiltinsOverrides.parameter let () = Parameter_customize.set_group precision_tuning module BuiltinsAuto = - False + True (struct let option_name = "-val-builtins-auto" let help = "When set, builtins will be used automatically to replace \ @@ -725,6 +733,14 @@ module BuiltinsAuto = end) let () = add_correctness_dep BuiltinsAuto.parameter +let () = Parameter_customize.set_group precision_tuning +module BuiltinsList = + False + (struct + let option_name = "-val-builtins-list" + let help = "Lists the existing builtins, and which functions they \ + are automatically associated to (if any)" + end) let () = Parameter_customize.is_invisible () module Subdivide_float_in_expr = @@ -767,7 +783,7 @@ let () = add_precision_dep UsePrototype.parameter let () = Parameter_customize.set_group precision_tuning module RmAssert = - False + True (struct let option_name = "-remove-redundant-alarms" let help = "after the analysis, try to remove redundant alarms, so that the user needs inspect fewer of them" @@ -806,40 +822,6 @@ let () = add_precision_dep ArrayPrecisionLevel.parameter let () = ArrayPrecisionLevel.add_update_hook (fun _ v -> Offsetmap.set_plevel v) -let () = Parameter_customize.set_group precision_tuning -module SeparateStmtStart = - String_set - (struct - let option_name = "-separate-stmts" - let arg_name = "n1,..,nk" - let help = "" - end) -let () = add_correctness_dep SeparateStmtStart.parameter - -let () = Parameter_customize.set_group precision_tuning -module SeparateStmtWord = - Int - (struct - let option_name = "-separate-n" - let default = 0 - let arg_name = "n" - let help = "" - end) -let () = SeparateStmtWord.set_range ~min:0 ~max:1073741823 -let () = add_correctness_dep SeparateStmtWord.parameter - -let () = Parameter_customize.set_group precision_tuning -module SeparateStmtOf = - Int - (struct - let option_name = "-separate-of" - let default = 0 - let arg_name = "n" - let help = "" - end) -let () = SeparateStmtOf.set_range ~min:0 ~max:1073741823 -let () = add_correctness_dep SeparateStmtOf.parameter - (* Options SaveFunctionState and LoadFunctionState are related and mutually dependent for sanity checking. Also, they depend on BuiltinsOverrides, so they cannot be defined before it. *) @@ -935,7 +917,7 @@ let () = Ast.apply_after_computed (fun _ -> let () = Parameter_customize.set_group messages module ValShowProgress = - True + False (struct let option_name = "-val-show-progress" let help = "Show progression messages during analysis" @@ -950,17 +932,17 @@ module ValShowInitialState = (* deprecated in Silicon *) let help = "[deprecated] Show initial state before analysis starts. \ This option has been replaced by \ - -val-msg-key=[-]initial-state and has no effect anymore." + -value-msg-key=[-]initial-state and has no effect anymore." end) let () = ValShowInitialState.add_set_hook (fun _ new_ -> if new_ then Kernel.warning "@[Option -val-show-initial-state has no effect, \ - it has been replaced by -val-msg-key=initial-state@]" + it has been replaced by -value-msg-key=initial-state@]" else Kernel.warning "@[Option -no-val-show-initial-state has no effect, \ - it has been replaced by -val-msg-key=-initial-state @]" + it has been replaced by -value-msg-key=-initial-state@]" ) let () = Parameter_customize.set_group messages @@ -993,6 +975,7 @@ module ShowSlevel = let arg_name = "n" let help = "Period for showing consumption of the alloted slevel during analysis" end) +let () = ShowSlevel.set_range ~min:1 ~max:max_int let () = Parameter_customize.set_group messages module PrintCallstacks = @@ -1011,6 +994,13 @@ module AlarmsWarnings = warnings" end) +let () = Parameter_customize.set_group alarms +module WarnBuiltinOverride = + True(struct + let option_name = "-val-warn-builtin-override" + let help = "Warn when EVA built-ins will override function definitions" + end) +let () = add_correctness_dep WarnBuiltinOverride.parameter (* ------------------------------------------------------------------------- *) (* --- Interpreter mode --- *) @@ -1050,9 +1040,9 @@ let () = Parameter_customize.set_group interpreter module StopAtNthAlarm = Int(struct let option_name = "-val-stop-at-nth-alarm" - let default = max_int - let arg_name = "n" - let help = "" + let default = max_int + let arg_name = "n" + let help = "Aborts the analysis when the nth alarm is emitted." end) (* -------------------------------------------------------------------------- *) @@ -1164,14 +1154,19 @@ let dkey_final_states = register_category sdkey_final_states let dkey_alarm = register_category sdkey_alarm let dkey_garbled_mix = register_category sdkey_garbled_mix let dkey_pointer_comparison = register_category sdkey_pointer_comparison +let dkey_cvalue_domain = register_category sdkey_cvalue_domain (* -------------------------------------------------------------------------- *) (* --- Freeze parameters. MUST GO LAST --- *) (* -------------------------------------------------------------------------- *) -let parameters_correctness = !parameters_correctness -let parameters_tuning = !parameters_tuning +let parameters_correctness = + Typed_parameter.Set.elements !parameters_correctness +let parameters_tuning = + Typed_parameter.Set.elements !parameters_tuning +let parameters_abstractions = + Typed_parameter.Set.elements !parameters_abstractions diff --git a/src/plugins/value/value_parameters.mli b/src/plugins/value/value_parameters.mli index 61c200ab0a4a4b12ef3c446aa77010b8d25a7b6a..664a3d60987fab219e6524add1729d27d2b6c3ed 100644 --- a/src/plugins/value/value_parameters.mli +++ b/src/plugins/value/value_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -24,8 +24,6 @@ include Plugin.General_services module ForceValues: Parameter_sig.With_output -module Eva: Parameter_sig.Bool - module EnumerateCond: Parameter_sig.Bool module OracleDepth: Parameter_sig.Int module ReductionDepth: Parameter_sig.Int @@ -35,6 +33,8 @@ module EqualityDomain: Parameter_sig.Bool module GaugesDomain: Parameter_sig.Bool module SymbolicLocsDomain: Parameter_sig.Bool module BitwiseOffsmDomain: Parameter_sig.Bool +module InoutDomain: Parameter_sig.Bool +module SignDomain: Parameter_sig.Bool module ApronOctagon: Parameter_sig.Bool module ApronBox: Parameter_sig.Bool @@ -51,10 +51,6 @@ module BitwiseOffsmStorage: Parameter_sig.Bool module AutomaticContextMaxDepth: Parameter_sig.Int module AutomaticContextMaxWidth: Parameter_sig.Int -module SeparateStmtStart: Parameter_sig.String_set -module SeparateStmtWord: Parameter_sig.Int -module SeparateStmtOf: Parameter_sig.Int - module AllRoundingModes: Parameter_sig.Bool module AllRoundingModesConstants: Parameter_sig.Bool @@ -98,6 +94,7 @@ module UndefinedPointerComparisonPropagateAll: Parameter_sig.Bool module WarnPointerComparison: Parameter_sig.String module ReduceOnLogicAlarms: Parameter_sig.Bool +module InitializedLocals: Parameter_sig.Bool module UsePrototype: Parameter_sig.Kernel_function_set @@ -108,6 +105,7 @@ module BuiltinsOverrides: Parameter_sig.Map with type key = Cil_types.kernel_function and type value = string module BuiltinsAuto: Parameter_sig.Bool +module BuiltinsList: Parameter_sig.Bool module SplitReturnFunction: Parameter_sig.Map with type key = Cil_types.kernel_function and type value = Split_strategy.t @@ -120,6 +118,7 @@ module ValPerfFlamegraphs: Parameter_sig.String module ShowSlevel: Parameter_sig.Int module PrintCallstacks: Parameter_sig.Bool module AlarmsWarnings: Parameter_sig.Bool +module WarnBuiltinOverride: Parameter_sig.Bool module MemExecAll: Parameter_sig.Bool @@ -139,6 +138,7 @@ module MallocLevel: Parameter_sig.Int val parameters_correctness: Typed_parameter.t list val parameters_tuning: Typed_parameter.t list +val parameters_abstractions: Typed_parameter.t list (** Debug categories responsible for printing initial and final states of Value. Enabled by default, but can be disabled via the command-line: @@ -155,6 +155,9 @@ val dkey_garbled_mix: Log.category (** Debug category used to print information about invalid pointer comparisons*) val dkey_pointer_comparison: Log.category +(** Debug category used to print the cvalue domain on Frama_C_[dump|show]_each + functions. *) +val dkey_cvalue_domain: Log.category (* Local Variables: diff --git a/src/plugins/value/values/abstract_location.mli b/src/plugins/value/values/abstract_location.mli index 53bf993a47da8681418fcd8dc6188fbf041041c4..343529f0ca3a7a2a2603912ff80f0bf04e1d8de9 100644 --- a/src/plugins/value/values/abstract_location.mli +++ b/src/plugins/value/values/abstract_location.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -33,6 +33,8 @@ module type S = sig type location (** abstract locations *) type offset (** abstract offsets *) + val top: location + val equal_loc: location -> location -> bool val equal_offset: offset -> offset -> bool val pretty_loc: Format.formatter -> location -> unit @@ -47,9 +49,6 @@ module type S = sig val check_non_overlapping: (lval * location) list -> (lval * location) list -> unit evaluated - (** Needed for Evaluation.get_influential_vars *) - val offset_cardinal_zero_or_one: offset -> bool - (** {3 Forward Offset Operations } *) val no_offset : offset diff --git a/src/plugins/value/values/abstract_value.mli b/src/plugins/value/values/abstract_value.mli index 04658f22df67fb3b6d1decb54455fa51b70fc35d..9df31b8a23970eff222277f2574d4357cce7944b 100644 --- a/src/plugins/value/values/abstract_value.mli +++ b/src/plugins/value/values/abstract_value.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,6 +29,9 @@ open Eval module type S = sig include Datatype.S + val pretty_typ: typ option -> t Pretty_utils.formatter + (** Pretty the abstract value assuming it has the type given as argument. *) + (** {3 Lattice Structure} *) val top : t @@ -107,11 +110,22 @@ module type S = sig (** {3 Reinterpret and Cast } *) - (** Read the given value with the given type. Also returns an alarm if the - type is floating-point type, and the value is not representable as - finite float. *) - val reinterpret : exp -> typ -> t -> t evaluated + (** [truncate_integer expr irange t] truncates the abstract value [t] to the + integer range [irange]. Produces overflow alarms if [t] does not already + fit into [irange], attached to the expression [expr]. *) + val truncate_integer: exp -> Eval_typ.integer_range -> t -> t evaluated + (** [rewrap_integer irange t] wraps around the abstract value [t] to fit the + integer range [irange]. Does not produce any alarms. *) + val rewrap_integer: Eval_typ.integer_range -> t -> t + + (** [cast_float expr fkind t] recasts the abstract value [t] resulting from a + floating-point operation to the precision type [fkind]. Produces + is_nan_or_infinite alarms (attached to the expression [expr]) if + necessary. *) + val cast_float: exp -> fkind -> t -> t evaluated + + (** Abstract evaluation of casts operators from [scr_typ] to [dst_typ]. *) val do_promotion : src_typ:typ -> dst_typ: typ -> exp -> t -> t evaluated val resolve_functions : diff --git a/src/plugins/value/values/cvalue_backward.ml b/src/plugins/value/values/cvalue_backward.ml index 2afe70c4c3cd228faad261274941e45ffae072a6..b75b9790b9b171bb770c74eaf3d71e1a7d5ea54f 100644 --- a/src/plugins/value/values/cvalue_backward.ml +++ b/src/plugins/value/values/cvalue_backward.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -118,7 +118,7 @@ let backward_add_float fk ~res_value ~v1 ~v2 pos = else add MinusA v1 res_1ulp in Some (v1', v2') - with V.Not_based_on_null | Ival.Nan_or_infinite -> + with V.Not_based_on_null | Ival.Nan_or_infinite | Fval.Non_finite -> None @@ -181,7 +181,7 @@ let backward_add_ptr typ ~res_value ~v1 ~v2 pos = b in try V.filter_base test v - with V.Error_Top -> v + with Abstract_interp.Error_Top -> v in let v1 = remove_lonely_bases ~other:v2 v1 and v2 = remove_lonely_bases ~other:v1 v2 in @@ -393,9 +393,9 @@ let backward_cast ~src_typ ~dst_typ ~src_val ~dst_val = let ik_dst = ikind dst_typ in let ik_src = ikind src_typ in if Cil.intTypeIncluded ik_src ik_dst (*the cast is statically the identity*) - || downcast_enabled ~ik_src ~ik_dst (* the cast may not be the identity, but - the alarms on downcasts ensure that [src_val] must fit in [dst_typ] *) - || fits_in_ikind ik_dst src_val (* the cast is dynamically the identity*) + || downcast_enabled ~ik_src ~ik_dst (* the cast may not be the identity, but + the alarms on downcasts ensure that [src_val] must fit in [dst_typ] *) + || fits_in_ikind ik_dst src_val (* the cast is dynamically the identity*) then (* in each case, the cast to [dst_typ] is the identity on [src_val]*) Some dst_val diff --git a/src/plugins/value/values/cvalue_backward.mli b/src/plugins/value/values/cvalue_backward.mli index aa5c17ad0d3285d00fc5619ec60c1aecc31769f1..5c5dde5f9aa9159202ee24919be3abbdc7cf5c44 100644 --- a/src/plugins/value/values/cvalue_backward.mli +++ b/src/plugins/value/values/cvalue_backward.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/values/cvalue_forward.ml b/src/plugins/value/values/cvalue_forward.ml index da8205e30caadbf4cd8149319e27d2bfc649f018..14d038f280da163de52a7934e0173ccff5e5d01a 100644 --- a/src/plugins/value/values/cvalue_forward.ml +++ b/src/plugins/value/values/cvalue_forward.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -64,22 +64,15 @@ let are_comparable_string pointer1 pointer2 = when their offset is 0. For object pointers, the offset is checked against the validity of each base, taking past-one into account. *) let possible_pointer ~one_past location = - try - let location = Locations.loc_bytes_to_loc_bits location in - let is_possible_offset base offs = - if Base.is_function base then - if Ival.is_zero offs then () else raise Base.Not_valid_offset - else - let size = if one_past then Integer.zero else Integer.one in - Base.is_valid_offset ~for_writing:false size base offs - in - match location with - | Locations.Location_Bits.Top _ -> false - | Locations.Location_Bits.Map m -> - Locations.Location_Bits.M.iter is_possible_offset m; - true - with - | Int_Base.Error_Top | Base.Not_valid_offset -> false + let location = Locations.loc_bytes_to_loc_bits location in + let is_possible_offset base offs = + if Base.is_function base then + Ival.is_zero offs + else + let size = if one_past then Integer.zero else Integer.one in + Base.is_valid_offset ~for_writing:false size base offs + in + Locations.Location_Bits.for_all is_possible_offset location (* Are [ev1] and [ev2] safely comparable, or does their comparison involves invalid pointers, or is undefined (typically pointers in different bases). *) @@ -186,59 +179,68 @@ let overflow_alarms ~signed ~min:mn ~max:mx expr = let alarms = signed Alarms.Lower_bound mn Alarmset.none in signed Alarms.Upper_bound mx alarms -let handle_overflow ~warn_unsigned expr typ interpreted_e = - match Cil.unrollType typ with - | TInt (kind, _) -> - let signed = Cil.isSigned kind in - let size = Cil.bitsSizeOfInt kind in - let mn, mx = - if signed then - let b = Integer.two_power_of_int (size-1) in - Integer.neg b, Integer.pred b - else - Integer.zero, Integer.pred (Integer.two_power_of_int size) - in - let warn_under, warn_over = - try - let i = V.project_ival interpreted_e in - let imn, imx = Ival.min_and_max i in - let u = match imn with - | Some bound when Integer.ge bound mn -> None - | _ -> Some mn - and o = match imx with - | Some bound when Integer.le bound mx -> None - | _ -> Some mx - in - u, o - with V.Not_based_on_null -> - (* Catch bottom case here: there is no overflow in this case. *) - if V.is_bottom interpreted_e then None, None else Some mn, Some mx +let truncate_integer expr range value = + let signed = range.Eval_typ.i_signed in + let size = range.Eval_typ.i_bits in + let mn, mx = + if signed then + let b = Integer.two_power_of_int (size-1) in + Integer.neg b, Integer.pred b + else + Integer.zero, Integer.pred (Integer.two_power_of_int size) + in + let warn_under, warn_over = + try + let i = V.project_ival value in + let imn, imx = Ival.min_and_max i in + let u = match imn with + | Some bound when Integer.ge bound mn -> None + | _ -> Some mn + and o = match imx with + | Some bound when Integer.le bound mx -> None + | _ -> Some mx + in + u, o + with V.Not_based_on_null -> + (* Catch bottom case here: there is no overflow in this case. *) + if V.is_bottom value then None, None else Some mn, Some mx + in + match warn_under, warn_over with + | None, None -> value, Alarmset.none + | _ -> + let all_values = + Cvalue.V.inject_ival (Ival.inject_range (Some mn) (Some mx)) in - begin match warn_under, warn_over with - | None, None -> interpreted_e, Alarmset.none - | _ -> - if (signed && Kernel.SignedOverflow.get ()) || - (not signed && warn_unsigned && Kernel.UnsignedOverflow.get()) - then - let all_values = - Cvalue.V.inject_ival (Ival.inject_range (Some mn) (Some mx)) - in - let alarms = - overflow_alarms ~signed ~min:warn_under ~max:warn_over expr - in - (* Take care of pointers addresses that may have crept in, - as they may alias with the NULL base *) - if V.is_arithmetic interpreted_e - then V.narrow all_values interpreted_e, alarms - else interpreted_e, alarms - else begin - if signed then - Value_util.warning_once_current - "2's complement assumed for overflow"; - interpreted_e, Alarmset.none - end - end - | _ -> interpreted_e, Alarmset.none + let alarms = overflow_alarms ~signed ~min:warn_under ~max:warn_over expr in + (* Take care of pointers addresses that may have crept in, + as they may alias with the NULL base *) + if V.is_arithmetic value + then V.narrow all_values value, alarms + else value, alarms + +let rewrap_integer range value = + let size = Integer.of_int range.Eval_typ.i_bits in + let v, identity = V.cast ~signed:range.Eval_typ.i_signed ~size value in + if range.Eval_typ.i_signed && not identity then + Value_util.warning_once_current + "2's complement assumed for overflow"; + v + +let unsafe_cast_float fkind v = + match Value_util.float_kind fkind with + | Fval.Float32 -> + let rounding_mode = Value_util.get_rounding_mode () in + Cvalue.V.cast_float ~rounding_mode v + | Fval.Float64 -> Cvalue.V.cast_double v + +let cast_float expr fkind v = + let addresses, overflow, r = unsafe_cast_float fkind v in + let alarms = + if overflow || addresses + then Alarmset.singleton (Alarms.Is_nan_or_infinite (expr, fkind)) + else Alarmset.none + in + r, alarms (* -------------------------------------------------------------------------- @@ -296,7 +298,7 @@ let forward_minus_pp ~context ~typ ev1 ev2 = if Integer.is_one size then minus_offs else Ival.scale_div ~pos:true size minus_offs - with Int_Base.Error_Top -> Ival.top + with Abstract_interp.Error_Top -> Ival.top in if not (Value_parameters.WarnPointerSubstraction.get ()) then (* Generate garbled mix if the two pointers disagree on their base *) @@ -320,7 +322,7 @@ let forward_minus_pp ~context ~typ ev1 ev2 = (* Evaluation of some operations on Cvalue.V. [typ] is the type of [ev1]. The function must behave as if it was acting on unbounded integers *) -let forward_binop_unbounded_integer ~context ~typ ev1 op ev2 = +let forward_binop_int ~context ~logic ~typ ev1 op ev2 = let e1 = context.left_operand and e2 = context.right_operand in match op with | PlusPI @@ -335,11 +337,17 @@ let forward_binop_unbounded_integer ~context ~typ ev1 op ev2 = | Div -> V.div ev1 ev2, division_alarms e2 ev2 | Mult -> return (V.mul ev1 ev2) | Shiftrt -> - let ev2, alarms = reduce_shift_rhs typ e2 ev2 in - V.shift_right ev1 ev2, alarms + if logic + then V.shift_right ev1 ev2, Alarmset.none + else + let ev2, alarms = reduce_shift_rhs typ e2 ev2 in + V.shift_right ev1 ev2, alarms | Shiftlt -> - let ev1, ev2, alarms = reduce_shift_left typ e1 ev1 e2 ev2 in - V.shift_left ev1 ev2, alarms + if logic + then V.shift_left ev1 ev2, Alarmset.none + else + let ev1, ev2, alarms = reduce_shift_left typ e1 ev1 e2 ev2 in + V.shift_left ev1 ev2, alarms | BXor -> return (V.bitwise_xor ev1 ev2) | BOr -> return (V.bitwise_or ev1 ev2) | BAnd -> @@ -359,7 +367,7 @@ let forward_binop_unbounded_integer ~context ~typ ev1 op ev2 = | Eq | Ne | Ge | Le | Gt | Lt -> let op = Value_util.conv_comp op in let ok, reason = are_comparable_reason op ev1 ev2 in - if reason <> `Ok then + if reason <> `Ok && not logic then Value_parameters.result ~current:true ~once:true ~dkey:Value_parameters.dkey_pointer_comparison @@ -376,6 +384,7 @@ let forward_binop_unbounded_integer ~context ~typ ev1 op ev2 = let signed = Bit_utils.is_signed_int_enum_pointer (Cil.unrollType typ) in let r = V.inject_comp_result (V.forward_comp_int ~signed op ev1 ev2) in if not ok && Value_parameters.UndefinedPointerComparisonPropagateAll.get () + && not logic then begin Value_parameters.result ~current:true ~once:true @@ -386,18 +395,6 @@ let forward_binop_unbounded_integer ~context ~typ ev1 op ev2 = end else r, alarms -let forward_binop_int ~context ~typ ev1 op ev2 = - let res, alarms = forward_binop_unbounded_integer ~context ~typ ev1 op ev2 in - match op with - | Shiftlt | Mult | MinusPP | MinusPI | IndexPI | PlusPI - | PlusA | Div | Mod | MinusA -> - let warn_unsigned = op <> Shiftlt in - let res, alarms' = - handle_overflow ~warn_unsigned context.binary_result context.result_typ res - in - res, Alarmset.union alarms alarms' - | _ -> res, alarms - let forward_binop_float round ev1 op ev2 = let conv v = try Ival.project_float (V.project_ival v) @@ -466,16 +463,9 @@ let forward_uneg ~context:{operand} v t = return (V.inject_ival (Ival.neg_int v)) with V.Not_based_on_null -> return (V.topify_arith_origin v) -let forward_unop ~check_overflow ~context typ op value = +let forward_unop ~context typ op value = match op with - | Neg -> - let r, alarms = forward_uneg ~context value typ in - if check_overflow - then - let warn_unsigned = true in - let r, alarms' = handle_overflow ~warn_unsigned context.result typ r in - r, Alarmset.union alarms alarms' - else r, alarms + | Neg -> forward_uneg ~context value typ | BNot -> begin match Cil.unrollType typ with | TInt (ik, _) | TEnum ({ekind=ik}, _) -> @@ -532,21 +522,36 @@ let forward_unop ~check_overflow ~context typ op value = type integer_range = Eval_typ.integer_range = { i_bits: int; i_signed: bool } +(* If these options are enabled, no integer or pointer value can wrap during the + analysis. Therefore, the concretization of the abstract value {{ &x }} is + exactly &x. Otherwise, the integer representation of this address could have + been wrapped around in an integer type (by integer overflow or a downcast), + and we don't known how it is now represented in its C type. For instance, an + address can be negative in a signed type, and thus cannot be safely converted + even into the (unsigned) pointer type. *) +let no_wrapping () = + Kernel.SignedDowncast.get () && Kernel.UnsignedDowncast.get () + && Kernel.SignedOverflow.get () && Kernel.UnsignedOverflow.get () + +(* Depends on machdep *) +let ptr_range () = Eval_typ.ik_range Cil.theMachine.Cil.upointKind + (* Check whether [v] of fits within the range [range]. Returns two [ok] booleans, one for each bound. *) let value_inclusion v range = let i, p = V.split Base.null v in - (* Check pure pointer part: emit an alarm if it is non-empty, and a pointer - would not fit within the destination type. Garbled mix also have an - integer part, which is checked later with the integer part. *) + (* Check whether the pointer part fits within [dst]. *) let ok_ptr_min, ok_ptr_max = if V.is_bottom p then true, true - else - let r_ptr = Eval_typ.ik_range Cil.theMachine.Cil.upointKind in - Eval_typ.range_inclusion r_ptr range + (* If no wrapping is possible and the value [p] is a nearly valid pointer, + then [p] fits within the pointer type [upointKind]. In this case, do not + emit alarms if this type is included in the destination type. *) + else if no_wrapping () && possible_pointer ~one_past:true p + then Eval_typ.range_inclusion (ptr_range ()) range + else false, false in - (* Check whether the integer part fits within [dst] *) + (* Check whether the integer part fits within [dst]. *) let ok_min, ok_max = if Ival.is_bottom i then true, true @@ -619,12 +624,13 @@ let signed_ikind = function | ILong | IULong -> ILong | ILongLong | IULongLong -> ILongLong -let signed_counterpart typ = +let rec signed_counterpart typ = match Cil.unrollType typ with | TInt (ik, attrs) -> TInt (signed_ikind ik, attrs) | TEnum ({ekind = ik} as info, attrs) -> let info = { info with ekind = signed_ikind ik} in TEnum (info, attrs) + | TPtr _ -> signed_counterpart Cil.(theMachine.upointType) | _ -> assert false module MemoDowncastConvertedAlarm = @@ -684,13 +690,6 @@ let reinterpret_int range v = let size = Integer.of_int range.i_bits in fst (V.cast ~signed:range.i_signed ~size v) -let reinterpret_float fkind v = - match Value_util.float_kind fkind with - | Fval.Float32 -> - let rounding_mode = Value_util.get_rounding_mode () in - Cvalue.V.cast_float ~rounding_mode v - | Fval.Float64 -> Cvalue.V.cast_double v - let cast_int exp ~src ~dst v = let effects, v = if @@ -700,7 +699,13 @@ let cast_int exp ~src ~dst v = else cast_effects ~src ~dst v exp, v in match effects with - | Identity -> v, Alarmset.none + | Identity -> + let v = + if V.is_topint v + then reinterpret_int dst v + else reinterpret_int dst v + in + v, Alarmset.none | DowncastWrap -> let size = Integer.of_int dst.i_bits in let v', _ = V.cast ~signed:dst.i_signed ~size v in @@ -711,19 +716,10 @@ let cast_int exp ~src ~dst v = let v_irange = V.inject_ival irange in (V.join v_irange pointer_part), alarms -let cast_float exp fkind v = - let addresses, overflow, r = reinterpret_float fkind v in - let alarms = - if overflow || addresses - then Alarmset.singleton (Alarms.Is_nan_or_infinite (exp, fkind)) - else Alarmset.none - in - r, alarms - let unsafe_reinterpret typ v = match Eval_typ.classify_as_scalar typ with | TSInt ik | TSPtr ik -> reinterpret_int ik v - | TSFloat fk -> let _, _, v = reinterpret_float fk v in v + | TSFloat fk -> let _, _, v = unsafe_cast_float fk v in v | TSNotScalar -> v (* TODO: reinterpret should never raise an alarm. Infinite/NaN should @@ -769,9 +765,9 @@ let do_promotion ~rounding_mode ~src_typ ~dst_typ exp v = match Eval_typ.classify_as_scalar dst_typ, Eval_typ.classify_as_scalar src_typ with - | TSFloat _, (TSInt _ | TSPtr _) -> (* Cannot overflow with 32 bits float *) + | TSFloat fkind, (TSInt _ | TSPtr _) -> (* Cannot overflow with 32 bits float *) let v, _ok = Cvalue.V.cast_int_to_float rounding_mode v in - return v + cast_float exp fkind v | (TSInt dst | TSPtr dst), TSFloat fk -> float_to_int_alarms dst fk exp v @@ -821,7 +817,8 @@ let eval_float_constant exp f fkind fstring = then Alarmset.singleton (Alarms.Is_nan_or_infinite (exp, fkind)) else Alarmset.none in - `Value v, alarms + let v, alarms' = cast_float exp fkind v in + `Value v, Alarmset.union alarms alarms' with Fval.Non_finite -> let alarms = Alarmset.singleton (Alarms.Is_nan_or_infinite (exp, fkind)) in `Bottom, alarms diff --git a/src/plugins/value/values/cvalue_forward.mli b/src/plugins/value/values/cvalue_forward.mli index ad7339c3208615c6d768caff51f234bb469a6eb5..cb66b9ddf1a700e89365f3d79b8004c82a8194be 100644 --- a/src/plugins/value/values/cvalue_forward.mli +++ b/src/plugins/value/values/cvalue_forward.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -29,6 +29,7 @@ val are_comparable: Abstract_interp.Comp.t -> V.t -> V.t -> bool val forward_binop_int: context: Eval.binop_context -> + logic: bool -> typ: typ -> V.t -> binop -> V.t -> V.t * Alarmset.t @@ -42,10 +43,13 @@ val forward_binop_float_alarm: V.t -> binop -> V.t -> V.t * Alarmset.t val forward_unop: - check_overflow:bool -> context: Eval.unop_context -> typ -> unop -> V.t -> V.t * Alarmset.t +val truncate_integer: exp -> Eval_typ.integer_range -> V.t -> V.t * Alarmset.t +val rewrap_integer: Eval_typ.integer_range -> V.t -> V.t +val cast_float: exp -> fkind -> V.t -> V.t * Alarmset.t + val reinterpret: exp -> typ -> V.t -> V.t * Alarmset.t val unsafe_reinterpret: typ -> V.t -> V.t diff --git a/src/plugins/value/values/location_lift.ml b/src/plugins/value/values/location_lift.ml index 86e15edc35241dcaa4cabe8da7ed4c15ae751eb7..aa4d5ae5147fcc2e41c63010a39d58910a99c315 100644 --- a/src/plugins/value/values/location_lift.ml +++ b/src/plugins/value/values/location_lift.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/values/location_lift.mli b/src/plugins/value/values/location_lift.mli index 69fafe38e900cc2bda9f9fbd7e23bb21886ae098..3cf3a2ca05e6028b6e707c2efdd86ed1a82f61e8 100644 --- a/src/plugins/value/values/location_lift.mli +++ b/src/plugins/value/values/location_lift.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/values/main_locations.ml b/src/plugins/value/values/main_locations.ml index 46b4bb0f1665e93026bde9e95514fadf8bac6426..4dc0f2bb4e511eb923597b18952a7470f1decf75 100644 --- a/src/plugins/value/values/main_locations.ml +++ b/src/plugins/value/values/main_locations.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -51,15 +51,11 @@ module PLoc = struct let size loc = Precise_locs.loc_size loc - let offset_cardinal_zero_or_one offset = - try - let ival = match offset with - | Precise off -> Precise_locs.imprecise_offset off - | Imprecise v -> Cvalue.V.project_ival v - in - Ival.cardinal_zero_or_one ival - with - Cvalue.V.Not_based_on_null -> false + let make loc = + let ploc_bits = Precise_locs.inject_location_bits loc.Locations.loc in + Precise_locs.make_precise_loc ploc_bits ~size:loc.Locations.size + + let top = make (Locations.make_loc Locations.Location_Bits.top Int_Base.Top) exception AlwaysOverlap of Alarms.alarm @@ -209,10 +205,7 @@ module PLoc = struct let loc_pr = join_loc value loc_bits in make_precise_loc loc_pr typ_offset - let eval_varinfo varinfo = - let loc = Locations.loc_of_varinfo varinfo in - let loc_bits = Precise_locs.inject_location_bits loc.Locations.loc in - Precise_locs.make_precise_loc loc_bits ~size:loc.Locations.size + let eval_varinfo varinfo = make (Locations.loc_of_varinfo varinfo) let is_valid ~for_writing loc = Locations.is_valid ~for_writing (Precise_locs.imprecise_location loc) diff --git a/src/plugins/value/values/main_locations.mli b/src/plugins/value/values/main_locations.mli index 589b37845d1a7b433d30d53a71eb8b5ef564906a..99fadff6d9d6b47c079fb87b06b4badb6ae77d37 100644 --- a/src/plugins/value/values/main_locations.mli +++ b/src/plugins/value/values/main_locations.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,9 +23,15 @@ (** Main memory locations of EVA: *) (** Abstract locations built over Precise_locs. *) -module PLoc : Abstract_location.Internal - with type value = Cvalue.V.t - and type location = Precise_locs.precise_location +module PLoc : sig + + include Abstract_location.Internal + with type value = Cvalue.V.t + and type location = Precise_locs.precise_location + + val make: Locations.location -> location + +end (** Key for precise locs. *) val ploc_key : PLoc.location Abstract_location.key diff --git a/src/plugins/value/values/main_values.ml b/src/plugins/value/values/main_values.ml index a1b7b0870a84bfb8e236d074fb4a3cc1c64a34e6..9cdd900d818c6101aff82581021a32723ceed225 100644 --- a/src/plugins/value/values/main_values.ml +++ b/src/plugins/value/values/main_values.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -62,8 +62,7 @@ module CVal = struct | CEnum _ -> assert false let forward_unop ~context typ unop value = - let value, alarms = - Cvalue_forward.forward_unop ~check_overflow:true ~context typ unop value in + let value, alarms = Cvalue_forward.forward_unop ~context typ unop value in (* TODO: `Bottom must be in CValue and Cvalue_forward. *) if Cvalue.V.is_bottom value then `Bottom, alarms @@ -76,14 +75,20 @@ module CVal = struct Cvalue_forward.forward_binop_float_alarm (Value_util.get_rounding_mode ()) ~context fkind v1 binop v2 | TInt _ | TPtr _ | _ as typ -> - Cvalue_forward.forward_binop_int ~context ~typ v1 binop v2 + Cvalue_forward.forward_binop_int ~context ~typ ~logic:false v1 binop v2 in if Cvalue.V.is_bottom value then `Bottom, alarms else `Value value, alarms - let reinterpret e t v = - let v, alarms = Cvalue_forward.reinterpret e t v in + let truncate_integer expr range value = + let v, alarms = Cvalue_forward.truncate_integer expr range value in + if Cvalue.V.is_bottom v then `Bottom, alarms else `Value v, alarms + + let rewrap_integer = Cvalue_forward.rewrap_integer + + let cast_float expr fkind value = + let v, alarms = Cvalue_forward.cast_float expr fkind value in if Cvalue.V.is_bottom v then `Bottom, alarms else `Value v, alarms let do_promotion ~src_typ ~dst_typ exp v = @@ -137,9 +142,10 @@ let interval_key = Structure.Key_Value.create_key "interval" module Interval = struct include Datatype.Option (Ival) - let structure = Structure.Key_Value.Leaf interval_key + let pretty_typ _ = pretty + let top = None let is_included a b = match a, b with @@ -171,12 +177,18 @@ module Interval = struct let resolve_functions ~typ_pointer:_ _ = `Top, true - let reinterpret_int_alarms range value = - let size = Integer.of_int range.Eval_typ.i_bits in - let signed = range.Eval_typ.i_signed in - `Value (Some (Ival.cast ~signed ~size ~value)), Alarmset.all (* TODO *) + (* TODO *) + let truncate_integer _expr _range value = `Value value, Alarmset.all + + let rewrap_integer range value = + match value with + | None -> value + | Some value -> + let size = Integer.of_int range.Eval_typ.i_bits in + let signed = range.Eval_typ.i_signed in + Some (Ival.cast ~signed ~size ~value) - let reinterpret_float fkind ival = + let cast_float_aux fkind ival = match Value_util.float_kind fkind with | Fval.Float32 -> let rounding_mode = Value_util.get_rounding_mode () in @@ -188,24 +200,17 @@ module Interval = struct let b', ival = Ival.cast_double ival in b || b', ival - let reinterpret_float_alarms exp fkind v = - let overflow, res = reinterpret_float fkind v in - let alarms = - if overflow - then Alarmset.singleton (Alarms.Is_nan_or_infinite (exp, fkind)) - else Alarmset.none - in - `Value (Some res), alarms - - let reinterpret expr typ = function - | None -> top_eval - | Some ival -> - match Eval_typ.classify_as_scalar typ with - | Eval_typ.TSInt ik | Eval_typ.TSPtr ik -> - reinterpret_int_alarms ik ival - | Eval_typ.TSFloat fk -> - reinterpret_float_alarms expr fk ival - | Eval_typ.TSNotScalar -> `Value None, Alarmset.all + let cast_float exp fkind value = + match value with + | None -> `Value value, Alarmset.all + | Some value -> + let overflow, res = cast_float_aux fkind value in + let alarms = + if overflow + then Alarmset.singleton (Alarms.Is_nan_or_infinite (exp, fkind)) + else Alarmset.none + in + `Value (Some res), alarms let backward_unop ~typ_arg:_ _unop ~arg:_ ~res:_ = `Value None let backward_binop ~input_type:_ ~resulting_type:_ _binop ~left:_ ~right:_ ~result:_ = diff --git a/src/plugins/value/values/main_values.mli b/src/plugins/value/values/main_values.mli index 68150acc82fbfcebf54d0b28af839a0666b3b855..4ebd1f909cec5d264f14c3d97a69330176b19539 100644 --- a/src/plugins/value/values/main_values.mli +++ b/src/plugins/value/values/main_values.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/values/offsm_value.ml b/src/plugins/value/values/offsm_value.ml index 0623353d8f9c4c6b510d41c724517f391934cf25..e88afe7ed2a725999dba035041e6fcdb2caeaea8 100644 --- a/src/plugins/value/values/offsm_value.ml +++ b/src/plugins/value/values/offsm_value.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -63,7 +63,8 @@ let basic_paste ?(start=Int.zero) ~src ~size_src dst = let basic_find ?(start=Int.zero) ~size o = let validity = enough_validity ~start ~size in let offsets = Ival.inject_singleton start in - snd (V_Offsetmap.find ~validity ~offsets ~size o) + let _, v = V_Offsetmap.find ~validity ~offsets ~size o in + V_Or_Uninitialized.map (fun v -> fst (V.cast ~signed:false ~size v)) v (* Paste [v] of size [size] at position [start] in [o] *) let basic_add ?(start=Int.zero) ~size v o = @@ -92,8 +93,8 @@ let read_bit o bit = | false, false (* bottom *) -> `Zero with V.Not_based_on_null -> `ZeroOne -(** Decompose the range [b..e] (inclusive) of [a] into ranges of consecutive - equal bits. Raise [NotConstant] if [o] is not constant on this range. *) +(** Decompose the range [b..e] (inclusive) of [o] into ranges of consecutive + equal bits. *) let explode_range o (b, e) = (* result. only [b..e] will be modified *) let r = ref o in @@ -128,7 +129,7 @@ let explode_range o (b, e) = let explode o = let r = ref o in let aux (e, b) _ = - r := explode_range o (Integer.to_int e, Integer.to_int b) + r := explode_range !r (Integer.to_int e, Integer.to_int b) in V_Offsetmap.iter aux o; List.rev (V_Offsetmap.fold (fun r v acc -> (r, v) :: acc) !r []) @@ -388,6 +389,12 @@ module Offsm : Abstract_value.Internal with type t = offsm_or_top = struct let structure = Structure.Key_Value.Leaf offsm_key + let pretty_typ typ fmt = function + | Top as o -> pretty fmt o + | O o -> + Format.fprintf fmt "O @[%a@]" + (V_Offsetmap.pretty_generic ?typ ()) o + let top = Top let is_included o1 o2 = match o1, o2 with @@ -402,7 +409,7 @@ module Offsm : Abstract_value.Internal with type t = offsm_or_top = struct let narrow o1 o2 = match o1, o2 with | Top, o | o, Top -> `Value o | O o1, O o2 -> - V_Offsetmap.narrow o1 o2 >>-: (fun o -> O o) + V_Offsetmap.narrow_reinterpret o1 o2 >>-: (fun o -> O o) (* Simple values cannot be injected because we do not known their type (hence size in bits *) @@ -465,7 +472,9 @@ module Offsm : Abstract_value.Internal with type t = offsm_or_top = struct let backward_cast ~src_typ:_ ~dst_typ:_ ~src_val:_ ~dst_val:_ = `Value None - let reinterpret _e _typ o = `Value o, Alarmset.all + let truncate_integer _e _range o = `Value o, Alarmset.all + let rewrap_integer _range o = o + let cast_float _e _fkind o = `Value o, Alarmset.all let do_promotion ~src_typ ~dst_typ _e o = let o' = @@ -538,7 +547,7 @@ module CvalueOffsm : Abstract_value.Internal with type t = V.t * offsm_or_top let shiftn = if op = Shiftlt then SLeft i else SRight (i, signed) in let o = shift (size typ) (to_offsm typ l) shiftn in Main_values.CVal.forward_binop ~context typ op v_l v_r >>=: fun v -> - strengthen_v typ (v, O o) + v, O o with V.Not_based_on_null | Ival.Not_Singleton_Int -> forward_binop ~context typ op l r end diff --git a/src/plugins/value/values/offsm_value.mli b/src/plugins/value/values/offsm_value.mli index 824583293cade44a93b4350558cec074066bafe8..7df65eda4787af0b88e62182156bd489eda8f8b5 100644 --- a/src/plugins/value/values/offsm_value.mli +++ b/src/plugins/value/values/offsm_value.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/values/sign_value.ml b/src/plugins/value/values/sign_value.ml new file mode 100644 index 0000000000000000000000000000000000000000..af7779c35dbd845f546d5dc9b8c8026dcdcaf267 --- /dev/null +++ b/src/plugins/value/values/sign_value.ml @@ -0,0 +1,294 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Cil_types +open Eval +open Abstract_interp + +(** Sign domain: abstraction of integer numerical values by their signs. *) + +type signs = { + pos: bool; (** true: maybe positive, false: never positive *) + zero: bool; (** true: maybe zero, false: never zero *) + neg: bool; (** true: maybe negative, false: never negative *) +} + +let top = { pos = true; zero = true; neg = true } +let pos_or_zero = { pos = true; zero = true; neg = false } +let pos = { pos = true; zero = false; neg = false } +let neg_or_zero = { pos = false; zero = true; neg = true } +let neg = { pos = false; zero = false; neg = true } +let zero = { pos = false; zero = true; neg = false } +let non_zero = { pos = true; zero = false; neg = true } +let ge_zero v = not v.neg +let le_zero v = not v.pos + +(* Bottom is a special value (`Bottom) in EVA, and need not be part of + the lattice. Here, we have a value which is equivalent to it, defined + there only for commodity. *) +let empty = { pos = false; zero = false; neg = false } + +(* Datatypes are Frama-C specific modules used among other things for + serialization. There is no need to understand them in detail. + They are created mostly via copy/paste of templates. *) +include Datatype.Make(struct + type t = signs + include Datatype.Serializable_undefined + let compare = Pervasives.compare + let equal = Datatype.from_compare + let hash = Hashtbl.hash + let reprs = [top] + let name = "Value.Sign_values.signs" + let pretty fmt v = + Format.fprintf fmt "%s%s%s" + (if v.neg then "-" else "") + (if v.zero then "0" else "") + (if v.pos then "+" else "") + end) +let pretty_debug = pretty +let pretty_typ _ = pretty + +(* Inclusion: test inclusion of each field. *) +let is_included v1 v2 = + let bincl b1 b2 = (not b1) || b2 in + bincl v1.pos v2.pos && bincl v1.zero v2.zero && bincl v1.neg v2.neg + +(* Join of the lattice: pointwise logical or. *) +let join v1 v2 = { + pos = v1.pos || v2.pos; + zero = v1.zero || v2.zero; + neg = v1.neg || v2.neg; +} + +(* Meet of the lattice (called 'narrow' in EVA for historical reasons). + We detect the case where the values have incompatible concretization, + and report this as `Bottom. *) +let narrow v1 v2 = + let r = { + pos = v1.pos && v2.pos; + zero = v1.zero && v2.zero; + neg = v1.neg && v2.neg; + } in + if r = empty then `Bottom else `Value r + +let float_zeros = top +let top_int = top + +(* [inject_int] creates an abstract value corresponding to the singleton [i]. *) +let inject_int _ i = + if Integer.lt i Integer.zero then neg + else if Integer.gt i Integer.zero then pos + else zero + +let constant _ c = + match c with + | CInt64 (i, _, _) -> + (* Integer constants never overflow, because the front-end chooses a + suitable type. *) + `Value (inject_int () i), Alarmset.none + | _ -> `Value top, Alarmset.all + +(* Modelisation of a pointer. We cannot be precise *) +let inject_address _ = top + +(* Extracting function pointers from an abstraction. Not implemented + precisely *) +let resolve_functions ~typ_pointer:_ _ = `Top, true + +(** {2 Forward transfer functions} *) + +(* The three functions below are forward transformers for the mathematical + operations +, *, /, and the unary negation -. The potential overflows for the + operations on machine integers are taken into account by the functions + [truncate_integer] and [rewrap_integer]. *) + +let neg_unop v = { v with neg = v.pos; pos = v.neg } + +let forward_unop ~context:_ _ op v = + match op with + | Neg -> `Value (neg_unop v), Alarmset.all + | _ -> `Value top, Alarmset.all + +let plus v1 v2 = + let neg = v1.neg || v2.neg in + let pos = v1.pos || v2.pos in + let same_sign v1 v2 = + (le_zero v1 && le_zero v2) || (ge_zero v1 && ge_zero v2) + in + let zero = not (same_sign v1 v2) || (v1.zero && v2.zero) in + { neg; pos; zero } + +let mul v1 v2 = + let pos = (v1.pos && v2.pos) || (v1.neg && v2.neg) in + let neg = (v1.pos && v2.neg) || (v1.neg && v2.pos) in + let zero = v1.zero || v2.zero in + { neg; pos; zero } + +let div v1 v2 = + let pos = (v1.pos && v2.pos) || (v1.neg && v2.neg) in + let neg = (v1.pos && v2.neg) || (v1.neg && v2.pos) in + let zero = true in (* zero can appear with large enough v2 *) + { neg; pos; zero } + +(* This function implements a forward evaluation of the / operator, but + also refines the alarms emitted by Eva when the divisor cannot be zero. *) +let div_with_alarms div_exp v1 v2 = + let r = if equal zero v2 then `Bottom else `Value (div v1 v2) in + let alarms = + if v2.zero then Alarmset.all (* division by zero can occur, return no + information on the possible alarms *) + else + (* Division by zero does *not* occur. Emit all possible alarms except + that one. *) + let div_alarm = Alarms.Division_by_zero div_exp in + Alarmset.set div_alarm Alarmset.True Alarmset.all + in + r, alarms + +let forward_binop ~context _ op v1 v2 = + match op with + | PlusA -> `Value (plus v1 v2), Alarmset.all + | MinusA -> `Value (plus v1 (neg_unop v2)), Alarmset.all + | Mult -> `Value (mul v1 v2), Alarmset.all + | Div -> div_with_alarms context.right_operand v1 v2 + | _ -> `Value top, Alarmset.all + +let truncate_integer _expr range v = + if equal v zero then `Value v, Alarmset.none + else if range.Eval_typ.i_signed + then `Value v, Alarmset.all + else `Value {v with neg = false}, Alarmset.all + +let rewrap_integer range v = + if equal v zero then v + else if range.Eval_typ.i_signed then top else pos_or_zero + +(* Floating-point values are not handled. *) +let cast_float _ _ _ = `Value top, Alarmset.all + +(* Casts from type [src_typ] to type [dst_typ]. As downcasting can wrap, + we only handle upcasts precisely *) +let do_promotion ~src_typ ~dst_typ _e v = + let open Eval_typ in + let range_src = classify_as_scalar src_typ in + let range_dst = classify_as_scalar dst_typ in + match range_src, range_dst with + | TSInt range_src, TSInt range_dst -> + if equal v zero then `Value v, Alarmset.none else + let included_low, included_up = range_inclusion range_src range_dst in + if included_low && included_up then + `Value v, Alarmset.none (* upcast *) + else if range_dst.i_signed then + `Value top, Alarmset.all (*dst_typ is signed, return all possible values*) + else + `Value pos_or_zero, Alarmset.all (* dst_typ is unsigned *) + | _ -> + (* at least one non-integer type. not handled precisely. *) + `Value top, Alarmset.all + + +(** {2 Backward transfer functions} *) + +(* Backward transfer functions are used to reduce the abstraction of a value, + knowing other information. For example '[0+] > [0]' means that the + first value can only be [+]. + + In the OCaml signatures, 'None' means 'I cannot reduce'. *) + +(* Value to return when no reduction is possible *) +let unreduced = `Value None +(* Function to use when a reduction is possible *) +let reduced v = `Value (Some v) + +(* This function must reduce the value [right] assuming that the + comparison [left op right] holds. *) +let backward_comp_right op ~left ~right = + let open Abstract_interp.Comp in + match op with + | Eq -> + narrow left right >>- reduced + | Ne -> + if equal left zero then + narrow right non_zero >>- reduced + else unreduced + | Le -> + if ge_zero left then + (* [left] is positive or zero. Hence, [right] is at least also positive + or zero. *) + if left.zero then + (* [left] may be zero, [right] is positive or zero *) + narrow right pos_or_zero >>- reduced + else + (* [left] is strictly positive, hence so is [right] *) + narrow right pos >>- reduced + else unreduced + | Lt -> + if ge_zero left then + narrow right pos >>- reduced + else unreduced + | Ge -> + if le_zero left then + if left.zero then + narrow right neg_or_zero >>- reduced + else + narrow right neg >>- reduced + else unreduced + | Gt -> + if le_zero left then + narrow right neg >>- reduced + else unreduced + +(* This functions must reduce the values [left] and [right], assuming + that [left op right == result] holds. Currently, it is only implemented + for comparison operators. *) +let backward_binop ~input_type:_ ~resulting_type:_ op ~left ~right ~result = + match op with + | Ne | Eq | Le | Lt | Ge | Gt -> + let op = Value_util.conv_comp op in + if equal zero result then + (* The comparison is false, as it always evaluate to false. Reduce by the + fact that the inverse comparison is true. *) + let op = Comp.inv op in + backward_comp_right op ~left ~right >>- fun right' -> + backward_comp_right (Comp.sym op) ~left:right ~right:left >>- fun left' -> + `Value (left', right') + else if not result.zero then + (* The comparison always hold, as it never evaluates to false. *) + backward_comp_right op ~left ~right >>- fun right' -> + backward_comp_right (Comp.sym op) ~left:right ~right:left >>- fun left' -> + `Value (left', right') + else + (* The comparison may or may not hold, it is not possible to reduce *) + `Value (None, None) + | _ -> `Value (None, None) + +(* Not implemented precisely *) +let backward_unop ~typ_arg:_ _op ~arg:_ ~res:_ = `Value None +(* Not implemented precisely *) +let backward_cast ~src_typ:_ ~dst_typ:_ ~src_val:_ ~dst_val:_ = `Value None + + +(** {2 Misc} *) + +(* Eva boilerplate, used to retrieve the domain. *) +let sign_key = Structure.Key_Value.create_key "sign_values" +let structure = Structure.Key_Value.Leaf sign_key diff --git a/src/plugins/value/slevel/stop_at_nth.ml b/src/plugins/value/values/sign_value.mli similarity index 85% rename from src/plugins/value/slevel/stop_at_nth.ml rename to src/plugins/value/values/sign_value.mli index 8dcc9864ec01da44e0825526126e57e62eb3bda6..1b42c0de6bc92340efbfa730a5aeee4cc3f3205c 100644 --- a/src/plugins/value/slevel/stop_at_nth.ml +++ b/src/plugins/value/values/sign_value.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,12 +20,10 @@ (* *) (**************************************************************************) -let n = ref 0 +(** Sign domain: abstraction of integer numerical values by their signs. *) -let clear () = n := 0 +include Abstract_value.Internal -let incr () = - let new_n = succ !n in - n := new_n; - new_n = Value_parameters.StopAtNthAlarm.get () - +val pretty_debug: t Pretty_utils.formatter + +val sign_key : t Structure.Key_Value.k diff --git a/src/plugins/value/values/value_product.ml b/src/plugins/value/values/value_product.ml index 535353d523f6874dbbe6c5a11131172addad010e..e2809a5eeea6563a10b6d1e063f666f3d07cabff 100644 --- a/src/plugins/value/values/value_product.ml +++ b/src/plugins/value/values/value_product.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -43,6 +43,10 @@ module Make let structure = Structure.Key_Value.Node (Left.structure, Right.structure) + let pretty_typ typ = + Pretty_utils.pp_pair ~pre:"@[" ~sep:",@ " ~suf:"@]" + (Left.pretty_typ typ) (Right.pretty_typ typ) + let top = Left.top, Right.top let is_included (l1, r1) (l2, r2) = Left.is_included l1 l2 && Right.is_included r1 r2 @@ -74,9 +78,17 @@ module Make Right.forward_binop ~context typ binop r1 r2 >>=: fun right -> left, right - let reinterpret expr typ (left, right) = - Left.reinterpret expr typ left >>= fun left -> - Right.reinterpret expr typ right >>=: fun right -> + let truncate_integer expr range (left, right) = + Left.truncate_integer expr range left >>= fun left -> + Right.truncate_integer expr range right >>=: fun right -> + left, right + + let rewrap_integer range (left, right) = + Left.rewrap_integer range left, Right.rewrap_integer range right + + let cast_float expr fkind (left, right) = + Left.cast_float expr fkind left >>= fun left -> + Right.cast_float expr fkind right >>=: fun right -> left, right let do_promotion ~src_typ ~dst_typ expr (left, right) = diff --git a/src/plugins/value/values/value_product.mli b/src/plugins/value/values/value_product.mli index 7db47d6872e74b36f60ea5c4686a09b3da159c45..dba969cac9c9c8d9f9005e525fe4869be152098a 100644 --- a/src/plugins/value/values/value_product.mli +++ b/src/plugins/value/values/value_product.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value/vtests b/src/plugins/value/vtests index 1e14dcde812712ba081c0789911c7684e767964f..52b0dbd3f4b807ff4be2ffbd0fdd54ca2ec5a786 100755 --- a/src/plugins/value/vtests +++ b/src/plugins/value/vtests @@ -1,7 +1,7 @@ #!/bin/bash -eu DEFAULT_TESTS=(float value idct non-free) -CONFIGS=( apron equalities legacy bitwise symblocs gauges) +CONFIGS=( apron equalities bitwise symblocs gauges) ARGS=("${@-}") diff --git a/src/plugins/value_types/cilE.ml b/src/plugins/value_types/cilE.ml index ef2b802c5fc08fe3b6b012715edef1e43f8ef034..23b4f50bb07f79eb33487a22a259ef5e1c804380 100644 --- a/src/plugins/value_types/cilE.ml +++ b/src/plugins/value_types/cilE.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -25,27 +25,18 @@ plug-in. Refactoring required. *) (* ************************************************************************* *) -type alarm_behavior = - { a_log: bool; - a_call: unit -> unit;} +type alarm_behavior = unit -> unit -let a_ignore = {a_log=false; a_call=Extlib.nop} +let a_ignore = Extlib.nop -type warn_mode = {imprecision_tracing:alarm_behavior; - defined_logic: alarm_behavior; +type warn_mode = {defined_logic: alarm_behavior; unspecified: alarm_behavior; others: alarm_behavior;} -let warn_all_mode = - let alog = {a_log=true; a_call=Extlib.nop} in - { imprecision_tracing = alog; - defined_logic = alog; - unspecified = alog; - others = alog; } - let warn_none_mode = - { imprecision_tracing = a_ignore; defined_logic = a_ignore; - unspecified = a_ignore; others=a_ignore; } + { defined_logic = a_ignore; unspecified = a_ignore; others = a_ignore; } + + (* diff --git a/src/plugins/value_types/cilE.mli b/src/plugins/value_types/cilE.mli index e01c64f30f23125185a330b9c41487b9f7ff9226..8fe3c81369f6f38f38457b61649e97beed826359 100644 --- a/src/plugins/value_types/cilE.mli +++ b/src/plugins/value_types/cilE.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -28,38 +28,22 @@ plug-in. Refactoring required. *) (* ************************************************************************* *) -type alarm_behavior = - { a_log: bool; - (** should the alarm be sent to the log *) - - a_call: unit -> unit; - (** call function after optionally emitting with field a_log. *) - } +type alarm_behavior = unit -> unit val a_ignore: alarm_behavior type warn_mode = - { imprecision_tracing: alarm_behavior - (** informative messages for garbled values *); - defined_logic: alarm_behavior + { defined_logic: alarm_behavior (** operations that raise an error only in the C, not in the logic *); unspecified: alarm_behavior (** defined but unspecified behaviors *); others: alarm_behavior (** all the remaining undefined behaviors *); } - (** An argument of type [warn_mode] is required by some of the access - functions in {!Db.Value} (the interface to the value analysis). This - argument tells what should be done with the various messages - that the value analysis emits during the call. - - Each [warn_mode] field indicates the expected treatment for one - category of message. These fields are not completely fixed - yet. However, you can still used functions {!warn_all_mode} and - {!warn_none_mode} below when you have to provide an argument of type - [warn_mode]. *) - -val warn_all_mode: warn_mode - (** Emit all messages, including alarms and informative messages - regarding the loss of precision. *) + (** An argument of type [warn_mode] can be supplied to some of the access + functions in {!Db.Value} (the interface to the value analysis). + Each field of {!warn_mode} indicates the action to perform + for each category of alarm. These fields are not completely fixed + yet. However, you can use the value {!warn_none_mode} below + when you have to provide an argument of type [warn_mode]. *) val warn_none_mode : warn_mode (** Do not emit any message. *) diff --git a/src/plugins/value_types/cvalue.ml b/src/plugins/value_types/cvalue.ml index 605ac862d2684af86e73dfac168e9e89b3c66d6e..a348b10d4cce7e575e1e232a8e4e335d86b86daf 100644 --- a/src/plugins/value_types/cvalue.ml +++ b/src/plugins/value_types/cvalue.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -95,22 +95,14 @@ module V = struct | Map _ -> is_topint v || is_bottom v || is_zero v let contains_zero loc = - try - let is_valid_offset base offset = - match base with - Base.Null -> - if Ival.contains_zero offset then raise Base.Not_valid_offset - | _ -> - let bits_offset = Ival.scale (Bit_utils.sizeofchar()) offset in - Base.is_valid_offset ~for_writing:false Int.zero base bits_offset - in - match loc with - | Location_Bytes.Top _ -> true - | Location_Bytes.Map m -> - Location_Bytes.M.iter is_valid_offset m; - false - with - | Base.Not_valid_offset -> true + let offset_contains_zero base offset = + if Base.is_null base + then Ival.contains_zero offset + else + let bits_offset = Ival.scale (Bit_utils.sizeofchar()) offset in + not (Base.is_valid_offset ~for_writing:false Int.zero base bits_offset) + in + Location_Bytes.exists offset_contains_zero loc let contains_non_zero v = not ((equal v bottom) || (is_zero v)) @@ -448,7 +440,7 @@ module V = struct if ok_garbled && integer_part' == integer_part then v (* both pointer and integer part are unchanged *), true else - join (inject_ival integer_part') pointer_part', ok_garbled + join (inject_ival integer_part') pointer_part', false let cast_float_to_int ~signed ~size v = try @@ -626,21 +618,37 @@ module V = struct try let i = project_ival_bottom v in false, inject_ival (Ival.extract_bits ~start ~stop ~size i) - with - | Not_based_on_null -> - if is_imprecise v - then false, v - else true, topify_with_origin_kind topify v + with Not_based_on_null -> + if is_imprecise v + then false, v + else + (* Keep precision if we are reading all the bits of an address *) + let ptr_size = + Integer.of_int (Cil.(bitsSizeOfInt theMachine.upointKind)) + in + if Int.equal start Int.zero && + Int.equal (Int.succ stop) ptr_size && + Int.equal size ptr_size + then false, v + else true, topify_with_origin_kind topify v (* Computes [e * 2^factor]. Auxiliary function for foo_endian_merge_bits *) - let shift_left_by_integer ~topify factor e = + let shift_left_by_integer ~topify factor v = try - let i = project_ival_bottom e in + let i = project_ival_bottom v in inject_ival (Ival.scale (Int.two_power factor) i) with - | Not_based_on_null -> topify_with_origin_kind topify e + | Not_based_on_null -> + if Integer.is_zero factor + then v + else topify_with_origin_kind topify v | Integer.Too_big -> top_int + let restrict_topint_to_size value size = + if is_topint value + then inject_ival (Ival.create_all_values ~signed:false ~size) + else value + let big_endian_merge_bits ~topify ~conflate_bottom ~total_length ~length ~value ~offset acc = if is_bottom acc || is_bottom value then begin @@ -655,6 +663,7 @@ module V = struct else let total_length_i = Int.of_int total_length in let factor = Int.sub (Int.sub total_length_i offset) length in + let value = restrict_topint_to_size value (Integer.to_int length) in let value' = shift_left_by_integer ~topify factor value in let result = add_untyped ~topify ~factor:Int_Base.one value' acc in (* Format.printf "big_endian_merge_bits : total_length:%d length:%a value:%a offset:%a acc:%a GOT:%a@." @@ -666,7 +675,7 @@ module V = struct pretty result; *) result - let little_endian_merge_bits ~topify ~conflate_bottom ~value ~offset acc = + let little_endian_merge_bits ~topify ~conflate_bottom ~length ~value ~offset acc = if is_bottom acc || is_bottom value then begin if conflate_bottom @@ -678,6 +687,7 @@ module V = struct (topify_with_origin_kind topify value) end else + let value = restrict_topint_to_size value (Integer.to_int length) in let value' = shift_left_by_integer ~topify offset value in let result = add_untyped ~topify ~factor:Int_Base.one value' acc in (*Format.printf "le merge_bits : total_length:%d value:%a offset:%a acc:%a GOT:%a@." @@ -817,9 +827,6 @@ module V_Or_Uninitialized = struct (lnot flags2) lor flags1 = -1 && V.is_included (get_v t1) (get_v t2) - let join_and_is_included t1 t2 = - let t12 = join t1 t2 in (t12, equal t12 t2) - let pretty_aux pp fmt t = let no_escaping_adr = is_noesc t in let initialized = is_initialized t in @@ -900,11 +907,11 @@ module V_Or_Uninitialized = struct inform_extract_pointer_bits, create (get_flags t) v - let little_endian_merge_bits ~topify ~conflate_bottom ~value ~offset t = + let little_endian_merge_bits ~topify ~conflate_bottom ~length ~value ~offset t = create ((get_flags t) land (get_flags value)) (V.little_endian_merge_bits ~topify ~conflate_bottom - ~value:(get_v value) ~offset + ~length ~value:(get_v value) ~offset (get_v t)) let big_endian_merge_bits ~topify ~conflate_bottom ~total_length ~length ~value ~offset t = @@ -931,29 +938,29 @@ module V_Or_Uninitialized = struct let unspecify_escaping_locals ~exact is_local t = let flags = get_flags t in - let flags = flags land mask_init - (* clear noesc flag *) - in let v = get_v t in - let locals, v' = V.remove_escaping_locals is_local v in - let v = if exact then v' else V.join v v' in - locals, create flags v - - let reduce_by_initializedness init v = match init, v with - | true, C_uninit_esc v -> C_init_esc v - | true, C_uninit_noesc v -> C_init_noesc v - | true, (C_init_esc _ | C_init_noesc _) -> v - | false, (C_init_esc _ | C_init_noesc _) -> bottom - | false, C_uninit_noesc _ -> C_uninit_noesc V.bottom - | false, C_uninit_esc _ -> C_uninit_esc V.bottom - - let reduce_by_danglingness spec v = match spec, v with - | false, C_uninit_esc v -> C_uninit_noesc v - | false, C_init_esc v -> C_init_noesc v - | false, (C_uninit_noesc _ | C_init_noesc _) -> v - | true, (C_uninit_noesc _ | C_init_noesc _) -> bottom - | true, C_uninit_esc _ -> C_uninit_esc V.bottom - | true, C_init_esc _ -> C_init_esc V.bottom + let removed, v' = V.remove_escaping_locals is_local v in + let t' = + if removed then + let flags = flags land mask_init (* add escaping flag *) in + (* perform a strong escaping if [exact] holds. Otherwise, [v'] + is included in [v] by definition, so we just add the flag to [v]. *) + if exact then create flags v' else create flags v + else t (* no update needed *) + in + removed, t' + + let reduce_by_initializedness pos v = + if pos then + meet v (C_init_esc V.top) + else + meet v (C_uninit_noesc V.bottom) + + let reduce_by_danglingness pos v = + if pos then + narrow v (C_init_esc V.bottom) + else + narrow v (C_uninit_noesc V.top) let remove_indeterminateness = function | C_init_noesc _ as v -> v @@ -1029,6 +1036,9 @@ module V_Offsetmap = struct let narrow x y = try `Value (OffsetmapNarrow.narrow x y) with NarrowReturnsBottom -> `Bottom + let narrow_reinterpret x y = + try `Value (OffsetmapNarrow.narrow_reinterpret x y) + with NarrowReturnsBottom -> `Bottom end @@ -1051,7 +1061,7 @@ module Default_offsetmap = struct | `Value size -> `Value (V_Offsetmap.create_isotropic ~size v) in match base with - | Base.Allocated (_, validity) -> + | Base.Allocated (_, _, validity) -> aux validity V_Or_Uninitialized.bottom | Base.Var (_, validity) | Base.CLogic_Var (_, _, validity) -> aux validity V_Or_Uninitialized.uninitialized @@ -1090,53 +1100,29 @@ module Model = struct include Make_Narrow(V_Or_Uninitialized) - let find_unspecified ?(conflate_bottom=true) state loc = + let find_indeterminate ?(conflate_bottom=true) state loc = find ~conflate_bottom state loc let find ?(conflate_bottom=true) state loc = - let alarm, v = find_unspecified ~conflate_bottom state loc in - alarm, V_Or_Uninitialized.get_v v - - let add_unsafe_binding ~exact mem loc v = - add_binding ~reducing:true ~exact mem loc v + let v = find_indeterminate ~conflate_bottom state loc in + V_Or_Uninitialized.get_v v - let add_binding_unspecified ~exact mem loc v = - add_binding ~reducing:false ~exact mem loc v + let add_indeterminate_binding ~exact mem loc v = + add_binding ~exact mem loc v let reduce_previous_binding state l v = assert (Locations.cardinal_zero_or_one l); let v = V_Or_Uninitialized.initialized v in - snd (add_binding ~reducing:true ~exact:true state l v) + add_binding ~exact:true state l v let reduce_indeterminate_binding state l v = assert (Locations.cardinal_zero_or_one l); - snd (add_binding ~reducing:true ~exact:true state l v) - - let reduce_binding initial_mem l v = - let _, v_old = find initial_mem l in - (* This function will discard any indeterminate bit in [v_old]. This is - by design, as reduction functions must be called after evaluation - was done. *) - if V.equal v v_old - then initial_mem - else - let v_new = V.narrow v_old v in - if V.equal v_new v_old then initial_mem - else if V.is_bottom v_new then bottom - else reduce_previous_binding initial_mem l v_new - - let add_initial_binding mem loc v = - snd (add_binding ~reducing:true ~exact:true mem loc v) + add_binding ~exact:true state l v (* Overwrites the definition of add_binding coming from Lmap, with a signature change. *) let add_binding ~exact acc loc value = - add_binding - ~reducing:false ~exact acc loc (V_Or_Uninitialized.initialized value) - - let add_new_base base ~size v ~size_v state = - let v = V_Or_Uninitialized.initialized v in - add_new_base base ~size v ~size_v state + add_binding ~exact acc loc (V_Or_Uninitialized.initialized value) let uninitialize_blocks_locals blocks state = List.fold_left diff --git a/src/plugins/value_types/cvalue.mli b/src/plugins/value_types/cvalue.mli index b60fff409214556b5ad692c8f7e094ec655febc3..b4a10a7808be5f11bdf609c91a5a8c26badb2ad5 100644 --- a/src/plugins/value_types/cvalue.mli +++ b/src/plugins/value_types/cvalue.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -97,8 +97,8 @@ module V : sig (** [cast ~size ~signed v] applies to the abstract value [v] the conversion to the integer type described by [size] and [signed]. The results - are [new_value, ok]. The boolean [ok], when true, indicates that no - imprecision was introduced. + are [new_value, ok]. The boolean [ok], when true, indicates that the cast + was the identity. Offsets of bases other than Null are not clipped. If they were clipped, they should be clipped at the validity of the base. The C standard does not say that [p+(1ULL<<32+1)] is the same as [p+1], it says that @@ -228,7 +228,7 @@ module V_Or_Uninitialized : sig (** Remove 'uninitialized' and 'escaping addresses' flags from the argument *) val unspecify_escaping_locals : - exact:bool -> (V.M.key -> bool) -> t -> Base.SetLattice.t * t + exact:bool -> (V.M.key -> bool) -> t -> bool * t val map: (V.t -> V.t) -> t -> t val map2: (V.t -> V.t -> V.t) -> t -> t -> t @@ -244,6 +244,8 @@ module V_Offsetmap: sig and type widen_hint = V_Or_Uninitialized.generic_widen_hint val narrow: t -> t -> t Bottom.Type.or_bottom + val narrow_reinterpret: t -> t -> t Bottom.Type.or_bottom + (** See the corresponding functions in {!Offsetmap_sig}. *) end @@ -265,7 +267,7 @@ module Model: sig (** {2 Finding values *} *) - (** [find_unspecified ~conflate_bottom state loc] returns the value + (** [find_indeterminate ~conflate_bottom state loc] returns the value and flags associated to [loc] in [state]. The flags are the union of the flags at all the locations and offsets corresponding to [loc]. The value is the join of all the values pointed by [l..l+loc.size-1] @@ -287,34 +289,27 @@ module Model: sig reading a scalar value. Conversely, if you are reading many bits at once (for example, to approximate the entire contents of a struct), set [conflate_bottom] to [false] -- to account for the possibility - of padding bits. The default value is [true]. The function - also returns [true] when the read location may be invalid. + of padding bits. The default value is [true]. *) - val find_unspecified : - ?conflate_bottom:bool -> t -> location -> bool * V_Or_Uninitialized.t + val find_indeterminate : + ?conflate_bottom:bool -> t -> location -> V_Or_Uninitialized.t (** [find ?conflate_bottom state loc] returns the same value as [find_indeterminate], but removes the indeterminate flags from the - result. The returned boolean indicates only a possibly invalid - location, not indeterminateness. *) - val find : ?conflate_bottom:bool -> t -> location -> bool * V.t + result. *) + val find : ?conflate_bottom:bool -> t -> location -> V.t (** {2 Writing values into the state} *) (** [add_binding state loc v] simulates the effect of writing [v] at location [loc] in [state]. If [loc] is not writable, {!bottom} is returned. - The returned boolean indicates that the location may be invalid. For this function, [v] is an initialized value; the function - {!add_binding_unspecified} allows to write a possibly unspecified + {!add_indeterminate_binding} allows to write a possibly indeterminate value to [state]. *) val add_binding : - exact:bool -> t -> location -> V.t -> bool * t - - val add_unsafe_binding : - exact:bool -> t -> location -> V_Or_Uninitialized.t -> bool * t - - val add_binding_unspecified : - exact:bool -> t -> location -> V_Or_Uninitialized.t -> bool * t + exact:bool -> t -> location -> V.t -> t + val add_indeterminate_binding : + exact:bool -> t -> location -> V_Or_Uninitialized.t -> t (** {2 Reducing the state} *) @@ -331,25 +326,6 @@ module Model: sig with 'undefined' and 'escaping addresses' flags. *) val reduce_indeterminate_binding: t -> location -> V_Or_Uninitialized.t -> t - (** [reduce_binding state loc v] refines the value associated to - [loc] in [state] according to [v], by keeping the values common - to the existing value and [v]. - - @deprecated since Magnesium-20151001. Use a combination of {!V.narrow} - and {!reduce_previous_binding} to obtain the same result. *) - val reduce_binding : t -> location -> V.t -> t - - - (** {2 Creating an initial state} *) - - (** The functions below can be used to create an initial state to perform - an analysis. In particular, they can write to read-only locations. *) - - val add_initial_binding: t -> location -> V_Or_Uninitialized.t -> t - - val add_new_base : - Base.t -> size:Int.t -> V.t -> size_v:Int.t -> t -> t - (** {2 Misc} *) diff --git a/src/plugins/value_types/function_Froms.ml b/src/plugins/value_types/function_Froms.ml index 206f13db72dada0ba5f90c71ff39453206f7a796..683806e9df01ab858356532444210862787a6230 100644 --- a/src/plugins/value_types/function_Froms.ml +++ b/src/plugins/value_types/function_Froms.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -221,10 +221,6 @@ module DepsOrUnassigned = struct include DatatypeDeps - let join_and_is_included d1 d2 = - let d12 = join d1 d2 in - (d12, equal d12 d2) - let subst f d = match d with | DepsBottom -> DepsBottom | Unassigned -> Unassigned @@ -379,24 +375,22 @@ module Memory = struct let add_binding_precise_loc ~exact m loc v = let aux_one_loc loc m = let loc = Locations.valid_part ~for_writing:true loc in - add_binding_loc - ~reducing:false ~exact m loc (DepsOrUnassigned.AssignedFrom v) + add_binding_loc ~exact m loc (DepsOrUnassigned.AssignedFrom v) in Precise_locs.fold aux_one_loc loc m let bind_var vi v m = let z = Locations.zone_of_varinfo vi in - add_binding ~reducing:true ~exact:true m z (DepsOrUnassigned.AssignedFrom v) + add_binding ~exact:true m z (DepsOrUnassigned.AssignedFrom v) let unbind_var vi m = remove_base (Base.of_varinfo vi) m let add_binding ~exact m z v = - add_binding ~reducing:false ~exact m z (DepsOrUnassigned.AssignedFrom v) + add_binding ~exact m z (DepsOrUnassigned.AssignedFrom v) let add_binding_loc ~exact m loc v = - add_binding_loc - ~reducing:false ~exact m loc (DepsOrUnassigned.AssignedFrom v) + add_binding_loc ~exact m loc (DepsOrUnassigned.AssignedFrom v) let is_unassigned m = LOffset.is_same_value m DepsOrUnassigned.Unassigned @@ -449,7 +443,7 @@ module Memory = struct | Top -> Deps.top | Map m -> try f_map z (shape m) - with Zone.Error_Top -> Deps.top + with Abstract_interp.Error_Top -> Deps.top (** Auxiliary function that substitutes the indirect right-hand part of a dependency by a pre-existing From state. The returned result is a zone, @@ -478,7 +472,7 @@ module Memory = struct | Top -> Zone.top | Map m -> try f_map z (shape m) - with Zone.Error_Top -> Zone.top + with Abstract_interp.Error_Top -> Zone.top let substitute call_site_froms deps = let open Deps in diff --git a/src/plugins/value_types/function_Froms.mli b/src/plugins/value_types/function_Froms.mli index e5f21cbff98c1474ba4c35eb62e19fa7f9a943bf..2d7d9a7425f8f799af588a9080894ca7c9765d03 100644 --- a/src/plugins/value_types/function_Froms.mli +++ b/src/plugins/value_types/function_Froms.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/inout_type.ml b/src/plugins/value_types/inout_type.ml index 76fd023911db63b76ee11dd27fa5c2ca956c94ad..a98af051d69bfcf52576770a7d713568f7b23e0c 100644 --- a/src/plugins/value_types/inout_type.ml +++ b/src/plugins/value_types/inout_type.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/inout_type.mli b/src/plugins/value_types/inout_type.mli index 31b4d0b747fa9e6f4df76179d569c4288ee42c40..5686a83c8bb8191c570801422650fbfc0c90e077 100644 --- a/src/plugins/value_types/inout_type.mli +++ b/src/plugins/value_types/inout_type.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/precise_locs.ml b/src/plugins/value_types/precise_locs.ml index beaae5e8c4ccf9c918b80b6bf33b3d994ad9c154..d9faec363b8fbac20d5f214d7d82d493484c605c 100644 --- a/src/plugins/value_types/precise_locs.ml +++ b/src/plugins/value_types/precise_locs.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -369,7 +369,10 @@ let reduce_offset_by_validity ~for_writing ~bitfield base offset size = | _, Int_Base.Top -> offset | (Base.Known (minv, maxv) | Base.Unknown (minv,_,maxv)), Int_Base.Value size -> - let maxv = Int.succ (Int.sub maxv size) in + (* The maximum offset is maxv - (size - 1), except if size = 0, + in which case the maximum offset is exactly maxv. *) + let pred_size = Int.max Int.zero (Int.pred size) in + let maxv = Int.sub maxv pred_size in let range = if bitfield then Ival.inject_range (Some minv) (Some maxv) @@ -377,7 +380,8 @@ let reduce_offset_by_validity ~for_writing ~bitfield base offset size = in reduce_offset_by_range range offset | Base.Variable variable_v, Int_Base.Value size -> - let maxv = Int.succ (Int.sub variable_v.Base.max_alloc size) in + let pred_size = Int.max Int.zero (Int.pred size) in + let maxv = Int.sub variable_v.Base.max_alloc pred_size in let range = if bitfield then Ival.inject_range (Some Int.zero) (Some maxv) diff --git a/src/plugins/value_types/precise_locs.mli b/src/plugins/value_types/precise_locs.mli index aa235ea629a694c18112ff6770ef20e1c4162ace..de30547898899b46c0727dd4a2410acd210f3ee6 100644 --- a/src/plugins/value_types/precise_locs.mli +++ b/src/plugins/value_types/precise_locs.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/value_types.ml b/src/plugins/value_types/value_types.ml index 922ba8e72c1a04b448db7a9cc890fa8861fe4c8c..da39e2343aab7efc7ea3e27cc58706df73f1139a 100644 --- a/src/plugins/value_types/value_types.ml +++ b/src/plugins/value_types/value_types.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/value_types.mli b/src/plugins/value_types/value_types.mli index 97756e6a6e4e45a9c9fb88053e6f71eda0b81108..b3105e51c26e4a99026420576b720f6af81cd0e6 100644 --- a/src/plugins/value_types/value_types.mli +++ b/src/plugins/value_types/value_types.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/widen_type.ml b/src/plugins/value_types/widen_type.ml index 3ce0cdcabf104a3b73733704949a4dfb72d27cc1..5cc63c2149eadd7d9a7fbc5608f87737dbbd34f9 100644 --- a/src/plugins/value_types/widen_type.ml +++ b/src/plugins/value_types/widen_type.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/value_types/widen_type.mli b/src/plugins/value_types/widen_type.mli index 380676b76dd7f169b4d2120aba3cd0d00bc60756..e8aa2a275ed0497ba0d3619ba969385bfc7d77b2 100644 --- a/src/plugins/value_types/widen_type.mli +++ b/src/plugins/value_types/widen_type.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/variadic/Makefile.in b/src/plugins/variadic/Makefile.in index b04d855b150f1cfb293301fde6a32630ad1ffa17..a52c943a9eb7646a3aee6321cb16324c3361341b 100644 --- a/src/plugins/variadic/Makefile.in +++ b/src/plugins/variadic/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # @@ -35,11 +35,10 @@ endif PLUGIN_DIR ?= . PLUGIN_ENABLE := @ENABLE_VARIADIC@ -PLUGIN_DYNAMIC := @DYNAMIC_VARIADIC@ PLUGIN_NAME := Variadic PLUGIN_CMI := format_types va_types PLUGIN_CMO := options extends va_build environment \ - format_pprint format_typer format_parser \ + format_string format_pprint format_typer format_parser \ generic standard classify translate \ register PLUGIN_DISTRIBUTED := $(PLUGIN_ENABLE) diff --git a/src/plugins/variadic/Variadic.mli b/src/plugins/variadic/Variadic.mli index 09181a7c0701dcb7512ea8abcc14b2a59b199e4c..d6b80d2bddc086eb05fa38746694cad6e041059a 100644 --- a/src/plugins/variadic/Variadic.mli +++ b/src/plugins/variadic/Variadic.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/variadic/classify.ml b/src/plugins/variadic/classify.ml index d6430a3fbe8cd078a323e32bfe4245472a27b76c..830f4fb984d2498313942ba1f9b5d16ea6479a59 100644 --- a/src/plugins/variadic/classify.ml +++ b/src/plugins/variadic/classify.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -82,9 +82,28 @@ let mk_aggregator env fun_name a_pos pname a_type = (* In case of failure return Misc (apply generic translation) *) with Exit -> Misc -let mk_format_fun ~buffer ?(additional=[]) ~format f_kind = - FormatFun { f_kind; f_buffer = buffer ; f_format_pos = format ; - f_additional_args = additional; } +let mk_format_fun vi f_kind f_buffer ~format_pos = + let buffer_arguments = match f_buffer with + | StdIO | Syslog -> [] + | File i | Stream i | Arg (i, None) -> [i] + | Arg (i, Some j) -> [i ; j] + in + let expected_args = buffer_arguments @ [ format_pos ] in + let n_expected_args = (List.fold_left max (-1) expected_args) + 1 + and n_actual_args = List.length (Typ.params vi.vtype) in + if n_actual_args < n_expected_args then + begin + Self.warning ~current:true + "The standard function %s was expected to have at least %d fixed \ + parameters but only has %d.@ \ + No variadic translation will be performed." + vi.vname + n_expected_args + n_actual_args; + Misc + end + else + FormatFun { f_kind ; f_buffer ; f_format_pos = format_pos } (* ************************************************************************ *) @@ -107,25 +126,28 @@ let classify_std env vi = match vi.vname with | "syscall" -> Misc (* stdio.h *) - | "fprintf" -> mk_format_fun ~buffer:(Stream 0) ~format:1 PrintfLike - | "printf" -> mk_format_fun ~buffer:(StdIO) ~format:0 PrintfLike - | "sprintf" -> mk_format_fun ~buffer:(Arg 0) ~format:1 PrintfLike - | "snprintf" -> mk_format_fun ~buffer:(Arg 0) ~additional:[1] ~format:2 PrintfLike - | "dprintf" -> mk_format_fun ~buffer:(File 0) ~format:1 PrintfLike - | "fscanf" -> mk_format_fun ~buffer:(Stream 0) ~format:1 ScanfLike - | "scanf" -> mk_format_fun ~buffer:(StdIO) ~format:0 ScanfLike - | "sscanf" -> mk_format_fun ~buffer:(Arg 0) ~format:1 ScanfLike + | "fprintf" -> mk_format_fun vi PrintfLike ~format_pos:1 (Stream 0) + | "printf" -> mk_format_fun vi PrintfLike ~format_pos:0 (StdIO) + | "sprintf" -> mk_format_fun vi PrintfLike ~format_pos:1 (Arg (0, None)) + | "snprintf" -> mk_format_fun vi PrintfLike ~format_pos:2 (Arg (0, Some 1)) + | "dprintf" -> mk_format_fun vi PrintfLike ~format_pos:1 (File 0) + | "fscanf" -> mk_format_fun vi ScanfLike ~format_pos:1 (Stream 0) + | "scanf" -> mk_format_fun vi ScanfLike ~format_pos:0 (StdIO) + | "sscanf" -> mk_format_fun vi ScanfLike ~format_pos:1 (Arg (0, None)) (* syslog.h *) - | "syslog" -> mk_format_fun ~buffer:(Syslog) ~format:1 PrintfLike + | "syslog" -> mk_format_fun vi PrintfLike ~format_pos:1 (Syslog) (* wchar.h *) - | "fwprintf" -> mk_format_fun ~buffer:(Stream 0) ~format:1 PrintfLike - | "swprintf" -> mk_format_fun ~buffer:(Arg 0) ~format:1 PrintfLike - | "wprintf" -> mk_format_fun ~buffer:(StdIO) ~format:0 PrintfLike - | "fwscanf" -> mk_format_fun ~buffer:(Stream 0) ~format:1 ScanfLike - | "swscanf" -> mk_format_fun ~buffer:(StdIO) ~format:0 ScanfLike - | "wscanf" -> mk_format_fun ~buffer:(Arg 0) ~format:1 ScanfLike + | "fwprintf" -> mk_format_fun vi PrintfLike ~format_pos:1 (Stream 0) + | "swprintf" -> mk_format_fun vi PrintfLike ~format_pos:2 (Arg (0, Some 1)) + | "wprintf" -> mk_format_fun vi PrintfLike ~format_pos:0 (StdIO) + | "fwscanf" -> mk_format_fun vi ScanfLike ~format_pos:1 (Stream 0) + | "swscanf" -> mk_format_fun vi ScanfLike ~format_pos:1 (Arg (0, None)) + | "wscanf" -> mk_format_fun vi ScanfLike ~format_pos:0 (StdIO) + + (* stropts.h *) + | "ioctl" -> mk_overload env ["__va_ioctl_void" ; "__va_ioctl_ptr"] (* Anything else *) | _ -> Unknown @@ -138,7 +160,8 @@ let classify env vi = Some { vf_decl = vi; vf_original_type = vi.vtype; - vf_class = if vi.vdefined then Defined else classify_std env vi + vf_class = if vi.vdefined then Defined else classify_std env vi; + vf_specialization_count = 0 } end else None diff --git a/src/plugins/variadic/configure.ac b/src/plugins/variadic/configure.ac index b254e0a8d428435ea27825b36608060120293fc8..3c94d726b2923c52cdec0610d2b5ac0c09747e15 100644 --- a/src/plugins/variadic/configure.ac +++ b/src/plugins/variadic/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat à l'énergie atomique et aux énergies # # alternatives) # # # diff --git a/src/plugins/variadic/environment.ml b/src/plugins/variadic/environment.ml index 2fa7b7702495b0c38886705bd90d82d922ea5592..05c888de325e09758d57468a52fabe1ca5ca34f0 100644 --- a/src/plugins/variadic/environment.ml +++ b/src/plugins/variadic/environment.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/variadic/extends.ml b/src/plugins/variadic/extends.ml index 60c9268fc9e115f082e31f056a4ede157495e71e..3abcce845cf82b20b4ff6d50a2f4ceaeb8e5d8c7 100644 --- a/src/plugins/variadic/extends.ml +++ b/src/plugins/variadic/extends.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -114,11 +114,6 @@ module Cil = struct let is_variadic_function vi = Typ.is_variadic vi.vtype - let rec static_string a = match a.enode with - | Const (CStr s) -> Some s - | CastE (_, e) -> static_string e - | _ -> None - let get_fundec_return_type fd = match fd.svar.vtype with | TFun(rt, _, _, _) -> rt | _ -> Options.Self.fatal "Varinfo of fundec does not have function type." @@ -127,38 +122,9 @@ module Cil = struct | Definition (fd, _) -> fd.svar.vattr | Declaration (_, vi, _, _) -> vi.vattr - let get_inst_loc = function - | Set (_, _, l) - | Call (_, _, _, l) - | Asm (_,_,_,l) - | Skip l - | Code_annot (_, l) -> l - - let rec get_stmt_loc s = match s.skind with - | Instr i -> get_inst_loc i - | Return (_, l) - | Goto (_, l) - | Break l - | Continue l - | If (_, _, _, l) - | Switch(_, _, _, l) - | Loop (_, _, l, _, _) - | Throw (_, l) - | TryCatch (_, _, l) - | TryFinally (_, _, l) - | TryExcept (_, _, _, l) -> l - | Block b -> - (try - let first_stmt = List.hd b.bstmts in - get_stmt_loc first_stmt - with - | _ -> raise (Invalid_argument "No statement found")) - | UnspecifiedSequence s -> - (try - let first_stmt, _, _, _, _ = List.hd s in - get_stmt_loc first_stmt - with - _ -> raise (Invalid_argument "No statement found")) + let get_inst_loc = Cil_datatype.Instr.loc + + let get_stmt_loc = Cil_datatype.Stmt.loc end module List = struct diff --git a/src/plugins/variadic/extends.mli b/src/plugins/variadic/extends.mli index 197d1bf5ae6ae92b485d2c82c060bd3a75caee3f..3c7ed671a1f126838b583ea96351f6e83de5b417 100644 --- a/src/plugins/variadic/extends.mli +++ b/src/plugins/variadic/extends.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -66,8 +66,6 @@ module Cil : sig is a non-variadic function or if it is not a function. *) val is_variadic_function : varinfo -> bool - val static_string : exp -> string option - (** Does not use {! Globals.Functions.get} nor {! Kernel_function.get_return_type}. *) val get_fundec_return_type : fundec -> typ diff --git a/src/plugins/variadic/format_parser.ml b/src/plugins/variadic/format_parser.ml index f533c18421ed1ba809d75f488f495e658b286e15..6b8c473b1bcfad3477233f62a2e009e377abb1b8 100644 --- a/src/plugins/variadic/format_parser.ml +++ b/src/plugins/variadic/format_parser.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -38,7 +38,7 @@ let warn f = Options.Self.warning ~current:true f let check_flag spec flag = let cs = spec.f_conversion_specifier in match flag, cs with - | FSharp, #capitalizable -> true + | FSharp, #has_alternative_form -> true | FZero, #integer_specifier when Extlib.has_some spec.f_precision -> warn "Flag 0 is ignored when a precision is specified"; false | FZero, #numeric_specifier when List.mem FMinus spec.f_flags -> @@ -48,7 +48,7 @@ let check_flag spec flag = | FSpace, #signed_specifier when List.mem FPlus spec.f_flags -> warn "Flag ' ' is ignored when flag + is also specified."; false | FSpace, #signed_specifier -> true - | FPlus, #signed_specifier -> true + | FPlus, (#signed_specifier | #float_specifier) -> true | _ -> warn "Flag %a and conversion specififer %a are not compatibles." pp_flag flag @@ -136,34 +136,40 @@ let check_format = function module Buffer = struct - type t = string * int ref + type t = Format_string.t * int ref - let create (s : string) : t = (s,ref 0) + let create (s : Format_string.t) : t = (s,ref 0) let consume (_s,i : t) : unit = incr i let back (_s,i : t) : unit = decr i let get (s,i : t) : char = - try let c = String.get s !i in incr i; c - with _ -> '\000' + try let c = Format_string.get_char s !i in incr i; c + with Format_string.OutOfBounds -> '\000' + | Format_string.NotAscii _ -> '\026' let last (s,i : t) : char = - String.get s (!i - 1) + try Format_string.get_char s (!i - 1) + with Format_string.OutOfBounds -> '\000' + | Format_string.NotAscii _ -> '\026' let peek (s,i : t) : char = - try String.get s !i - with _ -> '\000' + try Format_string.get_char s !i + with Format_string.OutOfBounds -> '\000' + | Format_string.NotAscii _ -> '\026' let getall (f : char -> bool) (s,i as b : t) : string = let start = !i in let len = ref 0 in - while f (get b) do - incr len; - done; - let s = String.sub s start !len in - back b; (* last char has not been matched *) - s + begin try + while f (get b) do + incr len; + done; + back b; (* last char has not been matched *) + with _ -> () + end; + Format_string.sub_string s start !len end @@ -266,6 +272,9 @@ let parse_f_cs b = | '\000' -> warn "Missing conversion specifier at the end of format."; raise Invalid_format + | '\026' -> + warn "Conversion specifiers must be ascii characters."; + raise Invalid_format | c -> warn "Unknown conversion specifier %c." c; raise Invalid_format diff --git a/src/plugins/variadic/format_parser.mli b/src/plugins/variadic/format_parser.mli index 9f82e4389eecff8d4d666fd84294cf9eb61dcec0..3cf9e35e53e1a85ba27958f9ff59f0f622208767 100644 --- a/src/plugins/variadic/format_parser.mli +++ b/src/plugins/variadic/format_parser.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -30,7 +30,7 @@ val check_f_format : f_format -> f_format val check_s_format : s_format -> s_format val check_format : format -> format -val parse_f_format : string -> f_format -val parse_s_format : string -> s_format -val parse_format : format_kind -> string -> format +val parse_f_format : Format_string.t -> f_format +val parse_s_format : Format_string.t -> s_format +val parse_format : format_kind -> Format_string.t -> format diff --git a/src/plugins/variadic/format_pprint.ml b/src/plugins/variadic/format_pprint.ml index e05d28e65b328ea4417ddc2722dfe312c2f5ec65..441d869a9ade61bbf7bd2f3e66516eabc98f163a 100644 --- a/src/plugins/variadic/format_pprint.ml +++ b/src/plugins/variadic/format_pprint.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/variadic/format_pprint.mli b/src/plugins/variadic/format_pprint.mli index 6af5bbba1ab89bf7b6d0dad69f3184fc9aa44d3a..bbe5749a2a6e57d4acdfaa83e147f1b4d58ad32f 100644 --- a/src/plugins/variadic/format_pprint.mli +++ b/src/plugins/variadic/format_pprint.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -35,7 +35,7 @@ val pp_f_format : Format.formatter -> f_format -> unit val pp_s_format : Format.formatter -> s_format -> unit val pp_format : Format.formatter -> format -> unit -(** Réécrit le format sous sa forme de chaîne de caractères *) +(** Rewrites the format as its string representation. *) val f_format_to_cstring : f_format -> string val s_format_to_cstring : s_format -> string val format_to_cstring : format -> string diff --git a/src/plugins/variadic/format_string.ml b/src/plugins/variadic/format_string.ml new file mode 100644 index 0000000000000000000000000000000000000000..401b21a14dcbdb95ca9464d67b459b7b4c3e67cc --- /dev/null +++ b/src/plugins/variadic/format_string.ml @@ -0,0 +1,68 @@ +(**************************************************************************) +(* *) +(* This file is part of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat à l'énergie atomique et aux énergies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +type t = +| String of string +| WString of int64 list + +exception OutOfBounds +exception NotAscii of int64 + +let get_char (s : t) (i : int) : char = + match s with + | String s -> + begin try + String.get s i + with + Invalid_argument _ -> raise OutOfBounds + end + | WString s -> + begin try + let c = List.nth s i in + if (c >= Int64.zero && c<= (Int64.of_int 255)) then + Char.chr (Int64.to_int c) + else + raise (NotAscii c) + with + Failure _ -> raise OutOfBounds + end + +let get_wchar (s : t) (i : int) : int64 = + match s with + | String s -> + begin try + Int64.of_int (Char.code (String.get s i)) + with + Invalid_argument _ -> raise OutOfBounds + end + | WString s -> + begin try + List.nth s i + with + Failure _ -> raise OutOfBounds + end + +let sub_string (s : t) (start : int) (len : int) : string = + let init_char i = + get_char s (start + i) + in + String.init len init_char diff --git a/src/plugins/variadic/format_typer.ml b/src/plugins/variadic/format_typer.ml index 25d03c54d97457a42ebc21dc236292141c3df042..d2e425fbce00ff5bc2868606cf4e26d739034207 100644 --- a/src/plugins/variadic/format_typer.ml +++ b/src/plugins/variadic/format_typer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,7 +26,10 @@ open Cil_types exception Type_not_found of string exception Invalid_specifier -type arg_dir = [ `ArgIn | `ArgInArray | `ArgOut | `ArgOutArray ] +type arg_dir = [ `ArgIn + | `ArgInArray of precision option (* for '%.*s' or '%.42s' *) + | `ArgOut + | `ArgOutArray ] type typdef_finder = Logic_typing.type_namespace -> string -> Cil_types.typ @@ -122,7 +125,7 @@ let type_f_format ?find_typedef format = if s.f_precision = Some PStar then r := (Cil.intType, `ArgIn) :: !r; let dir = match s.f_conversion_specifier with - | `s -> `ArgInArray + | `s -> `ArgInArray s.f_precision | `n -> `ArgOut | _ -> `ArgIn in diff --git a/src/plugins/variadic/format_typer.mli b/src/plugins/variadic/format_typer.mli index 110a01caa006dea65ba3d9cf3b97e97ae9af0b06..b0cb460adc024fd9c2d5991f140c6c452bcd19cc 100644 --- a/src/plugins/variadic/format_typer.mli +++ b/src/plugins/variadic/format_typer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,7 +26,10 @@ open Cil_types exception Type_not_found of string exception Invalid_specifier -type arg_dir = [ `ArgIn | `ArgInArray | `ArgOut | `ArgOutArray ] +type arg_dir = [ `ArgIn + | `ArgInArray of precision option (* for '%.*s' or '%.42s' *) + | `ArgOut + | `ArgOutArray ] type typdef_finder = Logic_typing.type_namespace -> string -> Cil_types.typ diff --git a/src/plugins/variadic/format_types.mli b/src/plugins/variadic/format_types.mli index a1eb3cabdeb55ae7778e798422a57b7a324e5c01..ec049a4fc6a81bba9a46463d6fc8586f848a2196 100644 --- a/src/plugins/variadic/format_types.mli +++ b/src/plugins/variadic/format_types.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +(** See C11, 7.21.6 *) + type flag = FMinus | FPlus | FSpace | FSharp | FZero type flags = flag list @@ -37,6 +39,7 @@ type integer_specifier = [ signed_specifier | unsigned_specifier ] type float_specifier = [ `f | `e | `g | `a ] type numeric_specifier = [ integer_specifier | float_specifier ] type capitalizable = [ `x | `f | `e | `g | `a ] +type has_alternative_form = [ `o | `x | `f | `e | `g | `a ] type f_conversion_specifier = [ numeric_specifier | `c | `s | `p | `n ] @@ -61,8 +64,7 @@ type s_conversion_specification = { mutable s_conversion_specifier: s_conversion_specifier; } -(** Un élément du format est soit un caractère, - soit une spécification de conversion. *) +(** A format element is either a character or a conversion specification. *) type 'spec token = | Char of char | Specification of 'spec diff --git a/src/plugins/variadic/generic.ml b/src/plugins/variadic/generic.ml index da7c593b6d4f726408e594f30ef1cddf9fdf4e8e..21d76c25d94870693a6095ff7c38efe3d5293135 100644 --- a/src/plugins/variadic/generic.ml +++ b/src/plugins/variadic/generic.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -135,21 +135,12 @@ let translate_va_builtin caller inst = (* Translation of calls to variadic functions *) -let translate_call ~fundec stmt = - (* Extract call informations *) - let lval, callee, pars, loc = match stmt.skind with - | Instr(Call(lval, callee, pars, loc)) -> lval, callee, pars, loc - | _ -> assert false - in +let translate_call ~fundec block loc mk_call callee pars = (* Log translation *) Self.result ~current:true ~level:2 "Generic translation of call to variadic function."; - (* Create a block to wrap the call *) - let block = Cil.mkBlock [] in - let block_stmt = {stmt with skind = Block block} in - (* Split params into static and variadic part *) let static_size = List.length (Typ.params (Cil.typeOf callee)) - 1 in let s_exps, v_exps = List.break static_size pars in @@ -158,26 +149,25 @@ let translate_call ~fundec stmt = let add_var i exp = let typ = Cil.typeOf exp and name = "__va_arg" ^ string_of_int i in - Cil.makeLocalVar fundec ~scope:block name typ + let res = Cil.makeLocalVar fundec ~scope:block name typ in + res.vdefined <- true; + res in let vis = List.mapi add_var v_exps in (* Assign parameters to these *) - block.bstmts <- List.map2 (Build.vi_assign ~loc) vis v_exps; + let instrs = List.map2 (Build.vi_init ~loc) vis v_exps in - (* Build an array with to store addresses *) + (* Build an array to store addresses *) let addrs = List.map Cil.mkAddrOfVi vis in let vargs, assigns = Build.array_init ~loc fundec block "__va_args" Cil.voidPtrType addrs in - block.bstmts <- List.append block.bstmts assigns; + let instrs = instrs @ [assigns] in (* Translate the call *) let exp_vargs = Cil.mkAddrOrStartOf ~loc (Cil.var vargs) in let new_arg = Cil.mkCast ~force:false ~e:exp_vargs ~newt:(vpar_typ []) in let new_args = s_exps @ [new_arg] in - let call = Cil.mkStmtOneInstr (Call(lval, callee, new_args, loc)) in - block.bstmts <- block.bstmts @ [call]; - - (* Return the created block *) - block_stmt + let call = mk_call callee new_args in + instrs @ [call] diff --git a/src/plugins/variadic/options.ml b/src/plugins/variadic/options.ml index 16a2f3f7694f72af70170bad695583c647ec76aa..0f7af474db516583b76521d7ff35f005ffc930b1 100644 --- a/src/plugins/variadic/options.ml +++ b/src/plugins/variadic/options.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -23,20 +23,20 @@ module Self = Plugin.Register (struct let name = "Variadic" - let shortname = "va" + let shortname = "variadic" let help = "Variadic functions translation" end) module Enabled = Self.True (struct - let option_name = "-va" + let option_name = "-variadic-translation" let help = "translate variadic functions and calls to semantic \ equivalents with only a fixed list of formal parameters" end) module Strict = Self.True (struct - let option_name = "-va-strict" + let option_name = "-variadic-strict" let help = "display warnings about non-portable implicit casts in the \ calls of standard variadic functions, i.e. casts between \ distinct integral types which has the same size and \ diff --git a/src/plugins/variadic/options.mli b/src/plugins/variadic/options.mli index aace01b49ebeb5eb7207c0702934afd9f69dfa64..c81be1820f25846e1aa75a9bdde896a37901e9d8 100644 --- a/src/plugins/variadic/options.mli +++ b/src/plugins/variadic/options.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/variadic/register.ml b/src/plugins/variadic/register.ml index 25ffad49ebf9dd9e8daa30c8f65874af5bcac148..28252e60330b604c27e4f8cc3ea5bae74b8e6af2 100644 --- a/src/plugins/variadic/register.ml +++ b/src/plugins/variadic/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/variadic/standard.ml b/src/plugins/variadic/standard.ml index 1732dea5bfa22033452ac1ce0cc82722b7e5dd53..f8c0a98c0861e5fe11bb38c2f45fe9cc249b54d2 100644 --- a/src/plugins/variadic/standard.ml +++ b/src/plugins/variadic/standard.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -32,14 +32,14 @@ module Build = Va_build let params_types params = List.map (fun (_,typ,_) -> typ) params -let pp_prototype name f tparams = - Format.fprintf f "%s(%a)" +let pp_prototype name fmt tparams = + Format.fprintf fmt "%s(%a)" name (Pretty_utils.pp_list ~sep:", " Printer.pp_typ) tparams -let pp_overload name f l = +let pp_overload name fmt l = let prototypes = List.map fst l in - Pretty_utils.pp_list ~sep:"@\n" (pp_prototype name) f prototypes + Pretty_utils.pp_list ~sep:"@\n" (pp_prototype name) fmt prototypes let new_globals : (global list) ref = ref [] @@ -51,6 +51,27 @@ let new_globals : (global list) ref = ref [] exception Translate_call_exn +(* Extended integer types (e.g. int8_t, uint_least16_t, int_fast32_t) + do not have their own character modifiers, but instead use macros that are + converted into "standard" modifiers (e.g. "%hhd", "%hu", "%d", etc.). + Therefore, we cannot enforce their types the same way as for e.g. size_t, + which has its own modifier. We weaken the check, allowing a different name + but still requiring same size and signedness. *) +let extended_integer_typenames = + ["int8_t"; "uint8_t"; "int_least8_t"; "uint_least8_t"; + "int_fast8_t"; "uint_fast8_t"; + "int16_t"; "uint16_t"; "int_least16_t"; "uint_least16_t"; + "int_fast16_t"; "uint_fast16_t"; + "int32_t"; "uint32_t"; "int_least32_t"; "uint_least32_t"; + "int_fast32_t"; "uint_fast32_t"; + "int64_t"; "uint64_t"; "int_least64_t"; "uint_least64_t"; + "int_fast64_t"; "uint_fast64_t"] + +let is_extended_integer_type t = + match t with + | TNamed (ti, _) -> List.mem ti.tname extended_integer_typenames + | _ -> false + let can_cast given expected = let integral_rep ikind = Cil.bitsSizeOfInt ikind, Cil.isSigned ikind @@ -58,12 +79,14 @@ let can_cast given expected = Cil.type_remove_attributes_for_c_cast (Cil.unrollType t) in match expose given, expose expected with - | (TInt (i1,a1) | TEnum({ekind=i1},a1)), - (TInt (i2,a2) | TEnum({ekind=i2},a2)) when not (Strict.get ()) -> - integral_rep i1 = integral_rep i2 && - Cil_datatype.Attributes.equal a1 a2 + | (TInt (i1,a1) | TEnum({ekind=i1},a1)), + (TInt (i2,a2) | TEnum({ekind=i2},a2)) + when not (Strict.get ()) || is_extended_integer_type given -> + integral_rep i1 = integral_rep i2 && + Cil_datatype.Attributes.equal a1 a2 | TPtr _, TPtr _ -> true - | _,_ -> Cil_datatype.Typ.equal given expected + | exposed_given, exposed_expected -> + Cil_datatype.Typ.equal exposed_given exposed_expected (* cast the i-th argument exp to paramtyp *) @@ -102,16 +125,13 @@ let match_args tparams args = (* translate a call by applying argument matching/pruning and changing callee *) -let match_call ~fundec stmt loc lval new_callee new_tparams args = - let block = Cil.mkBlock [] in - let block_stmt = {stmt with skind = Block block} in +let match_call ~loc ~fundec scope mk_call new_callee new_tparams args = let new_args, unused_args = match_args new_tparams args in - let call = Build.call ~loc lval new_callee new_args in - let reads = List.map (Cil.mkPureExpr ~fundec ~loc) unused_args in - block.bstmts <- reads @ [call]; - block_stmt - - + let call = mk_call (Cil.evar ~loc new_callee) new_args in + let reads = + List.map (fun e -> Cil.mkPureExprInstr ~fundec ~scope e) unused_args + in + reads @ [call] (* ************************************************************************ *) (* Aggregator calls *) @@ -121,12 +141,9 @@ let find_null exp_list = List.ifind (fun e -> Cil.isZero (Cil.constFold false e)) exp_list -let aggregator_call ~fundec {a_target; a_pos; a_type; a_param} vf stmt = - (* Extract call informations *) - let lval, args, loc = match stmt.skind with - | Instr(Call(lval, _, args, loc)) -> lval, args, loc - | _ -> assert false - and name = vf.vf_decl.vorig_name +let aggregator_call + ~fundec {a_target; a_pos; a_type; a_param} scope loc mk_call vf args = + let name = vf.vf_decl.vorig_name and tparams = Typ.params_types a_target.vtype and pname, ptyp = a_param in @@ -166,22 +183,16 @@ let aggregator_call ~fundec {a_target; a_pos; a_type; a_param} vf stmt = Self.result ~current:true ~level:2 "Translating call to %s to a call to %s." name a_target.vorig_name; - let block = Cil.mkBlock [] in - let block_stmt = {stmt with skind = Block block} in let pname = if pname = "" then "param" else pname in - let vaggr, assigns = Build.array_init ~loc fundec block - pname ptyp args_middle in + let vaggr, assigns = + Build.array_init ~loc fundec scope pname ptyp args_middle + in let new_arg = Cil.mkAddrOrStartOf ~loc (Cil.var vaggr) in let new_args = args_left @ [new_arg] @ args_right in let new_args,_ = match_args tparams new_args in - let call = Build.call ~loc lval a_target new_args in - let reads = List.map (Cil.mkPureExpr ~fundec ~loc) unused_args in - block.bstmts <- assigns @ reads @ [call]; - - (* Return the created block *) - block_stmt - - + let call = mk_call (Cil.evar ~loc a_target) new_args in + let reads = List.map (Cil.mkPureExprInstr ~fundec ~scope ~loc) unused_args in + assigns :: reads @ [call] (* ************************************************************************ *) (* Overloads calls *) @@ -197,48 +208,41 @@ let rec check_arg_matching given expected = let rec check_call_matching tparams targs = match tparams, targs with - (* No more args needed -> always valid *) - | [], _ -> true + | [], [] -> true + | [], _ + (* too many args: this is allowed by the standard (the extra arguments + are ignored), but in practice this leads to disambiguation issues in + some cases (e.g. last argument is 0 instead of NULL), so we prefer to + be strict *) (* Not enough input args *) | _, [] -> false | a1 :: l1, a2 :: l2 -> - check_arg_matching a1 a2 && - check_call_matching l1 l2 + check_arg_matching a1 a2 && + check_call_matching l1 l2 let filter_matching_prototypes overload args = (* Find suitable candidates for this call *) let targs = List.map Cil.typeOf args in - let check (tparams, vi) = - if check_call_matching tparams targs then - Some ((tparams, vi), List.length tparams) - else - None - in - let candidates = List.filter_map check overload in - (* Keep only best candidates (those with most parameters) *) - let max_params = List.fold_left (fun i (_,j) -> max i j) 0 candidates in - let candidates = List.filter (fun (_,i) -> i = max_params) candidates in - List.map fst candidates + let check (tparams, _vi) = check_call_matching tparams targs in + List.filter check overload -let overloaded_call ~fundec overload vf stmt = - (* Extract call informations *) - let lval, args, loc = match stmt.skind with - | Instr(Call(lval, _, args, loc)) -> lval, args, loc - | _ -> assert false - and name = vf.vf_decl.vorig_name in +let overloaded_call ~fundec overload block loc mk_call vf args = + let name = vf.vf_decl.vorig_name in (* Find the matching prototype *) let tparams, new_callee = match filter_matching_prototypes overload args with | [] -> (* No matching prototype *) - Self.warning ~current:true - "No matching prototype found for this call to %s. \ - Candidates were: \ - %a" - name - (pp_overload name) overload; + Self.warning ~current:true + "@[No matching prototype found for this call to %s.@.\ + Expected candidates:@.\ + @[<v> %a@]@.\ + Given arguments:@.\ + @[<v> %a@]" + name (pp_overload name) overload + (pp_prototype name) (List.map Cil.typeOf args); raise Translate_call_exn; | [(tparams,vi)] -> (* Exactly one matching prototype *) tparams, vi @@ -255,7 +259,7 @@ let overloaded_call ~fundec overload vf stmt = Self.result ~current:true ~level:2 "Translating call to the specialized version %a." (pp_prototype name) tparams; - match_call ~fundec stmt loc lval new_callee tparams args + match_call ~loc ~fundec block mk_call new_callee tparams args @@ -265,6 +269,12 @@ let overloaded_call ~fundec overload vf stmt = (* --- Specification building --- *) +let rec static_string a = match a.enode with + | Const (CStr s) -> Some (Format_string.String s) + | Const (CWStr s) -> Some (Format_string.WString s) + | CastE (_, e) -> static_string e + | _ -> None + let find_global env name = try Some (Environment.find_global env name) @@ -295,22 +305,36 @@ let find_field env structname fieldname = structname fieldname; None +let find_predicate_by_width typ narrow_name wide_name = + match Cil.unrollTypeDeep typ with + | TPtr (TInt(IChar, _), _) -> find_predicate narrow_name + | TPtr (t, _) when + (* drop attributes to remove 'const' qualifiers and fc_stdlib attributes *) + Cil_datatype.Typ.equal + (Cil.typeDeepDropAllAttributes (Cil.unrollTypeDeep t)) + Cil.theMachine.Cil.wcharType -> + find_predicate wide_name + | _ -> + Self.warning ~current:true + "expected single/wide character pointer type, got %a (%a, unrolled %a)" + Printer.pp_typ typ Cil_types_debug.pp_typ typ Cil_types_debug.pp_typ (Cil.unrollTypeDeep typ); + None + let build_fun_spec env loc vf format_fun tvparams formals = let open Format_types in let _ = () in let fixed_params_count = Typ.params_count vf.vf_original_type in let sformals, vformals = List.break fixed_params_count formals in + let here = Logic_const.here_label in (* Spec *) let sources = ref [] and dests = ref [] and requires = ref [] and ensures = ref [] in - let elval lval = - Build.logic_elval ~loc lval in let iterm lval = - Logic_const.new_identified_term (elval lval) - and insert x t = + Logic_const.new_identified_term (Build.tlval ~loc lval) + and insert x t = t := x :: !t in let insert_source ?(indirect=false) lval = @@ -332,45 +356,57 @@ let build_fun_spec env loc vf format_fun tvparams formals = let add_lval ~indirect (lval,dir) = (* Add the lval to the list of sources/dests *) begin match dir with - | (`ArgIn | `ArgInArray) -> insert_source ~indirect lval + | (`ArgIn | `ArgInArray _) -> insert_source ~indirect lval | (`ArgOut | `ArgOutArray) -> insert_dest lval | `ArgInOut -> insert_source ~indirect lval; insert_dest lval end - in - let add_var (vi,dir) = + in + let add_var ?pos (vi,dir) = (* Use the appropriate logical lval *) let lval = match dir with - | `ArgIn -> Build.logic_var vi - | (`ArgInArray | `ArgOutArray) -> Build.logic_varrange ~loc vi - | (`ArgOut | `ArgInOut) -> Build.logic_varmem ~loc vi + | `ArgIn -> Build.lvar vi + | (`ArgInArray _ | `ArgOutArray) -> Build.trange_from_vi ~loc vi + | (`ArgOut | `ArgInOut) -> Build.tvarmem ~loc vi in (* Build requires/ensures *) - let term = elval (Build.logic_var vi) - and here = Logic_const.here_label in + let term = Build.tvar ~loc vi in begin match dir with - | `ArgInArray -> - let pred = match Cil.unrollTypeDeep vi.vtype with - | TPtr (TInt(IChar, _), _) -> - find_predicate "valid_read_string" - | TPtr (typ, _) when typ = Cil.theMachine.Cil.wcharType -> - find_predicate "valid_wstring" - | _ -> None + | `ArgInArray None -> + let pred = + find_predicate_by_width vi.vtype "valid_read_string" "valid_read_wstring" in begin match pred with - | Some logic_info -> - let labels = - List.map (fun l -> l,Logic_const.here_label) logic_info.l_labels - in + | Some logic_info -> + let labels = List.map (fun _ -> here) logic_info.l_labels in let p = Logic_const.papp ~loc (logic_info, labels, [term]) in insert_require p - | None -> () + | None -> () + end + + | `ArgInArray (Some precision) -> + assert (pos <> None); + let pred = + find_predicate_by_width vi.vtype "valid_read_nstring" "valid_read_nwstring" + in + begin match pred with + | Some logic_info -> + let labels = List.map (fun _ -> here) logic_info.l_labels in + let nterm = match precision with + | PStar -> + let n_vi = List.nth vformals (Extlib.the pos) in + Logic_utils.numeric_coerce Linteger (Build.tvar ~loc n_vi) + | PInt n -> Cil.lconstant ~loc (Integer.of_int n) + in + let p = Logic_const.papp ~loc (logic_info, labels, [term; nterm]) in + insert_require p + | None -> () end - | `ArgOut -> + | `ArgOut -> insert_require (Logic_const.pvalid ~loc (here,term)); insert_ensure (Logic_const.pinitialized ~loc (here,term)) - | _ -> () + | _ -> () end; (* Cil.hasAttribute "const" *) add_lval (lval,dir) @@ -379,12 +415,12 @@ let build_fun_spec env loc vf format_fun tvparams formals = (* Build variadic parameter source/dest list *) let dirs = List.map snd tvparams in let l = List.combine vformals dirs in - List.iter (add_var ~indirect:false) l; + let pos = ref (-1) in + List.iter (incr pos; add_var ~indirect:false ~pos:!pos) l; (* Add format source and additional parameters *) - add_var ~indirect:true (List.nth sformals format_fun.f_format_pos, `ArgInArray); - List.iter (fun p -> add_var ~indirect:true (List.nth sformals p, `ArgIn)) - format_fun.f_additional_args; + let fmt_vi = List.nth sformals format_fun.f_format_pos in + add_var ~indirect:true (fmt_vi, `ArgInArray None); (* Add buffer source/dest *) let add_stream vi = @@ -392,19 +428,54 @@ let build_fun_spec env loc vf format_fun tvparams formals = \from stream->__fc_FILE_data, __fc_FILE_id *) begin match find_field env "__fc_FILE" "__fc_FILE_data" with | Some fieldinfo -> - let varfield = Build.logic_varfield ~loc vi fieldinfo in + let varfield = Build.tvarfield ~loc vi fieldinfo in add_lval ~indirect:false (varfield, `ArgInOut) | None -> add_var ~indirect:false (vi, `ArgInOut) end; begin match find_field env "__fc_FILE" "__fc_FILE_id" with | Some fieldinfo -> - let varfield = Build.logic_varfield ~loc vi fieldinfo in + let varfield = Build.tvarfield ~loc vi fieldinfo in add_lval ~indirect:true (varfield, `ArgIn) | None -> () end in + (* Add a bounded buffer *) + let add_buffer vi_buffer vi_size = + add_var ~indirect:true (vi_size, `ArgIn); + (* this is an snprintf-like function; compute and add its precondition: + \valid(s + (0..n-1)) || \valid(s + (0..format_length(format)-1)) *) + let make_valid_range tvalid_length = + let tvar = Build.tvar ~loc vi_buffer + and tmin = Build.tzero ~loc + and tmax = Build.tminus ~loc tvalid_length (Build.tone ~loc) in + let toffs = Build.trange ~loc (Some tmin) (Some tmax) in + let term = Build.tbinop ~loc PlusPI tvar toffs in + Logic_const.pvalid ~loc (here, term) + in + let size_var = Build.tvar ~loc vi_size in + let left_pred = make_valid_range size_var in + let pred = + find_predicate_by_width vi_buffer.vtype "format_length" "wformat_length" + in + match pred with + | Some format_length -> + let labels = List.map (fun _ -> here) format_length.l_labels in + let fmt_var = Build.tvar ~loc fmt_vi in + let flen_app = + try Build.tapp ~loc format_length labels [fmt_var] + with Build.NotAFunction -> + Self.abort ~current:true + "%a should be a logic function, not a predicate" + Printer.pp_logic_var format_length.l_var_info + in + let right_pred = make_valid_range flen_app in + let p = Logic_const.por ~loc (left_pred, right_pred) in + insert_require p + | None -> insert_require left_pred + in + begin match format_fun.f_buffer, format_fun.f_kind with | StdIO, ScanfLike -> begin match find_global env "__fc_stdin" with @@ -416,10 +487,15 @@ let build_fun_spec env loc vf format_fun tvparams formals = | Some vi -> add_stream vi | None -> () end - | Arg i, ScanfLike -> - add_var ~indirect:true (List.nth sformals i, `ArgInArray) - | Arg i, PrintfLike -> - add_var ~indirect:true (List.nth sformals i, `ArgOutArray) + | Arg (i, _), ScanfLike -> + add_var ~indirect:true (List.nth sformals i, `ArgInArray None) + | Arg (i, size_pos), PrintfLike -> + add_var ~indirect:true (List.nth sformals i, `ArgOutArray); + begin match size_pos with + | Some n -> + add_buffer (List.nth sformals i) (List.nth sformals n) + | None -> () + end | Stream i, _ -> add_stream (List.nth sformals i) | File i, _ -> @@ -431,7 +507,7 @@ let build_fun_spec env loc vf format_fun tvparams formals = (* Add return value dest *) let rettyp = Cil.getReturnType vf.vf_decl.vtype in if not (Cil.isVoidType rettyp) then - add_lval ~indirect:true (Build.logic_return rettyp, `ArgOut); + add_lval ~indirect:true (Build.tresult rettyp, `ArgOut); (* Build the assign clause *) let froms = List.map (fun iterm -> iterm, From !sources) !dests in @@ -445,12 +521,8 @@ let build_fun_spec env loc vf format_fun tvparams formals = (* --- Call translation --- *) -let format_fun_call ~fundec env format_fun vf stmt = - (* Extract call informations *) - let lval, args, loc = match stmt.skind with - | Instr(Call(lval, _, args, loc)) -> lval, args, loc - | _ -> assert false - and name = vf.vf_decl.vorig_name +let format_fun_call ~fundec env format_fun scope loc mk_call vf args = + let name = vf.vf_decl.vorig_name and params = Typ.params vf.vf_decl.vtype in (* Remove the va_param parameter added during the declaration visit *) let fixed_params_count = Typ.params_count vf.vf_original_type in @@ -459,14 +531,13 @@ let format_fun_call ~fundec env format_fun vf stmt = (* Extract the format if possible *) let format = try - let format_arg = - try List.nth args format_fun.f_format_pos - with Failure _ (* nth *)-> Self.abort - "The function %s does not have the expected number of arguments." - name - in - match Cil.static_string format_arg with - | None -> raise Translate_call_exn (* No syntactic hint *) + let format_arg = List.nth args format_fun.f_format_pos in + match static_string format_arg with + | None -> + Self.warning ~current:true + "Call to function %s with non-static format argument:@ \ + no specification will be generated." name; + raise Translate_call_exn (* No syntactic hint *) | Some s -> Format_parser.parse_format format_fun.f_kind s with | Format_parser.Invalid_format -> raise Translate_call_exn @@ -474,7 +545,18 @@ let format_fun_call ~fundec env format_fun vf stmt = (* Try to type expected parameters if possible *) let find_typedef = Environment.find_type env in - let tvparams = Format_typer.type_format ~find_typedef format in + let tvparams = + try + Format_typer.type_format ~find_typedef format + with Format_typer.Type_not_found type_name -> + Self.warning ~current:true + "Unable to find type %s in the source code which should be used in \ + this call:@ no specification will be generated.@ \ + Note that due to cleanup, the type may have been defined in the \ + original code but not used anywhere." + type_name; + raise Translate_call_exn + in let new_param i (typ,_dir) = let typ = if Cil.isIntegralType typ then Cil.integralPromotion typ @@ -487,11 +569,17 @@ let format_fun_call ~fundec env format_fun vf stmt = let new_params = sparams @ vparams in (* Create the new callee *) + vf.vf_specialization_count <- vf.vf_specialization_count + 1; let ret_typ, _, _, attributes = Cil.splitFunctionType vf.vf_decl.vtype in - let new_callee_typ = TFun (ret_typ, Some new_params, false, attributes) in - let mk_spec formals = build_fun_spec env loc vf format_fun tvparams formals in - let new_callee, glob = Build.function_declaration ~loc:vf.vf_decl.vdecl - name new_callee_typ mk_spec in + let new_callee_typ = TFun (ret_typ, Some new_params, false, attributes) + and new_name = name ^ "_va_" ^ (string_of_int vf.vf_specialization_count) + and mk_spec formals = build_fun_spec env loc vf format_fun tvparams formals + in + let new_callee, glob = + Build.function_declaration ~vattr:[Attr ("fc_stdlib_generated", [])] + ~loc:vf.vf_decl.vdecl name new_callee_typ mk_spec + in + new_callee.vname <- new_name; new_globals := glob :: !new_globals; (* Translate the call *) @@ -499,6 +587,4 @@ let format_fun_call ~fundec env format_fun vf stmt = "Translating call to %s to a call to the specialized version %s." name new_callee.vname; let tparams = params_types new_params in - match_call ~fundec stmt loc lval new_callee tparams args - - + match_call ~loc ~fundec scope mk_call new_callee tparams args diff --git a/src/plugins/variadic/tests/declared/oracle/empty-vpar.res.oracle b/src/plugins/variadic/tests/declared/oracle/empty-vpar.res.oracle index 8cbf464ed2cb85368b49c705af11e29c3675738c..e062740168ee57ac07e60d951eb79aac6857ee4d 100644 --- a/src/plugins/variadic/tests/declared/oracle/empty-vpar.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/empty-vpar.res.oracle @@ -1,5 +1,5 @@ -tests/declared/empty-vpar.c:1:[va] Declaration of variadic function f. -tests/declared/empty-vpar.c:8:[va] Generic translation of call to variadic function. +tests/declared/empty-vpar.c:1:[variadic] Declaration of variadic function f. +tests/declared/empty-vpar.c:8:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -21,7 +21,7 @@ int main(void) { int __retres; { - void *__va_args[1]; + void *__va_args[1] = {(void *)0}; f(1,2,3,(void * const *)(__va_args)); } __retres = 0; diff --git a/src/plugins/variadic/tests/declared/oracle/label.res.oracle b/src/plugins/variadic/tests/declared/oracle/label.res.oracle index d8659e6ded1b8bf06095c4c382ec4e3b063b2c03..b59018da12a69ce24fef414112db95f4360bf52c 100644 --- a/src/plugins/variadic/tests/declared/oracle/label.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/label.res.oracle @@ -1,5 +1,5 @@ -tests/declared/label.c:4:[va] Declaration of variadic function f. -tests/declared/label.c:8:[va] Generic translation of call to variadic function. +tests/declared/label.c:4:[variadic] Declaration of variadic function f. +tests/declared/label.c:8:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -18,16 +18,12 @@ int main(void) { int __retres; lbl: - { - void *__va_args[2]; - int __va_arg1; - int __va_arg0; - __va_arg0 = 2; - __va_arg1 = 3; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - f(1,(void * const *)(__va_args)); - } + { + int __va_arg0 = 2; + int __va_arg1 = 3; + void *__va_args[2] = {& __va_arg0, & __va_arg1}; + f(1,(void * const *)(__va_args)); + } __retres = 0; return __retres; } diff --git a/src/plugins/variadic/tests/declared/oracle/multi.res.oracle b/src/plugins/variadic/tests/declared/oracle/multi.res.oracle index 05edc288f53c4978393508af29163d90063385af..eebba8b2fb361473a8586c9d6984c3771805fccf 100644 --- a/src/plugins/variadic/tests/declared/oracle/multi.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/multi.res.oracle @@ -1,7 +1,7 @@ -tests/declared/multi.c:1:[va] Declaration of variadic function f. -tests/declared/multi.c:12:[va] Declaration of variadic function g. -tests/declared/multi.c:9:[va] Generic translation of call to variadic function. -tests/declared/multi.c:18:[va] Generic translation of call to variadic function. +tests/declared/multi.c:1:[variadic] Declaration of variadic function f. +tests/declared/multi.c:12:[variadic] Declaration of variadic function g. +tests/declared/multi.c:9:[variadic] Generic translation of call to variadic function. +tests/declared/multi.c:18:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -32,16 +32,10 @@ int call1(void) { int tmp; { - void *__va_args[3]; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 4; - __va_arg1 = 5; - __va_arg2 = 6; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; + int __va_arg0 = 4; + int __va_arg1 = 5; + int __va_arg2 = 6; + void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; tmp = f(1,2,3,(void * const *)(__va_args)); } return tmp; @@ -56,10 +50,8 @@ void g(int b, int c, void * const *__va_params); void call2(void) { { - void *__va_args[1]; - int __va_arg0; - __va_arg0 = 4; - __va_args[0] = & __va_arg0; + int __va_arg0 = 4; + void *__va_args[1] = {& __va_arg0}; g(-2,3,(void * const *)(__va_args)); } return; diff --git a/src/plugins/variadic/tests/declared/oracle/rvalues.res.oracle b/src/plugins/variadic/tests/declared/oracle/rvalues.res.oracle index 4ecf3cf6aa504d5324d00248ef92b16fa85a336f..029acc9b8e0d7dbadef8031a9aab83c86605231b 100644 --- a/src/plugins/variadic/tests/declared/oracle/rvalues.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/rvalues.res.oracle @@ -1,5 +1,5 @@ -tests/declared/rvalues.c:1:[va] Declaration of variadic function f. -tests/declared/rvalues.c:5:[va] Generic translation of call to variadic function. +tests/declared/rvalues.c:1:[variadic] Declaration of variadic function f. +tests/declared/rvalues.c:5:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -10,6 +10,12 @@ tests/declared/rvalues.c:5:[kernel] warning: Neither code nor specification for [value:final-states] Values at end of function main: x ∈ {0} i ∈ [--..--] + __va_arg0 ∈ {5} + __va_arg1 ∈ {20} + __va_arg2 ∈ {{ &x }} + __va_args[0] ∈ {{ (void *)&__va_arg0 }} + [1] ∈ {{ (void *)&__va_arg1 }} + [2] ∈ {{ (void *)&__va_arg2 }} /* Generated by Frama-C */ /*@ assigns \result; assigns \result \from a; */ @@ -17,22 +23,12 @@ int f(int a, void * const *__va_params); int main(void) { - int x; - int i; - x = 0; - { - void *__va_args[3]; - int *__va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 2 + 3; - __va_arg1 = 4 * 5; - __va_arg2 = & x; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - i = f(1,(void * const *)(__va_args)); - } + int x = 0; + int __va_arg0 = 2 + 3; + int __va_arg1 = 4 * 5; + int *__va_arg2 = & x; + void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; + int i = f(1,(void * const *)(__va_args)); return i; } diff --git a/src/plugins/variadic/tests/declared/oracle/simple.res.oracle b/src/plugins/variadic/tests/declared/oracle/simple.res.oracle index 6b1d4586fe36225fd799d008357e8ac14ccf5851..e98470b76bc4eb7f121cbb756f92cc4fc3ae9e7f 100644 --- a/src/plugins/variadic/tests/declared/oracle/simple.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/simple.res.oracle @@ -1,5 +1,5 @@ -tests/declared/simple.c:1:[va] Declaration of variadic function f. -tests/declared/simple.c:9:[va] Generic translation of call to variadic function. +tests/declared/simple.c:1:[variadic] Declaration of variadic function f. +tests/declared/simple.c:9:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -24,16 +24,10 @@ int main(void) { int tmp; { - void *__va_args[3]; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 4; - __va_arg1 = 5; - __va_arg2 = 6; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; + int __va_arg0 = 4; + int __va_arg1 = 5; + int __va_arg2 = 6; + void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; tmp = f(1,2,3,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/declared/oracle/struct.res.oracle b/src/plugins/variadic/tests/declared/oracle/struct.res.oracle index 3a41b61f188489c84d0d2d3da33b4fec8024ab2b..ebac431d3701479dfb34259a91430fb4cddcb825 100644 --- a/src/plugins/variadic/tests/declared/oracle/struct.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/struct.res.oracle @@ -1,5 +1,5 @@ -tests/declared/struct.c:5:[va] Declaration of variadic function f. -tests/declared/struct.c:10:[va] Generic translation of call to variadic function. +tests/declared/struct.c:5:[variadic] Declaration of variadic function f. +tests/declared/struct.c:10:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -30,25 +30,13 @@ int f(int n, void * const *__va_params); int main(void) { - s s1; - s s2; int tmp; - s1.a = 0; - s1.b = 1; - s1.c = 2; - s1.d = 3; - s2.a = 4; - s2.b = 5; - s2.c = 6; - s2.d = 7; + s s1 = {.a = 0, .b = 1, .c = 2, .d = 3}; + s s2 = {.a = 4, .b = 5, .c = 6, .d = 7}; { - void *__va_args[2]; - s __va_arg1; - s __va_arg0; - __va_arg0 = s1; - __va_arg1 = s2; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; + s __va_arg0 = s1; + s __va_arg1 = s2; + void *__va_args[2] = {& __va_arg0, & __va_arg1}; tmp = f(2,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/declared/oracle/typedefed_function.res.oracle b/src/plugins/variadic/tests/declared/oracle/typedefed_function.res.oracle index b7157054e4d85af296498b07e6708f64b97d26a8..c0cc5c27861f13f4d27fe39c6c5991a5ca204f97 100644 --- a/src/plugins/variadic/tests/declared/oracle/typedefed_function.res.oracle +++ b/src/plugins/variadic/tests/declared/oracle/typedefed_function.res.oracle @@ -1,5 +1,5 @@ -tests/declared/typedefed_function.c:2:[va] Declaration of variadic function f. -tests/declared/typedefed_function.c:5:[va] Generic translation of call to variadic function. +tests/declared/typedefed_function.c:2:[variadic] Declaration of variadic function f. +tests/declared/typedefed_function.c:5:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -18,13 +18,9 @@ int main(void) { int __retres; { - void *__va_args[2]; - int __va_arg1; - int __va_arg0; - __va_arg0 = 2; - __va_arg1 = 0; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; + int __va_arg0 = 2; + int __va_arg1 = 0; + void *__va_args[2] = {& __va_arg0, & __va_arg1}; f(1,(void * const *)(__va_args)); } __retres = 0; diff --git a/src/plugins/variadic/tests/defined/multiple-va_start.c b/src/plugins/variadic/tests/defined/multiple-va_start.c index 2ad4af60496edb85baf284e7bc3efcb4bf3da7b6..6c64d73d5fb4ee3bc23f593c42dd4dacc1f166bc 100644 --- a/src/plugins/variadic/tests/defined/multiple-va_start.c +++ b/src/plugins/variadic/tests/defined/multiple-va_start.c @@ -1,5 +1,5 @@ /* run.config -STDOPT: +"-val-builtin malloc:Frama_C_alloc_by_stack -no-val-malloc-returns-null" +STDOPT: +"-no-val-malloc-returns-null" */ diff --git a/src/plugins/variadic/tests/defined/oracle/annot-formal.res.oracle b/src/plugins/variadic/tests/defined/oracle/annot-formal.res.oracle index e3be5609a871fad75247f4714fa456534671c9b8..9223490d5bb19ec87cb3b8a9c65532f272b33e46 100644 --- a/src/plugins/variadic/tests/defined/oracle/annot-formal.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/annot-formal.res.oracle @@ -1,5 +1,5 @@ -tests/defined/annot-formal.c:4:[va] Declaration of variadic function sum. -tests/defined/annot-formal.c:20:[va] Generic translation of call to variadic function. +tests/defined/annot-formal.c:4:[variadic] Declaration of variadic function sum. +tests/defined/annot-formal.c:20:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -16,21 +16,18 @@ tests/defined/annot-formal.c:20:[va] Generic translation of call to variadic fun /*@ requires n ≥ 0; */ int sum(int n, void * const *__va_params) { - int ret; int i; va_list list; - ret = 0; + int ret = 0; list = __va_params; i = 0; /*@ loop invariant 0 < n; */ while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*list); - list ++; - ret += tmp; - } + tmp = *((int *)*list); + list ++; + ret += tmp; } i ++; } @@ -41,22 +38,13 @@ int main(void) { int tmp; { - void *__va_args[5]; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 6; - __va_arg1 = 9; - __va_arg2 = 14; - __va_arg3 = 12; - __va_arg4 = 1; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; + int __va_arg0 = 6; + int __va_arg1 = 9; + int __va_arg2 = 14; + int __va_arg3 = 12; + int __va_arg4 = 1; + void *__va_args[5] = + {& __va_arg0, & __va_arg1, & __va_arg2, & __va_arg3, & __va_arg4}; tmp = sum(5,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/annot-loc.res.oracle b/src/plugins/variadic/tests/defined/oracle/annot-loc.res.oracle index d43ca7da5bca4619e581b0e3f105398fbdd9d02e..7bb382712c779843bbd386dc28bb6803351754c0 100644 --- a/src/plugins/variadic/tests/defined/oracle/annot-loc.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/annot-loc.res.oracle @@ -1,5 +1,5 @@ -tests/defined/annot-loc.c:4:[va] Declaration of variadic function sum. -tests/defined/annot-loc.c:20:[va] Generic translation of call to variadic function. +tests/defined/annot-loc.c:4:[variadic] Declaration of variadic function sum. +tests/defined/annot-loc.c:20:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -16,22 +16,18 @@ tests/defined/annot-loc.c:20:[va] Generic translation of call to variadic functi /*@ requires n ≥ 0; */ int sum(int n, void * const *__va_params) { - int ret; - int i; va_list list; - ret = 0; - i = 0; + int ret = 0; + int i = 0; list = __va_params; i = 0; /*@ loop invariant 0 ≤ i; */ while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*list); - list ++; - ret += tmp; - } + tmp = *((int *)*list); + list ++; + ret += tmp; } i ++; } @@ -42,22 +38,13 @@ int main(void) { int tmp; { - void *__va_args[5]; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 6; - __va_arg1 = 9; - __va_arg2 = 14; - __va_arg3 = 12; - __va_arg4 = 1; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; + int __va_arg0 = 6; + int __va_arg1 = 9; + int __va_arg2 = 14; + int __va_arg3 = 12; + int __va_arg4 = 1; + void *__va_args[5] = + {& __va_arg0, & __va_arg1, & __va_arg2, & __va_arg3, & __va_arg4}; tmp = sum(5,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/empty-vpar.res.oracle b/src/plugins/variadic/tests/defined/oracle/empty-vpar.res.oracle index 5375d9a3f75b859a6beb58f7b3aee0ecb36eed99..81cf318efaad90b22efee432a04f07371888dae3 100644 --- a/src/plugins/variadic/tests/defined/oracle/empty-vpar.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/empty-vpar.res.oracle @@ -1,5 +1,5 @@ -tests/defined/empty-vpar.c:4:[va] Declaration of variadic function sum. -tests/defined/empty-vpar.c:19:[va] Generic translation of call to variadic function. +tests/defined/empty-vpar.c:4:[variadic] Declaration of variadic function sum. +tests/defined/empty-vpar.c:19:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -16,20 +16,16 @@ tests/defined/empty-vpar.c:19:[va] Generic translation of call to variadic funct /*@ requires n ≥ 0; */ int sum(int n, void * const *__va_params) { - int ret; - int i; va_list list; - ret = 0; - i = 0; + int ret = 0; + int i = 0; list = __va_params; while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*list); - list ++; - ret += tmp; - } + tmp = *((int *)*list); + list ++; + ret += tmp; } i ++; } @@ -40,7 +36,7 @@ int main(void) { int tmp; { - void *__va_args[1]; + void *__va_args[1] = {(void *)0}; tmp = sum(0,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/forward.res.oracle b/src/plugins/variadic/tests/defined/oracle/forward.res.oracle index af4b94d5518706557f6bdf6284b9ebdbfa8c2136..d0bf1e260d8766d3c5df428315b92444694197e4 100644 --- a/src/plugins/variadic/tests/defined/oracle/forward.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/forward.res.oracle @@ -1,5 +1,5 @@ -tests/defined/forward.c:3:[va] Declaration of variadic function sum. -tests/defined/forward.c:8:[va] Generic translation of call to variadic function. +tests/defined/forward.c:3:[variadic] Declaration of variadic function sum. +tests/defined/forward.c:8:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -19,22 +19,13 @@ int main(void) { int tmp; { - void *__va_args[5]; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 6; - __va_arg1 = 9; - __va_arg2 = 14; - __va_arg3 = 12; - __va_arg4 = 1; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; + int __va_arg0 = 6; + int __va_arg1 = 9; + int __va_arg2 = 14; + int __va_arg3 = 12; + int __va_arg4 = 1; + void *__va_args[5] = + {& __va_arg0, & __va_arg1, & __va_arg2, & __va_arg3, & __va_arg4}; tmp = sum(5,(void * const *)(__va_args)); } return tmp; @@ -44,20 +35,16 @@ int main(void) ensures \result ≥ 0; */ int sum(int n, void * const *__va_params) { - int ret; - int i; va_list args; - ret = 0; - i = 0; + int ret = 0; + int i = 0; args = __va_params; while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*args); - args ++; - ret += tmp; - } + tmp = *((int *)*args); + args ++; + ret += tmp; } i ++; } diff --git a/src/plugins/variadic/tests/defined/oracle/max.res.oracle b/src/plugins/variadic/tests/defined/oracle/max.res.oracle index 6e763e3d2d8dc48ab43e788838457323fd876f31..681f8e0085c02883c0850c6b575356e9bc23f62d 100644 --- a/src/plugins/variadic/tests/defined/oracle/max.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/max.res.oracle @@ -1,5 +1,5 @@ -tests/defined/max.c:3:[va] Declaration of variadic function max. -tests/defined/max.c:20:[va] Generic translation of call to variadic function. +tests/defined/max.c:3:[variadic] Declaration of variadic function max. +tests/defined/max.c:20:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -37,34 +37,25 @@ int main(void) { int tmp; { - void *__va_args[9]; - int __va_arg8; - int __va_arg7; - int __va_arg6; - int __va_arg5; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 3; - __va_arg1 = -7; - __va_arg2 = 14; - __va_arg3 = 42; - __va_arg4 = 23; - __va_arg5 = -57; - __va_arg6 = 73; - __va_arg7 = 92; - __va_arg8 = 8; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; - __va_args[5] = & __va_arg5; - __va_args[6] = & __va_arg6; - __va_args[7] = & __va_arg7; - __va_args[8] = & __va_arg8; + int __va_arg0 = 3; + int __va_arg1 = -7; + int __va_arg2 = 14; + int __va_arg3 = 42; + int __va_arg4 = 23; + int __va_arg5 = -57; + int __va_arg6 = 73; + int __va_arg7 = 92; + int __va_arg8 = 8; + void *__va_args[9] = + {& __va_arg0, + & __va_arg1, + & __va_arg2, + & __va_arg3, + & __va_arg4, + & __va_arg5, + & __va_arg6, + & __va_arg7, + & __va_arg8}; tmp = max(6,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/multiple-va_start.res.oracle b/src/plugins/variadic/tests/defined/oracle/multiple-va_start.res.oracle index 16afd8df4615696d2881fda4b4e7aa4b9349297c..e90d8ab22d27740ffaa821ed4d25553fc660c7ad 100644 --- a/src/plugins/variadic/tests/defined/oracle/multiple-va_start.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/multiple-va_start.res.oracle @@ -1,5 +1,5 @@ -tests/defined/multiple-va_start.c:9:[va] Declaration of variadic function pack. -tests/defined/multiple-va_start.c:32:[va] Generic translation of call to variadic function. +tests/defined/multiple-va_start.c:9:[variadic] Declaration of variadic function pack. +tests/defined/multiple-va_start.c:32:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -17,6 +17,18 @@ tests/defined/multiple-va_start.c:20:[value] allocating variable __malloc_pack_l [value:final-states] Values at end of function main: __fc_heap_status ∈ [--..--] p ∈ {{ &__malloc_pack_l20[0] }} + __va_arg0 ∈ {42} + __va_arg1 ∈ {42} + __va_arg2 ∈ {42} + __va_arg3 ∈ {42} + __va_arg4 ∈ {42} + __va_arg5 ∈ {0} + __va_args[0] ∈ {{ (void *)&__va_arg0 }} + [1] ∈ {{ (void *)&__va_arg1 }} + [2] ∈ {{ (void *)&__va_arg2 }} + [3] ∈ {{ (void *)&__va_arg3 }} + [4] ∈ {{ (void *)&__va_arg4 }} + [5] ∈ {{ (void *)&__va_arg5 }} __retres ∈ {42} __malloc_pack_l20[0..5] ∈ {42} [6] ∈ {0} @@ -53,29 +65,20 @@ int *pack(int first, void * const *__va_params) int main(void) { int __retres; - int *p; - { - void *__va_args[6]; - int __va_arg5; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 42; - __va_arg1 = 42; - __va_arg2 = 42; - __va_arg3 = 42; - __va_arg4 = 42; - __va_arg5 = 0; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; - __va_args[5] = & __va_arg5; - p = pack(42,(void * const *)(__va_args)); - } + int __va_arg0 = 42; + int __va_arg1 = 42; + int __va_arg2 = 42; + int __va_arg3 = 42; + int __va_arg4 = 42; + int __va_arg5 = 0; + void *__va_args[6] = + {& __va_arg0, + & __va_arg1, + & __va_arg2, + & __va_arg3, + & __va_arg4, + & __va_arg5}; + int *p = pack(42,(void * const *)(__va_args)); __retres = *(p + 0); return __retres; } diff --git a/src/plugins/variadic/tests/defined/oracle/pointers-to-va.res.oracle b/src/plugins/variadic/tests/defined/oracle/pointers-to-va.res.oracle index 5c01f294ec256fe7bebdbd1411bb7c9f823b0252..dafd2953cb1061af96100b0fef251df18fc1e117 100644 --- a/src/plugins/variadic/tests/defined/oracle/pointers-to-va.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/pointers-to-va.res.oracle @@ -1,9 +1,9 @@ -tests/defined/pointers-to-va.c:6:[va] Declaration of variadic function f. -tests/defined/pointers-to-va.c:17:[va] Declaration of variadic function g. -tests/defined/pointers-to-va.c:31:[va] Generic translation of call to variadic function. -tests/defined/pointers-to-va.c:32:[va] Generic translation of call to variadic function. -tests/defined/pointers-to-va.c:33:[va] Generic translation of call to variadic function. -tests/defined/pointers-to-va.c:34:[va] Generic translation of call to variadic function. +tests/defined/pointers-to-va.c:6:[variadic] Declaration of variadic function f. +tests/defined/pointers-to-va.c:17:[variadic] Declaration of variadic function g. +tests/defined/pointers-to-va.c:31:[variadic] Generic translation of call to variadic function. +tests/defined/pointers-to-va.c:32:[variadic] Generic translation of call to variadic function. +tests/defined/pointers-to-va.c:33:[variadic] Generic translation of call to variadic function. +tests/defined/pointers-to-va.c:34:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -33,11 +33,9 @@ void f(int n, void * const *__va_params) while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*list); - list ++; - global += tmp; - } + tmp = *((int *)*list); + list ++; + global += tmp; } i ++; } @@ -54,11 +52,9 @@ void g(int n, void * const *__va_params) while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*list); - list ++; - global *= tmp; - } + tmp = *((int *)*list); + list ++; + global *= tmp; } i ++; } @@ -68,49 +64,30 @@ void g(int n, void * const *__va_params) void (*applications[2])(int n, void * const *__va_params) = {& f, & g}; int main(void) { - void (*p)(int n, void * const *__va_params); - p = & f; + void (*p)(int n, void * const *__va_params) = & f; { - void *__va_args[1]; - int __va_arg0; - __va_arg0 = 1; - __va_args[0] = & __va_arg0; + int __va_arg0 = 1; + void *__va_args[1] = {& __va_arg0}; f(1,(void * const *)(__va_args)); } { - void *__va_args_9[3]; - int __va_arg2; - int __va_arg1; - int __va_arg0_5; - __va_arg0_5 = 0; - __va_arg1 = 1; - __va_arg2 = 2; - __va_args_9[0] = & __va_arg0_5; - __va_args_9[1] = & __va_arg1; - __va_args_9[2] = & __va_arg2; + int __va_arg0_5 = 0; + int __va_arg1 = 1; + int __va_arg2 = 2; + void *__va_args_9[3] = {& __va_arg0_5, & __va_arg1, & __va_arg2}; (*p)(3,(void * const *)(__va_args_9)); } { - void *__va_args_15[2]; - int __va_arg1_13; - int __va_arg0_11; - __va_arg0_11 = 2; - __va_arg1_13 = 3; - __va_args_15[0] = & __va_arg0_11; - __va_args_15[1] = & __va_arg1_13; + int __va_arg0_11 = 2; + int __va_arg1_13 = 3; + void *__va_args_15[2] = {& __va_arg0_11, & __va_arg1_13}; (*(applications[1]))(2,(void * const *)(__va_args_15)); } { - void *__va_args_23[3]; - int __va_arg2_21; - int __va_arg1_19; - int __va_arg0_17; - __va_arg0_17 = 4; - __va_arg1_19 = 5; - __va_arg2_21 = 9; - __va_args_23[0] = & __va_arg0_17; - __va_args_23[1] = & __va_arg1_19; - __va_args_23[2] = & __va_arg2_21; + int __va_arg0_17 = 4; + int __va_arg1_19 = 5; + int __va_arg2_21 = 9; + void *__va_args_23[3] = {& __va_arg0_17, & __va_arg1_19, & __va_arg2_21}; (*(applications[0]))(3,(void * const *)(__va_args_23)); } return global; diff --git a/src/plugins/variadic/tests/defined/oracle/recursive.res.oracle b/src/plugins/variadic/tests/defined/oracle/recursive.res.oracle index bb463c458a457ca7b8f84cc2d2d290358be06066..fb220b32fa26548bd31137524b51dffb0b3d8fdb 100644 --- a/src/plugins/variadic/tests/defined/oracle/recursive.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/recursive.res.oracle @@ -1,6 +1,6 @@ -tests/defined/recursive.c:1:[va] Declaration of variadic function f. -tests/defined/recursive.c:5:[va] Generic translation of call to variadic function. -tests/defined/recursive.c:9:[va] Generic translation of call to variadic function. +tests/defined/recursive.c:1:[variadic] Declaration of variadic function f. +tests/defined/recursive.c:5:[variadic] Generic translation of call to variadic function. +tests/defined/recursive.c:9:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -25,7 +25,7 @@ int f(int a, void * const *__va_params) else { int tmp; { - void *__va_args[1]; + void *__va_args[1] = {(void *)0}; tmp = f(a - 1,(void * const *)(__va_args)); } __retres = tmp; @@ -38,7 +38,7 @@ int main(void) { int tmp; { - void *__va_args[1]; + void *__va_args[1] = {(void *)0}; tmp = f(7,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/sentinel.res.oracle b/src/plugins/variadic/tests/defined/oracle/sentinel.res.oracle index 6205d9403691015242f275bbcd8e987bb0330c37..e658ece9be099830f53fd7c6cedda669577f24c1 100644 --- a/src/plugins/variadic/tests/defined/oracle/sentinel.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/sentinel.res.oracle @@ -1,5 +1,5 @@ -tests/defined/sentinel.c:3:[va] Declaration of variadic function sum. -tests/defined/sentinel.c:21:[va] Generic translation of call to variadic function. +tests/defined/sentinel.c:3:[variadic] Declaration of variadic function sum. +tests/defined/sentinel.c:21:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -15,10 +15,9 @@ tests/defined/sentinel.c:21:[va] Generic translation of call to variadic functio #include "stdarg.h" int sum(int n, void * const *__va_params) { - int ret; int tmp; va_list list; - ret = n; + int ret = n; list = __va_params; while (1) { tmp = *((int *)*list); @@ -33,22 +32,13 @@ int main(void) { int tmp; { - void *__va_args[5]; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 9; - __va_arg1 = 14; - __va_arg2 = 12; - __va_arg3 = 1; - __va_arg4 = 0; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; + int __va_arg0 = 9; + int __va_arg1 = 14; + int __va_arg2 = 12; + int __va_arg3 = 1; + int __va_arg4 = 0; + void *__va_args[5] = + {& __va_arg0, & __va_arg1, & __va_arg2, & __va_arg3, & __va_arg4}; tmp = sum(6,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/simple.res.oracle b/src/plugins/variadic/tests/defined/oracle/simple.res.oracle index a7cb17bede3b96bafe97d7e14edc3f4965699606..8882e1ab65f4e05ba92c6dc721a736b193ad8e62 100644 --- a/src/plugins/variadic/tests/defined/oracle/simple.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/simple.res.oracle @@ -1,5 +1,5 @@ -tests/defined/simple.c:4:[va] Declaration of variadic function sum. -tests/defined/simple.c:19:[va] Generic translation of call to variadic function. +tests/defined/simple.c:4:[variadic] Declaration of variadic function sum. +tests/defined/simple.c:19:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -16,20 +16,16 @@ tests/defined/simple.c:19:[va] Generic translation of call to variadic function. /*@ requires n ≥ 0; */ int sum(int n, void * const *__va_params) { - int ret; - int i; va_list list; - ret = 0; - i = 0; + int ret = 0; + int i = 0; list = __va_params; while (i < n) { { int tmp; - { /* sequence */ - tmp = *((int *)*list); - list ++; - ret += tmp; - } + tmp = *((int *)*list); + list ++; + ret += tmp; } i ++; } @@ -40,22 +36,13 @@ int main(void) { int tmp; { - void *__va_args[5]; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 6; - __va_arg1 = 9; - __va_arg2 = 14; - __va_arg3 = 12; - __va_arg4 = 1; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; + int __va_arg0 = 6; + int __va_arg1 = 9; + int __va_arg2 = 14; + int __va_arg3 = 12; + int __va_arg4 = 1; + void *__va_args[5] = + {& __va_arg0, & __va_arg1, & __va_arg2, & __va_arg3, & __va_arg4}; tmp = sum(5,(void * const *)(__va_args)); } return tmp; diff --git a/src/plugins/variadic/tests/defined/oracle/struct.res.oracle b/src/plugins/variadic/tests/defined/oracle/struct.res.oracle index 9cb2184f65375231777dc09f216aad088e53c339..2c1088c54970e7e9c83d0009cc9ed8b51dcaca9b 100644 --- a/src/plugins/variadic/tests/defined/oracle/struct.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/struct.res.oracle @@ -1,5 +1,5 @@ -tests/defined/struct.c:18:[va] Declaration of variadic function inter. -tests/defined/struct.c:41:[va] Generic translation of call to variadic function. +tests/defined/struct.c:18:[variadic] Declaration of variadic function inter. +tests/defined/struct.c:41:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -58,12 +58,10 @@ int max(int a, int b) rect inter(int n, rect first, void * const *__va_params) { - rect ret; rect tmp; - int i; va_list list; - ret = first; - i = 0; + rect ret = first; + int i = 0; list = __va_params; i = 1; while (i < n) { @@ -82,21 +80,11 @@ int main(void) { int __retres; rect r; - rect r1; - rect r2; - r1.left = 10; - r1.top = 10; - r1.right = 50; - r1.bottom = 70; - r2.left = 0; - r2.top = 30; - r2.right = 20; - r2.bottom = 60; + rect r1 = {.left = 10, .top = 10, .right = 50, .bottom = 70}; + rect r2 = {.left = 0, .top = 30, .right = 20, .bottom = 60}; { - void *__va_args[1]; - rect __va_arg0; - __va_arg0 = r2; - __va_args[0] = & __va_arg0; + rect __va_arg0 = r2; + void *__va_args[1] = {& __va_arg0}; r = inter(2,r1,(void * const *)(__va_args)); } __retres = 0; diff --git a/src/plugins/variadic/tests/defined/oracle/va_copy.res.oracle b/src/plugins/variadic/tests/defined/oracle/va_copy.res.oracle index 090343fe96ca451a34d9a7756965fcf21370d2a6..04a411469e45945405592bbf95cdd531780c1b50 100644 --- a/src/plugins/variadic/tests/defined/oracle/va_copy.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/va_copy.res.oracle @@ -1,5 +1,5 @@ -tests/defined/va_copy.c:9:[va] Declaration of variadic function pack. -tests/defined/va_copy.c:32:[va] Generic translation of call to variadic function. +tests/defined/va_copy.c:9:[variadic] Declaration of variadic function pack. +tests/defined/va_copy.c:32:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -18,6 +18,18 @@ tests/defined/va_copy.c:21:[value] allocating variable __malloc_pack_l21 [value:final-states] Values at end of function main: __fc_heap_status ∈ [--..--] p ∈ {{ &__malloc_pack_l21[0] }} + __va_arg0 ∈ {42} + __va_arg1 ∈ {42} + __va_arg2 ∈ {42} + __va_arg3 ∈ {42} + __va_arg4 ∈ {42} + __va_arg5 ∈ {0} + __va_args[0] ∈ {{ (void *)&__va_arg0 }} + [1] ∈ {{ (void *)&__va_arg1 }} + [2] ∈ {{ (void *)&__va_arg2 }} + [3] ∈ {{ (void *)&__va_arg3 }} + [4] ∈ {{ (void *)&__va_arg4 }} + [5] ∈ {{ (void *)&__va_arg5 }} __retres ∈ {42} __malloc_pack_l21[0..5] ∈ {42} [6] ∈ {0} @@ -55,29 +67,20 @@ int *pack(int first, void * const *__va_params) int main(void) { int __retres; - int *p; - { - void *__va_args[6]; - int __va_arg5; - int __va_arg4; - int __va_arg3; - int __va_arg2; - int __va_arg1; - int __va_arg0; - __va_arg0 = 42; - __va_arg1 = 42; - __va_arg2 = 42; - __va_arg3 = 42; - __va_arg4 = 42; - __va_arg5 = 0; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; - __va_args[5] = & __va_arg5; - p = pack(42,(void * const *)(__va_args)); - } + int __va_arg0 = 42; + int __va_arg1 = 42; + int __va_arg2 = 42; + int __va_arg3 = 42; + int __va_arg4 = 42; + int __va_arg5 = 0; + void *__va_args[6] = + {& __va_arg0, + & __va_arg1, + & __va_arg2, + & __va_arg3, + & __va_arg4, + & __va_arg5}; + int *p = pack(42,(void * const *)(__va_args)); __retres = *(p + 0); return __retres; } diff --git a/src/plugins/variadic/tests/defined/oracle/va_list-as-arg.res.oracle b/src/plugins/variadic/tests/defined/oracle/va_list-as-arg.res.oracle index 4cd3cb9ef0ee3c53fcf1c8061b74e3f674692b9b..5094d5b7e90efb867a786e167752a2762d1c90a3 100644 --- a/src/plugins/variadic/tests/defined/oracle/va_list-as-arg.res.oracle +++ b/src/plugins/variadic/tests/defined/oracle/va_list-as-arg.res.oracle @@ -1,5 +1,5 @@ -tests/defined/va_list-as-arg.c:15:[va] Declaration of variadic function sum. -tests/defined/va_list-as-arg.c:25:[va] Generic translation of call to variadic function. +tests/defined/va_list-as-arg.c:15:[variadic] Declaration of variadic function sum. +tests/defined/va_list-as-arg.c:25:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -20,8 +20,7 @@ tests/defined/va_list-as-arg.c:25:[va] Generic translation of call to variadic f float vsum(int n, va_list list) { int i; - float ret; - ret = (float)0.0; + float ret = (float)0.0; i = 0; while (i < n) { { @@ -30,19 +29,15 @@ float vsum(int n, va_list list) list ++; if (tmp_1) { double tmp; - { /* sequence */ - tmp = *((double *)*list); - list ++; - ret = (float)((double)ret + tmp); - } + tmp = *((double *)*list); + list ++; + ret = (float)((double)ret + tmp); } else { int tmp_0; - { /* sequence */ - tmp_0 = *((int *)*list); - list ++; - ret += (float)tmp_0; - } + tmp_0 = *((int *)*list); + list ++; + ret += (float)tmp_0; } } i ++; @@ -57,10 +52,8 @@ float sum(int n, void * const *__va_params) va_list list; float tmp_0; list = __va_params; - { /* sequence */ - tmp_0 = vsum(n,list); - tmp = (int)tmp_0; - } + tmp_0 = vsum(n,list); + tmp = (int)tmp_0; __retres = (float)tmp; return __retres; } @@ -70,31 +63,23 @@ int main(void) int __retres; float tmp; { - void *__va_args[8]; - int __va_arg7; - int __va_arg6; - double __va_arg5; - int __va_arg4; - int __va_arg3; - int __va_arg2; - double __va_arg1; - int __va_arg0; - __va_arg0 = 1; - __va_arg1 = 3.5; - __va_arg2 = 0; - __va_arg3 = 14; - __va_arg4 = 1; - __va_arg5 = 3.5; - __va_arg6 = 0; - __va_arg7 = 21; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; - __va_args[5] = & __va_arg5; - __va_args[6] = & __va_arg6; - __va_args[7] = & __va_arg7; + int __va_arg0 = 1; + double __va_arg1 = 3.5; + int __va_arg2 = 0; + int __va_arg3 = 14; + int __va_arg4 = 1; + double __va_arg5 = 3.5; + int __va_arg6 = 0; + int __va_arg7 = 21; + void *__va_args[8] = + {& __va_arg0, + & __va_arg1, + & __va_arg2, + & __va_arg3, + & __va_arg4, + & __va_arg5, + & __va_arg6, + & __va_arg7}; tmp = sum(4,(void * const *)(__va_args)); } __retres = (int)tmp; diff --git a/src/plugins/variadic/tests/defined/va_copy.c b/src/plugins/variadic/tests/defined/va_copy.c index 3eb20655e2c42ca2084a59b8f7281635a3222c13..4790c99d7902145357b13966e35a1919dfb1d0b3 100644 --- a/src/plugins/variadic/tests/defined/va_copy.c +++ b/src/plugins/variadic/tests/defined/va_copy.c @@ -1,5 +1,5 @@ /* run.config -STDOPT: +"-val-builtin malloc:Frama_C_alloc_by_stack -no-val-malloc-returns-null" +STDOPT: +"-no-val-malloc-returns-null" */ diff --git a/src/plugins/variadic/tests/erroneous/invalid_libc.c b/src/plugins/variadic/tests/erroneous/invalid_libc.c new file mode 100644 index 0000000000000000000000000000000000000000..a65482be484ee183f8835daba15b31c94a5bb0c7 --- /dev/null +++ b/src/plugins/variadic/tests/erroneous/invalid_libc.c @@ -0,0 +1,7 @@ +// Missing stream parameter +extern int fprintf (const char *restrict __format, ...); + +void main(void) +{ + fprintf("GCC compiles but crashes during execution"); +} diff --git a/src/plugins/variadic/tests/erroneous/oracle/exec.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/exec.res.oracle index 259221e32fb617765ee0c3b381e6be22b47bc07e..c6e0107288870372d722d20a456ebb38f7210190 100644 --- a/src/plugins/variadic/tests/erroneous/oracle/exec.res.oracle +++ b/src/plugins/variadic/tests/erroneous/oracle/exec.res.oracle @@ -1,11 +1,11 @@ -FRAMAC_SHARE/libc/unistd.h:744:[va] Declaration of variadic function execl. -FRAMAC_SHARE/libc/unistd.h:750:[va] Declaration of variadic function execle. -FRAMAC_SHARE/libc/unistd.h:756:[va] Declaration of variadic function execlp. -tests/erroneous/exec.c:5:[va] warning: Incorrect type for argument 3. The argument will be cast from int to char *. -tests/erroneous/exec.c:5:[va] Translating call to execl to a call to execv. -tests/erroneous/exec.c:7:[va] warning: Failed to find a sentinel (NULL pointer) in the argument list. -tests/erroneous/exec.c:7:[va] Generic translation of call to variadic function. -tests/erroneous/exec.c:9:[va] warning: Not enough arguments: expected 5, given 4. -tests/erroneous/exec.c:9:[va] Generic translation of call to variadic function. -tests/erroneous/exec.c:11:[va] warning: Incorrect type for argument 5. The argument will be cast from int to char * const *. -tests/erroneous/exec.c:11:[va] Translating call to execle to a call to execve. +FRAMAC_SHARE/libc/unistd.h:744:[variadic] Declaration of variadic function execl. +FRAMAC_SHARE/libc/unistd.h:750:[variadic] Declaration of variadic function execle. +FRAMAC_SHARE/libc/unistd.h:756:[variadic] Declaration of variadic function execlp. +tests/erroneous/exec.c:5:[variadic] warning: Incorrect type for argument 3. The argument will be cast from int to char *. +tests/erroneous/exec.c:5:[variadic] Translating call to execl to a call to execv. +tests/erroneous/exec.c:7:[variadic] warning: Failed to find a sentinel (NULL pointer) in the argument list. +tests/erroneous/exec.c:7:[variadic] Generic translation of call to variadic function. +tests/erroneous/exec.c:9:[variadic] warning: Not enough arguments: expected 5, given 4. +tests/erroneous/exec.c:9:[variadic] Generic translation of call to variadic function. +tests/erroneous/exec.c:11:[variadic] warning: Incorrect type for argument 5. The argument will be cast from int to char * const *. +tests/erroneous/exec.c:11:[variadic] Translating call to execle to a call to execve. diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.2.err.oracle b/src/plugins/variadic/tests/erroneous/oracle/invalid_libc.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp/oracle_qualif/wp_behav.2.err.oracle rename to src/plugins/variadic/tests/erroneous/oracle/invalid_libc.err.oracle diff --git a/src/plugins/variadic/tests/erroneous/oracle/invalid_libc.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/invalid_libc.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..3156d8ec50c88de22e7ce923ca9c6f69266c405a --- /dev/null +++ b/src/plugins/variadic/tests/erroneous/oracle/invalid_libc.res.oracle @@ -0,0 +1,4 @@ +tests/erroneous/invalid_libc.c:2:[variadic] Declaration of variadic function fprintf. +tests/erroneous/invalid_libc.c:2:[variadic] warning: The standard function fprintf was expected to have at least 2 fixed parameters but only has 1. + No variadic translation will be performed. +tests/erroneous/invalid_libc.c:6:[variadic] Generic translation of call to variadic function. diff --git a/src/plugins/variadic/tests/erroneous/oracle/no-libc.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/no-libc.res.oracle index c2a95372935a9cf14979adfdc24efb1e06787287..b008f1edbbd7e0385d3b40cf13258781b30e13c4 100644 --- a/src/plugins/variadic/tests/erroneous/oracle/no-libc.res.oracle +++ b/src/plugins/variadic/tests/erroneous/oracle/no-libc.res.oracle @@ -1,4 +1,4 @@ -tests/erroneous/no-libc.c:1:[va] Declaration of variadic function printf. -[va] warning: Unable to locate ACSL predicate valid_read_string which should be in the Frama-C LibC. Correct specifications can't be generated. -[va] warning: Unable to locate global __fc_stdout which should be in the Frama-C LibC. Correct specifications can't be generated. -tests/erroneous/no-libc.c:5:[va] Translating call to printf to a call to the specialized version printf_0. +tests/erroneous/no-libc.c:1:[variadic] Declaration of variadic function printf. +[variadic] warning: Unable to locate ACSL predicate valid_read_string which should be in the Frama-C LibC. Correct specifications can't be generated. +[variadic] warning: Unable to locate global __fc_stdout which should be in the Frama-C LibC. Correct specifications can't be generated. +tests/erroneous/no-libc.c:5:[variadic] Translating call to printf to a call to the specialized version printf_va_1. diff --git a/src/plugins/variadic/tests/erroneous/oracle/printf.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/printf.res.oracle index f7caff9f0fdad00dcd704a6ab95018db946a4328..d6d2eadd63945653ba7b477156a7228db6cd4d55 100644 --- a/src/plugins/variadic/tests/erroneous/oracle/printf.res.oracle +++ b/src/plugins/variadic/tests/erroneous/oracle/printf.res.oracle @@ -1,4 +1,4 @@ -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -tests/erroneous/printf.c:8:[va] warning: Multiple usage of flag '-'. -tests/erroneous/printf.c:8:[va] warning: Flag ' ' and conversion specififer e are not compatibles. -tests/erroneous/printf.c:8:[va] Generic translation of call to variadic function. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +tests/erroneous/printf.c:8:[variadic] warning: Multiple usage of flag '-'. +tests/erroneous/printf.c:8:[variadic] warning: Flag ' ' and conversion specififer e are not compatibles. +tests/erroneous/printf.c:8:[variadic] Generic translation of call to variadic function. diff --git a/src/plugins/variadic/tests/erroneous/oracle/va_arg-wrongtype.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/va_arg-wrongtype.res.oracle index b0654bbb051d6af3a4473b5fea9ab1ff0aea4a7f..29aac63c68233633732a3b3d69570e4f178b1d68 100644 --- a/src/plugins/variadic/tests/erroneous/oracle/va_arg-wrongtype.res.oracle +++ b/src/plugins/variadic/tests/erroneous/oracle/va_arg-wrongtype.res.oracle @@ -1,3 +1,3 @@ -tests/erroneous/va_arg-wrongtype.c:3:[va] Declaration of variadic function sum. -tests/erroneous/va_arg-wrongtype.c:9:[va] warning: Wrong type argument in va_start: short is promoted to int when used in the variadic part of the arguments. (You should pass int to va_start) -tests/erroneous/va_arg-wrongtype.c:18:[va] Generic translation of call to variadic function. +tests/erroneous/va_arg-wrongtype.c:3:[variadic] Declaration of variadic function sum. +tests/erroneous/va_arg-wrongtype.c:9:[variadic] warning: Wrong type argument in va_start: short is promoted to int when used in the variadic part of the arguments. (You should pass int to va_start) +tests/erroneous/va_arg-wrongtype.c:18:[variadic] Generic translation of call to variadic function. diff --git a/src/plugins/variadic/tests/erroneous/oracle/variadic-builtin.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/variadic-builtin.res.oracle index 93da1c36304adf08a3eb0f30e211bdd678cdb087..0d5d7a592c373878b3103e214f2c0e27895382f8 100644 --- a/src/plugins/variadic/tests/erroneous/oracle/variadic-builtin.res.oracle +++ b/src/plugins/variadic/tests/erroneous/oracle/variadic-builtin.res.oracle @@ -1,4 +1,4 @@ -tests/erroneous/variadic-builtin.c:1:[va] Variadic builtin Frama_C_show_each_warning left untransformed. -[kernel] Plug-in va aborted: unimplemented feature. +tests/erroneous/variadic-builtin.c:1:[variadic] Variadic builtin Frama_C_show_each_warning left untransformed. +[kernel] Plug-in variadic aborted: unimplemented feature. You may send a feature request at http://bts.frama-c.com with: - '[Plug-in va] The variadic plugin doesn't handle calls to a pointer to the variadic builtin Frama_C_show_each_warning.'. + '[Plug-in variadic] The variadic plugin doesn't handle calls to a pointer to the variadic builtin Frama_C_show_each_warning.'. diff --git a/src/plugins/variadic/tests/erroneous/oracle/wrong-va-start.res.oracle b/src/plugins/variadic/tests/erroneous/oracle/wrong-va-start.res.oracle index b99e5d04b922c1e15720c102bcb8e98f73b02354..29bc83475c1388c43f1575df0d084924cceac925 100644 --- a/src/plugins/variadic/tests/erroneous/oracle/wrong-va-start.res.oracle +++ b/src/plugins/variadic/tests/erroneous/oracle/wrong-va-start.res.oracle @@ -1,3 +1,3 @@ -tests/erroneous/wrong-va-start.c:6:[kernel] warning: The second argument in call to __builtin_va_start should be the last formal argument -tests/erroneous/wrong-va-start.c:3:[va] Declaration of variadic function f. -tests/erroneous/wrong-va-start.c:12:[va] Generic translation of call to variadic function. +tests/erroneous/wrong-va-start.c:6:[kernel] warning: The last argument in call to __builtin_va_start should be the last formal argument of f +tests/erroneous/wrong-va-start.c:3:[variadic] Declaration of variadic function f. +tests/erroneous/wrong-va-start.c:12:[variadic] Generic translation of call to variadic function. diff --git a/src/plugins/variadic/tests/erroneous/test_config b/src/plugins/variadic/tests/erroneous/test_config index 92ababeabb569dfc9ee88a4dfd6eb2f275d6eed4..d42e13c1ae8463c3923c3ff795491571140e2a2f 100644 --- a/src/plugins/variadic/tests/erroneous/test_config +++ b/src/plugins/variadic/tests/erroneous/test_config @@ -1 +1 @@ -OPT: -no-autoload-plugins -load-module variadic -check -kernel-verbose 0 -va-verbose 2 +OPT: -no-autoload-plugins -load-module variadic -check -kernel-verbose 0 -variadic-verbose 2 diff --git a/src/plugins/variadic/tests/known/empty.c b/src/plugins/variadic/tests/known/empty.c new file mode 100644 index 0000000000000000000000000000000000000000..26ed4bd36fb40e5debf75d1335691fe9b174bd5e --- /dev/null +++ b/src/plugins/variadic/tests/known/empty.c @@ -0,0 +1,4 @@ +/* run.config + DONTRUN: + // used by print_libc.c + */ diff --git a/src/plugins/variadic/tests/known/ioctl.c b/src/plugins/variadic/tests/known/ioctl.c new file mode 100644 index 0000000000000000000000000000000000000000..17fa17ea83c215d64270d10f1a3c670346fbeccf --- /dev/null +++ b/src/plugins/variadic/tests/known/ioctl.c @@ -0,0 +1,10 @@ +#include <stropts.h> + +int main(){ + int fd1 = 1; + int request1 = 0; + int r1 = ioctl(fd1, request1); // without 3rd argument + char arg = 42; + int r2 = ioctl(fd1, request1, &arg); // with 3rd argument + return 0; +} diff --git a/src/plugins/variadic/tests/known/oracle/exec.res.oracle b/src/plugins/variadic/tests/known/oracle/exec.res.oracle index 4c632fea32dd39391b5346cac589b4c3b04eb3ef..4e66a8768dc165a64f44747b589e5c7220a017b0 100644 --- a/src/plugins/variadic/tests/known/oracle/exec.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/exec.res.oracle @@ -1,15 +1,15 @@ -FRAMAC_SHARE/libc/unistd.h:744:[va] Declaration of variadic function execl. -FRAMAC_SHARE/libc/unistd.h:750:[va] Declaration of variadic function execle. -FRAMAC_SHARE/libc/unistd.h:756:[va] Declaration of variadic function execlp. -tests/known/exec.c:9:[va] Translating call to execle to a call to execve. -tests/known/exec.c:11:[va] warning: Too many arguments: expected 5, given 6. Superfluous arguments will be removed. -tests/known/exec.c:11:[va] Translating call to execl to a call to execv. -tests/known/exec.c:12:[va] warning: Too many arguments: expected 4, given 5. Superfluous arguments will be removed. -tests/known/exec.c:12:[va] Translating call to execlp to a call to execvp. -tests/known/exec.c:13:[va] warning: Too many arguments: expected 4, given 6. Superfluous arguments will be removed. -tests/known/exec.c:13:[va] Translating call to execle to a call to execve. -tests/known/exec.c:15:[va] warning: Failed to find a sentinel (NULL pointer) in the argument list. -tests/known/exec.c:15:[va] Generic translation of call to variadic function. +FRAMAC_SHARE/libc/unistd.h:744:[variadic] Declaration of variadic function execl. +FRAMAC_SHARE/libc/unistd.h:750:[variadic] Declaration of variadic function execle. +FRAMAC_SHARE/libc/unistd.h:756:[variadic] Declaration of variadic function execlp. +tests/known/exec.c:9:[variadic] Translating call to execle to a call to execve. +tests/known/exec.c:11:[variadic] warning: Too many arguments: expected 5, given 6. Superfluous arguments will be removed. +tests/known/exec.c:11:[variadic] Translating call to execl to a call to execv. +tests/known/exec.c:12:[variadic] warning: Too many arguments: expected 4, given 5. Superfluous arguments will be removed. +tests/known/exec.c:12:[variadic] Translating call to execlp to a call to execvp. +tests/known/exec.c:13:[variadic] warning: Too many arguments: expected 4, given 6. Superfluous arguments will be removed. +tests/known/exec.c:13:[variadic] Translating call to execle to a call to execve. +tests/known/exec.c:15:[variadic] warning: Failed to find a sentinel (NULL pointer) in the argument list. +tests/known/exec.c:15:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -26,68 +26,39 @@ tests/known/exec.c:15:[va] Generic translation of call to variadic function. __retres ∈ {0} /* Generated by Frama-C */ #include "getopt.h" +#include "sys/time.h" #include "unistd.h" int main(void) { int __retres; - char *env[2]; - char *sentinel; - env[0] = (char *)"VAR=42"; - env[1] = (char *)0; - sentinel = (char *)0; + char *env[2] = {(char *)"VAR=42", (char *)0}; + char *sentinel = (char *)0; { - char *argv[4]; - argv[0] = (char *)"sh"; - argv[1] = (char *)"-c"; - argv[2] = (char *)"echo $VAR"; - argv[3] = (char *)0; - execve("/bin/sh",(char * const *)(argv),(char * const *)(env)); + char * const argv[4] = + {(char *)"sh", (char *)"-c", (char *)"echo $VAR", (char *)0}; + execve("/bin/sh",argv,(char * const *)(env)); } { - char *argv_5[4]; - argv_5[0] = (char *)"ls"; - argv_5[1] = (char *)"-l"; - argv_5[2] = (char *)"--color"; - argv_5[3] = (char *)0; - { - int tmp; - tmp = 42; - } - execv("ls",(char * const *)(argv_5)); + char * const argv_5[4] = + {(char *)"ls", (char *)"-l", (char *)"--color", (char *)0}; + int tmp = 42; + execv("ls",argv_5); } { - char *argv_8[3]; - argv_8[0] = (char *)"ls"; - argv_8[1] = (char *)"-all"; - argv_8[2] = (char *)0; - { - void *tmp_10; - tmp_10 = (void *)0; - } - execvp("ls",(char * const *)(argv_8)); + char * const argv_8[3] = {(char *)"ls", (char *)"-all", (char *)0}; + void *tmp_10 = (void *)0; + execvp("ls",argv_8); } { - char *argv_12[2]; - argv_12[0] = (char *)"ls"; - argv_12[1] = (char *)0; - { - int tmp_14; - tmp_14 = 42; - } - { - void *tmp_16; - tmp_16 = (void *)0; - } - execve("ls",(char * const *)(argv_12),(char * const *)(env)); + char * const argv_12[2] = {(char *)"ls", (char *)0}; + int tmp_14 = 42; + void *tmp_16 = (void *)0; + execve("ls",argv_12,(char * const *)(env)); } { - void *__va_args[2]; - char *__va_arg1; - char const *__va_arg0; - __va_arg0 = "--reverse"; - __va_arg1 = sentinel; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; + char const *__va_arg0 = "--reverse"; + char *__va_arg1 = sentinel; + void *__va_args[2] = {& __va_arg0, & __va_arg1}; execlp("ls","ls",(void * const *)(__va_args)); } __retres = 0; diff --git a/src/plugins/variadic/tests/known/oracle/exec_failed_requirement.res.oracle b/src/plugins/variadic/tests/known/oracle/exec_failed_requirement.res.oracle index a0d8e2d5e0db5643d8330f425bf2c333203b2416..1373026c5373f7b2954243a5760c2446014d68f6 100644 --- a/src/plugins/variadic/tests/known/oracle/exec_failed_requirement.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/exec_failed_requirement.res.oracle @@ -1,7 +1,7 @@ -FRAMAC_SHARE/libc/unistd.h:744:[va] Declaration of variadic function execl. -FRAMAC_SHARE/libc/unistd.h:750:[va] Declaration of variadic function execle. -FRAMAC_SHARE/libc/unistd.h:756:[va] Declaration of variadic function execlp. -tests/known/exec_failed_requirement.c:7:[va] Translating call to execl to a call to execv. +FRAMAC_SHARE/libc/unistd.h:744:[variadic] Declaration of variadic function execl. +FRAMAC_SHARE/libc/unistd.h:750:[variadic] Declaration of variadic function execle. +FRAMAC_SHARE/libc/unistd.h:756:[variadic] Declaration of variadic function execlp. +tests/known/exec_failed_requirement.c:7:[variadic] Translating call to execl to a call to execv. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -13,14 +13,14 @@ FRAMAC_SHARE/libc/unistd.h:762:[value] warning: function execv: precondition got NON TERMINATING FUNCTION /* Generated by Frama-C */ #include "getopt.h" +#include "sys/time.h" #include "unistd.h" int main(void) { int __retres; { - char *argv[1]; - argv[0] = (char *)0; - execv("/bin/pwd",(char * const *)(argv)); + char * const argv[1] = {(char *)0}; + execv("/bin/pwd",argv); } __retres = 0; return __retres; diff --git a/src/plugins/variadic/tests/known/oracle/fcntl.res.oracle b/src/plugins/variadic/tests/known/oracle/fcntl.res.oracle index cefc72406d42818e915d67885811e4836ad729bc..774e3afbbf0f37f3414715f9e8308bd986908850 100644 --- a/src/plugins/variadic/tests/known/oracle/fcntl.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/fcntl.res.oracle @@ -1,23 +1,37 @@ -FRAMAC_SHARE/libc/fcntl.h:115:[va] Declaration of variadic function fcntl. -FRAMAC_SHARE/libc/fcntl.h:117:[va] Declaration of variadic function open. -FRAMAC_SHARE/libc/fcntl.h:119:[va] Declaration of variadic function openat. -tests/known/fcntl.c:8:[va] Translating call to the specialized version fcntl(int, int). -tests/known/fcntl.c:9:[va] Translating call to the specialized version fcntl(int, int, int). -tests/known/fcntl.c:10:[va] Translating call to the specialized version fcntl(int, int, struct flock *). -tests/known/fcntl.c:16:[va] Translating call to the specialized version fcntl(int, int, int). -tests/known/fcntl.c:16:[va] warning: Too many arguments: expected 3, given 4. Superfluous arguments will be removed. -tests/known/fcntl.c:20:[va] Translating call to the specialized version fcntl(int, int). -tests/known/fcntl.c:24:[va] Translating call to the specialized version fcntl(int, int, struct flock *). -tests/known/fcntl.c:28:[va] Translating call to the specialized version fcntl(int, int). -tests/known/fcntl.c:28:[va] warning: Too many arguments: expected 2, given 3. Superfluous arguments will be removed. +FRAMAC_SHARE/libc/fcntl.h:108:[variadic] Declaration of variadic function fcntl. +FRAMAC_SHARE/libc/fcntl.h:110:[variadic] Declaration of variadic function open. +FRAMAC_SHARE/libc/fcntl.h:112:[variadic] Declaration of variadic function openat. +tests/known/fcntl.c:8:[variadic] Translating call to the specialized version fcntl(int, int). +tests/known/fcntl.c:9:[variadic] Translating call to the specialized version fcntl(int, int, int). +tests/known/fcntl.c:10:[variadic] Translating call to the specialized version fcntl(int, int, struct flock *). +tests/known/fcntl.c:16:[variadic] warning: No matching prototype found for this call to fcntl. + Expected candidates: + fcntl(int, int) + fcntl(int, int, int) + fcntl(int, int, struct flock *) + Given arguments: + fcntl(int, int, int, int) +tests/known/fcntl.c:16:[variadic] Generic translation of call to variadic function. +tests/known/fcntl.c:20:[variadic] Translating call to the specialized version fcntl(int, int). +tests/known/fcntl.c:24:[variadic] Translating call to the specialized version fcntl(int, int, struct flock *). +tests/known/fcntl.c:28:[variadic] warning: No matching prototype found for this call to fcntl. + Expected candidates: + fcntl(int, int) + fcntl(int, int, int) + fcntl(int, int, struct flock *) + Given arguments: + fcntl(int, int, double) +tests/known/fcntl.c:28:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed +tests/known/fcntl.c:5:[value] warning: initialization of volatile variable choice ignored [value] using specification for function __va_fcntl_void [value] using specification for function __va_fcntl_int [value] using specification for function __va_fcntl_flock -FRAMAC_SHARE/libc/fcntl.h:128:[value] warning: function __va_fcntl_void: precondition 'valid_cmd' got status invalid. -FRAMAC_SHARE/libc/fcntl.h:136:[value] warning: function __va_fcntl_flock: precondition 'valid_cmd' got status invalid. +[value] using specification for function fcntl +FRAMAC_SHARE/libc/fcntl.h:119:[value] warning: function __va_fcntl_void: precondition 'valid_cmd' got status invalid. +FRAMAC_SHARE/libc/fcntl.h:127:[value] warning: function __va_fcntl_flock: precondition 'valid_cmd' got status invalid. [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -31,25 +45,26 @@ int main(void) { int __retres; struct flock fl; - int volatile choice; - int flags; - choice = 0; - flags = __va_fcntl_void(0,2); - __va_fcntl_int(0,3,flags); - __va_fcntl_flock(0,6,& fl); + int volatile choice = 0; + int flags = __va_fcntl_void(0,1); + __va_fcntl_int(0,2,flags); + __va_fcntl_flock(0,5,& fl); switch (choice) { - case 1: { - int tmp; - tmp = 5; - } - __va_fcntl_int(0,3,flags); - case 2: __va_fcntl_void(0,3); - case 3: __va_fcntl_flock(0,3,& fl); - case 4: { - double tmp_7; - tmp_7 = 0.5; - } - __va_fcntl_void(0,3); + case 1: + { + int __va_arg0 = flags; + int __va_arg1 = 5; + void *__va_args[2] = {& __va_arg0, & __va_arg1}; + fcntl(0,2,(void * const *)(__va_args)); + } + case 2: __va_fcntl_void(0,2); + case 3: __va_fcntl_flock(0,2,& fl); + case 4: + { + double __va_arg0_9 = 0.5; + void *__va_args_11[1] = {& __va_arg0_9}; + fcntl(0,2,(void * const *)(__va_args_11)); + } } __retres = 0; return __retres; diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.3.err.oracle b/src/plugins/variadic/tests/known/oracle/ioctl.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp/oracle_qualif/wp_behav.3.err.oracle rename to src/plugins/variadic/tests/known/oracle/ioctl.err.oracle diff --git a/src/plugins/variadic/tests/known/oracle/ioctl.res.oracle b/src/plugins/variadic/tests/known/oracle/ioctl.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..6202bb1ba000461147857e9005d4511a9cdca440 --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/ioctl.res.oracle @@ -0,0 +1,32 @@ +FRAMAC_SHARE/libc/stropts.h:164:[variadic] Declaration of variadic function ioctl. +tests/known/ioctl.c:6:[variadic] Translating call to the specialized version ioctl(int, int). +tests/known/ioctl.c:8:[variadic] Translating call to the specialized version ioctl(int, int, char *). +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value] using specification for function __va_ioctl_void +[value] using specification for function __va_ioctl_ptr +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + fd1 ∈ {1} + request1 ∈ {0} + r1 ∈ [--..--] + arg ∈ {42} + r2 ∈ [--..--] + __retres ∈ {0} +/* Generated by Frama-C */ +#include "stropts.h" +int main(void) +{ + int __retres; + int fd1 = 1; + int request1 = 0; + int r1 = __va_ioctl_void(fd1,request1); + char arg = (char)42; + int r2 = __va_ioctl_ptr(fd1,request1,& arg); + __retres = 0; + return __retres; +} + + diff --git a/src/plugins/variadic/tests/known/oracle/open.res.oracle b/src/plugins/variadic/tests/known/oracle/open.res.oracle index b69ee82952f1c0da76e133b70137a362637d1af9..5a04fc5697fcb6534d844e3069511d0d92237a76 100644 --- a/src/plugins/variadic/tests/known/oracle/open.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/open.res.oracle @@ -1,17 +1,22 @@ -FRAMAC_SHARE/libc/fcntl.h:115:[va] Declaration of variadic function fcntl. -FRAMAC_SHARE/libc/fcntl.h:117:[va] Declaration of variadic function open. -FRAMAC_SHARE/libc/fcntl.h:119:[va] Declaration of variadic function openat. -tests/known/open.c:7:[va] Translating call to the specialized version open(char const *, int, mode_t). -tests/known/open.c:7:[va] warning: Incorrect type for argument 3. The argument will be cast from int to mode_t. -tests/known/open.c:8:[va] Translating call to the specialized version open(char const *, int). -tests/known/open.c:9:[va] Translating call to the specialized version open(char const *, int, mode_t). -tests/known/open.c:9:[va] warning: Too many arguments: expected 3, given 6. Superfluous arguments will be removed. -tests/known/open.c:9:[va] warning: Incorrect type for argument 3. The argument will be cast from int to mode_t. +FRAMAC_SHARE/libc/fcntl.h:108:[variadic] Declaration of variadic function fcntl. +FRAMAC_SHARE/libc/fcntl.h:110:[variadic] Declaration of variadic function open. +FRAMAC_SHARE/libc/fcntl.h:112:[variadic] Declaration of variadic function openat. +tests/known/open.c:7:[variadic] Translating call to the specialized version open(char const *, int, mode_t). +tests/known/open.c:7:[variadic] warning: Incorrect type for argument 3. The argument will be cast from int to mode_t. +tests/known/open.c:8:[variadic] Translating call to the specialized version open(char const *, int). +tests/known/open.c:9:[variadic] warning: No matching prototype found for this call to open. + Expected candidates: + open(char const *, int) + open(char const *, int, mode_t) + Given arguments: + open(char const *, int, int, int, char const *, int) +tests/known/open.c:9:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value] using specification for function __va_open_mode_t [value] using specification for function __va_open_void +[value] using specification for function open [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -21,36 +26,31 @@ tests/known/open.c:9:[va] warning: Incorrect type for argument 3. The argument w fd1 ∈ [--..--] fd2 ∈ [--..--] fd3 ∈ [--..--] + __va_arg0 ∈ {0} + __va_arg1 ∈ {3} + __va_arg2 ∈ {{ "arg4" }} + __va_arg3 ∈ {5} + __va_args[0] ∈ {{ (void *)&__va_arg0 }} + [1] ∈ {{ (void *)&__va_arg1 }} + [2] ∈ {{ (void *)&__va_arg2 }} + [3] ∈ {{ (void *)&__va_arg3 }} __retres ∈ {0} /* Generated by Frama-C */ #include "fcntl.h" int main(void) { int __retres; - int flag; - int mode; - char *file; - int fd1; - int fd2; - int fd3; - flag = 0; - mode = 0; - file = (char *)"file"; - fd1 = __va_open_mode_t((char const *)file,flag,(mode_t)mode); - fd2 = __va_open_void((char const *)file,flag); - { - int tmp; - tmp = 3; - } - { - char const *tmp_12; - tmp_12 = "arg4"; - } - { - int tmp_14; - tmp_14 = 5; - } - fd3 = __va_open_mode_t((char const *)file,flag,(mode_t)mode); + int flag = 0; + int mode = 0; + char *file = (char *)"file"; + int fd1 = __va_open_mode_t((char const *)file,flag,(mode_t)mode); + int fd2 = __va_open_void((char const *)file,flag); + int __va_arg0 = mode; + int __va_arg1 = 3; + char const *__va_arg2 = "arg4"; + int __va_arg3 = 5; + void *__va_args[4] = {& __va_arg0, & __va_arg1, & __va_arg2, & __va_arg3}; + int fd3 = open((char const *)file,flag,(void * const *)(__va_args)); __retres = 0; return __retres; } diff --git a/src/plugins/variadic/tests/known/oracle/open_wrong.res.oracle b/src/plugins/variadic/tests/known/oracle/open_wrong.res.oracle index 25a43391225581f047dffbbaf1e48faadb78efb1..a28efe3611348f98ec898db3deb2d41e87f25d23 100644 --- a/src/plugins/variadic/tests/known/oracle/open_wrong.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/open_wrong.res.oracle @@ -1,12 +1,17 @@ -FRAMAC_SHARE/libc/fcntl.h:115:[va] Declaration of variadic function fcntl. -FRAMAC_SHARE/libc/fcntl.h:117:[va] Declaration of variadic function open. -FRAMAC_SHARE/libc/fcntl.h:119:[va] Declaration of variadic function openat. -tests/known/open_wrong.c:13:[va] Translating call to the specialized version open(char const *, int). -tests/known/open_wrong.c:13:[va] warning: Too many arguments: expected 2, given 3. Superfluous arguments will be removed. +FRAMAC_SHARE/libc/fcntl.h:108:[variadic] Declaration of variadic function fcntl. +FRAMAC_SHARE/libc/fcntl.h:110:[variadic] Declaration of variadic function open. +FRAMAC_SHARE/libc/fcntl.h:112:[variadic] Declaration of variadic function openat. +tests/known/open_wrong.c:13:[variadic] warning: No matching prototype found for this call to open. + Expected candidates: + open(char const *, int) + open(char const *, int, mode_t) + Given arguments: + open(char const *, int, char const *) +tests/known/open_wrong.c:13:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] using specification for function __va_open_void +[value] using specification for function open [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -18,15 +23,13 @@ tests/known/open_wrong.c:13:[va] warning: Too many arguments: expected 2, given int main(void) { int __retres; - char *file; - int flag; - file = (char *)"file"; - flag = 0; + char *file = (char *)"file"; + int flag = 0; { - char const *tmp; - tmp = ""; + char const *__va_arg0 = ""; + void *__va_args[1] = {& __va_arg0}; + open((char const *)file,flag,(void * const *)(__va_args)); } - __va_open_void((char const *)file,flag); __retres = 0; return __retres; } diff --git a/src/plugins/variadic/tests/known/oracle/openat.res.oracle b/src/plugins/variadic/tests/known/oracle/openat.res.oracle index 8a1234fe50ac89fe1d41f7f5f2c4a7a42d51ad13..cd4ebb660b70079d5fa716febac03386e0118a17 100644 --- a/src/plugins/variadic/tests/known/oracle/openat.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/openat.res.oracle @@ -1,16 +1,21 @@ -FRAMAC_SHARE/libc/fcntl.h:115:[va] Declaration of variadic function fcntl. -FRAMAC_SHARE/libc/fcntl.h:117:[va] Declaration of variadic function open. -FRAMAC_SHARE/libc/fcntl.h:119:[va] Declaration of variadic function openat. -tests/known/openat.c:8:[va] Translating call to the specialized version openat(int, char const *, int, mode_t). -tests/known/openat.c:9:[va] Translating call to the specialized version openat(int, char const *, int, mode_t). -tests/known/openat.c:9:[va] warning: Incorrect type for argument 4. The argument will be cast from int to mode_t. -tests/known/openat.c:10:[va] Translating call to the specialized version openat(int, char const *, int). -tests/known/openat.c:10:[va] warning: Too many arguments: expected 3, given 4. Superfluous arguments will be removed. +FRAMAC_SHARE/libc/fcntl.h:108:[variadic] Declaration of variadic function fcntl. +FRAMAC_SHARE/libc/fcntl.h:110:[variadic] Declaration of variadic function open. +FRAMAC_SHARE/libc/fcntl.h:112:[variadic] Declaration of variadic function openat. +tests/known/openat.c:8:[variadic] Translating call to the specialized version openat(int, char const *, int, mode_t). +tests/known/openat.c:9:[variadic] Translating call to the specialized version openat(int, char const *, int, mode_t). +tests/known/openat.c:9:[variadic] warning: Incorrect type for argument 4. The argument will be cast from int to mode_t. +tests/known/openat.c:10:[variadic] warning: No matching prototype found for this call to openat. + Expected candidates: + openat(int, char const *, int) + openat(int, char const *, int, mode_t) + Given arguments: + openat(int, char const *, int, double) +tests/known/openat.c:10:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value] using specification for function __va_openat_mode_t -[value] using specification for function __va_openat_void +[value] using specification for function openat [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -24,21 +29,17 @@ tests/known/openat.c:10:[va] warning: Too many arguments: expected 3, given 4. S int main(void) { int __retres; - int flag; - mode_t mode1; - int mode2; - char *file; - flag = 0; - mode1 = (unsigned int)0; - mode2 = 0; - file = (char *)"file"; + int flag = 0; + mode_t mode1 = (unsigned int)0; + int mode2 = 0; + char *file = (char *)"file"; __va_openat_mode_t(0,(char const *)file,flag,mode1); __va_openat_mode_t(0,(char const *)file,flag,(mode_t)mode2); { - double tmp; - tmp = 3.0; + double __va_arg0 = 3.0; + void *__va_args[1] = {& __va_arg0}; + openat(0,(char const *)file,flag,(void * const *)(__va_args)); } - __va_openat_void(0,(char const *)file,flag); __retres = 0; return __retres; } diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.0.err.oracle b/src/plugins/variadic/tests/known/oracle/print_libc.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.0.err.oracle rename to src/plugins/variadic/tests/known/oracle/print_libc.err.oracle diff --git a/src/plugins/variadic/tests/known/oracle/print_libc.pretty.c b/src/plugins/variadic/tests/known/oracle/print_libc.pretty.c new file mode 100644 index 0000000000000000000000000000000000000000..78b1f67254f4b3e518e44e833281bf69678f1dcb --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/print_libc.pretty.c @@ -0,0 +1,50 @@ +/* Generated by Frama-C */ +#include "errno.h" +#include "stdarg.h" +#include "stddef.h" +#include "stdio.h" +/*@ requires valid_read_string(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); + */ +int printf_va_1(char const *format); + +int main(void) +{ + int __retres; + printf_va_1(""); + __retres = 0; + return __retres; +} + + +/* Generated by Frama-C */ +#include "errno.h" +#include "stdarg.h" +#include "stddef.h" +#include "stdio.h" +/*@ requires valid_read_string(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); + */ +int printf_va_1(char const *format); + +int main(void) +{ + int __retres; + printf_va_1(""); + __retres = 0; + return __retres; +} + + diff --git a/src/plugins/variadic/tests/known/oracle/print_libc.res.oracle b/src/plugins/variadic/tests/known/oracle/print_libc.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..fcce6d0115732a749b8a8923723a7243c9dfb804 --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/print_libc.res.oracle @@ -0,0 +1,3 @@ +[kernel] Parsing tests/known/print_libc.c (with preprocessing) +[kernel] Parsing tests/known/empty.c (with preprocessing) +[kernel] Parsing tests/known/result/print_libc.pretty.c (with preprocessing) diff --git a/src/plugins/variadic/tests/known/oracle/printf.res.oracle b/src/plugins/variadic/tests/known/oracle/printf.res.oracle index 5a6937fe210f944843f3fc75bf961dd4004fc4e2..f9eb76f5c34099f6d916a1d81733cb7fe1effa11 100644 --- a/src/plugins/variadic/tests/known/oracle/printf.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/printf.res.oracle @@ -1,56 +1,71 @@ -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -tests/known/printf.c:33:[va] Translating call to printf to a call to the specialized version printf_0. -tests/known/printf.c:34:[va] Translating call to printf to a call to the specialized version printf_1. -tests/known/printf.c:35:[va] Translating call to printf to a call to the specialized version printf_2. -tests/known/printf.c:37:[va] Translating call to printf to a call to the specialized version printf_3. -tests/known/printf.c:38:[va] Translating call to printf to a call to the specialized version printf_4. -tests/known/printf.c:39:[va] Translating call to printf to a call to the specialized version printf_5. -tests/known/printf.c:40:[va] Translating call to printf to a call to the specialized version printf_6. -tests/known/printf.c:41:[va] Translating call to printf to a call to the specialized version printf_7. -tests/known/printf.c:42:[va] Translating call to printf to a call to the specialized version printf_8. -tests/known/printf.c:43:[va] Translating call to printf to a call to the specialized version printf_9. -tests/known/printf.c:44:[va] Translating call to printf to a call to the specialized version printf_10. -tests/known/printf.c:46:[va] Translating call to printf to a call to the specialized version printf_11. -tests/known/printf.c:47:[va] Translating call to printf to a call to the specialized version printf_12. -tests/known/printf.c:48:[va] Translating call to printf to a call to the specialized version printf_13. -tests/known/printf.c:49:[va] Translating call to printf to a call to the specialized version printf_14. -tests/known/printf.c:50:[va] Translating call to printf to a call to the specialized version printf_15. -tests/known/printf.c:51:[va] Translating call to printf to a call to the specialized version printf_16. -tests/known/printf.c:52:[va] Translating call to printf to a call to the specialized version printf_17. -tests/known/printf.c:54:[va] Translating call to printf to a call to the specialized version printf_18. -tests/known/printf.c:56:[va] Translating call to printf to a call to the specialized version printf_19. -tests/known/printf.c:59:[va] Translating call to printf to a call to the specialized version printf_20. -tests/known/printf.c:60:[va] Translating call to printf to a call to the specialized version printf_21. -tests/known/printf.c:62:[va] warning: Flag ' ' and conversion specififer x are not compatibles. -tests/known/printf.c:62:[va] Generic translation of call to variadic function. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +tests/known/printf.c:37:[variadic] Translating call to printf to a call to the specialized version printf_va_1. +tests/known/printf.c:38:[variadic] Translating call to printf to a call to the specialized version printf_va_2. +tests/known/printf.c:39:[variadic] Translating call to printf to a call to the specialized version printf_va_3. +tests/known/printf.c:41:[variadic] Translating call to printf to a call to the specialized version printf_va_4. +tests/known/printf.c:42:[variadic] Translating call to printf to a call to the specialized version printf_va_5. +tests/known/printf.c:43:[variadic] Translating call to printf to a call to the specialized version printf_va_6. +tests/known/printf.c:44:[variadic] Translating call to printf to a call to the specialized version printf_va_7. +tests/known/printf.c:45:[variadic] Translating call to printf to a call to the specialized version printf_va_8. +tests/known/printf.c:46:[variadic] Translating call to printf to a call to the specialized version printf_va_9. +tests/known/printf.c:47:[variadic] Translating call to printf to a call to the specialized version printf_va_10. +tests/known/printf.c:48:[variadic] Translating call to printf to a call to the specialized version printf_va_11. +tests/known/printf.c:50:[variadic] Translating call to printf to a call to the specialized version printf_va_12. +tests/known/printf.c:51:[variadic] Translating call to printf to a call to the specialized version printf_va_13. +tests/known/printf.c:52:[variadic] Translating call to printf to a call to the specialized version printf_va_14. +tests/known/printf.c:53:[variadic] Translating call to printf to a call to the specialized version printf_va_15. +tests/known/printf.c:54:[variadic] Translating call to printf to a call to the specialized version printf_va_16. +tests/known/printf.c:55:[variadic] Translating call to printf to a call to the specialized version printf_va_17. +tests/known/printf.c:56:[variadic] Translating call to printf to a call to the specialized version printf_va_18. +tests/known/printf.c:58:[variadic] Translating call to printf to a call to the specialized version printf_va_19. +tests/known/printf.c:59:[variadic] Translating call to printf to a call to the specialized version printf_va_20. +tests/known/printf.c:60:[variadic] Translating call to printf to a call to the specialized version printf_va_21. +tests/known/printf.c:61:[variadic] Translating call to printf to a call to the specialized version printf_va_22. +tests/known/printf.c:63:[variadic] Translating call to printf to a call to the specialized version printf_va_23. +tests/known/printf.c:65:[variadic] Translating call to printf to a call to the specialized version printf_va_24. +tests/known/printf.c:68:[variadic] Translating call to printf to a call to the specialized version printf_va_25. +tests/known/printf.c:69:[variadic] Translating call to printf to a call to the specialized version printf_va_26. +tests/known/printf.c:71:[variadic] warning: Flag ' ' and conversion specififer x are not compatibles. +tests/known/printf.c:71:[variadic] Generic translation of call to variadic function. +tests/known/printf.c:74:[variadic] Translating call to printf to a call to the specialized version printf_va_27. +tests/known/printf.c:75:[variadic] Translating call to printf to a call to the specialized version printf_va_28. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] user error: type long double not implemented. Using double instead -[value] using specification for function printf_0 -[value] using specification for function printf_1 -[value] using specification for function printf_2 -[value] using specification for function printf_3 -[value] using specification for function printf_4 -[value] using specification for function printf_5 -[value] using specification for function printf_6 -[value] using specification for function printf_7 -[value] using specification for function printf_8 -[value] using specification for function printf_9 -[value] using specification for function printf_10 -[value] using specification for function printf_11 -[value] using specification for function printf_12 -[value] using specification for function printf_13 -[value] using specification for function printf_14 -[value] using specification for function printf_15 -[value] using specification for function printf_16 -[value] using specification for function printf_17 -[value] using specification for function printf_18 -[value] using specification for function printf_19 -[value] using specification for function printf_20 -[value] using specification for function printf_21 -tests/known/printf.c:62:[kernel] warning: Neither code nor specification for function printf, generating default assigns from the prototype +[value] user error: type long double wider than 64 bits not supported. + Using double instead for the remainder of the analysis. +[value] using specification for function printf_va_1 +[value] using specification for function printf_va_2 +[value] using specification for function printf_va_3 +[value] using specification for function printf_va_4 +[value] using specification for function printf_va_5 +[value] using specification for function printf_va_6 +[value] using specification for function printf_va_7 +[value] using specification for function printf_va_8 +[value] using specification for function printf_va_9 +[value] using specification for function printf_va_10 +[value] using specification for function printf_va_11 +[value] using specification for function printf_va_12 +[value] using specification for function printf_va_13 +[value] using specification for function printf_va_14 +[value] using specification for function printf_va_15 +[value] using specification for function printf_va_16 +[value] using specification for function printf_va_17 +[value] using specification for function printf_va_18 +[value] using specification for function printf_va_19 +[value] using specification for function printf_va_20 +[value] using specification for function printf_va_21 +[value] using specification for function printf_va_22 +[value] using specification for function printf_va_23 +[value] using specification for function printf_va_24 +[value] using specification for function printf_va_25 +[value] using specification for function printf_va_26 +tests/known/printf.c:71:[kernel] warning: Neither code nor specification for function printf, generating default assigns from the prototype [value] using specification for function printf +[value] using specification for function printf_va_27 +tests/known/printf.c:74:[value] warning: function printf_va_27: precondition got status unknown. +[value] using specification for function printf_va_28 +tests/known/printf.c:75:[value] warning: function printf_va_28: precondition got status unknown. [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -77,6 +92,11 @@ tests/known/printf.c:62:[kernel] warning: Neither code nor specification for fun t ∈ [--..--] f ∈ {42.} L ∈ {42.} + u64 ∈ {42} + i8 ∈ {42} + uleast64 ∈ {42} + ifast32 ∈ {42} + hashes[0..3] ∈ {35} __retres ∈ {0} /* Generated by Frama-C */ #include "errno.h" @@ -86,6 +106,7 @@ tests/known/printf.c:62:[kernel] warning: Neither code nor specification for fun #include "stdint.h" #include "stdio.h" #include "stdlib.h" +#include "time.h" #include "wchar.h" FILE __fc_initial_stdout = {.__fc_FILE_id = (unsigned int)1, .__fc_FILE_data = 0U}; @@ -102,7 +123,7 @@ FILE __fc_initial_stdin = \from (indirect: __fc_stdout->__fc_FILE_id), __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int printf_0(char const *format); +int printf_va_1(char const *format); /*@ requires valid_read_string(format); requires \valid(param1); @@ -122,9 +143,10 @@ int printf_0(char const *format); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param0 + (0 ..)); */ -int printf_1(char const *format, char *param0, int *param1); +int printf_va_2(char const *format, char *param0, int *param1); /*@ requires valid_read_string(format); + requires valid_read_wstring(param0); assigns \result, __fc_stdout->__fc_FILE_data; assigns \result \from (indirect: __fc_stdout->__fc_FILE_id), @@ -135,7 +157,7 @@ int printf_1(char const *format, char *param0, int *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param0 + (0 ..)); */ -int printf_2(char const *format, wchar_t *param0); +int printf_va_3(char const *format, wchar_t *param0); /*@ requires valid_read_string(format); requires \valid(param1); @@ -154,7 +176,7 @@ int printf_2(char const *format, wchar_t *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_3(char const *format, int param0, signed char *param1); +int printf_va_4(char const *format, int param0, signed char *param1); /*@ requires valid_read_string(format); requires \valid(param1); @@ -173,7 +195,7 @@ int printf_3(char const *format, int param0, signed char *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_4(char const *format, int param0, short *param1); +int printf_va_5(char const *format, int param0, short *param1); /*@ requires valid_read_string(format); requires \valid(param1); @@ -192,7 +214,7 @@ int printf_4(char const *format, int param0, short *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_5(char const *format, int param0, long *param1); +int printf_va_6(char const *format, int param0, long *param1); /*@ requires valid_read_string(format); requires \valid(param1); @@ -211,7 +233,7 @@ int printf_5(char const *format, int param0, long *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_6(char const *format, long param0, long long *param1); +int printf_va_7(char const *format, long param0, long long *param1); /*@ requires valid_read_string(format); requires \valid(param1); @@ -230,7 +252,7 @@ int printf_6(char const *format, long param0, long long *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_7(char const *format, long long param0, intmax_t *param1); +int printf_va_8(char const *format, long long param0, intmax_t *param1); /*@ requires valid_read_string(format); requires \valid(param1); @@ -249,7 +271,7 @@ int printf_7(char const *format, long long param0, intmax_t *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_8(char const *format, intmax_t param0, size_t *param1); +int printf_va_9(char const *format, intmax_t param0, size_t *param1); /*@ requires valid_read_string(format); requires \valid(param1); @@ -268,7 +290,7 @@ int printf_8(char const *format, intmax_t param0, size_t *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_9(char const *format, size_t param0, ptrdiff_t *param1); +int printf_va_10(char const *format, size_t param0, ptrdiff_t *param1); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -281,7 +303,7 @@ int printf_9(char const *format, size_t param0, ptrdiff_t *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_10(char const *format, ptrdiff_t param0); +int printf_va_11(char const *format, ptrdiff_t param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -294,7 +316,7 @@ int printf_10(char const *format, ptrdiff_t param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_11(char const *format, unsigned int param0); +int printf_va_12(char const *format, unsigned int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -307,7 +329,7 @@ int printf_11(char const *format, unsigned int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_12(char const *format, int param0); +int printf_va_13(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -320,7 +342,7 @@ int printf_12(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_13(char const *format, int param0); +int printf_va_14(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -333,7 +355,7 @@ int printf_13(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_14(char const *format, unsigned long param0); +int printf_va_15(char const *format, unsigned long param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -346,7 +368,7 @@ int printf_14(char const *format, unsigned long param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_15(char const *format, unsigned long long param0); +int printf_va_16(char const *format, unsigned long long param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -359,7 +381,7 @@ int printf_15(char const *format, unsigned long long param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_16(char const *format, uintmax_t param0); +int printf_va_17(char const *format, uintmax_t param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -372,7 +394,59 @@ int printf_16(char const *format, uintmax_t param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param1, param0; */ -int printf_17(char const *format, size_t param0, ptrdiff_t param1); +int printf_va_18(char const *format, size_t param0, ptrdiff_t param1); + +/*@ requires valid_read_string(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + */ +int printf_va_19(char const *format, unsigned long long param0); + +/*@ requires valid_read_string(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + */ +int printf_va_20(char const *format, int param0); + +/*@ requires valid_read_string(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + */ +int printf_va_21(char const *format, unsigned long long param0); + +/*@ requires valid_read_string(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param0; + */ +int printf_va_22(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -385,7 +459,7 @@ int printf_17(char const *format, size_t param0, ptrdiff_t param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param1, param0; */ -int printf_18(char const *format, double param0, long double param1); +int printf_va_23(char const *format, double param0, long double param1); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -398,7 +472,7 @@ int printf_18(char const *format, double param0, long double param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_19(char const *format, int param0); +int printf_va_24(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -411,7 +485,7 @@ int printf_19(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_20(char const *format, void *param0); +int printf_va_25(char const *format, void *param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -424,92 +498,101 @@ int printf_20(char const *format, void *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param3, param2, param1, param0; */ -int printf_21(char const *format, int param0, int param1, int param2, - unsigned int param3); +int printf_va_26(char const *format, int param0, int param1, int param2, + unsigned int param3); + +/*@ requires valid_read_string(format); + requires valid_read_nstring(param1, param0); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + *(param1 + (0 ..)), param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + *(param1 + (0 ..)), param0; + */ +int printf_va_27(char const *format, int param0, char *param1); + +/*@ requires valid_read_string(format); + requires valid_read_nstring(param0, 4); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + *(param0 + (0 ..)); + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + *(param0 + (0 ..)); + */ +int printf_va_28(char const *format, char *param0); int main(void) { int __retres; - char *string; - wchar_t *wstring; - char c; signed char hh; - unsigned char uhh; short h; - unsigned short uh; int i; - unsigned int ui; long l; - unsigned long ul; long long ll; - unsigned long long ull; intmax_t j; - uintmax_t uj; size_t z; ptrdiff_t t; - double f; - long double L; - string = (char *)"Hello world !\n"; - wstring = (wchar_t *)L"H" - "e" - "l" - "l" - "o" - " " - "w" - "o" - "r" - "l" - "d" - " " - "!" - "\\n" - ; - c = (char)'4'; - uhh = (unsigned char)42; - uh = (unsigned short)42; - ui = (unsigned int)42; - ul = (unsigned long)42; - ull = (unsigned long long)42; - uj = (unsigned long long)42; - f = (double)42.0f; - L = 42.0l; - printf_0("Hello world !\n"); - printf_1("%s%n",string,& i); - printf_2("%ls",wstring); - printf_3("%d %hhn",i,& hh); - printf_4("%hhi %hn",(int)hh,& h); - printf_5("%hd %ln",(int)h,& l); - printf_6("%li %lln",l,& ll); - printf_7("%lld %jn",ll,& j); - printf_8("%jd %zn",j,& z); - printf_9("%zd %tn",z,& t); - printf_10("%td\n",t); - printf_11("%u ",ui); - printf_12("%hho ",(int)uhh); - printf_13("%hx ",(int)uh); - printf_14("%lX ",ul); - printf_15("%llu ",ull); - printf_16("%jo ",uj); - printf_17("%zx %tX\n",z,t); - printf_18("%f %Le\n",f,L); - printf_19("%c\n",(int)c); - printf_20("%p ",(void *)string); - printf_21("%d %*.*u\n",1,- (-1),2,ui); + char *string = (char *)"Hello world !\n"; + wchar_t *wstring = (wchar_t *)L"H" "e" "l" "l" "o" " " "w" "o" "r" "l" "d" + " " "!" "\\n" ; + char c = (char)'4'; + unsigned char uhh = (unsigned char)42; + unsigned short uh = (unsigned short)42; + unsigned int ui = (unsigned int)42; + unsigned long ul = (unsigned long)42; + unsigned long long ull = (unsigned long long)42; + uintmax_t uj = (unsigned long long)42; + double f = (double)42.0f; + long double L = 42.0l; + uint64_t u64 = (unsigned long long)42ul; + int8_t i8 = (signed char)42; + uint_least64_t uleast64 = (unsigned long long)42u; + int_fast32_t ifast32 = 42; + printf_va_1("Hello world !\n"); + printf_va_2("%s%n",string,& i); + printf_va_3("%ls",wstring); + printf_va_4("%d %hhn",i,& hh); + printf_va_5("%hhi %hn",(int)hh,& h); + printf_va_6("%hd %ln",(int)h,& l); + printf_va_7("%li %lln",l,& ll); + printf_va_8("%lld %jn",ll,& j); + printf_va_9("%jd %zn",j,& z); + printf_va_10("%zd %tn",z,& t); + printf_va_11("%td\n",t); + printf_va_12("%u ",ui); + printf_va_13("%hho ",(int)uhh); + printf_va_14("%hx ",(int)uh); + printf_va_15("%lX ",ul); + printf_va_16("%llu ",ull); + printf_va_17("%jo ",uj); + printf_va_18("%zx %tX\n",z,t); + printf_va_19("%llu",u64); + printf_va_20("%i",(int)i8); + printf_va_21("%llx",uleast64); + printf_va_22("%d",ifast32); + printf_va_23("%f %Le\n",f,L); + printf_va_24("%c\n",(int)c); + printf_va_25("%p ",(void *)string); + printf_va_26("%d %*.*u\n",1,- (-1),2,ui); { - void *__va_args[3]; - int __va_arg2; - char *__va_arg1; - unsigned int __va_arg0; - __va_arg0 = ui; - __va_arg1 = string; - __va_arg2 = 42; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; + unsigned int __va_arg0 = ui; + char *__va_arg1 = string; + int __va_arg2 = 42; + void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; printf("Hello %- 0+#20.10lx %% %s world %d !", (void * const *)(__va_args)); } + char hashes[4] = {(char)'#', (char)'#', (char)'#', (char)'#'}; + printf_va_27("%.*s",4,hashes); + printf_va_28("%.4s",hashes); __retres = 0; return __retres; } diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.1.err.oracle b/src/plugins/variadic/tests/known/oracle/printf_redefined.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.1.err.oracle rename to src/plugins/variadic/tests/known/oracle/printf_redefined.err.oracle diff --git a/src/plugins/variadic/tests/known/oracle/printf_redefined.res.oracle b/src/plugins/variadic/tests/known/oracle/printf_redefined.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..2973ebb49f79d334fd70f273fb15d817a5463e60 --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/printf_redefined.res.oracle @@ -0,0 +1,31 @@ +tests/known/printf_redefined.c:3:[variadic] Declaration of variadic function printf. +tests/known/printf_redefined.c:7:[variadic] warning: Unable to find type size_t in the source code which should be used in this call: + no specification will be generated. + Note that due to cleanup, the type may have been defined in the original code but not used anywhere. +tests/known/printf_redefined.c:7:[variadic] Generic translation of call to variadic function. +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +tests/known/printf_redefined.c:7:[kernel] warning: Neither code nor specification for function printf, generating default assigns from the prototype +[value] using specification for function printf +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + x ∈ {0} +/* Generated by Frama-C */ +/*@ assigns \result; + assigns \result \from *(__format + (0 ..)); */ +extern int printf(char const * __restrict __format, void * const *__va_params); + +void main(void) +{ + long x = (long)0; + { + long __va_arg0 = x; + void *__va_args[1] = {& __va_arg0}; + printf("%zd\n",(void * const *)(__va_args)); + } + return; +} + + diff --git a/src/plugins/variadic/tests/known/oracle/printf_wrong_arity.res.oracle b/src/plugins/variadic/tests/known/oracle/printf_wrong_arity.res.oracle index fabe9e66919a23346ee2788af5cf836fa2675b94..e794d7cdec72e0f783d0cc7ac1241503d621675e 100644 --- a/src/plugins/variadic/tests/known/oracle/printf_wrong_arity.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/printf_wrong_arity.res.oracle @@ -1,13 +1,13 @@ -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -tests/known/printf_wrong_arity.c:8:[va] Translating call to printf to a call to the specialized version printf_0. -tests/known/printf_wrong_arity.c:8:[va] warning: Too many arguments: expected 2, given 3. Superfluous arguments will be removed. -tests/known/printf_wrong_arity.c:9:[va] Translating call to printf to a call to the specialized version printf_1. -tests/known/printf_wrong_arity.c:9:[va] warning: Not enough arguments: expected 3, given 2. -tests/known/printf_wrong_arity.c:9:[va] Generic translation of call to variadic function. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +tests/known/printf_wrong_arity.c:8:[variadic] Translating call to printf to a call to the specialized version printf_va_1. +tests/known/printf_wrong_arity.c:8:[variadic] warning: Too many arguments: expected 2, given 3. Superfluous arguments will be removed. +tests/known/printf_wrong_arity.c:9:[variadic] Translating call to printf to a call to the specialized version printf_va_2. +tests/known/printf_wrong_arity.c:9:[variadic] warning: Not enough arguments: expected 3, given 2. +tests/known/printf_wrong_arity.c:9:[variadic] Generic translation of call to variadic function. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] using specification for function printf_0 +[value] using specification for function printf_va_1 tests/known/printf_wrong_arity.c:9:[kernel] warning: Neither code nor specification for function printf, generating default assigns from the prototype [value] using specification for function printf [value] done for function main @@ -38,7 +38,7 @@ FILE __fc_initial_stdin = __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_0(char const *format, int param0); +int printf_va_1(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -51,21 +51,18 @@ int printf_0(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param1, param0; */ -int printf_1(char const *format, int param0, int param1); +int printf_va_2(char const *format, int param0, int param1); int main(void) { int __retres; { - int tmp; - tmp = 2; + int tmp = 2; + printf_va_1("%d",1); } - printf_0("%d",1); { - void *__va_args[1]; - int __va_arg0; - __va_arg0 = 1; - __va_args[0] = & __va_arg0; + int __va_arg0 = 1; + void *__va_args[1] = {& __va_arg0}; printf("%d %d",(void * const *)(__va_args)); } __retres = 0; diff --git a/src/plugins/variadic/tests/known/oracle/printf_wrong_pointers.res.oracle b/src/plugins/variadic/tests/known/oracle/printf_wrong_pointers.res.oracle index 25c0edf7bde1588ca07377f51b9277ccc3cfd1ec..502996004ab3ffdad93f7749de65df313fa1d108 100644 --- a/src/plugins/variadic/tests/known/oracle/printf_wrong_pointers.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/printf_wrong_pointers.res.oracle @@ -1,19 +1,21 @@ -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -tests/known/printf_wrong_pointers.c:14:[va] Translating call to printf to a call to the specialized version printf_0. -tests/known/printf_wrong_pointers.c:15:[va] Translating call to printf to a call to the specialized version printf_1. -tests/known/printf_wrong_pointers.c:16:[va] Translating call to printf to a call to the specialized version printf_2. -tests/known/printf_wrong_pointers.c:17:[va] Translating call to printf to a call to the specialized version printf_3. -tests/known/printf_wrong_pointers.c:18:[va] Translating call to printf to a call to the specialized version printf_4. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +tests/known/printf_wrong_pointers.c:14:[variadic] Translating call to printf to a call to the specialized version printf_va_1. +tests/known/printf_wrong_pointers.c:15:[variadic] Translating call to printf to a call to the specialized version printf_va_2. +tests/known/printf_wrong_pointers.c:16:[variadic] Translating call to printf to a call to the specialized version printf_va_3. +tests/known/printf_wrong_pointers.c:17:[variadic] Translating call to printf to a call to the specialized version printf_va_4. +tests/known/printf_wrong_pointers.c:18:[variadic] Translating call to printf to a call to the specialized version printf_va_5. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] using specification for function printf_0 -tests/known/printf_wrong_pointers.c:14:[value] warning: function printf_0: precondition got status invalid. -[value] using specification for function printf_1 -[value] using specification for function printf_2 -tests/known/printf_wrong_pointers.c:16:[value] warning: function printf_2: precondition got status invalid. -[value] using specification for function printf_3 -[value] using specification for function printf_4 +tests/known/printf_wrong_pointers.c:9:[value] warning: initialization of volatile variable nondet ignored +[value] using specification for function printf_va_1 +tests/known/printf_wrong_pointers.c:14:[value] warning: function printf_va_1: precondition got status invalid. +[value] using specification for function printf_va_2 +[value] using specification for function printf_va_3 +tests/known/printf_wrong_pointers.c:16:[value] warning: function printf_va_3: precondition got status invalid. +[value] using specification for function printf_va_4 +[value] using specification for function printf_va_5 +tests/known/printf_wrong_pointers.c:18:[value] warning: function printf_va_5: precondition got status invalid. [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -42,7 +44,7 @@ tests/known/printf_wrong_pointers.c:16:[value] warning: function printf_2: preco \from (indirect: __fc_stdout->__fc_FILE_id), __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int printf_0(char const *format, int *param0); +int printf_va_1(char const *format, int *param0); /*@ requires valid_read_string(format); requires \valid(param0); @@ -58,7 +60,7 @@ int printf_0(char const *format, int *param0); \from (indirect: __fc_stdout->__fc_FILE_id), __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int printf_1(char const *format, int *param0); +int printf_va_2(char const *format, int *param0); /*@ requires valid_read_string(format); requires \valid(param0); @@ -74,7 +76,7 @@ int printf_1(char const *format, int *param0); \from (indirect: __fc_stdout->__fc_FILE_id), __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int printf_2(char const *format, signed char *param0); +int printf_va_3(char const *format, signed char *param0); /*@ requires valid_read_string(format); requires valid_read_string(param0); @@ -88,9 +90,10 @@ int printf_2(char const *format, signed char *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param0 + (0 ..)); */ -int printf_3(char const *format, char *param0); +int printf_va_4(char const *format, char *param0); /*@ requires valid_read_string(format); + requires valid_read_wstring(param0); assigns \result, __fc_stdout->__fc_FILE_data; assigns \result \from (indirect: __fc_stdout->__fc_FILE_id), @@ -101,26 +104,22 @@ int printf_3(char const *format, char *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param0 + (0 ..)); */ -int printf_4(char const *format, wchar_t *param0); +int printf_va_5(char const *format, wchar_t *param0); int main(void) { int __retres; short tt; - unsigned int ui; - char *string; - wchar_t *wstring; - int volatile nondet; - ui = (unsigned int)42; - string = (char *)"foo"; - wstring = (wchar_t *)L"b" "a" "r" ; - nondet = 0; + unsigned int ui = (unsigned int)42; + char *string = (char *)"foo"; + wchar_t *wstring = (wchar_t *)L"b" "a" "r" ; + int volatile nondet = 0; switch (nondet) { - case 0: printf_0("%n",(int *)(& tt)); - case 1: printf_1("%n",(int *)(& ui)); - case 2: printf_2("%hhn",(signed char *)string); - case 3: printf_3("%s",(char *)wstring); - case 4: printf_4("%ls",(wchar_t *)string); + case 0: printf_va_1("%n",(int *)(& tt)); + case 1: printf_va_2("%n",(int *)(& ui)); + case 2: printf_va_3("%hhn",(signed char *)string); + case 3: printf_va_4("%s",(char *)wstring); + case 4: printf_va_5("%ls",(wchar_t *)string); } __retres = 0; return __retres; diff --git a/src/plugins/variadic/tests/known/oracle/printf_wrong_types.res.oracle b/src/plugins/variadic/tests/known/oracle/printf_wrong_types.res.oracle index 5db81113ca63d16f0820b084ec00eb4589ccdbb6..046d7d879a7cc0b2cbec781140574e020a707ecd 100644 --- a/src/plugins/variadic/tests/known/oracle/printf_wrong_types.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/printf_wrong_types.res.oracle @@ -1,45 +1,46 @@ -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -tests/known/printf_wrong_types.c:19:[va] Translating call to printf to a call to the specialized version printf_0. -tests/known/printf_wrong_types.c:20:[va] Translating call to printf to a call to the specialized version printf_1. -tests/known/printf_wrong_types.c:20:[va] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to int. -tests/known/printf_wrong_types.c:21:[va] Translating call to printf to a call to the specialized version printf_2. -tests/known/printf_wrong_types.c:21:[va] warning: Incorrect type for argument 2. The argument will be cast from int to unsigned int. -tests/known/printf_wrong_types.c:22:[va] Translating call to printf to a call to the specialized version printf_3. -tests/known/printf_wrong_types.c:22:[va] warning: Incorrect type for argument 2. The argument will be cast from int to long. -tests/known/printf_wrong_types.c:23:[va] Translating call to printf to a call to the specialized version printf_4. -tests/known/printf_wrong_types.c:23:[va] warning: Incorrect type for argument 2. The argument will be cast from long to int. -tests/known/printf_wrong_types.c:24:[va] Translating call to printf to a call to the specialized version printf_5. -tests/known/printf_wrong_types.c:24:[va] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to unsigned long. -tests/known/printf_wrong_types.c:25:[va] Translating call to printf to a call to the specialized version printf_6. -tests/known/printf_wrong_types.c:25:[va] warning: Incorrect type for argument 2. The argument will be cast from unsigned long to unsigned int. -tests/known/printf_wrong_types.c:26:[va] Translating call to printf to a call to the specialized version printf_7. -tests/known/printf_wrong_types.c:26:[va] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to void *. -tests/known/printf_wrong_types.c:27:[va] Translating call to printf to a call to the specialized version printf_8. -tests/known/printf_wrong_types.c:28:[va] Translating call to printf to a call to the specialized version printf_9. -tests/known/printf_wrong_types.c:28:[va] warning: Incorrect type for argument 2. The argument will be cast from long double to double. -tests/known/printf_wrong_types.c:29:[va] Translating call to printf to a call to the specialized version printf_10. -tests/known/printf_wrong_types.c:29:[va] warning: Incorrect type for argument 2. The argument will be cast from long double to double. -tests/known/printf_wrong_types.c:30:[va] Translating call to printf to a call to the specialized version printf_11. -tests/known/printf_wrong_types.c:30:[va] warning: Incorrect type for argument 2. The argument will be cast from int to char *. -tests/known/printf_wrong_types.c:31:[va] Translating call to printf to a call to the specialized version printf_12. -tests/known/printf_wrong_types.c:31:[va] warning: Incorrect type for argument 2. The argument will be cast from char * to int. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +tests/known/printf_wrong_types.c:19:[variadic] Translating call to printf to a call to the specialized version printf_va_1. +tests/known/printf_wrong_types.c:20:[variadic] Translating call to printf to a call to the specialized version printf_va_2. +tests/known/printf_wrong_types.c:20:[variadic] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to int. +tests/known/printf_wrong_types.c:21:[variadic] Translating call to printf to a call to the specialized version printf_va_3. +tests/known/printf_wrong_types.c:21:[variadic] warning: Incorrect type for argument 2. The argument will be cast from int to unsigned int. +tests/known/printf_wrong_types.c:22:[variadic] Translating call to printf to a call to the specialized version printf_va_4. +tests/known/printf_wrong_types.c:22:[variadic] warning: Incorrect type for argument 2. The argument will be cast from int to long. +tests/known/printf_wrong_types.c:23:[variadic] Translating call to printf to a call to the specialized version printf_va_5. +tests/known/printf_wrong_types.c:23:[variadic] warning: Incorrect type for argument 2. The argument will be cast from long to int. +tests/known/printf_wrong_types.c:24:[variadic] Translating call to printf to a call to the specialized version printf_va_6. +tests/known/printf_wrong_types.c:24:[variadic] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to unsigned long. +tests/known/printf_wrong_types.c:25:[variadic] Translating call to printf to a call to the specialized version printf_va_7. +tests/known/printf_wrong_types.c:25:[variadic] warning: Incorrect type for argument 2. The argument will be cast from unsigned long to unsigned int. +tests/known/printf_wrong_types.c:26:[variadic] Translating call to printf to a call to the specialized version printf_va_8. +tests/known/printf_wrong_types.c:26:[variadic] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to void *. +tests/known/printf_wrong_types.c:27:[variadic] Translating call to printf to a call to the specialized version printf_va_9. +tests/known/printf_wrong_types.c:28:[variadic] Translating call to printf to a call to the specialized version printf_va_10. +tests/known/printf_wrong_types.c:28:[variadic] warning: Incorrect type for argument 2. The argument will be cast from long double to double. +tests/known/printf_wrong_types.c:29:[variadic] Translating call to printf to a call to the specialized version printf_va_11. +tests/known/printf_wrong_types.c:29:[variadic] warning: Incorrect type for argument 2. The argument will be cast from long double to double. +tests/known/printf_wrong_types.c:30:[variadic] Translating call to printf to a call to the specialized version printf_va_12. +tests/known/printf_wrong_types.c:30:[variadic] warning: Incorrect type for argument 2. The argument will be cast from int to char *. +tests/known/printf_wrong_types.c:31:[variadic] Translating call to printf to a call to the specialized version printf_va_13. +tests/known/printf_wrong_types.c:31:[variadic] warning: Incorrect type for argument 2. The argument will be cast from char * to int. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] user error: type long double not implemented. Using double instead -[value] using specification for function printf_0 -[value] using specification for function printf_1 -[value] using specification for function printf_2 -[value] using specification for function printf_3 -[value] using specification for function printf_4 -[value] using specification for function printf_5 -[value] using specification for function printf_6 -[value] using specification for function printf_7 -[value] using specification for function printf_8 -[value] using specification for function printf_9 -[value] using specification for function printf_10 -[value] using specification for function printf_11 -tests/known/printf_wrong_types.c:30:[value] warning: function printf_11: precondition got status invalid. +[value] user error: type long double wider than 64 bits not supported. + Using double instead for the remainder of the analysis. +[value] using specification for function printf_va_1 +[value] using specification for function printf_va_2 +[value] using specification for function printf_va_3 +[value] using specification for function printf_va_4 +[value] using specification for function printf_va_5 +[value] using specification for function printf_va_6 +[value] using specification for function printf_va_7 +[value] using specification for function printf_va_8 +[value] using specification for function printf_va_9 +[value] using specification for function printf_va_10 +[value] using specification for function printf_va_11 +[value] using specification for function printf_va_12 +tests/known/printf_wrong_types.c:30:[value] warning: function printf_va_12: precondition got status invalid. [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -60,7 +61,7 @@ tests/known/printf_wrong_types.c:30:[value] warning: function printf_11: precond __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_0(char const *format, int param0); +int printf_va_1(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -73,7 +74,7 @@ int printf_0(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_1(char const *format, int param0); +int printf_va_2(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -86,7 +87,7 @@ int printf_1(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_2(char const *format, unsigned int param0); +int printf_va_3(char const *format, unsigned int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -99,7 +100,7 @@ int printf_2(char const *format, unsigned int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_3(char const *format, long param0); +int printf_va_4(char const *format, long param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -112,7 +113,7 @@ int printf_3(char const *format, long param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_4(char const *format, int param0); +int printf_va_5(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -125,7 +126,7 @@ int printf_4(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_5(char const *format, unsigned long param0); +int printf_va_6(char const *format, unsigned long param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -138,7 +139,7 @@ int printf_5(char const *format, unsigned long param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_6(char const *format, unsigned int param0); +int printf_va_7(char const *format, unsigned int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -151,7 +152,7 @@ int printf_6(char const *format, unsigned int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_7(char const *format, void *param0); +int printf_va_8(char const *format, void *param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -164,7 +165,7 @@ int printf_7(char const *format, void *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_8(char const *format, double param0); +int printf_va_9(char const *format, double param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -177,7 +178,7 @@ int printf_8(char const *format, double param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_9(char const *format, double param0); +int printf_va_10(char const *format, double param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -190,7 +191,7 @@ int printf_9(char const *format, double param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_10(char const *format, double param0); +int printf_va_11(char const *format, double param0); /*@ requires valid_read_string(format); requires valid_read_string(param0); @@ -204,7 +205,7 @@ int printf_10(char const *format, double param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param0 + (0 ..)); */ -int printf_11(char const *format, char *param0); +int printf_va_12(char const *format, char *param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -217,40 +218,32 @@ int printf_11(char const *format, char *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_12(char const *format, int param0); +int printf_va_13(char const *format, int param0); int main(void) { int __retres; - int i; - unsigned int ui; - long li; - unsigned long uli; - char c; - float f; - long double ld; - char *string; - i = 42; - ui = (unsigned int)42; - li = (long)42; - uli = (unsigned long)42; - c = (char)'4'; - f = 42.0f; - ld = 42.0l; - string = (char *)"42"; - printf_0("%hhd",(int)c); - printf_1("%d",(int)ui); - printf_2("%x",(unsigned int)i); - printf_3("%ld",(long)i); - printf_4("%d",(int)li); - printf_5("%lu",(unsigned long)ui); - printf_6("%u",(unsigned int)uli); - printf_7("%p",(void *)ui); - printf_8("%f",(double)f); - printf_9("%f",(double)ld); - printf_10("%lf",(double)ld); - printf_11("%s",(char *)i); - printf_12("%d",(int)string); + int i = 42; + unsigned int ui = (unsigned int)42; + long li = (long)42; + unsigned long uli = (unsigned long)42; + char c = (char)'4'; + float f = 42.0f; + long double ld = 42.0l; + char *string = (char *)"42"; + printf_va_1("%hhd",(int)c); + printf_va_2("%d",(int)ui); + printf_va_3("%x",(unsigned int)i); + printf_va_4("%ld",(long)i); + printf_va_5("%d",(int)li); + printf_va_6("%lu",(unsigned long)ui); + printf_va_7("%u",(unsigned int)uli); + printf_va_8("%p",(void *)ui); + printf_va_9("%f",(double)f); + printf_va_10("%f",(double)ld); + printf_va_11("%lf",(double)ld); + printf_va_12("%s",(char *)i); + printf_va_13("%d",(int)string); __retres = 0; return __retres; } @@ -259,7 +252,8 @@ int main(void) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] user error: type long double not implemented. Using double instead +[value] user error: type long double wider than 64 bits not supported. + Using double instead for the remainder of the analysis. tests/known/printf_wrong_types.c:19:[kernel] warning: Neither code nor specification for function printf, generating default assigns from the prototype [value] using specification for function printf [value] done for function main @@ -282,22 +276,14 @@ tests/known/printf_wrong_types.c:19:[kernel] warning: Neither code nor specifica int main(void) { int __retres; - int i; - unsigned int ui; - long li; - unsigned long uli; - char c; - float f; - long double ld; - char *string; - i = 42; - ui = (unsigned int)42; - li = (long)42; - uli = (unsigned long)42; - c = (char)'4'; - f = 42.0f; - ld = 42.0l; - string = (char *)"42"; + int i = 42; + unsigned int ui = (unsigned int)42; + long li = (long)42; + unsigned long uli = (unsigned long)42; + char c = (char)'4'; + float f = 42.0f; + long double ld = 42.0l; + char *string = (char *)"42"; printf("%hhd",(int)c); printf("%d",ui); printf("%x",i); @@ -316,44 +302,45 @@ int main(void) } -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -tests/known/printf_wrong_types.c:19:[va] Translating call to printf to a call to the specialized version printf_0. -tests/known/printf_wrong_types.c:20:[va] Translating call to printf to a call to the specialized version printf_1. -tests/known/printf_wrong_types.c:20:[va] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to int. -tests/known/printf_wrong_types.c:21:[va] Translating call to printf to a call to the specialized version printf_2. -tests/known/printf_wrong_types.c:21:[va] warning: Incorrect type for argument 2. The argument will be cast from int to unsigned int. -tests/known/printf_wrong_types.c:22:[va] Translating call to printf to a call to the specialized version printf_3. -tests/known/printf_wrong_types.c:23:[va] Translating call to printf to a call to the specialized version printf_4. -tests/known/printf_wrong_types.c:24:[va] Translating call to printf to a call to the specialized version printf_5. -tests/known/printf_wrong_types.c:25:[va] Translating call to printf to a call to the specialized version printf_6. -tests/known/printf_wrong_types.c:26:[va] Translating call to printf to a call to the specialized version printf_7. -tests/known/printf_wrong_types.c:26:[va] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to void *. -tests/known/printf_wrong_types.c:27:[va] Translating call to printf to a call to the specialized version printf_8. -tests/known/printf_wrong_types.c:28:[va] Translating call to printf to a call to the specialized version printf_9. -tests/known/printf_wrong_types.c:28:[va] warning: Incorrect type for argument 2. The argument will be cast from long double to double. -tests/known/printf_wrong_types.c:29:[va] Translating call to printf to a call to the specialized version printf_10. -tests/known/printf_wrong_types.c:29:[va] warning: Incorrect type for argument 2. The argument will be cast from long double to double. -tests/known/printf_wrong_types.c:30:[va] Translating call to printf to a call to the specialized version printf_11. -tests/known/printf_wrong_types.c:30:[va] warning: Incorrect type for argument 2. The argument will be cast from int to char *. -tests/known/printf_wrong_types.c:31:[va] Translating call to printf to a call to the specialized version printf_12. -tests/known/printf_wrong_types.c:31:[va] warning: Incorrect type for argument 2. The argument will be cast from char * to int. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +tests/known/printf_wrong_types.c:19:[variadic] Translating call to printf to a call to the specialized version printf_va_1. +tests/known/printf_wrong_types.c:20:[variadic] Translating call to printf to a call to the specialized version printf_va_2. +tests/known/printf_wrong_types.c:20:[variadic] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to int. +tests/known/printf_wrong_types.c:21:[variadic] Translating call to printf to a call to the specialized version printf_va_3. +tests/known/printf_wrong_types.c:21:[variadic] warning: Incorrect type for argument 2. The argument will be cast from int to unsigned int. +tests/known/printf_wrong_types.c:22:[variadic] Translating call to printf to a call to the specialized version printf_va_4. +tests/known/printf_wrong_types.c:23:[variadic] Translating call to printf to a call to the specialized version printf_va_5. +tests/known/printf_wrong_types.c:24:[variadic] Translating call to printf to a call to the specialized version printf_va_6. +tests/known/printf_wrong_types.c:25:[variadic] Translating call to printf to a call to the specialized version printf_va_7. +tests/known/printf_wrong_types.c:26:[variadic] Translating call to printf to a call to the specialized version printf_va_8. +tests/known/printf_wrong_types.c:26:[variadic] warning: Incorrect type for argument 2. The argument will be cast from unsigned int to void *. +tests/known/printf_wrong_types.c:27:[variadic] Translating call to printf to a call to the specialized version printf_va_9. +tests/known/printf_wrong_types.c:28:[variadic] Translating call to printf to a call to the specialized version printf_va_10. +tests/known/printf_wrong_types.c:28:[variadic] warning: Incorrect type for argument 2. The argument will be cast from long double to double. +tests/known/printf_wrong_types.c:29:[variadic] Translating call to printf to a call to the specialized version printf_va_11. +tests/known/printf_wrong_types.c:29:[variadic] warning: Incorrect type for argument 2. The argument will be cast from long double to double. +tests/known/printf_wrong_types.c:30:[variadic] Translating call to printf to a call to the specialized version printf_va_12. +tests/known/printf_wrong_types.c:30:[variadic] warning: Incorrect type for argument 2. The argument will be cast from int to char *. +tests/known/printf_wrong_types.c:31:[variadic] Translating call to printf to a call to the specialized version printf_va_13. +tests/known/printf_wrong_types.c:31:[variadic] warning: Incorrect type for argument 2. The argument will be cast from char * to int. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] user error: type long double not implemented. Using double instead -[value] using specification for function printf_0 -[value] using specification for function printf_1 -[value] using specification for function printf_2 -[value] using specification for function printf_3 -[value] using specification for function printf_4 -[value] using specification for function printf_5 -[value] using specification for function printf_6 -[value] using specification for function printf_7 -[value] using specification for function printf_8 -[value] using specification for function printf_9 -[value] using specification for function printf_10 -[value] using specification for function printf_11 -tests/known/printf_wrong_types.c:30:[value] warning: function printf_11: precondition got status invalid. +[value] user error: type long double wider than 64 bits not supported. + Using double instead for the remainder of the analysis. +[value] using specification for function printf_va_1 +[value] using specification for function printf_va_2 +[value] using specification for function printf_va_3 +[value] using specification for function printf_va_4 +[value] using specification for function printf_va_5 +[value] using specification for function printf_va_6 +[value] using specification for function printf_va_7 +[value] using specification for function printf_va_8 +[value] using specification for function printf_va_9 +[value] using specification for function printf_va_10 +[value] using specification for function printf_va_11 +[value] using specification for function printf_va_12 +tests/known/printf_wrong_types.c:30:[value] warning: function printf_va_12: precondition got status invalid. [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -374,7 +361,7 @@ tests/known/printf_wrong_types.c:30:[value] warning: function printf_11: precond __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_0(char const *format, int param0); +int printf_va_1(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -387,7 +374,7 @@ int printf_0(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_1(char const *format, int param0); +int printf_va_2(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -400,7 +387,7 @@ int printf_1(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_2(char const *format, unsigned int param0); +int printf_va_3(char const *format, unsigned int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -413,7 +400,7 @@ int printf_2(char const *format, unsigned int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_3(char const *format, long param0); +int printf_va_4(char const *format, long param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -426,7 +413,7 @@ int printf_3(char const *format, long param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_4(char const *format, int param0); +int printf_va_5(char const *format, int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -439,7 +426,7 @@ int printf_4(char const *format, int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_5(char const *format, unsigned long param0); +int printf_va_6(char const *format, unsigned long param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -452,7 +439,7 @@ int printf_5(char const *format, unsigned long param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_6(char const *format, unsigned int param0); +int printf_va_7(char const *format, unsigned int param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -465,7 +452,7 @@ int printf_6(char const *format, unsigned int param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_7(char const *format, void *param0); +int printf_va_8(char const *format, void *param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -478,7 +465,7 @@ int printf_7(char const *format, void *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_8(char const *format, double param0); +int printf_va_9(char const *format, double param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -491,7 +478,7 @@ int printf_8(char const *format, double param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_9(char const *format, double param0); +int printf_va_10(char const *format, double param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -504,7 +491,7 @@ int printf_9(char const *format, double param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_10(char const *format, double param0); +int printf_va_11(char const *format, double param0); /*@ requires valid_read_string(format); requires valid_read_string(param0); @@ -518,7 +505,7 @@ int printf_10(char const *format, double param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param0 + (0 ..)); */ -int printf_11(char const *format, char *param0); +int printf_va_12(char const *format, char *param0); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -531,40 +518,32 @@ int printf_11(char const *format, char *param0); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_12(char const *format, int param0); +int printf_va_13(char const *format, int param0); int main(void) { int __retres; - int i; - unsigned int ui; - long li; - unsigned long uli; - char c; - float f; - long double ld; - char *string; - i = 42; - ui = (unsigned int)42; - li = (long)42; - uli = (unsigned long)42; - c = (char)'4'; - f = 42.0f; - ld = 42.0l; - string = (char *)"42"; - printf_0("%hhd",(int)c); - printf_1("%d",(int)ui); - printf_2("%x",(unsigned int)i); - printf_3("%ld",(long)i); - printf_4("%d",(int)li); - printf_5("%lu",(unsigned long)ui); - printf_6("%u",(unsigned int)uli); - printf_7("%p",(void *)ui); - printf_8("%f",(double)f); - printf_9("%f",(double)ld); - printf_10("%lf",(double)ld); - printf_11("%s",(char *)i); - printf_12("%d",(int)string); + int i = 42; + unsigned int ui = (unsigned int)42; + long li = (long)42; + unsigned long uli = (unsigned long)42; + char c = (char)'4'; + float f = 42.0f; + long double ld = 42.0l; + char *string = (char *)"42"; + printf_va_1("%hhd",(int)c); + printf_va_2("%d",(int)ui); + printf_va_3("%x",(unsigned int)i); + printf_va_4("%ld",(long)i); + printf_va_5("%d",(int)li); + printf_va_6("%lu",(unsigned long)ui); + printf_va_7("%u",(unsigned int)uli); + printf_va_8("%p",(void *)ui); + printf_va_9("%f",(double)f); + printf_va_10("%f",(double)ld); + printf_va_11("%lf",(double)ld); + printf_va_12("%s",(char *)i); + printf_va_13("%d",(int)string); __retres = 0; return __retres; } diff --git a/src/plugins/variadic/tests/known/oracle/scanf.res.oracle b/src/plugins/variadic/tests/known/oracle/scanf.res.oracle index 4c63dbfc7f7ba7be42e6a4dfa9ced99e67f46d0f..3fe4c3f157c795dc71b13f9166636a17efcb583e 100644 --- a/src/plugins/variadic/tests/known/oracle/scanf.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/scanf.res.oracle @@ -1,9 +1,9 @@ -FRAMAC_SHARE/libc/stdio.h:142:[va] Declaration of variadic function scanf. -tests/known/scanf.c:7:[va] Translating call to scanf to a call to the specialized version scanf_0. +FRAMAC_SHARE/libc/stdio.h:151:[variadic] Declaration of variadic function scanf. +tests/known/scanf.c:7:[variadic] Translating call to scanf to a call to the specialized version scanf_va_1. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] using specification for function scanf_0 +[value] using specification for function scanf_va_1 [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -40,14 +40,14 @@ tests/known/scanf.c:7:[va] Translating call to scanf to a call to the specialize \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int scanf_0(char const *format, char *param0, char *param1, int *param2); +int scanf_va_1(char const *format, char *param0, char *param1, int *param2); int main(void) { int __retres; char c[10]; int i; - scanf_0("Hello %*10le %% %10s %[^]world] %d !",c,c,& i); + scanf_va_1("Hello %*10le %% %10s %[^]world] %d !",c,c,& i); __retres = 0; return __retres; } diff --git a/src/plugins/variadic/tests/known/oracle/scanf_loop.res.oracle b/src/plugins/variadic/tests/known/oracle/scanf_loop.res.oracle index 1020b71a6cf54f515428d90e85d2232fc9883d6c..0e5f17dd91abb713cffb6df0961524c2c13757f1 100644 --- a/src/plugins/variadic/tests/known/oracle/scanf_loop.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/scanf_loop.res.oracle @@ -1,9 +1,9 @@ -FRAMAC_SHARE/libc/stdio.h:142:[va] Declaration of variadic function scanf. -tests/known/scanf_loop.c:6:[va] Translating call to scanf to a call to the specialized version scanf_0. +FRAMAC_SHARE/libc/stdio.h:151:[variadic] Declaration of variadic function scanf. +tests/known/scanf_loop.c:6:[variadic] Translating call to scanf to a call to the specialized version scanf_va_1. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed -[value] using specification for function scanf_0 +[value] using specification for function scanf_va_1 [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -29,14 +29,14 @@ int volatile nondet; \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int scanf_0(char const *format, int *param0); +int scanf_va_1(char const *format, int *param0); int main(void) { int n; while (1) { int tmp; - tmp = scanf_0("%d",& n); + tmp = scanf_va_1("%d",& n); if (! (tmp > 0)) break; if (nondet) break; } diff --git a/src/plugins/variadic/tests/known/oracle/scanf_wrong.res.oracle b/src/plugins/variadic/tests/known/oracle/scanf_wrong.res.oracle index 7ee343d27d301097075a2b7c8a23ed3bed9769f9..63a985dab7cf9558f66f25a4591d46ed2a94ff1d 100644 --- a/src/plugins/variadic/tests/known/oracle/scanf_wrong.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/scanf_wrong.res.oracle @@ -1,6 +1,6 @@ -FRAMAC_SHARE/libc/stdio.h:142:[va] Declaration of variadic function scanf. -tests/known/scanf_wrong.c:8:[va] Translating call to scanf to a call to the specialized version scanf_0. -tests/known/scanf_wrong.c:8:[va] warning: Incorrect type for argument 2. The argument will be cast from double to char *. +FRAMAC_SHARE/libc/stdio.h:151:[variadic] Declaration of variadic function scanf. +tests/known/scanf_wrong.c:8:[variadic] Translating call to scanf to a call to the specialized version scanf_va_1. +tests/known/scanf_wrong.c:8:[variadic] warning: Incorrect type for argument 2. The argument will be cast from double to char *. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -38,7 +38,7 @@ tests/known/scanf_wrong.c:8:[value] assertion 'Value,initialisation' got final s \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int scanf_0(char const *format, char *param0, char *param1, int *param2); +int scanf_va_1(char const *format, char *param0, char *param1, int *param2); int main(void) { @@ -47,7 +47,7 @@ int main(void) char c[10]; int i; /*@ assert Value: initialisation: \initialized(&d); */ - scanf_0("Hello %*10le %% %10s %[^]world] %d !",(char *)d,c,& i); + scanf_va_1("Hello %*10le %% %10s %[^]world] %d !",(char *)d,c,& i); __retres = 0; return __retres; } diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value.1.err.oracle b/src/plugins/variadic/tests/known/oracle/snprintf.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle/init_value.1.err.oracle rename to src/plugins/variadic/tests/known/oracle/snprintf.err.oracle diff --git a/src/plugins/variadic/tests/known/oracle/snprintf.res.oracle b/src/plugins/variadic/tests/known/oracle/snprintf.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..da8afc511217278b0f736d2a5fc48e8bd72d051c --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/snprintf.res.oracle @@ -0,0 +1,74 @@ +FRAMAC_SHARE/libc/stdio.h:152:[variadic] Declaration of variadic function snprintf. +tests/known/snprintf.c:12:[variadic] Translating call to snprintf to a call to the specialized version snprintf_va_1. +tests/known/snprintf.c:15:[variadic] Translating call to snprintf to a call to the specialized version snprintf_va_2. +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value] using specification for function snprintf_va_1 +tests/known/snprintf.c:12:[value] Cannot evaluate range bound format_length(format) - 1 + (unsupported ACSL construct: logic functions or predicates). Approximating +tests/known/snprintf.c:12:[value] warning: function snprintf_va_1: precondition got status unknown. +tests/known/snprintf.c:13:[value] warning: assertion got status invalid (stopping propagation). +[value] using specification for function snprintf_va_2 +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + data[0..98] ∈ {65} + [99] ∈ {0} + dest[0..49] ∈ [--..--] + __retres ∈ {0} +/* Generated by Frama-C */ +#include "errno.h" +#include "stdarg.h" +#include "stddef.h" +#include "stdio.h" +#include "string.h" +#include "strings.h" +int volatile nondet; +/*@ requires + \valid(s + (0 .. n - 1)) ∨ + \valid(s + (0 .. format_length(format) - 1)); + requires valid_read_string(format); + requires valid_read_string(param0); + assigns \result, *(s + (0 ..)); + assigns \result + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + assigns *(s + (0 ..)) + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + */ +int snprintf_va_1(char *s, size_t n, char const *format, char *param0); + +/*@ requires + \valid(s + (0 .. n - 1)) ∨ + \valid(s + (0 .. format_length(format) - 1)); + requires valid_read_string(format); + requires valid_read_string(param0); + assigns \result, *(s + (0 ..)); + assigns \result + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + assigns *(s + (0 ..)) + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + */ +int snprintf_va_2(char *s, size_t n, char const *format, char *param0); + +int main(void) +{ + int __retres; + char data[100]; + size_t tmp_0; + memset((void *)(data),'A',(unsigned int)99); + data[99] = (char)0; + char dest[50] = {(char)'\000'}; + if (nondet) { + size_t tmp; + tmp = strlen((char const *)(data)); + snprintf_va_1(dest,tmp,"%s",data); + /*@ assert \false; */ ; + } + tmp_0 = strlen((char const *)(data)); + snprintf_va_2(dest,tmp_0 / (size_t)2,"%s",data); + __retres = 0; + return __retres; +} + + diff --git a/src/plugins/variadic/tests/known/oracle/stdio_print.res.oracle b/src/plugins/variadic/tests/known/oracle/stdio_print.res.oracle index e380d3fa982c472ab751dd8774740e06417110a9..be203dd588ef22d6a1578af0515e8a6074f3eb77 100644 --- a/src/plugins/variadic/tests/known/oracle/stdio_print.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/stdio_print.res.oracle @@ -1,24 +1,36 @@ -tests/known/stdio_print.c:13:[kernel] warning: Calling undeclared function dprintf. Old style K&R code? -FRAMAC_SHARE/libc/stdio.h:137:[va] Declaration of variadic function fprintf. -FRAMAC_SHARE/libc/stdio.h:141:[va] Declaration of variadic function printf. -FRAMAC_SHARE/libc/stdio.h:143:[va] Declaration of variadic function snprintf. -FRAMAC_SHARE/libc/stdio.h:145:[va] Declaration of variadic function sprintf. -tests/known/stdio_print.c:9:[va] Generic translation of call to variadic function. -tests/known/stdio_print.c:10:[va] Generic translation of call to variadic function. -tests/known/stdio_print.c:11:[va] Generic translation of call to variadic function. -tests/known/stdio_print.c:12:[va] Generic translation of call to variadic function. -tests/known/stdio_print.c:15:[va] Translating call to fprintf to a call to the specialized version fprintf_0. -tests/known/stdio_print.c:16:[va] Translating call to printf to a call to the specialized version printf_0. -tests/known/stdio_print.c:17:[va] Translating call to snprintf to a call to the specialized version snprintf_0. -tests/known/stdio_print.c:18:[va] Translating call to sprintf to a call to the specialized version sprintf_0. +FRAMAC_SHARE/libc/stdio.h:146:[variadic] Declaration of variadic function fprintf. +FRAMAC_SHARE/libc/stdio.h:150:[variadic] Declaration of variadic function printf. +FRAMAC_SHARE/libc/stdio.h:152:[variadic] Declaration of variadic function snprintf. +FRAMAC_SHARE/libc/stdio.h:154:[variadic] Declaration of variadic function sprintf. +FRAMAC_SHARE/libc/stdio.h:335:[variadic] Declaration of variadic function dprintf. +tests/known/stdio_print.c:9:[variadic] warning: Call to function fprintf with non-static format argument: + no specification will be generated. +tests/known/stdio_print.c:9:[variadic] Generic translation of call to variadic function. +tests/known/stdio_print.c:10:[variadic] warning: Call to function printf with non-static format argument: + no specification will be generated. +tests/known/stdio_print.c:10:[variadic] Generic translation of call to variadic function. +tests/known/stdio_print.c:11:[variadic] warning: Call to function snprintf with non-static format argument: + no specification will be generated. +tests/known/stdio_print.c:11:[variadic] Generic translation of call to variadic function. +tests/known/stdio_print.c:12:[variadic] warning: Call to function sprintf with non-static format argument: + no specification will be generated. +tests/known/stdio_print.c:12:[variadic] Generic translation of call to variadic function. +tests/known/stdio_print.c:13:[variadic] warning: Call to function dprintf with non-static format argument: + no specification will be generated. +tests/known/stdio_print.c:13:[variadic] Generic translation of call to variadic function. +tests/known/stdio_print.c:15:[variadic] Translating call to fprintf to a call to the specialized version fprintf_va_1. +tests/known/stdio_print.c:16:[variadic] Translating call to printf to a call to the specialized version printf_va_1. +tests/known/stdio_print.c:17:[variadic] Translating call to snprintf to a call to the specialized version snprintf_va_1. +tests/known/stdio_print.c:18:[variadic] Translating call to sprintf to a call to the specialized version sprintf_va_1. +tests/known/stdio_print.c:19:[variadic] Translating call to dprintf to a call to the specialized version dprintf_va_1. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed tests/known/stdio_print.c:9:[value] warning: accessing uninitialized left-value. assert \initialized(&format); [value] done for function main tests/known/stdio_print.c:9:[value] assertion 'Value,initialisation' got final status invalid. -[value] ====== VALUES COMPUTED ====== tests/known/stdio_print.c:9:[kernel] warning: Neither code nor specification for function fprintf, generating default assigns from the prototype +[value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: NON TERMINATING FUNCTION /* Generated by Frama-C */ @@ -26,9 +38,6 @@ tests/known/stdio_print.c:9:[kernel] warning: Neither code nor specification for #include "stdarg.h" #include "stddef.h" #include "stdio.h" -extern int ( /* missing proto */ dprintf)(int x_0, char *x_1, int x_2, - char const *x_3, char const *x_4); - /*@ requires valid_read_string(format); requires valid_read_string(param1); assigns \result, stream->__fc_FILE_data; @@ -41,8 +50,8 @@ extern int ( /* missing proto */ dprintf)(int x_0, char *x_1, int x_2, (indirect: *(format + (0 ..))), param2, *(param1 + (0 ..)), param0; */ -int fprintf_0(FILE *stream, char const *format, int param0, char *param1, - int param2); +int fprintf_va_1(FILE *stream, char const *format, int param0, char *param1, + int param2); /*@ requires valid_read_string(format); requires valid_read_string(param1); @@ -56,9 +65,12 @@ int fprintf_0(FILE *stream, char const *format, int param0, char *param1, __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param2, *(param1 + (0 ..)), param0; */ -int printf_0(char const *format, int param0, char *param1, int param2); +int printf_va_1(char const *format, int param0, char *param1, int param2); -/*@ requires valid_read_string(format); +/*@ requires + \valid(s + (0 .. n - 1)) ∨ + \valid(s + (0 .. format_length(format) - 1)); + requires valid_read_string(format); requires valid_read_string(param1); assigns \result, *(s + (0 ..)); assigns \result @@ -68,8 +80,8 @@ int printf_0(char const *format, int param0, char *param1, int param2); \from (indirect: n), (indirect: *(format + (0 ..))), param2, *(param1 + (0 ..)), param0; */ -int snprintf_0(char *s, size_t n, char const *format, int param0, - char *param1, int param2); +int snprintf_va_1(char *s, size_t n, char const *format, int param0, + char *param1, int param2); /*@ requires valid_read_string(format); requires valid_read_string(param1); @@ -81,8 +93,19 @@ int snprintf_0(char *s, size_t n, char const *format, int param0, \from (indirect: *(format + (0 ..))), param2, *(param1 + (0 ..)), param0; */ -int sprintf_0(char *s, char const *format, int param0, char *param1, - int param2); +int sprintf_va_1(char *s, char const *format, int param0, char *param1, + int param2); + +/*@ requires valid_read_string(format); + requires valid_read_string(param2); + requires valid_read_string(param1); + assigns \result; + assigns \result + \from (indirect: fd), (indirect: *(format + (0 ..))), + *(param2 + (0 ..)), *(param1 + (0 ..)), param0; + */ +int dprintf_va_1(int fd, char const *format, int param0, char *param1, + char *param2); int main(void) { @@ -92,64 +115,46 @@ int main(void) char *str; size_t size; { - void *__va_args[3]; - int __va_arg2; - char const *__va_arg1; - int __va_arg0; - __va_arg0 = 1; - __va_arg1 = "2"; - __va_arg2 = 3; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; + int __va_arg0 = 1; + char const *__va_arg1 = "2"; + int __va_arg2 = 3; + void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; /*@ assert Value: initialisation: \initialized(&format); */ fprintf(stream,(char const *)format,(void * const *)(__va_args)); } { - void *__va_args_16[3]; - int __va_arg2_14; - char const *__va_arg1_12; - int __va_arg0_10; - __va_arg0_10 = 1; - __va_arg1_12 = "2"; - __va_arg2_14 = 3; - __va_args_16[0] = & __va_arg0_10; - __va_args_16[1] = & __va_arg1_12; - __va_args_16[2] = & __va_arg2_14; + int __va_arg0_10 = 1; + char const *__va_arg1_12 = "2"; + int __va_arg2_14 = 3; + void *__va_args_16[3] = {& __va_arg0_10, & __va_arg1_12, & __va_arg2_14}; printf((char const *)format,(void * const *)(__va_args_16)); } { - void *__va_args_24[3]; - int __va_arg2_22; - char const *__va_arg1_20; - int __va_arg0_18; - __va_arg0_18 = 1; - __va_arg1_20 = "2"; - __va_arg2_22 = 3; - __va_args_24[0] = & __va_arg0_18; - __va_args_24[1] = & __va_arg1_20; - __va_args_24[2] = & __va_arg2_22; + int __va_arg0_18 = 1; + char const *__va_arg1_20 = "2"; + int __va_arg2_22 = 3; + void *__va_args_24[3] = {& __va_arg0_18, & __va_arg1_20, & __va_arg2_22}; snprintf(str,size,(char const *)format,(void * const *)(__va_args_24)); } { - void *__va_args_32[3]; - int __va_arg2_30; - char const *__va_arg1_28; - int __va_arg0_26; - __va_arg0_26 = 1; - __va_arg1_28 = "2"; - __va_arg2_30 = 3; - __va_args_32[0] = & __va_arg0_26; - __va_args_32[1] = & __va_arg1_28; - __va_args_32[2] = & __va_arg2_30; + int __va_arg0_26 = 1; + char const *__va_arg1_28 = "2"; + int __va_arg2_30 = 3; + void *__va_args_32[3] = {& __va_arg0_26, & __va_arg1_28, & __va_arg2_30}; sprintf(str,(char const *)format,(void * const *)(__va_args_32)); } - dprintf(1,format,1,"3","4"); - fprintf_0(stream,"%d %s %d",1,(char *)"2",3); - printf_0("%d %s %d",1,(char *)"2",3); - snprintf_0(str,size,"%d %s %d",1,(char *)"2",3); - sprintf_0(str,"%d %s %d",1,(char *)"2",3); - dprintf(1,(char *)"%d %s %s",1,"3","4"); + { + int __va_arg0_34 = 1; + char const *__va_arg1_36 = "3"; + char const *__va_arg2_38 = "4"; + void *__va_args_40[3] = {& __va_arg0_34, & __va_arg1_36, & __va_arg2_38}; + dprintf(1,(char const *)format,(void * const *)(__va_args_40)); + } + fprintf_va_1(stream,"%d %s %d",1,(char *)"2",3); + printf_va_1("%d %s %d",1,(char *)"2",3); + snprintf_va_1(str,size,"%d %s %d",1,(char *)"2",3); + sprintf_va_1(str,"%d %s %d",1,(char *)"2",3); + dprintf_va_1(1,"%d %s %s",1,(char *)"3",(char *)"4"); __retres = 0; return __retres; } diff --git a/src/plugins/variadic/tests/known/oracle/stdio_scan.res.oracle b/src/plugins/variadic/tests/known/oracle/stdio_scan.res.oracle index deae937126bbd1a2df9c0cbbc85c4409fe61164d..48a12535ee8c97a3c71afb72321f868a3c9fc618 100644 --- a/src/plugins/variadic/tests/known/oracle/stdio_scan.res.oracle +++ b/src/plugins/variadic/tests/known/oracle/stdio_scan.res.oracle @@ -1,12 +1,18 @@ -FRAMAC_SHARE/libc/stdio.h:139:[va] Declaration of variadic function fscanf. -FRAMAC_SHARE/libc/stdio.h:142:[va] Declaration of variadic function scanf. -FRAMAC_SHARE/libc/stdio.h:147:[va] Declaration of variadic function sscanf. -tests/known/stdio_scan.c:11:[va] Generic translation of call to variadic function. -tests/known/stdio_scan.c:12:[va] Generic translation of call to variadic function. -tests/known/stdio_scan.c:13:[va] Generic translation of call to variadic function. -tests/known/stdio_scan.c:15:[va] Translating call to fscanf to a call to the specialized version fscanf_0. -tests/known/stdio_scan.c:16:[va] Translating call to scanf to a call to the specialized version scanf_0. -tests/known/stdio_scan.c:17:[va] Translating call to sscanf to a call to the specialized version sscanf_0. +FRAMAC_SHARE/libc/stdio.h:148:[variadic] Declaration of variadic function fscanf. +FRAMAC_SHARE/libc/stdio.h:151:[variadic] Declaration of variadic function scanf. +FRAMAC_SHARE/libc/stdio.h:156:[variadic] Declaration of variadic function sscanf. +tests/known/stdio_scan.c:11:[variadic] warning: Call to function fscanf with non-static format argument: + no specification will be generated. +tests/known/stdio_scan.c:11:[variadic] Generic translation of call to variadic function. +tests/known/stdio_scan.c:12:[variadic] warning: Call to function scanf with non-static format argument: + no specification will be generated. +tests/known/stdio_scan.c:12:[variadic] Generic translation of call to variadic function. +tests/known/stdio_scan.c:13:[variadic] warning: Call to function sscanf with non-static format argument: + no specification will be generated. +tests/known/stdio_scan.c:13:[variadic] Generic translation of call to variadic function. +tests/known/stdio_scan.c:15:[variadic] Translating call to fscanf to a call to the specialized version fscanf_va_1. +tests/known/stdio_scan.c:16:[variadic] Translating call to scanf to a call to the specialized version scanf_va_1. +tests/known/stdio_scan.c:17:[variadic] Translating call to sscanf to a call to the specialized version sscanf_va_1. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -44,8 +50,8 @@ tests/known/stdio_scan.c:11:[value] assertion 'Value,initialisation' got final s \from (indirect: stream->__fc_FILE_id), stream->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int fscanf_0(FILE *stream, char const *format, int *param0, char *param1, - int *param2); +int fscanf_va_1(FILE *stream, char const *format, int *param0, char *param1, + int *param2); /*@ requires valid_read_string(format); requires \valid(param2); @@ -70,7 +76,7 @@ int fscanf_0(FILE *stream, char const *format, int *param0, char *param1, \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int scanf_0(char const *format, int *param0, char *param1, int *param2); +int scanf_va_1(char const *format, int *param0, char *param1, int *param2); /*@ requires valid_read_string(s); requires valid_read_string(format); @@ -88,8 +94,8 @@ int scanf_0(char const *format, int *param0, char *param1, int *param2); assigns *param0 \from (indirect: *(s + (0 ..))), (indirect: *(format + (0 ..))); */ -int sscanf_0(char const *s, char const *format, int *param0, char *param1, - int *param2); +int sscanf_va_1(char const *s, char const *format, int *param0, char *param1, + int *param2); int main(void) { @@ -101,49 +107,31 @@ int main(void) int j; char *s; { - void *__va_args[3]; - int *__va_arg2; - char *__va_arg1; - int *__va_arg0; - __va_arg0 = & i; + int *__va_arg0 = & i; /*@ assert Value: initialisation: \initialized(&s); */ - __va_arg1 = s; - __va_arg2 = & j; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; + char *__va_arg1 = s; + int *__va_arg2 = & j; + void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; fscanf(stream,(char const *)format,(void * const *)(__va_args)); } { - void *__va_args_19[3]; - int *__va_arg2_17; - char *__va_arg1_15; - int *__va_arg0_13; - __va_arg0_13 = & i; - __va_arg1_15 = s; - __va_arg2_17 = & j; - __va_args_19[0] = & __va_arg0_13; - __va_args_19[1] = & __va_arg1_15; - __va_args_19[2] = & __va_arg2_17; + int *__va_arg0_13 = & i; + char *__va_arg1_15 = s; + int *__va_arg2_17 = & j; + void *__va_args_19[3] = {& __va_arg0_13, & __va_arg1_15, & __va_arg2_17}; scanf((char const *)format,(void * const *)(__va_args_19)); } { - void *__va_args_27[3]; - int *__va_arg2_25; - char *__va_arg1_23; - int *__va_arg0_21; - __va_arg0_21 = & i; - __va_arg1_23 = s; - __va_arg2_25 = & j; - __va_args_27[0] = & __va_arg0_21; - __va_args_27[1] = & __va_arg1_23; - __va_args_27[2] = & __va_arg2_25; + int *__va_arg0_21 = & i; + char *__va_arg1_23 = s; + int *__va_arg2_25 = & j; + void *__va_args_27[3] = {& __va_arg0_21, & __va_arg1_23, & __va_arg2_25}; sscanf((char const *)str,(char const *)format, (void * const *)(__va_args_27)); } - fscanf_0(stream,"%d %s %d",& i,s,& j); - scanf_0("%d %s %d",& i,s,& j); - sscanf_0((char const *)str,"%d %s %d",& i,s,& j); + fscanf_va_1(stream,"%d %s %d",& i,s,& j); + scanf_va_1("%d %s %d",& i,s,& j); + sscanf_va_1((char const *)str,"%d %s %d",& i,s,& j); __retres = 0; return __retres; } diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value.2.err.oracle b/src/plugins/variadic/tests/known/oracle/swprintf.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle/init_value.2.err.oracle rename to src/plugins/variadic/tests/known/oracle/swprintf.err.oracle diff --git a/src/plugins/variadic/tests/known/oracle/swprintf.res.oracle b/src/plugins/variadic/tests/known/oracle/swprintf.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..1bf5b063df68c6d9612593afdd237e607f4d114c --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/swprintf.res.oracle @@ -0,0 +1,76 @@ +FRAMAC_SHARE/libc/wchar.h:178:[variadic] Declaration of variadic function swprintf. +tests/known/swprintf.c:12:[variadic] Translating call to swprintf to a call to the specialized version swprintf_va_1. +tests/known/swprintf.c:15:[variadic] Translating call to swprintf to a call to the specialized version swprintf_va_2. +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value] using specification for function wmemset +[value] using specification for function swprintf_va_1 +tests/known/swprintf.c:12:[value] Cannot evaluate range bound wformat_length(format) - 1 + (unsupported ACSL construct: logic functions or predicates). Approximating +tests/known/swprintf.c:12:[value] warning: function swprintf_va_1: precondition got status unknown. +tests/known/swprintf.c:13:[value] warning: assertion got status invalid (stopping propagation). +[value] using specification for function swprintf_va_2 +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + data[0..98] ∈ {65} + [99] ∈ {0} + dest[0..49] ∈ [--..--] + __retres ∈ {0} +/* Generated by Frama-C */ +#include "errno.h" +#include "stdarg.h" +#include "stdio.h" +#include "time.h" +#include "wchar.h" +int volatile nondet; +/*@ requires + \valid(ws + (0 .. n - 1)) ∨ + \valid(ws + (0 .. wformat_length(format) - 1)); + requires valid_read_wstring(format); + requires valid_read_wstring(param0); + assigns \result, *(ws + (0 ..)); + assigns \result + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + assigns *(ws + (0 ..)) + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + */ +int swprintf_va_1(wchar_t *ws, size_t n, wchar_t const *format, + wchar_t *param0); + +/*@ requires + \valid(ws + (0 .. n - 1)) ∨ + \valid(ws + (0 .. wformat_length(format) - 1)); + requires valid_read_wstring(format); + requires valid_read_wstring(param0); + assigns \result, *(ws + (0 ..)); + assigns \result + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + assigns *(ws + (0 ..)) + \from (indirect: n), (indirect: *(format + (0 ..))), *(param0 + (0 ..)); + */ +int swprintf_va_2(wchar_t *ws, size_t n, wchar_t const *format, + wchar_t *param0); + +int main(void) +{ + int __retres; + wchar_t data[100]; + size_t tmp_0; + wmemset(data,65,(unsigned int)99); + data[99] = 0; + wchar_t dest[50] = {0}; + if (nondet) { + size_t tmp; + tmp = wcslen((wchar_t const *)(data)); + swprintf_va_1(dest,tmp,(wchar_t const *)L"%" "l" "s" ,data); + /*@ assert \false; */ ; + } + tmp_0 = wcslen((wchar_t const *)(data)); + swprintf_va_2(dest,tmp_0 / (size_t)2,(wchar_t const *)L"%" "l" "s" ,data); + __retres = 0; + return __retres; +} + + diff --git a/src/plugins/wp/tests/wp_acsl/oracle/pointer.1.err.oracle b/src/plugins/variadic/tests/known/oracle/wchar.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle/pointer.1.err.oracle rename to src/plugins/variadic/tests/known/oracle/wchar.err.oracle diff --git a/src/plugins/variadic/tests/known/oracle/wchar.res.oracle b/src/plugins/variadic/tests/known/oracle/wchar.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..97c6ce33c3b67ea0e0033d529a942eb5d127e3f4 --- /dev/null +++ b/src/plugins/variadic/tests/known/oracle/wchar.res.oracle @@ -0,0 +1,231 @@ +FRAMAC_SHARE/libc/wchar.h:178:[variadic] Declaration of variadic function swprintf. +FRAMAC_SHARE/libc/wchar.h:180:[variadic] Declaration of variadic function wprintf. +FRAMAC_SHARE/libc/wchar.h:183:[variadic] Declaration of variadic function wscanf. +FRAMAC_SHARE/libc/wchar.h:187:[variadic] Declaration of variadic function swscanf. +tests/known/wchar.c:11:[variadic] Translating call to wprintf to a call to the specialized version wprintf_va_1. +tests/known/wchar.c:12:[variadic] Translating call to wprintf to a call to the specialized version wprintf_va_2. +tests/known/wchar.c:13:[variadic] Translating call to wprintf to a call to the specialized version wprintf_va_3. +tests/known/wchar.c:14:[variadic] Translating call to wprintf to a call to the specialized version wprintf_va_4. +tests/known/wchar.c:15:[variadic] Translating call to wprintf to a call to the specialized version wprintf_va_5. +tests/known/wchar.c:16:[variadic] Translating call to wprintf to a call to the specialized version wprintf_va_6. +tests/known/wchar.c:18:[variadic] Translating call to swprintf to a call to the specialized version swprintf_va_1. +tests/known/wchar.c:20:[variadic] Translating call to wscanf to a call to the specialized version wscanf_va_1. +tests/known/wchar.c:21:[variadic] Translating call to wscanf to a call to the specialized version wscanf_va_2. +tests/known/wchar.c:23:[variadic] Translating call to swscanf to a call to the specialized version swscanf_va_1. +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value] using specification for function wprintf_va_1 +[value] using specification for function wprintf_va_2 +[value] using specification for function wprintf_va_3 +[value] using specification for function wprintf_va_4 +[value] using specification for function wprintf_va_5 +[value] using specification for function wprintf_va_6 +[value] using specification for function swprintf_va_1 +[value] using specification for function wscanf_va_1 +[value] using specification for function wscanf_va_2 +[value] using specification for function swscanf_va_1 +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + input[0] ∈ {102} + [1] ∈ {111} + [2] ∈ {114} + [3] ∈ {116} + [4] ∈ {121} + [5] ∈ {45} + [6] ∈ {116} + [7] ∈ {119} + [8] ∈ {111} + [9] ∈ {32} + [10] ∈ {105} + [11] ∈ {115} + [12..255] ∈ {0} + wstring[0..255] ∈ [--..--] or UNINITIALIZED + i ∈ [--..--] + j ∈ [--..--] + __retres ∈ {0} + S___fc_stdin[0..1] ∈ [--..--] + S___fc_stdout[0..1] ∈ [--..--] +/* Generated by Frama-C */ +#include "errno.h" +#include "stdarg.h" +#include "stdio.h" +#include "time.h" +#include "wchar.h" +/*@ requires valid_read_wstring(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param1, param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param1, param0; + */ +int wprintf_va_1(wchar_t const *format, int param0, long param1); + +/*@ requires valid_read_wstring(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param1, param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param1, param0; + */ +int wprintf_va_2(wchar_t const *format, int param0, int param1); + +/*@ requires valid_read_wstring(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param4, param3, param2, param1, param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param4, param3, param2, param1, param0; + */ +int wprintf_va_3(wchar_t const *format, int param0, unsigned int param1, + unsigned int param2, unsigned int param3, + unsigned int param4); + +/*@ requires valid_read_wstring(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param2, param1, param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param2, param1, param0; + */ +int wprintf_va_4(wchar_t const *format, double param0, double param1, + double param2); + +/*@ requires valid_read_wstring(format); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param1, param0; + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + param1, param0; + */ +int wprintf_va_5(wchar_t const *format, int param0, int param1); + +/*@ requires valid_read_wstring(format); + requires valid_read_wstring(param0); + assigns \result, __fc_stdout->__fc_FILE_data; + assigns \result + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + *(param0 + (0 ..)); + assigns __fc_stdout->__fc_FILE_data + \from (indirect: __fc_stdout->__fc_FILE_id), + __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), + *(param0 + (0 ..)); + */ +int wprintf_va_6(wchar_t const *format, wchar_t *param0); + +/*@ requires + \valid(ws + (0 .. n - 1)) ∨ + \valid(ws + (0 .. wformat_length(format) - 1)); + requires valid_read_wstring(format); + requires valid_read_string(param0); + assigns \result, *(ws + (0 ..)); + assigns \result + \from (indirect: n), (indirect: *(format + (0 ..))), param1, + *(param0 + (0 ..)); + assigns *(ws + (0 ..)) + \from (indirect: n), (indirect: *(format + (0 ..))), param1, + *(param0 + (0 ..)); + */ +int swprintf_va_1(wchar_t *ws, size_t n, wchar_t const *format, char *param0, + int param1); + +/*@ requires valid_read_wstring(format); + assigns \result, __fc_stdin->__fc_FILE_data, *(param0 + (0 ..)); + assigns \result + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + assigns __fc_stdin->__fc_FILE_data + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + assigns *(param0 + (0 ..)) + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + */ +int wscanf_va_1(wchar_t const *format, wchar_t *param0); + +/*@ requires valid_read_wstring(format); + requires \valid(param1); + requires \valid(param0); + ensures \initialized(param1); + ensures \initialized(param0); + assigns \result, __fc_stdin->__fc_FILE_data, *param1, *param0; + assigns \result + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + assigns __fc_stdin->__fc_FILE_data + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + assigns *param1 + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + assigns *param0 + \from (indirect: __fc_stdin->__fc_FILE_id), __fc_stdin->__fc_FILE_data, + (indirect: *(format + (0 ..))); + */ +int wscanf_va_2(wchar_t const *format, int *param0, int *param1); + +/*@ requires valid_read_wstring(str); + requires valid_read_wstring(format); + requires \valid(param1); + ensures \initialized(param1); + assigns \result, *param1, *(param0 + (0 ..)); + assigns \result + \from (indirect: *(str + (0 ..))), (indirect: *(format + (0 ..))); + assigns *param1 + \from (indirect: *(str + (0 ..))), (indirect: *(format + (0 ..))); + assigns *(param0 + (0 ..)) + \from (indirect: *(str + (0 ..))), (indirect: *(format + (0 ..))); + */ +int swscanf_va_1(wchar_t const *str, wchar_t const *format, wchar_t *param0, + int *param1); + +int main(void) +{ + int __retres; + wchar_t wstring[0x100]; + int i; + int j; + wchar_t input[0x100] = + {102, 111, 114, 116, 121, 45, 116, 119, 111, 32, 105, 115, 0}; + wprintf_va_1((wchar_t const *)L"%" "d" " " "%" "l" "d" "\\n" ,42,42L); + wprintf_va_2((wchar_t const *)L"%" "1" "0" "d" " " "%" "0" "1" "0" "d" + "\\n" ,42,42); + wprintf_va_3((wchar_t const *)L"%" "d" " " "%" "x" " " "%" "o" " " "%" "#" + "x" " " "%" "#" "o" "\\n" ,42,42u,42u,42u,42u); + wprintf_va_4((wchar_t const *)L"%" "2" "." "1" "f" " " "%" "+" "." "0" "e" + " " "%" "E" "\\n" ,42.0,42.0,42.0); + wprintf_va_5((wchar_t const *)L"%" "*" "d" " " "\\n" ,4,2); + wprintf_va_6((wchar_t const *)L"%" "l" "s" " " "\\n" ,(wchar_t *)L"4" "2" ); + swprintf_va_1(wstring,(unsigned int)0x100,(wchar_t const *)L"%" "s" " " "=" + " " "%" "d" ,(char *)L"4" "2" " " "+" " " "4" "2" ,42 + 42); + wscanf_va_1((wchar_t const *)L"%" "l" "s" ,wstring); + wscanf_va_2((wchar_t const *)L"%" "d" " " "%" "d" ,& i,& j); + swscanf_va_1((wchar_t const *)(input),(wchar_t const *)L"%" "l" "s" " " "%" + "*" "s" " " "%" "d" ,wstring,& i); + __retres = 0; + return __retres; +} + + diff --git a/src/plugins/variadic/tests/known/print_libc.c b/src/plugins/variadic/tests/known/print_libc.c new file mode 100644 index 0000000000000000000000000000000000000000..265018f2c74c6d406a2f0b2e28e6866fe3dc03af --- /dev/null +++ b/src/plugins/variadic/tests/known/print_libc.c @@ -0,0 +1,10 @@ +/* run.config + LOG: print_libc.pretty.c + OPT: @PTEST_DIR@/empty.c -no-autoload-plugins -load-module variadic -no-print-libc -print -ocode @PTEST_DIR@/result/@PTEST_NAME@.pretty.c -then @PTEST_DIR@/result/@PTEST_NAME@.pretty.c + */ + +#include <stdio.h> + +int main() { + printf(""); +} diff --git a/src/plugins/variadic/tests/known/printf.c b/src/plugins/variadic/tests/known/printf.c index c8ec8933617f7098f7658949174211b826560522..40fab6d3a0315cb72f91b901d9f25b2776840251 100644 --- a/src/plugins/variadic/tests/known/printf.c +++ b/src/plugins/variadic/tests/known/printf.c @@ -28,6 +28,10 @@ int main() ptrdiff_t t; double f = 42.0f; long double L = 42.0l; + uint64_t u64 = 42ul; + int8_t i8 = 42; + uint_least64_t uleast64 = 42u; + int_fast32_t ifast32 = 42; //wint_t win = '2'; printf("Hello world !\n"); @@ -51,6 +55,11 @@ int main() printf("%jo ", uj); printf("%zx %tX\n", z, t); + printf("%" PRIu64, u64); + printf("%" PRIi8, i8); + printf("%" PRIxLEAST64, uleast64); + printf("%" PRIdFAST32, ifast32); + printf("%f %Le\n", f, L); printf("%c\n", c); @@ -60,5 +69,8 @@ int main() printf("%d %*.*u\n", 1, -(-1), 2, ui); printf("Hello %- 0+#20.10lx %% %s world %d !", ui, string, 42); -} + char hashes[4] = "####"; // no terminator + printf("%.*s", 4, hashes); // ok + printf("%.4s", hashes); // ok +} diff --git a/src/plugins/variadic/tests/known/printf_redefined.c b/src/plugins/variadic/tests/known/printf_redefined.c new file mode 100644 index 0000000000000000000000000000000000000000..2d1c44d386dd7a89f744e840d011d101bded3056 --- /dev/null +++ b/src/plugins/variadic/tests/known/printf_redefined.c @@ -0,0 +1,9 @@ +typedef long unsigned int size_t; + +extern int printf(__const char *__restrict __format, ...); + +void main() { + long x = 0; + printf("%zd\n", x); +} + diff --git a/src/plugins/variadic/tests/known/printf_wrong_types.c b/src/plugins/variadic/tests/known/printf_wrong_types.c index 6708fdffd41f30e57b0b8f977f501f8692a48f0b..da5e7b867feac343975cd0c56c960b19dc377fec 100644 --- a/src/plugins/variadic/tests/known/printf_wrong_types.c +++ b/src/plugins/variadic/tests/known/printf_wrong_types.c @@ -1,5 +1,5 @@ /* run.config -STDOPT: +"-then -no-va -then -va -va-no-strict" +STDOPT: +"-then -variadic-no-translation -then -variadic-translation -variadic-no-strict" */ diff --git a/src/plugins/variadic/tests/known/snprintf.c b/src/plugins/variadic/tests/known/snprintf.c new file mode 100644 index 0000000000000000000000000000000000000000..279df7397b394edeb4d96fff831bbd0fa20fd356 --- /dev/null +++ b/src/plugins/variadic/tests/known/snprintf.c @@ -0,0 +1,17 @@ +#include <string.h> +#include <stdio.h> + +volatile int nondet; + +int main() { + char data[100]; + memset(data, 'A', 99); + data[99] = 0; + char dest[50] = ""; + if (nondet) { + snprintf(dest, strlen(data), "%s", data); // must fail + //@ assert \false; + } + snprintf(dest, strlen(data)/2, "%s", data); // ok + return 0; +} diff --git a/src/plugins/variadic/tests/known/swprintf.c b/src/plugins/variadic/tests/known/swprintf.c new file mode 100644 index 0000000000000000000000000000000000000000..e000a8c8d3d17acd186660cb2a590a903caddc4f --- /dev/null +++ b/src/plugins/variadic/tests/known/swprintf.c @@ -0,0 +1,17 @@ +#include <wchar.h> +#include <stdio.h> + +volatile int nondet; + +int main() { + wchar_t data[100]; + wmemset(data, L'A', 99); + data[99] = L'\0'; + wchar_t dest[50] = L""; + if (nondet) { + swprintf(dest, wcslen(data), L"%ls", data); // must fail + //@ assert \false; + } + swprintf(dest, wcslen(data)/2, L"%ls", data); // ok + return 0; +} diff --git a/src/plugins/variadic/tests/known/wchar.c b/src/plugins/variadic/tests/known/wchar.c new file mode 100644 index 0000000000000000000000000000000000000000..089fa2c8e32a45a47ba61d2418706936d3e53090 --- /dev/null +++ b/src/plugins/variadic/tests/known/wchar.c @@ -0,0 +1,27 @@ +#include <wchar.h> +#include <stdio.h> + +int main() +{ + wchar_t input[0x100] = L"forty-two is"; + wchar_t wstring[0x100]; + int i, j; + + //wprintf (L"%lc %lc\n", L'X', 88); /* requires intmax_t */ + wprintf (L"%d %ld\n", 42, 42L); + wprintf (L"%10d %010d\n", 42, 42); + wprintf (L"%d %x %o %#x %#o\n", 42, 42u, 42u, 42u, 42u); + wprintf (L"%2.1f %+.0e %E\n", 42.0, 42.0, 42.0); + wprintf (L"%*d \n", 4, 2); + wprintf (L"%ls \n", L"42"); + + swprintf (wstring, 0x100, L"%s = %d", L"42" " + " "42", 42 + 42); + + wscanf (L"%ls", wstring); + wscanf (L"%d %d", &i, &j); + + swscanf (input, L"%ls %*s %d", wstring, &i); + + return 0; +} + diff --git a/src/plugins/variadic/tests/test_config b/src/plugins/variadic/tests/test_config index bdad626f2c8048550d8dd56fb9187581d310835d..5d78cab8a18c695c3370acda6aaaa1eb63ca295e 100644 --- a/src/plugins/variadic/tests/test_config +++ b/src/plugins/variadic/tests/test_config @@ -1 +1 @@ -OPT: -no-autoload-plugins -load-module from,inout,value,variadic -check -print -kernel-verbose 0 -va-verbose 2 -val -slevel 10 -value-msg-key=-initial-state -no-val-show-progress -val-print +OPT: -no-autoload-plugins -load-module from,inout,value,variadic,scope -check -print -kernel-verbose 0 -variadic-verbose 2 -val -slevel 10 -value-msg-key=-initial-state -no-val-show-progress -val-print diff --git a/src/plugins/variadic/translate.ml b/src/plugins/variadic/translate.ml index 1851a08a9b1a0334e149294c38edf61a3ccb8050..6089bb9102a90335990bf0f81368fa219d5fa4da 100644 --- a/src/plugins/variadic/translate.ml +++ b/src/plugins/variadic/translate.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -72,6 +72,16 @@ let translate_variadics (file : file) = let v = object (self) inherit Cil.nopCilVisitor + val curr_block = Stack.create () + + method! vblock b = + Stack.push b curr_block; + Cil.DoChildrenPost (fun b -> ignore (Stack.pop curr_block); b) + + method private enclosing_block () = + try Stack.top curr_block + with Stack.Empty -> Options.Self.fatal "No enclosing block here" + method! vtype _typ = Cil.DoChildrenPost (Generic.translate_type) @@ -101,59 +111,117 @@ let translate_variadics (file : file) = Cil.DoChildren end - (* Replace variadic calls *) method! vstmt s = + match s.skind with + | Instr (Call _) -> + (* Separate locals created by a variadic call in their own block. + This can't be done for Local_init(x,ConsInit _,_), as this + instruction must be kept a direct child of the enclosing block, + that determines the scope of x. + *) + let block = Cil.mkBlock [] in + Stack.push block curr_block; + let keep_block_if_needed s = + ignore (Stack.pop curr_block); + match s.skind with + | Block b' -> + (* We have introduced several instructions, and potentially locals. + Scope of locals is in [block], that will replace b'. *) + block.bstmts <- b'.bstmts; + s.skind <- Block block; + s + | _ -> s + in + Cil.DoChildrenPost keep_block_if_needed + | _ -> Cil.DoChildren + + (* Replace variadic calls *) + method! vinst i = let fundec = the self#current_func in - begin match s.skind with - | Instr(Call(_, {enode = Lval(Var vi, _)}, _, _)) -> - begin try - let vf = Table.find classification vi in - let s' = try - let call_translator = match vf.vf_class with - | Overload o -> Standard.overloaded_call ~fundec o - | Aggregator a -> Standard.aggregator_call ~fundec a - | FormatFun f -> Standard.format_fun_call ~fundec env f - | _ -> raise Standard.Translate_call_exn - in - call_translator vf s - with Standard.Translate_call_exn -> - Generic.translate_call ~fundec s - in + let loc = Cil_datatype.Instr.loc i in + let block = self#enclosing_block () in + let make_new_args mk_call f args = + let vf = Table.find classification f in + try + let call_translator = match vf.vf_class with + | Overload o -> Standard.overloaded_call ~fundec o + | Aggregator a -> Standard.aggregator_call ~fundec a + | FormatFun f -> Standard.format_fun_call ~fundec env f + | _ -> raise Standard.Translate_call_exn + in + call_translator block loc mk_call vf args + with Standard.Translate_call_exn -> + Generic.translate_call + ~fundec block loc mk_call (Cil.evar ~loc f) args + in + begin match i with + | Call(_, {enode = Lval(Var vi, _)}, _, _) + when List.mem vi.vname va_builtins -> + File.must_recompute_cfg fundec; + Cil.ChangeTo (Generic.translate_va_builtin fundec i) + | Call(lv, {enode = Lval(Var vi, NoOffset)}, args, loc) -> + begin + try + let mk_call f args = Call (lv, f, args, loc) in + let res = make_new_args mk_call vi args in File.must_recompute_cfg fundec; - Cil.ChangeTo (s') + Cil.ChangeTo res with Not_found -> Cil.DoChildren - end - - | Instr(Call(_, callee, _, _)) -> - let is_variadic = - try - let last = Extends.List.last (Typ.params (Cil.typeOf callee)) in - last = Generic.vpar - with Extends.List.EmptyList -> false + end + + | Call(lv, callee, args, loc) -> + let is_variadic = + try + let last = Extends.List.last (Typ.params (Cil.typeOf callee)) in + last = Generic.vpar + with Extends.List.EmptyList -> false + in + if is_variadic then begin + let mk_call f args = Call (lv, f, args, loc) in + let res = + Generic.translate_call ~fundec block loc mk_call callee args in - if is_variadic then begin - let s' = Generic.translate_call fundec s in + File.must_recompute_cfg fundec; + Cil.ChangeTo res + end else + Cil.DoChildren + | Local_init(v, ConsInit(c, args, kind), loc) -> + begin + try + let mk_call f args = + let args = + match kind, args with + | Constructor, [] -> + Options.Self.fatal + "Constructor %a is expected to have at least one argument" + Cil_printer.pp_varinfo c + | Constructor, _::tl -> tl + | Plain_func, args -> args + in + let f = + match f.enode with + | Lval (Var f, NoOffset) -> f + | _ -> + Options.Self.fatal + "Constructor cannot be translated as indirect call" + in + Local_init(v,ConsInit(f,args,kind),loc) + in + let args = + match kind with + | Plain_func -> args + | Constructor -> Cil.mkAddrOfVi v :: args + in + let res = make_new_args mk_call c args in File.must_recompute_cfg fundec; - Cil.ChangeTo (s') - end else + Cil.ChangeTo res + with Not_found -> Cil.DoChildren - + end | _-> Cil.DoChildren end - (* Replace va__* builtins *) - method! vinst inst = - let fundec = the self#current_func in - begin match inst with - | Call(_, {enode = Lval(Var vi, _)}, _, _) - when List.mem vi.vname va_builtins -> - File.must_recompute_cfg fundec; - Cil.ChangeTo (Generic.translate_va_builtin fundec inst) - | _ -> - Cil.DoChildren - end - method! vexpr exp = begin match exp.enode with | AddrOf (Var vi, NoOffset) diff --git a/src/plugins/variadic/va_build.ml b/src/plugins/variadic/va_build.ml index 779882b2edc7948b042778e75cebfe3ab65e3c6c..868f3e8e0c7d0141f30c8546f39bdfd16208a105 100644 --- a/src/plugins/variadic/va_build.ml +++ b/src/plugins/variadic/va_build.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -26,9 +26,10 @@ open Cil (* --- Cil builders --- *) -let function_declaration ~loc name typ mk_spec = +let function_declaration ?vattr ~loc name typ mk_spec = (* Build the varinfo *) - let vi = makeGlobalVar (Cabs2cil.fresh_global name) typ in + let vi = makeGlobalVar name typ in + Extlib.may (fun extra_vattr -> vi.vattr <- vi.vattr @ extra_vattr) vattr; vi.vdecl <- loc; (* Build the formals *) setFormalsDecl vi typ; @@ -38,23 +39,23 @@ let function_declaration ~loc name typ mk_spec = let glob = GFunDecl (spec, vi, vi.vdecl) in vi, glob -let vi_assign ~loc vi exp = - let instr = Set((Var vi, NoOffset), exp, loc) in - Cil.mkStmtOneInstr ~valid_sid:true instr - -let array_assign ~loc vi values = - let assign_cell i exp = - let instr = Set((Var vi, Index (Cil.integer ~loc i, NoOffset)), exp, loc) - in Cil.mkStmtOneInstr ~valid_sid:true instr - in - List.mapi assign_cell values +let vi_init ~loc vi exp = Local_init(vi, AssignInit (SingleInit exp), loc) let array_init ~loc fundec scope name elem_typ values = let size = max (List.length values) 1 in (* In C, Array size >= 1 *) let esize = Cil.integer ~loc size in let typ = TArray (elem_typ, Some esize, Cil.empty_size_cache (), []) in let vi = Cil.makeLocalVar fundec ~scope name typ in - vi, array_assign loc vi values + let initl = + match values with + | [] -> [ Index (Cil.zero ~loc, NoOffset), Cil.makeZeroInit ~loc elem_typ] + | _ -> + List.mapi + (fun i exp -> Index (Cil.integer ~loc i, NoOffset), SingleInit exp) + values + in + vi.vdefined <- true; + vi, Local_init(vi, AssignInit(CompoundInit(typ,initl)), loc) let call ~loc lval callee args = let instr = Call (lval, (Cil.evar ~loc callee), args, loc) in @@ -63,29 +64,49 @@ let call ~loc lval callee args = (* --- Logic builders --- *) -let logic_elval ~loc lval = - Logic_const.term ~loc (TLval lval) (typeOfTermLval lval) - -let logic_var vi = +let lvar vi = TVar (Cil.cvar_to_lvar vi), TNoOffset -let logic_evar ~loc vi = - logic_elval ~loc (TVar (Cil.cvar_to_lvar vi), TNoOffset) +let tlval ~loc lval = + Logic_const.term ~loc (TLval lval) (typeOfTermLval lval) -let logic_varmem ~loc vi = - TMem (logic_evar ~loc vi), TNoOffset +let tvar ~loc vi = + tlval ~loc (lvar vi) -let logic_varfield ~loc vi fieldinfo = - TMem (logic_evar ~loc vi), TField (fieldinfo, TNoOffset) +let tvarmem ~loc vi = + TMem (tvar ~loc vi), TNoOffset -let logic_varrange ~loc vi = - let tstart = Some (Logic_const.tint ~loc Integer.zero) - and tend = None in - let range = Logic_const.trange ~loc (tstart, tend) in -(* TVar (Cil.cvar_to_lvar vi), TIndex (range, TNoOffset) *) - let binop = Logic_const.term ~loc - (TBinOp (IndexPI, logic_evar ~loc vi, range)) (Ctype vi.vtype) in - TMem binop, TNoOffset +let tvarfield ~loc vi fieldinfo = + TMem (tvar ~loc vi), TField (fieldinfo, TNoOffset) -let logic_return typ = +let tresult typ = TResult typ, TNoOffset + +let tzero ~loc = Cil.lzero ~loc () +let tone ~loc = Cil.lone ~loc () + +let tbinop ~loc binop t1 t2 = + Logic_const.term ~loc (TBinOp (binop, t1, t2)) t1.term_type + +let tminus ~loc t1 t2 = + tbinop ~loc MinusA t1 t2 + +let tplus ~loc t1 t2 = + tbinop ~loc PlusA t1 t2 + +let trange ~loc tstart tend = + Logic_const.trange ~loc (tstart, tend) + +let trange_from_vi ~loc vi = + let var = tvar ~loc vi + and range = trange ~loc (Some (tzero ~loc)) None in + TMem (tbinop IndexPI ~loc var range), TNoOffset + +exception NotAFunction + +let tapp ~loc logic_info labels args = + let ltyp = match logic_info.l_type with + | None -> raise NotAFunction + | Some ltyp -> ltyp + in + Logic_const.term ~loc (Tapp (logic_info, labels, args)) ltyp diff --git a/src/plugins/variadic/va_types.mli b/src/plugins/variadic/va_types.mli index d34cf6355924d706089cbe7f327c35b7fc714d45..1914eabbab9a03eadb57167e40ae3009ebb1d996 100644 --- a/src/plugins/variadic/va_types.mli +++ b/src/plugins/variadic/va_types.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) @@ -55,13 +55,12 @@ and aggregator_type = EndedByNull and format_fun = { f_kind : Format_types.format_kind; f_buffer : buffer; - f_additional_args : int list; f_format_pos : int; -} +} and buffer = | StdIO (** Standard input/output (stdin/stdout/stderr) *) -| Arg of int (* Position of the buffer argument *) +| Arg of int * int option (* Position of the buffer and size arguments *) | Stream of int (* Position of the stream argument *) | File of int (* Position of the file argument *) | Syslog (* Output to some system log *) @@ -71,4 +70,7 @@ type variadic_function = { vf_decl: varinfo; vf_original_type: typ; vf_class: variadic_class; + mutable vf_specialization_count: int; (* The number of specializations of + this function built yet *) } + diff --git a/src/plugins/wp/.gitignore b/src/plugins/wp/.gitignore index 72ced72a16b93f8ab1fb95ed99ddfd9fb2780541..64d57997994ffaf2997d64019fcdec171b845ef8 100644 --- a/src/plugins/wp/.gitignore +++ b/src/plugins/wp/.gitignore @@ -13,7 +13,8 @@ /tests/ptests_config /tests/*/result /tests/*/result_* -/tests/wp_usage/save_load.sav +/tests/*/*.sav +/tests/*/*.out /doc/*/.make-class /doc/*/.make-icons diff --git a/src/plugins/wp/Auto.ml b/src/plugins/wp/Auto.ml index 329d35db3d954e852b8d1e485566855480155e15..3f3f0d419d3c5cb633a00ff1c7342d375f7a3106 100644 --- a/src/plugins/wp/Auto.ml +++ b/src/plugins/wp/Auto.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -190,7 +190,7 @@ class autorange = let ranged = Range.ranges (Range.compute hyps) in Tmap.iter (fun e (a,b) -> - if Strategy.occurs_p e goal then + if Strategy.occurs_p e goal && b-a <= 1024 then let selection = Tactical.(Inside(Goal goal,e)) in push (range selection ~vmin:a ~vmax:b) ) ranged diff --git a/src/plugins/wp/Auto.mli b/src/plugins/wp/Auto.mli index 890bf87058d480019e29c8416e68e294a7fbb1e0..a225c27b91637f577d874380d96ce658b5517b01 100644 --- a/src/plugins/wp/Auto.mli +++ b/src/plugins/wp/Auto.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Cfloat.ml b/src/plugins/wp/Cfloat.ml index fec83a32018fdff193264aa579d4d0ba8e9100a0..8ed274212466ee0024f9c9f234df70a0a8b8b39a 100644 --- a/src/plugins/wp/Cfloat.ml +++ b/src/plugins/wp/Cfloat.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -46,7 +46,7 @@ let make_pred_float name f = extern_f ~library ~result:Logic.Prop ~params "%s_%a" name Ctypes.pp_float f let f_int = - extern_f ~library:"qed" ~result "real_of_int" + extern_f ~library:"qed" ~result ~params:[Logic.Sint] "real_of_int" let f_sqrt = extern_f ~library:"cmath" ~result ~params ~link:(link "sqrt") "\\sqrt" @@ -144,17 +144,17 @@ let is_eq0 z b = QED.eval_eq b z let builtin_positive_eq lfun z a b = let open Qed.Logic in begin match F.repr a , F.repr b with - | Fun(f,[_]) , _ when f = lfun && is_lt0 z b -> e_false - | Fun(f,[a]) , _ when f = lfun && is_eq0 z b -> e_eq a b + | Fun(f,[_]) , _ when f == lfun && is_lt0 z b -> e_false + | Fun(f,[a]) , _ when f == lfun && is_eq0 z b -> e_eq a b | _ -> raise Not_found end let builtin_positive_leq lfun z a b = let open Qed.Logic in begin match F.repr a , F.repr b with - | Fun(f,[_]) , _ when f = lfun && is_lt0 z b -> e_false - | Fun(f,[a]) , _ when f = lfun && is_eq0 z b -> e_eq a b - | _ , Fun(f,[_]) when f = lfun && is_le0 z a -> e_true + | Fun(f,[_]) , _ when f == lfun && is_lt0 z b -> e_false + | Fun(f,[a]) , _ when f == lfun && is_eq0 z b -> e_eq a b + | _ , Fun(f,[_]) when f == lfun && is_le0 z a -> e_true | _ -> raise Not_found end @@ -227,6 +227,15 @@ let () = add_builtin "\\epsilon" [F Float64] f_epsilon ; end +(* -------------------------------------------------------------------------- *) +(* --- Floating Point Predicate --- *) +(* -------------------------------------------------------------------------- *) + +let fle _ = F.p_leq +let flt _ = F.p_lt +let feq _ = F.p_equal +let fneq _ = F.p_neq + (* -------------------------------------------------------------------------- *) (* --- Precision --- *) (* -------------------------------------------------------------------------- *) @@ -250,9 +259,9 @@ let builtin_model = function | [e] -> let open Qed.Logic in begin match F.repr e with - | Fun(f,_) when f = f_model -> e - | Fun(f,_) when f = f_delta -> e_zero_real - | Fun(f,_) when f = f_epsilon -> e_zero_real + | Fun(f,_) when f == f_model -> e + | Fun(f,_) when f == f_delta -> e_zero_real + | Fun(f,_) when f == f_epsilon -> e_zero_real | Fun(op,xs) -> let phi = OP.find op in (* find phi before computing arguments *) @@ -269,7 +278,7 @@ let builtin_round f = function | Div(x,y) -> e_fun (flt_div f) [x;y] | Add ([_;_] as xs) -> e_fun (flt_add f) xs | Mul ([_;_] as xs) -> e_fun (flt_mul f) xs - | Fun(s,([_] as xs)) when s = f_sqrt -> e_fun (flt_sqrt f) xs + | Fun(s,([_] as xs)) when s == f_sqrt -> e_fun (flt_sqrt f) xs | Kreal r -> begin match R.to_string r with | "0.0" | "1.0" | "-1.0" -> e @@ -283,7 +292,7 @@ let builtin_error = function | [e] -> let open Qed.Logic in begin match F.repr e with - | Fun(f,_) when f = f_model -> e_zero_real + | Fun(f,_) when f == f_model -> e_zero_real | _ -> raise Not_found end | _ -> raise Not_found @@ -292,14 +301,14 @@ let builtin_error = function (* --- Conversion Symbols --- *) (* -------------------------------------------------------------------------- *) -let convert = - fun f a -> +let float_of_real f a = match Context.get model with | Real -> a | Float -> e_fun (flt_rnd f) [a] let real_of_int a = e_fun f_int [a] -let float_of_int f a = convert f (real_of_int a) +let float_of_int f a = float_of_real f (real_of_int a) +let real_of_float _f a = a let range = let is_float = Ctypes.f_memo (make_pred_float "is") in diff --git a/src/plugins/wp/Cfloat.mli b/src/plugins/wp/Cfloat.mli index fa12c25015d288b322fd0c762788ab199d84b57d..f40f6bf2b592c842db0e9a8ad02dc78310481d9e 100644 --- a/src/plugins/wp/Cfloat.mli +++ b/src/plugins/wp/Cfloat.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -36,7 +36,8 @@ val acsl_lit : Cil_types.logic_real -> term val real_of_int : unop val float_of_int : c_float -> unop -val convert : c_float -> unop +val float_of_real : c_float -> unop +val real_of_float : c_float -> unop val range : c_float -> term -> pred val fopp : c_float -> unop @@ -45,6 +46,11 @@ val fsub : c_float -> binop val fmul : c_float -> binop val fdiv : c_float -> binop +val flt : c_float -> cmp +val fle : c_float -> cmp +val feq : c_float -> cmp +val fneq : c_float -> cmp + val f_iabs : lfun val f_rabs : lfun val f_sqrt : lfun diff --git a/src/plugins/wp/Changelog b/src/plugins/wp/Changelog index d063b30c6ee6e1069a0a1b29ad5e04239c8e414a..8209948ccb64652eed51918da807a69081b52098 100644 --- a/src/plugins/wp/Changelog +++ b/src/plugins/wp/Changelog @@ -20,6 +20,26 @@ # <Prover>: prover ############################################################################### + - TIP [2017/04/25] Options -wp-time-{extra|margin} for more stability + -* Gui [2017/04/25] Fixed bug when running prover from the TIP + - Wp [2017/04/25] Improved model and simplifications of logical shifts + - Wp [2017/04/25] New simplification logic functions (-wp-reduce) + - Wp [2017/04/25] New simplification of unused variables (-wp-parasite) + - Wp [2017/04/25] New simplification for ground terms (-wp-ground) + - Wp [2017/04/25] Option -wp-prenex to normalize nested binders + - Wp [2017/04/25] Option -wp-overflows to add explicit assumptions + - TIP [2017/04/25] New tactical Overflow (to cope with modulus) + - TIP [2017/04/25] New tactical Ratio (divisions and products) + - TIP [2017/04/25] New tactical Bitwised, BitRange and Shift + - TIP [2017/04/25] New tactical Rewrite (two apply equalities) + - Wp [2017/03/12] Reduction of equalities with logic functions + - Wp [2017/03/12] More simplifications wrt integer domains + +################################### +Plugin WP / Frama-C 15 - Phosphorus +################################### + + -! Wp [2017/03/24] Remove support for generalized invariants (-wp-invariants) -o Ergo [2017/01/12] Update qualif tests to Alt-Ergo 1.30 - Qed [2016/12/09] Add E_fun constructor for neutral and absorbent - Wp [2016/12/07] Trivial simplification for truncate @@ -38,9 +58,37 @@ - WP [2016/05/26] Simplification of ACSL sequences - Qed [2016/05/17] Mutualized type inference in Term - Qed [2016/04/12] Improved simplifiers + - WP [2017/05/15] Extract inductive predicates as Inductive in Coq + -! Wp [2017/03/24] Remove support for generalized invariants (-wp-invariants) +############################# +Plugin WP Phosphorus-20170501 +############################# + +-! WP [2017/03/24] Remove support for generalized invariants (-wp-invariants) +-o Ergo [2017/01/12] Update qualif tests to Alt-Ergo 1.30 +- Qed [2016/12/09] Add E_fun constructor for neutral and absorbent +- WP [2016/12/07] Trivial simplification for truncate +- WP [2016/12/07] Fix bug on negative 0x float constants +- WP [2016/11/04] Improved comparison of logic compounds +- WP [2016/11/04] Improved filtering (prevents loss of init clauses) +- WP [2016/10/26] Generated HTML API (make wp-doc-api) +- WP [2016/10/26] Extensible Proof Engine +-! WP [2016/10/11] Deprecated Dynamic API +- WP [2016/09/20] Improved sequent simplifier +- Qed [2016/09/02] Negation of forall/exists qualitifers +- GUI [2016/08/26] Pretty-print of memory side effects +- WP [2016/08/23] Fixed bug #2246 (unsound switch) +- GUI [2016/07/23] Interactive Proof Engine +- WP [2016/07/21] Improved Sequent API (Conditions) +- WP [2016/05/26] Simplification of ACSL sequences +- Qed [2016/05/17] Mutualized type inference in Term +- Qed [2016/04/12] Improved simplifiers + - WP [2016/11/17] Warn against access to volatile l-values + - WP [2016/11/17] Fix volatile access (see -wp-no-volatile) ################################ Plugin WP 1.1 Silicon_20161101 +Plugin WP Silicon_20161101 ################################ - WP [2016/04/08] Unified variable usage for all models diff --git a/src/plugins/wp/Cint.ml b/src/plugins/wp/Cint.ml index 2d4c02df7fde586797b313e3eba3de72822cb50d..150d9a7314109b8d4001b53e776b79bd80ea6fe4 100644 --- a/src/plugins/wp/Cint.ml +++ b/src/plugins/wp/Cint.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -274,9 +274,9 @@ let simplify_f_to_land f iota e es' = let simplify_f_to_bounds iota e = (* min(ctypes)<=y<=max(ctypes) ==> to_ctypes(y)=y *) - let bounds = Ctypes.c_int_bounds iota in - if (F.decide (F.e_leq e (e_zint (snd bounds)))) && - (F.decide (F.e_leq (e_zint (fst bounds)) e)) + let lower,upper = Ctypes.bounds iota in + if (F.decide (F.e_leq e (e_zint upper))) && + (F.decide (F.e_leq (e_zint lower) e)) then e else raise Not_found @@ -317,11 +317,11 @@ let configure_to_int iota = F.set_builtin f simplify ; let simplify_leq x y = - let bounds = Ctypes.c_int_bounds iota in + let lower,upper = Ctypes.bounds iota in match F.repr y with | Logic.Fun( conv , [_] ) when (Fun.equal conv f) && - (F.decide (F.e_leq x (e_zint (fst bounds)))) -> + (F.decide (F.e_leq x (e_zint lower))) -> (* x<=min(ctypes) ==> x<=to_ctypes(y) *) e_true | _ -> @@ -329,7 +329,7 @@ let configure_to_int iota = match F.repr x with | Logic.Fun( conv , [_] ) when (Fun.equal conv f) && - (F.decide (F.e_leq (e_zint (snd bounds)) y)) -> + (F.decide (F.e_leq (e_zint upper) y)) -> (* max(ctypes)<=y ==> to_ctypes(y)<=y *) e_true | _ -> raise Not_found @@ -340,7 +340,7 @@ let configure_to_int iota = let simplify_p_is_bounds iota e = - let bounds = Ctypes.c_int_bounds iota in + let bounds = Ctypes.bounds iota in (* min(ctypes)<=y<=max(ctypes) <==> is_ctypes(y) *) match F.is_true (F.e_and [F.e_leq (e_zint (fst bounds)) e; @@ -359,8 +359,8 @@ let configure_is_int iota = begin match F.repr e with | Logic.Kint k -> - let vmin,vmax = Ctypes.c_int_bounds iota in - F.e_bool (Z.leq vmin k && Z.lt k vmax) + let vmin,vmax = Ctypes.bounds iota in + F.e_bool (Z.leq vmin k && Z.leq k vmax) | Logic.Fun( flor , es ) when (Fun.equal flor f_lor) && not (Ctypes.signed iota) -> (* is_uintN(a|b) == is_uintN(a) && is_uintN(b) *) @@ -385,7 +385,6 @@ let truncate e = let () = Context.register (fun () -> F.set_builtin_1 f_truncate truncate) let convert i a = e_fun (f_to_int i) [a] -let convert_unsigned i x = if Ctypes.signed i then x else convert i x (* -------------------------------------------------------------------------- *) @@ -406,6 +405,10 @@ let configure = Context.set model let of_real i a = convert i (e_fun f_truncate [a]) +let integer_of_real a = e_fun f_truncate [a] +let to_integer a = a +let of_integer i a = convert i a + let range i a = match Context.get model with | Natural -> @@ -414,11 +417,27 @@ let range i a = else F.p_leq F.e_zero a | Machine -> p_call (p_is_int i) [a] -let downcast i a = - if is_downcast_an_error i then a else e_fun (f_to_int i) [a] - -let overflow i a = - if is_overflow_an_error i then a else e_fun (f_to_int i) [a] +let check_rte () = + if Wp_parameters.RTE.get () || + Dynamic.Parameter.Bool.get "-rte" () + then + (Wp_parameters.warning ~once:true + "Option -wp-overflows incompatiable with RTE (ignored)" ; + false) + else true + +let ensures error i a = + if error i + then + (if Wp_parameters.Overflows.get () && Lang.has_gamma () && + check_rte () + then + Lang.assume (range i a) ; + a) + else e_fun (f_to_int i) [a] + +let downcast = ensures is_downcast_an_error +let overflow = ensures is_overflow_an_error (* -------------------------------------------------------------------------- *) (* --- Arithmetics --- *) @@ -697,20 +716,26 @@ let l_lsl a b = e_fun f_lsl [a;b] let l_lsr a b = e_fun f_lsr [a;b] (* C Code Semantics *) + (* we need a (forced) conversion to properly encode the semantics of C in terms of the semantics in Z(ACSL). Typically, lnot(128) becomes (-129), which must be converted to obtain an unsigned. *) -let bnot i x = convert_unsigned i (l_not x) -let bxor i x y = convert_unsigned i (l_xor x y) + +let mask_unsigned i m = + if Ctypes.signed i then m else convert i m + +let bnot i x = mask_unsigned i (l_not x) +let bxor i x y = mask_unsigned i (l_xor x y) + let bor _i = l_or (* no needs of range conversion *) let band _i = l_and (* no needs of range conversion *) -let blsl i x y = convert i (l_lsl x y) (* for bit extension *) -let blsr _i = l_lsr (* no needs of range conversion *) +let blsl i x y = overflow i (l_lsl x y) (* mult. by 2^y *) +let blsr _i = l_lsr (* div. by 2^y, never overflow *) (** Simplifiers *) let c_int_bounds_ival f = - let (umin,umax) = Ctypes.c_int_bounds f in + let (umin,umax) = Ctypes.bounds f in Ival.inject_range (Some umin) (Some umax) let max_reduce_quantifiers = 1000 @@ -860,4 +885,89 @@ let is_cint_simplifier = object (self) end +let mask_simplifier = + object(self) + + (** Must be 2^n-1 *) + val mutable magnitude : Integer.t Tmap.t = Tmap.empty + + method name = "Rewrite unsigned masks" + method copy = {< magnitude = magnitude >} + + method private update x m = + let better = + try Integer.lt m (Tmap.find x magnitude) + with Not_found -> true in + if better then magnitude <- Tmap.add x m magnitude + + method private collect d x = + try + let m = Tmap.find x magnitude in + match d with + | None -> Some m + | Some m0 -> if Integer.lt m m0 then Some m else d + with Not_found -> d + + method private reduce m x = + match F.repr x with + | Kint v -> F.e_zint (Integer.logand m v) + | _ -> x + + method private rewrite e = + match F.repr e with + | Fun(f,es) when f == f_land -> + begin + match List.fold_left self#collect None es with + | None -> raise Not_found + | Some m -> F.e_fun f_land (List.map (self#reduce m) es) + end + | _ -> raise Not_found + + method target _ = () + method infer = [] + method fixpoint = () + + method assume p = + let rec walk e = match F.repr e with + | And es -> List.iter walk es + | Fun(f,[x]) -> + begin + try + let iota = is_cint f in + if not (Ctypes.signed iota) then + self#update x (snd (Ctypes.bounds iota)) + with Not_found -> () + end + | _ -> () + in walk (F.e_prop p) + + method simplify_exp e = + if Tmap.is_empty magnitude then e else + F.e_subst self#rewrite e + + method simplify_hyp p = + if Tmap.is_empty magnitude then p else + F.p_subst self#rewrite p + + method simplify_branch p = + if Tmap.is_empty magnitude then p else + F.p_subst self#rewrite p + + method simplify_goal p = + if Tmap.is_empty magnitude then p else + F.p_subst self#rewrite p + + end + + + + + + + + + + + + (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/wp/Cint.mli b/src/plugins/wp/Cint.mli index 90a50a2466fd891dd6091717eb6c533efe9a4e5c..516d62617465ac2117b68d1af58027cf4cb829f0 100644 --- a/src/plugins/wp/Cint.mli +++ b/src/plugins/wp/Cint.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -30,6 +30,9 @@ open Lang.F val of_real : c_int -> unop val convert : c_int -> unop (** Independent from model *) +val integer_of_real : unop +val to_integer : unop +val of_integer : c_int -> unop val to_cint : lfun -> c_int (** Raises [Not_found] if not. *) val is_cint : lfun -> c_int (** Raises [Not_found] if not. *) @@ -76,4 +79,6 @@ val is_cint_simplifier: Conditions.simplifier (** Remove the [is_cint] in formulas that are redundant with other conditions. *) +val mask_simplifier: Conditions.simplifier + val is_positive_or_null: term -> bool diff --git a/src/plugins/wp/Cleaning.ml b/src/plugins/wp/Cleaning.ml index 2627fa4a0d0454a6123c4c4cc9e9bb2547699c0c..ee93c81ad72a6c9d4356d408d1b24cf18b306cdd 100644 --- a/src/plugins/wp/Cleaning.ml +++ b/src/plugins/wp/Cleaning.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Cleaning.mli b/src/plugins/wp/Cleaning.mli index bc85f3e2a6e16098b8e23197fd3361a0f7e52c0c..4af90c1ace5b9b5d72f3d96522480408aaf4ace2 100644 --- a/src/plugins/wp/Cleaning.mli +++ b/src/plugins/wp/Cleaning.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/CodeSemantics.ml b/src/plugins/wp/CodeSemantics.ml index ef3e73620caca5b07d0fda46cd3beece4cc49f2d..af18911bcb26bdf3df58302a83be8310eb7f30af 100644 --- a/src/plugins/wp/CodeSemantics.ml +++ b/src/plugins/wp/CodeSemantics.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -75,7 +75,8 @@ struct c.cfields | C_array a -> (*TODO[LC] make zero-initializers model-dependent. - For instance, a[N][M] becomes a[N*M] in MemTyped, but not in MemVar *) + For instance, a[N][M] becomes a[N*M] in MemTyped, + but not in MemVar *) let x = Lang.freshvar ~basename:"k" Logic.Int in let k = e_var x in let obj = Ctypes.object_of a.arr_element in @@ -223,10 +224,10 @@ struct | C_float fr , C_float fe -> let v = cval ve in - Val( if Ctypes.sub_c_float fe fr then v else Cfloat.convert fr v ) + Val( if Ctypes.equal_float fe fr then v else Cfloat.float_of_real fr (Cfloat.real_of_float fe v) ) - | C_int ir , C_float _ -> Val(Cint.of_real ir (cval ve)) - | C_float fr , C_int _ -> Val(Cfloat.float_of_int fr (cval ve)) + | C_int ir , C_float fr -> Val(Cint.of_real ir (Cfloat.real_of_float fr (cval ve))) + | C_float fr , C_int _ -> Val(Cfloat.float_of_real fr (Cfloat.real_of_int (cval ve))) | C_pointer tr , C_pointer te -> let obj_r = Ctypes.object_of tr in @@ -249,6 +250,15 @@ struct Warning.error "cast (%a) into (%a) not yet implemented" Printer.pp_typ te Printer.pp_typ tr + (* -------------------------------------------------------------------------- *) + (* --- Undefined Exp --- *) + (* -------------------------------------------------------------------------- *) + + let exp_undefined e = + let ty = Cil.typeOf e in + let x = Lang.freshvar ~basename:"w" (Lang.tau_of_ctype ty) in + Val (e_var x) + (* -------------------------------------------------------------------------- *) (* --- Exp-Node --- *) (* -------------------------------------------------------------------------- *) @@ -261,12 +271,16 @@ struct | Const c -> Val (Cvalues.constant c) | Lval lv -> - let loc = lval env lv in - let typ = Cil.typeOfLval lv in - let obj = Ctypes.object_of typ in - let data = M.load env obj loc in - Lang.assume (Cvalues.is_object obj data) ; - data + if Cil.isVolatileLval lv && + Cvalues.volatile ~warn:"unsafe read-access to volatile l-value" () + then exp_undefined e + else + let loc = lval env lv in + let typ = Cil.typeOfLval lv in + let obj = Ctypes.object_of typ in + let data = M.load env obj loc in + Lang.assume (Cvalues.is_object obj data) ; + data | AddrOf lv | StartOf lv -> Loc (lval env lv) @@ -290,14 +304,9 @@ struct (* --- Exp with Error --- *) (* -------------------------------------------------------------------------- *) - let exp_handler e = - let ty = Cil.typeOf e in - let x = Lang.freshvar ~basename:"w" (Lang.tau_of_ctype ty) in - Val (e_var x) - let exp_protected env e = Warning.handle - ~handler:exp_handler + ~handler:exp_undefined ~severe:false ~effect:"Hide sub-term definition" (exp_node env) e @@ -324,13 +333,16 @@ struct then M.loc_eq (cloc v1) (cloc v2) else p_equal (cval v1) (cval v2) - let compare env vop lop e1 e2 = - let t1 = Cil.typeOf e1 in - let t2 = Cil.typeOf e2 in - if Cil.isPointerType t1 && Cil.isPointerType t2 then - lop (loc_of_exp env e1) (loc_of_exp env e2) - else - vop (val_of_exp env e1) (val_of_exp env e2) + let compare env vop lop fop e1 e2 = + let t1 = Ctypes.object_of (Cil.typeOf e1) in + let t2 = Ctypes.object_of (Cil.typeOf e2) in + if not (Ctypes.equal t1 t2) then + Warning.error "Comparison with different types (%a) and (%a)" + Ctypes.pretty t1 Ctypes.pretty t2 ; + match t1 with + | C_pointer _ -> lop (loc_of_exp env e1) (loc_of_exp env e2) + | C_float f -> (fop f) (val_of_exp env e1) (val_of_exp env e2) + | _ -> vop (val_of_exp env e1) (val_of_exp env e2) let cond_node env e = match e.enode with @@ -338,12 +350,12 @@ struct | UnOp( LNot, e,_) -> p_not (!s_cond env e) | BinOp( LAnd, e1,e2,_) -> p_and (!s_cond env e1) (!s_cond env e2) | BinOp( LOr, e1,e2,_) -> p_or (!s_cond env e1) (!s_cond env e2) - | BinOp( Eq, e1,e2,_) -> compare env p_equal M.loc_eq e1 e2 - | BinOp( Ne, e1,e2,_) -> compare env p_neq M.loc_neq e1 e2 - | BinOp( Lt, e1,e2,_) -> compare env p_lt M.loc_lt e1 e2 - | BinOp( Gt, e1,e2,_) -> compare env p_lt M.loc_lt e2 e1 - | BinOp( Le, e1,e2,_) -> compare env p_leq M.loc_leq e1 e2 - | BinOp( Ge, e1,e2,_) -> compare env p_leq M.loc_leq e2 e1 + | BinOp( Eq, e1,e2,_) -> compare env p_equal M.loc_eq Cfloat.feq e1 e2 + | BinOp( Ne, e1,e2,_) -> compare env p_neq M.loc_neq Cfloat.fneq e1 e2 + | BinOp( Lt, e1,e2,_) -> compare env p_lt M.loc_lt Cfloat.flt e1 e2 + | BinOp( Gt, e1,e2,_) -> compare env p_lt M.loc_lt Cfloat.flt e2 e1 + | BinOp( Le, e1,e2,_) -> compare env p_leq M.loc_leq Cfloat.fle e1 e2 + | BinOp( Ge, e1,e2,_) -> compare env p_leq M.loc_leq Cfloat.fle e2 e1 | _ -> begin diff --git a/src/plugins/wp/CodeSemantics.mli b/src/plugins/wp/CodeSemantics.mli index a5978a4b19030d3983d114bd960f123248068a49..88ce586375f40e19ccc0012e8703d1c2bc7046df 100644 --- a/src/plugins/wp/CodeSemantics.mli +++ b/src/plugins/wp/CodeSemantics.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Conditions.ml b/src/plugins/wp/Conditions.ml index f10250adbf60c048b0f2c9d945244a631d83808a..4005c8883df9d1cb485b390a7fc28f7fe46188f9 100644 --- a/src/plugins/wp/Conditions.ml +++ b/src/plugins/wp/Conditions.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -29,6 +29,8 @@ open Cil_types open Lang open Lang.F +let dkey_pruning = Wp_parameters.register_category "pruning" + (* -------------------------------------------------------------------------- *) (* --- Category --- *) (* -------------------------------------------------------------------------- *) @@ -168,6 +170,41 @@ let sequence l = { seq_list = l ; } +(* -------------------------------------------------------------------------- *) +(* --- Sequence Comparator --- *) +(* -------------------------------------------------------------------------- *) + +let rec equal_cond ca cb = + match ca,cb with + | State _ , State _ -> true + | Type p , Type q + | Have p , Have q + | When p , When q + | Core p , Core q + | Init p , Init q + -> p == q + | Branch(p,a,b) , Branch(q,a',b') -> + p == q && equal_seq a a' && equal_seq b b' + | Either u, Either v -> + Qed.Hcons.equal_list equal_seq u v + | State _ , _ | _ , State _ + | Type _ , _ | _ , Type _ + | Have _ , _ | _ , Have _ + | When _ , _ | _ , When _ + | Core _ , _ | _ , Core _ + | Init _ , _ | _ , Init _ + | Branch _ , _ | _ , Branch _ + -> false + +and equal_step a b = + equal_cond a.condition b.condition + +and equal_list sa sb = + Qed.Hcons.equal_list equal_step sa sb + +and equal_seq sa sb = + equal_list sa.seq_list sb.seq_list + (* -------------------------------------------------------------------------- *) (* --- Core Inference --- *) (* -------------------------------------------------------------------------- *) @@ -277,14 +314,21 @@ end type bundle = Bundle.t type sequent = sequence * F.pred +let pretty = ref (fun _ _ -> ()) let is_true = function { seq_catg = TRUE | EMPTY } -> true | _ -> false let is_empty = function { seq_catg = EMPTY } -> true | _ -> false -let is_absurd h = match h.condition with - | (Type p | Core p | When p | Have p) -> p == F.p_false +let is_absurd_h h = match h.condition with + | (Core p | When p | Have p) -> p == F.p_false | _ -> false -let is_trivial_hs_p hs p = p == F.p_true || List.exists is_absurd hs +let is_trivial_h h = match h.condition with + | State _ -> false + | (Type p | Core p | When p | Have p | Init p) -> p == F.p_true + | Branch(_,a,b) -> is_true a && is_true b + | Either w -> List.for_all is_true w + +let is_trivial_hs_p hs p = p == F.p_true || List.exists is_absurd_h hs let is_trivial_hsp (hs,p) = is_trivial_hs_p hs p let is_trivial (s:sequent) = is_trivial_hs_p (fst s).seq_list (snd s) @@ -354,6 +398,35 @@ let disjunction phi es = | [] -> if !positives then D_TRUE else D_FALSE | cs -> D_EITHER cs +(* -------------------------------------------------------------------------- *) +(* --- Prenex-Form Introduction --- *) +(* -------------------------------------------------------------------------- *) + +let prenex_intro p = + try + let open Qed.Logic in + (* invariant: xs <> []; result <-> forall xs, hs -> p *) + let rec walk hs xs p = + match F.p_expr p with + | Imply(h,p) -> walk (h::hs) xs p + | Bind(Forall,tau,p) -> bind hs xs tau p + | _ -> + if hs = [] then raise Exit ; + F.p_forall (List.rev xs) (F.p_hyps (List.concat hs) p) + (* invariant: result <-> forall hs xs (\tau.bind) *) + and bind hs xs tau bind = + let x = Lang.freshvar tau in + let p = F.p_bool (F.QED.lc_open x bind) in + walk hs (x::xs) p + (* invariant: result <-> p *) + and crawl p = + match F.p_expr p with + | Imply(h,p) -> F.p_hyps h (crawl p) + | Bind(Forall,tau,p) -> bind [] [] tau p + | _ -> raise Exit + in crawl p + with Exit -> p + (* -------------------------------------------------------------------------- *) (* --- Existential Introduction --- *) (* -------------------------------------------------------------------------- *) @@ -365,7 +438,10 @@ let rec exist_intro p = | Bind(Exists,tau,p) -> let x = Lang.freshvar tau in exist_intro (F.p_bool (F.QED.lc_open x p)) - | _ -> p + | _ -> + if Wp_parameters.Prenex.get () + then prenex_intro p + else p let rec exist_intros = function | [] -> [] @@ -595,8 +671,15 @@ let rec map_condition f = function and map_step f h = update_cond h (map_condition f h.condition) +and map_steplist f = function + | [] -> [] + | h::hs -> + let h = map_step f h in + let hs = map_steplist f hs in + if is_trivial_h h then hs else h :: hs + and map_sequence f s = - sequence (List.map (map_step f) s.seq_list) + sequence (map_steplist f s.seq_list) and map_sequent f (hs,g) = map_sequence f hs , f g @@ -606,29 +689,46 @@ and map_sequent f (hs,g) = map_sequence f hs , f g module Ground = Letify.Ground -let id p = p -let have step = match step.condition with - | Have p | When p | Core p | Init p -> p - | _ -> F.p_true - -let ground_array cs = - let gs , s = Ground.compute (Array.map have cs) in - Array.mapi (fun i c -> map_step gs.(i) c) cs , s - -let ground_hrp = function - | [| |] -> [| |] , id - | [| c |] as w -> w , Ground.singleton (have c) - | cs -> ground_array cs - -let ground_hsp = function - | [] -> [] , id - | [c] as w -> w , Ground.singleton (have c) - | cs -> - let cs , s = ground_array (Array.of_list cs) in - Array.to_list cs , s +let rec ground_flow ~fwd env h = + match h.condition with + | State s -> + let s = Mstate.apply (Ground.e_apply env) s in + update_cond h (State s) + | Type _ | Have _ | When _ | Core _ | Init _ -> + let phi = if fwd then Ground.forward else Ground.backward in + let cond = map_condition (phi env) h.condition in + update_cond h cond + | Branch(p,a,b) -> + let p,wa,wb = Ground.branch env p in + let a = ground_flowseq ~fwd wa a in + let b = ground_flowseq ~fwd wb b in + update_cond h (Branch(p,a,b)) + | Either ws -> + let ws = List.map + (fun w -> ground_flowseq ~fwd (Ground.copy env) w) ws in + update_cond h (Either ws) + +and ground_flowseq ~fwd env hs = + sequence (ground_flowlist ~fwd env hs.seq_list) + +and ground_flowlist ~fwd env hs = + if fwd + then ground_flowdir ~fwd env hs + else List.rev (ground_flowdir ~fwd env (List.rev hs)) + +and ground_flowdir ~fwd env = function + | [] -> [] + | h::hs -> + let h = ground_flow ~fwd env h in + let hs = ground_flowdir ~fwd env hs in + if is_trivial_h h then hs else h :: hs -let ground_hseq (hs,goal) = - let hs , s = ground_hsp hs in hs , s goal +let ground (hs,g) = + let hs = ground_flowlist ~fwd:true (Ground.top ()) hs in + let hs = ground_flowlist ~fwd:false (Ground.top ()) hs in + let env = Ground.top () in + let hs = ground_flowlist ~fwd:true env hs in + hs , Ground.p_apply env g (* -------------------------------------------------------------------------- *) (* --- Letify --- *) @@ -637,32 +737,31 @@ let ground_hseq (hs,goal) = module Sigma = Letify.Sigma module Defs = Letify.Defs -let used_of_dseq = Array.fold_left (fun ys (xs,_,_) -> Vars.union ys xs) Vars.empty -let bind_dseq target (_,di,_) sigma = +let used_of_dseq ds = + Array.fold_left (fun ys (_,step) -> Vars.union ys step.vars) Vars.empty ds + +let bind_dseq target (di,_) sigma = Letify.bind (Letify.bind sigma di target) di (Defs.domain di) -let locals sigma ~target ~required ?(step=Vars.empty) k dseq = (* returns ( target , export ) *) +let locals sigma ~target ~required ?(step=Vars.empty) k dseq = + (* returns ( target , export ) *) let t = ref target in let e = ref (Vars.union required step) in Array.iteri - (fun i (xs,_,_) -> - if i > k then t := Vars.union !t xs ; - if i <> k then e := Vars.union !e xs ; + (fun i (_,step) -> + if i > k then t := Vars.union !t step.vars ; + if i <> k then e := Vars.union !e step.vars ; ) dseq ; Vars.diff !t (Sigma.domain sigma) , !e let dseq_of_step sigma step = - let xs = - match step.condition with - | Type _ -> Vars.empty - | _ -> step.vars in let defs = match step.condition with | Init p | Have p | When p | Core p -> Defs.extract (Sigma.p_apply sigma p) | Type _ | Branch _ | Either _ | State _ -> Defs.empty - in (xs , defs , step) + in defs , step -let letify_assume sref (_,_,step) = +let letify_assume sref (_,step) = let current = !sref in begin match step.condition with @@ -672,11 +771,13 @@ let letify_assume sref (_,_,step) = sref := Sigma.assume current p end ; current +[@@@ warning "-32"] let rec letify_type sigma used p = match F.p_expr p with | And ps -> p_all (letify_type sigma used) ps | _ -> let p = Sigma.p_apply sigma p in if Vars.intersect used (F.varsp p) then p else F.p_true +[@@@ warning "+32"] let rec letify_seq sigma0 ~target ~export (seq : step list) = let dseq = Array.map (dseq_of_step sigma0) (Array.of_list seq) in @@ -691,13 +792,15 @@ let rec letify_seq sigma0 ~target ~export (seq : step list) = let sequence = Array.mapi (letify_step dseq dsigma ~used ~required ~target) dseq in let modified = ref (not (Sigma.equal sigma0 sigma1)) in +(* let sequence = if Wp_parameters.Ground.get () then fst (ground_hrp sequence) else sequence in +*) let sequence = flatten_sequence modified (Array.to_list sequence) in !modified , sigma1 , sigma2 , sequence -and letify_step dseq dsigma ~required ~target ~used i (_,d,s) = +and letify_step dseq dsigma ~required ~target ~used i (d,s) = let sigma = dsigma.(i) in let cond = match s.condition with | State s -> State (Mstate.apply (Sigma.e_apply sigma) s) @@ -717,7 +820,8 @@ and letify_step dseq dsigma ~required ~target ~used i (_,d,s) = let p = Sigma.p_apply sigma p in let ps = Letify.add_definitions sigma d required [p] in When (p_conj ps) - | Type p -> Type (letify_type sigma used p) + | Type p -> + Type (letify_type sigma used p) | Branch(p,a,b) -> let p = Sigma.p_apply sigma p in let step = F.varsp p in @@ -979,33 +1083,32 @@ end (* --- Letify-Fixpoint --- *) (* -------------------------------------------------------------------------- *) -let rec fixpoint solvers sigma sequent = +let rec fixpoint limit solvers sigma s0 = !Db.progress (); - let sequent = - if Wp_parameters.Ground.get () then - ground_hseq sequent - else sequent in - let hs,p = ConstantFolder.simplify sequent in + let s1 = + if Wp_parameters.Ground.get () then ground s0 + else s0 in + let hs,p = ConstantFolder.simplify s1 in let target = F.varsp p in let export = Vars.empty in let modified , sigma1 , sigma2 , hs = letify_seq sigma ~target ~export hs in let p = Sigma.p_apply sigma2 p in - let s = hs , p in - if is_trivial_hsp s then [],p_true + let s2 = ground (hs , p) in + if is_trivial_hsp s2 then [],p_true else - if modified - then fixpoint solvers sigma1 s + if modified || (limit > 0 && not (equal_list (fst s0) (fst s2))) + then fixpoint (pred limit) solvers sigma1 s2 else - match simplify solvers s with - | Simplified s -> fixpoint solvers sigma1 s + match simplify solvers s2 with + | Simplified s3 -> fixpoint (pred limit) solvers sigma1 s3 | Trivial -> [],p_true - | NoSimplification -> s + | NoSimplification -> s2 -let letify_hsp ?(solvers=[]) hsp = fixpoint solvers Sigma.empty hsp +let letify_hsp ?(solvers=[]) hsp = fixpoint 10 solvers Sigma.empty hsp let rec letify ?(solvers=[]) ?(intros=10) (seq,p) = - let hs,p = fixpoint solvers Sigma.empty (seq.seq_list,p) in + let hs,p = fixpoint 10 solvers Sigma.empty (seq.seq_list,p) in let sequent = sequence hs , p in let introduced = introduction sequent in if sequent != introduced && intros > 0 then @@ -1068,7 +1171,7 @@ let pruning ?(solvers=[]) seq = collect_steps m hs ; tc := 0 ; let hsp = test_cases (hs,p) (Letify.Split.select m) in - if !tc > 0 && Wp_parameters.has_dkey "pruning" then + if !tc > 0 && Wp_parameters.has_dkey dkey_pruning then if is_trivial_hsp hsp then Wp_parameters.feedback "[Pruning] Trivial" else @@ -1312,6 +1415,153 @@ end let filter = Filter.make +(* -------------------------------------------------------------------------- *) +(* --- Filter Parasite Definitions --- *) +(* -------------------------------------------------------------------------- *) + +module Parasite = +struct + + open Qed.Logic + + type usage = Used | Def of F.term + type domain = usage Vmap.t + + [@@@ warning "-32"] + let pretty fmt w = + Format.fprintf fmt "@[<hov 2>{" ; + Vmap.iter + (fun x u -> match u with + | Used -> Format.fprintf fmt "@ %a" F.pp_var x + | Def e -> Format.fprintf fmt "@ @[<hov 2>%a:=%a;@]" F.pp_var x F.pp_term e + ) w ; + Format.fprintf fmt " }@]" + [@@@ warning "+32"] + + let cyclic w x e = + let m = ref Vars.empty in + let once x = if Vars.mem x !m then false else (m := Vars.add x !m ; true) in + let rec walk_y w x y = + if F.Var.equal x y then raise Exit ; + if once x then + let r = try Vmap.find x w with Not_found -> Used in + match r with Used -> () | Def e -> walk_e w x e + and walk_e w x e = Vars.iter (walk_y w x) (F.vars e) in + try walk_e w x e ; false with Exit -> true + +(* + let pivots w a b = + let rec collect xs e = + match F.repr e with + | Fvar x -> x :: xs + | Add es -> List.fold_left collect xs es + | _ -> xs in + let define w a b = + let xs = collect [] a in + let def r x = x , F.e_sub r (F.e_var x) in + let filter w (x,e) = acyclic w x e in + if xs = [] then [] else + List.filter (filter w) + (List.map (def (F.e_sub b a)) xs) in + define w a b @ define w b a +*) + + let rec add_used (w : domain) xs = Vars.fold add_usedvar xs w + and add_usedvar x w = + try match Vmap.find x w with + | Used -> w + | Def e -> add_used (Vmap.add x Used w) (F.vars e) + with Not_found -> Vmap.add x Used w + + let add_def (w : domain) x e = + try + let xs = F.vars e in + if cyclic w x e then add_used (add_usedvar x w) xs + else + match Vmap.find x w with + | Used -> add_used w xs + | Def e0 -> if F.equal e0 e then w else add_used (Vmap.add x Used w) xs + with Not_found -> Vmap.add x (Def e) w + + let kind x w = + try Some (Vmap.find x w) + with Not_found -> None + + let add_eq (w : domain) x y = + match kind x w , kind y w with + | None , None -> + let cmp = F.Var.compare x y in + if cmp > 0 then add_def w x (F.e_var y) else + if cmp < 0 then add_def w y (F.e_var x) else + w + | None , Some Used -> add_def w x (F.e_var y) + | Some Used , None -> add_def w y (F.e_var x) + | Some(Def e),(None | Some Used) + | (None|Some Used),Some (Def e) + -> add_usedvar x (add_usedvar y (add_used w (F.vars e))) + | Some Used,Some Used -> w + | Some(Def a),Some(Def b) -> + let xs = Vars.union (F.vars a) (F.vars b) in + add_usedvar x (add_usedvar y (add_used w xs)) + + let branch p wa wb = + let pool = ref (F.varsp p) in + let w0 = Vmap.union + (fun _x u v -> + match u,v with + | Used,Used -> Used + | Def a,Def b -> Def( F.e_if (F.e_prop p) a b ) + | Def e,Used | Used,Def e -> + pool := Vars.union !pool (F.vars e) ; Used + ) wa wb in + add_used w0 !pool + + let rec usage w p = + match F.repr p with + | And ps -> List.fold_left usage w ps + | Eq(a,b) -> + begin match F.repr a , F.repr b with + | Fvar x , Fvar y -> add_eq w x y + | Fvar x , _ -> add_def w x b + | _ , Fvar y -> add_def w y a + | _ -> add_used w (F.vars p) + end + | _ -> add_used w (F.vars p) + + let rec collect_step w s = + match s.condition with + | Type _ | State _ -> w + | Have p | Core p | Init p | When p -> + usage w (F.e_prop p) + | Branch(p,a,b) -> + let wa = collect_seq w a in + let wb = collect_seq w b in + branch p wa wb + | Either ws -> + List.fold_left collect_seq w ws + + and collect_seq w s = List.fold_left collect_step w s.seq_list + + let parasites w = + Vmap.fold + (fun x u xs -> match u with Used -> xs | Def _ -> Vars.add x xs) + w Vars.empty + + let rec filter xs p = + match F.p_expr p with + | And ps -> p_all (filter xs) ps + | _ -> if Vars.intersect (F.varsp p) xs then F.p_true else p + + let filter (hs,g) = + let w = collect_seq (add_used Vmap.empty (F.varsp g)) hs in + let xs = parasites w in + if Vars.is_empty xs then (hs,g) + else map_sequence (filter xs) hs , g + +end + +let parasite = Parasite.filter + (* -------------------------------------------------------------------------- *) (* --- Finalization --- *) (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/wp/Conditions.mli b/src/plugins/wp/Conditions.mli index b6193f2e7cb92c7d058ed85f49d39a563a150340..ef82e401ad1466c2a0926750acf1a937bb96c661 100644 --- a/src/plugins/wp/Conditions.mli +++ b/src/plugins/wp/Conditions.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -55,6 +55,8 @@ and sequence (** List of steps *) type sequent = sequence * F.pred +val pretty : (Format.formatter -> sequent -> unit) ref + val step : ?descr:string -> ?stmt:stmt -> @@ -203,6 +205,7 @@ class type simplifier = val clean : sequent -> sequent val filter : sequent -> sequent +val parasite : sequent -> sequent val letify : ?solvers:simplifier list -> ?intros:int -> sequent -> sequent val pruning : ?solvers:simplifier list -> sequent -> sequent diff --git a/src/plugins/wp/Context.ml b/src/plugins/wp/Context.ml index 4f1a56a1c49beff1e7c0c6c6179d828861f0785a..882a25eb57dfca54c7100ef4592be5b4a5496084 100644 --- a/src/plugins/wp/Context.ml +++ b/src/plugins/wp/Context.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Context.mli b/src/plugins/wp/Context.mli index 00b4b1ea20d5d6672e5c22b1ec46b1ca73e15415..2819739a3020847c22dbd51e83464030213f5782 100644 --- a/src/plugins/wp/Context.mli +++ b/src/plugins/wp/Context.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Cstring.ml b/src/plugins/wp/Cstring.ml index d743317918f1db6275deb9d15550ad322c12a00f..22a25ed9c6bea3219cc154d240735ff67ee4eabe 100644 --- a/src/plugins/wp/Cstring.ml +++ b/src/plugins/wp/Cstring.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Cstring.mli b/src/plugins/wp/Cstring.mli index 8c141a4548ed8da4feb939c6416932e2b2cc21a2..d4abc617f0a276ccd2674392403a7b953a8ee76f 100644 --- a/src/plugins/wp/Cstring.mli +++ b/src/plugins/wp/Cstring.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Cvalues.ml b/src/plugins/wp/Cvalues.ml index 4bbf0549d45ff798b7ed0d3266a7602ecc530267..d5a2f2573a371125cc7f40faa52a864df5084af3 100644 --- a/src/plugins/wp/Cvalues.ml +++ b/src/plugins/wp/Cvalues.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -210,6 +210,17 @@ let ldomain ltype = | Ctype typ -> cdomain typ | Ltype _ | Lvar _ | Linteger | Lreal | Larrow _ -> None +(* -------------------------------------------------------------------------- *) +(* --- Volatile --- *) +(* -------------------------------------------------------------------------- *) + +let volatile ?warn () = + Wp_parameters.Volatile.get () || + ( Extlib.may + (fun w -> Warning.emit ~severe:false + ~effect:"ignore volatile attribute" "%s" w) + warn ; false ) + (* -------------------------------------------------------------------------- *) (* --- ACSL Equality --- *) (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/wp/Cvalues.mli b/src/plugins/wp/Cvalues.mli index 8bc3b1e01304085857af6a166a6e9aba1e25e79c..e110cdc4387b233dc828b2c3cb7053d034e7b940 100644 --- a/src/plugins/wp/Cvalues.mli +++ b/src/plugins/wp/Cvalues.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -56,6 +56,13 @@ val has_ltype : logic_type -> term -> pred val cdomain : typ -> (term -> pred) option val ldomain : logic_type -> (term -> pred) option +(** {2 Volatile Access} *) + +val volatile : ?warn:string -> unit -> bool +(** Check if a volatile access must be properly modelled or ignored. + In case the volatile attribute comes to be ignored, + the provided warning is emitted, if any. *) + (** {2 ACSL Equality} *) val equal_object : c_object -> term -> term -> pred diff --git a/src/plugins/wp/Definitions.ml b/src/plugins/wp/Definitions.ml index 17019afe91c8ebcd16257ec040414e1ceb742e65..f609168ec663b8d446d88cd8d85c4638217e712a 100644 --- a/src/plugins/wp/Definitions.ml +++ b/src/plugins/wp/Definitions.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -384,14 +384,14 @@ class virtual visitor main = method private vproperties = function | Logic _ | Function _ | Predicate _ -> () - | Inductive cases -> List.iter self#vdlemma cases + | Inductive cases -> List.iter (fun l -> self#vdlemma l) cases method private vdfun d = begin List.iter self#vparam d.d_params ; self#vdefinition d.d_definition ; - self#on_dfun d ; self#vproperties d.d_definition ; + self#on_dfun d ; end method private vlfun f = @@ -437,7 +437,6 @@ class virtual visitor main = List.iter self#vparam a.l_forall ; List.iter (List.iter self#vtrigger) a.l_triggers ; self#vpred a.l_lemma ; - self#on_dlemma a ; end method vlemma lem = @@ -447,7 +446,7 @@ class virtual visitor main = lemmas <- DS.add l lemmas ; try let a = Lemma.find l in - if self#do_local a.l_cluster then self#vdlemma a + if self#do_local a.l_cluster then (self#vdlemma a; self#on_dlemma a) with Not_found -> Wp_parameters.fatal "Lemma '%s' undefined" l end @@ -498,7 +497,7 @@ class virtual visitor main = rev_iter (fun d -> self#vsymbol d.d_lfun) main.c_symbols ; method vlemmas = (* Visit the lemmas *) - rev_iter (fun l -> self#vdlemma l) main.c_lemmas ; + rev_iter (fun l -> self#vdlemma l; self#on_dlemma l) main.c_lemmas ; method vself = (* Visit a cluster *) begin diff --git a/src/plugins/wp/Definitions.mli b/src/plugins/wp/Definitions.mli index 68624413ca1a29cf1448e1c8ef8d11f3675d05e8..9fee21c40f61a69494df7f804494103c313240a4 100644 --- a/src/plugins/wp/Definitions.mli +++ b/src/plugins/wp/Definitions.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Factory.ml b/src/plugins/wp/Factory.ml index 898cfcbff06345ff33cf3e9337708e1adcb71157..ff39782c38f7e7ec62aa3ee3e9fb86f1415e0798 100644 --- a/src/plugins/wp/Factory.ml +++ b/src/plugins/wp/Factory.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Factory.mli b/src/plugins/wp/Factory.mli index 37e59fb29413bf06469aa1eed466ba4d6164afd2..b7fa4bc4c471ce0516652e39870a3c36532d3b28 100644 --- a/src/plugins/wp/Factory.mli +++ b/src/plugins/wp/Factory.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Filtering.ml b/src/plugins/wp/Filtering.ml index 74cb5488430e31d5beb77997a0c678445e766946..f84a9293e756d84a244c3da43ccf0e1118df959a 100644 --- a/src/plugins/wp/Filtering.ml +++ b/src/plugins/wp/Filtering.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Filtering.mli b/src/plugins/wp/Filtering.mli index bf72968891e9951a69d16762c1a6efe8621cf7b9..bfc35470e9fb9b11091f0c107f17745cf7d062ab 100644 --- a/src/plugins/wp/Filtering.mli +++ b/src/plugins/wp/Filtering.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Footprint.ml b/src/plugins/wp/Footprint.ml index 49a3e7cab150d117873438aacdebd4e24dd241a3..23b18582976e35846f6dc536ecc032f9c4610ba0 100644 --- a/src/plugins/wp/Footprint.ml +++ b/src/plugins/wp/Footprint.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Footprint.mli b/src/plugins/wp/Footprint.mli index 639634daa8fc7b0564fd89c0111930dfb6706bff..7db7d012968cf26efd91616ec887e4e6f58dcfb8 100644 --- a/src/plugins/wp/Footprint.mli +++ b/src/plugins/wp/Footprint.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Generator.ml b/src/plugins/wp/Generator.ml index 7177017978557e744f200142393c574f61fda138..6d09c9c727959890c6b5ca5b574dd4a2b41ca300 100644 --- a/src/plugins/wp/Generator.ml +++ b/src/plugins/wp/Generator.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Generator.mli b/src/plugins/wp/Generator.mli index c5889f04d4bd546972017613216d9a0afdbb0527..8bffa0d903a9139dca1291707cdcfd2f0eff7f52 100644 --- a/src/plugins/wp/Generator.mli +++ b/src/plugins/wp/Generator.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiComposer.ml b/src/plugins/wp/GuiComposer.ml index f4cf1f19ca5e914ea46749cd151e9194a74e2a70..46a167724bf755d3e9c2b7d7042bb54434c4d344 100644 --- a/src/plugins/wp/GuiComposer.ml +++ b/src/plugins/wp/GuiComposer.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiComposer.mli b/src/plugins/wp/GuiComposer.mli index c496e3ed492167e4d225f2ee376edfc52d56d862..87354eb824c93097f4d513315646a3ab34fa5761 100644 --- a/src/plugins/wp/GuiComposer.mli +++ b/src/plugins/wp/GuiComposer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiConfig.ml b/src/plugins/wp/GuiConfig.ml index 750d3729d2a64bfb93d9209f4e0bcf80b5bcde74..2ba40db2554f68426d81a29d3ca916a3d4c54caa 100644 --- a/src/plugins/wp/GuiConfig.ml +++ b/src/plugins/wp/GuiConfig.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiConfig.mli b/src/plugins/wp/GuiConfig.mli index c92d868ccfe57a93e821df14143a1d6baf79f151..2c0035b1c595d88a7bc4637ed3e09721812c67a5 100644 --- a/src/plugins/wp/GuiConfig.mli +++ b/src/plugins/wp/GuiConfig.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiGoal.ml b/src/plugins/wp/GuiGoal.ml index 12537b16321ea972d2a10494554a120dee0437a2..40d1a441ba950c5be6d08d4b37f004cba9fa0c6f 100644 --- a/src/plugins/wp/GuiGoal.ml +++ b/src/plugins/wp/GuiGoal.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -549,25 +549,27 @@ class pane (proverpane : GuiConfig.provers) = ~pool provers method private fork proof fork = - begin - let provers = VCS.[ BatchMode, AltErgo ] in - let pool = Task.pool () in - ProofEngine.iter (self#schedule pool provers) fork ; - let server = ProverTask.server () in - state <- Forking(proof,fork,pool) ; - Task.launch server ; - end + Wutil.later + begin fun () -> + let provers = VCS.[ BatchMode, AltErgo ] in + let pool = Task.pool () in + ProofEngine.iter (self#schedule pool provers) fork ; + let server = ProverTask.server () in + state <- Forking(proof,fork,pool) ; + Task.launch server ; + end method private apply tactic selection process = match state with | Empty | Forking _ | Composer _ | Browser _ -> () | Proof proof -> - begin - let title = tactic#title in - let tactic = ProofScript.jtactic ~title tactic selection in - let anchor = ProofEngine.anchor proof () in - self#fork proof (ProofEngine.fork proof ~anchor tactic process) - end + Wutil.later + begin fun () -> + let title = tactic#title in + let tactic = ProofScript.jtactic ~title tactic selection in + let anchor = ProofEngine.anchor proof () in + self#fork proof (ProofEngine.fork proof ~anchor tactic process) + end method private search proof = function | None -> text#printf "No tactic found.@\n" @@ -577,7 +579,8 @@ class pane (proverpane : GuiConfig.provers) = match state with | Empty | Forking _ | Composer _ | Browser _ -> () | Proof proof -> - begin + Wutil.later + begin fun () -> let anchor = ProofEngine.anchor proof () in let pool = new Strategy.pool in Model.with_model diff --git a/src/plugins/wp/GuiGoal.mli b/src/plugins/wp/GuiGoal.mli index a2e56d38cf58a96356f4bcee17b46e0f546af48f..e66a55c0020d72a490b2042090c9347736ab74a2 100644 --- a/src/plugins/wp/GuiGoal.mli +++ b/src/plugins/wp/GuiGoal.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiList.ml b/src/plugins/wp/GuiList.ml index ec0c27192f945ef702f2b0aa3d9c3f2eec969b1e..6060f69745bb93a68083f538a76d31dfd3b6e377 100644 --- a/src/plugins/wp/GuiList.ml +++ b/src/plugins/wp/GuiList.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -38,7 +38,7 @@ class model = method get k = Windex.get k index method coerce = (self :> Wpo.t Wtable.listmodel) end - + let render_prover_result p = let icn_stock name = [`STOCK_ID name] in let icn_status s = [`PIXBUF(Gtk_helper.Icon.get (Gtk_helper.Icon.Feedback s))] in @@ -64,7 +64,7 @@ let render_prover_result p = | { verdict=NoResult } , Qed -> icn_na | { verdict=NoResult } , Tactical -> begin - match ProofEngine.get w with + match ProverScript.get w with | `None -> icn_na | `Script -> icn_stock "gtk-media-play" | `Proof -> icn_stock "gtk-edit" diff --git a/src/plugins/wp/GuiList.mli b/src/plugins/wp/GuiList.mli index 46d5bd438f5872708872851f1c7c427a57d419a7..c1faa8f79c978ee407514211d7a9d2cc1e867d04 100644 --- a/src/plugins/wp/GuiList.mli +++ b/src/plugins/wp/GuiList.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiNavigator.ml b/src/plugins/wp/GuiNavigator.ml index eec1573363b54624470eb68194fc9e19dec0c89c..0b01423250aed16146a6e822eb464f9ad21cd146 100644 --- a/src/plugins/wp/GuiNavigator.ml +++ b/src/plugins/wp/GuiNavigator.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -34,7 +34,7 @@ open GuiSource (* -------------------------------------------------------------------------- *) type scope = [ `All | `Module | `Select ] -type filter = [ `ToComplete | `ToProve | `Scripts | `All ] +type filter = [ `ToProve | `Scripts | `All ] type card = [ `List | `Goal ] type focus = [ `All @@ -105,8 +105,8 @@ class behavior ~default:`Module scope ; Cfg.config_values ~key:"wp.navigator.filter" ~values:[`All,"all" ; `Scripts,"scripts" ; - `ToComplete,"tocomplete" ; `ToProve,"toprove"] - ~default:`ToComplete filter ; + `ToProve,"toprove"] + ~default:`ToProve filter ; filter#on_event self#reload ; end @@ -133,8 +133,7 @@ class behavior match filter#get with | `All -> true | `Scripts -> has_proof g - | `ToProve -> to_prove g - | `ToComplete -> to_prove g && has_proof g + | `ToProve -> to_prove g && (Wpo.is_unknown g || has_proof g) in if ok then list#add g in begin @@ -248,7 +247,7 @@ class behavior schedule (ProverWhy3ide.prove ~callback ~iter) | VCS.Tactical -> begin - match mode , ProofEngine.get w with + match mode , ProverScript.get w with | (None | Some VCS.BatchMode) , `Script -> schedule (ProverScript.prove ~callback ~success w) | _ -> @@ -428,7 +427,6 @@ let make (main : main_window_extension_points) = ] () in let filter = new Widget.menu ~default:`ToProve ~options:[ `ToProve , "Not Proved (yet)" ; - `ToComplete , "Pending Proofs" ; `Scripts , "All Scripts" ; `All , "All Goals" ; ] () in @@ -460,9 +458,8 @@ let make (main : main_window_extension_points) = filter#set_render (function | `All -> "All Results" | `Scripts -> "All Scripts" - | `ToProve -> "Not Proved" - | `ToComplete -> "Pending Proofs") ; - filter#set_items [ `ToProve ; `ToComplete ; `Scripts ; `All ] ; + | `ToProve -> "Not Proved") ; + filter#set_items [ `ToProve ; `Scripts ; `All ] ; end ; (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/wp/GuiNavigator.mli b/src/plugins/wp/GuiNavigator.mli index dc182dcf8dae3ae8d61c875a12790852f29d1996..fec94450db053c1ea25a5b1330d3ab4bb8708ca8 100644 --- a/src/plugins/wp/GuiNavigator.mli +++ b/src/plugins/wp/GuiNavigator.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiPanel.ml b/src/plugins/wp/GuiPanel.ml index 4bfc64fb125b6cea592a52b75088f2783f1e0d3f..00bf34ba4764b22ef8cbe3c2009ddc65320d4e32 100644 --- a/src/plugins/wp/GuiPanel.ml +++ b/src/plugins/wp/GuiPanel.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -247,13 +247,6 @@ let wp_panel ~packing:options#pack Wp_parameters.ProofTrace.get Wp_parameters.ProofTrace.set demon ; - let options = GPack.hbox ~spacing:8 ~packing () in - - Gtk_form.check ~label:"Invariants" - ~tooltip:"Alternative WP for loop with arbitrary invariants" - ~packing:options#pack - Wp_parameters.Invariants.get Wp_parameters.Invariants.set demon ; - let control = GPack.table ~columns:2 ~col_spacings:8 ~rows:4 ~packing () in let addcontrol line col w = control#attach ~left:(col-1) ~top:(line-1) ~expand:`NONE w in diff --git a/src/plugins/wp/GuiPanel.mli b/src/plugins/wp/GuiPanel.mli index a2790369d69064a6a79de53267fe5c6976a2763c..b3e2fc04c418c91897c0b2b46e41c5c36ef573ab 100644 --- a/src/plugins/wp/GuiPanel.mli +++ b/src/plugins/wp/GuiPanel.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiProof.ml b/src/plugins/wp/GuiProof.ml index 95248fde8833101ad5d37f13e451454051df8532..d8aeb486db7585bd706dcbaf6f437e09b0b15e30 100644 --- a/src/plugins/wp/GuiProof.ml +++ b/src/plugins/wp/GuiProof.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiProof.mli b/src/plugins/wp/GuiProof.mli index cebdae220c1ffdbed52a6c52c4edc3f2d82bb10c..d7bc766833e81836f75390f2d303e3609a58f13b 100644 --- a/src/plugins/wp/GuiProof.mli +++ b/src/plugins/wp/GuiProof.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiProver.ml b/src/plugins/wp/GuiProver.ml index 9b7e3a1246e30e0ec1f414538255aab0164fb518..2b0328f8c4ea22a54791605328d6bc7b2ed5edb2 100644 --- a/src/plugins/wp/GuiProver.ml +++ b/src/plugins/wp/GuiProver.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -23,7 +23,6 @@ let no_status = `Share "theme/default/never_tried.png" let ok_status = `Share "theme/default/surely_valid.png" let ko_status = `Share "theme/default/unknown.png" -let go_status = `Share "theme/default/valid_under_hyp.png" let wg_status = `Share "theme/default/invalid.png" let filter = function @@ -61,14 +60,10 @@ let depth_for = function Some spin | _ -> None -let configure widget option = - match widget , option with - | Some spinner , Some value -> spinner#set value - | _ -> () - class prover ~(console:Wtext.text) ~prover = let tooltip = "Configure Prover" in let content = new Wpane.form () in + let result = new Widget.label ~style:`Code ~align:`Center ~text:"No Result" () in let timeout = timeout_for prover in let stepout = stepout_for prover in let depth = depth_for prover in @@ -77,6 +72,7 @@ class prover ~(console:Wtext.text) ~prover = initializer begin assert (filter prover) ; + content#add_row ~xpadding:6 ~ypadding:4 result#coerce ; Wutil.on timeout (fun spin -> content#add_field ~label:"Timeout" spin#coerce) ; Wutil.on stepout (fun spin -> content#add_field ~label:"Steps" spin#coerce) ; Wutil.on depth (fun spin -> content#add_field ~label:"Depth" spin#coerce) ; @@ -119,26 +115,7 @@ class prover ~(console:Wtext.text) ~prover = let server = ProverTask.server () in Task.spawn server thread ; Task.launch server ; - self#update wpo ; - end - - method private retry wpo ~icn ~msg ?(cfg=msg) = function - | Some spin when spin#get > 0 -> - begin - self#set_status icn ; - let value = 2 * spin#get in - let tooltip = - Format.asprintf "Retry Prover with extended %s (%d)" cfg value in - let callback () = spin#set value ; self#run wpo in - self#set_action ~tooltip ~icon:`MEDIA_FORWARD ~callback () ; - Pretty_utils.ksfprintf self#set_label "%a (%s)" VCS.pp_prover prover msg ; - end - | _ -> - begin - self#set_status icn ; - let callback () = self#run wpo in - self#set_action ~tooltip:"Retry Prover" ~icon:`MEDIA_FORWARD ~callback () ; - Pretty_utils.ksfprintf self#set_label "%a (%s)" VCS.pp_prover prover msg ; + Wutil.later (fun () -> self#update wpo) ; end method clear = @@ -146,40 +123,38 @@ class prover ~(console:Wtext.text) ~prover = self#set_status no_status ; self#set_action ~icon:`MEDIA_PLAY ~tooltip:"Run Prover" ?callback:None () ; Pretty_utils.ksfprintf self#set_label "%a" VCS.pp_prover prover ; + result#set_text "No Goal" ; end method update wpo = + begin let res = Wpo.get_result wpo prover in - if VCS.is_verdict res then - begin - let cfg = VCS.configure res in - configure timeout cfg.VCS.timeout ; - configure stepout cfg.VCS.stepout ; - configure depth cfg.VCS.depth ; - end ; + result#set_text (Pretty_utils.to_string VCS.pp_result_perf res) ; match res.VCS.verdict with | VCS.NoResult -> let callback () = self#run wpo in self#set_status no_status ; - self#set_action ~tooltip:"Run Prover" ~icon:`MEDIA_PLAY ~callback () ; - Pretty_utils.ksfprintf self#set_label "%a" VCS.pp_prover prover ; - | VCS.Computing signal -> + self#set_action ~icon:`MEDIA_PLAY ~tooltip:"Run Prover" ~callback () ; + | VCS.Computing callback -> self#set_status `EXECUTE ; - self#set_action ~tooltip:"Interrrupt Prover" ~icon:`STOP ~callback:signal () ; + self#set_action ~tooltip:"Interrupt Prover" ~icon:`STOP ~callback () ; Pretty_utils.ksfprintf self#set_label "%a (...)" VCS.pp_prover prover ; | VCS.Valid | VCS.Checked -> + let callback () = self#run wpo in self#set_status ok_status ; - self#set_action ~tooltip:"Run Prover" ~icon:`MEDIA_PLAY () ; + self#set_action ~tooltip:"Run Prover" ~icon:`MEDIA_PLAY ~callback () ; Pretty_utils.ksfprintf self#set_label "%a (%a)" VCS.pp_prover prover Rformat.pp_time res.VCS.prover_time ; + | VCS.Invalid | VCS.Unknown | VCS.Timeout | VCS.Stepout -> + let callback () = self#run wpo in + self#set_status ko_status ; + self#set_action ~tooltip:"Run Prover" ~icon:`MEDIA_PLAY ~callback () ; + Pretty_utils.ksfprintf self#set_label "%a (?)" VCS.pp_prover prover ; | VCS.Failed -> + let callback () = self#log wpo res in self#set_status `DIALOG_WARNING ; - let callback () = self#log wpo res in self#set_action ~tooltip:"Dump Logs" ~icon:`FILE ~callback () ; Pretty_utils.ksfprintf self#set_label "%a (failed)" VCS.pp_prover prover ; - | VCS.Invalid -> self#retry wpo ~icn:wg_status ~msg:"invalid" None - | VCS.Unknown -> self#retry wpo ~icn:ko_status ~msg:"unknown" ~cfg:"depth" depth - | VCS.Timeout -> self#retry wpo ~icn:`CUT ~msg:"timeout" ~cfg:"time" timeout - | VCS.Stepout -> self#retry wpo ~icn:`CUT ~msg:"stepout" ~cfg:"steps" stepout + end end diff --git a/src/plugins/wp/GuiProver.mli b/src/plugins/wp/GuiProver.mli index dbe556ff01bd20dcc5cff475a8e87ebfedac0fdb..86dc9124a239443d90bdc35bb4e5a69ce4a71d3d 100644 --- a/src/plugins/wp/GuiProver.mli +++ b/src/plugins/wp/GuiProver.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -25,8 +25,8 @@ open Widget val no_status : icon val ok_status : icon val ko_status : icon -val go_status : icon - +val wg_status : icon + val filter : VCS.prover -> bool (** Requires [filter prover]. *) diff --git a/src/plugins/wp/GuiSequent.ml b/src/plugins/wp/GuiSequent.ml index d2ae6aa64b57ab5019e339f04dca35456b550c14..33f17ada3178843f46db3d6974701af11ed1d1de 100644 --- a/src/plugins/wp/GuiSequent.ml +++ b/src/plugins/wp/GuiSequent.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiSequent.mli b/src/plugins/wp/GuiSequent.mli index 83f99f11d456f58ffc730cbfb8dbb7f61e1a5019..11f2c966cc5ab8f4473469950324af65b8c47362 100644 --- a/src/plugins/wp/GuiSequent.mli +++ b/src/plugins/wp/GuiSequent.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiSource.ml b/src/plugins/wp/GuiSource.ml index 3de96a2f774aaa4cf31ea2b48abbe59a97d9566f..858eb8860ac0b9c85f903a30b5f8bc810da78406 100644 --- a/src/plugins/wp/GuiSource.ml +++ b/src/plugins/wp/GuiSource.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -58,9 +58,15 @@ let selection_of_localizable = function s_stmt = stmt ; } end + | { skind=Instr(Local_init(_,ConsInit (vi, _, _),_)) } -> + S_call { + s_called = Globals.Functions.get vi ; + s_caller = kf ; + s_stmt = stmt ; + } | _ -> S_none end - | PVDecl (Some kf,{vglob=true}) -> S_fun kf + | PVDecl (Some kf,_,{vglob=true}) -> S_fun kf | PIP ip -> S_prop ip | PVDecl _ | PLval _ | PExp _ | PTermLval _ | PGlobal _ -> S_none @@ -99,14 +105,14 @@ class popup () = method private rte_popup menu main loc = match loc with - | PVDecl (Some kf,{vglob=true}) -> + | PVDecl (Some kf,_,{vglob=true}) -> if not (is_rte_generated kf) then self#add_rte menu main "Insert WP-safety guards" Db.RteGen.do_all_rte kf ; if not (is_rte_precond kf) then self#add_rte menu main "Insert all callees contract" Db.RteGen.do_precond kf; - | PStmt(kf,({ skind=Instr(Call _) })) -> + | PStmt(kf,({ skind=Instr(Call _ | Local_init (_, ConsInit _, _)) })) -> if not (is_rte_precond kf) then self#add_rte menu main "Insert callees contract (all calls)" Db.RteGen.do_precond kf; diff --git a/src/plugins/wp/GuiSource.mli b/src/plugins/wp/GuiSource.mli index 1e6f47c4e7e49beed271c7dc633f7aef546c788c..89cec20e7c241daed27a299539701af82079d658 100644 --- a/src/plugins/wp/GuiSource.mli +++ b/src/plugins/wp/GuiSource.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiTactic.ml b/src/plugins/wp/GuiTactic.ml index 0895ce20d98ecb0b6262195e2dcfef42b1b964b3..76842348ff860ea32ec5b49c71e8e9cef751ba84 100644 --- a/src/plugins/wp/GuiTactic.ml +++ b/src/plugins/wp/GuiTactic.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/GuiTactic.mli b/src/plugins/wp/GuiTactic.mli index cad8a0d57b2aa96f9936141750fb8839102c8207..e675ba5e8d1e97918327dc96330d631b41bb6db1 100644 --- a/src/plugins/wp/GuiTactic.mli +++ b/src/plugins/wp/GuiTactic.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Lang.ml b/src/plugins/wp/Lang.ml index d7c4e4e2220661883d6f2d4ada45e5fca036511d..e3b801f46abf0c3795666659cc5f92ce486a59c2 100644 --- a/src/plugins/wp/Lang.ml +++ b/src/plugins/wp/Lang.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -30,6 +30,8 @@ open Ctypes open Qed open Qed.Logic +let dkey_pretty = Wp_parameters.register_category "pretty" + (* -------------------------------------------------------------------------- *) let basename def name = @@ -264,8 +266,10 @@ let atype t = with Not_found -> Atype t let builtin_type ~name ~link ~library = - let m = new_extern ~link ~library ~debug:name in - Hashtbl.add builtins name m + try Mtype (Hashtbl.find builtins name) + with Not_found -> + let m = new_extern ~link ~library ~debug:name in + Hashtbl.add builtins name m ; Mtype m let is_builtin_type ~name = function | Data(Mtype m,_) -> @@ -364,8 +368,8 @@ type lfun = and model = { m_category : lfun category ; m_params : sort list ; - m_resort : sort ; - m_result : tau option ; + m_result : sort ; + m_typeof : tau option list -> tau ; m_source : source ; } @@ -373,20 +377,22 @@ and source = | Generated of string | Extern of Engine.link extern -let tau_of_lfun = function +let tau_of_lfun phi ts = + match phi with | ACSL f -> tau_of_return f | CTOR c -> if c.ctor_type.lt_params = [] then Logic.Data(Atype c.ctor_type,[]) else raise Not_found - | Model { m_result = Some t } -> t - | Model m -> match m.m_resort with + | Model m -> match m.m_result with | Sint -> Int | Sreal -> Real | Sbool -> Bool - | _ -> raise Not_found + | _ -> m.m_typeof ts type balance = Nary | Left | Right +let not_found _ = raise Not_found + let symbolf ?library ?link @@ -395,6 +401,7 @@ let symbolf ?(params=[]) ?(sort=Logic.Sdata) ?(result:tau option) + ?(typecheck:(tau option list -> tau) option) name = let buffer = Buffer.create 80 in Format.kfprintf @@ -414,27 +421,29 @@ let symbolf | Some info -> info in Extern (new_extern ~library:th ~link ~debug:name) in - let resort,result = match sort,result with - | _,Some t -> Kind.of_tau t,result - | Sint,None -> sort,Some Int - | Sreal,None -> sort,Some Real - | Sbool,None -> sort,Some Bool - | Sprop,None -> sort,Some Prop - | _ -> sort,None in + let typeof = + match typecheck with Some phi -> phi | None -> + match result with Some t -> fun _ -> t | None -> not_found in + let result = + match result with Some t -> Kind.of_tau t | None -> sort in Model { m_category = category ; m_params = params ; m_result = result ; - m_resort = resort ; - m_source = source; + m_typeof = typeof ; + m_source = source ; } ) (Format.formatter_of_buffer buffer) name -let extern_s ~library ?link ?category ?params ?sort ?result name = - symbolf ~library ?category ?params ?sort ?result ?link "%s" name +let extern_s + ~library ?link ?category ?params ?sort ?result ?typecheck name = + symbolf + ~library ?category ?params ?sort ?result ?typecheck ?link "%s" name -let extern_f ~library ?link ?balance ?category ?params ?sort ?result name = - symbolf ~library ?category ?params ?link ?balance ?sort ?result name +let extern_f + ~library ?link ?balance ?category ?params ?sort ?result ?typecheck name = + symbolf + ~library ?category ?params ?link ?balance ?sort ?result ?typecheck name let extern_p ~library ?bool ?prop ?link ?(params=[]) () = let link = @@ -447,8 +456,8 @@ let extern_p ~library ?bool ?prop ?link ?(params=[]) () = Model { m_category = Logic.Function; m_params = params ; - m_resort = Logic.Sprop; - m_result = Some Logic.Prop; + m_result = Logic.Sprop; + m_typeof = not_found; m_source = Extern (new_extern ~library ~link ~debug) } @@ -459,8 +468,8 @@ let extern_fp ~library ?(params=[]) ?link phi = Model { m_category = Logic.Function ; m_params = params ; - m_resort = Logic.Sprop; - m_result = Some Logic.Prop; + m_result = Logic.Sprop; + m_typeof = not_found; m_source = Extern (new_extern ~library ~link @@ -474,8 +483,8 @@ let generated_p name = Model { m_category = Logic.Function ; m_params = [] ; - m_resort = Logic.Sprop; - m_result = Some Logic.Prop; + m_result = Logic.Sprop; + m_typeof = not_found; m_source = Generated name } @@ -522,7 +531,7 @@ struct | CTOR _ -> Logic.Constructor let sort = function - | Model m -> m.m_resort + | Model m -> m.m_result | ACSL { l_type=None } -> Logic.Sprop | ACSL { l_type=Some t } -> sort_of_ltype t | CTOR _ -> Logic.Sdata @@ -786,11 +795,11 @@ struct let pp_tau = Pretty.pp_tau let pp_term fmt e = - if Wp_parameters.has_dkey "pretty" + if Wp_parameters.has_dkey dkey_pretty then QED.debug fmt e else Pretty.pp_term Pretty.empty fmt e let pp_pred fmt p = - if Wp_parameters.has_dkey "pretty" + if Wp_parameters.has_dkey dkey_pretty then QED.debug fmt p else Pretty.pp_term Pretty.empty fmt p let pp_var fmt x = pp_term fmt (e_var x) @@ -886,6 +895,7 @@ let new_gamma ?copy () = let get_pool () = Context.get cpool let get_gamma () = Context.get cgamma +let has_gamma () = Context.defined cgamma let freshvar ?basename tau = F.fresh (Context.get cpool) ?basename tau let freshen x = F.alpha (Context.get cpool) x diff --git a/src/plugins/wp/Lang.mli b/src/plugins/wp/Lang.mli index 25bcc63accbeb381c9819e1429651afb498bebb4..73b19df0336a3d88e0b93931cb8d043f1660001b 100644 --- a/src/plugins/wp/Lang.mli +++ b/src/plugins/wp/Lang.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -80,8 +80,8 @@ type lfun = and model = { m_category : lfun category ; m_params : sort list ; - m_resort : sort ; - m_result : tau option ; + m_result : sort ; + m_typeof : tau option list -> tau ; m_source : source ; } @@ -89,7 +89,7 @@ and source = | Generated of string | Extern of Engine.link extern -val builtin_type : name:string -> link:string infoprover -> library:string -> unit +val builtin_type : name:string -> link:string infoprover -> library:string -> adt val is_builtin_type : name:string -> tau -> bool val datatype : library:string -> string -> adt val record : @@ -110,6 +110,7 @@ val extern_s : ?params:sort list -> ?sort:sort -> ?result:tau -> + ?typecheck:(tau option list -> tau) -> string -> lfun val extern_f : @@ -120,6 +121,7 @@ val extern_f : ?params:sort list -> ?sort:sort -> ?result:tau -> + ?typecheck:(tau option list -> tau) -> ('a,Format.formatter,unit,lfun) format4 -> 'a (** balance just give a default when link is not specified *) @@ -128,7 +130,8 @@ val extern_p : ?bool:string -> ?prop:string -> ?link:Engine.link infoprover -> - ?params:sort list -> unit -> lfun + ?params:sort list -> + unit -> lfun val extern_fp : library:library -> ?params:sort list -> ?link:string infoprover -> string -> lfun @@ -147,7 +150,7 @@ val tau_of_object : c_object -> tau val tau_of_ctype : typ -> tau val tau_of_ltype : logic_type -> tau val tau_of_return : logic_info -> tau -val tau_of_lfun : lfun -> tau +val tau_of_lfun : lfun -> tau option list -> tau val tau_of_field : field -> tau val tau_of_record : field -> tau @@ -368,7 +371,7 @@ sig val lc_closed : term -> bool val lc_iter : (term -> unit) -> term -> unit val lc_map : (term -> term) -> term -> term - + (** {3 Utilities} *) val decide : term -> bool (** Return [true] if and only the term is [e_true]. Constant time. *) @@ -415,7 +418,8 @@ sig val typeof : ?field:(Field.t -> tau) -> ?record:(Field.t -> tau) -> - ?call:(Fun.t -> tau) -> term -> tau + ?call:(Fun.t -> tau option list -> tau) -> + term -> tau (** {3 Builtins} @@ -496,6 +500,7 @@ val variables : gamma -> var list val get_pool : unit -> pool val get_gamma : unit -> gamma +val has_gamma : unit -> bool val get_hypotheses : unit -> pred list val get_variables : unit -> var list diff --git a/src/plugins/wp/Letify.ml b/src/plugins/wp/Letify.ml index 73175948968fb32e11dbe5065e407e511806eadc..43b53c70dacef72c1b2df79a3a68161dfa7f0500 100644 --- a/src/plugins/wp/Letify.ml +++ b/src/plugins/wp/Letify.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -62,48 +62,91 @@ struct let merge a b = Tmap.union (fun _ u v -> if F.compare u v <= 0 then u else v) a b + let clause env h = + begin + env.domain <- Tmap.add h F.e_true env.domain ; + env.domain <- Tmap.add (e_not h) F.e_false env.domain ; + end + + let frank = function + | ACSL _ -> 0 + | CTOR _ -> 3 + | Model { m_category = Function } -> 0 + | Model { m_category = Injection } -> 1 + | Model { m_category = Operator _ } -> 2 + | Model { m_category = Constructor } -> 3 + + let reduce env a b = + match F.repr a , F.repr b with + | Fun(f,_) , Fun(g,_) when Wp_parameters.Reduce.get () -> + let cmp = frank f - frank g in + if cmp < 0 then env.domain <- Tmap.add a b env.domain ; + if cmp > 0 then env.domain <- Tmap.add b a env.domain ; + | _ -> () + let rec walk env h = match F.repr h with | True | False -> () | And ps -> List.iter (walk env) ps | Eq(a,b) -> + clause env h ; if is_ground env b then env.domain <- Tmap.add a b env.domain else if is_ground env a then env.domain <- Tmap.add b a env.domain - | Not p -> - env.domain <- Tmap.add h F.e_true env.domain ; - env.domain <- Tmap.add p F.e_false env.domain + else + reduce env a b + | Fun(f,[x]) -> + begin + clause env h ; + try + let iota = Cint.is_cint f in + let conv = Cint.convert iota x in + env.domain <- Tmap.add conv x env.domain ; + with Not_found -> () + end | _ -> - env.domain <- Tmap.add h F.e_true env.domain ; - env.domain <- Tmap.add (e_not h) F.e_false env.domain + clause env h - let find mu e = try Tmap.find e mu with Not_found -> e + let lookup mu e = Tmap.find e mu let subst mu = let sigma = F.sigma () in - F.p_subst ~sigma (find mu) + F.p_subst ~sigma (lookup mu) + + let e_apply env = + let sigma = F.sigma () in + F.e_subst ~sigma (lookup env.domain) + + let p_apply env = + let sigma = F.sigma () in + F.p_subst ~sigma (lookup env.domain) [@@@ warning "-32"] let pp_sigma fmt s = begin Format.fprintf fmt "@[<hov 2>[" ; Tmap.iter - (fun a b -> Format.fprintf fmt "@ %a -> %a" F.pp_term a F.pp_term b) + (fun a b -> Format.fprintf fmt "@ %a -> %a ;" F.pp_term a F.pp_term b) s ; Format.fprintf fmt "]@]" ; end [@@@ warning "+32"] + let pretty fmt env = pp_sigma fmt env.domain + let assume env p = - let p = F.p_subst (find env.domain) p in + let p = F.p_subst (lookup env.domain) p in walk env (F.e_prop p) ; p + let top () = { ground = Tmap.empty ; domain = Tmap.empty } + let copy env = { domain = env.domain ; ground = env.ground } + let compute seq = let n = Array.length seq in let lhs = Array.make n Tmap.empty in let rhs = Array.make n Tmap.empty in - let env = { ground = Tmap.empty ; domain = Tmap.empty } in + let env = top () in for i = 0 to n-2 do seq.(i) <- assume env seq.(i) ; lhs.(succ i) <- env.domain ; @@ -129,6 +172,24 @@ struct ignore (assume env p) ; subst env.domain + let branch env p = + let p = p_apply env p in + let wa = copy env in + let wb = copy env in + ignore (assume wa p) ; + ignore (assume wb (F.p_not p)) ; + p , wa , wb + + let forward env p = + match F.p_expr p with + | And ps -> F.p_all (assume env) ps + | _ -> assume env p + + let backward env p = + match F.p_expr p with + | And ps -> F.p_all (assume env) (List.rev ps) + | _ -> assume env p + end (* -------------------------------------------------------------------------- *) @@ -442,12 +503,7 @@ struct let rec defs w p = match F.repr p with | And ps -> List.iter (defs w) ps - | Eq(a,b) -> - begin - match F.QED.congruence_eq a b with - | None -> defs_eq w a b - | Some eqs -> List.iter (fun (a,b) -> defs_eq w a b) eqs - end + | Eq(a,b) -> defs_eq w a b | Not p -> begin match F.repr p with diff --git a/src/plugins/wp/Letify.mli b/src/plugins/wp/Letify.mli index e163458103f545a763217cc1ff1a6cdeacc77bcb..211bec0199844fcb23e9195ee40e964e8ebc2ec9 100644 --- a/src/plugins/wp/Letify.mli +++ b/src/plugins/wp/Letify.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -28,9 +28,23 @@ open Lang.F module Ground : sig + type subst = pred -> pred val singleton : pred -> subst val compute : pred array -> subst array * subst + + type env + val pretty : Format.formatter -> env -> unit + val top : unit -> env + val copy : env -> env + + val e_apply : env -> term -> term + val p_apply : env -> pred -> pred + + val forward : env -> pred -> pred + val backward : env -> pred -> pred + val branch : env -> pred -> pred * env * env + end module Sigma : diff --git a/src/plugins/wp/LogicAssigns.ml b/src/plugins/wp/LogicAssigns.ml index cdf1e55e64c86c0d468dc2a868115476caebc2ec..93a1a1754a12d3677568b3e8abc1686132297811 100644 --- a/src/plugins/wp/LogicAssigns.ml +++ b/src/plugins/wp/LogicAssigns.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/LogicAssigns.mli b/src/plugins/wp/LogicAssigns.mli index 1a8e0179e7afafd1a1d6a3dad2524c6ddfc177cc..5da2cd0061b8ef566c79b4436b4746ecc629278a 100644 --- a/src/plugins/wp/LogicAssigns.mli +++ b/src/plugins/wp/LogicAssigns.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/LogicBuiltins.ml b/src/plugins/wp/LogicBuiltins.ml index 5fc6438201b9d6f5220ac44b0cba83a8030ac638..34a4e63d8827582dd01ebe58884e30b10e8bf74d 100644 --- a/src/plugins/wp/LogicBuiltins.ml +++ b/src/plugins/wp/LogicBuiltins.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -212,7 +212,7 @@ let add_ctor name kinds ~library ~link () = register name kinds (LFUN lfun) let add_type name ~library ?(link=Lang.infoprover name) () = - Lang.builtin_type ~name ~library ~link + ignore (Lang.builtin_type ~name ~library ~link) let sanitizers = Hashtbl.create 10 diff --git a/src/plugins/wp/LogicBuiltins.mli b/src/plugins/wp/LogicBuiltins.mli index a9c78a555bdb899e27e1fe93acd79285598e3def..dfb13269c07f074625ff8951296be650a1867c92 100644 --- a/src/plugins/wp/LogicBuiltins.mli +++ b/src/plugins/wp/LogicBuiltins.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/LogicCompiler.ml b/src/plugins/wp/LogicCompiler.ml index 6c58353d965b7206e83c9bd15b908e38f50d7297..9688928452229bbd2ed43eba80ed7fa2d8a8d517 100644 --- a/src/plugins/wp/LogicCompiler.ml +++ b/src/plugins/wp/LogicCompiler.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -35,6 +35,8 @@ open Lang.F open Memory open Definitions +let dkey_lemma = Wp_parameters.register_category "lemma" + type polarity = [ `Positive | `Negative | `NoPolarity ] module Make( M : Memory.Model ) = @@ -676,7 +678,7 @@ struct let define_type = Definitions.define_type let define_logic c a = Signature.compile (compile_logic c a) let define_lemma c l = - if l.lem_labels <> [] && Wp_parameters.has_dkey "lemma" then + if l.lem_labels <> [] && Wp_parameters.has_dkey dkey_lemma then Wp_parameters.warning ~source:l.lem_position "Lemma '%s' has labels, consider using global invariant instead." l.lem_name ; @@ -724,22 +726,23 @@ struct (* --- Binding Formal with Actual w.r.t Signature --- *) (* -------------------------------------------------------------------------- *) - let rec bind_labels env labels : M.Sigma.t LabelMap.t = - match labels with - | [] -> LabelMap.empty - | (l1,l2) :: labels -> + let rec bind_labels env phi_labels labels : M.Sigma.t LabelMap.t = + match phi_labels, labels with + | [], [] -> LabelMap.empty + | l1 :: phi_labels, l2 :: labels -> let l1 = Clabels.c_label l1 in let l2 = Clabels.c_label l2 in - LabelMap.add l1 (mem_at env l2) (bind_labels env labels) + LabelMap.add l1 (mem_at env l2) (bind_labels env phi_labels labels) + | _ -> Wp_parameters.fatal "Incorrect by AST typing" let call_params env (phi:logic_info) - (labels:(logic_label * logic_label) list) + (labels:logic_label list) (sparam : sig_param list) (parameters:F.term list) : F.term list = let mparams = wrap_lvar phi.l_profile parameters in - let mlabels = bind_labels env labels in + let mlabels = bind_labels env phi.l_labels labels in List.map (function | Sig_value lv -> Logic_var.Map.find lv mparams @@ -754,7 +757,7 @@ struct let call_fun env (phi:logic_info) - (labels:(logic_label * logic_label) list) + (labels:logic_label list) (parameters:F.term list) : F.term = match signature phi with | CST c -> e_zint c @@ -764,7 +767,7 @@ struct let call_pred env (phi:logic_info) - (labels:(logic_label * logic_label) list) + (labels:logic_label list) (parameters:F.term list) : F.pred = match signature phi with | CST _ -> assert false diff --git a/src/plugins/wp/LogicCompiler.mli b/src/plugins/wp/LogicCompiler.mli index 9a0090d6ce6b8c662bde1fa5b36970380d64affd..0bb70caf821c3e1d529d7177b76be8bbd976de5e 100644 --- a/src/plugins/wp/LogicCompiler.mli +++ b/src/plugins/wp/LogicCompiler.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -97,11 +97,11 @@ sig (** {3 Application} *) val call_fun : env -> logic_info - -> (logic_label * logic_label) list + -> logic_label list -> F.term list -> F.term val call_pred : env -> logic_info - -> (logic_label * logic_label) list + -> logic_label list -> F.term list -> F.pred (** {3 Logic Variable and ACSL Constants} *) diff --git a/src/plugins/wp/LogicSemantics.ml b/src/plugins/wp/LogicSemantics.ml index e4bd04e14ecabce78fff7b0e15ab3b33ea80e4a4..c0f4852f71cc8dac09fe0fd82cfe8299c8765a33 100644 --- a/src/plugins/wp/LogicSemantics.ml +++ b/src/plugins/wp/LogicSemantics.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -22,6 +22,8 @@ (* -------------------------------------------------------------------------- *) (* --- ACSL Translation --- *) +(* --- LogicSemantics and LogicCompiler are mutually recursive (cycle --- *) +(* --- closed by "boostrap*" function --- *) (* -------------------------------------------------------------------------- *) open Cil_types @@ -438,7 +440,7 @@ struct let rec cvsort_of_type t = match Logic_utils.unroll_type t with - | Ltype({lt_name="set"},[t]) -> cvsort_of_type t + | Ltype({lt_name="set"},[t]) -> (cvsort_of_type t) | Ltype _ as b when Logic_const.is_boolean_type b -> L_bool | Linteger -> L_integer | Lreal -> L_real @@ -455,6 +457,29 @@ struct | _ -> Warning.error "cast from (%a) not implemented yet" Printer.pp_logic_type t + (** cast to a logic type *) + let term_logic_cast env typ t = + match cvsort_of_type typ , cvsort_of_type t.term_type with + | L_integer, L_real -> + L.map Cint.integer_of_real (C.logic env t) + | L_real, L_integer -> + L.map Cfloat.real_of_int (C.logic env t) + | L_cfloat f, L_real -> + L.map (Cfloat.float_of_real f) (C.logic env t) + | L_real, L_cfloat f -> + L.map (Cfloat.real_of_float f) (C.logic env t) + | L_cint i, L_real -> + L.map (Cint.of_real i) (C.logic env t) + | L_real, L_cint _ -> + L.map (fun x -> Cfloat.real_of_int (Cint.to_integer x)) (C.logic env t) + | L_integer, L_cint _ -> + L.map Cint.to_integer (C.logic env t) + | L_cint i, L_integer -> + L.map (Cint.of_integer i) (C.logic env t) + | _ -> + C.logic env t + + (** cast to a C type *) let term_cast env typ t = match Ctypes.object_of typ , cvsort_of_type t.term_type with | C_int i , L_cint i0 -> @@ -467,8 +492,11 @@ struct L.map_l2t (M.int_of_loc i) (C.logic env t) | C_int i , (L_cfloat _ | L_real) -> L.map (Cint.of_real i) (C.logic env t) - | C_float f , (L_cfloat _ | L_real) -> - L.map (Cfloat.convert f) (C.logic env t) + | C_float f , L_real -> + L.map (Cfloat.float_of_real f) (C.logic env t) + | C_float ft, L_cfloat ff -> + let map v = if Ctypes.equal_float ff ft then v else Cfloat.float_of_real ft (Cfloat.real_of_float ff v) in + L.map map (C.logic env t) | C_float f , (L_cint _ | L_integer) -> L.map (Cfloat.float_of_int f) (C.logic env t) | C_pointer ty , L_pointer t0 -> @@ -484,9 +512,10 @@ struct | C_int _ , L_bool -> L.map Cvalues.bool_val (C.logic env t) | _ -> - Warning.error "Cast from (%a) to (%a) not implemented yet" + Warning.error "@[Cast from (%a) to (%a) not implemented yet@]" Printer.pp_logic_type t.term_type Printer.pp_typ typ + (* -------------------------------------------------------------------------- *) (* --- Environment Binding --- *) (* -------------------------------------------------------------------------- *) @@ -507,16 +536,27 @@ struct acc [] env [] qs (* -------------------------------------------------------------------------- *) - (* --- Term Nodes --- *) + (* --- Undefined Term --- *) (* -------------------------------------------------------------------------- *) - let rec term_node (env:env) t = + let term_undefined t = + let x = Lang.freshvar ~basename:"w" (Lang.tau_of_ltype t.term_type) in + Cvalues.plain t.term_type (e_var x) + + (* -------------------------------------------------------------------------- *) + (* --- Term Nodes --- *) + (* -------------------------------------------------------------------------- *) + let term_node (env:env) t = match t.term_node with | TConst c -> Vexp (Cvalues.logic_constant c) | TSizeOf _ | TSizeOfE _ | TSizeOfStr _ | TAlignOf _ | TAlignOfE _ -> Vexp (Cvalues.constant_term t) - | TLval lval -> term_lval env lval + | TLval lval -> + if Cil.isVolatileTermLval lval && + Cvalues.volatile ~warn:"unsafe volatile access to (term) l-value" () + then term_undefined t + else term_lval env lval | TAddrOf lval | TStartOf lval -> addr_lval env lval | TUnOp(Neg,t) when not (Logic_typing.is_integral_type t.term_type) -> @@ -620,7 +660,7 @@ struct | Ttypeof _ | Ttype _ -> Warning.error "Type tag not implemented yet" - | TLogic_coerce(_,t) -> term_node env t + | TLogic_coerce(typ,t) -> term_logic_cast env typ t (* -------------------------------------------------------------------------- *) (* --- Separated --- *) @@ -808,13 +848,9 @@ struct (* --- Protection --- *) (* -------------------------------------------------------------------------- *) - let term_handler t = - let x = Lang.freshvar ~basename:"w" (Lang.tau_of_ltype t.term_type) in - Cvalues.plain t.term_type (e_var x) - let term_protected env t = Warning.handle - ~handler:term_handler + ~handler:term_undefined ~severe:false ~effect:"Hide sub-term definition" (term_node env) t diff --git a/src/plugins/wp/LogicSemantics.mli b/src/plugins/wp/LogicSemantics.mli index 3211d374ebedcb1a40f8cd7323085bd74109b549..6b93426a3b45935ca74b50d608027aaa90151f79 100644 --- a/src/plugins/wp/LogicSemantics.mli +++ b/src/plugins/wp/LogicSemantics.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -83,8 +83,8 @@ sig val term : env -> Cil_types.term -> term val pred : polarity -> env -> Cil_types.predicate -> pred val region : env -> Cil_types.term -> region - val assigns : env -> identified_term assigns -> (c_object * region) list option - val assigns_from : env -> identified_term from list -> (c_object * region) list + val assigns : env -> assigns -> (c_object * region) list option + val assigns_from : env -> from list -> (c_object * region) list val val_of_term : env -> Cil_types.term -> term val loc_of_term : env -> Cil_types.term -> loc diff --git a/src/plugins/wp/LogicUsage.ml b/src/plugins/wp/LogicUsage.ml index 23965d520aff5720c26503abbbb56d7d972d9d05..4786152fd81b39de587b6a97ddfacbbd3183bc1f 100644 --- a/src/plugins/wp/LogicUsage.ml +++ b/src/plugins/wp/LogicUsage.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -273,7 +273,7 @@ let register_cases l inds = Then: ( A \in calls[B] ). *) -let add_call calls (l_a,l_b) = +let add_call calls l_a l_b = let a = Clabels.c_label l_a in let b = Clabels.c_label l_b in let s = @@ -315,7 +315,7 @@ class visitor = match inductive with | Some case -> if Logic_info.equal l case.ind_logic then - case.ind_call <- List.fold_left add_call case.ind_call labels + case.ind_call <- List.fold_left2 add_call case.ind_call l.l_labels labels | None -> match caller with | None -> () diff --git a/src/plugins/wp/LogicUsage.mli b/src/plugins/wp/LogicUsage.mli index 1f374e893c2887030ece9b486bcbaa9882465cf0..09d01882a741d349f0050027700c12f88d0fef02 100644 --- a/src/plugins/wp/LogicUsage.mli +++ b/src/plugins/wp/LogicUsage.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Makefile.in b/src/plugins/wp/Makefile.in index 88d135f6948749f75bf82c6281a1084896d8f4cc..1d331542e21d9524b86388db3ab82b93a2ce1510 100644 --- a/src/plugins/wp/Makefile.in +++ b/src/plugins/wp/Makefile.in @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # @@ -54,7 +54,6 @@ PLUGIN_GUI_CMO:= \ endif PLUGIN_ENABLE:=@ENABLE_WP@ -PLUGIN_DYNAMIC:=@DYNAMIC_WP@ PLUGIN_NAME:=Wp PLUGIN_CMO:= \ rformat wprop \ @@ -64,9 +63,9 @@ PLUGIN_CMO:= \ LogicUsage RefUsage \ cil2cfg normAtLabels wpPropId mcfg \ Context Warning Model Lang Repr Matrix Passive Splitter \ - Letify Cleaning \ LogicBuiltins Definitions \ Cint Cfloat Vset Vlist Region Cstring Cvalues \ + Letify Cleaning \ Memory Mstate Conditions \ Filtering \ Plang Pcfg Pcond \ @@ -82,7 +81,8 @@ PLUGIN_CMO:= \ TacArray TacCompound TacUnfold \ TacHavoc TacInstance TacLemma \ TacFilter TacCut WpTac TacNormalForm \ - TacRewrite Auto \ + TacRewrite TacBitwised TacBitrange TacShift \ + TacRatio TacOverflow Auto \ ProofSession ProofScript ProofEngine \ why3_xml \ ProverTask ProverErgo ProverCoq ProverWhy3 ProverWhy3ide \ @@ -153,7 +153,7 @@ PLUGIN_DISTRIB_EXTERNAL+= $(QED_DISTRIB_SRC) PLUGIN_TESTS_DIRS:= \ wp wp_plugin wp_acsl wp_bts \ wp_store wp_hoare wp_typed wp_usage \ - wp_gallery + wp_gallery wp_manual # -------------------------------------------------------------------------- # --- Dynamic Plugin --- diff --git a/src/plugins/wp/Matrix.ml b/src/plugins/wp/Matrix.ml index f122047939115f133e58a77f89e32a1149812c16..b631102de0ed5b11a4515374d4d816730c6f8f46 100644 --- a/src/plugins/wp/Matrix.ml +++ b/src/plugins/wp/Matrix.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Matrix.mli b/src/plugins/wp/Matrix.mli index fac751ad550460bfc2d09ca73523326c821db327..5056030b012e31f4ca04c7be8a2ea195b71ab4e3 100644 --- a/src/plugins/wp/Matrix.mli +++ b/src/plugins/wp/Matrix.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/MemEmpty.ml b/src/plugins/wp/MemEmpty.ml index aece001004b716074a39a473d66136b0fe6c38d5..9dfb84261fc33d719d4841a1cdf4dc97dd91c00b 100644 --- a/src/plugins/wp/MemEmpty.ml +++ b/src/plugins/wp/MemEmpty.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/MemEmpty.mli b/src/plugins/wp/MemEmpty.mli index 6e75e8cfdbda839e174b212e08ab10de98ebd333..31b357bf5a97d1dac7a535e4ff0f11d8331a36bf 100644 --- a/src/plugins/wp/MemEmpty.mli +++ b/src/plugins/wp/MemEmpty.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/MemTyped.ml b/src/plugins/wp/MemTyped.ml index 3b5e4fb2b1604becbd5083bd4c2140318d42aab5..8b7c22346c448ddd63b86cb21d644b10c25d0470 100644 --- a/src/plugins/wp/MemTyped.ml +++ b/src/plugins/wp/MemTyped.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -32,6 +32,9 @@ open Lang.F open Memory open Definitions +let dkey_layout = Wp_parameters.register_category "layout" + + module L = Qed.Logic let datatype = "MemTyped" @@ -936,9 +939,11 @@ let literal ~eid cst = shift (a_global (STRING.get (eid,cst))) (C_int (Ctypes.c_char ())) e_zero let cvar x = let base = a_global (BASE.get x) in - if Cil.isArrayType x.vtype || Cil.isPointerType x.vtype then - shift base (Ctypes.object_of x.vtype) e_zero + if Cil.isArrayType x.vtype then + let t_elt = Cil.typeOf_array_elem x.vtype in + shift base (Ctypes.object_of t_elt) e_zero else base + let pointer_loc t = t let pointer_val t = t @@ -1100,7 +1105,7 @@ end let pp_mismatch fmt s = - if Context.get pointer <> NoCast && Wp_parameters.has_dkey "layout" then + if Context.get pointer <> NoCast && Wp_parameters.has_dkey dkey_layout then Format.fprintf fmt "Cast with incompatible pointers types@\n\ @[@[Source: %a*@]@ @[(layout: %a)@]@]@\n\ diff --git a/src/plugins/wp/MemTyped.mli b/src/plugins/wp/MemTyped.mli index 2eadc2d8a58e49c701c44a2d2a13ba6a70377e88..486fcf7f79548f372468e40f4995842a3798a42b 100644 --- a/src/plugins/wp/MemTyped.mli +++ b/src/plugins/wp/MemTyped.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/MemVar.ml b/src/plugins/wp/MemVar.ml index 4e526405f43d1aa97eda9705a54f77a508010a86..d6d2fbc8cfe276b5da4c284c4dbf5699f06cd1f1 100644 --- a/src/plugins/wp/MemVar.ml +++ b/src/plugins/wp/MemVar.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -1009,8 +1009,26 @@ struct | Field f -> Dfield f | Shift(_,k) -> let u = Some k in Drange(u,u) - let delta ofs = List.map dofs ofs - + let tofs = function + | Field d -> Ctypes.object_of d.ftype + | Shift(elt,_) -> elt + + let rec dstartof dim = function + | C_array arr -> + let n = match arr.arr_flat with None -> 1 | Some a -> a.arr_dim in + if n > dim then + let u = Some e_zero in + let elt = Ctypes.object_of arr.arr_element in + Drange(u,u) :: dstartof dim elt + else [] + | _ -> [] + + let rec doffset obj host = function + | d::ds -> dofs d :: (doffset obj (tofs d) ds) + | [] -> dstartof (Ctypes.get_array_dim obj) host + + let delta obj x ofs = doffset obj (Ctypes.object_of x.vtype) ofs + let rec range ofs obj a b = match ofs with | [] -> [ Drange(a,b) ] @@ -1024,14 +1042,16 @@ struct | Rrange(Ref x,_,_,_) -> noref ~op:"sub-range of" x | Rloc(obj,Loc l) -> Lseg (Rloc(obj,l)) - | Rloc(_,Val((CVAL|CREF),x,ofs)) -> Fseg(x,delta ofs) + | Rloc(obj,Val((CVAL|CREF),x,ofs)) -> + Fseg(x,delta obj x ofs) | Rrange(Loc l,obj,a,b) -> Lseg (Rrange(l,obj,a,b)) - | Rrange(Val((CVAL|CREF),x,ofs),obj,a,b) -> Fseg(x,range ofs obj a b) + | Rrange(Val((CVAL|CREF),x,ofs),obj,a,b) -> + Fseg(x,range ofs obj a b) (* in M: *) | Rloc(obj,Val((CTXT|CARR|HEAP) as m,x,ofs)) -> - Mseg(Rloc(obj,mloc_of_path m x ofs),x,delta ofs) + Mseg(Rloc(obj,mloc_of_path m x ofs),x,delta obj x ofs) | Rrange(Val((CTXT|CARR|HEAP) as m,x,ofs),obj,a,b) -> Mseg(Rrange(mloc_of_path m x ofs,obj,a,b),x,range ofs obj a b) diff --git a/src/plugins/wp/MemVar.mli b/src/plugins/wp/MemVar.mli index 5bec6a9b9f3cb43b242548bb7a0bafe68b17492d..a32a812b79276c1cdcb27cef48e19d3e3b56ca2e 100644 --- a/src/plugins/wp/MemVar.mli +++ b/src/plugins/wp/MemVar.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/MemZeroAlias.ml b/src/plugins/wp/MemZeroAlias.ml index 7c9c27b922603083a31e5b733eba75c16d09dfbe..f5b24a5c4f8e1c2ea34ce6714ba623b3a90baf34 100644 --- a/src/plugins/wp/MemZeroAlias.ml +++ b/src/plugins/wp/MemZeroAlias.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/MemZeroAlias.mli b/src/plugins/wp/MemZeroAlias.mli index 6e75e8cfdbda839e174b212e08ab10de98ebd333..31b357bf5a97d1dac7a535e4ff0f11d8331a36bf 100644 --- a/src/plugins/wp/MemZeroAlias.mli +++ b/src/plugins/wp/MemZeroAlias.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Memory.ml b/src/plugins/wp/Memory.ml index bf237d6c3f98a547fb7dff0a83bb9cb111538462..4374443dbf23208706a2fbe5b7981af5435ba7df 100644 --- a/src/plugins/wp/Memory.ml +++ b/src/plugins/wp/Memory.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Model.ml b/src/plugins/wp/Model.ml index ea5065395a249fe6956fa4af9c5e6837e21966c1..2319b8ee2bc9f2cae60f890495210bb8ac7c38fa 100644 --- a/src/plugins/wp/Model.ml +++ b/src/plugins/wp/Model.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Model.mli b/src/plugins/wp/Model.mli index 6051600e5cc82aac61d5565bd828223bbb75af96..c021dbf13bc29cc87d057b2ff41a68c5d4e3a5ea 100644 --- a/src/plugins/wp/Model.mli +++ b/src/plugins/wp/Model.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Mstate.ml b/src/plugins/wp/Mstate.ml index 02a37d3c052d0179a34726c7c18d549f92f84099..ee075c122b34235f4dfc5347e59f2b13797a92f8 100644 --- a/src/plugins/wp/Mstate.ml +++ b/src/plugins/wp/Mstate.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Mstate.mli b/src/plugins/wp/Mstate.mli index f1468685088a8867918b3c09c14a7dc3a6026407..e89d7a0026940f362bbe148c898008363726dd1d 100644 --- a/src/plugins/wp/Mstate.mli +++ b/src/plugins/wp/Mstate.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Partitioning.ml b/src/plugins/wp/Partitioning.ml index 83f5116e0583bcb203ec6d7610517a867585ff2c..89ca64504e4cc93395ce2c1c5de7991a90fc1eaa 100644 --- a/src/plugins/wp/Partitioning.ml +++ b/src/plugins/wp/Partitioning.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Partitioning.mli b/src/plugins/wp/Partitioning.mli index ec5e01c5366b32f35de87341c74587e2d61a988f..bd2a37e94380ffc0cecf9a8fff4529a4bd3c5ae4 100644 --- a/src/plugins/wp/Partitioning.mli +++ b/src/plugins/wp/Partitioning.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Passive.ml b/src/plugins/wp/Passive.ml index bdc6c5a8eea9e63021f4ee47e281286ea8d59c18..92696a618f7c2dd1adb4c493beaa8794aedaf157 100644 --- a/src/plugins/wp/Passive.ml +++ b/src/plugins/wp/Passive.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Passive.mli b/src/plugins/wp/Passive.mli index 6f4f84ab9e002687f0c2ae7c75e883cea90b43bb..54b29b6b26b3f7512c280434324f246b6abd576a 100644 --- a/src/plugins/wp/Passive.mli +++ b/src/plugins/wp/Passive.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Pcfg.ml b/src/plugins/wp/Pcfg.ml index 0ba493f19744dfda9367e44c13513039f69ffd3e..028e348fec1d037819b1e96a2b1c599165162169 100644 --- a/src/plugins/wp/Pcfg.ml +++ b/src/plugins/wp/Pcfg.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Pcfg.mli b/src/plugins/wp/Pcfg.mli index 938c11690f56822f601c04918c0366cbcfa32c58..6ded5dcc038e496975ace99da1c0fdc787599f42 100644 --- a/src/plugins/wp/Pcfg.mli +++ b/src/plugins/wp/Pcfg.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Pcond.ml b/src/plugins/wp/Pcond.ml index 17fc90f07663a65ef24971e49d671a3eb5ee529c..f0714c7b63f390bc75a8cbd43f8e3f6c01d57420 100644 --- a/src/plugins/wp/Pcond.ml +++ b/src/plugins/wp/Pcond.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -26,6 +26,8 @@ module F = Lang.F module Env = Plang.Env open F +let dkey_state = Wp_parameters.register_category "state" + type env = Plang.Env.t let rec alloc_hyp pool f seq = @@ -435,7 +437,7 @@ class sequence (lang : #state) = (* -------------------------------------------------------------------------- *) let engine () = - if Wp_parameters.has_dkey "state" then + if Wp_parameters.has_dkey dkey_state then ( new sequence (new state) :> engine ) else new engine (new Plang.engine) @@ -443,6 +445,8 @@ let engine () = let pretty fmt seq = (engine())#pp_sequent fmt seq +let () = Conditions.pretty := pretty + let sequence ?(clause="Sequence") fmt seq = let plang = new Plang.engine in let pcond = new engine plang in diff --git a/src/plugins/wp/Pcond.mli b/src/plugins/wp/Pcond.mli index d5d6b81e0dce63d1a423d57a3109c9b83f549b33..77cf0ed91bb82bd0ca0e3fb1bae778624da8c836 100644 --- a/src/plugins/wp/Pcond.mli +++ b/src/plugins/wp/Pcond.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Plang.ml b/src/plugins/wp/Plang.ml index 8457cb8cc6eda24270cace1e96fb57c4af7eb96d..4bc1a1889ecf685694e6bb4f40bdeeb9fe4a356e 100644 --- a/src/plugins/wp/Plang.ml +++ b/src/plugins/wp/Plang.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Plang.mli b/src/plugins/wp/Plang.mli index a8ffdf1d6c3f7b9a35c2bf65f4a5955d1efadebd..7ba7068616873845f5bcf574f4f6e03858ff41ea 100644 --- a/src/plugins/wp/Plang.mli +++ b/src/plugins/wp/Plang.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/PrecisionLoss.mli b/src/plugins/wp/PrecisionLoss.mli index c72ffc7db435a5d231fd5ff116c872f5b82bfe19..67aac743cc48c01901f6411c655b44f9047b16fc 100644 --- a/src/plugins/wp/PrecisionLoss.mli +++ b/src/plugins/wp/PrecisionLoss.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProofEngine.ml b/src/plugins/wp/ProofEngine.ml index 47259318b872cfb2b6f1a56e9d7a60d04221b6a8..038aa1471d4c3b1e1e65f510cda7910a6ddd371b 100644 --- a/src/plugins/wp/ProofEngine.ml +++ b/src/plugins/wp/ProofEngine.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProofEngine.mli b/src/plugins/wp/ProofEngine.mli index 5a8741425f9d49c03b1dee4005714c3a5a1d4dce..bfce362b374bcc852ab4e9738312c22e7e4a438c 100644 --- a/src/plugins/wp/ProofEngine.mli +++ b/src/plugins/wp/ProofEngine.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProofScript.ml b/src/plugins/wp/ProofScript.ml index f93e19040783573f86514b56c46d05a83ec63804..5d427185956b88a54b68e695a1f74e52730c0fb9 100644 --- a/src/plugins/wp/ProofScript.ml +++ b/src/plugins/wp/ProofScript.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProofScript.mli b/src/plugins/wp/ProofScript.mli index 0aecf5d8af83b1b09aa7fcdc1b07e8087a210497..ab43494b26349542e705cc94c0e06cfe35f8d471 100644 --- a/src/plugins/wp/ProofScript.mli +++ b/src/plugins/wp/ProofScript.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProofSession.ml b/src/plugins/wp/ProofSession.ml index f19f1762f3b1861bb28c30a12731aa103b535472..0a9b2a73c28206b907ada26567d9cf451d0ca241 100644 --- a/src/plugins/wp/ProofSession.ml +++ b/src/plugins/wp/ProofSession.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProofSession.mli b/src/plugins/wp/ProofSession.mli index b431f666ee056835eefb7cff1bf4e04b67f981c0..5663660df70d9141575f56d80d88280a57908731 100644 --- a/src/plugins/wp/ProofSession.mli +++ b/src/plugins/wp/ProofSession.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverCoq.ml b/src/plugins/wp/ProverCoq.ml index 8589a7952971517e6445ae8bfb6224485eef67c9..7f4ac753405713bc961d47a8c2f353cf2d1dd1f3 100644 --- a/src/plugins/wp/ProverCoq.ml +++ b/src/plugins/wp/ProverCoq.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -210,9 +210,14 @@ class visitor fmt c = | Rec -> engine#declare_fixpoint ~prefix:"Fix" | Def -> engine#declare_definition in pp fmt d.d_lfun d.d_params Logic.Prop (F.e_prop p) - | Inductive _ -> - engine#declare_signature fmt + | Inductive dl -> + engine#declare_inductive fmt d.d_lfun (List.map F.tau_of_var d.d_params) Logic.Prop + (List.map (fun l -> (Lang.lemma_id l.l_name, + l.l_forall, + l.l_triggers, + (F.e_prop l.l_lemma)) + ) dl) end end @@ -220,16 +225,17 @@ class visitor fmt c = let write_cluster c = let f = cluster_file c in Wp_parameters.debug ~dkey "Generate '%s'" f ; - Command.print_file f - begin fun fmt -> - let v = new visitor fmt c in - v#lines ; - v#printf "Require Import ZArith.@\n" ; - v#printf "Require Import Reals.@\n" ; - v#on_library "qed" ; - v#vself ; - v#flush ; - end + let deps = Command.print_file f + begin fun fmt -> + let v = new visitor fmt c in + v#lines ; + v#printf "Require Import ZArith.@\n" ; + v#printf "Require Import Reals.@\n" ; + v#on_library "qed" ; + v#vself ; + v#flush ; + end + in Wp_parameters.print_generated f ; deps (* -------------------------------------------------------------------------- *) (* --- Assembling Goal --- *) @@ -381,10 +387,10 @@ class runcoq includes source = let base = Filename.chop_extension source in let logout = base ^ "_Coq.out" in let logerr = base ^ "_Coq.err" in - object(coq) + object(self) inherit ProverTask.command "coq" - + method private project = let dir = Filename.dirname source in let p = Wp_parameters.CoqProject.get () in @@ -405,11 +411,11 @@ class runcoq includes source = List.iter (fun (dir,name) -> if name = "" then - coq#add ["-R";dir;""] + self#add ["-R";dir;""] else - coq#add ["-R";dir;name] + self#add ["-R";dir;name] ) includes ; - coq#add [ "-noglob" ] ; + self#add [ "-noglob" ] ; end method failed : 'a. 'a task = @@ -426,54 +432,54 @@ class runcoq includes source = method compile = let cmd = Wp_parameters.CoqCompiler.get () in - coq#set_command cmd ; - coq#options ; - coq#add [ source ] ; - coq#timeout (coq_timeout ()) ; + self#set_command cmd ; + self#options ; + self#add [ source ] ; + self#timeout (coq_timeout ()) ; Task.call (fun () -> if not (Wp_parameters.Check.get ()) then let name = Filename.basename source in Wp_parameters.feedback ~ontty:`Transient "[Coq] Compiling '%s'." name) () - >>= coq#run ~logout ~logerr + >>= self#run ~logout ~logerr >>= fun r -> if r = 127 then Task.failed "Command '%s' not found" cmd - else if r <> 0 then coq#failed + else if r <> 0 then self#failed else Task.return () method check = let cmd = Wp_parameters.CoqCompiler.get () in - coq#set_command cmd ; - coq#options ; - coq#add [ source ] ; - coq#timeout (coq_timeout ()) ; - coq#run ~logout ~logerr () >>= function + self#set_command cmd ; + self#options ; + self#add [ source ] ; + self#timeout (coq_timeout ()) ; + self#run ~logout ~logerr () >>= function | 127 -> Task.failed "Command '%s' not found" cmd | 0 -> Task.return true | 1 -> Task.return false - | _ -> coq#failed + | _ -> self#failed method script = let script = Wp_parameters.Script.get () in - if Sys.file_exists script then coq#add [ script ] + if Sys.file_exists script then self#add [ script ] method coqide = let coqide = Wp_parameters.CoqIde.get () in - coq#set_command coqide ; + self#set_command coqide ; if is_emacs coqide then begin - coq#project ; - coq#script ; - coq#add [ source ] ; + self#project ; + self#script ; + self#add [ source ] ; end else begin - coq#options ; - coq#add [ source ] ; - coq#script ; + self#options ; + self#add [ source ] ; + self#script ; end ; - Task.sync coqide_lock (coq#run ~logout ~logerr) + Task.sync coqide_lock (self#run ~logout ~logerr) end (* -------------------------------------------------------------------------- *) @@ -621,6 +627,13 @@ let prove_session ~mode w = exception Admitted_not_proved +let gen_session w = + begin + make_script w " ...\n" "Qed." ; + Wp_parameters.print_generated w.cw_script ; + Task.return VCS.no_result + end + let check_session w = compile_headers w.cw_includes false w.cw_headers >>= (fun () -> check_script w) >>> function @@ -630,9 +643,12 @@ let check_session w = Task.raised Admitted_not_proved let prove_session ~mode w = - if Wp_parameters.Check.get () - then check_session w - else prove_session ~mode w + if Wp_parameters.Generate.get () then + gen_session w + else if Wp_parameters.Check.get () then + check_session w + else + prove_session ~mode w let prove_prop wpo ~mode ~axioms ~prop = let pid = wpo.po_pid in @@ -642,17 +658,14 @@ let prove_prop wpo ~mode ~axioms ~prop = let includes , headers , goal = Model.with_model model (assemble_goal ~pid axioms) prop in - Wp_parameters.print_generated script; - if Wp_parameters.Generate.get () - then Task.return VCS.no_result - else prove_session ~mode { - cw_pid = pid ; - cw_gid = gid ; - cw_goal = goal ; - cw_script = script ; - cw_headers = headers ; - cw_includes = includes ; - } + prove_session ~mode { + cw_pid = pid ; + cw_gid = gid ; + cw_goal = goal ; + cw_script = script ; + cw_headers = headers ; + cw_includes = includes ; + } let prove_annot wpo vcq ~mode = Task.todo diff --git a/src/plugins/wp/ProverCoq.mli b/src/plugins/wp/ProverCoq.mli index f443a72517fafadbf2de535fe640bf872bb2b307..8be509beab0b7553351d484335a8b162cb9f8d3f 100644 --- a/src/plugins/wp/ProverCoq.mli +++ b/src/plugins/wp/ProverCoq.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverErgo.ml b/src/plugins/wp/ProverErgo.ml index c56171a72e2f4713e1c94614237b4c246f52b1e9..ee36bdc4fa41dfa30359e138697b9211689b7370 100644 --- a/src/plugins/wp/ProverErgo.ml +++ b/src/plugins/wp/ProverErgo.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -30,6 +30,7 @@ open Lang open Definitions let dkey = Wp_parameters.register_category "prover" +let dkey_cluster = Wp_parameters.register_category "cluster" let option_file = LogicBuiltins.create_option (fun ~driver_dir x -> Filename.concat driver_dir x) @@ -208,9 +209,10 @@ class visitor fmt c = | Predicate(_,p) -> engine#declare_definition fmt d.d_lfun d.d_params Logic.Prop (F.e_prop p) - | Inductive _ -> + | Inductive ds -> engine#declare_signature fmt - d.d_lfun (List.map F.tau_of_var d.d_params) Logic.Prop + d.d_lfun (List.map F.tau_of_var d.d_params) Logic.Prop; + List.iter self#on_dlemma ds end end @@ -226,7 +228,7 @@ let write_cluster c job = v#flush end in - if Wp_parameters.has_dkey "cluster" then + if Wp_parameters.has_dkey dkey_cluster then Log.print_on_output begin fun fmt -> Format.fprintf fmt "---------------------------------------------@\n" ; diff --git a/src/plugins/wp/ProverErgo.mli b/src/plugins/wp/ProverErgo.mli index 05d7ffe8c259192750b837e81279f193845ff48e..429715122d86f269336a54b09b98787c830b1bdb 100644 --- a/src/plugins/wp/ProverErgo.mli +++ b/src/plugins/wp/ProverErgo.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverScript.ml b/src/plugins/wp/ProverScript.ml index 26ddc055b3eaabaa4bea21ecf0230074ff3efeb9..cd149273e2d83782aaadf0942c44d9491a6f2933 100644 --- a/src/plugins/wp/ProverScript.ml +++ b/src/plugins/wp/ProverScript.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -276,8 +276,30 @@ let spawn (* --- Save Session --- *) (* -------------------------------------------------------------------------- *) +let proofs = Hashtbl.create 32 +let has_proof wpo = + let wid = wpo.Wpo.po_gid in + try Hashtbl.find proofs wid + with Not_found -> + if ProofSession.exists wpo then + let ok = + try + let script = ProofScript.decode (ProofSession.load wpo) in + ProofScript.status script = 0 + with _ -> false in + (Hashtbl.add proofs wid ok ; ok) + else false + let save wpo = let script = ProofEngine.script (ProofEngine.proof ~main:wpo) in + Hashtbl.remove proofs wpo.Wpo.po_gid ; ProofSession.save wpo (ProofScript.encode script) +let get wpo = + match ProofEngine.get wpo with + | `None -> `None + | `Proof -> `Proof + | `Saved -> `Saved + | `Script -> if has_proof wpo then `Script else `Proof + (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/wp/ProverScript.mli b/src/plugins/wp/ProverScript.mli index 66456fa0b940f077f650866b934a39a5fe94b6be..4aa7483d69a9ccae92b7c4c54f4baeb4454a78bb 100644 --- a/src/plugins/wp/ProverScript.mli +++ b/src/plugins/wp/ProverScript.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -35,4 +35,5 @@ type 'a process = val prove : unit Task.task process val spawn : unit process +val get : Wpo.t -> [ `Script | `Proof | `Saved | `None ] val save : Wpo.t -> unit diff --git a/src/plugins/wp/ProverSearch.ml b/src/plugins/wp/ProverSearch.ml index 900425cc63cf377b684cf25415a75340b1fba5a6..f1a9c8198ba55f001d0864c19833f5dfb1bb6508 100644 --- a/src/plugins/wp/ProverSearch.ml +++ b/src/plugins/wp/ProverSearch.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverSearch.mli b/src/plugins/wp/ProverSearch.mli index d7dbbd9b1ad3f74387be565334db015f7ee64800..fe48f127093f721bc4405f4a0f4d7e8d46cb0556 100644 --- a/src/plugins/wp/ProverSearch.mli +++ b/src/plugins/wp/ProverSearch.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverTask.ml b/src/plugins/wp/ProverTask.ml index 8e064c4fc67ea0afe79f0524dcb03f9d30b91aa4..a3ed3a52b98a1ffe31716cfdce3d18842657d5fa 100644 --- a/src/plugins/wp/ProverTask.ml +++ b/src/plugins/wp/ProverTask.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -26,6 +26,9 @@ open Task +let dkey_prover = Wp_parameters.register_category "prover" + + (* -------------------------------------------------------------------------- *) (* --- Export Printer --- *) (* -------------------------------------------------------------------------- *) @@ -193,6 +196,10 @@ class command name = val stdout = Buffer.create 256 val stderr = Buffer.create 256 + method command = cmd :: param + method pretty fmt = + Format.pp_print_string fmt cmd ; pp_args fmt param + method set_command name = cmd <- name method add args = param <- param @ args @@ -232,7 +239,7 @@ class command name = Task.command ~timeout ~time ~stdout ~stderr cmd args >>? begin fun st -> (* finally *) - if Wp_parameters.has_dkey "prover" then + if Wp_parameters.has_dkey dkey_prover then Log.print_on_output begin fun fmt -> Format.fprintf fmt "@[<hov 2>RUN '%s%a'@]@." cmd pp_args param ; diff --git a/src/plugins/wp/ProverTask.mli b/src/plugins/wp/ProverTask.mli index 5e3a8c4b55c5bb88ce0a33e2f80967d7312fe59b..1d74ddd7dfdb10aa43553d94bca90de54a01c60d 100644 --- a/src/plugins/wp/ProverTask.mli +++ b/src/plugins/wp/ProverTask.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -61,7 +61,8 @@ type logs = [ `OUT | `ERR | `BOTH ] class virtual command : string -> object - + method command : string list + method pretty : Format.formatter -> unit method set_command : string -> unit method add : string list -> unit method add_int : name:string -> value:int -> unit diff --git a/src/plugins/wp/ProverWhy3.ml b/src/plugins/wp/ProverWhy3.ml index 199bcc9213974c08a525589f9cfa75c46f05f482..9bc40d4e557c71837ab2431606560e9e6c6064fb 100644 --- a/src/plugins/wp/ProverWhy3.ml +++ b/src/plugins/wp/ProverWhy3.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -232,9 +232,10 @@ class visitor fmt c = | Rec -> engine#declare_fixpoint ~prefix:"fix_" | Def -> engine#declare_definition in pp fmt d.d_lfun d.d_params Logic.Prop (F.e_prop p) - | Inductive _ -> + | Inductive dl -> engine#declare_signature fmt - d.d_lfun (List.map F.tau_of_var d.d_params) Logic.Prop + d.d_lfun (List.map F.tau_of_var d.d_params) Logic.Prop; + List.iter self#on_dlemma dl end end diff --git a/src/plugins/wp/ProverWhy3.mli b/src/plugins/wp/ProverWhy3.mli index 8bf1946092067198f3b6e78d5d15ed6479cab66e..289c556781a4b12c7a4789d99869ad945bf5b209 100644 --- a/src/plugins/wp/ProverWhy3.mli +++ b/src/plugins/wp/ProverWhy3.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverWhy3ide.ml b/src/plugins/wp/ProverWhy3ide.ml index ffc0fe55070914b801cf3505b2485a9370afb441..9b930eb5a4d18e22fd87dd695c77266262e6fea8 100644 --- a/src/plugins/wp/ProverWhy3ide.ml +++ b/src/plugins/wp/ProverWhy3ide.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/ProverWhy3ide.mli b/src/plugins/wp/ProverWhy3ide.mli index 3521042d1c9e9ca836ec1d48254704f95cb1a75e..0775807cb4ac609478054f7847905118531f0482 100644 --- a/src/plugins/wp/ProverWhy3ide.mli +++ b/src/plugins/wp/ProverWhy3ide.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/RefUsage.ml b/src/plugins/wp/RefUsage.ml index ec296b2176ce3d9c21c618ba895935850b259149..cdc855f1d6161761caffe5494960e00289ba1f6e 100644 --- a/src/plugins/wp/RefUsage.ml +++ b/src/plugins/wp/RefUsage.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -562,6 +562,18 @@ and v_body (env:ctx) = (* locals of the logical function are removed *) (* --- Compilation of C Function --- *) (* ---------------------------------------------------------------------- *) +let cinit vi init = + let update_code_env a v = E.cup a v in + let einit (m:model) a exp = + update_code_env a (E.cup (e_value m) (vexpr exp)) + in + let rec aux (m: model) a = function + | SingleInit (exp) -> einit m a exp + | CompoundInit(_,loi) -> + List.fold_left (fun a (ofs,init) -> aux (offset m ofs) a init) + a loi + in aux (cval vi) E.bot init + let cfun_code env kf = (* Visits term/pred of code annotations and C exp *) let update_code_env v = env.global.code <- E.cup env.global.code v in let do_term t = update_code_env (vterm env t) in @@ -605,6 +617,14 @@ let cfun_code env kf = (* Visits term/pred of code annotations and C exp *) | None -> List.iter do_exp (fun_exp::args_list) | Some called_kf -> do_args called_kf args_list end + | Instr(Local_init (v,AssignInit i,_)) -> update_code_env (cinit v i) + | Instr(Local_init (v,ConsInit (f,args,kind),_)) -> + let kf = Globals.Functions.get f in + (match kind with + | Constructor -> do_args kf (Cil.mkAddrOfVi v :: args) + | Plain_func -> + update_code_env (e_value (cval v)); + do_args kf args) | Return(Some exp,_) | If (exp,_,_,_) | Switch (exp,_,_,_) -> do_exp exp @@ -658,17 +678,7 @@ let cfun kf = let cvarinit vi initinfo env = match initinfo.init with | None -> env - | Some init -> - let update_code_env a v = E.cup a v in - let einit (m:model) a exp = - update_code_env a (E.cup (e_value m) (vexpr exp)) - in - let rec cinit (m: model) a = function - | SingleInit (exp) -> einit m a exp - | CompoundInit(_,loi) -> - List.fold_left (fun a (ofs,init) -> cinit (offset m ofs) a init) - a loi - in E.cup env (cinit (cval vi) E.bot init) + | Some init -> E.cup env (cinit vi init) (* ---------------------------------------------------------------------- *) (* --- Compilation --- *) diff --git a/src/plugins/wp/RefUsage.mli b/src/plugins/wp/RefUsage.mli index aff55b078a3f5f73db17c29bf69a8a1b6a419dc5..e4a75a1d487db31a640b93d192996bb53b9b8d04 100644 --- a/src/plugins/wp/RefUsage.mli +++ b/src/plugins/wp/RefUsage.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Region.ml b/src/plugins/wp/Region.ml index 00f10b12febad17d39ef985a99e747131fb98b24..c0c8ab1d159773298c78723d67f465dd670ceb9c 100644 --- a/src/plugins/wp/Region.ml +++ b/src/plugins/wp/Region.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Region.mli b/src/plugins/wp/Region.mli index 687fbb401813de0b7a12b51684c409283810b2be..9374b0c339bf79a6e204b9b8b0509c035f261dfe 100644 --- a/src/plugins/wp/Region.mli +++ b/src/plugins/wp/Region.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Repr.ml b/src/plugins/wp/Repr.ml index e6843df34f5069d9c6830a5dc3464d0c14da9844..869e8ad1dac63e7a562ac7f703aa0f73e67f25db 100644 --- a/src/plugins/wp/Repr.ml +++ b/src/plugins/wp/Repr.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Repr.mli b/src/plugins/wp/Repr.mli index c6f1672d7474967fc60ae43eae86c3533f6002c3..09c87d87fe358dc7b3166814530e8291e6c7076d 100644 --- a/src/plugins/wp/Repr.mli +++ b/src/plugins/wp/Repr.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Separation.ml b/src/plugins/wp/Separation.ml index 4c451ec2494fcf77a90da36476ffd2e94f42f269..cd3b4299d458a36734b5c5aed8197dcc585aed10 100644 --- a/src/plugins/wp/Separation.ml +++ b/src/plugins/wp/Separation.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Separation.mli b/src/plugins/wp/Separation.mli index d871f471cb5eb5389bc2cfb4a211351082d22df3..5a472051099541e33e85dd1d1501879dcf480d9d 100644 --- a/src/plugins/wp/Separation.mli +++ b/src/plugins/wp/Separation.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Sigma.ml b/src/plugins/wp/Sigma.ml index f85302a532a30657d8e53cd9f9787a05ab126654..5d69aa4aefd26dd3f918a463a7b865cf1a19ac73 100644 --- a/src/plugins/wp/Sigma.ml +++ b/src/plugins/wp/Sigma.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Sigma.mli b/src/plugins/wp/Sigma.mli index b98102c313e79e46cef7368c01e4e9a8c7ad1e64..ab143828659b27095d3bfd1de6357166e1b66a7a 100644 --- a/src/plugins/wp/Sigma.mli +++ b/src/plugins/wp/Sigma.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Splitter.ml b/src/plugins/wp/Splitter.ml index d4e383c6f3172479e4236b958527bd8591f22f4d..a62ce8886d3c5f85dc919d0db99c9331f3cab22e 100644 --- a/src/plugins/wp/Splitter.ml +++ b/src/plugins/wp/Splitter.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Splitter.mli b/src/plugins/wp/Splitter.mli index 705a6e720147590f7337fc66b32a0c4e3995acab..febef86e7b67c51174bb39c761dd4c787f1c9a5a 100644 --- a/src/plugins/wp/Splitter.mli +++ b/src/plugins/wp/Splitter.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/StmtSemantics.ml b/src/plugins/wp/StmtSemantics.ml index 8676404cf44b6fa6de6047e070d115ea74ead439..e9898869e64c787bb4957dba2f9ea2701e1fe5d4 100644 --- a/src/plugins/wp/StmtSemantics.ml +++ b/src/plugins/wp/StmtSemantics.ml @@ -59,8 +59,8 @@ sig method sequence : flow -> stmt list -> cfg method undefined : flow -> stmt list -> cfg method annotation : flow -> predicate -> cfg - method assigns : flow -> identified_term assigns -> cfg - method froms : flow -> identified_term from list -> cfg + method assigns : flow -> assigns -> cfg + method froms : flow -> from list -> cfg end end @@ -80,7 +80,7 @@ struct exception LabelNotFound of c_label let (@^) cfg1 cfg2 = Cfg.concat cfg1 cfg2 - let (@*) = List.fold_left (fun env (l, n) -> LabelMap.add l n env) + let (@*) = List.fold_left (fun (env:flow) (l, n) -> LabelMap.add l n env) let (@:) env lbl = try LabelMap.find lbl env @@ -213,8 +213,8 @@ struct method annotation : flow -> predicate -> cfg = assert false - method assigns : flow -> identified_term assigns -> cfg = assert false + method assigns : flow -> assigns -> cfg = assert false - method froms : flow -> identified_term from list -> cfg = assert false + method froms : flow -> from list -> cfg = assert false end end diff --git a/src/plugins/wp/StmtSemantics.mli b/src/plugins/wp/StmtSemantics.mli index f9aecde1a53e7e9201e08b09029ad38abf2ac13c..6a76ed83c501e4bde6b7dfe1c9adf8aa548105e8 100644 --- a/src/plugins/wp/StmtSemantics.mli +++ b/src/plugins/wp/StmtSemantics.mli @@ -92,8 +92,8 @@ sig bind the flow to the desired environment. *) method annotation : flow -> predicate -> cfg - method assigns : flow -> identified_term assigns -> cfg - method froms : flow -> identified_term from list -> cfg + method assigns : flow -> assigns -> cfg + method froms : flow -> from list -> cfg end diff --git a/src/plugins/wp/Strategy.ml b/src/plugins/wp/Strategy.ml index 0ca59cfd2a942cbea27c6679585fec1421319ccc..d4a01882c615a4cdc8e4a54a7703598dd4e1264e 100644 --- a/src/plugins/wp/Strategy.ml +++ b/src/plugins/wp/Strategy.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -131,7 +131,7 @@ let registry = ref Tmap.empty let register s = let id = s#id in if Tmap.mem id !registry then - Wp_parameters.error "Strategy #%s already registered (skiped)" id + Wp_parameters.error "Strategy #%s already registered (skipped)" id else registry := Tmap.add id (s :> heuristic) !registry diff --git a/src/plugins/wp/Strategy.mli b/src/plugins/wp/Strategy.mli index 1bea26c002a440491e3dca01bd0b15e0e0464f7c..31b0a8339345a35a1a34bbce0315c9372db5ddd9 100644 --- a/src/plugins/wp/Strategy.mli +++ b/src/plugins/wp/Strategy.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacArray.ml b/src/plugins/wp/TacArray.ml index eb872beb6d9902dda2998d65b5a02f9a5e73cd48..f44a655e32994ff5a098e2ffed4596fbaa8abdc6 100644 --- a/src/plugins/wp/TacArray.ml +++ b/src/plugins/wp/TacArray.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacArray.mli b/src/plugins/wp/TacArray.mli index ebc14f517914f2227e8b01b33d93878e06ff6ea0..7eb17ca7428bfa8c45a8868c5316895e0d5de0fb 100644 --- a/src/plugins/wp/TacArray.mli +++ b/src/plugins/wp/TacArray.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacBitrange.ml b/src/plugins/wp/TacBitrange.ml new file mode 100644 index 0000000000000000000000000000000000000000..35a75ac28102513dea611d1351b86a6a2b801921 --- /dev/null +++ b/src/plugins/wp/TacBitrange.ml @@ -0,0 +1,205 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Lang + +type log = Exact of int | Upper of int + +(* Requires 2^i < n && 0 <= i < j *) +let rec log2m i j n = + let b = Integer.two_power_of_int j in + if Integer.lt b n then log2m j (2*j) n else + (* 2^i < n <= 2^j *) + if Integer.equal b n then Exact j else + (* 2^i < n < 2^j *) + log2d i j n + +(* Requires 2^i < n < 2 ^j && 0 <= i < j *) +and log2d i j n = + if succ i = j then Upper j else + let k = (i+j)/2 in + let a = Integer.two_power_of_int k in + let c = Integer.compare a n in + if c > 0 then log2d i k n else (* a=2^k > n *) + if c < 0 then log2d k j n else (* a=2^k < n *) + Exact k + +(* Theorem: + + exists i, 0 <= x_i + forall i, x_i <= 2^p + ----------------------------- + 0 <= land(x_1,...,x_n) <= 2^p + +*) + +let is_positive e = F.p_leq F.e_zero e + +let land_leq es n = + if Integer.(lt zero n) then + let p = match log2m 0 1 n with Exact p -> p | Upper p -> p-1 in + (* Use theorem with 2^p <= n: land es <= 2^p <= n *) + let a = F.e_zint (Integer.two_power_of_int p) in + let positive = F.p_any is_positive es in + F.p_conj (positive :: List.map (fun e -> F.p_leq e a) es) + else if Integer.(equal zero n) then + F.p_all (fun e -> F.p_equal e F.e_zero) es + else raise Not_found + +let leq_land n es = + if Integer.(le n zero) then + (* Use theorem with maximal p: n <= 0 <= land es *) + F.p_any is_positive es + else raise Not_found + +(* Theorem: + + forall i, 0 <= x_i < 2^p + ----------------------------- + 0 <= lor(x_1,...,x_n) <= 2^p + +*) + +let lor_leq es n = + if Integer.(le n zero) then + let p = match log2m 0 1 n with Exact p -> p | Upper p -> p-1 in + (* Use theorem with 2^p <= n: lor es <= 2^p <= n *) + let a = F.e_zint (Integer.two_power_of_int p) in + F.p_all (fun e -> F.p_and (is_positive e) (F.p_lt e a)) es + else if Integer.(equal n zero) then + F.p_any (fun e -> F.p_leq e F.e_zero) es + else raise Not_found + +let leq_lor n es = + if Integer.(le n zero) then + (* Use theorem with maximal p: n <= 0 <= lor es *) + F.p_all is_positive es + else raise Not_found + +(* -------------------------------------------------------------------------- *) +(* --- Patterns --- *) +(* -------------------------------------------------------------------------- *) + +type pattern = + | LEQ of pattern * pattern + | LT of pattern * pattern + | INT + | LAND + | LOR + +type sigma = { + mutable bound : Integer.t ; + mutable terms : F.term list ; +} + +let rec pmatch s p e = + let open Qed.Logic in + match p , F.repr e with + | LEQ(p,q) , Leq(a,b) + | LT(p,q) , Lt(a,b) + -> pmatch s p a ; pmatch s q b + | INT , Kint n -> s.bound <- n + | LAND , Fun(f,es) when f == Cint.f_land -> s.terms <- es + | LOR , Fun(f,es) when f == Cint.f_lor -> s.terms <- es + | _ -> raise Exit + +let matches s p e = try pmatch s p e ; true with Exit -> false + +let patterns : (pattern * (sigma -> F.pred)) list = + [ + LEQ(INT,LAND) , (fun s -> leq_land s.bound s.terms) ; + LT(INT,LAND) , (fun s -> leq_land (Integer.succ s.bound) s.terms) ; + LEQ(LAND,INT) , (fun s -> land_leq s.terms s.bound) ; + LT(LAND,INT) , (fun s -> land_leq s.terms (Integer.pred s.bound)) ; + LEQ(INT,LOR) , (fun s -> leq_lor s.bound s.terms) ; + LT(INT,LOR) , (fun s -> leq_lor (Integer.succ s.bound) s.terms) ; + LEQ(LOR,INT) , (fun s -> lor_leq s.terms s.bound) ; + LT(LOR,INT) , (fun s -> lor_leq s.terms (Integer.pred s.bound)) ; + ] + +let select_goal g = + try + let s = { bound = Integer.zero ; terms = [] } in + let (_,f) = List.find (fun (p,_) -> matches s p g) patterns in + Some (f s) + with Not_found -> None + +let rec split_goals others ranges = function + | [] -> List.rev others , List.rev ranges + | g::gs -> + begin + match select_goal g with + | None -> split_goals (F.p_bool g::others) ranges gs + | Some g' -> split_goals others (g'::ranges) gs + end + +let range_goal g' (hs,_) = ["bit-range" , (hs,g')] +let range_goals gs' (hs,_) = List.map (fun g' -> "bit-range" , (hs,g')) gs' +let other_goals ps (hs,_) = List.map (fun p -> "split" , (hs,p)) ps + +open Tactical + +class bitrange = + object + inherit Tactical.make + ~id:"Wp.bitrange" + ~title:"Bit Range" + ~descr:"Bounds of Bitwise Operators" + ~params:[] + + method select feedback = function + | Clause(Goal p) -> + begin + let goals = + let e = F.e_prop p in + match F.repr e with + | Qed.Logic.And es -> es + | Qed.Logic.Leq _ | Qed.Logic.Lt _ -> [e] + | _ -> raise Not_found + in + let others,ranges = split_goals [] [] goals in + if ranges = [] then Tactical.Not_applicable else + begin + if others = [] then + feedback#set_title "Split & Bit Range(s)" + else + feedback#set_title "Bit Range(s)" ; + Tactical.Applicable + (fun seq -> other_goals others seq @ + range_goals ranges seq) + end + end + | Inside(Goal p,e) -> + begin + let g = F.e_prop p in + match F.repr g with + | Qed.Logic.And es when List.memq e es -> + begin match select_goal g with + | Some g' -> Tactical.Applicable(range_goal g') + | None -> Tactical.Not_applicable + end + | _ -> Tactical.Not_applicable + end + | _ -> Tactical.Not_applicable + end + +let tactical = Tactical.export (new bitrange) diff --git a/src/plugins/wp/TacBitrange.mli b/src/plugins/wp/TacBitrange.mli new file mode 100644 index 0000000000000000000000000000000000000000..00b47d429f11e7b6e6496798e341c128926089ec --- /dev/null +++ b/src/plugins/wp/TacBitrange.mli @@ -0,0 +1,29 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Built-in Bit Range Tactical (auto-registered) *) + +open Tactical + +val tactical : tactical + +(**************************************************************************) diff --git a/src/plugins/wp/TacBitwised.ml b/src/plugins/wp/TacBitwised.ml new file mode 100644 index 0000000000000000000000000000000000000000..e571819a826286e16d6f1cb649cf3d00329b0704 --- /dev/null +++ b/src/plugins/wp/TacBitwised.ml @@ -0,0 +1,67 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Lang + +let range a n = F.p_and (F.p_leq F.e_zero a) (F.p_lt a (F.e_int (1 lsl n))) + +let bit_test x k = Cint.l_and x (F.e_int (1 lsl k)) + +let rec bitwise_eqs a b n = + if n >= 0 then + F.e_eq (bit_test a n) (bit_test b n) :: + bitwise_eqs a b (n-1) + else [] + +let bitwise_eq a b n = F.e_and (bitwise_eqs a b n) +let rewrite descr u v = Tactical.rewrite [ descr , F.p_true , u , v ] + +let vrange,prange = Tactical.spinner ~id:"Wp.bitwised.range" + ~vmin:0 ~vmax:64 ~default:8 + ~title:"Bits" ~descr:"Number of bits for bitwise equality" () + +class bitcase = + object(self) + inherit Tactical.make + ~id:"Wp.bitwised" + ~title:"Bitwise Eq." + ~descr:"Decompose Bitwise Equality" + ~params:[prange] + + method select feedback selection = + let e = Tactical.selected selection in + let open Qed.Logic in + match F.repr e with + | Eq(a,b) when F.is_int a && F.is_int b -> + let n = self#get_field vrange in + feedback#set_title "Bitwise Eq. (%d bits)" n ; + let inrange = F.p_and (range a n) (range b n) in + let bitwise = bitwise_eq a b n in + Tactical.Applicable + (fun seq -> + ("range" , (fst seq , inrange)) :: + rewrite "bitwise" e bitwise seq) + | _ -> Tactical.Not_applicable + + end + +let tactical = Tactical.export (new bitcase) diff --git a/src/plugins/wp/TacBitwised.mli b/src/plugins/wp/TacBitwised.mli new file mode 100644 index 0000000000000000000000000000000000000000..f7c19823c8b5b8e43c34a8207e4b6b56cab718fe --- /dev/null +++ b/src/plugins/wp/TacBitwised.mli @@ -0,0 +1,29 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Built-in Bitwised-Eq Tactical (auto-registered) *) + +open Tactical + +val tactical : tactical + +(**************************************************************************) diff --git a/src/plugins/wp/TacChoice.ml b/src/plugins/wp/TacChoice.ml index 55025743823430ab6872d9e409701dd248229012..5c3a17dfdfa966178970657ebe95e65ae8c6384b 100644 --- a/src/plugins/wp/TacChoice.ml +++ b/src/plugins/wp/TacChoice.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacChoice.mli b/src/plugins/wp/TacChoice.mli index 57e438b08108e986b1e63d5da64824f40c356f1f..8ded4848ca6a26e71df3c8bf9b3902a8eb0359ab 100644 --- a/src/plugins/wp/TacChoice.mli +++ b/src/plugins/wp/TacChoice.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacCompound.ml b/src/plugins/wp/TacCompound.ml index d8fe39e2a77b213f7107ba76d7db65749a47c8ed..c4116f24a2d68a5b3f0952226fe48d3b5c05f7d1 100644 --- a/src/plugins/wp/TacCompound.ml +++ b/src/plugins/wp/TacCompound.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacCompound.mli b/src/plugins/wp/TacCompound.mli index 8cc38f4eb4597b5403f0545ddd9fa6c3e35e6403..d0481ca11d25e9ed2eac4540c9af0ab37ae7dca3 100644 --- a/src/plugins/wp/TacCompound.mli +++ b/src/plugins/wp/TacCompound.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacCut.ml b/src/plugins/wp/TacCut.ml index f5829ebccf8e09cf98ac419c47177cf15a70f756..84e961f96208d416fc9218c65edc5a58778213db 100644 --- a/src/plugins/wp/TacCut.ml +++ b/src/plugins/wp/TacCut.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacCut.mli b/src/plugins/wp/TacCut.mli index ae5948d16627c669733a52dc89a2395ab45afdd4..87dfda1910fe9d7d4aff02ce0d114bd734173c75 100644 --- a/src/plugins/wp/TacCut.mli +++ b/src/plugins/wp/TacCut.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacFilter.ml b/src/plugins/wp/TacFilter.ml index 434e0ef29f20ab4ccdc9007ee5943e56fca768cf..aa46067cf3bff9bb4d3042d1b4dca9f442d11b57 100644 --- a/src/plugins/wp/TacFilter.ml +++ b/src/plugins/wp/TacFilter.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacFilter.mli b/src/plugins/wp/TacFilter.mli index 32e3ec90cd10b86058ff58424f54a5204d22a173..c014f69ca30ff3437ba92e36b006afce3c5a22ca 100644 --- a/src/plugins/wp/TacFilter.mli +++ b/src/plugins/wp/TacFilter.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacHavoc.ml b/src/plugins/wp/TacHavoc.ml index 693c399b5f0052ada668be889e9dd2cc61a14bc2..4ac0fb7dfffc47f70ff23d9ead300124eb949a25 100644 --- a/src/plugins/wp/TacHavoc.ml +++ b/src/plugins/wp/TacHavoc.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacHavoc.mli b/src/plugins/wp/TacHavoc.mli index 1fdff54f57bc78cfcbb6f46266211fc9dc6b35bd..9f1facbf46c85e0103a623b03ec78ae14040010f 100644 --- a/src/plugins/wp/TacHavoc.mli +++ b/src/plugins/wp/TacHavoc.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacInstance.ml b/src/plugins/wp/TacInstance.ml index f941d5593472bc263d12090d8577cb443dc8fe1e..59458e9a153a53b5af988a4c24816de5711947b3 100644 --- a/src/plugins/wp/TacInstance.ml +++ b/src/plugins/wp/TacInstance.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -110,7 +110,6 @@ let rec bind_forall ranges bindings property = | [] -> bind_ranges [ "Instance" , property ] ranges - let instance_goal ?(title="Witness") bindings property sequent = [ title, (fst sequent , bind_exists bindings property) ] @@ -123,7 +122,6 @@ let instance_have ?(title="Instance") ?at bindings property sequent = | _ -> Conditions.(step (Either [sequence clauses])) in [ title , Conditions.insert ?at step sequent ] - let bind ~side bindings property : Tactical.process = match side with | None -> @@ -134,7 +132,7 @@ let bind ~side bindings property : Tactical.process = let filter x e = try F.Tau.equal (F.tau_of_var x) (F.typeof e) - with Not_found -> false + with Not_found -> true (* allowed to not restrict usage *) let fieldname k x = Pretty_utils.sfprintf "%s (%a)" (descr k) F.Tau.pretty (F.tau_of_var x) diff --git a/src/plugins/wp/TacInstance.mli b/src/plugins/wp/TacInstance.mli index 7146dbd75d812d229ac85f83019b74d4e761dbb0..5a98f510b1c37ecbcaec4e31cd41252c9370342a 100644 --- a/src/plugins/wp/TacInstance.mli +++ b/src/plugins/wp/TacInstance.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacLemma.ml b/src/plugins/wp/TacLemma.ml index 18e35eed1f5c6deaa776b68f4ff00ddc0004fcd6..d968f70cdc018a1b8a89dc257114b2b1d5b1ccaa 100644 --- a/src/plugins/wp/TacLemma.ml +++ b/src/plugins/wp/TacLemma.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -62,9 +62,10 @@ class browser ?on_cluster f cluster = end let browse f s = - let main = Definitions.cluster ~id:"browser" () in - let visitor = new browser f main in - visitor#vterm (Tactical.selected s) + if Model.is_model_defined () then + let main = Definitions.cluster ~id:"browser" () in + let visitor = new browser f main in + visitor#vterm (Tactical.selected s) (* -------------------------------------------------------------------------- *) (* --- Search Lemma Tactical --- *) diff --git a/src/plugins/wp/TacLemma.mli b/src/plugins/wp/TacLemma.mli index 54a4d88477fb79d50bf35a2209239ca7ec7e14ac..777961a8da9477794ff333a725f8629dd65c8558 100644 --- a/src/plugins/wp/TacLemma.mli +++ b/src/plugins/wp/TacLemma.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacNormalForm.ml b/src/plugins/wp/TacNormalForm.ml index 41403ed21a745cf9c3ebc783ac775350c4302db6..0cfce39297325f5fc0e8d0fa955dfbfc6c571a52 100644 --- a/src/plugins/wp/TacNormalForm.ml +++ b/src/plugins/wp/TacNormalForm.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacNormalForm.mli b/src/plugins/wp/TacNormalForm.mli index 2fa02064d93366af032b68a2653467596fd26223..0947e6dc845e9b8a9472b0fb2ac31539f75d548d 100644 --- a/src/plugins/wp/TacNormalForm.mli +++ b/src/plugins/wp/TacNormalForm.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacOverflow.ml b/src/plugins/wp/TacOverflow.ml new file mode 100644 index 0000000000000000000000000000000000000000..795533bb8b36a4a0a64de4f8299001e982b5cb8e --- /dev/null +++ b/src/plugins/wp/TacOverflow.ml @@ -0,0 +1,58 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Lang +open Tactical + +class overflow = + object + inherit Tactical.make + ~id:"Wp.overflow" + ~title:"Overflow" + ~descr:"Consider no overflow nor downcast" + ~params:[] + + method select _feedback selection = + let e = Tactical.selected selection in + let open Qed.Logic in + match F.repr e with + | Fun(f,[v]) -> + let iota = Cint.to_cint f in + let cond = Cint.range iota v in + (* + let a,b = Ctypes.bounds iota in + let range = F.p_and + (F.p_leq (F.e_zint a) v) + (F.p_leq v (F.e_zint b)) in + *) + Applicable( fun (hs,g) -> [ + "In-Range", (hs , cond) ; + "No-Overflow" , + Conditions.subst + (fun u -> if u == e then v else u) + (hs , F.p_imply cond g) + ]) + | _ -> Not_applicable + + end + +let overflow = Tactical.export (new overflow) diff --git a/src/plugins/wp/TacOverflow.mli b/src/plugins/wp/TacOverflow.mli new file mode 100644 index 0000000000000000000000000000000000000000..49ed18104201854a5f15fee09fd5f4e16af9d627 --- /dev/null +++ b/src/plugins/wp/TacOverflow.mli @@ -0,0 +1,25 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Auto registered overflow tactic *) + +val overflow : Tactical.t diff --git a/src/plugins/wp/TacRange.ml b/src/plugins/wp/TacRange.ml index 3edbf935c1fda4c94bb4d41d8ab6109c82aa2c12..44392dc0cb34950fa184eea366d362e12d4d3f4a 100644 --- a/src/plugins/wp/TacRange.ml +++ b/src/plugins/wp/TacRange.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacRange.mli b/src/plugins/wp/TacRange.mli index e96b1fa046c9992224b36dbf93e823eaccdaa102..1e6815cd59e798a1f56df31c58a1df599bb99d87 100644 --- a/src/plugins/wp/TacRange.mli +++ b/src/plugins/wp/TacRange.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacRatio.ml b/src/plugins/wp/TacRatio.ml new file mode 100644 index 0000000000000000000000000000000000000000..5adcf4fc26d1b479e7d339c2deabeae2654e4cc0 --- /dev/null +++ b/src/plugins/wp/TacRatio.ml @@ -0,0 +1,169 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Lang +open Qed.Logic + +type pattern = + | INT of Integer.t + | MUL_K of Integer.t * pattern + | DIV_K of pattern * Integer.t + | DIV of pattern * pattern + | VAR of F.term + +let rec pattern e = + match F.repr e with + | Kint n -> INT n + | Times(k,e) -> MUL_K(k,pattern e) + | Div(a,b) -> + begin match F.repr b with + | Kint k -> + if Integer.(equal k zero) then raise Not_found ; + DIV_K(pattern a,k) + | _ -> + DIV(pattern a,pattern b) + end + | _ -> + if F.is_int e then VAR e else raise Not_found + +let rec to_term = function + | INT n -> F.e_zint n + | MUL_K(k,a) -> F.e_times k (to_term a) + | DIV_K(a,k) -> F.e_div (to_term a) (F.e_zint k) + | DIV(a,b) -> F.e_div (to_term a) (to_term b) + | VAR e -> e + +let pdiv a b = INT(Integer.c_div a b) + +let nzero x = F.p_neq F.e_zero x +let positive x = F.p_lt F.e_zero x +let negative x = F.p_lt x F.e_zero + +type cmp = LEQ | LT + +let icmp cmp a b = match cmp with + | LEQ -> Integer.le a b + | LT -> Integer.lt a b + +let fcmp cmp a b = match cmp with + | LEQ -> F.p_leq a b + | LT -> F.p_lt a b + +let ratio cmp a u b v = + let x = F.e_mul a v in + let y = F.e_mul b v in + let pu = positive u in + let nu = negative u in + let pv = positive v in + let nv = negative v in + F.p_conj [ nzero u ; nzero v ; + F.p_hyps [pu;pv] (fcmp cmp x y) ; + F.p_hyps [nu;pv] (fcmp cmp y x) ; + F.p_hyps [pu;nv] (fcmp cmp y x) ; + F.p_hyps [nu;nv] (fcmp cmp x y) ] + +let rec compare cmp a b = + match a, b with + | MUL_K( k,a ) , INT n -> + if Integer.(lt zero k) then compare cmp a (pdiv n k) else + if Integer.(lt k zero) then compare cmp (pdiv n k) a else + if icmp cmp Integer.zero n then F.p_true else F.p_false + | INT n , MUL_K( k,a ) -> + if Integer.(lt zero k) then compare cmp (pdiv n k) a else + if Integer.(lt k zero) then compare cmp a (pdiv n k) else + if icmp cmp Integer.zero n then F.p_true else F.p_false + | DIV_K( a,k ) , _ -> + if Integer.(lt zero k) then + let c = F.e_times k (F.e_add (to_term b) F.e_one) in + compare cmp a (pattern c) + else + if Integer.(lt k zero) then + let c = F.e_times k (F.e_sub (to_term b) F.e_one) in + compare cmp (pattern c) a + else + raise Not_found + | _ , DIV_K( b,k ) -> + if Integer.(lt zero k) then + let c = F.e_times k (F.e_sub (to_term a) F.e_one) in + compare cmp (pattern c) b + else + if Integer.(lt k zero) then + let c = F.e_times k (F.e_add (to_term a) F.e_one) in + compare cmp b (pattern c) + else + raise Not_found + | DIV(a,u) , DIV(b,v) -> + ratio cmp (to_term a) (to_term u) (to_term b) (to_term v) + | DIV(a,u) , b -> + ratio cmp (to_term a) (to_term u) (to_term b) F.e_one + | a , DIV(b,v) -> + ratio cmp (to_term a) F.e_one (to_term b) (to_term v) + | _ -> fcmp cmp (to_term a) (to_term b) + +let rec equal a b = + match a , b with + | MUL_K( k,a ) , INT n + | INT n , MUL_K( k,a ) -> + let r = Integer.c_rem k n in + if Integer.equal r Integer.zero then + equal a (pdiv n k) + else + F.p_false + | MUL_K( k,a ) , MUL_K( k',b ) -> + let r = Integer.pgcd k k' in + F.p_equal + (F.e_times (Integer.c_div k r) (to_term a)) + (F.e_times (Integer.c_div k' r) (to_term b)) + | DIV_K(a,u) , DIV_K(b,v) -> + let r = Integer.pgcd u v in + F.p_equal + (F.e_div (to_term a) (F.e_zint (Integer.c_div u r))) + (F.e_div (to_term b) (F.e_zint (Integer.c_div v r))) + | _ -> F.p_equal (to_term a) (to_term b) + +let select goal = + match F.repr (F.e_prop goal) with + | Leq(a,b) -> compare LEQ (pattern a) (pattern b) + | Lt(a,b) -> compare LT (pattern a) (pattern b) + | Eq(a,b) -> equal (pattern a) (pattern b) + | Neq(a,b) -> F.p_not (equal (pattern a) (pattern b)) + | _ -> raise Not_found + +class ratio = + object + inherit Tactical.make + ~id:"Wp.ratio" + ~title:"Ratio" + ~descr:"Compare Products and Divisions" + ~params:[] + + method select _feedback = function + | Tactical.Clause(Tactical.Goal p) -> + let q = select p in + if q != p + then Tactical.Applicable(fun seq -> ["ratio" , (fst seq , q)]) + else Tactical.Not_applicable + | _ -> Tactical.Not_applicable + + end + +let tactical = Tactical.export (new ratio) diff --git a/src/plugins/wp/TacRatio.mli b/src/plugins/wp/TacRatio.mli new file mode 100644 index 0000000000000000000000000000000000000000..9d162ff4a0d9279e13bc8ad9f4acf4f90a058a40 --- /dev/null +++ b/src/plugins/wp/TacRatio.mli @@ -0,0 +1,29 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Built-in Tactical for Product & Division Comparison (auto-registered) *) + +open Tactical + +val tactical : tactical + +(**************************************************************************) diff --git a/src/plugins/wp/TacRewrite.ml b/src/plugins/wp/TacRewrite.ml index a8aba141ed70aa528ec51ff1fe35368bc783ca81..3aeaed953f5356f0134b904c8bb12c26a78981df 100644 --- a/src/plugins/wp/TacRewrite.ml +++ b/src/plugins/wp/TacRewrite.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -23,7 +23,6 @@ (* -------------------------------------------------------------------------- *) (* --- Tactic to Apply Substitution by Hand *) (* -------------------------------------------------------------------------- *) - open Tactical open Repr diff --git a/src/plugins/wp/TacRewrite.mli b/src/plugins/wp/TacRewrite.mli index 7a0f9cbe880a1ac887be93ced23f79e5e839d696..256796d748fcbbc703aea0924b1b5a8e1227eb27 100644 --- a/src/plugins/wp/TacRewrite.mli +++ b/src/plugins/wp/TacRewrite.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacShift.ml b/src/plugins/wp/TacShift.ml new file mode 100644 index 0000000000000000000000000000000000000000..3634bdc6a49a14a4fbf28e672c412d96605c8fe1 --- /dev/null +++ b/src/plugins/wp/TacShift.ml @@ -0,0 +1,66 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +open Lang + +let select_op f = + if f == Cint.f_lsl then F.e_mul else + if f == Cint.f_lsr then F.e_div else + raise Not_found + +let select_int n = + match F.repr n with + | Qed.Logic.Kint n -> + (try Integer.to_int n with Integer.Too_big -> raise Not_found) + | _ -> raise Not_found + +let rewrite descr u v = Tactical.rewrite [ descr , F.p_true , u , v ] + +class shift = + object + inherit Tactical.make + ~id:"Wp.shift" + ~title:"Logical Shift" + ~descr:"Transform Shifting into Arithmetics" + ~params:[] + + method select feedback selection = + let e = Tactical.selected selection in + let open Qed.Logic in + match F.repr e with + | Fun( f , [a;n] ) -> + begin + let op = select_op f in + let n = select_int n in + if n > 64 then feedback#set_error "Too large shift (64 max.)" ; + if n < 0 then feedback#set_error "Negative shift (0 min.)" ; + let b = op a (F.e_int (1 lsl n)) in + Tactical.Applicable + (fun seq -> + ("positive" , (fst seq , F.p_leq F.e_zero a)) :: + rewrite "shift" e b seq) + end + | _ -> Tactical.Not_applicable + + end + +let tactical = Tactical.export (new shift) diff --git a/src/plugins/wp/TacShift.mli b/src/plugins/wp/TacShift.mli new file mode 100644 index 0000000000000000000000000000000000000000..ec2694bd378c3230c5a271b434c885ae2bbea854 --- /dev/null +++ b/src/plugins/wp/TacShift.mli @@ -0,0 +1,29 @@ +(**************************************************************************) +(* *) +(* This file is part of WP plug-in of Frama-C. *) +(* *) +(* Copyright (C) 2007-2017 *) +(* CEA (Commissariat a l'energie atomique et aux energies *) +(* alternatives) *) +(* *) +(* you can redistribute it and/or modify it under the terms of the GNU *) +(* Lesser General Public License as published by the Free Software *) +(* Foundation, version 2.1. *) +(* *) +(* It is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU Lesser General Public License for more details. *) +(* *) +(* See the GNU Lesser General Public License version 2.1 *) +(* for more details (enclosed in the file licenses/LGPLv2.1). *) +(* *) +(**************************************************************************) + +(** Built-in Shift Tactical (auto-registered) *) + +open Tactical + +val tactical : tactical + +(**************************************************************************) diff --git a/src/plugins/wp/TacSplit.ml b/src/plugins/wp/TacSplit.ml index 712b3925cc8532a09b17c214e6f3a6d4058c0ad0..00621b41b6d5d6698555f28bc1d9c847f7235103 100644 --- a/src/plugins/wp/TacSplit.ml +++ b/src/plugins/wp/TacSplit.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacSplit.mli b/src/plugins/wp/TacSplit.mli index b5be2a17c9198e7bd6040194e98df6a1be9e1394..e16173d8af21ac0a53985c7cb9ee0f2f10b8d751 100644 --- a/src/plugins/wp/TacSplit.mli +++ b/src/plugins/wp/TacSplit.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/TacUnfold.ml b/src/plugins/wp/TacUnfold.ml index c37e9cd50294f0d0d21a18c955a441a9bd5e9ce3..e08e34cda13c85a6c4f8c73da7c0dfdeb1a01200 100644 --- a/src/plugins/wp/TacUnfold.ml +++ b/src/plugins/wp/TacUnfold.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -29,20 +29,36 @@ open Tactical open Definitions -let definition ?at e f es = +let definition f es = let d = find_symbol f in match d.d_definition with | Function(_,_,u) -> - let a = Pretty_utils.sfprintf "Unfold '%a'" Lang.Fun.pretty f in - let v = Subst.(e_apply (sigma d.d_params es) u) in - Tactical.rewrite ?at [a,F.p_true,e,v] + Subst.(e_apply (sigma d.d_params es) u) | Predicate(_,p) -> - let a = Pretty_utils.sfprintf "Unfold '%a'" Lang.Fun.pretty f in - let v = Subst.(p_apply (sigma d.d_params es) p) in - Tactical.rewrite ?at [a,F.p_true,e,F.e_prop v] + F.e_prop (Subst.(p_apply (sigma d.d_params es) p)) | _ -> raise Not_found +let range f es = + let a,b = Ctypes.bounds (Cint.is_cint f) in + let range e = F.p_and + (F.p_leq (F.e_zint a) e) + (F.p_leq e (F.e_zint b)) in + F.e_prop (F.p_all range es) + +let rec applicable ?at e f es = function + | phi::others -> + begin + try + let v = phi f es in + let d = Pretty_utils.sfprintf "Unfold '%a'" Lang.Fun.pretty f in + Applicable (Tactical.rewrite ?at [d,F.p_true,e,v]) + with Not_found | Invalid_argument _ -> + applicable ?at e f es others + end + | [] -> + Not_applicable + class unfold = object inherit Tactical.make ~id:"Wp.unfold" @@ -55,10 +71,7 @@ class unfold = let e = Tactical.selected s in match F.repr e with | Qed.Logic.Fun(f,es) -> - begin - try Applicable (definition ?at e f es) - with Not_found | Invalid_argument _ -> Not_applicable - end + applicable ?at e f es [ definition ; range ] | _ -> Not_applicable end diff --git a/src/plugins/wp/TacUnfold.mli b/src/plugins/wp/TacUnfold.mli index d224642d4729d99f54546742256f5d76a48c0463..06a6824846b6150ce1114f1ec4a18b20e9dec161 100644 --- a/src/plugins/wp/TacUnfold.mli +++ b/src/plugins/wp/TacUnfold.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Tactical.ml b/src/plugins/wp/Tactical.ml index 851a312ab4edf9b9fb01673f5f8ba98ccc256968..273f82cbc9199dd1430524088b2d63524adf9cdc 100644 --- a/src/plugins/wp/Tactical.ml +++ b/src/plugins/wp/Tactical.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -53,7 +53,7 @@ let rec insert_group cc = function let add_composer (c : #composer) = let id = c#id in if Tmap.mem id !composers then - Wp_parameters.error "Composer #%s already registered (skiped)" id + Wp_parameters.error "Composer #%s already registered (skipped)" id else begin composers := Tmap.add id (c :> composer) !composers ; @@ -404,7 +404,7 @@ let tacticals = ref Tmap.empty let register t = let id = t#id in if Tmap.mem id !tacticals then - Wp_parameters.error "Tactical #%s already registered (skiped)" id + Wp_parameters.error "Tactical #%s already registered (skipped)" id else tacticals := Tmap.add id (t :> t) !tacticals diff --git a/src/plugins/wp/Tactical.mli b/src/plugins/wp/Tactical.mli index 5c68d36aac4645160c0952c19139bf59f30fea0d..70a1c6c5d1dae9921b5d23074e21ac467d0f9460 100644 --- a/src/plugins/wp/Tactical.mli +++ b/src/plugins/wp/Tactical.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/VC.ml b/src/plugins/wp/VC.ml index 16cb8d16a5a659ae59f30b31ac469d9514a729e0..023ffce9aa602e2dc5c2b214f2c129419dce2fe7 100644 --- a/src/plugins/wp/VC.ml +++ b/src/plugins/wp/VC.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/VC.mli b/src/plugins/wp/VC.mli index 2c65f764a552bbb6a3ece9da6e6642451700a764..d84fa95b1d8807db506078eb8f2b77791988373e 100644 --- a/src/plugins/wp/VC.mli +++ b/src/plugins/wp/VC.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/VCS.ml b/src/plugins/wp/VCS.ml index 19fc02dde6cecb1c12e5d71ee78fdaa5c4c76fc3..36ad4b95729a2afa9154ab9b732bf2f684a82307 100644 --- a/src/plugins/wp/VCS.ml +++ b/src/plugins/wp/VCS.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -24,6 +24,10 @@ (* --- Provers --- *) (* -------------------------------------------------------------------------- *) +let dkey_no_time_info = Wp_parameters.register_category "no-time-info" +let dkey_no_step_info = Wp_parameters.register_category "no-step-info" +let dkey_no_goals_info = Wp_parameters.register_category "no-goals-info" + type prover = | Why3 of string (* Prover via WHY *) | Why3ide @@ -193,9 +197,6 @@ let current () = { let default = { valid = false ; timeout = None ; stepout = None ; depth = None } -let timer s = 5 + max 0 (int_of_float (s +. 0.5)) -let steper s = max 100 (s + s / 2) - let get_timeout = function | { timeout = None } -> Wp_parameters.Timeout.get () | { timeout = Some t } -> t @@ -239,21 +240,53 @@ let is_verdict r = match r.verdict with let is_valid r = r.verdict = Valid -let configure r = { - valid = (r.verdict = Valid) ; - timeout = if r.prover_time > 0.0 then Some (timer r.prover_time) else None ; - stepout = if r.prover_steps > 0 then Some (steper r.prover_steps) else None ; - depth = if r.prover_depth > 0 then Some r.prover_depth else None ; +let configure r = + let valid = (r.verdict = Valid) in + let timeout = + let t = r.prover_time in + if t > 0.0 then + let timeout = Wp_parameters.Timeout.get() in + let margin = Wp_parameters.TimeExtra.get() + int_of_float (t +. 0.5) in + Some(max timeout margin) + else + None in + let stepout = + if r.prover_steps > 0 && r.prover_time <= 0.0 then + let stepout = Wp_parameters.Steps.get () in + let margin = 1000 + r.prover_depth in + Some(max stepout margin) + else None in + let depth = + if r.prover_depth > 0 then Some r.prover_depth else None + in + { + valid ; + timeout ; + stepout ; + depth ; } -let fit result option = - result = 0 || - let vopt = option () in vopt = 0 || result <= vopt +let time_fits t = + t = 0.0 || + let timeout = Wp_parameters.Timeout.get () in + timeout = 0 || + let margin = Wp_parameters.TimeMargin.get () in + t < float (timeout - margin) + +let step_fits n = + n = 0 || + let stepout = Wp_parameters.Steps.get () in + stepout = 0 || n < stepout + +let depth_fits n = + n = 0 || + let depth = Wp_parameters.Depth.get () in + depth = 0 || n < depth let autofit r = - fit (timer r.prover_time) Wp_parameters.Timeout.get && - fit (steper r.prover_steps) Wp_parameters.Steps.get && - fit r.prover_depth Wp_parameters.Depth.get + time_fits r.prover_time && + step_fits r.prover_steps && + depth_fits r.prover_depth let result ?(solver=0.0) ?(time=0.0) ?(steps=0) ?(depth=0) verdict = { @@ -286,31 +319,36 @@ let failed ?pos msg = { let kfailed ?pos msg = Pretty_utils.ksfprintf (failed ?pos) msg -let pp_perf fmt r = +let perfo extended dkey = extended || not (Wp_parameters.has_dkey dkey) + +let pp_perf ~extended fmt r = begin let t = r.solver_time in - if t > Rformat.epsilon && not (Wp_parameters.has_dkey "no-time-info") + if t > Rformat.epsilon && perfo extended dkey_no_time_info then Format.fprintf fmt " (Qed:%a)" Rformat.pp_time t ; let t = r.prover_time in - if t > Rformat.epsilon && not (Wp_parameters.has_dkey "no-time-info") + if t > Rformat.epsilon && perfo extended dkey_no_time_info then Format.fprintf fmt " (%a)" Rformat.pp_time t ; let s = r.prover_steps in - if s > 0 && not (Wp_parameters.has_dkey "no-step-info") + if s > 0 && perfo extended dkey_no_step_info then Format.fprintf fmt " (%d)" s end -let pp_result fmt r = +let pp_res ~extended fmt r = match r.verdict with - | NoResult -> Format.pp_print_string fmt "-" + | NoResult -> Format.pp_print_string fmt (if extended then "No Result" else "-") | Invalid -> Format.pp_print_string fmt "Invalid" | Computing _ -> Format.pp_print_string fmt "Computing" - | Valid -> Format.fprintf fmt "Valid%a" pp_perf r + | Valid -> Format.fprintf fmt "Valid%a" (pp_perf ~extended) r | Checked -> Format.fprintf fmt "Typechecked" - | Unknown -> Format.fprintf fmt "Unknown%a" pp_perf r - | Timeout -> Format.fprintf fmt "Timeout%a" pp_perf r - | Stepout -> Format.fprintf fmt "Step limit%a" pp_perf r + | Unknown -> Format.fprintf fmt "Unknown%a" (pp_perf ~extended) r + | Timeout -> Format.fprintf fmt "Timeout%a" (pp_perf ~extended) r + | Stepout -> Format.fprintf fmt "Step limit%a" (pp_perf ~extended) r | Failed -> Format.fprintf fmt "Failed@ %s" r.prover_errmsg +let pp_result = pp_res ~extended:false +let pp_result_perf = pp_res ~extended:true + let compare p q = let rank = function | NoResult | Computing _ -> 0 diff --git a/src/plugins/wp/VCS.mli b/src/plugins/wp/VCS.mli index 0b951cf510a9e6303d23a9709e2457a2bfa024f8..75ab285ac936c86aa7c9f5b40da9d20f20d4d6cb 100644 --- a/src/plugins/wp/VCS.mli +++ b/src/plugins/wp/VCS.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -79,7 +79,6 @@ type config = { } -val timer : float -> int (** Suitable timeout w.r.t measured time and number of process *) val current : unit -> config (** Current parameters *) val default : config (** all None *) @@ -129,5 +128,10 @@ val configure : result -> config val autofit : result -> bool (** Result that fits the default configuration *) val pp_result : Format.formatter -> result -> unit +val pp_result_perf : Format.formatter -> result -> unit val compare : result -> result -> int (* best is minimal *) + +val dkey_no_time_info: Log.category +val dkey_no_step_info: Log.category +val dkey_no_goals_info: Log.category diff --git a/src/plugins/wp/Vlist.ml b/src/plugins/wp/Vlist.ml index 6dbd47dda1eaff0da68cf16ac1cf40c32118532a..846a4c5156980608b1f3ffe08a883ac5291e51dd 100644 --- a/src/plugins/wp/Vlist.ml +++ b/src/plugins/wp/Vlist.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -51,11 +51,43 @@ let l_repeat = Lang.(E.({ coq = F_call "repeat" ; })) +(*--- Typechecking ---*) + +let a_list = Lang.builtin_type ~library ~name:t_list ~link:l_list + +let ty_nil = function _ -> L.Data(a_list,[L.Tvar 0]) + +let ty_listelt = function + | L.Data(_,[t]) -> (t : tau) + | _ -> raise Not_found + +let ty_cons = function + | [ _ ; Some l ] -> l + | [ Some e ; _ ] -> L.Data(a_list,[e]) + | _ -> raise Not_found + +let ty_elt = function + | [ Some e ] -> L.Data(a_list,[e]) + | _ -> raise Not_found + +let ty_nth = function + | Some l :: _ -> ty_listelt l + | _ -> raise Not_found + +let rec ty_concat = function + | Some l :: _ -> l + | None :: w -> ty_concat w + | [] -> raise Not_found + +let ty_repeat = function + | Some l :: _ -> l + | _ -> raise Not_found + (*--- Qed Symbols ---*) -let f_cons = Lang.extern_f ~library "cons" (* rewritten in concat(elt) *) -let f_nil = Lang.extern_f ~library ~category:L.Constructor "nil" -let f_elt = Lang.extern_f ~library ~category:L.Constructor ~link:l_elt "elt" +let f_cons = Lang.extern_f ~library ~typecheck:ty_cons "cons" (* rewriten in concat(elt) *) +let f_nil = Lang.extern_f ~library ~typecheck:ty_nil ~category:L.Constructor "nil" +let f_elt = Lang.extern_f ~library ~category:L.Constructor ~typecheck:ty_elt ~link:l_elt "elt" let concatenation = L.(Operator { invertible = true ; @@ -66,10 +98,10 @@ let concatenation = L.(Operator { absorbant = E_none ; }) -let f_nth = Lang.extern_f ~library "nth" +let f_nth = Lang.extern_f ~library ~typecheck:ty_nth "nth" let f_length = Lang.extern_f ~library ~sort:L.Sint "length" -let f_concat = Lang.extern_f ~library ~category:concatenation ~link:l_concat "concat" -let f_repeat = Lang.extern_f ~library "repeat" ~link:l_repeat +let f_concat = Lang.extern_f ~library ~category:concatenation ~typecheck:ty_concat ~link:l_concat "concat" +let f_repeat = Lang.extern_f ~library ~typecheck:ty_repeat ~link:l_repeat "repeat" (*--- ACSL Builtins ---*) @@ -102,8 +134,8 @@ let rewrite_cons a w = v_concat [v_elt a ; w] let rewrite_length e = match F.repr e with | L.Fun( nil , [] ) when nil == f_nil -> F.e_zero - | L.Fun( elt , [_] ) when elt = f_elt -> F.e_one - | L.Fun( concat , es ) when concat = f_concat -> + | L.Fun( elt , [_] ) when elt == f_elt -> F.e_one + | L.Fun( concat , es ) when concat == f_concat -> F.e_sum (List.map v_length es) | _ -> raise Not_found @@ -136,7 +168,7 @@ let rewrite_repeat s n = if F.equal s v_nil then v_nil else match F.repr s with | L.Fun( repeat , [s0 ; n0] ) - when (repeat = f_repeat) && + when (repeat == f_repeat) && (Cint.is_positive_or_null n) && (Cint.is_positive_or_null n0) -> v_repeat s0 (F.e_mul n0 n) | _ -> raise Not_found @@ -154,7 +186,7 @@ let rec rightmost ms a = | L.Fun( concat , es ) when concat == f_concat -> begin match List.rev es with | [] -> ms , a - | e::es -> rightmost (ms@es) e + | e::es -> rightmost (ms @ List.rev es) e end | L.Fun( repeat , [ u ; n ] ) when repeat == f_repeat && Cint.is_positive_or_null n -> rightmost (ms @ [v_repeat u (F.e_sub n F.e_one)]) u @@ -217,13 +249,13 @@ let f_list = [ f_nil ; f_cons ; f_elt ; f_repeat ; f_concat ] let check_tau = Lang.is_builtin_type ~name:t_list -let check_term e = match F.repr e with +let check_term e = + try match F.repr e with | L.Fvar x -> check_tau (F.tau_of_var x) | L.Bvar(_,t) -> check_tau t - | L.Fun( f , _ ) -> - List.memq f f_list || - (try check_tau (Lang.tau_of_lfun f) with Not_found -> false) + | L.Fun( f , _ ) -> List.memq f f_list || check_tau (Lang.F.typeof e) | _ -> false + with Not_found -> false (* -------------------------------------------------------------------------- *) (* --- Export --- *) diff --git a/src/plugins/wp/Vlist.mli b/src/plugins/wp/Vlist.mli index c87f04768c4497be342d45c38ff2e7faec123ac0..6c67f19ecf8e68b99818d6a611662a1050b7a224 100644 --- a/src/plugins/wp/Vlist.mli +++ b/src/plugins/wp/Vlist.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Vset.ml b/src/plugins/wp/Vset.ml index 15310e42407bc90d3f44e32ee3f36b9363692fb1..eee7e3520cffd03c6de85cf45c15808b8671b1b3 100644 --- a/src/plugins/wp/Vset.ml +++ b/src/plugins/wp/Vset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Vset.mli b/src/plugins/wp/Vset.mli index a92606a7d08de1387a0c3db841e7ffa4dd28bdf8..9cb053b2a0a1e0fd76f98a34a4ca3ebed4a53336 100644 --- a/src/plugins/wp/Vset.mli +++ b/src/plugins/wp/Vset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/Warning.ml b/src/plugins/wp/Warning.ml index e87cb2a50469ab1a075bcc353c26670a8a354ab7..33816ea491d57733828c10291f11adb4c4f27e96 100644 --- a/src/plugins/wp/Warning.ml +++ b/src/plugins/wp/Warning.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -113,11 +113,10 @@ let flush old = Context.pop collector old ; c.warnings let add w = - Wp_parameters.warning ~source:w.loc "%s" w.reason ~once:true ; let c = Context.get collector in c.warnings <- Set.add w c.warnings -let emit ?(severe=false) ?source ~effect message = +let kprintf phi ?(log=true) ?(severe=false) ?source ~effect message = let source = match source with Some s -> s | None -> default () in let buffer = Buffer.create 80 in Format.kfprintf @@ -125,7 +124,9 @@ let emit ?(severe=false) ?source ~effect message = Format.pp_print_flush fmt () ; let text = Buffer.contents buffer in let loc = Cil_const.CurrentLoc.get () in - add { + if log then + Wp_parameters.warning ~source:(fst loc) "%s" text ~once:true ; + phi { loc = fst loc ; severe = severe ; source = source ; @@ -135,6 +136,12 @@ let emit ?(severe=false) ?source ~effect message = (Format.formatter_of_buffer buffer) message +let create ?log ?severe ?source ~effect msg = + kprintf (fun w -> w) ?log ?severe ?source ~effect msg + +let emit ?severe ?source ~effect msg = + kprintf add ~log:true ?severe ?source ~effect msg + let handle ?(severe=false) ~effect ~handler cc x = try cc x with Error(source,reason) -> diff --git a/src/plugins/wp/Warning.mli b/src/plugins/wp/Warning.mli index ce97a688c9accb0ca07c994f67ead89294911b2d..b1dac351b65c9ee08826a1cb6b9aa2a1c32d0d8a 100644 --- a/src/plugins/wp/Warning.mli +++ b/src/plugins/wp/Warning.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -48,8 +48,11 @@ type context val context : ?source:string -> unit -> context val flush : context -> Set.t - val add : t -> unit + +val create : ?log:bool -> ?severe:bool -> ?source:string -> effect:string -> + ('a,Format.formatter,unit,t) format4 -> 'a + val emit : ?severe:bool -> ?source:string -> effect:string -> ('a,Format.formatter,unit) format -> 'a (** Emit a warning in current context. @@ -69,4 +72,3 @@ val catch : ?source:string -> ?severe:bool -> effect:string -> ('a -> 'b) -> 'a (** Set up a context for the job. If non-handled errors are raised, then a warning is emitted with specified severity and effect. Default for [severe] is [true]. *) - diff --git a/src/plugins/wp/WpTac.ml b/src/plugins/wp/WpTac.ml index c4bdd2154f07ec817088562687d3005ba32fc230..ebea8411416175146d1ee3fcf804daaad8ee1a03 100644 --- a/src/plugins/wp/WpTac.ml +++ b/src/plugins/wp/WpTac.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/WpTac.mli b/src/plugins/wp/WpTac.mli index 652df3c2ede86286c3c004a28333338c1877b688..11122e34b0cd78a42fafecfdd33988ecd34e4fca 100644 --- a/src/plugins/wp/WpTac.mli +++ b/src/plugins/wp/WpTac.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/calculus.ml b/src/plugins/wp/calculus.ml index f359000e1da0c1c62678a7e1569f5fd4408661cd..e464453ac80af4fe76eeadf7346ac9aa41ba6a31 100644 --- a/src/plugins/wp/calculus.ml +++ b/src/plugins/wp/calculus.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -365,28 +365,11 @@ module Cfg (W : Mcfg.S) = struct match label with Some _ -> obj | None -> assert false (* we should have assigns hyp for loops !*) - let loop_with_cut cfg annots vloop = - let to_loop_edges = Cil2cfg.pred_e cfg vloop in - (* - let back_edges = - List.filter (Cil2cfg.is_back_edge) (Cil2cfg.pred_e cfg vloop) - in *) - List.for_all (test_edge_loop_ok cfg (Some annots)) to_loop_edges - (** Compute the result for edge [e] which goes to the loop node [nloop]. * So [e] can be either a back_edge or a loop entry edge. * Be very careful not to make an infinite loop by calling [get_loop_head]... * *) - let wp_loop ((_, cfg, strategy, _, wenv)) res nloop e get_loop_head = - let loop_with_cut_pass1 () = - (* simply propagate both for [entry_edge] and [back_edge] *) - debug "[wp_loop] propagate"; - let obj = get_loop_head nloop (* loop should be broken by a cut *) in - let obj = - if Cil2cfg.is_back_edge e then obj - else W.loop_entry obj - in obj - in + let wp_loop ((_, cfg, strategy, _, wenv)) nloop e get_loop_head = let loop_with_quantif () = if Cil2cfg.is_back_edge e then (* Be careful not to use get_only_succ here (infinite loop) *) @@ -402,12 +385,14 @@ module Cfg (W : Mcfg.S) = struct in use_loop_assigns strategy wenv head obj end in + (* if WpStrategy.new_loop_computation strategy && R.is_pass1 res && loop_with_cut cfg strategy nloop then loop_with_cut_pass1 () else (* old mode or no inv or pass2 *) + *) match Cil2cfg.node_type nloop with | Cil2cfg.Vloop (Some true, _) -> (* natural loop (has back edges) *) loop_with_quantif () @@ -415,6 +400,87 @@ module Cfg (W : Mcfg.S) = struct Wp_error.unsupported "non-natural loop without invariant property." + (* Hypothesis for initialization of one variable *) + let rec init_variable wenv lv init obj = + match init with + + | SingleInit exp -> + W.init_value wenv lv (Cil.typeOfLval lv) (Some exp) obj + + | CompoundInit ( ct , initl ) -> + + let len = List.length initl in + let implicit_defaults = + match ct with + | TArray (ty,Some {enode = (Const CInt64 (size,_,_))},_,_) + when Integer.lt (Integer.of_int len) size -> + W.init_range wenv lv ty + (Integer.of_int len) size None obj + + | TComp (cp,_,_) when len < (List.length cp.cfields) -> + + List.fold_left + (fun obj f -> + if List.exists + (function (Field(g,_),_) -> Fieldinfo.equal f g | _ -> false) + initl + then obj + else + W.init_value wenv + (Cil.addOffsetLval (Field(f, NoOffset)) lv) + f.ftype None obj) + obj (List.rev cp.cfields) + + | _ -> obj + in + match ct with + | TArray (ty,_,_,_) + when Wp_parameters.InitWithForall.get () -> + (** delayed: the last consecutive index have the same value + and are not yet initialized. + (i0,pred,il) =def \forall x. x \in [il;i0] t[x] == pred + *) + let make_quant obj = function + | None -> obj + | Some (Index({enode=Const (CInt64 (i0,_,_))}, NoOffset),exp,il) + when Integer.lt il i0 -> + W.init_range wenv lv ty il (Integer.succ i0) (Some exp) obj + | Some (off,exp,_) -> + let lv = Cil.addOffsetLval off lv in + W.init_value wenv lv ty (Some exp) obj in + let obj, delayed = + List.fold_left + (fun (obj,delayed) (off,init) -> + match delayed, off, init with + | None, Index({enode=Const (CInt64 (i0,_,_))}, NoOffset), + SingleInit curr -> + (obj,Some(off,curr,i0)) + | Some (i0,prev,ip), Index({enode=Const (CInt64 (i,_,_))}, NoOffset), + SingleInit curr + when ExpStructEq.equal prev curr + && Integer.equal (Integer.pred ip) i -> + (obj,Some(i0,prev,i)) + | _, _,_ -> + let obj = make_quant obj delayed in + begin match off, init with + | Index({enode=Const (CInt64 (i0,_,_))}, NoOffset), + SingleInit curr -> + obj, Some (off,curr,i0) + | _ -> + let lv = Cil.addOffsetLval off lv in + init_variable wenv lv init obj, None + end) + (implicit_defaults,None) + (** decreasing order *) + (List.rev initl) in + make_quant obj delayed + | _ -> + List.fold_left + (fun obj (off,init) -> + let lv = Cil.addOffsetLval off lv in + init_variable wenv lv init obj) + implicit_defaults (List.rev initl) + type callenv = { pre_annots : WpStrategy.t_annots ; post_annots : WpStrategy.t_annots ; @@ -486,6 +552,9 @@ module Cfg (W : Mcfg.S) = struct | Return (r, _) -> W.return wenv s r obj | Instr i -> begin match i with + | Local_init (vi, AssignInit i, _) -> + init_variable wenv (Cil.var vi) i obj + | Local_init (_, ConsInit _, _) -> assert false | (Set (lv, e, _)) -> W.assign wenv s lv e obj | (Asm _) -> let asm = WpPropId.mk_asm_assigns_desc s in @@ -611,7 +680,7 @@ module Cfg (W : Mcfg.S) = struct W.switch wenv s e cases_obj def_obj | Cil2cfg.Vloop _ | Cil2cfg.Vloop2 _ -> let get_loop_head = fun n -> get_only_succ env cfg n in - wp_loop env res v e get_loop_head + wp_loop env v e get_loop_head | Cil2cfg.VfctOut | Cil2cfg.Vexit -> let obj = get_only_succ env cfg v (* exitpost / postcondition *) in @@ -632,87 +701,6 @@ module Cfg (W : Mcfg.S) = struct Cil.CurrentLoc.set old_loc; res - (* Hypothesis for initialization of one global variable *) - let rec init_global_variable wenv lv init obj = - match init with - - | SingleInit exp -> - W.init_value wenv lv (Cil.typeOfLval lv) (Some exp) obj - - | CompoundInit ( ct , initl ) -> - - let len = List.length initl in - let implicit_defaults = - match ct with - | TArray (ty,Some {enode = (Const CInt64 (size,_,_))},_,_) - when Integer.lt (Integer.of_int len) size -> - W.init_range wenv lv ty - (Integer.of_int len) size None obj - - | TComp (cp,_,_) when len < (List.length cp.cfields) -> - - List.fold_left - (fun obj f -> - if List.exists - (function (Field(g,_),_) -> Fieldinfo.equal f g | _ -> false) - initl - then obj - else - W.init_value wenv - (Cil.addOffsetLval (Field(f, NoOffset)) lv) - f.ftype None obj) - obj (List.rev cp.cfields) - - | _ -> obj - in - match ct with - | TArray (ty,_,_,_) - when Wp_parameters.InitWithForall.get () -> - (** delayed: the last consecutive index have the same value - and are not yet initialized. - (i0,pred,il) =def \forall x. x \in [il;i0] t[x] == pred - *) - let make_quant obj = function - | None -> obj - | Some (Index({enode=Const (CInt64 (i0,_,_))}, NoOffset),exp,il) - when Integer.lt il i0 -> - W.init_range wenv lv ty il (Integer.succ i0) (Some exp) obj - | Some (off,exp,_) -> - let lv = Cil.addOffsetLval off lv in - W.init_value wenv lv ty (Some exp) obj in - let obj, delayed = - List.fold_left - (fun (obj,delayed) (off,init) -> - match delayed, off, init with - | None, Index({enode=Const (CInt64 (i0,_,_))}, NoOffset), - SingleInit curr -> - (obj,Some(off,curr,i0)) - | Some (i0,prev,ip), Index({enode=Const (CInt64 (i,_,_))}, NoOffset), - SingleInit curr - when ExpStructEq.equal prev curr - && Integer.equal (Integer.pred ip) i -> - (obj,Some(i0,prev,i)) - | _, _,_ -> - let obj = make_quant obj delayed in - begin match off, init with - | Index({enode=Const (CInt64 (i0,_,_))}, NoOffset), - SingleInit curr -> - obj, Some (off,curr,i0) - | _ -> - let lv = Cil.addOffsetLval off lv in - init_global_variable wenv lv init obj, None - end) - (implicit_defaults,None) - (** decreasing order *) - (List.rev initl) in - make_quant obj delayed - | _ -> - List.fold_left - (fun obj (off,init) -> - let lv = Cil.addOffsetLval off lv in - init_global_variable wenv lv init obj) - implicit_defaults (List.rev initl) - let compute_global_init wenv filter obj = Globals.Vars.fold_in_file_order (fun var initinfo obj -> @@ -731,7 +719,7 @@ module Cfg (W : Mcfg.S) = struct wenv (Var var,NoOffset) var.vtype None obj | Some init -> let lv = Var var, NoOffset in - init_global_variable wenv lv init obj + init_variable wenv lv init obj in Cil.CurrentLoc.set old_loc ; obj ) obj @@ -791,21 +779,11 @@ module Cfg (W : Mcfg.S) = struct || WpStrategy.strategy_has_asgn_goal strategy then try let kf = Cil2cfg.cfg_kf cfg in - - if WpStrategy.new_loop_computation strategy then - (match Cil2cfg.very_strange_loops cfg with [] -> () - | _ -> (* TODO : print info about the loops *) - Wp_error.unsupported "strange loop(s).") - else - (match Cil2cfg.strange_loops cfg with [] -> () - | _ -> (* TODO : print info about the loops *) - Wp_error.unsupported - "non natural loop(s): try [-wp-invariants] option"); - + if Cil2cfg.strange_loops cfg <> [] then + Wp_error.unsupported "non natural loop(s)" ; let lvars = match WpStrategy.strategy_kind strategy with | WpStrategy.SKfroms info -> info.WpStrategy.more_vars - | _ -> [] - in + | _ -> [] in let wenv = W.new_env ~lvars kf in let res = R.empty cfg in let env = (kf, cfg, strategy, res, wenv) in diff --git a/src/plugins/wp/calculus.mli b/src/plugins/wp/calculus.mli index 48508ff9b8a05866f148b5fa99c7dfdab6387148..ab74d09e82952e7b1db50e951f0fe1e139511627 100644 --- a/src/plugins/wp/calculus.mli +++ b/src/plugins/wp/calculus.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/cfgDump.ml b/src/plugins/wp/cfgDump.ml index 1024210e08b0abd276540c9b49d15a4afeec07dc..4d64ae5f926882b9d585f961abc9e4c4b38651f8 100644 --- a/src/plugins/wp/cfgDump.ml +++ b/src/plugins/wp/cfgDump.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/cfgDump.mli b/src/plugins/wp/cfgDump.mli index bedea5b98f60fe7406e42da3fbde593478cb544b..640d0dabe51381fa0e72ac7546f7e40ff0897766 100644 --- a/src/plugins/wp/cfgDump.mli +++ b/src/plugins/wp/cfgDump.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/cfgWP.ml b/src/plugins/wp/cfgWP.ml index 37fd5e30bd73457a1fe9746e5ce22981c338d3e8..ba38a12a45bb38e9f4a0abf5a236f9f4c1b987bb 100644 --- a/src/plugins/wp/cfgWP.ml +++ b/src/plugins/wp/cfgWP.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -247,11 +247,11 @@ struct (* --- Branching --- *) (* -------------------------------------------------------------------------- *) - let branch_vc ~stmt cond vc1 vc2 = + let branch_vc ~stmt ~warn cond vc1 vc2 = let hyps , goal = if F.eqp vc1.goal vc2.goal then begin - Conditions.branch ~stmt cond vc1.hyps vc2.hyps , + Conditions.branch ~stmt ~warn cond vc1.hyps vc2.hyps , vc1.goal end else @@ -260,7 +260,7 @@ struct let q = F.p_equal k F.e_false in let h1 = Conditions.assume p vc1.hyps in let h2 = Conditions.assume q vc2.hyps in - (Conditions.branch ~stmt cond h1 h2 , F.p_if p vc1.goal vc2.goal) + (Conditions.branch ~stmt ~warn cond h1 h2 , F.p_if p vc1.goal vc2.goal) in { hyps = hyps ; @@ -675,10 +675,16 @@ struct let seq = { pre=s1 ; post=s2 } in obj , domain , seq , loc - let cc_stored seq loc obj expr = - match expr.enode with - | Lval lv -> M.copied seq obj loc (C.lval seq.pre lv) - | _ -> M.stored seq obj loc (C.val_of_exp seq.pre expr) + let cc_stored lv seq loc obj expr = + if Cil.isVolatileLval lv && + Cvalues.volatile ~warn:"unsafe write-access to volatile l-value" () + then None + else Some + begin + match expr.enode with + | Lval lv -> M.copied seq obj loc (C.lval seq.pre lv) + | _ -> M.stored seq obj loc (C.val_of_exp seq.pre expr) + end let assign wenv stmt lv expr wp = in_wenv wenv wp begin fun env wp -> @@ -696,15 +702,16 @@ struct let region = [obj,[Sloc loc]] in let outcome = Warning.catch ~severe:false ~effect:"Havoc l-value (unknown r-value)" - (cc_stored seq loc obj) expr in + (cc_stored lv seq loc obj) expr in match outcome with - | Warning.Failed r_warn -> - (* R-Value is unknown *) + | Warning.Failed r_warn + | Warning.Result(r_warn,None) -> + (* R-Value is unknown or L-Value is volatile *) let warn = Warning.Set.union l_warn r_warn in let vcs = do_assigns ~source:FromCode ~stmt ~warn seq region wp.effects wp.vcs in { sigma = Some seq.pre ; vcs=vcs ; effects = wp.effects } - | Warning.Result(r_warn,stored) -> + | Warning.Result(r_warn,Some stored) -> (* R-Value and effects has been translated *) let warn = Warning.Set.union l_warn r_warn in let ft = M.Heap.Set.fold_sorted @@ -758,10 +765,11 @@ struct let sigma,pa1,pa2 = sigma_union wp1.sigma wp2.sigma in let warn,cond = match Warning.catch ~source:"Condition" - ~severe:false ~effect:"Skip condition value" (C.cond sigma) exp + ~severe:false ~effect:"Skip condition value" + (C.cond sigma) exp with | Warning.Result(warn,cond) -> warn,cond - | Warning.Failed(warn) -> warn , random () + | Warning.Failed(warn) -> warn,random() in let effects = Eset.union wp1.effects wp2.effects in let vcs = @@ -779,9 +787,9 @@ struct let vcs1 = gmap (passify_vc pa1) wp1.vcs in let vcs2 = gmap (passify_vc pa2) wp2.vcs in gbranch - ~left:(assume_vc ~descr:"Then" ~stmt [cond]) - ~right:(assume_vc ~descr:"Else" ~stmt [p_not cond]) - ~both:(branch_vc ~stmt cond) + ~left:(assume_vc ~descr:"Then" ~stmt ~warn [cond]) + ~right:(assume_vc ~descr:"Else" ~stmt ~warn [p_not cond]) + ~both:(branch_vc ~stmt ~warn cond) vcs1 vcs2 in { sigma = Some sigma ; vcs=vcs ; effects=effects }) () diff --git a/src/plugins/wp/cfgWP.mli b/src/plugins/wp/cfgWP.mli index 27505452e157379cadd90df35b1dc4db2d44575f..39bc56d39de273872c716d01c80618134791bc34 100644 --- a/src/plugins/wp/cfgWP.mli +++ b/src/plugins/wp/cfgWP.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/cil2cfg.ml b/src/plugins/wp/cil2cfg.ml index ae0025dcf59a544561d22ae3ab51de9e3a752c58..efd9569b8ed630b3fff651e8494b2205fc35d782 100644 --- a/src/plugins/wp/cil2cfg.ml +++ b/src/plugins/wp/cil2cfg.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -569,11 +569,11 @@ let get_exit_edges cfg src = let edges = try let edge = next_edge cfg src in - if false || is_next_edge edge then + if is_next_edge edge then (* needs to look at all node between the next node and the source *) snd (do_preds (edge_dst edge) (Nset.empty, [])) else do_node src [] - with Exit -> [] + with Exit | Not_found -> [] in if edges = [] then debug "[get_exit_edges] -> empty"; @@ -611,11 +611,12 @@ let rec get_edge_next_stmt cfg e = | None -> get_next v_after let get_post_logic_label cfg v = - match get_post_edges cfg v with [] -> None - | e::_ -> (* TODO: is this ok to consider only one edge ? *) - match get_edge_next_stmt cfg e with - | None -> None - | Some s -> Some (Clabels.mk_logic_label s) + match get_post_edges cfg v with + | [] -> None + | e::_ -> (* TODO: is this ok to consider only one edge ? *) + match get_edge_next_stmt cfg e with + | None -> None + | Some s -> Some (Cil_types.BuiltinLabel(Some s,Post)) let blocks_closed_by_edge cfg e = debug "[blocks_closed_by_edge] for %a...@." pp_edge e; @@ -773,9 +774,14 @@ let get_call_type fct = * processed if through [cfg_stmt]. It is important that the created node * is the same than while the 'normal' processing ! That is why * this pattern matching might seem redundant with the other one. *) -let get_stmt_node env s = match s.skind with - | Instr (Call (res, fct, args, _)) -> - get_node env (Vcall (s, res, get_call_type fct, args)) +let get_stmt_node env s = + let do_call res fct args _loc = + get_node env (Vcall (s, res, get_call_type fct, args)) + in + match s.skind with + | Instr (Call (res, fct, args, loc)) -> do_call res fct args loc + | Instr (Local_init (v, ConsInit(f, args, kind), loc)) -> + Cil.treat_constructor_as_func do_call v f args kind loc | Block b -> get_node env (VblkIn (Bstmt s,b)) | UnspecifiedSequence seq -> let b = Cil.block_from_unspecified_sequence seq in @@ -800,14 +806,9 @@ let rec cfg_stmts env stmts next = match stmts with ns and cfg_block env bkind b next = - (* - match b.bstmts with - | [] -> next - | _ -> - *) let in_blk = get_node env (VblkIn (bkind, b)) in - let _ = add_edge env in_blk Enext next in let out_blk = get_node env (VblkOut (bkind, b)) in + let _ = add_edge env in_blk Enext out_blk in let _ = add_edge env out_blk Enone next in let first_in_blk = cfg_stmts env b.bstmts out_blk in let _ = add_edge env in_blk Enone first_in_blk in @@ -853,6 +854,14 @@ and cfg_stmt env s next = let exit_node = get_node env (Vexit) in add_edge env in_call Enone exit_node; in_call + | Instr (Local_init(_,ConsInit (f, _, _), _)) -> + let kf = Globals.Functions.get f in + Statuses_by_call.setup_all_preconditions_proxies kf; + let in_call = get_stmt_node env s in + add_edge env in_call Enone next; + let exit_node = get_node env Vexit in + add_edge env in_call Enone exit_node; + in_call | Instr _ | Return _ -> let n = get_stmt_node env s in add_edge env n Enone next; diff --git a/src/plugins/wp/cil2cfg.mli b/src/plugins/wp/cil2cfg.mli index 6cbf2b795747723b17e8121dec449e5b7ef98482..8dafd93d61ebad22d5b8e30d64929d7921cca428 100644 --- a/src/plugins/wp/cil2cfg.mli +++ b/src/plugins/wp/cil2cfg.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/clabels.ml b/src/plugins/wp/clabels.ml index 810b99e5d9fd81e16ccca7f84c99241e160f2cfd..e5aef1c077638be914d38c96648cd7fcb1ea2ba0 100644 --- a/src/plugins/wp/clabels.ml +++ b/src/plugins/wp/clabels.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -93,25 +93,27 @@ let rec names_at = function else ("case" ^ Int64.to_string n) :: names_at labels let c_label = function - | LogicLabel (None, "Init") -> Init - | LogicLabel (None, "Here") -> Here - | LogicLabel (None, "Pre") -> Pre - | LogicLabel (None, "Post") -> Post - | LogicLabel (None, "Exit") -> Exit - | LogicLabel (None, l) -> LabelParam l - | LogicLabel (Some stmt, _) + | BuiltinLabel (None, Cil_types.Init) -> Init + | BuiltinLabel (None, Cil_types.Here) -> Here + | BuiltinLabel (None, Cil_types.Pre) -> Pre + | BuiltinLabel (None, Cil_types.Post) -> Post + | BuiltinLabel (None, Old) -> LabelParam "Old" + | BuiltinLabel (None, LoopEntry) -> LabelParam "LoopEntry" + | BuiltinLabel (None, LoopCurrent) -> LabelParam "LoopCurrent" + | FormalLabel "Exit" -> Exit + | FormalLabel l -> LabelParam l + | BuiltinLabel (Some stmt, _) | StmtLabel { contents=stmt } -> At(names_at stmt.labels,stmt) -(*TODO [LC] : Use extension of Clabels instead *) -let loop_head_label s = - LogicLabel (None, "wp!loop_"^(string_of_int s.sid)^"_head") +let mk_stmt_label s = + let clab = names_at s.labels in + let clab = if clab = [] then ["wp!stmt_"^(string_of_int s.sid)] else clab in + At(clab,s) -(*TODO [LC] : Use extension of Clabels instead *) -let mk_logic_label s = - LogicLabel (Some s, "wp!stmt_"^(string_of_int s.sid)) - -let mk_stmt_label s = (* TODO: clean that !*) c_label (mk_logic_label s) -let mk_loop_label s = (* TODO: clean that !*) c_label (loop_head_label s) +(* [VP 2017-08-03] It's extremely fishy to use a LabelParam here, + but this is what the old normalization did before refactoring + of Cil_types.logic_label *) +let mk_loop_label s = LabelParam ("wp!loop_"^(string_of_int s.sid)^"_head") let lookup_name = function | Init -> "Init" @@ -129,11 +131,15 @@ let lookup_name = function let lookup labels param = try - let is_param p = function (LogicLabel (None, a),_) -> a = p | _ -> false - in c_label (snd (List.find (is_param param) labels)) - with Not_found -> - Wp_parameters.fatal - "Unbound label parameter '%s' in predicate or function call" param + let is_param p = function + | FormalLabel a,_ -> a = p + | BuiltinLabel (None, a),_ -> + let a = Format.asprintf "%a" Printer.pp_logic_builtin_label a in a = p + | _ -> false + in + c_label (snd (List.find (is_param param) labels)) + with Not_found -> Wp_parameters.fatal + "Unbound label parameter '%s' in predicate or function call" param (* Label Iterator *) diff --git a/src/plugins/wp/clabels.mli b/src/plugins/wp/clabels.mli index 07b27c8f0f9f849271d34d7a39268da3a2fa492d..4aee870b283b49a1a86222d0af3f5de00daf6b2e 100644 --- a/src/plugins/wp/clabels.mli +++ b/src/plugins/wp/clabels.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -50,12 +50,6 @@ module T : sig type t = c_label val compare : t -> t -> int end module LabelMap : FCMap.S with type key = c_label module LabelSet : FCSet.S with type elt = c_label -(** @return a label that represent the first point of a loop body. *) -val loop_head_label : Cil_types.stmt -> Cil_types.logic_label - -(** create a virtual label to a statement (it can have no label) *) -val mk_logic_label : Cil_types.stmt -> Cil_types.logic_label - val mk_stmt_label : Cil_types.stmt -> c_label val mk_loop_label : Cil_types.stmt -> c_label diff --git a/src/plugins/wp/configure.ac b/src/plugins/wp/configure.ac index f8ec39072a36f777e46cd6199bb7518b0e3380d1..5972b22dd2939759d495efb7df234ddf834f5abd 100644 --- a/src/plugins/wp/configure.ac +++ b/src/plugins/wp/configure.ac @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # @@ -63,7 +63,7 @@ if test "$ENABLE_WP" != "no"; then if test "$COQC" = "yes" ; then COQVERSION=`coqc -v | sed -n -e 's|.*version* *\([[^ ]]*\) .*$|\1|p' ` case $COQVERSION in - 8.4pl6|8.5*|trunk) + 8.5*|8.6*|trunk) AC_MSG_RESULT(coqc version $COQVERSION found) ;; *) @@ -72,7 +72,7 @@ if test "$ENABLE_WP" != "no"; then ;; esac else - AC_MSG_NOTICE(rerun configure to make wp using coq 8.5) + AC_MSG_NOTICE(rerun configure to make wp using coq 8.5+) fi else COQC="no" diff --git a/src/plugins/wp/ctypes.ml b/src/plugins/wp/ctypes.ml index 9f3e2669776b584390c582a7c1826261a6664a7d..e02699bee3381e2c9fd358b81e96bcb02ebda1a1 100644 --- a/src/plugins/wp/ctypes.ml +++ b/src/plugins/wp/ctypes.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -87,28 +87,6 @@ let c_int ikind = | ILongLong -> make_c_int true mach.sizeof_longlong | IULongLong -> make_c_int false mach.sizeof_longlong -(* Bounds of an integer according to c_int ti : - An integer i : i \in [c_int_bounds ti] if - [c_int_bounds ti] = (min,max) then min <=i<max.*) -let c_int_bounds = - let uint8 = Integer.zero, Integer.of_string "256" - and sint8 = Integer.of_string "-128", Integer.of_string "128" - and uint16 = Integer.zero, Integer.of_string "65536" - and sint16 = Integer.of_string "-32768", Integer.of_string "32768" - and uint32 = Integer.zero, Integer.of_string "4294967296" - and sint32 = Integer.of_string "-2147483648", Integer.of_string "2147483648" - and uint64 = Integer.zero, Integer.of_string "18446744073709551616" - and sint64 = Integer.of_string "-9223372036854775808", Integer.of_string "9223372036854775808" - in function - | UInt8 -> uint8 - | SInt8 -> sint8 - | UInt16 -> uint16 - | SInt16 -> sint16 - | UInt32 -> uint32 - | SInt32 -> sint32 - | UInt64 -> uint64 - | SInt64 -> sint64 - let c_int_all = [ UInt8 ; SInt8 ; UInt16 ; SInt16 ; UInt32 ; SInt32 ; UInt64 ; SInt64 ] @@ -147,15 +125,15 @@ let c_float fkind = | FDouble -> make_c_float mach.sizeof_double | FLongDouble -> make_c_float mach.sizeof_longdouble -let sub_c_float f1 f2 = f_bits f1 <= f_bits f2 +let equal_float f1 f2 = f_bits f1 = f_bits f2 (* Array objects, with both the head view and the flatten view. *) type arrayflat = { arr_size : int ; (* number of elements in the array *) - arr_dim : int ; (* number of dimensions in the array *) - arr_cell : typ ; (* type of elementary cells of the flatten array *) - arr_cell_nbr : int ; (* number of elementary cells in the flatten array *) + arr_dim : int ; (* number of dimensions in the array *) + arr_cell : typ ; (* type of elementary cells of the flatten array *) + arr_cell_nbr : int ; (* number of elementary cells in the flatten array *) } type arrayinfo = { @@ -211,6 +189,20 @@ let i_iter f = let f_iter f = List.iter f [Float32;Float64] +(* -------------------------------------------------------------------------- *) +(* --- Bounds --- *) +(* -------------------------------------------------------------------------- *) + +let i_bounds i = + if signed i then + let m = Integer.two_power_of_int (i_bits i - 1) in + Integer.neg m , Integer.pred m + else + let m = Integer.two_power_of_int (i_bits i) in + Integer.zero , Integer.pred m + +let bounds i = i_memo i_bounds i + (* -------------------------------------------------------------------------- *) (* --- Pretty Printers --- *) (* -------------------------------------------------------------------------- *) @@ -409,16 +401,6 @@ let rec object_of_logic_pointed t = "@[<hov 2>pointed of logic type@ (%a)@]" Printer.pp_logic_type t -let array_dim arr = - match arr.arr_flat with - | Some f -> object_of f.arr_cell , f.arr_dim - 1 - | None -> - let rec collect_dim arr n = - match object_of arr.arr_element with - | C_array arr -> collect_dim arr (succ n) - | te -> te,n - in collect_dim arr 1 - let rec array_dimensions a = let te = object_of a.arr_element in let d = match a.arr_flat with None -> None | Some f -> Some f.arr_size in @@ -451,6 +433,11 @@ let get_array_size = function | C_array a -> array_size a | _ -> None +let get_array_dim = function + | C_array { arr_flat=Some a } -> a.arr_dim + | C_array _ -> 1 + | _ -> 0 + let get_array = function | C_array a -> Some( object_of a.arr_element, array_size a ) | _ -> None @@ -518,12 +505,6 @@ let promote a1 a2 = | _ -> WpLog.not_yet_implemented "promotion between arithmetics and pointer types" -let merge a b = - match a,b with - | C_int i, C_int i' -> if sub_c_int i' i then a else b - | C_float f , C_float f' -> if sub_c_float f' f then a else b - | _ -> assert (equal a b) ; a - let rec basename = function | C_int i -> Format.asprintf "%a" pp_int i | C_float f -> Format.asprintf "%a" pp_float f diff --git a/src/plugins/wp/ctypes.mli b/src/plugins/wp/ctypes.mli index a2f5846af9625394795bf3814078ee9ff75f9c80..20325429ec9ccc5da8c4bafe85427c26ef0606e9 100644 --- a/src/plugins/wp/ctypes.mli +++ b/src/plugins/wp/ctypes.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -100,13 +100,13 @@ val get_int : exp -> int64 option val i_bits : c_int -> int (** size in bits *) val i_bytes : c_int -> int (** size in bytes *) val signed : c_int -> bool (** [true] if signed *) -val c_int_bounds: c_int -> Integer.t * Integer.t +val bounds: c_int -> Integer.t * Integer.t (** domain, bounds included *) (** All sizes are in bits *) val sub_c_int: c_int -> c_int -> bool -val sub_c_float : c_float -> c_float -> bool +val equal_float : c_float -> c_float -> bool val sizeof_defined : c_object -> bool val sizeof_object : c_object -> int @@ -118,8 +118,8 @@ val is_comp : c_object -> compinfo -> bool val is_array : c_object -> elt:c_object -> bool val get_array : c_object -> ( c_object * int option ) option val get_array_size : c_object -> int option +val get_array_dim : c_object -> int val array_size : arrayinfo -> int option -val array_dim : arrayinfo -> c_object * int val array_dimensions : arrayinfo -> c_object * int option list (** Returns the list of dimensions the array consists of. None-dimension means undefined one. *) @@ -137,7 +137,6 @@ val pp_object : Format.formatter -> c_object -> unit val basename : c_object -> string val compare : c_object -> c_object -> int val equal : c_object -> c_object -> bool -val merge : c_object -> c_object -> c_object val hash : c_object -> int val pretty : Format.formatter -> c_object -> unit diff --git a/src/plugins/wp/doc/manual/wp.tex b/src/plugins/wp/doc/manual/wp.tex index b4c83bdfa440410eef8e314d864261b310c206d2..3197362a4879014e0492f9e29a95e95d14f68a9d 100644 --- a/src/plugins/wp/doc/manual/wp.tex +++ b/src/plugins/wp/doc/manual/wp.tex @@ -40,7 +40,6 @@ CEA LIST, Software Safety Laboratory \input{wp_intro.tex} \input{wp_plugin.tex} \input{wp_models.tex} -\input{wp_arith.tex} \input{wp_simplifier.tex} %%TODO diff --git a/src/plugins/wp/doc/manual/wp_arith.tex b/src/plugins/wp/doc/manual/wp_arith.tex deleted file mode 100644 index 5a9c98ba17947253b87cec9447a60786ca3fb035..0000000000000000000000000000000000000000 --- a/src/plugins/wp/doc/manual/wp_arith.tex +++ /dev/null @@ -1,80 +0,0 @@ -\chapter{WP Arithmetic Models} -\label{wp-models} - -Arithmetic models are responsible for modeling the integral and floating point -operations of \textsf{C} and \textsf{ACSL} into mathematical integers and reals. -The exact representation of machine operation into logic is -straightforward by using \textsf{ACSL} interpretation. However, this leads to -very difficult proof obligations for usual solvers which are not that efficient with -modular arithmetic. - -Hence, the \textsf{WP} proposes an aggressive simplification by using -separation of concerns: most machine operations are identical to their -pure mathematical counterpart unless an overflow occurs, and most -overflows are subject to unexpected behavior of the source code -- -excluding explicit conversions. - -To cope with various usage and needs, the \textsf{WP} plug-in proposes -three integral models and two floating point models: -\begin{quote} - \begin{tabular}{cl} - \hline - \texttt{Cint} & an exact model for machine integers \\ - \texttt{Natural} & a model assuming the absence of overflow \\ - \texttt{NoRange} & a model forgetting all integral bounds \\ - \hline - \texttt{Float} & an \emph{opaque} model for floating points \\ - \texttt{Real} & a model where all rounding are discarded \\ - \hline - \end{tabular} -\end{quote} - -The selection of the model is performed \textit{via} the \texttt{-wp-model} option (Cf.~\ref{wp-cmdline}). - -\section{Integral Models} - -We distinguish various kinds of machine-integral operations: -the domains of a \textsf{C}-integer types, the conversions of integer into a \textsf{C}-integer, -the usual arithmetic operations (addition, \textit{etc.}), and the logical bitwise operations. -Each model correspond to a specific choice for each kind of operations. - -The real machine operations depend on the \emph{signedness} and \emph{size} of the -\textsf{C}-integer types of its operands and result. We known detail how each model interpret machine operations. - -\paragraph{Domain.} Actually, any \textit{signed} $2n$-bits integer lives in -$[-2^{n}\ldots 2^{n}-1]$~; -and an \textit{unsigned} integer with the same size lives in range $[0\ldots 2^{2n}-1]$. -This is exactly rendered by the \texttt{Cint} and \texttt{Natural} model. -For the \texttt{NoRange} model, we simply erase the bounds but keep their signedness, -such that \textit{unsigned} integers are considered living in $[-\infty\ldots+\infty]$, -and \textit{signed} ones in $[0\ldots+\infty]$. - -\paragraph{Conversions.} Conversions explicitly introduced by casts are rendered exactly by a -modulus extraction in the \texttt{Cint} and \texttt{Natural} models. -For the \texttt{NoRange} model, since bounds are erased, no modulus is applied and the conversion -is replaced by the identity function. - -\paragraph{Arithmetics.} Usual operations (addition, multiplication, division, modulus) are -correctly rendered with a modulus extraction in the \texttt{Cint} model, -such that $a \oplus b \equiv \mathtt{(int)}(a+b)$ for the additions of -two \texttt{int} expressions $a$ and $b$. In the \texttt{Natural} and \texttt{NoRange} models, -the modulus is simply erased: in the natural model, we assume the absence of overflow, and without range, the conversion is considered an identity. - -\paragraph{Bitwise.} Logical bitwise operations (logical-or, logical-not, shifts, \emph{etc.}) -are correctly rendered with the \texttt{Cint} and \texttt{Natural} model by a modulus extraction of -their \textsf{ACSL} counterpart, which are precisely defined over natural integers. Notice that -in practice, only few \textit{unsigned} operations actually require a modulus. With the \texttt{NoRange} domain, modulus is simply never applied. - -The various interpretation of each kind of machine operation by the various models are summarized in the table below, with deviations from the actual behavior in italic: -\begin{center} - \begin{tabular}{rccc} - & \texttt{Cint} & \texttt{Natural} & \texttt{NoRange} \\ - \hline - \textbf{Domain} & bounds & bounds & \textit{signed} \\ - \textbf{Conversion} & modulus & modulus & \textit{identity} \\ - \textbf{Bitwise} & modulus & modulus & \textit{identity} \\ - \textbf{Arithmetic} & modulus & \textit{integral} & \textit{integral} \\ - \hline - \end{tabular} -\end{center} - diff --git a/src/plugins/wp/doc/manual/wp_calculus.tex b/src/plugins/wp/doc/manual/wp_calculus.tex index 15771ed63c6083a07ec919942bddfd8d6ebe0c1e..a4f02dde5a53485e99859b1996290964b869d834 100644 --- a/src/plugins/wp/doc/manual/wp_calculus.tex +++ b/src/plugins/wp/doc/manual/wp_calculus.tex @@ -86,7 +86,7 @@ to the exit node of the control flow graph. If the statement behavior is not the selected one, its properties are used as hypotheses. -When used as an hypothesis, the statement assigns property is different +When used as a hypothesis, the statement assigns property is different than other annotations because it is not used as a predicate. It is stored at the statement output point along with a label to identify the statement entry point. It will be used to skip the statement @@ -197,7 +197,7 @@ because without it, the calculation would not terminate. If the cut property is selected as a goal, it is propagated, so we have \(P = C\). Otherwise, there is nothing to propagate, so \(P = true\). -As an hypothesis, $C$ is used to prove \(WP(X)\). +As a hypothesis, $C$ is used to prove \(WP(X)\). So there is a proof obligation: \[ P' \; = \; C \Rightarrow WP(X) \] $P'$ cannot be integrated in \(R(X)\) because in might depend on @@ -304,11 +304,11 @@ a default {\bf loop invariant} with the predicate {\it true} is used. In that case, the WP for the back-edges is then {\it true}. For the entry edges, it would normally be also {\it true} according to the application of the cutting rule, but that wouldn't give much information! -Instead of that, a mandatory loop assigns property is used as an hypothesis. +Instead of that, a mandatory loop assigns property is used as a hypothesis. As for the function call, if the annotation table doesn't provide it, it is considered to be {\it everything}. This hypothesis is used to quantify the annotation at the loop head, -and then it can be propagated it to the entry edges.\\ +and then it can be propagated backward from entry edges.\\ For the loops that are not natural ones, invariant properties breaking the cycles are mandatory. diff --git a/src/plugins/wp/doc/manual/wp_intro.tex b/src/plugins/wp/doc/manual/wp_intro.tex index 68165a3ee5618bdf2245a66c0e63c575933f00e6..da74357a7b980d3af92104006171c1c51d367aa9 100644 --- a/src/plugins/wp/doc/manual/wp_intro.tex +++ b/src/plugins/wp/doc/manual/wp_intro.tex @@ -296,7 +296,7 @@ them to generate efficient proof obligations. \paragraph{Remark.} The original \texttt{Store} and \texttt{Runtime} memory models are no -longer available since \textsf{WP} version \verb+0.7+; the \texttt{Typed} model +longer available since \textsf{WP} version \verb+0.7+ (Fluorine); the \texttt{Typed} model replaces the \texttt{Store} one; the \texttt{Runtime} model will be entirely re-implemented as \texttt{Bytes} model in some future release. diff --git a/src/plugins/wp/doc/manual/wp_plugin.tex b/src/plugins/wp/doc/manual/wp_plugin.tex index 1d73181de410c165973b76a941ce9327f66a8ead..653b99f39b227e9a69f81029f6b74ada5cbce544 100644 --- a/src/plugins/wp/doc/manual/wp_plugin.tex +++ b/src/plugins/wp/doc/manual/wp_plugin.tex @@ -36,7 +36,7 @@ The natively supported provers are: \hline \textsf{Alt-Ergo} & \verb|0.99.1|, \verb|1.01| and \verb|1.30| & \url{http://alt-ergo.ocamlpro.com} & \cite{AltErgo2006}\\ - \textsf{Coq} & \verb|8.5| & + \textsf{Coq} & \verb|8.5| or \verb|8.6| & \url{http://coq.inria.fr} & \cite{Coq84}\\ \textsf{Why3} & \verb|0.87| & \url{http://why3.lri.fr} & \cite{Why3}\\ @@ -71,7 +71,7 @@ libraries manually, you can still run: \end{logs} \paragraph{Remark.} The \textsf{Why}~\cite{Filliatre2003} prover is no longer supported -since \textsf{WP} version \verb+0.7+. +since \textsf{WP} version \verb+0.7+ (Fluorine). \clearpage %----------------------------------------------------------------------------- @@ -298,8 +298,8 @@ This runs all existing scripts (none at the very beginning) in success-mode only \newcommand{\TACTIC}[2]{#1\quad\quad\triangleright\quad\quad#2} -\paragraph{Absurd} Contradict an Hypothesis\\ -The user can select an hypothesis $H$, and change the goal to $\neg H$: +\paragraph{Absurd} Contradict a Hypothesis\\ +The user can select a hypothesis $H$, and change the goal to $\neg H$: $$ \TACTIC{\Delta,H\models\,G}{\Delta\models\,\neg H} $$ @@ -324,7 +324,7 @@ $$ \TACTIC{ a = b }{ \bigwedge a.f_i = b.f_i } $$ \paragraph{Contrapose} Swap and Negate Hypothesis with Conclusion\\ -The user select an hypothesis (typically, a negation) and swap it with the goal. +The user select a hypothesis (typically, a negation) and swap it with the goal. $$ \TACTIC{\Delta,H\models\,G}{\Delta,\neg G\models\,\neg H} $$ \paragraph{Cut} Use Intermerdiate Hypothesis @@ -354,7 +354,7 @@ The tactic also have a variant where only hypotheses \emph{not relevant} to the This is a variant of the \texttt{Lemma} tactic dedicated to \texttt{Havoc} predicate generate by complex assigns clause. The user select an address, and if the address is not assigned by the \texttt{Havoc} clause, the memory at this address is unchanged. \paragraph{Instance} Instantiate properties\\ -The user selects an hypothesis with one or several $\forall$ quantifiers, or an $\exists$ quantified goal. Then, with the composer, the use choose to instantiate one or several of the quantified parameters. In case of $\forall$ quantifier over integer, a range of values can be instantiated instead. +The user selects a hypothesis with one or several $\forall$ quantifiers, or an $\exists$ quantified goal. Then, with the composer, the use choose to instantiate one or several of the quantified parameters. In case of $\forall$ quantifier over integer, a range of values can be instantiated instead. When instantiating hypothesis with an expression $e$: $$\TACTIC{\Delta,\,\forall x\, P(x)\models G}{\Delta,P(e)\models G}$$ @@ -369,7 +369,7 @@ $$\TACTIC{\Delta\models \exists x\,G(x)}{\Delta\models G(e)}$$ The user start by selecting a term in the goal. Then, the search button in the tactic panel will display a list of lemma related to the term. Then, he can instantiate the parameters of the lemma, like with the Instance tactic. \paragraph{Intuition} Decompose with Conjunctive/Disjunctive Normal Form\\ -The user can select an hypothesis or a goal with nested conjunctions and disjunctions. The tactics then computes the conjunctive or disjunctive normal form of the selection and split the goal accordingly. +The user can select a hypothesis or a goal with nested conjunctions and disjunctions. The tactics then computes the conjunctive or disjunctive normal form of the selection and split the goal accordingly. \paragraph{Range} Enumerate a range of values for an integer term\\ The user select any integer expression $e$ in the proof, and a range of numerical values $a\ldots b$. The proof goes by case for each $e=a\ldots e=b$, plus the side cases $e<a$ and $e>b$: @@ -383,7 +383,7 @@ $$\TACTIC{\Delta\models\,G}{% \end{array}} $$ \paragraph{Rewrite} Replace Terms\\ -This tactic uses an equality in hypothesis to replace each occurrence of term by another one. +This tactic uses an equality in a hypothesis to replace each occurrence of term by another one. The tactic exists with two variants: the left-variant which rewrites $a$ into $b$ from equality $a=b$, and the right-variant which rewrites $b$ into $a$ from equality $a=b$. The original equality hypothesis is removed from the goal. @@ -429,6 +429,104 @@ Finally, when the user select a arithmetic comparison over $a$ and $b$, the tact \paragraph{Definition} Unfold predicate and logic function definition\\ The user simply select a term $f(e_1,\ldots,e_n)$ or a predicate $P(e_1,\ldots,e_n)$ which is replaced by its definition, when available. +\paragraph{Bitwise} Decompose equalities over $N$-bits\\ +The use selects an integer equality and a number of bits. +Providing the two members of the equality are in range $0..2^N-1$, +the equality is decomposed into $N$ bit-tests equalities: +\[\TACTIC{\Delta\models G}{% +\begin{array}[t]{rcl} +\Delta\phantom{)} &\models & 0 \leq a,b < 2^N \\ +\sigma(\Delta) & \models & \sigma(G) +\end{array} +}\] +where $\sigma$ is the following subsitution: +\[ \sigma \equiv +\left[ a=b \quad \leftarrow +\bigwedge_{k\in 0..N-1} \mathtt{bit\_test}(a,k) = \mathtt{bit\_test}(b,k) +\right] +\] + +The \lstinline{bit_test(a,b)} function is predefined in \textsf{WP} and is equivalent +to the \textsf{ACSL} expression \lstinline{(a & (1 << k)) != 0}. The +\textsf{Qed} engine has many simplification rules that applies to +such patterns, and the a tactic is good way to reason over bits. + +\paragraph{Shift} Transform logical shifts into arithmetics\\ +For positive integers, logical shifts such as \lstinline{a << k} +and \lstinline{a >> k} where \lstinline$k$ is a constant can be interpreted into a multiplication or a division by $2^k$. + +When selecting a logical-shift, the tactic performs: +\[\TACTIC{\Delta\models G}{% +\begin{array}[t]{rcl} +\Delta\phantom{)} &\models& 0 \leq a \\ +\sigma(\Delta) &\models& \sigma(G) +\end{array} +}\] +where: +\begin{tabular}[t]{ll} +$\sigma = [ \mathtt{lsl}(a,k) \leftarrow a * 2^k ]$ & +for left-shift, \\ +$\sigma = [ \mathtt{lsr}(a,k) \leftarrow a / 2^k ]$ & +for right-shifts. +\end{tabular} + +\paragraph{BitRange} Range of logical bitwise operators \\ +This tactical applies the two following lemmas to the current goal. +The first lemma is on logical-or, and only applies to positive integers: +\[ +\begin{array}{c} + \bigwedge_i 0 \leq x_i < 2^p + \\\hline + 0 \leq \mathtt{lor}(x_1,\ldots,x_n) \leq 2^p +\end{array} +\] + +The second lemma is on logical-and, and applies to at-least one positive integer: +\[ +\begin{array}{c} + \bigvee_i 0 \leq x_i \quad\wedge\quad \bigwedge_i x_i \leq 2^p + \\\hline + 0 \leq \mathtt{land}(x_1,\ldots,x_n) \leq 2^p +\end{array} +\] + +The tactical rewrites range goals on logical and/or into the corresponding range over its parameters, by finding a suitable $2^p$ +to apply the theorems. Such a strategy is \emph{not} complete in general. +Typically, $\mathtt{land}(x,y) < 38$ is true whenever both $x$ and $y$ are in range $0\ldots 31$, but this is also true +in other cases. + +\paragraph{Ratio} Simplify Divisions and Products \\ +This tactic rewrites integer comparisons involving products and divisions. +The tactic applies one of the following theorems to the current goal. +In the following lemmas, $k$, $k'$, and $n$ are integer constants, $a$ and $b$ any integer terms. +The notation $k|n$ stands for $k$ divides $n$. +The lemmas are extended to non-strict inequalities and non-positive constants in a natural way. +\[ +\begin{array}{crcl} +0<k, & a < n/k &\Longrightarrow& k.a < n \\ +k|n, & a = n/k &\Longleftrightarrow& k.a = n \\ +\neg(k|n), & k.a = n & \Longrightarrow & \mathtt{false} \\ +0<k, & a < k.(b+1) &\Longrightarrow& a/k < b \\ +0<k, 0<k', & k'.a < k.b &\Longrightarrow& a/k < b/k' \\ +n|k, n|k', & (k/n).a = (k'/n).b &\Longleftrightarrow& k.a = k'.b +\end{array} +\] + +\paragraph{Overflow} Integer Conversions \\ +This tactic rewrites machine integer conversions by identify, +providing the converted value is in available range. The tactic applies on expression +with pattern $\mathtt{to\_iota(e)}$ where \texttt{iota} is a a machine-integer name, +\emph{eg.} \texttt{to\_uint32}. + +\[\TACTIC{\Delta\models G}{% +\begin{array}[t]{rcl} +\Delta\phantom{)} &\models & a \leq e \leq b \\ +\sigma(\Delta) & \models & \sigma(G) +\end{array} +}\] +where $\sigma = [ \mathtt{to\_iota}(e) \mapsto e ]$ and $[a..b]$ is the range +of the \texttt{iota} integer domain. + \subsection{Strategies} Strategies are heuristics that generate a prioritized bunch of tactics to be tried on the current goal. @@ -529,8 +627,8 @@ Selections are easy to build. There are five basic forms, as described below: \begin{lstlisting}[language=ocaml] type Tactical.selection = | Empty (** no selection *) - | Clause of clause (** selects an full hypothesis or the full goal *) - | Inside of clause * Lang.F.term (** selects a sub-term of an hypothesis or goal *) + | Clause of clause (** selects a full hypothesis or the full goal *) + | Inside of clause * Lang.F.term (** selects a sub-term of a hypothesis or goal *) | Compose of compose (** a calculus from several sub-selections *) and Tactical.clause = | Goal of Lang.F.pred @@ -720,12 +818,17 @@ The available \textsf{WP} command-line options related to model selection are: \item[\tt -warn-(un)signed-(overflow|downcast)] those kernel options are used by the (default) arithmetic model \texttt{-wp-model +int} to interpret integer - arithmetics. See section~\ref{wp-model-arith} for details. + arithmetic. See section~\ref{wp-model-arith} for details. -\item[\tt -wp-literals] exports the contents of string literals +\item[\tt -wp-(no)-overflows] explicitly add to proof context the assumptions related + to overflows and downcasts selected. This is especially useful when casts are inserted + in \textsf{ACSL} contracts to ensure type-checking but are related to identity-casts + from the code. The option is \texttt{off} by default. + +\item[\tt -wp-literals] exports the contents of string literals to provers (default: \texttt{no}). \item[\tt -wp-extern-arrays] gives an arbitrary large size to arrays - with no dimensions. This is a modelization of infinite size arrays + with no dimensions. This is a model of infinite size arrays (default is: \texttt{no}). \item[\tt -wp-(alias|unalias|ref|context)-vars <var,...>] these options can be used to finely tweak the memory model inferred by \textsf{WP}. Each variable with a given name @@ -736,6 +839,12 @@ The available \textsf{WP} command-line options related to model selection are: \texttt{ref}: & the variable is a constant pointer and is modeled by the \texttt{Ref}.\\ \texttt{context}: & the variable is initially non-aliased and uses a fresh global in \texttt{Typed}.\\ \end{tabular} +\item[\tt -wp-(no)-volatile] this option (de)activate the correct handling of + volatile access. By default, accessing a volatile l-value returns an undefined + value, and writing to a volatile l-value is modeled like an \textsf{ACSL} assigns clause. + Hence, only the accessed \emph{values} are ignored.\\ + Setting \texttt{-wp-no-volatile} turns this behavior off: it is potentially \emph{unsound} and + makes the \textsf{WP} emitting a warning on each volatile access. \item[\tt -wp-print-separation] this option activate the calculus of separation hypotheses for the generated proof obligations. For each model supporting this feature, and each concerned function, an \textsf{ACSL} specification is printed on output. @@ -751,7 +860,7 @@ weakest precondition calculus. \begin{description} \item[\tt -wp-(no)-rte] generates RTE guards before computing weakest preconditions. This option calls the \emph{rte generation} plug-in - before generating proof obligations. + before generating proof obligations. The generated guards, when proved\footnote{It is still correct to prove these RTE annotations with the \textsf{WP} plug-in.}, fulfill the requirements for using the \textsf{WP} plug-in with the default machine-integer domain (default is: \texttt{no}). @@ -762,22 +871,9 @@ weakest precondition calculus. \item[\tt -wp-(no)-split] conjunctions in generated proof obligations are recursively split into sub-goals. The generated goal names are suffixed by ``{\tt part<{\it n}>}'' (defaults to \texttt{no}). -\item[\tt -wp-(no)-invariants] computes proof obligations for arbitrary invariants - inside loops. Also modifies the calculus for proper loop invariants%% - \footnote{To be efficient, it is better to put all the loop - invariants inside only one annotation. Otherwise, \textsf{Frama-C} - inserts them at different program points. Then, the \textsf{WP} calculus cuts - the generated proof obligations at each invariant instead of - proving all of them inside the same induction scheme. - \noindent Notice that, when using the \textsf{ACSL-Importer} - plug-in, all the loop invariants are placed at one unique program - point, and are treated efficiently by the \textsf{WP} plug-in.} - (default is: \texttt{no}). \item[\tt -wp-(no)-callee-precond] includes preconditions of the callee after\footnote{Proof obligations are always generated to check preconditions.} a call (default is: \texttt{yes}). -\item[\tt -wp-(no)-init-const] uses initializers for global \texttt{const} variables - (default is: \texttt{no}). \item[\tt -wp-(no)-dynamic] handles calls \textit{via} function pointers (experimental, default is: \texttt{no}). \end{description} @@ -798,24 +894,43 @@ multi-trigger for their associated free variables. \subsection{Qed Simplifier Engine} These options control the simplifications performed by the \textsf{WP} plug-in before -sending proof obligations to external provers. +sending proof obligations to external provers. The default simplifiers can be +controlled by the following options: \begin{description} \item[\tt -wp-(no)-simpl] simplifies constant expressions and tautologies (default is: \texttt{yes}). -\item[\tt -wp-(no)-clean] removes unused terms and variables from - proof obligations (default is: \texttt{yes}). \item[\tt -wp-(no)-let] propagates equalities by substitutions and let-bindings (default is: \texttt{yes}). +\item[\tt -wp-(no)-core] factorize common properties between branches + (default is: \texttt{yes}). \item[\tt -wp-(no)-pruning] eliminates trivial branches of conditionals (default is: \texttt{yes}). +\item[\tt -wp-(no)-clean] removes unused terms and variables from + proof obligations (default is: \texttt{yes}). +\item[\tt -wp-(no)-ground] replace ground values in equalities + (default is: \texttt{yes}). +\item[\tt -wp-(no)-reduce] replace functions with precedence to constructors and + operators (default is: \texttt{yes}). +\item[\tt -wp-(no)-parasite] eliminate parasite variables + (default is: \texttt{yes}). \item[\tt -wp-(no)-bits] simplifies bitwise operations (default is: \texttt{yes}). +\item[\tt -wp-(no)-init-summarize-array] summarize contiguous initializers + with quantified formulae (default: \texttt{yes}). \item[\tt -wp-(no)-simplify-is-cint] eliminates redundant constraints on integers + (default: \texttt{yes}). +\item[\tt -wp-(no)-simplify-land-mask] tight constants in logical-and with + unsigned integers (default: \texttt{yes}). +\item[\tt -wp-(no)-prenex] normalize nested quantifiers into prenex-form (default: \texttt{no}). - Variables of C-integer types in \verb+\forall+ are promoted to \verb+integer+ variables when possible. - Typically, provided \verb+n+ is already an integer, \verb+\forall unsigned x; x < n ==> ...+ will be simplified into - \verb+\forall integer x; 0 <= x < n ==> ...+. +\item[\tt -wp-(no)-simplify-forall] eliminates integer ranges in quantifiers + (\emph{unsound}, to be used with caution, default is: \texttt{no}). +\item[\tt -wp-(no)-simplify-type] remove type constraints from proof obligation + (\emph{incomplete}, default is: \texttt{no}). +\item[\tt -wp-bound-forall-unfolding <n>] instantiates statically \texttt{n} + instances of $k$ for hypothesis $\forall k \in [n_1..n_2], a = b$ + (default is: \texttt{1000}). \end{description} \subsection{Decision Procedures Interface} @@ -856,6 +971,15 @@ proof obligations are sent to external decision procedures. when goals are not proved (default is: \texttt{no}). \item[\tt -wp-timeout <n>] sets the timeout (in seconds) for the calls to the decision prover (defaults to 10 seconds). +\item[\tt -wp-time-extra <n>] additional time allocated to provers when + replaying a script. This is used to cope with variable machine load. + Default is \verb+5s+. +\item[\tt -wp-time-margin <n>] margin time for considering a proof to be + replayable without a script. When a proof succeed within \verb+timeout-margin+ + seconds, it is considered fully automatic. Otherwise, a script is created + by prover \verb+tip+ to register the proof time. This is used to decrease the + impact of machine load when proof time is closed to the timeout. + Default is \verb+5s+. \end{description} \hrule @@ -927,7 +1051,7 @@ then save the proof scripts in order to replay them in batch mode. \hrule \paragraph{Why3.} -Since \textsf{WP} version \verb+0.7+, native support for \textsf{Why3} +Since \textsf{WP} version \verb+0.7+ (Fluorine), native support for \textsf{Why3} and \textsf{Why3-Ide} are provided. The older system \textsf{Why} \verb+2.x+ is \emph{no} longer supported. \begin{description} @@ -1138,7 +1262,7 @@ by a link (`\user{link};'). The available tags are depicted on figure~\ref{wp-dr \texttt{neutral:} \user{e-link}\texttt{:} & specify \user{e-link} as being the neutral element of the symbol: \\ & $\user{e-link} \odot x = x$ \\ & $x \odot \user{e-link} = x$ \\ -\texttt{inversible:} & specify simplification relying on the existence of an inverse: \\ +\texttt{invertible:} & specify simplification relying on the existence of an inverse: \\ & $x \odot y = x \odot z \Longleftrightarrow y = z$ \\ & $y \odot x = z \odot x \Longleftrightarrow y = z$ \\ \texttt{idempotent:} & specify an idempotent symbol: $x \odot x = x$ \\ diff --git a/src/plugins/wp/doc/tutorial/tests/binary/oracle/binarysearch.res.oracle b/src/plugins/wp/doc/tutorial/tests/binary/oracle/binarysearch.res.oracle index 313b7cf7fbd4a2b4db49ca42170343684b466db0..7b138b4ca17781128aed97ea5ee58a62d3acb40e 100644 --- a/src/plugins/wp/doc/tutorial/tests/binary/oracle/binarysearch.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/binary/oracle/binarysearch.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/binary/binarysearch.i (no preprocessing) [kernel] Parsing binarysearch/binarysearch.c (with preprocessing) [wp] warning: Missing RTE guards diff --git a/src/plugins/wp/doc/tutorial/tests/binary/oracle/lowerbound.res.oracle b/src/plugins/wp/doc/tutorial/tests/binary/oracle/lowerbound.res.oracle index 634e1d838fae8b47e6533cbf489b9402c9ee2481..dafee56c3b91d5e290bddf07e1a3991dd11f82ad 100644 --- a/src/plugins/wp/doc/tutorial/tests/binary/oracle/lowerbound.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/binary/oracle/lowerbound.res.oracle @@ -1,8 +1,6 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/binary/lowerbound.i (no preprocessing) # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing lowerbound/lowerbound.c (with preprocessing) [rte] annotating function lower_bound ------------------------------------------------ diff --git a/src/plugins/wp/doc/tutorial/tests/binary/oracle/upperbound.res.oracle b/src/plugins/wp/doc/tutorial/tests/binary/oracle/upperbound.res.oracle index cd25bfbecd99a3a23aa407c52e05e1b6b5383205..3fca20e9581db651e96695c0d8475add293dc554 100644 --- a/src/plugins/wp/doc/tutorial/tests/binary/oracle/upperbound.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/binary/oracle/upperbound.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/binary/upperbound.i (no preprocessing) [kernel] Parsing upperbound/upperbound.c (with preprocessing) [rte] annotating function upper_bound diff --git a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/compare.res.oracle b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/compare.res.oracle index 73c5b31102a73fd135059589c7405eb5c0ad1179..de32d853ef4d3b9b0d3cafc9c35181d998f416fa 100644 --- a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/compare.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/compare.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/maxmin/compare.i (no preprocessing) [kernel] Parsing compare/compare.c (with preprocessing) ------------------------------------------------ diff --git a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxelt.res.oracle b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxelt.res.oracle index 640f169a1b4c59770a815ea1bce7307cbfce72c2..c57f6f5b0d1677bad94a2bc2bdc165d6dfc156a2 100644 --- a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxelt.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxelt.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/maxmin/maxelt.i (no preprocessing) [kernel] Parsing maxelt/maxelt.c (with preprocessing) [rte] annotating function max_element diff --git a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxeltp.res.oracle b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxeltp.res.oracle index 8807a66c82a5fe87d99cd0eedc0c534b757def60..7e73d6924ab3331f3669feb255c8b2113b1869f0 100644 --- a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxeltp.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxeltp.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/maxmin/maxeltp.i (no preprocessing) [kernel] Parsing maxeltp/maxelt.c (with preprocessing) [rte] annotating function max_element diff --git a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxseq.res.oracle b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxseq.res.oracle index c145b23372ffd0e88c93f39ee38138e2801d19c6..66e1995e102445cbefaa536c43a8da4ff5224e55 100644 --- a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxseq.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/maxseq.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/maxmin/maxseq.i (no preprocessing) [kernel] Parsing maxseq/maxseq.c (with preprocessing) [rte] annotating function max_seq diff --git a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/minelt.res.oracle b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/minelt.res.oracle index 35dfbe349a1cfc0e890850c0a1a26969f12016b0..1c725b37f632b869ba2d816220ca0aa6955afdc6 100644 --- a/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/minelt.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/maxmin/oracle/minelt.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/maxmin/minelt.i (no preprocessing) [kernel] Parsing minelt/minelt.c (with preprocessing) [rte] annotating function min_element diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/copy.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/copy.res.oracle index 44ad7c05e6cba4bf40d353b2f54c7898916ca07f..3d13dba59cff1cf4a6252aaba23def3a4808ba3d 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/copy.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/copy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/copy.i (no preprocessing) [kernel] Parsing copy/copy.c (with preprocessing) [rte] annotating function copy diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/fill.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/fill.res.oracle index 6ebc8698c53ca8f8585f2056a06f286f41de7ec6..542dfd8b74525abf2f1d24f9397eecbcdad002b2 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/fill.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/fill.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/fill.i (no preprocessing) [kernel] Parsing fill/fill.c (with preprocessing) [wp] warning: Missing RTE guards diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/iota.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/iota.res.oracle index 633e17b0542b2154f5ffa3bd98c8bb1be2c457f7..53a2a88968abd45142de399b4ae3c69ddc4d74af 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/iota.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/iota.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/iota.i (no preprocessing) [kernel] Parsing iota/iota.c (with preprocessing) [wp] warning: Missing RTE guards diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/removecopy.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/removecopy.res.oracle index 76d03545ff5af58a31436f462e29a91c6c49b813..4492d9cf9531ef8e8323298f3f99524bce7dd077 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/removecopy.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/removecopy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/removecopy.i (no preprocessing) [kernel] Parsing removecopy/removecopy.c (with preprocessing) [rte] annotating function remove_copy diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/replacecopy.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/replacecopy.res.oracle index 067153bb49086f127d35e13445cc9b700b0457d3..55ab4468e5b2cded661c05412846c67addad0fc7 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/replacecopy.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/replacecopy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/replacecopy.i (no preprocessing) [kernel] Parsing replacecopy/replacecopy.c (with preprocessing) [rte] annotating function replace_copy diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reverse.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reverse.res.oracle index 3c09c59ca19317e210b17ac81f7517d4b7879cff..7c954059cc6919710db196e6cf21a867f3190e3c 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reverse.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reverse.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/reverse.i (no preprocessing) [kernel] Parsing reversecopy/reverse.c (with preprocessing) [rte] annotating function reverse diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reversecopy.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reversecopy.res.oracle index 31d61fbaa04408e0cd034dca287d5e6d43c7f44c..2f1a1e505be1c66c6575f4d753e040a7e9a404c8 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reversecopy.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/reversecopy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/reversecopy.i (no preprocessing) [kernel] Parsing reversecopy/reversecopy.c (with preprocessing) [rte] annotating function reverse_copy diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/rotatecopy.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/rotatecopy.res.oracle index 750e3c9b3cc85e7b097e8f050926bd86ead8e351..8f2becab5a5969712c59bdcd0ac8989e978e1b17 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/rotatecopy.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/rotatecopy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/rotatecopy.i (no preprocessing) [kernel] Parsing rotatecopy/rotatecopy.c (with preprocessing) [rte] annotating function rotate_copy diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swap.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swap.res.oracle index e88b0d10d33669013b60902159a99fdaa7e03a4a..b05f75df8ee46e823381dc4dbe0a5df8ab8cdf1e 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swap.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swap.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/swap.i (no preprocessing) [kernel] Parsing swap/swap.c (with preprocessing) [rte] annotating function swap diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapranges.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapranges.res.oracle index 10bb2b667684c193a949f413c023ef2425745df9..404d2414e3a8e1f3f7a4a8fc618ad241c933c9a0 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapranges.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapranges.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/swapranges.i (no preprocessing) [kernel] Parsing swapranges/swapranges.c (with preprocessing) [rte] annotating function swap_ranges diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues-withassert.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues-withassert.res.oracle index 740f525afe80e9d62d9099164469f94f8cdc18bb..1a23c9f627cfba7cf299f943693ea5fe2e0becd4 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues-withassert.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues-withassert.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/swapvalues-withassert.i (no preprocessing) [kernel] Parsing swapvalues/swapvalues-withassert.c (with preprocessing) [rte] annotating function swap_values diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues.res.oracle index a1559736f72a30eeff400245f554bb271cd68e6f..e217634d7e9b915483379f7d8e43f0ca9eade13a 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/swapvalues.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/swapvalues.i (no preprocessing) [kernel] Parsing swapvalues/swapvalues.c (with preprocessing) [wp] warning: Missing RTE guards diff --git a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/uniquecopy.res.oracle b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/uniquecopy.res.oracle index 9c494ed6627491aae5484d8aa688e16c4faa3317..8888733622ef84baa928dac52cce772b3ca6ca40 100644 --- a/src/plugins/wp/doc/tutorial/tests/mutating/oracle/uniquecopy.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/mutating/oracle/uniquecopy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/mutating/uniquecopy.i (no preprocessing) [kernel] Parsing uniquecopy/uniquecopy.c (with preprocessing) [rte] annotating function unique_copy diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/adjacent.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/adjacent.res.oracle index 56bb127c5cad455e9cb8eecd2ee8b3c54d44dbbe..8805de5ec86f02984f62fff9541f5879d38cd99b 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/adjacent.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/adjacent.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/adjacent.i (no preprocessing) [kernel] Parsing adjacent/adjacent.c (with preprocessing) [rte] annotating function adjacent_find diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/count.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/count.res.oracle index ae60a21b5b8bf3b74dc2a34c7816f85f65126898..ea361f2e9c0eaa26d93e0b03f14454546e0c3efb 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/count.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/count.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/count.i (no preprocessing) [kernel] Parsing count/count.c (with preprocessing) [rte] annotating function count diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/eqmismatch.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/eqmismatch.res.oracle index 840f3f4cfd375d45184366f6af66c05bbce984c0..d814045627c3774cb15d35b41784cfd272a5aa1b 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/eqmismatch.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/eqmismatch.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/eqmismatch.i (no preprocessing) [kernel] Parsing mismatch/equal.c (with preprocessing) [rte] annotating function equal diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal.res.oracle index ae68366b5d4f9d24ecf892b0caa6a95f80f9027c..267c8fb5bd318538dfd5308c9c768c4e1b250749 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/equal.i (no preprocessing) [kernel] Parsing equal/equal.c (with preprocessing) [wp] warning: Missing RTE guards diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal_rte.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal_rte.res.oracle index 849691d905581b43ffdfdc582bd62343c40d5439..77ed294c38fd022a7616a3219ec92ad3317d3a3c 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal_rte.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/equal_rte.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/equal_rte.i (no preprocessing) [kernel] Parsing equal/equal.c (with preprocessing) [rte] annotating function equal diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/find.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/find.res.oracle index b018e515538d12633d5771e09a01e26be08379a6..d022459964fad4c9320eeaa652ef534b93deec0a 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/find.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/find.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/find.i (no preprocessing) [kernel] Parsing find/find.c (with preprocessing) [rte] annotating function find diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/findfirst.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/findfirst.res.oracle index 7e17e5ea13bfee8fd1995bce019f53b7153a7b8a..b138d449c537cf8324bb7c6ebadff092fcb11384 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/findfirst.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/findfirst.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/findfirst.i (no preprocessing) [kernel] Parsing findfirst/findfirst.c (with preprocessing) [rte] annotating function find_first_of diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/mismatch.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/mismatch.res.oracle index edf70a89dbaa25a9141876c1b7aa1a434747487b..1f70ace71c3cbc521078b9a0c28a1a5a89f73985 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/mismatch.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/mismatch.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/mismatch.i (no preprocessing) [kernel] Parsing mismatch/mismatch.c (with preprocessing) [rte] annotating function mismatch diff --git a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/search.res.oracle b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/search.res.oracle index 2026019396a9445550c27430db68113f4ae55941..00d18c5d9b7598639aaec2a3434829f2a3996d1d 100644 --- a/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/search.res.oracle +++ b/src/plugins/wp/doc/tutorial/tests/nonmutating/oracle/search.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/nonmutating/search.i (no preprocessing) [kernel] Parsing search/search.c (with preprocessing) [rte] annotating function search diff --git a/src/plugins/wp/driver.mli b/src/plugins/wp/driver.mli index abb8f38f3c08e82c77adc8a50689e3f20f89d93d..0575382d2b6149ca50ec1b2b0f582156899e90ae 100644 --- a/src/plugins/wp/driver.mli +++ b/src/plugins/wp/driver.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/driver.mll b/src/plugins/wp/driver.mll index 9023a07cc400510fd542bcc7f35fa7fb483273c5..c77b50047071f0d75bb32b8757317c8fcd487256 100644 --- a/src/plugins/wp/driver.mll +++ b/src/plugins/wp/driver.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -361,7 +361,7 @@ and bal = parse Function, link `Nary input | ID "constructor" -> skip input ; skipkey input ":" ; - Constructor, link `Nary input + Qed.Logic.Constructor, link `Nary input | ID "injective" -> skip input ; skipkey input ":" ; Injection, link `Nary input @@ -470,6 +470,7 @@ and bal = parse (*TODO[LC] Think about projectification ... *) let dkey = Wp_parameters.register_category "includes" + let dkey_driver = Wp_parameters.register_category "driver" let loaded : (string list * string list, driver) Hashtbl.t =Hashtbl.create 10 let load_driver () = @@ -492,7 +493,7 @@ and bal = parse try [Wp_parameters.Share.dir ~error:false ()] with Wp_parameters.Share.No_dir -> [] in let directories = includes @ shared in - if Wp_parameters.has_dkey "includes" then + if Wp_parameters.has_dkey dkey then Wp_parameters.debug ~dkey "Included directories:%t" (fun fmt -> List.iter @@ -514,7 +515,7 @@ and bal = parse load ~ontty default; List.iter load drivers; Hashtbl.add loaded key (Context.get LogicBuiltins.driver); - if Wp_parameters.has_dkey "driver" then LogicBuiltins.dump () + if Wp_parameters.has_dkey dkey_driver then LogicBuiltins.dump () end ; Context.get LogicBuiltins.driver } diff --git a/src/plugins/wp/dyncall.ml b/src/plugins/wp/dyncall.ml index 59642e9fb36eda24e5f4dd8387fb81314032dcb3..972c6d9f5728d91bc0d3c026800e59ecff9d92f7 100644 --- a/src/plugins/wp/dyncall.ml +++ b/src/plugins/wp/dyncall.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -26,6 +26,8 @@ open Logic_typing open Logic_ptree open Cil_datatype +let dkey_calls = Wp_parameters.register_category "calls" + (* -------------------------------------------------------------------------- *) (* --- Typing --- *) (* -------------------------------------------------------------------------- *) @@ -129,7 +131,7 @@ class dyncall = List.iter (fun (bhv,kfs) -> begin - if Wp_parameters.has_dkey "calls" then + if Wp_parameters.has_dkey dkey_calls then let source = snd (Stmt.loc stmt) in if Cil.default_behavior_name = bhv then Wp_parameters.result ~source diff --git a/src/plugins/wp/dyncall.mli b/src/plugins/wp/dyncall.mli index 1f7fc0fd61ae7e7e948469152079e955677746d7..ee30ddfc6f7d21489af5746ab22d209d6c26047f 100644 --- a/src/plugins/wp/dyncall.mli +++ b/src/plugins/wp/dyncall.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/intro_wp.txt b/src/plugins/wp/intro_wp.txt index dea435194906688c1ddc8906dd69efeed8ae757f..e2bb05ec7226a854dae84c2a2d34ff76f9ab969b 100644 --- a/src/plugins/wp/intro_wp.txt +++ b/src/plugins/wp/intro_wp.txt @@ -2,7 +2,7 @@ #* # #* This file is part of WP plug-in of Frama-C. # #* # -#* Copyright (C) 2007-2016 # +#* Copyright (C) 2007-2017 # #* CEA (Commissariat a l'energie atomique et aux energies # #* alternatives) # #* # diff --git a/src/plugins/wp/mcfg.ml b/src/plugins/wp/mcfg.ml index 9dca47d019a14e746e5ddb2185423784eb438f6f..c8fa2b3c92058b94274b147522904c279ba2599d 100644 --- a/src/plugins/wp/mcfg.ml +++ b/src/plugins/wp/mcfg.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -115,7 +115,7 @@ module type S = sig pre: WpPropId.pred_info list -> post: WpPropId.pred_info list -> pexit: WpPropId.pred_info list -> - assigns: identified_term assigns -> + assigns: assigns -> p_post: t_prop -> p_exit: t_prop -> t_prop diff --git a/src/plugins/wp/normAtLabels.ml b/src/plugins/wp/normAtLabels.ml index 549567f9fcc3013b80591bf482a19e55fab2f4b9..b005883e71e673a2e3cc22675d29fd2e8e1739b9 100644 --- a/src/plugins/wp/normAtLabels.ml +++ b/src/plugins/wp/normAtLabels.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -81,7 +81,7 @@ class norm_at label_map = object(self) | {term_node=Tapp(predicate,labels,args)} as t -> let new_labels = List.map - (fun (logic_lab, stmt_lab) -> logic_lab, label_map stmt_lab) + (fun stmt_lab -> label_map stmt_lab) labels in { t with term_node=Tapp(predicate,new_labels,args) } | _ -> assert false @@ -99,7 +99,7 @@ class norm_at label_map = object(self) | {pred_content=Papp(predicate,labels,args)} as p -> let new_labels = List.map - (fun (logic,stmt) -> logic, label_map stmt) + (fun stmt -> label_map stmt) labels in { p with pred_content=Papp(predicate,new_labels,args) } | _ -> assert false @@ -117,20 +117,20 @@ let labels_empty l = raise (LabelError l) (* -------------------------------------------------------------------------- *) let labels_fct_pre = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, ("Pre" | "Here")) -> Logic_const.pre_label + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, (Pre | Here)) -> Logic_const.pre_label | l -> raise (LabelError l) let labels_fct_post = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, ("Pre" | "Old")) -> Logic_const.pre_label - | LogicLabel (None, ("Post" | "Here")) -> Logic_const.post_label + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, (Pre | Old)) -> Logic_const.pre_label + | BuiltinLabel (None, (Post | Here)) -> Logic_const.post_label | l -> raise (LabelError l) let labels_fct_assigns = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Post") -> Logic_const.post_label - | LogicLabel (None, ("Pre" | "Old")) -> Logic_const.pre_label + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Post) -> Logic_const.post_label + | BuiltinLabel (None, (Pre | Old)) -> Logic_const.pre_label | l -> raise (LabelError l) (* -------------------------------------------------------------------------- *) @@ -138,33 +138,35 @@ let labels_fct_assigns = function (* -------------------------------------------------------------------------- *) let labels_stmt_pre s = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Pre") -> Logic_const.pre_label (* fct pre-state *) - | LogicLabel (None, "Here") -> Clabels.mk_logic_label s - | LogicLabel (Some s, _) -> Clabels.mk_logic_label s - | StmtLabel rs -> Clabels.mk_logic_label !rs + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Pre) -> Logic_const.pre_label (* fct pre-state *) + | BuiltinLabel (None, Here) -> BuiltinLabel (Some s,Here) + | BuiltinLabel (Some _, _) as lab -> lab + | StmtLabel _ as lab -> lab | l -> raise (LabelError l) let labels_stmt_post s l_post = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Pre") -> Logic_const.pre_label (* fct pre-state *) - | LogicLabel (None, "Old") -> Clabels.mk_logic_label s (* contract pre-state *) - | LogicLabel (None, ("Here" | "Post")) as l -> + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Pre) -> Logic_const.pre_label (* fct pre-state *) + | BuiltinLabel (None, Old) -> + BuiltinLabel (Some s,Old) (* contract pre-state *) + | BuiltinLabel (None, (Here | Post)) as l -> begin match l_post with Some l -> l | None -> (* TODO ? *) raise (LabelError l) end - | LogicLabel (Some s, _) -> Clabels.mk_logic_label s - | StmtLabel rs -> Clabels.mk_logic_label !rs + | BuiltinLabel (Some _, _) as lab -> lab + | StmtLabel _ as lab -> lab | l -> raise (LabelError l) let labels_stmt_assigns s l_post = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Pre") -> Logic_const.pre_label (* fct pre-state *) - | LogicLabel (None, ("Here" | "Old")) -> (* contract pre-state *) - Clabels.mk_logic_label s - | LogicLabel (None, "Post") -> labels_stmt_post s l_post Logic_const.post_label - | LogicLabel (Some s, _) -> Clabels.mk_logic_label s - | StmtLabel rs -> Clabels.mk_logic_label !rs + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Pre) -> Logic_const.pre_label (* fct pre-state *) + | BuiltinLabel (None, (Here | Old as l)) -> (* contract pre-state *) + BuiltinLabel (Some s, l) + | BuiltinLabel (None, Post) -> + labels_stmt_post s l_post Logic_const.post_label + | BuiltinLabel (Some _, _) as lab -> lab + | StmtLabel _ as lab -> lab | l -> raise (LabelError l) (* -------------------------------------------------------------------------- *) @@ -172,28 +174,30 @@ let labels_stmt_assigns s l_post = function (* -------------------------------------------------------------------------- *) let labels_assert_before s = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Pre") -> Logic_const.pre_label - | LogicLabel (None, "Here") -> Clabels.mk_logic_label s - | LogicLabel (Some s, _) -> Clabels.mk_logic_label s - | StmtLabel rs -> Clabels.mk_logic_label !rs + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Pre) -> Logic_const.pre_label + | BuiltinLabel (None, Here) -> BuiltinLabel (Some s,Here) + | BuiltinLabel (Some _, _) as lab -> lab + | StmtLabel _ as lab -> lab | l -> raise (LabelError l) let labels_assert_after s l_post = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Pre") -> Logic_const.pre_label - | LogicLabel (None, "Here") -> + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Pre) -> Logic_const.pre_label + | BuiltinLabel (None, Here) -> labels_stmt_post s l_post Logic_const.post_label - | LogicLabel (Some s, _) -> Clabels.mk_logic_label s - | StmtLabel rs -> Clabels.mk_logic_label !rs + | BuiltinLabel (Some _, _) as lab -> lab + | StmtLabel _ as lab -> lab | l -> raise (LabelError l) let labels_loop_inv s = function - | LogicLabel (None, "Init") -> Logic_const.init_label - | LogicLabel (None, "Pre") -> Logic_const.pre_label - | LogicLabel (None, "Here") -> Logic_const.here_label - | LogicLabel (None, "LoopEntry") -> Clabels.mk_logic_label s - | LogicLabel (None, ("Old" | "Post")) as l -> raise (LabelError l) + | BuiltinLabel (None, Init) -> Logic_const.init_label + | BuiltinLabel (None, Pre) -> Logic_const.pre_label + | BuiltinLabel (None, Here) -> Logic_const.here_label + | BuiltinLabel (None, LoopEntry) -> BuiltinLabel (Some s, LoopEntry) + | BuiltinLabel (None, (Old | Post)) as l -> raise (LabelError l) + (* [VP 2017-08-03] As fishy as the rest of loop-related labels treatment*) + (* | FormalLabel _ as l -> raise (LabelError l) *) | l -> l let labels_loop_assigns s l = labels_loop_inv s l @@ -207,8 +211,8 @@ let labels_predicate lab_pairs l = with Not_found -> l let labels_axiom = function - | LogicLabel (None, ("Pre"|"Old"|"Post")) as l -> raise (LabelError l) - | LogicLabel (None, _) as l -> l + | BuiltinLabel (None, (Pre|Old|Post)) as l -> raise (LabelError l) + | BuiltinLabel (None, _) as l -> l | l -> raise (LabelError l) (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/wp/normAtLabels.mli b/src/plugins/wp/normAtLabels.mli index 6d7e7f09b0de6f769315f5d1a1b16a3717a7996c..f10167e0efd1bf737ce13ad99c73aa4fcdb38f91 100644 --- a/src/plugins/wp/normAtLabels.mli +++ b/src/plugins/wp/normAtLabels.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -44,6 +44,6 @@ val labels_axiom : label_mapping val preproc_annot : label_mapping -> predicate -> predicate val preproc_assigns : - label_mapping -> identified_term from list -> identified_term from list + label_mapping -> from list -> from list val preproc_label : label_mapping -> logic_label -> logic_label diff --git a/src/plugins/wp/proof.ml b/src/plugins/wp/proof.ml index c1a3ea5768ce17f1d3857724bbb8d33f29bdfc65..28076b5f518a4b0057795d14a4de0c47a560b2a1 100644 --- a/src/plugins/wp/proof.ml +++ b/src/plugins/wp/proof.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/proof.mli b/src/plugins/wp/proof.mli index 0c6dddeced982d8ec0b151710e12b9ccd6da6212..86b2e2f1c7f27150c22e17a6079bcbbbdf19553b 100644 --- a/src/plugins/wp/proof.mli +++ b/src/plugins/wp/proof.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/prover.ml b/src/plugins/wp/prover.ml index a1df046f9104ea58607d4cea177dfe7dfb029299..01dae27acdd8887b64a65389e5128a5959f0b0d3 100644 --- a/src/plugins/wp/prover.ml +++ b/src/plugins/wp/prover.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/prover.mli b/src/plugins/wp/prover.mli index 3cba00ad0bf842cfa0aeed02295ad954655efad2..e5678414053fc977ccfb951caf13931b7ee3fcbb 100644 --- a/src/plugins/wp/prover.mli +++ b/src/plugins/wp/prover.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/MakeOcaml b/src/plugins/wp/qed/src/MakeOcaml index 96004617cc931bf53dbbd4269c543b6f9b5ba6db..2c391d51c57bc42760c65a2bff8714f776294ac1 100755 --- a/src/plugins/wp/qed/src/MakeOcaml +++ b/src/plugins/wp/qed/src/MakeOcaml @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # diff --git a/src/plugins/wp/qed/src/Makefile b/src/plugins/wp/qed/src/Makefile index 1c9bbc2308c156e6fb8178096b48238748900c93..2301d7991792b07cd99a1402e7d2ec71624fb25e 100644 --- a/src/plugins/wp/qed/src/Makefile +++ b/src/plugins/wp/qed/src/Makefile @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # diff --git a/src/plugins/wp/qed/src/Makefile.src b/src/plugins/wp/qed/src/Makefile.src index cb57be8498ce6472f0695be37ba94de9832025c9..2752d50a0f70352eed4fd3f285885086fb9e0e23 100644 --- a/src/plugins/wp/qed/src/Makefile.src +++ b/src/plugins/wp/qed/src/Makefile.src @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # diff --git a/src/plugins/wp/qed/src/arith.mli b/src/plugins/wp/qed/src/arith.mli index 5a1eb9f9f92f4cc36a48d6a2fac20bca750048ff..7f65a03e43b7d624f9524806d4466f2b51b13a21 100644 --- a/src/plugins/wp/qed/src/arith.mli +++ b/src/plugins/wp/qed/src/arith.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/bvars.ml b/src/plugins/wp/qed/src/bvars.ml index 4726291577fdfd716e9ac33bb1f838ec486b0f20..989b8401b75e712186be220451e20b6d28cc2e74 100644 --- a/src/plugins/wp/qed/src/bvars.ml +++ b/src/plugins/wp/qed/src/bvars.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/bvars.mli b/src/plugins/wp/qed/src/bvars.mli index 8439712e5ec06c2c28a870d294d48adb28a500c6..a7b73f0597e5fb8ca9cc5d9a6a67c1fc823545f2 100644 --- a/src/plugins/wp/qed/src/bvars.mli +++ b/src/plugins/wp/qed/src/bvars.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/cache.ml b/src/plugins/wp/qed/src/cache.ml index cddd7dc1d8ae5f596c74234f24fbe56a70a5b8b1..a61ba0301be813f7636aa79cf87d2f2e2f5216ad 100644 --- a/src/plugins/wp/qed/src/cache.ml +++ b/src/plugins/wp/qed/src/cache.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/cache.mli b/src/plugins/wp/qed/src/cache.mli index a71c37882d3ff3a6e9261a0e1c73051bc29a89e8..409a99e7ddbbb0ccbd83fca3012d3a7c4d5f5816 100644 --- a/src/plugins/wp/qed/src/cache.mli +++ b/src/plugins/wp/qed/src/cache.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/collection.ml b/src/plugins/wp/qed/src/collection.ml index b8793135b7ac8b8ca673a4a48fb4150073c5d377..e63a0765a85d1ad81fc1b09586796f0e42a53fe5 100644 --- a/src/plugins/wp/qed/src/collection.ml +++ b/src/plugins/wp/qed/src/collection.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/collection.mli b/src/plugins/wp/qed/src/collection.mli index 427c28c1f91181f5b268cafbf87a33d0acb8d211..9a169241f2037b6d70488dd1c83de9c5fc41cae3 100644 --- a/src/plugins/wp/qed/src/collection.mli +++ b/src/plugins/wp/qed/src/collection.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/engine.mli b/src/plugins/wp/qed/src/engine.mli index 21c096e6ed961fa5b2aaebf15968af644a8e180c..d5734f89452ea6bd4f66f3d4b098c5846aebc4fc 100644 --- a/src/plugins/wp/qed/src/engine.mli +++ b/src/plugins/wp/qed/src/engine.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export.ml b/src/plugins/wp/qed/src/export.ml index 06228130e7ea929411ca34d8f87aada7e3e71538..d0a280300c9e8b04756b8867b1ec7b3dc18322d8 100644 --- a/src/plugins/wp/qed/src/export.ml +++ b/src/plugins/wp/qed/src/export.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export.mli b/src/plugins/wp/qed/src/export.mli index 2ece2886f21e97eeb749d1de0f8e0644c4c86f95..be44e1cf0c846af07460abfca7e8fab3203b8498 100644 --- a/src/plugins/wp/qed/src/export.mli +++ b/src/plugins/wp/qed/src/export.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export_altergo.ml b/src/plugins/wp/qed/src/export_altergo.ml index 0375c4587c718f69248c8f36fa36935b915165ec..685a3b54a8232fd1ec04e6bf1a74c21d9f946f58 100644 --- a/src/plugins/wp/qed/src/export_altergo.ml +++ b/src/plugins/wp/qed/src/export_altergo.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export_altergo.mli b/src/plugins/wp/qed/src/export_altergo.mli index 68245cb5458dea5862d038b1ddee4a404ecbb6ee..e9f626bf097684c14dc703bc9e07ba61878d11f7 100644 --- a/src/plugins/wp/qed/src/export_altergo.mli +++ b/src/plugins/wp/qed/src/export_altergo.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export_coq.ml b/src/plugins/wp/qed/src/export_coq.ml index ea82b415fd7cfec8818ad857237a0a5ad0c75030..f36711bd5e2d8fcb98dfdf1ee703e06238e89ba4 100644 --- a/src/plugins/wp/qed/src/export_coq.ml +++ b/src/plugins/wp/qed/src/export_coq.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -333,6 +333,18 @@ struct fprintf fmt "@ %a.@]@\n" self#pp_tau t ; end + method declare_inductive fmt f ts t l = + begin + fprintf fmt "@[<hov 4>Inductive %s :" (link_name (self#link f)) ; + List.iter (fun t -> fprintf fmt "@ %a ->" self#pp_tau t) ts ; + fprintf fmt "@ %a :=" self#pp_tau t ; + List.iter + (fun (lemma,xs,(_:trigger list list),p) -> + fprintf fmt "@ | @[<hov 2>%s: %a@]" lemma self#pp_prop (T.e_forall xs p) + ) l ; + fprintf fmt ".@]@\n" + end + method declare_definition fmt f xs t e = self#global begin fun () -> diff --git a/src/plugins/wp/qed/src/export_coq.mli b/src/plugins/wp/qed/src/export_coq.mli index a6d9903588432ce539bb75ea3b4a892fb8ac7277..894c6a1b53708a986b4b26b528ed4c09d0f11640 100644 --- a/src/plugins/wp/qed/src/export_coq.mli +++ b/src/plugins/wp/qed/src/export_coq.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -46,6 +46,7 @@ sig method declare_axiom : formatter -> string -> var list -> trigger list list -> term -> unit method declare_fixpoint : prefix:string -> formatter -> Fun.t -> var list -> tau -> term -> unit method declare_signature : formatter -> Fun.t -> tau list -> tau -> unit + method declare_inductive : formatter -> Fun.t -> tau list -> tau -> (string * var list * trigger list list * term) list -> unit method declare_definition : formatter -> Fun.t -> var list -> tau -> term -> unit end diff --git a/src/plugins/wp/qed/src/export_why3.ml b/src/plugins/wp/qed/src/export_why3.ml index 07cf95ddce7a2935cd8d0b2cdf6e05e75050ccf7..13f7f7986e855227d1d18f22e2ad198b5b51fef7 100644 --- a/src/plugins/wp/qed/src/export_why3.ml +++ b/src/plugins/wp/qed/src/export_why3.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export_why3.mli b/src/plugins/wp/qed/src/export_why3.mli index 55961b78c82defcf0e7aae0073cb2a25dd006d76..6c58ebddd360093813a7ee7b84afa1d0674aa18b 100644 --- a/src/plugins/wp/qed/src/export_why3.mli +++ b/src/plugins/wp/qed/src/export_why3.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export_whycore.ml b/src/plugins/wp/qed/src/export_whycore.ml index ecf415a04196880becd9deab9af1f65526cb7e56..5b9b68077c817c3ba75dd2bc60cd7d9510fdcde5 100644 --- a/src/plugins/wp/qed/src/export_whycore.ml +++ b/src/plugins/wp/qed/src/export_whycore.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/export_whycore.mli b/src/plugins/wp/qed/src/export_whycore.mli index 5741f6f1449ab05a113ee87531408c164770dfad..731035fb7aca8b8b3e85e9b6b78eff8ee2c48fc4 100644 --- a/src/plugins/wp/qed/src/export_whycore.mli +++ b/src/plugins/wp/qed/src/export_whycore.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/hcons.ml b/src/plugins/wp/qed/src/hcons.ml index de9273c105dccf7f53aee7204004a658332c25be..e47cfca75b21db07d2836931f97958235d3c65b3 100644 --- a/src/plugins/wp/qed/src/hcons.ml +++ b/src/plugins/wp/qed/src/hcons.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/hcons.mli b/src/plugins/wp/qed/src/hcons.mli index c1b4a31fef2d1232626e119fba7f063161132c62..336d1d129b7864ed73cd2fa89d0d479d722e545f 100644 --- a/src/plugins/wp/qed/src/hcons.mli +++ b/src/plugins/wp/qed/src/hcons.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/idxmap.ml b/src/plugins/wp/qed/src/idxmap.ml index 75ed2ed5aa9f4d870385563801ec35ab270de037..d3a237d08a8a8995e994276f3404ca2ddb14cd6e 100644 --- a/src/plugins/wp/qed/src/idxmap.ml +++ b/src/plugins/wp/qed/src/idxmap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/idxmap.mli b/src/plugins/wp/qed/src/idxmap.mli index 22dc877ff9d5d3955a810a51e7b55df7967266ed..d46cd99658c6ad3f17dfa9ac837f613e1e98d65d 100644 --- a/src/plugins/wp/qed/src/idxmap.mli +++ b/src/plugins/wp/qed/src/idxmap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/idxset.ml b/src/plugins/wp/qed/src/idxset.ml index 941384b3d74348ac91bffe0cf7cc3aa58a212388..fb9355a5a485cef2a202136d5c7116365edc813e 100644 --- a/src/plugins/wp/qed/src/idxset.ml +++ b/src/plugins/wp/qed/src/idxset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -69,48 +69,48 @@ struct (* good sharing *) let remove x = Intmap.remove (E.id x) let is_empty = Intmap.is_empty - let mem x = Intmap.mem (E.id x) - let find x = Intmap.find (E.id x) + let mem x m = Intmap.mem (E.id x) m + let find x m = Intmap.find (E.id x) m let cardinal = Intmap.size - let compare = Intmap.compare (fun _ _ -> 0) - let equal = Intmap.equal (fun _ _ -> true) + let compare m1 m2 = Intmap.compare (fun _ _ -> 0) m1 m2 + let equal m1 m2 = Intmap.equal (fun _ _ -> true) m1 m2 let _keep _ x _ = x let _keepq _ x _ = Some x let _same _ _ _ = true (* good sharing *) - let union = Intmap.union _keep + let union m1 m2 = Intmap.union _keep m1 m2 (* good sharing *) - let inter = Intmap.interq _keepq + let inter m1 m2 = Intmap.interq _keepq m1 m2 (* good sharing *) - let diff = Intmap.diffq _keepq - let subset = Intmap.subset _same - let intersect = Intmap.intersectf _same + let diff m1 m2 = Intmap.diffq _keepq m1 m2 + let subset m1 m2 = Intmap.subset _same m1 m2 + let intersect m1 m2 = Intmap.intersectf _same m1 m2 (* increasing order on id *) - let iter f = Intmap.iteri (fun _i x -> f x) + let iter f m = Intmap.iteri (fun _i x -> f x) m (* increasing order on id *) - let fold f = Intmap.foldi (fun _i x e -> f x e) + let fold f m i = Intmap.foldi (fun _i x e -> f x e) m i (* good sharing *) - let filter f = Intmap.filter (fun _i x -> f x) + let filter f m = Intmap.filter (fun _i x -> f x) m (* good sharing *) - let partition f = Intmap.partition (fun _i x -> f x) + let partition f m = Intmap.partition (fun _i x -> f x) m - let for_all f = Intmap.for_all (fun _i x -> f x) - let exists f = Intmap.exists (fun _i x -> f x) + let for_all f m = Intmap.for_all (fun _i x -> f x) m + let exists f m = Intmap.exists (fun _i x -> f x) m (* increasing order on id *) - let elements = Intmap.mapl (fun _i x -> x) + let elements m = Intmap.mapl (fun _i x -> x) m (* good sharing *) - let mapf f= Intmap.mapq (fun _i x -> f x) + let mapf f m = Intmap.mapq (fun _i x -> f x) m (* good sharing *) - let map f = Intmap.mapq (fun _i x -> Some (f x)) + let map f m = Intmap.mapq (fun _i x -> Some (f x)) m end diff --git a/src/plugins/wp/qed/src/idxset.mli b/src/plugins/wp/qed/src/idxset.mli index b6d0528334fe8bd91dfb704b39de0837facb44cf..ff15866214f3bde3ac899612d6a3444ca0aa9c48 100644 --- a/src/plugins/wp/qed/src/idxset.mli +++ b/src/plugins/wp/qed/src/idxset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/intmap.ml b/src/plugins/wp/qed/src/intmap.ml index 2919ab9c1205e4be2b4818ceac6014f351e89fa8..591f2b46615214c3b5794b6465e3ea39e38b46fd 100644 --- a/src/plugins/wp/qed/src/intmap.ml +++ b/src/plugins/wp/qed/src/intmap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/intmap.mli b/src/plugins/wp/qed/src/intmap.mli index 1599defc7918ed7f477314cd0f8e99afc66b2bda..985a627cae9badd882ad508e9d7622bc44212c27 100644 --- a/src/plugins/wp/qed/src/intmap.mli +++ b/src/plugins/wp/qed/src/intmap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/intset.ml b/src/plugins/wp/qed/src/intset.ml index 9ff516ae5946c504fb7a36678e9777ad96f9e735..f4502d377095b546c78bc8e4ed0e221fe2560529 100644 --- a/src/plugins/wp/qed/src/intset.ml +++ b/src/plugins/wp/qed/src/intset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/intset.mli b/src/plugins/wp/qed/src/intset.mli index 76db2f1f0c80c94cef097900275f5e39750b3233..8023ed804e1c046f3bc885dcad32174f680ee5f8 100644 --- a/src/plugins/wp/qed/src/intset.mli +++ b/src/plugins/wp/qed/src/intset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/kind.ml b/src/plugins/wp/qed/src/kind.ml index 0d8fcfcd6263094260709ba6cebb51bd6b758d43..809ae40d0c6c41921287e74497949ebd61565b35 100644 --- a/src/plugins/wp/qed/src/kind.ml +++ b/src/plugins/wp/qed/src/kind.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/kind.mli b/src/plugins/wp/qed/src/kind.mli index e89407c8463b509cc3b7340e1082bab7261624eb..c6c837d66c628707687105c6a0b0399630592b96 100644 --- a/src/plugins/wp/qed/src/kind.mli +++ b/src/plugins/wp/qed/src/kind.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/listmap.ml b/src/plugins/wp/qed/src/listmap.ml index 80971a3784035ae41b7e1de67abb3d64643b1857..5219cf3e395c984bc350812fc0bf1da6c37f461c 100644 --- a/src/plugins/wp/qed/src/listmap.ml +++ b/src/plugins/wp/qed/src/listmap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/listmap.mli b/src/plugins/wp/qed/src/listmap.mli index fdd2031c2deaf8e501e8c73dcdd509331aec06c2..fcae143fce29119a21b91bcd06afd484031d7e26 100644 --- a/src/plugins/wp/qed/src/listmap.mli +++ b/src/plugins/wp/qed/src/listmap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/listset.ml b/src/plugins/wp/qed/src/listset.ml index 665f40a998ac7a2acfe7aff9d9cc66e498191581..0b98d1ae3714bd678fa9cb58a63ae7351fae300d 100644 --- a/src/plugins/wp/qed/src/listset.ml +++ b/src/plugins/wp/qed/src/listset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/listset.mli b/src/plugins/wp/qed/src/listset.mli index e384ca808f00dfd1f6afc1463aeaa7d300847611..1c7740724b63e7fef7451695794e1ebf378f6fc2 100644 --- a/src/plugins/wp/qed/src/listset.mli +++ b/src/plugins/wp/qed/src/listset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/logic.mli b/src/plugins/wp/qed/src/logic.mli index bd8e276f77f3c30bfdd58c6591c31725dac26108..5a63329129272bf578ce46c60f592b729de31109 100644 --- a/src/plugins/wp/qed/src/logic.mli +++ b/src/plugins/wp/qed/src/logic.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -327,7 +327,7 @@ sig val typeof : ?field:(Field.t -> tau) -> ?record:(Field.t -> tau) -> - ?call:(Fun.t -> tau) -> term -> tau + ?call:(Fun.t -> tau option list -> tau) -> term -> tau (** {3 Support for Builtins} *) @@ -367,13 +367,7 @@ sig val consequence : term -> term -> term (** Knowing [h], [consequence h a] returns [b] such that [h -> (a<->b)] *) val literal : term -> bool * term - val congruence_eq : term -> term -> (term * term) list option - (** If [congruence_eq a b] returns [[ai,bi]], [a=b] is equivalent to [And{ai=bi}]. *) - val congruence_neq : term -> term -> (term * term) list option - (** If [congruence_eq a b] returns [[ai,bi]], [a<>b] is equivalent to [Or{ai<>bi}]. *) - val flattenable : term -> bool - val flattens : term -> term -> bool (** The comparison flattens *) - val flatten : term -> term list (** Returns an equivalent conjunction *) + val affine : term -> (Z.t,term) affine val record_with : record -> (term * record) option diff --git a/src/plugins/wp/qed/src/mergemap.ml b/src/plugins/wp/qed/src/mergemap.ml index 07d1f1f7bc87ae74a6018e36a81347f6a3fcad4b..e667770bcd688e126df0931777b862aab24a01cd 100644 --- a/src/plugins/wp/qed/src/mergemap.ml +++ b/src/plugins/wp/qed/src/mergemap.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/mergemap.mli b/src/plugins/wp/qed/src/mergemap.mli index d2940110637728c1d5e261134e02180861afd403..4211a221b8c0eeff26f8fde053cbdb21cc456b45 100644 --- a/src/plugins/wp/qed/src/mergemap.mli +++ b/src/plugins/wp/qed/src/mergemap.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/mergeset.ml b/src/plugins/wp/qed/src/mergeset.ml index 8b28153834e63e8bd76d419d320076bd31a06c74..15e6a5b497f0e5b1da593fc24016be18db617110 100644 --- a/src/plugins/wp/qed/src/mergeset.ml +++ b/src/plugins/wp/qed/src/mergeset.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/mergeset.mli b/src/plugins/wp/qed/src/mergeset.mli index 8c693d48205e123f1ac3bd97d487db9ff31aa586..4e65886140c751f2a991552d9249c1f46acf7045 100644 --- a/src/plugins/wp/qed/src/mergeset.mli +++ b/src/plugins/wp/qed/src/mergeset.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/numbers.mli b/src/plugins/wp/qed/src/numbers.mli index d2e27891673aa3e1f68d5db5bde1aa9d70054b8c..4a12161c6226d838ef2b92d2cf799a0701cf5438 100644 --- a/src/plugins/wp/qed/src/numbers.mli +++ b/src/plugins/wp/qed/src/numbers.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/numbers.mll b/src/plugins/wp/qed/src/numbers.mll index ee951117cef9650075b4fd047d8e08631e69f4d5..55e00028eb3f692bf5498929e6dc1856ddd2ca1c 100644 --- a/src/plugins/wp/qed/src/numbers.mll +++ b/src/plugins/wp/qed/src/numbers.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/ocamldoc.css b/src/plugins/wp/qed/src/ocamldoc.css index a1b7b7130114df3a25090e397f0978f4b6da30f4..f45580758d1e02140bbef1222f8b8d0dd67eb464 100644 --- a/src/plugins/wp/qed/src/ocamldoc.css +++ b/src/plugins/wp/qed/src/ocamldoc.css @@ -2,7 +2,7 @@ /* */ /* This file is part of WP plug-in of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat a l'energie atomique et aux energies */ /* alternatives) */ /* */ diff --git a/src/plugins/wp/qed/src/partition.ml b/src/plugins/wp/qed/src/partition.ml index 16410c31d6e2dd652d6951fd89927a0f83c63c54..d540ed2f925cf710a971f9eafb37f70f961b6cdd 100644 --- a/src/plugins/wp/qed/src/partition.ml +++ b/src/plugins/wp/qed/src/partition.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/partition.mli b/src/plugins/wp/qed/src/partition.mli index 2886f579d2aad2e8752c2306d536f1de6839ec24..a4d60fe3ca01c5f8d275f96930bb5e6a40a4d04a 100644 --- a/src/plugins/wp/qed/src/partition.mli +++ b/src/plugins/wp/qed/src/partition.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/pattern.ml b/src/plugins/wp/qed/src/pattern.ml index 4b132c8a74c4aed4c454a6d3e95638a5a753d51b..84f1e1c2a7e89fefbbcc82aedcc5eb6ef8e3a4ce 100644 --- a/src/plugins/wp/qed/src/pattern.ml +++ b/src/plugins/wp/qed/src/pattern.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/pattern.mli b/src/plugins/wp/qed/src/pattern.mli index 0d9301d2ca45713b23e1cfbb949c7a3fc8a98cd6..d5cc9244ffcf6532da7d6db2cfbead143455e0ed 100644 --- a/src/plugins/wp/qed/src/pattern.mli +++ b/src/plugins/wp/qed/src/pattern.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/plib.ml b/src/plugins/wp/qed/src/plib.ml index daf3e234d4636519618d19becfc9149bf648f1c8..a67b7441753091826c008a932d04e47ccdb6073e 100644 --- a/src/plugins/wp/qed/src/plib.ml +++ b/src/plugins/wp/qed/src/plib.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/plib.mli b/src/plugins/wp/qed/src/plib.mli index a918492e876a26aaa66e08beb44d9103b40cdc49..384d661aa004057b041efb996735cf28ddc6edf5 100644 --- a/src/plugins/wp/qed/src/plib.mli +++ b/src/plugins/wp/qed/src/plib.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/pool.ml b/src/plugins/wp/qed/src/pool.ml index 0c66950bcd35d8e11922aa3e22c0240287e05b53..d406be5d6a1ddacce73f1444f04b1f3a7b41d848 100644 --- a/src/plugins/wp/qed/src/pool.ml +++ b/src/plugins/wp/qed/src/pool.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/pool.mli b/src/plugins/wp/qed/src/pool.mli index 111792a370ad2c1d6d3d4084a835fe1cdaaeff4c..f47d294f65e70ac9fcbf0a48cc82975cc5db948d 100644 --- a/src/plugins/wp/qed/src/pool.mli +++ b/src/plugins/wp/qed/src/pool.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/pretty.ml b/src/plugins/wp/qed/src/pretty.ml index 5c3b31d7d66d0aa1619b99d6fed79e9a18a1ba38..8373e6fa583157f7a20e6a4a48efb7309ba91f94 100644 --- a/src/plugins/wp/qed/src/pretty.ml +++ b/src/plugins/wp/qed/src/pretty.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/pretty.mli b/src/plugins/wp/qed/src/pretty.mli index 9f46ed2118e8257063e25b7ab4c4d8f34858b124..d4ac9843975384cc5a04cc35f4dd81c82e9a6797 100644 --- a/src/plugins/wp/qed/src/pretty.mli +++ b/src/plugins/wp/qed/src/pretty.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/r.ml b/src/plugins/wp/qed/src/r.ml index 2056324e183d9283b3daffafbbb9860b731b922e..896ce6d690d2189d9611f8ef34e298a1f0fe458c 100644 --- a/src/plugins/wp/qed/src/r.ml +++ b/src/plugins/wp/qed/src/r.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/r.mli b/src/plugins/wp/qed/src/r.mli index dd7572f48ab93ae639de50b5ffb74e86e26ea49d..e502f56ec26a62c63896f6b749a2afdae8970b2f 100644 --- a/src/plugins/wp/qed/src/r.mli +++ b/src/plugins/wp/qed/src/r.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/relation.ml b/src/plugins/wp/qed/src/relation.ml index 8bcc4390719fc5c6cbb73a1f22dd40bfc0b57668..decae258a752ff753f42d97f61c053656e8395e6 100644 --- a/src/plugins/wp/qed/src/relation.ml +++ b/src/plugins/wp/qed/src/relation.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/relation.mli b/src/plugins/wp/qed/src/relation.mli index fc6691d64d731a6f4f7174e9d2776b9e2b0df5e3..ba9a57cddf11fd4583fc4e68f870ab5e07b07e37 100644 --- a/src/plugins/wp/qed/src/relation.mli +++ b/src/plugins/wp/qed/src/relation.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/subst.ml b/src/plugins/wp/qed/src/subst.ml index fb3df08ff84b55dce7c9f4ff1364ff82b13f7dcd..ff38a5119954da344000740a055aa5d8d9c0a6ee 100644 --- a/src/plugins/wp/qed/src/subst.ml +++ b/src/plugins/wp/qed/src/subst.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/subst.mli b/src/plugins/wp/qed/src/subst.mli index 9e22cfcfe41113415358b24933ce76ad1067e62f..4fe464d674e4759c52cab808cdf8787d241bfbc4 100644 --- a/src/plugins/wp/qed/src/subst.mli +++ b/src/plugins/wp/qed/src/subst.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/term.ml b/src/plugins/wp/qed/src/term.ml index 8edb28ee7c1c7ba3f38180c5e6bb9c2a8b93c7e4..bea15ec5e30cfe1b8fa212ab8cf1356902f0f23d 100644 --- a/src/plugins/wp/qed/src/term.ml +++ b/src/plugins/wp/qed/src/term.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -1419,50 +1419,37 @@ struct | _ -> consequence_aux [h] x type structural = - | S_equal (* equal constants or constructors *) - | S_disequal (* different constants or constructors *) - | S_injection (* same function, injective or constructor *) - | S_invertible (* same function, invertible on both side *) - | S_disjunction (* both constructors, but different ones *) + | S_diff (* different constructors *) + | S_injection (* same injective function *) + | S_invertible (* same invertible function *) | S_functions (* general functions *) let structural f g = if Fun.equal f g then match Fun.category f with - | Logic.Injection -> S_injection | Logic.Operator { invertible=true } -> S_invertible - | Logic.Constructor -> S_equal + | Logic.Injection | Logic.Constructor -> S_injection | Logic.Function | Logic.Operator _ -> S_functions else match Fun.category f , Fun.category g with - | Logic.Constructor , Logic.Constructor -> S_disequal + | Logic.Constructor , Logic.Constructor -> S_diff | _ -> S_functions let contrary x y = (is_prop x || is_prop y) && (e_not x == y) - let rec eq_all phi xs ys = - match xs , ys with - | [] , [] -> Yes - | [] , _ | _ , [] -> No - | x::xs , y::ys -> - match (phi x y).repr with - | False -> No - | True -> eq_all phi xs ys - | _ -> match eq_all phi xs ys with - | No -> No - | Yes | Maybe -> Maybe - - let rec neq_any phi xs ys = - match xs , ys with - | [] , [] -> No - | [] , _ | _ , [] -> Yes - | x::xs , y :: ys -> - match (phi x y).repr with - | True -> Yes - | False -> neq_any phi xs ys - | _ -> match neq_any phi xs ys with - | Yes -> Yes - | No | Maybe -> Maybe + (* -------------------------------------------------------------------------- *) + (* --- List All2/Any2 --- *) + (* -------------------------------------------------------------------------- *) + + let e_all2 phi xs ys = + let n = List.length xs in + let m = List.length ys in + if n <> m then e_false else conjunction (List.map2 phi xs ys) + + let e_any2 phi xs ys = + let n = List.length xs in + let m = List.length ys in + if n <> m then e_true else disjunction (List.map2 phi xs ys) (* -------------------------------------------------------------------------- *) (* --- Equality on R --- *) @@ -1501,10 +1488,8 @@ struct | Fun(f,xs) , Fun(g,ys) -> begin match structural f g with - | S_equal -> e_true - | S_disequal -> e_false - | S_injection -> eq_maybe x y (eq_all e_eq xs ys) - | S_disjunction -> e_false + | S_diff -> e_false + | S_injection -> e_all2 e_eq xs ys | S_functions -> c_builtin_eq x y | S_invertible -> let modified,xs,ys = op_invertible xs ys in @@ -1514,18 +1499,18 @@ struct end | Rdef fxs , Rdef gys -> begin - try eq_maybe x y (eq_all eq_field fxs gys) + try e_all2 eq_field fxs gys with Exit -> e_false end + | _ when contrary x y -> e_false + | Fun _ , _ | _ , Fun _ -> c_builtin_eq x y | _ -> c_eq x y - and eq_maybe x y = function - | Yes -> e_true | No -> e_false | Maybe -> c_builtin_eq x y - and eq_field (f,x) (g,y) = if Field.equal f g then e_eq x y else raise Exit + let () = extern_eq := e_eq (* -------------------------------------------------------------------------- *) @@ -1547,10 +1532,8 @@ struct | Fun(f,xs) , Fun(g,ys) -> begin match structural f g with - | S_equal -> e_false - | S_disequal -> e_true - | S_injection -> neq_maybe x y (neq_any e_neq xs ys) - | S_disjunction -> e_true + | S_diff -> e_true + | S_injection -> e_any2 e_neq xs ys | S_functions -> c_builtin_neq x y | S_invertible -> let modified,xs,ys = op_invertible xs ys in @@ -1560,18 +1543,18 @@ struct end | Rdef fxs , Rdef gys -> begin - try neq_maybe x y (neq_any neq_field fxs gys) + try e_any2 neq_field fxs gys with Exit -> e_true end + | _ when contrary x y -> e_true + | Fun _ , _ | _ , Fun _ -> c_builtin_neq x y | _ -> c_neq x y - and neq_maybe x y = function - | Yes -> e_true | No -> e_false | Maybe -> c_builtin_neq x y - and neq_field (f,x) (g,y) = if Field.equal f g then e_neq x y else raise Exit + let () = extern_neq := e_neq (* -------------------------------------------------------------------------- *) @@ -1879,133 +1862,6 @@ struct let e_sub x y = addition [x;e_opp y] let e_mul x y = multiplication [x;y] - (* -------------------------------------------------------------------------- *) - (* --- Congruence --- *) - (* -------------------------------------------------------------------------- *) - - exception NO_CONGRUENCE - exception FIELD_NEQ - - let rec concat2 f xs ys = match xs,ys with - | [],[] -> [] - | x::xs , y::ys -> f x y @ (concat2 f xs ys) - | _ -> raise NO_CONGRUENCE - - let rec congr_eq a b = - match a.repr , b.repr with - | Fun(f,xs) , Fun(g,ys) -> - begin - match structural f g with - | S_equal | S_disequal | S_disjunction | S_invertible -> [] - | S_injection -> concat2 congr_argeq xs ys - | S_functions -> raise NO_CONGRUENCE - end - | Rdef fxs , Rdef gys -> concat2 congr_fieldeq fxs gys - | _ -> raise NO_CONGRUENCE - - and congr_argeq a b = try congr_eq a b with NO_CONGRUENCE -> [a,b] - and congr_fieldeq (f,a) (g,b) = - if Field.equal f g then congr_argeq a b else raise NO_CONGRUENCE - - let congruence_eq a b = try Some (congr_eq a b) with NO_CONGRUENCE -> None - - let rec congr_neq a b = - match a.repr , b.repr with - | Fun(f,xs) , Fun(g,ys) -> - begin - match structural f g with - | S_equal | S_disequal | S_disjunction | S_invertible -> [] - | S_injection -> concat2 congr_argneq xs ys - | S_functions -> raise NO_CONGRUENCE - end - | Rdef fxs , Rdef gys -> - begin - try concat2 congr_fieldneq fxs gys - with FIELD_NEQ -> [] - end - | _ -> raise NO_CONGRUENCE - - and congr_argneq a b = try congr_neq a b with NO_CONGRUENCE -> [a,b] - and congr_fieldneq (f,a) (g,b) = - if Field.equal f g then congr_argneq a b else raise FIELD_NEQ - - let congruence_neq a b = try Some(congr_neq a b) with NO_CONGRUENCE -> None - - (* -------------------------------------------------------------------------- *) - (* --- List All2/Any2 --- *) - (* -------------------------------------------------------------------------- *) - - let e_all2 phi xs ys = - let n = List.length xs in - let m = List.length ys in - if n <> m then e_false else conjunction (List.map2 phi xs ys) - - let e_any2 phi xs ys = - let n = List.length xs in - let m = List.length ys in - if n <> m then e_true else disjunction (List.map2 phi xs ys) - - (* -------------------------------------------------------------------------- *) - (* --- Flat Reasoning --- *) - (* -------------------------------------------------------------------------- *) - - let rec flat_eq a b = - match a.repr , b.repr with - | Fun(f,xs) , Fun(g,ys) -> - begin - match structural f g with - | S_equal -> e_true - | S_disequal -> e_false - | S_injection -> e_all2 flat_eq xs ys - | S_disjunction -> e_false - | S_functions | S_invertible -> e_eq a b - end - | Rdef fxs , Rdef gys -> - begin - try e_all2 (fun (f,x) (g,y) -> - if Field.equal f g then flat_eq x y else raise Exit - ) fxs gys - with Exit -> e_false - end - | _ -> e_eq a b - - let rec flat_neq a b = - match a.repr , b.repr with - | Fun(f,xs) , Fun(g,ys) -> - begin - match structural f g with - | S_equal -> e_false - | S_disequal -> e_true - | S_injection -> e_any2 flat_neq xs ys - | S_disjunction -> e_true - | S_functions | S_invertible -> e_neq a b - end - | Rdef fxs , Rdef gys -> - begin - try e_any2 (fun (f,x) (g,y) -> - if Field.equal f g then flat_neq x y else raise Exit - ) fxs gys - with Exit -> e_true - end - | _ -> e_neq a b - - let flattens a b = match a.repr , b.repr with - | (Rdef _ | Fun _) , (Rdef _ | Fun _) -> true - | _ -> false - - let rec flat qs e = match e.repr with - | Eq(a,b) when flattens a b -> (flat_eq a b)::qs - | Neq(a,b) when flattens a b -> (flat_neq a b)::qs - | And ps -> List.fold_left flat qs ps - | _ -> e::qs - - let flatten p = List.rev (flat [] p) - - let flattenable e = match e.repr with - | Eq(a,b) | Neq(a,b) -> flattens a b - | And _ -> true - | _ -> false - (* -------------------------------------------------------------------------- *) (* --- Iterators --- *) (* -------------------------------------------------------------------------- *) @@ -2440,7 +2296,7 @@ struct type env = { field : Field.t -> tau ; record : Field.t -> tau ; - call : Fun.t -> tau ; + call : Fun.t -> tau option list -> tau ; } let rec typecheck env e = @@ -2457,9 +2313,9 @@ struct (try typecheck env m with Not_found -> Array(typecheck env k,typecheck env v)) - | Fun(f,_) -> + | Fun(f,es) -> (try tau_of_sort (Fun.sort f) - with Not_found -> env.call f) + with Not_found -> env.call f (List.map (typeof env) es)) | Aget(m,_) -> (try match typecheck env m with | Array(_,v) -> v @@ -2481,6 +2337,8 @@ struct | Bind((Forall|Exists),_,_) -> Prop | Apply _ | Bind(Lambda,_,_) -> raise Not_found + and typeof env e = try Some (typecheck env e) with Not_found -> None + let undefined _ = raise Not_found let typeof ?(field=undefined) ?(record=undefined) ?(call=undefined) e = typecheck { field ; record ; call } e diff --git a/src/plugins/wp/qed/src/term.mli b/src/plugins/wp/qed/src/term.mli index 243f107a35d5b6350dc7da84043c60c9be4c3986..4465f42f9c6b831949f4810578788e41992a68b3 100644 --- a/src/plugins/wp/qed/src/term.mli +++ b/src/plugins/wp/qed/src/term.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/topology.ml b/src/plugins/wp/qed/src/topology.ml index d0a4ebe1b1c6a62595e347e59e058f36173d577f..9cc86f58159d3837897caa1881c9517ed909cb70 100644 --- a/src/plugins/wp/qed/src/topology.ml +++ b/src/plugins/wp/qed/src/topology.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/src/topology.mli b/src/plugins/wp/qed/src/topology.mli index 1fcfef828fe69568879e79e7090b9316880ee5f2..8795a27350bb299592702d7724d2c83509d1cd31 100644 --- a/src/plugins/wp/qed/src/topology.mli +++ b/src/plugins/wp/qed/src/topology.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/ast.ml b/src/plugins/wp/qed/top/ast.ml index 94ed0cbcc871458215e5f41f1622f5cc7537d29b..8f5d11f165771ef93059167fd80ad633a32a332f 100644 --- a/src/plugins/wp/qed/top/ast.ml +++ b/src/plugins/wp/qed/top/ast.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/ast.mli b/src/plugins/wp/qed/top/ast.mli index b5993ff671dcb9e70c80bb47eb669ef8e4f1bca8..8ed0ff2917b848385eeb6990444091082923c76a 100644 --- a/src/plugins/wp/qed/top/ast.mli +++ b/src/plugins/wp/qed/top/ast.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/compiler.ml b/src/plugins/wp/qed/top/compiler.ml index c4c2ad9fc8b99ac4eb4a5ef854d663104abe0b07..f5e51eb17aa2b1be61d523689c9e19c232fe2df9 100644 --- a/src/plugins/wp/qed/top/compiler.ml +++ b/src/plugins/wp/qed/top/compiler.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/compiler.mli b/src/plugins/wp/qed/top/compiler.mli index c70fc8207c8451e8bc8378d5eb85764be9fcc548..e321451db9224908a45780d38522451d0fb963fc 100644 --- a/src/plugins/wp/qed/top/compiler.mli +++ b/src/plugins/wp/qed/top/compiler.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/depends.ml b/src/plugins/wp/qed/top/depends.ml index edebc8d19b7ed7c8a49a9b4f24855ce203e69a55..e6a0b0f851a7328293cb5252f45d34d3ba47cafc 100644 --- a/src/plugins/wp/qed/top/depends.ml +++ b/src/plugins/wp/qed/top/depends.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/depends.mli b/src/plugins/wp/qed/top/depends.mli index 1ef3a6755008a4624695d0d2367ee6bec21332c7..ff734f2e4adce46253c10fab6fe72d2131215edd 100644 --- a/src/plugins/wp/qed/top/depends.mli +++ b/src/plugins/wp/qed/top/depends.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/input.ml b/src/plugins/wp/qed/top/input.ml index e695cd78efacdb132433e24151a45755821960d4..0243b91f5780802ec0ea59b6091c607a007e4269 100644 --- a/src/plugins/wp/qed/top/input.ml +++ b/src/plugins/wp/qed/top/input.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/input.mli b/src/plugins/wp/qed/top/input.mli index ac42550af5f0702607a0f609105a6ca8bbeed478..358d329dba2b4e19767b8f45444fbc0dcde8b027 100644 --- a/src/plugins/wp/qed/top/input.mli +++ b/src/plugins/wp/qed/top/input.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/lexer.mli b/src/plugins/wp/qed/top/lexer.mli index daa915b8ff168f5c49cc4ef372c5b5427f34c593..f109d6c7da1f41f7a177d5a0140c26bfac8c4c4a 100644 --- a/src/plugins/wp/qed/top/lexer.mli +++ b/src/plugins/wp/qed/top/lexer.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/lexer.mll b/src/plugins/wp/qed/top/lexer.mll index d4134453f3e21df7d48dd28f77dcbb98e9798513..873a21957004f4167a4141ea2360a011255211a2 100644 --- a/src/plugins/wp/qed/top/lexer.mll +++ b/src/plugins/wp/qed/top/lexer.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/parser.ml b/src/plugins/wp/qed/top/parser.ml index 2f0ca3ecebb9e8cc671b71d95fb0fdc7cfda19ae..147607c12e68b11f34ed1c8d27fb29b41892554b 100644 --- a/src/plugins/wp/qed/top/parser.ml +++ b/src/plugins/wp/qed/top/parser.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/parser.mli b/src/plugins/wp/qed/top/parser.mli index b63260bc447bd7fa201854c3f74df975dc5d92db..864746f76fee40a39275b9b49541d15184410593 100644 --- a/src/plugins/wp/qed/top/parser.mli +++ b/src/plugins/wp/qed/top/parser.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/syntax.mli b/src/plugins/wp/qed/top/syntax.mli index 49fb54a89040389fd2d1898ff2f67f811a6bc725..c8d7b09b38fbe34b8b7f337ab62fd85265c626ef 100644 --- a/src/plugins/wp/qed/top/syntax.mli +++ b/src/plugins/wp/qed/top/syntax.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/typechecker.ml b/src/plugins/wp/qed/top/typechecker.ml index 8bcdffb8d64414290df5617cc85e0ee0a5b6ad89..4142d9a338d86af1f2602a2f575bc373ebe65db5 100644 --- a/src/plugins/wp/qed/top/typechecker.ml +++ b/src/plugins/wp/qed/top/typechecker.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/typechecker.mli b/src/plugins/wp/qed/top/typechecker.mli index d03f9367ea0a4107a1a10bfb19fcc65cc5b879d9..686857487036b2c93c6e0a81b625e9998db7ac6e 100644 --- a/src/plugins/wp/qed/top/typechecker.mli +++ b/src/plugins/wp/qed/top/typechecker.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/unify.ml b/src/plugins/wp/qed/top/unify.ml index 1da6e777afbbfc30b3981cebac16d3aba35a0cce..042781bbad748ac69266ee28759da65b97f02ec0 100644 --- a/src/plugins/wp/qed/top/unify.ml +++ b/src/plugins/wp/qed/top/unify.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/qed/top/unify.mli b/src/plugins/wp/qed/top/unify.mli index 31fe28d86e5c3cfa50f8cf98b79c9baea7e9f07d..477239216d985917c260fb733cba6e124d004888 100644 --- a/src/plugins/wp/qed/top/unify.mli +++ b/src/plugins/wp/qed/top/unify.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/register.ml b/src/plugins/wp/register.ml index fc173adf2c312f563fee74e0342dd09d718e3eac..2d0b12c16fec1624460d773a363149a2f09c7cba 100644 --- a/src/plugins/wp/register.ml +++ b/src/plugins/wp/register.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -258,7 +258,7 @@ let add_time s t = end let do_list_scheduled iter_on_goals = - if not (Wp_parameters.has_dkey "no-goals-info") then + if not (Wp_parameters.has_dkey VCS.dkey_no_goals_info) then begin clear_scheduled () ; iter_on_goals @@ -273,10 +273,12 @@ let do_list_scheduled iter_on_goals = else Wp_parameters.feedback "%d goal scheduled" n ; end +let dkey_prover = Wp_parameters.register_category "prover" + let do_wpo_start goal = begin incr exercised ; - if Wp_parameters.has_dkey "prover" then + if Wp_parameters.has_dkey dkey_prover then Wp_parameters.feedback "[Qed] Goal %s preprocessing" (Wpo.get_gid goal) ; end @@ -390,7 +392,7 @@ let do_report_prover_stats pp_prover fmt (p,s) = begin if s.n_time > 0 && s.u_time > Rformat.epsilon && - not (Wp_parameters.has_dkey "no-time-info") + not (Wp_parameters.has_dkey VCS.dkey_no_time_info) then let mean = s.a_time /. float s.n_time in let epsilon = 0.05 *. mean in @@ -410,7 +412,7 @@ let do_report_prover_stats pp_prover fmt (p,s) = Rformat.pp_time s.u_time end ; if s.steps > 0 && - not (Wp_parameters.has_dkey "no-step-info") then + not (Wp_parameters.has_dkey VCS.dkey_no_step_info) then Format.fprintf fmt " (%d)" s.steps ; if s.interrupted > 0 then Format.fprintf fmt " (interrupted: %d)" s.interrupted ; @@ -422,7 +424,7 @@ let do_report_prover_stats pp_prover fmt (p,s) = end let do_report_scheduled () = - if not (Wp_parameters.has_dkey "no-goals-info") then + if not (Wp_parameters.has_dkey VCS.dkey_no_goals_info) then if Wp_parameters.Generate.get () then let plural = if !exercised > 1 then "s" else "" in Wp_parameters.result "%d goal%s generated" !exercised plural @@ -623,22 +625,26 @@ let deprecated_wp_clear () = (* --- Command-line Entry Points --- *) (* ------------------------------------------------------------------------ *) +let dkey_logicusage = Wp_parameters.register_category "logicusage" +let dkey_refusage = Wp_parameters.register_category "refusage" +let dkey_builtins = Wp_parameters.register_category "builtins" + let cmdline_run () = let wp_main fct = Wp_parameters.feedback ~ontty:`Feedback "Running WP plugin..."; Ast.compute (); Dyncall.compute (); - if Wp_parameters.has_dkey "logicusage" then + if Wp_parameters.has_dkey dkey_logicusage then begin LogicUsage.compute (); LogicUsage.dump (); end ; - if Wp_parameters.has_dkey "refusage" then + if Wp_parameters.has_dkey dkey_refusage then begin RefUsage.compute (); RefUsage.dump (); end ; - if Wp_parameters.has_dkey "builtins" then + if Wp_parameters.has_dkey dkey_builtins then begin LogicBuiltins.dump (); end ; @@ -768,13 +774,17 @@ let pp_wp_parameters fmt = Format.pp_print_string fmt " -warn-signed-downcast" ; if Kernel.UnsignedDowncast.get () then Format.pp_print_string fmt " -warn-unsigned-downcast" ; + if not (Wp_parameters.Volatile.get ()) then + Format.pp_print_string fmt " -wp-no-volatile" ; Format.pp_print_string fmt " [...]" ; Format.pp_print_newline fmt () ; end +let dkey_shell = Wp_parameters.register_category "shell" + let () = Cmdline.run_after_setting_files (fun _ -> - if Wp_parameters.has_dkey "shell" then + if Wp_parameters.has_dkey dkey_shell then Log.print_on_output pp_wp_parameters) let do_prover_detect () = @@ -831,13 +841,15 @@ let rec try_sequence jobs () = match jobs with | head :: tail -> Extlib.try_finally ~finally:(try_sequence tail) head () +let dkey_raised = Wp_parameters.register_category "raised" + let sequence jobs () = - if Wp_parameters.has_dkey "raised" + if Wp_parameters.has_dkey dkey_raised then List.iter (fun f -> f ()) jobs else try_sequence jobs () let tracelog () = - if Datatype.String.Set.is_empty (Wp_parameters.Debug_category.get ()) then + if Wp_parameters.Debug_category.is_empty () then Wp_parameters.debug "Logging keys: %s." (Wp_parameters.Debug_category.As_string.get ()) diff --git a/src/plugins/wp/rformat.mli b/src/plugins/wp/rformat.mli index 031db4960fe5c84c28545128d02a0533612ed17d..0e9594623da0093f8f30a0088be21ec46c591416 100644 --- a/src/plugins/wp/rformat.mli +++ b/src/plugins/wp/rformat.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/rformat.mll b/src/plugins/wp/rformat.mll index e63dafa69e4471f759236007f969bc4e0ab13cf7..760b340597da80f2a7e1e948fd383a397a825522 100644 --- a/src/plugins/wp/rformat.mll +++ b/src/plugins/wp/rformat.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/script.mli b/src/plugins/wp/script.mli index 25845114b44b5039ca8e91b2f2e7fb00cdcc9d29..cc0d0d1700ac1de866616bdad8038e3a01705285 100644 --- a/src/plugins/wp/script.mli +++ b/src/plugins/wp/script.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/script.mll b/src/plugins/wp/script.mll index 7c7fe1803972dae62fb63b68fd4876fbc617909e..0ad999e615cded11e62b8ca4a7b5ea331a01eed2 100644 --- a/src/plugins/wp/script.mll +++ b/src/plugins/wp/script.mll @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/Makefile b/src/plugins/wp/share/Makefile index 3c65f78c256f41da530965e548eb313b24fd9aa5..37b0aa73bfeda87edf58fb7144b044a848a91279 100644 --- a/src/plugins/wp/share/Makefile +++ b/src/plugins/wp/share/Makefile @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # @@ -48,7 +48,7 @@ WHY3INCLUDES= -R $(WHY3LIB)/coq Why3 -R $(WPLSHARE)/why3 '' $(WPLSHARE)/why3/%.vo: $(WPLSHARE)/why3/%.v echo "Coqc $@" - @coqc $(WHY3INCLUDES) $< + @coqc -w none $(WHY3INCLUDES) $< $(WPLSHARE)/why3/.depend: $(addprefix $(WPLSHARE)/, $(WHY3_COQ_SOURCES)) echo "Coqdep for $(WPLSHARE)/why3" @@ -79,7 +79,7 @@ COQWPINCLUDES= -R $(WPLSHARE)/coqwp '' $(WPLSHARE)/coqwp/%.vo: $(WPLSHARE)/coqwp/%.v echo "Coqc $<" - @coqc $(COQWPINCLUDES) $< + @coqc -w none $(COQWPINCLUDES) $< $(WPLSHARE)/coqwp/.depend: $(addprefix $(WPLSHARE)/, $(WP_COQ_SOURCES)) echo "Coqdep for $(WPLSHARE)/coqwp" diff --git a/src/plugins/wp/share/Makefile.headers b/src/plugins/wp/share/Makefile.headers index aca872c9b21ea6f2e0f43c13c1ff1acff11f0df7..86779cf192ac6a35520729f9a6483792bd4e45ee 100644 --- a/src/plugins/wp/share/Makefile.headers +++ b/src/plugins/wp/share/Makefile.headers @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # diff --git a/src/plugins/wp/share/Makefile.resources b/src/plugins/wp/share/Makefile.resources index bbf54ba7082c303627f145a13574e6d8ca5f5fe8..36dcaac1fb43f01a5cd9b3fe492b3435626b26d8 100644 --- a/src/plugins/wp/share/Makefile.resources +++ b/src/plugins/wp/share/Makefile.resources @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # diff --git a/src/plugins/wp/share/coqwp/Bits.v b/src/plugins/wp/share/coqwp/Bits.v index 6ef9e065ba161bcef67bae64d85e263450fd36c0..6551e95e738894b9d880895c91fe8fc62b2293dc 100644 --- a/src/plugins/wp/share/coqwp/Bits.v +++ b/src/plugins/wp/share/coqwp/Bits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Cbits.v b/src/plugins/wp/share/coqwp/Cbits.v index ebb22a09238e4c2e29f25120a866990c2a4b7d8b..ac6cd0238fd3ca6f67c90890442aff1e52d91498 100644 --- a/src/plugins/wp/share/coqwp/Cbits.v +++ b/src/plugins/wp/share/coqwp/Cbits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Cfloat.v b/src/plugins/wp/share/coqwp/Cfloat.v index e05ba9fb8ad65fa673a1a6ae745aefd269500d5d..203dea0b09788aee5161311d4195e982fc1218d4 100644 --- a/src/plugins/wp/share/coqwp/Cfloat.v +++ b/src/plugins/wp/share/coqwp/Cfloat.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Cint.v b/src/plugins/wp/share/coqwp/Cint.v index 6943ec93eb3b09b41f93ee65fee76af1ce33f70b..56410926cf8a6cd12a9a419a8d285c6060b460db 100644 --- a/src/plugins/wp/share/coqwp/Cint.v +++ b/src/plugins/wp/share/coqwp/Cint.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Cmath.v b/src/plugins/wp/share/coqwp/Cmath.v index bc0b5393d1f18f97c5dda07618c271d92b0f314e..32790820774b87361e95af8d23c63b6605f65526 100644 --- a/src/plugins/wp/share/coqwp/Cmath.v +++ b/src/plugins/wp/share/coqwp/Cmath.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Memory.v b/src/plugins/wp/share/coqwp/Memory.v index b8701a2d314be12e79e7e4fe73003904ff47bb3a..77b7deb7ce8ae5fb4ac2a67122cb05db4d38f53a 100644 --- a/src/plugins/wp/share/coqwp/Memory.v +++ b/src/plugins/wp/share/coqwp/Memory.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Qed.v b/src/plugins/wp/share/coqwp/Qed.v index 720e0688fb35c3ccf7f374c6413269aa83f29afb..599d286d78641ccb17fabd673dc4f04a799076f0 100644 --- a/src/plugins/wp/share/coqwp/Qed.v +++ b/src/plugins/wp/share/coqwp/Qed.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Qedlib.v b/src/plugins/wp/share/coqwp/Qedlib.v index d257adffba796515a85b25a83a5de5792d3f91e3..7ac0739a0749a3690c97b0e9bbbe04934bf8daad 100644 --- a/src/plugins/wp/share/coqwp/Qedlib.v +++ b/src/plugins/wp/share/coqwp/Qedlib.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Vlist.v b/src/plugins/wp/share/coqwp/Vlist.v index 048269e18d083008d4255ece5955634e203e707a..3057755cf6ecd01d69562bb442b04805a9adba2a 100644 --- a/src/plugins/wp/share/coqwp/Vlist.v +++ b/src/plugins/wp/share/coqwp/Vlist.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Vset.v b/src/plugins/wp/share/coqwp/Vset.v index 73af45888a5d89cb1563f356b9006031dc4cafed..3d4e80170f4255d7d892261114b72cbd5fc051b7 100644 --- a/src/plugins/wp/share/coqwp/Vset.v +++ b/src/plugins/wp/share/coqwp/Vset.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/coqwp/Zbits.v b/src/plugins/wp/share/coqwp/Zbits.v index 7223c02b8b7d1f6b67db30d934d8a17b3981bba7..f8853c0857d7df60666d5b37db47408b81215e84 100644 --- a/src/plugins/wp/share/coqwp/Zbits.v +++ b/src/plugins/wp/share/coqwp/Zbits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -1868,10 +1868,10 @@ Local Ltac f_equal_hyp h f k := end. Local Ltac linear2 := - intros x y; (try split); intro H; (try split); + intros x y; (try split); intros H; (try split); let k := fresh "k" in Zbit_ext k; - try (destruct H as [H H0] ; f_equal_hyp H0 Zbit k; generalize H0; clear H0); + try (destruct H as [H H0] ; f_equal_hyp H0 Zbit k; generalize H0; clear H0) ; f_equal_hyp H Zbit k; generalize H; clear H; (try unfold limpl); (try unfold lnot); (try unfold land); (try unfold lor); (try unfold lxor); @@ -1903,14 +1903,14 @@ Lemma linear_limpl_r: forall x y: Z, Proof. linear2. Qed. - +(* Local Ltac F_equal_hyp h f k := match goal with | [ h:(?X1 = ?X2) |- _ ] => idtac h; let H := fresh in assert (H : f X1 k = f X2 k) by (f_equal; auto); clear h; assert (h: f X1 k = f X2 k) by (apply H); clear H end. - +*) Lemma linear_limpl_l: forall x y: Z, limpl x y = x <-> x=-1 /\ y=-1. Proof. @@ -1948,7 +1948,7 @@ Proof. Qed. Local Ltac linear3 := - intros x y z; (try split); intro H; (try split); + intros x y z; (try split); intros H; (try split); let k := fresh "k" in Zbit_ext k; try (destruct H as [H H0] ; f_equal_hyp H0 Zbit k; generalize H0; clear H0); diff --git a/src/plugins/wp/share/ergo/Cbits.mlw b/src/plugins/wp/share/ergo/Cbits.mlw index a18e6aa8ca3b860c31fa759f25081f5ce730e4ae..b9826e1f4f707dd1a5e7cb29895f06de48f5e8b5 100644 --- a/src/plugins/wp/share/ergo/Cbits.mlw +++ b/src/plugins/wp/share/ergo/Cbits.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Cfloat.mlw b/src/plugins/wp/share/ergo/Cfloat.mlw index 778b17b0ceebb544e593e64a6b570df29727982a..ec835bd56ad2bd782001fc57bcd0989d9428b8bd 100644 --- a/src/plugins/wp/share/ergo/Cfloat.mlw +++ b/src/plugins/wp/share/ergo/Cfloat.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Cint.mlw b/src/plugins/wp/share/ergo/Cint.mlw index e0a455c5af03dc80e108877817d9cbeda062b666..23dd9ba8d13713d1d10451e4c5c3a3022b221657 100644 --- a/src/plugins/wp/share/ergo/Cint.mlw +++ b/src/plugins/wp/share/ergo/Cint.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Cmath.mlw b/src/plugins/wp/share/ergo/Cmath.mlw index a4b50dc9af1ade3470437de316a2b14ae21377b0..3dddf84d16558991083d82c911af27285fd5b530 100644 --- a/src/plugins/wp/share/ergo/Cmath.mlw +++ b/src/plugins/wp/share/ergo/Cmath.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Memory.mlw b/src/plugins/wp/share/ergo/Memory.mlw index 5f94fca09b4dac8247453eee0631b26baa9f48b5..2c576a3773bd960e0a62c9f54f12e9b305ca8c68 100644 --- a/src/plugins/wp/share/ergo/Memory.mlw +++ b/src/plugins/wp/share/ergo/Memory.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Qed.mlw b/src/plugins/wp/share/ergo/Qed.mlw index 938bb3ed0d4cae57f49fa88e4906a5b29d547dbb..71e6e1c6e4ad9ff89939e895dbd2d469449e1f24 100644 --- a/src/plugins/wp/share/ergo/Qed.mlw +++ b/src/plugins/wp/share/ergo/Qed.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Vlist.mlw b/src/plugins/wp/share/ergo/Vlist.mlw index ddef3b92867c70bdbdc85e1d24a2aaf63eb0360e..487900595adc1bda902e57027e80f5dd267a1cc9 100644 --- a/src/plugins/wp/share/ergo/Vlist.mlw +++ b/src/plugins/wp/share/ergo/Vlist.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/ergo/Vset.mlw b/src/plugins/wp/share/ergo/Vset.mlw index 8a16f91d8298b29e9a73647fc3a5b8d95e67487b..2121998d91393dbdd19e74dad4228b5550b50f76 100644 --- a/src/plugins/wp/share/ergo/Vset.mlw +++ b/src/plugins/wp/share/ergo/Vset.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/install.ml b/src/plugins/wp/share/install.ml index ed682725e9074dd5c6ec4f8c3f2bbdf15b03f56e..caba6ffef779514e6e6e6417be3e43e2db6a3e2d 100644 --- a/src/plugins/wp/share/install.ml +++ b/src/plugins/wp/share/install.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/.gitignore b/src/plugins/wp/share/src/.gitignore index 4a16ab828bffe9ecc203a375b66470017ab1cac8..61cf9efba7524e2ad932634fa756919c5038fb7d 100644 --- a/src/plugins/wp/share/src/.gitignore +++ b/src/plugins/wp/share/src/.gitignore @@ -13,4 +13,3 @@ /*.glob /*.why_theory /.*.aux -/lia.cache diff --git a/src/plugins/wp/share/src/Bits.v b/src/plugins/wp/share/src/Bits.v index 18bc1674b9ff194eaa582368ee4fb93ab7f928a9..f9a23f69179da8a8a86b263364c436eea302bdb5 100644 --- a/src/plugins/wp/share/src/Bits.v +++ b/src/plugins/wp/share/src/Bits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/BuiltIn/bool.mlw b/src/plugins/wp/share/src/BuiltIn/bool.mlw index 853faea4885759f7ca846326c7448f9d56ca74b9..4b829493b190273681d8ad2094f39b9591384ca3 100644 --- a/src/plugins/wp/share/src/BuiltIn/bool.mlw +++ b/src/plugins/wp/share/src/BuiltIn/bool.mlw @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/Makefile b/src/plugins/wp/share/src/Makefile index 955d72c6ac720e9a07e7028537ddaf8315e87e61..8b3a796f29fae5b53dac8a51f0ec2bb2107a69a2 100644 --- a/src/plugins/wp/share/src/Makefile +++ b/src/plugins/wp/share/src/Makefile @@ -2,7 +2,7 @@ # # # This file is part of WP plug-in of Frama-C. # # # -# Copyright (C) 2007-2016 # +# Copyright (C) 2007-2017 # # CEA (Commissariat a l'energie atomique et aux energies # # alternatives) # # # diff --git a/src/plugins/wp/share/src/Qedlib.v b/src/plugins/wp/share/src/Qedlib.v index d257adffba796515a85b25a83a5de5792d3f91e3..7ac0739a0749a3690c97b0e9bbbe04934bf8daad 100644 --- a/src/plugins/wp/share/src/Qedlib.v +++ b/src/plugins/wp/share/src/Qedlib.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/Zbits.v b/src/plugins/wp/share/src/Zbits.v index 7223c02b8b7d1f6b67db30d934d8a17b3981bba7..b4bffa61760059b2f2cb159bf5d19a611bad615f 100644 --- a/src/plugins/wp/share/src/Zbits.v +++ b/src/plugins/wp/share/src/Zbits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/alt_ergo_why3_stdlib.drv b/src/plugins/wp/share/src/alt_ergo_why3_stdlib.drv index a8b8a831bd3a97bf10a4d2ff979ace01c05db4a5..980ae39c09e00997adf890991fcbe9c5ff0eaf8b 100644 --- a/src/plugins/wp/share/src/alt_ergo_why3_stdlib.drv +++ b/src/plugins/wp/share/src/alt_ergo_why3_stdlib.drv @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/cbits.why b/src/plugins/wp/share/src/cbits.why index be254bc7f1d91ffe7cc87ce0b5760f1784419675..9b41481fc00d3e90366b341e5320d1cf535893fd 100644 --- a/src/plugins/wp/share/src/cbits.why +++ b/src/plugins/wp/share/src/cbits.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/cfloat.why b/src/plugins/wp/share/src/cfloat.why index bb65fad104cb2ff1db21cf768f41343c0ff557ca..9cba532cf20eee6c32030c5160859b518b5a92aa 100644 --- a/src/plugins/wp/share/src/cfloat.why +++ b/src/plugins/wp/share/src/cfloat.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/cint.why b/src/plugins/wp/share/src/cint.why index 44aec73ee9df8233ecfb4dffe42950fcf0931d09..ee1ec99a68e3b4728783be49409da010bd99f293 100644 --- a/src/plugins/wp/share/src/cint.why +++ b/src/plugins/wp/share/src/cint.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/cmath.why b/src/plugins/wp/share/src/cmath.why index 3b5b9086f902eda2de6ce07b0498a36f2dacadd4..200b7ab516a856a10dcd947e957710af50e071fc 100644 --- a/src/plugins/wp/share/src/cmath.why +++ b/src/plugins/wp/share/src/cmath.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/coq-own-realization.drv b/src/plugins/wp/share/src/coq-own-realization.drv index f1c8ff8d1ed402bb25f9b8b303d46dab626128be..7c7f2ae4470926dc2b707b241808725e22af27ce 100644 --- a/src/plugins/wp/share/src/coq-own-realization.drv +++ b/src/plugins/wp/share/src/coq-own-realization.drv @@ -2,7 +2,7 @@ (* *) (* This file is part of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat à l'énergie atomique et aux énergies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/filter_axioms.ml b/src/plugins/wp/share/src/filter_axioms.ml index 26219b63f0dfb59b9d6f92228e8cb7751d3ab217..83459950a8dfd20ca8b6ab95f3b85e9fb8fed032 100644 --- a/src/plugins/wp/share/src/filter_axioms.ml +++ b/src/plugins/wp/share/src/filter_axioms.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/memory.why b/src/plugins/wp/share/src/memory.why index cdd79d234dde701b8240ef833346087f40c2c27d..99299f61312247166f7e3c95b5f2e49a663b7c19 100644 --- a/src/plugins/wp/share/src/memory.why +++ b/src/plugins/wp/share/src/memory.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/qed.why b/src/plugins/wp/share/src/qed.why index 93964ca523c1e1ccf711179ab2c3bc6a6e22b22b..38a6be62bf02d0da7beb629075ebe96cbf08cee4 100644 --- a/src/plugins/wp/share/src/qed.why +++ b/src/plugins/wp/share/src/qed.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/vlist.why b/src/plugins/wp/share/src/vlist.why index de7e3fb62c807ba030d40c737058f5a9a43deeae..265955a7f3bf27e63decb1068ebe4fdf12d775ec 100644 --- a/src/plugins/wp/share/src/vlist.why +++ b/src/plugins/wp/share/src/vlist.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/src/vset.why b/src/plugins/wp/share/src/vset.why index 46f10203ddbf7895c4e7c94c89630a382fca283a..e3b6b057e161e0fa7823a9b7aefe4eed21992106 100644 --- a/src/plugins/wp/share/src/vset.why +++ b/src/plugins/wp/share/src/vset.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Bits.v b/src/plugins/wp/share/why3/Bits.v index 0d7d4f445603182a1b62d3f5e29ec809f3c6a153..b831375d40c555f8071ac92030646d441f2628db 100644 --- a/src/plugins/wp/share/why3/Bits.v +++ b/src/plugins/wp/share/why3/Bits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cbits.v b/src/plugins/wp/share/why3/Cbits.v index ebb22a09238e4c2e29f25120a866990c2a4b7d8b..ac6cd0238fd3ca6f67c90890442aff1e52d91498 100644 --- a/src/plugins/wp/share/why3/Cbits.v +++ b/src/plugins/wp/share/why3/Cbits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cbits.why b/src/plugins/wp/share/why3/Cbits.why index 6e8110eb1ec3f440059550e3c14c0e219dda1cb4..5d549af4db5ba5d84736a3141d9bd7b2b71ec6ac 100644 --- a/src/plugins/wp/share/why3/Cbits.why +++ b/src/plugins/wp/share/why3/Cbits.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cfloat.v b/src/plugins/wp/share/why3/Cfloat.v index e05ba9fb8ad65fa673a1a6ae745aefd269500d5d..203dea0b09788aee5161311d4195e982fc1218d4 100644 --- a/src/plugins/wp/share/why3/Cfloat.v +++ b/src/plugins/wp/share/why3/Cfloat.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cfloat.why b/src/plugins/wp/share/why3/Cfloat.why index e9826cda2492ff89a10e8dfdf85cdf62cee0047b..ecaa19ef4108eb6c20a576f34e6d2316a2ab2767 100644 --- a/src/plugins/wp/share/why3/Cfloat.why +++ b/src/plugins/wp/share/why3/Cfloat.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cint.v b/src/plugins/wp/share/why3/Cint.v index 6943ec93eb3b09b41f93ee65fee76af1ce33f70b..56410926cf8a6cd12a9a419a8d285c6060b460db 100644 --- a/src/plugins/wp/share/why3/Cint.v +++ b/src/plugins/wp/share/why3/Cint.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cint.why b/src/plugins/wp/share/why3/Cint.why index 86015b211b3b4c171ec100fd78a1256da9a45d53..4018f4c3a236f0ee256ec844e935c40b0f7a52c3 100644 --- a/src/plugins/wp/share/why3/Cint.why +++ b/src/plugins/wp/share/why3/Cint.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cmath.v b/src/plugins/wp/share/why3/Cmath.v index bc0b5393d1f18f97c5dda07618c271d92b0f314e..32790820774b87361e95af8d23c63b6605f65526 100644 --- a/src/plugins/wp/share/why3/Cmath.v +++ b/src/plugins/wp/share/why3/Cmath.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Cmath.why b/src/plugins/wp/share/why3/Cmath.why index 7417716a4ddd95bed2ff6a4ddccd84f5a0067700..a90974d67b30b064dc2e3fe14d757683422d16fc 100644 --- a/src/plugins/wp/share/why3/Cmath.why +++ b/src/plugins/wp/share/why3/Cmath.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Memory.v b/src/plugins/wp/share/why3/Memory.v index b8701a2d314be12e79e7e4fe73003904ff47bb3a..77b7deb7ce8ae5fb4ac2a67122cb05db4d38f53a 100644 --- a/src/plugins/wp/share/why3/Memory.v +++ b/src/plugins/wp/share/why3/Memory.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Memory.why b/src/plugins/wp/share/why3/Memory.why index d29ad9ada69615a0f5856ad8e9c79300d77950cb..23a27fdb807c42d8abca57a08a025df7635b5c7b 100644 --- a/src/plugins/wp/share/why3/Memory.why +++ b/src/plugins/wp/share/why3/Memory.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Qed.v b/src/plugins/wp/share/why3/Qed.v index 720e0688fb35c3ccf7f374c6413269aa83f29afb..599d286d78641ccb17fabd673dc4f04a799076f0 100644 --- a/src/plugins/wp/share/why3/Qed.v +++ b/src/plugins/wp/share/why3/Qed.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Qed.why b/src/plugins/wp/share/why3/Qed.why index 37dc94d6eff13bb9f7a4d5303de3f05a60410b17..1c490193a9522379bef163938e034caa18ca5104 100644 --- a/src/plugins/wp/share/why3/Qed.why +++ b/src/plugins/wp/share/why3/Qed.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Qedlib.v b/src/plugins/wp/share/why3/Qedlib.v index d257adffba796515a85b25a83a5de5792d3f91e3..7ac0739a0749a3690c97b0e9bbbe04934bf8daad 100644 --- a/src/plugins/wp/share/why3/Qedlib.v +++ b/src/plugins/wp/share/why3/Qedlib.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Vlist.v b/src/plugins/wp/share/why3/Vlist.v index 048269e18d083008d4255ece5955634e203e707a..3057755cf6ecd01d69562bb442b04805a9adba2a 100644 --- a/src/plugins/wp/share/why3/Vlist.v +++ b/src/plugins/wp/share/why3/Vlist.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Vlist.why b/src/plugins/wp/share/why3/Vlist.why index 121dbde3cadd9533ded7fb62af0076afb7dddb5d..5604bbffc0a864d8680c804d8bb3ef6e555f5e36 100644 --- a/src/plugins/wp/share/why3/Vlist.why +++ b/src/plugins/wp/share/why3/Vlist.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Vset.v b/src/plugins/wp/share/why3/Vset.v index 73af45888a5d89cb1563f356b9006031dc4cafed..3d4e80170f4255d7d892261114b72cbd5fc051b7 100644 --- a/src/plugins/wp/share/why3/Vset.v +++ b/src/plugins/wp/share/why3/Vset.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Vset.why b/src/plugins/wp/share/why3/Vset.why index c420f650cb0f073b43242f5f724d16d6656f6f90..3a19cbafb81c29791d6e38ad40643655b966faad 100644 --- a/src/plugins/wp/share/why3/Vset.why +++ b/src/plugins/wp/share/why3/Vset.why @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/Zbits.v b/src/plugins/wp/share/why3/Zbits.v index 7223c02b8b7d1f6b67db30d934d8a17b3981bba7..b4bffa61760059b2f2cb159bf5d19a611bad615f 100644 --- a/src/plugins/wp/share/why3/Zbits.v +++ b/src/plugins/wp/share/why3/Zbits.v @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/why3/coq.drv b/src/plugins/wp/share/why3/coq.drv index 1439427cafb6229d58274d3d4b8fde8494f4e530..da2ea82dabce18514aa0783f121fb229d469d98f 100644 --- a/src/plugins/wp/share/why3/coq.drv +++ b/src/plugins/wp/share/why3/coq.drv @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/share/wp.driver b/src/plugins/wp/share/wp.driver index 34abd3ddd8453697c7258dc620aefaf391d76f03..5cb3dd0c086babea96b784f0e226fd89b366108b 100644 --- a/src/plugins/wp/share/wp.driver +++ b/src/plugins/wp/share/wp.driver @@ -2,7 +2,7 @@ /* */ /* This file is part of WP plug-in of Frama-C. */ /* */ -/* Copyright (C) 2007-2016 */ +/* Copyright (C) 2007-2017 */ /* CEA (Commissariat a l'energie atomique et aux energies */ /* alternatives) */ /* */ diff --git a/src/plugins/wp/tests/wp/oracle/bug_rte.res.oracle b/src/plugins/wp/tests/wp/oracle/bug_rte.res.oracle index faee5cbd5d55c411322bb938cc79588187a83645..5d27599429e5f10ea21f937458c88d6c52032373 100644 --- a/src/plugins/wp/tests/wp/oracle/bug_rte.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/bug_rte.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/bug_rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle/sharing.res.oracle b/src/plugins/wp/tests/wp/oracle/sharing.res.oracle index 309c72e1a654e359d7643e9cdd3675673ebbc2e6..ae849e86390f5a248d63cec50e316ed25a819aa1 100644 --- a/src/plugins/wp/tests/wp/oracle/sharing.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/sharing.res.oracle @@ -1,11 +1,11 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/sharing.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] 1 goal scheduled -[wp:print-generated] (* ---------------------------------------------------------- *) +[wp:print-generated] "WPOUT/typed/f_post.ergo" + (* ---------------------------------------------------------- *) (* --- Post-condition (file tests/wp/sharing.c, line 8) in 'f' --- *) (* ---------------------------------------------------------- *) diff --git a/src/plugins/wp/tests/wp/oracle/wp_behav.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_behav.res.oracle index ccc21dcd4032565cb5655b0717330b4ea5ebaced..4c5c1192ea5bc86599c5f2e99e070390daf04454 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_behav.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_behav.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_behav.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -112,7 +111,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function local_named_behavior with behavior xpos_stmt_54 + Function local_named_behavior with behavior xpos_stmt_53 ------------------------------------------------------------ Goal Post-condition for 'xpos' 'qed_ok' at instruction (file tests/wp/wp_behav.c, line 112): @@ -182,7 +181,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function more_stmt_assigns with behavior blk_stmt_87 + Function more_stmt_assigns with behavior blk_stmt_86 ------------------------------------------------------------ Goal Assigns for 'blk' 'qed_ok,qed_ok' at block (1/2): @@ -204,7 +203,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function part_stmt_bhv with behavior bs_stmt_94_b1 + Function part_stmt_bhv with behavior bs_stmt_93_b1 ------------------------------------------------------------ Goal Post-condition for 'bs' (file tests/wp/wp_behav.c, line 175) at block: @@ -265,7 +264,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function stmt_assigns with behavior default_for_stmt_71 + Function stmt_assigns with behavior default_for_stmt_70 ------------------------------------------------------------ Goal Assigns (file tests/wp/wp_behav.c, line 139) at call 'unknown' (file tests/wp/wp_behav.c, line 140): @@ -274,7 +273,7 @@ Prove: false. ------------------------------------------------------------ ------------------------------------------------------------ - Function stmt_contract with behavior default_for_stmt_23 + Function stmt_contract with behavior default_for_stmt_22 ------------------------------------------------------------ Goal Pre-condition 'qed_ok' at block: @@ -321,7 +320,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function stmt_contract_assigns with behavior default_for_stmt_44 + Function stmt_contract_assigns with behavior default_for_stmt_43 ------------------------------------------------------------ Goal Pre-condition 'qed_ok' at block: @@ -376,7 +375,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function stmt_contract_label with behavior default_for_stmt_33 + Function stmt_contract_label with behavior default_for_stmt_32 ------------------------------------------------------------ Goal Post-condition 'qed_ok' at block: diff --git a/src/plugins/wp/tests/wp/oracle/wp_call_pre.0.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_call_pre.0.res.oracle index 5574f3a3fd771aa6abd16d155ab600cfba4b770b..7f07c63971edd54c2a760e5cc3e749b242d61d7e 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_call_pre.0.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_call_pre.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_call_pre.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle/wp_call_pre.1.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_call_pre.1.res.oracle index d176641e720c94674bdcbe551cbcb3dc4254353d..0083ec25b1aa9f86d4271a663f3b31792cc90065 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_call_pre.1.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_call_pre.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_call_pre.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -16,7 +15,7 @@ Prove: true. ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'main' at call 'f' (file tests/wp/wp_call_pre.c, line 33) +Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'main' at initialization of 'x' (file tests/wp/wp_call_pre.c, line 33) : Prove: true. diff --git a/src/plugins/wp/tests/wp/oracle/wp_call_pre.2.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_call_pre.2.res.oracle index 0c06d586a95643784f25fc278a4de6c8f3522d8b..b674bac7874c3dbdc1f1db5d1d3b941a17392d35 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_call_pre.2.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_call_pre.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_call_pre.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -10,13 +9,13 @@ tests/wp/wp_call_pre.c:53:[kernel] warning: No code nor implicit assigns clause Function double_call ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at call 'f' (file tests/wp/wp_call_pre.c, line 26) +Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at initialization of 'x1' (file tests/wp/wp_call_pre.c, line 26) : Prove: true. ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at call 'f' (file tests/wp/wp_call_pre.c, line 27) +Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at initialization of 'x2' (file tests/wp/wp_call_pre.c, line 27) : Assume { Type: is_sint32(f) /\ is_sint32(x). @@ -32,7 +31,7 @@ Prove: (-1) <= x. Function main ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'main' at call 'f' (file tests/wp/wp_call_pre.c, line 33) +Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'main' at initialization of 'x' (file tests/wp/wp_call_pre.c, line 33) : Prove: true. diff --git a/src/plugins/wp/tests/wp/oracle/wp_call_pre.3.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_call_pre.3.res.oracle index 49c19292ea4840e37bf60b8300e7211445b68437..2d4b9ee5614e8804504a98e188b08fa35a347ece 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_call_pre.3.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_call_pre.3.res.oracle @@ -1,18 +1,17 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_call_pre.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' tests/wp/wp_call_pre.c:53:[kernel] warning: No code nor implicit assigns clause for function f, generating default assigns from the prototype [wp] warning: Missing RTE guards -Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at call 'f' (file tests/wp/wp_call_pre.c, line 26) +Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at initialization of 'x1' (file tests/wp/wp_call_pre.c, line 26) : Prove: true. ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at call 'f' (file tests/wp/wp_call_pre.c, line 27) +Goal Instance of 'Pre-condition 'qed_ok,Rf' in 'f'' in 'double_call' at initialization of 'x2' (file tests/wp/wp_call_pre.c, line 27) : Assume { Type: is_sint32(f) /\ is_sint32(x). diff --git a/src/plugins/wp/tests/wp/oracle/wp_call_pre.4.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_call_pre.4.res.oracle index dafeadda454ca1366b556ecf4e1dad6ed6dabe7d..5dfb259272d2aa5e276247d0e06ff9e6379bf74e 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_call_pre.4.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_call_pre.4.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_call_pre.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle/wp_eqb.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_eqb.res.oracle index 1b9792098e4241d28a1e81ac0819577a8de79259..01ab58059135538b7a8b0319c5e1976878f2d1a9 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_eqb.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_eqb.res.oracle @@ -1,11 +1,11 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_eqb.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] 1 goal scheduled -[wp:print-generated] (* ---------------------------------------------------------- *) +[wp:print-generated] "WPOUT/typed/f_post.ergo" + (* ---------------------------------------------------------- *) (* --- Post-condition (file tests/wp/wp_eqb.i, line 8) in 'f' --- *) (* ---------------------------------------------------------- *) diff --git a/src/plugins/wp/tests/wp/oracle/wp_inv_in_loop.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_inv_in_loop.res.oracle deleted file mode 100644 index a2efb8dbece8e4368c44e16e038f7c4baa7f623e..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp/oracle/wp_inv_in_loop.res.oracle +++ /dev/null @@ -1,296 +0,0 @@ -# frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp/wp_inv_in_loop.c (with preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] warning: Missing RTE guards -tests/wp/wp_inv_in_loop.c:99:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:169:[wp] warning: calculus failed on strategy - for 'double_entry', behavior 'default!', all properties, both assigns or not - because unsupported non-natural loop without invariant property. (abort) -tests/wp/wp_inv_in_loop.c:45:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:185:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:82:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:62:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:17:[wp] warning: Missing assigns clause (assigns 'everything' instead) ------------------------------------------------------------- - Function bts618 ------------------------------------------------------------- - -Goal Invariant 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 101): -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function caveat_inv ------------------------------------------------------------- - -Goal Invariant 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 38): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns 'qed_ok': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function double_loop ------------------------------------------------------------- - -Goal Invariant 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 46): -Prove: true. - ------------------------------------------------------------- - -Goal Invariant 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 49): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns 'qed_ok': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function goto_natural_loop with behavior qed_ok ------------------------------------------------------------- - -Goal Post-condition for 'qed_ok' 'qed_ok,ok' in 'goto_natural_loop': -Prove: true. - ------------------------------------------------------------- - -Goal Invariant for 'qed_ok' 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 186): -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function goto_natural_loop with behavior without_inv ------------------------------------------------------------- - -Goal Post-condition for 'without_inv' 'qed_ko' in 'goto_natural_loop': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function inv_from_init ------------------------------------------------------------- - -Goal Invariant 'qed_ok,I' (file tests/wp/wp_inv_in_loop.c, line 28): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns 'qed_ok': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function non_natural_loop with behavior n_neg ------------------------------------------------------------- - -Goal Post-condition for 'n_neg' (file tests/wp/wp_inv_in_loop.c, line 121) in 'non_natural_loop': -Assume { - Type: is_sint32(n) /\ is_sint32(n_1) /\ is_sint32(n_2) /\ - is_sint32(non_natural_loop_0) /\ is_sint32(x). - (* Pre-condition for 'n_neg' *) - Have: n_2 < 0. - (* Merge *) - Either { - Case: - Let x_1 = 2 + x. - Type: is_sint32(x) /\ is_sint32(x_1). - Have: (n = 10) /\ (n_2 = 10). - (* Invariant for 'n_neg' *) - Have: ((x % 2) = 0) /\ (x <= 9). - Have: x_1 = non_natural_loop_0. - Case: - Have: n_2 = n_1. - If n_1 < 0 - Then { Have: non_natural_loop_0 = 0. Have: n = 10. } - Else { Have: n = 20. Have: non_natural_loop_0 = 3. } - } - (* Else *) - Have: n <= non_natural_loop_0. -} -Prove: non_natural_loop_0 = 10. - ------------------------------------------------------------- - -Goal Invariant for 'n_neg' (file tests/wp/wp_inv_in_loop.c, line 137): -Assume { - Type: is_sint32(n) /\ is_sint32(n_1) /\ is_sint32(n_2) /\ is_sint32(x) /\ - is_sint32(x_1). - (* Pre-condition for 'n_neg' *) - Have: n_2 < 0. - (* Merge *) - Either { - Case: - Let x_2 = 2 + x_1. - Type: is_sint32(x_1) /\ is_sint32(x_2). - Have: (n = 10) /\ (n_2 = 10). - (* Invariant for 'n_neg' *) - Have: ((x_1 % 2) = 0) /\ (x_1 <= 9). - Have: x_2 = x. - Case: - Have: n_2 = n_1. - If n_1 < 0 - Then { Have: x = 0. Have: n = 10. } - Else { Have: n = 20. Have: x = 3. } - } - (* Then *) - Have: x < n. -} -Prove: (n = 10) /\ ((x % 2) = 0). - ------------------------------------------------------------- ------------------------------------------------------------- - Function non_natural_loop with behavior n_pos ------------------------------------------------------------- - -Goal Post-condition for 'n_pos' (file tests/wp/wp_inv_in_loop.c, line 124) in 'non_natural_loop': -Assume { - Type: is_sint32(n) /\ is_sint32(n_1) /\ is_sint32(n_2) /\ - is_sint32(non_natural_loop_0) /\ is_sint32(x). - (* Pre-condition for 'n_pos' *) - Have: 0 <= n_2. - (* Merge *) - Either { - Case: - Let x_1 = 2 + x. - Type: is_sint32(x) /\ is_sint32(x_1). - Have: (n = 20) /\ (n_2 = 20). - Have: x_1 = non_natural_loop_0. - Case: - Have: n_2 = n_1. - If n_1 < 0 - Then { Have: non_natural_loop_0 = 0. Have: n = 10. } - Else { Have: n = 20. Have: non_natural_loop_0 = 3. } - } - (* Else *) - Have: n <= non_natural_loop_0. -} -Prove: non_natural_loop_0 = 21. - ------------------------------------------------------------- - -Goal Invariant for 'n_pos' 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 139): -Assume { - Type: is_sint32(n) /\ is_sint32(n_1) /\ is_sint32(n_2) /\ is_sint32(x) /\ - is_sint32(x_1). - (* Pre-condition for 'n_pos' *) - Have: 0 <= n_2. - (* Merge *) - Either { - Case: - Let x_2 = 2 + x_1. - Type: is_sint32(x_1) /\ is_sint32(x_2). - Have: (n = 20) /\ (n_2 = 20). - Have: x_2 = x. - Case: - Have: n_2 = n_1. - If n_1 < 0 - Then { Have: x = 0. Have: n = 10. } - Else { Have: n = 20. Have: x = 3. } - } - (* Then *) - Have: x < n. -} -Prove: n = 20. - ------------------------------------------------------------- ------------------------------------------------------------- - Function razT2 ------------------------------------------------------------- - -Goal Post-condition 'post' in 'razT2': -Prove: true. - ------------------------------------------------------------- - -Goal Invariant 'Ii' (file tests/wp/wp_inv_in_loop.c, line 83): -Prove: true. - ------------------------------------------------------------- - -Goal Invariant (file tests/wp/wp_inv_in_loop.c, line 88): -Prove: true. - ------------------------------------------------------------- - -Goal Invariant (file tests/wp/wp_inv_in_loop.c, line 90): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp/wp_inv_in_loop.c, line 86) (1/2): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp/wp_inv_in_loop.c, line 86) (2/2): -Effect at line 87 -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function razT2simple ------------------------------------------------------------- - -Goal Post-condition 'qed_ok,post' in 'razT2simple': -Prove: true. - ------------------------------------------------------------- - -Goal Invariant 'qed_ok,I1' (file tests/wp/wp_inv_in_loop.c, line 63): -Prove: true. - ------------------------------------------------------------- - -Goal Invariant 'qed_ok,I2' (file tests/wp/wp_inv_in_loop.c, line 70): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp/wp_inv_in_loop.c, line 67) (1/2): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp/wp_inv_in_loop.c, line 67) (2/2): -Effect at line 68 -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function simple_inv ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'simple_inv': -Prove: true. - ------------------------------------------------------------- - -Goal Invariant 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 18): -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function test_for_tag ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'test_for_tag': -Prove: true. - ------------------------------------------------------------- - -Goal Invariant 'qed_ok' (file tests/wp/wp_inv_in_loop.c, line 152): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns 'qed_ok': -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp/oracle/wp_strategy.0.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_strategy.0.res.oracle index 67cc741f688a47d865d625987e9090bff174db4c..8f1118b949fdcd650d7ac7a26e3152d09f83cd93 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_strategy.0.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_strategy.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_strategy.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -45,7 +44,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function default_behaviors with behavior default_for_stmt_55 + Function default_behaviors with behavior default_for_stmt_54 ------------------------------------------------------------ Goal Post-condition 'qed_ok,stmt_p' at block: @@ -71,7 +70,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function dpd1 with behavior default_for_stmt_11 + Function dpd1 with behavior default_for_stmt_10 ------------------------------------------------------------ Goal Post-condition 'qed_ko,Eko' at program point (file tests/wp/wp_strategy.c, line 37): @@ -93,7 +92,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function dpd2 with behavior default_for_stmt_16 + Function dpd2 with behavior default_for_stmt_15 ------------------------------------------------------------ Goal Post-condition 'qed_ko,Eko' at program point (file tests/wp/wp_strategy.c, line 45): @@ -115,7 +114,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if with behavior default_for_stmt_21 + Function spec_if with behavior default_for_stmt_20 ------------------------------------------------------------ Goal Post-condition 'qed_ok' at block: @@ -128,7 +127,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if with behavior default_for_stmt_27 + Function spec_if with behavior default_for_stmt_26 ------------------------------------------------------------ Goal Assigns 'qed_ok' at block: @@ -136,7 +135,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if with behavior default_for_stmt_33 + Function spec_if with behavior default_for_stmt_32 ------------------------------------------------------------ Goal Assigns 'qed_ok' at block: @@ -144,7 +143,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if_cond with behavior default_for_stmt_41 + Function spec_if_cond with behavior default_for_stmt_40 ------------------------------------------------------------ Goal Post-condition 'qed_ok' at block: @@ -152,7 +151,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if_not_cond with behavior default_for_stmt_49 + Function spec_if_not_cond with behavior default_for_stmt_48 ------------------------------------------------------------ Goal Post-condition 'qed_ok' at if-then-else (file tests/wp/wp_strategy.c, line 80): diff --git a/src/plugins/wp/tests/wp/oracle/wp_strategy.1.res.oracle b/src/plugins/wp/tests/wp/oracle/wp_strategy.1.res.oracle index cc2841722449f881447483192b86ee0a38a88f1c..5cea66ab356f663aaf047474c639a4823b48e210 100644 --- a/src/plugins/wp/tests/wp/oracle/wp_strategy.1.res.oracle +++ b/src/plugins/wp/tests/wp/oracle/wp_strategy.1.res.oracle @@ -1,11 +1,10 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_strategy.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards ------------------------------------------------------------ - Function default_behaviors with behavior default_for_stmt_55 + Function default_behaviors with behavior default_for_stmt_54 ------------------------------------------------------------ Goal Assigns 'qed_ok' at block: @@ -13,7 +12,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function dpd1 with behavior default_for_stmt_11 + Function dpd1 with behavior default_for_stmt_10 ------------------------------------------------------------ Goal Assigns 'qed_ok' at program point (file tests/wp/wp_strategy.c, line 37): @@ -21,7 +20,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function dpd2 with behavior default_for_stmt_16 + Function dpd2 with behavior default_for_stmt_15 ------------------------------------------------------------ Goal Assigns 'qed_ok' at program point (file tests/wp/wp_strategy.c, line 45): @@ -29,7 +28,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if with behavior default_for_stmt_21 + Function spec_if with behavior default_for_stmt_20 ------------------------------------------------------------ Goal Assigns 'qed_ok' at block: @@ -37,7 +36,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if with behavior default_for_stmt_27 + Function spec_if with behavior default_for_stmt_26 ------------------------------------------------------------ Goal Assigns 'qed_ok' at block: @@ -45,7 +44,7 @@ Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ - Function spec_if with behavior default_for_stmt_33 + Function spec_if with behavior default_for_stmt_32 ------------------------------------------------------------ Goal Assigns 'qed_ok' at block: diff --git a/src/plugins/wp/tests/wp/oracle_qualif/sharing.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/sharing.res.oracle index c6c3deb096ac076f1156fd0c564d41708130bf73..b90965201597c99206e84f95ea7043ad243ed322 100644 --- a/src/plugins/wp/tests/wp/oracle_qualif/sharing.res.oracle +++ b/src/plugins/wp/tests/wp/oracle_qualif/sharing.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/sharing.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.0.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.0.res.oracle index b7515594f33607cfd7b0fa3a2fae05d1922a6bdd..35c25a57769c73efc97d4707af2837c9aaddfeab 100644 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.0.res.oracle +++ b/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_behav.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.1.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.1.res.oracle index 1bb38764464947fdfa3bf6caf4160767ae23809c..71c2b704f5a0ae60ba30d1595f73633aab216b2c 100644 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.1.res.oracle +++ b/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_behav.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.2.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.2.res.oracle deleted file mode 100644 index 3f0098ed59245c2851301f3f6c85e78c1b3d3869..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.2.res.oracle +++ /dev/null @@ -1,21 +0,0 @@ -# frama-c -wp -wp-model 'Hoare' [...] -[kernel] preprocessing with "gcc -C -E -I. tests/wp/wp_behav.c" -[rte] annotating function assert_needed -[rte] annotating function bhv -[rte] annotating function bts0513 -[rte] annotating function f -[rte] annotating function local_named_behavior -[rte] annotating function min -[rte] annotating function more_stmt_assigns -[rte] annotating function part_stmt_bhv -[rte] annotating function razT -[rte] annotating function stmt_assigns -[rte] annotating function stmt_contract -[rte] annotating function stmt_contract_assigns -[rte] annotating function stmt_contract_label -[wp] Running WP plugin... -[wp] Collecting axiomatic usage -tests/wp/wp_behav.c:183:[wp] warning: Ignored specification 'for b1' (generalize to all behavior) -[wp] warning: Missing RTE guards -[wp] user error: no share directory src/wp/share for plug-in WP. -[kernel] Plug-in wp aborted: invalid user input. diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.3.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.3.res.oracle deleted file mode 100644 index b873363692dc5a50691083207ad23e3812a1d8a7..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_behav.3.res.oracle +++ /dev/null @@ -1,22 +0,0 @@ -# frama-c -wp -wp-model 'Hoare' [...] -[kernel] preprocessing with "gcc -C -E -I. tests/wp/wp_behav.c" -[rte] annotating function assert_needed -[rte] annotating function bhv -[rte] annotating function bts0513 -[rte] annotating function f -[rte] annotating function local_named_behavior -[rte] annotating function min -[rte] annotating function more_stmt_assigns -[rte] annotating function part_stmt_bhv -[rte] annotating function razT -[rte] annotating function stmt_assigns -[rte] annotating function stmt_contract -[rte] annotating function stmt_contract_assigns -[rte] annotating function stmt_contract_label -[wp] Running WP plugin... -[wp] Collecting axiomatic usage -tests/wp/wp_behav.c:183:[wp] warning: Ignored specification 'for b1' (generalize to all behavior) -[wp] warning: Missing RTE guards -tests/wp/wp_behav.c:165:[wp] warning: Missing assigns clause (assigns 'everything' instead) -[wp] user error: no share directory src/wp/share for plug-in WP. -[kernel] Plug-in wp aborted: invalid user input. diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_call_pre.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_call_pre.res.oracle index 70a7ca2031bdc6e068c38d85a39ee7f02d11a993..bc639b908d3f0d7105fa75cc9bc56daf4d37d9f7 100644 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_call_pre.res.oracle +++ b/src/plugins/wp/tests/wp/oracle_qualif/wp_call_pre.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_call_pre.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_eqb.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_eqb.res.oracle index 670a30181a28620085b7783d6ede5aadf109e385..bd22ca351076082a89b866832cbbfdf4dc4d0220 100644 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_eqb.res.oracle +++ b/src/plugins/wp/tests/wp/oracle_qualif/wp_eqb.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_eqb.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.0.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.0.res.oracle deleted file mode 100644 index 886730c1903ff3c6f41b035f3d38f1ea1a869586..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.0.res.oracle +++ /dev/null @@ -1,62 +0,0 @@ -# frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp/wp_inv_in_loop.c (with preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] warning: Missing RTE guards -tests/wp/wp_inv_in_loop.c:99:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:169:[wp] warning: calculus failed on strategy - for 'double_entry', behavior 'default!', properties -qed_ko, both assigns or not - because unsupported non-natural loop without invariant property. (abort) -tests/wp/wp_inv_in_loop.c:45:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:185:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:82:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:62:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp/wp_inv_in_loop.c:17:[wp] warning: Missing assigns clause (assigns 'everything' instead) -[wp] 30 goals scheduled -[wp] [Qed] Goal typed_ref_bts618_inv_qed_ok : Valid -[wp] [Qed] Goal typed_ref_caveat_inv_inv_qed_ok : Valid -[wp] [Qed] Goal typed_ref_caveat_inv_loop_assign : Valid -[wp] [Qed] Goal typed_ref_double_loop_inv_qed_ok : Valid -[wp] [Qed] Goal typed_ref_double_loop_inv_qed_ok_2 : Valid -[wp] [Qed] Goal typed_ref_double_loop_loop_assign : Valid -[wp] [Qed] Goal typed_ref_goto_natural_loop_qed_ok_post_qed_ok_ok : Valid -[wp] [Qed] Goal typed_ref_goto_natural_loop_inv_qed_ok_for_qed_ok : Valid -[wp] [Qed] Goal typed_ref_inv_from_init_inv_qed_ok_I : Valid -[wp] [Qed] Goal typed_ref_inv_from_init_loop_assign : Valid -[wp] [Alt-Ergo] Goal typed_ref_non_natural_loop_n_neg_post : Valid -[wp] [Alt-Ergo] Goal typed_ref_non_natural_loop_inv_for_n_neg : Valid -[wp] [Alt-Ergo] Goal typed_ref_non_natural_loop_n_pos_post : Unknown -[wp] [Alt-Ergo] Goal typed_ref_non_natural_loop_inv_qed_ok_for_n_pos : Valid -[wp] [Qed] Goal typed_ref_razT2_post_post : Valid -[wp] [Qed] Goal typed_ref_razT2_inv_Ii : Valid -[wp] [Qed] Goal typed_ref_razT2_inv : Valid -[wp] [Qed] Goal typed_ref_razT2_inv_2 : Valid -[wp] [Qed] Goal typed_ref_razT2_loop_assign_part1 : Valid -[wp] [Qed] Goal typed_ref_razT2_loop_assign_part2 : Valid -[wp] [Qed] Goal typed_ref_razT2simple_post_qed_ok_post : Valid -[wp] [Qed] Goal typed_ref_razT2simple_inv_qed_ok_I1 : Valid -[wp] [Qed] Goal typed_ref_razT2simple_inv_qed_ok_I2 : Valid -[wp] [Qed] Goal typed_ref_razT2simple_loop_assign_part1 : Valid -[wp] [Qed] Goal typed_ref_razT2simple_loop_assign_part2 : Valid -[wp] [Qed] Goal typed_ref_simple_inv_post_qed_ok : Valid -[wp] [Qed] Goal typed_ref_simple_inv_inv_qed_ok : Valid -[wp] [Qed] Goal typed_ref_test_for_tag_post_qed_ok : Valid -[wp] [Qed] Goal typed_ref_test_for_tag_inv_qed_ok : Valid -[wp] [Qed] Goal typed_ref_test_for_tag_loop_assign : Valid -[wp] Proved goals: 29 / 30 - Qed: 26 - Alt-Ergo: 3 (unknown: 1) ----------------------------------------------------------- -Functions WP Alt-Ergo Total Success -simple_inv 2 - 2 100% -inv_from_init 2 - 2 100% -caveat_inv 2 - 2 100% -double_loop 3 - 3 100% -razT2simple 5 - 5 100% -razT2 6 - 6 100% -bts618 1 - 1 100% -non_natural_loop - 3 (30) 4 75.0% -test_for_tag 3 - 3 100% -goto_natural_loop 2 - 2 100% ----------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.1.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.1.res.oracle deleted file mode 100644 index d9f62ba8f5ab86ff709e9209a24fd7ca114d2d9b..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_inv_in_loop.1.res.oracle +++ /dev/null @@ -1,15 +0,0 @@ -# frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp/wp_inv_in_loop.c (with preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] warning: Missing RTE guards -tests/wp/wp_inv_in_loop.c:185:[wp] warning: Missing assigns clause (assigns 'everything' instead) -[wp] 1 goal scheduled -[wp] [Qed] Goal typed_ref_goto_natural_loop_without_inv_post_qed_ko : Valid -[wp] Proved goals: 1 / 1 - Qed: 1 ----------------------------------------------------------- -Functions WP Alt-Ergo Total Success -goto_natural_loop 1 - 1 100% ----------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp/oracle_qualif/wp_strategy.res.oracle b/src/plugins/wp/tests/wp/oracle_qualif/wp_strategy.res.oracle index b73f59b322ff18893357fceb4dda56489d136508..327b5668e7e185a63a4970c51110f1e2f202341d 100644 --- a/src/plugins/wp/tests/wp/oracle_qualif/wp_strategy.res.oracle +++ b/src/plugins/wp/tests/wp/oracle_qualif/wp_strategy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp/wp_strategy.c (with preprocessing) [rte] annotating function bts0513 [rte] annotating function bts0513_bis diff --git a/src/plugins/wp/tests/wp/wp_inv_in_loop.c b/src/plugins/wp/tests/wp/wp_inv_in_loop.c deleted file mode 100644 index 24593819c9e0fc7a4796776f6ba678fab5b564b0..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp/wp_inv_in_loop.c +++ /dev/null @@ -1,191 +0,0 @@ -/* run.config - OPT: -wp-invariants -wp-model Hoare -*/ - -/* run.config_qualif -OPT: -journal-disable -wp -wp-invariants -wp-model Typed+ref -wp-par 1 -wp-prop="-qed_ko" -OPT: -journal-disable -wp -wp-invariants -wp-model Typed+ref -wp-par 1 -wp-prop qed_ko -wp-timeout 2 -*/ - -/* run.config_qed -DONTRUN: (config_qed) see config_qualif -*/ - -//@ensures qed_ok: \result == 5; -int simple_inv (void) { - int i = 0; - while (i < 5) { - //@ invariant qed_ok: 0 <= i < 5 ; - i++; - } - return i; -} -int inv_from_init (void) { - int x = 5; - int i = 0; - //@ loop assigns qed_ok: i ; - while (i < 5) { - //@ invariant qed_ok: I: i < x ; - i++; - } - return i; -} - -int caveat_inv (int n) { - int i, s = 0; - //@ loop assigns qed_ok: i, s; - for (i = 0; i < n; i++) { - //@ invariant qed_ok: 0 <= i < n ; - s++; - } - return s; -} - -int double_loop (void) { - for (int i = 0; i < 10; i++) { - //@ invariant qed_ok: 0 <= i < 10 ; - //@ loop assigns qed_ok: j; - for (int j = 0; j < i; j++) { - //@ invariant qed_ok: 0 <= j < i ; - ; - } - } - return 0; -} - -int T2[10][20]; - -/*@ ensures qed_ok: post: - \forall int ii, jj; 0 <= ii < 10 ==> 0 <= jj < 20 ==> T2[ii][jj] == 0; -*/ -void razT2simple (void) { - for (int i = 0; i < 10; i++) { - /*@ invariant qed_ok: I1: \forall int ki, j; 0 <= ki < i ==> 0 <= j < 20 - ==>T2[ki][j] == 0; - */ - - //@ loop assigns j, T2[i][0..19]; - for (int j = 0; j < 20; j++) { - /*@ invariant qed_ok: I2: - (\forall int ki, kj; 0 <= ki < i ==> 0 <= kj < 20 - ==> T2[ki][kj] == 0) - && (\forall int kj; 0 <= kj < j ==> T2[i][kj] == 0); */ - T2[i][j] = 0; - } - } -} - -/*@ ensures post: - \forall int i, j; 0 <= i < 10 ==> 0 <= j < 20 ==> T2[i][j] == 0; -*/ -void razT2 (void) { - for (int i = 0; i < 10; i++) { - /*@ invariant Ii: \forall int ki, j; 0 <= ki < i ==> 0 <= j < 20 - ==>T2[ki][j] == 0; - */ - //@ loop assigns j, T2[i][0..19]; - for (int j = 0; j < 20; j++) { - /*@ invariant \forall int ki, kj; 0 <= ki < i ==> 0 <= kj < 20 - ==> T2[ki][kj] == 0; */ - /*@ invariant \forall int kj; 0 <= kj < j ==> T2[i][kj] == 0; */ - T2[i][j] = 0; - } - } -} - -//@ requires c > 0; -int bts618 (int c) { - int x = 1; - L : ; - x++; - //@ invariant qed_ok: (0 < c <= \at(c, Pre)) && x == 2 + (\at(c, Pre) - c); - if (--c > 0) goto L; - return x; -} - -int T[10]; - -/* - -int both_inv_and_loop_inv (int n) { - - //@ loop invariant \forall int k; 0 <= k && k < i ==> T[k] == 0; - for (int i = 0; i < 10; i++) - T[i] = 0; -} -*/ - -// Add this test for [new_loops] only -/*@ behavior n_neg : - assumes n < 0; - ensures \result == 10; - behavior n_pos : - assumes n >= 0; - ensures \result == 21; - */ -int non_natural_loop (int n) { - int x = 1; - if (n < 0) { - x = 0; - n = 10; - } - else { - n = 20; - L : x = x + 2; - } - if (x < n) { - //@ for n_neg: invariant x < n && n == 10 && x%2 == 0; - ; - //@ for n_pos: invariant qed_ok: n == 20; - ; - goto L; - } - return x; -} - -//@ requires 0 <= n; ensures qed_ok: 0 <= \result < n + 5; -int test_for_tag (int n) { - int i = 0; - //@ loop assigns qed_ok: i; - while (i < n) { - i += 2; - //@ invariant qed_ok: 2 <= i < n+2; - i += 3; - } - return i; -} - -//@ ensures \old(T[0]) == 0 ==> T[0] == 0; -int double_entry (int n) { - int i = 0; - - if (T[0] == 0) goto L; - - while (i < n) { - if (T[i] == 0) - T[i] ++; - -L: - if (T[i] > 5) - break; - - i++; - } - return i; -} - -/*@ - behavior without_inv : - ensures qed_ko : \result == 6; - behavior qed_ok : - ensures qed_ok: ok : \result == 6; -*/ -int goto_natural_loop (int c) { - int c = 0; -L : if (c > 5) goto R; - //@ for qed_ok: invariant qed_ok: c <= 5; - c++; - goto L; -R : return c; -} - diff --git a/src/plugins/wp/tests/wp_acsl/assign_array.i b/src/plugins/wp/tests/wp_acsl/assign_array.i new file mode 100644 index 0000000000000000000000000000000000000000..07d8ca375cb24f73cfbd715d0e0d4265f0d0b0df --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/assign_array.i @@ -0,0 +1,26 @@ + +int A[16]; +int G; + +/*@ + assigns *p; + */ +void f(int *p); + +/*@ + assigns A[0]; + */ +void jobA(void) +{ + f(A); +} + +/*@ + assigns G; + */ +void jobG(void) +{ + f(&G); +} + + diff --git a/src/plugins/wp/tests/wp_acsl/ctor.i b/src/plugins/wp/tests/wp_acsl/ctor.i new file mode 100644 index 0000000000000000000000000000000000000000..87208a3193cb6ce2e8ed1e2db9229d75b17ee249 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/ctor.i @@ -0,0 +1,13 @@ +//@ ghost int WORLD; + +/*@ + axiomatic Event { + type evt = WrOf(integer) | RdOf(integer) ; + logic \list<evt> obs{L} reads WORLD ; + + + lemma cons: \forall integer i,j; (WrOf(i) == WrOf(j)) <==> (i == j); + lemma diff: \forall integer i,j; (RdOf(i) != WrOf(j)); + + } +*/ diff --git a/src/plugins/wp/tests/wp_acsl/implicit_enum_cast.i b/src/plugins/wp/tests/wp_acsl/implicit_enum_cast.i new file mode 100644 index 0000000000000000000000000000000000000000..c63f642673736d8bdcf7039a209f7370b19b5c60 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/implicit_enum_cast.i @@ -0,0 +1,13 @@ +typedef enum CODE { OK=1, KO=2 } err; + +//@ensures (\result==OK) <==> (x>0); assigns \nothing; +err foo(int x); + +//@ensures (\result==OK) <==> (x>0 && y>0); assigns \nothing; +err bar(int x,int y) +{ + err s = OK; + if (foo(x) != OK) s = KO; + if (foo(y) != OK) s = KO; + return s; +} diff --git a/src/plugins/wp/tests/wp_acsl/oracle/arith.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/arith.res.oracle index 489f3af5cd4f6688d8473267652d3f8fab51aa97..802aedfd03e9bdb70fc40aa57f73186c1c4f6364 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/arith.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/arith.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/arith.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.2.err.oracle b/src/plugins/wp/tests/wp_acsl/oracle/assign_array.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.2.err.oracle rename to src/plugins/wp/tests/wp_acsl/oracle/assign_array.err.oracle diff --git a/src/plugins/wp/tests/wp_acsl/oracle/assign_array.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/assign_array.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..a8322eb26cc5d90fc5035b87014f2074f881f628 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle/assign_array.res.oracle @@ -0,0 +1,31 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/assign_array.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +------------------------------------------------------------ + Function jobA +------------------------------------------------------------ + +Goal Assigns (file tests/wp_acsl/assign_array.i, line 11) in 'jobA': +Prove: true. + +------------------------------------------------------------ + +Goal Assigns (file tests/wp_acsl/assign_array.i, line 11) in 'jobA': +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function jobG +------------------------------------------------------------ + +Goal Assigns (file tests/wp_acsl/assign_array.i, line 19) in 'jobG': +Prove: true. + +------------------------------------------------------------ + +Goal Assigns (file tests/wp_acsl/assign_array.i, line 19) in 'jobG': +Prove: true. + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/oracle/assigns_path.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/assigns_path.res.oracle index 440ebf48c9d7f3be9a779c00d64837034ba577aa..51cac4e3ac27dbd73fbe657167ef410f735d20d7 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/assigns_path.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/assigns_path.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/assigns_path.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -89,18 +88,12 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_acsl/assigns_path.i, line 9) in 'job' (1/3): +Goal Assigns (file tests/wp_acsl/assigns_path.i, line 9) in 'job' (1/2): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_acsl/assigns_path.i, line 9) in 'job' (2/3): -Effect at line 20 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_acsl/assigns_path.i, line 9) in 'job' (3/3): +Goal Assigns (file tests/wp_acsl/assigns_path.i, line 9) in 'job' (2/2): Effect at line 20 Prove: true. diff --git a/src/plugins/wp/tests/wp_acsl/oracle/assigns_range.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/assigns_range.res.oracle index 196f889a217dfe9376795cf72e8131534a9e4714..fdcc32084b0da3dfddcacc91fb0b5f8f7bbc37d8 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/assigns_range.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/assigns_range.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/assigns_range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/axioms.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/axioms.res.oracle index cb754076a2f04945e3d266667b1d405eae098708..9471fcc68989e69efdb50edecb88f62d34c7076f 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/axioms.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/axioms.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/axioms.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -193,13 +192,7 @@ Prove: included(a_2, 1, a_1, 1 + i - a). ------------------------------------------------------------ -Goal Assigns 'todo' in 'f' (1/2): -Effect at line 34 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'todo' in 'f' (2/2): +Goal Assigns 'todo' in 'f': Effect at line 34 Let a_1 = shift_sint32(t, a). Let x = -a. diff --git a/src/plugins/wp/tests/wp_acsl/oracle/bitwise.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/bitwise.res.oracle index ec185b43c68153a64eaf082f5907a9ea10f8dea7..8ee9b508833d31823aa69da74d7e447f5749e4d2 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/bitwise.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/bitwise.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/bitwise.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,10 +8,7 @@ ------------------------------------------------------------ Goal Post-condition (file tests/wp_acsl/bitwise.i, line 5) in 'band': -Let x = land(a, land(b, c)). -Assume { Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(c) /\ is_sint32(x). -} -Prove: to_sint32(x) = x. +Prove: true. ------------------------------------------------------------ @@ -79,8 +75,7 @@ Prove: land(65535, a) != 21845. ------------------------------------------------------------ Goal Post-condition (file tests/wp_acsl/bitwise.i, line 55) in 'bnot': -Let x = lnot(a). Assume { Type: is_sint32(a) /\ is_sint32(x). } -Prove: to_sint32(x) = x. +Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ @@ -88,10 +83,7 @@ Prove: to_sint32(x) = x. ------------------------------------------------------------ Goal Post-condition (file tests/wp_acsl/bitwise.i, line 28) in 'bor': -Let x = lor(a, lor(b, c)). -Assume { Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(c) /\ is_sint32(x). -} -Prove: to_sint32(x) = x. +Prove: true. ------------------------------------------------------------ @@ -128,9 +120,7 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition (file tests/wp_acsl/bitwise.i, line 42) in 'bxor': -Let x = lxor(a, b). -Assume { Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(x). } -Prove: to_sint32(x) = x. +Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ @@ -193,9 +183,7 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition (file tests/wp_acsl/bitwise.i, line 69) in 'rshift': -Let x = lsr(a, n). -Assume { Type: is_sint32(a) /\ is_sint32(n) /\ is_sint32(x). } -Prove: to_sint32(x) = x. +Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/oracle/block_length.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/block_length.res.oracle index 63f14c4990061449fa3db02c4ac70fca9c750d40..f7addd05cd6f47c05543a0d5d8fac99252cd19b9 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/block_length.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/block_length.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/block_length.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/classify_float.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/classify_float.res.oracle index d8e0beecfb7b26f1e48f8e52eefad05b35c8e8c8..c55b2723c3a06999ca0f3a8f59611823435b0439 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/classify_float.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/classify_float.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/classify_float.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.2.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/ctor.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.2.res.oracle rename to src/plugins/wp/tests/wp_acsl/oracle/ctor.err.oracle diff --git a/src/plugins/wp/tests/wp_acsl/oracle/ctor.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/ctor.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..6a6bd49b1a01dafc18260e0d12b3ddff5141c855 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle/ctor.res.oracle @@ -0,0 +1,18 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/ctor.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +------------------------------------------------------------ + Axiomatic 'Event' +------------------------------------------------------------ + +Lemma cons: +Prove: true + +------------------------------------------------------------ + +Lemma diff: +Assume: 'cons' +Prove: true + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/oracle/div_mod.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/div_mod.res.oracle index e04b64d6063c1cbfdfcee0d1a50f08206f1f1f02..56b2cf2c244f99172815e634ca5e814b5f306474 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/div_mod.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/div_mod.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/div_mod.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/e_imply.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/e_imply.res.oracle index 9eab03d32fd89955944a7cef9bda26efcaf95abf..1ee9478e32f974d733a743fd39abd8351a36844b 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/e_imply.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/e_imply.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/e_imply.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -227,16 +226,13 @@ Prove: (!P_F) \/ (!P_P(2)) \/ P_P(3) \/ (!P_P(4)). ------------------------------------------------------------ Goal Post-condition 'f0' in 'f': -Assume { (* Goal *) When: P_P(1) /\ P_P(2) /\ (P_P(1) \/ P_P(12)). } +Assume { (* Goal *) When: P_P(1) /\ P_P(2). } Prove: P_T. ------------------------------------------------------------ Goal Post-condition 'f1' in 'f': -Assume { - (* Goal *) - When: P_P(1) /\ P_P(2) /\ (P_P(1) \/ P_P(12)) /\ (P_P(2) \/ P_P(11)). -} +Assume { (* Goal *) When: P_P(1) /\ P_P(2). } Prove: P_T. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/oracle/equal.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/equal.res.oracle index 3867e35343d8f732f40b058ce81d2615053a38bd..31ad7376d93cae6135401fe7ec6c0c47269a64b9 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/equal.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/equal.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/equal.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.0.res.oracle index b3919c60a88b31e7b110d24f3c03a63940308435..faaa85f004781c92068bafec48b85041c1c93c1c 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/funvar_inv.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.1.res.oracle index 6988d0ae8b5d1488b3dc7e4d90e994e82a259786..b6efdef150719a9a24805d595b084aa10b994e3d 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/funvar_inv.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/funvar_inv.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,28 +8,31 @@ ------------------------------------------------------------ Goal Post-condition 'P_startof' in 'f': -Let a = shift_A4_sint32(global(G_G_67), 0). +Let a = global(G_G_20). +Let a_1 = shift_sint32(a, 0). Assume { Type: is_sint32(v) /\ is_sint32(Mint_0[shift_sint32(a, 1)]). (* Goal *) - When: Mint_0[shift_sint32(a, 0)] = 0. + When: Mint_0[a_1] = 0. (* Heap *) Have: linked(Malloc_0). + (* Initializer *) + Init: Mint_0[global(L_i_25)] = 0. If v <= 3 Then { - Let a_1 = shift_sint32(a, v). + Let a_2 = shift_sint32(a, v). (* Else *) - Have: Mint_0[a_1] = 0. - Have: a_1 = f. + Have: Mint_0[a_2] = 0. + Have: a_2 = f. } - Else { Have: global(L_i_72) = f. } + Else { Have: global(L_i_25) = f. } } -Prove: a = f. +Prove: a_1 = f. ------------------------------------------------------------ Goal Post-condition 'P_addr' in 'f': -Let a = shift_A4_sint32(global(G_G_67), 0). +Let a = global(G_G_20). Let x = Mint_0[shift_sint32(a, 0)]. Let a_1 = shift_sint32(a, 1). Assume { @@ -39,6 +41,8 @@ Assume { When: (x != 0) /\ (Mint_0[a_1] = 0). (* Heap *) Have: linked(Malloc_0). + (* Initializer *) + Init: Mint_0[global(L_i_25)] = 0. If v <= 3 Then { Let a_2 = shift_sint32(a, v). @@ -46,7 +50,7 @@ Assume { Have: Mint_0[a_2] = 0. Have: a_2 = f. } - Else { Have: global(L_i_72) = f. } + Else { Have: global(L_i_25) = f. } } Prove: a_1 = f. @@ -61,33 +65,36 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'P_startof_shift' in 'f2': -Let a = shift_A4_sint32(global(G_G_67), 0). +Let a = global(G_G_20). +Let a_1 = shift_sint32(a, 0). Assume { Type: is_sint32(v) /\ is_sint32(Mint_0[shift_sint32(a, 1)]). (* Goal *) - When: Mint_0[shift_sint32(a, 0)] = 0. + When: Mint_0[a_1] = 0. (* Heap *) Have: linked(Malloc_0). + (* Initializer *) + Init: Mint_0[global(L_i_30)] = 0. If (4 * v) <= 15 Then { (* Else *) Have: Mint_0[shift_sint32(a, v)] = 0. If 4 <= v - Then { Have: global(L_i_77) = f2_0. } + Then { Have: global(L_i_30) = f2_0. } Else { Have: shift_sint32(a, v) = f2_0. } } Else { If 4 <= v - Then { Have: global(L_i_77) = f2_0. } + Then { Have: global(L_i_30) = f2_0. } Else { Have: shift_sint32(a, v) = f2_0. } } } -Prove: a = f2_0. +Prove: a_1 = f2_0. ------------------------------------------------------------ Goal Post-condition 'P_addr_shift' in 'f2': -Let a = shift_A4_sint32(global(G_G_67), 0). +Let a = global(G_G_20). Let x = Mint_0[shift_sint32(a, 0)]. Let a_1 = shift_sint32(a, 1). Assume { @@ -96,17 +103,19 @@ Assume { When: (x != 0) /\ (Mint_0[a_1] = 0). (* Heap *) Have: linked(Malloc_0). + (* Initializer *) + Init: Mint_0[global(L_i_30)] = 0. If (4 * v) <= 15 Then { (* Else *) Have: Mint_0[shift_sint32(a, v)] = 0. If 4 <= v - Then { Have: global(L_i_77) = f2_0. } + Then { Have: global(L_i_30) = f2_0. } Else { Have: shift_sint32(a, v) = f2_0. } } Else { If 4 <= v - Then { Have: global(L_i_77) = f2_0. } + Then { Have: global(L_i_30) = f2_0. } Else { Have: shift_sint32(a, v) = f2_0. } } } @@ -123,33 +132,36 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'P_addr_startof_shift' in 'g': -Let a = shift_A4_sint32(global(G_G_67), 0). +Let a = global(G_G_20). +Let a_1 = shift_sint32(a, 0). Assume { Type: is_sint32(v) /\ is_sint32(Mint_0[shift_sint32(a, 1)]). (* Goal *) - When: Mint_0[shift_sint32(a, 0)] = 0. + When: Mint_0[a_1] = 0. (* Heap *) Have: linked(Malloc_0). + (* Initializer *) + Init: Mint_0[global(L_i_35)] = 0. If (16 * v) <= 63 Then { (* Else *) Have: Mint_0[shift_sint32(a, v)] = 0. If 4 <= v - Then { Have: global(L_i_82) = g. } + Then { Have: global(L_i_35) = g. } Else { Have: shift_sint32(a, v) = g. } } Else { If 4 <= v - Then { Have: global(L_i_82) = g. } + Then { Have: global(L_i_35) = g. } Else { Have: shift_sint32(a, v) = g. } } } -Prove: a = g. +Prove: a_1 = g. ------------------------------------------------------------ Goal Post-condition 'P_addr_addr_shift' in 'g': -Let a = shift_A4_sint32(global(G_G_67), 0). +Let a = global(G_G_20). Let x = Mint_0[shift_sint32(a, 0)]. Let a_1 = shift_sint32(a, 1). Assume { @@ -158,17 +170,19 @@ Assume { When: (x != 0) /\ (Mint_0[a_1] = 0). (* Heap *) Have: linked(Malloc_0). + (* Initializer *) + Init: Mint_0[global(L_i_35)] = 0. If (16 * v) <= 63 Then { (* Else *) Have: Mint_0[shift_sint32(a, v)] = 0. If 4 <= v - Then { Have: global(L_i_82) = g. } + Then { Have: global(L_i_35) = g. } Else { Have: shift_sint32(a, v) = g. } } Else { If 4 <= v - Then { Have: global(L_i_82) = g. } + Then { Have: global(L_i_35) = g. } Else { Have: shift_sint32(a, v) = g. } } } diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.2.err.oracle b/src/plugins/wp/tests/wp_acsl/oracle/implicit_enum_cast.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.2.err.oracle rename to src/plugins/wp/tests/wp_acsl/oracle/implicit_enum_cast.err.oracle diff --git a/src/plugins/wp/tests/wp_acsl/oracle/implicit_enum_cast.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/implicit_enum_cast.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..c10b1dbe92bab1cf171c6d6ea6521433304fb2a5 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle/implicit_enum_cast.res.oracle @@ -0,0 +1,59 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/implicit_enum_cast.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +------------------------------------------------------------ + Function bar +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_acsl/implicit_enum_cast.i, line 6) in 'bar': +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (1/3): +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (2/3): +Call Result at line 10 +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (3/3): +Effect at line 10 +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (1/5): +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (2/5): +Call Result at line 10 +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (3/5): +Effect at line 10 +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (4/5): +Call Result at line 11 +Prove: true. + +------------------------------------------------------------ + +Goal Assigns nothing in 'bar' (5/5): +Effect at line 11 +Prove: true. + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_label.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/init_label.res.oracle index b129ed9a188f897feb5f3711450f42c1e6a78a25..2df5446856044534cf6b19074bcbe7cf556e48d3 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/init_label.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/init_label.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_label.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/init_value.1.res.oracle deleted file mode 100644 index c12c7061c74584ceaef8a53c93c4a667df652f1c..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_acsl/oracle/init_value.1.res.oracle +++ /dev/null @@ -1 +0,0 @@ -[wp] No proof obligations diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value.2.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/init_value.2.res.oracle deleted file mode 100644 index c12c7061c74584ceaef8a53c93c4a667df652f1c..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_acsl/oracle/init_value.2.res.oracle +++ /dev/null @@ -1 +0,0 @@ -[wp] No proof obligations diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/init_value.res.oracle index cd868ad6f7d33716eb8482719398cd838c9c5e1c..7d914f607b1df90dd1544231b0559bd59b03d798 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/init_value.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/init_value.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_value.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.0.res.oracle index 016fa58aaf690f0490a87a6c939e11456cf7b6f1..39cbb0e4c4e5300b7ce1082af49f5addc68baf81 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_value_mem.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,7 +8,7 @@ ------------------------------------------------------------ Goal Post-condition 'P' in 'main': -Let a = global(G_v_67). +Let a = global(G_v_20). Let a_1 = Load_S1_St(a, Mint_0). Assume { Type: IsS1_St(w) /\ IsS1_St(a_1). @@ -22,14 +21,14 @@ Assume { (* Initializer *) Init: Mint_0[shiftfield_F1_St_b(a)] = 2. (* Heap *) - Have: region(G_v_67) <= 0. + Have: region(G_v_20) <= 0. } Prove: EqS1_St(a_1, w). ------------------------------------------------------------ Goal Post-condition 'Q' in 'main': -Let a = global(G_v_67). +Let a = global(G_v_20). Let a_1 = Load_S1_St(a, Mint_0). Assume { Type: IsS1_St(w) /\ IsS1_St(a_1). @@ -42,7 +41,7 @@ Assume { (* Initializer *) Init: Mint_0[shiftfield_F1_St_b(a)] = 2. (* Heap *) - Have: region(G_v_67) <= 0. + Have: region(G_v_20) <= 0. } Prove: EqS1_St(a_1, w). diff --git a/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.1.res.oracle index 04c47ddff4a0a45da20392f14d7eefb10cbae70f..71c9aa65cd20007a4dce304621da5372f90d52ed 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/init_value_mem.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Hoare' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_value_mem.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/intbool.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/intbool.res.oracle index 3e3e43a7553f4b3652300d271a7eb025d411961e..231196c1b0331896298ac2f9e0fecbce18adc8ec 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/intbool.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/intbool.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/intbool.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/label_escape.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/label_escape.res.oracle index 6d573e292cc9c17cb246a2b0b6e10acd38b6c998..d6ae17762f0dbb5c8c14acd9e5789ad97b58ced1 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/label_escape.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/label_escape.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/label_escape.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/logic.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/logic.res.oracle index 5ec8cc31c2942ff820b1ac147812cef84dff029c..9fffc6e9de65d026b67367a4e88f7172da23c6a9 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/logic.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/logic.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/logic.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/looplabels.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/looplabels.res.oracle index ac3f8638c41fc6af71151fcc2e4d9ee983c1b72f..f736155946b9f46e4c2b0687511ffa337e7f15a6 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/looplabels.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/looplabels.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/looplabels.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -164,13 +163,7 @@ Prove: included(a_3, 1, a_1, n). ------------------------------------------------------------ -Goal Assigns (file tests/wp_acsl/looplabels.i, line 14) in 'copy' (1/2): -Effect at line 22 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_acsl/looplabels.i, line 14) in 'copy' (2/2): +Goal Assigns (file tests/wp_acsl/looplabels.i, line 14) in 'copy': Effect at line 22 Let a_1 = shift_sint32(b, 0). Let a_2 = shift_sint32(a, 0). diff --git a/src/plugins/wp/tests/wp_acsl/oracle/null.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/null.res.oracle index 5a36c6ab4bfdb99377a5e67f2e0ef3eb4de83749..325b20e08549ce51a13c7dc92230081749285059 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/null.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/null.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/null.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/pointer.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/pointer.1.res.oracle deleted file mode 100644 index 84ec81812debd56e5312951bbc9def35e4fc978c..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_acsl/oracle/pointer.1.res.oracle +++ /dev/null @@ -1,3 +0,0 @@ -[wp] Running WP plugin... -[wp] user error: Model 'Runtime' is no more available until next release. -[kernel] Plug-in wp aborted: invalid user input. diff --git a/src/plugins/wp/tests/wp_acsl/oracle/pointer.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/pointer.res.oracle index e25a6d341bbe61228c8c6ad5edaf2b9459bdebf8..e2a367318a2a43519a93e451e8da1a5657e2c985 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/pointer.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/pointer.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/pointer.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -19,9 +18,9 @@ Assume { (* Goal *) When: q.offset < p.offset. (* Heap *) - Have: (region(G_t_68) <= 0) /\ (region(q.base) <= 0). + Have: (region(G_t_21) <= 0) /\ (region(q.base) <= 0). (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } Prove: addr_lt(q, p). @@ -32,9 +31,9 @@ Assume { (* Goal *) When: i_1 <= i. (* Heap *) - Have: (region(G_t_68) <= 0) /\ (region(q.base) <= 0). + Have: (region(G_t_21) <= 0) /\ (region(q.base) <= 0). (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } Prove: (4 * i) <= (4 * i_1). @@ -119,11 +118,11 @@ Assume { (* Goal *) When: 0 < w. (* Heap *) - Have: region(G_t_68) <= 0. + Have: region(G_t_21) <= 0. (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } -Prove: addr_lt(shift_A10_sint32(global(G_t_68), 0), p). +Prove: addr_lt(shift_sint32(global(G_t_21), 0), p). ------------------------------------------------------------ @@ -135,11 +134,11 @@ Assume { (* Goal *) When: 0 <= w. (* Heap *) - Have: region(G_t_68) <= 0. + Have: region(G_t_21) <= 0. (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } -Prove: addr_le(shift_A10_sint32(global(G_t_68), 0), p). +Prove: addr_le(shift_sint32(global(G_t_21), 0), p). ------------------------------------------------------------ @@ -149,11 +148,11 @@ tests/wp_acsl/pointer.i:47: warning from Reference Variable Model: Reason: Uncomparable locations p_0 and mem:t Assume { (* Heap *) - Have: region(G_t_68) <= 0. + Have: region(G_t_21) <= 0. (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } -Prove: shift_A10_sint32(global(G_t_68), 0) = p. +Prove: shift_sint32(global(G_t_21), 0) = p. ------------------------------------------------------------ @@ -165,11 +164,11 @@ Assume { (* Goal *) When: w != 0. (* Heap *) - Have: region(G_t_68) <= 0. + Have: region(G_t_21) <= 0. (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } -Prove: shift_A10_sint32(global(G_t_68), 0) != p. +Prove: shift_sint32(global(G_t_21), 0) != p. ------------------------------------------------------------ @@ -181,11 +180,11 @@ Assume { (* Goal *) When: 0 <= w. (* Heap *) - Have: region(G_t_68) <= 0. + Have: region(G_t_21) <= 0. (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } -Prove: addr_lt(shift_A10_sint32(global(G_t_68), 0), p). +Prove: addr_lt(shift_sint32(global(G_t_21), 0), p). ------------------------------------------------------------ @@ -197,11 +196,11 @@ Assume { (* Goal *) When: 0 < w. (* Heap *) - Have: region(G_t_68) <= 0. + Have: region(G_t_21) <= 0. (* Pre-condition *) - Have: p.base = G_t_68. + Have: p.base = G_t_21. } -Prove: addr_le(p, shift_A10_sint32(global(G_t_68), 0)). +Prove: addr_le(p, shift_sint32(global(G_t_21), 0)). ------------------------------------------------------------ ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/oracle/post_result.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/post_result.res.oracle index 07dd07b57507998921c381abe69b63dbc28afc44..cf7bc42d9a005dfcda1954166da6db12c8441450 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/post_result.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/post_result.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/post_result.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,7 +8,7 @@ ------------------------------------------------------------ Goal Assertion 'OK' (file tests/wp_acsl/post_result.i, line 16): -Let a = shift_A5_sint32(global(G_a_67), 0). +Let a = global(G_a_20). Let a_1 = shift_sint32(a, 3). Let x = Mint_1[a_1]. Let x_1 = Mint_0[a_1]. @@ -26,7 +25,7 @@ Prove: x_1 = x. ------------------------------------------------------------ Goal Assertion 'KO' (file tests/wp_acsl/post_result.i, line 22): -Let a = shift_A5_sint32(global(G_a_67), 0). +Let a = global(G_a_20). Let a_1 = shift_sint32(a, 1). Let x = Mint_1[a_1]. Let x_1 = Mint_0[a_1]. diff --git a/src/plugins/wp/tests/wp_acsl/oracle/precedence.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/precedence.res.oracle index f2c90b74afb6e649b35b7bc87a048dd2e5932c1c..e249362ba8dd71657a00f1cec68d2c5ec6d4b9f8 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/precedence.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/precedence.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/precedence.i (no preprocessing) tests/wp_acsl/precedence.i:90:[kernel] warning: unexpected token ';' tests/wp_acsl/precedence.i:135:[kernel] warning: Inconsistent relation chain. diff --git a/src/plugins/wp/tests/wp_acsl/oracle/range.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/range.res.oracle index b2b2bc76cbf9862a2b732fe904b96588249264a3..b2ea2d866cd1a5255640305276cfcff13ddfb612 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/range.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/range.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/reads.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/reads.res.oracle index bc3c773fe2d187b7203e1f37774139ac676a8a07..a848f6c3db8553e54d3a4055b8785d47954eda3b 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/reads.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/reads.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/reads.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/record.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/record.res.oracle index 9dccd5645bd0ce8f62018c92ec2bd7518c43499e..48b24cf159c29746b13843e4f9c861ddc374a957 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/record.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/record.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/record.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/simpl_is_type.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/simpl_is_type.res.oracle index fda8b18eefe5006b05b93cef5212bca130217ef2..bc5ca6411f5be09fcc80d41da3863f603d1feb0d 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/simpl_is_type.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/simpl_is_type.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/simpl_is_type.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/sizeof.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/sizeof.res.oracle index a2ae156032b383ad3b4a7bdbeb9b009e18c89bda..12fdf2ee146274b927e99cde6ff2b284a13c9e56 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/sizeof.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/sizeof.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/sizeof.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/struct_use_case.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/struct_use_case.res.oracle index a4bb837f3183ba553989cfb25317e3bae4ab85b3..9e96c601038f4c2432d00ca449aae36607ddff8b 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/struct_use_case.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/struct_use_case.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/struct_use_case.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/tset.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/tset.res.oracle index 71424535c4fde2e40e68c0bdb306aa2f436f7d90..4a54033d73a51ef1dded7eded945c9999db60343 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/tset.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/tset.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/tset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/type_guard.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/type_guard.res.oracle index 40fa11e182c48e6a245d4eb96ad40539deb6a802..1d54922283f316e575cdb8ac022045a66666556f 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/type_guard.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/type_guard.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/type_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/unit_bit_test.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/unit_bit_test.res.oracle index d44e57483a58a2b2f0905bb204b0dc2eb8f45a07..c12408c9342b2fcd5e118bef3a6afbf26c48a26c 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/unit_bit_test.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/unit_bit_test.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/unit_bit_test.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/unit_bool.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/unit_bool.res.oracle index 7f9013dbf01744e414c54a023bbfad0e0ece14a8..1cb5211807364ba0a1e40558630a6e0ede78bbd2 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/unit_bool.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/unit_bool.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/unit_bool.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/unit_compare.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/unit_compare.res.oracle index 06b712b01c8a44aeaa76d48041b0d1f8c439eb15..5313dd302c0bcbd752b6d4a4fbb3a6eb6cb85ec9 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/unit_compare.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/unit_compare.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/unit_compare.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle/user_def_type_guard.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/user_def_type_guard.res.oracle index becc8beba9bd5b3d66e3c8031e5067c20d8f2eef..61509e7d3bb217516c9f4e6c6f9f1789aa7eb562 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle/user_def_type_guard.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle/user_def_type_guard.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/user_def_type_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.0.res.oracle index b0e73b49edee72992b6d966158f0e91da12c418b..c595f5da8592ea5650a041aba628834b283ece04 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/arith.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.1.res.oracle index f5bd2f3815c45c10c6b3b0b6873b9d82311db8ab..be321d946870b1dffa546a3478f99d4b1b6dde39 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/arith.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/arith.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.3.err.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assign_array.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.3.err.oracle rename to src/plugins/wp/tests/wp_acsl/oracle_qualif/assign_array.err.oracle diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assign_array.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assign_array.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..6fb6903601291da0c5e0b3b34a80a6a85d90a95c --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assign_array.res.oracle @@ -0,0 +1,17 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/assign_array.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +[wp] 4 goals scheduled +[wp] [Qed] Goal typed_jobA_assign_exit : Valid +[wp] [Qed] Goal typed_jobA_assign_normal : Valid +[wp] [Qed] Goal typed_jobG_assign_exit : Valid +[wp] [Qed] Goal typed_jobG_assign_normal : Valid +[wp] Proved goals: 4 / 4 + Qed: 4 +---------------------------------------------------------- +Functions WP Alt-Ergo Total Success +jobA 2 - 2 100% +jobG 2 - 2 100% +---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_path.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_path.res.oracle index 4db084714a82858a4db112c40d026b2d87f8178d..15eca1b25456b647591f508fd3a3602e3bc8187b 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_path.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_path.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/assigns_path.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 10 goals scheduled +[wp] 9 goals scheduled [wp] [Qed] Goal typed_job_post_N : Valid [wp] [Alt-Ergo] Goal typed_job_post_A : Valid [wp] [Alt-Ergo] Goal typed_job_loop_inv_preserved : Valid @@ -14,11 +13,10 @@ [wp] [Qed] Goal typed_job_loop_assign : Valid [wp] [Qed] Goal typed_job_assign_part1 : Valid [wp] [Qed] Goal typed_job_assign_part2 : Valid -[wp] [Qed] Goal typed_job_assign_part3 : Valid -[wp] Proved goals: 10 / 10 - Qed: 7 +[wp] Proved goals: 9 / 9 + Qed: 6 Alt-Ergo: 3 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -job 7 3 (20) 10 100% +job 6 3 (20) 9 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.0.res.oracle index 00d65d79ee919cfdbd5a38a6ac8e47c518b80764..3e0a05de6f856aad1245b510e6d1e4071be8abb2 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/assigns_range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.1.res.oracle index 0d543df20df2103821dd09088b542dc6debc794e..396c4db4a76075083e34ce0746bf1af6531ddab5 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/assigns_range.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/assigns_range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/axioms.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/axioms.res.oracle index 3ada8488db77c2083142eaf292dc26d4c1b63cac..e7882d833ff32e1421d4404022b8cd6c8a21c9a5 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/axioms.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/axioms.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/axioms.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 11 goals scheduled +[wp] 10 goals scheduled [wp] [Alt-Ergo] Goal typed_f_post_P_todo : Unknown [wp] [Alt-Ergo] Goal typed_f_post_Q : Valid [wp] [Alt-Ergo] Goal typed_f_loop_inv_Index_preserved : Valid @@ -14,12 +13,11 @@ [wp] [Qed] Goal typed_f_loop_assign_part1 : Valid [wp] [Alt-Ergo] Goal typed_f_loop_assign_part2 : Valid [wp] [Alt-Ergo] Goal typed_f_loop_assign_part3 : Valid -[wp] [Qed] Goal typed_f_assign_part1 : Valid -[wp] [Alt-Ergo] Goal typed_f_assign_part2 : Unknown -[wp] Proved goals: 9 / 11 - Qed: 3 +[wp] [Alt-Ergo] Goal typed_f_assign : Unknown +[wp] Proved goals: 8 / 10 + Qed: 2 Alt-Ergo: 6 (unknown: 2) ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -f 3 6 (98) 11 81.8% +f 2 6 (98) 10 80.0% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/bitwise.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/bitwise.res.oracle index c321a9c081a269ddc86dea159bf33c077cf0a5f7..53adf24c728efb7e0daed6c1ab915e9061a909d5 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/bitwise.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/bitwise.res.oracle @@ -1,11 +1,10 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/bitwise.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] 23 goals scheduled -[wp] [Alt-Ergo] Goal typed_band_post : Valid +[wp] [Qed] Goal typed_band_post : Valid [wp] [Qed] Goal typed_band_post_band0 : Valid [wp] [Qed] Goal typed_band_bit0_post_band1 : Valid [wp] [Qed] Goal typed_band_bit0_post_band2 : Valid @@ -13,30 +12,29 @@ [wp] [Qed] Goal typed_band_bit2_post_band4 : Valid [wp] [Qed] Goal typed_band_bit3_post_band5 : Valid [wp] [Qed] Goal typed_band_bit4_post_band6 : Valid -[wp] [Alt-Ergo] Goal typed_bnot_post : Valid -[wp] [Alt-Ergo] Goal typed_bor_post : Valid +[wp] [Qed] Goal typed_bnot_post : Valid +[wp] [Qed] Goal typed_bor_post : Valid [wp] [Qed] Goal typed_bor_post_bor0 : Valid [wp] [Qed] Goal typed_bor_bit1_post_bor1 : Valid [wp] [Qed] Goal typed_bor_bit2_post_bor2 : Valid [wp] [Qed] Goal typed_bor_bit3_post_bor3 : Valid -[wp] [Alt-Ergo] Goal typed_bxor_post : Valid +[wp] [Qed] Goal typed_bxor_post : Valid [wp] [Qed] Goal typed_bxor_bit1_post : Valid [wp] [Qed] Goal typed_bxor_bit2_post : Valid [wp] [Qed] Goal typed_lshift_post : Valid [wp] [Qed] Goal typed_lshift_shift1_post_lsl1 : Valid [wp] [Qed] Goal typed_lshift_shift1_post_lsl2 : Valid [wp] [Qed] Goal typed_lshift_shift2_post_lsl3 : Valid -[wp] [Alt-Ergo] Goal typed_rshift_post : Valid +[wp] [Qed] Goal typed_rshift_post : Valid [wp] [Qed] Goal typed_rshift_shift1_post_lsr1 : Valid [wp] Proved goals: 23 / 23 - Qed: 18 - Alt-Ergo: 5 + Qed: 23 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -band 7 1 (32) 8 100% -bor 4 1 (32) 5 100% -bxor 2 1 (13) 3 100% -bnot - 1 (12) 1 100% +band 8 - 8 100% +bor 5 - 5 100% +bxor 3 - 3 100% +bnot 1 - 1 100% lshift 4 - 4 100% -rshift 1 1 (28) 2 100% +rshift 2 - 2 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/block_length.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/block_length.res.oracle index 622635c8a6d3dc61d6c59e20f5a3daff67cdc547..72e3d29f6f4a8f552b99e40de67cbc681e29859f 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/block_length.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/block_length.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/block_length.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.0.res.oracle index 562ba1b774f94cfdfbcce92c98439330c3f036d9..dab3aa84a1f3312420b8d5b92d92b888fa84f3a1 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/classify_float.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.1.res.oracle index eb95b37173c27b83e64c4ef0ababee622e89291b..09f8a06a851d0efed2d17cea28aa797be340755f 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/classify_float.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.2.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.2.res.oracle index 04d63b8b4db52431e5c00ca98393cbfd2fc1fb86..f27a49649cf8ef68dcf3886685e0086da576b504 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.2.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/classify_float.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/classify_float.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/cnf.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/cnf.res.oracle index 8f41b87a7503c0614449335b713c62acd2dfe77b..8f722179ca0af799e20009173e5f9ffbf7874224 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/cnf.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/cnf.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/cnf.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.4.err.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/ctor.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.4.err.oracle rename to src/plugins/wp/tests/wp_acsl/oracle_qualif/ctor.err.oracle diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/ctor.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/ctor.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..9bdbab83ce97f8d0987590ded0ac30e56fafd68e --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/ctor.res.oracle @@ -0,0 +1,13 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/ctor.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] 2 goals scheduled +[wp] [Qed] Goal typed_lemma_cons : Valid +[wp] [Qed] Goal typed_lemma_diff : Valid +[wp] Proved goals: 2 / 2 + Qed: 2 +---------------------------------------------------------- +Axiomatics WP Alt-Ergo Total Success +Axiomatic Event 2 - 2 100% +---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.0.res.oracle index f58a35fd994d6bb57281c6dd43103756f19aaae0..7e154a0545bef3c91de77b7605f8092776e559b0 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/div_mod.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.1.res.oracle index 505b85e3480684e754dee39c925775328f817959..8eec9469e8f071e383333be508546bca36f40a19 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/div_mod.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.2.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.2.res.oracle index 65ceb27ebb66ccd6dad206cc7cc7ba5f53f9af6d..baf120ac75b0290e8038720107b5e687d3b2d5b1 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.2.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/div_mod.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/div_mod.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/e_imply.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/e_imply.res.oracle index ad6bdb18859a9c17bba2f807e128510b936fad8e..4fba69d6ebc6c45c0aee3072d84835603f91339e 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/e_imply.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/e_imply.res.oracle @@ -1,11 +1,10 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/e_imply.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] Computing [100 goals...] -[wp] 121 goals scheduled +[wp] 119 goals scheduled [wp] [Alt-Ergo] Goal typed_f_post_p0 : Valid [wp] [Alt-Ergo] Goal typed_f_post_p1 : Valid [wp] [Alt-Ergo] Goal typed_f_post_p2 : Valid @@ -48,12 +47,12 @@ [wp] [Alt-Ergo] Goal typed_f_post_o9 : Valid [wp] [Alt-Ergo] Goal typed_f_post_f0 : Valid [wp] [Alt-Ergo] Goal typed_f_post_f1 : Valid -[wp] Proved goals: 121 / 121 +[wp] Proved goals: 119 / 119 Qed: 8 - Alt-Ergo: 113 + Alt-Ergo: 111 ---------------------------------------------------------- Axiomatics WP Alt-Ergo Total Success -Lemma - 79 (13) 79 100% +Lemma - 77 (13) 77 100% ---------------------------------------------------------- Functions WP Alt-Ergo Total Success f 8 34 (8) 42 100% diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/equal.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/equal.res.oracle index 01bb4660df767612c9babcadc0b5644a91b44709..59f5bd84a38270d70c31ea47e55c81401e8cb187 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/equal.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/equal.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/equal.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/funvar_inv.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/funvar_inv.res.oracle index bd78df165d60e7596fb6c49079e9d5aa36879f13..a0460909082cd7cff271d9abecf1370adc20d2d8 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/funvar_inv.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/funvar_inv.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/funvar_inv.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.5.err.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/implicit_enum_cast.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.5.err.oracle rename to src/plugins/wp/tests/wp_acsl/oracle_qualif/implicit_enum_cast.err.oracle diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/implicit_enum_cast.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/implicit_enum_cast.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..c9d16449da7d47e80bf6c0344e0c2b59bc08213b --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/implicit_enum_cast.res.oracle @@ -0,0 +1,21 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/implicit_enum_cast.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +[wp] 9 goals scheduled +[wp] [Qed] Goal typed_bar_post : Valid +[wp] [Qed] Goal typed_bar_assign_exit_part1 : Valid +[wp] [Qed] Goal typed_bar_assign_exit_part2 : Valid +[wp] [Qed] Goal typed_bar_assign_exit_part3 : Valid +[wp] [Qed] Goal typed_bar_assign_normal_part1 : Valid +[wp] [Qed] Goal typed_bar_assign_normal_part2 : Valid +[wp] [Qed] Goal typed_bar_assign_normal_part3 : Valid +[wp] [Qed] Goal typed_bar_assign_normal_part4 : Valid +[wp] [Qed] Goal typed_bar_assign_normal_part5 : Valid +[wp] Proved goals: 9 / 9 + Qed: 9 +---------------------------------------------------------- +Functions WP Alt-Ergo Total Success +bar 9 - 9 100% +---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_label.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_label.res.oracle index 2e059dea21ac86b17d0d33ad020189f29f38da89..486946c4cfc15b16b639f876fd4a7401a1df93b0 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_label.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_label.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_label.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.0.res.oracle index b326cb61fb140a1c71b86216d531337eefde5977..dc9a1c99823563846b04e8e10227f5b7588b535f 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_value.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.1.res.oracle index ebf41b84afe858f6ed7dcc8976b3b6a8c63b4688..1e87d47c334785eb40515fd455711afafdb27971 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_value.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.res.oracle index ad937d55d863eafc6cd9e866112d0ad151800427..ecfc24487a710d7697658257c08901c222e9b24a 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/init_value_mem.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/init_value_mem.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/intbool.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/intbool.res.oracle index aa09a259da4e27fcc8243fbdb7364fa7c03b373e..9efca25f6e6a6e5256f577c2d59b77b962918ceb 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/intbool.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/intbool.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/intbool.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.0.res.oracle index adf27b64a77894600c25662cba34ff8f6d077030..de50180581353d1825f3fddd1f535c48c9a1030f 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/label_escape.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.1.res.oracle index f2461279611bc7e41ab189d2089dae9d658f6856..8cb0f83df61e227d867fa52735120b83528fc3b1 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/label_escape.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/label_escape.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/logic.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/logic.res.oracle index 5282d5e33a096f758a31341bb4a325139e19dba8..67c412fb23624ef0e3654909429a5ede3918165d 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/logic.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/logic.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/logic.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/looplabels.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/looplabels.res.oracle index 1b22eb8b0d14c721077fd272d52dc520ccfc11a3..8cd87da8717896b468d69f8483d68b26e89d23e8 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/looplabels.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/looplabels.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/looplabels.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 10 goals scheduled +[wp] 9 goals scheduled [wp] [Qed] Goal typed_copy_post : Valid [wp] [Alt-Ergo] Goal typed_copy_loop_inv_preserved : Valid [wp] [Qed] Goal typed_copy_loop_inv_established : Valid @@ -13,12 +12,11 @@ [wp] [Qed] Goal typed_copy_loop_assign_part1 : Valid [wp] [Alt-Ergo] Goal typed_copy_loop_assign_part2 : Valid [wp] [Alt-Ergo] Goal typed_copy_loop_assign_part3 : Valid -[wp] [Qed] Goal typed_copy_assign_part1 : Valid -[wp] [Alt-Ergo] Goal typed_copy_assign_part2 : Valid -[wp] Proved goals: 10 / 10 - Qed: 4 +[wp] [Alt-Ergo] Goal typed_copy_assign : Valid +[wp] Proved goals: 9 / 9 + Qed: 3 Alt-Ergo: 6 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -copy 4 6 (735) 10 100% +copy 3 6 (735) 9 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/null.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/null.res.oracle index 156148d991f5ed1d1fda193e9474b70041cdfd77..985ebd6874f9d734d372fd3d86c47b168825bc59 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/null.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/null.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/null.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.0.res.oracle index f841d10629fc60bfba25c4387a92e902b786bbf2..b8bc61e9d6a49632f4715e760a1fcb4780d9860b 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/pointer.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.1.res.oracle index 762bb960f875986f95c05cf73a669b86a5c27842..33143bfd47e8bf68b915fa42677f24052a9d6399 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/pointer.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.2.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.2.res.oracle deleted file mode 100644 index 84ec81812debd56e5312951bbc9def35e4fc978c..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.2.res.oracle +++ /dev/null @@ -1,3 +0,0 @@ -[wp] Running WP plugin... -[wp] user error: Model 'Runtime' is no more available until next release. -[kernel] Plug-in wp aborted: invalid user input. diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.3.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.3.res.oracle deleted file mode 100644 index a48a626db3a11bde069c0fa653cd470de07e1faf..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/pointer.3.res.oracle +++ /dev/null @@ -1,11 +0,0 @@ -# frama-c -wp [...] -[wp] Running WP plugin... -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -[wp] 6 goals scheduled -[wp] [Alt-Ergo] Goal store_absurd_post_qed_ko_Base_oracle_ko : Unknown -[wp] [Alt-Ergo] Goal store_absurd_post_qed_ko_Comp_oracle_ko : Unknown -[wp] [Alt-Ergo] Goal store_mixed_array_pointer_post_qed_ko_Le_oracle_ko : Timeout -[wp] [Alt-Ergo] Goal store_mixed_array_pointer_post_qed_ko_Lt_oracle_ko : Unknown -[wp] [Alt-Ergo] Goal store_pointer_post_qed_ko_Le_oracle_ko : Unknown -[wp] [Alt-Ergo] Goal store_pointer_post_qed_ko_Eq_oracle_ko : Timeout diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/post_result.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/post_result.res.oracle index fdb5c3d4ffeba3d904925a62a9c15c918a2ae900..7fc173eefb967bdf591b77f3d2c99c93c7757b63 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/post_result.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/post_result.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/post_result.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -12,6 +11,6 @@ Alt-Ergo: 1 (unknown: 1) ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -correct - 1 (33) 1 100% +correct - 1 (32) 1 100% wrong - - 1 0.0% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.0.res.oracle index 3f6cc622a5dd243fb159632ce5b66cc751f4bbdf..af48d1b4b1401971fb57f9b9cc2580e82298cea0 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/precedence.i (no preprocessing) tests/wp_acsl/precedence.i:90:[kernel] warning: unexpected token ';' tests/wp_acsl/precedence.i:135:[kernel] warning: Inconsistent relation chain. diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.1.res.oracle index 365d0d448b4fb666b4fc4f68c63fd4cabe9ead52..de67e3c51c02840014929e91abb0cd13fc373dd7 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/precedence.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/precedence.i (no preprocessing) tests/wp_acsl/precedence.i:90:[kernel] warning: unexpected token ';' tests/wp_acsl/precedence.i:135:[kernel] warning: Inconsistent relation chain. diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/range.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/range.res.oracle index 3f14a76a7f029987e6b2be8e095ccc5a11c09043..c3079e61aee7d646dbff66dd51af1606bd25a12d 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/range.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/range.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.0.res.oracle index 89de2cc233560f9385c3f372a3979fbbf0dd0661..13202342fcf602660e8e677dbc5f8df23b88462d 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/reads.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.1.res.oracle index cb6e1a84ebcafd6088e4e66b22b0b45ed2a95174..ab4122c18880a94c1dc7f0b8009b54322459f9ff 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/reads.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/reads.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.0.res.oracle index 36f472d2b6bce8a6a2ad68333eabe38a9f9b1b80..f2a0f07e3830bc7032489b4a19c18bb56496b842 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/record.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.1.res.oracle index 7d4efbd62ad450dc504a3ef53ed564a61683fd8e..d76f8d409edacac6e1daa69e1237e9293c27a107 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/record.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/record.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/simpl_is_type.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/simpl_is_type.res.oracle index 5a7f4cb4bdc74e4244592b3d230a7eac9eeaa6af..7e01e369fef324851b7eb074fb2ec4d62b2293d1 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/simpl_is_type.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/simpl_is_type.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/simpl_is_type.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/sizeof.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/sizeof.res.oracle index feb1febd5622d9545599047586257d9db26a23b8..c3d5724fca2272fa900e7958cb1f56963a2edf27 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/sizeof.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/sizeof.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/sizeof.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.0.res.oracle index 35fef81a1655c949ed96da9837bb21c945b00b4c..7e2be3bc28fd93d878ae1274acb72f849b0b1d90 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/struct_use_case.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.1.res.oracle index 42a4ccb761fda3bde15096494e15231b08048f04..33da7f48b37da2b94e834721188c05d5cd6b5671 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/struct_use_case.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/struct_use_case.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/tset.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/tset.res.oracle index ad66460881e11967dc8a1185da6023b04b2e3867..664e8c232483af6660f4616650be0370d26f8ec2 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/tset.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/tset.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/tset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.0.res.oracle index 59e5e1ab8f6b732d9a575619fbcf96a02c912ac8..fdb199cb56afde14c66b3f9a7e7bc548867ca2cd 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/type_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.1.res.oracle index 53edb03d3574030df6f35613818ae9f420fbe273..0f3de53d6930deb7d3a7b3a6b4a993edfbbdaaec 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/type_guard.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/type_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bit_test.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bit_test.res.oracle index 638c0254c3c01f5130f5a04211ff6d88f300881b..876d9372da803aa49e4b4d022c7073a547cf4a7a 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bit_test.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bit_test.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/unit_bit_test.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bool.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bool.res.oracle index 4776cccb05d3e0d7ed22fe9bc85820b3a6ba9bb4..0cad579e3b4ec4e35bcaa9dbfdf3ab9f28ac0872 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bool.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/unit_bool.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/unit_bool.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.0.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.0.res.oracle index 5976e0aa7311ea1043c1e7323d16197a63597c04..5cb7f8edcca6a9774081a37d0d4053e17753daac 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.0.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/user_def_type_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.1.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.1.res.oracle index ca7f850d8e754970403ee36a4d1241f88d6f71a8..5d21f177f30f55b191206cd17f1032f8b4a62b61 100644 --- a/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.1.res.oracle +++ b/src/plugins/wp/tests/wp_acsl/oracle_qualif/user_def_type_guard.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_acsl/user_def_type_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/bts_1020.i b/src/plugins/wp/tests/wp_bts/bts_1020.i deleted file mode 100644 index 3656f63197e3130f7b78c70013e6d565cdd30aed..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_bts/bts_1020.i +++ /dev/null @@ -1,53 +0,0 @@ -/* run.config - OPT: -wp-invariants -*/ - -/* run.config_qualif - DONTRUN: (config_qualif) useless -*/ - -//@ predicate I(integer x) ; -//@ predicate A(integer x) ; -//@ predicate R(integer x) ; -//@ predicate E(integer x, integer y) ; - -int i; -/*@ requires R:R(i) ; - @ assigns Loc:i; - @ ensures E:E(i,\old(i)); -*/ -void g(void); - -void f1 (void) { - //@ loop assigns loc:i; - while (i < 10){ - //@ invariant I:I(i); - g() ; - } -} -void f2 (void) { - //@ loop assigns loc:i; - while (i < 10){ - g() ; - //@ invariant T:I(i); - } -} - - -void f3 (void) { - //@ loop assigns loc:i; - while (i < 10) { - //@ invariant I:I(i); - //@ assert A:A(i); - i = i+1 ; - } -} - -void f4 (void) { - //@ loop assigns loc:i; - while (i < 10) { - //@ assert A:A(i); - i = i+1 ; - //@ invariant I:I(i); - } -} diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts0708.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts0708.res.oracle index b71644ddb9e99da9a8c168d2b51ddfba9735f74b..e4834908afee145a5f97c07cf061eed48ee2b364 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts0708.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts0708.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts0708.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts0843.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts0843.res.oracle index cdd43ed6adb6b9037c88751cfca47e8de17b39a2..247ba5a62c09d34eee35588cefc04d2572550ee4 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts0843.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts0843.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts0843.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -19,7 +18,7 @@ Prove: true. Goal Assigns (file tests/wp_bts/bts0843.i, line 14) in 'g3': Call Effect at line 16 -Let a = Mptr_0[shift_PTR(global(G_p_67), 0)]. +Let a = Mptr_0[global(G_p_20)]. Let a_1 = shiftfield_F1_a(a). Assume { (* Goal *) @@ -35,7 +34,7 @@ Prove: a_1 = shiftfield_F1_a(Mptr_0[L_p_ref]). Goal Assigns (file tests/wp_bts/bts0843.i, line 14) in 'g3': Call Effect at line 16 -Let a = Mptr_0[shift_PTR(global(G_p_67), 0)]. +Let a = Mptr_0[global(G_p_20)]. Let a_1 = shiftfield_F1_a(a). Assume { (* Goal *) diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts779.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts779.res.oracle index e32cb66d5c04e901097224c3bfb0c5b8082346f4..31d7a64f2a14115989dbda94beda514e014467d8 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts779.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts779.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts779.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts788.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts788.res.oracle index ab3d92d9f27336920928f4160793e801c8c87102..28b4979b505b97388256af4ef112094adcbe1bea 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts788.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts788.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts788.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts986.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts986.res.oracle index cf1882c34bb54c798267e1ed181fdc723df8091d..e5e305d626fe5c97d9637ef64294c964f7b8b793 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts986.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts986.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts986.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -10,6 +9,6 @@ Goal Assertion 'A' (file tests/wp_bts/bts986.i, line 12): Assume { (* Heap *) Have: linked(Malloc_0). } -Prove: !valid_rw(Malloc_0[L_x_70 <- 0], global(L_x_70), 1). +Prove: !valid_rw(Malloc_0[L_x_23 <- 0], global(L_x_23), 1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_0896.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_0896.res.oracle index c74c5489673e44bba52ac67f2ffe4963116e1f94..f4a8a86bb98546017c4cd1e43d667cacda76fd55 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_0896.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_0896.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_0896.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1020.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1020.res.oracle deleted file mode 100644 index 0c1e2c5d8c6169c8a9337cf12f4335dea9d01b21..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1020.res.oracle +++ /dev/null @@ -1,108 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_bts/bts_1020.i (no preprocessing) -tests/wp_bts/bts_1020.i:9:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. -tests/wp_bts/bts_1020.i:10:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. -tests/wp_bts/bts_1020.i:11:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. -tests/wp_bts/bts_1020.i:12:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function f1 ------------------------------------------------------------- - -Goal Invariant 'I' (file tests/wp_bts/bts_1020.i, line 24): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns 'loc': -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition 'R' in 'g'' in 'f1' at call 'g' (file tests/wp_bts/bts_1020.i, line 25) -: -Assume { - Type: is_sint32(i). - (* Then *) - Have: i <= 9. - (* Invariant 'I' *) - Have: P_I(i). -} -Prove: P_R(i). - ------------------------------------------------------------- ------------------------------------------------------------- - Function f2 ------------------------------------------------------------- - -Goal Invariant 'T' (file tests/wp_bts/bts_1020.i, line 32): -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns 'loc': -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition 'R' in 'g'' in 'f2' at call 'g' (file tests/wp_bts/bts_1020.i, line 31) -: -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function f3 ------------------------------------------------------------- - -Goal Invariant 'I' (file tests/wp_bts/bts_1020.i, line 40): -Assume { Type: is_sint32(i). (* Then *) Have: i <= 9. } -Prove: P_I(i). - ------------------------------------------------------------- - -Goal Assertion 'A' (file tests/wp_bts/bts_1020.i, line 41): -Assume { - Type: is_sint32(i). - (* Then *) - Have: i <= 9. - (* Invariant 'I' *) - Have: P_I(i). -} -Prove: P_A(i). - ------------------------------------------------------------- - -Goal Loop assigns 'loc': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function f4 ------------------------------------------------------------- - -Goal Assertion 'A' (file tests/wp_bts/bts_1020.i, line 49): -Assume { Type: is_sint32(i). (* Then *) Have: i <= 9. } -Prove: P_A(i). - ------------------------------------------------------------- - -Goal Invariant 'I' (file tests/wp_bts/bts_1020.i, line 51): -Let x = 1 + i. -Assume { - Type: is_sint32(i) /\ is_sint32(x). - (* Then *) - Have: i <= 9. - (* Assertion 'A' *) - Have: P_A(i). -} -Prove: P_I(x). - ------------------------------------------------------------- - -Goal Loop assigns 'loc': -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1174.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1174.res.oracle index d933821fc9abf687dbadd33073c3f7e5320eab1a..7f7527f2436a3c15e6d23d78516a7debd46be0a7 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1174.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1174.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1174.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1176.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1176.res.oracle index e507e02db93072a592d7684157476cc7a80b03fe..5093eaf178356042ae4fe38609e98a9456b4b033 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1176.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1176.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1176.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1360.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1360.res.oracle index 8ecef5b7eb7043d2fd43364e9f138598c10be86d..634fe24a5292ab1672f88bb8ef3e007339ddbd7b 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1360.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1360.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1360.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -37,13 +36,7 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_bts/bts_1360.i, line 25) in 'foo_correct' (1/2): -Effect at line 29 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_bts/bts_1360.i, line 25) in 'foo_correct' (2/2): +Goal Assigns (file tests/wp_bts/bts_1360.i, line 25) in 'foo_correct': Effect at line 30 Prove: true. @@ -80,13 +73,7 @@ Prove: valid_rw(Malloc_0, a, 1). ------------------------------------------------------------ -Goal Assigns (file tests/wp_bts/bts_1360.i, line 14) in 'foo_wrong' (1/2): -Effect at line 18 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_bts/bts_1360.i, line 14) in 'foo_wrong' (2/2): +Goal Assigns (file tests/wp_bts/bts_1360.i, line 14) in 'foo_wrong': Effect at line 19 Prove: true. diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1382.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1382.res.oracle index e77736e7ace8191e100fec9c62098bac23fedab4..006192b829e9f0ef170ae08f6e58ca5d68d1fba1 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1382.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1382.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1382.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -41,7 +40,7 @@ Assume { (* Call Effects *) Have: havoc(Mchar_0, Mchar_1, shift_sint8(w_1, 0), 4). } -Prove: global(G_dest_87) = w. +Prove: global(G_dest_43) = w. ------------------------------------------------------------ @@ -68,6 +67,6 @@ Assume { (* Call Effects *) Have: havoc(Mchar_0, Mchar_1, a, 4). } -Prove: included(a, 4, global(G_dest_87), 1). +Prove: included(a, 4, global(G_dest_43), 1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1462.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1462.res.oracle index 6e50719315e63c46adb7ca60c2e443a4428ad584..560d86fe4bfbc474a5679997917ac051dc86c131 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1462.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1462.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1462.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1586.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1586.res.oracle index 55a6f44cf5a44be9c52faa0945762cfe7106a561..d7de6e54cfc55f942e11d2a89c9df507a313e400 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1586.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1586.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1586.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1588.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1588.res.oracle index f805f49cfe7d30e35450765eefd5f7abc33bf4fe..ff18efe48d46418cf138dd4b14da92dd36c7c4b7 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1588.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1588.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1588.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1601.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1601.res.oracle index 2fae5f982ee835e2696c43333a218a26ddbfc16b..c4f1a6ad3e5a3588f4d3f3bec3bb1f7cda165b43 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1601.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1601.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1601.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1647.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1647.res.oracle index 669ca0e8d71df46f8cafe8a323342b352b265e7c..aa8ee1492f3ea09e279cfe435acce781a3eba06f 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1647.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1647.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1647.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1776.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1776.res.oracle index ebdc450fa0aa5c856cec3c23abf426698128f06a..44967aac0cf5aa6320d3d464e34fc5a0219cb0c8 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1776.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1776.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1776.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1828.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_1828.res.oracle index d39eecdd2d1d4d3037bf86ee4f3c0dae752d62db..2a8aabe0d14ec2eb76dcfec26baffe826f4cebdb 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_1828.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_1828.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1828.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -15,7 +14,7 @@ Assume { (* Pre-condition *) Have: valid_rw(Malloc_0, one_0, 1). } -Prove: global(L_two_71) != one_0. +Prove: global(L_two_24) != one_0. ------------------------------------------------------------ ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_2040.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_2040.res.oracle index 33095c6b80a02b7412e57a466e0c162ba555c38a..ff34305d64b8b0031d82be41b3bd1fe9eadcd574 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_2040.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_2040.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2040.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_2079.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_2079.res.oracle index 6a4a90d752133ba57e31cd6db6c634874964fb42..2ccb83d325aad1111e32224331413cd229e3f9aa 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_2079.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_2079.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2079.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_2110.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_2110.res.oracle index 016682fb64f63da2b6dd1ea555eab82ef64d5dca..af6a5dff01de4100931295f459c91c6102424f39 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_2110.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_2110.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2110.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_2159.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_2159.res.oracle index 8c331d864e73057c8140bb36600427622b96efbe..0fed11448c5ef67ecee278be5dd79b9840cebefa 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_2159.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_2159.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2159.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -12,13 +11,9 @@ Goal Post-condition (file tests/wp_bts/bts_2159.i, line 5) in 'job': Assume { Type: is_sint32(s) /\ is_sint32(s_1) /\ is_sint32(x). If 0 <= x - Then { - If x <= 100 - Then { Let x_1 = s + x. Have: x_1 = s_1. Have: x_1 = s_1. } - Else { Have: s_1 = s. } - } + Then { If x <= 100 Then { Have: (s + x) = s_1. } Else { Have: s_1 = s. } } Else { Have: s_1 = s. } } -Prove: (if ((0 <= x) & (x <= 100)) then L_Id(x_1) else L_Id(s)) = s_1. +Prove: (if ((0 <= x) & (x <= 100)) then L_Id(s + x) else L_Id(s)) = s_1. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_2201.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_2201.res.oracle index 0c2e8a6743eb35cc80bd762001fe29201d9fb4b0..a85f6db83058b5db65c25cca702c65e5424dd45c 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_2201.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_2201.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2201.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -8,19 +7,7 @@ Function main ------------------------------------------------------------ -Goal Assigns nothing in 'main' (1/3): -Effect at line 6 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'main' (2/3): -Effect at line 7 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'main' (3/3): +Goal Assigns nothing in 'main': Effect at line 8 Prove: true. diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_2246.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/bts_2246.res.oracle index e942c65cf7af5e3d523d7a22996230f28e8f4acb..225bed60cc2f81b7f5a00a89e05af329fba0ec66 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/bts_2246.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/bts_2246.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2246.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/ergo_typecheck.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/ergo_typecheck.res.oracle index 9dbe28b7f0c931e3a7a702709665c18bf0cb28af..eef214adadbaa41a176cd2e9f24da77b5d6bd3ab 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/ergo_typecheck.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/ergo_typecheck.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/ergo_typecheck.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/ex5.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/ex5.res.oracle index 70fda7d4e056822b51098a97de94f964faa4ca3b..dc99f50b33ec1fbea798024c8c87c4806e644824 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/ex5.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/ex5.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/ex5.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/issue_141.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/issue_141.res.oracle index d5eb13e414e123e04d57b6c74407f8728c31f449..1f9fedd7d015746b8e356c498119837b076bb5a0 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/issue_141.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/issue_141.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_141.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/issue_198.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/issue_198.res.oracle index bcf632b7cfe46f54f35074975f29c1226eb4efbd..3995ac6f0b637b0ab3ea9a463f2ed9f6e838ff9e 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/issue_198.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/issue_198.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_198.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle/nupw-bcl-bts1120.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/nupw-bcl-bts1120.res.oracle index 619acc8975ae716bddd0582802038d46378b9737..3fbb0b7d0ee2b4dacab06f14681e2671cb4d6fc3 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/nupw-bcl-bts1120.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/nupw-bcl-bts1120.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/nupw-bcl-bts1120.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -73,7 +72,7 @@ Prove: true. ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'ok' in 'f_with_precond'' in 'unreachable_smt_with_contract' at call 'f_with_precond' (file tests/wp_bts/nupw-bcl-bts1120.i, line 40) +Goal Instance of 'Pre-condition 'ok' in 'f_with_precond'' in 'unreachable_smt_with_contract' at initialization of 'tmp' (file tests/wp_bts/nupw-bcl-bts1120.i, line 40) : Prove: true. diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0708.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0708.res.oracle index 9b2725feb16333ee3321415d741b5d0af0b5ec3e..a037bb9dfeb6abd064f88458ff5e96659598078b 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0708.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0708.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts0708.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0843.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0843.res.oracle index 88d8d5377ae914a2e745d321ef394e6e225f278d..c96e537e9ca6eec1ff3f5cdd32aae3dc37c55f42 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0843.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts0843.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts0843.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts779.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts779.res.oracle index 6fba7e71e12a85b28e383526d86bec3138bc71a3..c220c9506bb74d480dbea87e70e81ffec8660ef9 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts779.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts779.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts779.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts788.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts788.res.oracle index 55812fa896a9078f865577a3ca718704203a4dae..864df0dc95abdf5f97d7f06fc5568be899455e6b 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts788.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts788.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts788.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts986.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts986.res.oracle index 3564b8ecaa50285e8c66fa5c851823441c5012c6..da6ac11fceeb0e32107a1f1755048823627b46fa 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts986.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts986.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts986.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1174.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1174.res.oracle index f2bedfc20e31c21c9b29350cc02f005a3c30acaf..ff726ce05aa976890515997c52dc1d7d9d7d4f93 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1174.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1174.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1174.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1176.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1176.res.oracle index d90cfac4d9ccc1d65bdea7eb43685ac26f164c7d..e117c714f82f1a84fd80b4d40e95e5cc0048b47c 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1176.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1176.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1176.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1360.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1360.res.oracle index b4de531864f79e58ef9e589a8555508fdbf51327..ecf055554bb3b51a869ba33c9cac907f91def623 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1360.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1360.res.oracle @@ -1,28 +1,25 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1360.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [rte] annotating function foo_correct [rte] annotating function foo_wrong -[wp] 12 goals scheduled +[wp] 10 goals scheduled [wp] [Qed] Goal typed_foo_correct_post : Valid [wp] [Alt-Ergo] Goal typed_foo_correct_assert_rte_mem_access : Valid [wp] [Qed] Goal typed_foo_correct_assert_rte_mem_access_2 : Valid [wp] [Qed] Goal typed_foo_correct_assert_rte_mem_access_3 : Valid -[wp] [Qed] Goal typed_foo_correct_assign_part1 : Valid -[wp] [Qed] Goal typed_foo_correct_assign_part2 : Valid +[wp] [Qed] Goal typed_foo_correct_assign : Valid [wp] [Qed] Goal typed_foo_wrong_post : Valid [wp] [Qed] Goal typed_foo_wrong_assert_rte_mem_access : Valid [wp] [Qed] Goal typed_foo_wrong_assert_rte_mem_access_2 : Valid [wp] [Alt-Ergo] Goal typed_foo_wrong_assert_rte_mem_access_3 : Unknown -[wp] [Qed] Goal typed_foo_wrong_assign_part1 : Valid -[wp] [Qed] Goal typed_foo_wrong_assign_part2 : Valid -[wp] Proved goals: 11 / 12 - Qed: 10 +[wp] [Qed] Goal typed_foo_wrong_assign : Valid +[wp] Proved goals: 9 / 10 + Qed: 8 Alt-Ergo: 1 (unknown: 1) ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -foo_wrong 5 - 6 83.3% -foo_correct 5 1 (13) 6 100% +foo_wrong 4 - 5 80.0% +foo_correct 4 1 (13) 5 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1462.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1462.res.oracle index 3965ef1431cb2864dfa02c52d12eb816fd762a85..9ff47f5ca2d71425adfd2223889c1aeac5ab4a64 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1462.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1462.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1462.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1586.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1586.res.oracle index d1ffff5ee1645d394f2b828e4e7587849bf343ed..c0791fc676898716975fe4a5b0ad7de02655e377 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1586.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1586.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1586.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1588.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1588.res.oracle index 75ea8fa9262adf6139e4ead95f85295a392eb9ce..d41cf632fa6a33bd4cd8ad4b433f03feda424fd9 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1588.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1588.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1588.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1601.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1601.res.oracle index 0f2115a37a03c18cddd002425b06e790b1c14972..32f46b831a4a4e8a0a1851c79ff3730c35174098 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1601.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1601.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1601.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.0.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.0.res.oracle index a7a1b13ba2c939d8f4c16996d011938902d6cd7f..fff7de2f83b07a66b830360dac06986c6ddb56ba 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.0.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1828.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.1.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.1.res.oracle index cdd744f60f51bac2c30da9d524411150df5d0c03..440cfe5979ca3af9e97e3c820f05464c1ac57470 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.1.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_1828.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_1828.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2040.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2040.res.oracle index bc8867272d0d4052003b83d877e95cd56860a763..1af32f874dd7b0c2693062d132e9a8b4fa119444 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2040.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2040.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2040.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2079.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2079.res.oracle index 7160abacc5fca3b532ec370ad0de25db45a836d7..89b29e3f7ea824538f4c81b06f7a2ed976d69024 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2079.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2079.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2079.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2159.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2159.res.oracle index dca6ddede8f0489ffcb76560677d8537a1571982..b89d59513de12005123fd355b78842a9826126a2 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2159.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/bts_2159.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/bts_2159.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/ergo_typecheck.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/ergo_typecheck.res.oracle index d1e6ba0beb0d4f2357816f4199ac4b595ca4bf30..015dd6e3fe475e49e5c2866e4dce1571f7d67790 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/ergo_typecheck.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/ergo_typecheck.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/ergo_typecheck.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.0.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.0.res.oracle index 9475b006366c72973d733350dd53a921ccf3d3e6..45606b9e9f986ec8fbe0ef165f923f0b4c8ac0d7 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.0.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_143.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.1.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.1.res.oracle index eabb9fe5c0b0187e3086a1a4ab2e8b683485c3a3..732b55935bc0977c835b23166c178df610b4142c 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.1.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_143.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.2.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.2.res.oracle index 6863342f5325f1328b670dc60bc3d828ea151664..cb1570509c40582275096a5ca66d30f5a6cc7182 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.2.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_143.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.3.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.3.res.oracle index 8d35840a18449d708e749462a315196947390cf3..d9011d54a862ecc77de2540c76e999ea84873760 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.3.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.3.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_143.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.res.oracle deleted file mode 100644 index 269a571814823b98c80d27529056d562a133450b..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.res.oracle +++ /dev/null @@ -1,15 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_bts/issue_143.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] 1 goal scheduled -[wp] [Alt-Ergo] Goal typed_lemma_ok : Valid -[wp] Proved goals: 1 / 1 - Qed: 0 - Alt-Ergo: 1 ----------------------------------------------------------- -Axiomatics WP Alt-Ergo Total Success -Axiomatic Inconsistent - 1 (3) 1 100% ----------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_198.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_198.res.oracle index d9c85dd7f279e6c2f54f46561f68bd7118e86e03..deec389bd469f4ff79c78e0f18ff1b46e252cbdb 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_198.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_198.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/issue_198.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/nupw-bcl-bts1120.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/nupw-bcl-bts1120.res.oracle index b239918479469e5cb9406f194281c6aa89f69073..f4d4b554a9f75b2f6818da770ff4af27f6fa9033 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/nupw-bcl-bts1120.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/nupw-bcl-bts1120.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_bts/nupw-bcl-bts1120.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication-without-overflow.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication-without-overflow.res.oracle index 61f55780e20b5c0185df5e373ea9c25e193b9770..91c248c7d87b8bbd4762ce7232fa20ef3ffa51e7 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication-without-overflow.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication-without-overflow.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte -warn-unsigned-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/binary-multiplication-without-overflow.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication.res.oracle index 9c8608305afa0e9733e5ceb3e9888ba71705201b..13fccc467ff1eb8959b380af785edf56e677240c 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/binary-multiplication.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/binary-multiplication.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo1_solved.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo1_solved.res.oracle index 58bc92add169c7f7b16cad26d7dc90e2a89469be..43de8f0e4f5d0ee51d194883c2fccd4b1de93318 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo1_solved.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo1_solved.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo1_solved.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -16,8 +15,6 @@ [wp] Goal typed_exo1_assert_rte_signed_overflow_2 : not tried [wp] Goal typed_exo1_assert_rte_signed_overflow_3 : not tried [wp] Goal typed_exo1_loop_assign : trivial -[wp] Goal typed_exo1_assign_part1 : not tried -[wp] Goal typed_exo1_assign_part2 : not tried -[wp] Goal typed_exo1_assign_part3 : not tried +[wp] Goal typed_exo1_assign : not tried [wp] Goal typed_exo1_loop_term_decrease : not tried [wp] Goal typed_exo1_loop_term_positive : not tried diff --git a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo2_solved.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo2_solved.res.oracle index c6466d63d228d41eb72b8cb7636a41d2a8fb25aa..eafea03cce000bed408fac65ef413143b057a335 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo2_solved.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo2_solved.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte -no-warn-signed-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo2_solved.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -24,12 +23,6 @@ [wp] Goal typed_max_subarray_loop_inv_8_established : not tried [wp] Goal typed_max_subarray_assert_rte_mem_access : not tried [wp] Goal typed_max_subarray_loop_assign : trivial -[wp] Goal typed_max_subarray_assign_part1 : not tried -[wp] Goal typed_max_subarray_assign_part2 : not tried -[wp] Goal typed_max_subarray_assign_part3 : not tried -[wp] Goal typed_max_subarray_assign_part4 : not tried -[wp] Goal typed_max_subarray_assign_part5 : not tried -[wp] Goal typed_max_subarray_assign_part6 : not tried -[wp] Goal typed_max_subarray_assign_part7 : not tried +[wp] Goal typed_max_subarray_assign : not tried [wp] Goal typed_max_subarray_loop_term_decrease : not tried [wp] Goal typed_max_subarray_loop_term_positive : not tried diff --git a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.res.oracle index 62cc4375bdee3d8947ad48f7a056158bc0cfd650..3bb026b08b1ee1e227b6dca1c58978ae923cfcf2 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo3_solved.old.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -46,13 +45,10 @@ [wp] Goal typed_ref_equal_elements_assert_2 : not tried [wp] Goal typed_ref_equal_elements_assert_rte_signed_overflow_2 : not tried [wp] Goal typed_ref_equal_elements_loop_assign : trivial -[wp] Goal typed_ref_equal_elements_loop_assign_2_part1 : trivial -[wp] Goal typed_ref_equal_elements_loop_assign_2_part2 : not tried +[wp] Goal typed_ref_equal_elements_loop_assign_2 : trivial [wp] Goal typed_ref_equal_elements_assign_part1 : trivial [wp] Goal typed_ref_equal_elements_assign_part2 : not tried [wp] Goal typed_ref_equal_elements_assign_part3 : not tried -[wp] Goal typed_ref_equal_elements_assign_part4 : not tried -[wp] Goal typed_ref_equal_elements_assign_part5 : not tried [wp] Goal typed_ref_equal_elements_loop_term_decrease : not tried [wp] Goal typed_ref_equal_elements_loop_term_positive : not tried [wp] Goal typed_ref_equal_elements_loop_term_2_decrease : not tried diff --git a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.v2.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.v2.res.oracle index 3912502b598f88030d7dfb6d62636b55171d35e2..b353695b23741cdf8568b0af8a55d6492823629a 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.v2.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.old.v2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo3_solved.old.v2.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -47,13 +46,10 @@ [wp] Goal typed_ref_equal_elements_assert_rte_index_bound_6 : not tried [wp] Goal typed_ref_equal_elements_assert_rte_signed_overflow_2 : not tried [wp] Goal typed_ref_equal_elements_loop_assign : trivial -[wp] Goal typed_ref_equal_elements_loop_assign_2_part1 : trivial -[wp] Goal typed_ref_equal_elements_loop_assign_2_part2 : not tried +[wp] Goal typed_ref_equal_elements_loop_assign_2 : trivial [wp] Goal typed_ref_equal_elements_assign_part1 : trivial [wp] Goal typed_ref_equal_elements_assign_part2 : not tried [wp] Goal typed_ref_equal_elements_assign_part3 : not tried -[wp] Goal typed_ref_equal_elements_assign_part4 : not tried -[wp] Goal typed_ref_equal_elements_assign_part5 : not tried [wp] Goal typed_ref_equal_elements_loop_term_decrease : not tried [wp] Goal typed_ref_equal_elements_loop_term_positive : not tried [wp] Goal typed_ref_equal_elements_loop_term_2_decrease : not tried diff --git a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.simplified.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.simplified.res.oracle index 0c3921630e1c1bfd7a4c805bf86d97fae3993b60..c580a3411d9bb5e4717da9ec3f938b4b2c9798f0 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.simplified.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle/frama_c_exo3_solved.simplified.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo3_solved.simplified.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -28,15 +27,11 @@ [wp] Goal typed_pair_assert_rte_index_bound_6 : not tried [wp] Goal typed_pair_assert_rte_signed_overflow_2 : not tried [wp] Goal typed_pair_loop_assign : trivial -[wp] Goal typed_pair_loop_assign_2_part1 : trivial -[wp] Goal typed_pair_loop_assign_2_part2 : not tried +[wp] Goal typed_pair_loop_assign_2 : trivial [wp] Goal typed_pair_assign_part1 : not tried [wp] Goal typed_pair_assign_part2 : not tried [wp] Goal typed_pair_assign_part3 : not tried [wp] Goal typed_pair_assign_part4 : not tried -[wp] Goal typed_pair_assign_part5 : not tried -[wp] Goal typed_pair_assign_part6 : not tried -[wp] Goal typed_pair_assign_part7 : not tried [wp] Goal typed_pair_loop_term_decrease : not tried [wp] Goal typed_pair_loop_term_positive : not tried [wp] Goal typed_pair_loop_term_2_decrease : not tried diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication-without-overflow.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication-without-overflow.res.oracle index 0a067abeefaa09458b691ea33f46ed366701fec3..bad1754d198f9a61ad8500d4da5872a9c9419408 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication-without-overflow.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication-without-overflow.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -warn-unsigned-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/binary-multiplication-without-overflow.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -25,7 +24,7 @@ Axiomatics WP Alt-Ergo Total Success Axiomatic mult 2 - 3 66.7% ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -BinaryMultiplication 2 6 (56) 9 88.9% +BinaryMultiplication 2 6 (68) 9 88.9% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function BinaryMultiplication @@ -45,5 +44,5 @@ Axiomatics WP Alt-Ergo Total Success Axiomatic mult 2 - 3 66.7% ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -BinaryMultiplication 2 10 (56) 13 92.3% +BinaryMultiplication 2 10 (68) 13 92.3% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication.res.oracle index a4d5379e18c1746c1b7eb783dd0837c463617205..f3ed81e565b63b0a80563a4735cb29b30f175dc0 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/binary-multiplication.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/binary-multiplication.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -15,21 +14,21 @@ [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_inv_inv1_ok_preserved : Timeout [wp] [Qed] Goal typed_BinaryMultiplication_loop_inv_inv1_ok_established : Valid [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_inv_inv2_ok_preserved : Timeout -[wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_inv_inv2_ok_established : Valid +[wp] [Qed] Goal typed_BinaryMultiplication_loop_inv_inv2_ok_established : Valid [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_assert_a2_ok : Valid [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_assert_a3_ok : Valid [wp] [Qed] Goal typed_BinaryMultiplication_loop_assign : Valid [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_term_decrease : Valid [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_term_positive : Valid [wp] Proved goals: 13 / 16 - Qed: 4 - Alt-Ergo: 9 (interrupted: 2) (unknown: 1) + Qed: 5 + Alt-Ergo: 8 (interrupted: 2) (unknown: 1) ---------------------------------------------------------- Axiomatics WP Alt-Ergo Total Success Axiomatic mult 2 2 (4) 5 80.0% ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -BinaryMultiplication 2 7 (197) 11 81.8% +BinaryMultiplication 3 6 (226) 11 81.8% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function BinaryMultiplication @@ -38,14 +37,14 @@ BinaryMultiplication 2 7 (197) 11 81.8% [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_inv_inv1_ok_preserved : Timeout [wp] [Qed] Goal typed_BinaryMultiplication_loop_inv_inv1_ok_established : Valid [wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_inv_inv2_ok_preserved : Timeout -[wp] [Alt-Ergo] Goal typed_BinaryMultiplication_loop_inv_inv2_ok_established : Valid +[wp] [Qed] Goal typed_BinaryMultiplication_loop_inv_inv2_ok_established : Valid [wp] Proved goals: 2 / 5 - Qed: 1 - Alt-Ergo: 1 (interrupted: 2) (unknown: 1) + Qed: 2 + Alt-Ergo: 0 (interrupted: 2) (unknown: 1) ---------------------------------------------------------- Axiomatics WP Alt-Ergo Total Success Axiomatic mult 2 2 (4) 5 80.0% ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -BinaryMultiplication 2 7 (197) 11 81.8% +BinaryMultiplication 3 6 (226) 11 81.8% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo1_solved.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo1_solved.res.oracle index de84464ee9f38592c7a899b4e112f69bfa892ad0..59953f52998b627b33f6521eb73f4c63036e7bdf 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo1_solved.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo1_solved.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo1_solved.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 12 goals scheduled +[wp] 10 goals scheduled [wp] [Alt-Ergo] Goal typed_exo1_post : Valid [wp] [Alt-Ergo] Goal typed_exo1_post_2 : Valid [wp] [Alt-Ergo] Goal typed_exo1_loop_inv_preserved : Valid @@ -12,17 +11,15 @@ [wp] [Alt-Ergo] Goal typed_exo1_loop_inv_2_preserved : Valid [wp] [Qed] Goal typed_exo1_loop_inv_2_established : Valid [wp] [Qed] Goal typed_exo1_loop_assign : Valid -[wp] [Qed] Goal typed_exo1_assign_part1 : Valid -[wp] [Qed] Goal typed_exo1_assign_part2 : Valid -[wp] [Qed] Goal typed_exo1_assign_part3 : Valid +[wp] [Qed] Goal typed_exo1_assign : Valid [wp] [Qed] Goal typed_exo1_loop_term_decrease : Valid [wp] [Qed] Goal typed_exo1_loop_term_positive : Valid -[wp] Proved goals: 12 / 12 - Qed: 8 +[wp] Proved goals: 10 / 10 + Qed: 6 Alt-Ergo: 4 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -exo1 8 4 (187) 12 100% +exo1 6 4 (187) 10 100% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function exo1 @@ -37,5 +34,5 @@ exo1 8 4 (187) 12 100% Alt-Ergo: 5 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -exo1 8 9 (187) 17 100% +exo1 6 9 (187) 15 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo2_solved.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo2_solved.res.oracle index e5266d2164de6efd7262d3be5d5a2a0e494b1bac..7bd3d6e24e89cff96d559bd384c1074a78e29e35 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo2_solved.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo2_solved.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo2_solved.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 28 goals scheduled +[wp] 22 goals scheduled [wp] [Alt-Ergo] Goal typed_max_subarray_post : Valid [wp] [Alt-Ergo] Goal typed_max_subarray_post_2 : Valid [wp] [Alt-Ergo] Goal typed_max_subarray_loop_inv_preserved : Valid @@ -24,21 +23,15 @@ [wp] [Alt-Ergo] Goal typed_max_subarray_loop_inv_8_preserved : Valid [wp] [Alt-Ergo] Goal typed_max_subarray_loop_inv_8_established : Valid [wp] [Qed] Goal typed_max_subarray_loop_assign : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part1 : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part2 : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part3 : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part4 : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part5 : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part6 : Valid -[wp] [Qed] Goal typed_max_subarray_assign_part7 : Valid +[wp] [Qed] Goal typed_max_subarray_assign : Valid [wp] [Qed] Goal typed_max_subarray_loop_term_decrease : Valid [wp] [Qed] Goal typed_max_subarray_loop_term_positive : Valid -[wp] Proved goals: 28 / 28 - Qed: 15 +[wp] Proved goals: 22 / 22 + Qed: 9 Alt-Ergo: 13 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -max_subarray 15 13 (267) 28 100% +max_subarray 9 13 (267) 22 100% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function max_subarray @@ -49,5 +42,5 @@ max_subarray 15 13 (267) 28 100% Alt-Ergo: 1 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -max_subarray 15 14 (267) 29 100% +max_subarray 9 14 (267) 23 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.res.oracle index 5e549f804763388f1bcd6724c0faa50d550d26c2..7050d7a0c97308595b00e3deb3a2debef496f8d8 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo3_solved.old.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 37 goals scheduled +[wp] 34 goals scheduled [wp] [Alt-Ergo] Goal typed_ref_equal_elements_post : Valid [wp] [Alt-Ergo] Goal typed_ref_equal_elements_post_2 : Valid [wp] [Alt-Ergo] Goal typed_ref_equal_elements_post_3 : Valid @@ -31,23 +30,20 @@ [wp] [Alt-Ergo] Goal typed_ref_equal_elements_assert : Valid [wp] [Alt-Ergo] Goal typed_ref_equal_elements_assert_2 : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_assign : Valid -[wp] [Qed] Goal typed_ref_equal_elements_loop_assign_2_part1 : Valid -[wp] [Qed] Goal typed_ref_equal_elements_loop_assign_2_part2 : Valid +[wp] [Qed] Goal typed_ref_equal_elements_loop_assign_2 : Valid [wp] [Qed] Goal typed_ref_equal_elements_assign_part1 : Valid [wp] [Qed] Goal typed_ref_equal_elements_assign_part2 : Valid [wp] [Qed] Goal typed_ref_equal_elements_assign_part3 : Valid -[wp] [Qed] Goal typed_ref_equal_elements_assign_part4 : Valid -[wp] [Qed] Goal typed_ref_equal_elements_assign_part5 : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_decrease : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_positive : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_2_decrease : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_2_positive : Valid -[wp] Proved goals: 37 / 37 - Qed: 21 +[wp] Proved goals: 34 / 34 + Qed: 18 Alt-Ergo: 16 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -equal_elements 21 16 (406) 37 100% +equal_elements 18 16 (406) 34 100% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function equal_elements @@ -73,5 +69,5 @@ equal_elements 21 16 (406) 37 100% Alt-Ergo: 5 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -equal_elements 32 21 (406) 53 100% +equal_elements 29 21 (406) 50 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.v2.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.v2.res.oracle index 8810014da5e2e488db5780a867d1089416169927..b14045bc9746f181fe1c82044de08639fe0eff31 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.v2.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.old.v2.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo3_solved.old.v2.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 38 goals scheduled +[wp] 35 goals scheduled [wp] [Alt-Ergo] Goal typed_ref_equal_elements_post_v1_good : Valid [wp] [Alt-Ergo] Goal typed_ref_equal_elements_post_v2_good : Valid [wp] [Alt-Ergo] Goal typed_ref_equal_elements_post_v1_v2_diff : Valid @@ -32,23 +31,20 @@ [wp] [Alt-Ergo] Goal typed_ref_equal_elements_loop_inv_v2_sound2_preserved : Valid [wp] [Alt-Ergo] Goal typed_ref_equal_elements_loop_inv_v2_sound2_established : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_assign : Valid -[wp] [Qed] Goal typed_ref_equal_elements_loop_assign_2_part1 : Valid -[wp] [Qed] Goal typed_ref_equal_elements_loop_assign_2_part2 : Valid +[wp] [Qed] Goal typed_ref_equal_elements_loop_assign_2 : Valid [wp] [Qed] Goal typed_ref_equal_elements_assign_part1 : Valid [wp] [Qed] Goal typed_ref_equal_elements_assign_part2 : Valid [wp] [Qed] Goal typed_ref_equal_elements_assign_part3 : Valid -[wp] [Qed] Goal typed_ref_equal_elements_assign_part4 : Valid -[wp] [Qed] Goal typed_ref_equal_elements_assign_part5 : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_decrease : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_positive : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_2_decrease : Valid [wp] [Qed] Goal typed_ref_equal_elements_loop_term_2_positive : Valid -[wp] Proved goals: 38 / 38 - Qed: 20 +[wp] Proved goals: 35 / 35 + Qed: 17 Alt-Ergo: 18 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -equal_elements 20 18 (278) 38 100% +equal_elements 17 18 (278) 35 100% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function equal_elements @@ -74,5 +70,5 @@ equal_elements 20 18 (278) 38 100% Alt-Ergo: 5 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -equal_elements 31 23 (278) 54 100% +equal_elements 28 23 (278) 51 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.simplified.res.oracle b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.simplified.res.oracle index 32637add65ca6075b08b8fef44219df4cbc0ac45..2c4a1fc0ec31b2e4406cd2465210120bda427df6 100644 --- a/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.simplified.res.oracle +++ b/src/plugins/wp/tests/wp_gallery/oracle_qualif/frama_c_exo3_solved.simplified.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_gallery/frama_c_exo3_solved.simplified.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 30 goals scheduled +[wp] 26 goals scheduled [wp] [Qed] Goal typed_pair_complete_has_pair_no_pair : Valid [wp] [Qed] Goal typed_pair_disjoint_has_pair_no_pair : Valid [wp] [Alt-Ergo] Goal typed_pair_loop_inv_preserved : Valid @@ -20,27 +19,23 @@ [wp] [Alt-Ergo] Goal typed_pair_loop_inv_6_preserved : Valid [wp] [Alt-Ergo] Goal typed_pair_loop_inv_6_established : Valid [wp] [Qed] Goal typed_pair_loop_assign : Valid -[wp] [Qed] Goal typed_pair_loop_assign_2_part1 : Valid -[wp] [Qed] Goal typed_pair_loop_assign_2_part2 : Valid +[wp] [Qed] Goal typed_pair_loop_assign_2 : Valid [wp] [Qed] Goal typed_pair_assign_part1 : Valid [wp] [Qed] Goal typed_pair_assign_part2 : Valid [wp] [Qed] Goal typed_pair_assign_part3 : Valid [wp] [Qed] Goal typed_pair_assign_part4 : Valid -[wp] [Qed] Goal typed_pair_assign_part5 : Valid -[wp] [Qed] Goal typed_pair_assign_part6 : Valid -[wp] [Qed] Goal typed_pair_assign_part7 : Valid [wp] [Qed] Goal typed_pair_loop_term_decrease : Valid [wp] [Qed] Goal typed_pair_loop_term_positive : Valid [wp] [Qed] Goal typed_pair_loop_term_2_decrease : Valid [wp] [Qed] Goal typed_pair_loop_term_2_positive : Valid [wp] [Alt-Ergo] Goal typed_pair_has_pair_post : Valid [wp] [Alt-Ergo] Goal typed_pair_no_pair_post : Valid -[wp] Proved goals: 30 / 30 - Qed: 20 +[wp] Proved goals: 26 / 26 + Qed: 16 Alt-Ergo: 10 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -pair 20 10 (100) 30 100% +pair 16 10 (109) 26 100% ---------------------------------------------------------- [wp] Running WP plugin... [rte] annotating function pair @@ -59,5 +54,5 @@ pair 20 10 (100) 30 100% Alt-Ergo: 5 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -pair 24 15 (100) 39 100% +pair 20 15 (109) 35 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_hoare/oracle/byref.0.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/byref.0.res.oracle index 9214fc944aa4965ef48a45eb78d04fea4a92541b..59919899181e1efad21dc390d41005c65076d4a9 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/byref.0.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/byref.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/byref.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/byref.1.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/byref.1.res.oracle index 941f3ed6b916c90e4ed7687cbd8bcd4b1852b8f3..3ae5a9ec0b53ffe3ac1ffa6c9bd028f5b263bb6b 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/byref.1.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/byref.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/byref.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/byref.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/byref.res.oracle deleted file mode 100644 index ffa9faacd842ac227ed41522d1d35b832521102c..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_hoare/oracle/byref.res.oracle +++ /dev/null @@ -1,88 +0,0 @@ -# frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_hoare/byref.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function correct ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'correct': -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition 'qed_ok' in 'f'' in 'correct' at call 'f' (file tests/wp_hoare/byref.i, line 27) -: -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'f': -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'qed_ok' in 'f': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function f_ko ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'f_ko': -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'qed_ok' in 'f_ko': -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function formal ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'formal': -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition 'qed_ok' in 'f'' in 'formal' at call 'f' (file tests/wp_hoare/byref.i, line 42) -: -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function local ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'local': -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition 'qed_ok' in 'f'' in 'local' at call 'f' (file tests/wp_hoare/byref.i, line 35) -: -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function wrong ------------------------------------------------------------- - -Goal Post-condition 'qed_ok' in 'wrong': -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition 'qed_ko' in 'f_ko'' in 'wrong' at call 'f_ko' (file tests/wp_hoare/byref.i, line 20) -: -Prove: (ra_q_0=true). - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var.res.oracle index 265884fb564fb587645784a2ff6fa314e5f8dd0c..25356fd4664da026a35c9b83126d9b0395d2cee6 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/dispatch_var.i (no preprocessing) [wp] Running WP plugin... ................................................. @@ -375,41 +374,29 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'call_ref_ctr_nstars' (1/3): +Goal Assigns nothing in 'call_ref_ctr_nstars' (1/2): Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'call_ref_ctr_nstars' (2/3): +Goal Assigns nothing in 'call_ref_ctr_nstars' (2/2): Effect at line 167 Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'call_ref_ctr_nstars' (3/3): -Effect at line 168 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'call_ref_ctr_nstars' (1/4): +Goal Assigns nothing in 'call_ref_ctr_nstars' (1/3): Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'call_ref_ctr_nstars' (2/4): +Goal Assigns nothing in 'call_ref_ctr_nstars' (2/3): Effect at line 167 Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'call_ref_ctr_nstars' (3/4): -Effect at line 168 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'call_ref_ctr_nstars' (4/4): +Goal Assigns nothing in 'call_ref_ctr_nstars' (3/3): Call Result at line 169 Prove: true. diff --git a/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.0.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.0.res.oracle index 81588622dc2abc738eba5a633206790cfb80d2b4..ff7a01c358b85124e4e1b2d668be999f69b77a36 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.0.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' -wp-no-let [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/dispatch_var2.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.1.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.1.res.oracle index 6c0ad98930b8fa69ad42c116f85f00110ae73599..6bd173cde040e2c7aead911641dfd08f54a75ed2 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.1.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/dispatch_var2.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/dispatch_var2.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/isHoare.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/isHoare.res.oracle index 80298d15fc2cdabe4752aed4ad67fa797445294e..f103fdfb2f4070ea8c43549a61e804047dce6450 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/isHoare.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/isHoare.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/isHoare.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/logicarr.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/logicarr.res.oracle index f333130c94bce9a7caad843cf3d21fe49f6f197a..71a449aa61bea7d8d710ce10bcb206f546626662 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/logicarr.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/logicarr.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/logicarr.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,15 +8,16 @@ ------------------------------------------------------------ Goal Post-condition 'PTR' in 'job': -Let a = shift_A10_sint32(global(G_arr_80), 0). +Let a = global(G_arr_33). Let a_1 = shift_sint32(a, i). -Let a_2 = shift_sint32(a, j). Let x = Mint_0[a_1]. -Let m = Mint_0[a_1 <- Mint_0[a_2]][a_2 <- x][shift_sint32(a, k) <- x]. +Let a_2 = shift_sint32(a, 0). +Let a_3 = shift_sint32(a, j). +Let m = Mint_0[a_1 <- Mint_0[a_3]][a_3 <- x][shift_sint32(a, k) <- x]. Assume { - Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(k) /\ - IsArray1_sint32(Array1_int(a, 10, Mint_0)) /\ - IsArray1_sint32(Array1_int(a, 10, m)). + Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(k) /\ is_sint32(x) /\ + IsArray1_sint32(Array1_int(a_2, 10, Mint_0)) /\ + IsArray1_sint32(Array1_int(a_2, 10, m)). (* Pre-condition *) Have: (0 <= i) /\ (i <= 9). (* Pre-condition *) @@ -25,21 +25,22 @@ Assume { (* Pre-condition *) Have: (0 <= k) /\ (k <= 9). } -Prove: P_p_pointer(m, Mint_0, a, i, j). +Prove: P_p_pointer(m, Mint_0, a_2, i, j). ------------------------------------------------------------ Goal Post-condition 'ARR' in 'job': -Let a = shift_A10_sint32(global(G_arr_80), 0). -Let m = Array1_int(a, 10, Mint_0). +Let a = global(G_arr_33). Let a_1 = shift_sint32(a, i). -Let a_2 = shift_sint32(a, j). Let x = Mint_0[a_1]. -Let m_1 = Array1_int(a, 10, - Mint_0[a_1 <- Mint_0[a_2]][a_2 <- x][shift_sint32(a, k) <- x]). +Let a_2 = shift_sint32(a, 0). +Let m = Array1_int(a_2, 10, Mint_0). +Let a_3 = shift_sint32(a, j). +Let m_1 = Array1_int(a_2, 10, + Mint_0[a_1 <- Mint_0[a_3]][a_3 <- x][shift_sint32(a, k) <- x]). Assume { - Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(k) /\ IsArray1_sint32(m) /\ - IsArray1_sint32(m_1). + Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(k) /\ is_sint32(x) /\ + IsArray1_sint32(m) /\ IsArray1_sint32(m_1). (* Pre-condition *) Have: (0 <= i) /\ (i <= 9). (* Pre-condition *) @@ -52,15 +53,16 @@ Prove: P_p_arrays(m, i, m_1, j). ------------------------------------------------------------ Goal Post-condition 'DUM' in 'job': -Let a = shift_A10_sint32(global(G_arr_80), 0). +Let a = global(G_arr_33). Let a_1 = shift_sint32(a, i). -Let a_2 = shift_sint32(a, j). Let x = Mint_0[a_1]. -Let m = Array1_int(a, 10, - Mint_0[a_1 <- Mint_0[a_2]][a_2 <- x][shift_sint32(a, k) <- x]). +Let a_2 = shift_sint32(a, 0). +Let a_3 = shift_sint32(a, j). +Let m = Array1_int(a_2, 10, + Mint_0[a_1 <- Mint_0[a_3]][a_3 <- x][shift_sint32(a, k) <- x]). Assume { - Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(k) /\ - IsArray1_sint32(Array1_int(a, 10, Mint_0)) /\ IsArray1_sint32(m). + Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(k) /\ is_sint32(x) /\ + IsArray1_sint32(Array1_int(a_2, 10, Mint_0)) /\ IsArray1_sint32(m). (* Pre-condition *) Have: (0 <= i) /\ (i <= 9). (* Pre-condition *) diff --git a/src/plugins/wp/tests/wp_hoare/oracle/logicref.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/logicref.res.oracle index 41f75aa51099510c106d799040d24432331b763f..eb53c26f7eca7fea60603cf4a981ca9b42d88981 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/logicref.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/logicref.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/logicref.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/logicref_simple.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/logicref_simple.res.oracle index bacc3721ce522eea8c783c0837aed9e86e8eb3f7..279273c388283d0f798d155d20daade166b7370e 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/logicref_simple.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/logicref_simple.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/logicref_simple.i (no preprocessing) [wp] Running WP plugin... ................................................. @@ -52,12 +51,12 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition (file tests/wp_hoare/logicref_simple.i, line 19) in 'fsimple_array': -Let a = shift_A10_sint32(global(G_t_80), 0). +Let a = global(G_t_33). Let x = Mint_0[shift_sint32(a, 3)]. Assume { Type: is_sint32(x) /\ is_sint32(1 + x). (* Pre-condition *) - Have: P_simple_array(Mint_0, a). + Have: P_simple_array(Mint_0, shift_sint32(a, 0)). } Prove: x = 0. diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/reference.res.oracle index ce38d306cabae3012f1a37f5333f8bc6416ab77a..40e897a21806415c425ed9048759ab5730408659 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/reference.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/reference.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_and_struct.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/reference_and_struct.res.oracle index 9624566f0710854b7898f620b663a7d0732b3eb1..962152f82c870f693cdef1b627fb5bc94bc322cf 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/reference_and_struct.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/reference_and_struct.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference_and_struct.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_array.1.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/reference_array.1.res.oracle deleted file mode 100644 index cd4a5f3be032c02217b7da82e67137033998cb06..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_hoare/oracle/reference_array.1.res.oracle +++ /dev/null @@ -1,288 +0,0 @@ -[wp:var_kind] [incr_addr] t -[wp:var_kind] [incr_addr] t -[wp:var_kind] [incr_addr] t -[wp:var_kind] [incr_addr] tt -[wp:var_kind] [incr_addr] tt -[wp:var_kind] [incr_addr] tt -[wp:var_kind] [incr_addr] s -[wp:var_kind] [incr_addr] sp -[wp:var_kind] [incr_addr] sp -[wp:var_kind] [ByARef] first step + (fp,1) -[wp:var_kind] [ByARef] fp not yet -[wp:var_kind] [ByARef] add (fp,1) -[wp:var_kind] [ByARef] first step + (hp,1) -[wp:var_kind] [ByARef] hp not yet -[wp:var_kind] [ByARef] add (hp,1) -[wp:var_kind] [ByARef] first step + (gp,1) -[wp:var_kind] [ByARef] gp not yet -[wp:var_kind] [ByARef] add (gp,1) -[wp:var_kind] [ByARef] first step + (rp,1) -[wp:var_kind] [ByARef] rp not yet -[wp:var_kind] [ByARef] add (rp,1) -[wp:var_kind] [ByARef] first step + (rp,1) -[wp:var_kind] [ByARef] (rp,1) already -[wp:var_kind] [ByARef] first step + (lp,1) -[wp:var_kind] [ByARef] lp not yet -[wp:var_kind] [ByARef] add (lp,1) -[wp:var_kind] [ByARef] first step + (ap,1) -[wp:var_kind] [ByARef] ap not yet -[wp:var_kind] [ByARef] add (ap,1) -[wp:var_kind] [ByPRef] first step + (sp,0) -[wp:var_kind] [ByPRef] sp not yet -[wp:var_kind] [ByPRef] add (sp,0) -[wp:var_kind] [BuiltinCall] fp ByARef -[wp:var_kind] [BuiltinCall] fp + call(Prop,0,not address taken) -[wp:var_kind] [BuiltinCall] hp ByARef -[wp:var_kind] [BuiltinCall] hp + call(Prop,0,not address taken) -[wp:var_kind] [BuiltinCall] gp not yet ByPRef -[wp:var_kind] [BuiltinCall] gp ByARef -[wp:var_kind] [BuiltinCall] gp + call(Prop,1,not address taken) -[wp:var_kind] [BuiltinCall] rp ByARef -[wp:var_kind] [BuiltinCall] rp + call(Prop,0,not address taken) -[wp:var_kind] [BuiltinCall] lp ByARef -[wp:var_kind] [BuiltinCall] lp + call(Prop,0,not address taken) -[wp:var_kind] [BuiltinCall] ap not yet ByPRef -[wp:var_kind] [BuiltinCall] ap ByARef -[wp:var_kind] [BuiltinCall] ap + call(Prop,1,not address taken) -[wp:var_kind] [collect_calls] t not yet in ArgAref -[wp:var_kind] [ArgARef] try + t -[wp:var_kind] [ArgARef] + t -[wp:var_kind] [collect_calls] t + call(hp,0,address taken) -[wp:var_kind] [collect_calls] t ArfARef -[wp:var_kind] [collect_calls] t + call(fp,0,address taken) -[wp:var_kind] [collect_calls] t ArfARef -[wp:var_kind] [collect_calls] t + call(gp,0,address taken) -[wp:var_kind] [collect_calls] tt not yet in ArgAref -[wp:var_kind] [ArgARef] try + tt -[wp:var_kind] [ArgARef] + tt -[wp:var_kind] [collect_calls] tt + call(lp,0,address taken) -[wp:var_kind] [collect_calls] tt ArfARef -[wp:var_kind] [collect_calls] tt + call(rp,0,address taken) -[wp:var_kind] [collect_calls] tt ArfARef -[wp:var_kind] [collect_calls] tt + call(ap,0,address taken) -[wp:var_kind] [collect_calls] s not yet in ArgAref -[wp:var_kind] [ArgARef] try + s -[wp:var_kind] [ArgARef] + s -[wp:var_kind] [collect_calls] s + call(hp,0,address taken) -[wp:var_kind] [collect_calls] sp not yet ByARef -[wp:var_kind] [ByARef] first step + (sp,0) -[wp:var_kind] [ByARef] sp not yet -[wp:var_kind] [ByARef] add (sp,0) -[wp:var_kind] [collect_calls] sp + call(fp,0,address taken) -[wp:var_kind] [BuiltinCall] sp ByPRef -[wp:var_kind] [BuiltinCall] sp + call(Prop,0,address taken) -[wp:var_kind] [by_array_reference] fp ByAref -[wp:var_kind] [decr_addr] sp -[wp:var_kind] [by_array_reference] sp ByAref -[wp:var_kind] [by_array_reference] rp ByAref -[wp:var_kind] [by_array_reference] hp ByAref -[wp:var_kind] [by_array_reference] lp ByAref -[wp:var_kind] [by_array_reference] fp ByAref -[wp:var_kind] [by_array_reference] gp ByAref -[wp:var_kind] [by_array_reference] ap ByAref -[wp:var_kind] [decr_addr] sp -[wp:var_kind] [by_ptr_reference] sp ByPref -[wp:var_kind] [decr_addr] t -[wp:var_kind] [decr_addr] t -[wp:var_kind] [decr_addr] t -[wp:var_kind] [array_reference arg] t ArgAref -[wp:var_kind] [decr_addr] tt -[wp:var_kind] [decr_addr] tt -[wp:var_kind] [decr_addr] tt -[wp:var_kind] [array_reference arg] tt ArgAref -[wp:var_kind] [decr_addr] s -[wp:var_kind] [array_reference arg] s ArgAref -[wp:var_kind] [resolves addr taken] sp: remove addrtaken -[wp:var_kind] [resolves addr taken] t: remove addrtaken -[wp:var_kind] [resolves addr taken] tt: remove addrtaken -[wp:var_kind] [resolves addr taken] s: remove addrtaken -[kernel] warning: No code for function reset_5, default assigns generated for default behavior -[wp] warning: Missing RTE guards -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp] warning: Assuming contracts of external functions -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] rp is a array ref param of arity 1 -[wp:var_kind] reg_load is a funvar -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] reg_load is a funvar -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] lp is a array ref param of arity 1 -[wp:var_kind] lp is a array ref param of arity 1 -[wp] [WP:simplified] Goal store_load_1_5_exit_assigns : Valid -[wp] [WP:simplified] Goal store_load_1_5_normal_assigns : Valid -[wp:var_kind] reg_add is a funvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp:var_kind] tt is a array refvar -[wp] warning: Use -wp-warnings for details about 'Stronger' and 'Degenerated' goals -[wp] warning: Stronger goal store_calls_on_array_dim_2_post_16_Pload (3 warnings) -[wp] warning: Stronger goal store_calls_on_array_dim_2_post_17_Preset (3 warnings) -[wp] warning: Stronger goal store_calls_on_array_dim_2_post_18_Padd (3 warnings) -[wp] warning: Stronger goal store_calls_on_array_dim_2_exit_assigns (5 warnings) -[wp] warning: Stronger goal store_calls_on_array_dim_2_normal_assigns (3 warnings) -[wp] warning: Stronger goal store_calls_on_array_dim_2_pre12_add_1_5_s17 (3 warnings) -[wp] warning: Stronger goal store_calls_on_array_dim_2_pre10_load_1_5_s15 (1 warning) -[wp] warning: Stronger goal store_calls_on_array_dim_2_pre8_reset_1_5_s16 (2 warnings) -[wp:var_kind] reg_add is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] t is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] s is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] s is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] s is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] s is a array refvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] s is a array refvar -[wp] [WP:simplified] Goal store_call_on_array_in_struct_global_exit_assigns : Valid -[wp] [WP:simplified] Goal store_call_on_array_in_struct_global_normal_assigns : Valid -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] sp is a ptr ref param of arity 0 -[wp:var_kind] reg_add is a funvar -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] reg_add is a funvar -[wp:var_kind] reg_load is a funvar -[wp:var_kind] reg_add is a funvar -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] reg_add is a funvar -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] ap is a array ref param of arity 1 -[wp:var_kind] ap is a array ref param of arity 1 -[wp] [WP:simplified] Goal store_add_1_5_exit_assigns : Valid -[wp] [WP:simplified] Goal store_add_1_5_normal_assigns : Valid diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_array.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/reference_array.res.oracle index 12ec73bda0403f4703ccf55e8a1b78893c965c9b..c6889d00aed6e5e114ebb839df04747bc07efb2d 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/reference_array.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/reference_array.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference_array.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -220,7 +219,7 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'Pload' in 'calls_on_array_dim_2_to_1': -Let a = shift_A20_A5_sint32(global(G_tt_110), 0). +Let a = shift_A5_sint32(global(G_tt_66), 0). Let a_1 = shift_sint32(a, 0). Assume { (* Goal *) @@ -240,12 +239,12 @@ Assume { Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 4) -> (reg_add_0[i_1] = (reg_load_0[i_1] + Mint_1[shift_sint32(a, i_1)])))). } -Prove: Mint_0[shift_sint32(shift_A5_sint32(a, 0), i)] = reg_load_0[i]. +Prove: Mint_0[shift_sint32(a, i)] = reg_load_0[i]. ------------------------------------------------------------ Goal Post-condition 'Preset' in 'calls_on_array_dim_2_to_1': -Let a = shift_A20_A5_sint32(global(G_tt_110), 0). +Let a = shift_A5_sint32(global(G_tt_66), 0). Let a_1 = shift_sint32(a, 0). Assume { (* Goal *) @@ -265,12 +264,12 @@ Assume { Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 4) -> (reg_add_0[i_1] = (reg_load_0[i_1] + Mint_0[shift_sint32(a, i_1)])))). } -Prove: Mint_0[shift_sint32(shift_A5_sint32(a, 0), i)] = 0. +Prove: Mint_0[shift_sint32(a, i)] = 0. ------------------------------------------------------------ Goal Post-condition 'Padd' in 'calls_on_array_dim_2_to_1': -Let a = shift_A20_A5_sint32(global(G_tt_110), 0). +Let a = shift_A5_sint32(global(G_tt_66), 0). Let a_1 = shift_sint32(a, 0). Assume { (* Goal *) @@ -290,7 +289,7 @@ Assume { Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 4) -> (reg_add_0[i_1] = (reg_load_0[i_1] + Mint_1[shift_sint32(a, i_1)])))). } -Prove: Mint_0[shift_sint32(shift_A5_sint32(a, 0), i)] = reg_add_0[i]. +Prove: Mint_0[shift_sint32(a, i)] = reg_add_0[i]. ------------------------------------------------------------ @@ -308,7 +307,7 @@ Goal Instance of 'Pre-condition (file tests/wp_hoare/reference_array.i, line 19) : Assume { (* Heap *) Have: linked(Malloc_0). } Prove: valid_rw(Malloc_0, - shift_sint32(shift_A20_A5_sint32(global(G_tt_110), 0), 0), 5). + shift_sint32(shift_A5_sint32(global(G_tt_66), 0), 0), 5). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.1.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.1.res.oracle deleted file mode 100644 index cd99c7bffa5ab2d5169c5490ba40feb28a84b6b6..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.1.res.oracle +++ /dev/null @@ -1,51 +0,0 @@ -[wp:var_kind] [incr_addr] tt -[wp:var_kind] [ByARef] first step + (p1,1) -[wp:var_kind] [ByARef] p1 not yet -[wp:var_kind] [ByARef] add (p1,1) -[wp:var_kind] [collect_calls] tt not yet in ArgAref -[wp:var_kind] [ArgARef] try + tt -[wp:var_kind] [ArgARef] + tt -[wp:var_kind] [collect_calls] tt + call(p1,0,address taken) -[wp:var_kind] [by_array_reference] p1 ByAref -[wp:var_kind] [decr_addr] tt -[wp:var_kind] [array_reference arg] tt ArgAref -[wp:var_kind] [resolves addr taken] tt: remove addrtaken -[wp] warning: Missing RTE guards -[wp:var_kind] tmp is a funvar -[wp] warning: Assuming contracts of external functions -[wp:var_kind] tt is a array refvar -[wp:var_kind] tmp is a funvar -[wp:var_kind] tt is a array refvar ------------------------------------------------------------- - Proof Environment Store_env1 ------------------------------------------------------------- - ----------------------------------------- ---- Logic Definitions ----------------------------------------- - -Type constraint for Array sint32[][] -Declaration -predicate IsArray_sint32_d2 (a:int farray farray) = - forall i:int. - forall i_0:int. - is_in_format(sint32_format, a[i][i_0]) - - ------------------------------------------------------------- - Function call_f1 ------------------------------------------------------------- - -Proof Obligation post_2: -Environment: Store_env1 - - Assume calling Function 'f1' is consistent with Store-LogicVar -Goal store_call_f1_post_2: - forall tt_0:int farray farray. - IsArray_sint32_d2(tt_0) -> - (let tt_1 = tt_0[0->tt_0[0][3->5]] in - forall result_0:int. - is_in_format(sint32_format, result_0) -> - (result_0 = tt_1[0][3]) -> - (result_0 = 5)) - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.res.oracle index 72708f54d72837829ca195ed157898d985158d73..2af732936d01464064262140c1df26deb6efc01e 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference_array_simple.i (no preprocessing) [wp] Running WP plugin... ................................................. diff --git a/src/plugins/wp/tests/wp_hoare/oracle/refguards.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle/refguards.res.oracle index bb090257aeb178aa04a5c3136fd0193b11a2fcca..63d7053db930ba5226c064b3aceeb23096f52d53 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle/refguards.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle/refguards.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/refguards.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.0.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.0.res.oracle index 630bff016939d1aa0add1dd6da548f4881cf1783..0269fd67f7444af83947031aafe1a890588c4929 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.0.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/byref.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.1.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.1.res.oracle index 15592335b5c48045eea4c82e012e8ed7ef763639..b87b67721ce8710398ab0dc5fee2a0f37d3274e4 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.1.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/byref.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/byref.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var.res.oracle index 80f5aff6ba833eba688ca43e3bcd669f77f2fb60..c5adb5659dd71afd8e34bad8841584f4b8d28bbd 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/dispatch_var.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 80 goals scheduled +[wp] 78 goals scheduled [wp] [Qed] Goal typed_ref_array_in_struct_param_post_Pload2 : Valid [wp] [Qed] Goal typed_ref_array_in_struct_param_assign : Valid [wp] [Qed] Goal typed_ref_call_no_ref_bd_post_Mem_n5_nr6 : Valid @@ -53,11 +52,9 @@ [wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_post : Valid [wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_exit_part1 : Valid [wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_exit_part2 : Valid -[wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_exit_part3 : Valid [wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_normal_part1 : Valid [wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_normal_part2 : Valid [wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_normal_part3 : Valid -[wp] [Qed] Goal typed_ref_call_ref_ctr_nstars_assign_normal_part4 : Valid [wp] [Qed] Goal typed_ref_call_ref_valid_post_R7_N4 : Valid [wp] [Qed] Goal typed_ref_call_ref_valid_assign_exit_part1 : Valid [wp] [Qed] Goal typed_ref_call_ref_valid_assign_exit_part2 : Valid @@ -85,8 +82,8 @@ [wp] [Qed] Goal typed_ref_no_ref_bd_assign_part2 : Valid [wp] [Qed] Goal typed_ref_ref_bd_post : Valid [wp] [Qed] Goal typed_ref_ref_bd_assign : Valid -[wp] Proved goals: 80 / 80 - Qed: 80 +[wp] Proved goals: 78 / 78 + Qed: 78 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success call_ref_ctr 4 - 4 100% @@ -98,7 +95,7 @@ call_ref_valid 11 - 11 100% no_ref_bd 3 - 3 100% call_no_ref_bd 9 - 9 100% call_ref_ctr_nr 10 - 10 100% -call_ref_ctr_nstars 8 - 8 100% +call_ref_ctr_nstars 6 - 6 100% call_two_ref 7 - 7 100% g 4 - 4 100% array_in_struct_param 2 - 2 100% diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.0.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.0.res.oracle index 2b6383d3bd0cf7c819791665ec33ed9c37ee9882..d85bc25add9dd105acf3b58a13945d28b69f5b3b 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.0.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' -wp-no-let [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/dispatch_var2.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.1.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.1.res.oracle index 4295f8fbf5aa3b6518621ef39fa2d134bedbc7a8..23a53a486c8bcb56c1fe621c4f45afabab826ca7 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.1.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/dispatch_var2.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/dispatch_var2.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/isHoare.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/isHoare.res.oracle index 634908472e98f69f99de7fed282497ebc70f249d..1346509ba8b8f7c3dd0cd951a799285de1f621b5 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/isHoare.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/isHoare.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/isHoare.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicarr.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicarr.res.oracle index 1f309f5156e427da1825fd6d6b10beeeb82e7a0f..455be8578aeb1007392c747831e3ad05b02e79cc 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicarr.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicarr.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/logicarr.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -13,5 +12,5 @@ Alt-Ergo: 3 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -job - 3 (30) 3 100% +job - 3 (70) 3 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref.res.oracle index 7ce33e56e8863b0d7b67c8bd1a7c4fc0dfda68dd..b427461e51f7fe3204a607b7559580b8e294eb03 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/logicref.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref_simple.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref_simple.res.oracle index 664067868e796881c9985c343862baf4db1bbb11..f08e51c8e67ca74a47b7f7ab6b1bbb34a4baa092 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref_simple.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/logicref_simple.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/logicref_simple.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -20,7 +19,7 @@ ---------------------------------------------------------- Functions WP Alt-Ergo Total Success fsimple 1 1 (11) 2 100% -fsimple_array 1 1 (14) 2 100% +fsimple_array 1 1 (26) 2 100% ftwo_star 1 1 (13) 2 100% fvpositive 2 1 (9) 3 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference.res.oracle index 58bf38f2a536e4b6428c3216dfa080b3ce855539..6e28f8dc8eb1be3e3530fb4fb1a5044e7d27e338 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_and_struct.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_and_struct.res.oracle index 9474bf381f98e1b2a86289ca5e6ea10883fb9f2e..84eedb20e5dc915532cf96d3ef5c418b9a158a8d 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_and_struct.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_and_struct.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference_and_struct.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array.res.oracle index f43e23a772d3bd2c8e2da8b8561437ee82e8c2af..14e02d7bd20f9bdf986a72952ac1ceedee266ed0 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference_array.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -50,6 +49,6 @@ reset_1_5 3 1 (18) 4 100% load_1_5 3 1 (16) 4 100% add_1_5 3 1 (16) 4 100% calls_on_array_dim_1 5 3 (14) 8 100% -calls_on_array_dim_2_to_1 4 4 (65) 8 100% +calls_on_array_dim_2_to_1 4 4 (44) 8 100% calls_on_array_dim_2 5 3 (13) 8 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array_simple.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array_simple.res.oracle index d02d4f8d03cb8b0f8bd6097f3e2fc373f6fb203b..a3bc809a804cd8247181a51db9b686787cdf0783 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array_simple.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/reference_array_simple.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/reference_array_simple.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle_qualif/refguards.res.oracle b/src/plugins/wp/tests/wp_hoare/oracle_qualif/refguards.res.oracle index 0e97a68b1baf47eb490d2df7e879132a8cfb11ca..4423b4bb226bdf5040ebba0002b0e6303360341e 100644 --- a/src/plugins/wp/tests/wp_hoare/oracle_qualif/refguards.res.oracle +++ b/src/plugins/wp/tests/wp_hoare/oracle_qualif/refguards.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_hoare/refguards.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_manual/manual.i b/src/plugins/wp/tests/wp_manual/manual.i index 812f98f3cfc3b42ef5480c7ae619dcd5fbc3485e..7cd72107d4ca6d53372e573288e68d42ab88786c 100644 --- a/src/plugins/wp/tests/wp_manual/manual.i +++ b/src/plugins/wp/tests/wp_manual/manual.i @@ -4,6 +4,6 @@ /* run.config_qualif OPT: -wp-msg-key no-time-info @PTEST_DIR@/working_dir/swap.c @PTEST_DIR@/working_dir/swap1.h OPT: -wp-msg-key no-time-info -wp-rte @PTEST_DIR@/working_dir/swap.c @PTEST_DIR@/working_dir/swap2.h - OPT: -kernel-verbose 0 -wp-msg-key no-time-info -wp-rte @PTEST_DIR@/working_dir/swap.c @PTEST_DIR@/working_dir/swap2.h -wp-verbose 0 -then -no-unicode -report + OPT: -load-module report -kernel-verbose 0 -wp-msg-key no-time-info -wp-rte @PTEST_DIR@/working_dir/swap.c @PTEST_DIR@/working_dir/swap2.h -wp-verbose 0 -then -no-unicode -report */ void look_at_working_dir(void); diff --git a/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.0.res.oracle b/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.0.res.oracle index 101f074218ee2f3ee17edf6a28243d6a7d02abe9..81bf36627335bfd8f7498f173f437669e4480de2 100644 --- a/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.0.res.oracle +++ b/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.0.res.oracle @@ -1,11 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_manual/manual.i (no preprocessing) [kernel] Parsing tests/wp_manual/working_dir/swap.c (with preprocessing) [kernel] Parsing tests/wp_manual/working_dir/swap1.h (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage [wp] warning: Missing RTE guards [wp] 2 goals scheduled [wp] [Alt-Ergo] Goal typed_swap_post_A : Valid @@ -15,5 +13,5 @@ Alt-Ergo: 1 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -swap 1 1 (12) 2 100% +swap 1 1 (14) 2 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.1.res.oracle b/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.1.res.oracle index c0b8ea8d2992528009e845e70ec77445796d8452..06135369d21bb4566a24b9236cd5891e1cb98e4c 100644 --- a/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.1.res.oracle +++ b/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.1.res.oracle @@ -1,13 +1,11 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_manual/manual.i (no preprocessing) [kernel] Parsing tests/wp_manual/working_dir/swap.c (with preprocessing) [kernel] Parsing tests/wp_manual/working_dir/swap2.h (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage [rte] annotating function swap -[wp] 9 goals scheduled +[wp] 8 goals scheduled [wp] [Alt-Ergo] Goal typed_swap_post_A : Valid [wp] [Qed] Goal typed_swap_post_B : Valid [wp] [Alt-Ergo] Goal typed_swap_assert_rte_mem_access : Valid @@ -16,11 +14,10 @@ [wp] [Qed] Goal typed_swap_assert_rte_mem_access_4 : Valid [wp] [Qed] Goal typed_swap_assign_part1 : Valid [wp] [Qed] Goal typed_swap_assign_part2 : Valid -[wp] [Qed] Goal typed_swap_assign_part3 : Valid -[wp] Proved goals: 9 / 9 - Qed: 6 +[wp] Proved goals: 8 / 8 + Qed: 5 Alt-Ergo: 3 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -swap 6 3 (17) 9 100% +swap 5 3 (19) 8 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.2.res.oracle b/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.2.res.oracle index f3662084f779f784e12cef8562225fdd62c828eb..77a05557f8caa037b4aba84e7b681ab90a18d4d1 100644 --- a/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.2.res.oracle +++ b/src/plugins/wp/tests/wp_manual/oracle_qualif/manual.2.res.oracle @@ -2,7 +2,7 @@ [rte] annotating function swap ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -swap 6 3 (17) 9 100% +swap 5 3 (19) 8 100% ---------------------------------------------------------- [report] Computing properties status... diff --git a/src/plugins/wp/tests/wp_plugin/inductive.c b/src/plugins/wp/tests/wp_plugin/inductive.c new file mode 100644 index 0000000000000000000000000000000000000000..a436fbaffc4005ed8fc6af10ee2699c73b64ed7e --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/inductive.c @@ -0,0 +1,53 @@ +/* run.config + OPT: -wp-prover coq -wp-gen -wp-msg-key print-generated +*/ + +/* run.config_qualif + OPT: -wp-prover coq -wp-script tests/wp_plugin/inductive.script +*/ + +typedef struct _list { int element; struct _list* next; } list; + +/*@ inductive reachable{L} (list* root, list* node) { + case root_reachable{L}: + \forall list* root; reachable(root,root); + case next_reachable{L}: + \forall list* root, *node; + \valid(root) ==> reachable(root->next, node) ==> reachable(root,node); + } +*/ + +/*@ predicate swap{L1, L2}(int *a, int *b, integer begin, integer i, integer j, integer end) = + begin <= i < j < end && + \at(a[i], L1) == \at(b[j], L2) && + \at(a[j], L1) == \at(b[i], L2) && + \forall integer k; begin <= k < end && k != i && k != j ==> + \at(a[k], L1) == \at(b[k], L2); + + predicate same_array{L1,L2}(int *a, int *b, integer begin, integer end) = + \forall integer k; begin <= k < end ==> \at(a[k],L1) == \at(b[k],L2); + + inductive same_elements{L1, L2}(int *a, int *b, integer begin, integer end) { + case refl{L1, L2}: + \forall int *a, int *b, integer begin, end; + same_array{L1,L2}(a, b, begin, end) ==> + same_elements{L1, L2}(a, b, begin, end); + case swap{L1, L2}: \forall int *a, int *b, integer begin, i, j, end; + swap{L1, L2}(a, b, begin, i, j, end) ==> + same_elements{L1, L2}(a, b, begin, end); + case trans{L1, L2, L3}: \forall int* a, int *b, int *c, integer begin, end; + same_elements{L1, L2}(a, b, begin, end) ==> + same_elements{L2, L3}(b, c, begin, end) ==> + same_elements{L1, L3}(a, c, begin, end); + } +*/ + +/*@ lemma test: + \forall list *root,*node; + reachable(root,node) ==> ( root == node || (\valid(root) && reachable(root->next, node)) ); +*/ +/*@ lemma offset{L1,L2} : + \forall int *a, *b, integer begin, end, offset; + same_elements{L1,L2}(a+offset,b+offset, begin, end) ==> + same_elements{L1,L2}(a, b, begin+offset, end+offset); +*/ diff --git a/src/plugins/wp/tests/wp_plugin/inductive.script b/src/plugins/wp/tests/wp_plugin/inductive.script new file mode 100644 index 0000000000000000000000000000000000000000..d48df7d65c8cf57d1d6184026287411f2a3ef026 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/inductive.script @@ -0,0 +1,39 @@ +(* Generated by Frama-C WP *) + +Goal typed_lemma_offset. +Hint offset,property. +Proof. + intros. remember (shift_sint32 a_1 i) as a_11. + remember (shift_sint32 a i) as a1. + revert dependent a. revert dependent a_1. + induction H; intros; subst. + - apply Q_refl. unfold P_same_array; intros. + unfold P_same_array in *. unfold shift_sint32, shift in *. + destruct a0, a_0. simpl in *. + replace i1 with (i + (i1 -i)) by omega. + rewrite 2!Z.add_assoc. + apply H; omega. + - apply Q_swap with (i_2:=i+i_2) (i_1:=i+i_1). unfold P_swap in *. + decompose [and] H; clear H. + unfold shift_sint32, shift in *. destruct a0, a_0. simpl in *. + repeat split; try omega. + + rewrite 2!Z.add_assoc. assumption. + + rewrite 2!Z.add_assoc. assumption. + + intros. + replace i_0 with (i + (i_0 - i)) by omega. + rewrite 2!Z.add_assoc. + apply H6; omega. + - apply Q_trans with (t_1:=t_1) (a_1:=shift_sint32 a_1 (-i)). + + apply IHP_same_elements1. reflexivity. destruct a_1; unfold shift_sint32, shift; simpl. f_equal; omega. + + apply IHP_same_elements2. destruct a_1; unfold shift_sint32, shift; simpl. f_equal; omega. reflexivity. +Qed. + +Goal typed_lemma_test. +Hint property,test. +Proof. +intros. +destruct H. + - left. reflexivity. + - right. split;assumption. +(* auto with zarith. *) +Qed. diff --git a/src/plugins/wp/tests/wp_plugin/mask.i b/src/plugins/wp/tests/wp_plugin/mask.i new file mode 100644 index 0000000000000000000000000000000000000000..dd674ac70ba13993e37fd9905a025da0f669b22e --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/mask.i @@ -0,0 +1,8 @@ +/*@ + ensures A: \result == (-129 & x) ; + ensures B: \result == (0x7F & x) ; +*/ +int compute(unsigned char x) +{ + return x & 0xFF7F ; +} diff --git a/src/plugins/wp/tests/wp_plugin/oracle/abs.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/abs.res.oracle index e84129eb062995382676cc7391e195d7478d0f33..52d3c00dcb92cd22db6e42d3898d48d0cc4927ab 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/abs.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/abs.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/abs.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/asm.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/asm.res.oracle index 349e3ab6ff3cc62ffe75a5a5bd58e206b8bbe666..622e7f0918e85c49007cbec207c13ae6e5dbea4c 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/asm.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/asm.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/asm.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/call.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/call.res.oracle index 329e40d33162b8f5bfed5df0b4abc6607eac3567..ed5a33a9abf3f04c11ed6f2e67447eb1a52b742b 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/call.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/call.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/call.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/cint.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/cint.0.res.oracle index 532efa7bd7adec39b389fc476b379ff57b599d6d..d06dcb29cc4de0c520b4c750cee11da27edc9a29 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/cint.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/cint.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/cint.i (no preprocessing) tests/wp_plugin/cint.i:22:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/cint.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/cint.1.res.oracle index 7448380363fa524ba05768c60fee5acc5247c5fa..29f2ae3c905340967408606363ab7fd1a18a97af 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/cint.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/cint.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -no-warn-signed-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/cint.i (no preprocessing) tests/wp_plugin/cint.i:22:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/cint.2.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/cint.2.res.oracle index 2db392503f35c84feeaec7ee1cc9095f0cabe750..ba963814a8046f2cf3a070ee8671e39740c2b664 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/cint.2.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/cint.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -warn-unsigned-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/cint.i (no preprocessing) tests/wp_plugin/cint.i:22:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/cint.3.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/cint.3.res.oracle index f35ccab360dbcadd6470f712608d177412210b82..902b2fa7dd7b6f95586060b54fbdf559994b7d81 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/cint.3.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/cint.3.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -warn-signed-downcast [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/cint.i (no preprocessing) tests/wp_plugin/cint.i:22:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/cint.4.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/cint.4.res.oracle index c7c547e026efb578ad01ce464932808cac40ca7e..ad8f334dbaf4789e5b0bf7003f44d5a86cb3d99b 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/cint.4.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/cint.4.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -warn-unsigned-downcast [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/cint.i (no preprocessing) tests/wp_plugin/cint.i:22:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/cint.5.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/cint.5.res.oracle index 72289f34719be11fec31b23a383d9e18cc09e321..d231e87cd2c5d53a7c635609f94127d86c0c3112 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/cint.5.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/cint.5.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Nat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/cint.i (no preprocessing) tests/wp_plugin/cint.i:22:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/combined.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/combined.res.oracle index 8707ec04e910dc24576adee1b3f52a316026149f..d869bb93935c47f4813a4b06d355d53bf7439d60 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/combined.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/combined.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/combined.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/copy.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/copy.res.oracle index 2d43c8c8caf324aa695ad64e0c7fc8ab77b8f85d..4abcefcdf18a3f53de9bd5de278c476f560362bc 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/copy.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/copy.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/copy.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -241,13 +240,7 @@ Prove: included(a_1, 1, a_2, n). ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/copy.i, line 6) in 'copy' (1/2): -Effect at line 14 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/copy.i, line 6) in 'copy' (2/2): +Goal Assigns (file tests/wp_plugin/copy.i, line 6) in 'copy': Effect at line 14 Let a_1 = shift_sint32(a, 0). Assume { diff --git a/src/plugins/wp/tests/wp_plugin/oracle/dynamic.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/dynamic.res.oracle index 3abc7e637acd4ba877cc291967596fde8e276ce1..d3a955842703d173849ed11da30d5d07dc7edbb8 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/dynamic.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/dynamic.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/dynamic.i (no preprocessing) [wp] Running WP plugin... [wp] Computing dynamic calls. @@ -12,8 +11,8 @@ Goal calls f1 f2 in 'call' at instruction (file tests/wp_plugin/dynamic.i, line 30): Let a = Mptr_0[shiftfield_F1_S_f(closure_0)]. -Let a_1 = global(G_f2_75). -Let a_2 = global(G_f1_69). +Let a_1 = global(G_f2_28). +Let a_2 = global(G_f1_22). Let x = Mint_0[shiftfield_F1_S_param(closure_0)]. Assume { Type: is_sint32(x). @@ -47,8 +46,9 @@ Assume { (* Heap *) Have: (region(closure_0.base) <= 0) /\ framed(Mptr_0). (* Pre-condition *) - Have: (Mptr_0[shiftfield_F1_S_f(closure_0)] = global(G_f1_69)) /\ - (abs_int(x) <= 5). + Have: abs_int(x) <= 5. + (* Instance of 'f1' *) + Have: Mptr_0[shiftfield_F1_S_f(closure_0)] = global(G_f1_22). } Prove: ((-10) <= x) /\ (x <= 10). diff --git a/src/plugins/wp/tests/wp_plugin/oracle/frame.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/frame.res.oracle index 07e4b3784cfff99431dd2f07ac93108cbd82c726..3d27cc6a8370e9fa2026a8eb17433f18a80cc395 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/frame.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/frame.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/frame.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,7 +8,7 @@ ------------------------------------------------------------ Goal Post-condition 'KO' in 'alias': -Let a = global(P_r_86). +Let a = global(P_r_39). Let x = Mint_1[a]. Let x_1 = Mint_0[a]. Assume { diff --git a/src/plugins/wp/tests/wp_bts/oracle/bts_1020.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/inductive.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_bts/oracle/bts_1020.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/inductive.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle/inductive.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/inductive.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..b991be10e4591153c19fc0ce59c3d7a159b4c546 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle/inductive.res.oracle @@ -0,0 +1,177 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/inductive.c (with preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] 2 goals scheduled +[wp:print-generated] "WPOUT/typed/Compound.v" + (* ---------------------------------------------------------- *) + (* --- Memory Compound Updates --- *) + (* ---------------------------------------------------------- *) + + Require Import ZArith. + Require Import Reals. + Require Import BuiltIn. + Require Import int.Int. + Require Import int.Abs. + Require Import int.ComputerDivision. + Require Import real.Real. + Require Import real.RealInfix. + Require Import real.FromInt. + Require Import map.Map. + Require Import Qedlib. + Require Import Qed. + Require Import Memory. + + Definition shift_sint32 (p : addr) (k : Z) : addr := (shift p k%Z). + + Definition shiftfield_F1__list_next (p : addr) : addr := (shift p 1%Z). +[wp:print-generated] "WPOUT/typed/lemma_test_Coq.v" + (* ---------------------------------------------------------- *) + (* --- Lemma 'test' --- *) + (* ---------------------------------------------------------- *) + Require Import ZArith. + Require Import Reals. + Require Import BuiltIn. + Require Import int.Int. + Require Import int.Abs. + Require Import int.ComputerDivision. + Require Import real.Real. + Require Import real.RealInfix. + Require Import real.FromInt. + Require Import map.Map. + Require Import Qedlib. + Require Import Qed. + + (* --- Global Definitions --- *) + Require Import Memory. + + Require Import Compound. + + Inductive P_reachable : array Z -> farray addr addr -> addr -> addr -> + Prop := + | Q_root_reachable: forall (t : array Z), + forall (t_1 : farray addr addr), forall (a : addr), + (P_reachable t t_1 a a) + | Q_next_reachable: forall (t : array Z), + forall (t_1 : farray addr addr), forall (a_1 a : addr), + ((valid_rw t a_1 2%Z)) -> + ((P_reachable t t_1 (t_1.[ (shiftfield_F1__list_next a_1) ]) a)) -> + ((P_reachable t t_1 a_1 a)). + + Goal + forall (t : array Z), + forall (t_1 : farray addr addr), + forall (a_1 a : addr), + ((P_reachable t t_1 a_1 a)) -> + ((a_1 = a) \/ + (((valid_rw t a_1 2%Z)) /\ + ((P_reachable t t_1 (t_1.[ (shiftfield_F1__list_next a_1) ]) a)))). + + Proof. + ... + Qed. +[wp:print-generated] "WPOUT/typed/lemma_offset_Coq.v" + (* ---------------------------------------------------------- *) + (* --- Lemma 'offset' --- *) + (* ---------------------------------------------------------- *) + Require Import ZArith. + Require Import Reals. + Require Import BuiltIn. + Require Import int.Int. + Require Import int.Abs. + Require Import int.ComputerDivision. + Require Import real.Real. + Require Import real.RealInfix. + Require Import real.FromInt. + Require Import map.Map. + Require Import Qedlib. + Require Import Qed. + + (* --- Global Definitions --- *) + Require Import Memory. + + Require Import Compound. + + Inductive P_reachable : array Z -> farray addr addr -> addr -> addr -> + Prop := + | Q_root_reachable: forall (t : array Z), + forall (t_1 : farray addr addr), forall (a : addr), + (P_reachable t t_1 a a) + | Q_next_reachable: forall (t : array Z), + forall (t_1 : farray addr addr), forall (a_1 a : addr), + ((valid_rw t a_1 2%Z)) -> + ((P_reachable t t_1 (t_1.[ (shiftfield_F1__list_next a_1) ]) a)) -> + ((P_reachable t t_1 a_1 a)). + + Hypothesis Q_test: forall (t : array Z), forall (t_1 : farray addr addr), + forall (a_1 a : addr), ((P_reachable t t_1 a_1 a)) -> + ((a_1 = a) \/ + (((valid_rw t a_1 2%Z)) /\ + ((P_reachable t t_1 (t_1.[ (shiftfield_F1__list_next a_1) ]) a)))). + + Definition P_same_array (Mint_0 : farray addr Z) (Mint_1 : farray addr Z) + (a : addr) (b : addr) (begin_0 : Z) (end_0 : Z) : Prop := + forall (i : Z), ((begin_0 <= i)%Z) -> ((i < end_0)%Z) -> + (((Mint_1.[ (shift_sint32 a i%Z) ]) + = (Mint_0.[ (shift_sint32 b i%Z) ]))%Z). + + Definition P_swap (Mint_0 : farray addr Z) (Mint_1 : farray addr Z) + (a : addr) (b : addr) (begin_0 : Z) (i : Z) (j : Z) (end_0 : Z) : Prop := + (((Mint_1.[ (shift_sint32 a i%Z) ]) + = (Mint_0.[ (shift_sint32 b j%Z) ]))%Z) /\ + (((Mint_1.[ (shift_sint32 a j%Z) ]) + = (Mint_0.[ (shift_sint32 b i%Z) ]))%Z) /\ ((begin_0 <= i)%Z) /\ + ((i < j)%Z) /\ ((j < end_0)%Z) /\ + (forall (i_1 : Z), ((i_1 <> i)%Z) -> ((i_1 <> j)%Z) -> + ((begin_0 <= i_1)%Z) -> ((i_1 < end_0)%Z) -> + (((Mint_1.[ (shift_sint32 a i_1%Z) ]) + = (Mint_0.[ (shift_sint32 b i_1%Z) ]))%Z)). + + Inductive P_same_elements : farray addr Z -> farray addr Z -> addr -> addr -> + Z -> Z -> Prop := + | Q_refl: forall (i_1 i : Z), forall (t_1 t : farray addr Z), + forall (a_1 a : addr), ((P_same_array t_1 t a_1 a i_1%Z i%Z)) -> + ((P_same_elements t_1 t a_1 a i_1%Z i%Z)) + | Q_swap: forall (i_3 i_2 i_1 i : Z), forall (t_1 t : farray addr Z), + forall (a_1 a : addr), + ((P_swap t_1 t a_1 a i_3%Z i_2%Z i_1%Z i%Z)) -> + ((P_same_elements t_1 t a_1 a i_3%Z i%Z)) + | Q_trans: forall (i_1 i : Z), forall (t_2 t_1 t : farray addr Z), + forall (a_2 a_1 a : addr), + ((P_same_elements t_1 t a_2 a_1 i_1%Z i%Z)) -> + ((P_same_elements t_2 t_1 a_1 a i_1%Z i%Z)) -> + ((P_same_elements t_2 t a_2 a i_1%Z i%Z)). + + Goal + forall (i_2 i_1 i : Z), + forall (t_1 t : farray addr Z), + forall (a_1 a : addr), + ((P_same_elements t_1 t ((shift_sint32 a_1 i%Z)) ((shift_sint32 a i%Z)) + i_2%Z i_1%Z)) -> + ((P_same_elements t_1 t a_1 a (i%Z + i_2%Z)%Z (i%Z + i_1%Z)%Z)). + + Proof. + ... + Qed. +[wp] 2 goals generated +------------------------------------------------------------ + Global +------------------------------------------------------------ + +Lemma offset: +Assume: 'test' +Prove: (P_same_elements Mint_0 Mint_1 (shift_sint32 a_0 offset_0) + (shift_sint32 b_0 offset_0) begin_0 end_0) + -> (P_same_elements Mint_0 Mint_1 a_0 b_0 (begin_0+offset_0) + (end_0+offset_0)) + +------------------------------------------------------------ + +Lemma test: +Prove: (P_reachable Malloc_0 Mptr_0 root_0 node_0) + -> ((root_0=node_0) + \/ ((valid_rw Malloc_0 root_0 2) + /\ (P_reachable Malloc_0 Mptr_0 + Mptr_0[(shiftfield_F1__list_next root_0)] node_0))) + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle/init_const.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/init_const.res.oracle index e11cc07c2fb2a4095f0aa69061764a4d8d14a634..9e758d754ce3050c7eaea97ea56fcfd84375cd75 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/init_const.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/init_const.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_const.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/init_const_guard.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/init_const_guard.res.oracle index b079661d1830167753da31dcdc0a34159a9ccad7..ecbfcef0cd1b5d668798ee3156325e075cc19bda 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/init_const_guard.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/init_const_guard.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_const_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -14,8 +13,8 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'Pointed_Valid' in 'f': -Assume { (* Heap *) Have: (region(G_x_67) <= 0) /\ linked(Malloc_0). } -Prove: valid_rw(Malloc_0, global(G_x_67), 1). +Assume { (* Heap *) Have: (region(G_x_20) <= 0) /\ linked(Malloc_0). } +Prove: valid_rw(Malloc_0, global(G_x_20), 1). ------------------------------------------------------------ @@ -39,12 +38,12 @@ Prove: true. Goal Assertion 'Read' (file tests/wp_plugin/init_const_guard.i, line 31): Assume { (* Heap *) Have: (region(p.base) <= 0) /\ linked(Malloc_0). } -Prove: valid_rd(Malloc_0, global(G_x_67), 1). +Prove: valid_rd(Malloc_0, global(G_x_20), 1). ------------------------------------------------------------ Goal Assertion 'Guard_against_Const' (file tests/wp_plugin/init_const_guard.i, line 32): -Let a = global(G_x_67). +Let a = global(G_x_20). Assume { (* Heap *) Have: (region(p.base) <= 0) /\ linked(Malloc_0). diff --git a/src/plugins/wp/tests/wp_plugin/oracle/init_extern.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/init_extern.res.oracle index df010e6fdd82b5d13da30689964390c338359344..7b895fbadb2c27cd81f1bf2181ebf43053bcad69 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/init_extern.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/init_extern.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_extern.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_linker.i (no preprocessing) [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/init_valid.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/init_valid.res.oracle index 219ff674612854254e85f40f655e1d2207cac066..836833269d49c858c42b1e6525641a8d9fe37387 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/init_valid.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/init_valid.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_valid.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/initarr.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/initarr.res.oracle index 1276bf90e0dfa7630a38cc9ef56499ec8fdb4897..ebaee31386880a54641721249caff8f947a0e06b 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/initarr.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/initarr.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/initarr.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -16,17 +15,17 @@ Let a_3 = A[i]. Assume { Type: is_sint32(i). (* Initializer *) - Init: (a_2.F1_f) = global(G_a_67). + Init: (a_2.F1_f) = global(G_a_20). (* Initializer *) - Init: (a_2.F1_g) = global(G_b_68). + Init: (a_2.F1_g) = global(G_b_21). (* Initializer *) - Init: (a_1.F1_f) = global(G_c_69). + Init: (a_1.F1_f) = global(G_c_22). (* Initializer *) - Init: (a_1.F1_g) = global(G_d_70). + Init: (a_1.F1_g) = global(G_d_23). (* Initializer *) - Init: (a.F1_f) = global(G_e_71). + Init: (a.F1_f) = global(G_e_24). (* Initializer *) - Init: (a.F1_g) = global(G_f_72). + Init: (a.F1_g) = global(G_f_25). (* Pre-condition *) Have: (0 <= i) /\ (i <= 2). } @@ -35,9 +34,9 @@ Prove: (a_3.F1_g) != (a_3.F1_f). ------------------------------------------------------------ Goal Post-condition 'ALT' in 'job': -Let a = global(G_e_71). -Let a_1 = global(G_c_69). -Let a_2 = global(G_a_67). +Let a = global(G_e_24). +Let a_1 = global(G_c_22). +Let a_2 = global(G_a_20). Let a_3 = A[i].F1_f. Assume { Type: is_sint32(i). diff --git a/src/plugins/wp/tests/wp_plugin/oracle/injector.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/injector.res.oracle index 558a99ccd5018c6373ca6584483301bda4b8a8b1..5a137a34d0ffe6f5a3a7d4c48d46c1690fd68c63 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/injector.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/injector.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/injector.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -116,13 +115,13 @@ Prove: false. Goal Post-condition for 'ko_1' 'qed_ko' in 'f': Assume { - Type: is_sint32(v_1) /\ is_sint32(v). + Type: is_sint32(b) /\ is_sint32(v). (* Pre-condition for 'ko_1' *) Have: out_0[0] = 33. (* Pre-condition for 'ko_1' *) Have: out_0[1] = 33. } -Prove: v = v_1. +Prove: v = b. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle/loop.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/loop.res.oracle index 23cfdc003f055638a412e88fddb42f741b5eaf3d..31055ccee68e60742273618a9b7007f3690a9acc 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/loop.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/loop.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/loop.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -170,13 +169,7 @@ Prove: included(a_2, 1, a_1, 1 + i - a). ------------------------------------------------------------ -Goal Assigns 'qed_ok' in 'init' (1/2): -Effect at line 15 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'qed_ok' in 'init' (2/2): +Goal Assigns 'qed_ok' in 'init': Effect at line 15 Let a_1 = shift_sint32(t, a). Let x = -a. diff --git a/src/plugins/wp/tests/wp_plugin/oracle/loopentry.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/loopentry.res.oracle index b5b2daa7cd5bffa8aa76bbfbde1a5e0a794ac43e..562674694f4f9e90ba0d534a193589365a9a027f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/loopentry.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/loopentry.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/loopentry.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/mask.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_bts/oracle_qualif/issue_143.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/mask.err.oracle diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/mask.res.oracle similarity index 58% rename from src/plugins/wp/tests/wp_typed/oracle/unit_cst.res.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/mask.res.oracle index c23b520be17182ae75f6efbbd0feb0c18a0a86ab..675bfd7c48b3ca71400fa10923a31a0581217077 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/mask.res.oracle @@ -1,22 +1,18 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_cst.i (no preprocessing) +[kernel] Parsing tests/wp_plugin/mask.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage [wp] warning: Missing RTE guards ------------------------------------------------------------ - Function f + Function compute ------------------------------------------------------------ -Goal Post-condition 'A' in 'f': -Assume { } +Goal Post-condition 'A' in 'compute': Prove: true. ------------------------------------------------------------ -Goal Post-condition 'B' in 'f': -Assume { } +Goal Post-condition 'B' in 'compute': Prove: true. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle/model.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/model.res.oracle index 3593ece60340a17d3179befc9e8c58daf628634b..02ba325b8446096585bb8224770d70e434643259 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/model.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/model.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/model.i (no preprocessing) tests/wp_plugin/model.i:11:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle/nth.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/nth.res.oracle index a4c0c0c222f4b7e4fcd8fd8cc5a6b9736ae4484d..13e8d343c16cb3559600976958b8ec8014719ead 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/nth.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/nth.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/nth.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/params.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/params.res.oracle index 9856d1da8c061a49fb697976d792e672758abc46..06390f953027618fcb5e31859d50f89d565d1ffd 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/params.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/params.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/params.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/plet.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/plet.res.oracle index ab07db8cc74c1358ba0ac1e49fec808608fb33bb..8b4eb23ef7f431f7d47dd07aadaa8bf3f9631f5b 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/plet.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/plet.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/plet.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/polarity.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/polarity.res.oracle index 8c9e051638234f77329df2c90b97e2d80d78173f..5f7e6c8eb4666cbcdcdca63cee0f8e023f2fe698 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/polarity.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/polarity.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/polarity.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/byref.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/prenex.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_hoare/oracle/byref.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/prenex.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle/prenex.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/prenex.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..44ee810b3e731662bd695a53f7f58c456b05e655 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle/prenex.res.oracle @@ -0,0 +1,207 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/prenex.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +------------------------------------------------------------ + Function diag +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_plugin/prenex.i, line 11) in 'diag': +Assume { + Type: is_sint32(diag_0) /\ is_sint32(i) /\ is_sint32(i_1) /\ + is_sint32(j) /\ is_sint32(m) /\ is_sint32(n). + (* Heap *) + Have: (region(p.base) <= 0) /\ (region(q.base) <= 0). + (* Pre-condition *) + Have: (0 <= m) /\ (0 <= n). + (* Invariant 'PI' *) + Have: forall i_3,i_2 : Z. ((0 <= i_2) -> ((i_2 < m) -> ((0 <= i_3) -> + ((i_3 < i_1) -> + (Mint_0[shift_sint32(p, i_3)] < Mint_0[shift_sint32(q, i_2)]))))). + (* Invariant 'I' *) + Have: (0 <= i_1) /\ (i_1 <= n). + If i_1 < n + Then { + Let x = Mint_0[shift_sint32(p, i)]. + (* Invariant 'PJ' *) + Have: forall i_2 : Z. ((0 <= i_2) -> ((i_2 < j) -> + (x < Mint_0[shift_sint32(q, i_2)]))). + (* Invariant 'J' *) + Have: (0 <= j) /\ (j <= m). + (* Then *) + Have: j < m. + Have: i_1 = i. + (* Then *) + Have: Mint_0[shift_sint32(q, j)] <= x. + (* Return *) + Have: diag_0 = 0. + } + Else { (* Return *) Have: diag_0 = 1. } +} +Prove: (forall i_2 : Z. ((0 <= i_2) -> ((i_2 < n) -> + (forall i_3 : Z. ((0 <= i_3) -> ((i_3 < m) -> + (Mint_0[shift_sint32(p, i_2)] < Mint_0[shift_sint32(q, i_3)]))))))) <-> + (diag_0 != 0). + +------------------------------------------------------------ + +Goal Preservation of Invariant 'I' (file tests/wp_plugin/prenex.i, line 19): +Assume { + Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(m) /\ is_sint32(n) /\ + is_sint32(1 + i). + (* Heap *) + Have: (region(p.base) <= 0) /\ (region(q.base) <= 0). + (* Pre-condition *) + Have: (0 <= m) /\ (0 <= n). + (* Invariant 'PI' *) + Have: forall i_2,i_1 : Z. ((0 <= i_1) -> ((i_1 < m) -> ((0 <= i_2) -> + ((i_2 < i) -> + (Mint_0[shift_sint32(p, i_2)] < Mint_0[shift_sint32(q, i_1)]))))). + (* Invariant 'I' *) + Have: (0 <= i) /\ (i <= n). + (* Then *) + Have: i < n. + (* Invariant 'PJ' *) + Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 < j) -> + (Mint_0[shift_sint32(p, i)] < Mint_0[shift_sint32(q, i_1)]))). + (* Invariant 'J' *) + Have: (0 <= j) /\ (j <= m). + (* Else *) + Have: m <= j. +} +Prove: (-1) <= i. + +------------------------------------------------------------ + +Goal Establishment of Invariant 'I' (file tests/wp_plugin/prenex.i, line 19): +Prove: true. + +------------------------------------------------------------ + +Goal Preservation of Invariant 'PI' (file tests/wp_plugin/prenex.i, line 21): +Assume { + Type: is_sint32(i_2) /\ is_sint32(j) /\ is_sint32(m) /\ is_sint32(n) /\ + is_sint32(1 + i_2). + (* Goal *) + When: (0 <= i) /\ (0 <= i_1) /\ (i_1 < m) /\ (i <= i_2). + (* Heap *) + Have: (region(p.base) <= 0) /\ (region(q.base) <= 0). + (* Pre-condition *) + Have: (0 <= m) /\ (0 <= n). + (* Invariant 'PI' *) + Have: forall i_4,i_3 : Z. ((0 <= i_3) -> ((i_3 < m) -> ((0 <= i_4) -> + ((i_4 < i_2) -> + (Mint_0[shift_sint32(p, i_4)] < Mint_0[shift_sint32(q, i_3)]))))). + (* Invariant 'I' *) + Have: (0 <= i_2) /\ (i_2 <= n). + (* Then *) + Have: i_2 < n. + (* Invariant 'PJ' *) + Have: forall i_3 : Z. ((0 <= i_3) -> ((i_3 < j) -> + (Mint_0[shift_sint32(p, i_2)] < Mint_0[shift_sint32(q, i_3)]))). + (* Invariant 'J' *) + Have: (0 <= j) /\ (j <= m). + (* Else *) + Have: m <= j. +} +Prove: Mint_0[shift_sint32(p, i)] < Mint_0[shift_sint32(q, i_1)]. + +------------------------------------------------------------ + +Goal Establishment of Invariant 'PI' (file tests/wp_plugin/prenex.i, line 21): +Prove: true. + +------------------------------------------------------------ + +Goal Preservation of Invariant 'J' (file tests/wp_plugin/prenex.i, line 28): +Let x = Mint_0[shift_sint32(p, i)]. +Let x_1 = Mint_0[shift_sint32(q, j)]. +Assume { + Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(m) /\ is_sint32(n) /\ + is_sint32(1 + j) /\ is_sint32(x) /\ is_sint32(x_1). + (* Heap *) + Have: (region(p.base) <= 0) /\ (region(q.base) <= 0). + (* Pre-condition *) + Have: (0 <= m) /\ (0 <= n). + (* Invariant 'PI' *) + Have: forall i_2,i_1 : Z. ((0 <= i_1) -> ((i_1 < m) -> ((0 <= i_2) -> + ((i_2 < i) -> + (Mint_0[shift_sint32(p, i_2)] < Mint_0[shift_sint32(q, i_1)]))))). + (* Invariant 'I' *) + Have: (0 <= i) /\ (i <= n). + (* Then *) + Have: i < n. + (* Invariant 'PJ' *) + Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 < j) -> + (x < Mint_0[shift_sint32(q, i_1)]))). + (* Invariant 'J' *) + Have: (0 <= j) /\ (j <= m). + (* Then *) + Have: j < m. + (* Else *) + Have: x < x_1. +} +Prove: (-1) <= j. + +------------------------------------------------------------ + +Goal Establishment of Invariant 'J' (file tests/wp_plugin/prenex.i, line 28): +Prove: true. + +------------------------------------------------------------ + +Goal Preservation of Invariant 'PJ' (file tests/wp_plugin/prenex.i, line 30): +Let x = Mint_0[shift_sint32(p, i)]. +Let x_1 = Mint_0[shift_sint32(q, j)]. +Assume { + Type: is_sint32(i) /\ is_sint32(j) /\ is_sint32(m) /\ is_sint32(n) /\ + is_sint32(1 + j) /\ is_sint32(x) /\ is_sint32(x_1). + (* Goal *) + When: (0 <= i_1) /\ (i_1 <= j). + (* Heap *) + Have: (region(p.base) <= 0) /\ (region(q.base) <= 0). + (* Pre-condition *) + Have: (0 <= m) /\ (0 <= n). + (* Invariant 'PI' *) + Have: forall i_3,i_2 : Z. ((0 <= i_2) -> ((i_2 < m) -> ((0 <= i_3) -> + ((i_3 < i) -> + (Mint_0[shift_sint32(p, i_3)] < Mint_0[shift_sint32(q, i_2)]))))). + (* Invariant 'I' *) + Have: (0 <= i) /\ (i <= n). + (* Then *) + Have: i < n. + (* Invariant 'PJ' *) + Have: forall i_2 : Z. ((0 <= i_2) -> ((i_2 < j) -> + (x < Mint_0[shift_sint32(q, i_2)]))). + (* Invariant 'J' *) + Have: (0 <= j) /\ (j <= m). + (* Then *) + Have: j < m. + (* Else *) + Have: x < x_1. +} +Prove: x < Mint_0[shift_sint32(q, i_1)]. + +------------------------------------------------------------ + +Goal Establishment of Invariant 'PJ' (file tests/wp_plugin/prenex.i, line 30): +Prove: true. + +------------------------------------------------------------ + +Goal Loop assigns (file tests/wp_plugin/prenex.i, line 24) (1/2): +Prove: true. + +------------------------------------------------------------ + +Goal Loop assigns (file tests/wp_plugin/prenex.i, line 24) (2/2): +Effect at line 34 +Prove: true. + +------------------------------------------------------------ + +Goal Loop assigns (file tests/wp_plugin/prenex.i, line 32): +Prove: true. + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle/repeat.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/repeat.res.oracle index 973fff464e401991df2605737c54bf27ad72004e..86f26f8609462749b639f62f22c7b8ef80af90c3 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/repeat.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/repeat.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/repeat.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -15,8 +14,7 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_plugin/repeat.c, line 61): -Let a = L_sequence(calls_2). -Let a_1 = L_sequence(calls_1). +Let a = L_sequence(calls_1). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(1 + i). (* Pre-condition *) @@ -24,15 +22,15 @@ Assume { (* Pre-condition *) Have: L_sequence(calls_0) = nil. (* Invariant *) - Have: ([ 1, 2 ] *^ i) = a_1. + Have: ([ 1, 2 ] *^ i) = a. (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Then *) Have: i < n. (* Call 'f' *) - Have: a = a_1 ^ [ 1 ]. + Have: L_sequence(calls_2) = a ^ [ 1 ]. (* Call 'g' *) - Have: L_sequence(calls_3) = a ^ [ 2 ]. + Have: L_sequence(calls_3) = a ^ [ 1, 2 ]. } Prove: (-1) <= i. @@ -45,9 +43,8 @@ Prove: true. Goal Preservation of Invariant (file tests/wp_plugin/repeat.c, line 62): Let a = L_sequence(calls_0). -Let a_1 = L_sequence(calls_3). -Let a_2 = L_sequence(calls_2). -Let a_3 = [ 1, 2 ]. +Let a_1 = a ^ [ 1, 2 ]. +Let a_2 = [ 1, 2 ]. Let x = 1 + i. Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x). @@ -56,17 +53,17 @@ Assume { (* Pre-condition *) Have: L_sequence(calls_1) = nil. (* Invariant *) - Have: (a_3 *^ i) = a_2. + Have: (a_2 *^ i) = a. (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Then *) Have: i < n. (* Call 'f' *) - Have: a_1 = a_2 ^ [ 1 ]. + Have: L_sequence(calls_2) = a ^ [ 1 ]. (* Call 'g' *) - Have: a = a_1 ^ [ 2 ]. + Have: L_sequence(calls_3) = a_1. } -Prove: (a_3 *^ x) = a. +Prove: (a_2 *^ x) = a_1. ------------------------------------------------------------ @@ -80,30 +77,18 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (1/3): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (2/3): -Effect at line 65 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (3/3): -Effect at line 65 +Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (1/2): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (1/2): +Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (2/2): Effect at line 65 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction' (2/2): +Goal Assigns (file tests/wp_plugin/repeat.c, line 56) in 'induction': Effect at line 65 Prove: true. @@ -131,33 +116,32 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition (file tests/wp_plugin/repeat.c, line 73) in 'shifted': -Let a = L_sequence(calls_0). -Let a_1 = L_sequence(calls_3). -Let a_2 = [ 1, 2 ]. +Let a = [ 1, 2 ]. +Let a_1 = (a *^ i). +Let a_2 = a_1 ^ [ 1, 2 ]. Assume { Type: is_sint32(i) /\ is_sint32(n). (* Pre-condition *) Have: 0 <= n. (* Pre-condition *) - Have: L_sequence(calls_1) = nil. + Have: L_sequence(calls_0) = nil. (* Call 'f' *) - Have: L_sequence(calls_2) = [ 1 ]. + Have: L_sequence(calls_1) = [ 1 ]. (* Invariant *) - Have: a_1 = (a_2 *^ i) ^ [ 1 ]. + Have: L_sequence(calls_2) = a_1 ^ [ 1 ]. (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Else *) Have: n <= i. (* Call 'g' *) - Have: a = a_1 ^ [ 2 ]. + Have: L_sequence(calls_3) = a_2. } -Prove: (a_2 *^ 1 + i) = a. +Prove: (a *^ 1 + i) = a_2. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_plugin/repeat.c, line 81): -Let a = L_sequence(calls_3). -Let a_1 = L_sequence(calls_2). +Let a = ([ 1, 2 ] *^ i). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(1 + i). (* Pre-condition *) @@ -167,15 +151,15 @@ Assume { (* Call 'f' *) Have: L_sequence(calls_1) = [ 1 ]. (* Invariant *) - Have: a_1 = ([ 1, 2 ] *^ i) ^ [ 1 ]. + Have: L_sequence(calls_2) = a ^ [ 1 ]. (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Then *) Have: i < n. (* Call 'g' *) - Have: a = a_1 ^ [ 2 ]. + Have: L_sequence(calls_3) = a ^ [ 1, 2 ]. (* Call 'f' *) - Have: L_sequence(calls_4) = a ^ [ 1 ]. + Have: L_sequence(calls_4) = a ^ [ 1, 2, 1 ]. } Prove: (-1) <= i. @@ -187,31 +171,30 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_plugin/repeat.c, line 82): -Let a = L_sequence(calls_0). -Let a_1 = L_sequence(calls_4). -Let a_2 = L_sequence(calls_3). -Let a_3 = [ 1, 2 ]. +Let a = [ 1, 2 ]. +Let a_1 = (a *^ i). +Let a_2 = a_1 ^ [ 1, 2 ]. Let x = 1 + i. Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x). (* Pre-condition *) Have: 0 <= n. (* Pre-condition *) - Have: L_sequence(calls_1) = nil. + Have: L_sequence(calls_0) = nil. (* Call 'f' *) - Have: L_sequence(calls_2) = [ 1 ]. + Have: L_sequence(calls_1) = [ 1 ]. (* Invariant *) - Have: a_2 = (a_3 *^ i) ^ [ 1 ]. + Have: L_sequence(calls_2) = a_1 ^ [ 1 ]. (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Then *) Have: i < n. (* Call 'g' *) - Have: a_1 = a_2 ^ [ 2 ]. + Have: L_sequence(calls_3) = a_2. (* Call 'f' *) - Have: a = a_1 ^ [ 1 ]. + Have: L_sequence(calls_4) = a_1 ^ [ 1, 2, 1 ]. } -Prove: a = (a_3 *^ x) ^ [ 1 ]. +Prove: (a *^ x) = a_2. ------------------------------------------------------------ @@ -225,35 +208,23 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (1/3): +Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (1/2): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (2/3): +Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (2/2): Effect at line 85 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (3/3): -Effect at line 85 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (1/3): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (2/3): -Effect at line 85 +Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (1/2): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (3/3): +Goal Assigns (file tests/wp_plugin/repeat.c, line 74) in 'shifted' (2/2): Effect at line 85 Prove: true. @@ -277,143 +248,131 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (1/12): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (2/12): -Effect at line 47 +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (1/11): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (3/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (2/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (4/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (3/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (5/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (4/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (6/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (5/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (7/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (6/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (8/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (7/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (9/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (8/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (10/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (9/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (11/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (10/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (12/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (11/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (1/12): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (2/12): -Effect at line 47 +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (1/11): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (3/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (2/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (4/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (3/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (5/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (4/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (6/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (5/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (7/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (6/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (8/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (7/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (9/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (8/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (10/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (9/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (11/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (10/11): Effect at line 47 Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (12/12): +Goal Assigns (file tests/wp_plugin/repeat.c, line 42) in 'unroll' (11/11): Effect at line 47 Prove: true. diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.0.res.oracle index 34499d2463e73d00d59ca47b52723e50ef0c2c4b..796c421906c4addf96323c739df2b829203de8c0 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -29,9 +28,9 @@ int job(int *p, int n) { int __retres; /*@ assert rte: mem_access: \valid(p); */ + /*@ assert rte: mem_access: \valid_read(p); */ /*@ assert rte: signed_overflow: -2147483648 <= *p + n; */ /*@ assert rte: signed_overflow: *p + n <= 2147483647; */ - /*@ assert rte: mem_access: \valid_read(p); */ *p += n; /*@ assert rte: mem_access: \valid_read(p); */ __retres = *p; diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.1.res.oracle index 34db4c45a18d8a2f67f02363892a5d94bbb6cdd8..abbf86035bf4bf9e338d44e5f1b672ddfb8ba76f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte -no-warn-signed-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.2.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.2.res.oracle index cf6cba4e8b14adb39333fa8a1adce4af5c372978..84199cb985ca31fdc7d55ee3e5b3a73a09589c61 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.2.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-rte -warn-unsigned-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -33,9 +32,9 @@ int job(int *p, int n) { int __retres; /*@ assert rte: mem_access: \valid(p); */ + /*@ assert rte: mem_access: \valid_read(p); */ /*@ assert rte: signed_overflow: -2147483648 <= *p + n; */ /*@ assert rte: signed_overflow: *p + n <= 2147483647; */ - /*@ assert rte: mem_access: \valid_read(p); */ *p += n; /*@ assert rte: mem_access: \valid_read(p); */ __retres = *p; diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.3.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.3.res.oracle index c1252e11e7a65629991aa9c2f0d754a1ecf309f7..22ad5e55a3ea39c3700eaedfdafe210ef3de07c7 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.3.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.3.res.oracle @@ -1,14 +1,13 @@ # frama-c -wp -wp-rte -wp-model 'Typed (Nat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' -[wp] warning: -wp-rte and model nat require kernel to warn against unsigned overflow -[wp] warning: -wp-rte and model nat require kernel to warn against signed downcast -[wp] warning: -wp-rte and model nat require kernel to warn against unsigned downcast [wp:rte] function job: generate rte for memory access [wp:rte] function job: generate rte for division by zero [wp:rte] function job: generate rte for signed overflow +[wp] warning: -wp-rte and model nat require kernel to warn against unsigned overflow +[wp] warning: -wp-rte and model nat require kernel to warn against signed downcast +[wp] warning: -wp-rte and model nat require kernel to warn against unsigned downcast [rte] annotating function job [wp:rte] function job2: generate rte for memory access [wp:rte] function job2: generate rte for division by zero @@ -32,9 +31,9 @@ int job(int *p, int n) { int __retres; /*@ assert rte: mem_access: \valid(p); */ + /*@ assert rte: mem_access: \valid_read(p); */ /*@ assert rte: signed_overflow: -2147483648 <= *p + n; */ /*@ assert rte: signed_overflow: *p + n <= 2147483647; */ - /*@ assert rte: mem_access: \valid_read(p); */ *p += n; /*@ assert rte: mem_access: \valid_read(p); */ __retres = *p; diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.4.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.4.res.oracle index decb83fa5855784374a02e786482be8fd33b46df..70479035c28a994c1ba9a13f3e74c53edbdfd378 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.4.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.4.res.oracle @@ -1,14 +1,13 @@ # frama-c -wp -wp-rte -wp-model 'Typed (Nat)' -warn-unsigned-overflow [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' -[wp] warning: -wp-rte and model nat require kernel to warn against signed downcast -[wp] warning: -wp-rte and model nat require kernel to warn against unsigned downcast [wp:rte] function job: generate rte for memory access [wp:rte] function job: generate rte for division by zero [wp:rte] function job: generate rte for signed overflow [wp:rte] function job: generate rte for unsigned overflow +[wp] warning: -wp-rte and model nat require kernel to warn against signed downcast +[wp] warning: -wp-rte and model nat require kernel to warn against unsigned downcast [rte] annotating function job [wp:rte] function job2: generate rte for memory access [wp:rte] function job2: generate rte for division by zero @@ -35,9 +34,9 @@ int job(int *p, int n) { int __retres; /*@ assert rte: mem_access: \valid(p); */ + /*@ assert rte: mem_access: \valid_read(p); */ /*@ assert rte: signed_overflow: -2147483648 <= *p + n; */ /*@ assert rte: signed_overflow: *p + n <= 2147483647; */ - /*@ assert rte: mem_access: \valid_read(p); */ *p += n; /*@ assert rte: mem_access: \valid_read(p); */ __retres = *p; diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.5.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.5.res.oracle index 1bf52a9450d7c70fde605a9afa46408a2d516fce..645ea53439b69176268d0bfc7801bb941e23bb43 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.5.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.5.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Nat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/rte.6.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/rte.6.res.oracle index d2b3bb47a6e26f0415cf4a7d5354f5ced1ed480e..2ce40bae2fc5a5e78719a397581def4fd7279b4b 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/rte.6.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/rte.6.res.oracle @@ -1,14 +1,13 @@ # frama-c -wp -wp-rte -wp-model 'Typed (Nat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' -[wp] warning: -wp-rte and model nat require kernel to warn against unsigned overflow -[wp] warning: -wp-rte and model nat require kernel to warn against signed downcast -[wp] warning: -wp-rte and model nat require kernel to warn against unsigned downcast [wp] warning: -wp-rte can annotate memory access because -rte-mem is not set [wp:rte] function job: generate rte for division by zero [wp:rte] function job: generate rte for signed overflow +[wp] warning: -wp-rte and model nat require kernel to warn against unsigned overflow +[wp] warning: -wp-rte and model nat require kernel to warn against signed downcast +[wp] warning: -wp-rte and model nat require kernel to warn against unsigned downcast [rte] annotating function job [wp:rte] function job2: generate rte for division by zero [wp:rte] function job2: generate rte for signed overflow diff --git a/src/plugins/wp/tests/wp_plugin/oracle/sep.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/sep.res.oracle index 81e799f780dd767126c3698ebab275754f8e1b5e..42414d056783dfd9640435a028d8bd3518d2db06 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/sep.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/sep.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/sep.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/sequence.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/sequence.res.oracle index 00883d7a0983aae03a48cdab7023fde3dedc3533..f7363a2f9f0ab35ac919255e8239af638e950941 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/sequence.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/sequence.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/sequence.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,44 +8,22 @@ ------------------------------------------------------------ Goal Post-condition 'ok,first' in 'loops': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ - is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Call 'f' *) - Have: a_2 = [ x ]. - (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ ([ y ] *^ i). - (* Invariant 'ok,id_max' *) - Have: if (0 <= n) then (i <= n) else (i <= 0). - (* Invariant 'ok,id_min' *) - Have: 0 <= i. - (* Else *) - Have: n <= i. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: nth(a, 0) = x. +Prove: true. ------------------------------------------------------------ Goal Post-condition 'ok,last' in 'loops': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). +Let a = ([ y ] *^ i). +Let a_1 = [ x ] ^ a ^ [ z ]. Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Call 'f' *) - Have: a_2 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = [ x ] ^ a. (* Invariant 'ok,id_max' *) Have: if (0 <= n) then (i <= n) else (i <= 0). (* Invariant 'ok,id_min' *) @@ -54,24 +31,23 @@ Assume { (* Else *) Have: n <= i. (* Call 'f' *) - Have: a = a_1 ^ [ z ]. + Have: L_call_obs(call_seq_3) = a_1. } -Prove: nth(a, length(a) - 1) = z. +Prove: nth(a_1, 1 + length(a)) = z. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,id_max' (file tests/wp_plugin/sequence.i, line 97): -Let a = L_call_obs(call_seq_2). -Let a_1 = L_call_obs(call_seq_1). +Let a = ([ y ] *^ i). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(1 + i). (* Pre-condition *) Have: L_call_obs(call_seq_0) = nil. (* Call 'f' *) - Have: a_1 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a = a_1 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = [ x ] ^ a. (* Invariant 'ok,id_max' *) Have: if (0 <= n) then (i <= n) else (i <= 0). (* Invariant 'ok,id_min' *) @@ -79,7 +55,7 @@ Assume { (* Then *) Have: i < n. (* Call 'g' *) - Have: L_call_obs(call_seq_3) = a ^ [ y ]. + Have: L_call_obs(call_seq_3) = [ x ] ^ a ^ [ y ]. } Prove: 0 <= n. @@ -91,17 +67,16 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,id_min' (file tests/wp_plugin/sequence.i, line 96): -Let a = L_call_obs(call_seq_2). -Let a_1 = L_call_obs(call_seq_1). +Let a = ([ y ] *^ i). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(1 + i). (* Pre-condition *) Have: L_call_obs(call_seq_0) = nil. (* Call 'f' *) - Have: a_1 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a = a_1 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = [ x ] ^ a. (* Invariant 'ok,id_max' *) Have: if (0 <= n) then (i <= n) else (i <= 0). (* Invariant 'ok,id_min' *) @@ -109,7 +84,7 @@ Assume { (* Then *) Have: i < n. (* Call 'g' *) - Have: L_call_obs(call_seq_3) = a ^ [ y ]. + Have: L_call_obs(call_seq_3) = [ x ] ^ a ^ [ y ]. } Prove: (-1) <= i. @@ -121,19 +96,17 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,inv' (file tests/wp_plugin/sequence.i, line 98): -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_1). +Let a = ([ y ] *^ i). Let x_1 = 1 + i. Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(x_1). (* Pre-condition *) - Have: L_call_obs(call_seq_2) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Call 'f' *) - Have: a_2 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = [ x ] ^ a. (* Invariant 'ok,id_max' *) Have: if (0 <= n) then (i <= n) else (i <= 0). (* Invariant 'ok,id_min' *) @@ -141,9 +114,9 @@ Assume { (* Then *) Have: i < n. (* Call 'g' *) - Have: a = a_1 ^ [ y ]. + Have: L_call_obs(call_seq_3) = [ x ] ^ a ^ [ y ]. } -Prove: a = a_2 ^ ([ y ] *^ x_1). +Prove: ([ y ] *^ x_1) = a ^ [ y ]. ------------------------------------------------------------ @@ -195,20 +168,18 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_called' 'ok,u1' in 'loops': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). +Let a = ([ y ] *^ i). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Pre-condition for 'g_called' *) Have: 0 < n. (* Call 'f' *) - Have: a_2 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = [ x ] ^ a. (* Invariant 'ok,id_max' *) Have: i <= n. (* Invariant 'ok,id_min' *) @@ -216,38 +187,14 @@ Assume { (* Else *) Have: n <= i. (* Call 'f' *) - Have: a = a_1 ^ [ z ]. + Have: L_call_obs(call_seq_3) = [ x ] ^ a ^ [ z ]. } -Prove: (2 + i) = length(a). +Prove: length(a) = i. ------------------------------------------------------------ Goal Post-condition for 'g_called' 'ok,u2' in 'loops': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). -Let a_3 = ([ y ] *^ i). -Assume { - Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ - is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Pre-condition for 'g_called' *) - Have: 0 < n. - (* Call 'f' *) - Have: a_2 = [ x ]. - (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ a_3. - (* Invariant 'ok,id_max' *) - Have: i <= n. - (* Invariant 'ok,id_min' *) - Have: 0 <= i. - (* Else *) - Have: n <= i. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: a = [ x ] ^ a_3 ^ [ z ]. +Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ @@ -255,20 +202,18 @@ Prove: a = [ x ] ^ a_3 ^ [ z ]. ------------------------------------------------------------ Goal Post-condition for 'g_not_called' 'ok,v1' in 'loops': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). +Let a = ([ y ] *^ i). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Pre-condition for 'g_not_called' *) Have: n <= 0. (* Call 'f' *) - Have: a_2 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = [ x ] ^ a. (* Invariant 'ok,id_max' *) Have: if (0 <= n) then (i <= n) else (i <= 0). (* Invariant 'ok,id_min' *) @@ -276,27 +221,26 @@ Assume { (* Else *) Have: n <= i. (* Call 'f' *) - Have: a = a_1 ^ [ z ]. + Have: L_call_obs(call_seq_3) = [ x ] ^ a ^ [ z ]. } -Prove: length(a) = 2. +Prove: length(a) = 0. ------------------------------------------------------------ Goal Post-condition for 'g_not_called' 'ok,v2' in 'loops': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). +Let a = ([ y ] *^ i). +Let a_1 = [ x ] ^ a. Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Pre-condition for 'g_not_called' *) Have: n <= 0. (* Call 'f' *) - Have: a_2 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Invariant 'ok,inv' *) - Have: a_1 = a_2 ^ ([ y ] *^ i). + Have: L_call_obs(call_seq_2) = a_1. (* Invariant 'ok,id_max' *) Have: if (0 <= n) then (i <= n) else (i <= 0). (* Invariant 'ok,id_min' *) @@ -304,9 +248,9 @@ Assume { (* Else *) Have: n <= i. (* Call 'f' *) - Have: a = a_1 ^ [ z ]. + Have: L_call_obs(call_seq_3) = [ x ] ^ a ^ [ z ]. } -Prove: a = [ x, z ]. +Prove: [ x ] = a_1. ------------------------------------------------------------ ------------------------------------------------------------ @@ -395,86 +339,35 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_called' 'ok,o1' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(c) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Pre-condition for 'g_called' *) - Have: c != 0. - (* Call 'f' *) - Have: a_2 = [ x ]. - (* Call 'g' *) - Have: a_1 = a_2 ^ [ y ]. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: length(a) = 3. +Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_called' 'ok,p1' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(c) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Pre-condition for 'g_called' *) - Have: c != 0. - (* Call 'f' *) - Have: a_2 = [ x ]. - (* Call 'g' *) - Have: a_1 = a_2 ^ [ y ]. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: a = [ x, y, z ]. +Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_called' 'ok,p2' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(c) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Pre-condition for 'g_called' *) - Have: c != 0. - (* Call 'f' *) - Have: a_2 = [ x ]. - (* Call 'g' *) - Have: a_1 = a_2 ^ [ y ]. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: a = [ x, y, z ]. +Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_called' 'ok,p3' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_3). -Let a_2 = L_call_obs(call_seq_2). Assume { Type: is_sint32(c) /\ is_sint32(x) /\ is_sint32(y) /\ is_sint32(z). (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Pre-condition for 'g_called' *) Have: c != 0. (* Call 'f' *) - Have: a_2 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Call 'g' *) - Have: a_1 = a_2 ^ [ y ]. + Have: L_call_obs(call_seq_2) = [ x, y ]. (* Call 'f' *) - Have: a = a_1 ^ [ z ]. + Have: L_call_obs(call_seq_3) = [ x, y, z ]. } -Prove: a = [ x, y, z ] ^ L_call_nil. +Prove: L_call_nil = nil. ------------------------------------------------------------ ------------------------------------------------------------ @@ -482,65 +375,30 @@ Prove: a = [ x, y, z ] ^ L_call_nil. ------------------------------------------------------------ Goal Post-condition for 'g_not_called' 'ok,o2' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(x) /\ is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Call 'f' *) - Have: a_1 = [ x ]. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: length(a) = 2. +Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_not_called' 'ok,q1' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(x) /\ is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Call 'f' *) - Have: a_1 = [ x ]. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: a = [ x, z ]. +Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_not_called' 'ok,q2' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_2). -Assume { - Type: is_sint32(x) /\ is_sint32(z). - (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. - (* Call 'f' *) - Have: a_1 = [ x ]. - (* Call 'f' *) - Have: a = a_1 ^ [ z ]. -} -Prove: a = [ x, z ]. +Prove: true. ------------------------------------------------------------ Goal Post-condition for 'g_not_called' 'ok,q3' in 'sequence': -Let a = L_call_obs(call_seq_0). -Let a_1 = L_call_obs(call_seq_2). Assume { Type: is_sint32(x) /\ is_sint32(z). (* Pre-condition *) - Have: L_call_obs(call_seq_1) = nil. + Have: L_call_obs(call_seq_0) = nil. (* Call 'f' *) - Have: a_1 = [ x ]. + Have: L_call_obs(call_seq_1) = [ x ]. (* Call 'f' *) - Have: a = a_1 ^ [ z ]. + Have: L_call_obs(call_seq_2) = [ x, z ]. } -Prove: a = [ x ] ^ L_call_nil ^ [ z ]. +Prove: [ x ] = [ x ] ^ L_call_nil. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_array.1.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/stmt.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_hoare/oracle/reference_array.1.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/stmt.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle/stmt.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/stmt.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..97e0b4fb5469bc9b46751fa7a49c8769e339cd53 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle/stmt.res.oracle @@ -0,0 +1,142 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/stmt.c (with preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] [CFG] Goal f_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_assign : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_post : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_assign : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_post : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_exit : Valid (Unreachable) +[wp] warning: Missing RTE guards +------------------------------------------------------------ + Function f +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_plugin/stmt.c, line 10) in 'f': +Prove: true. + +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_plugin/stmt.c, line 11) in 'f': +Prove: true. + +------------------------------------------------------------ + +Goal Assertion (file tests/wp_plugin/stmt.c, line 16): +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function f with behavior default_for_stmt_2 +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_plugin/stmt.c, line 17) at block: +Prove: true. + +------------------------------------------------------------ + +Goal Assigns (file tests/wp_plugin/stmt.c, line 21) at block: +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function g +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_plugin/stmt.c, line 27) in 'g': +Prove: true. + +------------------------------------------------------------ + +Goal Assertion (file tests/wp_plugin/stmt.c, line 32): +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function h +------------------------------------------------------------ + +Goal Post-condition (file tests/wp_plugin/stmt.c, line 40) in 'h': +Prove: true. + +------------------------------------------------------------ + +Goal Assertion (generated): +Prove: true. + +------------------------------------------------------------ + +Goal Assertion (generated): +Prove: true. + +------------------------------------------------------------ +[report] Computing properties status... + +-------------------------------------------------------------------------------- +--- Properties of Function 'f' +-------------------------------------------------------------------------------- + +[ Valid ] Exit-condition (file tests/wp_plugin/stmt.c, line 15) at block + by Unreachable Annotations. +[ Partial ] Return-condition (file tests/wp_plugin/stmt.c, line 16) at block + By Frama-C kernel, with pending: + - Assertion (file tests/wp_plugin/stmt.c, line 16) +[ - ] Default behavior at block + tried with Frama-C kernel. + +-------------------------------------------------------------------------------- +--- Properties of Function 'g' +-------------------------------------------------------------------------------- + +[ Valid ] Exit-condition (file tests/wp_plugin/stmt.c, line 31) at block + by Unreachable Annotations. +[ Valid ] Return-condition (file tests/wp_plugin/stmt.c, line 32) at block + by Unreachable Annotations. +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 33) at block + by Unreachable Annotations. +[ Valid ] Assigns (file tests/wp_plugin/stmt.c, line 36) at block + by Unreachable Annotations. +[ Valid ] Default behavior at block + by Frama-C kernel. + +-------------------------------------------------------------------------------- +--- Properties of Function 'h' +-------------------------------------------------------------------------------- + +[ Valid ] Exit-condition (file tests/wp_plugin/stmt.c, line 43) at block + by Unreachable Annotations. +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 44) at block + by Unreachable Annotations. +[ Partial ] Return-condition for 'POS' (file tests/wp_plugin/stmt.c, line 48) at block + By Frama-C kernel, with pending: + - Assertion (generated) + - Assertion (generated) +[ Partial ] Return-condition for 'NEG' (file tests/wp_plugin/stmt.c, line 51) at block + By Frama-C kernel, with pending: + - Assertion (generated) + - Assertion (generated) +[ Valid ] Assigns (file tests/wp_plugin/stmt.c, line 53) at block + by Unreachable Annotations. +[ Partial ] Behavior 'NEG' at block + By Frama-C kernel, with pending: + - Assertion (generated) + - Assertion (generated) +[ Partial ] Behavior 'POS' at block + By Frama-C kernel, with pending: + - Assertion (generated) + - Assertion (generated) +[ Valid ] Default behavior at block + by Frama-C kernel. + +-------------------------------------------------------------------------------- +--- Status Report Summary +-------------------------------------------------------------------------------- + 10 Completely validated + 5 Locally validated + 1 To be validated + 16 Total +-------------------------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle/struct.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/struct.res.oracle index b545ed1e9f64caae71511e6e512718049d47ab9d..2304c67387d5e3e20b1606488e53746c9324efe0 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/struct.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/struct.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/struct.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/subset.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/subset.res.oracle index e9ffdcdf41c5ab9ba76ae310a9ac421a85cb02ea..da6e60965b775a16a463f9bb130a0282376a2ea0 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/subset.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/subset.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/subset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/subset_fopen.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/subset_fopen.res.oracle index fb05daa19b2b4d44218f130d3a59b3bf2deea8da..f5f3402480acedecae334c9bf3ebdeada6b96b50 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/subset_fopen.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/subset_fopen.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/subset_fopen.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -39,9 +38,7 @@ Assume { (* Assertion 'Ok_A' *) Have: (0 <= i) /\ (i <= 9). (* Call 'fopen' *) - Have: included(p, 2, - shift___fc_FILE(shift_A512___fc_FILE(global(G___fc_fopen_68), 0), - 0), 1024). + Have: included(p, 2, shift___fc_FILE(global(G___fc_fopen_21), 0), 1024). } Prove: valid_rw(Malloc_0, p, 2). diff --git a/src/plugins/wp/tests/wp_plugin/oracle/trig.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/trig.res.oracle index 727829cc52ef2005b121d50e691603a15e681d42..3eaafbeb1dac68360d07acef2fab6855682cf8fd 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/trig.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/trig.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/trig.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -64,7 +63,7 @@ Prove: a_5 = a_4. ------------------------------------------------------------ -Goal Instance of 'Pre-condition 'qed_ok' in 'fconcat'' in 'foo' at call 'fconcat' (file tests/wp_plugin/trig.i, line 38) +Goal Instance of 'Pre-condition 'qed_ok' in 'fconcat'' in 'foo' at initialization of 'c' (file tests/wp_plugin/trig.i, line 38) : Prove: true. diff --git a/src/plugins/wp/tests/wp_plugin/oracle/unroll.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/unroll.res.oracle index 582950dd771c176526d48b02073a0923431a0807..286b645013ce3c4ff905ea669e34b637cb596985 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/unroll.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/unroll.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/unroll.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.0.res.oracle index 2cf8574944bf9226d5a6c681e90c124e9f00a9e3..c1e9683f11300a04b3a08f3b11e7ef72b45e0f23 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/unsafe-arrays.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.1.res.oracle index 3a60b1821e31b29959cf6b2d74ffe825475f3a58..3b115d94e1682d1bf555d9047da1608a897f7ce5 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/unsafe-arrays.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.res.oracle deleted file mode 100644 index bd4de810fd4f1381b25aba7d6069f67fc10aacf3..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.res.oracle +++ /dev/null @@ -1,31 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_plugin/unsafe-arrays.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Post-condition 'ARRAYS' in 'f': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'STRUCT' in 'f': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'INDIRP' in 'f': -Assume { - (* Heap *) - Have: linked(Malloc_0) /\ (region(p.base) <= 0). - (* Pre-condition *) - Have: valid_rw(Malloc_0, p, 10). -} -Prove: valid_rw(Malloc_0, shift_sint32(shiftfield_F1_f(p), 0), 10). - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle/unsupported_init.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/unsupported_init.res.oracle index 5530eab5980ddb59893c2ea4176fc0a09c7f8ec4..5fc19bcc9273db5b6a134c9c06f20b55059d285e 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/unsupported_init.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/unsupported_init.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/unsupported_init.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.1.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/volatile.0.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_hoare/oracle/reference_array_simple.1.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/volatile.0.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle/volatile.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/volatile.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..6bd551af610631aaa0a600e3f48b09e12cab27fb --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle/volatile.0.res.oracle @@ -0,0 +1,43 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/volatile.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +------------------------------------------------------------ + Function job_assigns +------------------------------------------------------------ + +Goal Assertion 'KO_WHEN_VOLATILE' (file tests/wp_plugin/volatile.i, line 15): +Prove: w = 0. + +------------------------------------------------------------ +------------------------------------------------------------ + Function job_read +------------------------------------------------------------ + +Goal Assertion 'KO_WHEN_VOLATILE' (file tests/wp_plugin/volatile.i, line 21): +Assume { Type: is_sint32(x). } +Prove: x = w. + +------------------------------------------------------------ +------------------------------------------------------------ + Function job_struct +------------------------------------------------------------ + +Goal Assertion 'ok,dead_code' (file tests/wp_plugin/volatile.i, line 29): +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function job_struct_assigns +------------------------------------------------------------ + +Goal Assertion 'KO_WHEN_VOLATILE' (file tests/wp_plugin/volatile.i, line 35): +Assume { + (* Heap *) + Have: region(p.base) <= 0. + Have: havoc(Mint_0, Mint_1, p, 2). +} +Prove: EqS1_st_v(w, w_1). + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/volatile.1.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_plugin/oracle/unsafe-arrays.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/volatile.1.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle/volatile.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/volatile.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..dfa6241f67cd89be0542b1083c5c251934f5eac2 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle/volatile.1.res.oracle @@ -0,0 +1,65 @@ +# frama-c -wp -wp-no-volatile [...] +[kernel] Parsing tests/wp_plugin/volatile.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +tests/wp_plugin/volatile.i:15:[wp] warning: unsafe volatile access to (term) l-value +tests/wp_plugin/volatile.i:14:[wp] warning: unsafe write-access to volatile l-value +tests/wp_plugin/volatile.i:21:[wp] warning: unsafe volatile access to (term) l-value +tests/wp_plugin/volatile.i:20:[wp] warning: unsafe read-access to volatile l-value +tests/wp_plugin/volatile.i:35:[wp] warning: unsafe volatile access to (term) l-value +tests/wp_plugin/volatile.i:35:[wp] warning: unsafe volatile access to (term) l-value +tests/wp_plugin/volatile.i:34:[wp] warning: unsafe write-access to volatile l-value +------------------------------------------------------------ + Function job_assigns +------------------------------------------------------------ + +Goal Assertion 'KO_WHEN_VOLATILE' (file tests/wp_plugin/volatile.i, line 15): +tests/wp_plugin/volatile.i:14: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe write-access to volatile l-value +tests/wp_plugin/volatile.i:15: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe volatile access to (term) l-value +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function job_read +------------------------------------------------------------ + +Goal Assertion 'KO_WHEN_VOLATILE' (file tests/wp_plugin/volatile.i, line 21): +tests/wp_plugin/volatile.i:20: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe read-access to volatile l-value +tests/wp_plugin/volatile.i:21: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe volatile access to (term) l-value +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function job_struct +------------------------------------------------------------ + +Goal Assertion 'ok,dead_code' (file tests/wp_plugin/volatile.i, line 29): +Prove: true. + +------------------------------------------------------------ +------------------------------------------------------------ + Function job_struct_assigns +------------------------------------------------------------ + +Goal Assertion 'KO_WHEN_VOLATILE' (file tests/wp_plugin/volatile.i, line 35): +tests/wp_plugin/volatile.i:34: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe write-access to volatile l-value +tests/wp_plugin/volatile.i:35: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe volatile access to (term) l-value +tests/wp_plugin/volatile.i:35: warning from wp: + - Warning: ignore volatile attribute + Reason: unsafe volatile access to (term) l-value +Prove: true. + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/combined.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle/volatile.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_plugin/oracle_qualif/combined.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle/volatile.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle/volatile.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/volatile.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..bc8d6844b2f899cd8e9f51a3c7adc9d571c69b09 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle/volatile.res.oracle @@ -0,0 +1,27 @@ +# frama-c -wp [...] +[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) +[kernel] Parsing tests/wp_plugin/volatile.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +tests/wp_plugin/volatile.i:10:[wp] warning: read-access to volatile l-value +tests/wp_plugin/volatile.i:9:[wp] warning: write-access to volatile l-value +------------------------------------------------------------ + Function job +------------------------------------------------------------ + +Goal Assertion 'KO' (file tests/wp_plugin/volatile.i, line 10): +tests/wp_plugin/volatile.i:9: warning from wp: + - Warning: Skip assignment + Reason: write-access to volatile l-value +tests/wp_plugin/volatile.i:10: warning from wp: + - Warning: Hide sub-term definition + Reason: read-access to volatile l-value +Assume { + (* Then *) + Warning[wp]: read-access to volatile l-value (Hide sub-term definition). + Have: 0 != w. +} +Prove: false. + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.0.res.oracle index 0db620b3473256f4c12740c8723087e36dece71f..e94becddb5b43007fbac128d7effa14f27df2033 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/abs.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.1.res.oracle index d432c7e6483289e09a229a8d5440ce3750e85fc5..f18a02e42b3f788c5a615cb6129b5d9e72f64e7f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/abs.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.2.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.2.res.oracle index 8c2d0d0b684f69f1f1591825b624eeadbd482f2c..cf33aa22ba73ba8e22773d6db8d2ba4dbe8e10f5 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.2.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/abs.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/abs.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/asm.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/asm.res.oracle index f4cbb22acd20c772c0dbeeb60d577c73819f3d17..d8af8a56475738449e054783a3aeff69225ec4b0 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/asm.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/asm.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/asm.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/combined.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/combined.res.oracle deleted file mode 100644 index 4b5a7f8b7a83ca46f408a2155f8bd5dfe1159012..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/combined.res.oracle +++ /dev/null @@ -1,164 +0,0 @@ -[kernel] preprocessing with "gcc -C -E -I. tests/wp_plugin/combined.c" -[kernel] warning: ignoring status of axiomatic `A' -[wp] warning: Missing RTE guards -[wp] warning: Assuming contracts of external functions -[wp] [WP:simplified] Goal store_job_loop_assigns_4 : Valid -[wp] [WP:simplified] Goal store_job_loop_assigns_13 : Valid -[wp] [WP:simplified] Goal store_job_loop_inv_2_established : Valid -[wp] [Alt-Ergo] Goal store_job_assert_7 : Valid -[wp] [Alt-Ergo] Goal store_job_loop_inv_5_established : Valid -[wp] [Alt-Ergo] Goal store_job_loop_inv_5_preserved : Valid -[wp] [Alt-Ergo] Goal store_job_loop_inv_3_established : Valid -[wp] [Alt-Ergo] Goal store_job_loop_inv_3_preserved : Valid -[wp] [Alt-Ergo] Goal store_job_loop_inv_2_preserved : Valid -[wp] [Alt-Ergo] Goal store_job_assert_1 : Unknown -[report] Computing properties status... ------------------------------------------------------------- - Global Properties ------------------------------------------------------------- - -[ Valid ] Loop Invariants (sid:13) -[ Valid ] Loop Invariants (sid:4) - ------------------------------------------------------------- - Properties for Function 'f' ------------------------------------------------------------- - -[ Unverifiable, considered valid ] ensures P(\result) -[ Unverifiable, considered valid ] assigns \nothing; -[ Unknown ] behavior default! of function f - ------------------------------------------------------------- - Properties for Function 'g' ------------------------------------------------------------- - -[ Unverifiable, considered valid ] assigns \nothing; -[ Unknown ] behavior default! of function g - ------------------------------------------------------------- - Properties for Function 'job' ------------------------------------------------------------- - -[ Partial ] assigns i, *(t+(0..49)); -[ Partial ] assigns j, *(t+(A..99)); -[ Unknown ] assert 50 ≤ A ∧ A ≤ 100; -[ Valid ] loop invariant 0 ≤ i ∧ i ≤ 50; -[ Partial ] loop invariant ∀ ℤ k; 0 ≤ k ∧ k < i ⇒ P(*(t+k)); -[ Partial ] loop invariant A ≤ j ∧ j ≤ 100; -[ Partial ] assert ∀ ℤ k; 0 ≤ k ∧ k < 50 ⇒ P(*(t+k)); - ------------------------------------------------------------- - No proofs : 3 - Unverifiable : 3 - Partial proofs : 5 - Complete proofs : 3 - Total : 14 ------------------------------------------------------------- -[value] Analyzing a complete application starting at main -[value] Computing initial state -[value] Initial state computed -[value] Values of globals at initialization - T[0..99] ∈ {0} -[value] computing for function job <- main. - Called from tests/wp_plugin/combined.c:42. -tests/wp_plugin/combined.c:22:[value] Assertion got status valid. -tests/wp_plugin/combined.c:28:[value] entering loop for the first time -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -tests/wp_plugin/combined.c:13:[value] Function f: postcondition got status unknown -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -tests/wp_plugin/combined.c:28:[value] assigning non deterministic value for the first time -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -[value] computing for function f <- job <- main. - Called from tests/wp_plugin/combined.c:28. -[value] Done for function f -tests/wp_plugin/combined.c:33:[value] entering loop for the first time -[value] computing for function g <- job <- main. - Called from tests/wp_plugin/combined.c:33. -[value] Done for function g -[value] computing for function g <- job <- main. - Called from tests/wp_plugin/combined.c:33. -[value] Done for function g -[value] computing for function g <- job <- main. - Called from tests/wp_plugin/combined.c:33. -[value] Done for function g -[value] computing for function g <- job <- main. - Called from tests/wp_plugin/combined.c:33. -[value] Done for function g -[value] computing for function g <- job <- main. - Called from tests/wp_plugin/combined.c:33. -[value] Done for function g -tests/wp_plugin/combined.c:35:[value] Assertion got status unknown. -[value] Recording results for job -[value] Done for function job -[value] Recording results for main -[value] done for function main -[from] Computing for function f -[from] Done for function f -[from] Computing for function g -[from] Done for function g -[scope] warning: [get_annot_zone] don't know how to compute zone: skip this annotation -[report] Computing properties status... ------------------------------------------------------------- - Global Properties ------------------------------------------------------------- - -[ Unverifiable, considered valid ] Function 'f' is consistent with Store-LogicVar -[ Unverifiable, considered valid ] Function 'g' is consistent with Store-LogicVar -[ Valid ] Loop Invariants (sid:13) -[ Valid ] Loop Invariants (sid:4) - ------------------------------------------------------------- - Properties for Function 'f' ------------------------------------------------------------- - -[ Unverifiable, considered valid ] ensures P(\result) -[ Unverifiable, considered valid ] assigns \nothing; -[ Unknown ] behavior default! of function f - ------------------------------------------------------------- - Properties for Function 'g' ------------------------------------------------------------- - -[ Unverifiable, considered valid ] assigns \nothing; -[ Unknown ] behavior default! of function g - ------------------------------------------------------------- - Properties for Function 'job' ------------------------------------------------------------- - -[ Valid ] assigns i, *(t+(0..49)); -[ Valid ] assigns j, *(t+(A..99)); -[ Valid ] assert 50 ≤ A ∧ A ≤ 100; -[ Valid ] loop invariant 0 ≤ i ∧ i ≤ 50; -[ Valid ] loop invariant ∀ ℤ k; 0 ≤ k ∧ k < i ⇒ P(*(t+k)); -[ Valid ] loop invariant A ≤ j ∧ j ≤ 100; -[ Valid ] assert ∀ ℤ k; 0 ≤ k ∧ k < 50 ⇒ P(*(t+k)); - ------------------------------------------------------------- - No proofs : 2 - Unverifiable : 5 - Partial proofs : 0 - Complete proofs : 9 - Total : 16 ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/copy.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/copy.res.oracle index 0d6bfcb89dcb9e15e763f06253eeb7f2fe5aff22..e70eb5027dc908942dc86c69b95c00024995ec7e 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/copy.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/copy.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/copy.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 12 goals scheduled +[wp] 11 goals scheduled [wp] [Alt-Ergo] Goal typed_copy_post : Valid [wp] [Alt-Ergo] Goal typed_copy_loop_inv_Copy_preserved : Valid [wp] [Qed] Goal typed_copy_loop_inv_Copy_established : Valid @@ -15,12 +14,11 @@ [wp] [Qed] Goal typed_copy_loop_assign_part1 : Valid [wp] [Alt-Ergo] Goal typed_copy_loop_assign_part2 : Valid [wp] [Alt-Ergo] Goal typed_copy_loop_assign_part3 : Valid -[wp] [Qed] Goal typed_copy_assign_part1 : Valid -[wp] [Alt-Ergo] Goal typed_copy_assign_part2 : Valid -[wp] Proved goals: 12 / 12 - Qed: 4 +[wp] [Alt-Ergo] Goal typed_copy_assign : Valid +[wp] Proved goals: 11 / 11 + Qed: 3 Alt-Ergo: 8 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -copy 4 8 (315) 12 100% +copy 3 8 (315) 11 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/dynamic.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/dynamic.res.oracle index 9e175c243f9e7787332113c7e89ef6bf6a66aabd..8e95d268a4977a5d30127e2e2262a3501b4187cd 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/dynamic.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/dynamic.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/dynamic.i (no preprocessing) [wp] Running WP plugin... [wp] Computing dynamic calls. diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/f.dot b/src/plugins/wp/tests/wp_plugin/oracle_qualif/f.dot new file mode 100644 index 0000000000000000000000000000000000000000..fa60d26f26a8f5dc3dcb72c368ed9e49c38438d5 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/f.dot @@ -0,0 +1,89 @@ +digraph f { + rankdir = TB ; + node [ style = filled, shape = box ] ; + N000 [ color = red, shape = circle, label = "*" ] ; + N071 [ color=red , label="Prove f_post" ] ; + N071 -> N000 [ style=dotted ] ; + N072 [ color=red , label="Prove f_post_2" ] ; + N072 -> N071 [ style=dotted ] ; + N073 [ label="" , shape=circle ] ; + N073 -> N072 ; + N073 -> N071 ; + N074 [ color=lightblue , label="F-out { a b }" ] ; + N074 -> N073 ; + N075 [ label="Label \post" ] ; + N075 -> N074 ; + N076 [ color=lightblue , label="B-out { __retres }" ] ; + N076 -> N075 ; + N077 [ color=orange , label="Return __retres" ] ; + N077 -> N076 ; + N078 [ color=lightblue , label="B-out { }" ] ; + N078 -> N077 ; + N079 [ color=lightblue , label="B-out { }" ] ; + N079 -> N078 ; + N080 [ color=lightblue , label="B-out { }" ] ; + N080 -> N079 ; + N081 [ label="Label Stmt 'wp!stmt_27'" ] ; + N081 -> N080 ; + N082 [ label="Label Stmt 'wp!stmt_26'" ] ; + N082 -> N081 ; + N083 [ color=green , label="Assume f_assert" ] ; + N083 -> N082 ; + N084 [ color=red , label="Prove f_assert" ] ; + N084 -> N083 [ style=dotted ] ; + N085 [ label="" , shape=circle ] ; + N085 -> N084 ; + N085 -> N083 ; + N086 [ label="Label Stmt 'wp!stmt_25'" ] ; + N086 -> N085 ; + N087 [ color=orange , label="__retres := a + b" ] ; + N087 -> N086 ; + N088 [ label="Label Stmt 'wp!stmt_6'" ] ; + N088 -> N087 ; + N089 [ color=lightblue , label="B-in { }" ] ; + N089 -> N088 ; + N090 [ label="Label Stmt 'wp!stmt_24'" ] ; + N090 -> N089 ; + N091 [ color=lightblue , label="B-in { }" ] ; + N091 -> N090 ; + N092 [ color=orange , label="Return __retres" ] ; + N092 -> N076 ; + N093 [ label="Label Stmt 'wp!stmt_27'" ] ; + N093 -> N092 ; + N094 [ color=orange , label="__retres := -1" ] ; + N094 -> N093 ; + N095 [ label="Label Stmt 'wp!stmt_8'" ] ; + N095 -> N094 ; + N096 [ color=green , label="Assume f_stmt_post" ] ; + N096 -> N095 ; + N097 [ color=orange , label="Havoc f_stmt_assign" ] ; + N097 -> N096 ; + N098 [ color=lightblue , label="B-in { }" ] ; + N098 -> N000 [ style=dotted ]; + N099 [ color=lightblue , label="B-out { }" ] ; + N099 -> N098 ; + N100 [ color=cyan , label="If a > 0" ] ; + N100 -> N091 ; + N100 -> N099 ; + N101 [ label="Label Stmt 'wp!stmt_4'" ] ; + N101 -> N100 ; + N102 [ color=lightblue , label="B-in { }" ] ; + N102 -> N101 ; + N103 [ label="" , shape=circle ] ; + N103 -> N097 ; + N103 -> N102 ; + N104 [ label="Label Stmt 'wp!stmt_2'" ] ; + N104 -> N103 ; + N105 [ color=lightblue , label="B-in { __retres }" ] ; + N105 -> N104 ; + N106 [ color=lightblue , label="F-frame { a b }" ] ; + N106 -> N105 ; + N107 [ label="Label \pre" ] ; + N107 -> N106 ; + N108 [ color=lightblue , label="F-in { a b }" ] ; + N108 -> N107 ; + N109 [ color=lightblue , label="Global { }" ] ; + N109 -> N108 ; + N110 [ color=cyan , label="Function f" ] ; + N110 -> N109 ; +} diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/f_default_for_stmt_2.dot b/src/plugins/wp/tests/wp_plugin/oracle_qualif/f_default_for_stmt_2.dot new file mode 100644 index 0000000000000000000000000000000000000000..b6c094fc18da592138ae72d7f0446da4480bd16d --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/f_default_for_stmt_2.dot @@ -0,0 +1,81 @@ +digraph f { + rankdir = TB ; + node [ style = filled, shape = box ] ; + N000 [ color = red, shape = circle, label = "*" ] ; + N111 [ color=lightblue , label="F-out { a b }" ] ; + N111 -> N000 [ style=dotted ]; + N112 [ label="Label \post" ] ; + N112 -> N111 ; + N113 [ color=lightblue , label="B-out { __retres }" ] ; + N113 -> N112 ; + N114 [ color=orange , label="Return __retres" ] ; + N114 -> N113 ; + N115 [ color=lightblue , label="B-out { }" ] ; + N115 -> N114 ; + N116 [ color=lightblue , label="B-out { }" ] ; + N116 -> N115 ; + N117 [ color=lightblue , label="B-out { }" ] ; + N117 -> N116 ; + N118 [ label="Label Stmt 'wp!stmt_27'" ] ; + N118 -> N117 ; + N119 [ label="Label Stmt 'wp!stmt_26'" ] ; + N119 -> N118 ; + N120 [ color=green , label="Assume f_assert" ] ; + N120 -> N119 ; + N121 [ label="Label Stmt 'wp!stmt_25'" ] ; + N121 -> N120 ; + N122 [ color=orange , label="__retres := a + b" ] ; + N122 -> N121 ; + N123 [ label="Label Stmt 'wp!stmt_6'" ] ; + N123 -> N122 ; + N124 [ color=lightblue , label="B-in { }" ] ; + N124 -> N123 ; + N125 [ label="Label Stmt 'wp!stmt_24'" ] ; + N125 -> N124 ; + N126 [ color=lightblue , label="B-in { }" ] ; + N126 -> N125 ; + N127 [ color=orange , label="Return __retres" ] ; + N127 -> N113 ; + N128 [ label="Label Stmt 'wp!stmt_27'" ] ; + N128 -> N127 ; + N129 [ color=orange , label="__retres := -1" ] ; + N129 -> N128 ; + N130 [ label="Label Stmt 'wp!stmt_8'" ] ; + N130 -> N129 ; + N131 [ color=green , label="Assume f_stmt_post" ] ; + N131 -> N130 ; + N132 [ color=red , label="Assigns f_stmt_assign" ] ; + N133 [ label="" , shape=circle ] ; + N133 -> N132 ; + N133 -> N131 ; + N134 [ color=red , label="Prove f_stmt_post" ] ; + N134 -> N133 [ style=dotted ] ; + N135 [ label="" , shape=circle ] ; + N135 -> N134 ; + N135 -> N133 ; + N136 [ color=lightblue , label="B-in { }" ] ; + N136 -> N135 ; + N137 [ color=lightblue , label="B-out { }" ] ; + N137 -> N136 ; + N138 [ color=cyan , label="If a > 0" ] ; + N138 -> N126 ; + N138 -> N137 ; + N139 [ label="Label Stmt 'wp!stmt_4'" ] ; + N139 -> N138 ; + N140 [ color=lightblue , label="B-in { }" ] ; + N140 -> N139 ; + N141 [ label="Label Stmt 'wp!stmt_2'" ] ; + N141 -> N140 ; + N142 [ color=lightblue , label="B-in { __retres }" ] ; + N142 -> N141 ; + N143 [ color=lightblue , label="F-frame { a b }" ] ; + N143 -> N142 ; + N144 [ label="Label \pre" ] ; + N144 -> N143 ; + N145 [ color=lightblue , label="F-in { a b }" ] ; + N145 -> N144 ; + N146 [ color=lightblue , label="Global { }" ] ; + N146 -> N145 ; + N147 [ color=cyan , label="Function f" ] ; + N147 -> N146 ; +} diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/frame.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/frame.res.oracle index 20b6c0d10698a8dda2812708318935a676ebf55d..f8c3dd02257d2cbf06dfadacfdfdf9bb87271aed 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/frame.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/frame.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/frame.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/g.dot b/src/plugins/wp/tests/wp_plugin/oracle_qualif/g.dot new file mode 100644 index 0000000000000000000000000000000000000000..357aa5d29638460059fd297cff98afe147984c94 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/g.dot @@ -0,0 +1,56 @@ +digraph g { + rankdir = TB ; + node [ style = filled, shape = box ] ; + N000 [ color = red, shape = circle, label = "*" ] ; + N046 [ color=red , label="Prove g_post" ] ; + N046 -> N000 [ style=dotted ] ; + N047 [ color=lightblue , label="F-out { a b }" ] ; + N047 -> N046 ; + N048 [ label="Label \post" ] ; + N048 -> N047 ; + N049 [ color=lightblue , label="B-out { __retres }" ] ; + N049 -> N048 ; + N050 [ color=orange , label="Return __retres" ] ; + N050 -> N049 ; + N051 [ color=lightblue , label="B-out { }" ] ; + N051 -> N050 ; + N052 [ color=lightblue , label="B-out { }" ] ; + N052 -> N051 ; + N053 [ label="Label Stmt 'wp!stmt_32'" ] ; + N053 -> N052 ; + N054 [ label="Label Stmt 'wp!stmt_31'" ] ; + N054 -> N053 ; + N055 [ color=green , label="Assume g_assert" ] ; + N055 -> N054 ; + N056 [ color=red , label="Prove g_assert" ] ; + N056 -> N055 [ style=dotted ] ; + N057 [ label="" , shape=circle ] ; + N057 -> N056 ; + N057 -> N055 ; + N058 [ label="Label Stmt 'wp!stmt_30'" ] ; + N058 -> N057 ; + N059 [ color=orange , label="__retres := a + b" ] ; + N059 -> N058 ; + N060 [ label="Label Stmt 'wp!stmt_13'" ] ; + N060 -> N059 ; + N061 [ color=lightblue , label="B-in { }" ] ; + N061 -> N060 ; + N062 [ label="Label Stmt 'wp!stmt_29'" ] ; + N062 -> N061 ; + N063 [ color=lightblue , label="B-in { }" ] ; + N063 -> N062 ; + N064 [ label="Label Stmt 'wp!stmt_11'" ] ; + N064 -> N063 ; + N065 [ color=lightblue , label="B-in { __retres }" ] ; + N065 -> N064 ; + N066 [ color=lightblue , label="F-frame { a b }" ] ; + N066 -> N065 ; + N067 [ label="Label \pre" ] ; + N067 -> N066 ; + N068 [ color=lightblue , label="F-in { a b }" ] ; + N068 -> N067 ; + N069 [ color=lightblue , label="Global { }" ] ; + N069 -> N068 ; + N070 [ color=cyan , label="Function g" ] ; + N070 -> N069 ; +} diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/g_default_for_stmt_11.dot b/src/plugins/wp/tests/wp_plugin/oracle_qualif/g_default_for_stmt_11.dot new file mode 100644 index 0000000000000000000000000000000000000000..9ba47a7e30c7e3bc7eb537a23ff108e065b57ce0 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/g_default_for_stmt_11.dot @@ -0,0 +1,5 @@ +digraph g { + rankdir = TB ; + node [ style = filled, shape = box ] ; + N000 [ color = red, shape = circle, label = "*" ] ; +} diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.1.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/inductive.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.1.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle_qualif/inductive.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/inductive.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/inductive.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e22c7db643fa92eba821e74c47171535fb300a7d --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/inductive.res.oracle @@ -0,0 +1,16 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/inductive.c (with preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] 2 goals scheduled +[wp] [Coq] Goal typed_lemma_offset : Saved script +[wp] [Coq] Goal typed_lemma_offset : Valid +[wp] [Coq] Goal typed_lemma_test : Saved script +[wp] [Coq] Goal typed_lemma_test : Valid +[wp] Proved goals: 2 / 2 + Qed: 0 + Coq: 2 +---------------------------------------------------------- +Axiomatics WP Alt-Ergo Total Success +Lemma - - 2 100% +---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const.res.oracle index 19fc71f7885eb4d52231d3e36b07b5412924a6f1..0be8669881cab2a33694cbf8292c70b86b762d34 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_const.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const_guard.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const_guard.res.oracle index 5f8214e436edec2fc9ce100443d53e3d56c4818b..98ce4ab816e7c5523069bd662d0bad6b451e3078 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const_guard.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_const_guard.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_const_guard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_extern.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_extern.res.oracle index 0ea85b9a3df68954dc846de2c34194fb1a8cf890..0b21207ec2dbb431c55a8e9a9e8e91bdec44779c 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_extern.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_extern.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_extern.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_linker.i (no preprocessing) [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_valid.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_valid.res.oracle index 97d56331bc2a164a0ac7df1cea89869334cc9f07..fa14c565bab17364d8093461e21b81339ab52215 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_valid.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/init_valid.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/init_valid.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/initarr.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/initarr.res.oracle index c3d3d416e0d2f6d1c892a863177565c89e663c54..89d95d15c2821b947f6d515b9b4816fe36c83521 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/initarr.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/initarr.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/initarr.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.0.res.oracle index 566ce4d50bd9e4e7cb89d6322e0c23cb4269d0f7..198b302d971be94bdb6cc1b95cd850c96441d3a6 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/injector.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.1.res.oracle index ba9cc5d908a95dc8f3b93b557511e127a7e68166..4954af64b5979cc91c3a2835d0502876e266b548 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/injector.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/injector.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/loop.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/loop.res.oracle index 1867575a42857f3c0af83bfa3e1450304749bb55..46b2ef06dce923387408cd7c741a6f1c5fbff633 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/loop.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/loop.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/loop.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 10 goals scheduled +[wp] 9 goals scheduled [wp] [Alt-Ergo] Goal typed_init_post_qed_ok : Valid [wp] [Alt-Ergo] Goal typed_init_loop_inv_qed_ok_preserved : Valid [wp] [Alt-Ergo] Goal typed_init_loop_inv_qed_ok_established : Valid @@ -13,12 +12,11 @@ [wp] [Qed] Goal typed_init_loop_assign_part1 : Valid [wp] [Alt-Ergo] Goal typed_init_loop_assign_part2 : Valid [wp] [Alt-Ergo] Goal typed_init_loop_assign_part3 : Valid -[wp] [Qed] Goal typed_init_assign_part1 : Valid -[wp] [Alt-Ergo] Goal typed_init_assign_part2 : Unknown -[wp] Proved goals: 9 / 10 - Qed: 3 +[wp] [Alt-Ergo] Goal typed_init_assign : Unknown +[wp] Proved goals: 8 / 9 + Qed: 2 Alt-Ergo: 6 (unknown: 1) ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -init 3 6 (98) 10 90.0% +init 2 6 (98) 9 88.9% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/loopentry.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/loopentry.res.oracle index 1b363c7c7e741e5566c34d5622c46235029da9de..be1b7084425c09a2f0e32e4a21aa85da1161cb97 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/loopentry.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/loopentry.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/loopentry.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/mask.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle_qualif/mask.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/mask.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/mask.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..61038e84846fca76db70bae6ce9ba2084053e0aa --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/mask.res.oracle @@ -0,0 +1,14 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/mask.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +[wp] 2 goals scheduled +[wp] [Qed] Goal typed_compute_post_A : Valid +[wp] [Qed] Goal typed_compute_post_B : Valid +[wp] Proved goals: 2 / 2 + Qed: 2 +---------------------------------------------------------- +Functions WP Alt-Ergo Total Success +compute 2 - 2 100% +---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/model.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/model.res.oracle index 08ea00f40ac184af47c53dc527dd0b93551e7433..3dea3f23fa04dd0bea10107e76955ff9f94a7562 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/model.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/model.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/model.i (no preprocessing) tests/wp_plugin/model.i:11:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.0.res.oracle index 3c78fd32af84adaa7ea98ee08d3f82a2586dbbe7..19feb02789843bf10a98bb6c5a9c0949adb961b2 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-depth 16 [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/nth.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.1.res.oracle index 1e7f995da8f24971e8cf9d53305f502567c0e81a..466fb0e52e34f48947a982015eb819213c97f440 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/nth.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-depth 16 [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/nth.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/params.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/params.res.oracle index ddaa5d49c1f32a07a80c7c46d031e3ecab3d6a53..f269ad331ffd14b91b271585af5ad49f7aaf82b2 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/params.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/params.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/params.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/plet.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/plet.res.oracle index 6023de183814a6483e4ff663804d232780e9551d..c8c9567385c12f6bdaa83009f1fc4bb7f9056833 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/plet.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/plet.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/plet.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/polarity.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/polarity.res.oracle index c223806f7ea4421f7da44dabda4e089659a99fb2..10f9f31568231575cee6a77fc8d728cbb0120fc0 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/polarity.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/polarity.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/polarity.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/prenex.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/shift_lemma.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle_qualif/prenex.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/prenex.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/prenex.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..fb5d16cbe2033b58ef37e1e22f6d1abd66b5a259 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/prenex.res.oracle @@ -0,0 +1,25 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/prenex.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] warning: Missing RTE guards +[wp] 12 goals scheduled +[wp] [Alt-Ergo] Goal typed_diag_post : Valid +[wp] [Alt-Ergo] Goal typed_diag_loop_inv_I_preserved : Valid +[wp] [Qed] Goal typed_diag_loop_inv_I_established : Valid +[wp] [Alt-Ergo] Goal typed_diag_loop_inv_PI_preserved : Valid +[wp] [Qed] Goal typed_diag_loop_inv_PI_established : Valid +[wp] [Alt-Ergo] Goal typed_diag_loop_inv_J_preserved : Valid +[wp] [Qed] Goal typed_diag_loop_inv_J_established : Valid +[wp] [Alt-Ergo] Goal typed_diag_loop_inv_PJ_preserved : Valid +[wp] [Qed] Goal typed_diag_loop_inv_PJ_established : Valid +[wp] [Qed] Goal typed_diag_loop_assign_part1 : Valid +[wp] [Qed] Goal typed_diag_loop_assign_part2 : Valid +[wp] [Qed] Goal typed_diag_loop_assign_2 : Valid +[wp] Proved goals: 12 / 12 + Qed: 7 + Alt-Ergo: 5 +---------------------------------------------------------- +Functions WP Alt-Ergo Total Success +diag 7 5 (65) 12 100% +---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/removed.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/removed.res.oracle index 58878858375bf15c63a67dabf1671215b2565e19..87c20566db3e625991d83c00abc505a4810907fe 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/removed.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/removed.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/removed.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,7 +5,6 @@ [value:initial-state] Values of globals at initialization tests/wp_plugin/removed.i:10:[value] warning: signed overflow. assert 1 + i ≤ 2147483647; -[value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/repeat.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/repeat.res.oracle index 164c72c04fe1bf0f7d485860b4a4efb94f92f725..6bb911cfee50864c3587f94f38c9957ffc221a9e 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/repeat.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/repeat.res.oracle @@ -1,11 +1,10 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/repeat.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards tests/wp_plugin/repeat.c:47:[wp] warning: Missing assigns clause (assigns 'everything' instead) -[wp] 53 goals scheduled +[wp] 47 goals scheduled [wp] [Qed] Goal typed_induction_post : Valid [wp] [Alt-Ergo] Goal typed_induction_loop_inv_preserved : Valid [wp] [Qed] Goal typed_induction_loop_inv_established : Valid @@ -14,9 +13,7 @@ tests/wp_plugin/repeat.c:47:[wp] warning: Missing assigns clause (assigns 'every [wp] [Qed] Goal typed_induction_loop_assign : Valid [wp] [Qed] Goal typed_induction_assign_exit_part1 : Valid [wp] [Qed] Goal typed_induction_assign_exit_part2 : Valid -[wp] [Qed] Goal typed_induction_assign_exit_part3 : Valid -[wp] [Qed] Goal typed_induction_assign_normal_part1 : Valid -[wp] [Qed] Goal typed_induction_assign_normal_part2 : Valid +[wp] [Qed] Goal typed_induction_assign_normal : Valid [wp] [Qed] Goal typed_master_post : Valid [wp] [Qed] Goal typed_master_assign_exit : Valid [wp] [Qed] Goal typed_master_assign_normal : Valid @@ -28,10 +25,8 @@ tests/wp_plugin/repeat.c:47:[wp] warning: Missing assigns clause (assigns 'every [wp] [Qed] Goal typed_shifted_loop_assign : Valid [wp] [Qed] Goal typed_shifted_assign_exit_part1 : Valid [wp] [Qed] Goal typed_shifted_assign_exit_part2 : Valid -[wp] [Qed] Goal typed_shifted_assign_exit_part3 : Valid [wp] [Qed] Goal typed_shifted_assign_normal_part1 : Valid [wp] [Qed] Goal typed_shifted_assign_normal_part2 : Valid -[wp] [Qed] Goal typed_shifted_assign_normal_part3 : Valid [wp] [Qed] Goal typed_unroll_post : Valid [wp] [Qed] Goal typed_unroll_loop_inv_preserved : Valid [wp] [Qed] Goal typed_unroll_loop_inv_established : Valid @@ -46,7 +41,6 @@ tests/wp_plugin/repeat.c:47:[wp] warning: Missing assigns clause (assigns 'every [wp] [Qed] Goal typed_unroll_assign_exit_part09 : Valid [wp] [Qed] Goal typed_unroll_assign_exit_part10 : Valid [wp] [Qed] Goal typed_unroll_assign_exit_part11 : Valid -[wp] [Qed] Goal typed_unroll_assign_exit_part12 : Valid [wp] [Qed] Goal typed_unroll_assign_normal_part01 : Valid [wp] [Qed] Goal typed_unroll_assign_normal_part02 : Valid [wp] [Qed] Goal typed_unroll_assign_normal_part03 : Valid @@ -58,14 +52,13 @@ tests/wp_plugin/repeat.c:47:[wp] warning: Missing assigns clause (assigns 'every [wp] [Qed] Goal typed_unroll_assign_normal_part09 : Valid [wp] [Qed] Goal typed_unroll_assign_normal_part10 : Valid [wp] [Qed] Goal typed_unroll_assign_normal_part11 : Valid -[wp] [Qed] Goal typed_unroll_assign_normal_part12 : Valid -[wp] Proved goals: 53 / 53 - Qed: 48 +[wp] Proved goals: 47 / 47 + Qed: 42 Alt-Ergo: 5 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success master 3 - 3 100% -unroll 27 - 27 100% -induction 9 2 (565) 11 100% -shifted 9 3 (561) 12 100% +unroll 25 - 25 100% +induction 7 2 (47) 9 100% +shifted 7 3 (48) 10 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/rte.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/rte.res.oracle index 0e1a50b0850fc0828798e4f977979d32a5c83fd4..6d7150ffa66dbca478cf19cb9e8abdd751643206 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/rte.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/rte.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/rte.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.0.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.0.res.oracle index b87fba0b14b27b6d56b3234ad2409491726756f0..913f5b6dc0a242164f25179f924364400a880317 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.0.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.0.res.oracle @@ -1,11 +1,10 @@ # frama-c -wp -wp-model 'Typed (Caveat)' -wp-depth 16 [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/sequence.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] 39 goals scheduled -[wp] [Alt-Ergo] Goal typed_caveat_loops_post_ok_first : Valid +[wp] [Qed] Goal typed_caveat_loops_post_ok_first : Valid [wp] [Alt-Ergo] Goal typed_caveat_loops_post_ok_last : Valid [wp] [Alt-Ergo] Goal typed_caveat_loops_loop_inv_ok_id_max_preserved : Valid [wp] [Qed] Goal typed_caveat_loops_loop_inv_ok_id_max_established : Valid @@ -21,7 +20,7 @@ [wp] [Qed] Goal typed_caveat_loops_assign_normal_part2 : Valid [wp] [Qed] Goal typed_caveat_loops_assign_normal_part3 : Valid [wp] [Alt-Ergo] Goal typed_caveat_loops_g_called_post_ok_u1 : Valid -[wp] [Alt-Ergo] Goal typed_caveat_loops_g_called_post_ok_u2 : Valid +[wp] [Qed] Goal typed_caveat_loops_g_called_post_ok_u2 : Valid [wp] [Alt-Ergo] Goal typed_caveat_loops_g_not_called_post_ok_v1 : Valid [wp] [Alt-Ergo] Goal typed_caveat_loops_g_not_called_post_ok_v2 : Valid [wp] [Qed] Goal typed_caveat_no_calls_post_ok_m1 : Valid @@ -36,20 +35,20 @@ [wp] [Qed] Goal typed_caveat_no_calls_assign : Valid [wp] [Qed] Goal typed_caveat_sequence_assign_exit : Valid [wp] [Qed] Goal typed_caveat_sequence_assign_normal : Valid -[wp] [Alt-Ergo] Goal typed_caveat_sequence_g_called_post_ok_o1 : Valid -[wp] [Alt-Ergo] Goal typed_caveat_sequence_g_called_post_ok_p1 : Valid -[wp] [Alt-Ergo] Goal typed_caveat_sequence_g_called_post_ok_p2 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_called_post_ok_o1 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_called_post_ok_p1 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_called_post_ok_p2 : Valid [wp] [Alt-Ergo] Goal typed_caveat_sequence_g_called_post_ok_p3 : Valid -[wp] [Alt-Ergo] Goal typed_caveat_sequence_g_not_called_post_ok_o2 : Valid -[wp] [Alt-Ergo] Goal typed_caveat_sequence_g_not_called_post_ok_q1 : Valid -[wp] [Alt-Ergo] Goal typed_caveat_sequence_g_not_called_post_ok_q2 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_not_called_post_ok_o2 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_not_called_post_ok_q1 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_not_called_post_ok_q2 : Valid [wp] [Alt-Ergo] Goal typed_caveat_sequence_g_not_called_post_ok_q3 : Valid [wp] Proved goals: 39 / 39 - Qed: 17 - Alt-Ergo: 22 + Qed: 25 + Alt-Ergo: 14 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success no_calls 5 5 (9) 10 100% -sequence 2 8 (218) 10 100% -loops 10 9 (334) 19 100% +sequence 8 2 (16) 10 100% +loops 12 7 (95) 19 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.1.res.oracle index effa2331f61f004dd620c91102d53cf6b2d553fc..eb76a5733a1c705ac580edcc036249db67d8655f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.1.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.1.res.oracle @@ -1,11 +1,10 @@ # frama-c -wp -wp-model 'Typed (Caveat)' -wp-depth 16 [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/sequence.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] 34 goals scheduled -[wp] [alt-ergo] Goal typed_caveat_loops_post_ok_first : Valid +[wp] [Qed] Goal typed_caveat_loops_post_ok_first : Valid [wp] [alt-ergo] Goal typed_caveat_loops_post_ok_last : Valid [wp] [alt-ergo] Goal typed_caveat_loops_loop_inv_ok_id_max_preserved : Valid [wp] [Qed] Goal typed_caveat_loops_loop_inv_ok_id_max_established : Valid @@ -21,7 +20,7 @@ [wp] [Qed] Goal typed_caveat_loops_assign_normal_part2 : Valid [wp] [Qed] Goal typed_caveat_loops_assign_normal_part3 : Valid [wp] [alt-ergo] Goal typed_caveat_loops_g_called_post_ok_u1 : Valid -[wp] [alt-ergo] Goal typed_caveat_loops_g_called_post_ok_u2 : Valid +[wp] [Qed] Goal typed_caveat_loops_g_called_post_ok_u2 : Valid [wp] [alt-ergo] Goal typed_caveat_loops_g_not_called_post_ok_v1 : Valid [wp] [alt-ergo] Goal typed_caveat_loops_g_not_called_post_ok_v2 : Valid [wp] [Qed] Goal typed_caveat_no_calls_post_ok_m1 : Valid @@ -31,20 +30,20 @@ [wp] [Qed] Goal typed_caveat_no_calls_assign : Valid [wp] [Qed] Goal typed_caveat_sequence_assign_exit : Valid [wp] [Qed] Goal typed_caveat_sequence_assign_normal : Valid -[wp] [alt-ergo] Goal typed_caveat_sequence_g_called_post_ok_o1 : Valid -[wp] [alt-ergo] Goal typed_caveat_sequence_g_called_post_ok_p1 : Valid -[wp] [alt-ergo] Goal typed_caveat_sequence_g_called_post_ok_p2 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_called_post_ok_o1 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_called_post_ok_p1 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_called_post_ok_p2 : Valid [wp] [alt-ergo] Goal typed_caveat_sequence_g_called_post_ok_p3 : Valid -[wp] [alt-ergo] Goal typed_caveat_sequence_g_not_called_post_ok_o2 : Valid -[wp] [alt-ergo] Goal typed_caveat_sequence_g_not_called_post_ok_q1 : Valid -[wp] [alt-ergo] Goal typed_caveat_sequence_g_not_called_post_ok_q2 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_not_called_post_ok_o2 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_not_called_post_ok_q1 : Valid +[wp] [Qed] Goal typed_caveat_sequence_g_not_called_post_ok_q2 : Valid [wp] [alt-ergo] Goal typed_caveat_sequence_g_not_called_post_ok_q3 : Valid [wp] Proved goals: 34 / 34 - Qed: 14 - alt-ergo: 20 + Qed: 22 + alt-ergo: 12 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success no_calls 2 - 5 100% -sequence 2 - 10 100% -loops 10 - 19 100% +sequence 8 - 10 100% +loops 12 - 19 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.2.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.2.res.oracle index ec77b9eaa6bcb2a56298cc4e001f1f0513c87205..7d016e3c3bd8e2b85dab9482dea82f05bdfca6b5 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.2.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/sequence.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' -wp-depth 16 [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/sequence.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.err.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_alloc.err.oracle rename to src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.err.oracle diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.log b/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.log new file mode 100644 index 0000000000000000000000000000000000000000..89c07540f2ce5b589fa08db7e0c487b5a8576ce0 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.log @@ -0,0 +1,21 @@ +[kernel] Parsing tests/wp_plugin/stmt.c (with preprocessing) +[wp] Running WP plugin... +[wp] [CFG] Goal f_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_assign : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_post : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_assign : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_post : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_exit : Valid (Unreachable) +[wp] CFG h -> h +[wp] CFG h -> h_NEG_stmt_16 +[wp] CFG h -> h_POS_stmt_16 +[wp] CFG h -> h_default_for_stmt_16 +[wp] CFG g -> g +[wp] CFG g -> g_default_for_stmt_11 +[wp] CFG f -> f +[wp] CFG f -> f_default_for_stmt_2 +[wp] 0 goal scheduled +[wp] Proved goals: 0 / 0 diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..db885665be08e32597478439faa83774e32917c6 --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/stmt.res.oracle @@ -0,0 +1,115 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_plugin/stmt.c (with preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] [CFG] Goal f_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_assign : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_post : Valid (Unreachable) +[wp] [CFG] Goal g_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_exit : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_assign : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_post : Valid (Unreachable) +[wp] [CFG] Goal h_stmt_exit : Valid (Unreachable) +[wp] warning: Missing RTE guards +[wp] 10 goals scheduled +[wp] [Qed] Goal typed_f_post : Valid +[wp] [Qed] Goal typed_f_post_2 : Valid +[wp] [Qed] Goal typed_f_assert : Valid +[wp] [Qed] Goal typed_f_stmt_post : Valid +[wp] [Qed] Goal typed_f_stmt_assign : Valid +[wp] [Qed] Goal typed_g_post : Valid +[wp] [Qed] Goal typed_g_assert : Valid +[wp] [Qed] Goal typed_h_post : Valid +[wp] [Qed] Goal typed_h_assert : Valid +[wp] [Qed] Goal typed_h_assert_2 : Valid +[wp] Proved goals: 10 / 10 + Qed: 10 +---------------------------------------------------------- +Functions WP Alt-Ergo Total Success +f 5 - 5 100% +g 2 - 2 100% +h 3 - 3 100% +---------------------------------------------------------- +[report] Computing properties status... + +-------------------------------------------------------------------------------- +--- Properties of Function 'f' +-------------------------------------------------------------------------------- + +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 10) + by Wp.typed. +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 11) + by Wp.typed. +[ Valid ] Exit-condition (file tests/wp_plugin/stmt.c, line 15) at block + by Unreachable Annotations. +[ Valid ] Return-condition (file tests/wp_plugin/stmt.c, line 16) at block + by Frama-C kernel. +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 17) at block + by Wp.typed. +[ Valid ] Assigns (file tests/wp_plugin/stmt.c, line 21) at block + by Wp.typed. +[ Valid ] Assertion (file tests/wp_plugin/stmt.c, line 16) + by Wp.typed. +[ Valid ] Default behavior at block + by Frama-C kernel. +[ Valid ] Default behavior + by Frama-C kernel. + +-------------------------------------------------------------------------------- +--- Properties of Function 'g' +-------------------------------------------------------------------------------- + +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 27) + by Wp.typed. +[ Valid ] Exit-condition (file tests/wp_plugin/stmt.c, line 31) at block + by Unreachable Annotations. +[ Valid ] Return-condition (file tests/wp_plugin/stmt.c, line 32) at block + by Frama-C kernel. + by Unreachable Annotations. +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 33) at block + by Unreachable Annotations. +[ Valid ] Assigns (file tests/wp_plugin/stmt.c, line 36) at block + by Unreachable Annotations. +[ Valid ] Assertion (file tests/wp_plugin/stmt.c, line 32) + by Wp.typed. +[ Valid ] Default behavior at block + by Frama-C kernel. +[ Valid ] Default behavior + by Frama-C kernel. + +-------------------------------------------------------------------------------- +--- Properties of Function 'h' +-------------------------------------------------------------------------------- + +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 40) + by Wp.typed. +[ Valid ] Exit-condition (file tests/wp_plugin/stmt.c, line 43) at block + by Unreachable Annotations. +[ Valid ] Post-condition (file tests/wp_plugin/stmt.c, line 44) at block + by Unreachable Annotations. +[ Valid ] Return-condition for 'POS' (file tests/wp_plugin/stmt.c, line 48) at block + by Frama-C kernel. +[ Valid ] Return-condition for 'NEG' (file tests/wp_plugin/stmt.c, line 51) at block + by Frama-C kernel. +[ Valid ] Assigns (file tests/wp_plugin/stmt.c, line 53) at block + by Unreachable Annotations. +[ Valid ] Assertion (generated) + by Wp.typed. +[ Valid ] Assertion (generated) + by Wp.typed. +[ Valid ] Behavior 'NEG' at block + by Frama-C kernel. +[ Valid ] Behavior 'POS' at block + by Frama-C kernel. +[ Valid ] Default behavior at block + by Frama-C kernel. +[ Valid ] Default behavior + by Frama-C kernel. + +-------------------------------------------------------------------------------- +--- Status Report Summary +-------------------------------------------------------------------------------- + 29 Completely validated + 29 Total +-------------------------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct.res.oracle index 6b3dd047109fb65a7895b34a9ab3d324afac252e..acae1b83cd062204fb27d67a0f359874fbf7331f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/struct.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct_hack.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct_hack.res.oracle index 26e6a25673fb4e5e24de2ef95035873a9e0588e1..277f2d6a0e75f924b322ead95cb9d9de16b1122b 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct_hack.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/struct_hack.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/struct_hack.i (no preprocessing) tests/wp_plugin/struct_hack.i:46:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset.res.oracle index 9f3f5888c18e5fae382fb87218f1369f54b3d785..216f645f01ac7bdc9ce35f9f66d9001f33444386 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/subset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset_fopen.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset_fopen.res.oracle index 64e9fb4485bc7609013c8785f822a7a0592e8b86..b1aa4714c98a4240cfca228940c8faedf4b5f30f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset_fopen.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/subset_fopen.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/subset_fopen.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -15,5 +14,5 @@ Alt-Ergo: 1 (unknown: 1) ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -f 3 1 (81) 5 80.0% +f 3 1 (66) 5 80.0% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/trig.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/trig.res.oracle index 2d6d7c3f81b1370970d8f98415d9e61f89215cd7..a351a50b71395ac3d0cdd8254502f7d84b778b40 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/trig.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/trig.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/trig.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.1.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.1.res.oracle deleted file mode 100644 index 18233c843902c66acaa709771cb3b293d7c0cc1e..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.1.res.oracle +++ /dev/null @@ -1,6 +0,0 @@ -# frama-c -wp [...] -[wp] Running WP plugin... -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -[wp] 1 goal scheduled -[wp] [Alt-Ergo] Goal typed_echange_valeur_false_post_qed_ko : Unknown diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.res.oracle deleted file mode 100644 index 7487bd7f190b8495965b798c569b7048c532e8fa..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/tutorial.res.oracle +++ /dev/null @@ -1,15 +0,0 @@ -[wp] Running WP plugin... -tests/wp_plugin/tutorial.i:202:[wp] warning: Proof obligation for property 'div_mod' not generated. -tests/wp_plugin/tutorial.i:176:[wp] warning: Proof obligation for property 'pgcd_minus' not generated. -tests/wp_plugin/tutorial.i:177:[wp] warning: Proof obligation for property 'pgcd_minus_2' not generated. -tests/wp_plugin/tutorial.i:175:[wp] warning: Proof obligation for property 'pgcd_refl' not generated. -[wp] warning: Missing RTE guards -tests/wp_plugin/tutorial.i:160:[wp] warning: Missing assigns clause (assigns 'everything' instead) -tests/wp_plugin/tutorial.i:143:[wp] warning: Missing assigns clause (assigns 'everything' instead) -[wp] [Alt-Ergo] Goal store_absolue_post_qed_ok : Valid -[wp] [Alt-Ergo] Goal store_comparer_loop_inv_qed_ok_established : Valid -[wp] [Alt-Ergo] Goal store_comparer_loop_inv_qed_ok_preserved : Valid -[wp] [Alt-Ergo] Goal store_echange_valeur_post_qed_ok : Valid -[wp] [Alt-Ergo] Goal store_max_post_qed_ok : Valid -[wp] [Alt-Ergo] Goal store_min_element_loop_inv_qed_ok_established : Valid -[wp] [Alt-Ergo] Goal store_min_element_loop_inv_qed_ok_preserved : Valid diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsafe-arrays.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsafe-arrays.res.oracle index 197357e498bf904e643ff4e030e5590b7c74cdf0..44e634a1e55a36c36c6a09f4b7d5d871cd1c1a71 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsafe-arrays.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsafe-arrays.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/unsafe-arrays.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsupported_init.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsupported_init.res.oracle index 5e546fcd4a7e73feb277c2a39ea4206f1dd89060..7d8f85dd10beb3d2a8a54be9d8c75569ebd8787f 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsupported_init.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle_qualif/unsupported_init.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_plugin/unsupported_init.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_plugin/prenex.i b/src/plugins/wp/tests/wp_plugin/prenex.i new file mode 100644 index 0000000000000000000000000000000000000000..915f7a07f8fd33d3ea3838a4a080dcb4b2d97dcb --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/prenex.i @@ -0,0 +1,37 @@ +/* run.config + OPT: -wp-prenex +*/ +/* run.config_qualif + OPT: -wp-prenex +*/ + +/*@ + requires 0 <= n && 0 <= m; + ensures + \result <==> + ( \forall integer i; 0 <= i < n ==> + \forall integer j; 0 <= j < m ==> + p[i] < q[j] ); +*/ +int diag(int *p,int n,int *q,int m) +{ + /*@ + loop invariant I: 0 <= i <= n ; + loop invariant PI: + \forall integer i0; 0 <= i0 < i ==> + \forall integer j0; 0 <= j0 < m ==> + p[i0] < q[j0]; + loop assigns i; + */ + for (int i = 0; i<n; i++) + /*@ + loop invariant J: 0 <= j <= m ; + loop invariant PJ: + \forall integer j0; 0 <= j0 < j ==> + p[i] < q[j0]; + loop assigns j; + */ + for (int j = 0; j<m; j++) + if (p[i] >= q[j]) return 0; + return 1; +} diff --git a/src/plugins/wp/tests/wp_plugin/stmt.c b/src/plugins/wp/tests/wp_plugin/stmt.c new file mode 100644 index 0000000000000000000000000000000000000000..106abc646b90ed8a66a3a06720f13c947e97c15d --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/stmt.c @@ -0,0 +1,55 @@ +/* run.config + OPT: -load-module report -then -report +*/ + +/* run.config_qualif + OPT: -load-module report -then -report + EXECNOW: LOG stmt.log LOG f.dot LOG f_default_for_stmt_2.dot LOG g.dot LOG g_default_for_stmt_11.dot @frama-c@ -no-autoload-plugins -load-module wp -wp -wp-model Dump -wp-out tests/wp_plugin/result_qualif @PTEST_FILE@ 1> tests/wp_plugin/result_qualif/stmt.log +*/ + +/*@ ensures a > 0 ==> \result == a + b; + @ ensures a <= 0 ==> \result == -1; +*/ +int f(int a, int b) { + + /*@ exits \false; + @ returns \result == a + b; + @ ensures a <= 0; + @ assigns \nothing; + */ + if (a > 0) + return a + b; + + return -1; +} + + +/*@ ensures \result == a + b; +*/ +int g(int a, int b) { + + /*@ exits \false; + @ returns \result == a + b; + @ ensures \false; + @ assigns \nothing; + */ + return a + b; + +} + +/*@ ensures \result == (e ? a : b) ; */ +int h(int e,int a,int b) { + + /*@ exits \false; + @ ensures \false; + @ assigns \nothing; + @ behavior POS: + @ assumes e ; + @ returns \result == a; + @ behavior NEG: + @ assumes !e ; + @ returns \result == b; + */ + if (e) return a; else return b; + +} diff --git a/src/plugins/wp/tests/wp_plugin/volatile.i b/src/plugins/wp/tests/wp_plugin/volatile.i new file mode 100644 index 0000000000000000000000000000000000000000..81be3c130b37e940d99c901af4ad44c1a8a1bd9c --- /dev/null +++ b/src/plugins/wp/tests/wp_plugin/volatile.i @@ -0,0 +1,36 @@ +/* run.config + OPT: + OPT: -wp-no-volatile +*/ + +/* run.config_qualif + DONTRUN: +*/ + +volatile int v ; + +void job_assigns(void) +{ + v = 0; + /*@ assert KO_WHEN_VOLATILE: v == 0 ; */ ; +} + +void job_read(void) +{ + int x = v; + /*@ assert KO_WHEN_VOLATILE: x == v ; */ ; +} + +struct st_v { int a ; int volatile v ; } sv; + +void job_struct(void) +{ + sv.a = 0; + if (sv.a) /*@ assert ok: dead_code: \false ; */ ; +} + +void job_struct_assigns(struct st_v *p) +{ + *p = sv; + /*@ assert KO_WHEN_VOLATILE: *p == sv ; */ ; +} diff --git a/src/plugins/wp/tests/wp_store/oracle/array.res.oracle b/src/plugins/wp/tests/wp_store/oracle/array.res.oracle index ec2c094fabcc4d98071d25715fd1047d88cfa482..b920a91722a2079aaf00238a85658cf958c809b2 100644 --- a/src/plugins/wp/tests/wp_store/oracle/array.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle/array.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/array.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle/natural.res.oracle b/src/plugins/wp/tests/wp_store/oracle/natural.res.oracle index 3ee56c9c24231fe08f100b8c9ae4b4ccdba15ac7..58b2668810db36d12e825bef09e5b3e7491cc541 100644 --- a/src/plugins/wp/tests/wp_store/oracle/natural.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle/natural.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/natural.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle/nonaliasing.res.oracle b/src/plugins/wp/tests/wp_store/oracle/nonaliasing.res.oracle index b88ba7656f8b1ba65548de7c211a5a2a4059d607..67b50e6639b1f165f0e3c25fda44c89de0cddf6c 100644 --- a/src/plugins/wp/tests/wp_store/oracle/nonaliasing.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle/nonaliasing.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/nonaliasing.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle/struct.res.oracle b/src/plugins/wp/tests/wp_store/oracle/struct.res.oracle index 3d0417ade98a3574fd8b2b74c65129b0b36df648..e5ef3c5f5e1c532d9c4e3bc6204b2420eb3973c2 100644 --- a/src/plugins/wp/tests/wp_store/oracle/struct.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle/struct.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/struct.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -44,7 +43,7 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'P,qed_ok' in 'main': -Let a = global(G_v_75). +Let a = global(G_v_28). Let a_1 = Load_S2_St(a, Mint_0). Assume { Type: IsS2_St(w) /\ IsS2_St(a_1). @@ -57,14 +56,14 @@ Assume { (* Initializer *) Init: Mint_0[shiftfield_F2_St_b(a)] = 2. (* Heap *) - Have: region(G_v_75) <= 0. + Have: region(G_v_28) <= 0. } Prove: EqS2_St(a_1, w). ------------------------------------------------------------ Goal Post-condition 'Q,qed_ok' in 'main': -Let a = global(G_v_75). +Let a = global(G_v_28). Let a_1 = Load_S2_St(a, Mint_0). Assume { Type: IsS2_St(w) /\ IsS2_St(a_1). @@ -77,7 +76,7 @@ Assume { (* Initializer *) Init: Mint_0[shiftfield_F2_St_b(a)] = 2. (* Heap *) - Have: region(G_v_75) <= 0. + Have: region(G_v_28) <= 0. } Prove: EqS2_St(a_1, w). diff --git a/src/plugins/wp/tests/wp_store/oracle_qualif/array.res.oracle b/src/plugins/wp/tests/wp_store/oracle_qualif/array.res.oracle index d1857369d5de2951e5c4fb81b51c89adf08e9882..ca9542b8d0cd3e8a3546f006ae9b35731e9bddbb 100644 --- a/src/plugins/wp/tests/wp_store/oracle_qualif/array.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle_qualif/array.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/array.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle_qualif/natural.res.oracle b/src/plugins/wp/tests/wp_store/oracle_qualif/natural.res.oracle index a322506544a1599869edd94007eae77a0b1f6bf5..6b5748207c1c834d85b729f16c4a418cb3322755 100644 --- a/src/plugins/wp/tests/wp_store/oracle_qualif/natural.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle_qualif/natural.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/natural.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.0.res.oracle b/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.0.res.oracle index fe8d609f597053d3303ab9904b1b85c8afe80b7e..d6d4fdadca017e3d39ae9ef8c03ec228e1bc91e8 100644 --- a/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.0.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/nonaliasing.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.1.res.oracle b/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.1.res.oracle index 729cc07c36d6464e5bb40e499d4418494a28f511..65c92cd88c4559bc76f715dae352648e2cf0a2bd 100644 --- a/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.1.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle_qualif/nonaliasing.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/nonaliasing.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_store/oracle_qualif/struct.res.oracle b/src/plugins/wp/tests/wp_store/oracle_qualif/struct.res.oracle index bcf48860a950667aa5a2e93dc4d738f6a9e8aaf4..8e04748aef111126994326f77506fa73c232f379 100644 --- a/src/plugins/wp/tests/wp_store/oracle_qualif/struct.res.oracle +++ b/src/plugins/wp/tests/wp_store/oracle_qualif/struct.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_store/struct.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/array_initialized.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/array_initialized.0.res.oracle index d50990b0f1fe7c70546e8b5c4bdb840ae4c9f22e..67114b3d7a1f81098c455ff97c6186376bb7c2a3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/array_initialized.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/array_initialized.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/array_initialized.c (with preprocessing) tests/wp_typed/array_initialized.c:13:[kernel] warning: Too many initializers for array g [wp] Running WP plugin... @@ -253,7 +252,7 @@ Assume { When: (0 <= i) /\ (i <= 499). (* Initializer *) Init: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 499) -> - (p[i_1] = global(G_p0_75)))). + (p[i_1] = global(G_p0_28)))). (* Heap *) Have: linked(Malloc_0). } @@ -276,8 +275,8 @@ Assume { Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 49) -> (Mint_0[shift_sint32(t, i_1)] = x))). If 0 <= x - Then { Have: simpl_0 = 1. } - Else { Have: simpl_0 = 0. } + Then { (* Return *) Have: simpl_0 = 1. } + Else { (* Return *) Have: simpl_0 = 0. } } Prove: (0 <= Mint_0[shift_sint32(t, i)]) <-> (simpl_0 = 1). diff --git a/src/plugins/wp/tests/wp_typed/oracle/array_initialized.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/array_initialized.1.res.oracle index a3f79c119cf661bf4010aab41ae2a8396bfb1333..20cd6e0cca33a5e8e0d6273aebe6780fa15c2750 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/array_initialized.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/array_initialized.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/array_initialized.c (with preprocessing) tests/wp_typed/array_initialized.c:13:[kernel] warning: Too many initializers for array g [wp] Running WP plugin... @@ -10,7 +9,7 @@ tests/wp_typed/array_initialized.c:13:[kernel] warning: Too many initializers fo ------------------------------------------------------------ Goal Assertion (file tests/wp_typed/array_initialized.c, line 71): -Let a = shift_A500_sint32(global(K_g_67), 0). +Let a = global(K_g_20). Assume { (* Goal *) When: (0 <= i) /\ (i <= 499). @@ -26,8 +25,8 @@ Prove: Mint_0[shift_sint32(a, i)] = 0. ------------------------------------------------------------ Goal Assertion (file tests/wp_typed/array_initialized.c, line 185): -Let a = shift_A500_sint32(global(K_h1_71), 0). -Let a_1 = shift_A500_sint32(global(K_h2_72), 0). +Let a = global(K_h1_24). +Let a_1 = global(K_h2_25). Assume { (* Goal *) When: (0 <= i) /\ (i <= 499). @@ -254,13 +253,13 @@ Prove: true. ------------------------------------------------------------ Goal Assertion (file tests/wp_typed/array_initialized.c, line 283): -Let a = shift_A500_PTR(global(K_p_79), 0). +Let a = global(K_p_32). Assume { (* Goal *) When: (0 <= i) /\ (i <= 499). (* Initializer *) Init: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 499) -> - (Mptr_0[shift_PTR(a, i_1)] = global(G_p0_78)))). + (Mptr_0[shift_PTR(a, i_1)] = global(G_p0_31)))). (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). } @@ -283,8 +282,8 @@ Assume { Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 <= 49) -> (Mint_0[shift_sint32(t, i_1)] = x))). If 0 <= x - Then { Have: simpl_0 = 1. } - Else { Have: simpl_0 = 0. } + Then { (* Return *) Have: simpl_0 = 1. } + Else { (* Return *) Have: simpl_0 = 0. } } Prove: (0 <= Mint_0[shift_sint32(t, i)]) <-> (simpl_0 = 1). diff --git a/src/plugins/wp/tests/wp_typed/oracle/avar.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/avar.0.res.oracle index 5d4c4e7510d8576dfdd644b9538f358e51cb0373..8513985eded7c6ee18257d08688e099eef2157dd 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/avar.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/avar.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/avar.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/avar.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/avar.1.res.oracle index 5190db9d1822b39de11e4cc955fd7fc7b7e09056..73a9f488845cd2716a6f596c47eb27c60b3c862d 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/avar.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/avar.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/avar.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/bug_9.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/bug_9.0.res.oracle index 31e9ddc5d5422641001e78a424936da1aa623436..d83a4e589c24b468dee42a14b9907c28fb290e96 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/bug_9.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/bug_9.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/bug_9.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/bug_9.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/bug_9.1.res.oracle index 213297b48dd813a0fadc1f16f936063760505391..beebe7e3d3ff4d20b9b42d1e91740c603e0e2a38 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/bug_9.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/bug_9.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/bug_9.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.0.res.oracle index 755041a09eaf34c8b881cb5c7c219f2b0267e0bc..cfe1f81f3f0c8cb3436c7ffcfcf51df714a77936 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/shift_lemma.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.1.res.oracle index 0c8c62fcb28b32fe65dce155749a1c3d1baea478..8030ca9007563b39e60125c316d88d45bdd42c5b 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/shift_lemma.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.res.oracle deleted file mode 100644 index f3218bd2e993fce54413276e3c26a4e2b6e5676e..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/shift_lemma.res.oracle +++ /dev/null @@ -1,142 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/shift_lemma.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/shift_lemma.i, line 22): -Let x_0 = Mint_0[(shiftfield_F_s_d p_0)]. -Let a_0 = (shiftfield_F_s_u p_0). -Assume { - (* Domain *) - Type: (is_sint32 x_0) /\ (is_sint32 Mint_0[(shiftfield_F_s_e p_0)]) - /\ (is_sint32 Mint_0[(shiftfield_F_t_c (shift_t a_0 0))]) - /\ (is_sint32 Mint_0[(shiftfield_F_t_c (shift_t a_0 1))]). - (* Heap *) - Have: (region (base p_0))<=0. - (* Pre-condition (file tests/wp_typed/shift_lemma.i, line 19) in 'f' *) - (* Pre-condition: *) - Have: (P_inv Mint_0 p_0). -} -Prove: 0=x_0. - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/shift_lemma.i, line 23): -Let a_0 = (shiftfield_F_s_u p_0). -Let x_0 = Mint_0[(shiftfield_F_s_d p_0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_0) /\ (is_sint32 Mint_0[(shiftfield_F_s_e p_0)]) - /\ (is_sint32 Mint_0[(shiftfield_F_t_c (shift_t a_0 0))]) - /\ (is_sint32 Mint_0[(shiftfield_F_t_c (shift_t a_0 1))]). - (* Goal *) - When: (0<=i_2) /\ (i_2<=9) /\ (is_sint32 i_2). - (* Heap *) - Have: (region (base p_0))<=0. - (* Pre-condition (file tests/wp_typed/shift_lemma.i, line 19) in 'f' *) - (* Pre-condition: *) - Have: (P_inv Mint_0 p_0). - (* Assertion (file tests/wp_typed/shift_lemma.i, line 22) *) - (* tests/wp_typed/shift_lemma.i:22: Assertion: *) - Have: 0=x_0. -} -Prove: 0=Mint_0[(shiftfield_F_t_c (shift_t a_0 i_2))]. - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/shift_lemma.i, line 24): -Let a_0 = (shiftfield_F_s_u p_0). -Let x_0 = Mint_0[(shiftfield_F_t_c (shift_t a_0 0))]. -Let x_1 = Mint_0[(shiftfield_F_s_d p_0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_1) /\ (is_sint32 Mint_0[(shiftfield_F_s_e p_0)]) - /\ (is_sint32 x_0) - /\ (is_sint32 Mint_0[(shiftfield_F_t_c (shift_t a_0 1))]). - (* Heap *) - Have: (region (base p_0))<=0. - (* Pre-condition (file tests/wp_typed/shift_lemma.i, line 19) in 'f' *) - (* Pre-condition: *) - Have: (P_inv Mint_0 p_0). - (* Assertion (file tests/wp_typed/shift_lemma.i, line 22) *) - (* tests/wp_typed/shift_lemma.i:22: Assertion: *) - Have: 0=x_1. - (* Assertion (file tests/wp_typed/shift_lemma.i, line 23) *) - (* tests/wp_typed/shift_lemma.i:23: Assertion: *) - Have: forall i_0:int. - (0<=i_0) -> (i_0<=9) -> (is_sint32 i_0) - -> (0=Mint_0[(shiftfield_F_t_c (shift_t a_0 i_0))]). -} -Prove: 0=x_0. - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/shift_lemma.i, line 25): -Let a_0 = (shiftfield_F_s_u p_0). -Let x_0 = Mint_0[(shiftfield_F_t_c (shift_t a_0 1))]. -Let x_1 = Mint_0[(shiftfield_F_t_c (shift_t a_0 0))]. -Let x_2 = Mint_0[(shiftfield_F_s_d p_0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_2) /\ (is_sint32 Mint_0[(shiftfield_F_s_e p_0)]) - /\ (is_sint32 x_1) /\ (is_sint32 x_0). - (* Heap *) - Have: (region (base p_0))<=0. - (* Pre-condition (file tests/wp_typed/shift_lemma.i, line 19) in 'f' *) - (* Pre-condition: *) - Have: (P_inv Mint_0 p_0). - (* Assertion (file tests/wp_typed/shift_lemma.i, line 22) *) - (* tests/wp_typed/shift_lemma.i:22: Assertion: *) - Have: 0=x_2. - (* Assertion (file tests/wp_typed/shift_lemma.i, line 23) *) - (* tests/wp_typed/shift_lemma.i:23: Assertion: *) - Have: forall i_0:int. - (0<=i_0) -> (i_0<=9) -> (is_sint32 i_0) - -> (0=Mint_0[(shiftfield_F_t_c (shift_t a_0 i_0))]). - (* Assertion (file tests/wp_typed/shift_lemma.i, line 24) *) - (* tests/wp_typed/shift_lemma.i:24: Assertion: *) - Have: 0=x_1. -} -Prove: 0=x_0. - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/shift_lemma.i, line 26): -Let x_0 = Mint_0[(shiftfield_F_s_e p_0)]. -Let a_0 = (shiftfield_F_s_u p_0). -Let x_1 = Mint_0[(shiftfield_F_t_c (shift_t a_0 1))]. -Let x_2 = Mint_0[(shiftfield_F_t_c (shift_t a_0 0))]. -Let x_3 = Mint_0[(shiftfield_F_s_d p_0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_3) /\ (is_sint32 x_0) /\ (is_sint32 x_2) - /\ (is_sint32 x_1). - (* Heap *) - Have: (region (base p_0))<=0. - (* Pre-condition (file tests/wp_typed/shift_lemma.i, line 19) in 'f' *) - (* Pre-condition: *) - Have: (P_inv Mint_0 p_0). - (* Assertion (file tests/wp_typed/shift_lemma.i, line 22) *) - (* tests/wp_typed/shift_lemma.i:22: Assertion: *) - Have: 0=x_3. - (* Assertion (file tests/wp_typed/shift_lemma.i, line 23) *) - (* tests/wp_typed/shift_lemma.i:23: Assertion: *) - Have: forall i_0:int. - (0<=i_0) -> (i_0<=9) -> (is_sint32 i_0) - -> (0=Mint_0[(shiftfield_F_t_c (shift_t a_0 i_0))]). - (* Assertion (file tests/wp_typed/shift_lemma.i, line 24) *) - (* tests/wp_typed/shift_lemma.i:24: Assertion: *) - Have: 0=x_2. - (* Assertion (file tests/wp_typed/shift_lemma.i, line 25) *) - (* tests/wp_typed/shift_lemma.i:25: Assertion: *) - Have: 0=x_1. -} -Prove: 0=x_0. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/struct_array_type.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/struct_array_type.res.oracle index 4f49da1fe4bf00a6376cc1c38c88ab09904502e6..547707b1feb9aa87164edf2c706e7311c1a0dd3b 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/struct_array_type.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/struct_array_type.res.oracle @@ -1,11 +1,11 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/struct_array_type.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards [wp] 1 goal scheduled -[wp:print-generated] (* ---------------------------------------------------------- *) +[wp:print-generated] "WPOUT/typed/f_post.ergo" + (* ---------------------------------------------------------- *) (* --- Post-condition (file tests/wp_typed/struct_array_type.i, line 16) in 'f' --- *) (* ---------------------------------------------------------- *) diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.0.res.oracle index e4d85c4023514b0570f8cfcef26d35ab6e929ea8..030c0b2a7b89e4385e111700e273d9d8cefb3691 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_alloc.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -27,7 +26,7 @@ Prove: true. Goal Post-condition (file tests/wp_typed/unit_alloc.i, line 33) in 'h': Assume { (* Heap *) Have: linked(Malloc_0). } -Prove: !valid_rw(Malloc_0[P_x_87 <- 0], global(P_x_87), 1). +Prove: !valid_rw(Malloc_0[P_x_40 <- 0], global(P_x_40), 1). ------------------------------------------------------------ ------------------------------------------------------------ @@ -41,7 +40,7 @@ Prove: true. Goal Assertion (file tests/wp_typed/unit_alloc.i, line 21): Assume { (* Heap *) Have: (region(p.base) <= 0) /\ linked(Malloc_0). } -Prove: valid_rw(Malloc_0[L_y_72 <- 1], global(L_y_72), 1). +Prove: valid_rw(Malloc_0[L_y_25 <- 1], global(L_y_25), 1). ------------------------------------------------------------ @@ -51,13 +50,13 @@ Prove: true. ------------------------------------------------------------ Goal Assertion (file tests/wp_typed/unit_alloc.i, line 24): -Let a = global(L_y_72). +Let a = global(L_y_25). Assume { (* Heap *) Have: (region(p.base) <= 0) /\ linked(Malloc_0). (* Assertion *) - Have: valid_rw(Malloc_0[L_y_72 <- 1], a, 1). + Have: valid_rw(Malloc_0[L_y_25 <- 1], a, 1). } -Prove: !valid_rw(Malloc_0[L_y_72 <- 0], a, 1). +Prove: !valid_rw(Malloc_0[L_y_25 <- 0], a, 1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.1.res.oracle index 59ba493575054607532bba1f58547aec846192bc..acd04d29701ab5570baa206e74ca9b5a34deaac4 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_alloc.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -27,7 +26,7 @@ Prove: true. Goal Post-condition (file tests/wp_typed/unit_alloc.i, line 33) in 'h': Assume { (* Heap *) Have: linked(Malloc_0). } -Prove: !valid_rw(Malloc_0[P_x_87 <- 0], global(P_x_87), 1). +Prove: !valid_rw(Malloc_0[P_x_40 <- 0], global(P_x_40), 1). ------------------------------------------------------------ ------------------------------------------------------------ @@ -41,7 +40,7 @@ Prove: true. Goal Assertion (file tests/wp_typed/unit_alloc.i, line 21): Assume { (* Heap *) Have: (region(p.base) <= 0) /\ linked(Malloc_0). } -Prove: valid_rw(Malloc_0[L_y_72 <- 1], global(L_y_72), 1). +Prove: valid_rw(Malloc_0[L_y_25 <- 1], global(L_y_25), 1). ------------------------------------------------------------ @@ -51,13 +50,13 @@ Prove: true. ------------------------------------------------------------ Goal Assertion (file tests/wp_typed/unit_alloc.i, line 24): -Let a = global(L_y_72). +Let a = global(L_y_25). Assume { (* Heap *) Have: (region(p.base) <= 0) /\ linked(Malloc_0). (* Assertion *) - Have: valid_rw(Malloc_0[L_y_72 <- 1], a, 1). + Have: valid_rw(Malloc_0[L_y_25 <- 1], a, 1). } -Prove: !valid_rw(Malloc_0[L_y_72 <- 0], a, 1). +Prove: !valid_rw(Malloc_0[L_y_25 <- 0], a, 1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.res.oracle deleted file mode 100644 index b34e769b8551037ccdfac32f45ed70aa65516932..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_alloc.res.oracle +++ /dev/null @@ -1,78 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_alloc.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Assigns nothing in 'f': -Assume { } -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function g ------------------------------------------------------------- - -Goal Assigns nothing in 'g': -Effect at line 31 -Assume { } -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function h ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/unit_alloc.i, line 33) in 'h': -Assume { (* Heap *) Have: (linked Malloc_2). } -Prove: not (valid_rw Malloc_2[P_x_87->0] (shift_sint32 (global P_x_87) 0) 1). - ------------------------------------------------------------- ------------------------------------------------------------- - Function job ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/unit_alloc.i, line 15): -Assume { (* Heap *) Have: (linked Malloc_4) /\ ((region (base p_1))<=0). } -Prove: true. - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/unit_alloc.i, line 21): -Assume { (* Heap *) Have: (linked Malloc_4) /\ ((region (base p_1))<=0). } -Prove: (valid_rw Malloc_4[P_x_71->1][L_y_72->1][L_z_74->1] - (shift_sint32 (global L_y_72) 0) 1). - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/unit_alloc.i, line 22): -Assume { - (* Heap *) - Have: (linked Malloc_4) /\ ((region (base p_1))<=0). - (* Assertion (file tests/wp_typed/unit_alloc.i, line 21) *) - (* tests/wp_typed/unit_alloc.i:21: Assertion: *) - Have: (valid_rw Malloc_4[P_x_71->1][L_y_72->1][L_z_74->1] - (shift_sint32 (global L_y_72) 0) 1). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/unit_alloc.i, line 24): -Let m_0 = Malloc_4[P_x_71->1][L_y_72->1][L_z_74->1]. -Let a_0 = (shift_sint32 (global L_y_72) 0). -Assume { - (* Heap *) - Have: (linked Malloc_4) /\ ((region (base p_1))<=0). - (* Assertion (file tests/wp_typed/unit_alloc.i, line 21) *) - (* tests/wp_typed/unit_alloc.i:21: Assertion: *) - Have: (valid_rw m_0 a_0 1). -} -Prove: not (valid_rw m_0[L_y_72->0][L_z_74->0] a_0 1). - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.res.oracle index 7a26f2d4d25257d32244b81a9ee627bee67a9cfd..abaf2af97596a2db01f8cfa598c1b8d57b39b0fb 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_bitwise.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -307,8 +306,7 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'ok' in 'bor_uchar': -Assume { Type: is_uint8(a) /\ is_uint8(b). } -Prove: lor(to_uint8(a), to_uint8(b)) = lor(a, b). +Prove: true. ------------------------------------------------------------ ------------------------------------------------------------ @@ -369,21 +367,12 @@ Prove: to_uint32(x) = x. ------------------------------------------------------------ Goal Post-condition 'ok' in 'cast': -Let x = to_sint8(c). -Assume { - Type: is_uint8(c) /\ is_uint32(i). - (* Assertion 'ok' *) - Have: to_uint32(i) = i. - (* Assertion 'ko' *) - Have: to_uint32(x) = x. -} -Prove: to_uint8(c) = c. +Prove: true. ------------------------------------------------------------ Goal Assertion 'ok' (file tests/wp_typed/unit_bitwise.c, line 176): -Assume { Type: is_uint32(i). } -Prove: to_uint32(i) = i. +Prove: true. ------------------------------------------------------------ @@ -418,12 +407,7 @@ Prove: true. ------------------------------------------------------------ Goal Assertion 'ko' (file tests/wp_typed/unit_bitwise.c, line 186): -Let x = to_sint8(c). -Assume { - Type: is_uint8(c) /\ is_uint32(i). - (* Assertion 'ok' *) - Have: to_uint32(i) = i. -} +Let x = to_sint8(c). Assume { Type: is_uint8(c). } Prove: to_uint32(x) = x. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_call.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_call.0.res.oracle index 49fa60893ce744589fbc8d3a2cf92d6ad3b63191..7b90e63c9dda1b69cf59b23a57d8f418e226a054 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_call.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_call.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_call.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_call.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_call.1.res.oracle index 87d47acc7bee6748b5309b90789caf27f5e9a1a1..e2ed2b3c3e4286df6a515cf2d1ee280d83657c1d 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_call.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_call.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_call.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_call.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_call.res.oracle deleted file mode 100644 index 7928e82dae96ce5f29ca745d0ae0e9dadc55f477..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_call.res.oracle +++ /dev/null @@ -1,24 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_call.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -tests/wp_typed/unit_call.i:7:[kernel] warning: No code nor implicit assigns clause for function f, generating default assigns from the prototype -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function job ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/unit_call.i, line 14): -Assume { - (* Domain *) - Type: (is_sint32 r_0) /\ (is_sint32 r_1). - (* tests/wp_typed/unit_call.i:10: Call 'f' *) - Have: r_1<0. - (* tests/wp_typed/unit_call.i:12: Call 'f' *) - Have: 0<r_0. -} -Prove: r_0!=r_1. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_cast.0.res.oracle index f4b786442641cd53dfb26a22246e599d3129e5ee..02915480a805b553b7fc5d238c6514a7c41fedd5 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_cast.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_cast.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_cast.1.res.oracle index 7a2f2eaa283415e49b061e29b011b8a0bb4b0e62..cc46f4df177f4a25e890c0fc2b0e4b9e49408151 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_cast.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_cast.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_cast.res.oracle deleted file mode 100644 index e3923423fcf8c6c920c4487892ff167da4788140..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.res.oracle +++ /dev/null @@ -1,27 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_cast.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -tests/wp_typed/unit_cast.i:8:[wp] warning: Cast with incompatible pointers types (source: sint32*) (target: sint8*) ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Assertion 'OUT' (file tests/wp_typed/unit_cast.i, line 9): -tests/wp_typed/unit_cast.i:8: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Cast with incompatible pointers types (source: sint32*) (target: sint8*) -Let x_0 = Mchar_0[w_0]. -Assume { - (* Domain *) - Type: (is_sint8 x_0). - (* Heap *) - Have: (sconst Mchar_0) /\ ((region (base p_1))<=0) - /\ ((region (base v_0))<=0). -} -Prove: x_0<=255. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_cst.0.res.oracle index 1200edde8b15f140cfb4dfd01e2360dc58a4363c..cfdb45655f07a860b6df8e34db32c8234665af94 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_cst.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_cst.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_cst.1.res.oracle index db56b63f62bf06c085bab83aa233cec578023224..93e9d63f41e52a15db804187ed75e9af16f283c8 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_cst.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_cst.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_float.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_float.res.oracle index eeb0345c7008a62b3646894294175b7f7f72174c..d5572f3a91cd57da13f2b85817d9d85d8591e4c1 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_float.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_float.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_float.i (no preprocessing) tests/wp_typed/unit_float.i:21:[kernel] warning: Floating-point constant 0.2 is not represented exactly. Will use 0x1.999999999999ap-3. See documentation for option -warn-decimal-float [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_hard.0.res.oracle index 9ebf0f0762eb9ecd30922d3a3cf78a0067bfb315..063aea78835f266a6aa72bb6ff256f1023ea4ee5 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_hard.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_hard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_hard.1.res.oracle index 69c40728b4cdfd5dee637e55e8c4b265d4766cbb..0d0ad273d9de6b2cf4e343d29d7dc36b707839bb 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_hard.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_hard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_hard.res.oracle deleted file mode 100644 index 394125d931d8c190a58e52684c65b55dcb159224..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.res.oracle +++ /dev/null @@ -1,28 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_hard.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function main ------------------------------------------------------------- - -Goal Pre-condition 'p_is_33FF' in 'main': -Assume { (* Heap *) Have: (region 0)<=0. } -Prove: true. - ------------------------------------------------------------- - -Goal Pre-condition 'q_is_66F0' in 'main': -Assume { (* Heap *) Have: (region 0)<=0. } -Prove: true. - ------------------------------------------------------------- - -Goal Pre-condition 'r_is_q1_ko' in 'main': -Assume { (* Heap *) Have: (region 0)<=0. } -Prove: (hardware 26360)=(1+(hardware 26352)). - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_ite.0.res.oracle index 41766b2bf2a11f7de60549c9ebef394cf7c4f3b7..878483ed55aa9f3fa6269f4cd8cf8a30d618adaa 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_ite.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_ite.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_ite.1.res.oracle index fc797cafaef4e89c2ba531893371bbf81cb89161..1cfdf1413c39c4949cebb6dcbae09cd621a4d1ba 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_ite.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_ite.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_ite.res.oracle deleted file mode 100644 index ddb8b5f35deedf420a0994459373a0fb902e0934..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.res.oracle +++ /dev/null @@ -1,16 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_ite.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function check ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/unit_ite.i, line 2) in 'check': -Assume { (* Heap *) Have: (region (base p_0))<=0. } -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_labels.0.res.oracle index 0e58f51e5697188408efbb4547c31c2db035000b..7d55819274a5027ca58dcdf08a76dc3fba2dca02 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_labels.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_labels.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_labels.1.res.oracle index 1b672e31dade3d029ee74a65f475fc5293bff3bc..d1b7d8962d97993217283c4a288b609f2a98066c 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_labels.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_labels.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_labels.res.oracle deleted file mode 100644 index 5dcb742dd3e5d14709ec601160f8005aa67c6f7e..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.res.oracle +++ /dev/null @@ -1,84 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_labels.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function duplet ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/unit_labels.i, line 5) in 'duplet': -Let x_0 = Mint_2[pi_0]. -Let a_1 = (shift_sint32 a_0 x_0). -Let x_1 = Mint_2[pj_0]. -Let m_0 = Mint_2[a_1->Mint_2[(shift_sint32 a_0 x_1)]]. -Let x_2 = m_0[pi_0]. -Let x_3 = m_0[pj_0]. -Assume { - (* Domain *) - Type: (is_sint32 x_0) /\ (is_sint32 x_1) /\ (is_sint32 x_2) - /\ (is_sint32 x_3). - (* Heap *) - Have: ((region (base a_0))<=0) /\ ((region (base pi_0))<=0) - /\ ((region (base pj_0))<=0). - (* Pre-condition (file tests/wp_typed/unit_labels.i, line 4) in 'duplet' *) - (* Pre-condition: *) - Have: (pi_0!=pj_0) /\ (pi_0!=a_1) /\ (pj_0!=a_1). - (* Assertion 'PI' (file tests/wp_typed/unit_labels.i, line 9) *) - (* tests/wp_typed/unit_labels.i:9: Assertion 'PI': *) - Have: x_0=x_2. - (* Assertion 'PJ' (file tests/wp_typed/unit_labels.i, line 10) *) - (* tests/wp_typed/unit_labels.i:10: Assertion 'PJ': *) - Have: x_1=x_3. -} -Prove: (P_is_duplet m_0 a_0 x_2 x_3). - ------------------------------------------------------------- - -Goal Assertion 'PI' (file tests/wp_typed/unit_labels.i, line 9): -Let x_0 = Mint_2[pi_0]. -Let a_1 = (shift_sint32 a_0 x_0). -Let x_1 = Mint_2[pj_0]. -Let m_0 = Mint_2[a_1->Mint_2[(shift_sint32 a_0 x_1)]]. -Let x_2 = m_0[pi_0]. -Assume { - (* Domain *) - Type: (is_sint32 x_0) /\ (is_sint32 x_1) /\ (is_sint32 x_2) - /\ (is_sint32 m_0[pj_0]). - (* Heap *) - Have: ((region (base a_0))<=0) /\ ((region (base pi_0))<=0) - /\ ((region (base pj_0))<=0). - (* Pre-condition (file tests/wp_typed/unit_labels.i, line 4) in 'duplet' *) - (* Pre-condition: *) - Have: (pi_0!=pj_0) /\ (pi_0!=a_1) /\ (pj_0!=a_1). -} -Prove: x_0=x_2. - ------------------------------------------------------------- - -Goal Assertion 'PJ' (file tests/wp_typed/unit_labels.i, line 10): -Let x_0 = Mint_2[pj_0]. -Let x_1 = Mint_2[pi_0]. -Let a_1 = (shift_sint32 a_0 x_1). -Let m_0 = Mint_2[a_1->Mint_2[(shift_sint32 a_0 x_0)]]. -Let x_2 = m_0[pj_0]. -Let x_3 = m_0[pi_0]. -Assume { - (* Domain *) - Type: (is_sint32 x_1) /\ (is_sint32 x_0) /\ (is_sint32 x_3) - /\ (is_sint32 x_2). - (* Heap *) - Have: ((region (base a_0))<=0) /\ ((region (base pi_0))<=0) - /\ ((region (base pj_0))<=0). - (* Pre-condition (file tests/wp_typed/unit_labels.i, line 4) in 'duplet' *) - (* Pre-condition: *) - Have: (pi_0!=pj_0) /\ (pi_0!=a_1) /\ (pj_0!=a_1). - (* Assertion 'PI' (file tests/wp_typed/unit_labels.i, line 9) *) - (* tests/wp_typed/unit_labels.i:9: Assertion 'PI': *) - Have: x_1=x_3. -} -Prove: x_0=x_2. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.0.res.oracle index 2bb4244bd2b04664353d15bc7df466b8fae9fae2..6be54b4bb0957640bab00f4e5403d2427b542ef8 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_lemma.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.1.res.oracle index 9ee6c512794f774cb6495ee386807d439d1340e8..e3fed83ab4c5249d91d6d8ff9994264b282ebf57 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_lemma.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.res.oracle deleted file mode 100644 index b716d029a26c063fae123d4598574af089b52da8..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.res.oracle +++ /dev/null @@ -1,56 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_lemma.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage ------------------------------------------------------------- - Global ------------------------------------------------------------- - -Lemma P23_KO: -Prove: (P_P2 x_0) -> (P_P3 x_0) - ------------------------------------------------------------- - -Lemma P52: -Assume: 'P14' 'P34' 'P13' 'P23_KO' -Prove: (P_P5 x_0) -> (P_P2 x_0) - ------------------------------------------------------------- ------------------------------------------------------------- - Axiomatic 'G1' ------------------------------------------------------------- - -Lemma P13: -Assume: 'P23_KO' -Prove: (P_P1 x_0) -> (P_P3 x_0) - ------------------------------------------------------------- - -Lemma P14: -Assume: 'P34' 'P13' 'P23_KO' -Prove: (P_P1 x_0) -> (P_P4 x_0) - ------------------------------------------------------------- ------------------------------------------------------------- - Axiomatic 'G2' ------------------------------------------------------------- - -Lemma P54: -Assume: 'P52' 'P14' 'P34' 'P13' 'P23_KO' -Prove: (P_P5 x_0) -> (P_P4 x_0) - ------------------------------------------------------------- ------------------------------------------------------------- - Axiomatic 'Poluted' ------------------------------------------------------------- - -Lemma Foo: -Prove: (P_H 0) -> (forall i_0:int. - (0<i_0) -> (P_H i_0)) - -> (forall i_0:int. - (i_0<0) -> (P_H i_0)) -> (forall i_0:int. - (P_H i_0)) - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_local.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_local.0.res.oracle index 1f3e4b657cbfb8e18424ee5afe427c7791a4aeee..955c23c9c06c3be7f9de68f4f77a781f40546919 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_local.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_local.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_local.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -26,6 +25,6 @@ Prove: true. Goal Assigns nothing in 'foo' (2/2): Effect at line 19 Assume { (* Heap *) Have: linked(Malloc_0). } -Prove: !valid_rd(Malloc_0, global(L_a_70), 1). +Prove: !valid_rd(Malloc_0, global(L_a_23), 1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_local.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_local.1.res.oracle index 159a4297145e90985251e0b8209bd6b207c5702d..2431cfbc1f661a5fe3c36a115b2d478e2b7df8e6 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_local.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_local.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Raw)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_local.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -11,7 +10,7 @@ Goal Assigns nothing in 'bar': Effect at line 28 Assume { (* Heap *) Have: linked(Malloc_0). } -Prove: !valid_rd(Malloc_0, global(L_a_75), 1). +Prove: !valid_rd(Malloc_0, global(L_a_28), 1). ------------------------------------------------------------ ------------------------------------------------------------ @@ -21,13 +20,13 @@ Prove: !valid_rd(Malloc_0, global(L_a_75), 1). Goal Assigns nothing in 'foo' (1/2): Effect at line 18 Assume { (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). } -Prove: !valid_rd(Malloc_0, shift_PTR(global(L_pa_71), 0), 1). +Prove: !valid_rd(Malloc_0, global(L_pa_24), 1). ------------------------------------------------------------ Goal Assigns nothing in 'foo' (2/2): Effect at line 19 Assume { (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). } -Prove: !valid_rd(Malloc_0, global(L_a_70), 1). +Prove: !valid_rd(Malloc_0, global(L_a_23), 1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.0.res.oracle index 79c024b998c8ffa7ef9d01c52d6ee9c0ace0fba9..ab7bcf805645880658dc451044d5632ecab40c6f 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_loopscope.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.1.res.oracle index dec7a6a061cefe3d53d6522699ef86dd62651f85..59e4049f542282baa9f40587d3880dea4f01eabc 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_loopscope.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.res.oracle deleted file mode 100644 index aaaa6f235f659662986395f6e4be17d7952cb23a..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.res.oracle +++ /dev/null @@ -1,33 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_loopscope.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -tests/wp_typed/unit_loopscope.i:14:[wp] warning: Missing assigns clause (assigns 'everything' instead) ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Preservation of Invariant (file tests/wp_typed/unit_loopscope.i, line 13): -Assume { - (* Invariant (file tests/wp_typed/unit_loopscope.i, line 13) *) - (* tests/wp_typed/unit_loopscope.i:14: Invariant: *) - Have: false. -} -Prove: false. - ------------------------------------------------------------- - -Goal Establishment of Invariant (file tests/wp_typed/unit_loopscope.i, line 13): -Assume { - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base written_1))<=0). - (* Pre-condition (file tests/wp_typed/unit_loopscope.i, line 8) in 'f' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 written_1 1). -} -Prove: false. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.0.res.oracle index 8fe73bd4fc319d56b68df0072e9480f937109b2e..c3f16fc81ec694917366905231f0bcfb7e12258a 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_matrix.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.1.res.oracle index 24b7b39febe9a3a49cd4dd9592c5f1b5b0227fc9..64d62c9876d56f31fe61f880fa8cec2870a6999f 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_matrix.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.res.oracle deleted file mode 100644 index 87a716add8675e53626b4f4b5f535f42174c308a..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.res.oracle +++ /dev/null @@ -1,42 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_matrix.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function make ------------------------------------------------------------- - -Goal Post-condition 'OK1' in 'make': -Let m_0 = t_2[a_0->t_2[a_0][b_0->1]]. -Let x_0 = m_0[c_0->m_0[c_0][d_0->2]][a_0][b_0]. -Assume { - (* Domain *) - Type: (is_sint32 a_0) /\ (is_sint32 b_0) /\ (is_sint32 c_0) - /\ (is_sint32 d_0) /\ (is_sint32 x_0). - (* Goal *) - When: a_0!=c_0. -} -Prove: 1=x_0. - ------------------------------------------------------------- - -Goal Post-condition 'OK2' in 'make': -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'KO' in 'make': -Let m_0 = t_2[a_0->t_2[a_0][b_0->1]]. -Let x_0 = m_0[c_0->m_0[c_0][d_0->2]][a_0][b_0]. -Assume { - (* Domain *) - Type: (is_sint32 a_0) /\ (is_sint32 b_0) /\ (is_sint32 c_0) - /\ (is_sint32 d_0) /\ (is_sint32 x_0). -} -Prove: 1=x_0. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_string.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_string.0.res.oracle index d19d4f389f80b547aba776a211009e97f3392ea3..ff7216c4f0399a33af1dfaf33a7de24f770b0f5e 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_string.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_string.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_string.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_string.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_string.1.res.oracle index 636f17340d0ab82a1fede3e3f524219cff86c420..1376bb495dbdd6ba0797317e0c19e4db7aea27aa 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_string.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_string.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_string.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_string.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_string.res.oracle deleted file mode 100644 index 58cbb6c4823361ab1bc079b72ef62514d72bd016..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_string.res.oracle +++ /dev/null @@ -1,88 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_string.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function f ------------------------------------------------------------- - -Goal Assertion 'AB' (file tests/wp_typed/unit_string.i, line 11): -Assume { (* Heap *) Have: (linked Malloc_0) /\ (sconst Mchar_0). } -Prove: Str_2!=Str_5. - ------------------------------------------------------------- - -Goal Assertion 'B_valid' (file tests/wp_typed/unit_string.i, line 12): -Assume { - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0). - (* Assertion 'AB' (file tests/wp_typed/unit_string.i, line 11) *) - (* tests/wp_typed/unit_string.i:11: Assertion 'AB': *) - Have: Str_2!=Str_5. -} -Prove: (valid_rd Malloc_0 (shift_sint8 (global Str_5) 0) 3). - ------------------------------------------------------------- - -Goal Assertion 'B_out' (file tests/wp_typed/unit_string.i, line 13): -Let a_0 = (global Str_5). -Assume { - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0). - (* Assertion 'AB' (file tests/wp_typed/unit_string.i, line 11) *) - (* tests/wp_typed/unit_string.i:11: Assertion 'AB': *) - Have: Str_2!=Str_5. - (* Assertion 'B_valid' (file tests/wp_typed/unit_string.i, line 12) *) - (* tests/wp_typed/unit_string.i:12: Assertion 'B_valid': *) - Have: (valid_rd Malloc_0 (shift_sint8 a_0 0) 3). -} -Prove: not (valid_rd Malloc_0 (shift_sint8 a_0 3) 1). - ------------------------------------------------------------- - -Goal Assertion 'B_rw' (file tests/wp_typed/unit_string.i, line 14): -Let a_0 = (global Str_5). -Assume { - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0). - (* Assertion 'AB' (file tests/wp_typed/unit_string.i, line 11) *) - (* tests/wp_typed/unit_string.i:11: Assertion 'AB': *) - Have: Str_2!=Str_5. - (* Assertion 'B_valid' (file tests/wp_typed/unit_string.i, line 12) *) - (* tests/wp_typed/unit_string.i:12: Assertion 'B_valid': *) - Have: (valid_rd Malloc_0 (shift_sint8 a_0 0) 3). - (* Assertion 'B_out' (file tests/wp_typed/unit_string.i, line 13) *) - (* tests/wp_typed/unit_string.i:13: Assertion 'B_out': *) - Have: not (valid_rd Malloc_0 (shift_sint8 a_0 3) 1). -} -Prove: not (valid_rw Malloc_0 (shift_sint8 a_0 1) 1). - ------------------------------------------------------------- - -Goal Assertion 'VAL' (file tests/wp_typed/unit_string.i, line 15): -Let a_0 = (global Str_5). -Assume { - (* Goal *) - When: (0<=i_2) /\ (i_2<=2). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0). - (* Assertion 'AB' (file tests/wp_typed/unit_string.i, line 11) *) - (* tests/wp_typed/unit_string.i:11: Assertion 'AB': *) - Have: Str_2!=Str_5. - (* Assertion 'B_valid' (file tests/wp_typed/unit_string.i, line 12) *) - (* tests/wp_typed/unit_string.i:12: Assertion 'B_valid': *) - Have: (valid_rd Malloc_0 (shift_sint8 a_0 0) 3). - (* Assertion 'B_out' (file tests/wp_typed/unit_string.i, line 13) *) - (* tests/wp_typed/unit_string.i:13: Assertion 'B_out': *) - Have: not (valid_rd Malloc_0 (shift_sint8 a_0 3) 1). - (* Assertion 'B_rw' (file tests/wp_typed/unit_string.i, line 14) *) - (* tests/wp_typed/unit_string.i:14: Assertion 'B_rw': *) - Have: not (valid_rw Malloc_0 (shift_sint8 a_0 1) 1). -} -Prove: Mchar_0[(shift_sint8 a_0 i_2)]= - Mchar_0[(shift_sint8 (global Str_11) (3+i_2))]. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_tset.0.res.oracle index 0ba3816684aeacdf9c51f6fe868ad81a200332f2..ceaa7b2d0306e584dbaf5fbcd0d60aeeb38582af 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_tset.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_tset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_tset.1.res.oracle index 0c914402bd1ce4f2fbc18b5aaed9908d8897efcf..212d4ea2af788dca5a9a5ac41cd6cb1f01c7962f 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/unit_tset.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_tset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/unit_tset.res.oracle deleted file mode 100644 index 06776198d7710c48e294315929505fec12c602cd..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.res.oracle +++ /dev/null @@ -1,50 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/unit_tset.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function complex ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/unit_tset.i, line 6) in 'job'' in 'complex' at call 'job' (file tests/wp_typed/unit_tset.i, line 20) -: -Let x_0 = Mint_6[(shiftfield_F_S_size (shift_S (global P_s_79) 0))]. -Assume { - (* Domain *) - Type: (is_sint32 x_0). - (* Heap *) - Have: (linked Malloc_5). - (* Pre-condition (file tests/wp_typed/unit_tset.i, line 16) in 'complex' *) - (* Pre-condition: *) - Have: x_0<=49. -} -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function complex with behavior default_for_stmt_2 ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/unit_tset.i, line 19) at call 'job' (file tests/wp_typed/unit_tset.i, line 20): -Call Effect at line 20 -Let a_0 = (shift_S (global P_s_79) 0). -Let x_0 = Mint_0[(shiftfield_F_S_size a_0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_0). - (* Goal *) - When: (0<x_0) -> (x_0<=49). - (* Heap *) - Have: (linked Malloc_5). - (* Pre-condition (file tests/wp_typed/unit_tset.i, line 16) in 'complex' *) - (* Pre-condition: *) - Have: x_0<=49. - (* tests/wp_typed/unit_tset.i:20: Call Effects *) - Have: (havoc Mint_0 Mint_5 (shift_sint32 (shiftfield_F_S_value a_0) 1) x_0). -} -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.0.res.oracle index 8946410e6d6dca31d89e8ad172398268c51970ce..543c297fa1af65a9764a377b45efd20cca2e72bb 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_bitwise.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.1.res.oracle index 02ac6fb7783701e21b928f6e6b4b8ad221d4c4c7..f60d85ca6dccbdb22ec5084d7ed8ced6d6ac0cb3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_bitwise.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_bitwise.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_collect.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_collect.0.res.oracle index cd0d3e97d19c822834c00950d7065d35eb9611ce..3469aa487d6046bab2a7807afe711f74f3b965f8 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_collect.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_collect.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_collect.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_collect.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_collect.1.res.oracle index 93dfaef88a3b565b40f723733fc06883c9ecc9ac..d02b25d46ad93caaea5228ae1a556c3ba0ea5b93 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_collect.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_collect.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_collect.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_collect.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_collect.res.oracle deleted file mode 100644 index 5d5b33c1c432897439ccee1b0ce5956e265e040a..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_collect.res.oracle +++ /dev/null @@ -1,528 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_collect.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function caller ------------------------------------------------------------- - -Goal Post-condition 'K' in 'caller': -Let x_0 = k_3-1. -Let m_0 = p_6[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1_sint32 p_6) /\ (is_sint32 k_3) /\ (is_sint32 v_0) - /\ (is_sint32 v_2) /\ (is_sint32 x1_0) /\ (is_sint32 x2_0) - /\ (is_sint32 x_0) /\ (is_sint32 (1+k_3)) /\ (IsArray1_sint32 m_0) - /\ (IsArray1_sint32 m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 45) in 'caller' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:52: Call 'job' *) - Have: (k_3<=10) /\ (EqArray1_int 10 m_0 p_6[x_0->x1_0]). - (* tests/wp_typed/user_collect.i:53: Call 'job' *) - Have: (EqArray1_int 10 m_1 m_0[k_3->x2_0]). -} -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'P1' in 'caller': -Let x_0 = k_3-1. -Let m_0 = p_6[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1_sint32 p_6) /\ (is_sint32 k_3) /\ (is_sint32 v_0) - /\ (is_sint32 v_2) /\ (is_sint32 x1_0) /\ (is_sint32 x2_0) - /\ (is_sint32 x_0) /\ (is_sint32 (1+k_3)) /\ (IsArray1_sint32 m_0) - /\ (IsArray1_sint32 m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 45) in 'caller' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:52: Call 'job' *) - Have: (k_3<=10) /\ (EqArray1_int 10 m_0 p_6[x_0->x1_0]). - (* tests/wp_typed/user_collect.i:53: Call 'job' *) - Have: (EqArray1_int 10 m_1 m_0[k_3->x2_0]). -} -Prove: v_2=x1_0. - ------------------------------------------------------------- - -Goal Post-condition 'P2' in 'caller': -Let x_0 = k_3-1. -Let m_0 = p_6[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1_sint32 p_6) /\ (is_sint32 k_3) /\ (is_sint32 v_0) - /\ (is_sint32 v_2) /\ (is_sint32 x1_0) /\ (is_sint32 x2_0) - /\ (is_sint32 x_0) /\ (is_sint32 (1+k_3)) /\ (IsArray1_sint32 m_0) - /\ (IsArray1_sint32 m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 45) in 'caller' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:52: Call 'job' *) - Have: (k_3<=10) /\ (EqArray1_int 10 m_0 p_6[x_0->x1_0]). - (* tests/wp_typed/user_collect.i:53: Call 'job' *) - Have: (EqArray1_int 10 m_1 m_0[k_3->x2_0]). -} -Prove: v_0=x2_0. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_collect.i, line 10) in 'job'' in 'caller' at call 'job' (file tests/wp_typed/user_collect.i, line 52) -: -Assume { - (* Domain *) - Type: (is_sint32 k_9) /\ (is_sint32 p_0[k_9]) /\ (is_sint32 p_0[1+k_9]). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 45) in 'caller' *) - (* Pre-condition: *) - Have: (0<=k_9) /\ (k_9<=8). -} -Prove: k_9<=9. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_collect.i, line 10) in 'job'' in 'caller' at call 'job' (file tests/wp_typed/user_collect.i, line 53) -: -Let m_0 = p_9[k_7->v_2]. -Let x_0 = 1+k_7. -Assume { - (* Domain *) - Type: (IsArray1_sint32 p_9) /\ (is_sint32 k_7) /\ (is_sint32 x1_0) - /\ (IsArray1_sint32 m_0) /\ (is_sint32 p_0[k_7]) /\ (is_sint32 x_0) - /\ (is_sint32 p_0[x_0]). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 45) in 'caller' *) - (* Pre-condition: *) - Have: (0<=k_7) /\ (k_7<=8). - (* tests/wp_typed/user_collect.i:52: Call 'job' *) - Have: (k_7<=9) /\ (EqArray1_int 10 m_0 p_9[k_7->x1_0]). -} -Prove: -1<=k_7. - ------------------------------------------------------------- ------------------------------------------------------------- - Function caller2 ------------------------------------------------------------- - -Goal Post-condition 'K' in 'caller2': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 57) in 'caller2' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:65: Call 'job2' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 q_7[x_0->s1_0]). - (* tests/wp_typed/user_collect.i:66: Call 'job2' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'Q1' in 'caller2': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 57) in 'caller2' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:65: Call 'job2' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 q_7[x_0->s1_0]). - (* tests/wp_typed/user_collect.i:66: Call 'job2' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: (EqS_S v_2 s1_0). - ------------------------------------------------------------- - -Goal Post-condition 'Q2' in 'caller2': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 57) in 'caller2' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:65: Call 'job2' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 q_7[x_0->s1_0]). - (* tests/wp_typed/user_collect.i:66: Call 'job2' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: (EqS_S v_0 s2_0). - ------------------------------------------------------------- - -Goal Post-condition 'R' in 'caller2': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Let m_2 = q_7[x_0->s1_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 57) in 'caller2' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:65: Call 'job2' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 m_2). - (* tests/wp_typed/user_collect.i:66: Call 'job2' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: (EqArray1_S_S 10 m_1 m_2[k_3->s2_0]). - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_collect.i, line 21) in 'job2'' in 'caller2' at call 'job2' (file tests/wp_typed/user_collect.i, line 65) -: -Assume { - (* Domain *) - Type: (is_sint32 k_9) /\ (IsS_S q_0[k_9]) /\ (IsS_S q_0[1+k_9]). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 57) in 'caller2' *) - (* Pre-condition: *) - Have: (0<=k_9) /\ (k_9<=8). -} -Prove: k_9<=9. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_collect.i, line 21) in 'job2'' in 'caller2' at call 'job2' (file tests/wp_typed/user_collect.i, line 66) -: -Let m_0 = q_10[k_7->v_2]. -Let x_0 = 1+k_7. -Assume { - (* Domain *) - Type: (IsArray1S_S q_10) /\ (IsS_S s1_0) /\ (is_sint32 k_7) - /\ (IsArray1S_S m_0) /\ (IsS_S q_0[k_7]) /\ (is_sint32 x_0) - /\ (IsS_S q_0[x_0]). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 57) in 'caller2' *) - (* Pre-condition: *) - Have: (0<=k_7) /\ (k_7<=8). - (* tests/wp_typed/user_collect.i:65: Call 'job2' *) - Have: (k_7<=9) /\ (EqArray1_S_S 10 m_0 q_10[k_7->s1_0]). -} -Prove: -1<=k_7. - ------------------------------------------------------------- ------------------------------------------------------------- - Function caller3 ------------------------------------------------------------- - -Goal Post-condition 'K' in 'caller3': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 70) in 'caller3' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:78: Call 'job3' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 q_7[x_0->s1_0]). - (* tests/wp_typed/user_collect.i:79: Call 'job3' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'Q1' in 'caller3': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 70) in 'caller3' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:78: Call 'job3' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 q_7[x_0->s1_0]). - (* tests/wp_typed/user_collect.i:79: Call 'job3' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: (EqS_S v_2 s1_0). - ------------------------------------------------------------- - -Goal Post-condition 'Q2' in 'caller3': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 70) in 'caller3' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:78: Call 'job3' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 q_7[x_0->s1_0]). - (* tests/wp_typed/user_collect.i:79: Call 'job3' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: (EqS_S v_0 s2_0). - ------------------------------------------------------------- - -Goal Post-condition 'R' in 'caller3': -Let x_0 = k_3-1. -Let m_0 = q_7[x_0->v_2]. -Let m_1 = m_0[k_3->v_0]. -Let m_2 = q_7[x_0->s1_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_7) /\ (IsS_S s1_0) /\ (IsS_S s2_0) /\ (IsS_S v_0) - /\ (IsS_S v_2) /\ (is_sint32 k_3) /\ (is_sint32 x_0) - /\ (is_sint32 (1+k_3)) /\ (IsArray1S_S m_0) /\ (IsArray1S_S m_1). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 70) in 'caller3' *) - (* Pre-condition: *) - Have: (0<k_3) /\ (k_3<=9). - (* tests/wp_typed/user_collect.i:78: Call 'job3' *) - Have: (k_3<=10) /\ (EqArray1_S_S 10 m_0 m_2). - (* tests/wp_typed/user_collect.i:79: Call 'job3' *) - Have: (EqArray1_S_S 10 m_1 m_0[k_3->s2_0]). -} -Prove: (EqArray1_S_S 10 m_1 m_2[k_3->s2_0]). - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_collect.i, line 32) in 'job3'' in 'caller3' at call 'job3' (file tests/wp_typed/user_collect.i, line 78) -: -Assume { - (* Domain *) - Type: (is_sint32 k_9) /\ (IsS_S q_0[k_9]) /\ (IsS_S q_0[1+k_9]). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 70) in 'caller3' *) - (* Pre-condition: *) - Have: (0<=k_9) /\ (k_9<=8). -} -Prove: k_9<=9. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_collect.i, line 32) in 'job3'' in 'caller3' at call 'job3' (file tests/wp_typed/user_collect.i, line 79) -: -Let m_0 = q_10[k_7->v_2]. -Let x_0 = 1+k_7. -Assume { - (* Domain *) - Type: (IsArray1S_S q_10) /\ (IsS_S s1_0) /\ (is_sint32 k_7) - /\ (IsArray1S_S m_0) /\ (IsS_S q_0[k_7]) /\ (is_sint32 x_0) - /\ (IsS_S q_0[x_0]). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 70) in 'caller3' *) - (* Pre-condition: *) - Have: (0<=k_7) /\ (k_7<=8). - (* tests/wp_typed/user_collect.i:78: Call 'job3' *) - Have: (k_7<=9) /\ (EqArray1_S_S 10 m_0 q_10[k_7->s1_0]). -} -Prove: -1<=k_7. - ------------------------------------------------------------- ------------------------------------------------------------- - Function job ------------------------------------------------------------- - -Goal Post-condition 'K' in 'job': -Assume { - (* Domain *) - Type: (is_sint32 k_0) /\ (is_sint32 (1+k_0)). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 10) in 'job' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'P' in 'job': -Let m_0 = p_1[k_0->x_0]. -Assume { - (* Domain *) - Type: (IsArray1_sint32 p_1) /\ (is_sint32 k_0) /\ (is_sint32 x_0) - /\ (IsArray1_sint32 m_0). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 10) in 'job' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: (EqArray1_int 10 m_0 m_0). - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 13) in 'job' (1/3): -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 13) in 'job' (2/3): -Effect at line 17 -Assume { - (* Domain *) - Type: (is_sint32 k_0). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 10) in 'job' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 13) in 'job' (3/3): -Effect at line 17 -Assume { - (* Domain *) - Type: (is_sint32 tmp_1). - (* Goal *) - When: (0<=tmp_1) /\ (tmp_1<=9). -} -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function job2 ------------------------------------------------------------- - -Goal Post-condition 'K' in 'job2': -Assume { - (* Domain *) - Type: (is_sint32 k_0) /\ (is_sint32 (1+k_0)). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 21) in 'job2' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'Q' in 'job2': -Let m_0 = q_1[k_0->s_0]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_1) /\ (IsS_S s_0) /\ (is_sint32 k_0) - /\ (IsArray1S_S m_0). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 21) in 'job2' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: (EqArray1_S_S 10 m_0 m_0). - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 24) in 'job2' (1/3): -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 24) in 'job2' (2/3): -Effect at line 28 -Assume { - (* Domain *) - Type: (is_sint32 k_0). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 21) in 'job2' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 24) in 'job2' (3/3): -Effect at line 28 -Assume { - (* Domain *) - Type: (is_sint32 tmp_1). - (* Goal *) - When: (0<=tmp_1) /\ (tmp_1<=9). -} -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function job3 ------------------------------------------------------------- - -Goal Post-condition 'K' in 'job3': -Assume { - (* Domain *) - Type: (is_sint32 k_0) /\ (is_sint32 (1+k_0)). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 32) in 'job3' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'Q' in 'job3': -Let a_0 = s_0.F_S_f. -Let m_0 = q_1[k_0->{ F_S_f = q_1[k_0].F_S_f[0->a_0[0]][1->a_0[1]] }]. -Assume { - (* Domain *) - Type: (IsArray1S_S q_1) /\ (IsS_S s_0) /\ (is_sint32 k_0) - /\ (IsArray1S_S m_0). - (* Pre-condition (file tests/wp_typed/user_collect.i, line 32) in 'job3' *) - (* Pre-condition: *) - Have: (0<=k_0) /\ (k_0<=9). -} -Prove: (EqArray1_S_S 10 m_0 q_1[k_0->s_0]). - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 35) in 'job3' (1/3): -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 35) in 'job3' (2/3): -Effect at line 39 -Assume { - (* Domain *) - Type: (is_sint32 k_0). - (* Goal *) - When: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_collect.i, line 35) in 'job3' (3/3): -Effect at line 40 -Assume { - (* Domain *) - Type: (is_sint32 k_0). - (* Goal *) - When: (0<=k_0) /\ (k_0<=9). -} -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_init.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_init.0.res.oracle index 8b9c167eee989f015e2614ba6e88058bf42ae604..e35e18f806055e7a6b2d00c521b56dfd5f30bff3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_init.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_init.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_init.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -154,13 +153,7 @@ Prove: included(a_2, 1, a_1, n). ------------------------------------------------------------ -Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init' (1/2): -Effect at line 12 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init' (2/2): +Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init': Effect at line 12 Let a_1 = shift_sint32(a, 0). Assume { diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_init.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_init.1.res.oracle index 0f75da865eb3bc42cb022fae5c2fd8a4fcfea53a..3f0fa3b938ef982cb5e5d811f81bcd8b9f3b0c05 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_init.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_init.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_init.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -154,13 +153,7 @@ Prove: included(a_2, 1, a_1, n). ------------------------------------------------------------ -Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init' (1/2): -Effect at line 12 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init' (2/2): +Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init': Effect at line 12 Let a_1 = shift_sint32(a, 0). Assume { diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_init.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_init.res.oracle deleted file mode 100644 index 2540220e9b514ba448a978410def03991c33b86d..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_init.res.oracle +++ /dev/null @@ -1,245 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_init.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function init ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/user_init.i, line 3) in 'init': -Let a_0 = (shift_sint32 a_2 0). -Assume { - (* Domain *) - Type: (is_sint32 i_2) /\ (is_sint32 n_0). - (* Goal *) - When: (i_4<n_0) /\ (0<=i_4) /\ (is_sint32 i_4). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_2))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_0 n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. - (* tests/wp_typed/user_init.i:12: Assigns *) - (* tests/wp_typed/user_init.i:12: Loop assigns ...: *) - Have: (havoc Mint_4 Mint_2 a_0 n_0). - (* Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Partial': *) - Have: forall i_0:int. - (i_0<i_2) -> (0<=i_0) -> (is_sint32 i_0) - -> (v_1=Mint_2[(shift_sint32 a_2 i_0)]). - (* Invariant 'Range' (file tests/wp_typed/user_init.i, line 8) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Range': *) - Have: (0<=i_2) /\ (i_2<=n_0). - (* tests/wp_typed/user_init.i:12: Else *) - Have: n_0<=i_2. -} -Prove: v_1=Mint_2[(shift_sint32 a_2 i_4)]. - ------------------------------------------------------------- - -Goal Preservation of Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9): -Let a_1 = (shift_sint32 a_0 0). -Assume { - (* Domain *) - Type: (is_sint32 i_2) /\ (is_sint32 n_0) /\ (is_sint32 (1+i_2)). - (* Goal *) - When: (0<=i_1) /\ (i_1<=i_2) /\ (is_sint32 i_1). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_1 n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. - (* tests/wp_typed/user_init.i:12: Assigns *) - (* tests/wp_typed/user_init.i:12: Loop assigns ...: *) - Have: (havoc Mint_4 Mint_1 a_1 n_0). - (* Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Partial': *) - Have: forall i_0:int. - (i_0<i_2) -> (0<=i_0) -> (is_sint32 i_0) - -> (v_0=Mint_1[(shift_sint32 a_0 i_0)]). - (* Invariant 'Range' (file tests/wp_typed/user_init.i, line 8) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Range': *) - Have: (0<=i_2) /\ (i_2<=n_0). - (* tests/wp_typed/user_init.i:12: Then *) - Have: i_2<n_0. -} -Prove: v_0=Mint_1[(shift_sint32 a_0 i_2)->v_0][(shift_sint32 a_0 i_1)]. - ------------------------------------------------------------- - -Goal Establishment of Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9): -Assume { (* Goal *) When: false. } -Prove: v_0=Mint_4[(shift_sint32 a_0 i_6)]. - ------------------------------------------------------------- - -Goal Preservation of Invariant 'Range' (file tests/wp_typed/user_init.i, line 8): -Let a_1 = (shift_sint32 a_0 0). -Assume { - (* Domain *) - Type: (is_sint32 i_2) /\ (is_sint32 n_0) /\ (is_sint32 (1+i_2)). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_1 n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. - (* tests/wp_typed/user_init.i:12: Assigns *) - (* tests/wp_typed/user_init.i:12: Loop assigns ...: *) - Have: (havoc Mint_4 Mint_3 a_1 n_0). - (* Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Partial': *) - Have: forall i_0:int. - (i_0<i_2) -> (0<=i_0) -> (is_sint32 i_0) - -> (v_0=Mint_3[(shift_sint32 a_0 i_0)]). - (* Invariant 'Range' (file tests/wp_typed/user_init.i, line 8) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Range': *) - Have: (0<=i_2) /\ (i_2<=n_0). - (* tests/wp_typed/user_init.i:12: Then *) - Have: i_2<n_0. -} -Prove: -1<=i_2. - ------------------------------------------------------------- - -Goal Establishment of Invariant 'Range' (file tests/wp_typed/user_init.i, line 8): -Assume { - (* Domain *) - Type: (is_sint32 n_0). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 (shift_sint32 a_0 0) n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. -} -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_init.i, line 10) (1/3): -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_init.i, line 10) (2/3): -Effect at line 12 -Let a_1 = (shift_sint32 a_0 0). -Assume { - (* Domain *) - Type: (is_sint32 i_2) /\ (is_sint32 n_0). - (* Goal *) - When: (valid_rd Malloc_0 a_1 n_0). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_1 n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. - (* tests/wp_typed/user_init.i:12: Assigns *) - (* tests/wp_typed/user_init.i:12: Loop assigns ...: *) - Have: (havoc Mint_4 Mint_3 a_1 n_0). - (* Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Partial': *) - Have: forall i_0:int. - (i_0<i_2) -> (0<=i_0) -> (is_sint32 i_0) - -> (v_0=Mint_3[(shift_sint32 a_0 i_0)]). - (* Invariant 'Range' (file tests/wp_typed/user_init.i, line 8) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Range': *) - Have: (0<=i_2) /\ (i_2<=n_0). - (* tests/wp_typed/user_init.i:12: Then *) - Have: i_2<n_0. -} -Prove: (included a_1 n_0 a_1 n_0). - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_init.i, line 10) (3/3): -Effect at line 12 -Let a_1 = (shift_sint32 a_0 i_2). -Let a_2 = (shift_sint32 a_0 0). -Assume { - (* Domain *) - Type: (is_sint32 i_2) /\ (is_sint32 n_0). - (* Goal *) - When: (valid_rd Malloc_0 a_1 1). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_2 n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. - (* tests/wp_typed/user_init.i:12: Assigns *) - (* tests/wp_typed/user_init.i:12: Loop assigns ...: *) - Have: (havoc Mint_4 Mint_3 a_2 n_0). - (* Invariant 'Partial' (file tests/wp_typed/user_init.i, line 9) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Partial': *) - Have: forall i_0:int. - (i_0<i_2) -> (0<=i_0) -> (is_sint32 i_0) - -> (v_0=Mint_3[(shift_sint32 a_0 i_0)]). - (* Invariant 'Range' (file tests/wp_typed/user_init.i, line 8) *) - (* tests/wp_typed/user_init.i:12: Invariant 'Range': *) - Have: (0<=i_2) /\ (i_2<=n_0). - (* tests/wp_typed/user_init.i:12: Then *) - Have: i_2<n_0. -} -Prove: (included a_1 1 a_2 n_0). - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init' (1/2): -Effect at line 12 -Assume { - (* Domain *) - Type: (is_sint32 n_0). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 (shift_sint32 a_0 0) n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_typed/user_init.i, line 4) in 'init' (2/2): -Effect at line 12 -Let a_1 = (shift_sint32 a_0 0). -Assume { - (* Domain *) - Type: (is_sint32 n_0). - (* Heap *) - Have: (linked Malloc_1) /\ ((region (base a_0))<=0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 1) in 'init' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_1 a_1 n_0). - (* Pre-condition (file tests/wp_typed/user_init.i, line 2) in 'init' *) - (* Pre-condition: *) - Have: 0<=n_0. - (* tests/wp_typed/user_init.i:12: Assigns *) - (* tests/wp_typed/user_init.i:12: Loop assigns ...: *) - Have: (havoc Mint_4 Mint_3 a_1 n_0). -} -Prove: (valid_rd Malloc_1 a_1 n_0) -> (included a_1 n_0 a_1 n_0). - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_injector.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_injector.0.res.oracle deleted file mode 100644 index 9d35fc2e1e749f2baac83b921181898245dc7784..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_injector.0.res.oracle +++ /dev/null @@ -1,122 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_injector.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -tests/wp_typed/user_injector.i:61:[wp] warning: Validity of unsized array not implemented yet (considered valid). -tests/wp_typed/user_injector.i:60:[wp] warning: Validity of unsized array not implemented yet (considered valid). ------------------------------------------------------------- - Function job ------------------------------------------------------------- - -Goal Post-condition 'SEQ' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'ID1' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'ID2' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'R1' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'R2' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'R0' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'E1' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'E2' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (1/3): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (2/3): -Effect at line 58 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (3/3): -Call Result at line 60 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (1/9): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (2/9): -Effect at line 58 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (3/9): -Call Result at line 60 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (4/9): -Call Result at line 61 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (5/9): -Effect at line 63 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (6/9): -Effect at line 64 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (7/9): -Effect at line 66 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (8/9): -Effect at line 66 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (9/9): -Effect at line 66 -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_injector.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_injector.1.res.oracle deleted file mode 100644 index cb1ea1fe3c5e7b9efda4a55ac39c2ffd98e76858..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_injector.1.res.oracle +++ /dev/null @@ -1,99 +0,0 @@ -# frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_injector.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -[wp] Collecting variable usage -tests/wp_typed/user_injector.i:61:[wp] warning: Validity of unsized array not implemented yet (considered valid). -tests/wp_typed/user_injector.i:60:[wp] warning: Validity of unsized array not implemented yet (considered valid). ------------------------------------------------------------- - Function job ------------------------------------------------------------- - -Goal Post-condition 'SEQ' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'ID1' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'ID2' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'R1' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'R2' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'R0' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'E1' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Post-condition 'E2' in 'job': -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (1/2): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (2/2): -Call Result at line 60 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (1/6): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (2/6): -Call Result at line 60 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (3/6): -Call Result at line 61 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (4/6): -Effect at line 66 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (5/6): -Effect at line 66 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'A' in 'job' (6/6): -Effect at line 66 -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_injector.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_injector.res.oracle index fe02c094746267fd75e011186c2ff66b5681ca0f..74b2953bccc4790bf9d9605ee2b4899d0c0e844d 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_injector.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_injector.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_injector.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_rec.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_rec.0.res.oracle index 349712dd0e8c37ed2f76d122d91b3519c1937f98..b5eaba6202bc8d4cc7637fb00b83ebd7e02ccb06 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_rec.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_rec.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_rec.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -26,16 +25,19 @@ Prove: let x_0 = (L_fact m_0) in Goal Post-condition (file tests/wp_typed/user_rec.i, line 6) in 'F1': Assume { - Type: is_sint32(F1_0) /\ is_sint32(i) /\ is_sint32(n). + Type: is_sint32(F1_0) /\ is_sint32(i) /\ is_sint32(n) /\ + is_sint32(retres_0). If n <= 1 - Then { Have: F1_0 = 1. } + Then { Have: retres_0 = 1. (* Return *) Have: F1_0 = 1. } Else { + Let x = L_fact(i - 1). (* Invariant *) - Have: L_fact(i - 1) = F1_0. + Have: x = F1_0. (* Invariant *) Have: (2 <= i) /\ (i <= (1 + n)). (* Else *) Have: n < i. + Have: (retres_0 = F1_0) /\ (x = retres_0). } } Prove: L_fact(n) = F1_0. diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_rec.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_rec.1.res.oracle index bf9d0a8cf82af3b1bcceb460b4ab8798dccfa0d4..ba3e4bf8636f14548667f76415755d632583907c 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_rec.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_rec.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_rec.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -26,16 +25,19 @@ Prove: let x_0 = (L_fact m_0) in Goal Post-condition (file tests/wp_typed/user_rec.i, line 6) in 'F1': Assume { - Type: is_sint32(F1_0) /\ is_sint32(i) /\ is_sint32(n). + Type: is_sint32(F1_0) /\ is_sint32(i) /\ is_sint32(n) /\ + is_sint32(retres_0). If n <= 1 - Then { Have: F1_0 = 1. } + Then { Have: retres_0 = 1. (* Return *) Have: F1_0 = 1. } Else { + Let x = L_fact(i - 1). (* Invariant *) - Have: L_fact(i - 1) = F1_0. + Have: x = F1_0. (* Invariant *) Have: (2 <= i) /\ (i <= (1 + n)). (* Else *) Have: n < i. + Have: (retres_0 = F1_0) /\ (x = retres_0). } } Prove: L_fact(n) = F1_0. diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_rec.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_rec.res.oracle deleted file mode 100644 index 50dfabb7207f799b911db6582f23825242c41c0f..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_rec.res.oracle +++ /dev/null @@ -1,268 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_rec.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Global ------------------------------------------------------------- - -Lemma fact_ge1: -Prove: 0<(L_fact n_0) - ------------------------------------------------------------- - -Lemma fact_next: -Assume: 'fact_ge1' -Prove: let x_0 = (L_fact m_0) in - (0<n_0) -> (n_0<=m_0) - -> ((n_0*(x_0 div (L_fact n_0)))=(x_0 div (L_fact (n_0-1)))) - ------------------------------------------------------------- ------------------------------------------------------------- - Function F1 ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/user_rec.i, line 6) in 'F1': -Assume { - (* Domain *) - Type: (is_sint32 F1_0) /\ (is_sint32 i_1) /\ (is_sint32 i_2) - /\ (is_sint32 n_0). - (* tests/wp_typed/user_rec.i:9: Conditional *) - If: n_0<=1 - Then { (* tests/wp_typed/user_rec.i:9: Assignment *) Have: 1=F1_0. } - Else { - (* Invariant (file tests/wp_typed/user_rec.i, line 13) *) - (* tests/wp_typed/user_rec.i:16: Invariant: *) - Have: F1_0=(L_fact (i_1-1)). - (* Invariant (file tests/wp_typed/user_rec.i, line 12) *) - (* tests/wp_typed/user_rec.i:16: Invariant: *) - Have: (2<=i_1) /\ (i_1<=(1+n_0)). - (* tests/wp_typed/user_rec.i:16: Else *) - Have: n_0<i_1. - } -} -Prove: F1_0=(L_fact n_0). - ------------------------------------------------------------- - -Goal Preservation of Invariant (file tests/wp_typed/user_rec.i, line 12): -Assume { - (* Domain *) - Type: (is_sint32 i_1) /\ (is_sint32 n_1) /\ (is_sint32 (1+i_1)) - /\ (is_sint32 (L_fact (i_1-1))). - (* tests/wp_typed/user_rec.i:9: Else *) - Have: 1<n_1. - (* Invariant (file tests/wp_typed/user_rec.i, line 12) *) - (* tests/wp_typed/user_rec.i:16: Invariant: *) - Have: (2<=i_1) /\ (i_1<=(1+n_1)). - (* tests/wp_typed/user_rec.i:16: Then *) - Have: i_1<=n_1. -} -Prove: 0<i_1. - ------------------------------------------------------------- - -Goal Establishment of Invariant (file tests/wp_typed/user_rec.i, line 12): -Assume { - (* Domain *) - Type: (is_sint32 n_1). - (* tests/wp_typed/user_rec.i:9: Else *) - Have: 1<n_1. -} -Prove: true. - ------------------------------------------------------------- - -Goal Preservation of Invariant (file tests/wp_typed/user_rec.i, line 13): -Let x_0 = (L_fact (i_1-1)). -Let x_1 = i_1*x_0. -Assume { - (* Domain *) - Type: (is_sint32 i_1) /\ (is_sint32 n_0) /\ (is_sint32 (1+i_1)) - /\ (is_sint32 x_0) /\ (is_sint32 x_1). - (* tests/wp_typed/user_rec.i:9: Else *) - Have: 2<=n_0. - (* Invariant (file tests/wp_typed/user_rec.i, line 12) *) - (* tests/wp_typed/user_rec.i:16: Invariant: *) - Have: (2<=i_1) /\ (i_1<=(1+n_0)). - (* tests/wp_typed/user_rec.i:16: Then *) - Have: i_1<=n_0. -} -Prove: (L_fact i_1)=x_1. - ------------------------------------------------------------- - -Goal Establishment of Invariant (file tests/wp_typed/user_rec.i, line 13): -Assume { - (* Domain *) - Type: (is_sint32 n_0). - (* tests/wp_typed/user_rec.i:9: Else *) - Have: 2<=n_0. -} -Prove: 1=(L_fact 1). - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_rec.i, line 14): -Assume { } -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function F2 ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/user_rec.i, line 20) in 'F2': -Assume { - (* Domain *) - Type: (is_sint32 F2_0) /\ (is_sint32 i_1) /\ (is_sint32 n_1). - (* Invariant 'PART' (file tests/wp_typed/user_rec.i, line 26) *) - (* tests/wp_typed/user_rec.i:29: Invariant 'PART': *) - Have: if (n_1<=1) then (1=F2_0) else (F2_0=(L_fact (i_1-1))). - (* Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 25) *) - (* tests/wp_typed/user_rec.i:29: Invariant 'RANGE': *) - Have: if (n_1<=1) then (2=i_1) else ((2<=i_1) /\ (i_1<=(1+n_1))). - (* tests/wp_typed/user_rec.i:29: Else *) - Have: n_1<i_1. -} -Prove: F2_0=(L_fact n_1). - ------------------------------------------------------------- - -Goal Preservation of Invariant 'PART' (file tests/wp_typed/user_rec.i, line 26): -Let x_0 = i_1*p_1. -Assume { - (* Domain *) - Type: (is_sint32 i_1) /\ (is_sint32 n_0) /\ (is_sint32 p_1) - /\ (is_sint32 (1+i_1)) /\ (is_sint32 x_0). - (* Invariant 'PART' (file tests/wp_typed/user_rec.i, line 26) *) - (* tests/wp_typed/user_rec.i:29: Invariant 'PART': *) - Have: if (n_0<=1) then (1=p_1) else (p_1=(L_fact (i_1-1))). - (* Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 25) *) - (* tests/wp_typed/user_rec.i:29: Invariant 'RANGE': *) - Have: if (n_0<=1) then (2=i_1) else ((2<=i_1) /\ (i_1<=(1+n_0))). - (* tests/wp_typed/user_rec.i:29: Then *) - Have: i_1<=n_0. -} -Prove: if (n_0<=1) then (1=x_0) else ((L_fact i_1)=x_0). - ------------------------------------------------------------- - -Goal Establishment of Invariant 'PART' (file tests/wp_typed/user_rec.i, line 26): -Assume { (* Domain *) Type: (is_sint32 n_0). } -Prove: (n_0<=1) \/ (1=(L_fact 1)). - ------------------------------------------------------------- - -Goal Preservation of Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 25): -Assume { - (* Domain *) - Type: (is_sint32 i_1) /\ (is_sint32 n_0) /\ (is_sint32 p_3) - /\ (is_sint32 (1+i_1)). - (* Invariant 'PART' (file tests/wp_typed/user_rec.i, line 26) *) - (* tests/wp_typed/user_rec.i:29: Invariant 'PART': *) - Have: if (n_0<=1) then (1=p_3) else (p_3=(L_fact (i_1-1))). - (* Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 25) *) - (* tests/wp_typed/user_rec.i:29: Invariant 'RANGE': *) - Have: if (n_0<=1) then (2=i_1) else ((2<=i_1) /\ (i_1<=(1+n_0))). - (* tests/wp_typed/user_rec.i:29: Then *) - Have: i_1<=n_0. -} -Prove: if (n_0<=1) then (1=i_1) else (0<i_1). - ------------------------------------------------------------- - -Goal Establishment of Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 25): -Assume { (* Domain *) Type: (is_sint32 n_0). } -Prove: (0<n_0) \/ (n_0<=1). - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_rec.i, line 27): -Assume { } -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function F4 ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/user_rec.i, line 33) in 'F4': -Let x_0 = (L_fact n_0). -Assume { - (* Domain *) - Type: (is_sint32 F4_0) /\ (is_sint32 n_0) /\ (is_sint32 n_2). - (* Invariant 'NEVER' (file tests/wp_typed/user_rec.i, line 39) *) - (* tests/wp_typed/user_rec.i:42: Invariant 'NEVER': *) - Have: if (n_0<=1) then (1=F4_0) else (F4_0=(x_0 div (L_fact n_2))). - (* Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 38) *) - (* tests/wp_typed/user_rec.i:42: Invariant 'RANGE': *) - Have: if (n_0<=1) then (n_0=n_2) else ((0<n_2) /\ (n_2<=n_0)). - (* tests/wp_typed/user_rec.i:42: Else *) - Have: n_2<2. -} -Prove: F4_0=x_0. - ------------------------------------------------------------- - -Goal Preservation of Invariant 'NEVER' (file tests/wp_typed/user_rec.i, line 39): -Let x_0 = n_2*p_1. -Let x_1 = (L_fact n_0). -Let x_2 = n_2-1. -Assume { - (* Domain *) - Type: (is_sint32 n_0) /\ (is_sint32 n_2) /\ (is_sint32 p_1) - /\ (is_sint32 x_2) /\ (is_sint32 x_0). - (* Invariant 'NEVER' (file tests/wp_typed/user_rec.i, line 39) *) - (* tests/wp_typed/user_rec.i:42: Invariant 'NEVER': *) - Have: if (n_0<=1) then (1=p_1) else (p_1=(x_1 div (L_fact n_2))). - (* Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 38) *) - (* tests/wp_typed/user_rec.i:42: Invariant 'RANGE': *) - Have: if (n_0<=1) then (n_0=n_2) else ((0<n_2) /\ (n_2<=n_0)). - (* tests/wp_typed/user_rec.i:42: Then *) - Have: 2<=n_2. -} -Prove: if (n_0<=1) then (1=x_0) else (x_0=(x_1 div (L_fact x_2))). - ------------------------------------------------------------- - -Goal Establishment of Invariant 'NEVER' (file tests/wp_typed/user_rec.i, line 39): -Let x_0 = (L_fact n_0). -Assume { (* Domain *) Type: (is_sint32 n_0). } -Prove: (n_0<=1) \/ (1=(x_0 div x_0)). - ------------------------------------------------------------- - -Goal Preservation of Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 38): -Let x_0 = 1+n_0. -Assume { - (* Domain *) - Type: (is_sint32 n_0) /\ (is_sint32 n_2) /\ (is_sint32 p_3) - /\ (is_sint32 (n_2-1)). - (* Invariant 'NEVER' (file tests/wp_typed/user_rec.i, line 39) *) - (* tests/wp_typed/user_rec.i:42: Invariant 'NEVER': *) - Have: if (n_0<=1) then (1=p_3) else (p_3=((L_fact n_0) div (L_fact n_2))). - (* Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 38) *) - (* tests/wp_typed/user_rec.i:42: Invariant 'RANGE': *) - Have: if (n_0<=1) then (n_0=n_2) else ((0<n_2) /\ (n_2<=n_0)). - (* tests/wp_typed/user_rec.i:42: Then *) - Have: 2<=n_2. -} -Prove: if (n_0<=1) then (n_2=x_0) else (n_2<=x_0). - ------------------------------------------------------------- - -Goal Establishment of Invariant 'RANGE' (file tests/wp_typed/user_rec.i, line 38): -Assume { (* Domain *) Type: (is_sint32 n_0). } -Prove: (0<n_0) \/ (n_0<=1). - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_rec.i, line 40): -Assume { } -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle index 83806a81610d17b7bb4e7ac90c898d4cf1757219..e9207fbd0425efe5c84c2dae1cdc11d48f61340e 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_string.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -145,19 +144,13 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'strlen' (1/3): -Effect at line 26 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'strlen' (2/3): +Goal Assigns nothing in 'strlen' (1/2): Effect at line 34 Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'strlen' (3/3): +Goal Assigns nothing in 'strlen' (2/2): Effect at line 38 Prove: true. diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle index 9ed4091e86346f850b09ce80d68b82cf82517c9a..80f277cdaa3ebb87da932fc2f2acdd52ee360b0e 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_string.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -145,19 +144,13 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'strlen' (1/3): -Effect at line 26 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'strlen' (2/3): +Goal Assigns nothing in 'strlen' (1/2): Effect at line 34 Prove: true. ------------------------------------------------------------ -Goal Assigns nothing in 'strlen' (3/3): +Goal Assigns nothing in 'strlen' (2/2): Effect at line 38 Prove: true. diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_string.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_string.res.oracle deleted file mode 100644 index b342ee21b8d33bc38eda0c92c3eea4040eec7719..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_string.res.oracle +++ /dev/null @@ -1,338 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_string.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function strlen ------------------------------------------------------------- - -Goal Post-condition (file tests/wp_typed/user_string.i, line 23) in 'strlen': -Let x_0 = (offset ss_3). -Let x_1 = (offset s_3). -Let x_2 = x_0-x_1. -Let x_3 = Mchar_1[ss_3]. -Let x_4 = (base s_3). -Assume { - (* Domain *) - Type: (is_sint8 x_3) /\ (is_sint32 x_2). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_1) /\ ((region x_4)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_1 s_3 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+x_1)<x_0) -> (0!=Mchar_1[(shift_sint8 s_3 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_3 ss_3) - /\ (addr_le ss_3 (shift_sint8 s_3 (L_Length Mchar_1 s_3))). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_4=(base ss_3). - (* tests/wp_typed/user_string.i:34: Else *) - Have: 0=x_3. - (* Assertion 'END' (file tests/wp_typed/user_string.i, line 37) *) - (* tests/wp_typed/user_string.i:37: Assertion 'END': *) - Have: (P_Length_of_str_is Malloc_0 Mchar_1 s_3 x_2). -} -Prove: exists i_0:int. - (P_Length_of_str_is Malloc_0 Mchar_1 s_3 i_0) /\ (x_0=(i_0+x_1)). - ------------------------------------------------------------- - -Goal Preservation of Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28): -Let x_0 = Mchar_3[ss_2]. -Let x_1 = (base s_0). -Assume { - (* Domain *) - Type: (is_sint8 x_0). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_3) /\ ((region x_1)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_3 s_0 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+(offset s_0))<(offset ss_2)) - -> (0!=Mchar_3[(shift_sint8 s_0 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_0 ss_2) - /\ (addr_le ss_2 (shift_sint8 s_0 (L_Length Mchar_3 s_0))). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_1=(base ss_2). - (* tests/wp_typed/user_string.i:34: Then *) - Have: 0!=x_0. -} -Prove: true. - ------------------------------------------------------------- - -Goal Establishment of Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28): -Assume { - (* Domain *) - Type: (is_sint8 Mchar_3[ss_4]). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_3) /\ ((region (base s_4))<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_3 s_4 i_0). -} -Prove: true. - ------------------------------------------------------------- - -Goal Preservation of Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29): -Let a_0 = (shift_sint8 ss_2 1). -Let a_1 = (shift_sint8 s_0 (L_Length Mchar_0 s_0)). -Let x_0 = Mchar_0[ss_2]. -Let x_1 = (base s_0). -Assume { - (* Domain *) - Type: (is_sint8 x_0). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0) /\ ((region x_1)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_0 s_0 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+(offset s_0))<(offset ss_2)) - -> (0!=Mchar_0[(shift_sint8 s_0 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_0 ss_2) /\ (addr_le ss_2 a_1). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_1=(base ss_2). - (* tests/wp_typed/user_string.i:34: Then *) - Have: 0!=x_0. -} -Prove: (addr_le s_0 a_0) /\ (addr_le a_0 a_1). - ------------------------------------------------------------- - -Goal Establishment of Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29): -Assume { - (* Domain *) - Type: (is_sint8 Mchar_3[ss_4]). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_3) /\ ((region (base s_4))<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_3 s_4 i_0). -} -Prove: (addr_le s_4 s_4) - /\ (addr_le s_4 (shift_sint8 s_4 (L_Length Mchar_3 s_4))). - ------------------------------------------------------------- - -Goal Preservation of Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30): -Let x_0 = Mchar_0[ss_2]. -Let x_1 = (base s_0). -Let x_2 = (offset s_0). -Let x_3 = (offset ss_2). -Assume { - (* Domain *) - Type: (is_sint8 x_0). - (* Goal *) - When: (0<=i_1) /\ ((i_1+x_2)<=x_3). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0) /\ ((region x_1)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_0 s_0 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+x_2)<x_3) -> (0!=Mchar_0[(shift_sint8 s_0 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_0 ss_2) - /\ (addr_le ss_2 (shift_sint8 s_0 (L_Length Mchar_0 s_0))). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_1=(base ss_2). - (* tests/wp_typed/user_string.i:34: Then *) - Have: 0!=x_0. -} -Prove: 0!=Mchar_0[(shift_sint8 s_0 i_1)]. - ------------------------------------------------------------- - -Goal Establishment of Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30): -Assume { (* Goal *) When: false. } -Prove: 0!=Mchar_3[(shift_sint8 s_4 i_5)]. - ------------------------------------------------------------- - -Goal Assertion 'END' (file tests/wp_typed/user_string.i, line 37): -Let x_0 = (offset ss_3). -Let x_1 = (offset s_3). -Let x_2 = Mchar_2[ss_3]. -Let x_3 = (base s_3). -Assume { - (* Domain *) - Type: (is_sint8 x_2). - (* Heap *) - Have: (linked Malloc_1) /\ (sconst Mchar_2) /\ ((region x_3)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_1 Mchar_2 s_3 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+x_1)<x_0) -> (0!=Mchar_2[(shift_sint8 s_3 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_3 ss_3) - /\ (addr_le ss_3 (shift_sint8 s_3 (L_Length Mchar_2 s_3))). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_3=(base ss_3). - (* tests/wp_typed/user_string.i:34: Else *) - Have: 0=x_2. -} -Prove: (P_Length_of_str_is Malloc_1 Mchar_2 s_3 (x_0-x_1)). - ------------------------------------------------------------- - -Goal Loop assigns (file tests/wp_typed/user_string.i, line 31): -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'strlen' (1/3): -Effect at line 26 -Assume { - (* Domain *) - Type: (is_sint8 Mchar_3[ss_4]). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_3) /\ ((region (base s_2))<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_3 s_2 i_0). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'strlen' (2/3): -Effect at line 34 -Assume { - (* Domain *) - Type: (is_sint8 Mchar_3[ss_4]). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_3) /\ ((region (base s_2))<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_3 s_2 i_0). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns nothing in 'strlen' (3/3): -Effect at line 38 -Let x_0 = (offset ss_3). -Let x_1 = (offset s_3). -Let x_2 = Mchar_1[ss_3]. -Let x_3 = (base s_3). -Assume { - (* Domain *) - Type: (is_sint8 x_2). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_1) /\ ((region x_3)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_1 s_3 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+x_1)<x_0) -> (0!=Mchar_1[(shift_sint8 s_3 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_3 ss_3) - /\ (addr_le ss_3 (shift_sint8 s_3 (L_Length Mchar_1 s_3))). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_3=(base ss_3). - (* tests/wp_typed/user_string.i:34: Else *) - Have: 0=x_2. - (* Assertion 'END' (file tests/wp_typed/user_string.i, line 37) *) - (* tests/wp_typed/user_string.i:37: Assertion 'END': *) - Have: (P_Length_of_str_is Malloc_0 Mchar_1 s_3 (x_0-x_1)). -} -Prove: true. - ------------------------------------------------------------- - -Goal Decreasing of Loop variant at loop (file tests/wp_typed/user_string.i, line 34): -Let x_0 = Mchar_0[ss_2]. -Let x_1 = (base s_0). -Assume { - (* Domain *) - Type: (is_sint8 x_0). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0) /\ ((region x_1)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_0 s_0 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+(offset s_0))<(offset ss_2)) - -> (0!=Mchar_0[(shift_sint8 s_0 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_0 ss_2) - /\ (addr_le ss_2 (shift_sint8 s_0 (L_Length Mchar_0 s_0))). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_1=(base ss_2). - (* tests/wp_typed/user_string.i:34: Then *) - Have: 0!=x_0. -} -Prove: true. - ------------------------------------------------------------- - -Goal Positivity of Loop variant at loop (file tests/wp_typed/user_string.i, line 34): -Let x_0 = (offset ss_1). -Let x_1 = (offset s_1). -Let x_2 = (L_Length Mchar_0 s_1). -Let x_3 = Mchar_0[ss_1]. -Let x_4 = (base s_1). -Assume { - (* Domain *) - Type: (is_sint8 x_3). - (* Heap *) - Have: (linked Malloc_0) /\ (sconst Mchar_0) /\ ((region x_4)<=0). - (* Pre-condition (file tests/wp_typed/user_string.i, line 21) in 'strlen' *) - (* Pre-condition: *) - Have: exists i_0:int. (P_Length_of_str_is Malloc_0 Mchar_0 s_1 i_0). - (* Invariant 'ZERO' (file tests/wp_typed/user_string.i, line 30) *) - (* tests/wp_typed/user_string.i:34: Invariant 'ZERO': *) - Have: forall i_0:int. - (0<=i_0) -> ((i_0+x_1)<x_0) -> (0!=Mchar_0[(shift_sint8 s_1 i_0)]). - (* Invariant 'RANGE' (file tests/wp_typed/user_string.i, line 29) *) - (* tests/wp_typed/user_string.i:34: Invariant 'RANGE': *) - Have: (addr_le s_1 ss_1) /\ (addr_le ss_1 (shift_sint8 s_1 x_2)). - (* Invariant 'BASE' (file tests/wp_typed/user_string.i, line 28) *) - (* tests/wp_typed/user_string.i:34: Invariant 'BASE': *) - Have: x_4=(base ss_1). - (* tests/wp_typed/user_string.i:34: Then *) - Have: 0!=x_3. -} -Prove: x_0<=(x_1+x_2). - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_swap.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_swap.0.res.oracle index 79df21aeaa9b64ed915cc70738fa353e0f5b9f20..01229a21c6352ee0afa41fcf93693971352a4939 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_swap.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_swap.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_swap.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -50,19 +49,13 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns 'E' in 'swap' (1/3): -Effect at line 15 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'E' in 'swap' (2/3): +Goal Assigns 'E' in 'swap' (1/2): Effect at line 16 Prove: true. ------------------------------------------------------------ -Goal Assigns 'E' in 'swap' (3/3): +Goal Assigns 'E' in 'swap' (2/2): Effect at line 17 Prove: true. diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_swap.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_swap.1.res.oracle index c6e0465a66280b800b4792c6071b174a5437cd07..a3769f1221911178fcbc6be859a576d138044de3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_swap.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_swap.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_swap.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -38,13 +37,7 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns 'E' in 'swap' (1/2): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'E' in 'swap' (2/2): -Effect at line 15 +Goal Assigns 'E' in 'swap': Prove: true. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_swap.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_swap.res.oracle deleted file mode 100644 index ac2c5f8666cb15cbafd8f93617996ff1d0cd04ba..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle/user_swap.res.oracle +++ /dev/null @@ -1,157 +0,0 @@ -# frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/wp_typed/user_swap.i (no preprocessing) -[wp] Running WP plugin... -[wp] Loading driver 'share/wp.driver' -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards ------------------------------------------------------------- - Function main ------------------------------------------------------------- - -Goal Assertion (file tests/wp_typed/user_swap.i, line 25): -Assume { } -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_swap.i, line 6) in 'swap'' in 'main' at call 'swap' (file tests/wp_typed/user_swap.i, line 24) -: -Let x_0 = Mint_7[(shift_sint32 (global P_b_78) 0)]. -Let x_1 = Mint_7[(shift_sint32 (global P_a_77) 0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_1) /\ (is_sint32 x_0). - (* Heap *) - Have: (linked Malloc_6). - (* tests/wp_typed/user_swap.i:24: Then *) - Have: x_0<=x_1. -} -Prove: true. - ------------------------------------------------------------- - -Goal Instance of 'Pre-condition (file tests/wp_typed/user_swap.i, line 7) in 'swap'' in 'main' at call 'swap' (file tests/wp_typed/user_swap.i, line 24) -: -Let x_0 = Mint_7[(shift_sint32 (global P_b_78) 0)]. -Let x_1 = Mint_7[(shift_sint32 (global P_a_77) 0)]. -Assume { - (* Domain *) - Type: (is_sint32 x_1) /\ (is_sint32 x_0). - (* Heap *) - Have: (linked Malloc_6). - (* tests/wp_typed/user_swap.i:24: Then *) - Have: x_0<=x_1. -} -Prove: true. - ------------------------------------------------------------- ------------------------------------------------------------- - Function swap ------------------------------------------------------------- - -Goal Post-condition 'A' in 'swap': -Let x_0 = Mint_0[b_0]. -Let x_1 = Mint_0[a_0]. -Let x_2 = Mint_0[a_0->x_0][b_0->x_1][a_0]. -Assume { - (* Domain *) - Type: (is_sint32 x_1) /\ (is_sint32 x_0) /\ (is_sint32 x_2). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0) - /\ ((region (base b_0))<=0). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 6) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_0 1). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 7) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 b_0 1). -} -Prove: x_0=x_2. - ------------------------------------------------------------- - -Goal Post-condition 'B' in 'swap': -Let x_0 = Mint_0[a_0]. -Let x_1 = Mint_0[b_0]. -Assume { - (* Domain *) - Type: (is_sint32 x_0) /\ (is_sint32 x_1) - /\ (is_sint32 Mint_0[a_0->x_1][b_0->x_0][a_0]). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0) - /\ ((region (base b_0))<=0). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 6) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_0 1). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 7) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 b_0 1). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'E' in 'swap' (1/3): -Effect at line 15 -Assume { - (* Domain *) - Type: (is_sint32 Mint_0[a_0]) /\ (is_sint32 Mint_0[b_0]) - /\ (is_sint32 Mint_1[a_0]) /\ (is_sint32 Mint_1[b_0]). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0) - /\ ((region (base b_0))<=0). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 6) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_0 1). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 7) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 b_0 1). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'E' in 'swap' (2/3): -Effect at line 16 -Assume { - (* Domain *) - Type: (is_sint32 Mint_0[a_0]) /\ (is_sint32 Mint_0[b_0]) - /\ (is_sint32 Mint_1[a_0]) /\ (is_sint32 Mint_1[b_0]). - (* Goal *) - When: (valid_rd Malloc_0 a_0 1). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0) - /\ ((region (base b_0))<=0). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 6) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_0 1). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 7) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 b_0 1). -} -Prove: true. - ------------------------------------------------------------- - -Goal Assigns 'E' in 'swap' (3/3): -Effect at line 17 -Assume { - (* Domain *) - Type: (is_sint32 Mint_0[a_0]) /\ (is_sint32 Mint_0[b_0]) - /\ (is_sint32 Mint_1[a_0]) /\ (is_sint32 Mint_1[b_0]). - (* Goal *) - When: (valid_rd Malloc_0 b_0 1). - (* Heap *) - Have: (linked Malloc_0) /\ ((region (base a_0))<=0) - /\ ((region (base b_0))<=0). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 6) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 a_0 1). - (* Pre-condition (file tests/wp_typed/user_swap.i, line 7) in 'swap' *) - (* Pre-condition: *) - Have: (valid_rw Malloc_0 b_0 1). -} -Prove: true. - ------------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.0.res.oracle index 6254b0c723890bcde369747b0bbc6786099282c6..0e9e2b40fa4dec55e8e21b7f972d5fad0d72c0c9 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/array_initialized.c (with preprocessing) tests/wp_typed/array_initialized.c:13:[kernel] warning: Too many initializers for array g [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.1.res.oracle index 04130bf6b5bb696b98aec4f1c099c6911eca6801..ce67c048de8552b5d9be71304fe36d007b5757b7 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/array_initialized.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/array_initialized.c (with preprocessing) tests/wp_typed/array_initialized.c:13:[kernel] warning: Too many initializers for array g [wp] Running WP plugin... @@ -19,6 +18,6 @@ Functions WP Alt-Ergo Total Success main1 - 1 (20) 1 100% main2 - 1 (125) 1 100% main3 1 - 1 100% -main_pointer - 1 (68) 1 100% +main_pointer - 1 (65) 1 100% simpl - 1 (16) 1 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/avar.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/avar.res.oracle index ffa6b5b33a6fcb048d13f7ebabc81cc1cf113d4c..09a9e53dcf190f126e02131d02accc756dc58a95 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/avar.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/avar.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/avar.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/shift_lemma.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/shift_lemma.res.oracle index 856f756208d5c80ca54a1d67a7247c17b2ab21c5..d85ca5df20ef21c41142e3021cecc20ab4394d07 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/shift_lemma.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/shift_lemma.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/shift_lemma.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/struct_array_type.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/struct_array_type.res.oracle index ca05ab4a138145a3828f9430c9e682529cfc0908..c4a4d1906ad1fb2d4e91769a5af61ba3a6933af0 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/struct_array_type.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/struct_array_type.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/struct_array_type.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.0.res.oracle index 51ed49e80fdb1ac2144a5023534f4dbfbf24bf48..6e0797d90462eaadb1c60f6a34fc494359b4d81d 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_alloc.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.1.res.oracle index be668c0ff5ca834795014f5bbf4cecfa7068b721..e54afd7da45e9564aa89c97214ac4779cbe8d199 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_alloc.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_alloc.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.0.res.oracle index 8713e20b29f4afd8ce4681c2e3e7780ecaf37006..df6e8e9e6eddfa92c09e443f670208a90c63b740 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_bitwise.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -42,7 +41,7 @@ [wp] [Qed] Goal typed_bnot_uint_post_ok : Valid [wp] [Alt-Ergo] Goal typed_bor_char_post_ok : Valid [wp] [Qed] Goal typed_bor_int_post_ok : Valid -[wp] [Alt-Ergo] Goal typed_bor_uchar_post_ok : Valid +[wp] [Qed] Goal typed_bor_uchar_post_ok : Valid [wp] [Qed] Goal typed_bor_uint_post_ok : Valid [wp] [Alt-Ergo] Goal typed_bxor_char_post_ok : Valid [wp] [Qed] Goal typed_bxor_int_post_ok : Valid @@ -50,8 +49,8 @@ [wp] [Alt-Ergo] Goal typed_bxor_uchar_post_ok_2 : Valid [wp] [Qed] Goal typed_bxor_uint_post_ok : Valid [wp] [Alt-Ergo] Goal typed_bxor_uint_post_ok_2 : Valid -[wp] [Alt-Ergo] Goal typed_cast_post_ok : Valid -[wp] [Alt-Ergo] Goal typed_cast_assert_ok : Valid +[wp] [Qed] Goal typed_cast_post_ok : Valid +[wp] [Qed] Goal typed_cast_assert_ok : Valid [wp] [Qed] Goal typed_cast_assert_ok_2 : Valid [wp] [Qed] Goal typed_cast_assert_ok_3 : Valid [wp] [Qed] Goal typed_cast_assert_ok_4 : Valid @@ -67,8 +66,8 @@ [wp] [Alt-Ergo] Goal typed_rshift_uchar_post_ok : Valid [wp] [Qed] Goal typed_rshift_uint_post_ok : Valid [wp] Proved goals: 61 / 61 - Qed: 38 - Alt-Ergo: 23 + Qed: 41 + Alt-Ergo: 20 ---------------------------------------------------------- Axiomatics WP Alt-Ergo Total Success Lemma 10 8 (54) 18 100% @@ -95,12 +94,12 @@ lshift_char 1 - 1 100% rshift_char 1 - 1 100% band1_uchar 1 1 (14) 2 100% band_uchar - 1 (12) 1 100% -bor_uchar - 1 (11) 1 100% +bor_uchar 1 - 1 100% bxor_uchar 1 1 (12) 2 100% bnot_uchar 1 - 1 100% lshift_uchar 1 - 1 100% rshift_uchar - 1 (22) 1 100% band1_ushort 1 1 (14) 2 100% band1_ulong 1 1 (14) 2 100% -cast 6 2 (30) 8 100% +cast 8 - 8 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.1.res.oracle index 688bf0e7a79dce58eabeecea611371e5a95986c5..0f7f46de763c46818400ffddd2d043af6e711eac 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_bitwise.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_bitwise.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_call.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_call.res.oracle index c23d4e746c499d656318cf0bc033c4ba93b06704..766f1b10d68e4108d269cbbd86e9bb1c405ec9b9 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_call.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_call.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_call.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cast.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cast.res.oracle index 554c4d2c401b4af4724309a63e0ad597a00e59a6..00560d922042f86890580721e390e173c4ac0e77 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cast.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cast.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_cast.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cst.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cst.res.oracle index 4c9399b8e22c52f040aa25887d28bb6181078c54..da9bbf55e6fd4b2013356ffa08490b61e744c754 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cst.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_cst.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_cst.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.1.res.oracle deleted file mode 100644 index 237345763f36b601ea49a8478ac3dbf18258af70..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.1.res.oracle +++ /dev/null @@ -1,20 +0,0 @@ -# frama-c -wp -wp-model 'Typed (Float)' [...] -tests/wp_typed/unit_float.i:23:[kernel] warning: Floating-point constant 0.2 is not represented exactly. Will use 0x1.999999999999ap-3. See documentation for option -warn-decimal-float -[wp] Running WP plugin... -[wp] Collecting axiomatic usage -[wp] warning: Missing RTE guards -[wp] 6 goals scheduled -[wp] [Alt-Ergo] Goal typed_float_main_post_CST_F : Valid -[wp] [Alt-Ergo] Goal typed_float_main_post_CST_D : Valid -[wp] [Alt-Ergo] Goal typed_float_main_post_CNV_F : Unknown -[wp] [Gappa] Goal typed_float_main_post_CNV_F : Valid -[wp] [Alt-Ergo] Goal typed_float_main_post_CNV_D : Unknown -[wp] [Gappa] Goal typed_float_main_post_CNV_D : Valid -[wp] [Alt-Ergo] Goal typed_float_main_post_VAR_F : Unknown -[wp] [Gappa] Goal typed_float_main_post_VAR_F : Valid -[wp] [Qed] Goal typed_float_main_post_VAR_D : Valid -[wp] [Qed] Goal typed_float_main_post_VAR_D : Valid ----------------------------------------------------------- -Functions WP Alt-Ergo Total Success -main 2 2 6 100% ----------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.res.oracle index 865a8fbcc85ff791b37ec4d6db6682c2430cb693..76f6e20edca00ea69b43de639baa6e969483665f 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_float.i (no preprocessing) tests/wp_typed/unit_float.i:21:[kernel] warning: Floating-point constant 0.2 is not represented exactly. Will use 0x1.999999999999ap-3. See documentation for option -warn-decimal-float [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_hard.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_hard.res.oracle index 56a448e5c04ec750cc6f60f7c614782c87e0494d..16f1b2f431d8dca71a169864eb98c6823becfad3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_hard.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_hard.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_hard.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_ite.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_ite.res.oracle index 0a4edf0c8ab1d6d4ac5cc02f4a244d96b874b4bd..d41503caf96d49f489e6ed61e0ddaac042254338 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_ite.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_ite.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_ite.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_labels.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_labels.res.oracle index 72a3b928f92c430a3261f80d4337ee2e95f871dc..0fdb4d404c0a67b35f1da91b18216647a1cba236 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_labels.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_labels.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_labels.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_lemma.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_lemma.res.oracle index 8e48c6c6d5607cacd611499f4a9567c01dbaf65e..099c17830e47378bc6fac7948fa2212ef3249931 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_lemma.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_lemma.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_lemma.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.0.res.oracle index a6dc87021fc4e132f8f4cd41113d0849c0ae1f0c..5f7630b9c929312f0d071617471b5aa0ff7722d3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_local.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.1.res.oracle index 7b2b22d2c71693cdc972006bea52f401d54413c4..3a773b0013bc4c1de2a03edbfd9f788580ffc735 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_local.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Raw)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_local.c (with preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -13,6 +12,6 @@ Alt-Ergo: 3 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -foo - 2 (23) 2 100% +foo - 2 (21) 2 100% bar - 1 (20) 1 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.0.res.oracle index 79d75bdf9907f6e669861444174c92e7ec23e34a..0a82595305faf41913d07aead7275fb98cadaf35 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_loopscope.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.1.res.oracle index 00a522c9e99ce5b58726ac1445023e4a4f90601a..069546257ad19ce6ab1e16a49b8395147951accc 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_loopscope.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_loopscope.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_matrix.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_matrix.res.oracle index 98dfcb6cb7e3ec1ab8e252c18b43898876daa062..0fed6e30c04355d456125229cb5bd7fbe0c03406 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_matrix.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_matrix.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_matrix.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_string.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_string.res.oracle index 5fcb8012567367709a8dcff5fe55f942a9ddd61e..a378c41ee7e5d0e90c44cd557630a4a7b599b532 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_string.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_string.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_string.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_tset.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_tset.res.oracle index 4a0a70b56bde06d242bac891bf557687b4303f17..042f6a9f9bfa70af9f543bd4a7320ceb57221d3b 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_tset.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_tset.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/unit_tset.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.0.res.oracle index 1c05b178d88d37aede9a29b007486fbcdd79e9ea..e721626c45756a8271cedb2c9e9f0bfd98150f60 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_bitwise.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.1.res.oracle index 6c2e1fea8730fbfbd009da7a5fb00ca53ba398be..88d0f2d6782ee89629ac606b2d47e79c27a191b4 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_bitwise.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_bitwise.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_collect.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_collect.res.oracle index 98abb38a25e0db0267aa527edc22c2f482f4e897..9e1aea13b770f90073d7270f48eba0001562ec19 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_collect.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_collect.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_collect.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_init.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_init.res.oracle index aec14e0d0cc4ee3f5ddc78de23fe9d8cc64079a1..d658831f9f653bf820fbb9aecfce14bd1156c49c 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_init.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_init.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_init.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 10 goals scheduled +[wp] 9 goals scheduled [wp] [Alt-Ergo] Goal typed_init_post : Valid [wp] [Alt-Ergo] Goal typed_init_loop_inv_Partial_preserved : Valid [wp] [Qed] Goal typed_init_loop_inv_Partial_established : Valid @@ -13,12 +12,11 @@ [wp] [Qed] Goal typed_init_loop_assign_part1 : Valid [wp] [Alt-Ergo] Goal typed_init_loop_assign_part2 : Valid [wp] [Alt-Ergo] Goal typed_init_loop_assign_part3 : Valid -[wp] [Qed] Goal typed_init_assign_part1 : Valid -[wp] [Alt-Ergo] Goal typed_init_assign_part2 : Valid -[wp] Proved goals: 10 / 10 - Qed: 4 +[wp] [Alt-Ergo] Goal typed_init_assign : Valid +[wp] Proved goals: 9 / 9 + Qed: 3 Alt-Ergo: 6 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -init 4 6 (77) 10 100% +init 3 6 (77) 9 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.0.res.oracle index f4d4dc5ca4362e128accc62e78ccc74703b7de04..e91376423061835bafee08bdbebbbe6d0d028d5c 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_injector.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.1.res.oracle index e010b2b0d170e745bfa7bc2cde96d0ab604ebee5..cdd03b783595c87db263c19cf9323e9b5f2990b8 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_injector.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_injector.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_rec.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_rec.res.oracle index 5fe77cd078117a389096efe6244bb0c02b922608..2bab56e2d81c0a148c91316edfb7c6d01bba3e25 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_rec.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_rec.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_rec.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_string.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_string.res.oracle index d8b309fe73bf4c50095ba5e3f705ceb05d76d44d..f8aba7dae98bb1b50f1ef6a59f01780dd4d27e13 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_string.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_string.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_string.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 14 goals scheduled +[wp] 13 goals scheduled [wp] [Alt-Ergo] Goal typed_strlen_post : Valid [wp] [Qed] Goal typed_strlen_loop_inv_BASE_preserved : Valid [wp] [Qed] Goal typed_strlen_loop_inv_BASE_established : Valid @@ -16,13 +15,12 @@ [wp] [Qed] Goal typed_strlen_loop_assign : Valid [wp] [Qed] Goal typed_strlen_assign_part1 : Valid [wp] [Qed] Goal typed_strlen_assign_part2 : Valid -[wp] [Qed] Goal typed_strlen_assign_part3 : Valid [wp] [Qed] Goal typed_strlen_loop_term_decrease : Valid [wp] [Alt-Ergo] Goal typed_strlen_loop_term_positive : Valid -[wp] Proved goals: 14 / 14 - Qed: 8 +[wp] Proved goals: 13 / 13 + Qed: 7 Alt-Ergo: 6 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -strlen 8 6 (209) 14 100% +strlen 7 6 (209) 13 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.0.res.oracle index c097ffb2a7cfd6152b5bc3961ea7c90c5390e7b1..86c41ec8e3fe4021154d4a814d041e19fec2b4ee 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.0.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_swap.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 8 goals scheduled +[wp] 7 goals scheduled [wp] [Qed] Goal typed_main_assert : Valid [wp] [Qed] Goal typed_main_call_swap_pre : Valid [wp] [Qed] Goal typed_main_call_swap_pre_2 : Valid @@ -12,12 +11,11 @@ [wp] [Qed] Goal typed_swap_post_B : Valid [wp] [Qed] Goal typed_swap_assign_part1 : Valid [wp] [Qed] Goal typed_swap_assign_part2 : Valid -[wp] [Qed] Goal typed_swap_assign_part3 : Valid -[wp] Proved goals: 8 / 8 - Qed: 7 +[wp] Proved goals: 7 / 7 + Qed: 6 Alt-Ergo: 1 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -swap 4 1 (17) 5 100% +swap 3 1 (17) 4 100% main 3 - 3 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.1.res.oracle index d29385e131b2ed1b9280e9757830de6feb0443fe..6c11e5985343b1467b8a90c08b35a7b46d120fe4 100644 --- a/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle_qualif/user_swap.1.res.oracle @@ -1,21 +1,19 @@ # frama-c -wp -wp-model 'Typed (Ref)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_typed/user_swap.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 7 goals scheduled +[wp] 6 goals scheduled [wp] [Qed] Goal typed_ref_main_assert : Valid [wp] [Qed] Goal typed_ref_main_call_swap_pre : Valid [wp] [Qed] Goal typed_ref_main_call_swap_pre_2 : Valid [wp] [Qed] Goal typed_ref_swap_post_A : Valid [wp] [Qed] Goal typed_ref_swap_post_B : Valid -[wp] [Qed] Goal typed_ref_swap_assign_part1 : Valid -[wp] [Qed] Goal typed_ref_swap_assign_part2 : Valid -[wp] Proved goals: 7 / 7 - Qed: 7 +[wp] [Qed] Goal typed_ref_swap_assign : Valid +[wp] Proved goals: 6 / 6 + Qed: 6 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -swap 4 - 4 100% +swap 3 - 3 100% main 3 - 3 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_usage/oracle/caveat.0.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/caveat.0.res.oracle index 9a8656b58d0758f25770d5463a9ce538a5949bd4..7d351b0a8b2d6fb4ef69764462516fae8d524856 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/caveat.0.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/caveat.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/caveat.i (no preprocessing) tests/wp_usage/caveat.i:41:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_usage/oracle/caveat.1.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/caveat.1.res.oracle index 34b1702d1ab48230f46e2944191c8ee2ff413ae7..0957d00bdfc5b5f7aeecba37127b891c06a3bac0 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/caveat.1.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/caveat.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/caveat.i (no preprocessing) tests/wp_usage/caveat.i:41:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... @@ -70,7 +69,7 @@ Prove: true. ------------------------------------------------------------ Goal Post-condition 'KO' in 'observer': -Let a = global(G_a_90). +Let a = global(G_a_43). Let x = Mint_0[shiftfield_F1_S_f(a)]. Let x_1 = Mint_0[shiftfield_F1_S_g(a)]. Let x_2 = 1 + x. diff --git a/src/plugins/wp/tests/wp_usage/oracle/caveat2.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/caveat2.res.oracle index 3e50710a2bc35d32ebfcfcc9a20bd7c7d71d626b..9a053f4bb76b406b99a96f73575ff4342508c942 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/caveat2.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/caveat2.res.oracle @@ -1,65 +1,46 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/caveat2.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards tests/wp_usage/caveat2.i:22:[wp] warning: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:25:[wp] warning: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:14:[wp] warning: Undefined array-size (sint32[]) ------------------------------------------------------------ Function job ------------------------------------------------------------ Goal Post-condition 'N' in 'job': -tests/wp_usage/caveat2.i:22: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) Prove: true. ------------------------------------------------------------ Goal Post-condition 'A' in 'job': -tests/wp_usage/caveat2.i:14: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:22: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) +Let a = global(G_b_26). Assume { Type: is_sint32(i_1) /\ is_sint32(n). (* Goal *) When: (0 <= i) /\ (i < n). (* Pre-condition *) Have: (0 <= n) /\ (n <= 3). - Warning[Typed Model]: Undefined array-size (sint32[]) - (Hide sub-term definition). (* Invariant *) - Have: forall i_2 : Z. ((0 <= i_2) -> ((i_2 < i_1) -> (v[i_2] = w_1))). + Have: forall i_2 : Z. ((0 <= i_2) -> ((i_2 < i_1) -> + (Mint_0[shift_sint32(a, i_2)] = v[i_2]))). (* Invariant *) Have: (0 <= i_1) /\ (i_1 <= n). (* Else *) Have: n <= i_1. } -Prove: v[i] = w. +Prove: Mint_0[shift_sint32(a, i)] = v[i]. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_usage/caveat2.i, line 21): -tests/wp_usage/caveat2.i:22: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:25: warning from Typed Model: - - Warning: Havoc l-value (unknown r-value) - Reason: Undefined array-size (sint32[]) Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(1 + i). (* Pre-condition *) Have: (0 <= n) /\ (n <= 3). - Warning[Typed Model]: Undefined array-size (sint32[]) - (Hide sub-term definition). (* Invariant *) - Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 < i) -> (v[i_1] = w))). + Have: forall i_1 : Z. ((0 <= i_1) -> ((i_1 < i) -> + (Mint_0[shift_sint32(global(G_b_26), i_1)] = v[i_1]))). (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Then *) @@ -75,65 +56,44 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_usage/caveat2.i, line 22): -tests/wp_usage/caveat2.i:22: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) tests/wp_usage/caveat2.i:22: warning from Typed Model: - Warning: No allocation size for variable 'b' Reason: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:25: warning from Typed Model: - - Warning: Havoc l-value (unknown r-value) - Reason: Undefined array-size (sint32[]) +Let a = global(G_b_26). Assume { Type: is_sint32(i) /\ is_sint32(n) /\ is_sint32(1 + i). (* Goal *) When: (0 <= i_1) /\ (i_1 <= i). (* Pre-condition *) Have: (0 <= n) /\ (n <= 3). - Warning[Typed Model]: Undefined array-size (sint32[]) - (Hide sub-term definition). (* Invariant *) - Have: forall i_2 : Z. ((0 <= i_2) -> ((i_2 < i) -> (v[i_2] = w_1))). + Have: forall i_2 : Z. ((0 <= i_2) -> ((i_2 < i) -> + (Mint_0[shift_sint32(a, i_2)] = v[i_2]))). (* Invariant *) Have: (0 <= i) /\ (i <= n). (* Then *) Have: i < n. } -Prove: v[i <- v_1][i_1] = w. +Prove: v[i <- Mint_0[shift_sint32(a, i)]][i_1] = Mint_0[shift_sint32(a, i_1)]. ------------------------------------------------------------ Goal Establishment of Invariant (file tests/wp_usage/caveat2.i, line 22): -tests/wp_usage/caveat2.i:22: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) Prove: true. ------------------------------------------------------------ Goal Loop assigns (file tests/wp_usage/caveat2.i, line 23): -tests/wp_usage/caveat2.i:22: warning from Typed Model: - - Warning: Hide sub-term definition - Reason: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:25: warning from Typed Model: - - Warning: Havoc l-value (unknown r-value) - Reason: Undefined array-size (sint32[]) Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_usage/caveat2.i, line 15) in 'job' (1/3): -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_usage/caveat2.i, line 15) in 'job' (2/3): -Effect at line 25 +Goal Assigns (file tests/wp_usage/caveat2.i, line 15) in 'job' (1/2): Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_usage/caveat2.i, line 15) in 'job' (3/3): +Goal Assigns (file tests/wp_usage/caveat2.i, line 15) in 'job' (2/2): Effect at line 25 Prove: true. diff --git a/src/plugins/wp/tests/wp_usage/oracle/caveat_range.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/caveat_range.res.oracle index 3a697c9950f1af2138c0487065325c984793061b..fa8a822d012eadc19f98cf06f4fd1d6173df5191 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/caveat_range.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/caveat_range.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/caveat_range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,7 +8,7 @@ ------------------------------------------------------------ Goal Post-condition (file tests/wp_usage/caveat_range.i, line 12) in 'reset': -Let a = shift_A_S(global(G_p_69), 0). +Let a = global(G_p_22). Assume { Type: is_sint32(i_1). (* Goal *) @@ -32,7 +31,7 @@ Prove: Mint_0[shiftfield_F1_S_f(shift_S(a, i))] = 1. ------------------------------------------------------------ Goal Post-condition (file tests/wp_usage/caveat_range.i, line 13) in 'reset': -Let a = shift_A_S(global(G_p_69), 0). +Let a = global(G_p_22). Assume { Type: is_sint32(i_1). (* Goal *) @@ -55,7 +54,7 @@ Prove: Mint_0[shiftfield_F1_S_g(shift_S(a, i))] = 2. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_usage/caveat_range.i, line 19): -Let a = shift_A_S(global(G_p_69), 0). +Let a = global(G_p_22). Assume { Type: is_sint32(i) /\ is_sint32(1 + i). (* Loop assigns ... *) @@ -81,7 +80,7 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_usage/caveat_range.i, line 20): -Let a = shift_A_S(global(G_p_69), 0). +Let a = global(G_p_22). Let a_1 = shift_S(a, i). Assume { Type: is_sint32(i) /\ is_sint32(1 + i). @@ -111,7 +110,7 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant (file tests/wp_usage/caveat_range.i, line 21): -Let a = shift_A_S(global(G_p_69), 0). +Let a = global(G_p_22). Let a_1 = shift_S(a, i). Assume { Type: is_sint32(i) /\ is_sint32(1 + i). @@ -157,13 +156,7 @@ Prove: true. ------------------------------------------------------------ -Goal Assigns (file tests/wp_usage/caveat_range.i, line 14) in 'reset' (1/2): -Effect at line 24 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_usage/caveat_range.i, line 14) in 'reset' (2/2): +Goal Assigns (file tests/wp_usage/caveat_range.i, line 14) in 'reset': Effect at line 24 Prove: true. diff --git a/src/plugins/wp/tests/wp_usage/oracle/code_spec.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/code_spec.res.oracle index 1ab09ba5a973499b8ba8f2b38ec16e7eadc8b12e..e7115367e0a135ab74af18c23e8f20a8b47417f7 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/code_spec.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/code_spec.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/code_spec.i (no preprocessing) [wp] Running WP plugin... tests/wp_usage/code_spec.i:154:[kernel] warning: No code nor implicit assigns clause for function by_addr_in_spec, generating default assigns from the prototype @@ -198,6 +197,7 @@ tests/wp_usage/code_spec.i:154:[kernel] warning: No code nor implicit assigns cl value_array ................................................. [wp] Loading driver 'share/wp.driver' +[wp] [CFG] Goal by_addr_in_code_annotation_stmt_pre : Valid (Unreachable) [wp] [CFG] Goal by_reference_in_code_annotation_no_exit_exit : Valid (Unreachable) [wp] warning: Missing RTE guards [wp] No proof obligations diff --git a/src/plugins/wp/tests/wp_usage/oracle/core.0.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/core.0.res.oracle index db1461156c6cb89967bf12252814332b27b5cf24..b3aa90cecf13aaf10da4a9a2631d16e4c187e9d8 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/core.0.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/core.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/core.i (no preprocessing) tests/wp_usage/core.i:11:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... diff --git a/src/plugins/wp/tests/wp_usage/oracle/core.1.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/core.1.res.oracle index c5dcb9d0394fafc1d23fcca8d099b44dfa484d01..25ebe57a3eb0f4ce5bf02290e2609c8c2fd06324 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/core.1.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/core.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/core.i (no preprocessing) tests/wp_usage/core.i:11:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [wp] Running WP plugin... @@ -13,7 +12,11 @@ tests/wp_usage/core.i:17:[wp] warning: Missing assigns clause (assigns 'everythi ------------------------------------------------------------ Goal Post-condition (file tests/wp_usage/core.i, line 12) in 'f': -Let x_1 = 1 + x. Assume { Type: is_sint32(x) /\ is_sint32(x_1). } +Let x_1 = 1 + x. +Assume { + Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(c) /\ is_sint32(x) /\ + is_sint32(x_1). +} Prove: P_OBS(x, x_1). ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.0.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.0.res.oracle index c245c7ec80fde1b69a0582dbb3f545589af6fd12..bce18dc355c4c5c3d2cd8d5a9adef60cea7eb955 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.0.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189-bis.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' @@ -9,8 +8,8 @@ ------------------------------------------------------------ Goal Post-condition 'memcpy' in 'memcpy_alias_vars': -Let a = Mptr_0[shift_PTR(global(P_src_71), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_72), 0)]. +Let a = Mptr_0[global(P_src_24)]. +Let a_1 = Mptr_0[global(P_dst_25)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Assume { @@ -44,8 +43,8 @@ Prove: Mint_0[shift_uint8(a_1, i)] = Mint_1[shift_uint8(a, i)]. ------------------------------------------------------------ Goal Post-condition 'unmodified' in 'memcpy_alias_vars': -Let a = Mptr_0[shift_PTR(global(P_src_71), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_72), 0)]. +Let a = Mptr_0[global(P_src_24)]. +Let a_1 = Mptr_0[global(P_dst_25)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Let a_4 = shift_uint8(a, i). @@ -80,8 +79,8 @@ Prove: Mint_0[a_4] = Mint_1[a_4]. ------------------------------------------------------------ Goal Preservation of Invariant 'cpy' (file tests/wp_usage/issue-189-bis.i, line 27): -Let a = Mptr_0[shift_PTR(global(P_src_71), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_72), 0)]. +Let a = Mptr_0[global(P_src_24)]. +Let a_1 = Mptr_0[global(P_dst_25)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Let m = Mint_0[v <- Mint_0[v_1]]. @@ -131,8 +130,8 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant 'len' (file tests/wp_usage/issue-189-bis.i, line 23): -Let a = Mptr_0[shift_PTR(global(P_src_71), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_72), 0)]. +Let a = Mptr_0[global(P_src_24)]. +Let a_1 = Mptr_0[global(P_dst_25)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Assume { @@ -185,16 +184,16 @@ Prove: true. Goal Loop assigns (file tests/wp_usage/issue-189-bis.i, line 26) (2/5): Effect at line 31 -Let a = shift_PTR(global(P_src_71), 0). +Let a = global(P_src_24). Let a_1 = Mptr_0[a]. -Let a_2 = shift_PTR(global(P_dst_72), 0). +Let a_2 = global(P_dst_25). Let a_3 = Mptr_0[a_2]. Let a_4 = shift_uint8(a_3, 0). Let a_5 = shift_uint8(a_1, 0). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). (* Goal *) - When: valid_rd(Malloc_0[P_src_71 <- 1][P_dst_72 <- 1], a_4, len_0). + When: valid_rd(Malloc_0[P_src_24 <- 1][P_dst_25 <- 1], a_4, len_0). (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). (* Pre-condition 'write_access' *) @@ -236,16 +235,16 @@ Prove: true. Goal Loop assigns (file tests/wp_usage/issue-189-bis.i, line 26) (5/5): Effect at line 32 -Let a = shift_PTR(global(P_src_71), 0). +Let a = global(P_src_24). Let a_1 = Mptr_0[a]. -Let a_2 = shift_PTR(global(P_dst_72), 0). +Let a_2 = global(P_dst_25). Let a_3 = Mptr_0[a_2]. Let a_4 = shift_uint8(a_3, 0). Let a_5 = shift_uint8(a_1, 0). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). (* Goal *) - When: valid_rd(Malloc_0[P_src_71 <- 1][P_dst_72 <- 1], v, 1). + When: valid_rd(Malloc_0[P_src_24 <- 1][P_dst_25 <- 1], v, 1). (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). (* Pre-condition 'write_access' *) @@ -274,8 +273,8 @@ Prove: (a_2 = v) \/ (a = v) \/ included(v, 1, a_4, len_0). Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 18) in 'memcpy_alias_vars': Effect at line 31 -Let a = shift_uint8(Mptr_0[shift_PTR(global(P_dst_72), 0)], 0). -Let a_1 = shift_uint8(Mptr_0[shift_PTR(global(P_src_71), 0)], 0). +Let a = shift_uint8(Mptr_0[global(P_dst_25)], 0). +Let a_1 = shift_uint8(Mptr_0[global(P_src_24)], 0). Assume { Have: valid_rd(Malloc_0, a, len_0). Type: is_sint32(len_0). @@ -298,8 +297,8 @@ Prove: included(a, len_0, a, len_0). ------------------------------------------------------------ Goal Post-condition 'memcpy,ok' in 'memcpy_context_vars': -Let a = Mptr_0[shift_PTR(global(P_src_89), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_90), 0)]. +Let a = Mptr_0[global(P_src_45)]. +Let a_1 = Mptr_0[global(P_dst_46)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Assume { @@ -333,8 +332,8 @@ Prove: Mint_0[shift_uint8(a_1, i)] = Mint_1[shift_uint8(a, i)]. ------------------------------------------------------------ Goal Post-condition 'unmodified,ok' in 'memcpy_context_vars': -Let a = Mptr_0[shift_PTR(global(P_src_89), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_90), 0)]. +Let a = Mptr_0[global(P_src_45)]. +Let a_1 = Mptr_0[global(P_dst_46)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Let a_4 = shift_uint8(a, i). @@ -369,8 +368,8 @@ Prove: Mint_0[a_4] = Mint_1[a_4]. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,cpy' (file tests/wp_usage/issue-189-bis.i, line 55): -Let a = Mptr_0[shift_PTR(global(P_src_89), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_90), 0)]. +Let a = Mptr_0[global(P_src_45)]. +Let a_1 = Mptr_0[global(P_dst_46)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Let m = Mint_0[dst2_0 <- Mint_0[src2_0]]. @@ -420,8 +419,8 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,len' (file tests/wp_usage/issue-189-bis.i, line 51): -Let a = Mptr_0[shift_PTR(global(P_src_89), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_90), 0)]. +Let a = Mptr_0[global(P_src_45)]. +Let a_1 = Mptr_0[global(P_dst_46)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Assume { @@ -474,14 +473,14 @@ Prove: true. Goal Loop assigns (file tests/wp_usage/issue-189-bis.i, line 54) (2/5): Effect at line 59 -Let a = Mptr_0[shift_PTR(global(P_src_89), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_90), 0)]. +Let a = Mptr_0[global(P_src_45)]. +Let a_1 = Mptr_0[global(P_dst_46)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). (* Goal *) - When: valid_rd(Malloc_0[P_src_89 <- 1][P_dst_90 <- 1], a_2, len_0). + When: valid_rd(Malloc_0[P_src_45 <- 1][P_dst_46 <- 1], a_2, len_0). (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). (* Pre-condition 'write_access' *) @@ -522,14 +521,14 @@ Prove: true. Goal Loop assigns (file tests/wp_usage/issue-189-bis.i, line 54) (5/5): Effect at line 60 -Let a = Mptr_0[shift_PTR(global(P_src_89), 0)]. -Let a_1 = Mptr_0[shift_PTR(global(P_dst_90), 0)]. +Let a = Mptr_0[global(P_src_45)]. +Let a_1 = Mptr_0[global(P_dst_46)]. Let a_2 = shift_uint8(a_1, 0). Let a_3 = shift_uint8(a, 0). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). (* Goal *) - When: valid_rd(Malloc_0[P_src_89 <- 1][P_dst_90 <- 1], tmp_0, 1). + When: valid_rd(Malloc_0[P_src_45 <- 1][P_dst_46 <- 1], tmp_0, 1). (* Heap *) Have: framed(Mptr_0) /\ linked(Malloc_0). (* Pre-condition 'write_access' *) @@ -556,22 +555,10 @@ Prove: included(tmp_0, 1, a_2, len_0). ------------------------------------------------------------ -Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars' (1/3): -Effect at line 49 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars' (2/3): -Effect at line 49 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars' (3/3): +Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars': Effect at line 59 -Let a = shift_uint8(Mptr_0[shift_PTR(global(P_dst_90), 0)], 0). -Let a_1 = shift_uint8(Mptr_0[shift_PTR(global(P_src_89), 0)], 0). +Let a = shift_uint8(Mptr_0[global(P_dst_46)], 0). +Let a_1 = shift_uint8(Mptr_0[global(P_src_45)], 0). Assume { Have: valid_rd(Malloc_0, a, len_0). Type: is_sint32(len_0). diff --git a/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.1.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.1.res.oracle index 9da22a7c83195ccd6e468d049da8233a8eb9a417..ca95bbf61d01e9e678218ba462f1a85d09079d62 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.1.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/issue-189-bis.1.res.oracle @@ -1,13 +1,12 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189-bis.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards Goal Post-condition 'memcpy,ok' in 'memcpy_context_vars': -Let a = global(G_src_89). -Let a_1 = global(G_dst_90). +Let a = global(G_src_45). +Let a_1 = global(G_dst_46). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). (* Goal *) @@ -35,8 +34,8 @@ Prove: Mint_0[shift_uint8(a_1, i)] = Mint_1[shift_uint8(a, i)]. ------------------------------------------------------------ Goal Post-condition 'unmodified,ok' in 'memcpy_context_vars': -Let a = global(G_src_89). -Let a_1 = global(G_dst_90). +Let a = global(G_src_45). +Let a_1 = global(G_dst_46). Let a_2 = shift_uint8(a, i). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). @@ -65,8 +64,8 @@ Prove: Mint_0[a_2] = Mint_1[a_2]. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,cpy' (file tests/wp_usage/issue-189-bis.i, line 55): -Let a = global(G_src_89). -Let a_1 = global(G_dst_90). +Let a = global(G_src_45). +Let a_1 = global(G_dst_46). Let m = Mint_0[dst2_0 <- Mint_0[src2_0]]. Assume { Type: is_sint32(len_0) /\ is_sint32(len_1) /\ is_sint32(len_1 - 1). @@ -110,8 +109,8 @@ Prove: true. ------------------------------------------------------------ Goal Preservation of Invariant 'ok,len' (file tests/wp_usage/issue-189-bis.i, line 51): -Let a = global(G_src_89). -Let a_1 = global(G_dst_90). +Let a = global(G_src_45). +Let a_1 = global(G_dst_46). Assume { Type: is_sint32(len_1) /\ is_sint32(len_0) /\ is_sint32(len_0 - 1). (* Heap *) @@ -158,8 +157,8 @@ Prove: true. Goal Loop assigns (file tests/wp_usage/issue-189-bis.i, line 54) (2/5): Effect at line 59 -Let a = global(G_src_89). -Let a_1 = global(G_dst_90). +Let a = global(G_src_45). +Let a_1 = global(G_dst_46). Let a_2 = shift_uint8(a_1, 0). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). @@ -201,8 +200,8 @@ Prove: true. Goal Loop assigns (file tests/wp_usage/issue-189-bis.i, line 54) (5/5): Effect at line 60 -Let a = global(G_src_89). -Let a_1 = global(G_dst_90). +Let a = global(G_src_45). +Let a_1 = global(G_dst_46). Let a_2 = shift_uint8(a_1, 0). Assume { Type: is_sint32(len_0) /\ is_sint32(len_1). @@ -230,21 +229,9 @@ Prove: included(tmp_0, 1, a_2, len_0). ------------------------------------------------------------ -Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars' (1/3): -Effect at line 49 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars' (2/3): -Effect at line 49 -Prove: true. - ------------------------------------------------------------- - -Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars' (3/3): +Goal Assigns (file tests/wp_usage/issue-189-bis.i, line 44) in 'memcpy_context_vars': Effect at line 59 -Let a = shift_uint8(global(G_dst_90), 0). +Let a = shift_uint8(global(G_dst_46), 0). Assume { Have: valid_rd(Malloc_0, a, len_0). Type: is_sint32(len_0). diff --git a/src/plugins/wp/tests/wp_usage/oracle/issue-189.0.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/issue-189.0.res.oracle index f9515467e72216a904ad3b179a8bc4b8a94dd6fd..32c86d10d6ac2b57e5446bf94dc24ab6a3531f53 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/issue-189.0.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/issue-189.0.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_usage/oracle/issue-189.1.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/issue-189.1.res.oracle index b1e0e7050488c0b094ef81a8a3df4204b9e467cd..6f06d5b8988386b143b2636776f0ee072bb4b1ef 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/issue-189.1.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/issue-189.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189.i (no preprocessing) [wp] Running WP plugin... ................................................. diff --git a/src/plugins/wp/tests/wp_usage/oracle/issue-189.2.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/issue-189.2.res.oracle index fac23bc5f603ebd4bbe862385702203dc4abab5c..cd0c2aa96c213509441f01aa296fe7a64594b857 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/issue-189.2.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/issue-189.2.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189.i (no preprocessing) [wp] Running WP plugin... ................................................. diff --git a/src/plugins/wp/tests/wp_usage/oracle/reads.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/reads.res.oracle index aa008ee086ea6bef4c66ed8d16be6cd184ab51a6..32663355f9b60b732279ef417b3115f9d52c1521 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/reads.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/reads.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/reads.i (no preprocessing) [wp] Running WP plugin... tests/wp_usage/reads.i:86:[kernel] warning: No code nor implicit assigns clause for function recursive_usage, generating default assigns from the prototype diff --git a/src/plugins/wp/tests/wp_usage/oracle/save_load.1.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/save_load.1.res.oracle index 37f469df8b6d2796785bc66a8746cb0b5e454580..dc8ccc9708d15d25459bd24c7b5a3722996a5574 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/save_load.1.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/save_load.1.res.oracle @@ -1,5 +1,6 @@ [kernel] warning: ignoring source files specified on the command line while loading a global initial context. [wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' ------------------------------------------------------------ Function f ------------------------------------------------------------ @@ -9,12 +10,8 @@ Assume { Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(b_1) /\ is_sint32(c) /\ is_sint32(f) /\ is_sint32(f - b_1). If c != 0 - Then { Let x = 1 + a + b. Have: x = f. Have: x = f. } - Else { - Let x_1 = 1 + b_1. - Have: (x_1 = b) /\ ((a + b_1) = f). - Have: x_1 = b. - } + Then { Have: (b_1 = b) /\ ((1 + a + b_1) = f). } + Else { Have: ((1 + b_1) = b) /\ ((a + b) = (1 + f)). } } Prove: 0 < (a + b). diff --git a/src/plugins/wp/tests/wp_usage/oracle/save_load.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/save_load.res.oracle deleted file mode 100644 index 4c9d00afd25c5b964f0139c3bad50f5324315d9f..0000000000000000000000000000000000000000 --- a/src/plugins/wp/tests/wp_usage/oracle/save_load.res.oracle +++ /dev/null @@ -1,13 +0,0 @@ -[kernel] warning: ignoring source files specified on the command line while loading a global initial context. -/* Generated by Frama-C */ -int main(void) -{ - int __retres; - int a; - a = 42; - /*@ assert a > 0; */ ; - __retres = 0; - return __retres; -} - - diff --git a/src/plugins/wp/tests/wp_usage/oracle/save_load.sav.res b/src/plugins/wp/tests/wp_usage/oracle/save_load.sav.res index 43fb528a41bd72d78ff53358b1cb31926aa22a4d..efb863483b98d1a8464cd24e5b29c6e83d59dcb8 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/save_load.sav.res +++ b/src/plugins/wp/tests/wp_usage/oracle/save_load.sav.res @@ -1,6 +1,6 @@ -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/save_load.i (no preprocessing) [wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards ------------------------------------------------------------ Function f @@ -11,12 +11,8 @@ Assume { Type: is_sint32(a) /\ is_sint32(b) /\ is_sint32(b_1) /\ is_sint32(c) /\ is_sint32(f) /\ is_sint32(f - b_1). If c != 0 - Then { Let x = 1 + a + b. Have: x = f. Have: x = f. } - Else { - Let x_1 = 1 + b_1. - Have: (x_1 = b) /\ ((a + b_1) = f). - Have: x_1 = b. - } + Then { Have: (b_1 = b) /\ ((1 + a + b_1) = f). } + Else { Have: ((1 + b_1) = b) /\ ((a + b) = (1 + f)). } } Prove: 0 < (a + b). diff --git a/src/plugins/wp/tests/wp_usage/oracle/valinit.res.oracle b/src/plugins/wp/tests/wp_usage/oracle/valinit.res.oracle index 349a5009bb071dcd78820b00a3ef1a6d4b9e9253..fb73d0e5ce5e5082a57218533108398963d112aa 100644 --- a/src/plugins/wp/tests/wp_usage/oracle/valinit.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle/valinit.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/valinit.i (no preprocessing) [wp] Running WP plugin... ................................................. diff --git a/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat2.res.oracle b/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat2.res.oracle index bbfab05648b147d7658e94eb5a9ccb9e6aea0131..82572a9eaab4773706fbe98e33bc692baf6a5eeb 100644 --- a/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat2.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat2.res.oracle @@ -1,27 +1,23 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/caveat2.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards tests/wp_usage/caveat2.i:22:[wp] warning: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:25:[wp] warning: Undefined array-size (sint32[]) -tests/wp_usage/caveat2.i:14:[wp] warning: Undefined array-size (sint32[]) -[wp] 10 goals scheduled +[wp] 9 goals scheduled [wp] [Qed] Goal typed_caveat_job_post_N : Valid -[wp] [Alt-Ergo] Goal typed_caveat_job_post_A : Unknown (Stronger, 2 warnings) +[wp] [Alt-Ergo] Goal typed_caveat_job_post_A : Valid [wp] [Alt-Ergo] Goal typed_caveat_job_loop_inv_preserved : Valid [wp] [Qed] Goal typed_caveat_job_loop_inv_established : Valid -[wp] [Alt-Ergo] Goal typed_caveat_job_loop_inv_2_preserved : Unknown (Stronger, 3 warnings) +[wp] [Alt-Ergo] Goal typed_caveat_job_loop_inv_2_preserved : Valid [wp] [Qed] Goal typed_caveat_job_loop_inv_2_established : Valid [wp] [Qed] Goal typed_caveat_job_loop_assign : Valid [wp] [Qed] Goal typed_caveat_job_assign_part1 : Valid [wp] [Qed] Goal typed_caveat_job_assign_part2 : Valid -[wp] [Qed] Goal typed_caveat_job_assign_part3 : Valid -[wp] Proved goals: 8 / 10 - Qed: 7 - Alt-Ergo: 1 (unknown: 2) +[wp] Proved goals: 9 / 9 + Qed: 6 + Alt-Ergo: 3 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -job 7 1 (11) 10 80.0% +job 6 3 (22) 9 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat_range.res.oracle b/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat_range.res.oracle index 65e251e1340f9346f5b268b89e9f8b048b8b8bbd..07e9de22199e5a4849cfc111bc488783da5611f5 100644 --- a/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat_range.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle_qualif/caveat_range.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp -wp-model 'Typed (Caveat)' [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/caveat_range.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 13 goals scheduled +[wp] 12 goals scheduled [wp] [Alt-Ergo] Goal typed_caveat_reset_post : Valid [wp] [Alt-Ergo] Goal typed_caveat_reset_post_2 : Valid [wp] [Alt-Ergo] Goal typed_caveat_reset_loop_inv_preserved : Valid @@ -16,12 +15,11 @@ [wp] [Qed] Goal typed_caveat_reset_loop_assign_part1 : Valid [wp] [Qed] Goal typed_caveat_reset_loop_assign_part2 : Valid [wp] [Qed] Goal typed_caveat_reset_loop_assign_part3 : Valid -[wp] [Qed] Goal typed_caveat_reset_assign_part1 : Valid -[wp] [Qed] Goal typed_caveat_reset_assign_part2 : Valid -[wp] Proved goals: 13 / 13 - Qed: 8 +[wp] [Qed] Goal typed_caveat_reset_assign : Valid +[wp] Proved goals: 12 / 12 + Qed: 7 Alt-Ergo: 5 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -reset 8 5 (100) 13 100% +reset 7 5 (80) 12 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.0.res.oracle b/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.0.res.oracle index edefe9797810598f705f532bc3a02c13053ce089..9a93e242eac482747a784dafdc774ac373e92f3f 100644 --- a/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.0.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.0.res.oracle @@ -1,10 +1,9 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189-bis.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' [wp] warning: Missing RTE guards -[wp] 34 goals scheduled +[wp] 32 goals scheduled [wp] [Alt-Ergo] Goal typed_memcpy_alias_vars_post_memcpy : Valid [wp] [Alt-Ergo] Goal typed_memcpy_alias_vars_post_unmodified : Valid [wp] [Alt-Ergo] Goal typed_memcpy_alias_vars_loop_inv_cpy_preserved : Valid @@ -36,14 +35,12 @@ [wp] [Qed] Goal typed_memcpy_context_vars_loop_assign_part3 : Valid [wp] [Qed] Goal typed_memcpy_context_vars_loop_assign_part4 : Valid [wp] [Alt-Ergo] Goal typed_memcpy_context_vars_loop_assign_part5 : Valid -[wp] [Qed] Goal typed_memcpy_context_vars_assign_part1 : Valid -[wp] [Qed] Goal typed_memcpy_context_vars_assign_part2 : Valid -[wp] [Alt-Ergo] Goal typed_memcpy_context_vars_assign_part3 : Valid -[wp] Proved goals: 34 / 34 - Qed: 20 +[wp] [Alt-Ergo] Goal typed_memcpy_context_vars_assign : Valid +[wp] Proved goals: 32 / 32 + Qed: 18 Alt-Ergo: 14 ---------------------------------------------------------- Functions WP Alt-Ergo Total Success -memcpy_alias_vars 9 7 (1570) 16 100% -memcpy_context_vars 11 7 (1570) 18 100% +memcpy_alias_vars 9 7 (1172) 16 100% +memcpy_context_vars 9 7 (1172) 16 100% ---------------------------------------------------------- diff --git a/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.1.res.oracle b/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.1.res.oracle index 4923b1a8bbd4914dc377022978eb741e554b63f0..76113601e6a09911f30b970510954837d2818479 100644 --- a/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.1.res.oracle +++ b/src/plugins/wp/tests/wp_usage/oracle_qualif/issue-189-bis.1.res.oracle @@ -1,5 +1,4 @@ # frama-c -wp [...] -[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/wp_usage/issue-189-bis.i (no preprocessing) [wp] Running WP plugin... [wp] Loading driver 'share/wp.driver' diff --git a/src/plugins/wp/tests/wp_usage/save_load.i b/src/plugins/wp/tests/wp_usage/save_load.i index 50fe6d87247bc351ac964a6b6936a5467f3aed94..544dae3b38c163cf97bf18d231031964ab6bc82e 100644 --- a/src/plugins/wp/tests/wp_usage/save_load.i +++ b/src/plugins/wp/tests/wp_usage/save_load.i @@ -1,5 +1,5 @@ /* run.config - EXECNOW: LOG save_load.sav.res LOG save_load.sav.err BIN @PTEST_NAME@.sav @frama-c@ -no-autoload-plugins -load-module wp -wp -wp-print -wp-prover none @PTEST_FILE@ -save @PTEST_DIR@/@PTEST_NAME@.sav > @PTEST_DIR@/result/@PTEST_NAME@.sav.res 2> @PTEST_DIR@/result/@PTEST_NAME@.sav.err + EXECNOW: LOG save_load.sav.res LOG save_load.sav.err BIN @PTEST_NAME@.sav @frama-c@ -no-autoload-plugins -load-module wp -wp-share ./share -wp -wp-print -wp-prover none @PTEST_FILE@ -save @PTEST_DIR@/@PTEST_NAME@.sav > @PTEST_DIR@/result/@PTEST_NAME@.sav.res 2> @PTEST_DIR@/result/@PTEST_NAME@.sav.err CMD: @frama-c@ -no-autoload-plugins -load-module wp -load @PTEST_DIR@/@PTEST_NAME@.sav OPT: -print OPT: -wp -wp-prover none -wp-print diff --git a/src/plugins/wp/wpAnnot.ml b/src/plugins/wp/wpAnnot.ml index e74eab5d5775cbdb844fb6b855a0093b09cfe4c4..e003b81aa6b9c5a3acb13d133e0ab254ab682432 100644 --- a/src/plugins/wp/wpAnnot.ml +++ b/src/plugins/wp/wpAnnot.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -76,10 +76,14 @@ let wp_unreachable = ~tuning:[] (* TBC *) let set_unreachable pid = - let emit p = + let emit = function + | Property.IPPredicate(Property.PKAssumes _ ,_,_,_) -> () + | p -> debug "unreachable annotation %a@." Property.pretty p; - Property_status.emit wp_unreachable ~hyps:[] p Property_status.True in + Property_status.emit wp_unreachable ~hyps:[] p Property_status.True + in let pids = match WpPropId.property_of_id pid with + | Property.IPPredicate(Property.PKAssumes _ ,_,_,_) -> [] | Property.IPBehavior(kf, kinstr, active, bhv) -> let active = Datatype.String.Set.elements active in (Property.ip_post_cond_of_behavior kf kinstr active bhv) @ @@ -803,12 +807,7 @@ let add_loop_invariant_annot config vloop s ca b_list inv acc = | TBRok | TBRpart (* TODO: PKPartial *) -> - if Wp_parameters.Invariants.get() then begin - let loop_core = add_prop_inv_fixpoint config loop_core - (WpStrategy.AcutB true) s ca inv - in assigns, loop_entry , loop_back , loop_core - end - else begin + begin let loop_entry = add_prop_inv_establish config loop_entry WpStrategy.Agoal s ca inv in let loop_back = add_prop_inv_preserve config loop_back @@ -817,28 +816,12 @@ let add_loop_invariant_annot config vloop s ca b_list inv acc = WpStrategy.Ahyp s ca inv in assigns, loop_entry , loop_back , loop_core end - | TBRhyp -> (* TODO : add more inv hyp ? *) - let kind = - if Wp_parameters.Invariants.get() - then (WpStrategy.AcutB false) else WpStrategy.Ahyp - in - let loop_core = - add_prop_inv_fixpoint config loop_core kind s ca inv + | TBRhyp -> + let kind = WpStrategy.Ahyp in + let loop_core = add_prop_inv_fixpoint config loop_core kind s ca inv in assigns, loop_entry , loop_back , loop_core | TBRno -> acc -let add_stmt_invariant_annot config v s ca b_list inv ((b_acc, a_acc) as acc) = - let add_to_acc k = - let b_acc = add_prop_inv_fixpoint config b_acc k s ca inv in - (b_acc, a_acc) - in - let acc = - match is_annot_for_config config v s b_list with - | TBRok | TBRpart -> add_to_acc (WpStrategy.AcutB true) - | TBRhyp -> add_to_acc (WpStrategy.AcutB false) - | TBRno -> acc - in acc - (** Returns the annotations for the three edges of the loop node: * - loop_entry : goals for the edge entering in the loop * - loop_back : goals for the edge looping to the entry point @@ -896,16 +879,16 @@ let get_loop_annots config vloop s = let get_stmt_annots config v s = let do_annot _ a ((b_acc, (a_acc, e_acc)) as acc) = match a.annot_content with - | AInvariant (b_list, loop_inv, inv) -> + | AInvariant (_blist, loop_inv, _inv) -> if loop_inv then (* see get_loop_annots *) acc - else if Wp_parameters.Invariants.get() then - add_stmt_invariant_annot config v s a b_list inv acc - else begin - Wp_parameters.warning ~once:true - "Ignored 'invariant' specification (use -wp-invariants option):@, %a" - Printer.pp_code_annotation a; - acc - end + else + begin + Wp_parameters.warning ~once:true + "Unsupported generalized invariant, use loop invariant instead.\n\ + Ignored invariant @[<hov 2>%a@]" + Printer.pp_code_annotation a; + acc + end | AAssert (b_list,p) -> let kf = config.kf in let acc = match is_annot_for_config config v s b_list with @@ -1115,9 +1098,8 @@ let build_bhv_strategy config = let annots = get_behavior_annots config in let annots = add_global_annotations annots in let desc = Format.asprintf "%a" pp_strategy_info config in - let new_loops = Wp_parameters.Invariants.get() in WpStrategy.mk_strategy desc config.cfg (behavior_name_of_config config) - new_loops WpStrategy.SKannots annots + WpStrategy.SKannots annots (* Visit the CFG to find all the internal statement specifications. * (see [HdefAnnotBhv] documentation for information about this table). @@ -1215,6 +1197,30 @@ let find_behaviors kf cfg ki bhv_names = (* Unreachable *) (*----------------------------------------------------------------------------*) +class vexit kf acc = + object + inherit Visitor.frama_c_inplace + val mutable ips = acc + method acc = ips + method! vstmt_aux stmt = + Annotations.iter_code_annot + (fun _e ca -> + match ca.annot_content with + | AStmtSpec(_,spec) -> + List.iter + (fun bhv -> + List.iter + (fun post -> + if fst post = Exits then + let ip = WpPropId.mk_stmt_post_id kf stmt bhv post in + ips <- ip :: ips + ) bhv.b_post_cond + ) spec.spec_behavior + | _ -> () + ) stmt ; + Cil.DoChildren + end + let process_unreached_annots cfg = debug "collecting unreachable annotations@."; let unreached = Cil2cfg.unreachable_nodes cfg in @@ -1239,12 +1245,17 @@ let process_unreached_annots cfg = | Cil2cfg.Vstart -> Wp_parameters.fatal "Start must be reachable" | Cil2cfg.VfctIn -> Wp_parameters.fatal "FctIn must be reachable" | Cil2cfg.VfctOut -> List.fold_left (do_bhv Normal) acc spec.spec_behavior - | Cil2cfg.Vexit -> List.fold_left (do_bhv Exits) acc spec.spec_behavior + | Cil2cfg.Vexit -> + let acc = List.fold_left (do_bhv Exits) acc spec.spec_behavior in + let visitor = new vexit kf acc in + ignore Visitor.(visitFramacKf (visitor :> frama_c_visitor) kf) ; + visitor#acc | Cil2cfg.Vcall (s, _, call, _) -> Annotations.fold_code_annot (do_annot s) s acc @ preconditions_at_call s call | Cil2cfg.Vstmt s | Cil2cfg.VblkIn (Cil2cfg.Bstmt s, _) + | Cil2cfg.VblkOut (Cil2cfg.Bstmt s, _) | Cil2cfg.Vtest (true, s, _) | Cil2cfg.Vloop (_, s) | Cil2cfg.Vswitch (s,_) -> Annotations.fold_code_annot (do_annot s) s acc | Cil2cfg.Vtest (false, _, _) | Cil2cfg.Vloop2 _ @@ -1340,6 +1351,10 @@ let get_call_pre_strategies ~model stmt = let asked = CallPre (stmt, None) in get_strategies NoAssigns kf_caller model [] None asked in strategies + | Instr(Local_init(_, ConsInit _, _)) -> + let kf_caller = Kernel_function.find_englobing_kf stmt in + let asked = CallPre(stmt, None) in + get_strategies NoAssigns kf_caller model [] None asked | _ -> Wp_parameters.warning "[get_call_pre_strategies] this is not a call statement"; [] diff --git a/src/plugins/wp/wpAnnot.mli b/src/plugins/wp/wpAnnot.mli index 43171db27d4c5f630cd5b55217fd52594882f8c2..3cfc2db5189115644b52faa5799adaf1288233ac 100644 --- a/src/plugins/wp/wpAnnot.mli +++ b/src/plugins/wp/wpAnnot.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/wpPropId.ml b/src/plugins/wp/wpPropId.ml index 3e0707605be3bc69813b00d7be5b069bd2627965..f1aba4f51207c6bfa7b9572c90cc9743e6087355 100644 --- a/src/plugins/wp/wpPropId.ml +++ b/src/plugins/wp/wpPropId.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -656,25 +656,25 @@ type assigns_desc = { a_label : Cil_types.logic_label ; a_stmt : Cil_types.stmt option ; a_kind : a_kind ; - a_assigns : Cil_types.identified_term Cil_types.assigns ; + a_assigns : Cil_types.assigns ; } let mk_asm_assigns_desc s = { - a_label = Clabels.mk_logic_label s ; + a_label = BuiltinLabel(Some s,Here) ; a_stmt = Some s ; a_kind = StmtAssigns ; a_assigns = WritesAny ; } let mk_loop_assigns_desc s assigns = { - a_label = Clabels.mk_logic_label s ; + a_label = BuiltinLabel(Some s,Here) ; a_stmt = Some s ; a_kind = LoopAssigns ; a_assigns = Writes assigns } let mk_stmt_assigns_desc s assigns = { - a_label = Clabels.mk_logic_label s ; + a_label = BuiltinLabel(Some s, Here) ; a_stmt = Some s ; a_kind = StmtAssigns ; a_assigns = Writes assigns ; @@ -713,7 +713,8 @@ let mk_kf_assigns_desc assigns = { } let is_call_assigns = function - | { a_stmt = Some { skind = Instr(Call _) } } -> true + | {a_stmt=Some {skind=Instr(Call _ | Local_init (_, ConsInit _, _)) } } + -> true | _ -> false let pp_assigns_desc fmt a = Wp_error.pp_assigns fmt a.a_assigns @@ -750,7 +751,7 @@ let mk_assigns_info id a = AssignsLocations (id, a) let mk_stmt_any_assigns_info s = let a = { - a_label = Clabels.mk_logic_label s ; + a_label = BuiltinLabel(Some s,Here) ; a_stmt = Some s ; a_kind = StmtAssigns ; a_assigns = WritesAny ; @@ -768,7 +769,7 @@ let mk_kf_any_assigns_info () = let mk_loop_any_assigns_info s = let a = { - a_label = Clabels.mk_logic_label s ; + a_label = BuiltinLabel(Some s,Here) ; a_stmt = Some s ; a_kind = LoopAssigns ; a_assigns = WritesAny ; diff --git a/src/plugins/wp/wpPropId.mli b/src/plugins/wp/wpPropId.mli index 9d3f47cbb6db2c68013d53c55691079a14c9df8c..c264aeea063c9ccea6ff2d30333cbe3ad52938c1 100644 --- a/src/plugins/wp/wpPropId.mli +++ b/src/plugins/wp/wpPropId.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -96,7 +96,7 @@ val label_of_prop_id: prop_id -> string (** TODO: should probably be somewhere else *) val string_of_termination_kind : termination_kind -> string -val num_of_bhv_from : funbehavior -> identified_term from -> int +val num_of_bhv_from : funbehavior -> from -> int (*----------------------------------------------------------------------------*) val mk_code_annot_ids : kernel_function -> stmt -> code_annotation -> prop_id list @@ -120,17 +120,17 @@ val mk_var_pos_id : kernel_function -> stmt -> code_annotation -> prop_id (** \from property of loop assigns. Must not be [FromAny] *) val mk_loop_from_id : kernel_function -> stmt -> code_annotation -> - identified_term from -> prop_id + from -> prop_id (** \from property of function or statement behavior assigns. Must not be [FromAny] *) val mk_bhv_from_id : kernel_function -> kinstr -> string list -> funbehavior -> - identified_term from -> prop_id + from -> prop_id (** \from property of function behavior assigns. Must not be [FromAny]. *) val mk_fct_from_id : kernel_function -> funbehavior -> - termination_kind -> identified_term from -> prop_id + termination_kind -> from -> prop_id (** disjoint behaviors property. See {!Property.ip_of_disjoint} for more information @@ -144,21 +144,21 @@ val mk_disj_bhv_id : val mk_compl_bhv_id : kernel_function * kinstr * string list * string list -> prop_id -val mk_decrease_id : kernel_function * kinstr * term variant -> prop_id +val mk_decrease_id : kernel_function * kinstr * variant -> prop_id (** axiom identification *) val mk_lemma_id : logic_lemma -> prop_id val mk_stmt_assigns_id : kernel_function -> stmt -> string list -> funbehavior -> - identified_term from list -> prop_id option + from list -> prop_id option val mk_loop_assigns_id : kernel_function -> stmt -> code_annotation -> - identified_term from list -> prop_id option + from list -> prop_id option (** function assigns *) val mk_fct_assigns_id : kernel_function -> funbehavior -> - termination_kind -> identified_term from list -> prop_id option + termination_kind -> from list -> prop_id option val mk_pre_id : kernel_function -> kinstr -> funbehavior -> identified_predicate -> prop_id @@ -184,7 +184,7 @@ type assigns_desc = private { a_label : Cil_types.logic_label ; a_stmt : Cil_types.stmt option ; a_kind : a_kind ; - a_assigns : Cil_types.identified_term Cil_types.assigns ; + a_assigns : Cil_types.assigns ; } val pp_assigns_desc : Format.formatter -> assigns_desc -> unit @@ -208,13 +208,13 @@ val pp_assign_info : string -> Format.formatter -> assigns_full_info -> unit val merge_assign_info : assigns_full_info -> assigns_full_info -> assigns_full_info -val mk_loop_assigns_desc : stmt -> identified_term from list -> assigns_desc +val mk_loop_assigns_desc : stmt -> from list -> assigns_desc -val mk_stmt_assigns_desc : stmt -> identified_term from list -> assigns_desc +val mk_stmt_assigns_desc : stmt -> from list -> assigns_desc val mk_asm_assigns_desc : stmt -> assigns_desc -val mk_kf_assigns_desc : identified_term from list -> assigns_desc +val mk_kf_assigns_desc : from list -> assigns_desc val mk_init_assigns : assigns_desc diff --git a/src/plugins/wp/wpRTE.ml b/src/plugins/wp/wpRTE.ml index 2c39d6ca4b3aa71fd68f5f22c09f4b02b3659bd7..ed063804ef21797d3b27392f9b79009ea26d517d 100644 --- a/src/plugins/wp/wpRTE.ml +++ b/src/plugins/wp/wpRTE.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/wpRTE.mli b/src/plugins/wp/wpRTE.mli index 895b383b5781a0db446e971270e192cfdf7fb18f..17ee33e6a279ce5292bc6d64acd847fa16a1d42f 100644 --- a/src/plugins/wp/wpRTE.mli +++ b/src/plugins/wp/wpRTE.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/wpReport.ml b/src/plugins/wp/wpReport.ml index 1e7b727970e6f17b03e673a291de350d257a5975..6d937b8d103cb3f832788e2f8402f4b401f1e1f7 100644 --- a/src/plugins/wp/wpReport.ml +++ b/src/plugins/wp/wpReport.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/wpReport.mli b/src/plugins/wp/wpReport.mli index 9dacc7f8a78abaf64e227cc2295a0e10245cfa01..c91e1bf007132b943ad7d1c174287425c513f1f8 100644 --- a/src/plugins/wp/wpReport.mli +++ b/src/plugins/wp/wpReport.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/wpStrategy.ml b/src/plugins/wp/wpStrategy.ml index 7160d5e230a4d7b4c20d7519c9721f1b21b9390b..51b1d36d9a14b68fffe17951c53e2484395a46fc 100644 --- a/src/plugins/wp/wpStrategy.ml +++ b/src/plugins/wp/wpStrategy.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -223,7 +223,8 @@ let fold_bhv_post_cond ~warn f_normal f_exits acc b = match termination_kind with | Normal -> f_normal p_acc pe, e_acc | Exits -> p_acc, f_exits e_acc pe - | (Breaks|Continues|Returns) -> (* TODO *) + | Returns -> p_acc, e_acc (* HANDLED by an ASSERT from CIL *) + | (Breaks|Continues) -> (* TODO *) begin if warn then Wp_parameters.warning @@ -513,8 +514,7 @@ let add_node_annots tbl cfg v (before, (post, exits)) = begin let edges_after = Cil2cfg.get_post_edges cfg v in if edges_after = [] - then Wp_parameters.warning ~once:true - "Ignoring annotation rooted after statement with no succ" + then (* unreachable (see [process_unreached_annots]) *) () else add_on_edges tbl post edges_after end; if exits <> empty_acc then @@ -588,9 +588,6 @@ type strategy = { desc : string ; cfg : Cil2cfg.t; behavior_name : string option ; - - new_loops : bool; - strategy_kind : strategy_kind; annots : annots_tbl; } @@ -602,8 +599,8 @@ let get_bhv s = s.behavior_name let is_default_behavior s = match s.behavior_name with None -> true | Some _ -> false -let mk_strategy desc cfg bhv_name new_loops kind tbl = { - desc = desc; cfg = cfg; behavior_name = bhv_name; new_loops = new_loops; +let mk_strategy desc cfg bhv_name kind tbl = { + desc = desc; cfg = cfg; behavior_name = bhv_name; strategy_kind = kind; annots = tbl; } @@ -614,7 +611,6 @@ let strategy_kind strat = strat.strategy_kind let strategy_has_prop_goal strat = strat.annots.tbl_has_prop_goal let strategy_has_asgn_goal strat = strat.annots.tbl_has_asgn_goal let get_annots strat = get_annots strat.annots -let new_loop_computation strat = strat.new_loops let pp_info_of_strategy fmt strat = Format.fprintf fmt "@[%s@]" strat.desc @@ -645,7 +641,9 @@ let mk_variant_properties kf s ca v = let vpos_id = WpPropId.mk_var_pos_id kf s ca in let vdecr_id = WpPropId.mk_var_decr_id kf s ca in let loc = v.term_loc in - let lhead = Clabels.loop_head_label s in + (* let lhead = BuiltinLabel(Some s,LoopCurrent) in *) + (* [VP 2017-08-03] Again extremely fishy. See related comment in clabels.ml *) + let lhead = FormalLabel ("wp!loop_"^(string_of_int s.sid)^"_head") in let vhead = Logic_const.tat ~loc (v, lhead) in let zero = Cil.lzero ~loc () in let vpos = Logic_const.prel ~loc (Rle, zero, vhead) in diff --git a/src/plugins/wp/wpStrategy.mli b/src/plugins/wp/wpStrategy.mli index cbacc607981882223c66f769255cc170e5efbcbf..abf17a747cdca872830936eca38fa865d08426c1 100644 --- a/src/plugins/wp/wpStrategy.mli +++ b/src/plugins/wp/wpStrategy.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -146,13 +146,13 @@ val add_call_assigns_hyp : t_annots -> kernel_function -> stmt -> (** shortcut to add a loop assigns property as an hypothesis. *) val add_loop_assigns_hyp : t_annots -> kernel_function -> stmt -> - (code_annotation * identified_term from list) option -> t_annots + (code_annotation * from list) option -> t_annots val add_fct_bhv_assigns_hyp : t_annots -> kernel_function -> termination_kind -> funbehavior -> t_annots val assigns_upper_bound : - funspec -> (funbehavior * identified_term from list) option + funspec -> (funbehavior * from list) option (** {3 Getting information from annotations} *) @@ -224,11 +224,10 @@ type strategy_kind = | SKannots (** normal mode for annotations *) | SKfroms of strategy_for_froms -val mk_strategy : string -> Cil2cfg.t -> string option -> bool -> +val mk_strategy : string -> Cil2cfg.t -> string option -> strategy_kind -> annots_tbl -> strategy val get_annots : strategy -> Cil2cfg.edge -> t_annots -val new_loop_computation : strategy -> bool val strategy_has_asgn_goal : strategy -> bool val strategy_has_prop_goal : strategy -> bool val strategy_kind : strategy -> strategy_kind diff --git a/src/plugins/wp/wp_error.ml b/src/plugins/wp/wp_error.ml index 3c7e0fc62d3a7a64176fb39654c1d3dece05a442..1ac4c21f52f1f046b54a60769dc33ba5064bfa69 100644 --- a/src/plugins/wp/wp_error.ml +++ b/src/plugins/wp/wp_error.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -48,15 +48,16 @@ let not_yet_implemented ?(model= !current) fmt = open Cil_types let pp_logic_label fmt label = - let name = match label with - | LogicLabel (_,l) -> l - | StmtLabel {contents=stmt} -> - let rec pickLabel = function - | [] -> Printf.sprintf "__unknown_label_%d" stmt.sid - | Label (l, _, _) :: _ -> l - | _ :: rest -> pickLabel rest - in pickLabel stmt.labels - in Format.pp_print_string fmt name + match label with + | BuiltinLabel (_,l) -> Printer.pp_logic_builtin_label fmt l + | FormalLabel s -> Format.pp_print_string fmt s + | StmtLabel {contents=stmt} -> + Format.pp_print_string fmt + (let rec pickLabel = function + | [] -> Printf.sprintf "__unknown_label_%d" stmt.sid + | Label (l, _, _) :: _ -> l + | _ :: rest -> pickLabel rest + in pickLabel stmt.labels) let pp_assigns fmt asgns = match asgns with diff --git a/src/plugins/wp/wp_error.mli b/src/plugins/wp/wp_error.mli index fb415b7efc9a6853b7ffd38e2048a4831754b4fa..7832e201a4b8646bd77fce6098ad7d0173048edd 100644 --- a/src/plugins/wp/wp_error.mli +++ b/src/plugins/wp/wp_error.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -40,7 +40,7 @@ val not_yet_implemented : ?model:string -> ('a,Format.formatter,unit,'b) format4 val pp_logic_label : Format.formatter -> logic_label -> unit val pp_assigns : - Format.formatter -> Cil_types.identified_term Cil_types.assigns -> unit + Format.formatter -> Cil_types.assigns -> unit val pp_string_list : ?sep:Pretty_utils.sformat -> empty:string -> Format.formatter -> string list -> unit diff --git a/src/plugins/wp/wp_parameters.ml b/src/plugins/wp/wp_parameters.ml index 972d9c13d130068ded4ee467b8a9de134cd4a12c..ea970fb87f80e803ef033846bc4dba43ef6e3052 100644 --- a/src/plugins/wp/wp_parameters.ml +++ b/src/plugins/wp/wp_parameters.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -40,7 +40,7 @@ let warning ?current = match current with let resetdemon = ref [] let on_reset f = resetdemon := f :: !resetdemon let reset () = List.iter (fun f -> f ()) !resetdemon -let has_dkey k = Datatype.String.Set.mem k (Debug_category.get()) +let has_dkey (k:Log.category) = Datatype.String.Set.mem (k :> string) (Debug_category.get()) (* ------------------------------------------------------------------------ *) (* --- WP Generation --- *) @@ -223,6 +223,14 @@ module ExtEqual = let help = "Use extensional equality on compounds (hypotheses only)." end) +let () = Parameter_customize.set_group wp_model +module Overflows = + False(struct + let option_name = "-wp-overflows" + let help = "Collect hypotheses for absence of overflow and downcast\n\ + (incompatible with RTE generator plug-in)" + end) + let () = Parameter_customize.set_group wp_model module Literals = False(struct @@ -230,6 +238,14 @@ module Literals = let help = "Export content of string literals." end) +let () = Parameter_customize.set_group wp_model +module Volatile = + True(struct + let option_name = "-wp-volatile" + let help = "Sound modeling of volatile access.\n\ + Use -wp-no-volatile to ignore volatile attributes." + end) + (* ------------------------------------------------------------------------ *) (* --- WP Strategy --- *) (* ------------------------------------------------------------------------ *) @@ -276,17 +292,10 @@ module SplitDepth = let option_name = "-wp-split-depth" let default = 0 let arg_name = "p" - let help = "Set depth of exploration for spliting conjunctions into sub-goals.\n\ + let help = "Set depth of exploration for splitting conjunctions into sub-goals.\n\ Value `-1` means an unlimited depth." end) -let () = Parameter_customize.set_group wp_strategy -module Invariants = - False(struct - let option_name = "-wp-invariants" - let help = "Handle generalized invariants inside loops." - end) - let () = Parameter_customize.set_group wp_strategy module DynCall = False(struct @@ -342,6 +351,13 @@ module Ground = let help = "Use aggressive ground simplifications." end) +let () = Parameter_customize.set_group wp_simplifier +module Reduce = + True(struct + let option_name = "-wp-reduce" + let help = "Reduce function equalities with precedence to constructors." + end) + let () = Parameter_customize.set_group wp_simplifier module Filter = True(struct @@ -349,6 +365,20 @@ module Filter = let help = "Use variable filtering." end) +let () = Parameter_customize.set_group wp_simplifier +module Parasite = + True(struct + let option_name = "-wp-parasite" + let help = "Use singleton-variable filtering." + end) + +let () = Parameter_customize.set_group wp_simplifier +module Prenex = + False(struct + let option_name = "-wp-prenex" + let help = "Normalize nested foralls into prenex-form" + end) + let () = Parameter_customize.set_group wp_simplifier module Bits = True(struct @@ -363,6 +393,13 @@ module SimplifyIsCint = let help = "Remove redundant machine integer range hypothesis." end) +let () = Parameter_customize.set_group wp_simplifier +module SimplifyLandMask = + True(struct + let option_name = "-wp-simplify-land-mask" + let help = "Tight logical masks on unsigned integers." + end) + let () = Parameter_customize.set_group wp_simplifier module SimplifyForall = False(struct @@ -377,14 +414,6 @@ module SimplifyType = let help = "Remove all `Type` constraints." end) -let () = Parameter_customize.set_group wp_simplifier -module QedChecks = - String_set(struct - let option_name = "-wp-qed-checks" - let arg_name = "qed-key,..." - let help = "Check internal simplifications." - end) - let () = Parameter_customize.set_group wp_simplifier module InitWithForall = True(struct @@ -401,6 +430,14 @@ module BoundForallUnfolding = let default = 1000 end) +let () = Parameter_customize.set_group wp_simplifier +module QedChecks = + String_set(struct + let option_name = "-wp-qed-checks" + let arg_name = "qed-key,..." + let help = "Check internal simplifications." + end) + (* ------------------------------------------------------------------------ *) (* --- Prover Interface --- *) (* ------------------------------------------------------------------------ *) @@ -478,6 +515,31 @@ module Timeout = "Set the timeout (in seconds) for provers (default: %d)." default end) +let () = Parameter_customize.set_group wp_prover +module TimeExtra = + Int(struct + let option_name = "-wp-time-extra" + let default = 5 + let arg_name = "n" + let help = + Printf.sprintf + "Set extra-time (in seconds) for proof replay (default: %d)." default + end) + +let () = Parameter_customize.set_group wp_prover +module TimeMargin = + Int(struct + let option_name = "-wp-time-margin" + let default = 2 + let arg_name = "n" + let help = + Printf.sprintf + "Set margin-time (in seconds) for considering a proof automatic.\n\ + When using the 'tip' prover, scripts are created or cancelled\n\ + if the proof time is greater or lower than (timeout - margin).\n\ + (default: %d)." default + end) + let () = Parameter_customize.set_group wp_prover module Procs = Int(struct @@ -688,7 +750,7 @@ module TruncPropIdFileName = let option_name = "-wp-filename-truncation" let default = 60 let arg_name = "n" - let help = "Truncate basename of proof obligation files after <n> characters. Since numbers can be added as suffixes to make theses names unique, filename lengths can be highter to <n>. No truncation is performed when the value equals to zero (defaut: 60)." + let help = "Truncate basename of proof obligation files after <n> characters. Since numbers can be added as suffixes to make theses names unique, filename lengths can be highter to <n>. No truncation is performed when the value equals to zero (default: 60)." end) @@ -832,6 +894,7 @@ let base_output () = | dir -> make_output_dir dir ; dir in base_output := Some output; + Filepath.add_symbolic_dir "WPOUT" output ; output | Some output -> output @@ -869,13 +932,18 @@ let get_includes () = let cat_print_generated = register_category "print-generated" -let has_print_generated () = has_dkey "print-generated" - -let print_generated file = - debug ~dkey:cat_print_generated - "%a@." - (fun fmt file -> - Command.read_lines file (fun s -> - Format.pp_print_string fmt s; - Format.pp_print_newline fmt ())) - file; +let has_print_generated () = has_dkey cat_print_generated + +let print_generated ?header file = + let header = match header with + | None -> Filepath.pretty file + | Some head -> head in + debug ~dkey:cat_print_generated "%S@\n%t@." header + begin fun fmt -> + if not (Sys.file_exists file) then + Format.pp_print_string fmt "<missing file>" + else + Command.read_lines file (fun s -> + Format.pp_print_string fmt s; + Format.pp_print_newline fmt ()) + end diff --git a/src/plugins/wp/wp_parameters.mli b/src/plugins/wp/wp_parameters.mli index 89ca7abd7a080009ddfbc6f645143ba4c4a52d51..e6f1f37a95165b003ecf41188ffd2f1dddb40ec7 100644 --- a/src/plugins/wp/wp_parameters.mli +++ b/src/plugins/wp/wp_parameters.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -44,7 +44,7 @@ val job : unit -> job (** {2 Model Selection} *) -val has_dkey : string -> bool +val has_dkey : Log.category -> bool module Model : Parameter_sig.String_list module ByValue : Parameter_sig.String_set @@ -53,7 +53,9 @@ module InHeap : Parameter_sig.String_set module InCtxt : Parameter_sig.String_set module ExternArrays: Parameter_sig.Bool module ExtEqual : Parameter_sig.Bool +module Overflows : Parameter_sig.Bool module Literals : Parameter_sig.Bool +module Volatile : Parameter_sig.Bool (** {2 Computation Strategies} *) @@ -68,14 +70,17 @@ module Core: Parameter_sig.Bool module Prune: Parameter_sig.Bool module Clean: Parameter_sig.Bool module Filter: Parameter_sig.Bool +module Parasite: Parameter_sig.Bool +module Prenex: Parameter_sig.Bool module Bits: Parameter_sig.Bool module Ground: Parameter_sig.Bool +module Reduce: Parameter_sig.Bool module QedChecks : Parameter_sig.String_set module Split: Parameter_sig.Bool module SplitDepth: Parameter_sig.Int -module Invariants: Parameter_sig.Bool module DynCall : Parameter_sig.Bool module SimplifyIsCint : Parameter_sig.Bool +module SimplifyLandMask : Parameter_sig.Bool module SimplifyForall : Parameter_sig.Bool module SimplifyType : Parameter_sig.Bool module CalleePreCond : Parameter_sig.Bool @@ -89,6 +94,8 @@ module Drivers: Parameter_sig.String_list module Script: Parameter_sig.String module UpdateScript: Parameter_sig.Bool module Timeout: Parameter_sig.Int +module TimeExtra: Parameter_sig.Int +module TimeMargin: Parameter_sig.Int module CoqTimeout: Parameter_sig.Int module CoqCompiler : Parameter_sig.String module CoqIde : Parameter_sig.String @@ -131,6 +138,6 @@ val make_output_dir: string -> unit (** {2 Debugging Categories} *) val has_print_generated: unit -> bool -val print_generated: string -> unit +val print_generated: ?header:string -> string -> unit (** print the given file if the debugging category "print-generated" is set *) diff --git a/src/plugins/wp/wpo.ml b/src/plugins/wp/wpo.ml index d31d0a8ad8fe8eb2c66755c15c8e886559952d7c..8152ea3316b3c1225d41b97b26e811633df5bd1d 100644 --- a/src/plugins/wp/wpo.ml +++ b/src/plugins/wp/wpo.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -195,8 +195,10 @@ struct let apply phi g = g.sequent <- phi g.sequent - let default_simplifiers = - [Wp_parameters.SimplifyIsCint.get, Cint.is_cint_simplifier] + let default_simplifiers = [ + Wp_parameters.SimplifyIsCint.get, Cint.is_cint_simplifier ; + Wp_parameters.SimplifyLandMask.get, Cint.mask_simplifier ; + ] let preprocess g = if Wp_parameters.Let.get () then @@ -208,7 +210,9 @@ struct if Wp_parameters.Prune.get () then apply (Conditions.pruning ~solvers) g ; if Wp_parameters.Filter.get () - then apply Conditions.filter g + then apply Conditions.filter g ; + if Wp_parameters.Parasite.get () + then apply Conditions.parasite g end else begin @@ -685,7 +689,7 @@ let add g = Gmap.iter (fun _ ws -> WPOset.iter (fun _ -> incr added) ws) system.wpo_idx ; - if not (Wp_parameters.has_dkey "no-goals-info") then + if not (Wp_parameters.has_dkey VCS.dkey_no_goals_info) then Wp_parameters.feedback ~ontty:`Feedback "Computing [%d goals...]" !added ; added := 0 ; end ; @@ -793,8 +797,8 @@ let get_results g = let is_trivial g = match g.po_formula with - | GoalLemma vc -> Model.with_model g.po_model VC_Lemma.is_trivial vc - | GoalAnnot vc -> Model.with_model g.po_model VC_Annot.is_trivial vc + | GoalLemma vc -> VC_Lemma.is_trivial vc + | GoalAnnot vc -> VC_Annot.is_trivial vc | GoalCheck _ -> false let resolve g = @@ -816,6 +820,10 @@ let compute g = let is_proved g = List.exists (fun (_,r) -> VCS.is_valid r) (get_results g) +let is_unknown g = List.exists + (fun (_,r) -> VCS.is_verdict r && not (VCS.is_valid r)) + ( get_results g) + let get_result = Dynamic.register ~plugin:"Wp" "Wpo.get_result" ~journalize:false (Datatype.func2 WpoType.ty ProverType.ty ResultType.ty) diff --git a/src/plugins/wp/wpo.mli b/src/plugins/wp/wpo.mli index 23c8c546efee45ed1440d35091bbc38a50f378d9..d410495e210024956c0a9b2916c192521a7cfb52 100644 --- a/src/plugins/wp/wpo.mli +++ b/src/plugins/wp/wpo.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) @@ -169,6 +169,7 @@ val get_results : t -> (prover * result) list val get_proof : t -> bool * Property.t val is_trivial : t -> bool val is_proved : t -> bool +val is_unknown : t -> bool val warnings : t -> Warning.t list (** [true] if the result is valid. Dynamically exported. diff --git a/src/plugins/wp/wprop.ml b/src/plugins/wp/wprop.ml index 0dcddea94464fea34b0d95ad7398dbbddc34da01..34de3e08e50c3bd8f99b1db9437f85245ddc7513 100644 --- a/src/plugins/wp/wprop.ml +++ b/src/plugins/wp/wprop.ml @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/src/plugins/wp/wprop.mli b/src/plugins/wp/wprop.mli index 12f0673fe420036e49e32af16ccd20089da5f59e..bdeaac7f3b69b053610bef1771c93b3a8f36e62e 100644 --- a/src/plugins/wp/wprop.mli +++ b/src/plugins/wp/wprop.mli @@ -2,7 +2,7 @@ (* *) (* This file is part of WP plug-in of Frama-C. *) (* *) -(* Copyright (C) 2007-2016 *) +(* Copyright (C) 2007-2017 *) (* CEA (Commissariat a l'energie atomique et aux energies *) (* alternatives) *) (* *) diff --git a/tests/callgraph/function_pointer.i b/tests/callgraph/function_pointer.i new file mode 100644 index 0000000000000000000000000000000000000000..44e093a76a8890800ef571240d2166c5db631756 --- /dev/null +++ b/tests/callgraph/function_pointer.i @@ -0,0 +1,20 @@ +/* run.config + COMMENT: Test option -cg-function-pointers + EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs + OPT: -cg-function-pointers -load-module @PTEST_DIR@/@PTEST_NAME@ + OPT: -cg-no-function-pointers -load-module @PTEST_DIR@/@PTEST_NAME@ +*/ + +int (*fptr)(int); + +int f(int x) { return x; } +int g(int x) { return x-1; } + +int main(void) { + int x = 0; + *fptr = f; + x = (*fptr)(1); + *fptr = g; + x = (*fptr)(1); + return x; +} diff --git a/tests/callgraph/function_pointer.ml b/tests/callgraph/function_pointer.ml new file mode 100644 index 0000000000000000000000000000000000000000..c2b8ca966bd971e147c8f49ee8aeb94f7af9e0ff --- /dev/null +++ b/tests/callgraph/function_pointer.ml @@ -0,0 +1,4 @@ +let main () = + Format.printf "number of calls = %d@." (Callgraph.Uses.nb_calls ()) + +let () = Db.Main.extend main diff --git a/tests/callgraph/no_fp_unsound_warning.i b/tests/callgraph/no_fp_unsound_warning.i new file mode 100644 index 0000000000000000000000000000000000000000..f841a6e1821b5c00be834118f3cd6a8594a9c59f --- /dev/null +++ b/tests/callgraph/no_fp_unsound_warning.i @@ -0,0 +1,8 @@ +/* run.config + COMMENT: Test that callgraph users are warned about -cg-no-function-pointers + OPT: -cg-function-pointers -out + OPT: -cg-no-function-pointers -out +*/ + +void main() { +} diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.0.err.oracle b/tests/callgraph/oracle/function_pointer.0.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.0.err.oracle rename to tests/callgraph/oracle/function_pointer.0.err.oracle diff --git a/tests/callgraph/oracle/function_pointer.0.res.oracle b/tests/callgraph/oracle/function_pointer.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..6dc9d85f93e676d381cb465b72335ae535a84494 --- /dev/null +++ b/tests/callgraph/oracle/function_pointer.0.res.oracle @@ -0,0 +1,2 @@ +[kernel] Parsing tests/callgraph/function_pointer.i (no preprocessing) +number of calls = 2 diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.1.err.oracle b/tests/callgraph/oracle/function_pointer.1.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_bitwise.1.err.oracle rename to tests/callgraph/oracle/function_pointer.1.err.oracle diff --git a/tests/callgraph/oracle/function_pointer.1.res.oracle b/tests/callgraph/oracle/function_pointer.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..d275b5bc44d27ead6aab2ca148aff6bf54c7e440 --- /dev/null +++ b/tests/callgraph/oracle/function_pointer.1.res.oracle @@ -0,0 +1,2 @@ +[kernel] Parsing tests/callgraph/function_pointer.i (no preprocessing) +number of calls = 0 diff --git a/tests/callgraph/oracle/issue_55_iter_over_unregistered_function.res.oracle b/tests/callgraph/oracle/issue_55_iter_over_unregistered_function.res.oracle index 05dc89b34d1caddf763f121f1336e438100bd34d..f609f24b507baf10b3a866a4eb542998e09df220 100644 --- a/tests/callgraph/oracle/issue_55_iter_over_unregistered_function.res.oracle +++ b/tests/callgraph/oracle/issue_55_iter_over_unregistered_function.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/callgraph/issue_55_iter_over_unregistered_function.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,7 +5,6 @@ [value:initial-state] Values of globals at initialization tests/callgraph/issue_55_iter_over_unregistered_function.i:12:[value] warning: accessing uninitialized left-value. assert \initialized(&q); -[value] Recording results for main [value] done for function main tests/callgraph/issue_55_iter_over_unregistered_function.i:12:[value] assertion 'Value,initialisation' got final status invalid. [inout] InOut (internal) for function main: diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_call.err.oracle b/tests/callgraph/oracle/no_fp_unsound_warning.0.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_call.err.oracle rename to tests/callgraph/oracle/no_fp_unsound_warning.0.err.oracle diff --git a/tests/callgraph/oracle/no_fp_unsound_warning.0.res.oracle b/tests/callgraph/oracle/no_fp_unsound_warning.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..0b97d08d3d639a984521c3ff573d2df3f513a99c --- /dev/null +++ b/tests/callgraph/oracle/no_fp_unsound_warning.0.res.oracle @@ -0,0 +1,9 @@ +[kernel] Parsing tests/callgraph/no_fp_unsound_warning.i (no preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + +[value] done for function main +[inout] Out (internal) for function main: + \nothing diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cast.err.oracle b/tests/callgraph/oracle/no_fp_unsound_warning.1.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_cast.err.oracle rename to tests/callgraph/oracle/no_fp_unsound_warning.1.err.oracle diff --git a/tests/callgraph/oracle/no_fp_unsound_warning.1.res.oracle b/tests/callgraph/oracle/no_fp_unsound_warning.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..f599ec5775e934135798881d0857c1ca9e0b0b74 --- /dev/null +++ b/tests/callgraph/oracle/no_fp_unsound_warning.1.res.oracle @@ -0,0 +1,10 @@ +[kernel] Parsing tests/callgraph/no_fp_unsound_warning.i (no preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + +[value] done for function main +[cg] warning: using callgraph while option -cg-function-pointers is unset, result may be unsound +[inout] Out (internal) for function main: + \nothing diff --git a/tests/cil/acsl-comments.i b/tests/cil/acsl-comments.i new file mode 100644 index 0000000000000000000000000000000000000000..bf3c37795c39da683ba40f21b9901346cb16cba4 --- /dev/null +++ b/tests/cil/acsl-comments.i @@ -0,0 +1,2 @@ +/*@ ensures /* FOO */ \false; */ +void job(void) { } diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_cst.err.oracle b/tests/cil/oracle/acsl-comments.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_cst.err.oracle rename to tests/cil/oracle/acsl-comments.err.oracle diff --git a/tests/cil/oracle/acsl-comments.res.oracle b/tests/cil/oracle/acsl-comments.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..c7c45d5d11e67afd2b32133ebb2c0832bc6a4fdc --- /dev/null +++ b/tests/cil/oracle/acsl-comments.res.oracle @@ -0,0 +1,4 @@ +[kernel] Parsing tests/cil/acsl-comments.i (no preprocessing) +tests/cil/acsl-comments.i:1:[kernel] user error: lexical error, unexpected block-comment opening +[kernel] user error: stopping on file "tests/cil/acsl-comments.i" that has errors. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/cil/oracle/annot.res.oracle b/tests/cil/oracle/annot.res.oracle index 87eeb18fc96b03dd507012a76b2247c8045b2fb9..6ac364dad032473c0cb718e9d6edc84d7481e702 100644 --- a/tests/cil/oracle/annot.res.oracle +++ b/tests/cil/oracle/annot.res.oracle @@ -1,18 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/annot.c (with preprocessing) /* Generated by Frama-C */ int fact(int n) { - int r; - r = 1; + int r = 1; while (n > 0) { int tmp; /*@ assert n > 0; */ ; - before: { /* sequence */ - tmp = n; - n --; - r *= tmp; - } + before: tmp = n; + n --; + r *= tmp; /*@ assert r ≡ \at(r * n,before); */ ; } return r; diff --git a/tests/cil/oracle/branch.res.oracle b/tests/cil/oracle/branch.res.oracle index f06a75e2d1b74f601f733e98d26fc7c14dd9e856..aa369d3314a8df874eb6003e930e7e076482d797 100644 --- a/tests/cil/oracle/branch.res.oracle +++ b/tests/cil/oracle/branch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/branch.c (with preprocessing) /* Generated by Frama-C */ int f(int a, int b) @@ -6,21 +5,17 @@ int f(int a, int b) int __retres; if (a < b) { int tmp; - { /* sequence */ - tmp = a; - a ++; - ; - } + tmp = a; + a ++; + ; __retres = tmp; goto return_label; } else { int tmp_0; - { /* sequence */ - tmp_0 = b; - b --; - ; - } + tmp_0 = b; + b --; + ; __retres = tmp_0; goto return_label; } diff --git a/tests/cil/oracle/bts297.res.oracle b/tests/cil/oracle/bts297.res.oracle index e7c43847a874932ae1aa17ee4ea87b59f9097f76..cbc83caf1e1b54b332990a5c15099af8ea173a7d 100644 --- a/tests/cil/oracle/bts297.res.oracle +++ b/tests/cil/oracle/bts297.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/bts297.c (with preprocessing) tests/cil/bts297.c:4:[kernel] warning: Body of function abrupt falls-through. Adding a return statement /* Generated by Frama-C */ diff --git a/tests/cil/oracle/bts882.res.oracle b/tests/cil/oracle/bts882.res.oracle index 9e7b514a3c36225096f1ba10d9d604944f361549..b7cdef1e162b3cfb0918b77a19a515c69555ee36 100644 --- a/tests/cil/oracle/bts882.res.oracle +++ b/tests/cil/oracle/bts882.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/bts882.i (no preprocessing) tests/cil/bts882.i:8:[kernel] warning: Calling undeclared function f. Old style K&R code? /* Generated by Frama-C */ @@ -10,8 +9,7 @@ void main(void) switch (1) { case 2: r = f(1); break; - default: ; - break; + default: break; } return; } diff --git a/tests/cil/oracle/bts892.res.oracle b/tests/cil/oracle/bts892.res.oracle index 63b23aafe35d764ebb04ac3e37d2c7cb86413425..161332f7e5202184522e81092bbc456b32f8152c 100644 --- a/tests/cil/oracle/bts892.res.oracle +++ b/tests/cil/oracle/bts892.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/bts892.i (no preprocessing) tests/cil/bts892.i:11:[kernel] user error: Forbidden access to local variable i in static initializer [kernel] user error: stopping on file "tests/cil/bts892.i" that has errors. diff --git a/tests/cil/oracle/comments.res.oracle b/tests/cil/oracle/comments.res.oracle index 89f58cfbf0b48d13b0cbbb61fd59f38698a242eb..5fdf3be302ea82a72aa2bac2161501ce2d15571e 100644 --- a/tests/cil/oracle/comments.res.oracle +++ b/tests/cil/oracle/comments.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/comments.c (with preprocessing) /* Generated by Frama-C */ /* run.config @@ -22,10 +21,8 @@ void g(void) int bts_2176(void) { - int r; - int i; - r = 0; - i = 0; + int r = 0; + int i = 0; /* comment 1 */ /* comment 2 */ r = 1; diff --git a/tests/cil/oracle/cpu_a.res.oracle b/tests/cil/oracle/cpu_a.res.oracle index fc7b0da5a94fb8ce3bcc2e4e13232fba4641c347..b0c309dd681ef981e98f4cdbdb06fcaeb0938977 100644 --- a/tests/cil/oracle/cpu_a.res.oracle +++ b/tests/cil/oracle/cpu_a.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/cpu_a.c (with preprocessing) [kernel] Parsing tests/cil/cpu_b.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/cil/oracle/cpu_b.res.oracle b/tests/cil/oracle/cpu_b.res.oracle index 8f737f1be82b2dc1c6180b537b163a804eca89ca..f0f017316fc5fb8361ef2f9d3b1bd4024f6ac5c7 100644 --- a/tests/cil/oracle/cpu_b.res.oracle +++ b/tests/cil/oracle/cpu_b.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/cpu_b.c (with preprocessing) [kernel] Parsing tests/cil/cpu_a.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/cil/oracle/digraphs_c99.res.oracle b/tests/cil/oracle/digraphs_c99.res.oracle index 57fa990d42e94760465f74c469c934451c22e1be..c1f739d778c85e6c688942355624b02c9c06079e 100644 --- a/tests/cil/oracle/digraphs_c99.res.oracle +++ b/tests/cil/oracle/digraphs_c99.res.oracle @@ -1,39 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/digraphs_c99.c (with preprocessing) /* Generated by Frama-C */ -/*@ requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - assigns *(dest + (0 .. n - 1)); - assigns *(dest + (0 .. n - 1)) \from \nothing; - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(unsigned char *dest, - unsigned long n); - int main(void) { int __retres; - int a[5]; - char *s; - char *b; - char *c; int d1; int d2; - /*@ behavior Frama_C_implicit_init: - ensures a[0] ≡ 2; - ensures a[1] ≡ 1; - ensures a[2] ≡ 0; - ensures ∀ ℤ __i; 3 ≤ __i ≤ 4 ⇒ a[__i] ≡ 0; - assigns a[0 .. 5 - 1]; - */ - { - Frama_C_bzero((unsigned char *)(a),(unsigned long)sizeof(int [5])); - a[0] = 2; - a[1] = 1; - a[2] = 0; - } - s = (char *)"a<:"; - b = (char *)"(a[0])"; - c = (char *)"(a<:0:>)"; + int a[5] = {2, 1, 0}; + char *s = (char *)"a<:"; + char *b = (char *)"(a[0])"; + char *c = (char *)"(a<:0:>)"; d1 = 7; d2 = 9; __retres = a[4]; diff --git a/tests/cil/oracle/duplicate-labels.res.oracle b/tests/cil/oracle/duplicate-labels.res.oracle index 898e081b4cc14cd828e5dea092cd8fc65b80cd62..d65eddc06fdd013658e8f224eb3c3fb241813d9d 100644 --- a/tests/cil/oracle/duplicate-labels.res.oracle +++ b/tests/cil/oracle/duplicate-labels.res.oracle @@ -1,17 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/duplicate-labels.c (with preprocessing) /* Generated by Frama-C */ int foo18(int a) { - int x; - int y; - x = 0; - y = 1; - { /* sequence */ - goto l; - l: ; - x = 3; - } + int x = 0; + int y = 1; + goto l; + l: ; + x = 3; goto l; return x; } @@ -30,8 +25,7 @@ void foo(int z) void f(void) { - int i; - i = 0; + int i = 0; while_1_break: while (i < 10) i ++; goto while_1_break; return; diff --git a/tests/cil/oracle/empty_cond.res.oracle b/tests/cil/oracle/empty_cond.res.oracle index 774e0aad02ea783a5689b7d907bc076b42ffb9a0..6c71859e8096da1b3ad006204ae2ea5568decfc6 100644 --- a/tests/cil/oracle/empty_cond.res.oracle +++ b/tests/cil/oracle/empty_cond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/empty_cond.c (with preprocessing) /* Generated by Frama-C */ int y; diff --git a/tests/cil/oracle/merge.res.oracle b/tests/cil/oracle/merge.res.oracle index e01cb6525869713a5b92d170949496d243a7fb78..3f263812a264b10b004bb88993dd4d88e7201e82 100644 --- a/tests/cil/oracle/merge.res.oracle +++ b/tests/cil/oracle/merge.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/merge.c (with preprocessing) [kernel] Parsing tests/cil/merge2.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/cil/oracle/merge2.res.oracle b/tests/cil/oracle/merge2.res.oracle index fa243db33a4d15f2846c4c03624e4f0df9937331..dba7cef7e568b84758f494fa92feafd8303db695 100644 --- a/tests/cil/oracle/merge2.res.oracle +++ b/tests/cil/oracle/merge2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/merge2.c (with preprocessing) [kernel] Parsing tests/cil/merge.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/cil/oracle/ocaml32bits3_11_0.res.oracle b/tests/cil/oracle/ocaml32bits3_11_0.res.oracle index 8b6aea3a369d9bd8a3dd1efd27a26d0572b6abf6..44e645672186eac1812793cb79d8866ae2450e02 100644 --- a/tests/cil/oracle/ocaml32bits3_11_0.res.oracle +++ b/tests/cil/oracle/ocaml32bits3_11_0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/ocaml32bits3_11_0.i (no preprocessing) /* Generated by Frama-C */ enum __anonenum_v_1 { diff --git a/tests/cil/oracle/overlap.res.oracle b/tests/cil/oracle/overlap.res.oracle index 675c28385bc1001074e5fff2700f407ccf9236a6..9257c0ccf8c77beef7a9ea446b9db912a2c84dd5 100644 --- a/tests/cil/oracle/overlap.res.oracle +++ b/tests/cil/oracle/overlap.res.oracle @@ -1,15 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/overlap.c (with preprocessing) /* Generated by Frama-C */ int main(void) { int __retres; - int n; int z[8]; - n = 8; + int n = 8; { - int i; - i = 0; + int i = 0; while (i < n) { int tmp; int tmp_0; @@ -18,25 +15,21 @@ int main(void) int tmp_3; int tmp_4; first: - { /* sequence */ - tmp = i; - i ++; - tmp_0 = i; - i ++; - tmp_1 = i; - i --; - z[tmp] = z[tmp_0] + tmp_1; - } + tmp = i; + i ++; + tmp_0 = i; + i ++; + tmp_1 = i; + i --; + z[tmp] = z[tmp_0] + tmp_1; last: - { /* sequence */ - tmp_2 = i; - i ++; - tmp_3 = i; - i ++; - tmp_4 = i; - i --; - z[tmp_2] = z[tmp_3] + tmp_4; - } + tmp_2 = i; + i ++; + tmp_3 = i; + i ++; + tmp_4 = i; + i --; + z[tmp_2] = z[tmp_3] + tmp_4; /*@ assert \at(0 ≤ i < n,first); */ ; /*@ assert \at(0 ≤ i < n,last); */ ; } diff --git a/tests/cil/oracle/union_to_union.res.oracle b/tests/cil/oracle/union_to_union.res.oracle index 2326bccba4959a2b035ea6185b552f103a32ead4..3d21ad00f0c6c92ce6904ab8eb51bf07eb9e408e 100644 --- a/tests/cil/oracle/union_to_union.res.oracle +++ b/tests/cil/oracle/union_to_union.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/cil/union_to_union.i (no preprocessing) /* Generated by Frama-C */ union X { @@ -12,23 +11,14 @@ int main(void) union X u; union X v; union X w; - union X __constr_expr_0; int a; - union X __constr_expr_1; short b; - union X __constr_expr_2; - { /* sequence */ - __constr_expr_0 = u; - v = __constr_expr_0; - } - { /* sequence */ - __constr_expr_1.a = a; - w = __constr_expr_1; - } - { /* sequence */ - __constr_expr_2.b = b; - w = __constr_expr_2; - } + union X __constr_expr_0 = u; + v = __constr_expr_0; + union X __constr_expr_1 = {.a = a}; + w = __constr_expr_1; + union X __constr_expr_2 = {.b = b}; + w = __constr_expr_2; __retres = 0; return __retres; } diff --git a/tests/constant_propagation/array_pointers.i b/tests/constant_propagation/array_pointers.i index 1ba0c6505715f861df330c5e80f9ac2ac878b6c9..fa39cdeed979631ffd11cb7411427d72bdcbdd85 100644 --- a/tests/constant_propagation/array_pointers.i +++ b/tests/constant_propagation/array_pointers.i @@ -1,5 +1,5 @@ /* run.config - OPT: -val -semantic-const-folding -journal-disable + OPT: -val -val-show-progress -scf -val-show-progress -journal-disable */ void *p; diff --git a/tests/constant_propagation/bts-1787-bis.i b/tests/constant_propagation/bts-1787-bis.i index f1bca0cf36354ba0c847bff4b69865dfa69f1546..9f48943e13a316ced4630c0e77c4fc70006d2b8f 100644 --- a/tests/constant_propagation/bts-1787-bis.i +++ b/tests/constant_propagation/bts-1787-bis.i @@ -1,7 +1,7 @@ /* run.config OPT: -journal-disable -print -OPT: -journal-disable -scf -OPT: -journal-disable -scf -scf-allow-cast +OPT: -journal-disable -scf -val-show-progress +OPT: -journal-disable -scf -val-show-progress -scf-allow-cast */ typedef struct { diff --git a/tests/constant_propagation/bts-1787.i b/tests/constant_propagation/bts-1787.i index d3b7defca3bd8ff87c6001f906876b90b2382602..e566f14644cd2423665b4efa3dcc0413bb55b0f0 100644 --- a/tests/constant_propagation/bts-1787.i +++ b/tests/constant_propagation/bts-1787.i @@ -1,6 +1,6 @@ /* run.config -OPT: -journal-disable -scf -scf-allow-cast -OPT: -journal-disable -scf +OPT: -journal-disable -scf -val-show-progress -scf-allow-cast +OPT: -journal-disable -scf -val-show-progress */ typedef struct { diff --git a/tests/constant_propagation/bts117.c b/tests/constant_propagation/bts117.c index c204a27d40650a01e7fa3df2bec60647473dbbb7..0ff58f5b83fbf2e9520e334260c44d0ab39940be 100644 --- a/tests/constant_propagation/bts117.c +++ b/tests/constant_propagation/bts117.c @@ -1,7 +1,7 @@ /* run.config OPT: -journal-disable -print -OPT: -journal-disable -semantic-const-folding -OPT: -journal-disable -sparecode-analysis +OPT: -journal-disable -semantic-const-folding -val-show-progress +OPT: -journal-disable -sparecode-analysis -val-show-progress */ int main1 (void) { diff --git a/tests/constant_propagation/const_field_return_struct.i b/tests/constant_propagation/const_field_return_struct.i index aecc88d3b958592034a8398fb66a15658cbe12d0..0f875461dd797d6d0b5c7e6756194217ff0041c1 100644 --- a/tests/constant_propagation/const_field_return_struct.i +++ b/tests/constant_propagation/const_field_return_struct.i @@ -1,5 +1,5 @@ /* run.config - OPT: -val -semantic-const-folding -journal-disable + OPT: -val -val-show-progress -scf -val-show-progress -journal-disable */ struct S { diff --git a/tests/constant_propagation/const_propagate.c b/tests/constant_propagation/const_propagate.c index 0c271a48a0c06ca9c7c5d1671e368d749731e2af..822620e8bdd10a788a9cf6a3c7d209d534f87bbf 100644 --- a/tests/constant_propagation/const_propagate.c +++ b/tests/constant_propagation/const_propagate.c @@ -1,6 +1,6 @@ /* run.config - OPT: -val -deps -out -input -semantic-const-folding -journal-disable - OPT: -semantic-const-folding -cast-from-constant -semantic-const-fold add3 -main init -journal-disable + OPT: -val -val-show-progress -deps -out -input -scf -val-show-progress -journal-disable + OPT: -scf -val-show-progress -cast-from-constant -semantic-const-fold add3 -main init -journal-disable */ int x,y,z; int TAB[10]; diff --git a/tests/constant_propagation/declaration.c b/tests/constant_propagation/declaration.c index 2c2fdcff46b4e2c5f94d0cc6b9e61faf78b17897..851b0f86b3b5cf9e52f898157fc7e124fe8cab77 100644 --- a/tests/constant_propagation/declaration.c +++ b/tests/constant_propagation/declaration.c @@ -1,5 +1,5 @@ /* run.config - OPT: -val -then -scf -then-on propagated -scf + OPT: -val -val-show-progress -then -scf -val-show-progress -then-on propagated -scf -val-show-progress */ void f(int *x, int *y, void (*p)(int *x, int *y)) { diff --git a/tests/constant_propagation/declaration2.c b/tests/constant_propagation/declaration2.c index ab42e2a01382608aa6aa3757aac198298d14c79f..8ad98909d073578a21ddd5679c940c7c486165b4 100644 --- a/tests/constant_propagation/declaration2.c +++ b/tests/constant_propagation/declaration2.c @@ -1,5 +1,5 @@ /* run.config - OPT: -val -semantic-const-folding -journal-disable + OPT: -val -val-show-progress -scf -val-show-progress -journal-disable */ void f(int *x) { (*x)++; } diff --git a/tests/constant_propagation/enum.i b/tests/constant_propagation/enum.i index 5ac0b9374663a9e890c850d4281df162b1ee8461..05c5ff78021faacf7ac856d56e82d0e5787e0b38 100644 --- a/tests/constant_propagation/enum.i +++ b/tests/constant_propagation/enum.i @@ -1,5 +1,5 @@ /* run.config -OPT: -semantic-const-folding +OPT: -semantic-const-folding -val-show-progress */ enum E { A, B, C, D }; diff --git a/tests/constant_propagation/fct_ptr.i b/tests/constant_propagation/fct_ptr.i index 29ff3df6d9970095dca5051e64b7acb01fca55c5..83cf4fc3e62db221c44d80f1e06f8cf083f70eae 100644 --- a/tests/constant_propagation/fct_ptr.i +++ b/tests/constant_propagation/fct_ptr.i @@ -1,5 +1,5 @@ /* run.config -OPT: -scf -then-on propagated +OPT: -scf -val-show-progress -then-on propagated */ void (*pf)(void); diff --git a/tests/constant_propagation/introduction_of_non_explicit_cast.c b/tests/constant_propagation/introduction_of_non_explicit_cast.c index 201203138e6a86e06bc45c979222aa2fffba9f67..e357fb07067625aef32c46cc6cae626a15c9f88d 100644 --- a/tests/constant_propagation/introduction_of_non_explicit_cast.c +++ b/tests/constant_propagation/introduction_of_non_explicit_cast.c @@ -1,5 +1,5 @@ /* run.config - OPT: -load-script tests/constant_propagation/introduction_of_non_explicit_cast.ml -val -deps -journal-disable + OPT: -load-script tests/constant_propagation/introduction_of_non_explicit_cast.ml -val -val-show-progress -deps -journal-disable */ diff --git a/tests/constant_propagation/oracle/array_pointers.res.oracle b/tests/constant_propagation/oracle/array_pointers.res.oracle index e40bb411f2a7a6343ddc9776e35530fc1df82875..25f8486cf2cca1738da342bddaf6d6a2e2230cd3 100644 --- a/tests/constant_propagation/oracle/array_pointers.res.oracle +++ b/tests/constant_propagation/oracle/array_pointers.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/array_pointers.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -19,12 +18,9 @@ tests/constant_propagation/array_pointers.i:10:[kernel] warning: using size of ' void *p; void main(void) { - void **q; - void **r; - void *s; - q = & p + 1; - r = & p + 2; - s = p + 1; + void **q = & p + 1; + void **r = & p + 2; + void *s = p + 1; return; } diff --git a/tests/constant_propagation/oracle/bts-1787-bis.0.res.oracle b/tests/constant_propagation/oracle/bts-1787-bis.0.res.oracle index 75ae346625e6901ee6c3137e7e093c441866b9ff..76e01d549a47b5c291f5b25ab6733266096a0878 100644 --- a/tests/constant_propagation/oracle/bts-1787-bis.0.res.oracle +++ b/tests/constant_propagation/oracle/bts-1787-bis.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts-1787-bis.i (no preprocessing) /* Generated by Frama-C */ struct __anonstruct_S1_t_1 { @@ -20,46 +19,40 @@ static S2_t const G2 = {.p1 = (S1_t const *)(& G1.c12), .p2 = & G1.c12, .p3 = & G1.c3}; void h1(S2_t const *q) { - S1_t *s1; - s1 = (S1_t *)q->p1; + S1_t *s1 = (S1_t *)q->p1; return; } void h2(S2_t const *q) { - S1_t *s2; - s2 = (S1_t *)q->p1; + S1_t *s2 = (S1_t *)q->p1; return; } void h3(S2_t const *q) { - S1_t *s3; - s3 = (S1_t *)G2.p1; + S1_t *s3 = (S1_t *)G2.p1; return; } void h4(S2_t const *q) { - S1_t *s5; - s5 = & G1.c12; + S1_t *s5 = & G1.c12; return; } void h5(S2_t const *q) { - S1_t *s6; - s6 = & G1.c12; + S1_t *s6 = & G1.c12; return; } int main(int c) { int __retres; - int s; int tmp; if (c) tmp = 1; else tmp = 2; - s = tmp; + int s = tmp; G1.c12.s = s; h1(& G2); h2(& G2); diff --git a/tests/constant_propagation/oracle/bts-1787-bis.1.res.oracle b/tests/constant_propagation/oracle/bts-1787-bis.1.res.oracle index 98ce4cad8960de543a045d349e7c4a428b464f74..c8926c7f35de6a5157feb0f3962baafc115a3fa0 100644 --- a/tests/constant_propagation/oracle/bts-1787-bis.1.res.oracle +++ b/tests/constant_propagation/oracle/bts-1787-bis.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts-1787-bis.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -50,46 +49,40 @@ static S2_t const G2 = {.p1 = (S1_t const *)(& G1.c12), .p2 = & G1.c12, .p3 = & G1.c3}; void h1(S2_t const *q) { - S1_t *s1; - s1 = & G1.c12; + S1_t *s1 = & G1.c12; return; } void h2(S2_t const *q) { - S1_t *s2; - s2 = & G1.c12; + S1_t *s2 = & G1.c12; return; } void h3(S2_t const *q) { - S1_t *s3; - s3 = & G1.c12; + S1_t *s3 = & G1.c12; return; } void h4(S2_t const *q) { - S1_t *s5; - s5 = & G1.c12; + S1_t *s5 = & G1.c12; return; } void h5(S2_t const *q) { - S1_t *s6; - s6 = & G1.c12; + S1_t *s6 = & G1.c12; return; } int main(int c) { int __retres; - int s; int tmp; if (c) tmp = 1; else tmp = 2; - s = tmp; + int s = tmp; G1.c12.s = s; h1(& G2); h2(& G2); diff --git a/tests/constant_propagation/oracle/bts-1787-bis.2.res.oracle b/tests/constant_propagation/oracle/bts-1787-bis.2.res.oracle index 98ce4cad8960de543a045d349e7c4a428b464f74..c8926c7f35de6a5157feb0f3962baafc115a3fa0 100644 --- a/tests/constant_propagation/oracle/bts-1787-bis.2.res.oracle +++ b/tests/constant_propagation/oracle/bts-1787-bis.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts-1787-bis.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -50,46 +49,40 @@ static S2_t const G2 = {.p1 = (S1_t const *)(& G1.c12), .p2 = & G1.c12, .p3 = & G1.c3}; void h1(S2_t const *q) { - S1_t *s1; - s1 = & G1.c12; + S1_t *s1 = & G1.c12; return; } void h2(S2_t const *q) { - S1_t *s2; - s2 = & G1.c12; + S1_t *s2 = & G1.c12; return; } void h3(S2_t const *q) { - S1_t *s3; - s3 = & G1.c12; + S1_t *s3 = & G1.c12; return; } void h4(S2_t const *q) { - S1_t *s5; - s5 = & G1.c12; + S1_t *s5 = & G1.c12; return; } void h5(S2_t const *q) { - S1_t *s6; - s6 = & G1.c12; + S1_t *s6 = & G1.c12; return; } int main(int c) { int __retres; - int s; int tmp; if (c) tmp = 1; else tmp = 2; - s = tmp; + int s = tmp; G1.c12.s = s; h1(& G2); h2(& G2); diff --git a/tests/constant_propagation/oracle/bts-1787.0.res.oracle b/tests/constant_propagation/oracle/bts-1787.0.res.oracle index 3fb4224d8f03892b48845b22592e3aaed16a40ba..55c048639702d2b9cef267e8f1bbdeca8b90c58e 100644 --- a/tests/constant_propagation/oracle/bts-1787.0.res.oracle +++ b/tests/constant_propagation/oracle/bts-1787.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts-1787.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -36,8 +35,7 @@ static S2_t const G2 = {.p1 = (S1_t const *)(& G1.c12), .p2 = & G1.c12, .p3 = & G1.c3}; void g(S2_t const *q) { - S1_t *s1; - s1 = & G1.c12; + S1_t *s1 = & G1.c12; G1.c3.s = G1.c12.s + G1.c12.s; G1.c12.s = 3; return; @@ -46,10 +44,9 @@ void g(S2_t const *q) int main(int c) { int __retres; - int s; int tmp; if (c) tmp = 1; else tmp = 2; - s = tmp; + int s = tmp; G1.c12.s = s; g(& G2); __retres = G1.c3.s; diff --git a/tests/constant_propagation/oracle/bts-1787.1.res.oracle b/tests/constant_propagation/oracle/bts-1787.1.res.oracle index 3fb4224d8f03892b48845b22592e3aaed16a40ba..55c048639702d2b9cef267e8f1bbdeca8b90c58e 100644 --- a/tests/constant_propagation/oracle/bts-1787.1.res.oracle +++ b/tests/constant_propagation/oracle/bts-1787.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts-1787.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -36,8 +35,7 @@ static S2_t const G2 = {.p1 = (S1_t const *)(& G1.c12), .p2 = & G1.c12, .p3 = & G1.c3}; void g(S2_t const *q) { - S1_t *s1; - s1 = & G1.c12; + S1_t *s1 = & G1.c12; G1.c3.s = G1.c12.s + G1.c12.s; G1.c12.s = 3; return; @@ -46,10 +44,9 @@ void g(S2_t const *q) int main(int c) { int __retres; - int s; int tmp; if (c) tmp = 1; else tmp = 2; - s = tmp; + int s = tmp; G1.c12.s = s; g(& G2); __retres = G1.c3.s; diff --git a/tests/constant_propagation/oracle/bts117.0.res.oracle b/tests/constant_propagation/oracle/bts117.0.res.oracle index 3702456f66e8cb3abf2c604392499e427b3fb087..f3781d0604d214a91cefad0e09ea401c52a1550b 100644 --- a/tests/constant_propagation/oracle/bts117.0.res.oracle +++ b/tests/constant_propagation/oracle/bts117.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts117.c (with preprocessing) /* Generated by Frama-C */ int main1(void) @@ -10,8 +9,7 @@ int main1(void) int main2(void) { - int r; - r = 1; + int r = 1; if (r) r = 0; else r = 2; return r; } @@ -19,10 +17,8 @@ int main2(void) int main(void) { int __retres; - int x1; - int x2; - x1 = main1(); - x2 = main2(); + int x1 = main1(); + int x2 = main2(); __retres = x1 + x2; return __retres; } diff --git a/tests/constant_propagation/oracle/bts117.1.res.oracle b/tests/constant_propagation/oracle/bts117.1.res.oracle index 8b19c6139378c46b13a08f86c6ba592c64585322..a0c2a9789b00494fd0b7e38d2fca07559f25f242 100644 --- a/tests/constant_propagation/oracle/bts117.1.res.oracle +++ b/tests/constant_propagation/oracle/bts117.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts117.c (with preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -26,8 +25,7 @@ int main1(void) int main2(void) { - int r; - r = 1; + int r = 1; if (1) r = 0; else r = 2; return r; } @@ -35,10 +33,8 @@ int main2(void) int main(void) { int __retres; - int x1; - int x2; - x1 = main1(); - x2 = main2(); + int x1 = main1(); + int x2 = main2(); __retres = 0; return __retres; } diff --git a/tests/constant_propagation/oracle/bts117.2.res.oracle b/tests/constant_propagation/oracle/bts117.2.res.oracle index fb0de2245bc18d6f7dc978e5f79d69a8fa698732..66a81566dac268149e80c03d08f1a553ec202b9a 100644 --- a/tests/constant_propagation/oracle/bts117.2.res.oracle +++ b/tests/constant_propagation/oracle/bts117.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/bts117.c (with preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -26,14 +25,6 @@ [pdg] done for function main2 [pdg] computing for function main1 [pdg] done for function main1 -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] remove unused global declarations... [sparecode] result in new project 'default without sparecode'. /* Generated by Frama-C */ @@ -54,10 +45,8 @@ int main2(void) int main(void) { int __retres; - int x1; - int x2; - x1 = main1(); - x2 = main2(); + int x1 = main1(); + int x2 = main2(); __retres = x1 + x2; return __retres; } diff --git a/tests/constant_propagation/oracle/const_field_return_struct.res.oracle b/tests/constant_propagation/oracle/const_field_return_struct.res.oracle index 1f204d0a761d924a6b94caf866d591f8ebb3dbfd..bb4dd1b23716c48d1fd866699137a8ee64a4b287 100644 --- a/tests/constant_propagation/oracle/const_field_return_struct.res.oracle +++ b/tests/constant_propagation/oracle/const_field_return_struct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/const_field_return_struct.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -14,7 +13,7 @@ [scf] beginning constant propagation /* Generated by Frama-C */ struct S { - int f0 ; + int const f0 ; int f1 ; }; struct S T; diff --git a/tests/constant_propagation/oracle/const_propagate.0.res.oracle b/tests/constant_propagation/oracle/const_propagate.0.res.oracle index cf1a706967a783488f5d1e0735adbfbf2a6f24d7..d033b27d41f1d7cd55237cbfff6b30502a8849d7 100644 --- a/tests/constant_propagation/oracle/const_propagate.0.res.oracle +++ b/tests/constant_propagation/oracle/const_propagate.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/const_propagate.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -144,9 +143,7 @@ struct st s1; struct st s2; void test_struct(void) { - ST s; - s.a = 0; - s.b = 1; + ST s = {.a = 0, .b = 1}; s1 = s; s1.a = 1; s2.a = 1; @@ -158,20 +155,15 @@ void test_struct(void) void test_tab(int v) { - int *r; - char *q; - int decal; - { /* sequence */ - s2.b = 2; - TAB[1] = 0; - } - r = & TAB[4]; + s2.b = 2; + TAB[1] = 0; + int *r = & TAB[4]; TAB[4] = 13; TAB[5] = 13; - q = (char *)(& TAB[4]); + char *q = (char *)(& TAB[4]); *q = (char)13; *(q + 1) = (char)13; - decal = 4; + int decal = 4; *(q + 4) = (char)13; return; } @@ -179,13 +171,10 @@ void test_tab(int v) int *test_ptr(int v) { int *__retres; - int *p; - char *s; - int decal; - p = & x; - s = (char *)(& x); + int *p = & x; + char *s = (char *)(& x); *s = (char)7; - decal = 1; + int decal = 1; *(s + 1) = (char)7; s = (char *)(& x) + 1; *s = (char)7; @@ -197,8 +186,7 @@ int *test_ptr(int v) int *test_struct_ptr(void) { int *__retres; - int *q; - q = & s1.b; + int *q = & s1.b; __retres = & s1.a; return __retres; } @@ -212,15 +200,12 @@ int add3(int v1, int v2, int v3) int init(int v) { - int zero; - int sept; - int z1; - zero = 0; - sept = 7; + int zero = 0; + int sept = 7; x = 5; y = 7; z = add3(5,7,0); - z1 = 12; + int z1 = 12; return zero; } @@ -252,23 +237,19 @@ void test_float_double(void) void main(int a) { - int b; - int *p; - int *q; int *tmp_1; - int yy; test_ull(); test_struct(); test_struct_ptr(); test_tab(13); test_float_double(); - b = init(5); + int b = init(5); z = add3(a,0,0); - p = test_ptr(7); + int *p = test_ptr(7); /*@ assert *p ≡ 7; */ ; if (a) tmp_1 = & x; else tmp_1 = & y; - q = tmp_1; - yy = 7; + int *q = tmp_1; + int yy = 7; /*@ assert a ≡ 0 ⇒ q ≡ &y; */ ; /*@ assert *q ≡ 7; */ ; return; diff --git a/tests/constant_propagation/oracle/const_propagate.1.res.oracle b/tests/constant_propagation/oracle/const_propagate.1.res.oracle index fbaabc4a167b30a9581e9d763e9abe715bce28df..5ada4eafd603d54b55b6a54f5cd43aa1ace49c02 100644 --- a/tests/constant_propagation/oracle/const_propagate.1.res.oracle +++ b/tests/constant_propagation/oracle/const_propagate.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/const_propagate.c (with preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at init @@ -41,9 +40,7 @@ struct st s1; struct st s2; void test_struct(void) { - ST s; - s.a = 0; - s.b = 1; + ST s = {.a = 0, .b = 1}; s1 = s; (s1.a) ++; s2.a = s1.a; @@ -55,20 +52,15 @@ void test_struct(void) void test_tab(int v) { - int *r; - char *q; - int decal; - { /* sequence */ - (s2.b) ++; - TAB[s1.b] = TAB[s2.b]; - } - r = & TAB[4]; + (s2.b) ++; + TAB[s1.b] = TAB[s2.b]; + int *r = & TAB[4]; *r = v; *(r + 1) = v; - q = (char *)r; + char *q = (char *)r; *q = (char)v; *(q + 1) = (char)v; - decal = (int)sizeof(int); + int decal = (int)sizeof(int); *(q + decal) = (char)v; return; } @@ -76,13 +68,10 @@ void test_tab(int v) int *test_ptr(int v) { int *__retres; - int *p; - char *s; - int decal; - p = & x; - s = (char *)p; + int *p = & x; + char *s = (char *)p; *s = (char)v; - decal = 1; + int decal = 1; *(s + decal) = (char)v; s = (char *)p + decal; *s = (char)v; @@ -94,8 +83,7 @@ int *test_ptr(int v) int *test_struct_ptr(void) { int *__retres; - int *q; - q = & s1.b; + int *q = & s1.b; __retres = & s1.a; return __retres; } @@ -110,15 +98,12 @@ int add3(int v1, int v2, int v3) int init(int v) { - int zero; - int sept; - int z1; - zero = 0; - sept = 7; + int zero = 0; + int sept = 7; x = v; y = sept; z = add3(x,y,zero); - z1 = z; + int z1 = z; return zero; } @@ -150,23 +135,19 @@ void test_float_double(void) void main(int a) { - int b; - int *p; - int *q; int *tmp_1; - int yy; test_ull(); test_struct(); test_struct_ptr(); test_tab(13); test_float_double(); - b = init(5); + int b = init(5); z = add3(a,0,0); - p = test_ptr(y); + int *p = test_ptr(y); /*@ assert *p ≡ 7; */ ; if (a) tmp_1 = p; else tmp_1 = & y; - q = tmp_1; - yy = *q; + int *q = tmp_1; + int yy = *q; /*@ assert a ≡ 0 ⇒ q ≡ &y; */ ; /*@ assert *q ≡ 7; */ ; return; diff --git a/tests/constant_propagation/oracle/declaration.res.oracle b/tests/constant_propagation/oracle/declaration.res.oracle index 35448212377e7bf6f1b5b4c50d26ab8548b7b79d..d0b595bae07551a9a1f85d073168b942e4c9042e 100644 --- a/tests/constant_propagation/oracle/declaration.res.oracle +++ b/tests/constant_propagation/oracle/declaration.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/declaration.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/constant_propagation/oracle/declaration2.res.oracle b/tests/constant_propagation/oracle/declaration2.res.oracle index 40d274341c636f96aaf40b4a427eaf33a2c1e8dd..c58fd357e09f85dca4a362f6e39ddb421eb29ccf 100644 --- a/tests/constant_propagation/oracle/declaration2.res.oracle +++ b/tests/constant_propagation/oracle/declaration2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/declaration2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -26,8 +25,7 @@ void f(int *x) int main(void) { - int Y; - Y = 42; + int Y = 42; f(& Y); return Y; } diff --git a/tests/constant_propagation/oracle/enum.res.oracle b/tests/constant_propagation/oracle/enum.res.oracle index 3d20913660ca4d03e9d5f57587145c5b6c16020b..fa2a8dbe5528dc7769353c24a96fc0296ea30312 100644 --- a/tests/constant_propagation/oracle/enum.res.oracle +++ b/tests/constant_propagation/oracle/enum.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/enum.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -37,17 +36,12 @@ int f(enum E e) int main(int c, unsigned int u) { int __retres; - enum E x; - int y; - int z; - int t; - int v; - x = A; - y = f(0U); - z = f(D); + enum E x = A; + int y = f(0U); + int z = f(D); /*@ assert Value: signed_overflow: B + c ≤ 2147483647; */ - t = B + c; - v = (int)(2U + u); + int t = B + c; + int v = (int)(2U + u); /*@ assert Value: signed_overflow: (int)(y + z) + t ≤ 2147483647; */ /*@ assert Value: signed_overflow: -2147483648 ≤ (int)((int)(y + z) + t) + v; diff --git a/tests/constant_propagation/oracle/fct_ptr.res.oracle b/tests/constant_propagation/oracle/fct_ptr.res.oracle index a249b4c276eaec9d30e1b56d64713b9e5ac3aa49..765ca5c45f7e06e3773f574e961658c7d4204e77 100644 --- a/tests/constant_propagation/oracle/fct_ptr.res.oracle +++ b/tests/constant_propagation/oracle/fct_ptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/fct_ptr.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main diff --git a/tests/constant_propagation/oracle/introduction_of_non_explicit_cast.res.oracle b/tests/constant_propagation/oracle/introduction_of_non_explicit_cast.res.oracle index 0b53c5ab438cf2f0b043c3ae93ba0bf1644562cc..228313d191ec35bbb83b416c8ab7576474da1f52 100644 --- a/tests/constant_propagation/oracle/introduction_of_non_explicit_cast.res.oracle +++ b/tests/constant_propagation/oracle/introduction_of_non_explicit_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/introduction_of_non_explicit_cast.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -168,9 +167,7 @@ struct st s1; struct st s2; void test_struct(void) { - ST s; - s.a = 0; - s.b = 1; + ST s = {.a = 0, .b = 1}; s1 = s; s1.a = 1; s2.a = 1; @@ -182,20 +179,15 @@ void test_struct(void) void test_tab(int v) { - int *r; - char *q; - int decal; - { /* sequence */ - s2.b = 2; - TAB[1] = 0; - } - r = & TAB[4]; + s2.b = 2; + TAB[1] = 0; + int *r = & TAB[4]; TAB[4] = 13; TAB[5] = 13; - q = (char *)(& TAB[4]); + char *q = (char *)(& TAB[4]); *((char *)(& TAB[4])) = (char)13; *((char *)(& TAB[4]) + 1) = (char)13; - decal = 4; + int decal = 4; *((char *)(& TAB[5])) = (char)13; return; } @@ -203,13 +195,10 @@ void test_tab(int v) int *test_ptr(int v) { int *__retres; - int *p; - char *s; - int decal; - p = & x; - s = (char *)(& x); + int *p = & x; + char *s = (char *)(& x); *((char *)(& x)) = (char)7; - decal = 1; + int decal = 1; *((char *)(& x) + 1) = (char)7; s = (char *)(& x) + 1; *((char *)(& x) + 1) = (char)7; @@ -221,8 +210,7 @@ int *test_ptr(int v) int *test_struct_ptr(void) { int *__retres; - int *q; - q = & s1.b; + int *q = & s1.b; __retres = & s1.a; return __retres; } @@ -236,15 +224,12 @@ int add3(int v1, int v2, int v3) int init(int v) { - int zero; - int sept; - int z1; - zero = 0; - sept = 7; + int zero = 0; + int sept = 7; x = 5; y = 7; z = add3(5,7,0); - z1 = 12; + int z1 = 12; return zero; } @@ -257,22 +242,18 @@ void test_ull(void) void main(int a) { - int b; - int *p; - int *q; int *tmp_1; - int yy; test_ull(); test_struct(); test_struct_ptr(); test_tab(13); - b = init(5); + int b = init(5); z = add3(a,0,0); - p = test_ptr(7); + int *p = test_ptr(7); /*@ assert *p ≡ 7; */ ; if (a) tmp_1 = & x; else tmp_1 = & y; - q = tmp_1; - yy = 7; + int *q = tmp_1; + int yy = 7; /*@ assert a ≡ 0 ⇒ q ≡ &y; */ ; /*@ assert *q ≡ 7; */ ; return; diff --git a/tests/constant_propagation/oracle/struct_field.res.oracle b/tests/constant_propagation/oracle/struct_field.res.oracle index 3afde9de384a8c4e8585ca3efd100d06523cfba5..58c4fb43ec77e822088a151426a8b170c3180d4c 100644 --- a/tests/constant_propagation/oracle/struct_field.res.oracle +++ b/tests/constant_propagation/oracle/struct_field.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/constant_propagation/struct_field.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -48,20 +47,13 @@ struct __anonstruct_S_1 S; union v v; void main(void) { - int *p1; - int *p2; - int *p6; - int **pp; - int *p11; - int *p14; - char *p; - p1 = & S.f0; - p2 = & S.f1[0]; - p6 = & S.f1[4]; - pp = & p6; - p11 = & S.f2[0].u1; - p14 = & S.f2[1].u2.b; - p = & v.f2.c4; + int *p1 = & S.f0; + int *p2 = & S.f1[0]; + int *p6 = & S.f1[4]; + int **pp = & p6; + int *p11 = & S.f2[0].u1; + int *p14 = & S.f2[1].u2.b; + char *p = & v.f2.c4; return; } diff --git a/tests/constant_propagation/struct_field.i b/tests/constant_propagation/struct_field.i index d4fb2fc847b81915a15630899c3aa999579b1789..ceb93c8ca9272e1edd4e890260c8ef01b7a6a7c4 100644 --- a/tests/constant_propagation/struct_field.i +++ b/tests/constant_propagation/struct_field.i @@ -1,5 +1,5 @@ /* run.config - OPT: -val -semantic-const-folding -journal-disable + OPT: -val -semantic-const-folding -val-show-progress -journal-disable */ struct st { diff --git a/tests/dynamic/oracle/dynamic.0.res.oracle b/tests/dynamic/oracle/dynamic.0.res.oracle index c219ab41a4df005f08e083f102acb885e9414441..29118a648cabe78347baf3317b186857a118094f 100644 --- a/tests/dynamic/oracle/dynamic.0.res.oracle +++ b/tests/dynamic/oracle/dynamic.0.res.oracle @@ -1,4 +1,3 @@ [kernel] warning: cannot load 'tests/dynamic/none' (not a directory) [kernel] warning: cannot load 'tests/dynamic/file_path' (not a directory) -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/dynamic/dynamic.i (no preprocessing) diff --git a/tests/dynamic/oracle/dynamic.1.res.oracle b/tests/dynamic/oracle/dynamic.1.res.oracle index 4f318edac542bb5b5d3315b0d566059ff1a45d4e..753fe34a06e45c4214ee47c931e70316470e89a4 100644 --- a/tests/dynamic/oracle/dynamic.1.res.oracle +++ b/tests/dynamic/oracle/dynamic.1.res.oracle @@ -12,5 +12,4 @@ A.ho has type (int -> int) -> A.t -> A.u but is used with type (A.t -> int) -> A ppu 1.050000 ppu 1.000000 ppu 1.000000 -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/dynamic/dynamic.i (no preprocessing) diff --git a/tests/float/absorb.c b/tests/float/absorb.c index 81c4577ee789c1885caf4574880a88f9ac18cef8..79875d1c899015bd0150bd00560ef5edfdc5bb7c 100644 --- a/tests/float/absorb.c +++ b/tests/float/absorb.c @@ -1,10 +1,10 @@ /* run.config + COMMENT: run.config is intentionally not-* EXECNOW: BIN absorb.sav LOG absorb_sav.res LOG absorb_sav.err FRAMAC_PLUGIN=tests/.empty @frama-c@ -journal-disable -save @PTEST_DIR@/result/absorb.sav @PTEST_FILE@ > @PTEST_DIR@/result/absorb_sav.res 2> @PTEST_DIR@/result/absorb_sav.err EXECNOW: BIN absorb.sav2 LOG absorb_sav2.res LOG absorb_sav2.err @frama-c@ -load @PTEST_DIR@/result/absorb.sav -val @VALUECONFIG@ -journal-disable -float-hex -save @PTEST_DIR@/result/absorb.sav2 > @PTEST_DIR@/result/absorb_sav2.res 2> @PTEST_DIR@/result/absorb_sav2.err OPT: -load @PTEST_DIR@/result/absorb.sav2 -deps -out -input OPT: -all-rounding-modes -val @VALUECONFIG@ -deps -out -input -journal-disable -float-hex */ - #include "__fc_builtin.h" float x = 1.0, y = 0.0, z, t, min_f, min_fl, den; diff --git a/tests/float/builtins.c b/tests/float/builtins.c index 53ddaade069a8fc5b05e4f77e78a111a815fd6b9..8a9c2ec72f6931fdcf7797700c1c7cc337bd7262 100644 --- a/tests/float/builtins.c +++ b/tests/float/builtins.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -no-val-builtins-auto -val @VALUECONFIG@ -then -main main_log_exp -then -all-rounding-modes -then -val-builtins-auto + OPT: -no-val-builtins-auto -val @VALUECONFIG@ -then -main main_log_exp -then -all-rounding-modes -then -val-builtins-auto -value-msg-key=-builtins */ #include <__fc_builtin.h> diff --git a/tests/float/diff_equalities b/tests/float/diff_equalities index 0eae0f66ac1bb667df5a2212360eda2870dc807d..741a881febf9cabed1f2fe4b35c9d3ecc4228e86 100644 --- a/tests/float/diff_equalities +++ b/tests/float/diff_equalities @@ -8,3 +8,43 @@ Only in tests/float/oracle: absorb_sav.err Only in tests/float/oracle: absorb_sav.res Only in tests/float/oracle: absorb_sav2.err Only in tests/float/oracle: absorb_sav2.res +diff tests/float/oracle/nonlin.0.res.oracle tests/float/oracle_equalities/nonlin.0.res.oracle +191c191 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +250c250 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +diff tests/float/oracle/nonlin.1.res.oracle tests/float/oracle_equalities/nonlin.1.res.oracle +53a54 +> tests/float/nonlin.c:42:[value:nonlin] subdividing on a +211c212 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +270c271 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +diff tests/float/oracle/nonlin.2.res.oracle tests/float/oracle_equalities/nonlin.2.res.oracle +191c191 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +250c250 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +diff tests/float/oracle/nonlin.3.res.oracle tests/float/oracle_equalities/nonlin.3.res.oracle +53a54 +> tests/float/nonlin.c:42:[value:nonlin] subdividing on a +211c212 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} +270c271 +< (origin: Arithmetic {tests/float/nonlin.c:87}) }} +--- +> (origin: Arithmetic {tests/float/nonlin.c:88}) }} diff --git a/tests/float/diff_legacy b/tests/float/diff_legacy deleted file mode 100644 index 204b44f5d6799ea73283b18a080c8ba70e4822cd..0000000000000000000000000000000000000000 --- a/tests/float/diff_legacy +++ /dev/null @@ -1,197 +0,0 @@ -Only in tests/float/oracle: absorb.0.err.oracle -Only in tests/float/oracle: absorb.0.res.oracle -Only in tests/float/oracle: absorb.1.err.oracle -Only in tests/float/oracle: absorb.1.res.oracle -Only in tests/float/oracle_legacy: absorb.err.oracle -Only in tests/float/oracle_legacy: absorb.res.oracle -Only in tests/float/oracle: absorb_sav.err -Only in tests/float/oracle: absorb_sav.res -Only in tests/float/oracle: absorb_sav2.err -Only in tests/float/oracle: absorb_sav2.res -diff tests/float/oracle/builtins.res.oracle tests/float/oracle_legacy/builtins.res.oracle -130d129 -< tests/float/builtins.c:26:[value] warning: non-finite double value. assert \is_finite(d); -133a133 -> tests/float/builtins.c:26:[value] warning: non-finite double value. assert \is_finite(d); -137,138d136 -< tests/float/builtins.c:26:[value] Assigning imprecise value to tmp. -< The imprecision originates from Arithmetic -140,143d137 -< tests/float/builtins.c:26:[value] warning: non-finite double value. assert \is_finite(tmp); -< (tmp from Frama_C_log(d)) -< tests/float/builtins.c:26:[value] Assigning imprecise value to \result<log>. -< The imprecision originates from Arithmetic -146,147d139 -< tests/float/builtins.c:107:[value] Assigning imprecise value to l7. -< The imprecision originates from Arithmetic -271,272d262 -< tests/float/builtins.c:26:[value] warning: non-finite double value. assert \is_finite(tmp); -< (tmp from Frama_C_log(d)) -332,333d321 -< tests/float/builtins.c:107:[value] Assigning imprecise value to l7. -< The imprecision originates from Arithmetic {tests/float/builtins.c:107} -diff tests/float/oracle/cond_cast_int_to_float.res.oracle tests/float/oracle_legacy/cond_cast_int_to_float.res.oracle -13c13 -< tests/float/cond_cast_int_to_float.c:3:[value] function assert: precondition got status valid. ---- -> tests/float/cond_cast_int_to_float.c:3:[value] warning: function assert: precondition got status unknown. -15c15 -< [value] Called Frama_C_show_each_then({18}, [31..10000]) ---- -> [value] Called Frama_C_show_each_then({18}, [-10000..10000]) -19c19 -< [value] Called Frama_C_show_each_else({18}, [-10000..30]) ---- -> [value] Called Frama_C_show_each_else({18}, [-10000..10000]) -23c23 -< [value] Called Frama_C_show_each_then({19}, [31..10000]) ---- -> [value] Called Frama_C_show_each_then({19}, [-10000..10000]) -27c27 -< [value] Called Frama_C_show_each_else({19}, [-10000..30]) ---- -> [value] Called Frama_C_show_each_else({19}, [-10000..10000]) -31c31 -< [value] Called Frama_C_show_each_then({20}, [30..10000]) ---- -> [value] Called Frama_C_show_each_then({20}, [-10000..10000]) -35c35 -< [value] Called Frama_C_show_each_else({20}, [-10000..29]) ---- -> [value] Called Frama_C_show_each_else({20}, [-10000..10000]) -39c39 -< [value] Called Frama_C_show_each_then({22}, [-30..10000]) ---- -> [value] Called Frama_C_show_each_then({22}, [-10000..10000]) -43c43 -< [value] Called Frama_C_show_each_else({22}, [-10000..-31]) ---- -> [value] Called Frama_C_show_each_else({22}, [-10000..10000]) -47c47 -< [value] Called Frama_C_show_each_then({23}, [-30..10000]) ---- -> [value] Called Frama_C_show_each_then({23}, [-10000..10000]) -51c51 -< [value] Called Frama_C_show_each_else({23}, [-10000..-31]) ---- -> [value] Called Frama_C_show_each_else({23}, [-10000..10000]) -55c55 -< [value] Called Frama_C_show_each_then({24}, [-29..10000]) ---- -> [value] Called Frama_C_show_each_then({24}, [-10000..10000]) -59c59 -< [value] Called Frama_C_show_each_else({24}, [-10000..-30]) ---- -> [value] Called Frama_C_show_each_else({24}, [-10000..10000]) -diff tests/float/oracle/const.res.oracle tests/float/oracle_legacy/const.res.oracle -198a199,200 -> if2 ∈ {0; 1} -> if3 ∈ {0; 1} -200,201c202,203 -< ite2 ∈ {2} -< ite3 ∈ {2} ---- -> ite2 ∈ {1; 2} -> ite3 ∈ {1; 2} -280a283,284 -> if2 FROM \nothing (and SELF) -> if3 FROM \nothing (and SELF) -294,295c298,299 -< s6; s7; s8; if1; ite1; ite2; ite3; ca1; ca2; ca3; ca4; tmp; tmp_0; -< tmp_1; tmp_2; tmp_3; tmp_4; tmp_5; tmp_6; tmp_7 ---- -> s6; s7; s8; if1; if2; if3; ite1; ite2; ite3; ca1; ca2; ca3; ca4; tmp; -> tmp_0; tmp_1; tmp_2; tmp_3; tmp_4; tmp_5; tmp_6; tmp_7 -diff tests/float/oracle/const1.res.oracle tests/float/oracle_legacy/const1.res.oracle -12a13,15 -> [from] Computing for function main -> [from] Non-terminating function main (no dependencies) -> [from] Done for function main -14a18,19 -> [from] Function main: -> NON TERMINATING - NO EFFECTS -15a21,24 -> [inout] Out (internal) for function main: -> \nothing -> [inout] Inputs for function main: -> \nothing -diff tests/float/oracle/const2.res.oracle tests/float/oracle_legacy/const2.res.oracle -12a13,15 -> [from] Computing for function main -> [from] Non-terminating function main (no dependencies) -> [from] Done for function main -14a18,19 -> [from] Function main: -> NON TERMINATING - NO EFFECTS -15a21,24 -> [inout] Out (internal) for function main: -> \nothing -> [inout] Inputs for function main: -> \nothing -diff tests/float/oracle/const4.0.res.oracle tests/float/oracle_legacy/const4.0.res.oracle -13a14,16 -> [from] Computing for function main -> [from] Non-terminating function main (no dependencies) -> [from] Done for function main -15a19,20 -> [from] Function main: -> NON TERMINATING - NO EFFECTS -16a22,25 -> [inout] Out (internal) for function main: -> \nothing -> [inout] Inputs for function main: -> \nothing -diff tests/float/oracle/nonlin.1.res.oracle tests/float/oracle_legacy/nonlin.1.res.oracle -127c127 -< tests/float/nonlin.c:61:[value:nonlin] non-linear 'i * i', lv 'i' ---- -> tests/float/nonlin.c:61:[value:nonlin] non-linear '1 + t[(int)(i * i + 2.0)]', lv 'i' -130c130 -< tests/float/nonlin.c:62:[value:nonlin] non-linear 's - s', lv 's' ---- -> tests/float/nonlin.c:62:[value:nonlin] non-linear '(int)(10000.0 * (s - s))', lv 's' -151c151 -< tests/float/nonlin.c:75:[value:nonlin] non-linear '(double)ff * (double)ff', lv 'ff' ---- -> tests/float/nonlin.c:75:[value:nonlin] non-linear '(double)1 / ((double)ff * (double)ff + 0.000000001)', lv 'ff' -158,159c158,159 -< tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1', lv 'v1' -< tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv 'v2' ---- -> tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1 + (double)v2 * (double)v2', lv 'v2' -> tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1 + (double)v2 * (double)v2', lv 'v1' -180c180 -< square ∈ [-0x0.0000000000000p-1022 .. 0x1.fffffc0000020p256] ---- -> square ∈ [-0x1.fffffc0000020p255 .. 0x1.fffffc0000020p256] -234c234 -< square ∈ [-0. .. 2.31584150868e+77] ---- -> square ∈ [-1.15792075434e+77 .. 2.31584150868e+77] -diff tests/float/oracle/nonlin.3.res.oracle tests/float/oracle_legacy/nonlin.3.res.oracle -127c127 -< tests/float/nonlin.c:61:[value:nonlin] non-linear 'i * i', lv 'i' ---- -> tests/float/nonlin.c:61:[value:nonlin] non-linear '1 + t[(int)((double)(i * i) + 2.0)]', lv 'i' -130c130 -< tests/float/nonlin.c:62:[value:nonlin] non-linear 's - s', lv 's' ---- -> tests/float/nonlin.c:62:[value:nonlin] non-linear '(int)(10000.0 * (double)(s - s))', lv 's' -151c151 -< tests/float/nonlin.c:75:[value:nonlin] non-linear '(double)ff * (double)ff', lv 'ff' ---- -> tests/float/nonlin.c:75:[value:nonlin] non-linear '(double)1 / ((double)ff * (double)ff + 0.000000001)', lv 'ff' -158,159c158,159 -< tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1', lv 'v1' -< tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv 'v2' ---- -> tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1 + (double)v2 * (double)v2', lv 'v2' -> tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1 + (double)v2 * (double)v2', lv 'v1' -180c180 -< square ∈ [-0x0.0000000000000p-1022 .. 0x1.fffffc0000020p256] ---- -> square ∈ [-0x1.fffffc0000020p255 .. 0x1.fffffc0000020p256] -234c234 -< square ∈ [-0. .. 2.31584150868e+77] ---- -> square ∈ [-1.15792075434e+77 .. 2.31584150868e+77] diff --git a/tests/float/dr.i b/tests/float/dr.i index 02d1f91b000fa16c98ba56890c6d3c87806360a6..487d37bc185a07a6dc0d811fe119aeba8d1b1bfa 100644 --- a/tests/float/dr.i +++ b/tests/float/dr.i @@ -1,6 +1,7 @@ /* run.config* STDOPT: STDOPT: #"-float-hex" + STDOPT: #"-all-rounding-modes-constants" */ float big = 100e30f; diff --git a/tests/float/nonlin.c b/tests/float/nonlin.c index 81b912d0e2eef51e05f811e779dcdb98a262c8c9..076158e649e1f53dafc95e2202eae330ec05e00f 100644 --- a/tests/float/nonlin.c +++ b/tests/float/nonlin.c @@ -81,9 +81,17 @@ void norm() { double square = (double)v1*v1+(double)v2*v2; } +// a bug resulted in an invalid interval due to the presence of garbled mix +void garbled() { + int x; + float a = (float)((int)(&x + (int)&x)); + float f = a + a; +} + void main() { nonlin_f(); other (); split_alarm(); norm(); + garbled(); } diff --git a/tests/float/oracle/absorb.1.res.oracle b/tests/float/oracle/absorb.1.res.oracle index 8a0d180c0dd897fcc7e6fa11a6c23fc995946f21..f932758a79eb34774bd1ad4d5bbcc944d803a0a1 100644 --- a/tests/float/oracle/absorb.1.res.oracle +++ b/tests/float/oracle/absorb.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/absorb.c (with preprocessing) tests/float/absorb.c:15:[kernel] warning: Floating-point constant 1e-286 is not represented exactly. Will use 0x1.e74404f3daadbp-951. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main diff --git a/tests/float/oracle/absorb_sav.res b/tests/float/oracle/absorb_sav.res index 4b6eb4b78a458660db22eaa8b0f02a7888bf39d7..f700aa45ca2084e0148e8ce1a59ddcd99cc34413 100644 --- a/tests/float/oracle/absorb_sav.res +++ b/tests/float/oracle/absorb_sav.res @@ -1,3 +1,2 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/absorb.c (with preprocessing) tests/float/absorb.c:15:[kernel] warning: Floating-point constant 1e-286 is not represented exactly. Will use 0x1.e74404f3daadbp-951. See documentation for option -warn-decimal-float diff --git a/tests/float/oracle/alarms.res.oracle b/tests/float/oracle/alarms.res.oracle index 9f8531eaba7ef4e09c047e0fa786b325f034909e..7242dc383930dd59438d9d421e1d4f3bb4defd6c 100644 --- a/tests/float/oracle/alarms.res.oracle +++ b/tests/float/oracle/alarms.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/alarms.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -12,7 +11,8 @@ ull ∈ {0} tests/float/alarms.i:9:[value] warning: non-finite float value. assert \is_finite(u1.f); tests/float/alarms.i:11:[value] warning: non-finite double value. assert \is_finite(u2.d); -[value] DUMPING STATE of file tests/float/alarms.i line 12 +tests/float/alarms.i:12:[value] Frama_C_dump_each: + # Cvalue domain: u1{.l[bits 0 to 31]; .f; .d[bits 0 to 31]} ∈ [-3.40282346639e+38 .. 3.40282346639e+38] {.l[bits 32 to 63]; .f[bits 32 to 63]; .d[bits 32 to 63]} ∈ [--..--] @@ -22,14 +22,9 @@ tests/float/alarms.i:11:[value] warning: non-finite double value. assert \is_fin big ∈ {0} ull ∈ {0} l ∈ [--..--] - vf ∈ UNINITIALIZED tmp ∈ UNINITIALIZED - vd ∈ UNINITIALIZED - i ∈ UNINITIALIZED - j ∈ UNINITIALIZED - mvd ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] computing for function fd <- main. Called from tests/float/alarms.i:14. tests/float/alarms.i:14:[kernel] warning: Neither code nor specification for function fd, generating default assigns from the prototype diff --git a/tests/float/oracle/builtins.res.oracle b/tests/float/oracle/builtins.res.oracle index e2723282c783bea66e5157c3cc02533cb401da3b..ce8cf3184c2a6ea03142d9d6c576c3e0b61880cf 100644 --- a/tests/float/oracle/builtins.res.oracle +++ b/tests/float/oracle/builtins.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/builtins.c (with preprocessing) tests/float/builtins.c:55:[kernel] warning: Floating-point constant 2.72 is not represented exactly. Will use 0x1.5c28f5c28f5c3p1. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -10,14 +9,14 @@ tests/float/builtins.c:55:[kernel] warning: Floating-point constant 2.72 is not [value] computing for function Frama_C_float_interval <- main. Called from tests/float/builtins.c:11. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval [value] computing for function Frama_C_double_interval <- main. Called from tests/float/builtins.c:12. [value] using specification for function Frama_C_double_interval -share/libc/__fc_builtin.h:151:[value] function Frama_C_double_interval: precondition got status valid. -share/libc/__fc_builtin.h:152:[value] function Frama_C_double_interval: precondition got status valid. +share/libc/__fc_builtin.h:157:[value] function Frama_C_double_interval: precondition got status valid. +share/libc/__fc_builtin.h:158:[value] function Frama_C_double_interval: precondition got status valid. [value] Done for function Frama_C_double_interval [value] Recording results for main [value] done for function main diff --git a/tests/float/oracle/cond.res.oracle b/tests/float/oracle/cond.res.oracle index b722089d2fb8315f46b718f6b8c296ada1cf90a6..410a53d1a4f676a7504bda9225d6d225cfcbb801 100644 --- a/tests/float/oracle/cond.res.oracle +++ b/tests/float/oracle/cond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/cond.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -17,8 +16,8 @@ [value] computing for function Frama_C_float_interval <- main. Called from tests/float/cond.c:12. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval [value] computing for function Frama_C_float_interval <- main. Called from tests/float/cond.c:15. diff --git a/tests/float/oracle/cond_cast_int_to_float.res.oracle b/tests/float/oracle/cond_cast_int_to_float.res.oracle index c6662b84bea1af4aadfd53a66f64368d7cdb2695..ebcfafaf2deb4a5f014623b1c2ba303b490814bc 100644 --- a/tests/float/oracle/cond_cast_int_to_float.res.oracle +++ b/tests/float/oracle/cond_cast_int_to_float.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/cond_cast_int_to_float.c (with preprocessing) tests/float/cond_cast_int_to_float.c:18:[kernel] warning: Floating-point constant 30.1f is not represented exactly. Will use 0x1.e1999a0000000p4. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -12,51 +11,51 @@ tests/float/cond_cast_int_to_float.c:15:[value] warning: function main: precondi [value] using specification for function assert tests/float/cond_cast_int_to_float.c:3:[value] function assert: precondition got status valid. [value] Done for function assert -[value] Called Frama_C_show_each_then({18}, [31..10000]) +tests/float/cond_cast_int_to_float.c:18:[value] Frama_C_show_each_then: {18}, [31..10000] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:18. [value] Done for function assert -[value] Called Frama_C_show_each_else({18}, [-10000..30]) +tests/float/cond_cast_int_to_float.c:18:[value] Frama_C_show_each_else: {18}, [-10000..30] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:19. [value] Done for function assert -[value] Called Frama_C_show_each_then({19}, [31..10000]) +tests/float/cond_cast_int_to_float.c:19:[value] Frama_C_show_each_then: {19}, [31..10000] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:19. [value] Done for function assert -[value] Called Frama_C_show_each_else({19}, [-10000..30]) +tests/float/cond_cast_int_to_float.c:19:[value] Frama_C_show_each_else: {19}, [-10000..30] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:20. [value] Done for function assert -[value] Called Frama_C_show_each_then({20}, [30..10000]) +tests/float/cond_cast_int_to_float.c:20:[value] Frama_C_show_each_then: {20}, [30..10000] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:20. [value] Done for function assert -[value] Called Frama_C_show_each_else({20}, [-10000..29]) +tests/float/cond_cast_int_to_float.c:20:[value] Frama_C_show_each_else: {20}, [-10000..29] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:22. [value] Done for function assert -[value] Called Frama_C_show_each_then({22}, [-30..10000]) +tests/float/cond_cast_int_to_float.c:22:[value] Frama_C_show_each_then: {22}, [-30..10000] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:22. [value] Done for function assert -[value] Called Frama_C_show_each_else({22}, [-10000..-31]) +tests/float/cond_cast_int_to_float.c:22:[value] Frama_C_show_each_else: {22}, [-10000..-31] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:23. [value] Done for function assert -[value] Called Frama_C_show_each_then({23}, [-30..10000]) +tests/float/cond_cast_int_to_float.c:23:[value] Frama_C_show_each_then: {23}, [-30..10000] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:23. [value] Done for function assert -[value] Called Frama_C_show_each_else({23}, [-10000..-31]) +tests/float/cond_cast_int_to_float.c:23:[value] Frama_C_show_each_else: {23}, [-10000..-31] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:24. [value] Done for function assert -[value] Called Frama_C_show_each_then({24}, [-29..10000]) +tests/float/cond_cast_int_to_float.c:24:[value] Frama_C_show_each_then: {24}, [-29..10000] [value] computing for function assert <- main. Called from tests/float/cond_cast_int_to_float.c:24. [value] Done for function assert -[value] Called Frama_C_show_each_else({24}, [-10000..-30]) +tests/float/cond_cast_int_to_float.c:24:[value] Frama_C_show_each_else: {24}, [-10000..-30] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/const.res.oracle b/tests/float/oracle/const.res.oracle index eda7617317c442ccf686fb9a34a6642ddd263bd0..a413aa6d3c5f6a0b22c12a3e24237744ad99fa31 100644 --- a/tests/float/oracle/const.res.oracle +++ b/tests/float/oracle/const.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const.i (no preprocessing) tests/float/const.i:21:[kernel] warning: Floating-point constant 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024703282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772285886546332835517796989819938739800539093906315035659515570226392290858392449105184435931802849936536152500319370457678249219365623669863658480757001585769269903706311928279558551332927834338409351978015531246597263579574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324673600968951340535537458516661134223766678604162159680461914467291840300530057530849048765391711386591646239524912623653881879636239373280423891018672348497668235089863388587925628302755995657524455507255189313690836254779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328125 is not represented exactly. Will use 0x0.0000000000000p-1022 tests/float/const.i:22:[kernel] warning: Floating-point constant 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470328229206232720882843964341106861825299013071623822127928412503377536351043759326499181808179961898982823477228588654633283551779698981993873980053909390631503565951557022639229085839244910518443593180284993653615250031937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357957462276646527282722005637400648549997709659947045402082816622623785739345073633900796776193057750674017632467360096895134053553745851666113422376667860416215968046191446729184030053005753084904876539171138659164623952491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625477918694866799496832404970582102851318545139621383772282614543769341253209859132766723632812501 is not represented exactly. Will use 0x0.0000000000001p-1022 diff --git a/tests/float/oracle/const1.res.oracle b/tests/float/oracle/const1.res.oracle index 6480f6213a3617436cd276eff6c3ad2d2841f47d..565c6f215c94711342ed229af3d1c99d09ee24d3 100644 --- a/tests/float/oracle/const1.res.oracle +++ b/tests/float/oracle/const1.res.oracle @@ -1,10 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const1.i (no preprocessing) tests/float/const1.i:1:[kernel] warning: Floating-point constant 1e40f is not represented exactly. Will use inf. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main [value] Computing initial state tests/float/const1.i:1:[value] warning: non-finite float value. assert \is_finite(1e40f); -tests/float/const1.i:1:[value] Evaluation of initializer '(unsigned long long)1e40f' failed +tests/float/const1.i:1:[value] evaluation of initializer '(unsigned long long)1e40f' failed [value] Initial state computed [value:initial-state] Values of globals at initialization NOT ACCESSIBLE diff --git a/tests/float/oracle/const2.res.oracle b/tests/float/oracle/const2.res.oracle index f8ff6e83c3310bb3cef79c26442c4d7b2044ccad..9fb7ab91d44e3b09076dbea7a4792d775dd7cf58 100644 --- a/tests/float/oracle/const2.res.oracle +++ b/tests/float/oracle/const2.res.oracle @@ -1,10 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const2.i (no preprocessing) tests/float/const2.i:1:[kernel] warning: Floating-point constant 1e-40f is not represented exactly. Will use 0x1.16c2000000000p-133. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main [value] Computing initial state tests/float/const2.i:2:[value] warning: non-finite float value. assert \is_finite(1e40f); -tests/float/const2.i:2:[value] Evaluation of initializer '1e40f' failed +tests/float/const2.i:2:[value] evaluation of initializer '1e40f' failed [value] Initial state computed [value:initial-state] Values of globals at initialization NOT ACCESSIBLE diff --git a/tests/float/oracle/const3.0.res.oracle b/tests/float/oracle/const3.0.res.oracle index a6fb67c12d4683afd7394d0c901f92f1d8f97ec7..ca129880ab266e5af73c65447bf0d5cb1b3fc95f 100644 --- a/tests/float/oracle/const3.0.res.oracle +++ b/tests/float/oracle/const3.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const3.i (no preprocessing) tests/float/const3.i:6:[kernel] warning: Floating-point constant 1e-40f is not represented exactly. Will use 0x1.16c2000000000p-133 tests/float/const3.i:7:[kernel] warning: Floating-point constant 1e-40 is not represented exactly. Will use 0x1.16c262777579cp-133 @@ -8,12 +7,12 @@ tests/float/const3.i:7:[kernel] warning: Floating-point constant 1e-40 is not re [value:initial-state] Values of globals at initialization f1 ∈ {9.99994610111e-41} d0 ∈ {1e-40} -[value] DUMPING STATE of file tests/float/const3.i line 11 +tests/float/const3.i:11:[value] Frama_C_dump_each: + # Cvalue domain: f1 ∈ {9.99994610111e-41} d0 ∈ {1e-40} - d1 ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/const3.1.res.oracle b/tests/float/oracle/const3.1.res.oracle index e1c2cbfcba4880c5668f95fbce719b98710c50e2..7e8c3471f4877519167a087f4cd9118f4979ed1a 100644 --- a/tests/float/oracle/const3.1.res.oracle +++ b/tests/float/oracle/const3.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const3.i (no preprocessing) tests/float/const3.i:6:[kernel] warning: Floating-point constant 1e-40f is not represented exactly. Will use 0x1.16c2000000000p-133 tests/float/const3.i:7:[kernel] warning: Floating-point constant 1e-40 is not represented exactly. Will use 0x1.16c262777579cp-133 @@ -8,12 +7,12 @@ tests/float/const3.i:7:[kernel] warning: Floating-point constant 1e-40 is not re [value:initial-state] Values of globals at initialization f1 ∈ [0x1.16c2000000000p-133 .. 0x1.16c3000000000p-133] d0 ∈ [0x1.16c262777579cp-133 .. 0x1.16c262777579dp-133] -[value] DUMPING STATE of file tests/float/const3.i line 11 +tests/float/const3.i:11:[value] Frama_C_dump_each: + # Cvalue domain: f1 ∈ [0x1.16c2000000000p-133 .. 0x1.16c3000000000p-133] d0 ∈ [0x1.16c262777579cp-133 .. 0x1.16c262777579dp-133] - d1 ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/const4.0.res.oracle b/tests/float/oracle/const4.0.res.oracle index 58157234db8389d76a1e46708212a2564c58e2e7..8d9fbf6ffed43c73069d2e20add6e747f6fb6f01 100644 --- a/tests/float/oracle/const4.0.res.oracle +++ b/tests/float/oracle/const4.0.res.oracle @@ -1,11 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const4.i (no preprocessing) tests/float/const4.i:6:[kernel] warning: Floating-point constant 3.4e38f is not represented exactly. Will use 0x1.ff933c0000000p127 tests/float/const4.i:7:[kernel] warning: Floating-point constant 3.405e38f is not represented exactly. Will use inf [value] Analyzing a complete application starting at main [value] Computing initial state tests/float/const4.i:7:[value] warning: non-finite float value. assert \is_finite(3.405e38f); -tests/float/const4.i:7:[value] Evaluation of initializer '(double)3.405e38f' failed +tests/float/const4.i:7:[value] evaluation of initializer '(double)3.405e38f' failed [value] Initial state computed [value:initial-state] Values of globals at initialization NOT ACCESSIBLE diff --git a/tests/float/oracle/const4.1.res.oracle b/tests/float/oracle/const4.1.res.oracle index c6a7cb5ee7cf326f97d009ea0446157ed3fa3f5f..0dfd1137b2eba76186eecd1afe70ef432df832be 100644 --- a/tests/float/oracle/const4.1.res.oracle +++ b/tests/float/oracle/const4.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/const4.i (no preprocessing) tests/float/const4.i:6:[kernel] warning: Floating-point constant 3.4e38f is not represented exactly. Will use 0x1.ff933c0000000p127 tests/float/const4.i:7:[kernel] warning: Floating-point constant 3.405e38f is not represented exactly. Will use inf @@ -9,12 +8,12 @@ tests/float/const4.i:7:[value] warning: non-finite float value. assert \is_finit [value:initial-state] Values of globals at initialization f1 ∈ [3.39999995214e+38 .. 3.40000015497e+38] f2 ∈ {3.40282346639e+38} -[value] DUMPING STATE of file tests/float/const4.i line 11 +tests/float/const4.i:11:[value] Frama_C_dump_each: + # Cvalue domain: f1 ∈ [3.39999995214e+38 .. 3.40000015497e+38] f2 ∈ {3.40282346639e+38} - d2 ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/conv.res.oracle b/tests/float/oracle/conv.res.oracle index 28b908f801466787461847a4d5228aea30dc3018..81148994a015613c8fda6e0360421985a9501ef7 100644 --- a/tests/float/oracle/conv.res.oracle +++ b/tests/float/oracle/conv.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/conv.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,51 +8,42 @@ v ∈ [--..--] [value] computing for function main1 <- main. Called from tests/float/conv.i:105. -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({1.40129846432e-45}) -[value] Called Frama_C_show_each([1.40129846432e-43 .. 2.40330263757e+12]) +tests/float/conv.i:15:[value] Frama_C_show_each: {0} +tests/float/conv.i:18:[value] Frama_C_show_each: {1.40129846432e-45} +tests/float/conv.i:22:[value] Frama_C_show_each: [1.40129846432e-43 .. 2.40330263757e+12] tests/float/conv.i:24:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({3.40282346639e+38}) +tests/float/conv.i:28:[value] Frama_C_show_each: {3.40282346639e+38} tests/float/conv.i:29:[value] assertion got status valid. tests/float/conv.i:32:[value] warning: non-finite float value. assert \is_finite(*((float *)(&i))); -[value] Called Frama_C_show_each([-3.40282346639e+38 .. 3.40282346639e+38]) -[value] Called Frama_C_show_each({-3.40282346639e+38}) +tests/float/conv.i:33:[value] Frama_C_show_each: [-3.40282346639e+38 .. 3.40282346639e+38] +tests/float/conv.i:37:[value] Frama_C_show_each: {-3.40282346639e+38} tests/float/conv.i:38:[value] assertion got status valid. tests/float/conv.i:41:[value] warning: non-finite float value. assert \is_finite(*((float *)(&i))); -[value] Called Frama_C_show_each([-3.40282346639e+38 .. 3.40282346639e+38]) -[value] Called Frama_C_show_each([0. .. 1.40129846432e-45]) +tests/float/conv.i:42:[value] Frama_C_show_each: [-3.40282346639e+38 .. 3.40282346639e+38] +tests/float/conv.i:45:[value] Frama_C_show_each: [0. .. 1.40129846432e-45] tests/float/conv.i:48:[value] warning: assertion got status unknown. -tests/float/conv.i:49:[value] warning: non-finite float value. assert \is_finite(*((float *)(&i))); -[value] Called Frama_C_show_each([-3.40282346639e+38 .. 3.40282346639e+38]) -tests/float/conv.i:52:[value] warning: non-finite float value. assert \is_finite(*((float *)(&i))); -[value] Called Frama_C_show_each([-3.40282346639e+38 .. 3.40282346639e+38]) -tests/float/conv.i:55:[value] warning: non-finite float value. assert \is_finite(*((float *)(&ui))); -[value] Called Frama_C_show_each([-3.40282346639e+38 .. 3.40282346639e+38]) +tests/float/conv.i:49:[value] Frama_C_show_each: [-3.40282346639e+38 .. 3.40282346639e+38] +tests/float/conv.i:52:[value] Frama_C_show_each: [-3.40282346639e+38 .. 3.40282346639e+38] +tests/float/conv.i:55:[value] Frama_C_show_each: [-3.40282346639e+38 .. 3.40282346639e+38] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/float/conv.i:106. -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({4.94065645841e-324}) -[value] Called Frama_C_show_each([4.94065645841e-322 .. 9.22442153475e+159]) -[value] Called Frama_C_show_each({1.79769313486e+308}) +tests/float/conv.i:63:[value] Frama_C_show_each: {0} +tests/float/conv.i:66:[value] Frama_C_show_each: {4.94065645841e-324} +tests/float/conv.i:69:[value] Frama_C_show_each: [4.94065645841e-322 .. 9.22442153475e+159] +tests/float/conv.i:73:[value] Frama_C_show_each: {1.79769313486e+308} tests/float/conv.i:74:[value] assertion got status valid. -tests/float/conv.i:77:[value] warning: non-finite double value. assert \is_finite(*((double *)(&i))); -[value] Called Frama_C_show_each([-1.79769313486e+308 .. 1.79769313486e+308]) -tests/float/conv.i:80:[value] warning: non-finite double value. assert \is_finite(*((double *)(&i))); -[value] Called Frama_C_show_each([-1.79769313486e+308 .. 1.79769313486e+308]) -[value] Called Frama_C_show_each({-1.79769313486e+308}) +tests/float/conv.i:77:[value] Frama_C_show_each: [-1.79769313486e+308 .. 1.79769313486e+308] +tests/float/conv.i:80:[value] Frama_C_show_each: [-1.79769313486e+308 .. 1.79769313486e+308] +tests/float/conv.i:84:[value] Frama_C_show_each: {-1.79769313486e+308} tests/float/conv.i:85:[value] assertion got status valid. -tests/float/conv.i:88:[value] warning: non-finite double value. assert \is_finite(*((double *)(&i))); -[value] Called Frama_C_show_each([-1.79769313486e+308 .. 1.79769313486e+308]) -[value] Called Frama_C_show_each([0. .. 4.94065645841e-324]) +tests/float/conv.i:88:[value] Frama_C_show_each: [-1.79769313486e+308 .. 1.79769313486e+308] +tests/float/conv.i:91:[value] Frama_C_show_each: [0. .. 4.94065645841e-324] tests/float/conv.i:94:[value] warning: assertion got status unknown. -tests/float/conv.i:95:[value] warning: non-finite double value. assert \is_finite(*((double *)(&i))); -[value] Called Frama_C_show_each([-1.79769313486e+308 .. 1.79769313486e+308]) -tests/float/conv.i:98:[value] warning: non-finite double value. assert \is_finite(*((double *)(&i))); -[value] Called Frama_C_show_each([-1.79769313486e+308 .. 1.79769313486e+308]) -tests/float/conv.i:101:[value] warning: non-finite double value. assert \is_finite(*((double *)(&ui))); -[value] Called Frama_C_show_each([-1.79769313486e+308 .. 1.79769313486e+308]) +tests/float/conv.i:95:[value] Frama_C_show_each: [-1.79769313486e+308 .. 1.79769313486e+308] +tests/float/conv.i:98:[value] Frama_C_show_each: [-1.79769313486e+308 .. 1.79769313486e+308] +tests/float/conv.i:101:[value] Frama_C_show_each: [-1.79769313486e+308 .. 1.79769313486e+308] [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main diff --git a/tests/float/oracle/cte_overflow.res.oracle b/tests/float/oracle/cte_overflow.res.oracle index 8ee7263887eadcbaa81094585255ef10a3f2426c..3fe48bbdafe8eb977aecfb6d8fe2eae5c7a8d7e9 100644 --- a/tests/float/oracle/cte_overflow.res.oracle +++ b/tests/float/oracle/cte_overflow.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/cte_overflow.i (no preprocessing) tests/float/cte_overflow.i:12:[kernel] warning: Floating-point constant 1e500 is not represented exactly. Will use inf tests/float/cte_overflow.i:12:[kernel] warning: Floating-point constant 1e500 is not represented exactly. Will use inf diff --git a/tests/float/oracle/dr.0.res.oracle b/tests/float/oracle/dr.0.res.oracle index 3fc5b79606f2f77c8da3f87b97beff09a6c015ee..12b7c08cdf6e8ce992fb2be9eac018d8f6a99f57 100644 --- a/tests/float/oracle/dr.0.res.oracle +++ b/tests/float/oracle/dr.0.res.oracle @@ -1,6 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/dr.i (no preprocessing) -tests/float/dr.i:6:[kernel] warning: Floating-point constant 100e30f is not represented exactly. Will use 0x1.3b8b5c0000000p106. See documentation for option -warn-decimal-float +tests/float/dr.i:7:[kernel] warning: Floating-point constant 100e30f is not represented exactly. Will use 0x1.3b8b5c0000000p106. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -21,7 +20,7 @@ tests/float/dr.i:6:[kernel] warning: Floating-point constant 100e30f is not repr d2 ∈ {1.01161128283} e1 ∈ {0} e2 ∈ {0} -[value] Called Frama_C_show_each({1}, {0}) +tests/float/dr.i:26:[value] Frama_C_show_each: {1}, {0} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/dr.1.res.oracle b/tests/float/oracle/dr.1.res.oracle index 1a221d9130d08dcbdfde481ceb7f0929442f2109..bb5d6031648ecaa7dedee31f7b5a43de120487c5 100644 --- a/tests/float/oracle/dr.1.res.oracle +++ b/tests/float/oracle/dr.1.res.oracle @@ -1,6 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/dr.i (no preprocessing) -tests/float/dr.i:6:[kernel] warning: Floating-point constant 100e30f is not represented exactly. Will use 0x1.3b8b5c0000000p106. See documentation for option -warn-decimal-float +tests/float/dr.i:7:[kernel] warning: Floating-point constant 100e30f is not represented exactly. Will use 0x1.3b8b5c0000000p106. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -21,7 +20,7 @@ tests/float/dr.i:6:[kernel] warning: Floating-point constant 100e30f is not repr d2 ∈ {0x1.02f8f50000000p0} e1 ∈ {0} e2 ∈ {0} -[value] Called Frama_C_show_each({1}, {0}) +tests/float/dr.i:26:[value] Frama_C_show_each: {1}, {0} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_hard.err.oracle b/tests/float/oracle/dr.2.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_hard.err.oracle rename to tests/float/oracle/dr.2.err.oracle diff --git a/tests/float/oracle/dr.2.res.oracle b/tests/float/oracle/dr.2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..ed6929d1686ca46a9e4f4ba7963dcce5598ddc47 --- /dev/null +++ b/tests/float/oracle/dr.2.res.oracle @@ -0,0 +1,43 @@ +[kernel] Parsing tests/float/dr.i (no preprocessing) +tests/float/dr.i:7:[kernel] warning: Floating-point constant 100e30f is not represented exactly. Will use 0x1.3b8b5c0000000p106. See documentation for option -warn-decimal-float +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + big ∈ [9.99999936467e+31 .. 1.00000003318e+32] + big2 ∈ [1.00125992731e+32 .. 1.00126002403e+32] + ne1 ∈ [-0.10000000149 .. -0.0999999940395] + ne2 ∈ {-0.5} + nodigits ∈ {10.} + smaller ∈ [0. .. 1.40129846432e-45] + he ∈ {3.} + g1 ∈ {0.10000000149} + f1 ∈ [0.0999999940395 .. 0.10000000149] + f9 ∈ [0.999999940395 .. 1.] + ep ∈ [12499999744. .. 12500000768.] + g2 ∈ [1.01161122322 .. 1.01161134243] + f2 ∈ [1.01161122322 .. 1.01161134243] + d2 ∈ [1.01161128283 .. 1.01161128283] + e1 ∈ {0} + e2 ∈ {0} +tests/float/dr.i:26:[value] Frama_C_show_each: {0; 1}, {0; 1} +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + e1 ∈ {0; 1} + e2 ∈ {0; 1} + __retres ∈ {0} +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function main: + e1 FROM g1; f1 + e2 FROM g2; f2 + \result FROM \nothing +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main: + e1; e2; __retres +[inout] Inputs for function main: + g1; f1; g2; f2; e1; e2 diff --git a/tests/float/oracle/dr_infinity.res.oracle b/tests/float/oracle/dr_infinity.res.oracle index bd5400a4f2a087c041ab60a997e84f2245082cd9..f9bdeeb9825c711f601b2aad29ca4d1660da8193 100644 --- a/tests/float/oracle/dr_infinity.res.oracle +++ b/tests/float/oracle/dr_infinity.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/dr_infinity.i (no preprocessing) tests/float/dr_infinity.i:8:[kernel] warning: Floating-point constant 3.4028235677973366e+38f is not represented exactly. Will use 0x1.fffffe0000000p127 tests/float/dr_infinity.i:11:[kernel] warning: Floating-point constant 3.402823567797366e+38 is not represented exactly. Will use 0x1.ffffff000004ep127 @@ -13,7 +12,7 @@ tests/float/dr_infinity.i:36:[kernel] warning: Floating-point constant 0.001 is [value] Initial state computed [value:initial-state] Values of globals at initialization v ∈ [--..--] -[value] Called Frama_C_show_each({0x1.fffffe0000000p127}) +tests/float/dr_infinity.i:9:[value] Frama_C_show_each: {0x1.fffffe0000000p127} tests/float/dr_infinity.i:11:[value] warning: non-finite float value. assert \is_finite((float)3.402823567797366e+38); tests/float/dr_infinity.i:16:[value] warning: non-finite float value. assert \is_finite((float)(x * x)); tests/float/dr_infinity.i:21:[value] warning: non-finite double value. assert \is_finite((double)(d * (double)10)); diff --git a/tests/float/oracle/extract_bits.0.res.oracle b/tests/float/oracle/extract_bits.0.res.oracle index 07254c1d183a9623aa37d12fa1b168e56204da53..5ca8c940fcbbc14941be620f0997ee221f5f5576 100644 --- a/tests/float/oracle/extract_bits.0.res.oracle +++ b/tests/float/oracle/extract_bits.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/extract_bits.i (no preprocessing) tests/float/extract_bits.i:6:[kernel] warning: Floating-point constant 3.14 is not represented exactly. Will use 0x1.91eb851eb851fp1 tests/float/extract_bits.i:7:[kernel] warning: Floating-point constant 2.71 is not represented exactly. Will use 0x1.5ae147ae147aep1 @@ -12,8 +11,9 @@ tests/float/extract_bits.i:9:[kernel] warning: Floating-point constant 1.8254370 stdtod_bug ∈ {1.8254370818746401} fr[0..0x3] ∈ {0} dr[0..0x7] ∈ {0} -[value] user error: type long double not implemented. Using double instead -[value] Called Frama_C_show_each([0..0xFF]) +[value] user error: type long double wider than 64 bits not supported. + Using double instead for the remainder of the analysis. +tests/float/extract_bits.i:25:[value] Frama_C_show_each: [0..0xFF] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/extract_bits.1.res.oracle b/tests/float/oracle/extract_bits.1.res.oracle index e6c1e9d712c7dbb91cc2c0f959f4dea949ee862c..dd0873a872520d322239f1a55fe45c34e16f5abf 100644 --- a/tests/float/oracle/extract_bits.1.res.oracle +++ b/tests/float/oracle/extract_bits.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/extract_bits.i (no preprocessing) tests/float/extract_bits.i:6:[kernel] warning: Floating-point constant 3.14 is not represented exactly. Will use 0x1.91eb851eb851fp1 tests/float/extract_bits.i:7:[kernel] warning: Floating-point constant 2.71 is not represented exactly. Will use 0x1.5ae147ae147aep1 @@ -12,8 +11,9 @@ tests/float/extract_bits.i:9:[kernel] warning: Floating-point constant 1.8254370 stdtod_bug ∈ {1.8254370818746401} fr[0..0x3] ∈ {0} dr[0..0x7] ∈ {0} -[value] user error: type long double not implemented. Using double instead -[value] Called Frama_C_show_each([0..0xFF]) +[value] user error: type long double wider than 64 bits not supported. + Using double instead for the remainder of the analysis. +tests/float/extract_bits.i:25:[value] Frama_C_show_each: [0..0xFF] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/float_cast_implicite.res.oracle b/tests/float/oracle/float_cast_implicite.res.oracle index 903f5d3853e1bd2c2b56d5aef968d77dbf609cd1..1edb95218dbe0db611515166db2feaa4c48a9adb 100644 --- a/tests/float/oracle/float_cast_implicite.res.oracle +++ b/tests/float/oracle/float_cast_implicite.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/float_cast_implicite.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/float/oracle/init_float.res.oracle b/tests/float/oracle/init_float.res.oracle index c948ef470e1505325d52ed29bb1071713df75a57..35251d8cd8dc0f172239c8e007c1f1579b63b570 100644 --- a/tests/float/oracle/init_float.res.oracle +++ b/tests/float/oracle/init_float.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/init_float.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/float/oracle/leaf_ensures.res.oracle b/tests/float/oracle/leaf_ensures.res.oracle index d5d303f2e09df33fcc6f9c9dd42a36a22c59926e..7a587e754b336f4281ee16823096eb8e68104352 100644 --- a/tests/float/oracle/leaf_ensures.res.oracle +++ b/tests/float/oracle/leaf_ensures.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/leaf_ensures.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -16,14 +15,14 @@ [value] computing for function d <- main. Called from tests/float/leaf_ensures.i:24. [value] using specification for function d -tests/float/leaf_ensures.i:4:[value] warning: no \from part for clause 'assigns d1, d2, d3;' of function d tests/float/leaf_ensures.i:10:[value] warning: no 'assigns \result \from ...' clause specified for function d +tests/float/leaf_ensures.i:4:[value] warning: no \from part for clause 'assigns d1, d2, d3;' [value] Done for function d [value] computing for function f <- main. Called from tests/float/leaf_ensures.i:25. [value] using specification for function f -tests/float/leaf_ensures.i:14:[value] warning: no \from part for clause 'assigns f1, f2, f3;' of function f tests/float/leaf_ensures.i:20:[value] warning: no 'assigns \result \from ...' clause specified for function f +tests/float/leaf_ensures.i:14:[value] warning: no \from part for clause 'assigns f1, f2, f3;' [value] Done for function f [value] Recording results for main [value] done for function main diff --git a/tests/float/oracle/logic.res.oracle b/tests/float/oracle/logic.res.oracle index 68f00bfad9d6b38c9f8645e93cfb0f591f1c5255..4031539e42a905832583b92523cf4e89f7a74f79 100644 --- a/tests/float/oracle/logic.res.oracle +++ b/tests/float/oracle/logic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/logic.i (no preprocessing) tests/float/logic.i:11:[kernel] warning: Floating-point constant 0.1 is not represented exactly. Will use 0x1.999999999999ap-4 tests/float/logic.i:16:[kernel] warning: Floating-point constant 0.1 is not represented exactly. Will use 0x1.999999999999ap-4 diff --git a/tests/float/oracle/math_builtins.res.oracle b/tests/float/oracle/math_builtins.res.oracle index 4ee9c388858b1c61856f29dc17c083b18d3f5666..6c7a0689810c9ac445687baf95006779c95128cb 100644 --- a/tests/float/oracle/math_builtins.res.oracle +++ b/tests/float/oracle/math_builtins.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/math_builtins.c (with preprocessing) tests/float/math_builtins.c:248:[kernel] warning: Floating-point constant 5.8 is not represented exactly. Will use 0x1.7333333333333p2. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -127,12 +126,13 @@ tests/float/math_builtins.c:117:[value] warning: builtin Frama_C_pow: out-of-ran Called from tests/float/math_builtins.c:120. [value] Recording results for double_interval [value] Done for function double_interval -[value] Called Frama_C_show_each_i([0.0000000000000000 .. 1.0000000000000000*2^-1000]) +tests/float/math_builtins.c:122:[value] Frama_C_show_each_i: [0.0000000000000000 .. 1.0000000000000000*2^-1000] [value] computing for function double_interval <- test_pow_singleton_exp <- main. Called from tests/float/math_builtins.c:123. [value] Recording results for double_interval [value] Done for function double_interval -[value] Called Frama_C_show_each_j([0.2500000000000000*2^-1022 .. 1.2707064924076672*2^-330]) +tests/float/math_builtins.c:125:[value] Frama_C_show_each_j: + [0.2500000000000000*2^-1022 .. 1.2707064924076672*2^-330] [value] computing for function double_interval <- test_pow_singleton_exp <- main. Called from tests/float/math_builtins.c:132. [value] Recording results for double_interval @@ -620,12 +620,12 @@ tests/float/math_builtins.c:250:[value] warning: builtin Frama_C_powf: out-of-ra Called from tests/float/math_builtins.c:253. [value] Recording results for double_interval [value] Done for function double_interval -[value] Called Frama_C_show_each_i([0.0000000000000000 .. 1.0000000000000000*2^-120]) +tests/float/math_builtins.c:255:[value] Frama_C_show_each_i: [0.0000000000000000 .. 1.0000000000000000*2^-120] [value] computing for function double_interval <- test_powf_singleton_exp <- main. Called from tests/float/math_builtins.c:256. [value] Recording results for double_interval [value] Done for function double_interval -[value] Called Frama_C_show_each_j({0}) +tests/float/math_builtins.c:258:[value] Frama_C_show_each_j: {0} [value] computing for function double_interval <- test_powf_singleton_exp <- main. Called from tests/float/math_builtins.c:265. [value] Recording results for double_interval @@ -1753,54 +1753,35 @@ double double_interval(double min, double max) void test_cos_det(void) { - double x; - double y; - double z; - x = cos(1.); - y = cos(0.); - z = cos(- 1.); + double x = cos(1.); + double y = cos(0.); + double z = cos(- 1.); return; } void test_sin_det(void) { - double x; - double y; - double z; - x = sin(1.); - y = sin(0.); - z = sin(- 1.); + double x = sin(1.); + double y = sin(0.); + double z = sin(- 1.); return; } void test_atan2_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - a = atan2(1.,0.); - b = atan2(0.,1.); - c = atan2(1.,- 0.); - d = atan2(- 0.,1.); - e = atan2(- 1.,0.); - f = atan2(- 1.,0.); - g = atan2(- 1.,- 0.); - h = atan2(- 1.,- 0.); - i = atan2(0.,0.); - j = atan2(2.,1.); - k = atan2(- 2.,1.); - l = atan2(2.,- 1.); - m = atan2(- 2.,- 1.); + double a = atan2(1.,0.); + double b = atan2(0.,1.); + double c = atan2(1.,- 0.); + double d = atan2(- 0.,1.); + double e = atan2(- 1.,0.); + double f = atan2(- 1.,0.); + double g = atan2(- 1.,- 0.); + double h = atan2(- 1.,- 0.); + double i = atan2(0.,0.); + double j = atan2(2.,1.); + double k = atan2(- 2.,1.); + double l = atan2(2.,- 1.); + double m = atan2(- 2.,- 1.); return; } @@ -1808,88 +1789,58 @@ void test_atan2(void) { double x; double y; - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - double n; y = double_interval(0.125,10.); x = double_interval(0.125,10.); - a = atan2(y,x); + double a = atan2(y,x); x = double_interval(- 2.5,3.); - b = atan2(y,x); + double b = atan2(y,x); y = double_interval(- 1.25,- 0.5); - c = atan2(y,x); + double c = atan2(y,x); x = double_interval(- 3.,- 2.5); - d = atan2(y,x); + double d = atan2(y,x); x = double_interval(- 0.,0.); - e = atan2(y,x); + double e = atan2(y,x); x = double_interval(1.,5.); y = double_interval(- 1.,- 0.); - f = atan2(y,x); + double f = atan2(y,x); y = double_interval(0.,0.5); - g = atan2(y,x); + double g = atan2(y,x); y = double_interval(- 0.,0.5); - h = atan2(y,x); + double h = atan2(y,x); y = double_interval(- 0.5,0.); - i = atan2(y,x); + double i = atan2(y,x); y = double_interval(- 0.,0.); - j = atan2(y,x); - k = atan2(0.,x); - l = atan2(- 0.,x); - m = atan2(0.,- x); - n = atan2(- 0.,- x); + double j = atan2(y,x); + double k = atan2(0.,x); + double l = atan2(- 0.,x); + double m = atan2(0.,- x); + double n = atan2(- 0.,- x); return; } void test_pow_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - a = pow(1.,8.); - b = pow(0.,1.); - c = pow(12.,0.); - d = pow(2.25,0.25); - e = pow(178.25,0.25); - f = pow(129.5,- 0.25); - g = pow(512.,- 2.25); - h = pow(0.,0.); + double a = pow(1.,8.); + double b = pow(0.,1.); + double c = pow(12.,0.); + double d = pow(2.25,0.25); + double e = pow(178.25,0.25); + double f = pow(129.5,- 0.25); + double g = pow(512.,- 2.25); + double h = pow(0.,0.); return; } void test_powf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - float f32__e; - float f32__f; - float f32__g; - float f32__h; - f32__a = powf((float)1.,(float)8.); - f32__b = powf((float)0.,(float)1.); - f32__c = powf((float)12.,(float)0.); - f32__d = powf((float)2.25,(float)0.25); - f32__e = powf((float)178.25,(float)0.25); - f32__f = powf((float)129.5,(float)(- 0.25)); - f32__g = powf((float)512.,(float)(- 2.25)); - f32__h = powf((float)0.,(float)0.); + float f32__a = powf((float)1.,(float)8.); + float f32__b = powf((float)0.,(float)1.); + float f32__c = powf((float)12.,(float)0.); + float f32__d = powf((float)2.25,(float)0.25); + float f32__e = powf((float)178.25,(float)0.25); + float f32__f = powf((float)129.5,(float)(- 0.25)); + float f32__g = powf((float)512.,(float)(- 2.25)); + float f32__h = powf((float)0.,(float)0.); return; } @@ -1906,23 +1857,6 @@ extern int ( /* missing proto */ Frama_C_show_each_j)(); void test_pow_singleton_exp(void) { double x; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - double n; - double o; - double p; - double q; - double r; - double s; x = double_interval(- 3.5,- 2.75); if (nondet) { /*@ assert @@ -1944,47 +1878,47 @@ void test_pow_singleton_exp(void) /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,1.5))"); */ - c = pow(x,1.5); + double c = pow(x,1.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,- 1.5))"); */ - d = pow(x,- 1.5); + double d = pow(x,- 1.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,- 3.))"); */ - e = pow(x,- 3.); + double e = pow(x,- 3.); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,- 2.))"); */ - f = pow(x,- 2.); + double f = pow(x,- 2.); x = double_interval((double)(1LL << 50),(double)(1LL << 62)); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,19.5))"); */ - g = pow(x,19.5); + double g = pow(x,19.5); x = double_interval((double)(- (1LL << 49)),- .75); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,23.0))"); */ - h = pow(x,23.0); + double h = pow(x,23.0); x = double_interval(0.125,0.25); - i = pow(x,500.); + double i = pow(x,500.); Frama_C_show_each_i(i); x = double_interval(1.25,2.0); - j = pow(x,- 1024.); + double j = pow(x,- 1024.); Frama_C_show_each_j(j); - k = pow(x,2.5); - l = pow(x,3.5); + double k = pow(x,2.5); + double l = pow(x,3.5); x = double_interval(0.25,4.125); - m = pow(x,- 2.25); - n = pow(x,- 1.5); - o = pow(x,0.25); - p = pow(x,1.625); - q = pow(x,4.); + double m = pow(x,- 2.25); + double n = pow(x,- 1.5); + double o = pow(x,0.25); + double p = pow(x,1.625); + double q = pow(x,4.); x = double_interval(- 3.5,- 0.125); - r = pow(x,- 2.); - s = pow(x,- 1.); + double r = pow(x,- 2.); + double s = pow(x,- 1.); return; } @@ -1992,85 +1926,67 @@ void test_pow(void) { double x; double y; - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - double n; - double o; - double p; - double q; - double r; y = double_interval(- 18.5,12.125); - a = pow(1.0,y); + double a = pow(1.0,y); x = double_interval(- 15.25,32.75); - b = pow(x,0.0); + double b = pow(x,0.0); y = double_interval(- 0.0,0.0); - c = pow(x,y); + double c = pow(x,y); x = double_interval(- 4.0,7.5); y = double_interval(2.125,2.875); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - d = pow(x,y); + double d = pow(x,y); y = double_interval(2.125,4.875); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - e = pow(x,y); + double e = pow(x,y); y = double_interval(2.0,3.0); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - f = pow(x,y); + double f = pow(x,y); y = double_interval(- 0.75,- 0.); x = double_interval(0.125,7.5); - g = pow(x,y); + double g = pow(x,y); y = double_interval(0.25,2.5); x = double_interval(0.5,1.25); - h = pow(x,y); + double h = pow(x,y); x = double_interval(- 1.0,1.0); y = double_interval(- 1.0,1.0); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - i = pow(x,y); + double i = pow(x,y); x = double_interval(- 1.0,1.0); y = double_interval(- 0.5,1.0); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - j = pow(x,y); + double j = pow(x,y); x = double_interval(- 13.,430.); y = double_interval(3.,6.); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - k = pow(x,y); + double k = pow(x,y); x = double_interval(- 4.,- 2.); y = double_interval(3.,5.); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - l = pow(x,y); + double l = pow(x,y); x = double_interval(- 0.,10.); y = double_interval(- 0.,5.); - m = pow(x,y); + double m = pow(x,y); x = double_interval(- 0.0,10.0); y = double_interval(- 3.5,4.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - n = pow(x,y); + double n = pow(x,y); x = double_interval(- 5.,- 0.5); y = double_interval(- 0.875,- 0.125); if (nondet) { @@ -2084,17 +2000,17 @@ void test_pow(void) /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - o = pow(x,y); + double o = pow(x,y); y = double_interval(10.,11.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - p = pow(x,y); + double p = pow(x,y); y = double_interval(- 9876.5,1234.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_pow(x,y))"); */ - q = pow(x,y); + double q = pow(x,y); x = double_interval(1e10,1e11); y = double_interval(1e14,1e15); if (nondet) { @@ -2114,7 +2030,7 @@ void test_pow(void) Frama_C_show_each_unreachable(); } y = double_interval(- 0.5,9.5); - r = pow(10.0,y); + double r = pow(10.0,y); return; } @@ -2123,33 +2039,14 @@ void test_powf_singleton_exp(void) float f32__x; double tmp; double tmp_0; - float f32__c; - float f32__d; - float f32__e; - float f32__f; double tmp_5; - float f32__g; double tmp_7; - float f32__h; double tmp_9; - float f32__i; double tmp_11; - float f32__j; - float f32__k; - float f32__l; double tmp_15; - float f32__m; - float f32__n; - float f32__o; - float f32__p; - float f32__q; double tmp_21; - float f32__r; - float f32__s; - { /* sequence */ - tmp = double_interval(- 3.5,- 2.75); - f32__x = (float)tmp; - } + tmp = double_interval(- 3.5,- 2.75); + f32__x = (float)tmp; if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2166,73 +2063,59 @@ void test_powf_singleton_exp(void) powf(f32__x,(float)(- 1.5)); Frama_C_show_each_unreachable(); } - { /* sequence */ - tmp_0 = double_interval(- 3.5,2.75); - f32__x = (float)tmp_0; - } + tmp_0 = double_interval(- 3.5,2.75); + f32__x = (float)tmp_0; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,(float)1.5))"); */ - f32__c = powf(f32__x,(float)1.5); + float f32__c = powf(f32__x,(float)1.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,(float)(- 1.5)))"); */ - f32__d = powf(f32__x,(float)(- 1.5)); + float f32__d = powf(f32__x,(float)(- 1.5)); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,(float)(- 3.)))"); */ - f32__e = powf(f32__x,(float)(- 3.)); + float f32__e = powf(f32__x,(float)(- 3.)); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,(float)(- 2.)))"); */ - f32__f = powf(f32__x,(float)(- 2.)); - { /* sequence */ - tmp_5 = double_interval((double)(1LL << 20),(double)(1LL << 21)); - f32__x = (float)tmp_5; - } - f32__g = powf(f32__x,(float)5.8); - { /* sequence */ - tmp_7 = double_interval((double)(- (1LL << 49)),- .75); - f32__x = (float)tmp_7; - } + float f32__f = powf(f32__x,(float)(- 2.)); + tmp_5 = double_interval((double)(1LL << 20),(double)(1LL << 21)); + f32__x = (float)tmp_5; + float f32__g = powf(f32__x,(float)5.8); + tmp_7 = double_interval((double)(- (1LL << 49)),- .75); + f32__x = (float)tmp_7; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,(float)23.0))"); */ - f32__h = powf(f32__x,(float)23.0); - { /* sequence */ - tmp_9 = double_interval(0.125,0.25); - f32__x = (float)tmp_9; - } - f32__i = powf(f32__x,(float)60.); + float f32__h = powf(f32__x,(float)23.0); + tmp_9 = double_interval(0.125,0.25); + f32__x = (float)tmp_9; + float f32__i = powf(f32__x,(float)60.); Frama_C_show_each_i(f32__i); - { /* sequence */ - tmp_11 = double_interval(1.25,2.0); - f32__x = (float)tmp_11; - } - f32__j = powf(f32__x,(float)(- 1024.)); + tmp_11 = double_interval(1.25,2.0); + f32__x = (float)tmp_11; + float f32__j = powf(f32__x,(float)(- 1024.)); Frama_C_show_each_j(f32__j); - f32__k = powf(f32__x,(float)2.5); - f32__l = powf(f32__x,(float)3.5); - { /* sequence */ - tmp_15 = double_interval(0.25,4.125); - f32__x = (float)tmp_15; - } - f32__m = powf(f32__x,(float)(- 2.25)); - f32__n = powf(f32__x,(float)(- 1.5)); - f32__o = powf(f32__x,(float)0.25); - f32__p = powf(f32__x,(float)1.625); - f32__q = powf(f32__x,(float)4.); - { /* sequence */ - tmp_21 = double_interval(- 3.5,- 0.125); - f32__x = (float)tmp_21; - } - f32__r = powf(f32__x,(float)(- 2.)); - f32__s = powf(f32__x,(float)(- 1.)); + float f32__k = powf(f32__x,(float)2.5); + float f32__l = powf(f32__x,(float)3.5); + tmp_15 = double_interval(0.25,4.125); + f32__x = (float)tmp_15; + float f32__m = powf(f32__x,(float)(- 2.25)); + float f32__n = powf(f32__x,(float)(- 1.5)); + float f32__o = powf(f32__x,(float)0.25); + float f32__p = powf(f32__x,(float)1.625); + float f32__q = powf(f32__x,(float)4.); + tmp_21 = double_interval(- 3.5,- 0.125); + f32__x = (float)tmp_21; + float f32__r = powf(f32__x,(float)(- 2.)); + float f32__s = powf(f32__x,(float)(- 1.)); return; } @@ -2241,181 +2124,120 @@ void test_powf(void) float f32__x; float f32__y; double tmp; - float f32__a; double tmp_1; - float f32__b; double tmp_3; - float f32__c; double tmp_5; double tmp_6; - float f32__d; double tmp_8; - float f32__e; double tmp_10; - float f32__f; double tmp_12; double tmp_13; - float f32__g; double tmp_15; double tmp_16; - float f32__h; double tmp_18; double tmp_19; - float f32__i; double tmp_21; double tmp_22; - float f32__j; double tmp_24; double tmp_25; - float f32__k; double tmp_27; double tmp_28; - float f32__l; double tmp_30; double tmp_31; - float f32__m; - { /* sequence */ - tmp = double_interval(- 18.5,12.125); - f32__y = (float)tmp; - } - f32__a = powf((float)1.0,f32__y); - { /* sequence */ - tmp_1 = double_interval(- 15.25,32.75); - f32__x = (float)tmp_1; - } - f32__b = powf(f32__x,(float)0.0); - { /* sequence */ - tmp_3 = double_interval(- 0.0,0.0); - f32__y = (float)tmp_3; - } - f32__c = powf(f32__x,f32__y); - { /* sequence */ - tmp_5 = double_interval(- 4.0,7.5); - f32__x = (float)tmp_5; - } - { /* sequence */ - tmp_6 = double_interval(2.125,2.875); - f32__y = (float)tmp_6; - } + tmp = double_interval(- 18.5,12.125); + f32__y = (float)tmp; + float f32__a = powf((float)1.0,f32__y); + tmp_1 = double_interval(- 15.25,32.75); + f32__x = (float)tmp_1; + float f32__b = powf(f32__x,(float)0.0); + tmp_3 = double_interval(- 0.0,0.0); + f32__y = (float)tmp_3; + float f32__c = powf(f32__x,f32__y); + tmp_5 = double_interval(- 4.0,7.5); + f32__x = (float)tmp_5; + tmp_6 = double_interval(2.125,2.875); + f32__y = (float)tmp_6; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__d = powf(f32__x,f32__y); - { /* sequence */ - tmp_8 = double_interval(2.125,4.875); - f32__y = (float)tmp_8; - } + float f32__d = powf(f32__x,f32__y); + tmp_8 = double_interval(2.125,4.875); + f32__y = (float)tmp_8; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__e = powf(f32__x,f32__y); - { /* sequence */ - tmp_10 = double_interval(2.0,3.0); - f32__y = (float)tmp_10; - } + float f32__e = powf(f32__x,f32__y); + tmp_10 = double_interval(2.0,3.0); + f32__y = (float)tmp_10; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__f = powf(f32__x,f32__y); - { /* sequence */ - tmp_12 = double_interval(- 0.75,- 0.); - f32__y = (float)tmp_12; - } - { /* sequence */ - tmp_13 = double_interval(0.125,7.5); - f32__x = (float)tmp_13; - } - f32__g = powf(f32__x,f32__y); - { /* sequence */ - tmp_15 = double_interval(0.25,2.5); - f32__y = (float)tmp_15; - } - { /* sequence */ - tmp_16 = double_interval(0.5,1.25); - f32__x = (float)tmp_16; - } - f32__h = powf(f32__x,f32__y); - { /* sequence */ - tmp_18 = double_interval(- 1.0,1.0); - f32__x = (float)tmp_18; - } - { /* sequence */ - tmp_19 = double_interval(- 1.0,1.0); - f32__y = (float)tmp_19; - } + float f32__f = powf(f32__x,f32__y); + tmp_12 = double_interval(- 0.75,- 0.); + f32__y = (float)tmp_12; + tmp_13 = double_interval(0.125,7.5); + f32__x = (float)tmp_13; + float f32__g = powf(f32__x,f32__y); + tmp_15 = double_interval(0.25,2.5); + f32__y = (float)tmp_15; + tmp_16 = double_interval(0.5,1.25); + f32__x = (float)tmp_16; + float f32__h = powf(f32__x,f32__y); + tmp_18 = double_interval(- 1.0,1.0); + f32__x = (float)tmp_18; + tmp_19 = double_interval(- 1.0,1.0); + f32__y = (float)tmp_19; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__i = powf(f32__x,f32__y); - { /* sequence */ - tmp_21 = double_interval(- 1.0,1.0); - f32__x = (float)tmp_21; - } - { /* sequence */ - tmp_22 = double_interval(- 0.5,1.0); - f32__y = (float)tmp_22; - } + float f32__i = powf(f32__x,f32__y); + tmp_21 = double_interval(- 1.0,1.0); + f32__x = (float)tmp_21; + tmp_22 = double_interval(- 0.5,1.0); + f32__y = (float)tmp_22; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__j = powf(f32__x,f32__y); - { /* sequence */ - tmp_24 = double_interval(- 13.,430.); - f32__x = (float)tmp_24; - } - { /* sequence */ - tmp_25 = double_interval(3.,6.); - f32__y = (float)tmp_25; - } + float f32__j = powf(f32__x,f32__y); + tmp_24 = double_interval(- 13.,430.); + f32__x = (float)tmp_24; + tmp_25 = double_interval(3.,6.); + f32__y = (float)tmp_25; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__k = powf(f32__x,f32__y); - { /* sequence */ - tmp_27 = double_interval(- 4.,- 2.); - f32__x = (float)tmp_27; - } - { /* sequence */ - tmp_28 = double_interval(3.,5.); - f32__y = (float)tmp_28; - } + float f32__k = powf(f32__x,f32__y); + tmp_27 = double_interval(- 4.,- 2.); + f32__x = (float)tmp_27; + tmp_28 = double_interval(3.,5.); + f32__y = (float)tmp_28; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_powf(f32__x,f32__y))"); */ - f32__l = powf(f32__x,f32__y); - { /* sequence */ - tmp_30 = double_interval(- 0.,10.); - f32__x = (float)tmp_30; - } - { /* sequence */ - tmp_31 = double_interval(- 0.,5.); - f32__y = (float)tmp_31; - } - f32__m = powf(f32__x,f32__y); + float f32__l = powf(f32__x,f32__y); + tmp_30 = double_interval(- 0.,10.); + f32__x = (float)tmp_30; + tmp_31 = double_interval(- 0.,5.); + f32__y = (float)tmp_31; + float f32__m = powf(f32__x,f32__y); return; } void test_fmod_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - a = fmod(4.0,2.25); - b = fmod(- 4.0,2.25); - c = fmod(- 0.0,2.25); - d = fmod(0.0,2.25); - e = fmod(0.0,0.0009765625); - f = fmod(1.25,0.0009765625); + double a = fmod(4.0,2.25); + double b = fmod(- 4.0,2.25); + double c = fmod(- 0.0,2.25); + double d = fmod(0.0,2.25); + double e = fmod(0.0,0.0009765625); + double f = fmod(1.25,0.0009765625); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2431,62 +2253,34 @@ void test_fmod(void) { double x; double y; - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - double n; - double o; - double p; - double q; - double r; - double s; double tmp_18; - double t; - double u; - double v1; - double v2; - double v3; - double v4; - double w1; - double w2; - double w3; x = double_interval(2.,9.5); - a = fmod(x,1.5); - b = fmod(x,- 1.5); - c = fmod(- x,1.5); - d = fmod(- x,- 1.5); + double a = fmod(x,1.5); + double b = fmod(x,- 1.5); + double c = fmod(- x,1.5); + double d = fmod(- x,- 1.5); x = double_interval(.75,1.25); - e = fmod(x,1.5); - f = fmod(x,- 1.5); + double e = fmod(x,1.5); + double f = fmod(x,- 1.5); x = double_interval(4.,5.5); y = double_interval(6.5,8.); - g = fmod(x,y); + double g = fmod(x,y); x = double_interval(6.5,8.); y = double_interval(4.,5.5); - h = fmod(x,y); - i = fmod(x,- y); + double h = fmod(x,y); + double i = fmod(x,- y); x = double_interval(- 9.,8.75); y = double_interval(- 2.,4.5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - j = fmod(x,y); + double j = fmod(x,y); x = double_interval(- 2.,4.5); y = double_interval(- 9.,8.75); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - k = fmod(x,y); + double k = fmod(x,y); y = double_interval(- 0.0,0.0); if (nondet) { /*@ assert @@ -2499,67 +2293,61 @@ void test_fmod(void) /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - l = fmod(x,y); + double l = fmod(x,y); y = double_interval(- 0.125,- 0.0); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - m = fmod(x,y); + double m = fmod(x,y); x = double_interval(1e308,1.1e308); - n = fmod(x,0.001953125); + double n = fmod(x,0.001953125); x = double_interval(- 1.1e308,- 1e308); - o = fmod(x,0.001953125); + double o = fmod(x,0.001953125); x = double_interval(1e308,1.00001e308); - p = fmod(x,0.001953125); + double p = fmod(x,0.001953125); x = double_interval(1.600000000000001e11,1.600000000000005e11); - q = fmod(x,0.001953125); + double q = fmod(x,0.001953125); x = double_interval(1.759218604000011e13,1759218604000015e13); - r = fmod(x,0.00195313); + double r = fmod(x,0.00195313); x = double_interval(0.5,0.505); - s = fmod(x,0.1); - { /* sequence */ - tmp_18 = double_interval(0.5,0.505); - x = - tmp_18; - } - t = fmod(x,0.1); + double s = fmod(x,0.1); + tmp_18 = double_interval(0.5,0.505); + x = - tmp_18; + double t = fmod(x,0.1); x = double_interval((double)(-8),- 6.5); - u = fmod(x,(double)4); + double u = fmod(x,(double)4); x = double_interval((double)6,(double)7); y = double_interval((double)(-5),(double)(-4)); - v1 = fmod(x,y); + double v1 = fmod(x,y); y = double_interval((double)4,(double)5); - v2 = fmod(x,y); + double v2 = fmod(x,y); x = double_interval((double)(-7),(double)(-6)); - v3 = fmod(x,y); + double v3 = fmod(x,y); y = double_interval((double)(-5),(double)(-4)); - v4 = fmod(x,y); + double v4 = fmod(x,y); x = double_interval((double)2,(double)3); y = double_interval((double)(-4),(double)5); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - w1 = fmod(x,y); + double w1 = fmod(x,y); x = double_interval((double)(-2),(double)3); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - w2 = fmod(x,y); + double w2 = fmod(x,y); x = double_interval((double)(-3),(double)2); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_fmod(x,y))"); */ - w3 = fmod(x,y); + double w3 = fmod(x,y); return; } void test_sqrt_det(void) { - double a; - double b; - double c; - double d; - a = sqrt(42.125); - b = sqrt(0.125); + double a = sqrt(42.125); + double b = sqrt(0.125); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2568,29 +2356,25 @@ void test_sqrt_det(void) sqrt(- 2.); Frama_C_show_each_unreachable(); } - c = sqrt(0.); - d = sqrt(- 0.); + double c = sqrt(0.); + double d = sqrt(- 0.); return; } void test_sqrt(void) { - double x; - double a; - double b; - double c; - x = double_interval(- 0.0,5.0); - a = sqrt(x); + double x = double_interval(- 0.0,5.0); + double a = sqrt(x); x = double_interval(- 6.5,0.0); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_sqrt(x))"); */ - b = sqrt(x); + double b = sqrt(x); x = double_interval(- 6.5,- 0.0); /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_sqrt(x))"); */ - c = sqrt(x); + double c = sqrt(x); x = double_interval(- 6.5,- 0.1); if (nondet) { /*@ assert @@ -2604,12 +2388,8 @@ void test_sqrt(void) void test_sqrtf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - f32__a = sqrtf((float)42.125); - f32__b = sqrtf((float)0.125); + float f32__a = sqrtf((float)42.125); + float f32__b = sqrtf((float)0.125); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2618,46 +2398,36 @@ void test_sqrtf_det(void) sqrtf((float)(- 2.)); Frama_C_show_each_unreachable(); } - f32__c = sqrtf((float)0.); - f32__d = sqrtf((float)(- 0.)); + float f32__c = sqrtf((float)0.); + float f32__d = sqrtf((float)(- 0.)); return; } void test_sqrtf(void) { - float f32__x; double tmp; - float f32__a; double tmp_1; - float b; double tmp_3; - float c; double tmp_5; tmp = double_interval(- 0.0,5.0); - f32__x = (float)tmp; - f32__a = sqrtf(f32__x); - { /* sequence */ - tmp_1 = double_interval(- 6.5,0.0); - f32__x = (float)tmp_1; - } + float f32__x = (float)tmp; + float f32__a = sqrtf(f32__x); + tmp_1 = double_interval(- 6.5,0.0); + f32__x = (float)tmp_1; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_sqrtf(f32__x))"); */ - b = sqrtf(f32__x); - { /* sequence */ - tmp_3 = double_interval(- 6.5,- 0.0); - f32__x = (float)tmp_3; - } + float b = sqrtf(f32__x); + tmp_3 = double_interval(- 6.5,- 0.0); + f32__x = (float)tmp_3; /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_sqrtf(f32__x))"); */ - c = sqrtf(f32__x); - { /* sequence */ - tmp_5 = double_interval(- 6.5,- 0.1); - f32__x = (float)tmp_5; - } + float c = sqrtf(f32__x); + tmp_5 = double_interval(- 6.5,- 0.1); + f32__x = (float)tmp_5; if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2671,16 +2441,11 @@ void test_sqrtf(void) void test_exp_det(void) { - double a; - double b; - double c; - double d; - double e; - a = exp(42.125); - b = exp(- 2.); - c = exp(0.); - d = exp(- 0.); - e = exp(- 1.); + double a = exp(42.125); + double b = exp(- 2.); + double c = exp(0.); + double d = exp(- 0.); + double e = exp(- 1.); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2694,25 +2459,18 @@ void test_exp_det(void) void test_expf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - float f32__e; - f32__a = expf((float)42.125); - f32__b = expf((float)(- 2.)); - f32__c = expf((float)0.); - f32__d = expf((float)(- 0.)); - f32__e = expf((float)(- 1.)); + float f32__a = expf((float)42.125); + float f32__b = expf((float)(- 2.)); + float f32__c = expf((float)0.); + float f32__d = expf((float)(- 0.)); + float f32__e = expf((float)(- 1.)); return; } void test_log_det(void) { - double a; - double b; - a = log(42.125); - b = log(0.125); + double a = log(42.125); + double b = log(0.125); if (nondet) { /*@ assert Value: is_nan_or_infinite: \warning("\\is_finite(Frama_C_log(- 2.))"); @@ -2746,10 +2504,8 @@ void test_log_det(void) void test_logf_det(void) { - float f32__a; - float f32__b; - f32__a = logf((float)42.125); - f32__b = logf((float)0.125); + float f32__a = logf((float)42.125); + float f32__b = logf((float)0.125); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2787,10 +2543,8 @@ void test_logf_det(void) void test_log10_det(void) { - double a; - double b; - a = log10(42.125); - b = log10(0.125); + double a = log10(42.125); + double b = log10(0.125); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2827,10 +2581,8 @@ void test_log10_det(void) void test_log10f_det(void) { - float f32__a; - float f32__b; - f32__a = log10f((float)42.125); - f32__b = log10f((float)0.125); + float f32__a = log10f((float)42.125); + float f32__b = log10f((float)0.125); if (nondet) { /*@ assert Value: is_nan_or_infinite: @@ -2868,206 +2620,144 @@ void test_log10f_det(void) void test_diff_pow_powf(void) { - double d; - float f32__f; - d = pow(0.11,30.); - f32__f = powf((float)0.11,(float)30.); + double d = pow(0.11,30.); + float f32__f = powf((float)0.11,(float)30.); return; } void test_floor_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - a = floor(1.5); - b = floor(0.5); - c = floor(0.0); - d = floor(- 0.0); - e = floor(- 0.5); - f = floor(- 1.5); + double a = floor(1.5); + double b = floor(0.5); + double c = floor(0.0); + double d = floor(- 0.0); + double e = floor(- 0.5); + double f = floor(- 1.5); return; } void test_ceil_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - a = ceil(1.5); - b = ceil(0.5); - c = ceil(0.0); - d = ceil(- 0.0); - e = ceil(- 0.5); - f = ceil(- 1.5); + double a = ceil(1.5); + double b = ceil(0.5); + double c = ceil(0.0); + double d = ceil(- 0.0); + double e = ceil(- 0.5); + double f = ceil(- 1.5); return; } void test_trunc_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - a = trunc(1.5); - b = trunc(0.5); - c = trunc(0.0); - d = trunc(- 0.0); - e = trunc(- 0.5); - f = trunc(- 1.5); + double a = trunc(1.5); + double b = trunc(0.5); + double c = trunc(0.0); + double d = trunc(- 0.0); + double e = trunc(- 0.5); + double f = trunc(- 1.5); return; } void test_round_det(void) { - double a; - double b; - double c; - double d; - double e; - double f; - a = round(1.5); - b = round(0.5); - c = round(0.0); - d = round(- 0.0); - e = round(- 0.5); - f = round(- 1.5); + double a = round(1.5); + double b = round(0.5); + double c = round(0.0); + double d = round(- 0.0); + double e = round(- 0.5); + double f = round(- 1.5); return; } void test_floor(void) { double x; - double a; - double b; - double c; x = double_interval(- 0.5,1.5); - a = floor(x); + double a = floor(x); x = double_interval(- 0.0,0.5); - b = floor(x); + double b = floor(x); x = double_interval(- 2.5,- 0.5); - c = floor(x); + double c = floor(x); return; } void test_ceil(void) { double x; - double a; - double b; - double c; x = double_interval(- 0.5,1.5); - a = ceil(x); + double a = ceil(x); x = double_interval(- 0.0,0.5); - b = ceil(x); + double b = ceil(x); x = double_interval(- 2.5,- 0.5); - c = ceil(x); + double c = ceil(x); return; } void test_trunc(void) { double x; - double a; - double b; - double c; x = double_interval(- 0.5,1.5); - a = trunc(x); + double a = trunc(x); x = double_interval(- 0.0,0.5); - b = trunc(x); + double b = trunc(x); x = double_interval(- 2.5,- 0.5); - c = trunc(x); + double c = trunc(x); return; } void test_round(void) { double x; - double a; - double b; - double c; x = double_interval(- 0.5,1.5); - a = round(x); + double a = round(x); x = double_interval(- 0.0,0.5); - b = round(x); + double b = round(x); x = double_interval(- 2.5,- 0.5); - c = round(x); + double c = round(x); return; } void test_floorf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - float f32__e; - float f32__f; - f32__a = floorf((float)1.5); - f32__b = floorf((float)0.5); - f32__c = floorf((float)0.0); - f32__d = floorf((float)(- 0.0)); - f32__e = floorf((float)(- 0.5)); - f32__f = floorf((float)(- 1.5)); + float f32__a = floorf((float)1.5); + float f32__b = floorf((float)0.5); + float f32__c = floorf((float)0.0); + float f32__d = floorf((float)(- 0.0)); + float f32__e = floorf((float)(- 0.5)); + float f32__f = floorf((float)(- 1.5)); return; } void test_ceilf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - float f32__e; - float f32__f; - f32__a = ceilf((float)1.5); - f32__b = ceilf((float)0.5); - f32__c = ceilf((float)0.0); - f32__d = ceilf((float)(- 0.0)); - f32__e = ceilf((float)(- 0.5)); - f32__f = ceilf((float)(- 1.5)); + float f32__a = ceilf((float)1.5); + float f32__b = ceilf((float)0.5); + float f32__c = ceilf((float)0.0); + float f32__d = ceilf((float)(- 0.0)); + float f32__e = ceilf((float)(- 0.5)); + float f32__f = ceilf((float)(- 1.5)); return; } void test_truncf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - float f32__e; - float f32__f; - f32__a = truncf((float)1.5); - f32__b = truncf((float)0.5); - f32__c = truncf((float)0.0); - f32__d = truncf((float)(- 0.0)); - f32__e = truncf((float)(- 0.5)); - f32__f = truncf((float)(- 1.5)); + float f32__a = truncf((float)1.5); + float f32__b = truncf((float)0.5); + float f32__c = truncf((float)0.0); + float f32__d = truncf((float)(- 0.0)); + float f32__e = truncf((float)(- 0.5)); + float f32__f = truncf((float)(- 1.5)); return; } void test_roundf_det(void) { - float f32__a; - float f32__b; - float f32__c; - float f32__d; - float f32__e; - float f32__f; - f32__a = roundf((float)1.5); - f32__b = roundf((float)0.5); - f32__c = roundf((float)0.0); - f32__d = roundf((float)(- 0.0)); - f32__e = roundf((float)(- 0.5)); - f32__f = roundf((float)(- 1.5)); + float f32__a = roundf((float)1.5); + float f32__b = roundf((float)0.5); + float f32__c = roundf((float)0.0); + float f32__d = roundf((float)(- 0.0)); + float f32__e = roundf((float)(- 0.5)); + float f32__f = roundf((float)(- 1.5)); return; } @@ -3075,26 +2765,17 @@ void test_floorf(void) { float f32__x; double tmp; - float f32__a; double tmp_1; - float f32__b; double tmp_3; - float f32__c; - { /* sequence */ - tmp = double_interval(- 0.5,1.5); - f32__x = (float)tmp; - } - f32__a = floorf(f32__x); - { /* sequence */ - tmp_1 = double_interval(- 0.0,0.5); - f32__x = (float)tmp_1; - } - f32__b = floorf(f32__x); - { /* sequence */ - tmp_3 = double_interval(- 2.5,- 0.5); - f32__x = (float)tmp_3; - } - f32__c = floorf(f32__x); + tmp = double_interval(- 0.5,1.5); + f32__x = (float)tmp; + float f32__a = floorf(f32__x); + tmp_1 = double_interval(- 0.0,0.5); + f32__x = (float)tmp_1; + float f32__b = floorf(f32__x); + tmp_3 = double_interval(- 2.5,- 0.5); + f32__x = (float)tmp_3; + float f32__c = floorf(f32__x); return; } @@ -3102,26 +2783,17 @@ void test_ceilf(void) { float f32__x; double tmp; - float f32__a; double tmp_1; - float f32__b; double tmp_3; - float f32__c; - { /* sequence */ - tmp = double_interval(- 0.5,1.5); - f32__x = (float)tmp; - } - f32__a = ceilf(f32__x); - { /* sequence */ - tmp_1 = double_interval(- 0.0,0.5); - f32__x = (float)tmp_1; - } - f32__b = ceilf(f32__x); - { /* sequence */ - tmp_3 = double_interval(- 2.5,- 0.5); - f32__x = (float)tmp_3; - } - f32__c = ceilf(f32__x); + tmp = double_interval(- 0.5,1.5); + f32__x = (float)tmp; + float f32__a = ceilf(f32__x); + tmp_1 = double_interval(- 0.0,0.5); + f32__x = (float)tmp_1; + float f32__b = ceilf(f32__x); + tmp_3 = double_interval(- 2.5,- 0.5); + f32__x = (float)tmp_3; + float f32__c = ceilf(f32__x); return; } @@ -3129,26 +2801,17 @@ void test_truncf(void) { float f32__x; double tmp; - float f32__a; double tmp_1; - float f32__b; double tmp_3; - float f32__c; - { /* sequence */ - tmp = double_interval(- 0.5,1.5); - f32__x = (float)tmp; - } - f32__a = truncf(f32__x); - { /* sequence */ - tmp_1 = double_interval(- 0.0,0.5); - f32__x = (float)tmp_1; - } - f32__b = truncf(f32__x); - { /* sequence */ - tmp_3 = double_interval(- 2.5,- 0.5); - f32__x = (float)tmp_3; - } - f32__c = truncf(f32__x); + tmp = double_interval(- 0.5,1.5); + f32__x = (float)tmp; + float f32__a = truncf(f32__x); + tmp_1 = double_interval(- 0.0,0.5); + f32__x = (float)tmp_1; + float f32__b = truncf(f32__x); + tmp_3 = double_interval(- 2.5,- 0.5); + f32__x = (float)tmp_3; + float f32__c = truncf(f32__x); return; } @@ -3156,26 +2819,17 @@ void test_roundf(void) { float f32__x; double tmp; - float f32__a; double tmp_1; - float f32__b; double tmp_3; - float f32__c; - { /* sequence */ - tmp = double_interval(- 0.5,1.5); - f32__x = (float)tmp; - } - f32__a = roundf(f32__x); - { /* sequence */ - tmp_1 = double_interval(- 0.0,0.5); - f32__x = (float)tmp_1; - } - f32__b = roundf(f32__x); - { /* sequence */ - tmp_3 = double_interval(- 2.5,- 0.5); - f32__x = (float)tmp_3; - } - f32__c = roundf(f32__x); + tmp = double_interval(- 0.5,1.5); + f32__x = (float)tmp; + float f32__a = roundf(f32__x); + tmp_1 = double_interval(- 0.0,0.5); + f32__x = (float)tmp_1; + float f32__b = roundf(f32__x); + tmp_3 = double_interval(- 2.5,- 0.5); + f32__x = (float)tmp_3; + float f32__c = roundf(f32__x); return; } diff --git a/tests/float/oracle/nonlin.0.res.oracle b/tests/float/oracle/nonlin.0.res.oracle index d7f889dc7c08736c96897bd33e6624626e12c6fc..0ccb56310d6cac80962dc7b33f0ae9fd360c1a31 100644 --- a/tests/float/oracle/nonlin.0.res.oracle +++ b/tests/float/oracle/nonlin.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/nonlin.c (with preprocessing) tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is not represented exactly. Will use 0x1.12e0be826d695p-30. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -36,86 +35,102 @@ tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is rbits2 ∈ {0} v ∈ [--..--] [value] computing for function nonlin_f <- main. - Called from tests/float/nonlin.c:85. + Called from tests/float/nonlin.c:92. [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:16. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:17. [value] Done for function Frama_C_float_interval tests/float/nonlin.c:20:[value] assertion got status valid. tests/float/nonlin.c:24:[value] assertion got status valid. -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4000000000000p2 .. 0x1.4800000000000p2], - {{ "r2" }}, - [0x1.4000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4800000000000p2 .. 0x1.5000000000000p2], - {{ "r2" }}, - [0x1.4800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5000000000000p2 .. 0x1.5800000000000p2], - {{ "r2" }}, - [0x1.5000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5800000000000p2 .. 0x1.6000000000000p2], - {{ "r2" }}, - [0x1.5800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6000000000000p2 .. 0x1.6800000000000p2], - {{ "r2" }}, - [0x1.6000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6800000000000p2 .. 0x1.7000000000000p2], - {{ "r2" }}, - [0x1.6800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7000000000000p2 .. 0x1.7800000000000p2], - {{ "r2" }}, - [0x1.7000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7800000000000p2 .. 0x1.8000000000000p2], - {{ "r2" }}, - [0x1.7800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8000000000000p2 .. 0x1.8800000000000p2], - {{ "r2" }}, - [0x1.8000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8800000000000p2 .. 0x1.9000000000000p2], - {{ "r2" }}, - [0x1.8800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9000000000000p2 .. 0x1.9800000000000p2], - {{ "r2" }}, - [0x1.9000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9800000000000p2 .. 0x1.a000000000000p2], - {{ "r2" }}, - [0x1.9800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a000000000000p2 .. 0x1.a800000000000p2], - {{ "r2" }}, - [0x1.a000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a800000000000p2 .. 0x1.b000000000000p2], - {{ "r2" }}, - [0x1.a800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b000000000000p2 .. 0x1.b800000000000p2], - {{ "r2" }}, - [0x1.b000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b800000000000p2 .. 0x1.c000000000000p2], - {{ "r2" }}, - [0x1.b800000000000p2 .. 0x1.c800000000000p2]) +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4000000000000p2 .. 0x1.4800000000000p2], + {{ "r2" }}, + [0x1.4000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4800000000000p2 .. 0x1.5000000000000p2], + {{ "r2" }}, + [0x1.4800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5000000000000p2 .. 0x1.5800000000000p2], + {{ "r2" }}, + [0x1.5000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5800000000000p2 .. 0x1.6000000000000p2], + {{ "r2" }}, + [0x1.5800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6000000000000p2 .. 0x1.6800000000000p2], + {{ "r2" }}, + [0x1.6000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6800000000000p2 .. 0x1.7000000000000p2], + {{ "r2" }}, + [0x1.6800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7000000000000p2 .. 0x1.7800000000000p2], + {{ "r2" }}, + [0x1.7000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7800000000000p2 .. 0x1.8000000000000p2], + {{ "r2" }}, + [0x1.7800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8000000000000p2 .. 0x1.8800000000000p2], + {{ "r2" }}, + [0x1.8000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8800000000000p2 .. 0x1.9000000000000p2], + {{ "r2" }}, + [0x1.8800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9000000000000p2 .. 0x1.9800000000000p2], + {{ "r2" }}, + [0x1.9000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9800000000000p2 .. 0x1.a000000000000p2], + {{ "r2" }}, + [0x1.9800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a000000000000p2 .. 0x1.a800000000000p2], + {{ "r2" }}, + [0x1.a000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a800000000000p2 .. 0x1.b000000000000p2], + {{ "r2" }}, + [0x1.a800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b000000000000p2 .. 0x1.b800000000000p2], + {{ "r2" }}, + [0x1.b000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b800000000000p2 .. 0x1.c000000000000p2], + {{ "r2" }}, + [0x1.b800000000000p2 .. 0x1.c800000000000p2] [value] Recording results for nonlin_f [value] Done for function nonlin_f [value] computing for function other <- main. - Called from tests/float/nonlin.c:86. + Called from tests/float/nonlin.c:93. [value] computing for function Frama_C_float_interval <- other <- main. Called from tests/float/nonlin.c:59. [value] Done for function Frama_C_float_interval @@ -139,7 +154,7 @@ tests/float/nonlin.c:70:[value] warning: division by zero. assert x ≢ 0; [value] Recording results for other [value] Done for function other [value] computing for function split_alarm <- main. - Called from tests/float/nonlin.c:87. + Called from tests/float/nonlin.c:94. tests/float/nonlin.c:74:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:75:[value] warning: non-finite double value. assert @@ -148,11 +163,21 @@ tests/float/nonlin.c:75:[value] warning: non-finite double value. [value] Recording results for split_alarm [value] Done for function split_alarm [value] computing for function norm <- main. - Called from tests/float/nonlin.c:88. + Called from tests/float/nonlin.c:95. tests/float/nonlin.c:79:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_finite(v); [value] Recording results for norm [value] Done for function norm +[value] computing for function garbled <- main. + Called from tests/float/nonlin.c:96. +tests/float/nonlin.c:87:[value] warning: non-finite float value. + assert \is_finite((float)((int)(&x_0 + (int)(&x_0)))); +tests/float/nonlin.c:87:[value] Assigning imprecise value to a_0. + The imprecision originates from Arithmetic {tests/float/nonlin.c:87} +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite(a_0); +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite((float)(a_0 + a_0)); +[value] Recording results for garbled +[value] Done for function garbled [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -160,6 +185,11 @@ tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_fini rbits1 ∈ {0; 1; 2} x0 ∈ [--..--] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [0x1.4000000000000p2 .. 0x1.c000000000000p2] @@ -214,6 +244,11 @@ tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_fini rbits1 ∈ {0; 1; 2} x0 ∈ [--..--] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [5. .. 7.] diff --git a/tests/float/oracle/nonlin.1.res.oracle b/tests/float/oracle/nonlin.1.res.oracle index fa463d647da0d8b7425bc9614e8351c7271421fd..5b7443248885d028a651234ffc9134fdee7820cf 100644 --- a/tests/float/oracle/nonlin.1.res.oracle +++ b/tests/float/oracle/nonlin.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/nonlin.c (with preprocessing) tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is not represented exactly. Will use 0x1.12e0be826d695p-30. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -36,88 +35,106 @@ tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is rbits2 ∈ {0} v ∈ [--..--] [value] computing for function nonlin_f <- main. - Called from tests/float/nonlin.c:85. + Called from tests/float/nonlin.c:92. [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:16. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:17. [value] Done for function Frama_C_float_interval tests/float/nonlin.c:20:[value] assertion got status valid. tests/float/nonlin.c:22:[value:nonlin] non-linear 'a + b * (c - a)', lv 'a' +tests/float/nonlin.c:22:[value:nonlin] subdividing on a tests/float/nonlin.c:24:[value] assertion got status valid. tests/float/nonlin.c:41:[value:nonlin] non-linear 'b * (c - a) + a', lv 'a' -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4000000000000p2 .. 0x1.4800000000000p2], - {{ "r2" }}, - [0x1.4000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4800000000000p2 .. 0x1.5000000000000p2], - {{ "r2" }}, - [0x1.4800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5000000000000p2 .. 0x1.5800000000000p2], - {{ "r2" }}, - [0x1.5000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5800000000000p2 .. 0x1.6000000000000p2], - {{ "r2" }}, - [0x1.5800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6000000000000p2 .. 0x1.6800000000000p2], - {{ "r2" }}, - [0x1.6000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6800000000000p2 .. 0x1.7000000000000p2], - {{ "r2" }}, - [0x1.6800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7000000000000p2 .. 0x1.7800000000000p2], - {{ "r2" }}, - [0x1.7000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7800000000000p2 .. 0x1.8000000000000p2], - {{ "r2" }}, - [0x1.7800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8000000000000p2 .. 0x1.8800000000000p2], - {{ "r2" }}, - [0x1.8000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8800000000000p2 .. 0x1.9000000000000p2], - {{ "r2" }}, - [0x1.8800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9000000000000p2 .. 0x1.9800000000000p2], - {{ "r2" }}, - [0x1.9000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9800000000000p2 .. 0x1.a000000000000p2], - {{ "r2" }}, - [0x1.9800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a000000000000p2 .. 0x1.a800000000000p2], - {{ "r2" }}, - [0x1.a000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a800000000000p2 .. 0x1.b000000000000p2], - {{ "r2" }}, - [0x1.a800000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b000000000000p2 .. 0x1.b800000000000p2], - {{ "r2" }}, - [0x1.b000000000000p2 .. 0x1.c0fffffffffffp2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b800000000000p2 .. 0x1.c000000000000p2], - {{ "r2" }}, - [0x1.b800000000000p2 .. 0x1.c0fffffffffffp2]) +tests/float/nonlin.c:41:[value:nonlin] subdividing on a +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4000000000000p2 .. 0x1.4800000000000p2], + {{ "r2" }}, + [0x1.4000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4800000000000p2 .. 0x1.5000000000000p2], + {{ "r2" }}, + [0x1.4800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5000000000000p2 .. 0x1.5800000000000p2], + {{ "r2" }}, + [0x1.5000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5800000000000p2 .. 0x1.6000000000000p2], + {{ "r2" }}, + [0x1.5800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6000000000000p2 .. 0x1.6800000000000p2], + {{ "r2" }}, + [0x1.6000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6800000000000p2 .. 0x1.7000000000000p2], + {{ "r2" }}, + [0x1.6800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7000000000000p2 .. 0x1.7800000000000p2], + {{ "r2" }}, + [0x1.7000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7800000000000p2 .. 0x1.8000000000000p2], + {{ "r2" }}, + [0x1.7800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8000000000000p2 .. 0x1.8800000000000p2], + {{ "r2" }}, + [0x1.8000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8800000000000p2 .. 0x1.9000000000000p2], + {{ "r2" }}, + [0x1.8800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9000000000000p2 .. 0x1.9800000000000p2], + {{ "r2" }}, + [0x1.9000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9800000000000p2 .. 0x1.a000000000000p2], + {{ "r2" }}, + [0x1.9800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a000000000000p2 .. 0x1.a800000000000p2], + {{ "r2" }}, + [0x1.a000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a800000000000p2 .. 0x1.b000000000000p2], + {{ "r2" }}, + [0x1.a800000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b000000000000p2 .. 0x1.b800000000000p2], + {{ "r2" }}, + [0x1.b000000000000p2 .. 0x1.c0fffffffffffp2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b800000000000p2 .. 0x1.c000000000000p2], + {{ "r2" }}, + [0x1.b800000000000p2 .. 0x1.c0fffffffffffp2] [value] Recording results for nonlin_f [value] Done for function nonlin_f [value] computing for function other <- main. - Called from tests/float/nonlin.c:86. + Called from tests/float/nonlin.c:93. [value] computing for function Frama_C_float_interval <- other <- main. Called from tests/float/nonlin.c:59. [value] Done for function Frama_C_float_interval @@ -125,13 +142,19 @@ tests/float/nonlin.c:41:[value:nonlin] non-linear 'b * (c - a) + a', lv 'a' Called from tests/float/nonlin.c:60. [value] Done for function Frama_C_float_interval tests/float/nonlin.c:61:[value:nonlin] non-linear 'i * i', lv 'i' +tests/float/nonlin.c:61:[value:nonlin] subdividing on i tests/float/nonlin.c:61:[value] warning: accessing out of bounds index. assert (int)((double)((double)(i * i) + 2.0)) < 10; tests/float/nonlin.c:62:[value:nonlin] non-linear 's - s', lv 's' +tests/float/nonlin.c:62:[value:nonlin] subdividing on s tests/float/nonlin.c:63:[value:nonlin] non-linear 's - s', lv 's' +tests/float/nonlin.c:63:[value:nonlin] subdividing on s tests/float/nonlin.c:64:[value:nonlin] non-linear 's + s', lv 's' +tests/float/nonlin.c:64:[value:nonlin] subdividing on s tests/float/nonlin.c:65:[value:nonlin] non-linear 's * s', lv 's' +tests/float/nonlin.c:65:[value:nonlin] subdividing on s tests/float/nonlin.c:66:[value:nonlin] non-linear 's * ((double)1 - s)', lv 's' +tests/float/nonlin.c:66:[value:nonlin] subdividing on s [value] computing for function access_bits <- other <- main. Called from tests/float/nonlin.c:67. [value] Recording results for access_bits @@ -142,23 +165,39 @@ tests/float/nonlin.c:66:[value:nonlin] non-linear 's * ((double)1 - s)', lv 's' share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. [value] Done for function Frama_C_interval tests/float/nonlin.c:70:[value:nonlin] non-linear '(1 / x) * x', lv 'x' +tests/float/nonlin.c:70:[value:nonlin] subdividing on x tests/float/nonlin.c:70:[value] warning: division by zero. assert x ≢ 0; [value] Recording results for other [value] Done for function other [value] computing for function split_alarm <- main. - Called from tests/float/nonlin.c:87. + Called from tests/float/nonlin.c:94. tests/float/nonlin.c:74:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:75:[value:nonlin] non-linear '(double)ff * (double)ff', lv 'ff' +tests/float/nonlin.c:75:[value:nonlin] subdividing on ff [value] Recording results for split_alarm [value] Done for function split_alarm [value] computing for function norm <- main. - Called from tests/float/nonlin.c:88. + Called from tests/float/nonlin.c:95. tests/float/nonlin.c:79:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1', lv 'v1' tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv 'v2' +tests/float/nonlin.c:81:[value:nonlin] subdividing on v1 +tests/float/nonlin.c:81:[value:nonlin] subdividing on v2 [value] Recording results for norm [value] Done for function norm +[value] computing for function garbled <- main. + Called from tests/float/nonlin.c:96. +tests/float/nonlin.c:87:[value] warning: non-finite float value. + assert \is_finite((float)((int)(&x_0 + (int)(&x_0)))); +tests/float/nonlin.c:87:[value] Assigning imprecise value to a_0. + The imprecision originates from Arithmetic {tests/float/nonlin.c:87} +tests/float/nonlin.c:88:[value:nonlin] non-linear 'a_0 + a_0', lv 'a_0' +tests/float/nonlin.c:88:[value:nonlin] subdividing on a_0 +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite(a_0); +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite((float)(a_0 + a_0)); +[value] Recording results for garbled +[value] Done for function garbled [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -166,6 +205,11 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv rbits1 ∈ {0; 1; 2} x0 ∈ [--..--] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [0x1.4000000000000p2 .. 0x1.c000000000000p2] @@ -180,7 +224,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv square ∈ [-0x0.0000000000000p-1022 .. 0x1.fffffc0000020p256] [value:final-states] Values at end of function other: Frama_C_entropy_source ∈ [--..--] - i ∈ [-0x1.05ffffffffffbp2 .. 0x1.6a3b000000004p1] + i ∈ [-0x1.714fffffffff7p1 .. 0x1.71c0000000003p1] s ∈ [-0x1.0a00000000000p7 .. 0x1.1c00000000000p7] zf ∈ [-0x1.12ffffffffffep4 .. 0x1.12ffffffffffep4] s2 ∈ [-0x1.0a00000000000p8 .. 0x1.1c00000000000p8] @@ -203,7 +247,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv r1 ∈ [0x1.4000000000000p2 .. 0x1.cffffffffffffp2] r2 ∈ [0x1.4000000000000p2 .. 0x1.c0fffffffffffp2] d ∈ [0x1.4000000000000p2 .. 0x1.c000000000000p2] - i ∈ [-0x1.05ffffffffffbp2 .. 0x1.6a3b000000004p1] + i ∈ [-0x1.714fffffffff7p1 .. 0x1.71c0000000003p1] s ∈ [-0x1.0a00000000000p7 .. 0x1.1c00000000000p7] zf ∈ [-0x1.12ffffffffffep4 .. 0x1.12ffffffffffep4] s2 ∈ [-0x1.0a00000000000p8 .. 0x1.1c00000000000p8] @@ -220,6 +264,11 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv rbits1 ∈ {0; 1; 2} x0 ∈ [--..--] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [5. .. 7.] @@ -234,7 +283,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv square ∈ [-0. .. 2.31584150868e+77] [value:final-states] Values at end of function other: Frama_C_entropy_source ∈ [--..--] - i ∈ [-4.09375 .. 2.82992553711] + i ∈ [-2.88525390625 .. 2.888671875] s ∈ [-133. .. 142.] zf ∈ [-17.1875 .. 17.1875] s2 ∈ [-266. .. 284.] @@ -257,7 +306,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv r1 ∈ [5. .. 7.25] r2 ∈ [5. .. 7.015625] d ∈ [5. .. 7.] - i ∈ [-4.09375 .. 2.82992553711] + i ∈ [-2.88525390625 .. 2.888671875] s ∈ [-133. .. 142.] zf ∈ [-17.1875 .. 17.1875] s2 ∈ [-266. .. 284.] diff --git a/tests/float/oracle/nonlin.2.res.oracle b/tests/float/oracle/nonlin.2.res.oracle index 8abbe02865e6cefe1636d3f8133eba406399c2e9..6ad10e2220da6b9416d5923a7f62828970ab6581 100644 --- a/tests/float/oracle/nonlin.2.res.oracle +++ b/tests/float/oracle/nonlin.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/nonlin.c (with preprocessing) tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is not represented exactly. Will use 0x1.12e0be826d695p-30. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -36,86 +35,102 @@ tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is rbits2 ∈ {0} v ∈ [--..--] [value] computing for function nonlin_f <- main. - Called from tests/float/nonlin.c:85. + Called from tests/float/nonlin.c:92. [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:16. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:17. [value] Done for function Frama_C_float_interval tests/float/nonlin.c:20:[value] assertion got status valid. tests/float/nonlin.c:24:[value] assertion got status valid. -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4000000000000p2 .. 0x1.4800000000000p2], - {{ "r2" }}, - [0x1.4000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4800000000000p2 .. 0x1.5000000000000p2], - {{ "r2" }}, - [0x1.4800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5000000000000p2 .. 0x1.5800000000000p2], - {{ "r2" }}, - [0x1.5000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5800000000000p2 .. 0x1.6000000000000p2], - {{ "r2" }}, - [0x1.5800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6000000000000p2 .. 0x1.6800000000000p2], - {{ "r2" }}, - [0x1.6000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6800000000000p2 .. 0x1.7000000000000p2], - {{ "r2" }}, - [0x1.6800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7000000000000p2 .. 0x1.7800000000000p2], - {{ "r2" }}, - [0x1.7000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7800000000000p2 .. 0x1.8000000000000p2], - {{ "r2" }}, - [0x1.7800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8000000000000p2 .. 0x1.8800000000000p2], - {{ "r2" }}, - [0x1.8000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8800000000000p2 .. 0x1.9000000000000p2], - {{ "r2" }}, - [0x1.8800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9000000000000p2 .. 0x1.9800000000000p2], - {{ "r2" }}, - [0x1.9000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9800000000000p2 .. 0x1.a000000000000p2], - {{ "r2" }}, - [0x1.9800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a000000000000p2 .. 0x1.a800000000000p2], - {{ "r2" }}, - [0x1.a000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a800000000000p2 .. 0x1.b000000000000p2], - {{ "r2" }}, - [0x1.a800000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b000000000000p2 .. 0x1.b800000000000p2], - {{ "r2" }}, - [0x1.b000000000000p2 .. 0x1.c800000000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b800000000000p2 .. 0x1.c000000000000p2], - {{ "r2" }}, - [0x1.b800000000000p2 .. 0x1.c800000000000p2]) +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4000000000000p2 .. 0x1.4800000000000p2], + {{ "r2" }}, + [0x1.4000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4800000000000p2 .. 0x1.5000000000000p2], + {{ "r2" }}, + [0x1.4800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5000000000000p2 .. 0x1.5800000000000p2], + {{ "r2" }}, + [0x1.5000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5800000000000p2 .. 0x1.6000000000000p2], + {{ "r2" }}, + [0x1.5800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6000000000000p2 .. 0x1.6800000000000p2], + {{ "r2" }}, + [0x1.6000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6800000000000p2 .. 0x1.7000000000000p2], + {{ "r2" }}, + [0x1.6800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7000000000000p2 .. 0x1.7800000000000p2], + {{ "r2" }}, + [0x1.7000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7800000000000p2 .. 0x1.8000000000000p2], + {{ "r2" }}, + [0x1.7800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8000000000000p2 .. 0x1.8800000000000p2], + {{ "r2" }}, + [0x1.8000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8800000000000p2 .. 0x1.9000000000000p2], + {{ "r2" }}, + [0x1.8800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9000000000000p2 .. 0x1.9800000000000p2], + {{ "r2" }}, + [0x1.9000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9800000000000p2 .. 0x1.a000000000000p2], + {{ "r2" }}, + [0x1.9800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a000000000000p2 .. 0x1.a800000000000p2], + {{ "r2" }}, + [0x1.a000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a800000000000p2 .. 0x1.b000000000000p2], + {{ "r2" }}, + [0x1.a800000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b000000000000p2 .. 0x1.b800000000000p2], + {{ "r2" }}, + [0x1.b000000000000p2 .. 0x1.c800000000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b800000000000p2 .. 0x1.c000000000000p2], + {{ "r2" }}, + [0x1.b800000000000p2 .. 0x1.c800000000000p2] [value] Recording results for nonlin_f [value] Done for function nonlin_f [value] computing for function other <- main. - Called from tests/float/nonlin.c:86. + Called from tests/float/nonlin.c:93. [value] computing for function Frama_C_float_interval <- other <- main. Called from tests/float/nonlin.c:59. [value] Done for function Frama_C_float_interval @@ -139,7 +154,7 @@ tests/float/nonlin.c:70:[value] warning: division by zero. assert x ≢ 0; [value] Recording results for other [value] Done for function other [value] computing for function split_alarm <- main. - Called from tests/float/nonlin.c:87. + Called from tests/float/nonlin.c:94. tests/float/nonlin.c:74:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:75:[value] warning: non-finite double value. assert @@ -148,11 +163,21 @@ tests/float/nonlin.c:75:[value] warning: non-finite double value. [value] Recording results for split_alarm [value] Done for function split_alarm [value] computing for function norm <- main. - Called from tests/float/nonlin.c:88. + Called from tests/float/nonlin.c:95. tests/float/nonlin.c:79:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_finite(v); [value] Recording results for norm [value] Done for function norm +[value] computing for function garbled <- main. + Called from tests/float/nonlin.c:96. +tests/float/nonlin.c:87:[value] warning: non-finite float value. + assert \is_finite((float)((int)(&x_0 + (int)(&x_0)))); +tests/float/nonlin.c:87:[value] Assigning imprecise value to a_0. + The imprecision originates from Arithmetic {tests/float/nonlin.c:87} +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite(a_0); +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite((float)(a_0 + a_0)); +[value] Recording results for garbled +[value] Done for function garbled [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -160,6 +185,11 @@ tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_fini rbits1 ∈ {0; 1; 2} x0 ∈ [0..3271884800] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [0x1.4000000000000p2 .. 0x1.c000000000000p2] @@ -214,6 +244,11 @@ tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_fini rbits1 ∈ {0; 1; 2} x0 ∈ [0..3271884800] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [5. .. 7.] diff --git a/tests/float/oracle/nonlin.3.res.oracle b/tests/float/oracle/nonlin.3.res.oracle index cfababadc788348b475391c662e627b376d0dcf3..d88d98596501a8448748f71d728264890f3961a3 100644 --- a/tests/float/oracle/nonlin.3.res.oracle +++ b/tests/float/oracle/nonlin.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/nonlin.c (with preprocessing) tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is not represented exactly. Will use 0x1.12e0be826d695p-30. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -36,88 +35,106 @@ tests/float/nonlin.c:75:[kernel] warning: Floating-point constant 0.000000001 is rbits2 ∈ {0} v ∈ [--..--] [value] computing for function nonlin_f <- main. - Called from tests/float/nonlin.c:85. + Called from tests/float/nonlin.c:92. [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:16. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval [value] computing for function Frama_C_float_interval <- nonlin_f <- main. Called from tests/float/nonlin.c:17. [value] Done for function Frama_C_float_interval tests/float/nonlin.c:20:[value] assertion got status valid. tests/float/nonlin.c:22:[value:nonlin] non-linear 'a + b * (c - a)', lv 'a' +tests/float/nonlin.c:22:[value:nonlin] subdividing on a tests/float/nonlin.c:24:[value] assertion got status valid. tests/float/nonlin.c:41:[value:nonlin] non-linear 'b * (c - a) + a', lv 'a' -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4000000000000p2 .. 0x1.4800000000000p2], - {{ "r2" }}, - [0x1.4000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.4800000000000p2 .. 0x1.5000000000000p2], - {{ "r2" }}, - [0x1.4800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5000000000000p2 .. 0x1.5800000000000p2], - {{ "r2" }}, - [0x1.5000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.5800000000000p2 .. 0x1.6000000000000p2], - {{ "r2" }}, - [0x1.5800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6000000000000p2 .. 0x1.6800000000000p2], - {{ "r2" }}, - [0x1.6000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.6800000000000p2 .. 0x1.7000000000000p2], - {{ "r2" }}, - [0x1.6800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7000000000000p2 .. 0x1.7800000000000p2], - {{ "r2" }}, - [0x1.7000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.7800000000000p2 .. 0x1.8000000000000p2], - {{ "r2" }}, - [0x1.7800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8000000000000p2 .. 0x1.8800000000000p2], - {{ "r2" }}, - [0x1.8000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.8800000000000p2 .. 0x1.9000000000000p2], - {{ "r2" }}, - [0x1.8800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9000000000000p2 .. 0x1.9800000000000p2], - {{ "r2" }}, - [0x1.9000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.9800000000000p2 .. 0x1.a000000000000p2], - {{ "r2" }}, - [0x1.9800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a000000000000p2 .. 0x1.a800000000000p2], - {{ "r2" }}, - [0x1.a000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.a800000000000p2 .. 0x1.b000000000000p2], - {{ "r2" }}, - [0x1.a800000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b000000000000p2 .. 0x1.b800000000000p2], - {{ "r2" }}, - [0x1.b000000000000p2 .. 0x1.c0fffe0000000p2]) -[value] Called Frama_C_show_each_a_r2({{ "a" }}, - [0x1.b800000000000p2 .. 0x1.c000000000000p2], - {{ "r2" }}, - [0x1.b800000000000p2 .. 0x1.c0fffe0000000p2]) +tests/float/nonlin.c:41:[value:nonlin] subdividing on a +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4000000000000p2 .. 0x1.4800000000000p2], + {{ "r2" }}, + [0x1.4000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.4800000000000p2 .. 0x1.5000000000000p2], + {{ "r2" }}, + [0x1.4800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5000000000000p2 .. 0x1.5800000000000p2], + {{ "r2" }}, + [0x1.5000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.5800000000000p2 .. 0x1.6000000000000p2], + {{ "r2" }}, + [0x1.5800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6000000000000p2 .. 0x1.6800000000000p2], + {{ "r2" }}, + [0x1.6000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.6800000000000p2 .. 0x1.7000000000000p2], + {{ "r2" }}, + [0x1.6800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7000000000000p2 .. 0x1.7800000000000p2], + {{ "r2" }}, + [0x1.7000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.7800000000000p2 .. 0x1.8000000000000p2], + {{ "r2" }}, + [0x1.7800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8000000000000p2 .. 0x1.8800000000000p2], + {{ "r2" }}, + [0x1.8000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.8800000000000p2 .. 0x1.9000000000000p2], + {{ "r2" }}, + [0x1.8800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9000000000000p2 .. 0x1.9800000000000p2], + {{ "r2" }}, + [0x1.9000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.9800000000000p2 .. 0x1.a000000000000p2], + {{ "r2" }}, + [0x1.9800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a000000000000p2 .. 0x1.a800000000000p2], + {{ "r2" }}, + [0x1.a000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.a800000000000p2 .. 0x1.b000000000000p2], + {{ "r2" }}, + [0x1.a800000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b000000000000p2 .. 0x1.b800000000000p2], + {{ "r2" }}, + [0x1.b000000000000p2 .. 0x1.c0fffe0000000p2] +tests/float/nonlin.c:42:[value] Frama_C_show_each_a_r2: + {{ "a" }}, + [0x1.b800000000000p2 .. 0x1.c000000000000p2], + {{ "r2" }}, + [0x1.b800000000000p2 .. 0x1.c0fffe0000000p2] [value] Recording results for nonlin_f [value] Done for function nonlin_f [value] computing for function other <- main. - Called from tests/float/nonlin.c:86. + Called from tests/float/nonlin.c:93. [value] computing for function Frama_C_float_interval <- other <- main. Called from tests/float/nonlin.c:59. [value] Done for function Frama_C_float_interval @@ -125,13 +142,19 @@ tests/float/nonlin.c:41:[value:nonlin] non-linear 'b * (c - a) + a', lv 'a' Called from tests/float/nonlin.c:60. [value] Done for function Frama_C_float_interval tests/float/nonlin.c:61:[value:nonlin] non-linear 'i * i', lv 'i' +tests/float/nonlin.c:61:[value:nonlin] subdividing on i tests/float/nonlin.c:61:[value] warning: accessing out of bounds index. assert (int)((double)((double)((float)(i * i)) + 2.0)) < 10; tests/float/nonlin.c:62:[value:nonlin] non-linear 's - s', lv 's' +tests/float/nonlin.c:62:[value:nonlin] subdividing on s tests/float/nonlin.c:63:[value:nonlin] non-linear 's - s', lv 's' +tests/float/nonlin.c:63:[value:nonlin] subdividing on s tests/float/nonlin.c:64:[value:nonlin] non-linear 's + s', lv 's' +tests/float/nonlin.c:64:[value:nonlin] subdividing on s tests/float/nonlin.c:65:[value:nonlin] non-linear 's * s', lv 's' +tests/float/nonlin.c:65:[value:nonlin] subdividing on s tests/float/nonlin.c:66:[value:nonlin] non-linear 's * ((float)1 - s)', lv 's' +tests/float/nonlin.c:66:[value:nonlin] subdividing on s [value] computing for function access_bits <- other <- main. Called from tests/float/nonlin.c:67. [value] Recording results for access_bits @@ -142,30 +165,51 @@ tests/float/nonlin.c:66:[value:nonlin] non-linear 's * ((float)1 - s)', lv 's' share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. [value] Done for function Frama_C_interval tests/float/nonlin.c:70:[value:nonlin] non-linear '(1 / x) * x', lv 'x' +tests/float/nonlin.c:70:[value:nonlin] subdividing on x tests/float/nonlin.c:70:[value] warning: division by zero. assert x ≢ 0; [value] Recording results for other [value] Done for function other [value] computing for function split_alarm <- main. - Called from tests/float/nonlin.c:87. + Called from tests/float/nonlin.c:94. tests/float/nonlin.c:74:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:75:[value:nonlin] non-linear '(double)ff * (double)ff', lv 'ff' +tests/float/nonlin.c:75:[value:nonlin] subdividing on ff [value] Recording results for split_alarm [value] Done for function split_alarm [value] computing for function norm <- main. - Called from tests/float/nonlin.c:88. + Called from tests/float/nonlin.c:95. tests/float/nonlin.c:79:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:80:[value] warning: non-finite float value. assert \is_finite(v); tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v1 * (double)v1', lv 'v1' tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv 'v2' +tests/float/nonlin.c:81:[value:nonlin] subdividing on v1 +tests/float/nonlin.c:81:[value:nonlin] subdividing on v2 [value] Recording results for norm [value] Done for function norm +[value] computing for function garbled <- main. + Called from tests/float/nonlin.c:96. +tests/float/nonlin.c:87:[value] warning: non-finite float value. + assert \is_finite((float)((int)(&x_0 + (int)(&x_0)))); +tests/float/nonlin.c:87:[value] Assigning imprecise value to a_0. + The imprecision originates from Arithmetic {tests/float/nonlin.c:87} +tests/float/nonlin.c:88:[value:nonlin] non-linear 'a_0 + a_0', lv 'a_0' +tests/float/nonlin.c:88:[value:nonlin] subdividing on a_0 +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite(a_0); +tests/float/nonlin.c:88:[value] warning: non-finite float value. assert \is_finite((float)(a_0 + a_0)); +[value] Recording results for garbled +[value] Done for function garbled [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function access_bits: rbits1 ∈ {0; 1; 2} - x0 ∈ [0..3229810683] + x0 ∈ [0..3224938487] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [0x1.4000000000000p2 .. 0x1.c000000000000p2] @@ -180,7 +224,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv square ∈ [-0x0.0000000000000p-1022 .. 0x1.fffffc0000020p256] [value:final-states] Values at end of function other: Frama_C_entropy_source ∈ [--..--] - i ∈ [-0x1.05fff60000000p2 .. 0x1.6a3b040000000p1] + i ∈ [-0x1.714fee0000000p1 .. 0x1.71c0040000000p1] s ∈ [-0x1.0a00000000000p7 .. 0x1.1c00000000000p7] zf ∈ [-0x1.12fffc0000000p4 .. 0x1.12fffc0000000p4] s2 ∈ [-0x1.0a00000000000p8 .. 0x1.1c00000000000p8] @@ -203,7 +247,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv r1 ∈ [0x1.4000000000000p2 .. 0x1.cffffe0000000p2] r2 ∈ [0x1.4000000000000p2 .. 0x1.c0fffe0000000p2] d ∈ [0x1.4000000000000p2 .. 0x1.c000000000000p2] - i ∈ [-0x1.05fff60000000p2 .. 0x1.6a3b040000000p1] + i ∈ [-0x1.714fee0000000p1 .. 0x1.71c0040000000p1] s ∈ [-0x1.0a00000000000p7 .. 0x1.1c00000000000p7] zf ∈ [-0x1.12fffc0000000p4 .. 0x1.12fffc0000000p4] s2 ∈ [-0x1.0a00000000000p8 .. 0x1.1c00000000000p8] @@ -218,8 +262,13 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function access_bits: rbits1 ∈ {0; 1; 2} - x0 ∈ [0..3229810683] + x0 ∈ [0..3224938487] __retres ∈ {0; 1} +[value:final-states] Values at end of function garbled: + a_0 ∈ + {{ garbled mix of &{x_0} + (origin: Arithmetic {tests/float/nonlin.c:87}) }} + f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] [value:final-states] Values at end of function nonlin_f: Frama_C_entropy_source ∈ [--..--] a ∈ [5. .. 7.] @@ -234,7 +283,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv square ∈ [-0. .. 2.31584150868e+77] [value:final-states] Values at end of function other: Frama_C_entropy_source ∈ [--..--] - i ∈ [-4.09374761581 .. 2.82992601395] + i ∈ [-2.88525176048 .. 2.88867235184] s ∈ [-133. .. 142.] zf ∈ [-17.1874961853 .. 17.1874961853] s2 ∈ [-266. .. 284.] @@ -257,7 +306,7 @@ tests/float/nonlin.c:81:[value:nonlin] non-linear '(double)v2 * (double)v2', lv r1 ∈ [5. .. 7.24999952316] r2 ∈ [5. .. 7.01562452316] d ∈ [5. .. 7.] - i ∈ [-4.09374761581 .. 2.82992601395] + i ∈ [-2.88525176048 .. 2.88867235184] s ∈ [-133. .. 142.] zf ∈ [-17.1874961853 .. 17.1874961853] s2 ∈ [-266. .. 284.] diff --git a/tests/float/oracle/parse.res.oracle b/tests/float/oracle/parse.res.oracle index e03b608cea1b0d236eb0613594c11c38b2e1fa56..fd59e6bc0346b07102b96f47c11e99bfcbdb6c9b 100644 --- a/tests/float/oracle/parse.res.oracle +++ b/tests/float/oracle/parse.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/parse.i (no preprocessing) tests/float/parse.i:25:[kernel] warning: Floating-point constant 0.00000000000000000000000000000000000000001e310 is not represented exactly. Will use 0x1.83a99c3ec7eb0p893 tests/float/parse.i:30:[kernel] warning: Floating-point constant 0.0000001E9999999999999999999 is not represented exactly. Will use inf @@ -7,10 +6,10 @@ tests/float/parse.i:30:[kernel] warning: Floating-point constant 0.0000001E99999 [value] Initial state computed [value:initial-state] Values of globals at initialization v ∈ [--..--] -[value] Called Frama_C_show_each({0}, {{ "reached" }}) -[value] Called Frama_C_show_each({0}, {{ "reached" }}) -[value] Called Frama_C_show_each({0}, {0}, {{ "reached" }}) -[value] Called Frama_C_show_each({0x1.83a99c3ec7eb0p893}, {{ "reached" }}) +tests/float/parse.i:10:[value] Frama_C_show_each: {0}, {{ "reached" }} +tests/float/parse.i:15:[value] Frama_C_show_each: {0}, {{ "reached" }} +tests/float/parse.i:21:[value] Frama_C_show_each: {0}, {0}, {{ "reached" }} +tests/float/parse.i:26:[value] Frama_C_show_each: {0x1.83a99c3ec7eb0p893}, {{ "reached" }} tests/float/parse.i:30:[value] warning: non-finite double value. assert \is_finite(0.0000001E9999999999999999999); [value] Recording results for main [value] done for function main diff --git a/tests/float/oracle/precise_cos_sin.res.oracle b/tests/float/oracle/precise_cos_sin.res.oracle index 233cae0f75e60930acd9ede636b01cecc2b7e962..15fac953d2e31f80f5b7e9793169060c7f4b06e8 100644 --- a/tests/float/oracle/precise_cos_sin.res.oracle +++ b/tests/float/oracle/precise_cos_sin.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/precise_cos_sin.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,61 +7,67 @@ [value] computing for function Frama_C_float_interval <- main. Called from tests/float/precise_cos_sin.c:12. [value] using specification for function Frama_C_float_interval -share/libc/__fc_builtin.h:143:[value] function Frama_C_float_interval: precondition got status valid. -share/libc/__fc_builtin.h:144:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:149:[value] function Frama_C_float_interval: precondition got status valid. +share/libc/__fc_builtin.h:150:[value] function Frama_C_float_interval: precondition got status valid. [value] Done for function Frama_C_float_interval -[value] Called Frama_C_show_each_s([-1.6214298009872436*2^-3 .. 1.4685190916061401*2^-5]) -[value] Called Frama_C_show_each_c([-1.0000000000000000 .. -1.9584906101226807*2^-1]) -[value] Called Frama_C_show_each_s([-1.7545883655548095*2^-2 .. -1.6214298009872436*2^-3]) -[value] Called Frama_C_show_each_c([-1.9584906101226807*2^-1 .. -1.7973188161849975*2^-1]) -[value] Called Frama_C_show_each_s([-1.2946850061416626*2^-1 .. -1.7545883655548095*2^-2]) -[value] Called Frama_C_show_each_c([-1.7973188161849975*2^-1 .. -1.5243984460830688*2^-1]) -[value] Called Frama_C_show_each_s([-1.6315786838531494*2^-1 .. -1.2946850061416626*2^-1]) -[value] Called Frama_C_show_each_c([-1.5243984460830688*2^-1 .. -1.1566983461380005*2^-1]) -[value] Called Frama_C_show_each_s([-1.8670285940170288*2^-1 .. -1.6315786838531494*2^-1]) -[value] Called Frama_C_show_each_c([-1.1566983461380005*2^-1 .. -1.4341608285903930*2^-2]) -[value] Called Frama_C_show_each_s([-1.9863957166671753*2^-1 .. -1.8670285940170288*2^-1]) -[value] Called Frama_C_show_each_c([-1.4341608285903930*2^-2 .. -1.8630230426788330*2^-4]) -[value] Called Frama_C_show_each_s([-1.0000000000000000 .. -1.9822584390640259*2^-1]) -[value] Called Frama_C_show_each_c([-1.8630230426788330*2^-4 .. 1.0632156133651733*2^-3]) -[value] Called Frama_C_show_each_s([-1.9822584390640259*2^-1 .. -1.8548737764358520*2^-1]) -[value] Called Frama_C_show_each_c([1.0632156133651733*2^-3 .. 1.4959185123443604*2^-2]) -[value] Called Frama_C_show_each_s([-1.8548737764358520*2^-1 .. -1.6121622323989868*2^-1]) -[value] Called Frama_C_show_each_c([1.4959185123443604*2^-2 .. 1.1836102008819580*2^-1]) -[value] Called Frama_C_show_each_s([-1.6121622323989868*2^-1 .. -1.2692141532897949*2^-1]) -[value] Called Frama_C_show_each_c([1.1836102008819580*2^-1 .. 1.5456699132919311*2^-1]) -[value] Called Frama_C_show_each_s([-1.2692141532897949*2^-1 .. -1.6947050094604492*2^-2]) -[value] Called Frama_C_show_each_c([1.5456699132919311*2^-1 .. 1.8116273880004883*2^-1]) -[value] Called Frama_C_show_each_s([-1.6947050094604492*2^-2 .. -1.4912263154983521*2^-3]) -[value] Called Frama_C_show_each_c([1.8116273880004883*2^-1 .. 1.9649466276168823*2^-1]) -[value] Called Frama_C_show_each_s([-1.4912263154983521*2^-3 .. 1.9986981153488159*2^-5]) -[value] Called Frama_C_show_each_c([1.9649466276168823*2^-1 .. 1.0000000000000000]) -[value] Called Frama_C_show_each_s([1.9986981153488159*2^-5 .. 1.2297540903091430*2^-2]) -[value] Called Frama_C_show_each_c([1.9031358957290649*2^-1 .. 1.9960950613021851*2^-1]) -[value] Called Frama_C_show_each_s([1.2297540903091430*2^-2 .. 1.0666053295135498*2^-1]) -[value] Called Frama_C_show_each_c([1.6918489933013916*2^-1 .. 1.9031358957290649*2^-1]) -[value] Called Frama_C_show_each_s([1.0666053295135498*2^-1 .. 1.4520173072814941*2^-1]) -[value] Called Frama_C_show_each_c([1.3753710985183716*2^-1 .. 1.6918489933013916*2^-1]) -[value] Called Frama_C_show_each_s([1.4520173072814941*2^-1 .. 1.7471498250961303*2^-1]) -[value] Called Frama_C_show_each_c([1.9467586278915405*2^-2 .. 1.3753710985183716*2^-1]) -[value] Called Frama_C_show_each_s([1.7471498250961303*2^-1 .. 1.9336531162261963*2^-1]) -[value] Called Frama_C_show_each_c([1.0217350721359252*2^-2 .. 1.9467586278915405*2^-2]) -[value] Called Frama_C_show_each_s([1.9336531162261963*2^-1 .. 1.9999312162399292*2^-1]) -[value] Called Frama_C_show_each_c([1.0619176626205444*2^-7 .. 1.0217350721359252*2^-2]) -[value] Called Frama_C_show_each_s([1.9418631792068481*2^-1 .. 1.0000000000000000]) -[value] Called Frama_C_show_each_c([-1.9148570299148559*2^-3 .. 1.0619176626205444*2^-7]) -[value] Called Frama_C_show_each_s([1.7630596160888672*2^-1 .. 1.9418631792068481*2^-1]) -[value] Called Frama_C_show_each_c([-1.8885136842727661*2^-2 .. -1.9148570299148559*2^-3]) -[value] Called Frama_C_show_each_s([1.4746373891830444*2^-1 .. 1.7630596160888672*2^-1]) -[value] Called Frama_C_show_each_c([-1.3510900735855102*2^-1 .. -1.8885136842727661*2^-2]) -[value] Called Frama_C_show_each_s([1.0945295095443725*2^-1 .. 1.4746373891830444*2^-1]) -[value] Called Frama_C_show_each_c([-1.6739190816879272*2^-1 .. -1.3510900735855102*2^-1]) -[value] Called Frama_C_show_each_s([1.2927380800247192*2^-2 .. 1.0945295095443725*2^-1]) -[value] Called Frama_C_show_each_c([-1.8926719427108764*2^-1 .. -1.6739190816879272*2^-1]) -[value] Called Frama_C_show_each_s([1.2641634941101074*2^-4 .. 1.2927380800247192*2^-2]) -[value] Called Frama_C_show_each_c([-1.9937475919723511*2^-1 .. -1.8926719427108764*2^-1]) -[value] Called Frama_C_show_each_s([-1.4685190916061401*2^-5 .. 1.2641634941101074*2^-4]) -[value] Called Frama_C_show_each_c([-1.0000000000000000 .. -1.9937475919723511*2^-1]) +tests/float/precise_cos_sin.c:15:[kernel] warning: Neither code nor specification for function Frama_C_sin, generating default assigns from the prototype +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.6214298009872436*2^-3 .. 1.4685190916061401*2^-5] +tests/float/precise_cos_sin.c:16:[kernel] warning: Neither code nor specification for function Frama_C_cos, generating default assigns from the prototype +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.0000000000000000 .. -1.9584906101226807*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.7545883655548095*2^-2 .. -1.6214298009872436*2^-3] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.9584906101226807*2^-1 .. -1.7973188161849975*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.2946850061416626*2^-1 .. -1.7545883655548095*2^-2] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.7973188161849975*2^-1 .. -1.5243984460830688*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.6315786838531494*2^-1 .. -1.2946850061416626*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.5243984460830688*2^-1 .. -1.1566983461380005*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.8670285940170288*2^-1 .. -1.6315786838531494*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.1566983461380005*2^-1 .. -1.4341608285903930*2^-2] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.9863957166671753*2^-1 .. -1.8670285940170288*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.4341608285903930*2^-2 .. -1.8630230426788330*2^-4] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.0000000000000000 .. -1.9822584390640259*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.8630230426788330*2^-4 .. 1.0632156133651733*2^-3] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.9822584390640259*2^-1 .. -1.8548737764358520*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.0632156133651733*2^-3 .. 1.4959185123443604*2^-2] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.8548737764358520*2^-1 .. -1.6121622323989868*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.4959185123443604*2^-2 .. 1.1836102008819580*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.6121622323989868*2^-1 .. -1.2692141532897949*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.1836102008819580*2^-1 .. 1.5456699132919311*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.2692141532897949*2^-1 .. -1.6947050094604492*2^-2] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.5456699132919311*2^-1 .. 1.8116273880004883*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.6947050094604492*2^-2 .. -1.4912263154983521*2^-3] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.8116273880004883*2^-1 .. 1.9649466276168823*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.4912263154983521*2^-3 .. 1.9986981153488159*2^-5] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.9649466276168823*2^-1 .. 1.0000000000000000] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.9986981153488159*2^-5 .. 1.2297540903091430*2^-2] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.9031358957290649*2^-1 .. 1.9960950613021851*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.2297540903091430*2^-2 .. 1.0666053295135498*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.6918489933013916*2^-1 .. 1.9031358957290649*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.0666053295135498*2^-1 .. 1.4520173072814941*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.3753710985183716*2^-1 .. 1.6918489933013916*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.4520173072814941*2^-1 .. 1.7471498250961303*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.9467586278915405*2^-2 .. 1.3753710985183716*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.7471498250961303*2^-1 .. 1.9336531162261963*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.0217350721359252*2^-2 .. 1.9467586278915405*2^-2] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.9336531162261963*2^-1 .. 1.9999312162399292*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [1.0619176626205444*2^-7 .. 1.0217350721359252*2^-2] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.9418631792068481*2^-1 .. 1.0000000000000000] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.9148570299148559*2^-3 .. 1.0619176626205444*2^-7] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.7630596160888672*2^-1 .. 1.9418631792068481*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.8885136842727661*2^-2 .. -1.9148570299148559*2^-3] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.4746373891830444*2^-1 .. 1.7630596160888672*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.3510900735855102*2^-1 .. -1.8885136842727661*2^-2] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.0945295095443725*2^-1 .. 1.4746373891830444*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.6739190816879272*2^-1 .. -1.3510900735855102*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.2927380800247192*2^-2 .. 1.0945295095443725*2^-1] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.8926719427108764*2^-1 .. -1.6739190816879272*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [1.2641634941101074*2^-4 .. 1.2927380800247192*2^-2] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.9937475919723511*2^-1 .. -1.8926719427108764*2^-1] +tests/float/precise_cos_sin.c:15:[value] Frama_C_show_each_s: [-1.4685190916061401*2^-5 .. 1.2641634941101074*2^-4] +tests/float/precise_cos_sin.c:16:[value] Frama_C_show_each_c: [-1.0000000000000000 .. -1.9937475919723511*2^-1] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + Frama_C_entropy_source ∈ [--..--] + f ∈ [3.1875002384185791 .. 3.4375000000000000] + __retres ∈ {0} diff --git a/tests/float/oracle/round10d.0.res.oracle b/tests/float/oracle/round10d.0.res.oracle index 24ec6874e85a16abb58275ba24f43c59d52047d5..f99b888fdde3628542e5910b7d9b8cf33eeda897 100644 --- a/tests/float/oracle/round10d.0.res.oracle +++ b/tests/float/oracle/round10d.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/round10d.i (no preprocessing) tests/float/round10d.i:9:[kernel] warning: Floating-point constant 0.1 is not represented exactly. Will use 0x1.999999999999ap-4. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -6,17 +5,17 @@ tests/float/round10d.i:9:[kernel] warning: Floating-point constant 0.1 is not re [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each_dixieme({1.6000000000000000*2^-4}) -[value] Called Frama_C_show_each_t({1.6000000000000000*2^-4}) -[value] Called Frama_C_show_each_t({1.6000000000000000*2^-3}) -[value] Called Frama_C_show_each_t({1.2000000000000001*2^-2}) -[value] Called Frama_C_show_each_t({1.6000000000000000*2^-2}) -[value] Called Frama_C_show_each_t({1.0000000000000000*2^-1}) -[value] Called Frama_C_show_each_t({1.1999999999999999*2^-1}) -[value] Called Frama_C_show_each_t({1.3999999999999999*2^-1}) -[value] Called Frama_C_show_each_t({1.5999999999999998*2^-1}) -[value] Called Frama_C_show_each_t({1.7999999999999998*2^-1}) -[value] Called Frama_C_show_each_t({1.9999999999999998*2^-1}) +tests/float/round10d.i:9:[value] Frama_C_show_each_dixieme: {1.6000000000000000*2^-4} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.6000000000000000*2^-4} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.6000000000000000*2^-3} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.2000000000000001*2^-2} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.6000000000000000*2^-2} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.0000000000000000*2^-1} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.1999999999999999*2^-1} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.3999999999999999*2^-1} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.5999999999999998*2^-1} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.7999999999999998*2^-1} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.9999999999999998*2^-1} tests/float/round10d.i:11:[value] entering loop for the first time tests/float/round10d.i:16:[value] warning: assertion got status invalid (stopping propagation). [value] Recording results for main diff --git a/tests/float/oracle/round10d.1.res.oracle b/tests/float/oracle/round10d.1.res.oracle index aed555a508b0f5d9233154679f92e6a6d1cceee2..4d37ed7f6227b0e43866da3326a23761c1b3f8a8 100644 --- a/tests/float/oracle/round10d.1.res.oracle +++ b/tests/float/oracle/round10d.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/round10d.i (no preprocessing) tests/float/round10d.i:9:[kernel] warning: Floating-point constant 0.1 is not represented exactly. Will use 0x1.999999999999ap-4. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -6,17 +5,17 @@ tests/float/round10d.i:9:[kernel] warning: Floating-point constant 0.1 is not re [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each_dixieme({1.6000000000000000*2^-4}) -[value] Called Frama_C_show_each_t({1.6000000000000000*2^-4}) -[value] Called Frama_C_show_each_t({1.6000000000000000*2^-3}) -[value] Called Frama_C_show_each_t([1.1999999999999999*2^-2 .. 1.2000000000000001*2^-2]) -[value] Called Frama_C_show_each_t([1.5999999999999998*2^-2 .. 1.6000000000000003*2^-2]) -[value] Called Frama_C_show_each_t([1.9999999999999998*2^-2 .. 1.0000000000000002*2^-1]) -[value] Called Frama_C_show_each_t([1.1999999999999997*2^-1 .. 1.2000000000000004*2^-1]) -[value] Called Frama_C_show_each_t([1.3999999999999997*2^-1 .. 1.4000000000000006*2^-1]) -[value] Called Frama_C_show_each_t([1.5999999999999996*2^-1 .. 1.6000000000000007*2^-1]) -[value] Called Frama_C_show_each_t([1.7999999999999996*2^-1 .. 1.8000000000000009*2^-1]) -[value] Called Frama_C_show_each_t([1.9999999999999996*2^-1 .. 1.0000000000000006]) +tests/float/round10d.i:9:[value] Frama_C_show_each_dixieme: {1.6000000000000000*2^-4} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.6000000000000000*2^-4} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: {1.6000000000000000*2^-3} +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.1999999999999999*2^-2 .. 1.2000000000000001*2^-2] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.5999999999999998*2^-2 .. 1.6000000000000003*2^-2] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.9999999999999998*2^-2 .. 1.0000000000000002*2^-1] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.1999999999999997*2^-1 .. 1.2000000000000004*2^-1] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.3999999999999997*2^-1 .. 1.4000000000000006*2^-1] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.5999999999999996*2^-1 .. 1.6000000000000007*2^-1] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.7999999999999996*2^-1 .. 1.8000000000000009*2^-1] +tests/float/round10d.i:14:[value] Frama_C_show_each_t: [1.9999999999999996*2^-1 .. 1.0000000000000006] tests/float/round10d.i:11:[value] entering loop for the first time tests/float/round10d.i:16:[value] warning: assertion got status unknown. [value] Recording results for main diff --git a/tests/float/oracle/s.0.res.oracle b/tests/float/oracle/s.0.res.oracle index 8e0e24021f6d5b713547fcf8f126b79036e30889..68b7acadcd2b37083918c4b675e4174fdd45db55 100644 --- a/tests/float/oracle/s.0.res.oracle +++ b/tests/float/oracle/s.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/s.i (no preprocessing) tests/float/s.i:18:[kernel] warning: Floating-point constant 1.882f is not represented exactly. Will use 0x1.e1cac00000000p0. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main diff --git a/tests/float/oracle/s.1.res.oracle b/tests/float/oracle/s.1.res.oracle index 192c26c2be7f67c933c5974832b2fdea9e747490..81687a1492d6d5e540eced6804ad5241ac9967f8 100644 --- a/tests/float/oracle/s.1.res.oracle +++ b/tests/float/oracle/s.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/s.i (no preprocessing) tests/float/s.i:18:[kernel] warning: Floating-point constant 1.882f is not represented exactly. Will use 0x1.e1cac00000000p0. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main diff --git a/tests/float/oracle/some.0.res.oracle b/tests/float/oracle/some.0.res.oracle index 6a7bcd98a9034059089939ffa23006ff0061bbe7..96e3f1aa9c65be0300086fa88d9cb777ef015155 100644 --- a/tests/float/oracle/some.0.res.oracle +++ b/tests/float/oracle/some.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/some.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -12,7 +11,8 @@ [value] Semantic level unrolling superposing up to 30 states [value] Semantic level unrolling superposing up to 40 states [value] Semantic level unrolling superposing up to 50 states -[value] DUMPING STATE of file tests/float/some.c line 16 +tests/float/some.c:16:[value] Frama_C_dump_each: + # Cvalue domain: t[0] ∈ {1.0000000000000000} [1] ∈ {1.5000000000000000} [2] ∈ {1.7500000000000000} @@ -69,7 +69,7 @@ [53..54] ∈ {2.0000000000000000} y ∈ {1.0000000000000000*2^-55} i ∈ {55} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/some.1.res.oracle b/tests/float/oracle/some.1.res.oracle index 93cff5497130e6128e77d7947349c626dc193bdc..779b48d5f1f92ad7e8ff8897fbce3e7b988b5b87 100644 --- a/tests/float/oracle/some.1.res.oracle +++ b/tests/float/oracle/some.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/some.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,7 +6,8 @@ t[0] ∈ {1.0000000000000000} [1..25] ∈ {0} y ∈ {1.0000000000000000*2^-1} -[value] DUMPING STATE of file tests/float/some.c line 16 +tests/float/some.c:16:[value] Frama_C_dump_each: + # Cvalue domain: t[0] ∈ {1.0000000000000000} [1] ∈ {1.5000000000000000} [2] ∈ {1.7500000000000000} @@ -35,7 +35,7 @@ [24..25] ∈ {2.0000000000000000} y ∈ {1.0000000000000000*2^-26} i ∈ {26} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/oracle/sqrt.0.res.oracle b/tests/float/oracle/sqrt.0.res.oracle index cff7f7f3461dcb779d630cc39cd559f53c2a2a40..77afd22f0dd1f2a72f6248ea1b160b82423dcf3f 100644 --- a/tests/float/oracle/sqrt.0.res.oracle +++ b/tests/float/oracle/sqrt.0.res.oracle @@ -1,34 +1,35 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/sqrt.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/float/sqrt.i:11:[kernel] warning: Neither code nor specification for function Frama_C_sqrt, generating default assigns from the prototype tests/float/sqrt.i:12:[value] assertion got status valid. tests/float/sqrt.i:14:[value] assertion got status valid. -[value] DUMPING STATE of file tests/float/sqrt.i line 19 +tests/float/sqrt.i:19:[value] Frama_C_dump_each: + # Cvalue domain: k ∈ UNINITIALIZED i ∈ {-0.} j ∈ {-0.} r ∈ UNINITIALIZED p ∈ {{ (unsigned long long *)&j }} c[0..7] ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/float/sqrt.i line 23 + ==END OF DUMP== +tests/float/sqrt.i:23:[value] Frama_C_dump_each: + # Cvalue domain: k ∈ UNINITIALIZED i ∈ {-0.} j ∈ {-0.} r ∈ {-0x8000000000000000} p ∈ {{ (unsigned long long *)&j }} c[0..7] ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each_long_long({-0x8000000000000000}) -[value] Called Frama_C_show_each_double({-0.}) + ==END OF DUMP== +tests/float/sqrt.i:25:[value] Frama_C_show_each_long_long: {-0x8000000000000000} +tests/float/sqrt.i:26:[value] Frama_C_show_each_double: {-0.} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/float/sqrt.i:11:[kernel] warning: Neither code nor specification for function Frama_C_sqrt, generating default assigns from the prototype [value:final-states] Values at end of function main: k ∈ {8} i ∈ {-0.} diff --git a/tests/float/oracle/sqrt.1.res.oracle b/tests/float/oracle/sqrt.1.res.oracle index 165332df2cde43fdb06d5f30beea0a0f660e530d..945fb9dd04a6bd8e93369ce1c19e896d365c5890 100644 --- a/tests/float/oracle/sqrt.1.res.oracle +++ b/tests/float/oracle/sqrt.1.res.oracle @@ -1,34 +1,35 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/sqrt.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/float/sqrt.i:11:[kernel] warning: Neither code nor specification for function Frama_C_sqrt, generating default assigns from the prototype tests/float/sqrt.i:12:[value] assertion got status valid. tests/float/sqrt.i:14:[value] assertion got status valid. -[value] DUMPING STATE of file tests/float/sqrt.i line 19 +tests/float/sqrt.i:19:[value] Frama_C_dump_each: + # Cvalue domain: k ∈ UNINITIALIZED i ∈ {-0.} j ∈ {-0.} r ∈ UNINITIALIZED p ∈ {{ (unsigned long long *)&j }} c[0..7] ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/float/sqrt.i line 23 + ==END OF DUMP== +tests/float/sqrt.i:23:[value] Frama_C_dump_each: + # Cvalue domain: k ∈ UNINITIALIZED i ∈ {-0.} j ∈ {-0.} r ∈ {-0x8000000000000000} p ∈ {{ (unsigned long long *)&j }} c[0..7] ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each_long_long({-0x8000000000000000}) -[value] Called Frama_C_show_each_double({-0.}) + ==END OF DUMP== +tests/float/sqrt.i:25:[value] Frama_C_show_each_long_long: {-0x8000000000000000} +tests/float/sqrt.i:26:[value] Frama_C_show_each_double: {-0.} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/float/sqrt.i:11:[kernel] warning: Neither code nor specification for function Frama_C_sqrt, generating default assigns from the prototype [value:final-states] Values at end of function main: k ∈ {8} i ∈ {-0.} diff --git a/tests/float/oracle/uninit.res.oracle b/tests/float/oracle/uninit.res.oracle index 839e7049794643b988210f8edc4a84766d1b0e40..9d3962f7160873acafc14c768270ca8d7333d1a1 100644 --- a/tests/float/oracle/uninit.res.oracle +++ b/tests/float/oracle/uninit.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/uninit.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/float/oracle/zero.res.oracle b/tests/float/oracle/zero.res.oracle index 35a9c8286d4d813d03110f2c07cf3ca2657d9100..0f7ba0e324e76b1326082d15b7cef2e129c585ac 100644 --- a/tests/float/oracle/zero.res.oracle +++ b/tests/float/oracle/zero.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/float/zero.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,12 +5,12 @@ [value:initial-state] Values of globals at initialization tests/float/zero.i:5:[value] warning: function main: precondition got status unknown. -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each_1([1.40129846432e-45 .. 3.40282346639e+38]) -[value] Called Frama_C_show_each_2([-0. .. 0.]) -[value] Called Frama_C_show_each_3([-3.40282346639e+38 .. -1.40129846432e-45]) -[value] Called Frama_C_show_each_4([-0. .. 0.]) +tests/float/zero.i:10:[value] Frama_C_show_each: {1} +tests/float/zero.i:17:[value] Frama_C_show_each: {1} +tests/float/zero.i:23:[value] Frama_C_show_each_1: [1.40129846432e-45 .. 3.40282346639e+38] +tests/float/zero.i:25:[value] Frama_C_show_each_2: [-0. .. 0.] +tests/float/zero.i:29:[value] Frama_C_show_each_3: [-3.40282346639e+38 .. -1.40129846432e-45] +tests/float/zero.i:31:[value] Frama_C_show_each_4: [-0. .. 0.] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -36,12 +35,12 @@ tests/float/zero.i:5:[value] warning: function main: precondition got status unk [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each_1([-0. .. 3.40282346639e+38]) -[value] Called Frama_C_show_each_2([-0. .. 0.]) -[value] Called Frama_C_show_each_3([-3.40282346639e+38 .. 0.]) -[value] Called Frama_C_show_each_4([-0. .. 0.]) +tests/float/zero.i:10:[value] Frama_C_show_each: {1} +tests/float/zero.i:17:[value] Frama_C_show_each: {1} +tests/float/zero.i:23:[value] Frama_C_show_each_1: [-0. .. 3.40282346639e+38] +tests/float/zero.i:25:[value] Frama_C_show_each_2: [-0. .. 0.] +tests/float/zero.i:29:[value] Frama_C_show_each_3: [-3.40282346639e+38 .. 0.] +tests/float/zero.i:31:[value] Frama_C_show_each_4: [-0. .. 0.] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/float/precise_cos_sin.c b/tests/float/precise_cos_sin.c index 880df221f8c36095f3a530ec864939e8061ceb38..fb331c4a921bc50ab896a4c863eeace9a83defa9 100644 --- a/tests/float/precise_cos_sin.c +++ b/tests/float/precise_cos_sin.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -val @VALUECONFIG@ -obviously-terminates -journal-disable -float-normal + OPT: -val @VALUECONFIG@ -slevel 1000 -journal-disable -float-normal */ #include <__fc_builtin.h> diff --git a/tests/idct/diff_apron b/tests/idct/diff_apron index 193498a333000826bdd483c4861acb582918f362..3e6fabf0a50bfb3ff6b9e1336da7d41efa8e43ed 100644 --- a/tests/idct/diff_apron +++ b/tests/idct/diff_apron @@ -1,12 +1,12 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_1180_1990.res.oracle -107c107,110 +106c106,109 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand --- > [value] computing for function IEEE_1180_1990_rand <- IEEE_1180_1990_mkbk <- main. > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -218,221c221,236 +217,220c220,235 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand @@ -28,7 +28,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -262,265c277,292 +261,264c276,291 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand @@ -50,7 +50,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -302,306c329,348 +301,305c328,347 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand @@ -77,14 +77,14 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -319c361,364 +318c360,363 < tests/idct/ieee_1180_1990.c:214:[value] Reusing old results for call to idct --- > [value] computing for function idct <- main. > Called from tests/idct/ieee_1180_1990.c:214. > [value] Recording results for idct > [value] Done for function idct -325,326c370,377 +324,325c369,376 < tests/idct/ieee_1180_1990.c:237:[value] Reusing old results for call to IEEE_1180_1990_idctf < tests/idct/ieee_1180_1990.c:238:[value] Reusing old results for call to idct --- @@ -96,7 +96,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:238. > [value] Recording results for idct > [value] Done for function idct -329,333c380,399 +328,332c379,398 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand @@ -123,7 +123,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -347,351c413,432 +346,350c412,431 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand @@ -150,7 +150,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -365,369c446,465 +364,368c445,464 < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand < tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand @@ -177,7 +177,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:85. > [value] Recording results for IEEE_1180_1990_rand > [value] Done for function IEEE_1180_1990_rand -378,379c474,481 +377,378c473,480 < tests/idct/ieee_1180_1990.c:213:[value] Reusing old results for call to IEEE_1180_1990_idctf < tests/idct/ieee_1180_1990.c:214:[value] Reusing old results for call to idct --- @@ -189,7 +189,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:214. > [value] Recording results for idct > [value] Done for function idct -397,400c499,536 +396,399c498,535 < tests/idct/ieee_1180_1990.c:211:[value] Reusing old results for call to IEEE_1180_1990_mkbk < tests/idct/ieee_1180_1990.c:212:[value] Reusing old results for call to IEEE_1180_1990_dctf < tests/idct/ieee_1180_1990.c:213:[value] Reusing old results for call to IEEE_1180_1990_idctf @@ -233,7 +233,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:214. > [value] Recording results for idct > [value] Done for function idct -418,421c554,591 +417,420c553,590 < tests/idct/ieee_1180_1990.c:211:[value] Reusing old results for call to IEEE_1180_1990_mkbk < tests/idct/ieee_1180_1990.c:212:[value] Reusing old results for call to IEEE_1180_1990_dctf < tests/idct/ieee_1180_1990.c:213:[value] Reusing old results for call to IEEE_1180_1990_idctf @@ -277,7 +277,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:214. > [value] Recording results for idct > [value] Done for function idct -439,442c609,646 +438,441c608,645 < tests/idct/ieee_1180_1990.c:211:[value] Reusing old results for call to IEEE_1180_1990_mkbk < tests/idct/ieee_1180_1990.c:212:[value] Reusing old results for call to IEEE_1180_1990_dctf < tests/idct/ieee_1180_1990.c:213:[value] Reusing old results for call to IEEE_1180_1990_idctf @@ -321,7 +321,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:214. > [value] Recording results for idct > [value] Done for function idct -460,463c664,701 +459,462c663,700 < tests/idct/ieee_1180_1990.c:211:[value] Reusing old results for call to IEEE_1180_1990_mkbk < tests/idct/ieee_1180_1990.c:212:[value] Reusing old results for call to IEEE_1180_1990_dctf < tests/idct/ieee_1180_1990.c:213:[value] Reusing old results for call to IEEE_1180_1990_idctf @@ -365,7 +365,7 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_apron/ieee_11 > Called from tests/idct/ieee_1180_1990.c:214. > [value] Recording results for idct > [value] Done for function idct -481,484c719,756 +480,483c718,755 < tests/idct/ieee_1180_1990.c:211:[value] Reusing old results for call to IEEE_1180_1990_mkbk < tests/idct/ieee_1180_1990.c:212:[value] Reusing old results for call to IEEE_1180_1990_dctf < tests/idct/ieee_1180_1990.c:213:[value] Reusing old results for call to IEEE_1180_1990_idctf diff --git a/tests/idct/diff_bitwise b/tests/idct/diff_bitwise index 850f6b4e3bdc8e495cf8df996ab0711df10cbce5..eae0ded98bd64552a32761b23c0e1e8599a8c021 100644 --- a/tests/idct/diff_bitwise +++ b/tests/idct/diff_bitwise @@ -1,5 +1,5 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_bitwise/ieee_1180_1990.res.oracle -503c503 +502c502 < i ∈ [0..2147483646] --- > i ∈ [0..2147483646],0%2 diff --git a/tests/idct/diff_equalities b/tests/idct/diff_equalities index 8d9d4edb69f402c13cff14c82519a9e78a1dcfb1..b177d60597d2e0a7800b40027acb31e91bfc45d2 100644 --- a/tests/idct/diff_equalities +++ b/tests/idct/diff_equalities @@ -1,55 +1,55 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_equalities/ieee_1180_1990.res.oracle -180a181 +179a180 > tests/idct/ieee_1180_1990.c:219:[value] warning: 2's complement assumed for overflow -182a184 +181a183 > tests/idct/ieee_1180_1990.c:220:[value] warning: 2's complement assumed for overflow -185d186 +184d185 < tests/idct/ieee_1180_1990.c:219:[value] warning: 2's complement assumed for overflow -205a207 +204a206 > tests/idct/ieee_1180_1990.c:243:[value] warning: 2's complement assumed for overflow -207a210 +206a209 > tests/idct/ieee_1180_1990.c:244:[value] warning: 2's complement assumed for overflow -210d212 +209d211 < tests/idct/ieee_1180_1990.c:243:[value] warning: 2's complement assumed for overflow -223a226,227 +222a225,226 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand -233a238 +232a237 > tests/idct/ieee_1180_1990.c:265:[value] warning: 2's complement assumed for overflow -235a241 +234a240 > tests/idct/ieee_1180_1990.c:266:[value] warning: 2's complement assumed for overflow -238d243 +237d242 < tests/idct/ieee_1180_1990.c:265:[value] warning: 2's complement assumed for overflow -249a255 +248a254 > tests/idct/ieee_1180_1990.c:289:[value] warning: 2's complement assumed for overflow -251a258 +250a257 > tests/idct/ieee_1180_1990.c:290:[value] warning: 2's complement assumed for overflow -254d260 +253d259 < tests/idct/ieee_1180_1990.c:289:[value] warning: 2's complement assumed for overflow -267a274,275 +266a273,274 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand -277a286 +276a285 > tests/idct/ieee_1180_1990.c:311:[value] warning: 2's complement assumed for overflow -279a289 +278a288 > tests/idct/ieee_1180_1990.c:312:[value] warning: 2's complement assumed for overflow -282d291 +281d290 < tests/idct/ieee_1180_1990.c:311:[value] warning: 2's complement assumed for overflow -293a303 +292a302 > tests/idct/ieee_1180_1990.c:335:[value] warning: 2's complement assumed for overflow -295a306 +294a305 > tests/idct/ieee_1180_1990.c:336:[value] warning: 2's complement assumed for overflow -298d308 +297d307 < tests/idct/ieee_1180_1990.c:335:[value] warning: 2's complement assumed for overflow -308a319,320 +307a318,319 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand -335a348,349 +334a347,348 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand -353a368,369 +352a367,368 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand -364a381,382 +363a380,381 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand diff --git a/tests/idct/diff_gauges b/tests/idct/diff_gauges index e2f728e474d448bbdbdcc9c115a59f8dcff241b9..3b66ac45bac1208cf53761917fef3d8ce9fed373 100644 --- a/tests/idct/diff_gauges +++ b/tests/idct/diff_gauges @@ -1,8 +1,8 @@ diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_gauges/ieee_1180_1990.res.oracle -110a111,112 +109a110,111 > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand > tests/idct/ieee_1180_1990.c:85:[value] Reusing old results for call to IEEE_1180_1990_rand -484a487,503 +483a486,502 > tests/idct/ieee_1180_1990.c:236:[value] Reusing old results for call to IEEE_1180_1990_dctf > tests/idct/ieee_1180_1990.c:237:[value] Reusing old results for call to IEEE_1180_1990_idctf > tests/idct/ieee_1180_1990.c:238:[value] Reusing old results for call to idct diff --git a/tests/idct/diff_legacy b/tests/idct/diff_legacy deleted file mode 100644 index 7d5d8c435e4d85c8ce749aae01677f90acde7eb7..0000000000000000000000000000000000000000 --- a/tests/idct/diff_legacy +++ /dev/null @@ -1,97 +0,0 @@ -diff tests/idct/oracle/ieee_1180_1990.res.oracle tests/idct/oracle_legacy/ieee_1180_1990.res.oracle -48d47 -< tests/idct/idct.c:163:[value] warning: 2's complement assumed for overflow -49a49 -> tests/idct/idct.c:163:[value] warning: 2's complement assumed for overflow -52d51 -< tests/idct/idct.c:176:[value] warning: 2's complement assumed for overflow -53a53 -> tests/idct/idct.c:176:[value] warning: 2's complement assumed for overflow -172d171 -< tests/idct/idct.c:129:[value] warning: 2's complement assumed for overflow -173a173 -> tests/idct/idct.c:129:[value] warning: 2's complement assumed for overflow -178,179d177 -< tests/idct/ieee_1180_1990.c:218:[value] warning: 2's complement assumed for overflow -< tests/idct/ieee_1180_1990.c:218:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -180a179,180 -> tests/idct/ieee_1180_1990.c:218:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -> tests/idct/ieee_1180_1990.c:218:[value] warning: 2's complement assumed for overflow -203,204d202 -< tests/idct/ieee_1180_1990.c:242:[value] warning: 2's complement assumed for overflow -< tests/idct/ieee_1180_1990.c:242:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -205a204,205 -> tests/idct/ieee_1180_1990.c:242:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -> tests/idct/ieee_1180_1990.c:242:[value] warning: 2's complement assumed for overflow -231,232d230 -< tests/idct/ieee_1180_1990.c:264:[value] warning: 2's complement assumed for overflow -< tests/idct/ieee_1180_1990.c:264:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -233a232,233 -> tests/idct/ieee_1180_1990.c:264:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -> tests/idct/ieee_1180_1990.c:264:[value] warning: 2's complement assumed for overflow -247,248d246 -< tests/idct/ieee_1180_1990.c:288:[value] warning: 2's complement assumed for overflow -< tests/idct/ieee_1180_1990.c:288:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -249a248,249 -> tests/idct/ieee_1180_1990.c:288:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -> tests/idct/ieee_1180_1990.c:288:[value] warning: 2's complement assumed for overflow -275,276d274 -< tests/idct/ieee_1180_1990.c:310:[value] warning: 2's complement assumed for overflow -< tests/idct/ieee_1180_1990.c:310:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -277a276,277 -> tests/idct/ieee_1180_1990.c:310:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -> tests/idct/ieee_1180_1990.c:310:[value] warning: 2's complement assumed for overflow -291,292d290 -< tests/idct/ieee_1180_1990.c:334:[value] warning: 2's complement assumed for overflow -< tests/idct/ieee_1180_1990.c:334:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -293a292,293 -> tests/idct/ieee_1180_1990.c:334:[value] warning: accessing uninitialized left-value. assert \initialized(&m3[j][k]); -> tests/idct/ieee_1180_1990.c:334:[value] warning: 2's complement assumed for overflow -2330c2330 -< assert Value: initialisation: \initialized(&m3[j][k]); ---- -> assert Value: initialisation: \initialized(&m4[j][k]); -2333c2333 -< assert Value: initialisation: \initialized(&m4[j][k]); ---- -> assert Value: initialisation: \initialized(&m3[j][k]); -2342c2342 -< assert Value: initialisation: \initialized(&m3[j][k]); ---- -> assert Value: initialisation: \initialized(&m4[j][k]); -2345c2345 -< assert Value: initialisation: \initialized(&m4[j][k]); ---- -> assert Value: initialisation: \initialized(&m3[j][k]); -2354c2354 -< assert Value: initialisation: \initialized(&m3[j][k]); ---- -> assert Value: initialisation: \initialized(&m4[j][k]); -2357c2357 -< assert Value: initialisation: \initialized(&m4[j][k]); ---- -> assert Value: initialisation: \initialized(&m3[j][k]); -2366c2366 -< assert Value: initialisation: \initialized(&m3[j][k]); ---- -> assert Value: initialisation: \initialized(&m4[j][k]); -2369c2369 -< assert Value: initialisation: \initialized(&m4[j][k]); ---- -> assert Value: initialisation: \initialized(&m3[j][k]); -2378c2378 -< assert Value: initialisation: \initialized(&m3[j][k]); ---- -> assert Value: initialisation: \initialized(&m4[j][k]); -2381c2381 -< assert Value: initialisation: \initialized(&m4[j][k]); ---- -> assert Value: initialisation: \initialized(&m3[j][k]); -2390c2390 -< assert Value: initialisation: \initialized(&m3[j][k]); ---- -> assert Value: initialisation: \initialized(&m4[j][k]); -2393c2393 -< assert Value: initialisation: \initialized(&m4[j][k]); ---- -> assert Value: initialisation: \initialized(&m3[j][k]); diff --git a/tests/idct/oracle/ieee_1180_1990.res.oracle b/tests/idct/oracle/ieee_1180_1990.res.oracle index b6fa59994a930fba642882cd8e82f45d02cde15d..391958bff0c1faed4141394d917602fb3523587e 100644 --- a/tests/idct/oracle/ieee_1180_1990.res.oracle +++ b/tests/idct/oracle/ieee_1180_1990.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/idct/ieee_1180_1990.c (with preprocessing) tests/idct/ieee_1180_1990.c:101:[kernel] warning: Floating-point constant 3.14159265358979323846 is not represented exactly. Will use 0x1.921fb54442d18p1. See documentation for option -warn-decimal-float [kernel] Parsing tests/idct/idct.c (with preprocessing) @@ -60,16 +59,16 @@ tests/idct/idct.c:185:[value] warning: accessing uninitialized left-value. asser tests/idct/ieee_1180_1990.c:189:[value] entering loop for the first time tests/idct/ieee_1180_1990.c:190:[value] entering loop for the first time tests/idct/ieee_1180_1990.c:191:[value] warning: accessing uninitialized left-value. assert \initialized(&m2[i][j]); -[value] computing for function printf <- main. +[value] computing for function printf_va_1 <- main. Called from tests/idct/ieee_1180_1990.c:195. -[value] using specification for function printf -tests/idct/ieee_1180_1990.c:195:[value] function printf: precondition got status valid. -[value] Done for function printf -[value] computing for function printf_0 <- main. +[value] using specification for function printf_va_1 +tests/idct/ieee_1180_1990.c:195:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 +[value] computing for function printf_va_2 <- main. Called from tests/idct/ieee_1180_1990.c:196. -[value] using specification for function printf_0 -tests/idct/ieee_1180_1990.c:196:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 +[value] using specification for function printf_va_2 +tests/idct/ieee_1180_1990.c:196:[value] function printf_va_2: precondition got status valid. +[value] Done for function printf_va_2 tests/idct/ieee_1180_1990.c:202:[value] entering loop for the first time [value] computing for function IEEE_1180_1990_mkbk <- main. Called from tests/idct/ieee_1180_1990.c:211. @@ -587,10 +586,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [from] Computing for function idct [from] Done for function idct [from] Computing for function main -[from] Computing for function printf <-main -[from] Done for function printf -[from] Computing for function printf_0 <-main -[from] Done for function printf_0 +[from] Computing for function printf_va_1 <-main +[from] Done for function printf_va_1 +[from] Computing for function printf_va_2 <-main +[from] Done for function printf_va_2 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: @@ -602,13 +601,13 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over randx FROM randx (and SELF) [from] Function cos: \result FROM x -[from] Function printf: +[from] Function printf_va_1: S___fc_stdout[0].__fc_FILE_data FROM S___fc_stdout[0]; "For all-zero input, the proposed IDCT shall generate all-zero "[bits 0 to 503] (and SELF) \result FROM S___fc_stdout[0]; "For all-zero input, the proposed IDCT shall generate all-zero "[bits 0 to 503] -[from] Function printf_0: +[from] Function printf_va_2: S___fc_stdout[0].__fc_FILE_data FROM S___fc_stdout[0]; "output.\n"[bits 0 to 71] (and SELF) \result FROM S___fc_stdout[0]; "output.\n"[bits 0 to 71] @@ -817,6 +816,9 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Valid ] Axiomatic 'WcsNCmp' axiomatic WcsNCmp by Frama-C kernel. +[ Valid ] Axiomatic 'format_length' + axiomatic format_length + by Frama-C kernel. -------------------------------------------------------------------------------- --- Properties of Function 'remove' @@ -991,10 +993,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'vfprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 150) +[ Extern ] Assigns (file share/libc/stdio.h, line 159) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 150) +[ Extern ] Froms (file share/libc/stdio.h, line 159) assigns *stream \from *(format + (..)), arg; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1005,10 +1007,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'vfscanf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 155) +[ Extern ] Assigns (file share/libc/stdio.h, line 164) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 155) +[ Extern ] Froms (file share/libc/stdio.h, line 164) assigns *stream \from *(format + (..)), *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1019,10 +1021,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'vprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 161) +[ Extern ] Assigns (file share/libc/stdio.h, line 170) assigns *__fc_stdout; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 161) +[ Extern ] Froms (file share/libc/stdio.h, line 170) assigns *__fc_stdout \from arg; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1033,10 +1035,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'vscanf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 165) +[ Extern ] Assigns (file share/libc/stdio.h, line 174) assigns *__fc_stdin; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 165) +[ Extern ] Froms (file share/libc/stdio.h, line 174) assigns *__fc_stdin \from *(format + (..)); Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1047,10 +1049,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'vsnprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 170) +[ Extern ] Assigns (file share/libc/stdio.h, line 179) assigns *(s + (0 .. n - 1)); Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 170) +[ Extern ] Froms (file share/libc/stdio.h, line 179) assigns *(s + (0 .. n - 1)) \from *(format + (..)), arg; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1061,10 +1063,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'vsprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 176) +[ Extern ] Assigns (file share/libc/stdio.h, line 185) assigns *(s + (0 ..)); Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 176) +[ Extern ] Froms (file share/libc/stdio.h, line 185) assigns *(s + (0 ..)) \from *(format + (..)), arg; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1075,7 +1077,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fgetc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 187) +[ Extern ] Assigns (file share/libc/stdio.h, line 196) assigns *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1086,19 +1088,19 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fgets' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 193) +[ Extern ] Post-condition (file share/libc/stdio.h, line 202) ensures \result ≡ \null ∨ \result ≡ \old(s) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 191) +[ Extern ] Assigns (file share/libc/stdio.h, line 200) assigns *(s + (0 .. n - 1)), *stream, \result; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 191) +[ Extern ] Froms (file share/libc/stdio.h, line 200) assigns *(s + (0 .. n - 1)) \from *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 191) +[ Extern ] Froms (file share/libc/stdio.h, line 200) assigns *stream \from *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 192) +[ Extern ] Froms (file share/libc/stdio.h, line 201) assigns \result \from s, n, *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1109,7 +1111,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fputc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 198) +[ Extern ] Assigns (file share/libc/stdio.h, line 207) assigns *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1120,10 +1122,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fputs' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 201) +[ Extern ] Assigns (file share/libc/stdio.h, line 210) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 201) +[ Extern ] Froms (file share/libc/stdio.h, line 210) assigns *stream \from *(s + (..)); Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1134,13 +1136,13 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'getc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 205) +[ Extern ] Assigns (file share/libc/stdio.h, line 214) assigns \result, *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 205) +[ Extern ] Froms (file share/libc/stdio.h, line 214) assigns \result \from *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 205) +[ Extern ] Froms (file share/libc/stdio.h, line 214) assigns *stream \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1154,7 +1156,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 208) +[ Extern ] Froms (file share/libc/stdio.h, line 217) assigns \result \from *__fc_stdin; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1165,16 +1167,16 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'gets' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 213) +[ Extern ] Post-condition (file share/libc/stdio.h, line 222) ensures \result ≡ \old(s) ∨ \result ≡ \null Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 211) +[ Extern ] Assigns (file share/libc/stdio.h, line 220) assigns *(s + (..)), \result; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 211) +[ Extern ] Froms (file share/libc/stdio.h, line 220) assigns *(s + (..)) \from *__fc_stdin; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 212) +[ Extern ] Froms (file share/libc/stdio.h, line 221) assigns \result \from s, __fc_stdin; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1185,10 +1187,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'putc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 217) +[ Extern ] Assigns (file share/libc/stdio.h, line 226) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 217) +[ Extern ] Froms (file share/libc/stdio.h, line 226) assigns *stream \from c; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1199,10 +1201,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'putchar' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 220) +[ Extern ] Assigns (file share/libc/stdio.h, line 229) assigns *__fc_stdout; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 220) +[ Extern ] Froms (file share/libc/stdio.h, line 229) assigns *__fc_stdout \from c; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1213,10 +1215,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'puts' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 223) +[ Extern ] Assigns (file share/libc/stdio.h, line 232) assigns *__fc_stdout; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 223) +[ Extern ] Froms (file share/libc/stdio.h, line 232) assigns *__fc_stdout \from *(s + (..)); Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1227,10 +1229,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'ungetc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 226) +[ Extern ] Assigns (file share/libc/stdio.h, line 235) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 226) +[ Extern ] Froms (file share/libc/stdio.h, line 235) assigns *stream \from c; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1241,21 +1243,21 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fread' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 234) +[ Extern ] Post-condition (file share/libc/stdio.h, line 243) ensures \result ≤ \old(nmemb) Unverifiable but considered Valid. -[ Extern ] Post-condition (file share/libc/stdio.h, line 235) +[ Extern ] Post-condition (file share/libc/stdio.h, line 244) ensures \initialized((char *)\old(ptr) + (0 .. \result * \old(size) - 1)) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 232) +[ Extern ] Assigns (file share/libc/stdio.h, line 241) assigns *((char *)ptr + (0 .. nmemb * size - 1)), \result; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 232) +[ Extern ] Froms (file share/libc/stdio.h, line 241) assigns *((char *)ptr + (0 .. nmemb * size - 1)) \from size, nmemb, *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 233) +[ Extern ] Froms (file share/libc/stdio.h, line 242) assigns \result \from size, *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1266,16 +1268,16 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fwrite' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 246) +[ Extern ] Post-condition (file share/libc/stdio.h, line 255) ensures \result ≤ \old(nmemb) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 245) +[ Extern ] Assigns (file share/libc/stdio.h, line 254) assigns *stream, \result; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 245) +[ Extern ] Froms (file share/libc/stdio.h, line 254) assigns *stream \from *((char *)ptr + (0 .. nmemb * size - 1)); Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 245) +[ Extern ] Froms (file share/libc/stdio.h, line 254) assigns \result \from *((char *)ptr + (0 .. nmemb * size - 1)); Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1286,10 +1288,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fgetpos' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 253) +[ Extern ] Assigns (file share/libc/stdio.h, line 262) assigns *pos; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 253) +[ Extern ] Froms (file share/libc/stdio.h, line 262) assigns *pos \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1300,11 +1302,22 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fseek' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 257) - assigns *stream, __fc_errno; +[ Extern ] Assigns (file share/libc/stdio.h, line 269) + assigns *stream, \result, __fc_errno; + Unverifiable but considered Valid. +[ Extern ] Froms (file share/libc/stdio.h, line 269) + assigns *stream + \from *stream, (indirect: offset), (indirect: whence); Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 257) - assigns *stream \from offset, whence; +[ Extern ] Froms (file share/libc/stdio.h, line 270) + assigns \result + \from (indirect: *stream), (indirect: offset), + (indirect: whence); + Unverifiable but considered Valid. +[ Extern ] Froms (file share/libc/stdio.h, line 270) + assigns __fc_errno + \from (indirect: *stream), (indirect: offset), + (indirect: whence); Unverifiable but considered Valid. [ Valid ] Default behavior default behavior @@ -1314,10 +1327,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'fsetpos' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 261) +[ Extern ] Assigns (file share/libc/stdio.h, line 274) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 261) +[ Extern ] Froms (file share/libc/stdio.h, line 274) assigns *stream \from *pos; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1328,13 +1341,13 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'ftell' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 264) +[ Extern ] Assigns (file share/libc/stdio.h, line 277) assigns \result, __fc_errno; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 264) +[ Extern ] Froms (file share/libc/stdio.h, line 277) assigns \result \from *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 264) +[ Extern ] Froms (file share/libc/stdio.h, line 277) assigns __fc_errno \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1345,10 +1358,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'rewind' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 267) +[ Extern ] Assigns (file share/libc/stdio.h, line 280) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 267) +[ Extern ] Froms (file share/libc/stdio.h, line 280) assigns *stream \from \nothing; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1359,10 +1372,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'clearerr' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 270) +[ Extern ] Assigns (file share/libc/stdio.h, line 283) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 270) +[ Extern ] Froms (file share/libc/stdio.h, line 283) assigns *stream \from \nothing; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1376,7 +1389,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 273) +[ Extern ] Froms (file share/libc/stdio.h, line 286) assigns \result \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1390,7 +1403,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 276) +[ Extern ] Froms (file share/libc/stdio.h, line 289) assigns \result \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1401,10 +1414,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'flockfile' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 279) +[ Extern ] Assigns (file share/libc/stdio.h, line 292) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 279) +[ Extern ] Froms (file share/libc/stdio.h, line 292) assigns *stream \from \nothing; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1415,10 +1428,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'funlockfile' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 282) +[ Extern ] Assigns (file share/libc/stdio.h, line 295) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 282) +[ Extern ] Froms (file share/libc/stdio.h, line 295) assigns *stream \from \nothing; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1429,13 +1442,13 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'ftrylockfile' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 285) +[ Extern ] Assigns (file share/libc/stdio.h, line 298) assigns \result, *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 285) +[ Extern ] Froms (file share/libc/stdio.h, line 298) assigns \result \from \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 285) +[ Extern ] Froms (file share/libc/stdio.h, line 298) assigns *stream \from \nothing; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1449,7 +1462,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 288) +[ Extern ] Froms (file share/libc/stdio.h, line 301) assigns \result \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1460,10 +1473,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'perror' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 291) +[ Extern ] Assigns (file share/libc/stdio.h, line 304) assigns __fc_stdout; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 291) +[ Extern ] Froms (file share/libc/stdio.h, line 304) assigns __fc_stdout \from __fc_errno, *(s + (..)); Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1474,13 +1487,13 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'getc_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 294) +[ Extern ] Assigns (file share/libc/stdio.h, line 307) assigns \result, *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 294) +[ Extern ] Froms (file share/libc/stdio.h, line 307) assigns \result \from *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 294) +[ Extern ] Froms (file share/libc/stdio.h, line 307) assigns *stream \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1494,7 +1507,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 296) +[ Extern ] Froms (file share/libc/stdio.h, line 309) assigns \result \from *__fc_stdin; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1505,10 +1518,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'putc_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 298) +[ Extern ] Assigns (file share/libc/stdio.h, line 311) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 298) +[ Extern ] Froms (file share/libc/stdio.h, line 311) assigns *stream \from c; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1519,10 +1532,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'putchar_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 300) +[ Extern ] Assigns (file share/libc/stdio.h, line 313) assigns *__fc_stdout; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 300) +[ Extern ] Froms (file share/libc/stdio.h, line 313) assigns *__fc_stdout \from c; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1533,10 +1546,10 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over --- Properties of Function 'clearerr_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 303) +[ Extern ] Assigns (file share/libc/stdio.h, line 316) assigns *stream; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 303) +[ Extern ] Froms (file share/libc/stdio.h, line 316) assigns *stream \from \nothing; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1550,7 +1563,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 305) +[ Extern ] Froms (file share/libc/stdio.h, line 318) assigns \result \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1564,7 +1577,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 307) +[ Extern ] Froms (file share/libc/stdio.h, line 320) assigns \result \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -1578,7 +1591,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over [ Extern ] Assigns nothing assigns \nothing; Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 309) +[ Extern ] Froms (file share/libc/stdio.h, line 322) assigns \result \from *stream; Unverifiable but considered Valid. [ Valid ] Default behavior @@ -2420,19 +2433,19 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over assert Value: initialisation: \initialized(&res[i].pme[j][k]); By RedundantAlarms, with pending: - Assertion 'Value,initialisation' (file tests/idct/ieee_1180_1990.c, line 368) -[ Valid ] Instance of 'Pre-condition (file tests/idct/ieee_1180_1990.c, line 195)' at call 'printf' (file tests/idct/ieee_1180_1990.c, line 195) +[ Valid ] Instance of 'Pre-condition (file tests/idct/ieee_1180_1990.c, line 195)' at call 'printf_va_1' (file tests/idct/ieee_1180_1990.c, line 195) status of 'requires - valid_read_string(format)' of printf at stmt 611 + valid_read_string(format)' of printf_va_1 at stmt 238 by Value. -[ Valid ] Instance of 'Pre-condition (file tests/idct/ieee_1180_1990.c, line 196)' at call 'printf_0' (file tests/idct/ieee_1180_1990.c, line 196) +[ Valid ] Instance of 'Pre-condition (file tests/idct/ieee_1180_1990.c, line 196)' at call 'printf_va_2' (file tests/idct/ieee_1180_1990.c, line 196) status of 'requires - valid_read_string(format)' of printf_0 at stmt 612 + valid_read_string(format)' of printf_va_2 at stmt 239 by Value. -------------------------------------------------------------------------------- ---- Properties of Function 'printf' +--- Properties of Function 'printf_va_1' -------------------------------------------------------------------------------- [ Valid ] Pre-condition (file tests/idct/ieee_1180_1990.c, line 195) @@ -2458,7 +2471,7 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over by Frama-C kernel. -------------------------------------------------------------------------------- ---- Properties of Function 'printf_0' +--- Properties of Function 'printf_va_2' -------------------------------------------------------------------------------- [ Valid ] Pre-condition (file tests/idct/ieee_1180_1990.c, line 196) @@ -2486,9 +2499,9 @@ tests/idct/ieee_1180_1990.c:389:[value] warning: 2's complement assumed for over -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- - 113 Completely validated + 114 Completely validated 16 Locally validated - 247 Considered valid + 249 Considered valid 56 To be validated - 432 Total + 435 Total -------------------------------------------------------------------------------- diff --git a/tests/impact/depend4.i b/tests/impact/depend4.i index af847dce2e39553b55a5ca5fcbfca933838e12d3..3eefa9de01d483accb100ccfaba0368a98222b88 100644 --- a/tests/impact/depend4.i +++ b/tests/impact/depend4.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-calldeps" +"-inout-callwise" +"-then" +"-impact-pragma main" + STDOPT: +"-calldeps -then -impact-pragma main" */ int a, r1, r2; @@ -12,7 +12,7 @@ void aux(int *p, int cond) { if(cond) r1 = *p; else - r2 = *p; // Ne devrait pas être sélectionné + r2 = *p; // Ne devrait pas être sélectionné } void g1() { diff --git a/tests/impact/depend5.i b/tests/impact/depend5.i index dfef31d673ae3a42e6fa0748ecce274556af6e93..fcae6034c68e975b5cd0c0712356523269a25e33 100644 --- a/tests/impact/depend5.i +++ b/tests/impact/depend5.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: #"-calldeps" +"-then -impact-pragma g -then -inout-callwise" + STDOPT: #"-calldeps -then -impact-pragma g" */ int a, b, c, d, e; diff --git a/tests/impact/loop2.i b/tests/impact/loop2.i index a0dc50e60eb6a4b248b1537be05ea9dc265e5a57..80632b996cdbe4940385a552b42255e23a0e640c 100644 --- a/tests/impact/loop2.i +++ b/tests/impact/loop2.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: #"-kernel-msg-key offsetmap:caches -impact-pragma main -lib-entry -calldeps -inout-callwise" +"-then -ulevel 10" + STDOPT: #"-kernel-msg-key offsetmap:caches -impact-pragma main -lib-entry -calldeps" +"-then -ulevel 10" */ diff --git a/tests/impact/oracle/alias.res.oracle b/tests/impact/oracle/alias.res.oracle index c606b014f159e01cf51c9f6342ed168d8b4b74e7..fcfa1884317078a0e2bacfdefd1fdf073782286c 100644 --- a/tests/impact/oracle/alias.res.oracle +++ b/tests/impact/oracle/alias.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/alias.i (no preprocessing) [impact] beginning analysis [value] Analyzing an incomplete application starting at f @@ -20,10 +19,9 @@ tests/impact/alias.i:18:[value] assertion 'Value,mem_access' got final status in [pdg] computing for function f [pdg] done for function f [impact] impacted statements of stmt(s) 2 are: - tests/impact/alias.i:10 (sid 4): y = x + 1; - tests/impact/alias.i:11 (sid 5): *y = 4; - tests/impact/alias.i:12 (sid 7): a = *(x + 1) + 2; - tests/impact/alias.i:13 (sid 8): *y = 2; - tests/impact/alias.i:15 (sid 12): __retres = *(x + 1); - tests/impact/alias.i:14 (sid 21): return_label: return __retres; + tests/impact/alias.i:11 (sid 3): *y = 4; + tests/impact/alias.i:12 (sid 4): int a = *(x + 1) + 2; + tests/impact/alias.i:13 (sid 5): *y = 2; + tests/impact/alias.i:15 (sid 9): __retres = *(x + 1); + tests/impact/alias.i:14 (sid 18): return_label: return __retres; [impact] analysis done diff --git a/tests/impact/oracle/call.0.res.oracle b/tests/impact/oracle/call.0.res.oracle index 434d55c27b50187b3eb9354938d2b5352cbd667f..e0f23b91029243002b848db3b77f33400d0e9c8c 100644 --- a/tests/impact/oracle/call.0.res.oracle +++ b/tests/impact/oracle/call.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/call.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main diff --git a/tests/impact/oracle/call.1.res.oracle b/tests/impact/oracle/call.1.res.oracle index d7788edfff734cd47b66bdedf25ec3e77fca2292..7d3bd5c58523fd95d1b0ba2fb090d3e4fc304954 100644 --- a/tests/impact/oracle/call.1.res.oracle +++ b/tests/impact/oracle/call.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/call.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main2 diff --git a/tests/impact/oracle/call.2.res.oracle b/tests/impact/oracle/call.2.res.oracle index 1559f64a7fa5f9bcccb258b9cecdf4c8b04037e7..94ca016864aeeebd1828af7810cbde83c2905ae2 100644 --- a/tests/impact/oracle/call.2.res.oracle +++ b/tests/impact/oracle/call.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/call.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main3 @@ -14,7 +13,7 @@ [value] computing for function p3 <- test3 <- call_test3 <- main3. Called from tests/impact/call.i:45. [value] using specification for function p3 -tests/impact/call.i:41:[value] warning: no \from part for clause 'assigns G;' of function p3 +tests/impact/call.i:41:[value] warning: no \from part for clause 'assigns G;' [value] Done for function p3 [value] computing for function p2 <- test3 <- call_test3 <- main3. Called from tests/impact/call.i:45. diff --git a/tests/impact/oracle/called.0.res.oracle b/tests/impact/oracle/called.0.res.oracle index 680ab333b4eabf956770355dad0acb1b17108eea..46cfe7841f79a33db1ba631beaece37262de18ec 100644 --- a/tests/impact/oracle/called.0.res.oracle +++ b/tests/impact/oracle/called.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/called.i (no preprocessing) [impact] beginning analysis [value] Analyzing an incomplete application starting at g diff --git a/tests/impact/oracle/called.1.res.oracle b/tests/impact/oracle/called.1.res.oracle index ef8c561bf0d14c165bd43f80f59dcc4756ea7bf1..18a2bb599471d7df015745bba3b95d10aba0f5af 100644 --- a/tests/impact/oracle/called.1.res.oracle +++ b/tests/impact/oracle/called.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/called.i (no preprocessing) [impact] beginning analysis [value] Analyzing an incomplete application starting at h diff --git a/tests/impact/oracle/depend1.res.oracle b/tests/impact/oracle/depend1.res.oracle index b096265a54d5c514ea7c5c218bf7b1249217cfbe..041adf549c45abb1876364bcb683576d48d014ec 100644 --- a/tests/impact/oracle/depend1.res.oracle +++ b/tests/impact/oracle/depend1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/depend1.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main @@ -32,7 +31,6 @@ [pdg] done for function find [impact] impacted statements of stmt(s) 6 are: tests/impact/depend1.i:6 (sid 2): return x; - tests/impact/depend1.i:12 (sid 7): b = find(2); - tests/impact/depend1.i:13 (sid 8): c = find(b); - tests/impact/depend1.i:15 (sid 11): return c; + tests/impact/depend1.i:13 (sid 7): int c = find(b); + tests/impact/depend1.i:15 (sid 10): return c; [impact] analysis done diff --git a/tests/impact/oracle/depend2.res.oracle b/tests/impact/oracle/depend2.res.oracle index b61cf8de2ade202f819eef40cc9d55fe5e811f36..44b30a7537d899c943915a47053210232a4c72e1 100644 --- a/tests/impact/oracle/depend2.res.oracle +++ b/tests/impact/oracle/depend2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/depend2.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main @@ -32,14 +31,7 @@ [pdg] done for function main [pdg] computing for function apply [pdg] done for function apply -[pdg] computing for function find -[pdg] done for function find [impact] impacted statements of stmt(s) 11 are: - tests/impact/depend2.i:5 (sid 2): return x; - tests/impact/depend2.i:7 (sid 5): tmp = find(x); - tests/impact/depend2.i:7 (sid 7): __retres = tmp + y; - tests/impact/depend2.i:13 (sid 12): b = apply(2,200); - tests/impact/depend2.i:14 (sid 14): __retres = a + b; - tests/impact/depend2.i:7 (sid 17): return __retres; - tests/impact/depend2.i:14 (sid 19): return __retres; + tests/impact/depend2.i:14 (sid 13): __retres = a + b; + tests/impact/depend2.i:14 (sid 18): return __retres; [impact] analysis done diff --git a/tests/impact/oracle/depend3.res.oracle b/tests/impact/oracle/depend3.res.oracle index 98780a21aa84534ee6ebd11125207f02dafe1053..544298002f37a55c0be53582eb3eedc9fba51450 100644 --- a/tests/impact/oracle/depend3.res.oracle +++ b/tests/impact/oracle/depend3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/depend3.c (with preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main @@ -33,15 +32,7 @@ tests/impact/depend3.c:10:[value] entering loop for the first time [pdg] done for function main [pdg] computing for function apply [pdg] done for function apply -[pdg] computing for function find -[pdg] done for function find [impact] impacted statements of stmt(s) 34 are: - tests/impact/depend3.c:10 (sid 7): tmp = x; - tests/impact/depend3.c:10 (sid 8): ring[k] = tmp; - tests/impact/depend3.c:10 (sid 9): if(tmp) <..> - tests/impact/depend3.c:18 (sid 29): tmp = find(x); - tests/impact/depend3.c:18 (sid 30): return tmp; - tests/impact/depend3.c:24 (sid 35): b = apply(2,200); - tests/impact/depend3.c:25 (sid 37): __retres = a + b; - tests/impact/depend3.c:25 (sid 46): return __retres; + tests/impact/depend3.c:25 (sid 36): __retres = a + b; + tests/impact/depend3.c:25 (sid 45): return __retres; [impact] analysis done diff --git a/tests/impact/oracle/depend4.res.oracle b/tests/impact/oracle/depend4.res.oracle index 1786334de499a423fe6f670df28bef2e5b7d0e9f..270737ae72e637f1f3ec011bd0195a75cc27587b 100644 --- a/tests/impact/oracle/depend4.res.oracle +++ b/tests/impact/oracle/depend4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/depend4.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/impact/oracle/depend5.res.oracle b/tests/impact/oracle/depend5.res.oracle index d0c5b092bdcd69db05d8a716ca52a42e0a4305b9..3fd7d24267e3ac6434c9130882a4c128bc185b8d 100644 --- a/tests/impact/oracle/depend5.res.oracle +++ b/tests/impact/oracle/depend5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/depend5.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,86 +8,12 @@ c ∈ {0} d ∈ {0} e ∈ {0} -[value] computing for function f <- main. - Called from tests/impact/depend5.i:23. -[value] Recording results for f [from] Computing for function f [from] Done for function f -[value] Done for function f -[value] computing for function g <- main. - Called from tests/impact/depend5.i:25. -[value] computing for function f <- g <- main. - Called from tests/impact/depend5.i:18. -[value] Recording results for f [from] Computing for function f [from] Done for function f -[value] Done for function f -[value] Recording results for g [from] Computing for function g [from] Done for function g -[value] Done for function g -[value] Recording results for main -[from] Computing for function main -[from] Done for function main -[value] done for function main -[from] ====== DISPLAYING CALLWISE DEPENDENCIES ====== -[from] call to f at tests/impact/depend5.i:18 (by g): - b FROM a; e -[from] call to f at tests/impact/depend5.i:23 (by main): - c FROM a; d -[from] call to g at tests/impact/depend5.i:25 (by main): - b FROM a - d FROM \nothing - e FROM \nothing -[from] entry point: - a FROM \nothing - b FROM \nothing - c FROM d - d FROM \nothing - e FROM \nothing -[from] ====== END OF CALLWISE DEPENDENCIES ====== -[impact] beginning analysis -[pdg] computing for function g -[pdg] done for function g -[pdg] computing for function main -[pdg] done for function main -[pdg] computing for function f -[pdg] done for function f -[impact] impacted statements of stmt(s) 8 are: - tests/impact/depend5.i:9 (sid 3): c = d; - tests/impact/depend5.i:11 (sid 4): b = e; - tests/impact/depend5.i:17 (sid 9): e = d; - tests/impact/depend5.i:18 (sid 10): f(); - tests/impact/depend5.i:25 (sid 16): g(); -[impact] analysis done -[value] Analyzing a complete application starting at main -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - a ∈ {0} - b ∈ {0} - c ∈ {0} - d ∈ {0} - e ∈ {0} -[value] computing for function f <- main. - Called from tests/impact/depend5.i:23. -[value] Recording results for f -[from] Computing for function f -[from] Done for function f -[value] Done for function f -[value] computing for function g <- main. - Called from tests/impact/depend5.i:25. -[value] computing for function f <- g <- main. - Called from tests/impact/depend5.i:18. -[value] Recording results for f -[from] Computing for function f -[from] Done for function f -[value] Done for function f -[value] Recording results for g -[from] Computing for function g -[from] Done for function g -[value] Done for function g -[value] Recording results for main [from] Computing for function main [from] Done for function main [value] done for function main diff --git a/tests/impact/oracle/first.res.oracle b/tests/impact/oracle/first.res.oracle index af6f8426b78da7c4974f54cf4615cd6aa32ed79e..686bd55973c6183482dde203ce21ac4c429e8f6f 100644 --- a/tests/impact/oracle/first.res.oracle +++ b/tests/impact/oracle/first.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/first.i (no preprocessing) [impact] beginning analysis [value] Analyzing an incomplete application starting at impact diff --git a/tests/impact/oracle/initial.res.oracle b/tests/impact/oracle/initial.res.oracle index 6a3679d55ee990485dd5cef89a4703f697a0088a..99a285f5f8ff17388ffe43d65b5a67479bfa04ba 100644 --- a/tests/impact/oracle/initial.res.oracle +++ b/tests/impact/oracle/initial.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/initial.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main1 diff --git a/tests/impact/oracle/loop.res.oracle b/tests/impact/oracle/loop.res.oracle index 62f48f1042adc6729768639eb9706671d0f8cd24..c2b38f76ffac113eabd51a852de4b56e7a8c7483 100644 --- a/tests/impact/oracle/loop.res.oracle +++ b/tests/impact/oracle/loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/loop.i (no preprocessing) [impact] beginning analysis [value] Analyzing an incomplete application starting at loop diff --git a/tests/impact/oracle/loop2.res.oracle b/tests/impact/oracle/loop2.res.oracle index 44560e82e9556bd726000f55bde99ca38149dce2..2a779678cf9d106285ae247af31f17290b2c288d 100644 --- a/tests/impact/oracle/loop2.res.oracle +++ b/tests/impact/oracle/loop2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/loop2.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -62,14 +61,13 @@ tests/impact/loop2.i:25:[value] entering loop for the first time [pdg] done for function init [pdg] computing for function f [pdg] done for function f -[impact] impacted statements of stmt(s) 18 are: - tests/impact/loop2.i:17 (sid 12): v_0 = t[i]; - tests/impact/loop2.i:18 (sid 13): w[i] = i; - tests/impact/loop2.i:19 (sid 14): t[i] = u[i]; - tests/impact/loop2.i:26 (sid 27): if(t[i]) <..> - tests/impact/loop2.i:27 (sid 28): f(i); +[impact] impacted statements of stmt(s) 17 are: + tests/impact/loop2.i:17 (sid 11): int v_0 = t[i]; + tests/impact/loop2.i:18 (sid 12): w[i] = i; + tests/impact/loop2.i:19 (sid 13): t[i] = u[i]; + tests/impact/loop2.i:26 (sid 26): if(t[i]) <..> + tests/impact/loop2.i:27 (sid 27): f(i); [impact] analysis done -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/loop2.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -214,16 +212,16 @@ tests/impact/loop2.i:25:[value] entering loop for the first time [pdg] done for function init [pdg] computing for function f [pdg] done for function f -[impact] impacted statements of stmt(s) 59 are: - tests/impact/loop2.i:19 (sid 55): t[i] = u[i]; - tests/impact/loop2.i:27 (sid 151): f(i); - tests/impact/loop2.i:27 (sid 158): f(i); - tests/impact/loop2.i:27 (sid 165): f(i); - tests/impact/loop2.i:27 (sid 172): f(i); - tests/impact/loop2.i:27 (sid 179): f(i); - tests/impact/loop2.i:27 (sid 186): f(i); - tests/impact/loop2.i:27 (sid 193): f(i); - tests/impact/loop2.i:27 (sid 200): f(i); - tests/impact/loop2.i:27 (sid 207): f(i); - tests/impact/loop2.i:27 (sid 214): f(i); +[impact] impacted statements of stmt(s) 57 are: + tests/impact/loop2.i:19 (sid 53): t[i] = u[i]; + tests/impact/loop2.i:27 (sid 149): f(i); + tests/impact/loop2.i:27 (sid 156): f(i); + tests/impact/loop2.i:27 (sid 163): f(i); + tests/impact/loop2.i:27 (sid 170): f(i); + tests/impact/loop2.i:27 (sid 177): f(i); + tests/impact/loop2.i:27 (sid 184): f(i); + tests/impact/loop2.i:27 (sid 191): f(i); + tests/impact/loop2.i:27 (sid 198): f(i); + tests/impact/loop2.i:27 (sid 205): f(i); + tests/impact/loop2.i:27 (sid 212): f(i); [impact] analysis done diff --git a/tests/impact/oracle/slicing.res.oracle b/tests/impact/oracle/slicing.res.oracle index 0be88d4c453c079d80a5d65873185cd0762fd5e4..248fffc10f6e800a1f26b377bd7dca65cc96efa0 100644 --- a/tests/impact/oracle/slicing.res.oracle +++ b/tests/impact/oracle/slicing.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/slicing.i (no preprocessing) [impact] beginning analysis [value] Analyzing an incomplete application starting at impact @@ -29,7 +28,7 @@ tests/impact/slicing.i:18:[value] warning: signed overflow. assert y + f ≤ 214 tests/impact/slicing.i:14 (sid 10): y = x + e; tests/impact/slicing.i:18 (sid 13): z = y + f; tests/impact/slicing.i:19 (sid 14): w = b; -[slicing] making slicing project 'impact slicing'... +[slicing] initializing slicing ... [slicing] applying all slicing requests... [slicing] applying 0 actions... [slicing] applying all slicing requests... diff --git a/tests/impact/oracle/topbot.res.oracle b/tests/impact/oracle/topbot.res.oracle index ecf85f65caa7d72303c3840ad5edc1c48b584255..f17b02b8a6c97e2a466fb67f29d079e6e59c8b00 100644 --- a/tests/impact/oracle/topbot.res.oracle +++ b/tests/impact/oracle/topbot.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/topbot.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -32,7 +31,7 @@ tests/impact/topbot.c:5:[value] warning: function f: precondition got status inv {n5}: VarDecl : x {n6}: VarDecl : y {n7}: VarDecl : z - {n8}: x = 1; + {n8}: int x = 1; -[-c-]-> 2 -[a--]-> 5 {n9}: c diff --git a/tests/impact/oracle/undef_function.res.oracle b/tests/impact/oracle/undef_function.res.oracle index 292f8f0f85f769a63bda5834e10d55e7fa133ef5..b73f9347996b7075c15adda1439b1d7789add7f2 100644 --- a/tests/impact/oracle/undef_function.res.oracle +++ b/tests/impact/oracle/undef_function.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/undef_function.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main diff --git a/tests/impact/oracle/variadic.res.oracle b/tests/impact/oracle/variadic.res.oracle index 0435651670d51f1cbf15f7b3f8f3fb463add1394..0970bfea0e957e3384f00e492b71b869b39f9251 100644 --- a/tests/impact/oracle/variadic.res.oracle +++ b/tests/impact/oracle/variadic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/impact/variadic.i (no preprocessing) [impact] beginning analysis [value] Analyzing a complete application starting at main @@ -21,7 +20,7 @@ tests/impact/variadic.i:12:[kernel] warning: Neither code nor specification for [pdg] computing for function f [pdg] done for function f [impact] impacted statements of stmt(s) 3 are: - tests/impact/variadic.i:12 (sid 71): f(i,(void * const *)(__va_args)); + tests/impact/variadic.i:12 (sid 50): f(i,(void * const *)(__va_args)); [impact] analysis done [impact] beginning analysis [value] Analyzing a complete application starting at main1 @@ -49,12 +48,12 @@ tests/impact/variadic.i:12:[kernel] warning: Neither code nor specification for [impact] impacted statements of stmt(s) 12 are: tests/impact/variadic.i:19 (sid 7): y = x + y; tests/impact/variadic.i:31 (sid 15): return y; - tests/impact/variadic.i:29 (sid 49): __va_arg0 = 2; - tests/impact/variadic.i:29 (sid 50): __va_arg1 = 3; - tests/impact/variadic.i:29 (sid 51): __va_args[0] = & __va_arg0; - tests/impact/variadic.i:29 (sid 52): __va_args[1] = & __va_arg1; - tests/impact/variadic.i:29 (sid 73): g1(1,(void * const *)(__va_args)); - tests/impact/variadic.i:30 (sid 74): g1(1,(void * const *)(__va_args_8)); + tests/impact/variadic.i:29 (sid 52): int __va_arg0 = 2; + tests/impact/variadic.i:29 (sid 53): int __va_arg1 = 3; + tests/impact/variadic.i:29 (sid 54): void *__va_args[2] = + {& __va_arg0, & __va_arg1}; + tests/impact/variadic.i:29 (sid 55): g1(1,(void * const *)(__va_args)); + tests/impact/variadic.i:30 (sid 58): g1(1,(void * const *)(__va_args_8)); [impact] analysis done [impact] beginning analysis [value] Analyzing a complete application starting at main2 @@ -79,11 +78,11 @@ tests/impact/variadic.i:12:[kernel] warning: Neither code nor specification for [pdg] computing for function g2 [pdg] done for function g2 [impact] impacted statements of stmt(s) 19 are: - tests/impact/variadic.i:37 (sid 55): __va_arg0 = 2; - tests/impact/variadic.i:37 (sid 56): __va_arg1 = 3; - tests/impact/variadic.i:37 (sid 57): __va_args[0] = & __va_arg0; - tests/impact/variadic.i:37 (sid 58): __va_args[1] = & __va_arg1; - tests/impact/variadic.i:37 (sid 76): g2(1,(void * const *)(__va_args)); + tests/impact/variadic.i:37 (sid 60): int __va_arg0 = 2; + tests/impact/variadic.i:37 (sid 61): int __va_arg1 = 3; + tests/impact/variadic.i:37 (sid 62): void *__va_args[2] = + {& __va_arg0, & __va_arg1}; + tests/impact/variadic.i:37 (sid 63): g2(1,(void * const *)(__va_args)); [impact] analysis done [impact] beginning analysis [value] Analyzing a complete application starting at main3 @@ -132,10 +131,11 @@ tests/impact/variadic.i:12:[kernel] warning: Neither code nor specification for tests/impact/variadic.i:19 (sid 7): y = x + y; tests/impact/variadic.i:53 (sid 29): return y; tests/impact/variadic.i:59 (sid 34): return y; - tests/impact/variadic.i:51 (sid 79): g1(x_0,(void * const *)(__va_args)); - tests/impact/variadic.i:52 (sid 80): g1(x_0,(void * const *)(__va_args_5)); - tests/impact/variadic.i:57 (sid 82): aux3(1,(void * const *)(__va_args)); - tests/impact/variadic.i:58 (sid 83): aux3(2,(void * const *)(__va_args_6)); + tests/impact/variadic.i:51 (sid 68): void *__va_args[1] = {(void *)0}; + tests/impact/variadic.i:51 (sid 69): g1(x_0,(void * const *)(__va_args)); + tests/impact/variadic.i:52 (sid 71): g1(x_0,(void * const *)(__va_args_5)); + tests/impact/variadic.i:57 (sid 75): aux3(1,(void * const *)(__va_args)); + tests/impact/variadic.i:58 (sid 78): aux3(2,(void * const *)(__va_args_6)); [impact] analysis done [impact] beginning analysis [value] Analyzing a complete application starting at main4 @@ -175,7 +175,7 @@ tests/impact/variadic.i:12:[kernel] warning: Neither code nor specification for [impact] impacted statements of stmt(s) 37 are: tests/impact/variadic.i:69 (sid 42): return y; tests/impact/variadic.i:75 (sid 47): return y; - tests/impact/variadic.i:73 (sid 85): aux4bis(1,(void * const *)(__va_args)); + tests/impact/variadic.i:73 (sid 82): aux4bis(1,(void * const *)(__va_args)); tests/impact/variadic.i:74 (sid 86): aux4bis(1, (void * const *)(__va_args_7)); [impact] analysis done diff --git a/tests/impact/test_config b/tests/impact/test_config index 719aa2c47bb8675f3b21806f18e223bcab4978ac..b2aad4f48595001126f643f9c986fcdbf7c85c5e 100644 --- a/tests/impact/test_config +++ b/tests/impact/test_config @@ -1 +1 @@ -OPT: -journal-disable -impact-print +OPT: -journal-disable -impact-print -val-show-progress diff --git a/tests/journal/control.i b/tests/journal/control.i index 66b9cbb6583f72ea6f37ceb8a219414c07b4693c..39c8a21bacc6793da247ecb7c22390a20964cd35 100644 --- a/tests/journal/control.i +++ b/tests/journal/control.i @@ -1,6 +1,6 @@ /* run.config COMMENT: do not compare generated journals since they depend on current time - EXECNOW: BIN control_journal.ml BIN control_journal_bis.ml (./bin/toplevel.opt -journal-enable -check -val -deps -out -main f -journal-name tests/journal/result/control_journal.ml tests/journal/control.i && cp tests/journal/result/control_journal.ml tests/journal/result/control_journal_bis.ml) > /dev/null 2> /dev/null + EXECNOW: BIN control_journal.ml BIN control_journal_bis.ml (./bin/toplevel.opt -journal-enable -check -val -deps -out -val-show-progress -main f -journal-name tests/journal/result/control_journal.ml tests/journal/control.i && cp tests/journal/result/control_journal.ml tests/journal/result/control_journal_bis.ml) > /dev/null 2> /dev/null CMD: FRAMAC_LIB=lib/fc ./bin/toplevel.byte OPT: -load-script tests/journal/result/control_journal -journal-disable CMD: FRAMAC_LIB=lib/fc ./bin/toplevel.byte diff --git a/tests/journal/intra.i b/tests/journal/intra.i index 0701ee6ad9db758bcdc2f65a7cf68af1a9099d28..7f995e7184bccb9f7321fa6505ddf97d9066ee27 100644 --- a/tests/journal/intra.i +++ b/tests/journal/intra.i @@ -1,6 +1,6 @@ /* run.config EXECNOW: make -s tests/journal/intra.cmxs - EXECNOW: BIN intra_journal.ml @frama-c@ -load-module ./tests/journal/intra -journal-enable -journal-name tests/journal/result/intra_journal.ml tests/journal/intra.i > /dev/null 2> /dev/null + EXECNOW: BIN intra_journal.ml @frama-c@ -val-show-progress -load-module ./tests/journal/intra -journal-enable -journal-name tests/journal/result/intra_journal.ml tests/journal/intra.i > /dev/null 2> /dev/null CMD: @frama-c@ -load-module ./tests/journal/intra OPT: -load-script tests/journal/result/intra_journal -journal-disable */ diff --git a/tests/journal/oracle/control.0.res.oracle b/tests/journal/oracle/control.0.res.oracle index d3ca6330b3cc688897ef91460adc546afe89a31b..e0e4375d907242a5a6ca33a26a7219a3f5846329 100644 --- a/tests/journal/oracle/control.0.res.oracle +++ b/tests/journal/oracle/control.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/journal/control.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/journal/oracle/control.1.res.oracle b/tests/journal/oracle/control.1.res.oracle index f622154d0d4554fd39ef647407528f615c5c40a7..b5795671fc568fe05ea19d18bfe113cff471566d 100644 --- a/tests/journal/oracle/control.1.res.oracle +++ b/tests/journal/oracle/control.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/journal/control.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/journal/oracle/control2.res.oracle b/tests/journal/oracle/control2.res.oracle index 83d98d18f5c88ed9e17e74f6d3b31a2f9a071df7..8aab42622886aeeda08b2737e018d675bbeed58b 100644 --- a/tests/journal/oracle/control2.res.oracle +++ b/tests/journal/oracle/control2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/journal/control2.c (with preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state @@ -10,7 +9,6 @@ d ∈ {0} tests/journal/control2.c:12:[value] entering loop for the first time tests/journal/control2.c:15:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; -[value] Recording results for f [value] done for function f [from] Computing for function f [from] Done for function f @@ -25,7 +23,6 @@ tests/journal/control2.c:15:[value] warning: signed overflow. assert x + 1 ≤ 2 tests/journal/control2.c:13:[value] warning: signed overflow. assert y + 1 ≤ 2147483647; tests/journal/control2.c:13:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; tests/journal/control2.c:15:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; -[value] Recording results for f [value] done for function f [from] Computing for function f [from] Done for function f diff --git a/tests/journal/oracle/control2_sav.res b/tests/journal/oracle/control2_sav.res index 4eb717939ddb41f62c3f1e34e0953595a1a8404a..be16f8a516dcbf2a66940ea85378bb9188263df9 100644 --- a/tests/journal/oracle/control2_sav.res +++ b/tests/journal/oracle/control2_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/journal/control2.c (with preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state @@ -10,7 +9,6 @@ d ∈ {0} tests/journal/control2.c:12:[value] entering loop for the first time tests/journal/control2.c:15:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; -[value] Recording results for f [value] done for function f [from] Computing for function f [from] Done for function f @@ -26,7 +24,6 @@ tests/journal/control2.c:15:[value] warning: signed overflow. assert x + 1 ≤ 2 tests/journal/control2.c:13:[value] warning: signed overflow. assert y + 1 ≤ 2147483647; tests/journal/control2.c:13:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; tests/journal/control2.c:15:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; -[value] Recording results for f [value] done for function f [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function f: diff --git a/tests/journal/oracle/intra.res.oracle b/tests/journal/oracle/intra.res.oracle index 2f3dad924b73682dde4c0b154be2c955120bdf2c..290069796b0c804ce45a70b78f8a614c932180cd 100644 --- a/tests/journal/oracle/intra.res.oracle +++ b/tests/journal/oracle/intra.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/journal/intra.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -87,19 +86,11 @@ tests/journal/intra.i:92:[value] entering loop for the first time [pdg] done for function param [pdg] computing for function two_outputs [pdg] done for function two_outputs -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [pdg] computing for function f10 -[pdg] warning: unreachable entry point (sid:83, function f10) +[pdg] warning: unreachable entry point (sid:79, function f10) [pdg] Bottom for function f10 [pdg] computing for function main2 -[pdg] warning: unreachable entry point (sid:92, function main2) +[pdg] warning: unreachable entry point (sid:87, function main2) [pdg] Bottom for function main2 [pdg] computing for function spare_called_fct [pdg] done for function spare_called_fct diff --git a/tests/libc/alloca_h.c b/tests/libc/alloca_h.c new file mode 100644 index 0000000000000000000000000000000000000000..6f7f079602e4160d9278119d6f406e36c2fe325b --- /dev/null +++ b/tests/libc/alloca_h.c @@ -0,0 +1,50 @@ +#include <alloca.h> + +volatile int nondet; + +char *f() { + char *p = alloca(3); + char *q = malloc(4); + char *r = nondet ? p : q; + free(r); // warning: q can be free'd, but not p + return p; // p will be dangling after function exit +} + +char *f2(char *allocaed) { // allocaed must contain at least 2 bytes + *allocaed = 42; + *(allocaed+1) = 43; + char *p = alloca(5); + return p; +} + +char *loop() { + char *q = 0; + for (int i = 0; i < 100; i++) { + char *p = alloca(i); + q = nondet ? q : p; + } + return q; +} + +int main() { + int *a = alloca(sizeof(int)); + //@ assert !\initialized(a); + *a = 42; + char *p; + { + char *local = alloca(2); + local[0] = 'A'; + local[1] = 0; + p = local; + } + //@ assert !\dangling(&p); + char *q = f(); + //@ assert \dangling(&q); + char *r = loop(); + //@ assert \dangling(&r); + char *in = alloca(2); + char *s = f2(in); + *in = 44; + //@ assert \dangling(&s); + return 0; +} diff --git a/tests/libc/coverage.c b/tests/libc/coverage.c index cdf54f0f6da57c61e6ed24a62588b67b41f66c7f..57caec0fbd528cfe9a870c1a81e6674d03b08e88 100644 --- a/tests/libc/coverage.c +++ b/tests/libc/coverage.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -no-val-builtins-auto share/libc/string.c -val -slevel 6 -metrics-value-cover -then -metrics-libc + OPT: -no-val-builtins-auto -val-show-progress share/libc/string.c -val -slevel 6 -metrics-value-cover -then -metrics-libc */ #include "string.h" diff --git a/tests/libc/fc_libc.c b/tests/libc/fc_libc.c index 1f466f0293769d3828e2b3d1dcab707a718c36e5..e9e269127c1f9c68b3f34bedf38f30c1bbf1ab1b 100644 --- a/tests/libc/fc_libc.c +++ b/tests/libc/fc_libc.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -print -cpp-extra-args='-nostdinc -Ishare/libc' -metrics -metrics-libc -load-script tests/libc/check_const.ml -val @VALUECONFIG@ -then -lib-entry -no-print -metrics-no-libc + OPT: -print -cpp-extra-args='-nostdinc -Ishare/libc' -metrics -metrics-libc -load-script tests/libc/check_const.ml -load-module metrics -val @VALUECONFIG@ -then -lib-entry -no-print -metrics-no-libc OPT: -print -print-libc CMD: ./tests/libc/check_full_libc.sh OPT: @@ -16,6 +16,7 @@ #define FRAMA_C_MALLOC_INDIVIDUAL #include "share/libc/fc_runtime.c" +#include "alloca.h" #include "arpa/inet.h" #include "assert.h" #include "byteswap.h" @@ -37,11 +38,13 @@ #include "__fc_define_ino_t.h" #include "__fc_define_intptr_t.h" #include "__fc_define_iovec.h" +#include "__fc_define_key_t.h" #include "__fc_define_mode_t.h" #include "__fc_define_nlink_t.h" #include "__fc_define_null.h" #include "__fc_define_off_t.h" #include "__fc_define_pid_t.h" +#include "__fc_define_pthread_types.h" #include "__fc_define_sa_family_t.h" #include "__fc_define_seek_macros.h" #include "__fc_define_sigset_t.h" @@ -64,6 +67,7 @@ #include "features.h" #include "fenv.h" #include "float.h" +#include "fnmatch.h" #include "getopt.h" #include "glob.h" #include "grp.h" @@ -81,6 +85,7 @@ #include "linux/rtnetlink.h" #include "locale.h" #include "math.h" +#include "memory.h" #include "netdb.h" #include "net/if.h" #include "netinet/in.h" @@ -89,8 +94,12 @@ #include "netinet/ip_icmp.h" #include "netinet/tcp.h" #include "nl_types.h" +#include "poll.h" +#include "pthread.h" #include "pwd.h" #include "regex.h" +#include "sched.h" +#include "semaphore.h" #include "setjmp.h" #include "signal.h" #include "stdarg.h" @@ -101,11 +110,16 @@ #include "stdlib.h" #include "string.h" #include "strings.h" +#include "stropts.h" +#include "sys/file.h" #include "sys/ioctl.h" +#include "sys/ipc.h" #include "syslog.h" +#include "sys/mman.h" #include "sys/param.h" #include "sys/resource.h" #include "sys/select.h" +#include "sys/shm.h" #include "sys/socket.h" #include "sys/stat.h" #include "sys/sysctl.h" @@ -114,12 +128,15 @@ #include "sys/types.h" #include "sys/uio.h" #include "sys/un.h" +#include "sys/utsname.h" #include "sys/wait.h" #include "termios.h" #include "tgmath.h" #include "time.h" #include "uchar.h" #include "unistd.h" +#include "utime.h" +#include "utmpx.h" #include "wchar.h" #include "wctype.h" diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_ite.err.oracle b/tests/libc/oracle/alloca_h.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_ite.err.oracle rename to tests/libc/oracle/alloca_h.err.oracle diff --git a/tests/libc/oracle/alloca_h.res.oracle b/tests/libc/oracle/alloca_h.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..3799e529c3edae02444e1d64c1472c3d16cb95e0 --- /dev/null +++ b/tests/libc/oracle/alloca_h.res.oracle @@ -0,0 +1,76 @@ +[kernel] Parsing tests/libc/alloca_h.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + __fc_stack_status ∈ [--..--] + nondet ∈ [--..--] +tests/libc/alloca_h.c:30:[value] allocating variable __alloca_main_l30 +tests/libc/alloca_h.c:31:[value] assertion got status valid. +tests/libc/alloca_h.c:35:[value] allocating variable __alloca_main_l35 +tests/libc/alloca_h.c:40:[value] assertion got status valid. +[value] computing for function f <- main. + Called from tests/libc/alloca_h.c:41. +tests/libc/alloca_h.c:6:[value] allocating variable __alloca_f_l6 +tests/libc/alloca_h.c:7:[value] allocating variable __malloc_f_l7 +tests/libc/alloca_h.c:9:[value] warning: Wrong free: assert(pass a freeable address) +tests/libc/alloca_h.c:10:[value] warning: accessing left-value that contains escaping addresses. + assert ¬\dangling(&p); +[value] Recording results for f +[value] Done for function f +tests/libc/alloca_h.c:41:[value] freeing automatic bases: {__alloca_f_l6} +tests/libc/alloca_h.c:42:[value] assertion got status valid. +[value] computing for function loop <- main. + Called from tests/libc/alloca_h.c:43. +tests/libc/alloca_h.c:22:[value] entering loop for the first time +tests/libc/alloca_h.c:23:[value] allocating variable __alloca_loop_l23 +[value] Recording results for loop +[value] Done for function loop +tests/libc/alloca_h.c:43:[value] freeing automatic bases: {__alloca_w_loop_l23} +tests/libc/alloca_h.c:44:[value] warning: assertion got status unknown. +tests/libc/alloca_h.c:45:[value] allocating variable __alloca_main_l45 +[value] computing for function f2 <- main. + Called from tests/libc/alloca_h.c:46. +tests/libc/alloca_h.c:16:[value] allocating variable __alloca_f2_l16 +[value] Recording results for f2 +[value] Done for function f2 +tests/libc/alloca_h.c:46:[value] freeing automatic bases: {__alloca_f2_l16} +tests/libc/alloca_h.c:48:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function f2: + __fc_stack_status ∈ [--..--] + p ∈ {{ &__alloca_f2_l16[0] }} + __alloca_main_l45[0] ∈ {42} + [1] ∈ {43} +[value:final-states] Values at end of function loop: + __fc_stack_status ∈ [--..--] + q ∈ {{ NULL ; &__alloca_w_loop_l23[0] }} +[value:final-states] Values at end of function f: + __fc_heap_status ∈ [--..--] + __fc_stack_status ∈ [--..--] + p ∈ {{ &__alloca_f_l6[0] }} or ESCAPINGADDR + q ∈ {{ NULL ; &__malloc_f_l7[0] }} or ESCAPINGADDR + r ∈ {{ NULL ; &__alloca_f_l6[0] ; &__malloc_f_l7[0] }} or ESCAPINGADDR +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + __fc_stack_status ∈ [--..--] + a ∈ {{ &__alloca_main_l30 }} + p ∈ {{ &__alloca_main_l35[0] }} + q ∈ ESCAPINGADDR + r ∈ ESCAPINGADDR + in ∈ {{ &__alloca_main_l45[0] }} + s ∈ ESCAPINGADDR + __retres ∈ {0} + __alloca_main_l30 ∈ {42} + __alloca_main_l35[0] ∈ {65} + [1] ∈ {0} + __alloca_main_l45[0] ∈ {44} + [1] ∈ {43} diff --git a/tests/libc/oracle/coverage.res.oracle b/tests/libc/oracle/coverage.res.oracle index f153e76ca017751808238309b9fda2dd7ab9f9b4..2a0d1834f3e431fc5eac1426650d4a7ec535fbb1 100644 --- a/tests/libc/oracle/coverage.res.oracle +++ b/tests/libc/oracle/coverage.res.oracle @@ -1,22 +1,20 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/coverage.c (with preprocessing) [kernel] Parsing share/libc/string.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] computing for function strlen <- main. Called from tests/libc/coverage.c:9. share/libc/string.h:92:[value] function strlen: precondition 'valid_string_src' got status valid. -share/libc/string.c:77:[value] entering loop for the first time -share/libc/string.c:78:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:94:[value] warning: function strlen: postcondition got status unknown. +share/libc/string.c:78:[value] entering loop for the first time +share/libc/string.h:94:[value] function strlen: postcondition got status valid. [value] Recording results for strlen [value] Done for function strlen [value] Recording results for main diff --git a/tests/libc/oracle/ctype.res.oracle b/tests/libc/oracle/ctype.res.oracle index ba90dcd1855a7af250a844580a6ce53b333505c7..5e1daf5f3ba6d82f87d4399cc198e721d10a2fad 100644 --- a/tests/libc/oracle/ctype.res.oracle +++ b/tests/libc/oracle/ctype.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/ctype.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/libc/oracle/fc_libc.0.res.oracle b/tests/libc/oracle/fc_libc.0.res.oracle index f91a62e98094590f43af566d6d2322edc45fcedc..cc4b07526f1dcf55954088529d5cb226a69865a5 100644 --- a/tests/libc/oracle/fc_libc.0.res.oracle +++ b/tests/libc/oracle/fc_libc.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/fc_libc.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -35,12 +34,16 @@ __fc_initial_stderr.__fc_FILE_id ∈ {2} .__fc_FILE_data ∈ {0} __fc_initial_stdin ∈ {0} - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + __fc_time ∈ [--..--] + __fc_time_tm ∈ {0} + __fc_p_time_tm ∈ {{ &__fc_time_tm }} + __fc_stack_status ∈ [--..--] __fc_sockfds[0..1023] ∈ {0} __fc_socket_counter ∈ [--..--] __fc_open_sock_fds ∈ [--..--] @@ -48,8 +51,11 @@ in6addr_loopback.s6_addr[0..15] ∈ {255} __fc_opendir[0..511] ∈ {0} __fc_p_opendir ∈ {{ &__fc_opendir[0] }} - __fc_time ∈ [--..--] __fc_tz ∈ [--..--] + __fc_itimer_real ∈ [--..--] + __fc_itimer_virtual ∈ [--..--] + __fc_itimer_prof ∈ [--..--] + __fc_fds_state ∈ [--..--] h_errno ∈ {0} facilitynames[0].c_name ∈ {{ "auth" }} [0].c_val ∈ {32} @@ -123,13 +129,11 @@ [11].c_val ∈ {4} [12].c_name ∈ {0} [12].c_val ∈ {-1} - __fc_time_tm ∈ {0} - __fc_p_time_tm ∈ {{ &__fc_time_tm }} __fc_fds[0..1023] ∈ {0} S_optarg[0..1] ∈ [--..--] -tests/libc/fc_libc.c:129:[value] assertion got status valid. -tests/libc/fc_libc.c:130:[value] assertion got status valid. -tests/libc/fc_libc.c:131:[value] assertion got status valid. +tests/libc/fc_libc.c:146:[value] assertion got status valid. +tests/libc/fc_libc.c:147:[value] assertion got status valid. +tests/libc/fc_libc.c:148:[value] assertion got status valid. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -152,29 +156,31 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. strcmp (0 call); strcpy (0 call); strdup (0 call); strerror (0 call); strlen (4 calls); strncat (0 call); strncmp (0 call); strncpy (0 call); strndup (0 call); strrchr (0 call); strstr (0 call); tolower (0 call); - toupper (0 call); wcscat (0 call); wcscpy (0 call); wcslen (1 call); + toupper (0 call); wcscat (0 call); wcscpy (0 call); wcslen (2 calls); wcsncat (0 call); wcsncpy (0 call); wmemcpy (0 call); wmemset (0 call); - Undefined functions (235) + Undefined functions (243) ========================= FD_CLR (0 call); FD_ISSET (0 call); FD_SET (0 call); FD_ZERO (0 call); Frama_C_abort (1 call); Frama_C_char_interval (0 call); Frama_C_int_interval (0 call); Frama_C_long_interval (0 call); Frama_C_long_long_interval (0 call); Frama_C_make_unknown (0 call); - Frama_C_short_interval (0 call); Frama_C_unsigned_char_interval (0 call); + Frama_C_short_interval (0 call); Frama_C_size_t_interval (0 call); + Frama_C_unsigned_char_interval (0 call); Frama_C_unsigned_int_interval (0 call); Frama_C_unsigned_long_interval (0 call); Frama_C_unsigned_long_long_interval (0 call); Frama_C_unsigned_short_interval (0 call); Frama_C_update_entropy (4 calls); _Exit (0 call); __va_fcntl_flock (0 call); __va_fcntl_int (0 call); - __va_fcntl_void (0 call); __va_open_mode_t (0 call); - __va_open_void (0 call); __va_openat_mode_t (0 call); - __va_openat_void (0 call); abort (0 call); accept (0 call); acos (0 call); - acosf (0 call); acosh (0 call); acoshf (0 call); acoshl (0 call); - acosl (0 call); asin (0 call); asinf (0 call); asinl (0 call); - at_quick_exit (0 call); atan2 (0 call); atexit (0 call); atof (0 call); - atol (0 call); atoll (0 call); bind (0 call); bsearch (0 call); - bzero (0 call); ceil (0 call); ceilf (0 call); clearerr (0 call); + __va_fcntl_void (0 call); __va_ioctl_ptr (0 call); __va_ioctl_void (0 call); + __va_open_mode_t (0 call); __va_open_void (0 call); + __va_openat_mode_t (0 call); __va_openat_void (0 call); abort (0 call); + accept (0 call); acos (0 call); acosf (0 call); acosh (0 call); + acoshf (0 call); acoshl (0 call); acosl (0 call); alloca (0 call); + asin (0 call); asinf (0 call); asinl (0 call); at_quick_exit (0 call); + atan2 (0 call); atexit (0 call); atof (0 call); atol (0 call); + atoll (0 call); bind (0 call); bsearch (0 call); bzero (0 call); + ceil (0 call); ceilf (0 call); clearerr (0 call); clearerr_unlocked (0 call); clock (0 call); close (0 call); closedir (0 call); closelog (0 call); connect (0 call); creat (0 call); difftime (0 call); div (0 call); execl (0 call); execle (0 call); @@ -188,7 +194,7 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. freopen (0 call); fseek (0 call); fsetpos (0 call); ftell (0 call); ftrylockfile (0 call); funlockfile (0 call); fwrite (0 call); getc (0 call); getc_unlocked (0 call); getchar (0 call); getchar_unlocked (0 call); - getenv (0 call); getopt (0 call); getopt_long (0 call); + getenv (0 call); getitimer (0 call); getopt (0 call); getopt_long (0 call); getopt_long_only (0 call); getpriority (0 call); getrlimit (0 call); getrusage (0 call); gets (0 call); getsockopt (0 call); gettimeofday (0 call); getuid (0 call); gmtime (0 call); htonl (0 call); @@ -201,12 +207,13 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. mbtowc (0 call); memoverlap (1 call); mktime (0 call); nan (0 call); nanf (0 call); nanl (0 call); ntohl (0 call); ntohs (0 call); open (0 call); openat (0 call); opendir (0 call); openlog (0 call); perror (0 call); - pow (0 call); powf (0 call); putc (0 call); putc_unlocked (0 call); - putchar (0 call); putchar_unlocked (0 call); puts (0 call); qsort (0 call); - quick_exit (0 call); raise (0 call); rand (0 call); read (0 call); - readdir (0 call); readv (0 call); realloc (0 call); recv (0 call); - recvmsg (0 call); remove (0 call); rename (0 call); rewind (0 call); - round (0 call); roundf (0 call); setbuf (0 call); setjmp (0 call); + poll (0 call); pow (0 call); powf (0 call); putc (0 call); + putc_unlocked (0 call); putchar (0 call); putchar_unlocked (0 call); + puts (0 call); qsort (0 call); quick_exit (0 call); raise (0 call); + rand (0 call); read (0 call); readdir (0 call); readv (0 call); + realloc (0 call); recv (0 call); recvmsg (0 call); remove (0 call); + rename (0 call); rewind (0 call); round (0 call); roundf (0 call); + select (0 call); setbuf (0 call); setitimer (0 call); setjmp (0 call); setlogmask (0 call); setpriority (0 call); setrlimit (0 call); setsockopt (0 call); settimeofday (0 call); setvbuf (0 call); shutdown (0 call); siglongjmp (0 call); signal (0 call); socket (0 call); @@ -225,9 +232,10 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. wcsstr (0 call); wcstombs (0 call); wctomb (0 call); wmemchr (0 call); wmemcmp (0 call); wmemmove (0 call); write (0 call); - 'Extern' global variables (3) + 'Extern' global variables (6) ============================= - optarg; opterr; optopt + __fc_mblen_state; __fc_mbtowc_state; __fc_wctomb_state; optarg; opterr; + optopt Potential entry points (1) ========================== @@ -235,18 +243,18 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. Global metrics ============== - Sloc = 621 - Decision point = 116 - Global variables = 32 - If = 114 - Loop = 31 - Goto = 34 - Assignment = 234 + Sloc = 592 + Decision point = 117 + Global variables = 33 + If = 115 + Loop = 30 + Goto = 35 + Assignment = 233 Exit point = 63 - Function = 298 - Function call = 35 - Pointer dereferencing = 79 - Cyclomatic complexity = 179 + Function = 306 + Function call = 36 + Pointer dereferencing = 83 + Cyclomatic complexity = 180 /* Generated by Frama-C */ #include "__fc_builtin.h" #include "__fc_define_fd_set_t.h" @@ -256,6 +264,7 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. #include "__fc_define_suseconds_t.h" #include "__fc_define_useconds_t.h" #include "__fc_select.h" +#include "alloca.h" #include "arpa/inet.h" #include "assert.h" #include "ctype.h" @@ -268,15 +277,21 @@ tests/libc/fc_libc.c:131:[value] assertion got status valid. #include "locale.h" #include "math.h" #include "netdb.h" +#include "netinet/in.h" +#include "poll.h" #include "setjmp.h" #include "signal.h" #include "stdarg.h" #include "stdint.h" #include "stdio.h" #include "stdlib.h" +#include "string.c" #include "string.h" #include "strings.h" +#include "stropts.h" #include "sys/resource.h" +#include "sys/socket.h" +#include "sys/time.h" #include "sys/times.h" #include "sys/uio.h" #include "syslog.h" @@ -336,68 +351,6 @@ FILE __fc_initial_stdin = {.__fc_FILE_id = (unsigned int)0, .__fc_FILE_data = 0U}; extern void Frama_C_free(void *base); -/*@ assigns \result; - assigns \result \from (indirect: p), (indirect: q), (indirect: n); - - behavior separated: - assumes \separated(p + (0 .. n - 1), q + (0 .. n - 1)); - ensures \result ≡ 0; - - behavior not_separated_lt: - assumes ¬\separated(p + (0 .. n - 1), q + (0 .. n - 1)); - assumes p ≤ q < p + n; - ensures \result ≡ -1; - - behavior not_separated_gt: - assumes ¬\separated(p + (0 .. n - 1), q + (0 .. n - 1)); - assumes q < p ≤ q + n; - ensures \result ≡ 1; - - complete behaviors not_separated_gt, not_separated_lt, separated; - disjoint behaviors not_separated_gt, not_separated_lt, separated; - */ -static int memoverlap(char const *p, char const *q, size_t n); - -static int char_equal_ignore_case(char c1, char c2) -{ - int __retres; - if ((int)c1 >= 'A') - if ((int)c1 <= 'Z') c1 = (char)((int)c1 - ('A' - 'a')); - if ((int)c2 >= 'A') - if ((int)c2 <= 'Z') c2 = (char)((int)c2 - ('A' - 'a')); - if ((int)c1 == (int)c2) { - __retres = 0; - goto return_label; - } - else { - __retres = (int)((unsigned char)c2) - (int)((unsigned char)c1); - goto return_label; - } - return_label: return __retres; -} - -void *memrchr(void const *s, int c, size_t n) -{ - void *__retres; - unsigned char ch; - unsigned char const *ss; - ch = (unsigned char)c; - ss = (unsigned char const *)s; - { - size_t i; - i = n; - while (i > (size_t)0) { - if ((int)*(ss + (i - (size_t)1)) == (int)ch) { - __retres = (void *)(ss + (i - (size_t)1)); - goto return_label; - } - i -= (size_t)1; - } - } - __retres = (void *)0; - return_label: return __retres; -} - /*@ assigns Frama_C_entropy_source; assigns Frama_C_entropy_source \from Frama_C_entropy_source; */ @@ -454,6 +407,10 @@ void main(void) __fc_mblen_state ∈ [--..--] __fc_mbtowc_state ∈ [--..--] __fc_wctomb_state ∈ [--..--] + __fc_time ∈ [--..--] + __fc_time_tm ∈ [--..--] + __fc_p_time_tm ∈ {{ &__fc_time_tm }} + __fc_stack_status ∈ [--..--] __fc_sockfds[0..1023] ∈ [--..--] __fc_socket_counter ∈ [--..--] __fc_open_sock_fds ∈ [--..--] @@ -4040,8 +3997,11 @@ void main(void) {{ NULL ; &S___fc_dir_entries_0___fc_opendir[0] ; &S___fc_dir_entries_1___fc_opendir[0] }} __fc_p_opendir ∈ {{ &__fc_opendir[0] }} - __fc_time ∈ [--..--] __fc_tz ∈ [--..--] + __fc_itimer_real ∈ [--..--] + __fc_itimer_virtual ∈ [--..--] + __fc_itimer_prof ∈ [--..--] + __fc_fds_state ∈ [--..--] h_errno ∈ [--..--] facilitynames[0].c_name ∈ {{ NULL ; &S_c_name_0_facilitynames[0] }} [0].c_val ∈ [--..--] @@ -4179,8 +4139,6 @@ void main(void) {{ NULL ; &S_c_name_0_prioritynames[0] ; &S_c_name_1_prioritynames[0] }} [12].c_val ∈ [--..--] - __fc_time_tm ∈ [--..--] - __fc_p_time_tm ∈ {{ &__fc_time_tm }} __fc_fds[0..1023] ∈ [--..--] S_optarg_0[0..1] ∈ [--..--] S_decimal_point___C_locale[0..1] ∈ [--..--] @@ -4322,9 +4280,9 @@ void main(void) ===================== main (0 call); - Undefined functions (0) + Undefined functions (1) ======================= - + Frama_C_update_entropy (0 call); 'Extern' global variables (0) ============================= @@ -4338,13 +4296,13 @@ void main(void) ============== Sloc = 4 Decision point = 0 - Global variables = 0 + Global variables = 4 If = 0 Loop = 0 Goto = 0 Assignment = 0 Exit point = 1 - Function = 1 + Function = 2 Function call = 0 Pointer dereferencing = 0 Cyclomatic complexity = 1 diff --git a/tests/libc/oracle/fc_libc.1.res.oracle b/tests/libc/oracle/fc_libc.1.res.oracle index cb08d210607e8f3e19eacdddb0b8a3d2e4f994e1..b2a75ee3f9551e3434f4eb74acc6334316467958 100644 --- a/tests/libc/oracle/fc_libc.1.res.oracle +++ b/tests/libc/oracle/fc_libc.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/fc_libc.c (with preprocessing) /* Generated by Frama-C */ typedef unsigned int size_t; @@ -94,6 +93,18 @@ struct __fc_lldiv_t { long long rem ; }; typedef struct __fc_lldiv_t lldiv_t; +typedef unsigned int clock_t; +struct tm { + int tm_sec ; + int tm_min ; + int tm_hour ; + int tm_mday ; + int tm_mon ; + int tm_year ; + int tm_wday ; + int tm_yday ; + int tm_isdst ; +}; typedef unsigned int socklen_t; typedef unsigned short sa_family_t; struct sockaddr { @@ -162,13 +173,23 @@ struct timezone { int tz_minuteswest ; int tz_dsttime ; }; +struct itimerval { + struct timeval it_interval ; + struct timeval it_value ; +}; typedef void * iconv_t; +struct pollfd { + int fd ; + short events ; + short revents ; +}; +typedef unsigned long nfds_t; typedef int ( jmp_buf)[5]; -struct __anonstruct_sigjmp_buf_14 { +struct __anonstruct_sigjmp_buf_38 { jmp_buf buf ; sigset_t sigs ; }; -typedef struct __anonstruct_sigjmp_buf_14 sigjmp_buf; +typedef struct __anonstruct_sigjmp_buf_38 sigjmp_buf; struct _code { char const *c_name ; int c_val ; @@ -183,18 +204,6 @@ struct rusage { struct timeval ru_utime ; struct timeval ru_stime ; }; -typedef unsigned int clock_t; -struct tm { - int tm_sec ; - int tm_min ; - int tm_hour ; - int tm_mday ; - int tm_mon ; - int tm_year ; - int tm_wday ; - int tm_yday ; - int tm_isdst ; -}; struct tms { clock_t tms_utime ; clock_t tms_stime ; @@ -319,6 +328,14 @@ extern unsigned long long Frama_C_unsigned_long_long_interval(unsigned long long */ extern long long Frama_C_long_long_interval(long long min, long long max); +/*@ requires min ≤ max; + ensures \old(min) ≤ \result ≤ \old(max); + assigns \result, Frama_C_entropy_source; + assigns \result \from min, max, Frama_C_entropy_source; + assigns Frama_C_entropy_source \from Frama_C_entropy_source; + */ +extern size_t Frama_C_size_t_interval(size_t min, size_t max); + float Frama_C_float_interval(float min, float max); double Frama_C_double_interval(double min, double max); @@ -344,7 +361,7 @@ extern __attribute__((__noreturn__)) void Frama_C_abort(void); assigns \result \from p; */ extern size_t Frama_C_offset(void const *p); -extern void *Frama_C_alloc_size(size_t size); +extern void *Frama_C_malloc_fresh(size_t size); void __FC_assert(char const *file, int line, char const *expr); @@ -354,7 +371,6 @@ extern void Frama_C_show_each_warning(); /*@ requires \false; terminates \false; assigns \nothing; */ -void __FC_assert(char const *file, int line, char const *expr);; void __FC_assert(char const *file, int line, char const *expr) { Frama_C_show_each_warning("Assertion may fail",file,line,expr); @@ -424,7 +440,6 @@ extern int isascii(int c); disjoint behaviors definitely_match, definitely_not_match; */ -int isalnum(int c);; int isalnum(int c) { int tmp; @@ -462,7 +477,6 @@ int isalnum(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int isalpha(int c);; int isalpha(int c) { int tmp; @@ -493,7 +507,6 @@ int isalpha(int c) complete behaviors match, no_match; disjoint behaviors match, no_match; */ -int isblank(int c);; int isblank(int c) { int tmp; @@ -529,7 +542,6 @@ int isblank(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int iscntrl(int c);; int iscntrl(int c) { int tmp; @@ -552,7 +564,6 @@ int iscntrl(int c) complete behaviors match, no_match; disjoint behaviors match, no_match; */ -int isdigit(int c);; int isdigit(int c) { int tmp; @@ -576,7 +587,6 @@ int isdigit(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int isgraph(int c);; int isgraph(int c) { int tmp; @@ -598,7 +608,6 @@ int isgraph(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int islower(int c);; int islower(int c) { int tmp; @@ -622,7 +631,6 @@ int islower(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int isprint(int c);; int isprint(int c) { int tmp; @@ -648,7 +656,6 @@ int isprint(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int ispunct(int c);; int ispunct(int c) { int tmp; @@ -672,7 +679,6 @@ int ispunct(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int isspace(int c);; int isspace(int c) { int tmp; @@ -704,7 +710,6 @@ int isspace(int c) disjoint behaviors definitely_match, definitely_not_match; */ -int isupper(int c);; int isupper(int c) { int tmp; @@ -732,7 +737,6 @@ int isupper(int c) complete behaviors match, no_match; disjoint behaviors match, no_match; */ -int isxdigit(int c);; int isxdigit(int c) { int tmp; @@ -769,7 +773,6 @@ int isxdigit(int c) disjoint behaviors definitely_changed, definitely_not_changed; */ -int tolower(int c);; int tolower(int c) { int __retres; @@ -797,7 +800,6 @@ int tolower(int c) disjoint behaviors definitely_changed, definitely_not_changed; */ -int toupper(int c);; int toupper(int c) { int __retres; @@ -900,7 +902,6 @@ extern intmax_t strtoimax(char const *nptr, char **endptr, int base); assigns \result; assigns \result \from c; */ -intmax_t imaxabs(intmax_t c);; intmax_t imaxabs(intmax_t c) { intmax_t __retres; @@ -921,7 +922,6 @@ intmax_t imaxabs(intmax_t c) assigns \result; assigns \result \from numer, denom; */ -imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);; imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom) { imaxdiv_t r; @@ -1176,6 +1176,10 @@ predicate valid_read_string{L}(char *s) = 0 ≤ strlen(s) ∧ \valid_read(s + (0 .. strlen(s))); */ /*@ +predicate valid_read_nstring{L}(char *s, ℤ n) = + \valid_read(s + (0 .. n - 1)) ∨ valid_read_string(s); + */ +/*@ predicate valid_string_or_null{L}(char *s) = s ≡ \null ∨ valid_string(s); */ /*@ @@ -1183,6 +1187,14 @@ predicate valid_wstring{L}(wchar_t *s) = 0 ≤ wcslen(s) ∧ \valid(s + (0 .. wcslen(s))); */ /*@ +predicate valid_read_wstring{L}(wchar_t *s) = + 0 ≤ wcslen(s) ∧ \valid_read(s + (0 .. wcslen(s))); + */ +/*@ +predicate valid_read_nwstring{L}(wchar_t *s, ℤ n) = + \valid_read(s + (0 .. n - 1)) ∨ valid_read_wstring(s); + */ +/*@ predicate valid_wstring_or_null{L}(wchar_t *s) = s ≡ \null ∨ valid_wstring(s); @@ -1230,7 +1242,6 @@ char *__frama_c_locale_names[1] = {(char *)"C"}; assigns __frama_c_locale \from category, *(locale + (..)); assigns \result \from __frama_c_locale, category, *(locale + (..)); */ -char *setlocale(int category, char const *locale);; char *setlocale(int category, char const *locale) { char *__retres; @@ -1245,7 +1256,6 @@ char *setlocale(int category, char const *locale) /*@ ensures \result ≡ __frama_c_locale; assigns \nothing; */ -struct lconv *localeconv(void);; struct lconv *localeconv(void) { return __frama_c_locale; @@ -1498,7 +1508,6 @@ extern double Frama_C_exp(double x); /*@ assigns \result; assigns \result \from x; */ -double exp(double x);; double exp(double x) { double tmp; @@ -1512,7 +1521,6 @@ extern double Frama_C_cos(double x); /*@ assigns \result; assigns \result \from x; */ -double cos(double x);; double cos(double x) { double tmp; @@ -1526,7 +1534,6 @@ extern double Frama_C_sin(double x); /*@ assigns \result; assigns \result \from x; */ -double sin(double x);; double sin(double x) { double tmp; @@ -1540,7 +1547,6 @@ extern double Frama_C_sqrt(double x); /*@ assigns \result; assigns \result \from x; */ -double sqrt(double x);; double sqrt(double x) { double tmp; @@ -1548,7 +1554,6 @@ double sqrt(double x) return tmp; } -double fabs(double x);; double fabs(double x) { double __retres; @@ -1633,6 +1638,12 @@ extern void setbuf(FILE *stream, char *buf); assigns *stream \from buf, mode, size; */ extern int setvbuf(FILE *stream, char *buf, int mode, size_t size); +/*@ axiomatic format_length { + logic ℤ format_length{L}(char *format) ; + + } + +*/ /*@ assigns *stream; assigns *stream \from *(format + (..)), arg; */ extern int vfprintf(FILE *stream, char const *format, va_list arg); @@ -1735,8 +1746,15 @@ extern size_t fwrite(void const *ptr, size_t size, size_t nmemb, FILE *stream); assigns *pos \from *stream; */ extern int fgetpos(FILE *stream, fpos_t *pos); -/*@ assigns *stream, __fc_errno; - assigns *stream \from offset, whence; */ +/*@ requires \valid(stream); + requires whence ≡ 0 ∨ whence ≡ 1 ∨ whence ≡ 2; + assigns *stream, \result, __fc_errno; + assigns *stream \from *stream, (indirect: offset), (indirect: whence); + assigns \result + \from (indirect: *stream), (indirect: offset), (indirect: whence); + assigns __fc_errno + \from (indirect: *stream), (indirect: offset), (indirect: whence); + */ extern int fseek(FILE *stream, long offset, int whence); /*@ assigns *stream; @@ -2079,7 +2097,9 @@ extern unsigned long strtoul(char const *nptr, char **endptr, int base); extern unsigned long long strtoull(char const *nptr, char **endptr, int base); /*@ ghost - int __fc_random_counter __attribute__((__unused__, __FRAMA_C_MODEL__)); */ +extern int __fc_random_counter __attribute__((__unused__, __FRAMA_C_MODEL__)); +*/ + unsigned long const __fc_rand_max = (unsigned long)32767; /*@ ensures 0 ≤ \result ≤ __fc_rand_max; assigns \result, __fc_random_counter; @@ -2103,18 +2123,21 @@ extern void srand48(long seed); assigns __fc_random_counter \from seed; */ extern void srand(unsigned int seed); -void *calloc(size_t nmemb, size_t size); - /*@ ghost extern int __fc_heap_status __attribute__((__FRAMA_C_MODEL__)); */ /*@ axiomatic dynamic_allocation { - predicate is_allocable{L}(size_t n) + predicate is_allocable{L}(ℤ n) reads __fc_heap_status; + axiom never_allocable{L}: + ∀ ℤ i; i < 0 ∨ i > 4294967295U ⇒ ¬is_allocable(i); + } */ +void *calloc(size_t nmemb, size_t size); + void *malloc(size_t size); void free(void *p); @@ -2213,15 +2236,37 @@ extern void qsort(void *base, size_t nmemb, size_t size, int abs(int i); -/*@ requires abs_representable: (long)(-j) ≡ -j; +/*@ requires abs_representable: j > -2147483647L - 1L; assigns \result; assigns \result \from j; + + behavior neg: + assumes j < 0; + ensures \result ≡ -\old(j); + + behavior nonneg: + assumes j ≥ 0; + ensures \result ≡ \old(j); + + complete behaviors nonneg, neg; + disjoint behaviors nonneg, neg; */ extern long labs(long j); -/*@ requires abs_representable: (long long)(-j) ≡ -j; +/*@ requires abs_representable: j > -9223372036854775807LL - 1LL; assigns \result; assigns \result \from j; + + behavior neg: + assumes j < 0; + ensures \result ≡ -\old(j); + + behavior nonneg: + assumes j ≥ 0; + ensures \result ≡ \old(j); + + complete behaviors nonneg, neg; + disjoint behaviors nonneg, neg; */ extern long long llabs(long long j); @@ -2237,7 +2282,8 @@ extern ldiv_t ldiv(long numer, long denom); assigns \result \from numer, denom; */ extern lldiv_t lldiv(long long numer, long long denom); -/*@ ghost int __fc_mblen_state; */ +/*@ ghost extern int __fc_mblen_state; */ + /*@ assigns \result, __fc_mblen_state; assigns \result \from (indirect: s), (indirect: *(s + (0 ..))), (indirect: n), @@ -2248,7 +2294,8 @@ extern lldiv_t lldiv(long long numer, long long denom); */ extern int mblen(char const *s, size_t n); -/*@ ghost int __fc_mbtowc_state; */ +/*@ ghost extern int __fc_mbtowc_state; */ + /*@ requires \separated(pwc, s); ensures \result ≤ \old(n); assigns \result, *(pwc + (0 .. \result - 1)), __fc_mbtowc_state; @@ -2264,7 +2311,8 @@ extern int mblen(char const *s, size_t n); */ extern int mbtowc(wchar_t *pwc, char const *s, size_t n); -/*@ ghost int __fc_wctomb_state; */ +/*@ ghost extern int __fc_wctomb_state; */ + /*@ assigns \result, *(s + (0 ..)), __fc_wctomb_state; assigns \result \from (indirect: wc), __fc_wctomb_state; assigns *(s + (0 ..)) \from wc, __fc_wctomb_state; @@ -2291,11 +2339,21 @@ extern size_t mbstowcs(wchar_t *pwcs, char const *s, size_t n); */ extern size_t wcstombs(char *s, wchar_t const *pwcs, size_t n); -/*@ requires abs_representable: (int)(-i) ≡ -i; +/*@ requires abs_representable: i > -2147483647 - 1; assigns \result; assigns \result \from i; + + behavior neg: + assumes i < 0; + ensures \result ≡ -\old(i); + + behavior nonneg: + assumes i ≥ 0; + ensures \result ≡ \old(i); + + complete behaviors nonneg, neg; + disjoint behaviors nonneg, neg; */ -int abs(int i);; int abs(int i) { int __retres; @@ -2311,18 +2369,15 @@ int abs(int i) assigns \result; assigns \result \from (indirect: p), (indirect: *(p + (0 ..))); */ -int atoi(char const *p);; int atoi(char const *p) { int __retres; int n; int c; - int neg; - unsigned char *up; int tmp_1; int tmp_3; - neg = 0; - up = (unsigned char *)p; + int neg = 0; + unsigned char *up = (unsigned char *)p; c = (int)*up; tmp_1 = isdigit(c); if (! tmp_1) { @@ -2331,17 +2386,13 @@ int atoi(char const *p) int tmp; tmp = isspace(c); if (! tmp) break; - { /* sequence */ - up ++; - c = (int)*up; - } + up ++; + c = (int)*up; } switch (c) { case '-': neg ++; - case '+': { /* sequence */ - up ++; - c = (int)*up; - } + case '+': up ++; + c = (int)*up; } tmp_0 = isdigit(c); if (! tmp_0) { @@ -2352,10 +2403,8 @@ int atoi(char const *p) n = '0' - c; while (1) { int tmp_2; - { /* sequence */ - up ++; - c = (int)*up; - } + up ++; + c = (int)*up; tmp_2 = isdigit(c); if (! tmp_2) break; n *= 10; @@ -2388,11 +2437,10 @@ int atoi(char const *p) complete behaviors no_allocation, allocation; disjoint behaviors no_allocation, allocation; */ -void *malloc(size_t size);; void *malloc(size_t size) { void *tmp; - tmp = Frama_C_alloc_size(size); + tmp = Frama_C_malloc_fresh(size); return tmp; } @@ -2417,25 +2465,51 @@ extern void Frama_C_free(void *base); complete behaviors no_deallocation, deallocation; disjoint behaviors no_deallocation, deallocation; */ -void free(void *p);; void free(void *p) { if (p) Frama_C_free(p); return; } -/*@ requires nmemb * size ≤ 4294967295U; */ -void *calloc(size_t nmemb, size_t size);; +/*@ assigns __fc_heap_status, \result; + assigns __fc_heap_status + \from (indirect: nmemb), (indirect: size), __fc_heap_status; + assigns \result + \from (indirect: nmemb), (indirect: size), (indirect: __fc_heap_status); + allocates \result; + + behavior allocation: + assumes is_allocable(nmemb * size); + ensures \fresh{Old, Here}(\result,\old(nmemb) * \old(size)); + ensures + \initialized((char *)\result + (0 .. \old(nmemb) * \old(size) - 1)); + ensures + \subset(*((char *)\result + (0 .. \old(nmemb) * \old(size) - 1)), + {0}); + + behavior no_allocation: + assumes ¬is_allocable(nmemb * size); + ensures \result ≡ \null; + assigns \result; + assigns \result \from \nothing; + allocates \nothing; + + complete behaviors no_allocation, allocation; + disjoint behaviors no_allocation, allocation; + */ void *calloc(size_t nmemb, size_t size) { void *__retres; - size_t l; - char *p; - l = nmemb * size; - p = (char *)malloc(l); - Frama_C_memset((void *)p,0,l); + size_t l = nmemb * size; + if (size != (size_t)0) + if (l / size != nmemb) { + __retres = (void *)0; + goto return_label; + } + char *p = malloc(l); + if (p) Frama_C_memset((void *)p,0,l); __retres = (void *)p; - return __retres; + return_label: return __retres; } int memcmp(void const *s1, void const *s2, size_t n); @@ -2539,6 +2613,7 @@ char *strdup(char const *s); char *strndup(char const *s, size_t n); /*@ requires \valid((char *)s + (0 .. n - 1)); + ensures \subset(*((char *)\old(s) + (0 .. \old(n) - 1)), {0}); assigns *((char *)s + (0 .. n - 1)); assigns *((char *)s + (0 .. n - 1)) \from \nothing; */ @@ -2558,15 +2633,12 @@ int strcasecmp(char const *s1, char const *s2); \from *((char *)src + (0 .. n - 1)); assigns \result \from dest; */ -void *memcpy(void *dest, void const *src, size_t n);; void *memcpy(void *dest, void const *src, size_t n) { void *__retres; - char *res; - res = (char *)dest; + char *res = (char *)dest; { - size_t i; - i = (unsigned int)0; + size_t i = (unsigned int)0; while (i < n) { *((char *)dest + i) = *((char *)src + i); i += (size_t)1; @@ -2608,17 +2680,15 @@ static int memoverlap(char const *p, char const *q, size_t n); \from *((char *)src + (0 .. n - 1)); assigns \result \from dest; */ -void *memmove(void *dest, void const *src, size_t n);; void *memmove(void *dest, void const *src, size_t n) { void *__retres; - char *s; int tmp_0; if (n == (size_t)0) { __retres = dest; goto return_label; } - s = (char *)src; + char *s = (char *)src; tmp_0 = memoverlap((char const *)dest,(char const *)src,n); if (tmp_0 <= 0) { void *tmp; @@ -2627,11 +2697,9 @@ void *memmove(void *dest, void const *src, size_t n) goto return_label; } else { - char *d; - d = (char *)dest; + char *d = (char *)dest; { - size_t i; - i = n - (size_t)1; + size_t i = n - (size_t)1; while (i > (size_t)0) { *(d + i) = *(s + i); i -= (size_t)1; @@ -2649,7 +2717,6 @@ void *memmove(void *dest, void const *src, size_t n) assigns \result; assigns \result \from *(s + (0 ..)); */ -size_t strlen(char const *s);; size_t strlen(char const *s) { size_t i; @@ -2665,14 +2732,11 @@ size_t strlen(char const *s) assigns *((char *)s + (0 .. n - 1)) \from c; assigns \result \from s; */ -void *memset(void *s, int c, size_t n);; void *memset(void *s, int c, size_t n) { - unsigned char *p; - p = (unsigned char *)s; + unsigned char *p = (unsigned char *)s; { - size_t i; - i = (unsigned int)0; + size_t i = (unsigned int)0; while (i < n) { *(p + i) = (unsigned char)c; i += (size_t)1; @@ -2687,7 +2751,6 @@ void *memset(void *s, int c, size_t n) assigns \result; assigns \result \from *(s1 + (0 ..)), *(s2 + (0 ..)); */ -int strcmp(char const *s1, char const *s2);; int strcmp(char const *s1, char const *s2) { int __retres; @@ -2710,13 +2773,11 @@ int strcmp(char const *s1, char const *s2) assigns \result; assigns \result \from *(s1 + (0 .. n - 1)), *(s2 + (0 .. n - 1)); */ -int strncmp(char const *s1, char const *s2, size_t n);; int strncmp(char const *s1, char const *s2, size_t n) { int __retres; { - size_t i; - i = (unsigned int)0; + size_t i = (unsigned int)0; while (i < n) { if ((int)*(s1 + i) != (int)*(s2 + i)) { __retres = (int)*((unsigned char *)s1 + i) - (int)*((unsigned char *)s2 + i); @@ -2742,7 +2803,6 @@ int strncmp(char const *s1, char const *s2, size_t n) assigns \result \from *((char *)s1 + (0 .. n - 1)), *((char *)s2 + (0 .. n - 1)); */ -int memcmp(void const *s1, void const *s2, size_t n);; int memcmp(void const *s1, void const *s2, size_t n) { int __retres; @@ -2751,8 +2811,7 @@ int memcmp(void const *s1, void const *s2, size_t n) p1 = (unsigned char const *)s1; p2 = (unsigned char const *)s2; { - size_t i; - i = (unsigned int)0; + size_t i = (unsigned int)0; while (i < n) { if ((int)*(p1 + i) != (int)*(p2 + i)) { __retres = (int)*(p1 + i) - (int)*(p2 + i); @@ -2783,7 +2842,6 @@ static int char_equal_ignore_case(char c1, char c2) return_label: return __retres; } -int strcasecmp(char const *s1, char const *s2);; int strcasecmp(char const *s1, char const *s2) { int __retres; @@ -2795,8 +2853,7 @@ int strcasecmp(char const *s1, char const *s2) } else break; { - int res; - res = char_equal_ignore_case(*(s1 + i),*(s2 + i)); + int res = char_equal_ignore_case(*(s1 + i),*(s2 + i)); if (res != 0) { __retres = res; goto return_label; @@ -2838,12 +2895,10 @@ int strcasecmp(char const *s1, char const *s2) \from *(src + (0 .. strlen{Old}(src))); assigns \result \from dest; */ -char *strcat(char *dest, char const *src);; char *strcat(char *dest, char const *src) { size_t i; - size_t n; - n = strlen((char const *)dest); + size_t n = strlen((char const *)dest); i = (unsigned int)0; while ((int)*(src + i) != 0) { *(dest + (n + i)) = *(src + i); @@ -2857,7 +2912,6 @@ char *strcat(char *dest, char const *src) valid_string_src: valid_read_string(src) ∨ \valid_read(src + (0 .. n - 1)); requires valid_string_dst: valid_string(dest); - requires room_string: \valid(dest + (strlen(dest) .. strlen(dest) + n)); ensures \result ≡ \old(dest); assigns *(dest + (strlen{Old}(dest) .. strlen{Old}(dest) + n)), \result; assigns *(dest + (strlen{Old}(dest) .. strlen{Old}(dest) + n)) @@ -2866,6 +2920,8 @@ char *strcat(char *dest, char const *src) behavior complete: assumes valid_read_string(src) ∧ strlen(src) ≤ n; + requires + room_string: \valid((dest + strlen(dest)) + (0 .. strlen(src))); ensures strlen(\old(dest)) ≡ \old(strlen(dest) + strlen(src)); assigns *(dest + (strlen{Old}(dest) .. strlen{Old}(dest) + strlen{Old}(src))), @@ -2877,6 +2933,7 @@ char *strcat(char *dest, char const *src) behavior partial: assumes ¬(valid_read_string(src) ∧ strlen(src) ≤ n); + requires room_string: \valid((dest + strlen(dest)) + (0 .. n)); ensures strlen(\old(dest)) ≡ \old(strlen(dest)) + \old(n); assigns *(dest + (strlen{Old}(dest) .. strlen{Old}(dest) + n)), \result; @@ -2884,12 +2941,10 @@ char *strcat(char *dest, char const *src) \from *(src + (0 .. strlen{Old}(src))); assigns \result \from dest; */ -char *strncat(char *dest, char const *src, size_t n);; char *strncat(char *dest, char const *src, size_t n) { - size_t dest_len; size_t i; - dest_len = strlen((char const *)dest); + size_t dest_len = strlen((char const *)dest); i = (unsigned int)0; while (i < n) { if ((int)*(src + i) == 0) break; @@ -2902,6 +2957,9 @@ char *strncat(char *dest, char const *src, size_t n) /*@ requires valid_string_src: valid_read_string(src); requires room_string: \valid(dest + (0 .. strlen(src))); + requires + separated_strings: + \separated(dest + (0 .. strlen(src)), src + (0 .. strlen(src))); ensures strcmp(\old(dest), \old(src)) ≡ 0; ensures \result ≡ \old(dest); assigns *(dest + (0 .. strlen{Old}(src))), \result; @@ -2909,7 +2967,6 @@ char *strncat(char *dest, char const *src, size_t n) \from *(src + (0 .. strlen{Old}(src))); assigns \result \from dest; */ -char *strcpy(char *dest, char const *src);; char *strcpy(char *dest, char const *src) { size_t i; @@ -2938,7 +2995,6 @@ char *strcpy(char *dest, char const *src) assumes n ≤ strlen(src); ensures memcmp{Post, Post}(\old(dest), \old(src), \old(n)) ≡ 0; */ -char *strncpy(char *dest, char const *src, size_t n);; char *strncpy(char *dest, char const *src, size_t n) { size_t i; @@ -2975,13 +3031,11 @@ char *strncpy(char *dest, char const *src, size_t n) ensures \result ≡ \null ∨ \base_addr(\result) ≡ \base_addr(\old(s)); */ -char *strchr(char const *s, int c);; char *strchr(char const *s, int c) { char *__retres; - char ch; size_t i; - ch = (char)c; + char const ch = (char)c; i = (unsigned int)0; while ((int)*(s + i) != (int)ch) { if ((int)*(s + i) == 0) { @@ -3012,17 +3066,14 @@ char *strchr(char const *s, int c) ensures \result ≡ \null ∨ \base_addr(\result) ≡ \base_addr(\old(s)); */ -char *strrchr(char const *s, int c);; char *strrchr(char const *s, int c) { char *__retres; - char ch; - ch = (char)c; + char const ch = (char)c; { - size_t i; size_t tmp; tmp = strlen(s); - i = tmp + (size_t)1; + size_t i = tmp + (size_t)1; while (i > (size_t)0) { if ((int)*(s + (i - (size_t)1)) == (int)ch) { __retres = (char *)(s + (i - (size_t)1)); @@ -3053,17 +3104,13 @@ char *strrchr(char const *s, int c) assumes ¬(memchr((char *)s, c, n) ≡ \true); ensures \result ≡ \null; */ -void *memchr(void const *s, int c, size_t n);; void *memchr(void const *s, int c, size_t n) { void *__retres; - unsigned char ch; - unsigned char const *ss; - ch = (unsigned char)c; - ss = (unsigned char const *)s; + unsigned char const ch = (unsigned char)c; + unsigned char const *ss = (unsigned char const *)s; { - size_t i; - i = (unsigned int)0; + size_t i = (unsigned int)0; while (i < n) { if ((int)*(ss + i) == (int)ch) { __retres = (void *)(ss + i); @@ -3079,13 +3126,10 @@ void *memchr(void const *s, int c, size_t n) void *memrchr(void const *s, int c, size_t n) { void *__retres; - unsigned char ch; - unsigned char const *ss; - ch = (unsigned char)c; - ss = (unsigned char const *)s; + unsigned char const ch = (unsigned char)c; + unsigned char const *ss = (unsigned char const *)s; { - size_t i; - i = n; + size_t i = n; while (i > (size_t)0) { if ((int)*(ss + (i - (size_t)1)) == (int)ch) { __retres = (void *)(ss + (i - (size_t)1)); @@ -3109,7 +3153,6 @@ void *memrchr(void const *s, int c, size_t n) \from haystack, (indirect: *(haystack + (0 ..))), (indirect: *(needle + (0 ..))); */ -char *strstr(char const *haystack, char const *needle);; char *strstr(char const *haystack, char const *needle) { char *__retres; @@ -3118,8 +3161,7 @@ char *strstr(char const *haystack, char const *needle) goto return_label; } { - size_t i; - i = (unsigned int)0; + size_t i = (unsigned int)0; while ((int)*(haystack + i) != 0) { { size_t j; @@ -3144,7 +3186,6 @@ char *strstr(char const *haystack, char const *needle) assigns \result; assigns \result \from errnum; */ -char *strerror(int errnum);; char *strerror(int errnum) { char *__retres; @@ -3158,15 +3199,12 @@ char *strerror(int errnum) strcmp(\result, \old(s)) ≡ 0; assigns \nothing; */ -char *strdup(char const *s);; char *strdup(char const *s) { - size_t l; size_t tmp; - char *p; tmp = strlen(s); - l = tmp + (size_t)1; - p = (char *)malloc(l); + size_t l = tmp + (size_t)1; + char *p = malloc(l); memcpy((void *)p,(void const *)s,l); return p; } @@ -3178,22 +3216,74 @@ char *strdup(char const *s) strncmp(\result, \old(s), \old(n)) ≡ 0; assigns \nothing; */ -char *strndup(char const *s, size_t n);; char *strndup(char const *s, size_t n) { size_t l; - char *p; l = (unsigned int)0; while (l < n) { if ((int)*(s + l) == 0) break; l += (size_t)1; } - p = (char *)malloc(l + (size_t)1); + char *p = malloc(l + (size_t)1); memcpy((void *)p,(void const *)s,l); *(p + l) = (char)0; return p; } +/*@ ghost unsigned int volatile __fc_time __attribute__((__FRAMA_C_MODEL__)); + */ +/*@ assigns \result; + assigns \result \from __fc_time; */ +extern clock_t clock(void); + +/*@ assigns \result; + assigns \result \from time1, time0; */ +extern double difftime(time_t time1, time_t time0); + +/*@ assigns *timeptr, \result; + assigns *timeptr \from *timeptr; + assigns \result \from *timeptr; + */ +extern time_t mktime(struct tm *timeptr); + +/*@ assigns *timer, \result; + assigns *timer \from __fc_time; + assigns \result \from __fc_time; + + behavior null: + assumes timer ≡ \null; + assigns \result; + assigns \result \from __fc_time; + + behavior not_null: + assumes timer ≢ \null; + requires \valid(timer); + ensures \initialized(\old(timer)); + assigns *timer, \result; + assigns *timer \from __fc_time; + assigns \result \from __fc_time; + + complete behaviors not_null, null; + disjoint behaviors not_null, null; + */ +extern time_t time(time_t *timer); + +struct tm __fc_time_tm; +struct tm * const __fc_p_time_tm = & __fc_time_tm; +/*@ ensures \result ≡ &__fc_time_tm ∨ \result ≡ \null; + assigns \result, __fc_time_tm; + assigns \result \from __fc_p_time_tm; + assigns __fc_time_tm \from *timer; + */ +extern struct tm *gmtime(time_t const *timer); + +/*@ ensures \result ≡ &__fc_time_tm ∨ \result ≡ \null; + assigns \result, __fc_time_tm; + assigns \result \from __fc_p_time_tm; + assigns __fc_time_tm \from *timer; + */ +extern struct tm *localtime(time_t const *timer); + /*@ ensures \result ≡ \null ∨ \subset(\result, \old(s) + (0 .. \old(n) - 1)); assigns \result; @@ -3209,7 +3299,7 @@ extern wchar_t *wmemchr(wchar_t const *s, wchar_t c, size_t n); */ extern int wmemcmp(wchar_t const *s1, wchar_t const *s2, size_t n); -wchar_t *wmemcpy(wchar_t *region1, wchar_t const *region2, size_t n); +wchar_t *wmemcpy(wchar_t *dest, wchar_t const *src, size_t n); /*@ ensures \result ≡ \old(dest); assigns *(dest + (0 .. n - 1)), \result; @@ -3221,7 +3311,7 @@ extern wchar_t *wmemmove(wchar_t *dest, wchar_t const *src, size_t n); wchar_t *wmemset(wchar_t *dest, wchar_t val, size_t len); -wchar_t *wcscat(wchar_t *s1, wchar_t const *s2); +wchar_t *wcscat(wchar_t *dest, wchar_t const *src); /*@ ensures \result ≡ \null ∨ \subset(\result, \old(wcs) + (0 ..)); assigns \result; @@ -3235,7 +3325,7 @@ extern wchar_t *wcschr(wchar_t const *wcs, wchar_t wc); */ extern int wcscmp(wchar_t const *s1, wchar_t const *s2); -wchar_t *wcscpy(wchar_t *s1, wchar_t const *s2); +wchar_t *wcscpy(wchar_t *dest, wchar_t const *src); /*@ assigns \result; assigns \result @@ -3274,7 +3364,7 @@ wchar_t *wcsncat(wchar_t *dest, wchar_t const *src, size_t n); */ extern int wcsncmp(wchar_t const *s1, wchar_t const *s2, size_t n); -wchar_t *wcsncpy(wchar_t *s1, wchar_t const *s2, size_t n); +wchar_t *wcsncpy(wchar_t *dest, wchar_t const *src, size_t n); /*@ ensures \result ≡ \null ∨ \subset(\result, \old(wcs) + (0 ..)); assigns \result; @@ -3303,189 +3393,120 @@ extern size_t wcsspn(wchar_t const *wcs, wchar_t const *accept); */ extern wchar_t *wcsstr(wchar_t const *haystack, wchar_t const *needle); -/*@ requires \separated(region1 + (0 .. n - 1), region2 + (0 .. n - 1)); - ensures \result ≡ \old(region1); - assigns *(region1 + (0 .. n - 1)), \result; - assigns *(region1 + (0 .. n - 1)) - \from *(region2 + (0 .. n - 1)), (indirect: region2), (indirect: n); - assigns \result \from region1; +/*@ axiomatic wformat_length { + logic ℤ wformat_length{L}(wchar_t *format) ; + + } + +*/ +/*@ requires \separated(dest + (0 .. n - 1), src + (0 .. n - 1)); + ensures \result ≡ \old(dest); + assigns *(dest + (0 .. n - 1)), \result; + assigns *(dest + (0 .. n - 1)) + \from *(src + (0 .. n - 1)), (indirect: src), (indirect: n); + assigns \result \from dest; */ -wchar_t *wmemcpy(wchar_t *region1, wchar_t const *region2, size_t n);; -wchar_t *wmemcpy(wchar_t *region1, wchar_t const *region2, size_t n) +wchar_t *wmemcpy(wchar_t *dest, wchar_t const *src, size_t n) { - wchar_t const *first; - wchar_t const *last; - wchar_t *result; - wchar_t *dest; - first = region2; - last = region2 + n; - result = region1; - dest = result; - while (first != last) { - wchar_t *tmp; - wchar_t const *tmp_0; - { /* sequence */ - tmp = dest; - dest ++; - tmp_0 = first; - first ++; - *tmp = *tmp_0; + { + size_t i = (unsigned int)0; + while (i < n) { + *(dest + i) = *(src + i); + i += (size_t)1; } } - return result; + return dest; } /*@ ensures \result ≡ \old(dest); + ensures \initialized(\old(dest) + (0 .. \old(len) - 1)); + ensures \subset(*(\old(dest) + (0 .. \old(len) - 1)), \old(val)); assigns *(dest + (0 .. len - 1)), \result; assigns *(dest + (0 .. len - 1)) \from val, (indirect: len); assigns \result \from dest; */ -wchar_t *wmemset(wchar_t *dest, wchar_t val, size_t len);; wchar_t *wmemset(wchar_t *dest, wchar_t val, size_t len) { - wchar_t *ptr; - ptr = dest; - while (1) { - size_t tmp_0; - wchar_t *tmp; - { /* sequence */ - tmp_0 = len; - len -= (size_t)1; - ; - } - if (! (tmp_0 > (size_t)0)) break; - { /* sequence */ - tmp = ptr; - ptr ++; - *tmp = val; + { + size_t i = (unsigned int)0; + while (i < len) { + *(dest + i) = val; + i += (size_t)1; } } return dest; } -/*@ ensures \result ≡ \old(s1); - assigns *(s1 + (0 ..)), \result; - assigns *(s1 + (0 ..)) - \from *(s2 + (0 ..)), (indirect: s2), *(s1 + (0 ..)), (indirect: s1); - assigns \result \from s1; +/*@ ensures \result ≡ \old(dest); + assigns *(dest + (0 ..)), \result; + assigns *(dest + (0 ..)) + \from *(src + (0 ..)), (indirect: src), *(dest + (0 ..)), + (indirect: dest); + assigns \result \from dest; */ -wchar_t *wcscpy(wchar_t *s1, wchar_t const *s2);; -wchar_t *wcscpy(wchar_t *s1, wchar_t const *s2) +wchar_t *wcscpy(wchar_t *dest, wchar_t const *src) { - wchar_t *os1; - os1 = s1; - while (1) { - wchar_t *tmp; - wchar_t const *tmp_1; - wchar_t tmp_0; - { /* sequence */ - tmp = s1; - s1 ++; - tmp_1 = s2; - s2 ++; - tmp_0 = *tmp_1; - } - *tmp = tmp_0; - if (! tmp_0) break; + size_t i; + i = (unsigned int)0; + while (*(src + i) != 0) { + *(dest + i) = *(src + i); + i += (size_t)1; } - return os1; + *(dest + i) = 0; + return dest; } /*@ assigns \result; assigns \result \from (indirect: *(str + (0 ..))); */ -size_t wcslen(wchar_t const *str);; size_t wcslen(wchar_t const *str) { - size_t __retres; - wchar_t const *s; - s = str; - s = str; - while (*s) s ++; - __retres = (unsigned int)(s - str); - return __retres; + size_t i; + i = (unsigned int)0; + while (*(str + i) != 0) i += (size_t)1; + return i; } -/*@ requires \separated(s1 + (0 .. n - 1), s2 + (0 .. n - 1)); - ensures \result ≡ \old(s1); - assigns *(s1 + (0 .. n - 1)), \result; - assigns *(s1 + (0 .. n - 1)) - \from *(s2 + (0 .. n - 1)), (indirect: s2), (indirect: n); - assigns \result \from s1; +/*@ requires \separated(dest + (0 .. n - 1), src + (0 .. n - 1)); + ensures \result ≡ \old(dest); + assigns *(dest + (0 .. n - 1)), \result; + assigns *(dest + (0 .. n - 1)) + \from *(src + (0 .. n - 1)), (indirect: src), (indirect: n); + assigns \result \from dest; */ -wchar_t *wcsncpy(wchar_t *s1, wchar_t const *s2, size_t n);; -wchar_t *wcsncpy(wchar_t *s1, wchar_t const *s2, size_t n) +wchar_t *wcsncpy(wchar_t *dest, wchar_t const *src, size_t n) { - wchar_t *os1; - os1 = s1; - n += (size_t)1; - while (1) { - n -= (size_t)1; - if (n != (size_t)0) { - wchar_t *tmp; - wchar_t const *tmp_1; - wchar_t tmp_0; - { /* sequence */ - tmp = s1; - s1 ++; - tmp_1 = s2; - s2 ++; - tmp_0 = *tmp_1; - } - *tmp = tmp_0; - if (! (tmp_0 != 0)) break; - } - else break; + size_t i; + i = (unsigned int)0; + while (i < n) { + *(dest + i) = *(src + i); + if (*(src + i) == 0) break; + i += (size_t)1; } - if (n != (size_t)0) - while (1) { - wchar_t *tmp_2; - n -= (size_t)1; - if (! (n != (size_t)0)) break; - { /* sequence */ - tmp_2 = s1; - s1 ++; - *tmp_2 = 0; - } - } - return os1; + while (i < n) { + *(dest + i) = 0; + i += (size_t)1; + } + return dest; } -/*@ ensures \result ≡ \old(s1); - assigns *(s1 + (0 ..)), \result; - assigns *(s1 + (0 ..)) - \from *(s1 + (0 ..)), (indirect: s1), *(s2 + (0 ..)), (indirect: s2); - assigns \result \from s1; +/*@ ensures \result ≡ \old(dest); + assigns *(dest + (0 ..)), \result; + assigns *(dest + (0 ..)) + \from *(dest + (0 ..)), (indirect: dest), *(src + (0 ..)), + (indirect: src); + assigns \result \from dest; */ -wchar_t *wcscat(wchar_t *s1, wchar_t const *s2);; -wchar_t *wcscat(wchar_t *s1, wchar_t const *s2) +wchar_t *wcscat(wchar_t *dest, wchar_t const *src) { - wchar_t *os1; - os1 = s1; - while (1) { - wchar_t *tmp; - { /* sequence */ - tmp = s1; - s1 ++; - ; - } - if (! *tmp) break; - } - s1 --; - while (1) { - wchar_t *tmp_0; - wchar_t const *tmp_2; - wchar_t tmp_1; - { /* sequence */ - tmp_0 = s1; - s1 ++; - tmp_2 = s2; - s2 ++; - tmp_1 = *tmp_2; - } - *tmp_0 = tmp_1; - if (! tmp_1) break; + size_t i; + size_t n = wcslen((wchar_t const *)dest); + i = (unsigned int)0; + while (*(src + i) != 0) { + *(dest + (n + i)) = *(src + i); + i += (size_t)1; } - return os1; + *(dest + (n + i)) = 0; + return dest; } /*@ ensures \result ≡ \old(dest); @@ -3495,12 +3516,10 @@ wchar_t *wcscat(wchar_t *s1, wchar_t const *s2) (indirect: src), (indirect: n); assigns \result \from dest; */ -wchar_t *wcsncat(wchar_t *dest, wchar_t const *src, size_t n);; wchar_t *wcsncat(wchar_t *dest, wchar_t const *src, size_t n) { - size_t dest_len; size_t i; - dest_len = wcslen((wchar_t const *)dest); + size_t dest_len = wcslen((wchar_t const *)dest); i = (unsigned int)0; while (1) { if (i < n) { @@ -3524,7 +3543,6 @@ extern void Frama_C_update_entropy(void); assigns \result \from a, b, Frama_C_entropy_source; assigns Frama_C_entropy_source \from Frama_C_entropy_source; */ -int Frama_C_nondet(int a, int b);; int Frama_C_nondet(int a, int b) { int tmp; @@ -3538,7 +3556,6 @@ int Frama_C_nondet(int a, int b) assigns \result \from a, b, Frama_C_entropy_source; assigns Frama_C_entropy_source \from Frama_C_entropy_source; */ -void *Frama_C_nondet_ptr(void *a, void *b);; void *Frama_C_nondet_ptr(void *a, void *b) { void *__retres; @@ -3554,7 +3571,6 @@ void *Frama_C_nondet_ptr(void *a, void *b) assigns \result \from min, max, Frama_C_entropy_source; assigns Frama_C_entropy_source \from Frama_C_entropy_source; */ -int Frama_C_interval(int min, int max);; int Frama_C_interval(int min, int max) { int r; @@ -3574,7 +3590,6 @@ int Frama_C_interval(int min, int max) assigns \result \from min, max, Frama_C_entropy_source; assigns Frama_C_entropy_source \from Frama_C_entropy_source; */ -float Frama_C_float_interval(float min, float max);; float Frama_C_float_interval(float min, float max) { float tmp; @@ -3590,7 +3605,6 @@ float Frama_C_float_interval(float min, float max) assigns \result \from min, max, Frama_C_entropy_source; assigns Frama_C_entropy_source \from Frama_C_entropy_source; */ -double Frama_C_double_interval(double min, double max);; double Frama_C_double_interval(double min, double max) { double tmp; @@ -3599,6 +3613,16 @@ double Frama_C_double_interval(double min, double max) return tmp; } +/*@ ghost extern int __fc_stack_status __attribute__((__FRAMA_C_MODEL__)); */ + +/*@ ensures \fresh{Old, Here}(\result,\old(size)); + assigns __fc_stack_status, \result; + assigns __fc_stack_status \from size, __fc_stack_status; + assigns \result \from (indirect: size), (indirect: __fc_stack_status); + allocates \result; + */ +void *alloca(size_t size); + /*@ ghost struct __fc_sockfds_type __fc_sockfds[1024]; */ /*@ ghost extern int __fc_socket_counter __attribute__((__FRAMA_C_MODEL__)); */ @@ -3891,19 +3915,31 @@ extern DIR *opendir(char const *path); */ extern struct dirent *readdir(DIR *dirp); -/*@ assigns *fdset; - assigns *fdset \from *fdset, fd; */ +/*@ requires \valid(fdset); + requires \initialized(fdset); + assigns *fdset; + assigns *fdset \from *fdset, (indirect: fd); + */ extern void FD_CLR(int fd, fd_set *fdset); -/*@ assigns \nothing; */ -extern int FD_ISSET(int fd, fd_set *fdset); +/*@ requires \valid_read(fdset); + requires \initialized(fdset); + assigns \result; + assigns \result \from (indirect: *fdset), (indirect: fd); + */ +extern int FD_ISSET(int fd, fd_set const *fdset); -/*@ assigns *fdset; - assigns *fdset \from *fdset, fd; */ +/*@ requires \valid(fdset); + requires \initialized(fdset); + assigns *fdset; + assigns *fdset \from *fdset, (indirect: fd); + */ extern void FD_SET(int fd, fd_set *fdset); -/*@ assigns *fdset; - assigns *fdset \from \nothing; */ +/*@ ensures \initialized(\old(fdset)); + assigns *fdset; + assigns *fdset \from \nothing; + */ extern void FD_ZERO(fd_set *fdset); /*@ assigns \result; @@ -3924,19 +3960,19 @@ extern int open(char const *filename, int flags, void * const *__va_params); extern int openat(int dirfd, char const *filename, int flags, void * const *__va_params); -/*@ requires valid_cmd: cmd ≡ 2 ∨ cmd ≡ 4 ∨ cmd ≡ 9; +/*@ requires valid_cmd: cmd ≡ 1 ∨ cmd ≡ 3 ∨ cmd ≡ 9; assigns \result; assigns \result \from fd, cmd; */ extern int __va_fcntl_void(int fd, int cmd); -/*@ requires valid_cmd: cmd ≡ 1 ∨ cmd ≡ 3 ∨ cmd ≡ 5 ∨ cmd ≡ 10; +/*@ requires valid_cmd: cmd ≡ 0 ∨ cmd ≡ 2 ∨ cmd ≡ 4 ∨ cmd ≡ 8; assigns \result; assigns \result \from fd, cmd, arg; */ extern int __va_fcntl_int(int fd, int cmd, int arg); -/*@ requires valid_cmd: cmd ≡ 6 ∨ cmd ≡ 7 ∨ cmd ≡ 8; +/*@ requires valid_cmd: cmd ≡ 5 ∨ cmd ≡ 6 ∨ cmd ≡ 7; requires valid_arg: \valid(arg); assigns \result, *arg; assigns \result \from fd, cmd, *arg; @@ -3944,7 +3980,7 @@ extern int __va_fcntl_int(int fd, int cmd, int arg); */ extern int __va_fcntl_flock(int fd, int cmd, struct flock *arg); -/*@ requires valid_flag: (flags & 0x0200) ≡ 0; +/*@ requires valid_flag: (flags & 0x40) ≡ 0; assigns \result; assigns \result \from *(filename + (0 ..)), flags; */ @@ -3955,7 +3991,7 @@ extern int __va_open_void(char const *filename, int flags); */ extern int __va_open_mode_t(char const *filename, int flags, mode_t mode); -/*@ requires valid_flag: (flags & 0x0200) ≡ 0; +/*@ requires valid_flag: (flags & 0x40) ≡ 0; assigns \result; assigns \result \from dirfd, *(filename + (0 ..)), flags; */ @@ -3967,8 +4003,6 @@ extern int __va_openat_void(int dirfd, char const *filename, int flags); extern int __va_openat_mode_t(int dirfd, char const *filename, int flags, mode_t mode); -/*@ ghost unsigned int volatile __fc_time __attribute__((__FRAMA_C_MODEL__)); - */ /*@ ghost extern int __fc_tz __attribute__((__FRAMA_C_MODEL__)); */ /*@ assigns \result; @@ -4025,6 +4059,167 @@ extern int gettimeofday(struct timeval *tv, struct timezone *tz); */ extern int settimeofday(struct timeval const *tv, struct timezone const *tz); +/*@ ghost + struct itimerval volatile __fc_itimer_real __attribute__((__FRAMA_C_MODEL__)); + */ +/*@ ghost + struct itimerval volatile __fc_itimer_virtual __attribute__((__FRAMA_C_MODEL__)); + */ +/*@ ghost + struct itimerval volatile __fc_itimer_prof __attribute__((__FRAMA_C_MODEL__)); + */ +/*@ requires \valid(curr_value); + ensures \initialized(\old(curr_value)); + assigns \result, *curr_value; + assigns \result \from (indirect: which); + assigns *curr_value + \from __fc_itimer_real, __fc_itimer_virtual, __fc_itimer_prof; + + behavior real: + assumes which ≡ 0; + ensures \result ≡ 0; + assigns \result, *curr_value; + assigns \result \from \nothing; + assigns *curr_value \from __fc_itimer_real; + + behavior virtual: + assumes which ≡ 1; + ensures \result ≡ 0; + assigns \result, *curr_value; + assigns \result \from \nothing; + assigns *curr_value \from __fc_itimer_virtual; + + behavior prof: + assumes which ≡ 2; + ensures \result ≡ 0; + assigns \result, *curr_value; + assigns \result \from \nothing; + assigns *curr_value \from __fc_itimer_prof; + + behavior invalid: + assumes which ≢ 0 ∧ which ≢ 1 ∧ which ≢ 2; + ensures \result ≡ -1; + assigns \result; + assigns \result \from \nothing; + + complete behaviors invalid, prof, virtual, real; + disjoint behaviors invalid, prof, virtual, real; + */ +extern int getitimer(int which, struct itimerval *curr_value); + +/*@ requires \valid_read(new_value); + requires old_value ≡ \null ∨ \valid(old_value); + ensures \result ≡ 0 ∨ \result ≡ -1; + assigns old_value ≢ \null? *old_value: \empty, \result; + assigns old_value ≢ \null? *old_value: \empty + \from (indirect: which), (indirect: old_value), (indirect: new_value), + __fc_itimer_real, __fc_itimer_virtual, __fc_itimer_prof; + assigns \result + \from (indirect: which), (indirect: new_value), (indirect: *new_value); + + behavior real: + assumes + which ≡ 0 ≤ new_value->it_value.tv_usec ≤ 999999 ∧ + 0 ≤ new_value->it_interval.tv_usec ≤ 999999; + ensures \result ≡ 0; + ensures \initialized(\old(old_value)); + assigns \result, old_value ≢ \null? *old_value: \empty, + __fc_itimer_real; + assigns \result \from \nothing; + assigns old_value ≢ \null? *old_value: \empty \from __fc_itimer_real; + assigns __fc_itimer_real \from *new_value; + + behavior virtual: + assumes + which ≡ 1 ∧ 0 ≤ new_value->it_value.tv_usec ≤ 999999 ∧ + 0 ≤ new_value->it_interval.tv_usec ≤ 999999; + ensures \result ≡ 0; + ensures \initialized(\old(old_value)); + assigns \result, old_value ≢ \null? *old_value: \empty; + assigns \result \from \nothing; + assigns old_value ≢ \null? *old_value: \empty + \from __fc_itimer_virtual; + + behavior prof: + assumes + which ≡ 2 ∧ 0 ≤ new_value->it_value.tv_usec ≤ 999999 ∧ + 0 ≤ new_value->it_interval.tv_usec ≤ 999999; + ensures \result ≡ 0; + ensures \initialized(\old(old_value)); + assigns \result, old_value ≢ \null? *old_value: \empty; + assigns \result \from \nothing; + assigns old_value ≢ \null? *old_value: \empty \from __fc_itimer_prof; + + behavior invalid: + assumes + (which ≢ 0 ∧ which ≢ 1 ∧ which ≢ 2) ∨ + ¬(0 ≤ new_value->it_value.tv_usec ≤ 999999 ∧ + 0 ≤ new_value->it_interval.tv_usec ≤ 999999); + ensures \result ≡ -1; + assigns \result; + assigns \result \from \nothing; + + disjoint behaviors invalid, prof, virtual, real; + */ +extern int setitimer(int which, struct itimerval const *new_value, + struct itimerval *old_value); + +/*@ ghost int volatile __fc_fds_state; */ +/*@ requires nfds ≥ 0; + requires readfds ≡ \null ∨ \valid(readfds); + requires writefds ≡ \null ∨ \valid(writefds); + requires errorfds ≡ \null ∨ \valid(errorfds); + requires timeout ≡ \null ∨ \valid(timeout); + assigns __fc_fds_state, readfds ≡ \null? \empty: *readfds, + writefds ≡ \null? \empty: *writefds, + errorfds ≡ \null? \empty: *errorfds, + timeout ≡ \null? \empty: *timeout, \result; + assigns __fc_fds_state \from __fc_fds_state; + assigns readfds ≡ \null? \empty: *readfds + \from (indirect: nfds), (indirect: readfds), (indirect: *readfds), + (indirect: writefds), (indirect: *writefds), + (indirect: errorfds), (indirect: *errorfds), (indirect: timeout), + (indirect: *timeout), __fc_fds_state; + assigns writefds ≡ \null? \empty: *writefds + \from (indirect: nfds), (indirect: readfds), (indirect: *readfds), + (indirect: writefds), (indirect: *writefds), + (indirect: errorfds), (indirect: *errorfds), (indirect: timeout), + (indirect: *timeout), __fc_fds_state; + assigns errorfds ≡ \null? \empty: *errorfds + \from (indirect: nfds), (indirect: readfds), (indirect: *readfds), + (indirect: writefds), (indirect: *writefds), + (indirect: errorfds), (indirect: *errorfds), (indirect: timeout), + (indirect: *timeout), __fc_fds_state; + assigns timeout ≡ \null? \empty: *timeout + \from (indirect: nfds), (indirect: readfds), (indirect: *readfds), + (indirect: writefds), (indirect: *writefds), + (indirect: errorfds), (indirect: *errorfds), (indirect: timeout), + (indirect: *timeout), __fc_fds_state; + assigns \result + \from (indirect: nfds), (indirect: readfds), (indirect: *readfds), + (indirect: writefds), (indirect: *writefds), + (indirect: errorfds), (indirect: *errorfds), (indirect: timeout), + (indirect: *timeout), __fc_fds_state; + + behavior read_notnull: + assumes readfds ≢ \null; + ensures \initialized(\old(readfds)); + + behavior write_notnull: + assumes writefds ≢ \null; + ensures \initialized(\old(writefds)); + + behavior error_notnull: + assumes errorfds ≢ \null; + ensures \initialized(\old(errorfds)); + + behavior timeout_notnull: + assumes timeout ≢ \null; + ensures \initialized(\old(timeout)); + */ +extern int select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout); + /*@ assigns *(*(outbuf + (0 .. *outbytesleft - 1))), __fc_errno; assigns *(*(outbuf + (0 .. *outbytesleft - 1))) \from *(*(inbuf + (0 .. *inbytesleft - 1))); @@ -4042,6 +4237,21 @@ extern int iconv_close(iconv_t); extern iconv_t iconv_open(char const *tocode, char const *fromcode); int h_errno; +/*@ requires \valid(fds + (0 .. nfds - 1)); + ensures -1 ≤ \result ≤ \old(nfds); + ensures \initialized(&(\old(fds) + (0 .. \old(nfds) - 1))->revents); + assigns (fds + (0 .. nfds - 1))->revents, \result; + assigns (fds + (0 .. nfds - 1))->revents + \from (indirect: (fds + (0 .. nfds - 1))->fd), + (fds + (0 .. nfds - 1))->events, (indirect: nfds), + (indirect: timeout), (indirect: Frama_C_entropy_source); + assigns \result + \from (indirect: (fds + (0 .. nfds - 1))->fd), + (indirect: (fds + (0 .. nfds - 1))->events), (indirect: nfds), + (indirect: timeout), (indirect: Frama_C_entropy_source); + */ +extern int poll(struct pollfd *fds, nfds_t nfds, int timeout); + /*@ assigns *(env + (0 .. 4)); */ extern int setjmp(int * /*[5]*/ env); @@ -4060,6 +4270,14 @@ extern void (*signal(int sig, void (*func)(int )))(int ); assigns \nothing; */ extern int raise(int sig); +/*@ assigns \result; + assigns \result \from fd, request; */ +extern int __va_ioctl_void(int fd, int request); + +/*@ assigns \result; + assigns \result \from fd, request, *(argp + (0 ..)); */ +extern int __va_ioctl_ptr(int fd, int request, char *argp); + CODE facilitynames[23] = {{.c_name = "auth", .c_val = 4 << 3}, {.c_name = "authpriv", .c_val = 10 << 3}, @@ -4136,58 +4354,6 @@ extern int getrusage(int r, struct rusage *ru); assigns \result \from r, rl->rlim_cur, rl->rlim_max; */ extern int setrlimit(int r, struct rlimit const *rl); -/*@ assigns \result; - assigns \result \from __fc_time; */ -extern clock_t clock(void); - -/*@ assigns \result; - assigns \result \from time1, time0; */ -extern double difftime(time_t time1, time_t time0); - -/*@ assigns *timeptr, \result; - assigns *timeptr \from *timeptr; - assigns \result \from *timeptr; - */ -extern time_t mktime(struct tm *timeptr); - -/*@ assigns *timer, \result; - assigns *timer \from __fc_time; - assigns \result \from __fc_time; - - behavior null: - assumes timer ≡ \null; - assigns \result; - assigns \result \from __fc_time; - - behavior not_null: - assumes timer ≢ \null; - requires \valid(timer); - ensures \initialized(\old(timer)); - assigns *timer, \result; - assigns *timer \from __fc_time; - assigns \result \from __fc_time; - - complete behaviors not_null, null; - disjoint behaviors not_null, null; - */ -extern time_t time(time_t *timer); - -struct tm __fc_time_tm; -struct tm * const __fc_p_time_tm = & __fc_time_tm; -/*@ ensures \result ≡ &__fc_time_tm ∨ \result ≡ \null; - assigns \result, __fc_time_tm; - assigns \result \from __fc_p_time_tm; - assigns __fc_time_tm \from *timer; - */ -extern struct tm *gmtime(time_t const *timer); - -/*@ ensures \result ≡ &__fc_time_tm ∨ \result ≡ \null; - assigns \result, __fc_time_tm; - assigns \result \from __fc_p_time_tm; - assigns __fc_time_tm \from *timer; - */ -extern struct tm *localtime(time_t const *timer); - /*@ requires \valid(buffer); assigns \result, *buffer; assigns \result \from __fc_time; diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_labels.err.oracle b/tests/libc/oracle/poll.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_labels.err.oracle rename to tests/libc/oracle/poll.err.oracle diff --git a/tests/libc/oracle/poll.res.oracle b/tests/libc/oracle/poll.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..f036c0f65b266955eb569f4e33ea13a6e138b0e4 --- /dev/null +++ b/tests/libc/oracle/poll.res.oracle @@ -0,0 +1,35 @@ +[kernel] Parsing tests/libc/poll.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_errno ∈ [--..--] + __fc_stdin ∈ {{ NULL ; &S___fc_stdin[0] }} + __fc_stdout ∈ {{ NULL ; &S___fc_stdout[0] }} + __fc_fopen[0..511] ∈ {0} + __fc_p_fopen ∈ {{ &__fc_fopen[0] }} + Frama_C_entropy_source ∈ [--..--] + S___fc_stdin[0..1] ∈ [--..--] + S___fc_stdout[0..1] ∈ [--..--] +[value] computing for function poll <- main. + Called from tests/libc/poll.c:11. +[value] using specification for function poll +share/libc/poll.h:51:[value] function poll: precondition got status valid. +[value] Done for function poll +[value] computing for function perror <- main. + Called from tests/libc/poll.c:12. +[value] using specification for function perror +[value] Done for function perror +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_stdout ∈ {{ NULL + [--..--] ; &S___fc_stdout[0] }} + ufds.fd ∈ {0} + .events ∈ {3} + .revents ∈ [--..--] + r ∈ {-1; 0; 1} + can_read ∈ {0; 1} + can_read_out_of_band ∈ {0; 2} + invalid_fd ∈ {0; 32} + __retres ∈ [0..127] diff --git a/tests/libc/oracle/socket.0.res.oracle b/tests/libc/oracle/socket.0.res.oracle index 285f0cc2b82bfef75356bb9aace83743462c456d..49fa9723fb226d810ef0460757e6d3442cf810d0 100644 --- a/tests/libc/oracle/socket.0.res.oracle +++ b/tests/libc/oracle/socket.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/socket.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,14 +12,15 @@ __fc_stdout ∈ {{ NULL ; &S___fc_stdout[0] }} __fc_fopen[0..511] ∈ {0} __fc_p_fopen ∈ {{ &__fc_fopen[0] }} - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] __fc_time ∈ [--..--] __fc_tz ∈ [--..--] + __fc_fds_state ∈ [--..--] optarg ∈ {{ NULL ; &S_optarg[0] }} optind ∈ [--..--] opterr ∈ [--..--] @@ -41,17 +41,16 @@ [value] computing for function socketpair <- init_sockets <- main. Called from tests/libc/socket.c:50. [value] using specification for function socketpair -share/libc/sys/socket.h:336:[value] function socketpair: precondition got status valid. +share/libc/sys/socket.h:357:[value] function socketpair: precondition got status valid. [value] Done for function socketpair -[value] computing for function fprintf_0 <- init_sockets <- main. +[value] computing for function fprintf_va_1 <- init_sockets <- main. Called from tests/libc/socket.c:52. -[value] using specification for function fprintf_0 -tests/libc/socket.c:52:[value] function fprintf_0: precondition got status valid. -[value] Done for function fprintf_0 +[value] using specification for function fprintf_va_1 +tests/libc/socket.c:52:[value] function fprintf_va_1: precondition got status valid. +[value] Done for function fprintf_va_1 [value] computing for function exit <- init_sockets <- main. Called from tests/libc/socket.c:53. [value] using specification for function exit -share/libc/stdlib.h:370:[value] function exit: no state left in which to evaluate postcondition, status not computed. [value] Done for function exit tests/libc/socket.c:55:[value] assertion got status valid. [value] Recording results for init_sockets @@ -60,7 +59,11 @@ tests/libc/socket.c:55:[value] assertion got status valid. Called from tests/libc/socket.c:126. [value] computing for function init_reception <- test_read <- main. Called from tests/libc/socket.c:60. -[value] Call to builtin bzero(({{ (void *)&rcv_buffer }},{10})) +[value] computing for function bzero <- init_reception <- test_read <- main. + Called from tests/libc/socket.c:43. +[value] using specification for function bzero +share/libc/strings.h:35:[value] function bzero: precondition got status valid. +[value] Done for function bzero [value] computing for function write <- init_reception <- test_read <- main. Called from tests/libc/socket.c:44. [value] using specification for function write @@ -75,19 +78,21 @@ share/libc/unistd.h:875:[value] function write: precondition got status valid. share/libc/unistd.h:824:[value] function read: precondition got status valid. share/libc/unistd.h:825:[value] function read: precondition got status valid. [value] Done for function read -[value] computing for function printf_0 <- test_read <- main. +[value] computing for function printf_va_1 <- test_read <- main. Called from tests/libc/socket.c:62. -[value] using specification for function printf_0 -tests/libc/socket.c:62:[value] function printf_0: precondition got status valid. -tests/libc/socket.c:62:[value] warning: function printf_0: precondition got status unknown. -[value] Done for function printf_0 +[value] using specification for function printf_va_1 +tests/libc/socket.c:62:[value] function printf_va_1: precondition got status valid. +tests/libc/socket.c:62:[value] warning: function printf_va_1: precondition got status unknown. +[value] Done for function printf_va_1 [value] Recording results for test_read [value] Done for function test_read [value] computing for function test_readv <- main. Called from tests/libc/socket.c:127. [value] computing for function init_reception <- test_readv <- main. Called from tests/libc/socket.c:68. -[value] Call to builtin bzero(({{ (void *)&rcv_buffer }},{10})) +[value] computing for function bzero <- init_reception <- test_readv <- main. + Called from tests/libc/socket.c:43. +[value] Done for function bzero [value] computing for function write <- init_reception <- test_readv <- main. Called from tests/libc/socket.c:44. [value] Done for function write @@ -98,24 +103,25 @@ tests/libc/socket.c:62:[value] warning: function printf_0: precondition got stat [value] using specification for function readv share/libc/sys/uio.h:34:[value] function readv: precondition got status valid. share/libc/sys/uio.h:37:[value] warning: no \from part - for clause 'assigns *((char *)(iov + (0 .. iovcnt - 1))->iov_base + (0 ..));' of - function readv + for clause 'assigns *((char *)(iov + (0 .. iovcnt - 1))->iov_base + (0 ..));' [value] Done for function readv tests/libc/socket.c:72:[value] warning: accessing uninitialized left-value. assert \initialized((char *)rcv_buffer_scattered1); -[value] computing for function printf_1 <- test_readv <- main. +[value] computing for function printf_va_2 <- test_readv <- main. Called from tests/libc/socket.c:75. -[value] using specification for function printf_1 -tests/libc/socket.c:75:[value] function printf_1: precondition got status valid. -tests/libc/socket.c:75:[value] warning: function printf_1: precondition got status unknown. -[value] Done for function printf_1 +[value] using specification for function printf_va_2 +tests/libc/socket.c:75:[value] function printf_va_2: precondition got status valid. +tests/libc/socket.c:75:[value] warning: function printf_va_2: precondition got status unknown. +[value] Done for function printf_va_2 [value] Recording results for test_readv [value] Done for function test_readv [value] computing for function test_recvmsg <- main. Called from tests/libc/socket.c:128. [value] computing for function init_reception <- test_recvmsg <- main. Called from tests/libc/socket.c:82. -[value] Call to builtin bzero(({{ (void *)&rcv_buffer }},{10})) +[value] computing for function bzero <- init_reception <- test_recvmsg <- main. + Called from tests/libc/socket.c:43. +[value] Done for function bzero [value] computing for function write <- init_reception <- test_recvmsg <- main. Called from tests/libc/socket.c:44. [value] Done for function write @@ -124,19 +130,19 @@ tests/libc/socket.c:75:[value] warning: function printf_1: precondition got stat [value] computing for function recvmsg <- test_recvmsg <- main. Called from tests/libc/socket.c:90. [value] using specification for function recvmsg -share/libc/sys/socket.h:283:[value] function recvmsg: precondition got status valid. -share/libc/sys/socket.h:284:[value] function recvmsg: precondition got status valid. -share/libc/sys/socket.h:285:[value] function recvmsg: precondition got status valid. -share/libc/sys/socket.h:286:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:304:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:305:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:306:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:307:[value] function recvmsg: precondition got status valid. [value] Done for function recvmsg tests/libc/socket.c:92:[value] warning: accessing uninitialized left-value. assert \initialized((char *)rcv_buffer_scattered1); -[value] computing for function printf_2 <- test_recvmsg <- main. +[value] computing for function printf_va_3 <- test_recvmsg <- main. Called from tests/libc/socket.c:95. -[value] using specification for function printf_2 -tests/libc/socket.c:95:[value] function printf_2: precondition got status valid. -tests/libc/socket.c:95:[value] warning: function printf_2: precondition got status unknown. -[value] Done for function printf_2 +[value] using specification for function printf_va_3 +tests/libc/socket.c:95:[value] function printf_va_3: precondition got status valid. +tests/libc/socket.c:95:[value] warning: function printf_va_3: precondition got status unknown. +[value] Done for function printf_va_3 [value] Recording results for test_recvmsg [value] Done for function test_recvmsg [value] computing for function test_server_echo <- main. @@ -149,33 +155,31 @@ tests/libc/socket.c:95:[value] warning: function printf_2: precondition got stat Called from tests/libc/socket.c:103. [value] using specification for function memset share/libc/string.h:82:[value] function memset: precondition got status valid. -tests/libc/socket.c:103:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:85:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Done for function memset [value] computing for function bind <- test_server_echo <- main. Called from tests/libc/socket.c:107. [value] using specification for function bind -share/libc/sys/socket.h:191:[value] function bind: precondition got status valid. -share/libc/sys/socket.h:192:[value] function bind: precondition got status valid. +share/libc/sys/socket.h:195:[value] function bind: precondition got status valid. +share/libc/sys/socket.h:196:[value] function bind: precondition got status valid. [value] Done for function bind [value] computing for function listen <- test_server_echo <- main. Called from tests/libc/socket.c:108. [value] using specification for function listen -share/libc/sys/socket.h:257:[value] function listen: precondition got status valid. +share/libc/sys/socket.h:261:[value] function listen: precondition got status valid. [value] Done for function listen [value] computing for function accept <- test_server_echo <- main. Called from tests/libc/socket.c:111. [value] using specification for function accept -share/libc/sys/socket.h:172:[value] function accept: precondition got status valid. +share/libc/sys/socket.h:176:[value] function accept: precondition got status valid. tests/libc/socket.c:111:[value] function accept, behavior addr_null: assumes got status invalid; behavior not evaluated. -share/libc/sys/socket.h:182:[value] function accept, behavior addr_not_null: precondition got status valid. -share/libc/sys/socket.h:183:[value] function accept, behavior addr_not_null: precondition got status valid. +share/libc/sys/socket.h:186:[value] function accept, behavior addr_not_null: precondition got status valid. +share/libc/sys/socket.h:187:[value] function accept, behavior addr_not_null: precondition got status valid. [value] Done for function accept [value] computing for function accept <- test_server_echo <- main. Called from tests/libc/socket.c:112. tests/libc/socket.c:112:[value] function accept, behavior addr_not_null: assumes got status invalid; behavior not evaluated. -share/libc/sys/socket.h:178:[value] function accept, behavior addr_null: precondition got status valid. -tests/libc/socket.c:112:[value] warning: Completely invalid destination for assigns - clause *((char *)addr + (0 .. *addrlen - 1)). Ignoring. +share/libc/sys/socket.h:182:[value] function accept, behavior addr_null: precondition got status valid. [value] Done for function accept [value] computing for function read <- test_server_echo <- main. Called from tests/libc/socket.c:115. @@ -255,10 +259,10 @@ share/libc/unistd.h:731:[value] function close: precondition got status valid. __fc_fds[0..1023] ∈ [--..--] fd ∈ [-1..1023] addr ∈ [--..--] or UNINITIALIZED - addrlen ∈ {8} or UNINITIALIZED - client_fd ∈ [-1..1023] or UNINITIALIZED + addrlen ∈ {8} + client_fd ∈ [-1..1023] buf[0..63] ∈ [--..--] or UNINITIALIZED - r ∈ [-1..64] or UNINITIALIZED + r ∈ [-1..64] __retres ∈ {0; 1; 5; 20; 100; 200; 300; 400} [value:final-states] Values at end of function main: __fc_sockfds[0..1023] ∈ [--..--] diff --git a/tests/libc/oracle/socket.1.res.oracle b/tests/libc/oracle/socket.1.res.oracle index 30b5b8bd14524ad88259636871df5ac49aa9f4c8..f8486b689421d65123abda445c76cab0ad9b261a 100644 --- a/tests/libc/oracle/socket.1.res.oracle +++ b/tests/libc/oracle/socket.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/socket.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,14 +12,15 @@ __fc_stdout ∈ {{ NULL ; &S___fc_stdout[0] }} __fc_fopen[0..511] ∈ {0} __fc_p_fopen ∈ {{ &__fc_fopen[0] }} - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] __fc_time ∈ [--..--] __fc_tz ∈ [--..--] + __fc_fds_state ∈ [--..--] optarg ∈ {{ NULL ; &S_optarg[0] }} optind ∈ [--..--] opterr ∈ [--..--] @@ -41,17 +41,16 @@ [value] computing for function socketpair <- init_sockets <- main. Called from tests/libc/socket.c:50. [value] using specification for function socketpair -share/libc/sys/socket.h:336:[value] function socketpair: precondition got status valid. +share/libc/sys/socket.h:357:[value] function socketpair: precondition got status valid. [value] Done for function socketpair -[value] computing for function fprintf_0 <- init_sockets <- main. +[value] computing for function fprintf_va_1 <- init_sockets <- main. Called from tests/libc/socket.c:52. -[value] using specification for function fprintf_0 -tests/libc/socket.c:52:[value] function fprintf_0: precondition got status valid. -[value] Done for function fprintf_0 +[value] using specification for function fprintf_va_1 +tests/libc/socket.c:52:[value] function fprintf_va_1: precondition got status valid. +[value] Done for function fprintf_va_1 [value] computing for function exit <- init_sockets <- main. Called from tests/libc/socket.c:53. [value] using specification for function exit -share/libc/stdlib.h:370:[value] function exit: no state left in which to evaluate postcondition, status not computed. [value] Done for function exit tests/libc/socket.c:55:[value] assertion got status valid. [value] Recording results for init_sockets @@ -60,7 +59,11 @@ tests/libc/socket.c:55:[value] assertion got status valid. Called from tests/libc/socket.c:126. [value] computing for function init_reception <- test_read <- main. Called from tests/libc/socket.c:60. -[value] Call to builtin bzero(({{ (void *)&rcv_buffer }},{10})) +[value] computing for function bzero <- init_reception <- test_read <- main. + Called from tests/libc/socket.c:43. +[value] using specification for function bzero +share/libc/strings.h:35:[value] function bzero: precondition got status valid. +[value] Done for function bzero [value] computing for function write <- init_reception <- test_read <- main. Called from tests/libc/socket.c:44. [value] using specification for function write @@ -75,19 +78,21 @@ share/libc/unistd.h:875:[value] function write: precondition got status valid. share/libc/unistd.h:824:[value] function read: precondition got status valid. share/libc/unistd.h:825:[value] function read: precondition got status valid. [value] Done for function read -[value] computing for function printf_0 <- test_read <- main. +[value] computing for function printf_va_1 <- test_read <- main. Called from tests/libc/socket.c:62. -[value] using specification for function printf_0 -tests/libc/socket.c:62:[value] function printf_0: precondition got status valid. -tests/libc/socket.c:62:[value] warning: function printf_0: precondition got status unknown. -[value] Done for function printf_0 +[value] using specification for function printf_va_1 +tests/libc/socket.c:62:[value] function printf_va_1: precondition got status valid. +tests/libc/socket.c:62:[value] warning: function printf_va_1: precondition got status unknown. +[value] Done for function printf_va_1 [value] Recording results for test_read [value] Done for function test_read [value] computing for function test_readv <- main. Called from tests/libc/socket.c:127. [value] computing for function init_reception <- test_readv <- main. Called from tests/libc/socket.c:68. -[value] Call to builtin bzero(({{ (void *)&rcv_buffer }},{10})) +[value] computing for function bzero <- init_reception <- test_readv <- main. + Called from tests/libc/socket.c:43. +[value] Done for function bzero [value] computing for function write <- init_reception <- test_readv <- main. Called from tests/libc/socket.c:44. [value] Done for function write @@ -98,24 +103,25 @@ tests/libc/socket.c:62:[value] warning: function printf_0: precondition got stat [value] using specification for function readv share/libc/sys/uio.h:34:[value] function readv: precondition got status valid. share/libc/sys/uio.h:37:[value] warning: no \from part - for clause 'assigns *((char *)(iov + (0 .. iovcnt - 1))->iov_base + (0 ..));' of - function readv + for clause 'assigns *((char *)(iov + (0 .. iovcnt - 1))->iov_base + (0 ..));' [value] Done for function readv tests/libc/socket.c:72:[value] warning: accessing uninitialized left-value. assert \initialized((char *)rcv_buffer_scattered1); -[value] computing for function printf_1 <- test_readv <- main. +[value] computing for function printf_va_2 <- test_readv <- main. Called from tests/libc/socket.c:75. -[value] using specification for function printf_1 -tests/libc/socket.c:75:[value] function printf_1: precondition got status valid. -tests/libc/socket.c:75:[value] warning: function printf_1: precondition got status unknown. -[value] Done for function printf_1 +[value] using specification for function printf_va_2 +tests/libc/socket.c:75:[value] function printf_va_2: precondition got status valid. +tests/libc/socket.c:75:[value] warning: function printf_va_2: precondition got status unknown. +[value] Done for function printf_va_2 [value] Recording results for test_readv [value] Done for function test_readv [value] computing for function test_recvmsg <- main. Called from tests/libc/socket.c:128. [value] computing for function init_reception <- test_recvmsg <- main. Called from tests/libc/socket.c:82. -[value] Call to builtin bzero(({{ (void *)&rcv_buffer }},{10})) +[value] computing for function bzero <- init_reception <- test_recvmsg <- main. + Called from tests/libc/socket.c:43. +[value] Done for function bzero [value] computing for function write <- init_reception <- test_recvmsg <- main. Called from tests/libc/socket.c:44. [value] Done for function write @@ -124,19 +130,19 @@ tests/libc/socket.c:75:[value] warning: function printf_1: precondition got stat [value] computing for function recvmsg <- test_recvmsg <- main. Called from tests/libc/socket.c:90. [value] using specification for function recvmsg -share/libc/sys/socket.h:283:[value] function recvmsg: precondition got status valid. -share/libc/sys/socket.h:284:[value] function recvmsg: precondition got status valid. -share/libc/sys/socket.h:285:[value] function recvmsg: precondition got status valid. -share/libc/sys/socket.h:286:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:304:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:305:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:306:[value] function recvmsg: precondition got status valid. +share/libc/sys/socket.h:307:[value] function recvmsg: precondition got status valid. [value] Done for function recvmsg tests/libc/socket.c:92:[value] warning: accessing uninitialized left-value. assert \initialized((char *)rcv_buffer_scattered1); -[value] computing for function printf_2 <- test_recvmsg <- main. +[value] computing for function printf_va_3 <- test_recvmsg <- main. Called from tests/libc/socket.c:95. -[value] using specification for function printf_2 -tests/libc/socket.c:95:[value] function printf_2: precondition got status valid. -tests/libc/socket.c:95:[value] warning: function printf_2: precondition got status unknown. -[value] Done for function printf_2 +[value] using specification for function printf_va_3 +tests/libc/socket.c:95:[value] function printf_va_3: precondition got status valid. +tests/libc/socket.c:95:[value] warning: function printf_va_3: precondition got status unknown. +[value] Done for function printf_va_3 [value] Recording results for test_recvmsg [value] Done for function test_recvmsg [value] computing for function test_server_echo <- main. @@ -149,33 +155,31 @@ tests/libc/socket.c:95:[value] warning: function printf_2: precondition got stat Called from tests/libc/socket.c:103. [value] using specification for function memset share/libc/string.h:82:[value] function memset: precondition got status valid. -tests/libc/socket.c:103:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:85:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Done for function memset [value] computing for function bind <- test_server_echo <- main. Called from tests/libc/socket.c:107. [value] using specification for function bind -share/libc/sys/socket.h:191:[value] function bind: precondition got status valid. -share/libc/sys/socket.h:192:[value] function bind: precondition got status valid. +share/libc/sys/socket.h:195:[value] function bind: precondition got status valid. +share/libc/sys/socket.h:196:[value] function bind: precondition got status valid. [value] Done for function bind [value] computing for function listen <- test_server_echo <- main. Called from tests/libc/socket.c:108. [value] using specification for function listen -share/libc/sys/socket.h:257:[value] function listen: precondition got status valid. +share/libc/sys/socket.h:261:[value] function listen: precondition got status valid. [value] Done for function listen [value] computing for function accept <- test_server_echo <- main. Called from tests/libc/socket.c:111. [value] using specification for function accept -share/libc/sys/socket.h:172:[value] function accept: precondition got status valid. +share/libc/sys/socket.h:176:[value] function accept: precondition got status valid. tests/libc/socket.c:111:[value] function accept, behavior addr_null: assumes got status invalid; behavior not evaluated. -share/libc/sys/socket.h:182:[value] function accept, behavior addr_not_null: precondition got status valid. -share/libc/sys/socket.h:183:[value] function accept, behavior addr_not_null: precondition got status valid. +share/libc/sys/socket.h:186:[value] function accept, behavior addr_not_null: precondition got status valid. +share/libc/sys/socket.h:187:[value] function accept, behavior addr_not_null: precondition got status valid. [value] Done for function accept [value] computing for function accept <- test_server_echo <- main. Called from tests/libc/socket.c:112. tests/libc/socket.c:112:[value] function accept, behavior addr_not_null: assumes got status invalid; behavior not evaluated. -share/libc/sys/socket.h:178:[value] function accept, behavior addr_null: precondition got status valid. -tests/libc/socket.c:112:[value] warning: Completely invalid destination for assigns - clause *((char *)addr + (0 .. *addrlen - 1)). Ignoring. +share/libc/sys/socket.h:182:[value] function accept, behavior addr_null: precondition got status valid. [value] Done for function accept [value] computing for function read <- test_server_echo <- main. Called from tests/libc/socket.c:115. @@ -257,10 +261,10 @@ share/libc/unistd.h:731:[value] function close: precondition got status valid. __fc_fds[0..1023] ∈ [--..--] fd ∈ [-1..1023] addr ∈ [--..--] or UNINITIALIZED - addrlen ∈ {8} or UNINITIALIZED - client_fd ∈ [-1..1023] or UNINITIALIZED + addrlen ∈ {8} + client_fd ∈ [-1..1023] buf[0..63] ∈ [--..--] or UNINITIALIZED - r ∈ [-1..64] or UNINITIALIZED + r ∈ [-1..64] __retres ∈ {0; 1; 5; 20; 100; 200; 300; 400} [value:final-states] Values at end of function main: __fc_sockfds[0..1023] ∈ [--..--] diff --git a/tests/libc/oracle/socket_h.res.oracle b/tests/libc/oracle/socket_h.res.oracle index 1ebc75e143b250e98b5e2e1f79cb902aecc4c258..622786ca9d60b431fb121a8bad6a06556064a598 100644 --- a/tests/libc/oracle/socket_h.res.oracle +++ b/tests/libc/oracle/socket_h.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/socket_h.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,12 +9,12 @@ __fc_open_sock_fds ∈ [--..--] in6addr_any ∈ {0} in6addr_loopback.s6_addr[0..15] ∈ {255} - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] computing for function socket <- main. Called from tests/libc/socket_h.c:7. [value] using specification for function socket @@ -36,8 +35,8 @@ share/libc/arpa/inet.h:42:[value] function inet_addr: precondition got status va [value] computing for function connect <- main. Called from tests/libc/socket_h.c:13. [value] using specification for function connect -share/libc/sys/socket.h:202:[value] function connect: precondition got status valid. -share/libc/sys/socket.h:203:[value] function connect: precondition got status valid. +share/libc/sys/socket.h:206:[value] function connect: precondition got status valid. +share/libc/sys/socket.h:207:[value] function connect: precondition got status valid. [value] Done for function connect [value] computing for function exit <- main. Called from tests/libc/socket_h.c:14. @@ -45,11 +44,11 @@ share/libc/sys/socket.h:203:[value] function connect: precondition got status va [value] computing for function getsockopt <- main. Called from tests/libc/socket_h.c:18. [value] using specification for function getsockopt -share/libc/sys/socket.h:223:[value] function getsockopt: precondition got status valid. -share/libc/sys/socket.h:224:[value] function getsockopt: precondition got status valid. -share/libc/sys/socket.h:235:[value] function getsockopt, behavior so_error: precondition got status valid. -share/libc/sys/socket.h:236:[value] function getsockopt, behavior so_error: precondition got status valid. -share/libc/sys/socket.h:237:[value] function getsockopt, behavior so_error: precondition got status valid. +share/libc/sys/socket.h:227:[value] function getsockopt: precondition got status valid. +share/libc/sys/socket.h:228:[value] function getsockopt: precondition got status valid. +share/libc/sys/socket.h:239:[value] function getsockopt, behavior so_error: precondition got status valid. +share/libc/sys/socket.h:240:[value] function getsockopt, behavior so_error: precondition got status valid. +share/libc/sys/socket.h:241:[value] function getsockopt, behavior so_error: precondition got status valid. [value] Done for function getsockopt [value] Recording results for main [value] done for function main diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_lemma.err.oracle b/tests/libc/oracle/stdint_h.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_lemma.err.oracle rename to tests/libc/oracle/stdint_h.err.oracle diff --git a/tests/libc/oracle/stdint_h.res.oracle b/tests/libc/oracle/stdint_h.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..a253d2fb3e6e3071258ce00f9a735d2211f21178 --- /dev/null +++ b/tests/libc/oracle/stdint_h.res.oracle @@ -0,0 +1,15 @@ +[kernel] Parsing tests/libc/stdint_h.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + +tests/libc/stdint_h.c:7:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + min ∈ {-9223372036854775808} + max ∈ {9223372036854775807} + umax ∈ {18446744073709551615} + __retres ∈ {0} diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.err.oracle b/tests/libc/oracle/stdio_h.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_loopscope.err.oracle rename to tests/libc/oracle/stdio_h.err.oracle diff --git a/tests/libc/oracle/stdio_h.res.oracle b/tests/libc/oracle/stdio_h.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..7b1eb4a27c6b1bb8c2a34b0ed14fc89efe19c534 --- /dev/null +++ b/tests/libc/oracle/stdio_h.res.oracle @@ -0,0 +1,47 @@ +[kernel] Parsing tests/libc/stdio_h.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_errno ∈ [--..--] + __fc_stdin ∈ {{ NULL ; &S___fc_stdin[0] }} + __fc_stdout ∈ {{ NULL ; &S___fc_stdout[0] }} + __fc_fopen[0..511] ∈ {0} + __fc_p_fopen ∈ {{ &__fc_fopen[0] }} + Frama_C_entropy_source ∈ [--..--] + nondet ∈ [--..--] + S___fc_stdin[0..1] ∈ [--..--] + S___fc_stdout[0..1] ∈ [--..--] +[value] computing for function fopen <- main. + Called from tests/libc/stdio_h.c:6. +[value] using specification for function fopen +[value] Done for function fopen +[value] computing for function fseek <- main. + Called from tests/libc/stdio_h.c:8. +[value] using specification for function fseek +share/libc/stdio.h:267:[value] function fseek: precondition got status valid. +share/libc/stdio.h:268:[value] function fseek: precondition got status valid. +[value] Done for function fseek +[value] computing for function fseek <- main. + Called from tests/libc/stdio_h.c:10. +share/libc/stdio.h:267:[value] warning: function fseek: precondition got status invalid. +[value] Done for function fseek +[value] computing for function Frama_C_interval <- main. + Called from tests/libc/stdio_h.c:16. +[value] using specification for function Frama_C_interval +share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. +[value] Done for function Frama_C_interval +[value] computing for function fseek <- main. + Called from tests/libc/stdio_h.c:19. +share/libc/stdio.h:268:[value] warning: function fseek: precondition got status invalid. +[value] Done for function fseek +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_errno ∈ [--..--] + __fc_fopen[0..511] ∈ [--..--] + Frama_C_entropy_source ∈ [--..--] + f ∈ {{ NULL ; &__fc_fopen + [0..4088],0%8 }} + r ∈ [--..--] + __retres ∈ {0; 1} diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_matrix.err.oracle b/tests/libc/oracle/stdlib_c.0.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_matrix.err.oracle rename to tests/libc/oracle/stdlib_c.0.err.oracle diff --git a/tests/libc/oracle/stdlib_c.0.res.oracle b/tests/libc/oracle/stdlib_c.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..7dfef89007530c88e21883e1ec75552ce78ae599 --- /dev/null +++ b/tests/libc/oracle/stdlib_c.0.res.oracle @@ -0,0 +1,52 @@ +[kernel] Parsing tests/libc/stdlib_c.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + Frama_C_entropy_source ∈ [--..--] +tests/libc/stdlib_c.c:14:[value] allocating variable __calloc_main_l14 +tests/libc/stdlib_c.c:16:[value] assertion got status valid. +[value] computing for function Frama_C_size_t_interval <- main. + Called from tests/libc/stdlib_c.c:20. +[value] using specification for function Frama_C_size_t_interval +share/libc/__fc_builtin.h:142:[value] function Frama_C_size_t_interval: precondition got status valid. +[value] Done for function Frama_C_size_t_interval +[value] computing for function Frama_C_size_t_interval <- main. + Called from tests/libc/stdlib_c.c:20. +[value] Done for function Frama_C_size_t_interval +tests/libc/stdlib_c.c:21:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/libc/stdlib_c.c:21:[value] allocating variable __calloc_main_l21 +tests/libc/stdlib_c.c:23:[value] assertion got status valid. +tests/libc/stdlib_c.c:27:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/libc/stdlib_c.c:28:[value] assertion got status valid. +tests/libc/stdlib_c.c:32:[value] allocating variable __calloc_main_l32 +tests/libc/stdlib_c.c:31:[value] entering loop for the first time +tests/libc/stdlib_c.c:32:[value:malloc] marking variable `__calloc_main_l32' as weak +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31) to fit 0..63 +tests/libc/stdlib_c.c:33:[value] warning: out of bounds write. assert \valid(s + (unsigned int)(i - 1)); +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/63) to fit 0..63/95 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/95) to fit 0..63/127 +tests/libc/stdlib_c.c:32:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/127) to fit 0..63/34359738367 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' + (0..31/34359738367) to fit 0..63/34359738367 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' + (0..31/34359738367) to fit 0..63/34359738367 +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + Frama_C_entropy_source ∈ [--..--] + p ∈ {{ NULL ; &__calloc_main_l14 }} + nmemb ∈ [1..4294967295] + q ∈ {{ NULL ; &__calloc_main_l21[0] }} + r ∈ {0} + __retres ∈ {0} + __calloc_w_main_l32[0..1073741823] ∈ {0; 42} diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_string.err.oracle b/tests/libc/oracle/stdlib_c.1.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_string.err.oracle rename to tests/libc/oracle/stdlib_c.1.err.oracle diff --git a/tests/libc/oracle/stdlib_c.1.res.oracle b/tests/libc/oracle/stdlib_c.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..35c27ce48bb3a5457366b6fc5ca484d47aef9339 --- /dev/null +++ b/tests/libc/oracle/stdlib_c.1.res.oracle @@ -0,0 +1,57 @@ +[kernel] Parsing tests/libc/stdlib_c.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + Frama_C_entropy_source ∈ [--..--] +tests/libc/stdlib_c.c:14:[value] allocating variable __calloc_main_l14 +tests/libc/stdlib_c.c:16:[value] assertion got status valid. +[value] computing for function Frama_C_size_t_interval <- main. + Called from tests/libc/stdlib_c.c:20. +[value] using specification for function Frama_C_size_t_interval +share/libc/__fc_builtin.h:142:[value] function Frama_C_size_t_interval: precondition got status valid. +[value] Done for function Frama_C_size_t_interval +tests/libc/stdlib_c.c:21:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/libc/stdlib_c.c:21:[value] allocating variable __calloc_main_l21 +tests/libc/stdlib_c.c:23:[value] assertion got status valid. +tests/libc/stdlib_c.c:27:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/libc/stdlib_c.c:28:[value] assertion got status valid. +tests/libc/stdlib_c.c:32:[value] allocating variable __calloc_main_l32 +tests/libc/stdlib_c.c:32:[value:malloc] marking variable `__calloc_main_l32' as weak +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31) to fit 0..63 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/63) to fit 0..63 +tests/libc/stdlib_c.c:33:[value] warning: out of bounds write. assert \valid(s + (unsigned int)(i - 1)); +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/63) to fit 0..95 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/95) to fit 0..95 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/95) to fit 0..127 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/127) to fit 0..127 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/127) to fit 0..159 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/159) to fit 0..159 +tests/libc/stdlib_c.c:31:[value] entering loop for the first time +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/159) to fit 0..191 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/191) to fit 0..191/223 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/223) to fit 0..191/255 +tests/libc/stdlib_c.c:32:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' (0..31/255) to fit 0..191/34359738367 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' + (0..31/34359738367) to fit 0..191/34359738367 +tests/libc/stdlib_c.c:32:[value:malloc] resizing variable `__calloc_w_main_l32' + (0..31/34359738367) to fit 0..191/34359738367 +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + Frama_C_entropy_source ∈ [--..--] + p ∈ {{ &__calloc_main_l14 }} + nmemb ∈ [1..4294967295] + q ∈ {{ NULL ; &__calloc_main_l21[0] }} + r ∈ {0} + __retres ∈ {0} + __calloc_w_main_l32[0..1073741823] ∈ {0; 42} diff --git a/src/plugins/wp/tests/wp_typed/oracle/unit_tset.err.oracle b/tests/libc/oracle/stdlib_c.2.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/unit_tset.err.oracle rename to tests/libc/oracle/stdlib_c.2.err.oracle diff --git a/tests/libc/oracle/stdlib_c.2.res.oracle b/tests/libc/oracle/stdlib_c.2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..2d3d451882161481d8005a216f0057bf8a8d44fb --- /dev/null +++ b/tests/libc/oracle/stdlib_c.2.res.oracle @@ -0,0 +1,152 @@ +[kernel] Parsing tests/libc/stdlib_c.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + Frama_C_entropy_source ∈ [--..--] +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:14. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +share/libc/stdlib.c:84:[value] allocating variable __malloc_malloc_l84 +share/libc/stdlib.c:84:[kernel] warning: Neither code nor specification for function Frama_C_malloc_by_stack, generating default assigns from the prototype +share/libc/stdlib.h:320:[value] warning: function malloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.h:325:[value] warning: function malloc, behavior no_allocation: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.h:325:[value] function malloc, behavior no_allocation: postcondition got status valid. (Behavior may be inactive, no reduction performed.) +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_malloc_l84 }},{0},{4})) +share/libc/stdlib.h:299:[value] warning: function calloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.h:300:[value] warning: function calloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.h:301:[value] warning: function calloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.h:307:[value] warning: function calloc, behavior no_allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +[value] Recording results for calloc +[value] Done for function calloc +tests/libc/stdlib_c.c:16:[value] assertion got status valid. +[value] computing for function Frama_C_size_t_interval <- main. + Called from tests/libc/stdlib_c.c:20. +[value] using specification for function Frama_C_size_t_interval +share/libc/__fc_builtin.h:142:[value] function Frama_C_size_t_interval: precondition got status valid. +[value] Done for function Frama_C_size_t_interval +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:21. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +share/libc/stdlib.c:84:[value] allocating variable __malloc_malloc_l84_0 +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_malloc_l84_0 }},{0}, + [0..4294967292],0%4)) +share/libc/stdlib.c:105:[value] warning: out of bounds write. assert \valid(p + (0 .. l - 1)); +share/libc/stdlib.h:307:[value] function calloc, behavior no_allocation: postcondition got status valid. (Behavior may be inactive, no reduction performed.) +[value] Recording results for calloc +[value] Done for function calloc +tests/libc/stdlib_c.c:23:[value] warning: assertion got status unknown. +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:27. +share/libc/stdlib.h:307:[value] function calloc, behavior no_allocation: postcondition got status valid. +[value] Recording results for calloc +[value] Done for function calloc +tests/libc/stdlib_c.c:28:[value] assertion got status valid. +tests/libc/stdlib_c.c:31:[value] entering loop for the first time +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:32. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +share/libc/stdlib.c:84:[value] allocating variable __malloc_malloc_l84_1 +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_malloc_l84_1 }},{0},{4})) +[value] Recording results for calloc +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:32. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_w_malloc_l84_1 }},{0},{4; 8})) +[value] Recording results for calloc +[value] Done for function calloc +tests/libc/stdlib_c.c:33:[value] warning: out of bounds write. assert \valid(s + (unsigned int)(i - 1)); +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:32. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_w_malloc_l84_1 }},{0}, + {4; 8; 12})) +[value] Recording results for calloc +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:32. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_w_malloc_l84_1 }},{0}, + [0..4294967292],0%4)) +[value] Recording results for calloc +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:32. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_w_malloc_l84_1 }},{0}, + [0..4294967292],0%4)) +[value] Recording results for calloc +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/libc/stdlib_c.c:32. +[value] computing for function malloc <- calloc <- main. + Called from share/libc/stdlib.c:104. +[value] Recording results for malloc +[value] Done for function malloc +share/libc/stdlib.c:105:[value] Call to builtin memset(({{ (void *)&__malloc_w_malloc_l84_1 }},{0}, + [0..4294967292],0%4)) +[value] Recording results for calloc +[value] Done for function calloc +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function malloc: + +[value:final-states] Values at end of function calloc: + l ∈ [0..4294967292],0%4 + p ∈ + {{ NULL ; &__malloc_malloc_l84[0] ; &__malloc_malloc_l84_0[0] ; + &__malloc_w_malloc_l84_1[0] }} + __retres ∈ + {{ NULL ; (void *)&__malloc_malloc_l84 ; + (void *)&__malloc_malloc_l84_0 ; + (void *)&__malloc_w_malloc_l84_1 }} + __malloc_malloc_l84[0..3] ∈ {0} or UNINITIALIZED + __malloc_malloc_l84_0[0..4294967291] ∈ {0} or UNINITIALIZED + __malloc_w_malloc_l84_1[0]# ∈ {0; 42} or UNINITIALIZED%32, bits 0 to 7 + [1]# ∈ {0; 42} or UNINITIALIZED%32, bits 8 to 15 + [2]# ∈ {0; 42} or UNINITIALIZED%32, bits 16 to 23 + [bits 24 to 34359738335]# ∈ + {0; 42} or UNINITIALIZED repeated %32, bits 24 to 34359738335 +[value:final-states] Values at end of function main: + Frama_C_entropy_source ∈ [--..--] + p ∈ {{ NULL ; (int *)&__malloc_malloc_l84 }} + nmemb ∈ [1..4294967295] + q ∈ {{ NULL ; (int *)&__malloc_malloc_l84_0 }} + r ∈ {0} + __retres ∈ {0} + __malloc_malloc_l84[0..3] ∈ {0} or UNINITIALIZED + __malloc_malloc_l84_0[0..4294967291] ∈ {0} or UNINITIALIZED + __malloc_w_malloc_l84_1[0]# ∈ {0; 42} or UNINITIALIZED%32, bits 0 to 7 + [1]# ∈ {0; 42} or UNINITIALIZED%32, bits 8 to 15 + [2]# ∈ {0; 42} or UNINITIALIZED%32, bits 16 to 23 + [bits 24 to 34359738335]# ∈ + {0; 42} or UNINITIALIZED repeated %32, bits 24 to 34359738335 diff --git a/tests/libc/oracle/stdlib_h.res.oracle b/tests/libc/oracle/stdlib_h.res.oracle index 03e92a3099c91bbf1922a051caf7e3feb599d207..5f40e2db61276e137da29715177373ca633663a5 100644 --- a/tests/libc/oracle/stdlib_h.res.oracle +++ b/tests/libc/oracle/stdlib_h.res.oracle @@ -1,27 +1,26 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/stdlib_h.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] [value] computing for function strtol <- main. Called from tests/libc/stdlib_h.c:15. [value] using specification for function strtol -share/libc/stdlib.h:151:[value] function strtol: precondition got status valid. share/libc/stdlib.h:152:[value] function strtol: precondition got status valid. share/libc/stdlib.h:153:[value] function strtol: precondition got status valid. -share/libc/stdlib.h:161:[value] function strtol, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:154:[value] function strtol: precondition got status valid. +share/libc/stdlib.h:162:[value] function strtol, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtol [value] computing for function strtol <- main. Called from tests/libc/stdlib_h.c:16. -share/libc/stdlib.h:151:[value] warning: function strtol: precondition got status unknown. +share/libc/stdlib.h:152:[value] warning: function strtol: precondition got status unknown. [value] Done for function strtol [value] computing for function strtol <- main. Called from tests/libc/stdlib_h.c:17. @@ -32,14 +31,14 @@ share/libc/stdlib.h:151:[value] warning: function strtol: precondition got statu [value] computing for function strtoll <- main. Called from tests/libc/stdlib_h.c:22. [value] using specification for function strtoll -share/libc/stdlib.h:176:[value] function strtoll: precondition got status valid. share/libc/stdlib.h:177:[value] function strtoll: precondition got status valid. share/libc/stdlib.h:178:[value] function strtoll: precondition got status valid. -share/libc/stdlib.h:186:[value] function strtoll, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:179:[value] function strtoll: precondition got status valid. +share/libc/stdlib.h:187:[value] function strtoll, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtoll [value] computing for function strtoll <- main. Called from tests/libc/stdlib_h.c:23. -share/libc/stdlib.h:176:[value] warning: function strtoll: precondition got status unknown. +share/libc/stdlib.h:177:[value] warning: function strtoll: precondition got status unknown. [value] Done for function strtoll [value] computing for function strtoll <- main. Called from tests/libc/stdlib_h.c:24. @@ -47,14 +46,14 @@ share/libc/stdlib.h:176:[value] warning: function strtoll: precondition got stat [value] computing for function strtoul <- main. Called from tests/libc/stdlib_h.c:28. [value] using specification for function strtoul -share/libc/stdlib.h:201:[value] function strtoul: precondition got status valid. share/libc/stdlib.h:202:[value] function strtoul: precondition got status valid. share/libc/stdlib.h:203:[value] function strtoul: precondition got status valid. -share/libc/stdlib.h:211:[value] function strtoul, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:204:[value] function strtoul: precondition got status valid. +share/libc/stdlib.h:212:[value] function strtoul, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtoul [value] computing for function strtoul <- main. Called from tests/libc/stdlib_h.c:29. -share/libc/stdlib.h:201:[value] warning: function strtoul: precondition got status unknown. +share/libc/stdlib.h:202:[value] warning: function strtoul: precondition got status unknown. [value] Done for function strtoul [value] computing for function strtoul <- main. Called from tests/libc/stdlib_h.c:30. @@ -62,14 +61,14 @@ share/libc/stdlib.h:201:[value] warning: function strtoul: precondition got stat [value] computing for function strtoull <- main. Called from tests/libc/stdlib_h.c:34. [value] using specification for function strtoull -share/libc/stdlib.h:226:[value] function strtoull: precondition got status valid. share/libc/stdlib.h:227:[value] function strtoull: precondition got status valid. share/libc/stdlib.h:228:[value] function strtoull: precondition got status valid. -share/libc/stdlib.h:236:[value] function strtoull, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:229:[value] function strtoull: precondition got status valid. +share/libc/stdlib.h:237:[value] function strtoull, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtoull [value] computing for function strtoull <- main. Called from tests/libc/stdlib_h.c:35. -share/libc/stdlib.h:226:[value] warning: function strtoull: precondition got status unknown. +share/libc/stdlib.h:227:[value] warning: function strtoull: precondition got status unknown. [value] Done for function strtoull [value] computing for function strtoull <- main. Called from tests/libc/stdlib_h.c:36. @@ -77,13 +76,13 @@ share/libc/stdlib.h:226:[value] warning: function strtoull: precondition got sta [value] computing for function strtod <- main. Called from tests/libc/stdlib_h.c:41. [value] using specification for function strtod -share/libc/stdlib.h:85:[value] function strtod: precondition got status valid. share/libc/stdlib.h:86:[value] function strtod: precondition got status valid. -share/libc/stdlib.h:94:[value] function strtod, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:87:[value] function strtod: precondition got status valid. +share/libc/stdlib.h:95:[value] function strtod, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtod [value] computing for function strtod <- main. Called from tests/libc/stdlib_h.c:42. -share/libc/stdlib.h:85:[value] warning: function strtod: precondition got status unknown. +share/libc/stdlib.h:86:[value] warning: function strtod: precondition got status unknown. [value] Done for function strtod [value] computing for function strtod <- main. Called from tests/libc/stdlib_h.c:43. @@ -91,13 +90,13 @@ share/libc/stdlib.h:85:[value] warning: function strtod: precondition got status [value] computing for function strtold <- main. Called from tests/libc/stdlib_h.c:47. [value] using specification for function strtold -share/libc/stdlib.h:128:[value] function strtold: precondition got status valid. share/libc/stdlib.h:129:[value] function strtold: precondition got status valid. -share/libc/stdlib.h:137:[value] function strtold, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:130:[value] function strtold: precondition got status valid. +share/libc/stdlib.h:138:[value] function strtold, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtold [value] computing for function strtold <- main. Called from tests/libc/stdlib_h.c:48. -share/libc/stdlib.h:128:[value] warning: function strtold: precondition got status unknown. +share/libc/stdlib.h:129:[value] warning: function strtold: precondition got status unknown. [value] Done for function strtold [value] computing for function strtold <- main. Called from tests/libc/stdlib_h.c:49. @@ -105,13 +104,13 @@ share/libc/stdlib.h:128:[value] warning: function strtold: precondition got stat [value] computing for function strtof <- main. Called from tests/libc/stdlib_h.c:53. [value] using specification for function strtof -share/libc/stdlib.h:106:[value] function strtof: precondition got status valid. share/libc/stdlib.h:107:[value] function strtof: precondition got status valid. -share/libc/stdlib.h:115:[value] function strtof, behavior nonnull_endptr: precondition got status valid. +share/libc/stdlib.h:108:[value] function strtof: precondition got status valid. +share/libc/stdlib.h:116:[value] function strtof, behavior nonnull_endptr: precondition got status valid. [value] Done for function strtof [value] computing for function strtof <- main. Called from tests/libc/stdlib_h.c:54. -share/libc/stdlib.h:106:[value] warning: function strtof: precondition got status unknown. +share/libc/stdlib.h:107:[value] warning: function strtof: precondition got status unknown. [value] Done for function strtof [value] computing for function strtof <- main. Called from tests/libc/stdlib_h.c:55. diff --git a/tests/libc/oracle/string_c.res.oracle b/tests/libc/oracle/string_c.res.oracle index 0af4d9bc4901ee56d0f43148915b077c69124eb8..d9dadd2aac89492d531ca5f1728dab94fc9fe2b3 100644 --- a/tests/libc/oracle/string_c.res.oracle +++ b/tests/libc/oracle/string_c.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/string_c.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] computing for function test_memcpy <- main. Called from tests/libc/string_c.c:262. tests/libc/string_c.c:10:[value] Call to builtin memcpy(({{ (void *)&dest }},{{ (void const *)&src }},{6})) @@ -33,23 +32,23 @@ tests/libc/string_c.c:28:[value] assertion got status valid. [value] Done for function test_memcpy [value] computing for function test_memmove <- main. Called from tests/libc/string_c.c:263. -[value] Called Frama_C_show_each_s0({1}) -[value] Called Frama_C_show_each_s0({2}) -[value] Called Frama_C_show_each_s0({3}) -[value] Called Frama_C_show_each_s0({4}) -[value] Called Frama_C_show_each_s0({3}) -[value] Called Frama_C_show_each_s0({4}) -[value] Called Frama_C_show_each_s0({5}) -[value] Called Frama_C_show_each_s0({6}) +tests/libc/string_c.c:37:[value] Frama_C_show_each_s0: {1} +tests/libc/string_c.c:38:[value] Frama_C_show_each_s0: {2} +tests/libc/string_c.c:39:[value] Frama_C_show_each_s0: {3} +tests/libc/string_c.c:40:[value] Frama_C_show_each_s0: {4} +tests/libc/string_c.c:41:[value] Frama_C_show_each_s0: {3} +tests/libc/string_c.c:42:[value] Frama_C_show_each_s0: {4} +tests/libc/string_c.c:43:[value] Frama_C_show_each_s0: {5} +tests/libc/string_c.c:44:[value] Frama_C_show_each_s0: {6} [value] computing for function memmove <- test_memmove <- main. Called from tests/libc/string_c.c:45. share/libc/string.h:71:[value] function memmove: precondition 'valid_dst' got status valid. share/libc/string.h:72:[value] function memmove: precondition 'valid_src' got status valid. [value] computing for function memoverlap <- memmove <- test_memmove <- main. - Called from share/libc/string.c:61. + Called from share/libc/string.c:62. [value] using specification for function memoverlap [value] Done for function memoverlap -share/libc/string.c:61:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:75:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:75:[value] warning: function memmove: postcondition got status unknown. share/libc/string.h:76:[value] function memmove: postcondition got status valid. [value] Recording results for memmove @@ -59,18 +58,18 @@ tests/libc/string_c.c:47:[value] assertion got status valid. [value] computing for function memmove <- test_memmove <- main. Called from tests/libc/string_c.c:52. [value] computing for function memoverlap <- memmove <- test_memmove <- main. - Called from share/libc/string.c:61. + Called from share/libc/string.c:62. [value] Done for function memoverlap -share/libc/string.c:62:[value] Call to builtin memcpy(({{ (void *)&buf }},{{ (void const *)&buf[2] }},{4})) +share/libc/string.c:63:[value] Call to builtin memcpy(({{ (void *)&buf }},{{ (void const *)&buf[2] }},{4})) [value] Recording results for memmove [value] Done for function memmove tests/libc/string_c.c:53:[value] assertion got status valid. [value] computing for function memmove <- test_memmove <- main. Called from tests/libc/string_c.c:55. [value] computing for function memoverlap <- memmove <- test_memmove <- main. - Called from share/libc/string.c:61. + Called from share/libc/string.c:62. [value] Done for function memoverlap -share/libc/string.c:62:[value] Call to builtin memcpy(({{ (void *)&buf }},{{ (void const *)&buf }},{4})) +share/libc/string.c:63:[value] Call to builtin memcpy(({{ (void *)&buf }},{{ (void const *)&buf }},{4})) [value] Recording results for memmove [value] Done for function memmove tests/libc/string_c.c:56:[value] assertion got status valid. @@ -81,8 +80,7 @@ tests/libc/string_c.c:56:[value] assertion got status valid. [value] computing for function strlen <- test_strlen <- main. Called from tests/libc/string_c.c:62. share/libc/string.h:92:[value] function strlen: precondition 'valid_string_src' got status valid. -share/libc/string.c:78:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:94:[value] warning: function strlen: postcondition got status unknown. +share/libc/string.h:94:[value] function strlen: postcondition got status valid. [value] Recording results for strlen [value] Done for function strlen tests/libc/string_c.c:63:[value] assertion got status valid. @@ -103,7 +101,7 @@ tests/libc/string_c.c:67:[value] assertion got status valid. [value] computing for function memset <- test_memset <- main. Called from tests/libc/string_c.c:73. share/libc/string.h:82:[value] function memset: precondition got status valid. -share/libc/string.c:87:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:85:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:85:[value] warning: function memset: postcondition got status unknown. share/libc/string.h:86:[value] function memset: postcondition got status valid. [value] Recording results for memset @@ -124,7 +122,7 @@ tests/libc/string_c.c:78:[value] assertion got status valid. Called from tests/libc/string_c.c:85. share/libc/string.h:104:[value] function strcmp: precondition 'valid_string_s1' got status valid. share/libc/string.h:105:[value] function strcmp: precondition 'valid_string_s2' got status valid. -share/libc/string.c:96:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:107:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:107:[value] warning: function strcmp: postcondition got status unknown. [value] Recording results for strcmp [value] Done for function strcmp @@ -167,7 +165,7 @@ tests/libc/string_c.c:98:[value] assertion got status valid. Called from tests/libc/string_c.c:148. share/libc/string.h:111:[value] function strncmp: precondition 'valid_string_s1' got status valid. share/libc/string.h:112:[value] function strncmp: precondition 'valid_string_s2' got status valid. -share/libc/string.c:107:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:114:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:114:[value] warning: function strncmp: postcondition got status unknown. [value] Recording results for strncmp [value] Done for function strncmp @@ -215,7 +213,7 @@ tests/libc/string_c.c:164:[value] assertion got status valid. Called from tests/libc/string_c.c:169. share/libc/string.h:36:[value] function memcmp: precondition got status valid. share/libc/string.h:37:[value] function memcmp: precondition got status valid. -share/libc/string.c:117:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:39:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:39:[value] warning: function memcmp: postcondition got status unknown. [value] Recording results for memcmp [value] Done for function memcmp @@ -241,28 +239,23 @@ tests/libc/string_c.c:176:[value] assertion got status valid. Called from tests/libc/string_c.c:269. [value] computing for function strcat <- test_strcat <- main. Called from tests/libc/string_c.c:105. -share/libc/string.h:262:[value] function strcat: precondition 'valid_string_src' got status valid. -share/libc/string.h:263:[value] function strcat: precondition 'valid_string_dst' got status valid. -tests/libc/string_c.c:105:[value] Cannot evaluate range bound strlen(dest) + strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -share/libc/string.h:264:[value] warning: function strcat: precondition 'room_string' got status unknown. +share/libc/string.h:264:[value] function strcat: precondition 'valid_string_src' got status valid. +share/libc/string.h:265:[value] function strcat: precondition 'valid_string_dst' got status valid. +share/libc/string.h:266:[value] function strcat: precondition 'room_string' got status valid. [value] computing for function strlen <- strcat <- test_strcat <- main. - Called from share/libc/string.c:145. + Called from share/libc/string.c:146. [value] Recording results for strlen [value] Done for function strlen -share/libc/string.c:150:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:267:[value] warning: function strcat: postcondition got status unknown. share/libc/string.h:269:[value] function strcat: postcondition got status valid. +share/libc/string.h:271:[value] function strcat: postcondition got status valid. [value] Recording results for strcat [value] Done for function strcat tests/libc/string_c.c:106:[value] assertion got status valid. tests/libc/string_c.c:107:[value] assertion got status valid. [value] computing for function strcat <- test_strcat <- main. Called from tests/libc/string_c.c:113. -tests/libc/string_c.c:113:[value] Cannot evaluate range bound strlen(dest) + strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] computing for function strlen <- strcat <- test_strcat <- main. - Called from share/libc/string.c:145. + Called from share/libc/string.c:146. [value] Recording results for strlen [value] Done for function strlen [value] Recording results for strcat @@ -270,20 +263,16 @@ tests/libc/string_c.c:113:[value] Cannot evaluate range bound strlen(dest) + str tests/libc/string_c.c:114:[value] assertion got status valid. [value] computing for function strcat <- test_strcat <- main. Called from tests/libc/string_c.c:115. -tests/libc/string_c.c:115:[value] Cannot evaluate range bound strlen(dest) + strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] computing for function strlen <- strcat <- test_strcat <- main. - Called from share/libc/string.c:145. + Called from share/libc/string.c:146. [value] Recording results for strlen [value] Done for function strlen [value] Recording results for strcat [value] Done for function strcat [value] computing for function strcat <- test_strcat <- main. Called from tests/libc/string_c.c:116. -tests/libc/string_c.c:116:[value] Cannot evaluate range bound strlen(dest) + strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] computing for function strlen <- strcat <- test_strcat <- main. - Called from share/libc/string.c:145. + Called from share/libc/string.c:146. [value] Recording results for strlen [value] Done for function strlen [value] Recording results for strcat @@ -296,27 +285,22 @@ tests/libc/string_c.c:117:[value] assertion got status valid. [value] computing for function strcpy <- test_strcpy <- main. Called from tests/libc/string_c.c:123. share/libc/string.h:221:[value] function strcpy: precondition 'valid_string_src' got status valid. -tests/libc/string_c.c:123:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -share/libc/string.h:222:[value] warning: function strcpy: precondition 'room_string' got status unknown. -share/libc/string.c:173:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:225:[value] warning: function strcpy: postcondition got status unknown. -share/libc/string.h:226:[value] function strcpy: postcondition got status valid. +share/libc/string.h:222:[value] function strcpy: precondition 'room_string' got status valid. +share/libc/string.h:224:[value] function strcpy: precondition 'separated_strings' got status valid. +share/libc/string.h:227:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:227:[value] warning: function strcpy: postcondition got status unknown. +share/libc/string.h:228:[value] function strcpy: postcondition got status valid. [value] Recording results for strcpy [value] Done for function strcpy tests/libc/string_c.c:124:[value] assertion got status valid. tests/libc/string_c.c:125:[value] assertion got status valid. [value] computing for function strcpy <- test_strcpy <- main. Called from tests/libc/string_c.c:126. -tests/libc/string_c.c:126:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy tests/libc/string_c.c:127:[value] assertion got status valid. [value] computing for function strcpy <- test_strcpy <- main. Called from tests/libc/string_c.c:128. -tests/libc/string_c.c:128:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy tests/libc/string_c.c:129:[value] assertion got status valid. @@ -326,33 +310,30 @@ tests/libc/string_c.c:129:[value] assertion got status valid. Called from tests/libc/string_c.c:272. [value] computing for function strncpy <- test_strncpy <- main. Called from tests/libc/string_c.c:135. -share/libc/string.h:231:[value] function strncpy: precondition 'valid_string_src' got status valid. -share/libc/string.h:232:[value] function strncpy: precondition 'room_nstring' got status valid. -tests/libc/string_c.c:135:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:235:[value] function strncpy: postcondition got status valid. -share/libc/string.h:236:[value] function strncpy: postcondition got status valid. -share/libc/string.c:185:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:239:[value] warning: function strncpy, behavior complete: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/string.h:242:[value] warning: function strncpy, behavior partial: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/string.h:233:[value] function strncpy: precondition 'valid_string_src' got status valid. +share/libc/string.h:234:[value] function strncpy: precondition 'room_nstring' got status valid. +share/libc/string.h:237:[value] function strncpy: postcondition got status valid. +share/libc/string.h:238:[value] function strncpy: postcondition got status valid. +share/libc/string.h:241:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:241:[value] warning: function strncpy, behavior complete: postcondition got status unknown. [value] Recording results for strncpy [value] Done for function strncpy tests/libc/string_c.c:136:[value] assertion got status valid. tests/libc/string_c.c:137:[value] assertion got status valid. [value] computing for function strncpy <- test_strncpy <- main. Called from tests/libc/string_c.c:138. -tests/libc/string_c.c:138:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:244:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:244:[value] warning: function strncpy, behavior partial: postcondition got status unknown. [value] Recording results for strncpy [value] Done for function strncpy tests/libc/string_c.c:139:[value] assertion got status valid. [value] computing for function strncpy <- test_strncpy <- main. Called from tests/libc/string_c.c:140. -tests/libc/string_c.c:140:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strncpy [value] Done for function strncpy tests/libc/string_c.c:141:[value] assertion got status valid. [value] computing for function strncpy <- test_strncpy <- main. Called from tests/libc/string_c.c:142. -tests/libc/string_c.c:142:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strncpy [value] Done for function strncpy tests/libc/string_c.c:143:[value] assertion got status valid. @@ -363,11 +344,11 @@ tests/libc/string_c.c:143:[value] assertion got status valid. [value] computing for function strchr <- test_strchr <- main. Called from tests/libc/string_c.c:182. share/libc/string.h:124:[value] function strchr: precondition 'valid_string_src' got status valid. -tests/libc/string_c.c:182:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:127:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:134:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:128:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:129:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) -share/libc/string.c:194:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:130:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/string.h:130:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:131:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:132:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:135:[value] warning: function strchr, behavior not_found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) @@ -377,7 +358,6 @@ share/libc/string.h:137:[value] function strchr, behavior default: postcondition tests/libc/string_c.c:183:[value] assertion got status valid. [value] computing for function strchr <- test_strchr <- main. Called from tests/libc/string_c.c:184. -tests/libc/string_c.c:184:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:128:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:129:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:130:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) @@ -388,13 +368,11 @@ share/libc/string.h:135:[value] function strchr, behavior not_found: postconditi tests/libc/string_c.c:185:[value] assertion got status valid. [value] computing for function strchr <- test_strchr <- main. Called from tests/libc/string_c.c:186. -tests/libc/string_c.c:186:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr tests/libc/string_c.c:187:[value] assertion got status valid. [value] computing for function strchr <- test_strchr <- main. Called from tests/libc/string_c.c:188. -tests/libc/string_c.c:188:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr tests/libc/string_c.c:189:[value] assertion got status valid. @@ -405,9 +383,10 @@ tests/libc/string_c.c:189:[value] assertion got status valid. [value] computing for function strrchr <- test_strrchr <- main. Called from tests/libc/string_c.c:195. share/libc/string.h:141:[value] function strrchr: precondition 'valid_string_src' got status valid. -tests/libc/string_c.c:195:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:144:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:149:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] computing for function strlen <- strrchr <- test_strrchr <- main. - Called from share/libc/string.c:200. + Called from share/libc/string.c:201. [value] Recording results for strlen [value] Done for function strlen share/libc/string.h:145:[value] function strrchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) @@ -420,9 +399,8 @@ share/libc/string.h:152:[value] function strrchr, behavior default: postconditio tests/libc/string_c.c:196:[value] assertion got status valid. [value] computing for function strrchr <- test_strrchr <- main. Called from tests/libc/string_c.c:197. -tests/libc/string_c.c:197:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] computing for function strlen <- strrchr <- test_strrchr <- main. - Called from share/libc/string.c:200. + Called from share/libc/string.c:201. [value] Recording results for strlen [value] Done for function strlen share/libc/string.h:145:[value] warning: function strrchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) @@ -434,9 +412,8 @@ share/libc/string.h:150:[value] function strrchr, behavior not_found: postcondit tests/libc/string_c.c:198:[value] assertion got status valid. [value] computing for function strrchr <- test_strrchr <- main. Called from tests/libc/string_c.c:199. -tests/libc/string_c.c:199:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] computing for function strlen <- strrchr <- test_strrchr <- main. - Called from share/libc/string.c:200. + Called from share/libc/string.c:201. [value] Recording results for strlen [value] Done for function strlen [value] Recording results for strrchr @@ -444,9 +421,8 @@ tests/libc/string_c.c:199:[value] cannot evaluate ACSL term, unsupported ACSL co tests/libc/string_c.c:200:[value] assertion got status valid. [value] computing for function strrchr <- test_strrchr <- main. Called from tests/libc/string_c.c:201. -tests/libc/string_c.c:201:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] computing for function strlen <- strrchr <- test_strrchr <- main. - Called from share/libc/string.c:200. + Called from share/libc/string.c:201. [value] Recording results for strlen [value] Done for function strlen [value] Recording results for strrchr @@ -459,7 +435,8 @@ tests/libc/string_c.c:202:[value] assertion got status valid. [value] computing for function memchr <- test_memchr <- main. Called from tests/libc/string_c.c:208. share/libc/string.h:43:[value] function memchr: precondition got status valid. -tests/libc/string_c.c:208:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:46:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:53:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:47:[value] function memchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:48:[value] function memchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:49:[value] warning: function memchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) @@ -469,7 +446,6 @@ share/libc/string.h:54:[value] warning: function memchr, behavior not_found: pos tests/libc/string_c.c:209:[value] assertion got status valid. [value] computing for function memchr <- test_memchr <- main. Called from tests/libc/string_c.c:210. -tests/libc/string_c.c:210:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:47:[value] warning: function memchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:48:[value] warning: function memchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:54:[value] function memchr, behavior not_found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) @@ -478,25 +454,21 @@ share/libc/string.h:54:[value] function memchr, behavior not_found: postconditio tests/libc/string_c.c:211:[value] assertion got status valid. [value] computing for function memchr <- test_memchr <- main. Called from tests/libc/string_c.c:212. -tests/libc/string_c.c:212:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for memchr [value] Done for function memchr tests/libc/string_c.c:213:[value] assertion got status valid. [value] computing for function memchr <- test_memchr <- main. Called from tests/libc/string_c.c:214. -tests/libc/string_c.c:214:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for memchr [value] Done for function memchr tests/libc/string_c.c:215:[value] assertion got status valid. [value] computing for function memchr <- test_memchr <- main. Called from tests/libc/string_c.c:216. -tests/libc/string_c.c:216:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for memchr [value] Done for function memchr tests/libc/string_c.c:217:[value] assertion got status valid. [value] computing for function memchr <- test_memchr <- main. Called from tests/libc/string_c.c:218. -tests/libc/string_c.c:218:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for memchr [value] Done for function memchr tests/libc/string_c.c:219:[value] assertion got status valid. @@ -542,7 +514,7 @@ tests/libc/string_c.c:236:[value] assertion got status valid. Called from tests/libc/string_c.c:242. share/libc/string.h:177:[value] function strstr: precondition 'valid_string_haystack' got status valid. share/libc/string.h:178:[value] function strstr: precondition 'valid_string_needle' got status valid. -share/libc/string.c:234:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:183:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:181:[value] warning: function strstr: postcondition got status unknown. [value] Recording results for strstr [value] Done for function strstr diff --git a/tests/libc/oracle/string_c_generic.res.oracle b/tests/libc/oracle/string_c_generic.res.oracle index 9ed79ecc0de7aae15d2ea970d81719e3df3f8f91..d9b85f194e1448ab535a8f71563b58f38979b539 100644 --- a/tests/libc/oracle/string_c_generic.res.oracle +++ b/tests/libc/oracle/string_c_generic.res.oracle @@ -1,38 +1,34 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/string_c_generic.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:56. share/libc/string.h:221:[value] function strcpy: precondition 'valid_string_src' got status valid. -tests/libc/string_c_generic.c:56:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -share/libc/string.h:222:[value] warning: function strcpy: precondition 'room_string' got status unknown. -share/libc/string.c:173:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:225:[value] warning: function strcpy: postcondition got status unknown. -share/libc/string.h:226:[value] function strcpy: postcondition got status valid. +share/libc/string.h:222:[value] function strcpy: precondition 'room_string' got status valid. +share/libc/string.h:224:[value] function strcpy: precondition 'separated_strings' got status valid. +share/libc/string.h:227:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:227:[value] warning: function strcpy: postcondition got status unknown. +share/libc/string.h:228:[value] function strcpy: postcondition got status valid. [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. Called from tests/libc/string_c_generic.c:57. share/libc/string.h:104:[value] function strcmp: precondition 'valid_string_s1' got status valid. share/libc/string.h:105:[value] function strcmp: precondition 'valid_string_s2' got status valid. -share/libc/string.c:96:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:107:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:107:[value] warning: function strcmp: postcondition got status unknown. [value] Recording results for strcmp [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:58. -tests/libc/string_c_generic.c:58:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. @@ -41,8 +37,6 @@ tests/libc/string_c_generic.c:58:[value] Cannot evaluate range bound strlen(src) [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:60. -tests/libc/string_c_generic.c:60:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. @@ -51,8 +45,6 @@ tests/libc/string_c_generic.c:60:[value] Cannot evaluate range bound strlen(src) [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:62. -tests/libc/string_c_generic.c:62:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. @@ -61,8 +53,6 @@ tests/libc/string_c_generic.c:62:[value] Cannot evaluate range bound strlen(src) [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:65. -tests/libc/string_c_generic.c:65:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. @@ -71,8 +61,6 @@ tests/libc/string_c_generic.c:65:[value] Cannot evaluate range bound strlen(src) [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:67. -tests/libc/string_c_generic.c:67:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. @@ -81,8 +69,6 @@ tests/libc/string_c_generic.c:67:[value] Cannot evaluate range bound strlen(src) [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:69. -tests/libc/string_c_generic.c:69:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strcmp <- main. @@ -92,45 +78,44 @@ tests/libc/string_c_generic.c:69:[value] Cannot evaluate range bound strlen(src) [value] computing for function memset <- main. Called from tests/libc/string_c_generic.c:72. share/libc/string.h:82:[value] function memset: precondition got status valid. -share/libc/string.c:84:[value] entering loop for the first time -share/libc/string.c:87:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.c:85:[value] entering loop for the first time +share/libc/string.h:85:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:85:[value] warning: function memset: postcondition got status unknown. share/libc/string.h:86:[value] function memset: postcondition got status valid. [value] Recording results for memset [value] Done for function memset [value] computing for function strncpy <- main. Called from tests/libc/string_c_generic.c:73. -share/libc/string.h:231:[value] function strncpy: precondition 'valid_string_src' got status valid. -share/libc/string.h:232:[value] function strncpy: precondition 'room_nstring' got status valid. -tests/libc/string_c_generic.c:73:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.c:183:[value] entering loop for the first time -share/libc/string.h:235:[value] function strncpy: postcondition got status valid. -share/libc/string.h:236:[value] function strncpy: postcondition got status valid. -share/libc/string.c:185:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:239:[value] warning: function strncpy, behavior complete: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/string.h:242:[value] warning: function strncpy, behavior partial: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/string.h:233:[value] function strncpy: precondition 'valid_string_src' got status valid. +share/libc/string.h:234:[value] function strncpy: precondition 'room_nstring' got status valid. +share/libc/string.c:184:[value] entering loop for the first time +share/libc/string.h:237:[value] function strncpy: postcondition got status valid. +share/libc/string.h:238:[value] function strncpy: postcondition got status valid. +share/libc/string.h:241:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:241:[value] warning: function strncpy, behavior complete: postcondition got status unknown. [value] Recording results for strncpy [value] Done for function strncpy [value] computing for function memcmp <- main. Called from tests/libc/string_c_generic.c:74. share/libc/string.h:36:[value] function memcmp: precondition got status valid. share/libc/string.h:37:[value] function memcmp: precondition got status valid. -share/libc/string.c:115:[value] entering loop for the first time -share/libc/string.c:117:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.c:116:[value] entering loop for the first time +share/libc/string.h:39:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:39:[value] warning: function memcmp: postcondition got status unknown. [value] Recording results for memcmp [value] Done for function memcmp [value] computing for function strncpy <- main. Called from tests/libc/string_c_generic.c:78. -tests/libc/string_c_generic.c:78:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:244:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:244:[value] warning: function strncpy, behavior partial: postcondition got status unknown. [value] Recording results for strncpy [value] Done for function strncpy [value] computing for function strncmp <- main. Called from tests/libc/string_c_generic.c:82. share/libc/string.h:111:[value] function strncmp: precondition 'valid_string_s1' got status valid. share/libc/string.h:112:[value] function strncmp: precondition 'valid_string_s2' got status valid. -share/libc/string.c:101:[value] entering loop for the first time -share/libc/string.c:107:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.c:102:[value] entering loop for the first time +share/libc/string.h:114:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:114:[value] warning: function strncmp: postcondition got status unknown. [value] Recording results for strncmp [value] Done for function strncmp @@ -140,53 +125,41 @@ share/libc/string.h:114:[value] warning: function strncmp: postcondition got sta [value] Done for function strncmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:85. -tests/libc/string_c_generic.c:85:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strncat <- main. Called from tests/libc/string_c_generic.c:86. -share/libc/string.h:274:[value] function strncat: precondition 'valid_string_src' got status valid. -share/libc/string.h:275:[value] function strncat: precondition 'valid_string_dst' got status valid. -tests/libc/string_c_generic.c:86:[value] Cannot evaluate range bound strlen(dest) - (unsupported ACSL construct: logic functions or predicates). Approximating -tests/libc/string_c_generic.c:86:[value] Cannot evaluate range bound strlen(dest) + n - (unsupported ACSL construct: logic functions or predicates). Approximating -share/libc/string.h:276:[value] warning: function strncat: precondition 'room_string' got status unknown. -tests/libc/string_c_generic.c:86:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:276:[value] function strncat: precondition 'valid_string_src' got status valid. +share/libc/string.h:277:[value] function strncat: precondition 'valid_string_dst' got status valid. +share/libc/string.h:290:[value] function strncat, behavior partial: precondition 'room_string' got status valid. [value] computing for function strlen <- strncat <- main. - Called from share/libc/string.c:156. + Called from share/libc/string.c:157. share/libc/string.h:92:[value] function strlen: precondition 'valid_string_src' got status valid. -share/libc/string.c:78:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:94:[value] warning: function strlen: postcondition got status unknown. +share/libc/string.h:94:[value] function strlen: postcondition got status valid. [value] Recording results for strlen [value] Done for function strlen -share/libc/string.h:279:[value] function strncat: postcondition got status valid. -share/libc/string.c:164:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:285:[value] warning: function strncat, behavior complete: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/string.h:291:[value] warning: function strncat, behavior partial: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/string.h:280:[value] function strncat: postcondition got status valid. +share/libc/string.h:294:[value] function strncat, behavior partial: postcondition got status valid. [value] Recording results for strncat [value] Done for function strncat [value] computing for function strcmp <- main. Called from tests/libc/string_c_generic.c:88. -share/libc/string.c:93:[value] entering loop for the first time +share/libc/string.c:94:[value] entering loop for the first time [value] Recording results for strcmp [value] Done for function strcmp [value] computing for function strcpy <- main. Called from tests/libc/string_c_generic.c:90. -tests/libc/string_c_generic.c:90:[value] Cannot evaluate range bound strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -share/libc/string.c:170:[value] entering loop for the first time +share/libc/string.c:171:[value] entering loop for the first time [value] Recording results for strcpy [value] Done for function strcpy [value] computing for function strchr <- main. Called from tests/libc/string_c_generic.c:91. share/libc/string.h:124:[value] function strchr: precondition 'valid_string_src' got status valid. -tests/libc/string_c_generic.c:91:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:127:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:134:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:128:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:129:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) -share/libc/string.c:194:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:130:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) +share/libc/string.h:130:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:131:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:132:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:135:[value] warning: function strchr, behavior not_found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) @@ -195,8 +168,7 @@ share/libc/string.h:137:[value] function strchr, behavior default: postcondition [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_generic.c:92. -tests/libc/string_c_generic.c:92:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.c:192:[value] entering loop for the first time +share/libc/string.c:193:[value] entering loop for the first time share/libc/string.h:128:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:129:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:130:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) @@ -207,10 +179,11 @@ share/libc/string.h:135:[value] function strchr, behavior not_found: postconditi [value] computing for function strrchr <- main. Called from tests/libc/string_c_generic.c:93. share/libc/string.h:141:[value] function strrchr: precondition 'valid_string_src' got status valid. -tests/libc/string_c_generic.c:93:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:144:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:149:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] computing for function strlen <- strrchr <- main. - Called from share/libc/string.c:200. -share/libc/string.c:77:[value] entering loop for the first time + Called from share/libc/string.c:201. +share/libc/string.c:78:[value] entering loop for the first time [value] Recording results for strlen [value] Done for function strlen share/libc/string.h:145:[value] function strrchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) @@ -222,12 +195,11 @@ share/libc/string.h:152:[value] function strrchr, behavior default: postconditio [value] Done for function strrchr [value] computing for function strrchr <- main. Called from tests/libc/string_c_generic.c:94. -tests/libc/string_c_generic.c:94:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] computing for function strlen <- strrchr <- main. - Called from share/libc/string.c:200. + Called from share/libc/string.c:201. [value] Recording results for strlen [value] Done for function strlen -share/libc/string.c:200:[value] entering loop for the first time +share/libc/string.c:201:[value] entering loop for the first time share/libc/string.h:145:[value] warning: function strrchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:146:[value] warning: function strrchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:147:[value] warning: function strrchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) diff --git a/tests/libc/oracle/string_c_strchr.res.oracle b/tests/libc/oracle/string_c_strchr.res.oracle index dd473b61da408e56105e8ec044eef17906f4269b..72347b95dd7f12e4a27b003522bd16a0b611834e 100644 --- a/tests/libc/oracle/string_c_strchr.res.oracle +++ b/tests/libc/oracle/string_c_strchr.res.oracle @@ -1,22 +1,22 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/string_c_strchr.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] Semantic level unrolling superposing up to 100 states [value] Semantic level unrolling superposing up to 200 states tests/libc/string_c_strchr.c:59:[value] entering loop for the first time [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:62. share/libc/string.h:124:[value] function strchr: precondition 'valid_string_src' got status valid. -tests/libc/string_c_strchr.c:62:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:127:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:134:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:128:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:129:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:130:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) @@ -28,134 +28,108 @@ share/libc/string.h:137:[value] function strchr, behavior default: postcondition [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:63. -tests/libc/string_c_strchr.c:63:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:64. -tests/libc/string_c_strchr.c:64:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:65. -tests/libc/string_c_strchr.c:65:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:66. -tests/libc/string_c_strchr.c:66:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:67. -tests/libc/string_c_strchr.c:67:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:68. -tests/libc/string_c_strchr.c:68:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:70. -tests/libc/string_c_strchr.c:70:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:128:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:129:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) -share/libc/string.c:194:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -share/libc/string.h:130:[value] warning: function strchr, behavior found: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) share/libc/string.h:131:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) share/libc/string.h:135:[value] warning: function strchr, behavior not_found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:71. -tests/libc/string_c_strchr.c:71:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:130:[value] function strchr, behavior found: postcondition got status valid. (Behavior may be inactive, no reduction performed.) [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:72. -tests/libc/string_c_strchr.c:72:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:128:[value] warning: function strchr, behavior found: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:73. -tests/libc/string_c_strchr.c:73:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:74. -tests/libc/string_c_strchr.c:74:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:75. -tests/libc/string_c_strchr.c:75:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:76. -tests/libc/string_c_strchr.c:76:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:77. -tests/libc/string_c_strchr.c:77:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:78. -tests/libc/string_c_strchr.c:78:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:79. -tests/libc/string_c_strchr.c:79:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:80. -tests/libc/string_c_strchr.c:80:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:81. -tests/libc/string_c_strchr.c:81:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:82. -tests/libc/string_c_strchr.c:82:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:83. -tests/libc/string_c_strchr.c:83:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:84. -tests/libc/string_c_strchr.c:84:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:85. -tests/libc/string_c_strchr.c:85:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:86. -tests/libc/string_c_strchr.c:86:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:87. -tests/libc/string_c_strchr.c:87:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] computing for function strchr <- main. Called from tests/libc/string_c_strchr.c:88. -tests/libc/string_c_strchr.c:88:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for strchr [value] Done for function strchr [value] Recording results for main diff --git a/tests/libc/oracle/string_c_strstr.res.oracle b/tests/libc/oracle/string_c_strstr.res.oracle index c681f1c52963c02d07d4de642e0bc8c79a940a90..5bd60499d6565fee050021f5818426dd8b40fe42 100644 --- a/tests/libc/oracle/string_c_strstr.res.oracle +++ b/tests/libc/oracle/string_c_strstr.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/string_c_strstr.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] computing for function strstr <- main. Called from tests/libc/string_c_strstr.c:52. share/libc/string.h:177:[value] function strstr: precondition 'valid_string_haystack' got status valid. @@ -43,7 +42,7 @@ share/libc/string.h:181:[value] function strstr: postcondition got status valid. [value] Done for function strstr [value] computing for function strstr <- main. Called from tests/libc/string_c_strstr.c:59. -share/libc/string.c:229:[value] entering loop for the first time +share/libc/string.c:230:[value] entering loop for the first time [value] Recording results for strstr [value] Done for function strstr [value] computing for function strstr <- main. @@ -60,7 +59,7 @@ share/libc/string.c:229:[value] entering loop for the first time [value] Done for function strstr [value] computing for function strstr <- main. Called from tests/libc/string_c_strstr.c:64. -share/libc/string.c:234:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:183:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates share/libc/string.h:181:[value] warning: function strstr: postcondition got status unknown. [value] Recording results for strstr [value] Done for function strstr diff --git a/tests/libc/oracle/string_h.res.oracle b/tests/libc/oracle/string_h.res.oracle index 437988f583a04a91938ab0673d092395c50da940..91441cfe6fb6c0db94c942208880313f102308ae 100644 --- a/tests/libc/oracle/string_h.res.oracle +++ b/tests/libc/oracle/string_h.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/string_h.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,57 +5,81 @@ [value:initial-state] Values of globals at initialization nondet ∈ [--..--] [value] computing for function test_strcmp <- main. - Called from tests/libc/string_h.c:27. + Called from tests/libc/string_h.c:55. [value] computing for function strcmp <- test_strcmp <- main. Called from tests/libc/string_h.c:5. [value] using specification for function strcmp share/libc/string.h:104:[value] function strcmp: precondition 'valid_string_s1' got status valid. share/libc/string.h:105:[value] function strcmp: precondition 'valid_string_s2' got status valid. -tests/libc/string_h.c:5:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:107:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Done for function strcmp tests/libc/string_h.c:6:[value] warning: assertion got status unknown. [value] Recording results for test_strcmp [value] Done for function test_strcmp [value] computing for function test_strcat <- main. - Called from tests/libc/string_h.c:28. + Called from tests/libc/string_h.c:56. [value] computing for function strcat <- test_strcat <- main. Called from tests/libc/string_h.c:13. [value] using specification for function strcat -share/libc/string.h:262:[value] function strcat: precondition 'valid_string_src' got status valid. -share/libc/string.h:263:[value] function strcat: precondition 'valid_string_dst' got status valid. -tests/libc/string_h.c:13:[value] Cannot evaluate range bound strlen(dest) + strlen(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -share/libc/string.h:264:[value] warning: function strcat: precondition 'room_string' got status unknown. -tests/libc/string_h.c:13:[value] Cannot evaluate range bound strlen{Old}(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -tests/libc/string_h.c:13:[value] Cannot evaluate range bound strlen{Old}(dest) - (unsupported ACSL construct: logic functions or predicates). Approximating -tests/libc/string_h.c:13:[value] Cannot evaluate range bound strlen{Old}(dest) + strlen{Old}(src) - (unsupported ACSL construct: logic functions or predicates). Approximating -tests/libc/string_h.c:13:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:264:[value] function strcat: precondition 'valid_string_src' got status valid. +share/libc/string.h:265:[value] function strcat: precondition 'valid_string_dst' got status valid. +share/libc/string.h:266:[value] function strcat: precondition 'room_string' got status valid. [value] Done for function strcat [value] Recording results for test_strcat [value] Done for function test_strcat [value] computing for function test_strstr <- main. - Called from tests/libc/string_h.c:29. + Called from tests/libc/string_h.c:57. [value] computing for function strstr <- test_strstr <- main. Called from tests/libc/string_h.c:21. [value] using specification for function strstr share/libc/string.h:177:[value] function strstr: precondition 'valid_string_haystack' got status valid. share/libc/string.h:178:[value] function strstr: precondition 'valid_string_needle' got status valid. -tests/libc/string_h.c:21:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:183:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Done for function strstr tests/libc/string_h.c:22:[value] warning: assertion got status unknown. [value] Recording results for test_strstr [value] Done for function test_strstr +[value] computing for function test_strncat <- main. + Called from tests/libc/string_h.c:58. +[value] Semantic level unrolling superposing up to 100 states +tests/libc/string_h.c:31:[value] entering loop for the first time +[value] computing for function strncat <- test_strncat <- main. + Called from tests/libc/string_h.c:33. +[value] using specification for function strncat +share/libc/string.h:276:[value] function strncat: precondition 'valid_string_src' got status valid. +share/libc/string.h:277:[value] function strncat: precondition 'valid_string_dst' got status valid. +share/libc/string.h:283:[value] function strncat, behavior complete: precondition 'room_string' got status valid. +[value] Done for function strncat +[value] Recording results for test_strncat +[value] Done for function test_strncat +[value] computing for function crashes_gcc <- main. + Called from tests/libc/string_h.c:59. +tests/libc/string_h.c:47:[value] entering loop for the first time +[value] computing for function strcpy <- crashes_gcc <- main. + Called from tests/libc/string_h.c:50. +[value] using specification for function strcpy +share/libc/string.h:221:[value] function strcpy: precondition 'valid_string_src' got status valid. +share/libc/string.h:222:[value] function strcpy: precondition 'room_string' got status valid. +share/libc/string.h:224:[value] warning: function strcpy: precondition 'separated_strings' got status invalid. +[value] Done for function strcpy +[value] Recording results for crashes_gcc +[value] Done for function crashes_gcc [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function crashes_gcc: + NON TERMINATING FUNCTION [value:final-states] Values at end of function test_strcat: string[0] ∈ [--..--] - [1..9] ∈ [--..--] or UNINITIALIZED + [1..5] ∈ [--..--] or UNINITIALIZED + [6..9] ∈ UNINITIALIZED [value:final-states] Values at end of function test_strcmp: res ∈ {0} +[value:final-states] Values at end of function test_strncat: + data[0] ∈ [--..--] + [1..99] ∈ [--..--] or UNINITIALIZED + source[0..98] ∈ {90} + [99] ∈ {0} [value:final-states] Values at end of function test_strstr: s ∈ {{ "aba" ; "bab" }} needle ∈ {{ "a" ; "b" }} diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_collect.err.oracle b/tests/libc/oracle/sys_select.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_collect.err.oracle rename to tests/libc/oracle/sys_select.err.oracle diff --git a/tests/libc/oracle/sys_select.res.oracle b/tests/libc/oracle/sys_select.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..d66e541de5b6cb4303fd1298b8e9bd7d899db901 --- /dev/null +++ b/tests/libc/oracle/sys_select.res.oracle @@ -0,0 +1,88 @@ +[kernel] Parsing tests/libc/sys_select.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_sockfds[0..1023] ∈ {0} + __fc_socket_counter ∈ [--..--] + __fc_open_sock_fds ∈ [--..--] + __fc_time ∈ [--..--] + __fc_tz ∈ [--..--] + __fc_fds_state ∈ [--..--] + __fc_errno ∈ [--..--] + in6addr_any ∈ {0} + in6addr_loopback.s6_addr[0..15] ∈ {255} + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] +[value] computing for function socket <- main. + Called from tests/libc/sys_select.c:9. +[value] using specification for function socket +[value] Done for function socket +[value] computing for function exit <- main. + Called from tests/libc/sys_select.c:10. +[value] using specification for function exit +[value] Done for function exit +tests/libc/sys_select.c:16:[value] Call to builtin memset(({{ (void *)&addr }},{0},{8})) +[value] computing for function htonl <- main. + Called from tests/libc/sys_select.c:18. +[value] using specification for function htonl +[value] Done for function htonl +[value] computing for function htons <- main. + Called from tests/libc/sys_select.c:19. +[value] using specification for function htons +[value] Done for function htons +[value] computing for function bind <- main. + Called from tests/libc/sys_select.c:20. +[value] using specification for function bind +share/libc/sys/socket.h:195:[value] function bind: precondition got status valid. +share/libc/sys/socket.h:196:[value] function bind: precondition got status valid. +[value] Done for function bind +[value] computing for function exit <- main. + Called from tests/libc/sys_select.c:21. +[value] Done for function exit +[value] computing for function FD_ZERO <- main. + Called from tests/libc/sys_select.c:22. +[value] using specification for function FD_ZERO +[value] Done for function FD_ZERO +[value] computing for function FD_SET <- main. + Called from tests/libc/sys_select.c:24. +[value] using specification for function FD_SET +share/libc/__fc_define_fd_set_t.h:49:[value] function FD_SET: precondition got status valid. +share/libc/__fc_define_fd_set_t.h:50:[value] function FD_SET: precondition got status valid. +[value] Done for function FD_SET +tests/libc/sys_select.c:30:[value] Call to builtin memcpy(({{ (void *)&fds2 }},{{ (void const *)&fds1 }},{1})) +[value] computing for function select <- main. + Called from tests/libc/sys_select.c:31. +[value] using specification for function select +share/libc/__fc_select.h:48:[value] function select: precondition got status valid. +share/libc/__fc_select.h:49:[value] function select: precondition got status valid. +share/libc/__fc_select.h:50:[value] function select: precondition got status valid. +share/libc/__fc_select.h:51:[value] function select: precondition got status valid. +share/libc/__fc_select.h:52:[value] function select: precondition got status valid. +[value] Done for function select +[value] computing for function FD_ISSET <- main. + Called from tests/libc/sys_select.c:32. +[value] using specification for function FD_ISSET +share/libc/__fc_define_fd_set_t.h:41:[value] function FD_ISSET: precondition got status valid. +share/libc/__fc_define_fd_set_t.h:42:[value] function FD_ISSET: precondition got status valid. +[value] Done for function FD_ISSET +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_sockfds[0..1023] ∈ [--..--] + __fc_socket_counter ∈ [--..--] + __fc_fds_state ∈ [--..--] + fd1 ∈ [0..1023] + max_fd ∈ [0..1023] + fds1 ∈ [--..--] + fds2 ∈ [--..--] + addr.sin_family ∈ {2} + {.sin_port; .sin_addr} ∈ [--..--] + res ∈ [--..--] + timeout ∈ [--..--] + __retres ∈ {0} diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_init.err.oracle b/tests/libc/oracle/sys_time.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_init.err.oracle rename to tests/libc/oracle/sys_time.err.oracle diff --git a/tests/libc/oracle/sys_time.res.oracle b/tests/libc/oracle/sys_time.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..95c5b65fb8fe457f782777188696a98b3b1f9374 --- /dev/null +++ b/tests/libc/oracle/sys_time.res.oracle @@ -0,0 +1,51 @@ +[kernel] Parsing tests/libc/sys_time.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_time ∈ [--..--] + __fc_tz ∈ [--..--] + __fc_itimer_real ∈ [--..--] + __fc_itimer_virtual ∈ [--..--] + __fc_itimer_prof ∈ [--..--] +[value] computing for function setitimer <- main. + Called from tests/libc/sys_time.c:6. +[value] using specification for function setitimer +share/libc/sys/time.h:143:[value] function setitimer: precondition got status valid. +share/libc/sys/time.h:144:[value] function setitimer: precondition got status valid. +[value] Done for function setitimer +tests/libc/sys_time.c:7:[value] assertion got status valid. +[value] computing for function setitimer <- main. + Called from tests/libc/sys_time.c:9. +[value] Done for function setitimer +tests/libc/sys_time.c:10:[value] assertion got status valid. +tests/libc/sys_time.c:11:[value] assertion got status valid. +[value] computing for function getitimer <- main. + Called from tests/libc/sys_time.c:12. +[value] using specification for function getitimer +share/libc/sys/time.h:104:[value] function getitimer: precondition got status valid. +[value] Done for function getitimer +tests/libc/sys_time.c:13:[value] assertion got status valid. +tests/libc/sys_time.c:14:[value] assertion got status valid. +[value] computing for function getitimer <- main. + Called from tests/libc/sys_time.c:16. +[value] Done for function getitimer +tests/libc/sys_time.c:17:[value] assertion got status valid. +[value] computing for function setitimer <- main. + Called from tests/libc/sys_time.c:19. +[value] Done for function setitimer +tests/libc/sys_time.c:20:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + i1.it_interval.tv_sec ∈ {1} + .it_interval.tv_usec ∈ {100} + .it_value.tv_sec ∈ {2} + .it_value.tv_usec ∈ {200} + res ∈ {-1} + i2.it_interval.tv_sec ∈ [--..--] + .it_interval.tv_usec ∈ {1000000} + .it_value ∈ [--..--] + INVALID_ITIMER ∈ {-1} + __retres ∈ {0} diff --git a/tests/libc/oracle/sys_times.res.oracle b/tests/libc/oracle/sys_times.res.oracle index 145f2b8c6310da3bf3eb047850bc89f7701832fb..89e6f76aa5b2ce652a8614d0d7dcba0d25ba479a 100644 --- a/tests/libc/oracle/sys_times.res.oracle +++ b/tests/libc/oracle/sys_times.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/sys_times.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/libc/oracle/termios.res.oracle b/tests/libc/oracle/termios.res.oracle index 2ece8abbefe341ab85143c6b4ec3a22a83916b8a..b749d3da78911a29adeb8a2e134adcaa961a50a7 100644 --- a/tests/libc/oracle/termios.res.oracle +++ b/tests/libc/oracle/termios.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/termios.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,7 +7,7 @@ [value] computing for function __va_open_void <- main. Called from tests/libc/termios.c:10. [value] using specification for function __va_open_void -share/libc/fcntl.h:141:[value] function __va_open_void: precondition 'valid_flag' got status valid. +share/libc/fcntl.h:132:[value] function __va_open_void: precondition 'valid_flag' got status valid. [value] Done for function __va_open_void [value] computing for function tcgetattr <- main. Called from tests/libc/termios.c:11. diff --git a/tests/libc/oracle/time.res.oracle b/tests/libc/oracle/time.res.oracle index ae7ef9136f5da6de20e7b24058d1fab41f334579..30487819c3b760e573b25ff10eb784fe7d3630ef 100644 --- a/tests/libc/oracle/time.res.oracle +++ b/tests/libc/oracle/time.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/time.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/libc/oracle/unistd.res.oracle b/tests/libc/oracle/unistd.res.oracle index ebfd248cf2ec8e44af81f6a88db70c1c58d6c0cc..4e862a1bd0dc660f782a687c77a8c89debce16e5 100644 --- a/tests/libc/oracle/unistd.res.oracle +++ b/tests/libc/oracle/unistd.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/unistd.c (with preprocessing) tests/libc/unistd.c:6:[kernel] warning: Calling undeclared function usleep. Old style K&R code? [value] Analyzing a complete application starting at main @@ -7,6 +6,7 @@ tests/libc/unistd.c:6:[kernel] warning: Calling undeclared function usleep. Old [value:initial-state] Values of globals at initialization __fc_time ∈ [--..--] __fc_tz ∈ [--..--] + __fc_fds_state ∈ [--..--] optarg ∈ {{ NULL ; &S_optarg[0] }} optind ∈ [--..--] opterr ∈ [--..--] diff --git a/tests/libc/oracle/wchar_c_h.0.res.oracle b/tests/libc/oracle/wchar_c_h.0.res.oracle index 08642de53e7843064c5ab16c09a7a6ce00886b05..c766033661b7c8e443911784fd9739b8d6b72d48 100644 --- a/tests/libc/oracle/wchar_c_h.0.res.oracle +++ b/tests/libc/oracle/wchar_c_h.0.res.oracle @@ -1,519 +1,459 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/wchar_c_h.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization + __fc_time ∈ [--..--] + __fc_time_tm ∈ {0} + __fc_p_time_tm ∈ {{ &__fc_time_tm }} + wc ∈ {-1} + wi ∈ {4294967295} + t ∈ {0} nondet ∈ [--..--] [value] computing for function wmemchr <- main. - Called from tests/libc/wchar_c_h.c:23. + Called from tests/libc/wchar_c_h.c:29. [value] using specification for function wmemchr [value] Done for function wmemchr [value] computing for function wmemcmp <- main. - Called from tests/libc/wchar_c_h.c:24. + Called from tests/libc/wchar_c_h.c:30. [value] using specification for function wmemcmp [value] Done for function wmemcmp [value] computing for function wmemcmp <- main. - Called from tests/libc/wchar_c_h.c:24. + Called from tests/libc/wchar_c_h.c:30. [value] Done for function wmemcmp [value] computing for function wmemcpy <- main. - Called from tests/libc/wchar_c_h.c:25. -share/libc/wchar.h:45:[value] function wmemcpy: precondition got status valid. -share/libc/wchar.h:48:[value] function wmemcpy: postcondition got status valid. + Called from tests/libc/wchar_c_h.c:31. +share/libc/wchar.h:59:[value] function wmemcpy: precondition got status valid. +share/libc/wchar.h:62:[value] function wmemcpy: postcondition got status valid. [value] Recording results for wmemcpy [value] Done for function wmemcpy [value] computing for function wmemcpy <- main. - Called from tests/libc/wchar_c_h.c:25. + Called from tests/libc/wchar_c_h.c:31. [value] Recording results for wmemcpy [value] Done for function wmemcpy [value] computing for function wmemmove <- main. - Called from tests/libc/wchar_c_h.c:26. + Called from tests/libc/wchar_c_h.c:32. [value] using specification for function wmemmove [value] Done for function wmemmove [value] computing for function wmemmove <- main. - Called from tests/libc/wchar_c_h.c:26. + Called from tests/libc/wchar_c_h.c:32. [value] Done for function wmemmove [value] computing for function wmemmove <- main. - Called from tests/libc/wchar_c_h.c:26. + Called from tests/libc/wchar_c_h.c:32. [value] Done for function wmemmove [value] computing for function wmemset <- main. - Called from tests/libc/wchar_c_h.c:27. -share/libc/wchar.h:62:[value] function wmemset: postcondition got status valid. + Called from tests/libc/wchar_c_h.c:33. +share/libc/wchar.h:76:[value] function wmemset: postcondition got status valid. +share/libc/wchar.h:77:[value] function wmemset: postcondition got status valid. +share/libc/wchar.h:78:[value] warning: function wmemset: postcondition got status unknown. [value] Recording results for wmemset [value] Done for function wmemset [value] computing for function wmemset <- main. - Called from tests/libc/wchar_c_h.c:27. + Called from tests/libc/wchar_c_h.c:33. [value] Recording results for wmemset [value] Done for function wmemset [value] computing for function wmemset <- main. - Called from tests/libc/wchar_c_h.c:27. + Called from tests/libc/wchar_c_h.c:33. [value] Recording results for wmemset [value] Done for function wmemset [value] computing for function wcschr <- main. - Called from tests/libc/wchar_c_h.c:28. + Called from tests/libc/wchar_c_h.c:34. [value] using specification for function wcschr [value] Done for function wcschr [value] computing for function wcschr <- main. - Called from tests/libc/wchar_c_h.c:28. + Called from tests/libc/wchar_c_h.c:34. [value] Done for function wcschr [value] computing for function wcschr <- main. - Called from tests/libc/wchar_c_h.c:28. + Called from tests/libc/wchar_c_h.c:34. [value] Done for function wcschr [value] computing for function wcscmp <- main. - Called from tests/libc/wchar_c_h.c:29. + Called from tests/libc/wchar_c_h.c:35. [value] using specification for function wcscmp [value] Done for function wcscmp [value] computing for function wcscmp <- main. - Called from tests/libc/wchar_c_h.c:29. + Called from tests/libc/wchar_c_h.c:35. [value] Done for function wcscmp [value] computing for function wcscmp <- main. - Called from tests/libc/wchar_c_h.c:29. + Called from tests/libc/wchar_c_h.c:35. [value] Done for function wcscmp [value] computing for function wcscpy <- main. - Called from tests/libc/wchar_c_h.c:30. -share/libc/wchar.h:85:[value] function wcscpy: postcondition got status valid. + Called from tests/libc/wchar_c_h.c:36. +share/libc/wchar.h:101:[value] function wcscpy: postcondition got status valid. [value] Recording results for wcscpy [value] Done for function wcscpy [value] computing for function wcscpy <- main. - Called from tests/libc/wchar_c_h.c:30. + Called from tests/libc/wchar_c_h.c:36. [value] Recording results for wcscpy [value] Done for function wcscpy [value] computing for function wcscpy <- main. - Called from tests/libc/wchar_c_h.c:30. + Called from tests/libc/wchar_c_h.c:36. [value] Recording results for wcscpy [value] Done for function wcscpy [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. [value] using specification for function wcscspn [value] Done for function wcscspn [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. [value] Done for function wcscspn [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. [value] Done for function wcscspn [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. [value] Done for function wcscspn [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] using specification for function wcslcat [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] using specification for function wcslcpy -share/libc/wchar.h:101:[value] function wcslcpy: precondition got status valid. +share/libc/wchar.h:117:[value] function wcslcpy: precondition got status valid. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Recording results for wcslen -[value] Done for function wcslen +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] using specification for function wcsncmp [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. -share/libc/wchar.h:121:[value] function wcsncpy: precondition got status valid. -share/libc/wchar.h:124:[value] function wcsncpy: postcondition got status valid. + Called from tests/libc/wchar_c_h.c:42. +share/libc/wchar.h:137:[value] function wcsncpy: precondition got status valid. +share/libc/wchar.h:140:[value] function wcsncpy: postcondition got status valid. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Recording results for wcsncpy [value] Done for function wcsncpy [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] using specification for function wcspbrk [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] using specification for function wcsrchr [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] using specification for function wcsspn [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] using specification for function wcsstr [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. -share/libc/wchar.h:69:[value] function wcscat: postcondition got status valid. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) +share/libc/wchar.h:85:[value] function wcscat: postcondition got status valid. [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. +share/libc/wchar.c:73:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcscat [value] Done for function wcscat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen -share/libc/wchar.h:113:[value] function wcsncat: postcondition got status valid. + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) +share/libc/wchar.h:129:[value] function wcsncat: postcondition got status valid. [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] Recording results for wcsncat -[value] Done for function wcsncat -[value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen -[value] Recording results for wcsncat -[value] Done for function wcsncat -[value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. -[value] computing for function wcslen <- wcsncat <- main. - Called from share/libc/wchar.c:89. -[value] Recording results for wcslen -[value] Done for function wcslen + Called from tests/libc/wchar_c_h.c:52. +share/libc/wchar.c:83:[value] Call to builtin Frama_C_wcslen(({{ &buf[0] }})) [value] Recording results for wcsncat [value] Done for function wcsncat [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function wcscat: - s1 ∈ {{ &buf{[9], [10], [11], [12], [13], [14]} }} - s2 ∈ {{ L"Haystack" + {36} }} - os1 ∈ {{ &buf[0] }} - buf[0..4] ∈ [--..--] - [5] ∈ {72; 97; 115; 116; 121} - [6] ∈ {97; 99; 115; 116; 121} - [7] ∈ {97; 99; 107; 115; 116; 121} - [8] ∈ {0; 97; 99; 107; 115; 116} - [9..19] ∈ [--..--] or UNINITIALIZED [value:final-states] Values at end of function wcscpy: - s1 ∈ {{ &buf[9] }} - s2 ∈ {{ L"Haystack" + {36} }} - os1 ∈ {{ &buf[0] }} + i ∈ {8} buf[0] ∈ {72} [1] ∈ {97} [2] ∈ {121} @@ -524,9 +464,12 @@ share/libc/wchar.h:113:[value] function wcsncat: postcondition got status valid. [7] ∈ {107} [8] ∈ {0} [9..19] ∈ UNINITIALIZED -[value:final-states] Values at end of function wcslen: - s ∈ {{ &buf{[0], [1], [2], [3], [4], [5]} ; L"Needle" + {24} }} - __retres ∈ {0; 1; 2; 3; 4; 5; 6} +[value:final-states] Values at end of function wcscat: + i ∈ {8} + n ∈ {0; 1; 2; 3; 4; 5} + buf[0..4] ∈ [--..--] + [5] ∈ {0; 72; 97; 115; 116; 121} + [6..19] ∈ [--..--] or UNINITIALIZED [value:final-states] Values at end of function wcsncat: dest_len ∈ {0; 1; 2; 3; 4; 5} i ∈ {5} @@ -534,10 +477,7 @@ share/libc/wchar.h:113:[value] function wcsncat: postcondition got status valid. [5] ∈ {0; 72; 97; 115; 116; 121} [6..19] ∈ [--..--] or UNINITIALIZED [value:final-states] Values at end of function wcsncpy: - s1 ∈ {{ &buf[5] }} - s2 ∈ {{ L"Haystack" + {20} }} - n ∈ {0} - os1 ∈ {{ &buf[0] }} + i ∈ {5} buf[0] ∈ {72} [1] ∈ {97} [2] ∈ {121} @@ -545,10 +485,6 @@ share/libc/wchar.h:113:[value] function wcsncat: postcondition got status valid. [4] ∈ {116} [5..19] ∈ [--..--] or UNINITIALIZED [value:final-states] Values at end of function wmemcpy: - first ∈ {{ L"Haystack" + {20} }} - last ∈ {{ L"Haystack" + {20} }} - result ∈ {{ &buf[0] }} - dest ∈ {{ &buf[5] }} buf[0] ∈ {72} [1] ∈ {97} [2] ∈ {121} @@ -556,8 +492,6 @@ share/libc/wchar.h:113:[value] function wcsncat: postcondition got status valid. [4] ∈ {116} [5..19] ∈ UNINITIALIZED [value:final-states] Values at end of function wmemset: - len ∈ {4294967295} - ptr ∈ {{ &buf[5] }} buf[0..4] ∈ [--..--] [5..19] ∈ UNINITIALIZED [value:final-states] Values at end of function main: diff --git a/tests/libc/oracle/wchar_c_h.1.res.oracle b/tests/libc/oracle/wchar_c_h.1.res.oracle index 08375f181fc062f5da56c24dff2203beea978b9c..bb7b731be6b37a1d068cd91537f2aa712795268b 100644 --- a/tests/libc/oracle/wchar_c_h.1.res.oracle +++ b/tests/libc/oracle/wchar_c_h.1.res.oracle @@ -1,299 +1,471 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/libc/wchar_c_h.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization + __fc_time ∈ [--..--] + __fc_time_tm ∈ {0} + __fc_p_time_tm ∈ {{ &__fc_time_tm }} + wc ∈ {-1} + wi ∈ {4294967295} + t ∈ {0} nondet ∈ [--..--] [value] computing for function wmemchr <- main. - Called from tests/libc/wchar_c_h.c:23. + Called from tests/libc/wchar_c_h.c:29. [value] using specification for function wmemchr [value] Done for function wmemchr [value] computing for function wmemcmp <- main. - Called from tests/libc/wchar_c_h.c:24. + Called from tests/libc/wchar_c_h.c:30. [value] using specification for function wmemcmp [value] Done for function wmemcmp [value] computing for function wmemcmp <- main. - Called from tests/libc/wchar_c_h.c:24. + Called from tests/libc/wchar_c_h.c:30. [value] Done for function wmemcmp [value] computing for function wmemcpy <- main. - Called from tests/libc/wchar_c_h.c:25. + Called from tests/libc/wchar_c_h.c:31. [value] using specification for function wmemcpy -share/libc/wchar.h:45:[value] function wmemcpy: precondition got status valid. +share/libc/wchar.h:59:[value] function wmemcpy: precondition got status valid. [value] Done for function wmemcpy [value] computing for function wmemcpy <- main. - Called from tests/libc/wchar_c_h.c:25. + Called from tests/libc/wchar_c_h.c:31. [value] Done for function wmemcpy [value] computing for function wmemmove <- main. - Called from tests/libc/wchar_c_h.c:26. + Called from tests/libc/wchar_c_h.c:32. [value] using specification for function wmemmove [value] Done for function wmemmove [value] computing for function wmemmove <- main. - Called from tests/libc/wchar_c_h.c:26. + Called from tests/libc/wchar_c_h.c:32. [value] Done for function wmemmove [value] computing for function wmemmove <- main. - Called from tests/libc/wchar_c_h.c:26. + Called from tests/libc/wchar_c_h.c:32. [value] Done for function wmemmove [value] computing for function wmemset <- main. - Called from tests/libc/wchar_c_h.c:27. + Called from tests/libc/wchar_c_h.c:33. [value] using specification for function wmemset [value] Done for function wmemset [value] computing for function wmemset <- main. - Called from tests/libc/wchar_c_h.c:27. + Called from tests/libc/wchar_c_h.c:33. [value] Done for function wmemset [value] computing for function wmemset <- main. - Called from tests/libc/wchar_c_h.c:27. + Called from tests/libc/wchar_c_h.c:33. [value] Done for function wmemset [value] computing for function wcschr <- main. - Called from tests/libc/wchar_c_h.c:28. + Called from tests/libc/wchar_c_h.c:34. [value] using specification for function wcschr [value] Done for function wcschr [value] computing for function wcschr <- main. - Called from tests/libc/wchar_c_h.c:28. + Called from tests/libc/wchar_c_h.c:34. +[value] Done for function wcschr +[value] computing for function wcschr <- main. + Called from tests/libc/wchar_c_h.c:34. [value] Done for function wcschr [value] computing for function wcschr <- main. - Called from tests/libc/wchar_c_h.c:28. + Called from tests/libc/wchar_c_h.c:34. [value] Done for function wcschr [value] computing for function wcscmp <- main. - Called from tests/libc/wchar_c_h.c:29. + Called from tests/libc/wchar_c_h.c:35. [value] using specification for function wcscmp [value] Done for function wcscmp [value] computing for function wcscmp <- main. - Called from tests/libc/wchar_c_h.c:29. + Called from tests/libc/wchar_c_h.c:35. [value] Done for function wcscmp [value] computing for function wcscmp <- main. - Called from tests/libc/wchar_c_h.c:29. + Called from tests/libc/wchar_c_h.c:35. +[value] Done for function wcscmp +[value] computing for function wcscmp <- main. + Called from tests/libc/wchar_c_h.c:35. +[value] Done for function wcscmp +[value] computing for function wcscmp <- main. + Called from tests/libc/wchar_c_h.c:35. +[value] Done for function wcscmp +[value] computing for function wcscmp <- main. + Called from tests/libc/wchar_c_h.c:35. [value] Done for function wcscmp [value] computing for function wcscpy <- main. - Called from tests/libc/wchar_c_h.c:30. + Called from tests/libc/wchar_c_h.c:36. [value] using specification for function wcscpy [value] Done for function wcscpy [value] computing for function wcscpy <- main. - Called from tests/libc/wchar_c_h.c:30. + Called from tests/libc/wchar_c_h.c:36. [value] Done for function wcscpy [value] computing for function wcscpy <- main. - Called from tests/libc/wchar_c_h.c:30. + Called from tests/libc/wchar_c_h.c:36. +[value] Done for function wcscpy +[value] computing for function wcscpy <- main. + Called from tests/libc/wchar_c_h.c:36. +[value] Done for function wcscpy +[value] computing for function wcscpy <- main. + Called from tests/libc/wchar_c_h.c:36. +[value] Done for function wcscpy +[value] computing for function wcscpy <- main. + Called from tests/libc/wchar_c_h.c:36. [value] Done for function wcscpy [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. [value] using specification for function wcscspn [value] Done for function wcscspn [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. [value] Done for function wcscspn [value] computing for function wcscspn <- main. - Called from tests/libc/wchar_c_h.c:31. + Called from tests/libc/wchar_c_h.c:37. +[value] Done for function wcscspn +[value] computing for function wcscspn <- main. + Called from tests/libc/wchar_c_h.c:37. +[value] Done for function wcscspn +[value] computing for function wcscspn <- main. + Called from tests/libc/wchar_c_h.c:37. +[value] Done for function wcscspn +[value] computing for function wcscspn <- main. + Called from tests/libc/wchar_c_h.c:37. [value] Done for function wcscspn [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] using specification for function wcslcat [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcat <- main. - Called from tests/libc/wchar_c_h.c:32. + Called from tests/libc/wchar_c_h.c:38. +[value] Done for function wcslcat +[value] computing for function wcslcat <- main. + Called from tests/libc/wchar_c_h.c:38. +[value] Done for function wcslcat +[value] computing for function wcslcat <- main. + Called from tests/libc/wchar_c_h.c:38. +[value] Done for function wcslcat +[value] computing for function wcslcat <- main. + Called from tests/libc/wchar_c_h.c:38. +[value] Done for function wcslcat +[value] computing for function wcslcat <- main. + Called from tests/libc/wchar_c_h.c:38. +[value] Done for function wcslcat +[value] computing for function wcslcat <- main. + Called from tests/libc/wchar_c_h.c:38. +[value] Done for function wcslcat +[value] computing for function wcslcat <- main. + Called from tests/libc/wchar_c_h.c:38. [value] Done for function wcslcat [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] using specification for function wcslcpy -share/libc/wchar.h:101:[value] function wcslcpy: precondition got status valid. +share/libc/wchar.h:117:[value] function wcslcpy: precondition got status valid. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy [value] computing for function wcslcpy <- main. - Called from tests/libc/wchar_c_h.c:33. + Called from tests/libc/wchar_c_h.c:39. [value] Done for function wcslcpy -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] using specification for function wcslen -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Done for function wcslen -[value] computing for function wcslen <- main. - Called from tests/libc/wchar_c_h.c:34. -[value] Done for function wcslen +[value] computing for function wcslcpy <- main. + Called from tests/libc/wchar_c_h.c:39. +[value] Done for function wcslcpy +[value] computing for function wcslcpy <- main. + Called from tests/libc/wchar_c_h.c:39. +[value] Done for function wcslcpy +[value] computing for function wcslcpy <- main. + Called from tests/libc/wchar_c_h.c:39. +[value] Done for function wcslcpy +[value] computing for function wcslcpy <- main. + Called from tests/libc/wchar_c_h.c:39. +[value] Done for function wcslcpy +[value] computing for function wcslcpy <- main. + Called from tests/libc/wchar_c_h.c:39. +[value] Done for function wcslcpy +[value] computing for function wcslcpy <- main. + Called from tests/libc/wchar_c_h.c:39. +[value] Done for function wcslcpy +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) +tests/libc/wchar_c_h.c:40:[value] Call to builtin Frama_C_wcslen(({{ L"Needle" }})) [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] using specification for function wcsncmp [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncmp <- main. - Called from tests/libc/wchar_c_h.c:35. + Called from tests/libc/wchar_c_h.c:41. +[value] Done for function wcsncmp +[value] computing for function wcsncmp <- main. + Called from tests/libc/wchar_c_h.c:41. +[value] Done for function wcsncmp +[value] computing for function wcsncmp <- main. + Called from tests/libc/wchar_c_h.c:41. +[value] Done for function wcsncmp +[value] computing for function wcsncmp <- main. + Called from tests/libc/wchar_c_h.c:41. +[value] Done for function wcsncmp +[value] computing for function wcsncmp <- main. + Called from tests/libc/wchar_c_h.c:41. +[value] Done for function wcsncmp +[value] computing for function wcsncmp <- main. + Called from tests/libc/wchar_c_h.c:41. +[value] Done for function wcsncmp +[value] computing for function wcsncmp <- main. + Called from tests/libc/wchar_c_h.c:41. [value] Done for function wcsncmp [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] using specification for function wcsncpy -share/libc/wchar.h:121:[value] function wcsncpy: precondition got status valid. +share/libc/wchar.h:137:[value] function wcsncpy: precondition got status valid. [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. [value] Done for function wcsncpy [value] computing for function wcsncpy <- main. - Called from tests/libc/wchar_c_h.c:36. + Called from tests/libc/wchar_c_h.c:42. +[value] Done for function wcsncpy +[value] computing for function wcsncpy <- main. + Called from tests/libc/wchar_c_h.c:42. +[value] Done for function wcsncpy +[value] computing for function wcsncpy <- main. + Called from tests/libc/wchar_c_h.c:42. +[value] Done for function wcsncpy +[value] computing for function wcsncpy <- main. + Called from tests/libc/wchar_c_h.c:42. +[value] Done for function wcsncpy +[value] computing for function wcsncpy <- main. + Called from tests/libc/wchar_c_h.c:42. +[value] Done for function wcsncpy +[value] computing for function wcsncpy <- main. + Called from tests/libc/wchar_c_h.c:42. +[value] Done for function wcsncpy +[value] computing for function wcsncpy <- main. + Called from tests/libc/wchar_c_h.c:42. [value] Done for function wcsncpy [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] using specification for function wcspbrk [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcspbrk <- main. - Called from tests/libc/wchar_c_h.c:37. + Called from tests/libc/wchar_c_h.c:43. +[value] Done for function wcspbrk +[value] computing for function wcspbrk <- main. + Called from tests/libc/wchar_c_h.c:43. +[value] Done for function wcspbrk +[value] computing for function wcspbrk <- main. + Called from tests/libc/wchar_c_h.c:43. +[value] Done for function wcspbrk +[value] computing for function wcspbrk <- main. + Called from tests/libc/wchar_c_h.c:43. +[value] Done for function wcspbrk +[value] computing for function wcspbrk <- main. + Called from tests/libc/wchar_c_h.c:43. +[value] Done for function wcspbrk +[value] computing for function wcspbrk <- main. + Called from tests/libc/wchar_c_h.c:43. +[value] Done for function wcspbrk +[value] computing for function wcspbrk <- main. + Called from tests/libc/wchar_c_h.c:43. [value] Done for function wcspbrk [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] using specification for function wcsrchr [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsrchr <- main. - Called from tests/libc/wchar_c_h.c:38. + Called from tests/libc/wchar_c_h.c:44. +[value] Done for function wcsrchr +[value] computing for function wcsrchr <- main. + Called from tests/libc/wchar_c_h.c:44. +[value] Done for function wcsrchr +[value] computing for function wcsrchr <- main. + Called from tests/libc/wchar_c_h.c:44. +[value] Done for function wcsrchr +[value] computing for function wcsrchr <- main. + Called from tests/libc/wchar_c_h.c:44. +[value] Done for function wcsrchr +[value] computing for function wcsrchr <- main. + Called from tests/libc/wchar_c_h.c:44. +[value] Done for function wcsrchr +[value] computing for function wcsrchr <- main. + Called from tests/libc/wchar_c_h.c:44. +[value] Done for function wcsrchr +[value] computing for function wcsrchr <- main. + Called from tests/libc/wchar_c_h.c:44. [value] Done for function wcsrchr [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] using specification for function wcsspn [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsspn <- main. - Called from tests/libc/wchar_c_h.c:39. + Called from tests/libc/wchar_c_h.c:45. +[value] Done for function wcsspn +[value] computing for function wcsspn <- main. + Called from tests/libc/wchar_c_h.c:45. +[value] Done for function wcsspn +[value] computing for function wcsspn <- main. + Called from tests/libc/wchar_c_h.c:45. +[value] Done for function wcsspn +[value] computing for function wcsspn <- main. + Called from tests/libc/wchar_c_h.c:45. +[value] Done for function wcsspn +[value] computing for function wcsspn <- main. + Called from tests/libc/wchar_c_h.c:45. +[value] Done for function wcsspn +[value] computing for function wcsspn <- main. + Called from tests/libc/wchar_c_h.c:45. +[value] Done for function wcsspn +[value] computing for function wcsspn <- main. + Called from tests/libc/wchar_c_h.c:45. [value] Done for function wcsspn [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] using specification for function wcsstr [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. +[value] Done for function wcsstr +[value] computing for function wcsstr <- main. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcsstr <- main. - Called from tests/libc/wchar_c_h.c:40. + Called from tests/libc/wchar_c_h.c:46. +[value] Done for function wcsstr +[value] computing for function wcsstr <- main. + Called from tests/libc/wchar_c_h.c:46. +[value] Done for function wcsstr +[value] computing for function wcsstr <- main. + Called from tests/libc/wchar_c_h.c:46. +[value] Done for function wcsstr +[value] computing for function wcsstr <- main. + Called from tests/libc/wchar_c_h.c:46. +[value] Done for function wcsstr +[value] computing for function wcsstr <- main. + Called from tests/libc/wchar_c_h.c:46. +[value] Done for function wcsstr +[value] computing for function wcsstr <- main. + Called from tests/libc/wchar_c_h.c:46. [value] Done for function wcsstr [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. [value] using specification for function wcscat [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. [value] Done for function wcscat [value] computing for function wcscat <- main. - Called from tests/libc/wchar_c_h.c:44. + Called from tests/libc/wchar_c_h.c:50. [value] Done for function wcscat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. + Called from tests/libc/wchar_c_h.c:52. [value] using specification for function wcsncat [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. + Called from tests/libc/wchar_c_h.c:52. [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. + Called from tests/libc/wchar_c_h.c:52. [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. + Called from tests/libc/wchar_c_h.c:52. [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. + Called from tests/libc/wchar_c_h.c:52. [value] Done for function wcsncat [value] computing for function wcsncat <- main. - Called from tests/libc/wchar_c_h.c:46. + Called from tests/libc/wchar_c_h.c:52. [value] Done for function wcsncat [value] Recording results for main [value] done for function main diff --git a/tests/libc/poll.c b/tests/libc/poll.c new file mode 100644 index 0000000000000000000000000000000000000000..352d53e89645c18a9b06023957ccce2f83c5348c --- /dev/null +++ b/tests/libc/poll.c @@ -0,0 +1,19 @@ +#include <stdio.h> +#include <poll.h> + +#define GOT_TIMEOUT 127 + +int main() { + struct pollfd ufds; + + ufds.fd = 0; // stdin + ufds.events = POLLIN | POLLPRI; + int r = poll(&ufds, 1, 1000); + if (r == -1) perror("poll"); + if (r == 0) return GOT_TIMEOUT; + int can_read = ufds.revents & POLLIN; + int can_read_out_of_band = ufds.revents & POLLPRI; + int invalid_fd = ufds.revents & POLLNVAL; + + return can_read | can_read_out_of_band | invalid_fd; +} diff --git a/tests/libc/socket.c b/tests/libc/socket.c index b6b5a2a5ecd9e8fd28e8dbf25bff9342d80c1cb9..fb66a52f3a8f437b0156fac3dc40ddaa5de0960b 100644 --- a/tests/libc/socket.c +++ b/tests/libc/socket.c @@ -1,6 +1,6 @@ /* run.config - STDOPT: +"-value-verbose 2 -val-builtin bzero:Frama_C_bzero" - STDOPT: +"-value-verbose 2 -val-builtin bzero:Frama_C_bzero -machdep x86_64" + STDOPT: +"-value-verbose 2 -no-val-builtins-auto" + STDOPT: +"-value-verbose 2 -machdep x86_64 -no-val-builtins-auto" */ #include <sys/types.h> #include <sys/socket.h> @@ -25,7 +25,7 @@ char rcv_buffer[SIZEOF_RCV_BUFFER]; char rcv_buffer_scattered1[2]; \ char rcv_buffer_scattered2[5]; \ char rcv_buffer_scattered3[3]; \ -const struct iovec rcv_buffer_scattered_iovec[3] = \ +struct iovec rcv_buffer_scattered_iovec[3] = \ {{ &rcv_buffer_scattered1, sizeof(rcv_buffer_scattered1)}, \ { &rcv_buffer_scattered2, sizeof(rcv_buffer_scattered2)}, \ { &rcv_buffer_scattered3, sizeof(rcv_buffer_scattered3)}} diff --git a/tests/libc/stdint_h.c b/tests/libc/stdint_h.c new file mode 100644 index 0000000000000000000000000000000000000000..403333eb6c03602c63c6a2e27a8bf3b337f70019 --- /dev/null +++ b/tests/libc/stdint_h.c @@ -0,0 +1,9 @@ +#include <stdint.h> + +int main() { + intmax_t min = INTMAX_MIN; + intmax_t max = INTMAX_MAX; + uintmax_t umax = UINTMAX_MAX; + //@ assert min < max && max <= umax; + return 0; +} diff --git a/tests/libc/stdio_h.c b/tests/libc/stdio_h.c new file mode 100644 index 0000000000000000000000000000000000000000..1ee69d756249f3793d85eab93da3af589c0b488d --- /dev/null +++ b/tests/libc/stdio_h.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include "__fc_builtin.h" + +volatile int nondet; +int main() { + FILE *f = fopen("/dev/urandom", "r"); + if (!f) return 1; + int r = fseek(f, 0L, SEEK_SET); + if (nondet) { + fseek(NULL, 0L, SEEK_CUR); // must fail + //@ assert \false; + } + if (nondet) { + // to obtain an invalid value for whence, any interval containing at + // least 4 elements must contain an invalid value + int invalid_whence = Frama_C_interval(0, 3); + if (invalid_whence != SEEK_SET && invalid_whence != SEEK_CUR && + invalid_whence != SEEK_END) { + fseek(f, 42, invalid_whence); // must fail + //@ assert \false; + } + } + return 0; +} diff --git a/tests/libc/stdlib_c.c b/tests/libc/stdlib_c.c new file mode 100644 index 0000000000000000000000000000000000000000..426c8a8324cee02523f9196a420e8af61d959a13 --- /dev/null +++ b/tests/libc/stdlib_c.c @@ -0,0 +1,37 @@ +/* run.config + STDOPT: #"-no-val-builtins-auto -slevel 10 -val-builtin calloc:Frama_C_calloc_by_stack -value-msg-key malloc" + STDOPT: #"-no-val-builtins-auto -slevel 10 -val-builtin calloc:Frama_C_calloc_by_stack -no-val-malloc-returns-null -value-msg-key malloc" + STDOPT: #"-no-val-builtins-auto" +*/ // slevel is used to unroll loops + +#define FRAMA_C_MALLOC_STACK +#include "stdlib.c" +#include "__fc_builtin.h" +#include <stdint.h> + +int main() { + // always succeeds if -no-val-malloc-returns-null, otherwise may succeed + int *p = calloc(1, sizeof(int)); + if (p) { + //@ assert \valid(p); + } + + // partial overflow + size_t nmemb = Frama_C_size_t_interval(1, SIZE_MAX); + int *q = calloc(nmemb, sizeof(int)); + if (q) { + //@ assert \valid(q); + } + + // never succeeds (always overflows) + int *r = calloc(SIZE_MAX, sizeof(int)); + //@ assert !r; + + // may succeed for some cases, but fail later + for (size_t i = 1; i < SIZE_MAX; i++) { + int *s = calloc(i, sizeof(int)); + if (s) s[i-1] = 42; + } + + return 0; +} diff --git a/tests/libc/string_h.c b/tests/libc/string_h.c index 57b0c2370eab0dab80c90e107caaf6aaf647f472..50b644679bb0ddb6622f5cee2e21a7134f6a7afb 100644 --- a/tests/libc/string_h.c +++ b/tests/libc/string_h.c @@ -22,10 +22,40 @@ void test_strstr(void) //@ assert res != 0; } +void test_strncat(void) +{ + char data[100]; + data[0] = '\0'; + char source[100]; + //@ slevel 99; + for (int i = 0; i < 99; i++) source[i] = 'Z'; + source[99] = '\0'; + strncat(data, source, 100); +} + +struct s { + char s1[30]; + char s2[30]; +}; + +// this test crashes GCC (tested with v7.1.1) due to the non-respect of +// non-aliasing in strcpy +void crashes_gcc() { + struct s s; + char *ss = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012"; + //@ slevel 30; + for (int i = 0; i < 30; i++) s.s1[i] = ss[i]; + char *dest = s.s1+29; + char *src = s.s1; + strcpy(dest, src); // must produce at least a warning +} + int main(int argc, char **argv) { test_strcmp(); test_strcat(); test_strstr(); + test_strncat(); + if (!nondet) crashes_gcc(); return 0; } diff --git a/tests/libc/sys_select.c b/tests/libc/sys_select.c new file mode 100644 index 0000000000000000000000000000000000000000..2ced3d1a5a7fdd2ac2c52f9ee0526f3a0aaa07cf --- /dev/null +++ b/tests/libc/sys_select.c @@ -0,0 +1,37 @@ +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/select.h> +#include <arpa/inet.h> +#include <string.h> +#include <stdlib.h> + +int main() { + int fd1 = socket(AF_INET, SOCK_DGRAM, 0); + if (fd1 < 0) exit(1); + int max_fd; + + fd_set fds1, fds2; + + struct sockaddr_in addr; + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_ANY); + addr.sin_port = htons(8000); + int res = bind(fd1, (struct sockaddr *)&addr, sizeof(addr)); + if (res < 0) exit(2); + FD_ZERO(&fds1); + max_fd = fd1; + FD_SET(fd1, &fds1); + + struct timeval timeout; + timeout.tv_sec = 20; + timeout.tv_usec = 0; + + memcpy(&fds2, &fds1, sizeof(fds1)); + res = select(max_fd + 1, &fds2, NULL, NULL, &timeout); + if (FD_ISSET(fd1, &fds2)) { // check that fds2 is initialized + // ... + } + + return 0; +} diff --git a/tests/libc/sys_time.c b/tests/libc/sys_time.c new file mode 100644 index 0000000000000000000000000000000000000000..51808be30647c078a6b23b1813df9e5a1b4b9346 --- /dev/null +++ b/tests/libc/sys_time.c @@ -0,0 +1,22 @@ +#define _XOPEN_SOURCE 600 +#include <sys/time.h> + +int main() { + struct itimerval i1 = {{1, 100}, {2, 200}}; + int res = setitimer(ITIMER_REAL, &i1, 0); + //@ assert res == 0; + struct itimerval i2; + res = setitimer(ITIMER_REAL, &i1, &i2); + //@ assert res == 0; + //@ assert \initialized(&i2); + res = getitimer(ITIMER_REAL, &i2); + //@ assert res == 0; + //@ assert \initialized(&i2); + int INVALID_ITIMER = -1; + res = getitimer(INVALID_ITIMER, &i2); + //@ assert res == -1; + i2.it_interval.tv_usec = 1000000; // invalid tv_usec + res = setitimer(ITIMER_VIRTUAL, &i2, &i1); + //@ assert res == -1; + return 0; +} diff --git a/tests/libc/test_config b/tests/libc/test_config index c19d5db8dc6b191f2158d315a1fa1f46873abe84..4c10d1e3cae5176275599fc61a1a02fbda2aebe6 100644 --- a/tests/libc/test_config +++ b/tests/libc/test_config @@ -1 +1 @@ -OPT: -val -cpp-extra-args='-nostdinc -Ishare/libc' \ No newline at end of file +OPT: -val -val-show-progress -cpp-extra-args='-nostdinc -Ishare/libc' \ No newline at end of file diff --git a/tests/libc/wchar_c_h.c b/tests/libc/wchar_c_h.c index f14b18ece1261c70a136a988f0a6f688d059dbd4..a4d52050ee1ce73dd5f82a98b68ec2d87781c828 100644 --- a/tests/libc/wchar_c_h.c +++ b/tests/libc/wchar_c_h.c @@ -5,6 +5,12 @@ #include <wchar.h> +// check that the following types/macros are defined, as required by C11 §7.29.1 +// (note that the variables themselves are not used) +wchar_t wc = WCHAR_MIN | WCHAR_MAX; +wint_t wi = WEOF | WINT_MIN | WINT_MAX; +struct tm t; + #ifdef TEST_IMPLEMENTATION #include "wchar.c" #endif diff --git a/tests/metrics/func_ptr.c b/tests/metrics/func_ptr.c index f84f34beff67d2d2ac2b46ac525ca28bf17ce0bb..cac4ff2535d7d95bd76b935bbda6fe6b81331938 100644 --- a/tests/metrics/func_ptr.c +++ b/tests/metrics/func_ptr.c @@ -1,6 +1,6 @@ /* run.config - STDOPT: +"-metrics-value-cover" +"-metrics-cover main" - STDOPT: +"-metrics-value-cover" +"-main foobar" +"-metrics-cover foobar" + STDOPT: +"-metrics-value-cover -metrics-cover main -load-module scope" + STDOPT: +"-metrics-value-cover -main foobar -metrics-cover foobar -load-module scope" **/ void (*bar) (int); extern void (*bar_extern) (int); diff --git a/tests/metrics/oracle/cabs.res.oracle b/tests/metrics/oracle/cabs.res.oracle index de0a1661a24f259a0266a841e39b2afb41b97bfd..b50f5fd1e5d4e2c9851ce6e877d0bffaca5a2e64 100644 --- a/tests/metrics/oracle/cabs.res.oracle +++ b/tests/metrics/oracle/cabs.res.oracle @@ -1,19 +1,18 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/cabs.i (no preprocessing) [metrics] Halstead metrics ================ - Total operators: 19 - Distinct operators: 12 - Total_operands: 13 - Distinct operands: 9 - Program length: 32 - Vocabulary size: 21 - Program volume: 140.55 - Effort: 1218.14 - Program level: 0.12 - Difficulty level: 8.67 - Time to implement: 67.67 - Bugs delivered: 0.04 + Total operators: 15 + Distinct operators: 10 + Total_operands: 9 + Distinct operands: 6 + Program length: 24 + Vocabulary size: 16 + Program volume: 96 + Effort: 720 + Program level: 0.13 + Difficulty level: 7.50 + Time to implement: 40 + Bugs delivered: 0.03 Global statistics (Halstead) @@ -21,7 +20,6 @@ Operators --------- for: 1 - extern: 2 ): 1 {: 1 (: 1 @@ -31,15 +29,11 @@ +=: 1 <: 1 int: 2 - void: 2 Operands -------- - Frama_C_bzero: 1 j: 2 - Frama_C_copy_block: 1 i: 3 - FC_BUILTIN: 2 2: 1 1: 1 6: 1 diff --git a/tests/metrics/oracle/cyclo_comp5.res.oracle b/tests/metrics/oracle/cyclo_comp5.res.oracle index e3243b5ef386f2cb102a88a8e35a42361f5af8ac..61160dcc221ba0280daeb89b5e42ab8ab103c18d 100644 --- a/tests/metrics/oracle/cyclo_comp5.res.oracle +++ b/tests/metrics/oracle/cyclo_comp5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/cyclo_comp5.c (with preprocessing) [metrics] Defined functions (2) ===================== @@ -18,13 +17,13 @@ Global metrics ============== - Sloc = 14 + Sloc = 13 Decision point = 4 Global variables = 0 If = 1 Loop = 0 Goto = 0 - Assignment = 0 + Assignment = 1 Exit point = 2 Function = 3 Function call = 5 diff --git a/tests/metrics/oracle/func_ptr.0.res.oracle b/tests/metrics/oracle/func_ptr.0.res.oracle index bec865dc19902a769ecfb11828fa950a365382cb..957c4c32a58fb72f7d46efd6967659361f2cbc4b 100644 --- a/tests/metrics/oracle/func_ptr.0.res.oracle +++ b/tests/metrics/oracle/func_ptr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/func_ptr.c (with preprocessing) tests/metrics/func_ptr.c:28:[kernel] warning: Calling undeclared function exit. Old style K&R code? [metrics] Defined functions (4) @@ -45,7 +44,6 @@ tests/metrics/func_ptr.c:28:[kernel] warning: Calling undeclared function exit. [value:initial-state] Values of globals at initialization bar ∈ {0} bar_extern ∈ {0} -[value] Recording results for main [value] done for function main [metrics] Value coverage statistics ========================= @@ -53,7 +51,7 @@ tests/metrics/func_ptr.c:28:[kernel] warning: Calling undeclared function exit. Semantically reached functions = 1 Coverage estimation = 33.3% - Unseen functions (2) = + Unreached functions (2) = <tests/metrics/func_ptr.c>: exit; foo; [metrics] References to non-analyzed functions ------------------------------------ diff --git a/tests/metrics/oracle/func_ptr.1.res.oracle b/tests/metrics/oracle/func_ptr.1.res.oracle index 93e97b03a7d1bb70004f34349a14637316657bbe..d0570e287b9746e81bd5887a477b69e443f7991a 100644 --- a/tests/metrics/oracle/func_ptr.1.res.oracle +++ b/tests/metrics/oracle/func_ptr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/func_ptr.c (with preprocessing) tests/metrics/func_ptr.c:28:[kernel] warning: Calling undeclared function exit. Old style K&R code? [metrics] Defined functions (4) @@ -45,11 +44,6 @@ tests/metrics/func_ptr.c:28:[kernel] warning: Calling undeclared function exit. [value:initial-state] Values of globals at initialization bar ∈ {0} bar_extern ∈ {0} -[value] computing for function baz <- foobar. - Called from tests/metrics/func_ptr.c:12. -[value] Recording results for baz -[value] Done for function baz -[value] Recording results for foobar [value] done for function foobar [metrics] Value coverage statistics ========================= diff --git a/tests/metrics/oracle/libc.0.res.oracle b/tests/metrics/oracle/libc.0.res.oracle index 141396f7533b4d2c0c9706514c73618fdc26bee5..ecdc8aa5270d8d98b1d44013ef2e661a3a8c7a4b 100644 --- a/tests/metrics/oracle/libc.0.res.oracle +++ b/tests/metrics/oracle/libc.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/libc.c (with preprocessing) [metrics] Defined functions (1) ===================== @@ -24,7 +23,7 @@ If = 0 Loop = 0 Goto = 0 - Assignment = 0 + Assignment = 1 Exit point = 1 Function = 1 Function call = 1 diff --git a/tests/metrics/oracle/libc.1.res.oracle b/tests/metrics/oracle/libc.1.res.oracle index 1ad940d0b7537be5c6a1e20b2e86edd23720ee71..8b2ca57645d2d2a50175a955cd1ee6d7f8bde64a 100644 --- a/tests/metrics/oracle/libc.1.res.oracle +++ b/tests/metrics/oracle/libc.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/libc.c (with preprocessing) [metrics] Defined functions (1) ===================== @@ -41,7 +40,7 @@ If = 0 Loop = 0 Goto = 0 - Assignment = 0 + Assignment = 1 Exit point = 1 Function = 67 Function call = 1 diff --git a/tests/metrics/oracle/locals_size.0.res.oracle b/tests/metrics/oracle/locals_size.0.res.oracle index fa16e984e37f22ed9a5854a76d78d0cd0906515f..28781eb07040f5c4b610416b9355c76fbaa18329 100644 --- a/tests/metrics/oracle/locals_size.0.res.oracle +++ b/tests/metrics/oracle/locals_size.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/locals_size.i (no preprocessing) [metrics] function locals_size_no_temps locals_size_with_temps max_call_size_no_temps max_call_size_with_temps [metrics] f 0 0 0 0 diff --git a/tests/metrics/oracle/locals_size.1.res.oracle b/tests/metrics/oracle/locals_size.1.res.oracle index 472c5d9a7e0b96a0d919d6b8db0970ad3ff00532..786b3acadc8876ac40aadea41fa874dfd276cd0a 100644 --- a/tests/metrics/oracle/locals_size.1.res.oracle +++ b/tests/metrics/oracle/locals_size.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/locals_size.i (no preprocessing) [metrics] function locals_size_no_temps locals_size_with_temps max_call_size_no_temps max_call_size_with_temps [metrics] user error: unsupported recursive call detected: recurse2 <- recurse1 <- recurse2 diff --git a/tests/metrics/oracle/reach.res.oracle b/tests/metrics/oracle/reach.res.oracle index dd63019ae18e7fe2114a5d8039ab56240e830d22..6e44cdb40664cd1d1c02509c3588725053a67df5 100644 --- a/tests/metrics/oracle/reach.res.oracle +++ b/tests/metrics/oracle/reach.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/reach.c (with preprocessing) [metrics] Cil AST @@ -83,7 +82,6 @@ bar ∈ {0} t[0] ∈ {{ &baz }} [1] ∈ {0} -[value] Recording results for main [value] done for function main [metrics] Value coverage statistics ========================= @@ -91,7 +89,7 @@ Semantically reached functions = 1 Coverage estimation = 33.3% - Unseen functions (2) = + Unreached functions (2) = <tests/metrics/reach.c>: baz; foo; [metrics] References to non-analyzed functions ------------------------------------ diff --git a/tests/metrics/oracle/unreachable.res.oracle b/tests/metrics/oracle/unreachable.res.oracle index 6a88b5f6ea7b9bbca6bd9410329370aef41235f8..212e260ca5d734e8e75fd9e0f219f0d108aded21 100644 --- a/tests/metrics/oracle/unreachable.res.oracle +++ b/tests/metrics/oracle/unreachable.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/metrics/unreachable.c (with preprocessing) [metrics] Defined functions (2) ===================== @@ -35,7 +34,6 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Recording results for main [value] done for function main [metrics] Value coverage statistics ========================= @@ -43,7 +41,7 @@ Semantically reached functions = 1 Coverage estimation = 50.0% - Unseen functions (1) = + Unreached functions (1) = <tests/metrics/unreachable.c>: foo; [metrics] References to non-analyzed functions ------------------------------------ @@ -57,7 +55,6 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Recording results for foo [value] done for function foo [metrics] Value coverage statistics ========================= diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_injector.0.err.oracle b/tests/metrics/oracle/variadic-stdlib-generated.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_injector.0.err.oracle rename to tests/metrics/oracle/variadic-stdlib-generated.err.oracle diff --git a/tests/metrics/oracle/variadic-stdlib-generated.res.oracle b/tests/metrics/oracle/variadic-stdlib-generated.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..5aaba685816c87cc96ad2473185c35ed4248e289 --- /dev/null +++ b/tests/metrics/oracle/variadic-stdlib-generated.res.oracle @@ -0,0 +1,31 @@ +[kernel] Parsing tests/metrics/variadic-stdlib-generated.c (with preprocessing) +[metrics] Defined functions (2) + ===================== + main (0 call); my_printf (1 call); + + Undefined functions (1) + ======================= + rand (1 call); + + 'Extern' global variables (0) + ============================= + + + Potential entry points (1) + ========================== + main; + + Global metrics + ============== + Sloc = 5 + Decision point = 0 + Global variables = 0 + If = 0 + Loop = 0 + Goto = 0 + Assignment = 0 + Exit point = 2 + Function = 3 + Function call = 3 + Pointer dereferencing = 0 + Cyclomatic complexity = 2 diff --git a/tests/metrics/reach.c b/tests/metrics/reach.c index caa5d394ecd025e7e26a4606b241a467ab290f9e..01f71a614d4f120a3b44a5f31e1c2f7f514426bf 100644 --- a/tests/metrics/reach.c +++ b/tests/metrics/reach.c @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-metrics-by-function" +"-metrics-value-cover" + STDOPT: +"-metrics-by-function -metrics-value-cover -load-module scope" **/ void (*bar) (int); void (*t[2])(int); diff --git a/tests/metrics/unreachable.c b/tests/metrics/unreachable.c index 6c1d3b41f1ba70d87fdff4019929ec46924cb995..95ba040bc3aaad25f7b50878b09878dd889db02b 100644 --- a/tests/metrics/unreachable.c +++ b/tests/metrics/unreachable.c @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-metrics-value-cover" +"-then" +"-main foo" + STDOPT: +"-load-module scope -metrics-value-cover -then -main foo" **/ void foo () { int i = 0; diff --git a/tests/metrics/variadic-stdlib-generated.c b/tests/metrics/variadic-stdlib-generated.c new file mode 100644 index 0000000000000000000000000000000000000000..5dbb491914075a2d6effefab344bb23df8b39a30 --- /dev/null +++ b/tests/metrics/variadic-stdlib-generated.c @@ -0,0 +1,19 @@ +/* run.config + STDOPT: #"-load-module variadic" +*/ + +#include <stdio.h> + +// <stdlib.h> contains this function, but we did not include it, so it should +// not be reported as part of the stdlib. +int rand(void); + +void my_printf(char *s) {} + +void printf2(char *s); + +void main() { + printf("this call is part of the stdlib"); + my_printf("this call is not part of the stdlib"); + rand(); +} diff --git a/tests/misc/bts0541.c b/tests/misc/bts0541.c index 55e767d8aef9c7b92d350c5b669a7b95ce265615..6bec6dbab693999428fc766aa2eb7ced151e30de 100644 --- a/tests/misc/bts0541.c +++ b/tests/misc/bts0541.c @@ -1,5 +1,5 @@ /* run.config - OPT: -pp-annot -cpp-extra-args="-I./share/libc" -pp-annot -val + OPT: -pp-annot -cpp-extra-args="-I./share/libc" -pp-annot -val -val-show-progress */ #include <stdbool.h> diff --git a/tests/misc/bts1347.i b/tests/misc/bts1347.i index fe30736e8929cae9c27cbe14594f31a3568f9a41..15a08daaf6e9f4b2225655aa490fa21b09688c8f 100644 --- a/tests/misc/bts1347.i +++ b/tests/misc/bts1347.i @@ -1,9 +1,5 @@ -/* run.config_no_native_dynlink - CMD: bin/toplevel.byte - OPT: -load-script tests/misc/bts1347.ml -then -report -*/ /* run.config - OPT: -load-script tests/misc/bts1347.ml -then -report + OPT: -load-script tests/misc/bts1347.ml -val-show-progress -then -report */ int f(int *x) { return *x; } diff --git a/tests/misc/custom_machdep/__fc_machdep_custom.h b/tests/misc/custom_machdep/__fc_machdep_custom.h index 7352e6eb9354a6ca1e791c6f37ba7a8910552ed4..fb3450aeebcfe40789fe72f5c22e0e67084d2391 100644 --- a/tests/misc/custom_machdep/__fc_machdep_custom.h +++ b/tests/misc/custom_machdep/__fc_machdep_custom.h @@ -23,13 +23,13 @@ #define __FC_SHRT_MIN (-32768) #define __FC_SHRT_MAX 32767 #define __FC_USHRT_MAX 65535 -#define __FC_INT_MIN (-INT_MAX - 1) +#define __FC_INT_MIN (-2147483647 - 1) #define __FC_INT_MAX 2147483647 #define __FC_UINT_MAX 4294967295U -#define __FC_LONG_MIN (-LONG_MAX -1L) +#define __FC_LONG_MIN (-2147483647L -1L) #define __FC_LONG_MAX 2147483647L #define __FC_ULONG_MAX 4294967295UL -#define __FC_LLONG_MIN (-LLONG_MAX -1LL) +#define __FC_LLONG_MIN (-9223372036854775807LL -1LL) #define __FC_LLONG_MAX 9223372036854775807LL #define __FC_ULLONG_MAX 18446744073709551615ULL @@ -77,6 +77,9 @@ /* stdint.h */ #define __FC_PTRDIFF_MIN __FC_INT_MIN #define __FC_PTRDIFF_MAX __FC_INT_MAX +#define __FC_INTMAX_MIN (-9223372036854775807LL -1LL) +#define __FC_INTMAX_MAX 9223372036854775807LL +#define __FC_UINTMAX_MAX 18446744073709551615ULL #define __FC_EOF (-1) #define __FC_FOPEN_MAX 20 @@ -86,6 +89,15 @@ /* for stdarg.h */ #define __FC_VA_LIST_T char* +/* for time.h */ +#define __FC_TIME_T long + +/* for wchar.h */ +#define __WINT_T unsigned int +#define __FC_WEOF (0xFFFFFFFFU) +#define __FC_WINT_MIN 0 +#define __FC_WINT_MAX __FC_UINT_MAX + #else error "I'm supposed to be called with __FC_MACHDEP_CUSTOM macro defined" #endif diff --git a/tests/misc/ensures.i b/tests/misc/ensures.i index 4ec057666a52cb05ee91e1d6d92ee5d25e48106c..140bf8122f031aa574e460218275fceb1fb3112b 100644 --- a/tests/misc/ensures.i +++ b/tests/misc/ensures.i @@ -1,7 +1,3 @@ -/* run.config_no_native_dynlink - CMD: bin/toplevel.byte - OPT: -load-script tests/misc/ensures.ml -*/ /* run.config OPT: -load-script tests/misc/ensures.ml */ diff --git a/tests/misc/exception.i b/tests/misc/exception.i index d056c83e41e3e99634f8af83cfa3c65399a9b6f0..4b73ec776649d824fae164bf23655cd6ab7c26c1 100644 --- a/tests/misc/exception.i +++ b/tests/misc/exception.i @@ -42,6 +42,6 @@ int f4 (int c) { int h(int c) { if (c-1<=0) return f1(c); else if (c-100<=0) /*@ returns \result == c+1; */ return f2(c); - else if (c>360) return f3(c); + else if (c>360) { int x = f3(c); return x; } else return f4(c); } diff --git a/tests/misc/global_decl_loc.i b/tests/misc/global_decl_loc.i new file mode 100644 index 0000000000000000000000000000000000000000..3da30326dde49e4dacd4027a5ac9515fe448b0b5 --- /dev/null +++ b/tests/misc/global_decl_loc.i @@ -0,0 +1,4 @@ +/* run.config + OPT: @PTEST_DIR@/global_decl_loc2.i -load-module @PTEST_DIR@/global_decl_loc.cmxs + */ +int g; diff --git a/tests/misc/global_decl_loc.ml b/tests/misc/global_decl_loc.ml new file mode 100644 index 0000000000000000000000000000000000000000..afe0d309b5e8b570901a9fad9eaa53b264a969ee --- /dev/null +++ b/tests/misc/global_decl_loc.ml @@ -0,0 +1,11 @@ +open Cil_types + +let run () = + Globals.Vars.iter + (fun vi _ -> + Kernel.result "global variable %a declared at %a" + Printer.pp_varinfo vi + Printer.pp_location vi.vdecl + ) + +let () = Db.Main.extend run diff --git a/tests/misc/global_decl_loc2.i b/tests/misc/global_decl_loc2.i new file mode 100644 index 0000000000000000000000000000000000000000..08fe31aa7b67c33420527175fdcfeeedce5ac8b6 --- /dev/null +++ b/tests/misc/global_decl_loc2.i @@ -0,0 +1,10 @@ +/* run.config + OPT: @PTEST_DIR@/global_decl_loc.i -load-module @PTEST_DIR@/global_decl_loc.cmxs +*/ + +extern int g; + +int main(void) { + int a = g; + return a; +} diff --git a/tests/misc/issue109.i b/tests/misc/issue109.i index 5b316c74a993d0490571fff3dd854155b016981b..878305d92c4d6cce282a72f3450870ecb9817789 100644 --- a/tests/misc/issue109.i +++ b/tests/misc/issue109.i @@ -1,5 +1,5 @@ /* run.config - OPT: -val -slevel-function main:10 -load-script tests/misc/issue109.ml + OPT: -val -val-show-progress -slevel-function main:10 -load-script tests/misc/issue109.ml */ void main() { diff --git a/tests/misc/log_twice.i b/tests/misc/log_twice.i index e39d8e19ecd16eed8be95693bed977480ae468f4..96dc84cdc98cca6d0cccc2512cc2ff634567adee 100644 --- a/tests/misc/log_twice.i +++ b/tests/misc/log_twice.i @@ -1,5 +1,5 @@ /* run.config - OPT: -load-script tests/misc/log_twice + OPT: -load-script tests/misc/log_twice -val-show-progress */ int* f() { diff --git a/tests/misc/oracle/add_assigns.res.oracle b/tests/misc/oracle/add_assigns.res.oracle index 79c760abc96bb8d3c4d6825e15174e00f9657de0..e9b898dda96033266aea3877186cee83a1b8d193 100644 --- a/tests/misc/oracle/add_assigns.res.oracle +++ b/tests/misc/oracle/add_assigns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/add_assigns.i (no preprocessing) [report] Computing properties status... @@ -24,16 +23,12 @@ int f(int *x, int *y) int __retres; int *tmp; int *tmp_0; - { /* sequence */ - tmp = x; - x ++; - ; - } - { /* sequence */ - tmp_0 = y; - y ++; - ; - } + tmp = x; + x ++; + ; + tmp_0 = y; + y ++; + ; __retres = *x + *y; return __retres; } diff --git a/tests/misc/oracle/behavior_names.res.oracle b/tests/misc/oracle/behavior_names.res.oracle index fceea5983c788eea1199f33ab10e38305fbfce2d..abe343441b7744a32e425990be85317a432beea4 100644 --- a/tests/misc/oracle/behavior_names.res.oracle +++ b/tests/misc/oracle/behavior_names.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/behavior_names.i (no preprocessing) stmt: bli bar new1: foo_0 diff --git a/tests/misc/oracle/bts0451.res.oracle b/tests/misc/oracle/bts0451.res.oracle index 8fa597e6ac0454a4c66288be9ea647cf46091a36..d26ce0b24af6983f36234ac3776285f92f99c391 100644 --- a/tests/misc/oracle/bts0451.res.oracle +++ b/tests/misc/oracle/bts0451.res.oracle @@ -1,5 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0451.i (no preprocessing) tests/misc/bts0451.i:26:[kernel] user error: break outside of a loop or switch + 24 /* should abort with an error at type-checking */ + 25 int main (void) { + 26 break; + ^^^^^^^^ + 27 return 0; + 28 } [kernel] user error: stopping on file "tests/misc/bts0451.i" that has errors. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/misc/oracle/bts0452.res.oracle b/tests/misc/oracle/bts0452.res.oracle index ceb738f72c633e5004ddb5cefdeca3ab316f02d8..4fe32affd79880437c7b12910f708fbbf57cdadd 100644 --- a/tests/misc/oracle/bts0452.res.oracle +++ b/tests/misc/oracle/bts0452.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0452.i (no preprocessing) tests/misc/bts0452.i:13:[kernel] warning: Body of function f falls-through. Adding a return statement tests/misc/bts0452.i:27:[kernel] warning: Body of function h falls-through. Adding a return statement diff --git a/tests/misc/oracle/bts0489.res.oracle b/tests/misc/oracle/bts0489.res.oracle index 42200436c57ab11fe0f0974817320d407deb8f7d..635e3ae92a2e1d0bc8b8340d51ce3e16160dbbc4 100644 --- a/tests/misc/oracle/bts0489.res.oracle +++ b/tests/misc/oracle/bts0489.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0489.i (no preprocessing) Found representation 2 Found representation 2U diff --git a/tests/misc/oracle/bts0525-2.res.oracle b/tests/misc/oracle/bts0525-2.res.oracle index 05394d27cb6cd1e73f927e43c178adf447e92fa9..05f701aa40b3b3b3f78d3635a8d3cf38fe432c07 100644 --- a/tests/misc/oracle/bts0525-2.res.oracle +++ b/tests/misc/oracle/bts0525-2.res.oracle @@ -1,3 +1,2 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0525-2.i (no preprocessing) [kernel] Parsing tests/misc/bts0525.i (no preprocessing) diff --git a/tests/misc/oracle/bts0525.res.oracle b/tests/misc/oracle/bts0525.res.oracle index b8c24057821c1d6d4f5200b56d9e2db2013d10cd..acbed15382985f934672cb389658c2260c761816 100644 --- a/tests/misc/oracle/bts0525.res.oracle +++ b/tests/misc/oracle/bts0525.res.oracle @@ -1,3 +1,2 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0525.i (no preprocessing) [kernel] Parsing tests/misc/bts0525-2.i (no preprocessing) diff --git a/tests/misc/oracle/bts0541.res.oracle b/tests/misc/oracle/bts0541.res.oracle index c42f28170385220879e748da7e42aff511777c85..003da7f75e73e8d3435a314678b616eb243aaa9c 100644 --- a/tests/misc/oracle/bts0541.res.oracle +++ b/tests/misc/oracle/bts0541.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0541.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] tests/misc/bts0541.c:13:[value] assertion got status valid. [value] Recording results for main [value] done for function main diff --git a/tests/misc/oracle/bts0990_link.res.oracle b/tests/misc/oracle/bts0990_link.res.oracle index 885246e221bf2f51a99f762aae94422fc57a0257..65c623fb2bdfc4e23308da582971e8c805446144 100644 --- a/tests/misc/oracle/bts0990_link.res.oracle +++ b/tests/misc/oracle/bts0990_link.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts0990_link.i (no preprocessing) [kernel] Parsing tests/misc/bts0990_link_1.i (no preprocessing) [kernel] user error: Incompatible declaration for s: diff --git a/tests/misc/oracle/bts1135_ulevel.res.oracle b/tests/misc/oracle/bts1135_ulevel.res.oracle index a9e04a72d00a0b724855bd7cbf15a7754913dd2e..ae38436bfd625a143614bc2c4541a4aa63bd3f18 100644 --- a/tests/misc/oracle/bts1135_ulevel.res.oracle +++ b/tests/misc/oracle/bts1135_ulevel.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts1135_ulevel.i (no preprocessing) /* Generated by Frama-C */ int X; void main(int c) { - int i; - i = 0; + int i = 0; if (! (i < 10)) goto unrolling_2_loop; if (c) /*@ ensures \false; */ diff --git a/tests/misc/oracle/bts1201.res.oracle b/tests/misc/oracle/bts1201.res.oracle index 8b1d81fdc4f1493fef9169616254f905caa61f3b..ca9a96549d98199bb7a69d54a9c75faa16881f12 100644 --- a/tests/misc/oracle/bts1201.res.oracle +++ b/tests/misc/oracle/bts1201.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts1201.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,14 +5,12 @@ [value:initial-state] Values of globals at initialization tests/misc/bts1201.i:5:[value] assertion got status valid. -[value] Recording results for main [value] done for function main [value] Analyzing a complete application starting at main2 [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Recording results for main2 [value] done for function main2 /* Generated by Frama-C */ void main(void) diff --git a/tests/misc/oracle/bts1347.res.oracle b/tests/misc/oracle/bts1347.res.oracle index e0adc1c1a24d3e9a8632ba96810ea7d96d49ff26..3afa53a66612446ea6cad4f18d56f32c7b0815b7 100644 --- a/tests/misc/oracle/bts1347.res.oracle +++ b/tests/misc/oracle/bts1347.res.oracle @@ -1,11 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bts1347.i (no preprocessing) [value] Analyzing an incomplete application starting at f [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/misc/bts1347.i:9:[value] warning: out of bounds read. assert \valid_read(x); +tests/misc/bts1347.i:5:[value] warning: out of bounds read. assert \valid_read(x); [value] Recording results for f [value] done for function f [value] Analyzing an incomplete application starting at g @@ -13,7 +12,7 @@ tests/misc/bts1347.i:9:[value] warning: out of bounds read. assert \valid_read(x [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/misc/bts1347.i:10:[value] warning: out of bounds read. assert \valid_read(tmp); +tests/misc/bts1347.i:6:[value] warning: out of bounds read. assert \valid_read(tmp); (tmp from x++) [value] Recording results for g [value] done for function g @@ -23,22 +22,22 @@ tests/misc/bts1347.i:10:[value] warning: out of bounds read. assert \valid_read( --- Properties of Function 'f' -------------------------------------------------------------------------------- -[ Dead ] Assertion 'emitter' (file tests/misc/bts1347.i, line 9) +[ Dead ] Assertion 'emitter' (file tests/misc/bts1347.i, line 5) Locally valid, but unreachable. By Value because: - - Unreachable return (file tests/misc/bts1347.i, line 9) -[Unreachable] Unreachable return (file tests/misc/bts1347.i, line 9) + - Unreachable return (file tests/misc/bts1347.i, line 5) +[Unreachable] Unreachable return (file tests/misc/bts1347.i, line 5) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'g' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,mem_access' (file tests/misc/bts1347.i, line 10) +[ - ] Assertion 'Value,mem_access' (file tests/misc/bts1347.i, line 6) tried with Value. -[ Partial ] Assertion 'emitter' (file tests/misc/bts1347.i, line 10) +[ Partial ] Assertion 'emitter' (file tests/misc/bts1347.i, line 6) By emitter, with pending: - - Assertion 'Value,mem_access' (file tests/misc/bts1347.i, line 10) + - Assertion 'Value,mem_access' (file tests/misc/bts1347.i, line 6) -------------------------------------------------------------------------------- --- Status Report Summary @@ -54,8 +53,8 @@ tests/misc/bts1347.i:10:[value] warning: out of bounds read. assert \valid_read( [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/misc/bts1347.i:9:[value] warning: out of bounds read. assert \valid_read(x); -tests/misc/bts1347.i:9:[value] assertion 'emitter' got status valid. +tests/misc/bts1347.i:5:[value] warning: out of bounds read. assert \valid_read(x); +tests/misc/bts1347.i:5:[value] assertion 'emitter' got status valid. [value] Recording results for f [value] done for function f [value] Analyzing an incomplete application starting at g @@ -63,8 +62,8 @@ tests/misc/bts1347.i:9:[value] assertion 'emitter' got status valid. [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/misc/bts1347.i:10:[value] warning: out of bounds read. assert \valid_read(tmp); +tests/misc/bts1347.i:6:[value] warning: out of bounds read. assert \valid_read(tmp); (tmp from x++) -tests/misc/bts1347.i:10:[value] assertion 'emitter' got status valid. +tests/misc/bts1347.i:6:[value] assertion 'emitter' got status valid. [value] Recording results for g [value] done for function g diff --git a/tests/misc/oracle/bug0277.res.oracle b/tests/misc/oracle/bug0277.res.oracle index 5e9cda542589463fffd46c97b316dc5dcd43894d..6db9b212d97be10f086c281ea4f157292958ea7f 100644 --- a/tests/misc/oracle/bug0277.res.oracle +++ b/tests/misc/oracle/bug0277.res.oracle @@ -1,2 +1 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bug0277.i (no preprocessing) diff --git a/tests/misc/oracle/bug_0209.res.oracle b/tests/misc/oracle/bug_0209.res.oracle index c9ae8845c99a4139449ce749efb64706b565c742..26bbe191b142dfbbb0bb9be6cd2b9ac1bb5ee7eb 100644 --- a/tests/misc/oracle/bug_0209.res.oracle +++ b/tests/misc/oracle/bug_0209.res.oracle @@ -1,4 +1,2 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/bug_0209.c (with preprocessing) [kernel] warning: no input file. -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) diff --git a/tests/misc/oracle/callsite.res.oracle b/tests/misc/oracle/callsite.res.oracle index aef39397152963abbd7688c77258ace738e024cb..052451557200d4e77ef67c5517295412b16dcd50 100644 --- a/tests/misc/oracle/callsite.res.oracle +++ b/tests/misc/oracle/callsite.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/callsite.i (no preprocessing) Call Sites for f: Call Sites for g: diff --git a/tests/misc/oracle/change_formals.0.res.oracle b/tests/misc/oracle/change_formals.0.res.oracle index 6f49634b46f3b45e187e249d5fd09b01a6c7f2bf..22dc10f37e8a0e84a256544ee404ff1e529bcd10 100644 --- a/tests/misc/oracle/change_formals.0.res.oracle +++ b/tests/misc/oracle/change_formals.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/change_formals.c (with preprocessing) [test] current prj = project "test" [test] current prj = project "test" diff --git a/tests/misc/oracle/change_formals.1.res.oracle b/tests/misc/oracle/change_formals.1.res.oracle index 19c1f262afd7b6b1976a3cd0551e6a96f4aa0326..1f5fcdcd5e9190f8f8d30d8539dc1445a9034ed0 100644 --- a/tests/misc/oracle/change_formals.1.res.oracle +++ b/tests/misc/oracle/change_formals.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/change_formals.c (with preprocessing) [test] current prj = project "test" /* Generated by Frama-C */ diff --git a/tests/misc/oracle/change_formals.2.res.oracle b/tests/misc/oracle/change_formals.2.res.oracle index 8159eb83681f6dce95a3ca2f4f8235200bd3e6f2..3f746d6b7f699a77b6f8d4fff112a9d72aa9ea18 100644 --- a/tests/misc/oracle/change_formals.2.res.oracle +++ b/tests/misc/oracle/change_formals.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/change_formals.c (with preprocessing) [test] current prj = project "test" [test] current prj = project "test" diff --git a/tests/misc/oracle/change_main.res.oracle b/tests/misc/oracle/change_main.res.oracle index 16ca2624105332faad508b0ca870641f1187bbe1..3f7a4439c19ee93d9ab57bb6beecd6259f91f0ce 100644 --- a/tests/misc/oracle/change_main.res.oracle +++ b/tests/misc/oracle/change_main.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/change_main.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Recording results for f [value] done for function f [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function f: @@ -15,7 +13,6 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Recording results for g [value] done for function g [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function g: diff --git a/tests/misc/oracle/char_ampamp.res.oracle b/tests/misc/oracle/char_ampamp.res.oracle index 333945dd622ad7488cc7307ab301ddc6bb126241..048a835303ca43c8f9b9489a86ce66002b0f74c1 100644 --- a/tests/misc/oracle/char_ampamp.res.oracle +++ b/tests/misc/oracle/char_ampamp.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/char_ampamp.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,7 +7,7 @@ y ∈ {0} [value] computing for function g <- main. Called from tests/misc/char_ampamp.c:12. -[value] Called Frama_C_show_each_x({1}) +tests/misc/char_ampamp.c:6:[value] Frama_C_show_each_x: {1} [value] Recording results for g [value] Done for function g [value] Recording results for main diff --git a/tests/misc/oracle/copy_kf.res.oracle b/tests/misc/oracle/copy_kf.res.oracle index c2dfe4ca224a69466eec1e01c706c8a31542a7d2..d6cb6bd642b228de0dbd288993c5244b0b800355 100644 --- a/tests/misc/oracle/copy_kf.res.oracle +++ b/tests/misc/oracle/copy_kf.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/copy_kf.i (no preprocessing) [kernel] After cloning f: /* Generated by Frama-C */ diff --git a/tests/misc/oracle/copy_machdep.res.oracle b/tests/misc/oracle/copy_machdep.res.oracle index 491d366ae190cc2dc849487bcc59263888b2cde9..3283cac38767cc29e75b195f2ecd41d399d7e675 100644 --- a/tests/misc/oracle/copy_machdep.res.oracle +++ b/tests/misc/oracle/copy_machdep.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/copy_machdep.i (no preprocessing) [kernel] Machdep is preserved [kernel] Enums is preserved diff --git a/tests/misc/oracle/custom_machdep.res.oracle b/tests/misc/oracle/custom_machdep.res.oracle index 58a11e0bf6351b6dfee355cddb40a6143d2ea36f..84de51d3f4ab779eed63311ac49105fab98e1ee4 100644 --- a/tests/misc/oracle/custom_machdep.res.oracle +++ b/tests/misc/oracle/custom_machdep.res.oracle @@ -1,5 +1,4 @@ [kernel] Registering machdep 'mach' as 'custom' -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/custom_machdep.c (with preprocessing) /* Generated by Frama-C */ #include "ctype.h" diff --git a/tests/misc/oracle/debug_category.0.res.oracle b/tests/misc/oracle/debug_category.0.res.oracle index 362cbbd49b06c9f65111bf631f1926933a5c3d7a..54dd74dbedd9efdfe2dcb50c0c35f3b1f1af6c9b 100644 --- a/tests/misc/oracle/debug_category.0.res.oracle +++ b/tests/misc/oracle/debug_category.0.res.oracle @@ -1,5 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/misc/debug_category.i (no preprocessing) [test] Available message categories are: a a:b diff --git a/tests/misc/oracle/debug_category.1.res.oracle b/tests/misc/oracle/debug_category.1.res.oracle index f8ca407dba72339b95a4364b7dd51dd85727fa1b..aea51a88d499d2792ae0af3a55fd2950771caf91 100644 --- a/tests/misc/oracle/debug_category.1.res.oracle +++ b/tests/misc/oracle/debug_category.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/debug_category.i (no preprocessing) [test:a] A is enabled [test:a:b] B is enabled diff --git a/tests/misc/oracle/debug_category.2.res.oracle b/tests/misc/oracle/debug_category.2.res.oracle index 7afb178c02f29e1b801a9a267d0abd730ac29ffc..cf5b57b60c8e854ee457d3a5a1b374b33bb97947 100644 --- a/tests/misc/oracle/debug_category.2.res.oracle +++ b/tests/misc/oracle/debug_category.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/debug_category.i (no preprocessing) [test:a] A is enabled [test:a] A is enabled diff --git a/tests/misc/oracle/debug_category.3.res.oracle b/tests/misc/oracle/debug_category.3.res.oracle index fd3b3b77c8035877d81ae54ea4d688f40bfe068d..d52a5d992932f1dceb9ae67cbecd3a21d4222e1e 100644 --- a/tests/misc/oracle/debug_category.3.res.oracle +++ b/tests/misc/oracle/debug_category.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/debug_category.i (no preprocessing) [test:a] A is enabled [test:a:b:c] C is enabled diff --git a/tests/misc/oracle/debug_category.4.res.oracle b/tests/misc/oracle/debug_category.4.res.oracle index 66de2b13c34f8c04bbbc3c130fa6eb5ace500498..a70bf4db8227e81d6a08c25100efe8033270a5b8 100644 --- a/tests/misc/oracle/debug_category.4.res.oracle +++ b/tests/misc/oracle/debug_category.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/debug_category.i (no preprocessing) [test:a:b:c] C is enabled [test:d] D is enabled diff --git a/tests/misc/oracle/debug_category.5.res.oracle b/tests/misc/oracle/debug_category.5.res.oracle index b56bb78b75de90695674fbade03ba449f784dd1b..d8f60deca3597d677a01e0db77dbed3899d6a38f 100644 --- a/tests/misc/oracle/debug_category.5.res.oracle +++ b/tests/misc/oracle/debug_category.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/debug_category.i (no preprocessing) [test:a] A is enabled [test:a:b] B is enabled diff --git a/tests/misc/oracle/ensures.res.oracle b/tests/misc/oracle/ensures.res.oracle index 719f00e62bc6517df69ce255e5f8e229ea2147b6..8af43b37d8350e5b9f51622280d34b542d5fe26e 100644 --- a/tests/misc/oracle/ensures.res.oracle +++ b/tests/misc/oracle/ensures.res.oracle @@ -1,26 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/ensures.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/misc/ensures.i:8:[value] warning: function main: postcondition got status invalid. -[value] Recording results for main +tests/misc/ensures.i:4:[value] warning: function main: postcondition got status invalid. [value] done for function main -[kernel] Frama_C_bzero: behavior default! - VALID according to Frama-C kernel (under hypotheses) -[kernel] Frama_C_bzero: behavior default! no verification attempted -[kernel] Frama_C_bzero: behavior default! no verification attempted -[kernel] Frama_C_bzero: behavior default! no verification attempted -[kernel] Frama_C_bzero: behavior default! no verification attempted -[kernel] Frama_C_copy_block: behavior default! - VALID according to Frama-C kernel (under hypotheses) -[kernel] Frama_C_copy_block: behavior default! no verification attempted -[kernel] Frama_C_copy_block: behavior default! no verification attempted -[kernel] Frama_C_copy_block: behavior default! no verification attempted -[kernel] Frama_C_copy_block: behavior default! no verification attempted -[kernel] Frama_C_copy_block: behavior default! no verification attempted [kernel] main: behavior default! **NOT** VALID according to Frama-C kernel (under hypotheses) [kernel] main: behavior default! **NOT** VALID according to Value (under hypotheses) diff --git a/tests/misc/oracle/exception.0.res.oracle b/tests/misc/oracle/exception.0.res.oracle index 29248de175c931138777afd440a8f7fc9739fb61..eef04e1c9e2973684a22ab29d71309149ef12e3e 100644 --- a/tests/misc/oracle/exception.0.res.oracle +++ b/tests/misc/oracle/exception.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/exception.i (no preprocessing) /* Generated by Frama-C */ struct my_exn { @@ -25,18 +24,20 @@ int f(int c) int g(int c) { int __retres; - try + try { int tmp; tmp = f(c); __retres = tmp; goto return_label; + } catch ( int x_0 ) { __retres = 3; goto return_label; - } catch ( ... ) { + } + catch ( ... ) { __retres = 4; goto return_label; - } + } return_label: return __retres; } @@ -105,7 +106,7 @@ int f4(int c) int h(int c) { int __retres; - try + try if (c - 1 <= 0) { int tmp; tmp = f1(c); @@ -125,9 +126,8 @@ int h(int c) } else if (c > 360) { - int tmp_1; - tmp_1 = f3(c); - __retres = tmp_1; + int x_0 = f3(c); + __retres = x_0; goto return_label; } else { @@ -140,20 +140,19 @@ int h(int c) struct my_exn exn_aux struct my_exn2 exn2 ) { - __retres = exn.e; - goto return_label; - } - catch ( int y ) { - __retres = y; - goto return_label; - } - catch ( double not_thrown ) { - __retres = -1; - goto return_label; - } - catch ( ... ) { - throw ; - } + __retres = exn.e; + goto return_label; + } + catch ( int y ) { + __retres = y; + goto return_label; + } + catch ( double not_thrown ) { + __retres = -1; + goto return_label; + } + catch ( ... ) + throw ; return_label: return __retres; } diff --git a/tests/misc/oracle/exception.1.res.oracle b/tests/misc/oracle/exception.1.res.oracle index 1bebfa54d5d1e1a54e48be168ba9cdc536d9dee8..1e08b827e439ad9187b78134a6e8df83010def56 100644 --- a/tests/misc/oracle/exception.1.res.oracle +++ b/tests/misc/oracle/exception.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/exception.i (no preprocessing) /* Generated by Frama-C */ struct my_exn { @@ -160,7 +159,7 @@ int h(int c) tmp = f1(c); if (__fc_exn.exn_uncaught == 1) switch (__fc_exn.exn_kind) case __fc_exn_kind___fc_Smy_exn: - goto __fc_Smy_exn_1; + goto __fc_Smy_exn_1; __retres = tmp; goto return_label; } @@ -179,11 +178,10 @@ int h(int c) } else if (c > 360) { - int tmp_1; - tmp_1 = f3(c); + int x_0 = f3(c); if (__fc_exn.exn_uncaught == 1) switch (__fc_exn.exn_kind) default: goto catch_all; - __retres = tmp_1; + __retres = x_0; goto return_label; } else { @@ -191,7 +189,7 @@ int h(int c) tmp_2 = f4(c); if (__fc_exn.exn_uncaught == 1) switch (__fc_exn.exn_kind) case __fc_exn_kind___fc_Smy_exn2: - goto __fc_Smy_exn2_2; + goto __fc_Smy_exn2_2; __retres = tmp_2; goto return_label; } diff --git a/tests/misc/oracle/filepath.res.oracle b/tests/misc/oracle/filepath.res.oracle index 51cedc444fd060b59a1ffdce07d58533313f4f9a..d4e55cef9b9bac4468324b3b5e95ce5f9632bece 100644 --- a/tests/misc/oracle/filepath.res.oracle +++ b/tests/misc/oracle/filepath.res.oracle @@ -6,5 +6,4 @@ [kernel] normalize(/../tmp/../..): / [kernel] normalize(/tmp/inexistent_directory/..): /tmp [kernel] caught the expected exception -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/filepath.i (no preprocessing) diff --git a/tests/misc/oracle/find_enclosing_loop.res.oracle b/tests/misc/oracle/find_enclosing_loop.res.oracle index d8ca7049acd1dd44a0eaf8207fd7be52fec96f46..7c98f13b60d78ecf5d981dba1a4f96fa8a243fef 100644 --- a/tests/misc/oracle/find_enclosing_loop.res.oracle +++ b/tests/misc/oracle/find_enclosing_loop.res.oracle @@ -1,3 +1,2 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/find_enclosing_loop.c (with preprocessing) [kernel] Script done diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_injector.1.err.oracle b/tests/misc/oracle/global_decl_loc.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_injector.1.err.oracle rename to tests/misc/oracle/global_decl_loc.err.oracle diff --git a/tests/misc/oracle/global_decl_loc.res.oracle b/tests/misc/oracle/global_decl_loc.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..91dcbad389ee7258de2940ef69b8809c8228a4c6 --- /dev/null +++ b/tests/misc/oracle/global_decl_loc.res.oracle @@ -0,0 +1,3 @@ +[kernel] Parsing tests/misc/global_decl_loc.i (no preprocessing) +[kernel] Parsing tests/misc/global_decl_loc2.i (no preprocessing) +[kernel] global variable g declared at tests/misc/global_decl_loc.i:4 diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_rec.err.oracle b/tests/misc/oracle/global_decl_loc2.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_rec.err.oracle rename to tests/misc/oracle/global_decl_loc2.err.oracle diff --git a/tests/misc/oracle/global_decl_loc2.res.oracle b/tests/misc/oracle/global_decl_loc2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..cb0dd4ebc1ed2ac8dc7d06588f966e722cc06704 --- /dev/null +++ b/tests/misc/oracle/global_decl_loc2.res.oracle @@ -0,0 +1,3 @@ +[kernel] Parsing tests/misc/global_decl_loc2.i (no preprocessing) +[kernel] Parsing tests/misc/global_decl_loc.i (no preprocessing) +[kernel] global variable g declared at tests/misc/global_decl_loc.i:4 diff --git a/tests/misc/oracle/init_from_cil.res.oracle b/tests/misc/oracle/init_from_cil.res.oracle index efb9630bb3f8e27583d85356bb2f387239775525..5bd9f1c13dca0915ea3d2e67f4f03f24f3a5cd1e 100644 --- a/tests/misc/oracle/init_from_cil.res.oracle +++ b/tests/misc/oracle/init_from_cil.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/init_from_cil.i (no preprocessing) /* Generated by Frama-C */ int f(int x); diff --git a/tests/misc/oracle/issue109.res.oracle b/tests/misc/oracle/issue109.res.oracle index 13e20e79bc9cb1728a8e732dfd6b39c8bad010b5..fda51a4650a75d65d1e44e296721562382c0aca9 100644 --- a/tests/misc/oracle/issue109.res.oracle +++ b/tests/misc/oracle/issue109.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/issue109.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,7 +12,6 @@ tests/misc/issue109.i:10:[value] assertion got status valid. [value:final-states] Values at end of function main: i ∈ {10} j ∈ {10} -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/issue109.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/misc/oracle/justcopy.res.oracle b/tests/misc/oracle/justcopy.res.oracle index dc45ad7359689b3bdd0791301a4ae8506c9f857a..b65d3b8acfa713b48a141f30a8864c830c0c701e 100644 --- a/tests/misc/oracle/justcopy.res.oracle +++ b/tests/misc/oracle/justcopy.res.oracle @@ -1,2 +1 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/justcopy.i (no preprocessing) diff --git a/tests/misc/oracle/keep_entry_point.res.oracle b/tests/misc/oracle/keep_entry_point.res.oracle index e8f0cd4d42420831062faa7ff3e486d620fd76af..7bfb2ae538299668f02fa071148ce8acdee1baa7 100644 --- a/tests/misc/oracle/keep_entry_point.res.oracle +++ b/tests/misc/oracle/keep_entry_point.res.oracle @@ -1,5 +1,4 @@ [kernel] Do not keep unused static functions -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/keep_entry_point.i (no preprocessing) /* Generated by Frama-C */ static int f(void); @@ -8,11 +7,9 @@ static int x; static int f(void) { int tmp; - { /* sequence */ - tmp = x; - x ++; - ; - } + tmp = x; + x ++; + ; return tmp; } diff --git a/tests/misc/oracle/log-file-feedback.txt b/tests/misc/oracle/log-file-feedback.txt index 1fd84decd6e4736bb7471db5b518ae93639457db..1f78d0689fc71dc13f7c64c15d803904a31ddfe9 100644 --- a/tests/misc/oracle/log-file-feedback.txt +++ b/tests/misc/oracle/log-file-feedback.txt @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/log-file.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/misc/oracle/log-file.0.res.oracle b/tests/misc/oracle/log-file.0.res.oracle index 3e611aa6f4c204824ee72603a684225736c7c9ee..0078627c5be7ffcf82a3a838da4866e725d50511 100644 --- a/tests/misc/oracle/log-file.0.res.oracle +++ b/tests/misc/oracle/log-file.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/log-file.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/misc/oracle/log-file.1.res.oracle b/tests/misc/oracle/log-file.1.res.oracle index 63c4819260c31b4b9038723522c1d5d508d6d989..ed77dbaec76b765d2bfa77b89fb127ad789dabdd 100644 --- a/tests/misc/oracle/log-file.1.res.oracle +++ b/tests/misc/oracle/log-file.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/log-file.i (no preprocessing) [kernel:foo-category] result with dkey [kernel] result diff --git a/tests/misc/oracle/log_twice.res.oracle b/tests/misc/oracle/log_twice.res.oracle index dd0dcca8f8c717e4d5df9c3fdf00f0b23877c408..7df930607eab3c3c392c67b5f122ee5989c07e90 100644 --- a/tests/misc/oracle/log_twice.res.oracle +++ b/tests/misc/oracle/log_twice.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/log_twice.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/misc/oracle/long_ident.res.oracle b/tests/misc/oracle/long_ident.res.oracle index 01758606366850350a08308590873ee76b73df0a..f096b85e19614755f018c95a23088344fe527bc8 100644 --- a/tests/misc/oracle/long_ident.res.oracle +++ b/tests/misc/oracle/long_ident.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/long_ident.c (with preprocessing) /* *********************************** */ /* start of dictionary for obfuscation */ @@ -36,8 +35,7 @@ enum T1 G2; /*@ ensures \valid(\old(f3)); */ void main(int f2, int *f3) { - int V1; - V1 = 0; + int V1 = 0; G2 = E1; F1(f3); return; diff --git a/tests/misc/oracle/m12_2.res.oracle b/tests/misc/oracle/m12_2.res.oracle index 0b2a62c33df6a9b1fca7f0dc5ae0090f8ae65446..5bd22e6672ce0bc5fae5c462e604e5533aa86338 100644 --- a/tests/misc/oracle/m12_2.res.oracle +++ b/tests/misc/oracle/m12_2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/m12_2.i (no preprocessing) tests/misc/m12_2.i:51:[kernel] warning: Unspecified sequence with side effect: /* y <- i */ @@ -21,10 +20,8 @@ tests/misc/m12_2.i:55:[kernel] warning: Unspecified sequence with side effect: tests/misc/m12_2.i:59:[kernel] warning: Unspecified sequence with side effect: /* x <- tmp_1 */ x = 3; - { /* sequence */ - tmp_1 = x; - x ++; - } + tmp_1 = x; + x ++; /* <- x */ tests/misc/m12_2.i:63:[kernel] warning: Unspecified sequence with side effect: @@ -55,11 +52,9 @@ tests/misc/m12_2.i:81:[kernel] warning: Unspecified sequence with side effect: */ if ((3 * 8) * 1) { SI_32 tmp_5; - { /* sequence */ - tmp_5 = i; - i ++; - - } + tmp_5 = i; + i ++; + if (tmp_5) tmp_6 = 1; else tmp_6 = 0; } else tmp_6 = 0; @@ -73,11 +68,9 @@ tests/misc/m12_2.i:85:[kernel] warning: Unspecified sequence with side effect: if ((3 * 8) * 0) tmp_9 = 1; else { SI_32 tmp_8; - { /* sequence */ - tmp_8 = i; - i ++; - - } + tmp_8 = i; + i ++; + if (tmp_8) tmp_9 = 1; else tmp_9 = 0; } /* z <- */ diff --git a/tests/misc/oracle/mergestruct2.res.oracle b/tests/misc/oracle/mergestruct2.res.oracle index 839264ece1add2b99b032d077d3aa2ffd07e8df2..4a903770cb44df6989203820242b120db7cabf34 100644 --- a/tests/misc/oracle/mergestruct2.res.oracle +++ b/tests/misc/oracle/mergestruct2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct2.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct3.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct1.i (no preprocessing) diff --git a/tests/misc/oracle/mergestruct3.0.res.oracle b/tests/misc/oracle/mergestruct3.0.res.oracle index 7b4be6301567b1b04e24f126c3dbb62e645621e1..b48d04264f6582de5b22f9fea09f3142256db9b7 100644 --- a/tests/misc/oracle/mergestruct3.0.res.oracle +++ b/tests/misc/oracle/mergestruct3.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct3.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct1.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct2.i (no preprocessing) diff --git a/tests/misc/oracle/mergestruct3.1.res.oracle b/tests/misc/oracle/mergestruct3.1.res.oracle index 19921275dd6ab292e72b50f7e604d86f88373018..7c599a63bbe751311d6d14cb08a0ac0ed6a76698 100644 --- a/tests/misc/oracle/mergestruct3.1.res.oracle +++ b/tests/misc/oracle/mergestruct3.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct3.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct2.i (no preprocessing) [kernel] Parsing tests/misc/mergestruct1.i (no preprocessing) diff --git a/tests/misc/oracle/my_visitor.res.oracle b/tests/misc/oracle/my_visitor.res.oracle index 014a360baacb02283700c77956c29c62e1fe0d93..dcdcd2818c9db4374e16b0f7d11ff1af34391b71 100644 --- a/tests/misc/oracle/my_visitor.res.oracle +++ b/tests/misc/oracle/my_visitor.res.oracle @@ -9,9 +9,8 @@ int f(void) { int __retres; - int y; /*@ assert emitter2: ∀ ℤ x; x ≡ x; */ - y = 0; + int y = 0; y ++; /*@ assert y ≡ 1; */ /*@ assert emitter2: ∀ ℤ x; x ≡ x; */ diff --git a/tests/misc/oracle/my_visitor_sav.res b/tests/misc/oracle/my_visitor_sav.res index 9b5b5a1da24f33f039b15c0755f0fb691bf68561..e37f52644b9a6b4b4c294d03b132c9f897376cbe 100644 --- a/tests/misc/oracle/my_visitor_sav.res +++ b/tests/misc/oracle/my_visitor_sav.res @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/my_visitor.c (with preprocessing) /* Generated by Frama-C */ int f(void) { int __retres; - int y; - y = 0; + int y = 0; y ++; /*@ assert y ≡ 1; */ ; __retres = 0; @@ -18,9 +16,8 @@ int f(void) int f(void) { int __retres; - int y; /*@ assert emitter2: ∀ ℤ x; x ≡ x; */ - y = 0; + int y = 0; /*@ assert emitter1: ∀ ℤ x; x ≡ x; */ y ++; /*@ assert y ≡ 1; */ @@ -38,9 +35,8 @@ int f(void) int f(void) { int __retres; - int y; /*@ assert emitter2: ∀ ℤ x; x ≡ x; */ - y = 0; + int y = 0; y ++; /*@ assert y ≡ 1; */ /*@ assert emitter2: ∀ ℤ x; x ≡ x; */ diff --git a/tests/misc/oracle/obfuscate.res.oracle b/tests/misc/oracle/obfuscate.res.oracle index 11397a0011a512adf58436021b559a4227f041c9..6ba918f0252ea446c324c85ca1b090a33cff40f6 100644 --- a/tests/misc/oracle/obfuscate.res.oracle +++ b/tests/misc/oracle/obfuscate.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/obfuscate.i (no preprocessing) /* *********************************** */ /* start of dictionary for obfuscation */ @@ -63,8 +62,7 @@ int G1 = 0; int F1(void) { int V2; - enum T1 V1; - V1 = E1; + enum T1 V1 = E1; /*@ assert G1 ≥ E1; */ ; G1 ++; if (! G1) goto L1; diff --git a/tests/misc/oracle/plugin-log-all.txt b/tests/misc/oracle/plugin-log-all.txt index 63c4819260c31b4b9038723522c1d5d508d6d989..ed77dbaec76b765d2bfa77b89fb127ad789dabdd 100644 --- a/tests/misc/oracle/plugin-log-all.txt +++ b/tests/misc/oracle/plugin-log-all.txt @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/log-file.i (no preprocessing) [kernel:foo-category] result with dkey [kernel] result diff --git a/tests/misc/oracle/pragma-pack.0.res.oracle b/tests/misc/oracle/pragma-pack.0.res.oracle index d97cef78eef5e9970d913a56eb9f5d89ea6c3f7c..447559d0d5a8689853612a6c28839f575d2534ce 100644 --- a/tests/misc/oracle/pragma-pack.0.res.oracle +++ b/tests/misc/oracle/pragma-pack.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/pragma-pack.c (with preprocessing) [kernel:cabs2cil:pragma] Pushing fc_stdlib stdint.h [kernel:cabs2cil:pragma] Pushing fc_stdlib __fc_define_intptr_t.h @@ -7,6 +6,8 @@ [kernel:cabs2cil:pragma] Pushing fc_stdlib stddef.h [kernel:cabs2cil:pragma] Pushing fc_stdlib __fc_define_size_t.h [kernel:cabs2cil:pragma] Popping fc_stdlib __fc_define_size_t.h +[kernel:cabs2cil:pragma] Pushing fc_stdlib __fc_define_wchar_t.h +[kernel:cabs2cil:pragma] Popping fc_stdlib __fc_define_wchar_t.h [kernel:cabs2cil:pragma] Popping fc_stdlib stddef.h tests/misc/pragma-pack.c:52:[kernel:cabs2cil:pragma] packing pragma: setting alignment to 8 tests/misc/pragma-pack.c:53:[kernel:cabs2cil:pragma] adding aligned(1) attribute to field 'PACK8.i' due to packing pragma diff --git a/tests/misc/oracle/pragma-pack.1.res.oracle b/tests/misc/oracle/pragma-pack.1.res.oracle index c04018893b57d29894136dfb2490ada75e0a8c44..567b1d23e4b99a8aec366299ba06f16cef7a9cc0 100644 --- a/tests/misc/oracle/pragma-pack.1.res.oracle +++ b/tests/misc/oracle/pragma-pack.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/pragma-pack.c (with preprocessing) tests/misc/pragma-pack.c:87:[kernel] warning: ignoring #pragma pack(pop) with empty stack [value] Analyzing a complete application starting at main diff --git a/tests/misc/oracle/pragma-pack.2.res.oracle b/tests/misc/oracle/pragma-pack.2.res.oracle index 1ba7d95752d55efc6c51dfce83e1d620ff23150c..01e44d93d96cd3ac75f149f0cbb9e2048fe6e906 100644 --- a/tests/misc/oracle/pragma-pack.2.res.oracle +++ b/tests/misc/oracle/pragma-pack.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/pragma-pack.c (with preprocessing) tests/misc/pragma-pack.c:87:[kernel] warning: ignoring #pragma pack(pop) with empty stack [value] Analyzing a complete application starting at main diff --git a/tests/misc/oracle/pragma_pack_zero.0.res.oracle b/tests/misc/oracle/pragma_pack_zero.0.res.oracle index 4fec7e84de3fe73568550193ca9f18c68ba3e92a..615a39ed607520be1c502180085715d01c942397 100644 --- a/tests/misc/oracle/pragma_pack_zero.0.res.oracle +++ b/tests/misc/oracle/pragma_pack_zero.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/pragma_pack_zero.c (with preprocessing) tests/misc/pragma_pack_zero.c:35:[kernel] warning: GCC accepts pack(0) but does not specify its behavior; considering it equivalent to pack() [value] Analyzing a complete application starting at main diff --git a/tests/misc/oracle/pragma_pack_zero.1.res.oracle b/tests/misc/oracle/pragma_pack_zero.1.res.oracle index e603f5a9e84262ff1961015bdc25d0f642791f33..18c2965adf73148718da9cba23a1c893010237b4 100644 --- a/tests/misc/oracle/pragma_pack_zero.1.res.oracle +++ b/tests/misc/oracle/pragma_pack_zero.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/pragma_pack_zero.c (with preprocessing) tests/misc/pragma_pack_zero.c:35:[kernel] warning: ignoring invalid packing alignment (0) [value] Analyzing a complete application starting at main diff --git a/tests/misc/oracle/print_machdep.res.oracle b/tests/misc/oracle/print_machdep.res.oracle index 0d061fc56e8b27d11e68169301f045336939897b..f316dde7bf7872cc7866978b7ac5099c86f40a9d 100644 --- a/tests/misc/oracle/print_machdep.res.oracle +++ b/tests/misc/oracle/print_machdep.res.oracle @@ -14,7 +14,7 @@ Machine: gcc 4.0.3 - X86-32bits mode typeof ptrdiff_t = int char is signed machine is little endian - strings are writable chars + strings are const chars assembly names have no leading '_' compiler has builtin __va_list compiler uses __head as a keyword diff --git a/tests/misc/oracle/remove_status_hyps.res.oracle b/tests/misc/oracle/remove_status_hyps.res.oracle index 6da65a21f522afa3788bcb34656b3778d0f88e3f..a66e3c900e0659d46bedd03a63222d7d396916ff 100644 --- a/tests/misc/oracle/remove_status_hyps.res.oracle +++ b/tests/misc/oracle/remove_status_hyps.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/remove_status_hyps.i (no preprocessing) [rsh] initial statuses [rsh] assert P1: \true;: unknown (hyps: ) diff --git a/tests/misc/oracle/save_comments.res.oracle b/tests/misc/oracle/save_comments.res.oracle index 12f41029a51d2b601bf9d28762597301373a730d..fa8ecc7b92399bcdf1721529af1bad62ab343057 100644 --- a/tests/misc/oracle/save_comments.res.oracle +++ b/tests/misc/oracle/save_comments.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/save_comments.i (no preprocessing) Printing default project first time: /* Generated by Frama-C */ @@ -7,8 +6,7 @@ Printing default project first time: */ int f(void) { - int x; - x = 0; + int x = 0; /* Hello, I'm the f function */ return x; } @@ -21,8 +19,7 @@ Printing default project second time: */ int f(void) { - int x; - x = 0; + int x = 0; /* Hello, I'm the f function */ return x; } @@ -41,8 +38,7 @@ Printing saved project: */ int f(void) { - int x; - x = 0; + int x = 0; /* Hello, I'm the f function */ return x; } diff --git a/tests/misc/oracle/stdint.0.res.oracle b/tests/misc/oracle/stdint.0.res.oracle index 5f3e647e3cb65fba577a1eccfc4546b5d16cfa56..dcdad81cc5fb54c9aac04c87614fb754b4f0d224 100644 --- a/tests/misc/oracle/stdint.0.res.oracle +++ b/tests/misc/oracle/stdint.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/stdint.i (no preprocessing) tests/misc/stdint.i:10:[kernel] warning: bad type 'int' (16 bits) for typedef 'int8_t'; check for mismatch between -machdep flag and headers used diff --git a/tests/misc/oracle/stdint.1.res.oracle b/tests/misc/oracle/stdint.1.res.oracle index 592c42b316000d5404c9c6d3c7a56daaea84afbd..adfb4fa1e5083caeffb5eee8cae07d6eaf97fb22 100644 --- a/tests/misc/oracle/stdint.1.res.oracle +++ b/tests/misc/oracle/stdint.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/stdint.i (no preprocessing) tests/misc/stdint.i:10:[kernel] warning: bad type 'int' (32 bits) for typedef 'int8_t'; check for mismatch between -machdep flag and headers used diff --git a/tests/misc/oracle/stdint.2.res.oracle b/tests/misc/oracle/stdint.2.res.oracle index 592c42b316000d5404c9c6d3c7a56daaea84afbd..adfb4fa1e5083caeffb5eee8cae07d6eaf97fb22 100644 --- a/tests/misc/oracle/stdint.2.res.oracle +++ b/tests/misc/oracle/stdint.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/stdint.i (no preprocessing) tests/misc/stdint.i:10:[kernel] warning: bad type 'int' (32 bits) for typedef 'int8_t'; check for mismatch between -machdep flag and headers used diff --git a/tests/misc/oracle/vis_spec.res.oracle b/tests/misc/oracle/vis_spec.res.oracle index e3fba4817f1fd4ddefe1755df8f03871974111d1..dc63a50b17730d080ab136243357ee538797a178 100644 --- a/tests/misc/oracle/vis_spec.res.oracle +++ b/tests/misc/oracle/vis_spec.res.oracle @@ -1,22 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/vis_spec.i (no preprocessing) Starting visit -Considering spec of function Frama_C_bzero -Function prototype; Funspec is -'requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - assigns *(dest + (0 .. n - 1)); - assigns *(dest + (0 .. n - 1)) \from \nothing;' -Considering spec of function Frama_C_copy_block -Function prototype; Funspec is -'requires \valid(dest + (0 .. size * n - 1)); - requires n ≥ 1; - ensures - ∀ ℤ i, ℤ j; - 0 ≤ i < \old(size) ∧ 1 ≤ j < \old(n) ⇒ - *(\old(dest) + (i + j * \old(size))) ≡ *(\old(dest) + i); - assigns *(dest + (size .. size * n - 1)); - assigns *(dest + (size .. size * n - 1)) \from *(dest + (0 .. size - 1));' Considering spec of function g Function prototype; Funspec is 'assigns \nothing;' Considering spec of function f diff --git a/tests/misc/oracle/visitor_creates_func_bts_1349.res.oracle b/tests/misc/oracle/visitor_creates_func_bts_1349.res.oracle index 6ed7026171eb8845e968f5fa51eff665949f29f7..255cdebea6004350d6ec94fa61c9df9b08b1fe5d 100644 --- a/tests/misc/oracle/visitor_creates_func_bts_1349.res.oracle +++ b/tests/misc/oracle/visitor_creates_func_bts_1349.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/visitor_creates_func_bts_1349.i (no preprocessing) /* Generated by Frama-C */ int a = 10; diff --git a/tests/misc/oracle/well_typed_alarm.res.oracle b/tests/misc/oracle/well_typed_alarm.res.oracle index c2a9b22909109c92179f791f06311a0e16a9bfaf..bb6b105e30586f456345cb81747bc367d921eab1 100644 --- a/tests/misc/oracle/well_typed_alarm.res.oracle +++ b/tests/misc/oracle/well_typed_alarm.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/well_typed_alarm.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,20 +5,15 @@ [value:initial-state] Values of globals at initialization tests/misc/well_typed_alarm.i:11:[value] warning: pointer comparison. assert \pointer_comparable((void *)p, (void *)q); -[value] Recording results for main [value] done for function main /* Generated by Frama-C */ int main(int c) { int __retres; - int x; - int y; - int *p; - int *q; - x = 0; - y = 0; - p = & x; - q = & y; + int x = 0; + int y = 0; + int *p = & x; + int *q = & y; if (c) q = & x; /*@ assert Value: ptr_comparison: \pointer_comparable((void *)p, (void *)q); diff --git a/tests/misc/oracle/widen_hints.0.res.oracle b/tests/misc/oracle/widen_hints.0.res.oracle index cc98f41982eb68f228a87a395b7f632bad950655..c095c8ea8c4c120b4b04199f4e70498f0cdc38b2 100644 --- a/tests/misc/oracle/widen_hints.0.res.oracle +++ b/tests/misc/oracle/widen_hints.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/widen_hints.c (with preprocessing) tests/misc/widen_hints.c:14:[kernel] warning: invalid widen_hints annotation: no hints. Ignoring code annotation tests/misc/widen_hints.c:19:[kernel] warning: invalid widen_hints annotation: no hints. Ignoring code annotation diff --git a/tests/misc/oracle/widen_hints.1.res.oracle b/tests/misc/oracle/widen_hints.1.res.oracle index ea9da7da3cfde02cfc289722004071385061b729..028fc81692c135c8f19d40423902f2d2af74b7f8 100644 --- a/tests/misc/oracle/widen_hints.1.res.oracle +++ b/tests/misc/oracle/widen_hints.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/widen_hints.c (with preprocessing) tests/misc/widen_hints.c:65:[value] user error: could not parse widening hint: local_const If it contains variables, they must be global const integers. diff --git a/tests/misc/oracle/widen_hints.2.res.oracle b/tests/misc/oracle/widen_hints.2.res.oracle index bf909cb2aa7855103e5701e38e3ff3ae2c02e4b0..8cb7ba8ecf345d3a353eceeb45aa91a6c84b2b2b 100644 --- a/tests/misc/oracle/widen_hints.2.res.oracle +++ b/tests/misc/oracle/widen_hints.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/widen_hints.c (with preprocessing) [value:widen-hints] computing global widen hints tests/misc/widen_hints.c:71:[value:widen-hints] adding hint from annotation: a, {87} (for all statements) @@ -9,21 +8,21 @@ tests/misc/widen_hints.c:87:[value:widen-hints] adding hint from annotation: ss, [value:initial-state] Values of globals at initialization x ∈ {9} not_const ∈ {42} -tests/misc/widen_hints.c:72:[value:widen-hints] computing dynamic hints for statement 17 +tests/misc/widen_hints.c:72:[value:widen-hints] computing dynamic hints for statement 16 tests/misc/widen_hints.c:72:[value] entering loop for the first time tests/misc/widen_hints.c:73:[value] entering loop for the first time -tests/misc/widen_hints.c:88:[value:widen-hints] computing dynamic hints for statement 31 +tests/misc/widen_hints.c:88:[value:widen-hints] computing dynamic hints for statement 30 tests/misc/widen_hints.c:88:[value] entering loop for the first time tests/misc/widen_hints.c:89:[value] entering loop for the first time -tests/misc/widen_hints.c:97:[value:widen-hints] computing dynamic hints for statement 50 +tests/misc/widen_hints.c:97:[value:widen-hints] computing dynamic hints for statement 48 tests/misc/widen_hints.c:97:[value:widen-hints] adding new base due to dynamic widen hint: ip, {87} tests/misc/widen_hints.c:97:[value] entering loop for the first time tests/misc/widen_hints.c:98:[value] entering loop for the first time -tests/misc/widen_hints.c:107:[value:widen-hints] computing dynamic hints for statement 71 +tests/misc/widen_hints.c:107:[value:widen-hints] computing dynamic hints for statement 67 tests/misc/widen_hints.c:107:[value:widen-hints] adding new base due to dynamic widen hint: ip2, {87} tests/misc/widen_hints.c:107:[value] entering loop for the first time tests/misc/widen_hints.c:108:[value] entering loop for the first time -tests/misc/widen_hints.c:118:[value:widen-hints] computing dynamic hints for statement 100 +tests/misc/widen_hints.c:118:[value:widen-hints] computing dynamic hints for statement 91 tests/misc/widen_hints.c:118:[value:widen-hints] adding new base due to dynamic widen hint: iarray, {87} tests/misc/widen_hints.c:116:[value] entering loop for the first time tests/misc/widen_hints.c:118:[value] entering loop for the first time diff --git a/tests/misc/oracle/widen_hints.3.res.oracle b/tests/misc/oracle/widen_hints.3.res.oracle index e6fd6b0a2e8318483fc9a67cb0b18544a64243c8..043a67196c8d1709b4ad7616842b50595fe54cd5 100644 --- a/tests/misc/oracle/widen_hints.3.res.oracle +++ b/tests/misc/oracle/widen_hints.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/widen_hints.c (with preprocessing) [value:widen-hints] computing global widen hints tests/misc/widen_hints.c:79:[value:widen-hints] adding global hint from annotation: for all variables, {88} (for all statements) @@ -10,35 +9,35 @@ tests/misc/widen_hints.c:87:[value:widen-hints] adding hint from annotation: ss, [value:initial-state] Values of globals at initialization x ∈ {9} not_const ∈ {42} -tests/misc/widen_hints.c:72:[value:widen-hints] computing dynamic hints for statement 38 +tests/misc/widen_hints.c:72:[value:widen-hints] computing dynamic hints for statement 36 tests/misc/widen_hints.c:72:[value] entering loop for the first time tests/misc/widen_hints.c:73:[value] entering loop for the first time -tests/misc/widen_hints.c:80:[value:widen-hints] computing dynamic hints for statement 52 +tests/misc/widen_hints.c:80:[value:widen-hints] computing dynamic hints for statement 50 [value] computing for function f <- main. Called from tests/misc/widen_hints.c:80. tests/misc/widen_hints.c:41:[value] entering loop for the first time tests/misc/widen_hints.c:42:[value] entering loop for the first time [value] Recording results for f [value] Done for function f -tests/misc/widen_hints.c:88:[value:widen-hints] computing dynamic hints for statement 54 +tests/misc/widen_hints.c:88:[value:widen-hints] computing dynamic hints for statement 52 tests/misc/widen_hints.c:88:[value] entering loop for the first time tests/misc/widen_hints.c:89:[value] entering loop for the first time -tests/misc/widen_hints.c:97:[value:widen-hints] computing dynamic hints for statement 73 +tests/misc/widen_hints.c:97:[value:widen-hints] computing dynamic hints for statement 70 tests/misc/widen_hints.c:97:[value:widen-hints] adding new base due to dynamic widen hint: ip, {87} tests/misc/widen_hints.c:97:[value] entering loop for the first time tests/misc/widen_hints.c:98:[value] entering loop for the first time -tests/misc/widen_hints.c:107:[value:widen-hints] computing dynamic hints for statement 94 +tests/misc/widen_hints.c:107:[value:widen-hints] computing dynamic hints for statement 89 tests/misc/widen_hints.c:107:[value:widen-hints] adding new base due to dynamic widen hint: ip2, {87} tests/misc/widen_hints.c:107:[value] entering loop for the first time tests/misc/widen_hints.c:108:[value] entering loop for the first time tests/misc/widen_hints.c:116:[value] entering loop for the first time -tests/misc/widen_hints.c:118:[value:widen-hints] computing dynamic hints for statement 123 +tests/misc/widen_hints.c:118:[value:widen-hints] computing dynamic hints for statement 113 tests/misc/widen_hints.c:118:[value:widen-hints] adding new base due to dynamic widen hint: iarray, {87} tests/misc/widen_hints.c:118:[value] entering loop for the first time tests/misc/widen_hints.c:123:[value] entering loop for the first time [value] computing for function using_dynamic_global <- main. Called from tests/misc/widen_hints.c:124. -tests/misc/widen_hints.c:58:[value:widen-hints] computing dynamic hints for statement 23 +tests/misc/widen_hints.c:58:[value:widen-hints] computing dynamic hints for statement 22 tests/misc/widen_hints.c:58:[value:widen-hints] adding new base due to dynamic widen hint: outer_i, {87} tests/misc/widen_hints.c:58:[value] entering loop for the first time [value] Recording results for using_dynamic_global diff --git a/tests/misc/oracle/widen_hints2.0.res.oracle b/tests/misc/oracle/widen_hints2.0.res.oracle index 1275d8fa4d30097af6c03341fe13448e3048b69f..86ed3d7e89495fcf518dba537487b1105631fabe 100644 --- a/tests/misc/oracle/widen_hints2.0.res.oracle +++ b/tests/misc/oracle/widen_hints2.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/widen_hints2.c (with preprocessing) [value:widen-hints] computing global widen hints tests/misc/widen_hints2.c:47:[value:widen-hints] adding global hint from annotation: m, {2} (for all statements) @@ -15,33 +14,33 @@ tests/misc/widen_hints2.c:79:[value:widen-hints] adding hint from annotation: gl [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] t[0..99] ∈ {0} x ∈ {9} glob ∈ {0} y ∈ {0} -tests/misc/widen_hints2.c:49:[value:widen-hints] computing dynamic hints for statement 46 -tests/misc/widen_hints2.c:51:[value:widen-hints] computing dynamic hints for statement 51 +tests/misc/widen_hints2.c:49:[value:widen-hints] computing dynamic hints for statement 44 +tests/misc/widen_hints2.c:51:[value:widen-hints] computing dynamic hints for statement 47 tests/misc/widen_hints2.c:51:[value] entering loop for the first time -tests/misc/widen_hints2.c:53:[value:widen-hints] computing dynamic hints for statement 57 +tests/misc/widen_hints2.c:53:[value:widen-hints] computing dynamic hints for statement 53 tests/misc/widen_hints2.c:53:[value] entering loop for the first time -tests/misc/widen_hints2.c:64:[value:widen-hints] computing dynamic hints for statement 69 +tests/misc/widen_hints2.c:64:[value:widen-hints] computing dynamic hints for statement 65 tests/misc/widen_hints2.c:64:[value] entering loop for the first time tests/misc/widen_hints2.c:65:[value] entering loop for the first time -tests/misc/widen_hints2.c:73:[value:widen-hints] computing dynamic hints for statement 85 +tests/misc/widen_hints2.c:73:[value:widen-hints] computing dynamic hints for statement 81 tests/misc/widen_hints2.c:73:[value] entering loop for the first time tests/misc/widen_hints2.c:74:[value] entering loop for the first time -tests/misc/widen_hints2.c:80:[value:widen-hints] computing dynamic hints for statement 100 +tests/misc/widen_hints2.c:80:[value:widen-hints] computing dynamic hints for statement 96 tests/misc/widen_hints2.c:80:[value] entering loop for the first time tests/misc/widen_hints2.c:81:[value] entering loop for the first time [value] computing for function f <- main. Called from tests/misc/widen_hints2.c:86. -tests/misc/widen_hints2.c:22:[value:widen-hints] computing dynamic hints for statement 5 +tests/misc/widen_hints2.c:22:[value:widen-hints] computing dynamic hints for statement 4 tests/misc/widen_hints2.c:22:[value] entering loop for the first time tests/misc/widen_hints2.c:23:[value] entering loop for the first time [value] Recording results for f diff --git a/tests/misc/oracle/widen_hints2.1.res.oracle b/tests/misc/oracle/widen_hints2.1.res.oracle index 7a3acfeb77f2db047f738c138239dad849742383..df62b5adbac8228b7cb0462324341a37be927460 100644 --- a/tests/misc/oracle/widen_hints2.1.res.oracle +++ b/tests/misc/oracle/widen_hints2.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/widen_hints2.c (with preprocessing) /* Generated by Frama-C */ #include "stdlib.h" @@ -8,18 +7,14 @@ int glob; void f(void) { int tf[100]; - int m; - int n; - m = 10; - n = 33 + m; + int m = 10; + int n = 33 + m; /*@ widen_hints "all", 88; */ { - int a; - a = 0; + int a = 0; while (a < n * 2 + 1) { { - int b; - b = 0; + int b = 0; while (b < a) { tf[b] = 1; b ++; @@ -34,17 +29,13 @@ void f(void) void g(void) { int tg[100]; - int m; - int n; - m = 10; - n = 33 + m; + int m = 10; + int n = 33 + m; { - int ll; - ll = 0; + int ll = 0; while (ll < n * 2 + 1) { { - int kk; - kk = 0; + int kk = 0; while (kk < ll) { tg[kk] = 1; kk ++; @@ -61,83 +52,74 @@ int main(void) { int __retres; int y_0; - int m; - int n; - m = 10; + int m = 10; /*@ widen_hints global:m, 2; widen_hints y_0, 5; */ - n = 33 + m; - { - int a; - a = 0; - /*@ loop widen_hints a, 2; */ - while (a < n * 2 + 1) { - /*@ widen_hints a, 88; */ - { - int b; - b = 0; - while (b < a) { - t[b] = 1; - b ++; - } + int n = 33 + m; + { + int a = 0; + /*@ loop widen_hints a, 2; */ + while (a < n * 2 + 1) { + /*@ widen_hints a, 88; */ + { + int b = 0; + while (b < a) { + t[b] = 1; + b ++; } - a ++; } + a ++; } - { - int c; - c = 0; - /*@ loop widen_hints c, 88; - loop widen_hints y_0, 1; - loop widen_hints global:y_0, 2; - */ - while (c < n * 2 + 1) { - { - int d; - d = 0; - while (d < c) { - t[d] = 1; - d ++; - } + } + { + int c = 0; + /*@ loop widen_hints c, 88; + loop widen_hints y_0, 1; + loop widen_hints global:y_0, 2; + */ + while (c < n * 2 + 1) { + { + int d = 0; + while (d < c) { + t[d] = 1; + d ++; } - c ++; } + c ++; } + } + { + int c_0 = 0; + /*@ loop widen_hints c_0, 88; */ + while (c_0 < n * 2 + 1) { { - int c_0; - c_0 = 0; - /*@ loop widen_hints c_0, 88; */ - while (c_0 < n * 2 + 1) { - { - int d_0; - d_0 = 0; - while (d_0 < c_0) { - t[d_0] = 1; - d_0 ++; - } - } - c_0 ++; + int d_0 = 0; + while (d_0 < c_0) { + t[d_0] = 1; + d_0 ++; } } - /*@ widen_hints glob, 88; */ + c_0 ++; + } + } + /*@ widen_hints glob, 88; */ + { + glob = 0; + while (glob < n * 2 + 1) { { - glob = 0; - while (glob < n * 2 + 1) { - { - int j; - j = 0; - while (j < glob) { - t[j] = 1; - j ++; - } - } - glob ++; + int j = 0; + while (j < glob) { + t[j] = 1; + j ++; } } - f(); - g(); - __retres = 0; - return __retres; + glob ++; } + } + f(); + g(); + __retres = 0; + return __retres; +} diff --git a/tests/misc/oracle/wstring_phase6.res.oracle b/tests/misc/oracle/wstring_phase6.res.oracle index 21ce9c980cfe91595f8b4e9ba22bc2e5cb202522..908098b8708f4222ee167b00d2e24db3b2a456ae 100644 --- a/tests/misc/oracle/wstring_phase6.res.oracle +++ b/tests/misc/oracle/wstring_phase6.res.oracle @@ -1,10 +1,32 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/misc/wstring_phase6.i (no preprocessing) -[kernel] syntax error at tests/misc/wstring_phase6.i:9: - 7 printf( "%s\n", "123" "456" ); - 8 printf( "%ls\n", L"123" L"456" ); - 9 printf( "%ls\n", "123" L"456" ); - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 10 printf( "%ls\n", L"123" "456" ); - 11 printf( "%ls\n", L"123" L"456" ); -[kernel] Frama-C aborted: invalid user input. +tests/misc/wstring_phase6.i:8:[kernel] warning: Calling undeclared function printf. Old style K&R code? +[kernel] Constant "%s\n" location: Start line 8, char 8; End line 8, char 14 +[kernel] Constant "123456" location: Start line 8, char 16; End line 8, char 27 +[kernel] Constant "%ls\n" location: Start line 9, char 8; End line 9, char 15 +[kernel] Constant L"1" "2" "3" "4" "5" "6" + location: Start line 9, char 17; End line 9, char 30 +[kernel] Constant "%ls\n" location: Start line 10, char 8; End line 10, char 15 +[kernel] Constant L"1" "2" "3" "4" "5" "6" + location: Start line 10, char 17; End line 10, char 29 +[kernel] Constant "%ls\n" location: Start line 11, char 8; End line 11, char 15 +[kernel] Constant L"1" "2" "3" "4" "5" "6" + location: Start line 11, char 17; End line 11, char 29 +[kernel] Constant "%ls\n" location: Start line 12, char 8; End line 12, char 15 +[kernel] Constant L"1" "2" "3" "4" "5" "6" + location: Start line 12, char 17; End line 12, char 30 +/* Generated by Frama-C */ +extern int ( /* missing proto */ printf)(char const *x_0, char const *x_1); + +int main(void) +{ + int __retres; + printf("%s\n","123456"); + printf("%ls\n",(char const *)L"1" "2" "3" "4" "5" "6" ); + printf("%ls\n",(char const *)L"1" "2" "3" "4" "5" "6" ); + printf("%ls\n",(char const *)L"1" "2" "3" "4" "5" "6" ); + printf("%ls\n",(char const *)L"1" "2" "3" "4" "5" "6" ); + __retres = 0; + return __retres; +} + + diff --git a/tests/misc/remove_status_hyps.i b/tests/misc/remove_status_hyps.i index 49b7c024a77ce9753b858a935d71157dbe4d553b..65348944a6d4a5ede92bee270d3aa2c8352a3070 100644 --- a/tests/misc/remove_status_hyps.i +++ b/tests/misc/remove_status_hyps.i @@ -1,7 +1,3 @@ -/* run.config_no_native_dynlink - CMD: bin/toplevel.byte - OPT: -load-script tests/misc/remove_status_hyps.ml -*/ /* run.config OPT: -load-script tests/misc/remove_status_hyps.ml */ diff --git a/tests/misc/test_config b/tests/misc/test_config new file mode 100644 index 0000000000000000000000000000000000000000..49f38b4a622efe9bb126ca0450ad800d06fde62d --- /dev/null +++ b/tests/misc/test_config @@ -0,0 +1 @@ +EXECNOW: make -s @PTEST_DIR@/global_decl_loc.cmxs diff --git a/tests/misc/widen_hints.c b/tests/misc/widen_hints.c index 37ed073589b7b9db854258967086992547d30ed5..584a607bfc7e7f4b6ab113edc2e3147cc5814de4 100644 --- a/tests/misc/widen_hints.c +++ b/tests/misc/widen_hints.c @@ -1,8 +1,8 @@ /* run.config - OPT: -val -cpp-extra-args=-DSYNTAX_ERRORS -continue-annot-error - OPT: -val -cpp-extra-args=-DNONCONST - OPT: -val -slevel 1 -value-msg-key widen-hints - OPT: -val -cpp-extra-args=-DALLGLOBAL -value-msg-key widen-hints + OPT: -val -val-show-progress -cpp-extra-args=-DSYNTAX_ERRORS -continue-annot-error + OPT: -val -val-show-progress -cpp-extra-args=-DNONCONST + OPT: -val -val-show-progress -slevel 1 -value-msg-key widen-hints + OPT: -val -val-show-progress -cpp-extra-args=-DALLGLOBAL -value-msg-key widen-hints */ #define N 2 diff --git a/tests/misc/wstring_phase6.i b/tests/misc/wstring_phase6.i index ec125df4475fe6818cee62e1f5bbe3f985600425..f13106281301dc2a7ee7c43269d8dd6cda9749fb 100644 --- a/tests/misc/wstring_phase6.i +++ b/tests/misc/wstring_phase6.i @@ -1,5 +1,6 @@ /* run.config - OPT: -journal-disable -print + EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs + OPT: -journal-disable -print -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs */ // See http://stackoverflow.com/questions/18102502/mixing-wide-and-narrow-string-literals-in-c diff --git a/tests/misc/wstring_phase6.ml b/tests/misc/wstring_phase6.ml new file mode 100644 index 0000000000000000000000000000000000000000..cdbf929d653c22ec805135ffb071133bd2f47f3c --- /dev/null +++ b/tests/misc/wstring_phase6.ml @@ -0,0 +1,22 @@ +open Cil_types + +let print_loc fmt (b,e) = + let open Lexing in + Format.fprintf fmt "Start line %d, char %d; End line %d, char %d" + b.pos_lnum (b.pos_cnum - b.pos_bol) e.pos_lnum (e.pos_cnum - e.pos_bol) + +class vis = +object + inherit Visitor.frama_c_inplace + method! vexpr e = + (match e.enode with + | Const (CStr _ | CWStr _ as c) -> + Kernel.result "Constant %a location: %a" + Printer.pp_constant c print_loc e.eloc + | _ -> ()); + Cil.DoChildren +end + +let do_it () = Visitor.visitFramacFileSameGlobals (new vis) (Ast.get()) + +let () = Db.Main.extend do_it diff --git a/tests/non-free/Longinit_sequencer.i b/tests/non-free/Longinit_sequencer.i index 67c8cd916a2d2206dcc426870d05e17fd8ac38ba..c56bece9005ecbf64a44b88a1e8145fc033ded96 100644 --- a/tests/non-free/Longinit_sequencer.i +++ b/tests/non-free/Longinit_sequencer.i @@ -1,4 +1,4 @@ /* run.config* EXECNOW: make tests/non-free/Longinit_sequencer.cmxs -OPT: -load-module tests/non-free/Longinit_sequencer.cmxs -res-file @PTEST_RESULT@ +OPT: -load-module tests/non-free/Longinit_sequencer.cmxs -val-show-progress -res-file @PTEST_RESULT@ */ diff --git a/tests/non-free/Longinit_sequencer.ml b/tests/non-free/Longinit_sequencer.ml index cc44bc84d967e7a3812e5c892da06f0acdb97d47..71a9289cdefd81d53dafc69a3dc4a8ba095d2b6c 100644 --- a/tests/non-free/Longinit_sequencer.ml +++ b/tests/non-free/Longinit_sequencer.ml @@ -35,8 +35,9 @@ let main () = let display_results state = Format.fprintf fmt "@[%a@]@\n" !Db.Value.display state in Dynamic.Parameter.String.set "" "tests/non-free/long_init.c"; Dynamic.Parameter.String.set "-val-save-fun-state" ("init_inner:" ^ tmpfile); - Dynamic.Parameter.String.set "-val-builtin" "malloc:Frama_C_alloc_size,free:Frama_C_free"; + Dynamic.Parameter.String.set "-val-builtin" "malloc:Frama_C_malloc_fresh"; Dynamic.Parameter.Bool.set "-val-malloc-returns-null" false; + Dynamic.Parameter.Bool.set "-val-warn-builtin-override" false; !Db.Value.compute (); Callgraph.Uses.iter_in_rev_order display_results; Files.clear (); @@ -48,7 +49,7 @@ let main () = Dynamic.Parameter.String.set "-val-load-fun-state" ("init_inner:" ^ tmpfile); (* set builtins in a different order to force kernel to recompute kernel function IDs *) - Dynamic.Parameter.String.set "-val-builtin" "free:Frama_C_free,malloc:Frama_C_alloc_size"; + Dynamic.Parameter.String.set "-val-builtin" "malloc:Frama_C_malloc_fresh"; !Db.Value.compute (); Callgraph.Uses.iter_in_rev_order display_results; Files.clear (); @@ -58,7 +59,7 @@ let main () = Dynamic.Parameter.String.set "-val-load-fun-state" ("init_outer:" ^ tmpfile); (* set builtins in a different order to force kernel to recompute kernel function IDs *) - Dynamic.Parameter.String.set "-val-builtin" "malloc:Frama_C_alloc_size,free:Frama_C_free"; + Dynamic.Parameter.String.set "-val-builtin" "malloc:Frama_C_malloc_fresh"; !Db.Value.compute (); Callgraph.Uses.iter_in_rev_order display_results; ok:=true (* no error, we can erase the file *) diff --git a/tests/non-free/alloc.c b/tests/non-free/alloc.c index 33c04a3c935247890650f97d60d084b1495002fa..2d54d769867864bb180f5ad3790830329a3c0569 100644 --- a/tests/non-free/alloc.c +++ b/tests/non-free/alloc.c @@ -1,7 +1,7 @@ /* run.config* GCC: - STDOPT: - STDOPT: #"-absolute-valid-range 0x100-0x200 -main main_abs" + STDOPT: #"-no-val-builtins-auto" + STDOPT: #"-no-val-builtins-auto -absolute-valid-range 0x100-0x200 -main main_abs" */ #define FRAMA_C_MALLOC_INDIVIDUAL diff --git a/tests/non-free/alloc_weak.c b/tests/non-free/alloc_weak.c index 781ee320927b0936e8fbf6cacb0fb201851c3193..090cdc0309c4d49532076b0c1fc99f3e04d9e9e6 100644 --- a/tests/non-free/alloc_weak.c +++ b/tests/non-free/alloc_weak.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-val-builtin memcpy:Frama_C_memcpy,malloc:Frama_C_alloc_by_stack" + STDOPT: #"-val-builtin memcpy:Frama_C_memcpy,malloc:Frama_C_malloc_by_stack" */ #include <stdlib.h> diff --git a/tests/non-free/allocated.c b/tests/non-free/allocated.c index 818f475fdc7bcfd3371fef5d74c545b36ccd7473..f408e5f6c68fe2163129e2015c452357105eeff4 100644 --- a/tests/non-free/allocated.c +++ b/tests/non-free/allocated.c @@ -1,6 +1,6 @@ /* run.config* - STDOPT: +"-slevel 1 -val-builtin malloc:Frama_C_alloc_by_stack,free:Frama_C_free -val-mlevel 0" - STDOPT: +"-slevel 999 -val-builtin malloc:Frama_C_alloc_size,free:Frama_C_free" + STDOPT: +"-slevel 1 -val-mlevel 0" + STDOPT: +"-slevel 999 -val-builtin malloc:Frama_C_malloc_fresh,__fc_vla_alloc:Frama_C_malloc_fresh,__fc_vla_free:Frama_C_vla_free" */ #define assert_bottom(exp) if (nondet) {exp; Frama_C_show_each_unreachable();} @@ -123,6 +123,12 @@ int main() { Frama_C_show_each(pb->i1); // Alarm } free (p); - + for (i = 0; i < 10; i++) { + int a[i+1]; + for (j = 0; j <=i; j++) { + a[j] = j; + } + Frama_C_show_each(a[i]); + } return 0; } diff --git a/tests/non-free/big_local_array.i b/tests/non-free/big_local_array.i index c3385491aeaa42db4b796487b2c628f5535789f9..9240946948a46b31edf9379153ac7fbfa5efebb3 100644 --- a/tests/non-free/big_local_array.i +++ b/tests/non-free/big_local_array.i @@ -1,7 +1,7 @@ /* run.config* -OPT: -print -journal-disable -val -report +OPT: -val-show-progress -print -journal-disable -val -report OPT: -load-script tests/non-free/big_local_array_script.ml -then-on prj -print -report -OPT: -print -journal-disable -no-initialized-padding-locals -val +OPT: -val-show-progress -print -journal-disable -no-initialized-padding-locals -val */ struct S { diff --git a/tests/non-free/calloc.c b/tests/non-free/calloc.c new file mode 100644 index 0000000000000000000000000000000000000000..65de934ec6af98d7f2c00467fdb14cdf532043a0 --- /dev/null +++ b/tests/non-free/calloc.c @@ -0,0 +1,39 @@ +/* run.config* + STDOPT: #"-no-val-builtins-auto -val-malloc-returns-null" + STDOPT: #"-no-val-builtins-auto -val-malloc-returns-null -val-builtin calloc:Frama_C_calloc_fresh" + STDOPT: #"-no-val-builtins-auto -val-malloc-returns-null -val-builtin calloc:Frama_C_calloc_by_stack" + STDOPT: #"-no-val-builtins-auto -no-val-malloc-returns-null -val-builtin calloc:Frama_C_calloc_fresh" + STDOPT: #"-no-val-builtins-auto -no-val-malloc-returns-null -val-builtin calloc:Frama_C_calloc_by_stack" + */ + +#include <stdlib.h> +#include <stdint.h> + +volatile int nondet; +int main() { + char *p1 = calloc(0, 0); + if (!p1) return 1; + + char *p2 = calloc(1, 0); + if (!p2) return 1; + + char *p3 = calloc(0, 1); + if (!p3) return 1; + + char *p4 = calloc(1, 1); + if (!p4) return 1; + //@ assert \valid(p4); + //@ assert *p4 == 0; + + int *p5 = calloc(1024, sizeof(int)); + if (!p5) return 1; + //@ assert \valid(p5+(0..1023)); + //@ assert *p5 == 0; + //@ assert p5[1023] == 0; + + char *p9001 = calloc(SIZE_MAX - 1, 2); + if (p9001) return 1; + //@ assert p9001 == \null; + + return 0; +} diff --git a/tests/non-free/diff_apron b/tests/non-free/diff_apron index d7db9ccf226b19c20ea30300dfc8f1841df7ccbf..e554eed4837f6c9b6094d74ccb025e0a1c62dc35 100644 --- a/tests/non-free/diff_apron +++ b/tests/non-free/diff_apron @@ -1,11 +1,26 @@ diff tests/non-free/oracle/Longinit_sequencer.res.oracle tests/non-free/oracle_apron/Longinit_sequencer.res.oracle -381c381 +373c373 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_apron/Longinit_sequencer.sav -621c621 +608c608 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_apron/Longinit_sequencer.sav -Only in tests/non-free/oracle: loopalloc.err.oracle -Only in tests/non-free/oracle: loopalloc.res.oracle +diff tests/non-free/oracle/allocated.0.res.oracle tests/non-free/oracle_apron/allocated.0.res.oracle +120c120 +< tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1; 2; 3; 4} +--- +> tests/non-free/allocated.c:131:[value] Frama_C_show_each: [0..2147483647] +123c123 +< tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1; 2; 3; 4; 5} +--- +> tests/non-free/allocated.c:131:[value] Frama_C_show_each: [0..2147483647] +126c126 +< tests/non-free/allocated.c:131:[value] Frama_C_show_each: [0..9] +--- +> tests/non-free/allocated.c:131:[value] Frama_C_show_each: [0..2147483647] +138c138 +< j ∈ [1..2147483647] +--- +> j ∈ [1..10] diff --git a/tests/non-free/diff_bitwise b/tests/non-free/diff_bitwise index fda059fd0937712fc941858cac288552bffceb20..1e646b1d9fab44f6d1338ead7f4e5033c00a6878 100644 --- a/tests/non-free/diff_bitwise +++ b/tests/non-free/diff_bitwise @@ -1,11 +1,9 @@ diff tests/non-free/oracle/Longinit_sequencer.res.oracle tests/non-free/oracle_bitwise/Longinit_sequencer.res.oracle -381c381 +373c373 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_bitwise/Longinit_sequencer.sav -621c621 +608c608 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_bitwise/Longinit_sequencer.sav -Only in tests/non-free/oracle: loopalloc.err.oracle -Only in tests/non-free/oracle: loopalloc.res.oracle diff --git a/tests/non-free/diff_equalities b/tests/non-free/diff_equalities index 31039f252bd3005c67d3cbccb7338fa3236b12df..794764d6e9543e90097bbe663f52908253f26296 100644 --- a/tests/non-free/diff_equalities +++ b/tests/non-free/diff_equalities @@ -1,286 +1,288 @@ diff tests/non-free/oracle/Longinit_sequencer.res.oracle tests/non-free/oracle_equalities/Longinit_sequencer.res.oracle -381c381 +373c373 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_equalities/Longinit_sequencer.sav -621c621 +608c608 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_equalities/Longinit_sequencer.sav diff tests/non-free/oracle/alloc_weak.res.oracle tests/non-free/oracle_equalities/alloc_weak.res.oracle -30d29 +29d28 < tests/non-free/alloc_weak.c:30:[value] warning: accessing uninitialized left-value. assert \initialized(p); -864c863 +863c862 < r ∈ [--..--] --- > r ∈ {42} diff tests/non-free/oracle/imprecise.res.oracle tests/non-free/oracle_equalities/imprecise.res.oracle -203a204 +198a199 > tests/non-free/imprecise.c:110:[kernel] more than 200(300) elements to enumerate. Approximating. -208a210 +203a205 > tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate. Approximating. -284,285d285 +206,207d207 < tests/non-free/imprecise.c:110:[kernel] more than 200(300) elements to enumerate. Approximating. < tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate. Approximating. -diff tests/non-free/oracle/linked_list.0.res.oracle tests/non-free/oracle_equalities/linked_list.0.res.oracle -288a289 -> tests/non-free/linked_list.c:19:[kernel] more than 200(536870912) elements to enumerate. Approximating. diff tests/non-free/oracle/linked_list.1.res.oracle tests/non-free/oracle_equalities/linked_list.1.res.oracle -289a290 -> tests/non-free/linked_list.c:19:[kernel] more than 100(0x20000000) elements to enumerate. Approximating. -322a324 +333a334 > tests/non-free/linked_list.c:43:[kernel] more than 100(128) elements to enumerate. Approximating. -323a326 +334a336 > tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerate. Approximating. -386,387d388 +394,395d395 < tests/non-free/linked_list.c:43:[kernel] more than 100(128) elements to enumerate. Approximating. < tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerate. Approximating. -Only in tests/non-free/oracle: loopalloc.err.oracle -Only in tests/non-free/oracle: loopalloc.res.oracle diff tests/non-free/oracle/malloc-optimistic.res.oracle tests/non-free/oracle_equalities/malloc-optimistic.res.oracle -359d358 +380d379 < tests/non-free/malloc-optimistic.c:79:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -377c376 +400c399 < k ∈ {-2; -1} --- > k ∈ {-1} -404c403 +429c428 < k ∈ {-1; 0} --- > k ∈ {0} -433c432 +460c459 < k ∈ {0; 1} --- > k ∈ {1} -464c463 +493c492 < k ∈ {1; 2} --- > k ∈ {2} -497c496 +528c527 < k ∈ {2; 3} --- > k ∈ {3} -532c531 +565c564 < k ∈ {3; 4} --- > k ∈ {4} -569c568 +604c603 < k ∈ {4; 5} --- > k ∈ {5} -608c607 +645c644 < k ∈ {5; 6} --- > k ∈ {6} -649c648 +688c687 < k ∈ {6; 7} --- > k ∈ {7} -1391d1389 +1460d1458 < tests/non-free/malloc-optimistic.c:92:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -1542d1539 +1617d1614 < tests/non-free/malloc-optimistic.c:105:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -1571c1568 +1648c1645 < k ∈ {-2; -1} --- > k ∈ {-1} -1620c1617 +1699c1696 < k ∈ {-1; 0} --- > k ∈ {0} -1671c1668 +1752c1749 < k ∈ {0; 1} --- > k ∈ {1} -1724c1721 +1807c1804 < k ∈ {1; 2} --- > k ∈ {2} -1779c1776 +1864c1861 < k ∈ {2; 3} --- > k ∈ {3} -1836c1833 +1923c1920 < k ∈ {3; 4} --- > k ∈ {4} -1895c1892 +1984c1981 < k ∈ {4; 5} --- > k ∈ {5} -1956c1953 +2047c2044 < k ∈ {5; 6} --- > k ∈ {6} -2019c2016 +2112c2109 < k ∈ {6; 7} --- > k ∈ {7} -2084c2081 +2179c2176 < k ∈ {7; 8} --- > k ∈ {8} -2151c2148 +2248c2245 < k ∈ {8; 9} --- > k ∈ {9} -2220c2217 +2319c2316 < k ∈ {9; 10} --- > k ∈ {10} -2291c2288 +2392c2389 < k ∈ {10; 11} --- > k ∈ {11} -2364c2361 +2467c2464 < k ∈ {11; 12} --- > k ∈ {12} -2402c2399 +2506c2503 < k ∈ {12; 13} --- > k ∈ {13} -2441c2438 +2546c2543 < k ∈ {12; 13; 14} --- > k ∈ {13; 14} -2480c2477 +2586c2583 < k ∈ {12; 13; 14; 15} --- > k ∈ {13; 14; 15} -2519c2516 +2626c2623 < k ∈ [12..97] --- > k ∈ [13..97] -2566c2563 -< [value] Called Frama_C_show_each({-20; 1}) +2673c2670 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1} --- -> [value] Called Frama_C_show_each({1}) -2572c2569 -< [value] Called Frama_C_show_each({-20; 1; 2}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {1} +2679c2676 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2} --- -> [value] Called Frama_C_show_each({2}) -2578c2575 -< [value] Called Frama_C_show_each({-20; 1; 2; 3}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {2} +2685c2682 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3} --- -> [value] Called Frama_C_show_each({3}) -2584c2581 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {3} +2691c2688 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4} --- -> [value] Called Frama_C_show_each({4}) -2590c2587 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {4} +2697c2694 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5} --- -> [value] Called Frama_C_show_each({5}) -2596c2593 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5; 6}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {5} +2703c2700 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5; 6} --- -> [value] Called Frama_C_show_each({6}) -2602c2599 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5; 6; 7}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {6} +2709c2706 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5; 6; 7} --- -> [value] Called Frama_C_show_each({7}) -2608c2605 -< [value] Called Frama_C_show_each([-20..8]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {7} +2715c2712 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..8] --- -> [value] Called Frama_C_show_each({8}) -2614c2611 -< [value] Called Frama_C_show_each([-20..9]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {8} +2721c2718 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..9] --- -> [value] Called Frama_C_show_each({9}) -2620c2617 -< [value] Called Frama_C_show_each([-20..10]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {9} +2727c2724 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..10] --- -> [value] Called Frama_C_show_each({10}) -2626c2623 -< [value] Called Frama_C_show_each([-20..11]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {10} +2733c2730 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..11] +--- +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {11} +2739c2736 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..12] +--- +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {12} +2745c2742 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..13] --- -> [value] Called Frama_C_show_each({11}) -2632c2629 -< [value] Called Frama_C_show_each([-20..12]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {13} +2751c2748 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..14] --- -> [value] Called Frama_C_show_each({12}) -2638c2635 -< [value] Called Frama_C_show_each([-20..13]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {14} +2757c2754 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..15] --- -> [value] Called Frama_C_show_each({13}) -2644c2641 -< [value] Called Frama_C_show_each([-20..14]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {15} +2763c2760 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..16] --- -> [value] Called Frama_C_show_each({14}) -2650c2647 -< [value] Called Frama_C_show_each([-20..15]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {16} +2769c2766 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..17] --- -> [value] Called Frama_C_show_each({15}) -2656c2653 -< [value] Called Frama_C_show_each([-20..16]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {17} +2775c2772 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..18] --- -> [value] Called Frama_C_show_each({16}) -2662c2659 -< [value] Called Frama_C_show_each([-20..17]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {18} +2781c2778 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..19] --- -> [value] Called Frama_C_show_each({17}) -2668c2665 -< [value] Called Frama_C_show_each([-20..18]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {19} +2787c2784 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..20] --- -> [value] Called Frama_C_show_each({18}) -2674c2671 -< [value] Called Frama_C_show_each([-20..19]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {20} +2793c2790 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..21] --- -> [value] Called Frama_C_show_each({19}) -2680c2677 -< [value] Called Frama_C_show_each([-20..20]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {21} +2799c2796 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..22] --- -> [value] Called Frama_C_show_each({20}) -2686c2683 -< [value] Called Frama_C_show_each([-20..21]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {22} +2805c2802 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..23] --- -> [value] Called Frama_C_show_each({21}) -2692c2689 -< [value] Called Frama_C_show_each([-20..22]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {23} +2811c2808 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..24] --- -> [value] Called Frama_C_show_each({22}) -2698c2695 -< [value] Called Frama_C_show_each([-20..23]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {24} +2817c2814 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..25] --- -> [value] Called Frama_C_show_each({23}) -2704c2701 -< [value] Called Frama_C_show_each([-20..24]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {25} +2823c2820 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..26] --- -> [value] Called Frama_C_show_each({24}) -2710c2707 -< [value] Called Frama_C_show_each([-20..25]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {26} +2829c2826 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..27] --- -> [value] Called Frama_C_show_each({25}) -2716c2713 -< [value] Called Frama_C_show_each([-20..26]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {27} +2835c2832 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..28] --- -> [value] Called Frama_C_show_each({26}) -2722c2719 -< [value] Called Frama_C_show_each([-20..27]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {28} +2841c2838 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..29] --- -> [value] Called Frama_C_show_each({27}) -2728c2725 -< [value] Called Frama_C_show_each([-20..28]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {29} +2848c2845 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..30] --- -> [value] Called Frama_C_show_each({28}) -2734c2731 -< [value] Called Frama_C_show_each([-20..29]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {30} +2854c2851 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..31] --- -> [value] Called Frama_C_show_each({29}) -2741c2738 -< [value] Called Frama_C_show_each([-20..30]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {30; 31} +2860c2857 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..32] --- -> [value] Called Frama_C_show_each({30}) -2747c2744 -< [value] Called Frama_C_show_each([-20..31]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {30; 31; 32} +2866c2863 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..99] --- -> [value] Called Frama_C_show_each({30; 31}) -2753c2750 -< [value] Called Frama_C_show_each([-20..32]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [30..99] +diff tests/non-free/oracle/write-const.res.oracle tests/non-free/oracle_equalities/write-const.res.oracle +53c53 +< tmp ∈ {{ &a ; &b }} --- -> [value] Called Frama_C_show_each({30; 31; 32}) -2759c2756 -< [value] Called Frama_C_show_each([-20..99]) +> tmp ∈ {{ &b }} +68c68 +< tmp ∈ {{ &a ; &b }} --- -> [value] Called Frama_C_show_each([30..99]) +> tmp ∈ {{ &b }} diff --git a/tests/non-free/diff_gauges b/tests/non-free/diff_gauges index 8f5da6e93a14935d712f19bc581c296165991a4d..0c3c1a1b890efb1b8a69af1c9db3e2a7a8a41c04 100644 --- a/tests/non-free/diff_gauges +++ b/tests/non-free/diff_gauges @@ -1,24 +1,24 @@ diff tests/non-free/oracle/Longinit_sequencer.res.oracle tests/non-free/oracle_gauges/Longinit_sequencer.res.oracle -381c381 +373c373 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_gauges/Longinit_sequencer.sav -621c621 +608c608 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_gauges/Longinit_sequencer.sav diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/allocated.1.res.oracle -91a92 +94a95 > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_7 -96a98,99 +99a101,102 > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -106a110,111 +109a113,114 > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -112d116 +115d119 < tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_7 -135a140,146 +138a143,149 > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_31 > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_32 > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_33 @@ -26,9 +26,9 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_35 > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_36 > tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82_37 -140d150 +143d153 < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -163a174,187 +166a177,190 > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} @@ -43,10 +43,10 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} -187,188d210 +190,191d213 < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -211a234,247 +214a237,250 > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} @@ -61,10 +61,10 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} -235,236d270 +238,239d273 < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -259a294,307 +262a297,310 > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} @@ -79,10 +79,10 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} -283,284d330 +286,287d333 < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -307a354,367 +310a357,370 > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} @@ -97,16 +97,16 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_33} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_32} > tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_31} -331d390 +334d393 < tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -380,382c439,440 +413,415c472,473 < __malloc_main_l82_7[0] ∈ {21} or UNINITIALIZED < [1] ∈ {24} or UNINITIALIZED < [2] ∈ {27} or UNINITIALIZED --- > __malloc_main_l82_7[0] ∈ {14} or UNINITIALIZED > [1] ∈ {17} or UNINITIALIZED -451a510,530 +484a543,563 > __malloc_main_l82_31[0] ∈ {21} or UNINITIALIZED > [1] ∈ {24} or UNINITIALIZED > [2] ∈ {27} or UNINITIALIZED @@ -128,11 +128,11 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > __malloc_main_l82_37[0] ∈ {21} or UNINITIALIZED > [1] ∈ {24} or UNINITIALIZED > [2] ∈ {27} or UNINITIALIZED -487c566 +529c608 < __malloc_main_l82_7[0..2] FROM __fc_heap_status; nondet (and SELF) --- > __malloc_main_l82_7[0..1] FROM __fc_heap_status; nondet (and SELF) -510a590,596 +552a632,638 > __malloc_main_l82_31[0..2] FROM __fc_heap_status; nondet (and SELF) > __malloc_main_l82_32[0..2] FROM __fc_heap_status; nondet (and SELF) > __malloc_main_l82_33[0..2] FROM __fc_heap_status; nondet (and SELF) @@ -140,57 +140,59 @@ diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_gauges/a > __malloc_main_l82_35[0..2] FROM __fc_heap_status; nondet (and SELF) > __malloc_main_l82_36[0..2] FROM __fc_heap_status; nondet (and SELF) > __malloc_main_l82_37[0..2] FROM __fc_heap_status; nondet (and SELF) -524c610 -< __malloc_main_l82_7[0..2]; __malloc_main_l82_8[0..2]; +576c662 +< __malloc_main_l82_6[0..1]; __malloc_main_l82_7[0..2]; --- -> __malloc_main_l82_7[0..1]; __malloc_main_l82_8[0..2]; -536c622,625 -< __malloc_main_l97[0]; __malloc_main_l114[0..3] +> __malloc_main_l82_6[0..1]; __malloc_main_l82_7[0..1]; +588,589c674,679 +< __malloc_main_l82_30[0..2]; __malloc_main_l97[0]; __malloc_main_l114[0..3]; +< __malloc_main_l127; __malloc_main_l127_0[0..1]; __malloc_main_l127_1[0..2]; --- -> __malloc_main_l82_31[0..2]; __malloc_main_l82_32[0..2]; -> __malloc_main_l82_33[0..2]; __malloc_main_l82_34[0..2]; -> __malloc_main_l82_35[0..2]; __malloc_main_l82_36[0..2]; -> __malloc_main_l82_37[0..2]; __malloc_main_l97[0]; __malloc_main_l114[0..3] +> __malloc_main_l82_30[0..2]; __malloc_main_l82_31[0..2]; +> __malloc_main_l82_32[0..2]; __malloc_main_l82_33[0..2]; +> __malloc_main_l82_34[0..2]; __malloc_main_l82_35[0..2]; +> __malloc_main_l82_36[0..2]; __malloc_main_l82_37[0..2]; +> __malloc_main_l97[0]; __malloc_main_l114[0..3]; __malloc_main_l127; +> __malloc_main_l127_0[0..1]; __malloc_main_l127_1[0..2]; diff tests/non-free/oracle/linked_list.0.res.oracle tests/non-free/oracle_gauges/linked_list.0.res.oracle -878a879,884 -> [value] computing for function printf_0 <- main. +891a892,897 +> [value] computing for function printf_va_1 <- main. > Called from tests/non-free/linked_list.c:51. -> [value] Done for function printf_0 -> [value] computing for function printf_0 <- main. +> [value] Done for function printf_va_1 +> [value] computing for function printf_va_1 <- main. > Called from tests/non-free/linked_list.c:51. -> [value] Done for function printf_0 +> [value] Done for function printf_va_1 diff tests/non-free/oracle/linked_list.1.res.oracle tests/non-free/oracle_gauges/linked_list.1.res.oracle -379a380,385 -> [value] computing for function printf_0 <- main. +392a393,398 +> [value] computing for function printf_va_1 <- main. > Called from tests/non-free/linked_list.c:51. -> [value] Done for function printf_0 -> [value] computing for function printf_0 <- main. +> [value] Done for function printf_va_1 +> [value] computing for function printf_va_1 <- main. > Called from tests/non-free/linked_list.c:51. -> [value] Done for function printf_0 -Only in tests/non-free/oracle: loopalloc.err.oracle -Only in tests/non-free/oracle: loopalloc.res.oracle +> [value] Done for function printf_va_1 diff tests/non-free/oracle/malloc-size-zero.1.res.oracle tests/non-free/oracle_gauges/malloc-size-zero.1.res.oracle -28a29,36 -> [value] computing for function calloc <- main. +25a26,33 +> [value] computing for function my_calloc <- main. > Called from tests/non-free/malloc-size-zero.i:29. -> [value] Recording results for calloc -> [value] Done for function calloc -> [value] computing for function calloc <- main. +> [value] Recording results for my_calloc +> [value] Done for function my_calloc +> [value] computing for function my_calloc <- main. > Called from tests/non-free/malloc-size-zero.i:29. -> [value] Recording results for calloc -> [value] Done for function calloc +> [value] Recording results for my_calloc +> [value] Done for function my_calloc diff tests/non-free/oracle/memcpy.res.oracle tests/non-free/oracle_gauges/memcpy.res.oracle -104a105,108 +109a110,113 > tests/non-free/memcpy.c:96:[value] Call to builtin memcpy(({{ (void *)&x }},{{ (void const *)&x }}, > [0..4294967295])) > tests/non-free/memcpy.c:96:[value] Call to builtin memcpy(({{ (void *)&x }},{{ (void const *)&x }}, > [0..4294967295])) diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/realloc.res.oracle -413a414,618 +422a423,639 > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -203,11 +205,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -220,11 +223,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -237,11 +241,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -254,11 +259,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -271,11 +277,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -288,11 +295,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -305,11 +313,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -322,12 +331,13 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > tests/non-free/realloc.c:150:[value] entering loop for the first time > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -340,11 +350,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -357,11 +368,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -374,11 +386,12 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== > [value:malloc] bases_to_realloc: {__realloc_w_main10_l152} > tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -> [value] Called Frama_C_show_each_main10({4}) -> [value] DUMPING STATE of file tests/non-free/realloc.c line 155 +> tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +> tests/non-free/realloc.c:155:[value] Frama_C_dump_each: +> # Cvalue domain: > __fc_random_counter ∈ {0} > __fc_rand_max ∈ {32767} > __fc_heap_status ∈ [--..--] @@ -391,4 +404,4 @@ diff tests/non-free/oracle/realloc.res.oracle tests/non-free/oracle_gauges/reall > q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR > __realloc_w_main10_l152[0] ∈ {4} > [1] ∈ UNINITIALIZED -> =END OF DUMP== +> ==END OF DUMP== diff --git a/tests/non-free/diff_legacy b/tests/non-free/diff_legacy deleted file mode 100644 index 2f0f609e9402780e30d033a8a0c35d9f50405f86..0000000000000000000000000000000000000000 --- a/tests/non-free/diff_legacy +++ /dev/null @@ -1,174 +0,0 @@ -diff tests/non-free/oracle/Longinit_sequencer.res.oracle tests/non-free/oracle_legacy/Longinit_sequencer.res.oracle -381c381 -< tests/non-free/result/Longinit_sequencer.sav ---- -> tests/non-free/result_legacy/Longinit_sequencer.sav -621c621 -< tests/non-free/result/Longinit_sequencer.sav ---- -> tests/non-free/result_legacy/Longinit_sequencer.sav -diff tests/non-free/oracle/allocated.1.res.oracle tests/non-free/oracle_legacy/allocated.1.res.oracle -83,84d82 -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_1} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_0} -86a85,86 -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_1} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_0} -92,96d91 -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_2} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_3} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_4} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_5} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_6} -111a107,111 -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_2} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_3} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_4} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_5} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_6} -140,163d139 -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_8} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_9} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_10} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_11} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_12} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_13} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_14} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_15} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_16} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_17} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_18} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_19} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_20} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_21} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_22} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_23} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_24} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_25} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_26} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_27} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_28} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_29} -< tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_30} -331a308,331 -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_7} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_8} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_9} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_10} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_11} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_12} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_13} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_14} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_15} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_16} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_17} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_18} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_19} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_20} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_21} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_22} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_23} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_24} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_25} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_26} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_27} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_28} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_29} -> tests/non-free/allocated.c:87:[value:malloc] strong free on bases: {__malloc_main_l82_30} -diff tests/non-free/oracle/imprecise.res.oracle tests/non-free/oracle_legacy/imprecise.res.oracle -69a70 -> tests/non-free/imprecise.c:23:[value] warning: locals {j; k} escaping the scope of write_garbled through NULL -74d74 -< tests/non-free/imprecise.c:144:[value] warning: locals {j; k} escaping the scope of write_garbled through NULL -79d78 -< tests/non-free/imprecise.c:40:[value] warning: accessing uninitialized left-value. assert \initialized(p); -80a80 -> tests/non-free/imprecise.c:40:[value] warning: accessing uninitialized left-value. assert \initialized(p); -152a153,157 -> tests/non-free/imprecise.c:77:[value] Reading left-value *p_gm_null. -> The location is {{ NULL -> [0..34359738360],0%8; -> alloced_return_gm_f1 -> [0..17179869176],0%8 }}. -> It contains a garbled mix of {addr; alloced_return_gm_f1} because of -> Misaligned {tests/non-free/imprecise.c:54}. -178,179c183 -< p_gm_null ∈ -< {{ NULL + [100..197] ; &alloced_return_gm_f1 + [0..2147483647] }} ---- -> p_gm_null ∈ {{ NULL + [--..--] ; &alloced_return_gm_f1 + [0..2147483647] }} -277c281 -< {{ NULL + [100..197] ; &alloced_return_gm_f1 + [0..2147483647] }} ---- -> {{ NULL + [--..--] ; &alloced_return_gm_f1 + [0..2147483647] }} -335c339 -< {{ NULL + [100..197] ; &alloced_return_gm_f1 + [0..2147483647] }} ---- -> {{ NULL + [--..--] ; &alloced_return_gm_f1 + [0..2147483647] }} -715d718 -< tests/non-free/imprecise.c:40:[value] warning: accessing uninitialized left-value. assert \initialized(p); -716a720 -> tests/non-free/imprecise.c:40:[value] warning: accessing uninitialized left-value. assert \initialized(p); -813,814c817 -< p_gm_null ∈ -< {{ NULL + [100..197] ; &alloced_return_gm_f1 + [0..2147483647] }} ---- -> p_gm_null ∈ {{ NULL + [--..--] ; &alloced_return_gm_f1 + [0..2147483647] }} -915c918 -< {{ NULL + [100..197] ; &alloced_return_gm_f1 + [0..2147483647] }} ---- -> {{ NULL + [--..--] ; &alloced_return_gm_f1 + [0..2147483647] }} -967c970 -< {{ NULL + [100..197] ; &alloced_return_gm_f1 + [0..2147483647] }} ---- -> {{ NULL + [--..--] ; &alloced_return_gm_f1 + [0..2147483647] }} -diff tests/non-free/oracle/linked_list.1.res.oracle tests/non-free/oracle_legacy/linked_list.1.res.oracle -379a380 -> tests/non-free/linked_list.c:52:[value] warning: out of bounds read. assert \valid_read(&curr->next); -Only in tests/non-free/oracle: loopalloc.err.oracle -Only in tests/non-free/oracle: loopalloc.res.oracle -diff tests/non-free/oracle/malloc-deps.res.oracle tests/non-free/oracle_legacy/malloc-deps.res.oracle -90c90,94 -< __malloc_w_main_l28[0..9] ∈ [0..9] or UNINITIALIZED ---- -> __malloc_w_main_l28[0..1] ∈ [-2147483647..2147483647] or UNINITIALIZED -> [2] ∈ [-2147483646..2147483647] or UNINITIALIZED -> [3] ∈ [-2147483645..2147483647] or UNINITIALIZED -> [4] ∈ [-2147483644..2147483647] or UNINITIALIZED -> [5..9] ∈ [-2147483643..2147483647] or UNINITIALIZED -99c103,107 -< __malloc_w_main_l28[0..9] ∈ [0..9] or UNINITIALIZED ---- -> __malloc_w_main_l28[0..1] ∈ [-2147483647..2147483647] or UNINITIALIZED -> [2] ∈ [-2147483646..2147483647] or UNINITIALIZED -> [3] ∈ [-2147483645..2147483647] or UNINITIALIZED -> [4] ∈ [-2147483644..2147483647] or UNINITIALIZED -> [5..9] ∈ [-2147483643..2147483647] or UNINITIALIZED -diff tests/non-free/oracle/realloc_multiple.res.oracle tests/non-free/oracle_legacy/realloc_multiple.res.oracle -174c174,176 -< s ∈ {{ &__realloc_main3_l65[0] ; &__realloc_main3_l65_0[0] }} ---- -> s ∈ -> {{ &__realloc_main3_l65[0] ; &__realloc_main3_l65_0[0] ; -> &__realloc_main3_l65_1[0] }} -202c204,206 -< s ∈ {{ &__realloc_main3_l65[0] ; &__realloc_main3_l65_0[0] }} ---- -> s ∈ -> {{ &__realloc_main3_l65[0] ; &__realloc_main3_l65_0[0] ; -> &__realloc_main3_l65_1[0] }} -250c254,256 -< s ∈ {{ &__realloc_main3_l65[0] ; &__realloc_main3_l65_0[0] }} ---- -> s ∈ -> {{ &__realloc_main3_l65[0] ; &__realloc_main3_l65_0[0] ; -> &__realloc_main3_l65_1[0] }} -diff tests/non-free/oracle/strlen_align.res.oracle tests/non-free/oracle_legacy/strlen_align.res.oracle -17c17 -< k ∈ {0} ---- -> k# ∈ {32}%64, bits 32 to 39 -diff tests/non-free/oracle/strnlen.res.oracle tests/non-free/oracle_legacy/strnlen.res.oracle -37c37 -< c ∈ [-2147483648..2147483646] ---- -> c ∈ [--..--] diff --git a/tests/non-free/diff_symblocs b/tests/non-free/diff_symblocs index 3a5464c4b7e2eccf148e2305085d35ed580fcb03..d6f2991f6b4522c966d64003f6028dcc8ed3e357 100644 --- a/tests/non-free/diff_symblocs +++ b/tests/non-free/diff_symblocs @@ -1,281 +1,279 @@ diff tests/non-free/oracle/Longinit_sequencer.res.oracle tests/non-free/oracle_symblocs/Longinit_sequencer.res.oracle -381c381 +373c373 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_symblocs/Longinit_sequencer.sav -621c621 +608c608 < tests/non-free/result/Longinit_sequencer.sav --- > tests/non-free/result_symblocs/Longinit_sequencer.sav diff tests/non-free/oracle/alloc_weak.res.oracle tests/non-free/oracle_symblocs/alloc_weak.res.oracle -30d29 +29d28 < tests/non-free/alloc_weak.c:30:[value] warning: accessing uninitialized left-value. assert \initialized(p); -864c863 +863c862 < r ∈ [--..--] --- > r ∈ {42} diff tests/non-free/oracle/imprecise.res.oracle tests/non-free/oracle_symblocs/imprecise.res.oracle -203a204 +198a199 > tests/non-free/imprecise.c:110:[kernel] more than 200(300) elements to enumerate. Approximating. -208a210 +203a205 > tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate. Approximating. -284,285d285 +206,207d207 < tests/non-free/imprecise.c:110:[kernel] more than 200(300) elements to enumerate. Approximating. < tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate. Approximating. diff tests/non-free/oracle/linked_list.1.res.oracle tests/non-free/oracle_symblocs/linked_list.1.res.oracle -322a323 +333a334 > tests/non-free/linked_list.c:43:[kernel] more than 100(128) elements to enumerate. Approximating. -323a325 +334a336 > tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerate. Approximating. -386,387d387 +394,395d395 < tests/non-free/linked_list.c:43:[kernel] more than 100(128) elements to enumerate. Approximating. < tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerate. Approximating. -Only in tests/non-free/oracle: loopalloc.err.oracle -Only in tests/non-free/oracle: loopalloc.res.oracle diff tests/non-free/oracle/malloc-optimistic.res.oracle tests/non-free/oracle_symblocs/malloc-optimistic.res.oracle -359d358 +380d379 < tests/non-free/malloc-optimistic.c:79:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -377c376 +400c399 < k ∈ {-2; -1} --- > k ∈ {-1} -404c403 +429c428 < k ∈ {-1; 0} --- > k ∈ {0} -433c432 +460c459 < k ∈ {0; 1} --- > k ∈ {1} -464c463 +493c492 < k ∈ {1; 2} --- > k ∈ {2} -497c496 +528c527 < k ∈ {2; 3} --- > k ∈ {3} -532c531 +565c564 < k ∈ {3; 4} --- > k ∈ {4} -569c568 +604c603 < k ∈ {4; 5} --- > k ∈ {5} -608c607 +645c644 < k ∈ {5; 6} --- > k ∈ {6} -649c648 +688c687 < k ∈ {6; 7} --- > k ∈ {7} -1391d1389 +1460d1458 < tests/non-free/malloc-optimistic.c:92:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -1542d1539 +1617d1614 < tests/non-free/malloc-optimistic.c:105:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -1571c1568 +1648c1645 < k ∈ {-2; -1} --- > k ∈ {-1} -1620c1617 +1699c1696 < k ∈ {-1; 0} --- > k ∈ {0} -1671c1668 +1752c1749 < k ∈ {0; 1} --- > k ∈ {1} -1724c1721 +1807c1804 < k ∈ {1; 2} --- > k ∈ {2} -1779c1776 +1864c1861 < k ∈ {2; 3} --- > k ∈ {3} -1836c1833 +1923c1920 < k ∈ {3; 4} --- > k ∈ {4} -1895c1892 +1984c1981 < k ∈ {4; 5} --- > k ∈ {5} -1956c1953 +2047c2044 < k ∈ {5; 6} --- > k ∈ {6} -2019c2016 +2112c2109 < k ∈ {6; 7} --- > k ∈ {7} -2084c2081 +2179c2176 < k ∈ {7; 8} --- > k ∈ {8} -2151c2148 +2248c2245 < k ∈ {8; 9} --- > k ∈ {9} -2220c2217 +2319c2316 < k ∈ {9; 10} --- > k ∈ {10} -2291c2288 +2392c2389 < k ∈ {10; 11} --- > k ∈ {11} -2364c2361 +2467c2464 < k ∈ {11; 12} --- > k ∈ {12} -2402c2399 +2506c2503 < k ∈ {12; 13} --- > k ∈ {13} -2441c2438 +2546c2543 < k ∈ {12; 13; 14} --- > k ∈ {13; 14} -2480c2477 +2586c2583 < k ∈ {12; 13; 14; 15} --- > k ∈ {13; 14; 15} -2519c2516 +2626c2623 < k ∈ [12..97] --- > k ∈ [13..97] -2566c2563 -< [value] Called Frama_C_show_each({-20; 1}) +2673c2670 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1} --- -> [value] Called Frama_C_show_each({1}) -2572c2569 -< [value] Called Frama_C_show_each({-20; 1; 2}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {1} +2679c2676 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2} --- -> [value] Called Frama_C_show_each({2}) -2578c2575 -< [value] Called Frama_C_show_each({-20; 1; 2; 3}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {2} +2685c2682 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3} --- -> [value] Called Frama_C_show_each({3}) -2584c2581 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {3} +2691c2688 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4} --- -> [value] Called Frama_C_show_each({4}) -2590c2587 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {4} +2697c2694 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5} --- -> [value] Called Frama_C_show_each({5}) -2596c2593 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5; 6}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {5} +2703c2700 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5; 6} --- -> [value] Called Frama_C_show_each({6}) -2602c2599 -< [value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5; 6; 7}) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {6} +2709c2706 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5; 6; 7} --- -> [value] Called Frama_C_show_each({7}) -2608c2605 -< [value] Called Frama_C_show_each([-20..8]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {7} +2715c2712 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..8] --- -> [value] Called Frama_C_show_each({8}) -2614c2611 -< [value] Called Frama_C_show_each([-20..9]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {8} +2721c2718 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..9] --- -> [value] Called Frama_C_show_each({9}) -2620c2617 -< [value] Called Frama_C_show_each([-20..10]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {9} +2727c2724 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..10] --- -> [value] Called Frama_C_show_each({10}) -2626c2623 -< [value] Called Frama_C_show_each([-20..11]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {10} +2733c2730 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..11] --- -> [value] Called Frama_C_show_each({11}) -2632c2629 -< [value] Called Frama_C_show_each([-20..12]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {11} +2739c2736 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..12] --- -> [value] Called Frama_C_show_each({12}) -2638c2635 -< [value] Called Frama_C_show_each([-20..13]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {12} +2745c2742 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..13] --- -> [value] Called Frama_C_show_each({13}) -2644c2641 -< [value] Called Frama_C_show_each([-20..14]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {13} +2751c2748 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..14] --- -> [value] Called Frama_C_show_each({14}) -2650c2647 -< [value] Called Frama_C_show_each([-20..15]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {14} +2757c2754 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..15] --- -> [value] Called Frama_C_show_each({15}) -2656c2653 -< [value] Called Frama_C_show_each([-20..16]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {15} +2763c2760 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..16] --- -> [value] Called Frama_C_show_each({16}) -2662c2659 -< [value] Called Frama_C_show_each([-20..17]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {16} +2769c2766 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..17] --- -> [value] Called Frama_C_show_each({17}) -2668c2665 -< [value] Called Frama_C_show_each([-20..18]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {17} +2775c2772 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..18] --- -> [value] Called Frama_C_show_each({18}) -2674c2671 -< [value] Called Frama_C_show_each([-20..19]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {18} +2781c2778 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..19] --- -> [value] Called Frama_C_show_each({19}) -2680c2677 -< [value] Called Frama_C_show_each([-20..20]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {19} +2787c2784 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..20] --- -> [value] Called Frama_C_show_each({20}) -2686c2683 -< [value] Called Frama_C_show_each([-20..21]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {20} +2793c2790 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..21] --- -> [value] Called Frama_C_show_each({21}) -2692c2689 -< [value] Called Frama_C_show_each([-20..22]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {21} +2799c2796 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..22] --- -> [value] Called Frama_C_show_each({22}) -2698c2695 -< [value] Called Frama_C_show_each([-20..23]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {22} +2805c2802 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..23] --- -> [value] Called Frama_C_show_each({23}) -2704c2701 -< [value] Called Frama_C_show_each([-20..24]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {23} +2811c2808 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..24] --- -> [value] Called Frama_C_show_each({24}) -2710c2707 -< [value] Called Frama_C_show_each([-20..25]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {24} +2817c2814 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..25] --- -> [value] Called Frama_C_show_each({25}) -2716c2713 -< [value] Called Frama_C_show_each([-20..26]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {25} +2823c2820 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..26] --- -> [value] Called Frama_C_show_each({26}) -2722c2719 -< [value] Called Frama_C_show_each([-20..27]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {26} +2829c2826 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..27] --- -> [value] Called Frama_C_show_each({27}) -2728c2725 -< [value] Called Frama_C_show_each([-20..28]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {27} +2835c2832 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..28] --- -> [value] Called Frama_C_show_each({28}) -2734c2731 -< [value] Called Frama_C_show_each([-20..29]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {28} +2841c2838 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..29] --- -> [value] Called Frama_C_show_each({29}) -2741c2738 -< [value] Called Frama_C_show_each([-20..30]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {29} +2848c2845 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..30] --- -> [value] Called Frama_C_show_each({30}) -2747c2744 -< [value] Called Frama_C_show_each([-20..31]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {30} +2854c2851 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..31] --- -> [value] Called Frama_C_show_each({30; 31}) -2753c2750 -< [value] Called Frama_C_show_each([-20..32]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {30; 31} +2860c2857 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..32] --- -> [value] Called Frama_C_show_each({30; 31; 32}) -2759c2756 -< [value] Called Frama_C_show_each([-20..99]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {30; 31; 32} +2866c2863 +< tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..99] --- -> [value] Called Frama_C_show_each([30..99]) +> tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [30..99] diff --git a/tests/non-free/free.i b/tests/non-free/free.i index 3b47d42cdd3b6dbd74eb2e4ff2e3f969db37399c..0dea07aeaccea7912d90a9641356c3a7813e154e 100644 --- a/tests/non-free/free.i +++ b/tests/non-free/free.i @@ -1,43 +1,43 @@ void Frama_C_free(void*); -void* Frama_C_alloc_size(unsigned long); +void* Frama_C_malloc_fresh(unsigned long); volatile v; void main1() { - int *p = Frama_C_alloc_size(40); + int *p = Frama_C_malloc_fresh(40); p[1] = 1; - int *q = Frama_C_alloc_size(40); + int *q = Frama_C_malloc_fresh(40); q[2] = 2; int *r = v ? p : q; Frama_C_dump_each(); Frama_C_free(r); - int *u = Frama_C_alloc_size(40); + int *u = Frama_C_malloc_fresh(40); u[3] = 3; Frama_C_free(u); int* t = 0; Frama_C_free(t); - int* s = Frama_C_alloc_size(40); + int* s = Frama_C_malloc_fresh(40); s[4] = 4; s = v ? 0 : s; Frama_C_free(s); } -void free(void *p) { - Frama_C_free(p); -} + + + void main2() { int *p; int i = 1; - p = Frama_C_alloc_size(i * sizeof (int)); + p = Frama_C_malloc_fresh(i * sizeof (int)); if (p != 0) { *p = i; } - free(p); /* we must not backward-propagate information about p before and - after the call, because it has became dangling. */ + Frama_C_free(p); /* we must not backward-propagate information about p + before and after the call, because it became dangling. */ } void main() { diff --git a/tests/non-free/from_result.c b/tests/non-free/from_result.c index f1bff2aef5ebac59f3b7212a973fa425a3940033..6e7ec8c65ab690512292606d812b0d041caf4989 100644 --- a/tests/non-free/from_result.c +++ b/tests/non-free/from_result.c @@ -1,5 +1,5 @@ /* run.config* - OPT: @VALUECONFIG@ -deps -journal-disable + OPT: @VALUECONFIG@ -no-val-builtins-auto -deps -journal-disable */ #define FRAMA_C_MALLOC_INDIVIDUAL #include "../../share/libc/stdlib.c" diff --git a/tests/non-free/gcc_zero_length_array.c b/tests/non-free/gcc_zero_length_array.c index aa5676e508087a1635bd309853716313eb9d41eb..c11dc83e7e530afd3a88158688e7b97f4f9efac2 100644 --- a/tests/non-free/gcc_zero_length_array.c +++ b/tests/non-free/gcc_zero_length_array.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-machdep gcc_x86_32 -val-builtin malloc:Frama_C_alloc_size,free:Frama_C_free -slevel 11" + STDOPT: +"-machdep gcc_x86_32 -val-builtin malloc:Frama_C_malloc_fresh,free:Frama_C_free -slevel 11" */ #include <stdlib.h> diff --git a/tests/non-free/imprecise-malloc-free.i b/tests/non-free/imprecise-malloc-free.i index 5be2210f2d694d3eae72aefa2f5c5212c0b60269..bf9ff9515b1db7bdfe2b21b4c5ea23228b4b1a74 100644 --- a/tests/non-free/imprecise-malloc-free.i +++ b/tests/non-free/imprecise-malloc-free.i @@ -5,15 +5,15 @@ extern int i; //@ ensures \result != \null; -void* Frama_C_alloc_by_stack(unsigned long); +void* Frama_C_malloc_by_stack(unsigned long); void main() { int size1, size2; size1 = &size1 + i; size2 = i + ((int)&size2 >> 1); - int *p = Frama_C_alloc_by_stack(&i+(int)&i); - int *q = Frama_C_alloc_by_stack(size1); - int *r = Frama_C_alloc_by_stack(size2); + int *p = Frama_C_malloc_by_stack(&i+(int)&i); + int *q = Frama_C_malloc_by_stack(size1); + int *r = Frama_C_malloc_by_stack(size2); Frama_C_show_each(p, q, r); Frama_C_show_each(p+(int)p); diff --git a/tests/non-free/linked_list.c b/tests/non-free/linked_list.c index d9bce8100a2863533624c147701f3d210b30cc20..f042689c036981f565faa80329de288978abef15 100644 --- a/tests/non-free/linked_list.c +++ b/tests/non-free/linked_list.c @@ -1,7 +1,7 @@ /* run.config* - STDOPT: - STDOPT: #"-plevel 100 -big-ints-hex 257" - STDOPT: #"-slevel 12 -big-ints-hex 257" + STDOPT: #"-load-module variadic -no-val-builtins-auto" + STDOPT: #"-load-module variadic -plevel 100 -big-ints-hex 257 -no-val-builtins-auto" + STDOPT: #"-load-module variadic -slevel 12 -big-ints-hex 257 -no-val-builtins-auto" */ #include "__fc_define_size_t.h" diff --git a/tests/non-free/loopalloc.i b/tests/non-free/loopalloc.i deleted file mode 100644 index a7635604afd6200d3baa490a0264cbcc957029d9..0000000000000000000000000000000000000000 --- a/tests/non-free/loopalloc.i +++ /dev/null @@ -1,49 +0,0 @@ -/* run.config* - DONTRUN: this test loops with nearly all the new domains of Eva. See comments below - STDOPT: +"-slevel 1 -then -main main2 -slevel 100" -*/ -void * Frama_C_alloc_size(unsigned long); -void Frama_C_free(void *); - -char *p; - -/* This test converges with slevel 1, with a slightly dubious semantics - (only one base allocated). It diverges with slevel 0. Notice that this - works only because the loop has fully stabilized when slevel is exhausted. */ - -int main() { - while (1) - { - Frama_C_dump_each(); - p = Frama_C_alloc_size(10); - Frama_C_free(p); - Frama_C_dump_each(); - } -} - -/* Slightly more involved example. There is enough slevel to stabilize c, - so the analysis converges. This is very brittle, and fails e.g. if 'incr' - is inlined. */ - -volatile v; - -void incr (int *p) { - if (v && *p <= 10) - (*p)++; -} - -int main2() { - int c = 0; - while (1) - { - incr (&c); - - Frama_C_dump_each(); - p = Frama_C_alloc_size(10); - Frama_C_show_each(p); - Frama_C_free(p); - Frama_C_dump_each(); - } -} - - diff --git a/tests/non-free/malloc-deps.i b/tests/non-free/malloc-deps.i index 8a76fcebb4274e1497c51c2b7d2d4b9e7cca0f53..680b54f480f5ff1460c311356785c2d04e7175db 100644 --- a/tests/non-free/malloc-deps.i +++ b/tests/non-free/malloc-deps.i @@ -2,11 +2,11 @@ OPT: -val @VALUECONFIG@ -deps -calldeps -inout -slevel 5 -value-msg-key malloc */ //@ assigns \result \from \nothing; -void *Frama_C_alloc_size(unsigned long n); +void *Frama_C_malloc_fresh(unsigned long n); //@ assigns \result \from \nothing; -void *Frama_C_alloc_size_weak(unsigned long n); +void *Frama_C_malloc_fresh_weak(unsigned long n); //@ assigns \result \from \nothing; -void *Frama_C_alloc_by_stack(unsigned long n); +void *Frama_C_malloc_by_stack(unsigned long n); volatile int v; @@ -14,18 +14,18 @@ void g(int *p, int k) { p[k] = k; } void main(int i, int j) { int *p, *q; - p = Frama_C_alloc_size_weak(100); + p = Frama_C_malloc_fresh_weak(100); *p = i; *p = j; // Cannnot perform strong update for deps, variable is weak - q = Frama_C_alloc_size(100); + q = Frama_C_malloc_fresh(100); *q = i; *q = j; // Can perform strong update for deps int *r; for (int l=0; l<10; l++) { - r = Frama_C_alloc_by_stack((l+1)*4); + r = Frama_C_malloc_by_stack((l+1)*4); g(r, l+v); // Again, we can only perform weak updates (after iteration 1) } } diff --git a/tests/non-free/malloc-optimistic.c b/tests/non-free/malloc-optimistic.c index 92ae451f55580e635c6a4a503d47d71c456ed73d..ea13b75b8a70505061a9b0f77031967194f3c8ea 100644 --- a/tests/non-free/malloc-optimistic.c +++ b/tests/non-free/malloc-optimistic.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-val-builtin malloc:Frama_C_alloc_by_stack,free:Frama_C_free -slevel 30 -val-slevel-merge-after-loop @all -val-malloc-functions malloc -memexec-all" + STDOPT: +"-slevel 30 -val-slevel-merge-after-loop @all -val-malloc-functions malloc -memexec-all" */ //@ assigns \result \from \nothing; diff --git a/tests/non-free/malloc-size-zero.i b/tests/non-free/malloc-size-zero.i index e8313e96851dfe13758f483788452d12ec7225db..d5dde5fa5c8c2bfa5e1366089258b33bc0e92f79 100644 --- a/tests/non-free/malloc-size-zero.i +++ b/tests/non-free/malloc-size-zero.i @@ -1,19 +1,19 @@ /* run.config* - OPT: -val @VALUECONFIG@ -val-builtin malloc:Frama_C_alloc_by_stack,free:Frama_C_free -val-mlevel 3 - OPT: -val @VALUECONFIG@ -val-builtin malloc:Frama_C_alloc_by_stack,free:Frama_C_free -val-malloc-functions calloc + OPT: -val @VALUECONFIG@ -val-mlevel 3 + OPT: -val @VALUECONFIG@ -val-malloc-functions my_calloc */ void* malloc(unsigned long); void free(void*); -void* calloc (int s, int n) { +void* my_calloc (int s, int n) { return malloc (s*n); } volatile foo; void main () { - char *p1 = calloc (0, 0); + char *p1 = my_calloc (0, 0); if (p1 == 0) Frama_C_show_each_NULL_p1(); if (p1) @@ -26,7 +26,7 @@ void main () { char *q1; while (foo) { if (foo) { - q1 = calloc (0, 0); + q1 = my_calloc (0, 0); } } diff --git a/tests/non-free/malloc.c b/tests/non-free/malloc.c index f28c77d294c73cd84aacc31ae618f4cfd8e14681..1acf298c3dfb1b197363aabd78f970f829456250 100644 --- a/tests/non-free/malloc.c +++ b/tests/non-free/malloc.c @@ -2,23 +2,23 @@ OPT: -val @VALUECONFIG@ -slevel 10 -val-mlevel 0 */ -void *Frama_C_alloc_by_stack(unsigned long i); -void *Frama_C_alloc_size(unsigned long i); +void *Frama_C_malloc_by_stack(unsigned long i); +void *Frama_C_malloc_fresh(unsigned long i); void main(int c) { int x; int *s; if(c) { x = 1; - s = Frama_C_alloc_by_stack(100); + s = Frama_C_malloc_by_stack(100); } else { x = 2; s = 0; } - int *p = Frama_C_alloc_by_stack(c); - int *q = Frama_C_alloc_by_stack(12); - int *r = Frama_C_alloc_size(100); + int *p = Frama_C_malloc_by_stack(c); + int *q = Frama_C_malloc_by_stack(12); + int *r = Frama_C_malloc_fresh(100); *p = 1; *(p+2) = 3; *(p+24999) = 4; diff --git a/tests/non-free/malloc_bug_tr.c b/tests/non-free/malloc_bug_tr.c index 12704847514a928e499f4e2777eb81bde1cbf391..9ae6b3bf2338a127c52fe162da4b9484a017308b 100644 --- a/tests/non-free/malloc_bug_tr.c +++ b/tests/non-free/malloc_bug_tr.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -val @VALUECONFIG@ -val-builtin malloc:Frama_C_alloc_by_stack,free:Frama_C_free,memcpy:Frama_C_memcpy + OPT: -val @VALUECONFIG@ */ #include <stdlib.h> diff --git a/tests/non-free/malloc_individual.c b/tests/non-free/malloc_individual.c index 6ef694176e4cf94ef137979abbf495705c3fcf3c..c101dd46549155393c001b0229e5d988c21de113 100644 --- a/tests/non-free/malloc_individual.c +++ b/tests/non-free/malloc_individual.c @@ -1,3 +1,6 @@ +/* run.config* + STDOPT: #"-no-val-builtins-auto" +*/ #define FRAMA_C_MALLOC_INDIVIDUAL #include "share/libc/stdlib.c" diff --git a/tests/non-free/malloc_memexec.c b/tests/non-free/malloc_memexec.c index 665be63d4999b8efd3cdef1f4cbdad1202220056..401a940df49d35cecd3324017f82c7909ea7dd4d 100644 --- a/tests/non-free/malloc_memexec.c +++ b/tests/non-free/malloc_memexec.c @@ -3,10 +3,10 @@ */ //@ assigns \result; -void *Frama_C_alloc_size(unsigned long n); +void *Frama_C_malloc_fresh(unsigned long n); //@ assigns \result; -void *Frama_C_alloc_size_weak(unsigned long n); +void *Frama_C_malloc_fresh_weak(unsigned long n); void f(int *p, int i) { @@ -16,7 +16,7 @@ void f(int *p, int i) { volatile v; void main() { - int *p = Frama_C_alloc_size (4); + int *p = Frama_C_malloc_fresh (4); if (v) { f(p, 2); f(p, 1); // This call or the corresponding one below could be cached. It is not, because we forbid memexec to take full updates to a strong variable into account for malloced bases, because they may become weak later @@ -24,7 +24,7 @@ void main() { f(p, 1); } - int *q = Frama_C_alloc_size_weak (4); + int *q = Frama_C_malloc_fresh_weak (4); if (v) { f(q, 2); f(q, 1); diff --git a/tests/non-free/malloc_multiple.c b/tests/non-free/malloc_multiple.c index 549c4164cecc48d2e0b768b4af683eec075bcd9c..77d6b422bac90ed490882e7545ee29cd1e32de56 100644 --- a/tests/non-free/malloc_multiple.c +++ b/tests/non-free/malloc_multiple.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -val @VALUECONFIG@ -slevel 50 -val-mlevel 5 -val-builtin malloc:Frama_C_alloc_by_stack,free:Frama_C_free + OPT: -val @VALUECONFIG@ -slevel 50 -val-mlevel 5 */ #include<stdlib.h> #define MAX 10 diff --git a/tests/non-free/memcpy.c b/tests/non-free/memcpy.c index 4f48654060697a2433c6361b44d6036559f95dd5..beb4bbe2011732e911da7dcc34ba15019623106e 100644 --- a/tests/non-free/memcpy.c +++ b/tests/non-free/memcpy.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-calldeps -slevel-function init:2000 -inout-callwise -value-msg-key imprecision -plevel 150 -main main_all -inout -no-deps -then -report" + STDOPT: +"-calldeps -slevel-function init:2000 -value-msg-key imprecision -plevel 150 -main main_all -inout -no-deps -absolute-valid-range 100000-100001 -then -load-module report -report" */ #include "__fc_builtin.h" @@ -212,9 +212,20 @@ void main_local() { Frama_C_dump_each(); } +void copy_0() { + /* Currently, the memcpy builtin does not flag 0-size copies to invalid + locations. But there used to be a bug with the NULL base when + -absolute-valid-range is set. */ + int l; + Frama_C_memcpy(0, &l, 0); + Frama_C_memcpy(&l, 0, 0); +} + + void main_all () { if (maybe) main (maybe, maybe); else if (maybe) main_uninit (); else if (maybe) main_local (); + else if (maybe) copy_0 (); while (1); // results of main are unimportant } diff --git a/tests/non-free/memexec-malloc.c b/tests/non-free/memexec-malloc.c index 64bbf8b0e9ec9a75ab47881440df9e96f96f0cce..7ad36cbd3f5a7cd58dc1f0b14e6c54572f05d024 100644 --- a/tests/non-free/memexec-malloc.c +++ b/tests/non-free/memexec-malloc.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-val-malloc-functions alloc,Frama_C_alloc_by_stack -val-mlevel 0" + STDOPT: #"-val-malloc-functions alloc,Frama_C_malloc_by_stack -val-mlevel 0" */ #define N 2000 @@ -12,7 +12,7 @@ void f() { } int *alloc() { - return Frama_C_alloc_by_stack(4); + return Frama_C_malloc_by_stack(4); } int *k() { diff --git a/tests/non-free/memset.i b/tests/non-free/memset.i index fa89534285dbad7e39a93516907b49ce22fb8c6e..53ea070b65dfebf22a8d58e5fd609d1a565c5cb6 100644 --- a/tests/non-free/memset.i +++ b/tests/non-free/memset.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-calldeps -inout-callwise -value-msg-key imprecision -plevel 500" +"-inout -no-deps" + STDOPT: #"-calldeps -value-msg-key imprecision -plevel 500" +"-inout -no-deps" */ //@ assigns *((char*)dst+(0..size-1)) \from v; assigns \result \from dst; diff --git a/tests/non-free/memset_malloc_0.i b/tests/non-free/memset_malloc_0.i index 40c624c4f69dcabfab5ca00a6f91df0d97648d7f..e7aea10825fe3eeaea20cc181fc9b7bc9aa06405 100644 --- a/tests/non-free/memset_malloc_0.i +++ b/tests/non-free/memset_malloc_0.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-val-builtin malloc:Frama_C_alloc_by_stack,memset:Frama_C_memset" + */ typedef unsigned long size_t; diff --git a/tests/non-free/oracle/Longinit_sequencer.res.oracle b/tests/non-free/oracle/Longinit_sequencer.res.oracle index d49acac93a0cfc55289bf8a433a8a098f4c79665..51da60eaab5511bfd6c19b7aa11b62fbb50655bc 100644 --- a/tests/non-free/oracle/Longinit_sequencer.res.oracle +++ b/tests/non-free/oracle/Longinit_sequencer.res.oracle @@ -1,6 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/Longinit_sequencer.i (no preprocessing) -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/long_init.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,12 +6,12 @@ tests/non-free/long_init.c:34:[value] Assigning imprecise value to garbled_mix. The imprecision originates from Arithmetic {tests/non-free/long_init.c:34} [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] a1[0..9] ∈ {0} stuff ∈ {0} @@ -105,13 +103,14 @@ tests/non-free/long_init.c:83:[value] warning: locals {r2} escaping the scope of tests/non-free/long_init.c:83:[value] warning: locals {r2} escaping the scope of init_inner through pr_escaping [value] Recording results for init_outer [value] Done for function init_outer -[value] DUMPING STATE of file tests/non-free/long_init.c line 90 - __fc_random_counter ∈ {0} +tests/non-free/long_init.c:90:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] a1[0] ∈ {0} [1] ∈ {1} @@ -150,15 +149,10 @@ tests/non-free/long_init.c:83:[value] warning: locals {r2} escaping the scope of fp ∈ {{ &fun }} inited ∈ {1} sa ∈ {{ "abc" }} - r ∈ UNINITIALIZED - r2 ∈ UNINITIALIZED - dm ∈ UNINITIALIZED - res_from_fp ∈ UNINITIALIZED - res ∈ UNINITIALIZED - local ∈ UNINITIALIZED + tmp_2 ∈ UNINITIALIZED __retres ∈ UNINITIALIZED __malloc_init_inner_l72 ∈ {{ (int)&__malloc_init_inner_l72 }} - =END OF DUMP== + ==END OF DUMP== [value] computing for function analyze <- main. Called from tests/non-free/long_init.c:91. [value] computing for function subanalyze <- analyze <- main. @@ -219,7 +213,6 @@ tests/non-free/long_init.c:102:[value] allocating variable __malloc_main_l102 [value] Recording results for main [value] done for function main [value] Saving globals state after call to function: init_inner - Values at end of function dmin: __retres ∈ [93.9166666667 .. 110.791666667] @@ -343,20 +336,19 @@ Values at end of function main: res_from_fp ∈ {32} res ∈ {93} local ∈ {1} - __retres ∈ {0}[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/non-free/long_init2.c (with preprocessing) + __retres ∈ {0}[kernel] Parsing tests/non-free/long_init2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state tests/non-free/long_init2.c:34:[value] Assigning imprecise value to garbled_mix. The imprecision originates from Arithmetic {tests/non-free/long_init2.c:34} [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] a1[0..9] ∈ {0} stuff ∈ {0} @@ -380,19 +372,20 @@ tests/non-free/long_init2.c:34:[value] Assigning imprecise value to garbled_mix. [value] Skipping call to init_inner, loading globals state from file: tests/non-free/result/Longinit_sequencer.sav [value] warning: importing garbled mix, locations may have changed -[value] warning: variable `r (id 659)' is not global, possibly an escaping value; ignoring -[value] warning: variable `r2 (id 662)' is not global, possibly an escaping value; ignoring -[value] warning: variable `r2 (id 662)' is not global, possibly an escaping value; ignoring +[value] warning: variable `r' is not global, possibly an escaping value; ignoring +[value] warning: variable `r2' is not global, possibly an escaping value; ignoring +[value] warning: variable `r2' is not global, possibly an escaping value; ignoring [value] warning: found new global variable `another_global' [value] Recording results for init_outer [value] Done for function init_outer -[value] DUMPING STATE of file tests/non-free/long_init2.c line 90 - __fc_random_counter ∈ {0} +tests/non-free/long_init2.c:90:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] a1[0] ∈ {0} [1] ∈ {1} @@ -432,15 +425,10 @@ tests/non-free/long_init2.c:34:[value] Assigning imprecise value to garbled_mix. fp ∈ {{ &fun }} inited ∈ {1} sa ∈ {{ "abc" }} - r ∈ UNINITIALIZED - r2 ∈ UNINITIALIZED - dm ∈ UNINITIALIZED - res_from_fp ∈ UNINITIALIZED - res ∈ UNINITIALIZED - local ∈ UNINITIALIZED + tmp_2 ∈ UNINITIALIZED __retres ∈ UNINITIALIZED __malloc_init_inner_l72 ∈ {{ (int)&__malloc_init_inner_l72 }} - =END OF DUMP== + ==END OF DUMP== [value] computing for function analyze <- main. Called from tests/non-free/long_init2.c:91. [value] computing for function subanalyze <- analyze <- main. @@ -504,7 +492,6 @@ tests/non-free/long_init2.c:102:[value] allocating variable __malloc_main_l102 [value] Saving globals state after call to function: init_outer - Values at end of function dmin: __retres ∈ [93.9166666667 .. 110.791666667] @@ -575,6 +562,7 @@ Values at end of function main: pr ∈ {{ &r ; &r2 }} pr2 ∈ {{ &r ; &r2 }} ppr ∈ {{ &pr ; &pr2 }} + alloc1 ∈ ESCAPINGADDR alloc3 ∈ {{ &__malloc_main_l102 }} inited ∈ {1} sa ∈ {{ "abc" }} @@ -584,20 +572,19 @@ Values at end of function main: res_from_fp ∈ {32} res ∈ {93} local ∈ {42} - __retres ∈ {0}[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/non-free/long_init3.c (with preprocessing) + __retres ∈ {0}[kernel] Parsing tests/non-free/long_init3.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state tests/non-free/long_init3.c:34:[value] Assigning imprecise value to garbled_mix. The imprecision originates from Arithmetic {tests/non-free/long_init3.c:34} [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] a1[0..9] ∈ {0} stuff ∈ {0} @@ -621,13 +608,14 @@ tests/non-free/long_init3.c:34:[value] Assigning imprecise value to garbled_mix. tests/non-free/result/Longinit_sequencer.sav [value] warning: importing garbled mix, locations may have changed [value] warning: found new global variable `yet_another_global' -[value] DUMPING STATE of file tests/non-free/long_init3.c line 90 - __fc_random_counter ∈ {0} +tests/non-free/long_init3.c:90:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] a1[0] ∈ {0} [1] ∈ {1} @@ -668,16 +656,10 @@ tests/non-free/long_init3.c:34:[value] Assigning imprecise value to garbled_mix. fp ∈ {{ &fun }} inited ∈ {1} sa ∈ {{ "abc" }} - r ∈ UNINITIALIZED - r2 ∈ UNINITIALIZED - dm ∈ UNINITIALIZED - res_from_fp ∈ UNINITIALIZED - res ∈ UNINITIALIZED - local ∈ UNINITIALIZED - local2 ∈ UNINITIALIZED + tmp_2 ∈ UNINITIALIZED __retres ∈ UNINITIALIZED __malloc_init_inner_l72 ∈ {{ (int)&__malloc_init_inner_l72 }} - =END OF DUMP== + ==END OF DUMP== [value] computing for function analyze <- main. Called from tests/non-free/long_init3.c:91. [value] computing for function subanalyze <- analyze <- main. @@ -740,7 +722,6 @@ tests/non-free/long_init3.c:102:[value] allocating variable __malloc_main_l102 [value] done for function main - Values at end of function dmin: __retres ∈ [93.9166666667 .. 110.791666667] @@ -786,6 +767,7 @@ Values at end of function main: pr ∈ {{ &r ; &r2 }} pr2 ∈ {{ &r ; &r2 }} ppr ∈ {{ &pr ; &pr2 }} + alloc1 ∈ ESCAPINGADDR alloc3 ∈ {{ &__malloc_main_l102 }} inited ∈ {1} sa ∈ {{ "abc" }} diff --git a/tests/non-free/oracle/alloc.0.res.oracle b/tests/non-free/oracle/alloc.0.res.oracle index 7fca9f41018bea04e922032261356765ccba88fd..6434ec0e8f2c4b38ccde36009a103c46260eede9 100644 --- a/tests/non-free/oracle/alloc.0.res.oracle +++ b/tests/non-free/oracle/alloc.0.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/alloc.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {0} q ∈ {0} @@ -23,8 +22,8 @@ [value] computing for function malloc <- main. Called from tests/non-free/alloc.c:16. share/libc/stdlib.c:74:[value] allocating variable __malloc_malloc_l74 -share/libc/stdlib.h:294:[value] warning: function malloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/stdlib.h:299:[value] warning: function malloc, behavior no_allocation: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_malloc_fresh, generating default assigns from the prototype +share/libc/stdlib.h:320:[value] warning: function malloc, behavior allocation: postcondition got status unknown. [value] Recording results for malloc [value] Done for function malloc [value] computing for function malloc <- main. @@ -83,8 +82,8 @@ tests/non-free/alloc.c:36:[value] assertion 'Value,mem_access' got final status tests/non-free/alloc.c:37:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/alloc.c:42:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/alloc.c:43:[value] assertion 'Value,mem_access' got final status invalid. +[scope:rm_asserts] removing 2 assertion(s) [value] ====== VALUES COMPUTED ====== -share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype [value:final-states] Values at end of function malloc: [value:final-states] Values at end of function main: @@ -107,14 +106,14 @@ share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for func __malloc_malloc_l74_3[0] ∈ {35} [1] ∈ {36} [from] Computing for function malloc -[from] Computing for function Frama_C_alloc_size <-malloc -[from] Done for function Frama_C_alloc_size +[from] Computing for function Frama_C_malloc_fresh <-malloc +[from] Done for function Frama_C_malloc_fresh [from] Done for function malloc [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_size: +[from] Function Frama_C_malloc_fresh: \result FROM size [from] Function malloc: \result FROM size diff --git a/tests/non-free/oracle/alloc.1.res.oracle b/tests/non-free/oracle/alloc.1.res.oracle index a360517bded662b82155a25168cf64df082dbd88..4e8ab049d227c0c289d611b884090bbe8aae188c 100644 --- a/tests/non-free/oracle/alloc.1.res.oracle +++ b/tests/non-free/oracle/alloc.1.res.oracle @@ -1,16 +1,15 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/alloc.c (with preprocessing) [value] Analyzing a complete application starting at main_abs [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization NULL[rbits 2048 to 4103] ∈ [--..--] - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {0} q ∈ {0} @@ -24,8 +23,8 @@ [value] computing for function malloc <- main_abs. Called from tests/non-free/alloc.c:50. share/libc/stdlib.c:74:[value] allocating variable __malloc_malloc_l74 -share/libc/stdlib.h:294:[value] warning: function malloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/stdlib.h:299:[value] warning: function malloc, behavior no_allocation: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_malloc_fresh, generating default assigns from the prototype +share/libc/stdlib.h:320:[value] warning: function malloc, behavior allocation: postcondition got status unknown. [value] Recording results for malloc [value] Done for function malloc tests/non-free/alloc.c:51:[value] warning: signed overflow. assert -2147483648 ≤ -((int)q); @@ -38,7 +37,6 @@ tests/non-free/alloc.c:56:[value] warning: signed overflow. assert *q + 1 ≤ 21 [value] Recording results for main_abs [value] done for function main_abs [value] ====== VALUES COMPUTED ====== -share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype [value:final-states] Values at end of function malloc: [value:final-states] Values at end of function main_abs: @@ -51,14 +49,14 @@ share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for func __malloc_malloc_l74[bits 0 to 31] ∈ {{ NULL + [1..510] ; (? *)&__malloc_malloc_l74[1] }} [from] Computing for function malloc -[from] Computing for function Frama_C_alloc_size <-malloc -[from] Done for function Frama_C_alloc_size +[from] Computing for function Frama_C_malloc_fresh <-malloc +[from] Done for function Frama_C_malloc_fresh [from] Done for function malloc [from] Computing for function main_abs [from] Done for function main_abs [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_size: +[from] Function Frama_C_malloc_fresh: \result FROM size [from] Function malloc: \result FROM size diff --git a/tests/non-free/oracle/alloc_weak.res.oracle b/tests/non-free/oracle/alloc_weak.res.oracle index af92bb096540fc4e2f891df03089f70ebec42579..22d575f8d4764fe2e74f896a20c202eb6dda0b77 100644 --- a/tests/non-free/oracle/alloc_weak.res.oracle +++ b/tests/non-free/oracle/alloc_weak.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/alloc_weak.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] v ∈ [--..--] [value] computing for function main1 <- main. Called from tests/non-free/alloc_weak.c:46. diff --git a/tests/non-free/oracle/allocated.0.res.oracle b/tests/non-free/oracle/allocated.0.res.oracle index 5b4edb6b54ed0ff404363db75d1051e4a0852bf5..e9f4c77f8472255780d1887d251cbd67a0fea758 100644 --- a/tests/non-free/oracle/allocated.0.res.oracle +++ b/tests/non-free/oracle/allocated.0.res.oracle @@ -1,29 +1,28 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/allocated.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] tests/non-free/allocated.c:25:[value] allocating variable __malloc_main_l25 tests/non-free/allocated.c:25:[value] assertion got status valid. tests/non-free/allocated.c:27:[value] warning: out of bounds read. assert \valid_read(p + 1); tests/non-free/allocated.c:28:[value] warning: out of bounds read. assert \valid_read(p + 2); -[value] Called Frama_C_show_each_p({{ &__malloc_main_l25 }}) -[value] Called Frama_C_show_each_p0({18}) +tests/non-free/allocated.c:29:[value] Frama_C_show_each_p: {{ &__malloc_main_l25 }} +tests/non-free/allocated.c:30:[value] Frama_C_show_each_p0: {18} tests/non-free/allocated.c:31:[value:malloc] strong free on bases: {__malloc_main_l25} -[value] Called Frama_C_show_each_p_after_free({{ }}) +tests/non-free/allocated.c:32:[value] Frama_C_show_each_p_after_free: Bottom tests/non-free/allocated.c:36:[value] allocating variable __malloc_main_l36 tests/non-free/allocated.c:36:[value] assertion got status valid. -[value] Called Frama_C_show_each_p({{ &__malloc_main_l36 }}) -[value] Called Frama_C_show_each_p0({13}) -[value] Called Frama_C_show_each_p1({54}) +tests/non-free/allocated.c:40:[value] Frama_C_show_each_p: {{ &__malloc_main_l36 }} +tests/non-free/allocated.c:41:[value] Frama_C_show_each_p0: {13} +tests/non-free/allocated.c:42:[value] Frama_C_show_each_p1: {54} tests/non-free/allocated.c:43:[value:malloc] strong free on bases: {__malloc_main_l36} tests/non-free/allocated.c:44:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(&p); @@ -34,39 +33,38 @@ tests/non-free/allocated.c:46:[kernel] warning: all target addresses were invali tests/non-free/allocated.c:50:[value] allocating variable __malloc_main_l50 tests/non-free/allocated.c:50:[value] assertion got status valid. tests/non-free/allocated.c:53:[value] warning: out of bounds write. assert \valid(p + 2); -[value] Called Frama_C_show_each_p({{ &__malloc_main_l50 }}) -[value] Called Frama_C_show_each_p0({13}) -[value] Called Frama_C_show_each_p1({42}) -tests/non-free/allocated.c:57:[value] warning: out of bounds read. assert \valid_read(p + 2); -[value] Called Frama_C_show_each_p2({77}) +tests/non-free/allocated.c:54:[value] Frama_C_show_each_p: {{ &__malloc_main_l50 }} +tests/non-free/allocated.c:55:[value] Frama_C_show_each_p0: {13} +tests/non-free/allocated.c:56:[value] Frama_C_show_each_p1: {42} +tests/non-free/allocated.c:57:[value] Frama_C_show_each_p2: {77} tests/non-free/allocated.c:58:[value:malloc] strong free on bases: {__malloc_main_l50} tests/non-free/allocated.c:63:[value] allocating variable __malloc_main_l63 tests/non-free/allocated.c:63:[value] assertion got status valid. -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63 }}) -[value] Called Frama_C_show_each_p0({0}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {0} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63} -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63 }}) -[value] Called Frama_C_show_each_p0({1}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {1} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63} -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63 }}) -[value] Called Frama_C_show_each_p0({2}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {2} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63} -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63 }}) -[value] Called Frama_C_show_each_p0({3}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {3} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63} tests/non-free/allocated.c:73:[value] allocating variable __malloc_main_l73 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73 }}) -[value] Called Frama_C_show_each_p0({0}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {0} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73} tests/non-free/allocated.c:72:[value] entering loop for the first time -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73 }}) -[value] Called Frama_C_show_each_p0({1}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {1} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73} -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73 }}) -[value] Called Frama_C_show_each_p0({1; 2}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {1; 2} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73} -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73 }}) -[value] Called Frama_C_show_each_p0({1; 2; 3}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {1; 2; 3} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73} tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82 tests/non-free/allocated.c:82:[value] assertion got status valid. @@ -87,32 +85,57 @@ tests/non-free/allocated.c:91:[value] assertion got status valid. tests/non-free/allocated.c:92:[value:malloc] strong free on bases: {__malloc_main_l91} tests/non-free/allocated.c:96:[value] warning: assertion 'Assume' got status unknown. tests/non-free/allocated.c:97:[value] allocating variable __malloc_main_l97 -[value] Called Frama_C_show_each({{ &__malloc_main_l97 }}) +tests/non-free/allocated.c:97:[value] Frama_C_show_each: {{ &__malloc_main_l97 }} tests/non-free/allocated.c:98:[value] warning: out of bounds write. assert \valid(p); -tests/non-free/allocated.c:110:[value] warning: out of bounds read. assert \valid_read(&pb->i1); -[value] Called Frama_C_show_each({0}) +tests/non-free/allocated.c:110:[value] Frama_C_show_each: {0} tests/non-free/allocated.c:111:[value:malloc] strong free on bases: {__malloc_main_l97} tests/non-free/allocated.c:113:[value] warning: assertion got status unknown. tests/non-free/allocated.c:114:[value] allocating variable __malloc_main_l114 -[value] Called Frama_C_show_each({{ &__malloc_main_l114 }}) +tests/non-free/allocated.c:114:[value] Frama_C_show_each: {{ &__malloc_main_l114 }} tests/non-free/allocated.c:115:[value] warning: out of bounds write. assert \valid(p); -[value] Called Frama_C_show_each({0}) +tests/non-free/allocated.c:117:[value] Frama_C_show_each: {0} tests/non-free/allocated.c:118:[value:malloc] strong free on bases: {__malloc_main_l114} tests/non-free/allocated.c:120:[value] allocating variable __malloc_main_l120 -[value] Called Frama_C_show_each({{ &__malloc_main_l120 }}) -tests/non-free/allocated.c:123:[value] warning: out of bounds read. assert \valid_read(&pb->i1); +tests/non-free/allocated.c:120:[value] Frama_C_show_each: {{ &__malloc_main_l120 }} +tests/non-free/allocated.c:123:[value] Frama_C_show_each: Bottom tests/non-free/allocated.c:125:[value:malloc] strong free on bases: {__malloc_main_l120} +tests/non-free/allocated.c:127:[value] assertion 'alloca_bounds' got status valid. +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127 +tests/non-free/allocated.c:127:[kernel] warning: Neither code nor specification for function __fc_vla_alloc, generating default assigns from the prototype +tests/non-free/allocated.c:128:[value] entering loop for the first time +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:126:[value] entering loop for the first time +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31) to fit 0..63 +tests/non-free/allocated.c:129:[value] warning: out of bounds write. assert \valid(a + j); +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31/63) to fit 0..63/95 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1; 2} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31/95) to fit 0..63/127 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1; 2; 3} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31/127) to fit 0..63/159 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1; 2; 3; 4} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31/159) to fit 0..63/191 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0; 1; 2; 3; 4; 5} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31/191) to fit 0..63/319 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: [0..9] +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value:malloc] resizing variable `__malloc_main_l127' (0..31/319) to fit 0..63/319 [value] Recording results for main [value] done for function main tests/non-free/allocated.c:27:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/allocated.c:28:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/allocated.c:46:[value] assertion 'Value,dangling_pointer' got final status invalid. -tests/non-free/allocated.c:123:[value] assertion 'Value,mem_access' got final status invalid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: __fc_heap_status ∈ [--..--] - i ∈ {4} - j ∈ [0..2147483647] + i ∈ {10} + j ∈ [1..2147483647] p ∈ ESCAPINGADDR k ∈ {8; 12} size ∈ [1..100] @@ -125,9 +148,18 @@ tests/non-free/allocated.c:123:[value] assertion 'Value,mem_access' got final st [from] Done for function malloc [from] Computing for function free <-main [from] Done for function free +[from] Computing for function __fc_vla_alloc <-main +[from] Done for function __fc_vla_alloc +[from] Computing for function __fc_vla_free <-main +tests/non-free/allocated.c:127:[kernel] warning: Neither code nor specification for function __fc_vla_free, generating default assigns from the prototype +[from] Done for function __fc_vla_free [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: +[from] Function __fc_vla_alloc: + \result FROM \nothing +[from] Function __fc_vla_free: + NO EFFECTS [from] Function free: __fc_heap_status FROM __fc_heap_status (and SELF) [from] Function malloc: @@ -143,14 +175,17 @@ tests/non-free/allocated.c:123:[value] assertion 'Value,mem_access' got final st __malloc_w_main_l82[0..2] FROM __fc_heap_status; nondet (and SELF) __malloc_main_l97[0] FROM __fc_heap_status; nondet __malloc_main_l114[0..3] FROM __fc_heap_status; nondet + __malloc_main_l127[0..9] FROM \nothing (and SELF) \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - __fc_heap_status; i; j; p; tmp; tmp_3; k; tmp_4; size; pb; __retres; - __malloc_main_l25; __malloc_main_l36[0..1]; __malloc_main_l50[0..2]; - __malloc_main_l63; __malloc_main_l73; __malloc_w_main_l82[0..2]; - __malloc_main_l97[0]; __malloc_main_l114[0..3] + __fc_heap_status; i; j; p; tmp; tmp_3; k; tmp_4; size; pb; a; __lengthof_a; + __retres; __malloc_main_l25; __malloc_main_l36[0..1]; + __malloc_main_l50[0..2]; __malloc_main_l63; __malloc_main_l73; + __malloc_w_main_l82[0..2]; __malloc_main_l97[0]; __malloc_main_l114[0..3]; + __malloc_main_l127[0..9] [inout] Inputs for function main: __fc_heap_status; nondet; __malloc_main_l25; __malloc_main_l36[0..1]; __malloc_main_l50[0..2]; __malloc_main_l63; __malloc_main_l73; - __malloc_main_l97[0][bits 0 to 0]; __malloc_main_l114[0][bits 0 to 0] + __malloc_main_l97[0][bits 0 to 0]; __malloc_main_l114[0][bits 0 to 0]; + __malloc_main_l127[0..9] diff --git a/tests/non-free/oracle/allocated.1.res.oracle b/tests/non-free/oracle/allocated.1.res.oracle index afcda88baff1c97ff8d1fdfcfb5074a21b1d8f9a..fb8f1d70465eb40915fcaebe60e69b4589ee4c29 100644 --- a/tests/non-free/oracle/allocated.1.res.oracle +++ b/tests/non-free/oracle/allocated.1.res.oracle @@ -1,29 +1,32 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/allocated.c (with preprocessing) +[value] user error: no assigns specified for function '__fc_vla_free', for which a builtin + or the specification will be used. Potential unsoundness. +[value] user error: no assigns specified for function '__fc_vla_alloc', for which a builtin + or the specification will be used. Potential unsoundness. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] tests/non-free/allocated.c:25:[value] allocating variable __malloc_main_l25 tests/non-free/allocated.c:25:[value] assertion got status valid. tests/non-free/allocated.c:27:[value] warning: out of bounds read. assert \valid_read(p + 1); tests/non-free/allocated.c:28:[value] warning: out of bounds read. assert \valid_read(p + 2); -[value] Called Frama_C_show_each_p({{ &__malloc_main_l25 }}) -[value] Called Frama_C_show_each_p0({18}) +tests/non-free/allocated.c:29:[value] Frama_C_show_each_p: {{ &__malloc_main_l25 }} +tests/non-free/allocated.c:30:[value] Frama_C_show_each_p0: {18} tests/non-free/allocated.c:31:[value:malloc] strong free on bases: {__malloc_main_l25} -[value] Called Frama_C_show_each_p_after_free({{ }}) +tests/non-free/allocated.c:32:[value] Frama_C_show_each_p_after_free: Bottom tests/non-free/allocated.c:36:[value] allocating variable __malloc_main_l36 tests/non-free/allocated.c:36:[value] assertion got status valid. -[value] Called Frama_C_show_each_p({{ &__malloc_main_l36 }}) -[value] Called Frama_C_show_each_p0({13}) -[value] Called Frama_C_show_each_p1({54}) +tests/non-free/allocated.c:40:[value] Frama_C_show_each_p: {{ &__malloc_main_l36 }} +tests/non-free/allocated.c:41:[value] Frama_C_show_each_p0: {13} +tests/non-free/allocated.c:42:[value] Frama_C_show_each_p1: {54} tests/non-free/allocated.c:43:[value:malloc] strong free on bases: {__malloc_main_l36} tests/non-free/allocated.c:44:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(&p); @@ -37,43 +40,43 @@ tests/non-free/allocated.c:50:[value] allocating variable __malloc_main_l50_0 tests/non-free/allocated.c:50:[value] assertion got status valid. tests/non-free/allocated.c:53:[value] warning: out of bounds write. assert \valid(p + 2); tests/non-free/allocated.c:53:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -[value] Called Frama_C_show_each_p({{ &__malloc_main_l50_0 }}) -[value] Called Frama_C_show_each_p0({13}) -[value] Called Frama_C_show_each_p1({42}) -[value] Called Frama_C_show_each_p2({77}) +tests/non-free/allocated.c:54:[value] Frama_C_show_each_p: {{ &__malloc_main_l50_0 }} +tests/non-free/allocated.c:55:[value] Frama_C_show_each_p0: {13} +tests/non-free/allocated.c:56:[value] Frama_C_show_each_p1: {42} +tests/non-free/allocated.c:57:[value] Frama_C_show_each_p2: {77} tests/non-free/allocated.c:58:[value:malloc] strong free on bases: {__malloc_main_l50_0} tests/non-free/allocated.c:63:[value] allocating variable __malloc_main_l63 tests/non-free/allocated.c:63:[value] assertion got status valid. -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63 }}) -[value] Called Frama_C_show_each_p0({0}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {0} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63} tests/non-free/allocated.c:63:[value] allocating variable __malloc_main_l63_0 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63_0 }}) -[value] Called Frama_C_show_each_p0({1}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63_0 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {1} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63_0} tests/non-free/allocated.c:63:[value] allocating variable __malloc_main_l63_1 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63_1 }}) -[value] Called Frama_C_show_each_p0({2}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63_1 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {2} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63_1} tests/non-free/allocated.c:63:[value] allocating variable __malloc_main_l63_2 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l63_2 }}) -[value] Called Frama_C_show_each_p0({3}) +tests/non-free/allocated.c:65:[value] Frama_C_show_each_p: {{ &__malloc_main_l63_2 }} +tests/non-free/allocated.c:66:[value] Frama_C_show_each_p0: {3} tests/non-free/allocated.c:67:[value:malloc] strong free on bases: {__malloc_main_l63_2} tests/non-free/allocated.c:73:[value] allocating variable __malloc_main_l73 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73 }}) -[value] Called Frama_C_show_each_p0({0}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {0} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73} tests/non-free/allocated.c:73:[value] allocating variable __malloc_main_l73_0 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73_0 }}) -[value] Called Frama_C_show_each_p0({1}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73_0 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {1} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73_0} tests/non-free/allocated.c:73:[value] allocating variable __malloc_main_l73_1 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73_1 }}) -[value] Called Frama_C_show_each_p0({2}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73_1 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {2} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73_1} tests/non-free/allocated.c:73:[value] allocating variable __malloc_main_l73_2 -[value] Called Frama_C_show_each_p({{ &__malloc_main_l73_2 }}) -[value] Called Frama_C_show_each_p0({3}) +tests/non-free/allocated.c:75:[value] Frama_C_show_each_p: {{ &__malloc_main_l73_2 }} +tests/non-free/allocated.c:76:[value] Frama_C_show_each_p0: {3} tests/non-free/allocated.c:77:[value:malloc] strong free on bases: {__malloc_main_l73_2} tests/non-free/allocated.c:82:[value] allocating variable __malloc_main_l82 tests/non-free/allocated.c:82:[value] assertion got status valid. @@ -334,32 +337,62 @@ tests/non-free/allocated.c:91:[value] assertion got status valid. tests/non-free/allocated.c:92:[value:malloc] strong free on bases: {__malloc_main_l91} tests/non-free/allocated.c:96:[value] warning: assertion 'Assume' got status unknown. tests/non-free/allocated.c:97:[value] allocating variable __malloc_main_l97 -[value] Called Frama_C_show_each({{ &__malloc_main_l97 }}) +tests/non-free/allocated.c:97:[value] Frama_C_show_each: {{ &__malloc_main_l97 }} tests/non-free/allocated.c:98:[value] warning: out of bounds write. assert \valid(p); -tests/non-free/allocated.c:110:[value] warning: out of bounds read. assert \valid_read(&pb->i1); -[value] Called Frama_C_show_each({0}) +tests/non-free/allocated.c:110:[value] Frama_C_show_each: {0} tests/non-free/allocated.c:111:[value:malloc] strong free on bases: {__malloc_main_l97} tests/non-free/allocated.c:113:[value] warning: assertion got status unknown. tests/non-free/allocated.c:114:[value] allocating variable __malloc_main_l114 -[value] Called Frama_C_show_each({{ &__malloc_main_l114 }}) +tests/non-free/allocated.c:114:[value] Frama_C_show_each: {{ &__malloc_main_l114 }} tests/non-free/allocated.c:115:[value] warning: out of bounds write. assert \valid(p); -[value] Called Frama_C_show_each({0}) +tests/non-free/allocated.c:117:[value] Frama_C_show_each: {0} tests/non-free/allocated.c:118:[value:malloc] strong free on bases: {__malloc_main_l114} tests/non-free/allocated.c:120:[value] allocating variable __malloc_main_l120 -[value] Called Frama_C_show_each({{ &__malloc_main_l120 }}) -tests/non-free/allocated.c:123:[value] warning: out of bounds read. assert \valid_read(&pb->i1); +tests/non-free/allocated.c:120:[value] Frama_C_show_each: {{ &__malloc_main_l120 }} +tests/non-free/allocated.c:123:[value] Frama_C_show_each: Bottom tests/non-free/allocated.c:125:[value:malloc] strong free on bases: {__malloc_main_l120} +tests/non-free/allocated.c:127:[value] assertion 'alloca_bounds' got status valid. +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127 +tests/non-free/allocated.c:127:[kernel] warning: Neither code nor specification for function __fc_vla_alloc, generating default assigns from the prototype +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {0} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_0 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {1} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_0} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_1 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {2} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_1} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_2 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {3} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_2} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_3 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {4} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_3} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_4 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {5} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_4} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_5 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {6} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_5} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_6 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {7} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_6} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_7 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {8} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_7} +tests/non-free/allocated.c:127:[value] allocating variable __malloc_main_l127_8 +tests/non-free/allocated.c:131:[value] Frama_C_show_each: {9} +tests/non-free/allocated.c:127:[value:malloc] strong free on bases: {__malloc_main_l127_8} [value] Recording results for main [value] done for function main tests/non-free/allocated.c:27:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/allocated.c:28:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/allocated.c:46:[value] assertion 'Value,dangling_pointer' got final status invalid. -tests/non-free/allocated.c:123:[value] assertion 'Value,mem_access' got final status invalid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: __fc_heap_status ∈ [--..--] - i ∈ {4} - j ∈ {3} + i ∈ {10} + j ∈ {10} p ∈ ESCAPINGADDR k ∈ {12} size ∈ [1..100] @@ -454,9 +487,18 @@ tests/non-free/allocated.c:123:[value] assertion 'Value,mem_access' got final st [from] Done for function malloc [from] Computing for function free <-main [from] Done for function free +[from] Computing for function __fc_vla_alloc <-main +[from] Done for function __fc_vla_alloc +[from] Computing for function __fc_vla_free <-main +tests/non-free/allocated.c:127:[kernel] warning: Neither code nor specification for function __fc_vla_free, generating default assigns from the prototype +[from] Done for function __fc_vla_free [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: +[from] Function __fc_vla_alloc: + \result FROM \nothing +[from] Function __fc_vla_free: + NO EFFECTS [from] Function free: __fc_heap_status FROM __fc_heap_status (and SELF) [from] Function malloc: @@ -510,33 +552,53 @@ tests/non-free/allocated.c:123:[value] assertion 'Value,mem_access' got final st __malloc_main_l82_30[0..2] FROM __fc_heap_status; nondet (and SELF) __malloc_main_l97[0] FROM __fc_heap_status; nondet __malloc_main_l114[0..3] FROM __fc_heap_status; nondet + __malloc_main_l127 FROM \nothing (and SELF) + __malloc_main_l127_0[0..1] FROM \nothing (and SELF) + __malloc_main_l127_1[0..2] FROM \nothing (and SELF) + __malloc_main_l127_2[0..3] FROM \nothing (and SELF) + __malloc_main_l127_3[0..4] FROM \nothing (and SELF) + __malloc_main_l127_4[0..5] FROM \nothing (and SELF) + __malloc_main_l127_5[0..6] FROM \nothing (and SELF) + __malloc_main_l127_6[0..7] FROM \nothing (and SELF) + __malloc_main_l127_7[0..8] FROM \nothing (and SELF) + __malloc_main_l127_8[0..9] FROM \nothing (and SELF) \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - __fc_heap_status; i; j; p; tmp; tmp_3; k; tmp_4; size; pb; __retres; - __malloc_main_l25; __malloc_main_l36[0..1]; __malloc_main_l50[0..1]; - __malloc_main_l50_0[0..2]; __malloc_main_l63; __malloc_main_l63_0; - __malloc_main_l63_1; __malloc_main_l63_2; __malloc_main_l73; - __malloc_main_l73_0; __malloc_main_l73_1; __malloc_main_l73_2; - __malloc_main_l82_0; __malloc_main_l82_1; __malloc_main_l82_2[0..1]; - __malloc_main_l82_3[0..1]; __malloc_main_l82_4[0..1]; - __malloc_main_l82_5[0..1]; __malloc_main_l82_6[0..1]; - __malloc_main_l82_7[0..2]; __malloc_main_l82_8[0..2]; - __malloc_main_l82_9[0..2]; __malloc_main_l82_10[0..2]; - __malloc_main_l82_11[0..2]; __malloc_main_l82_12[0..2]; - __malloc_main_l82_13[0..2]; __malloc_main_l82_14[0..2]; - __malloc_main_l82_15[0..2]; __malloc_main_l82_16[0..2]; - __malloc_main_l82_17[0..2]; __malloc_main_l82_18[0..2]; - __malloc_main_l82_19[0..2]; __malloc_main_l82_20[0..2]; - __malloc_main_l82_21[0..2]; __malloc_main_l82_22[0..2]; - __malloc_main_l82_23[0..2]; __malloc_main_l82_24[0..2]; - __malloc_main_l82_25[0..2]; __malloc_main_l82_26[0..2]; - __malloc_main_l82_27[0..2]; __malloc_main_l82_28[0..2]; - __malloc_main_l82_29[0..2]; __malloc_main_l82_30[0..2]; - __malloc_main_l97[0]; __malloc_main_l114[0..3] + __fc_heap_status; i; j; p; tmp; tmp_3; k; tmp_4; size; pb; a; __lengthof_a; + __retres; __malloc_main_l25; __malloc_main_l36[0..1]; + __malloc_main_l50[0..1]; __malloc_main_l50_0[0..2]; __malloc_main_l63; + __malloc_main_l63_0; __malloc_main_l63_1; __malloc_main_l63_2; + __malloc_main_l73; __malloc_main_l73_0; __malloc_main_l73_1; + __malloc_main_l73_2; __malloc_main_l82_0; __malloc_main_l82_1; + __malloc_main_l82_2[0..1]; __malloc_main_l82_3[0..1]; + __malloc_main_l82_4[0..1]; __malloc_main_l82_5[0..1]; + __malloc_main_l82_6[0..1]; __malloc_main_l82_7[0..2]; + __malloc_main_l82_8[0..2]; __malloc_main_l82_9[0..2]; + __malloc_main_l82_10[0..2]; __malloc_main_l82_11[0..2]; + __malloc_main_l82_12[0..2]; __malloc_main_l82_13[0..2]; + __malloc_main_l82_14[0..2]; __malloc_main_l82_15[0..2]; + __malloc_main_l82_16[0..2]; __malloc_main_l82_17[0..2]; + __malloc_main_l82_18[0..2]; __malloc_main_l82_19[0..2]; + __malloc_main_l82_20[0..2]; __malloc_main_l82_21[0..2]; + __malloc_main_l82_22[0..2]; __malloc_main_l82_23[0..2]; + __malloc_main_l82_24[0..2]; __malloc_main_l82_25[0..2]; + __malloc_main_l82_26[0..2]; __malloc_main_l82_27[0..2]; + __malloc_main_l82_28[0..2]; __malloc_main_l82_29[0..2]; + __malloc_main_l82_30[0..2]; __malloc_main_l97[0]; __malloc_main_l114[0..3]; + __malloc_main_l127; __malloc_main_l127_0[0..1]; __malloc_main_l127_1[0..2]; + __malloc_main_l127_2[0..3]; __malloc_main_l127_3[0..4]; + __malloc_main_l127_4[0..5]; __malloc_main_l127_5[0..6]; + __malloc_main_l127_6[0..7]; __malloc_main_l127_7[0..8]; + __malloc_main_l127_8[0..9] [inout] Inputs for function main: __fc_heap_status; nondet; __malloc_main_l25; __malloc_main_l36[0..1]; __malloc_main_l50_0[0..2]; __malloc_main_l63; __malloc_main_l63_0; __malloc_main_l63_1; __malloc_main_l63_2; __malloc_main_l73; __malloc_main_l73_0; __malloc_main_l73_1; __malloc_main_l73_2; - __malloc_main_l97[0][bits 0 to 0]; __malloc_main_l114[0][bits 0 to 0] + __malloc_main_l97[0][bits 0 to 0]; __malloc_main_l114[0][bits 0 to 0]; + __malloc_main_l127; __malloc_main_l127_0[0..1]; __malloc_main_l127_1[0..2]; + __malloc_main_l127_2[0..3]; __malloc_main_l127_3[0..4]; + __malloc_main_l127_4[0..5]; __malloc_main_l127_5[0..6]; + __malloc_main_l127_6[0..7]; __malloc_main_l127_7[0..8]; + __malloc_main_l127_8[0..9] diff --git a/tests/non-free/oracle/big_local_array.0.res.oracle b/tests/non-free/oracle/big_local_array.0.res.oracle index 6613a4cf586184e5b7c1bce033aa5a0101908750..73d9ffaa7ee8229a0f65964c6161e8eed762b641 100644 --- a/tests/non-free/oracle/big_local_array.0.res.oracle +++ b/tests/non-free/oracle/big_local_array.0.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/big_local_array.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Call to builtin bzero(({{ (unsigned char *)&x }},{10496})) [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -26,126 +24,20 @@ {[3].b[18..31]; [4..31]} ∈ {0} __retres ∈ {0} [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Properties of Function 'Frama_C_bzero' --------------------------------------------------------------------------------- - -[ Extern ] Post-condition (file share/libc/__fc_builtin_for_normalization.i, line 32) - Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Valid ] Default behavior - by Frama-C kernel. - -------------------------------------------------------------------------------- ---- Properties of Function 'main' --------------------------------------------------------------------------------- - -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Assigns for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Behavior 'Frama_C_implicit_init' at block - by Frama-C kernel. - --------------------------------------------------------------------------------- ---- Status Report Summary --------------------------------------------------------------------------------- - 19 Completely validated - 3 Considered valid - 22 Total +--- No status to report -------------------------------------------------------------------------------- /* Generated by Frama-C */ struct S { int a[50] ; int b[32] ; }; -/*@ requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - assigns *(dest + (0 .. n - 1)); - assigns *(dest + (0 .. n - 1)) \from \nothing; - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(unsigned char *dest, - unsigned long n); - int main(void) { int __retres; - struct S x[32]; - /*@ behavior Frama_C_implicit_init: - ensures x[0].a[0] ≡ 1; - ensures x[0].a[1] ≡ 2; - ensures x[0].a[2] ≡ 3; - ensures ∀ ℤ __i; 3 ≤ __i ≤ 49 ⇒ x[0].a[__i] ≡ 0; - ensures x[0].b[5] ≡ 5; - ensures x[0].b[6] ≡ 6; - ensures x[0].b[7] ≡ 7; - ensures - ∀ ℤ __i; - 0 ≤ __i ≤ 4 ∧ 8 ≤ __i ≤ 31 ⇒ x[0].b[__i] ≡ 0; - ensures x[3].a[0] ≡ 0; - ensures x[3].a[1] ≡ 1; - ensures x[3].a[2] ≡ 2; - ensures x[3].a[3] ≡ 3; - ensures ∀ ℤ __i; 4 ≤ __i ≤ 49 ⇒ x[3].a[__i] ≡ 0; - ensures x[3].b[17] ≡ 17; - ensures - ∀ ℤ __i; - 0 ≤ __i ≤ 16 ∧ 18 ≤ __i ≤ 31 ⇒ x[3].b[__i] ≡ 0; - ensures - ∀ ℤ __i; - 1 ≤ __i ≤ 2 ∧ 4 ≤ __i ≤ 31 ⇒ - (∀ ℤ __i0; 0 ≤ __i0 < 50 ⇒ x[__i].a[__i0] ≡ 0) ∧ - (∀ ℤ __i0; 0 ≤ __i0 < 32 ⇒ x[__i].b[__i0] ≡ 0); - assigns x[0 .. 32 - 1]; - */ - { - Frama_C_bzero((unsigned char *)(x),(unsigned long)sizeof(struct S [32])); - x[0].a[0] = 1; - x[0].a[1] = 2; - x[0].a[2] = 3; - x[0].b[5] = 5; - x[0].b[6] = 6; - x[0].b[7] = 7; - x[3].a[0] = 0; - x[3].a[1] = 1; - x[3].a[2] = 2; - x[3].a[3] = 3; - x[3].b[17] = 17; - } + struct S x[32] = + {{.a = {1, 2, 3}, .b = {[5] = 5, 6, 7}}, + [3] = {.a = {0, 1, 2, 3}, .b = {[17] = 17}}}; __retres = 0; return __retres; } diff --git a/tests/non-free/oracle/big_local_array.1.res.oracle b/tests/non-free/oracle/big_local_array.1.res.oracle index 42809cb562bce8214df223085b996e142b98c166..4ec4a8e981d604988d7d21f17ed816cf038d645c 100644 --- a/tests/non-free/oracle/big_local_array.1.res.oracle +++ b/tests/non-free/oracle/big_local_array.1.res.oracle @@ -1,128 +1,20 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/big_local_array.i (no preprocessing) -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/big_local_array.i (no preprocessing) [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Properties of Function 'Frama_C_bzero' --------------------------------------------------------------------------------- - -[ Extern ] Post-condition (file share/libc/__fc_builtin_for_normalization.i, line 32) - Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Valid ] Default behavior - by Frama-C kernel. - -------------------------------------------------------------------------------- ---- Properties of Function 'main' --------------------------------------------------------------------------------- - -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 14) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 15) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Assigns for 'Frama_C_implicit_init' (file tests/non-free/big_local_array.i, line 13) at block - by Frama-C kernel. -[ Valid ] Behavior 'Frama_C_implicit_init' at block - by Frama-C kernel. - --------------------------------------------------------------------------------- ---- Status Report Summary --------------------------------------------------------------------------------- - 19 Completely validated - 3 Considered valid - 22 Total +--- No status to report -------------------------------------------------------------------------------- /* Generated by Frama-C */ struct S { int a[50] ; int b[32] ; }; -/*@ requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - assigns *(dest + (0 .. n - 1)); - assigns *(dest + (0 .. n - 1)) \from \nothing; - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(unsigned char *dest, - unsigned long n); - int main(void) { int __retres; - struct S x[32]; - /*@ behavior Frama_C_implicit_init: - ensures x[0].a[0] ≡ 1; - ensures x[0].a[1] ≡ 2; - ensures x[0].a[2] ≡ 3; - ensures ∀ ℤ __i; 3 ≤ __i ≤ 49 ⇒ x[0].a[__i] ≡ 0; - ensures x[0].b[5] ≡ 5; - ensures x[0].b[6] ≡ 6; - ensures x[0].b[7] ≡ 7; - ensures - ∀ ℤ __i; - 0 ≤ __i ≤ 4 ∧ 8 ≤ __i ≤ 31 ⇒ x[0].b[__i] ≡ 0; - ensures x[3].a[0] ≡ 0; - ensures x[3].a[1] ≡ 1; - ensures x[3].a[2] ≡ 2; - ensures x[3].a[3] ≡ 3; - ensures ∀ ℤ __i; 4 ≤ __i ≤ 49 ⇒ x[3].a[__i] ≡ 0; - ensures x[3].b[17] ≡ 17; - ensures - ∀ ℤ __i; - 0 ≤ __i ≤ 16 ∧ 18 ≤ __i ≤ 31 ⇒ x[3].b[__i] ≡ 0; - ensures - ∀ ℤ __i; - 1 ≤ __i ≤ 2 ∧ 4 ≤ __i ≤ 31 ⇒ - (∀ ℤ __i0; 0 ≤ __i0 < 50 ⇒ x[__i].a[__i0] ≡ 0) ∧ - (∀ ℤ __i0; 0 ≤ __i0 < 32 ⇒ x[__i].b[__i0] ≡ 0); - assigns x[0 .. 32 - 1]; - */ - { - Frama_C_bzero((unsigned char *)(x),(unsigned long)sizeof(struct S [32])); - x[0].a[0] = 1; - x[0].a[1] = 2; - x[0].a[2] = 3; - x[0].b[5] = 5; - x[0].b[6] = 6; - x[0].b[7] = 7; - x[3].a[0] = 0; - x[3].a[1] = 1; - x[3].a[2] = 2; - x[3].a[3] = 3; - x[3].b[17] = 17; - } + struct S x[32] = + {{.a = {1, 2, 3}, .b = {[5] = 5, 6, 7}}, + [3] = {.a = {0, 1, 2, 3}, .b = {[17] = 17}}}; __retres = 0; return __retres; } diff --git a/tests/non-free/oracle/big_local_array.2.res.oracle b/tests/non-free/oracle/big_local_array.2.res.oracle index e4df91a6fd7cf1924e16ccbb94865b14c9b8229f..f587a473f9b338127d9b80bed2459d6682de049a 100644 --- a/tests/non-free/oracle/big_local_array.2.res.oracle +++ b/tests/non-free/oracle/big_local_array.2.res.oracle @@ -1,13 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/big_local_array.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/non-free/big_local_array.i:13:[value] Call to builtin copy_block(({{ (unsigned char *)&x }},{4},{50})) -tests/non-free/big_local_array.i:13:[value] Call to builtin copy_block(({{ (unsigned char *)&x[0].b }},{4},{32})) -tests/non-free/big_local_array.i:13:[value] Call to builtin copy_block(({{ (unsigned char *)&x }},{328},{32})) [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -32,71 +28,12 @@ struct S { int a[50] ; int b[32] ; }; -/*@ requires \valid(dest + (0 .. size * n - 1)); - requires n ≥ 1; - ensures - ∀ ℤ i, ℤ j; - 0 ≤ i < \old(size) ∧ 1 ≤ j < \old(n) ⇒ - *(\old(dest) + (i + j * \old(size))) ≡ *(\old(dest) + i); - assigns *(dest + (size .. size * n - 1)); - assigns *(dest + (size .. size * n - 1)) \from *(dest + (0 .. size - 1)); - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_copy_block(unsigned char *dest, - unsigned long size, - unsigned long n); - int main(void) { int __retres; - struct S x[32]; - /*@ behavior Frama_C_implicit_init: - ensures x[0].a[0] ≡ 1; - ensures x[0].a[1] ≡ 2; - ensures x[0].a[2] ≡ 3; - ensures ∀ ℤ __i; 3 ≤ __i ≤ 49 ⇒ x[0].a[__i] ≡ 0; - ensures x[0].b[5] ≡ 5; - ensures x[0].b[6] ≡ 6; - ensures x[0].b[7] ≡ 7; - ensures - ∀ ℤ __i; - 0 ≤ __i ≤ 4 ∧ 8 ≤ __i ≤ 31 ⇒ x[0].b[__i] ≡ 0; - ensures x[3].a[0] ≡ 0; - ensures x[3].a[1] ≡ 1; - ensures x[3].a[2] ≡ 2; - ensures x[3].a[3] ≡ 3; - ensures ∀ ℤ __i; 4 ≤ __i ≤ 49 ⇒ x[3].a[__i] ≡ 0; - ensures x[3].b[17] ≡ 17; - ensures - ∀ ℤ __i; - 0 ≤ __i ≤ 16 ∧ 18 ≤ __i ≤ 31 ⇒ x[3].b[__i] ≡ 0; - ensures - ∀ ℤ __i; - 1 ≤ __i ≤ 2 ∧ 4 ≤ __i ≤ 31 ⇒ - (∀ ℤ __i0; 0 ≤ __i0 < 50 ⇒ x[__i].a[__i0] ≡ 0) ∧ - (∀ ℤ __i0; 0 ≤ __i0 < 32 ⇒ x[__i].b[__i0] ≡ 0); - assigns x[0 .. 32 - 1]; - */ - { - x[0].a[0] = 0; - Frama_C_copy_block((unsigned char *)(x[0].a),(unsigned long)sizeof(int), - 50UL); - x[0].b[0] = 0; - Frama_C_copy_block((unsigned char *)(x[0].b),(unsigned long)sizeof(int), - 32UL); - Frama_C_copy_block((unsigned char *)(x),(unsigned long)sizeof(struct S), - 32UL); - x[0].a[0] = 1; - x[0].a[1] = 2; - x[0].a[2] = 3; - x[0].b[5] = 5; - x[0].b[6] = 6; - x[0].b[7] = 7; - x[3].a[0] = 0; - x[3].a[1] = 1; - x[3].a[2] = 2; - x[3].a[3] = 3; - x[3].b[17] = 17; - } + struct S x[32] = + {{.a = {1, 2, 3}, .b = {[5] = 5, 6, 7}}, + [3] = {.a = {0, 1, 2, 3}, .b = {[17] = 17}}}; __retres = 0; return __retres; } diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_string.err.oracle b/tests/non-free/oracle/calloc.0.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_string.err.oracle rename to tests/non-free/oracle/calloc.0.err.oracle diff --git a/tests/non-free/oracle/calloc.0.res.oracle b/tests/non-free/oracle/calloc.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..d40ce72a7e25bb98524e16e18d4a2ef6702f6a59 --- /dev/null +++ b/tests/non-free/oracle/calloc.0.res.oracle @@ -0,0 +1,69 @@ +[kernel] Parsing tests/non-free/calloc.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + nondet ∈ [--..--] +[value] computing for function calloc <- main. + Called from tests/non-free/calloc.c:14. +[value] using specification for function calloc +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/non-free/calloc.c:17. +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/non-free/calloc.c:20. +[value] Done for function calloc +[value] computing for function calloc <- main. + Called from tests/non-free/calloc.c:23. +[value] Done for function calloc +tests/non-free/calloc.c:25:[value] warning: assertion got status unknown. +tests/non-free/calloc.c:26:[value] warning: assertion got status unknown. +[value] computing for function calloc <- main. + Called from tests/non-free/calloc.c:28. +[value] Done for function calloc +tests/non-free/calloc.c:30:[value] warning: assertion got status unknown. +tests/non-free/calloc.c:31:[value] warning: assertion got status unknown. +tests/non-free/calloc.c:32:[value] warning: assertion got status unknown. +[value] computing for function calloc <- main. + Called from tests/non-free/calloc.c:34. +[value] Done for function calloc +tests/non-free/calloc.c:36:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + p1 ∈ + {{ NULL + [0..4294967295] ; &alloced_return_calloc + [0..2147483647] }} + p2 ∈ + {{ NULL + [0..4294967295] ; &alloced_return_calloc + [0..2147483647] }} + p3 ∈ + {{ NULL + [0..4294967295] ; &alloced_return_calloc + [0..2147483647] }} + p4 ∈ {{ NULL ; &alloced_return_calloc + [0..2147483647] }} + p5 ∈ {{ NULL ; &alloced_return_calloc + [0..2147483647] }} + p9001 ∈ {0} + __retres ∈ {0; 1} +[from] Computing for function main +[from] Computing for function calloc <-main +[from] Done for function calloc +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function calloc: + __fc_heap_status FROM __fc_heap_status; nmemb; size (and SELF) + \result FROM __fc_heap_status; nmemb; size +[from] Function main: + __fc_heap_status FROM __fc_heap_status (and SELF) + \result FROM __fc_heap_status +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main: + __fc_heap_status; p1; p2; p3; p4; p5; p9001; __retres +[inout] Inputs for function main: + __fc_heap_status diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_swap.err.oracle b/tests/non-free/oracle/calloc.1.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle/user_swap.err.oracle rename to tests/non-free/oracle/calloc.1.err.oracle diff --git a/tests/non-free/oracle/calloc.1.res.oracle b/tests/non-free/oracle/calloc.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..63348709e474c96bb7a57b62f56dc22ad32c7d22 --- /dev/null +++ b/tests/non-free/oracle/calloc.1.res.oracle @@ -0,0 +1,53 @@ +[kernel] Parsing tests/non-free/calloc.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + nondet ∈ [--..--] +tests/non-free/calloc.c:14:[value] allocating variable __calloc_main_l14 +tests/non-free/calloc.c:17:[value] allocating variable __calloc_main_l17 +tests/non-free/calloc.c:20:[value] allocating variable __calloc_main_l20 +tests/non-free/calloc.c:23:[value] allocating variable __calloc_main_l23 +tests/non-free/calloc.c:25:[value] assertion got status valid. +tests/non-free/calloc.c:26:[value] assertion got status valid. +tests/non-free/calloc.c:28:[value] allocating variable __calloc_main_l28 +tests/non-free/calloc.c:30:[value] assertion got status valid. +tests/non-free/calloc.c:31:[value] assertion got status valid. +tests/non-free/calloc.c:32:[value] assertion got status valid. +tests/non-free/calloc.c:34:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/non-free/calloc.c:36:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + p1 ∈ {{ &__calloc_main_l14[0] }} + p2 ∈ {{ &__calloc_main_l17[0] }} + p3 ∈ {{ &__calloc_main_l20[0] }} + p4 ∈ {{ &__calloc_main_l23 }} + p5 ∈ {{ &__calloc_main_l28[0] }} + p9001 ∈ {0} + __retres ∈ {0} +[from] Computing for function main +[from] Computing for function calloc <-main +[from] Done for function calloc +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function calloc: + __fc_heap_status FROM __fc_heap_status; nmemb; size (and SELF) + \result FROM __fc_heap_status; nmemb; size +[from] Function main: + __fc_heap_status FROM __fc_heap_status (and SELF) + \result FROM __fc_heap_status +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main: + __fc_heap_status; p1; p2; p3; p4; p5; p9001; __retres +[inout] Inputs for function main: + __fc_heap_status diff --git a/src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.1.err.oracle b/tests/non-free/oracle/calloc.2.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_typed/oracle_qualif/unit_float.1.err.oracle rename to tests/non-free/oracle/calloc.2.err.oracle diff --git a/tests/non-free/oracle/calloc.2.res.oracle b/tests/non-free/oracle/calloc.2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..63348709e474c96bb7a57b62f56dc22ad32c7d22 --- /dev/null +++ b/tests/non-free/oracle/calloc.2.res.oracle @@ -0,0 +1,53 @@ +[kernel] Parsing tests/non-free/calloc.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + nondet ∈ [--..--] +tests/non-free/calloc.c:14:[value] allocating variable __calloc_main_l14 +tests/non-free/calloc.c:17:[value] allocating variable __calloc_main_l17 +tests/non-free/calloc.c:20:[value] allocating variable __calloc_main_l20 +tests/non-free/calloc.c:23:[value] allocating variable __calloc_main_l23 +tests/non-free/calloc.c:25:[value] assertion got status valid. +tests/non-free/calloc.c:26:[value] assertion got status valid. +tests/non-free/calloc.c:28:[value] allocating variable __calloc_main_l28 +tests/non-free/calloc.c:30:[value] assertion got status valid. +tests/non-free/calloc.c:31:[value] assertion got status valid. +tests/non-free/calloc.c:32:[value] assertion got status valid. +tests/non-free/calloc.c:34:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/non-free/calloc.c:36:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + p1 ∈ {{ &__calloc_main_l14[0] }} + p2 ∈ {{ &__calloc_main_l17[0] }} + p3 ∈ {{ &__calloc_main_l20[0] }} + p4 ∈ {{ &__calloc_main_l23 }} + p5 ∈ {{ &__calloc_main_l28[0] }} + p9001 ∈ {0} + __retres ∈ {0} +[from] Computing for function main +[from] Computing for function calloc <-main +[from] Done for function calloc +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function calloc: + __fc_heap_status FROM __fc_heap_status; nmemb; size (and SELF) + \result FROM __fc_heap_status; nmemb; size +[from] Function main: + __fc_heap_status FROM __fc_heap_status (and SELF) + \result FROM __fc_heap_status +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main: + __fc_heap_status; p1; p2; p3; p4; p5; p9001; __retres +[inout] Inputs for function main: + __fc_heap_status diff --git a/src/plugins/wp/tests/wp_usage/oracle/save_load.err.oracle b/tests/non-free/oracle/calloc.3.err.oracle similarity index 100% rename from src/plugins/wp/tests/wp_usage/oracle/save_load.err.oracle rename to tests/non-free/oracle/calloc.3.err.oracle diff --git a/tests/non-free/oracle/calloc.3.res.oracle b/tests/non-free/oracle/calloc.3.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..63348709e474c96bb7a57b62f56dc22ad32c7d22 --- /dev/null +++ b/tests/non-free/oracle/calloc.3.res.oracle @@ -0,0 +1,53 @@ +[kernel] Parsing tests/non-free/calloc.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + nondet ∈ [--..--] +tests/non-free/calloc.c:14:[value] allocating variable __calloc_main_l14 +tests/non-free/calloc.c:17:[value] allocating variable __calloc_main_l17 +tests/non-free/calloc.c:20:[value] allocating variable __calloc_main_l20 +tests/non-free/calloc.c:23:[value] allocating variable __calloc_main_l23 +tests/non-free/calloc.c:25:[value] assertion got status valid. +tests/non-free/calloc.c:26:[value] assertion got status valid. +tests/non-free/calloc.c:28:[value] allocating variable __calloc_main_l28 +tests/non-free/calloc.c:30:[value] assertion got status valid. +tests/non-free/calloc.c:31:[value] assertion got status valid. +tests/non-free/calloc.c:32:[value] assertion got status valid. +tests/non-free/calloc.c:34:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/non-free/calloc.c:36:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + p1 ∈ {{ &__calloc_main_l14[0] }} + p2 ∈ {{ &__calloc_main_l17[0] }} + p3 ∈ {{ &__calloc_main_l20[0] }} + p4 ∈ {{ &__calloc_main_l23 }} + p5 ∈ {{ &__calloc_main_l28[0] }} + p9001 ∈ {0} + __retres ∈ {0} +[from] Computing for function main +[from] Computing for function calloc <-main +[from] Done for function calloc +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function calloc: + __fc_heap_status FROM __fc_heap_status; nmemb; size (and SELF) + \result FROM __fc_heap_status; nmemb; size +[from] Function main: + __fc_heap_status FROM __fc_heap_status (and SELF) + \result FROM __fc_heap_status +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main: + __fc_heap_status; p1; p2; p3; p4; p5; p9001; __retres +[inout] Inputs for function main: + __fc_heap_status diff --git a/tests/non-free/oracle/loopalloc.err.oracle b/tests/non-free/oracle/calloc.4.err.oracle similarity index 100% rename from tests/non-free/oracle/loopalloc.err.oracle rename to tests/non-free/oracle/calloc.4.err.oracle diff --git a/tests/non-free/oracle/calloc.4.res.oracle b/tests/non-free/oracle/calloc.4.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..63348709e474c96bb7a57b62f56dc22ad32c7d22 --- /dev/null +++ b/tests/non-free/oracle/calloc.4.res.oracle @@ -0,0 +1,53 @@ +[kernel] Parsing tests/non-free/calloc.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + nondet ∈ [--..--] +tests/non-free/calloc.c:14:[value] allocating variable __calloc_main_l14 +tests/non-free/calloc.c:17:[value] allocating variable __calloc_main_l17 +tests/non-free/calloc.c:20:[value] allocating variable __calloc_main_l20 +tests/non-free/calloc.c:23:[value] allocating variable __calloc_main_l23 +tests/non-free/calloc.c:25:[value] assertion got status valid. +tests/non-free/calloc.c:26:[value] assertion got status valid. +tests/non-free/calloc.c:28:[value] allocating variable __calloc_main_l28 +tests/non-free/calloc.c:30:[value] assertion got status valid. +tests/non-free/calloc.c:31:[value] assertion got status valid. +tests/non-free/calloc.c:32:[value] assertion got status valid. +tests/non-free/calloc.c:34:[value] warning: calloc out of bounds: assert(nmemb * size <= SIZE_MAX) +tests/non-free/calloc.c:36:[value] assertion got status valid. +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main: + __fc_heap_status ∈ [--..--] + p1 ∈ {{ &__calloc_main_l14[0] }} + p2 ∈ {{ &__calloc_main_l17[0] }} + p3 ∈ {{ &__calloc_main_l20[0] }} + p4 ∈ {{ &__calloc_main_l23 }} + p5 ∈ {{ &__calloc_main_l28[0] }} + p9001 ∈ {0} + __retres ∈ {0} +[from] Computing for function main +[from] Computing for function calloc <-main +[from] Done for function calloc +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function calloc: + __fc_heap_status FROM __fc_heap_status; nmemb; size (and SELF) + \result FROM __fc_heap_status; nmemb; size +[from] Function main: + __fc_heap_status FROM __fc_heap_status (and SELF) + \result FROM __fc_heap_status +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main: + __fc_heap_status; p1; p2; p3; p4; p5; p9001; __retres +[inout] Inputs for function main: + __fc_heap_status diff --git a/tests/non-free/oracle/fam.res.oracle b/tests/non-free/oracle/fam.res.oracle index 7d3ffc3146eb398b1ace815c3d886dc78b3f43d2..957d036ae777cb6dc09667b940a99129eb1f55a4 100644 --- a/tests/non-free/oracle/fam.res.oracle +++ b/tests/non-free/oracle/fam.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/fam.i (no preprocessing) tests/non-free/fam.i:14:[kernel] warning: Calling undeclared function Frama_C_memcpy. Old style K&R code? [value] Analyzing a complete application starting at main @@ -6,12 +5,11 @@ tests/non-free/fam.i:14:[kernel] warning: Calling undeclared function Frama_C_me [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each({{ &buf + {11} }}) +tests/non-free/fam.i:13:[value] Frama_C_show_each: {{ &buf + {11} }} tests/non-free/fam.i:14:[value] Call to builtin memcpy(({{ &buf[11] }},{{ &value[0] }},{2})) [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/fam.i:14:[kernel] warning: Neither code nor specification for function Frama_C_memcpy, generating default assigns from the prototype [value:final-states] Values at end of function main: buf[0] ∈ {42} [1..9] ∈ UNINITIALIZED @@ -24,6 +22,7 @@ tests/non-free/fam.i:14:[kernel] warning: Neither code nor specification for fun option ∈ {{ (TcpOption *)&buf[10] }} [from] Computing for function main [from] Computing for function Frama_C_memcpy <-main +tests/non-free/fam.i:14:[kernel] warning: Neither code nor specification for function Frama_C_memcpy, generating default assigns from the prototype [from] Done for function Frama_C_memcpy [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== @@ -36,6 +35,6 @@ tests/non-free/fam.i:14:[kernel] warning: Neither code nor specification for fun NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - buf{[0]; [10..99]}; value[0..1]; option + buf{[0]; [10..12]}; value[0..1]; option [inout] Inputs for function main: \nothing diff --git a/tests/non-free/oracle/free.res.oracle b/tests/non-free/oracle/free.res.oracle index e7811878cf9a8a6a7eff7c1fda23d3b58e4f2214..c5abd9dea90c27339a3b96677cabed99b86ce53a 100644 --- a/tests/non-free/oracle/free.res.oracle +++ b/tests/non-free/oracle/free.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/free.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,23 +7,22 @@ [value] computing for function main1 <- main. Called from tests/non-free/free.i:44. tests/non-free/free.i:6:[value] allocating variable __malloc_main1_l6 +tests/non-free/free.i:6:[kernel] warning: Neither code nor specification for function Frama_C_malloc_fresh, generating default assigns from the prototype tests/non-free/free.i:8:[value] allocating variable __malloc_main1_l8 -[value] DUMPING STATE of file tests/non-free/free.i line 11 +tests/non-free/free.i:11:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] p ∈ {{ &__malloc_main1_l6[0] }} q ∈ {{ &__malloc_main1_l8[0] }} r ∈ {{ &__malloc_main1_l6[0] ; &__malloc_main1_l8[0] }} tmp_1 ∈ {{ &__malloc_main1_l6[0] ; &__malloc_main1_l8[0] }} - u ∈ UNINITIALIZED - t ∈ UNINITIALIZED - s ∈ UNINITIALIZED __malloc_main1_l6[0] ∈ UNINITIALIZED [1] ∈ {1} [2..9] ∈ UNINITIALIZED __malloc_main1_l8[0..1] ∈ UNINITIALIZED [2] ∈ {2} [3..9] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/free.i:12:[value:malloc] weak free on bases: {__malloc_main1_l6, __malloc_main1_l8} tests/non-free/free.i:14:[value] allocating variable __malloc_main1_l14 tests/non-free/free.i:16:[value:malloc] strong free on bases: {__malloc_main1_l14} @@ -36,20 +34,12 @@ tests/non-free/free.i:24:[value:malloc] weak free on bases: {__malloc_main1_l21} [value] computing for function main2 <- main. Called from tests/non-free/free.i:45. tests/non-free/free.i:35:[value] allocating variable __malloc_main2_l35 -[value] computing for function free <- main2 <- main. - Called from tests/non-free/free.i:39. -tests/non-free/free.i:28:[value:malloc] strong free on bases: {__malloc_main2_l35} -[value] Recording results for free -[value] Done for function free +tests/non-free/free.i:39:[value:malloc] strong free on bases: {__malloc_main2_l35} [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/free.i:28:[kernel] warning: Neither code nor specification for function Frama_C_free, generating default assigns from the prototype -[value:final-states] Values at end of function free: - -tests/non-free/free.i:6:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype [value:final-states] Values at end of function main1: p ∈ {{ &__malloc_main1_l6[0] }} or ESCAPINGADDR q ∈ {{ &__malloc_main1_l8[0] }} or ESCAPINGADDR @@ -79,15 +69,14 @@ tests/non-free/free.i:6:[kernel] warning: Neither code nor specification for fun __malloc_main1_l21[0..3] ∈ UNINITIALIZED [4] ∈ {4} [5..9] ∈ UNINITIALIZED -[from] Computing for function free -[from] Computing for function Frama_C_free <-free -[from] Done for function Frama_C_free -[from] Done for function free [from] Computing for function main1 -[from] Computing for function Frama_C_alloc_size <-main1 -[from] Done for function Frama_C_alloc_size +[from] Computing for function Frama_C_malloc_fresh <-main1 +[from] Done for function Frama_C_malloc_fresh [from] Computing for function Frama_C_dump_each <-main1 [from] Done for function Frama_C_dump_each +[from] Computing for function Frama_C_free <-main1 +tests/non-free/free.i:12:[kernel] warning: Neither code nor specification for function Frama_C_free, generating default assigns from the prototype +[from] Done for function Frama_C_free [from] Done for function main1 [from] Computing for function main2 [from] Done for function main2 @@ -95,12 +84,10 @@ tests/non-free/free.i:6:[kernel] warning: Neither code nor specification for fun [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_size: - \result FROM \nothing [from] Function Frama_C_free: NO EFFECTS -[from] Function free: - NO EFFECTS +[from] Function Frama_C_malloc_fresh: + \result FROM \nothing [from] Function main1: __malloc_main1_l6[1] FROM \nothing __malloc_main1_l8[2] FROM \nothing @@ -115,10 +102,6 @@ tests/non-free/free.i:6:[kernel] warning: Neither code nor specification for fun __malloc_main1_l21[4] FROM v (and SELF) __malloc_main2_l35 FROM v (and SELF) [from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function free: - \nothing -[inout] Inputs for function free: - \nothing [inout] Out (internal) for function main1: p; q; r; tmp_1; u; t; s; __malloc_main1_l6[1]; __malloc_main1_l8[2]; __malloc_main1_l14[3]; __malloc_main1_l21[4] diff --git a/tests/non-free/oracle/from_result.res.oracle b/tests/non-free/oracle/from_result.res.oracle index 06b0a42b1a9fa2975833aca9cbcd7c564d1af155..78aa445a8aed54852f1da4afef8cd9aea6e36abe 100644 --- a/tests/non-free/oracle/from_result.res.oracle +++ b/tests/non-free/oracle/from_result.res.oracle @@ -1,23 +1,22 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/from_result.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] [value] computing for function bar <- main. Called from tests/non-free/from_result.c:32. [value] computing for function malloc <- bar <- main. Called from tests/non-free/from_result.c:18. share/libc/stdlib.c:74:[value] allocating variable __malloc_malloc_l74 -share/libc/stdlib.h:294:[value] warning: function malloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/stdlib.h:299:[value] warning: function malloc, behavior no_allocation: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_malloc_fresh, generating default assigns from the prototype +share/libc/stdlib.h:320:[value] warning: function malloc, behavior allocation: postcondition got status unknown. [value] Recording results for malloc [value] Done for function malloc [value] Recording results for bar @@ -53,9 +52,8 @@ tests/non-free/from_result.c:29:[value] warning: no 'assigns \result \from ...' [from] Computing for function change_t [from] Done for function change_t [from] Computing for function malloc -[from] Computing for function Frama_C_alloc_size <-malloc -share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype -[from] Done for function Frama_C_alloc_size +[from] Computing for function Frama_C_malloc_fresh <-malloc +[from] Done for function Frama_C_malloc_fresh [from] Done for function malloc [from] Computing for function bar [from] Done for function bar @@ -69,7 +67,7 @@ share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for func [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_size: +[from] Function Frama_C_malloc_fresh: \result FROM size [from] Function change_t: v.a FROM t0; x diff --git a/tests/non-free/oracle/gcc_zero_length_array.res.oracle b/tests/non-free/oracle/gcc_zero_length_array.res.oracle index a4d64e716868ba7168030bb64c2ffac0c0c9d1aa..36b6522b88eff8b122977b963cbf37dd002a12f8 100644 --- a/tests/non-free/oracle/gcc_zero_length_array.res.oracle +++ b/tests/non-free/oracle/gcc_zero_length_array.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/gcc_zero_length_array.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] [value] computing for function make_fam <- main. Called from tests/non-free/gcc_zero_length_array.c:24. tests/non-free/gcc_zero_length_array.c:15:[value] allocating variable __malloc_make_fam_l15 diff --git a/tests/non-free/oracle/imprecise-malloc-free.res.oracle b/tests/non-free/oracle/imprecise-malloc-free.res.oracle index cd8181a9ac2bc38cdff1915b9c0307fa849384e1..f686357cb2c115629bbaf98c7e8e5284aadcab1e 100644 --- a/tests/non-free/oracle/imprecise-malloc-free.res.oracle +++ b/tests/non-free/oracle/imprecise-malloc-free.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/imprecise-malloc-free.i (no preprocessing) tests/non-free/imprecise-malloc-free.i:25:[kernel] warning: Calling undeclared function Frama_C_free. Old style K&R code? [value] Analyzing a complete application starting at main @@ -12,14 +11,14 @@ tests/non-free/imprecise-malloc-free.i:13:[value] Assigning imprecise value to s The imprecision originates from Arithmetic {tests/non-free/imprecise-malloc-free.i:13} tests/non-free/imprecise-malloc-free.i:14:[value] allocating variable __malloc_main_l14 +tests/non-free/imprecise-malloc-free.i:14:[kernel] warning: No code nor implicit assigns clause for function Frama_C_malloc_by_stack, generating default assigns from the prototype tests/non-free/imprecise-malloc-free.i:15:[value] allocating variable __malloc_main_l15 tests/non-free/imprecise-malloc-free.i:16:[value] allocating variable __malloc_main_l16 -[value] Called Frama_C_show_each({{ &__malloc_main_l14 }}, - {{ &__malloc_main_l15 }}, - {{ &__malloc_main_l16 }}) -[value] Called Frama_C_show_each({{ garbled mix of &{__malloc_main_l14} - (origin: Arithmetic - {tests/non-free/imprecise-malloc-free.i:19}) }}) +tests/non-free/imprecise-malloc-free.i:18:[value] Frama_C_show_each: + {{ &__malloc_main_l14 }}, {{ &__malloc_main_l15 }}, {{ &__malloc_main_l16 }} +tests/non-free/imprecise-malloc-free.i:19:[value] Frama_C_show_each: + {{ garbled mix of &{__malloc_main_l14} + (origin: Arithmetic {tests/non-free/imprecise-malloc-free.i:19}) }} tests/non-free/imprecise-malloc-free.i:21:[value] warning: out of bounds write. assert \valid(p); tests/non-free/imprecise-malloc-free.i:22:[value] warning: out of bounds write. assert \valid(q); tests/non-free/imprecise-malloc-free.i:23:[value] warning: out of bounds write. assert \valid(r); @@ -30,8 +29,6 @@ tests/non-free/imprecise-malloc-free.i:26:[value:malloc] weak free on bases: {__ [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/imprecise-malloc-free.i:14:[kernel] warning: No code nor implicit assigns clause for function Frama_C_alloc_by_stack, generating default assigns from the prototype -tests/non-free/imprecise-malloc-free.i:25:[kernel] warning: Neither code nor specification for function Frama_C_free, generating default assigns from the prototype [value:final-states] Values at end of function main: size1 ∈ {{ &size1 + [-8589934592..8589934588],0%4 }} size2 ∈ @@ -47,15 +44,14 @@ tests/non-free/imprecise-malloc-free.i:25:[kernel] warning: Neither code nor spe __malloc_main_l16[0] ∈ {{ (int)&__malloc_main_l16[3] }} or ESCAPINGADDR [1..1073741823] ∈ UNINITIALIZED [from] Computing for function main -[from] Computing for function Frama_C_alloc_by_stack <-main -[from] Done for function Frama_C_alloc_by_stack +[from] Computing for function Frama_C_malloc_by_stack <-main +[from] Done for function Frama_C_malloc_by_stack [from] Computing for function Frama_C_free <-main +tests/non-free/imprecise-malloc-free.i:25:[kernel] warning: Neither code nor specification for function Frama_C_free, generating default assigns from the prototype [from] Done for function Frama_C_free [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_by_stack: - \result FROM \nothing [from] Function Frama_C_free: __malloc_main_l14[0..1073741823] FROM __malloc_main_l14[0..1073741823]; @@ -72,6 +68,8 @@ tests/non-free/imprecise-malloc-free.i:25:[kernel] warning: Neither code nor spe \result FROM __malloc_main_l14[0..1073741823]; __malloc_main_l15[0..1073741823]; __malloc_main_l16[0..1073741823] +[from] Function Frama_C_malloc_by_stack: + \result FROM \nothing [from] Function main: __malloc_main_l14[0] FROM __malloc_main_l14[1..1073741823]; @@ -99,8 +97,8 @@ tests/non-free/imprecise-malloc-free.i:25:[kernel] warning: Neither code nor spe __malloc_main_l16[1..1073741823] (and SELF) [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - size1; size2; p; q; r; __malloc_main_l14[0..1073741823]; - __malloc_main_l15[0..1073741823]; __malloc_main_l16[0..1073741823] + size1; size2; p; q; r; __malloc_main_l14[0]; __malloc_main_l15[0]; + __malloc_main_l16[0] [inout] Inputs for function main: i; __malloc_main_l14[0..1073741823]; __malloc_main_l15[0..1073741823]; __malloc_main_l16[0..1073741823] diff --git a/tests/non-free/oracle/imprecise.res.oracle b/tests/non-free/oracle/imprecise.res.oracle index da6b86513481769dfcc15111892ea4deab9c7abe..775cea8bae404c2736b0b24c1da543635a1ff18b 100644 --- a/tests/non-free/oracle/imprecise.res.oracle +++ b/tests/non-free/oracle/imprecise.res.oracle @@ -1,26 +1,19 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/imprecise.c (with preprocessing) tests/non-free/imprecise.c:77:[kernel] warning: Calling undeclared function gm_f2. Old style K&R code? [value] Analyzing a complete application starting at main [value] Computing initial state tests/non-free/imprecise.c:27:[value] warning: during initialization of variable 'v1', size of type 'struct s' cannot be computed (abstract type 'struct s') -tests/non-free/imprecise.c:27:[kernel] imprecise size for variable v1 (abstract type 'struct s') tests/non-free/imprecise.c:27:[value] warning: during initialization of variable 'v2', size of type 'struct s' cannot be computed (abstract type 'struct s') -tests/non-free/imprecise.c:27:[kernel] imprecise size for variable v2 (abstract type 'struct s') tests/non-free/imprecise.c:28:[value] warning: during initialization of variable 'v3', size of type 'struct u' cannot be computed (abstract type 'struct u') -tests/non-free/imprecise.c:28:[kernel] imprecise size for variable v3 (abstract type 'struct u') tests/non-free/imprecise.c:28:[value] warning: during initialization of variable 'v5', size of type 'struct u' cannot be computed (abstract type 'struct u') -tests/non-free/imprecise.c:28:[kernel] imprecise size for variable v5 (abstract type 'struct u') tests/non-free/imprecise.c:83:[value] warning: during initialization of variable 's1', size of type 'struct s' cannot be computed (abstract type 'struct s') -tests/non-free/imprecise.c:83:[kernel] imprecise size for variable s1 (abstract type 'struct s') tests/non-free/imprecise.c:83:[value] warning: during initialization of variable 's2', size of type 'struct s' cannot be computed (abstract type 'struct s') -tests/non-free/imprecise.c:83:[kernel] imprecise size for variable s2 (abstract type 'struct s') [value] Initial state computed [value:initial-state] Values of globals at initialization NULL[rbits 800 to 1607] ∈ [--..--] @@ -46,11 +39,11 @@ tests/non-free/imprecise.c:83:[kernel] imprecise size for variable s2 (abstract [value] Done for function invalid_assigns_imprecise [value] computing for function write_garbled <- main. Called from tests/non-free/imprecise.c:144. -[value] Call to builtin bzero(({{ (unsigned char *)&k }},{20})) tests/non-free/imprecise.c:19:[value] Assigning imprecise value to p. The imprecision originates from Arithmetic {tests/non-free/imprecise.c:19} tests/non-free/imprecise.c:20:[value] warning: out of bounds write. assert \valid(p); -[value] DUMPING STATE of file tests/non-free/imprecise.c line 21 +tests/non-free/imprecise.c:21:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 800 to 1607] ∈ [--..--] i ∈ {1} j ∈ {1; 2} @@ -66,7 +59,7 @@ tests/non-free/imprecise.c:20:[value] warning: out of bounds write. assert \vali p_gm_null ∈ {0} s1.[bits 0 to ..] ∈ {0} or UNINITIALIZED s2.[bits 0 to ..] ∈ {0} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for write_garbled [from] Computing for function write_garbled [from] Done for function write_garbled @@ -121,7 +114,8 @@ tests/non-free/imprecise.c:68:[value] Assigning imprecise value to c3. tests/non-free/imprecise.c:75:[kernel] warning: Neither code nor specification for function gm_f1, generating default assigns from the prototype [value] using specification for function gm_f1 [value] Done for function gm_f1 -[value] DUMPING STATE of file tests/non-free/imprecise.c line 76 +tests/non-free/imprecise.c:76:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 800 to 1607] ∈ {{ garbled mix of &{addr} (origin: Misaligned {tests/non-free/imprecise.c:54}) }} or ESCAPINGADDR @@ -146,7 +140,7 @@ tests/non-free/imprecise.c:75:[kernel] warning: Neither code nor specification f {{ garbled mix of &{alloced_return_gm_f1} (origin: Library function {tests/non-free/imprecise.c:75}) }} - =END OF DUMP== + ==END OF DUMP== tests/non-free/imprecise.c:77:[value] warning: out of bounds read. assert \valid_read(p_gm_null); tests/non-free/imprecise.c:77:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(p_gm_null); @@ -155,7 +149,8 @@ tests/non-free/imprecise.c:77:[value] warning: accessing left-value that contain tests/non-free/imprecise.c:77:[kernel] warning: Neither code nor specification for function gm_f2, generating default assigns from the prototype [value] using specification for function gm_f2 [value] Done for function gm_f2 -[value] DUMPING STATE of file tests/non-free/imprecise.c line 78 +tests/non-free/imprecise.c:78:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 800 to 1607] ∈ {{ garbled mix of &{addr; alloced_return_gm_f1} (origin: Misaligned {tests/non-free/imprecise.c:54}) }} or ESCAPINGADDR @@ -182,7 +177,7 @@ tests/non-free/imprecise.c:77:[kernel] warning: Neither code nor specification f alloced_return_gm_f1[bits 0 to ..] ∈ {{ garbled mix of &{addr; alloced_return_gm_f1} (origin: Misaligned {tests/non-free/imprecise.c:54}) }} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for garbled_mix_null [from] Computing for function garbled_mix_null [from] Done for function garbled_mix_null @@ -208,6 +203,8 @@ tests/non-free/imprecise.c:113:[kernel] more than 200(300) locations to update i tests/non-free/imprecise.c:113:[kernel] approximating value to write. tests/non-free/imprecise.c:115:[value] warning: assertion got status unknown. [value] Recording results for many_writes +tests/non-free/imprecise.c:110:[kernel] more than 200(300) elements to enumerate. Approximating. +tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate. Approximating. [from] Computing for function many_writes tests/non-free/imprecise.c:110:[kernel] more than 200(300) dependencies to update. Approximating. tests/non-free/imprecise.c:113:[kernel] more than 200(300) dependencies to update. Approximating. @@ -281,8 +278,6 @@ tests/non-free/imprecise.c:139:[value] warning: accessing uninitialized left-val [value:final-states] Values at end of function invalid_assigns_imprecise: NULL[rbits 800 to 1607] ∈ [--..--] p ∈ {0} -tests/non-free/imprecise.c:110:[kernel] more than 200(300) elements to enumerate. Approximating. -tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate. Approximating. [value:final-states] Values at end of function many_writes: t_packed1{[0..298]{.i1; .i2#; .[bits 48 to 63]#}; [299].i1} ∈ {1} or UNINITIALIZED repeated %32 @@ -364,15 +359,11 @@ tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate [from] Computing for function weak_update_imprecise_size [from] Done for function weak_update_imprecise_size [from] Computing for function write_garbled -[from] Computing for function Frama_C_bzero <-write_garbled -[from] Done for function Frama_C_bzero [from] Done for function write_garbled [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - k[0..4] FROM \nothing [from] Function Frama_C_memset: v3.[bits 0 to 34359738359] FROM c (and SELF) s FROM c (and SELF) @@ -469,8 +460,6 @@ tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate [from] call to Frama_C_memset at tests/non-free/imprecise.c:132 (by paste_big): s FROM c \result FROM p -[from] call to Frama_C_bzero at tests/non-free/imprecise.c:17 (by write_garbled): - k[0..4] FROM \nothing [from] call to Frama_C_dump_each at tests/non-free/imprecise.c:21 (by write_garbled): \result FROM \nothing [from] call to invalid_assigns_imprecise at tests/non-free/imprecise.c:143 (by main): @@ -530,7 +519,7 @@ tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate NULL[..]; v1[..]; v2[..]; v3.[bits 0 to 34359738359]; v5.[bits 0 to ..]; p; w1; w; q; p2; p4; p5; p6 [inout] Inputs for function abstract_structs: - v; v1[..]; v2[..]; v3[..]; t[5] + v; v1[..]; v2[..]; t[5] [inout] InOut (internal) for function abstract_structs: Operational inputs: v; v1[..]; v2[..]; t[5] @@ -630,7 +619,7 @@ tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate NULL[..]; addr; v1[..]; v2[..]; v3.[bits 0 to 34359738359]; v5.[bits 0 to ..]; p_gm_null; s1[..]; alloced_return_gm_f1[bits 0 to ..] [inout] Inputs for function main: - NULL[100..200]; v; addr; v1[..]; v2[..]; v3[..]; t[5]; p_gm_null; s2[..]; + NULL[100..200]; v; addr; v1[..]; v2[..]; t[5]; p_gm_null; s2[..]; alloced_return_gm_f1[bits 0 to ..] [inout] InOut (internal) for function main: Operational inputs: @@ -643,8 +632,10 @@ tests/non-free/imprecise.c:113:[kernel] more than 200(300) elements to enumerate v1.[bits 0 to 7]; v2.[bits 32 to 63]; p_gm_null [value] Analyzing an incomplete application starting at main [value] Computing initial state +[value:initial-state] creating variable S_0_t with imprecise size (type struct s [2]) tests/non-free/imprecise.c:29:[value] warning: during initialization of variable 't', size of type 'struct s' cannot be computed (abstract type 'struct s') +[value:initial-state] creating variable S_1_t with imprecise size (type struct s [2]) [value] Initial state computed [value:initial-state] Values of globals at initialization NULL[rbits 800 to 1607] ∈ [--..--] @@ -677,9 +668,9 @@ tests/non-free/imprecise.c:29:[value] warning: during initialization of variable [value] Done for function invalid_assigns_imprecise [value] computing for function write_garbled <- main. Called from tests/non-free/imprecise.c:144. -[value] Call to builtin bzero(({{ (unsigned char *)&k }},{20})) tests/non-free/imprecise.c:20:[value] warning: out of bounds write. assert \valid(p); -[value] DUMPING STATE of file tests/non-free/imprecise.c line 21 +tests/non-free/imprecise.c:21:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 800 to 1607] ∈ [--..--] i ∈ {1} j ∈ {1; 2} @@ -703,7 +694,7 @@ tests/non-free/imprecise.c:20:[value] warning: out of bounds write. assert \vali [1] ∈ {{ NULL ; &S_1_S_p_gm_null[0] }} S_0_S_p_gm_null[0..1] ∈ [--..--] S_1_S_p_gm_null[0..1] ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for write_garbled [from] Computing for function write_garbled [from] Done for function write_garbled @@ -752,7 +743,8 @@ tests/non-free/imprecise.c:68:[value] warning: signed overflow. assert (int)*((c [value] computing for function gm_f1 <- garbled_mix_null <- main. Called from tests/non-free/imprecise.c:75. [value] Done for function gm_f1 -[value] DUMPING STATE of file tests/non-free/imprecise.c line 76 +tests/non-free/imprecise.c:76:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 800 to 1607] ∈ {{ garbled mix of &{addr} (origin: Misaligned {tests/non-free/imprecise.c:54}) }} or ESCAPINGADDR @@ -785,14 +777,15 @@ tests/non-free/imprecise.c:68:[value] warning: signed overflow. assert (int)*((c [1] ∈ {{ NULL ; &S_1_S_p_gm_null[0] }} S_0_S_p_gm_null[0..1] ∈ [--..--] S_1_S_p_gm_null[0..1] ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== tests/non-free/imprecise.c:77:[value] warning: out of bounds read. assert \valid_read(p_gm_null); tests/non-free/imprecise.c:77:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(p_gm_null); [value] computing for function gm_f2 <- garbled_mix_null <- main. Called from tests/non-free/imprecise.c:77. [value] Done for function gm_f2 -[value] DUMPING STATE of file tests/non-free/imprecise.c line 78 +tests/non-free/imprecise.c:78:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 800 to 1607] ∈ {{ garbled mix of &{addr; alloced_return_gm_f1} (origin: Misaligned {tests/non-free/imprecise.c:54}) }} or ESCAPINGADDR @@ -827,7 +820,7 @@ tests/non-free/imprecise.c:77:[value] warning: accessing left-value that contain [1] ∈ {{ NULL ; &S_1_S_p_gm_null[0] }} S_0_S_p_gm_null[0..1] ∈ [--..--] S_1_S_p_gm_null[0..1] ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for garbled_mix_null [from] Computing for function garbled_mix_null [from] Done for function garbled_mix_null @@ -1002,15 +995,11 @@ tests/non-free/imprecise.c:139:[value] warning: accessing uninitialized left-val [from] Computing for function weak_update_imprecise_size [from] Done for function weak_update_imprecise_size [from] Computing for function write_garbled -[from] Computing for function Frama_C_bzero <-write_garbled -[from] Done for function Frama_C_bzero [from] Done for function write_garbled [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - k[0..4] FROM \nothing [from] Function Frama_C_memset: v3.[bits 0 to 34359738359] FROM c (and SELF) s FROM c (and SELF) @@ -1111,8 +1100,6 @@ tests/non-free/imprecise.c:139:[value] warning: accessing uninitialized left-val [from] call to Frama_C_memset at tests/non-free/imprecise.c:132 (by paste_big): s FROM c \result FROM p -[from] call to Frama_C_bzero at tests/non-free/imprecise.c:17 (by write_garbled): - k[0..4] FROM \nothing [from] call to Frama_C_dump_each at tests/non-free/imprecise.c:21 (by write_garbled): \result FROM \nothing [from] call to invalid_assigns_imprecise at tests/non-free/imprecise.c:143 (by main): @@ -1176,7 +1163,7 @@ tests/non-free/imprecise.c:139:[value] warning: accessing uninitialized left-val NULL[..]; v1[..]; v2[..]; v3.[bits 0 to 34359738359]; v5.[bits 0 to ..]; p; w1; w; q; p2; p4; p5; p6; S_0_t[..]; S_1_t[..] [inout] Inputs for function abstract_structs: - v; v1[..]; v2[..]; v3[..]; t[5] + v; v1[..]; v2[..]; t[5] [inout] InOut (internal) for function abstract_structs: Operational inputs: v; v1[..]; v2[..]; t[5] @@ -1277,7 +1264,7 @@ tests/non-free/imprecise.c:139:[value] warning: accessing uninitialized left-val v5.[bits 0 to ..]; p_gm_null; s1[..]; alloced_return_gm_f1[bits 0 to ..]; S_0_t[..]; S_1_t[..] [inout] Inputs for function main: - NULL[100..200]; v; addr; v1[..]; v2[..]; v3[..]; t[5]; p_gm_null; s2[..]; + NULL[100..200]; v; addr; v1[..]; v2[..]; t[5]; p_gm_null; s2[..]; alloced_return_gm_f1[bits 0 to ..] [inout] InOut (internal) for function main: Operational inputs: diff --git a/tests/non-free/oracle/linked_list.0.res.oracle b/tests/non-free/oracle/linked_list.0.res.oracle index e8afdaf1dc7b16d875068e35cb9e6903557156f4..c04558fc0903f50e1b6c063f03b21fa3493e39f7 100644 --- a/tests/non-free/oracle/linked_list.0.res.oracle +++ b/tests/non-free/oracle/linked_list.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/linked_list.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -18,7 +17,8 @@ __fc_initial_stdin ∈ {0} next_free ∈ {0} tests/non-free/linked_list.c:39:[value] entering loop for the first time -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[0..1023] ∈ {0} __fc_errno ∈ [--..--] __fc_stderr ∈ {{ &__fc_initial_stderr }} @@ -35,12 +35,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {0} i ∈ {1} next_free ∈ {0} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[0..1023] ∈ {0} __fc_errno ∈ [--..--] __fc_stderr ∈ {{ &__fc_initial_stderr }} @@ -57,8 +58,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {0} i ∈ {1} next_free ∈ {8} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1} [4..1023] ∈ {0} __fc_errno ∈ [--..--] @@ -76,12 +78,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY }} i ∈ {1; 2} next_free ∈ {0; 8} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1} [4..1023] ∈ {0} __fc_errno ∈ [--..--] @@ -99,8 +102,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY }} i ∈ {1; 2} next_free ∈ {8; 16} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY }} [bits 64 to 95] ∈ {0; 1; 2} @@ -121,12 +125,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8]} }} i ∈ {1; 2; 3} next_free ∈ {0; 8; 16} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY }} [bits 64 to 95] ∈ {0; 1; 2} @@ -147,8 +152,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8]} }} i ∈ {1; 2; 3} next_free ∈ {8; 16; 24} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2; 3} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8]} }} [bits 64 to 95] ∈ {0; 1; 2; 3} @@ -171,12 +177,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16]} }} i ∈ [1..10] next_free ∈ {0; 8; 16; 24} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2; 3} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8]} }} [bits 64 to 95] ∈ {0; 1; 2; 3} @@ -199,8 +206,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16]} }} i ∈ [1..10] next_free ∈ {8; 16; 24; 32} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8], [16]} }} [bits 64 to 95] ∈ [0..10] @@ -225,12 +233,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16], [24]} }} i ∈ [1..10] next_free ∈ {0; 8; 16; 24; 32} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8], [16]} }} [bits 64 to 95] ∈ [0..10] @@ -255,8 +264,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16], [24]} }} i ∈ [1..10] next_free ∈ {8; 16; 24; 32; 40} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} [bits 64 to 95] ∈ [0..10] @@ -283,12 +293,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} i ∈ [1..10] next_free ∈ [0..2147483640],0%8 - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} [bits 64 to 95] ∈ [0..10] @@ -315,9 +326,10 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} i ∈ [1..10] next_free ∈ [-2147483648..2147483640],0%8 - =END OF DUMP== + ==END OF DUMP== tests/non-free/linked_list.c:43:[value] warning: out of bounds write. assert \valid(&curr->val); -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} [bits 64 to 95] ∈ [0..10] @@ -589,12 +601,13 @@ tests/non-free/linked_list.c:43:[value] warning: out of bounds write. assert \va head ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} i ∈ [1..10] next_free ∈ [-2147483648..2147483640],0%8 - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} [bits 64 to 95] ∈ [0..10] @@ -866,16 +879,16 @@ tests/non-free/linked_list.c:43:[value] warning: out of bounds write. assert \va head ∈ {{ NULL ; &MEMORY + [0..1016],0%8 }} i ∈ [1..10] next_free ∈ [-2147483648..2147483640],0%8 - =END OF DUMP== + ==END OF DUMP== tests/non-free/linked_list.c:50:[value] entering loop for the first time -[value] computing for function printf_0 <- main. +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] using specification for function printf_0 -tests/non-free/linked_list.c:51:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] using specification for function printf_va_1 +tests/non-free/linked_list.c:51:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 +[value] Done for function printf_va_1 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -1150,15 +1163,15 @@ tests/non-free/linked_list.c:51:[value] function printf_0: precondition got stat [from] Computing for function main [from] Computing for function Frama_C_dump_each <-main [from] Done for function Frama_C_dump_each -[from] Computing for function printf_0 <-main -[from] Done for function printf_0 +[from] Computing for function printf_va_1 <-main +[from] Done for function printf_va_1 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: [from] Function malloc: next_free FROM size; next_free \result FROM size; next_free -[from] Function printf_0: +[from] Function printf_va_1: __fc_initial_stdout.__fc_FILE_data FROM __fc_initial_stdout; param0; "%d\n" (and SELF) \result FROM __fc_initial_stdout; param0; "%d\n" diff --git a/tests/non-free/oracle/linked_list.1.res.oracle b/tests/non-free/oracle/linked_list.1.res.oracle index 97a8c9070737701d3758d15737fca55de48c3a5d..5a0ab2ab2db38dcc5f8e25538c7c7e2960bba69f 100644 --- a/tests/non-free/oracle/linked_list.1.res.oracle +++ b/tests/non-free/oracle/linked_list.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/linked_list.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -18,7 +17,8 @@ __fc_initial_stdin ∈ {0} next_free ∈ {0} tests/non-free/linked_list.c:39:[value] entering loop for the first time -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[0..0x3FF] ∈ {0} __fc_errno ∈ [--..--] __fc_stderr ∈ {{ &__fc_initial_stderr }} @@ -35,12 +35,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {0} i ∈ {1} next_free ∈ {0} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[0..0x3FF] ∈ {0} __fc_errno ∈ [--..--] __fc_stderr ∈ {{ &__fc_initial_stderr }} @@ -57,8 +58,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {0} i ∈ {1} next_free ∈ {8} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1} [4..0x3FF] ∈ {0} __fc_errno ∈ [--..--] @@ -76,12 +78,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY }} i ∈ {1; 2} next_free ∈ {0; 8} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1} [4..0x3FF] ∈ {0} __fc_errno ∈ [--..--] @@ -99,8 +102,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY }} i ∈ {1; 2} next_free ∈ {8; 16} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY }} [bits 64 to 95] ∈ {0; 1; 2} @@ -121,12 +125,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8]} }} i ∈ {1; 2; 3} next_free ∈ {0; 8; 16} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY }} [bits 64 to 95] ∈ {0; 1; 2} @@ -147,8 +152,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8]} }} i ∈ {1; 2; 3} next_free ∈ {8; 16; 24} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2; 3} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8]} }} [bits 64 to 95] ∈ {0; 1; 2; 3} @@ -171,12 +177,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16]} }} i ∈ [1..10] next_free ∈ {0; 8; 16; 24} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {0; 1; 2; 3} [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8]} }} [bits 64 to 95] ∈ {0; 1; 2; 3} @@ -199,8 +206,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16]} }} i ∈ [1..10] next_free ∈ {8; 16; 24; 32} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8], [16]} }} [bits 64 to 95] ∈ [0..10] @@ -225,12 +233,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16], [24]} }} i ∈ [1..10] next_free ∈ {0; 8; 16; 24; 32} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; (? *)&MEMORY{[0], [8], [16]} }} [bits 64 to 95] ∈ [0..10] @@ -255,8 +264,9 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; (item *)&MEMORY{[0], [8], [16], [24]} }} i ∈ [1..10] next_free ∈ {8; 16; 24; 32; 40} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; &MEMORY + [0..0x3F8],0%8 }} [bits 64 to 95] ∈ [0..10] @@ -284,12 +294,13 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; &MEMORY + [0..0x3F8],0%8 }} i ∈ [1..10] next_free ∈ [0..0x7FFFFFF8],0%8 - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 63] ∈ {{ NULL ; &MEMORY + [0..0x3F8],0%8 }} [bits 64 to 95] ∈ [0..10] @@ -317,11 +328,12 @@ tests/non-free/linked_list.c:39:[value] entering loop for the first time head ∈ {{ NULL ; &MEMORY + [0..0x3F8],0%8 }} i ∈ [1..10] next_free ∈ [-0x80000000..0x7FFFFFF8],0%8 - =END OF DUMP== + ==END OF DUMP== tests/non-free/linked_list.c:43:[value] warning: out of bounds write. assert \valid(&curr->val); tests/non-free/linked_list.c:43:[kernel] more than 100(128) locations to update in array. Approximating. tests/non-free/linked_list.c:44:[kernel] more than 100(128) locations to update in array. Approximating. -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 0x1FDF]# ∈ {{ NULL + [0..10] ; &MEMORY + [0..0x3F8],0%8 }} repeated %32 @@ -341,12 +353,13 @@ tests/non-free/linked_list.c:44:[kernel] more than 100(128) locations to update head ∈ {{ NULL ; &MEMORY + [0..0x3F8],0%8 }} i ∈ [1..10] next_free ∈ [-0x80000000..0x7FFFFFF8],0%8 - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 0x1FDF]# ∈ {{ NULL + [0..10] ; &MEMORY + [0..0x3F8],0%8 }} repeated %32 @@ -366,25 +379,25 @@ tests/non-free/linked_list.c:44:[kernel] more than 100(128) locations to update head ∈ {{ NULL ; &MEMORY + [0..0x3F8],0%8 }} i ∈ [1..10] next_free ∈ [-0x80000000..0x7FFFFFF8],0%8 - =END OF DUMP== + ==END OF DUMP== tests/non-free/linked_list.c:50:[value] entering loop for the first time -[value] computing for function printf_0 <- main. +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] using specification for function printf_0 -tests/non-free/linked_list.c:51:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 +[value] using specification for function printf_va_1 +tests/non-free/linked_list.c:51:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 tests/non-free/linked_list.c:51:[value] warning: out of bounds read. assert \valid_read(&curr->val); -[value] computing for function printf_0 <- main. +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 +[value] Done for function printf_va_1 [value] Recording results for main +tests/non-free/linked_list.c:43:[kernel] more than 100(128) elements to enumerate. Approximating. +tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerate. Approximating. [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function malloc: next_free ∈ [-0x80000000..0x7FFFFFF8],0%8 __retres ∈ {{ NULL ; &MEMORY + [0..0xFFFFFFF8],0%8 }} -tests/non-free/linked_list.c:43:[kernel] more than 100(128) elements to enumerate. Approximating. -tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerate. Approximating. [value:final-states] Values at end of function main: MEMORY[bits 0 to 31] ∈ [0..10] [bits 32 to 0x1FDF]# ∈ @@ -406,15 +419,15 @@ tests/non-free/linked_list.c:44:[kernel] more than 100(128) elements to enumerat [from] Done for function Frama_C_dump_each tests/non-free/linked_list.c:43:[kernel] more than 100(128) dependencies to update. Approximating. tests/non-free/linked_list.c:44:[kernel] more than 100(128) dependencies to update. Approximating. -[from] Computing for function printf_0 <-main -[from] Done for function printf_0 +[from] Computing for function printf_va_1 <-main +[from] Done for function printf_va_1 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: [from] Function malloc: next_free FROM size; next_free \result FROM size; next_free -[from] Function printf_0: +[from] Function printf_va_1: __fc_initial_stdout.__fc_FILE_data FROM __fc_initial_stdout; param0; "%d\n" (and SELF) \result FROM __fc_initial_stdout; param0; "%d\n" diff --git a/tests/non-free/oracle/linked_list.2.res.oracle b/tests/non-free/oracle/linked_list.2.res.oracle index 3193cfd57d88421526dade00ce3bc1408dd51a9e..78fa58f12e0fa88e0be240de6bad536afd6d5985 100644 --- a/tests/non-free/oracle/linked_list.2.res.oracle +++ b/tests/non-free/oracle/linked_list.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/linked_list.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -17,7 +16,8 @@ .__fc_FILE_data ∈ {0} __fc_initial_stdin ∈ {0} next_free ∈ {0} -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[0..0x3FF] ∈ {0} __fc_errno ∈ [--..--] __fc_stderr ∈ {{ &__fc_initial_stderr }} @@ -34,12 +34,13 @@ head ∈ {0} i ∈ {1} next_free ∈ {0} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[0..0x3FF] ∈ {0} __fc_errno ∈ [--..--] __fc_stderr ∈ {{ &__fc_initial_stderr }} @@ -56,8 +57,9 @@ head ∈ {0} i ∈ {1} next_free ∈ {8} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..0x3FF] ∈ {0} __fc_errno ∈ [--..--] @@ -75,12 +77,13 @@ head ∈ {{ (item *)&MEMORY }} i ∈ {2} next_free ∈ {8} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..0x3FF] ∈ {0} __fc_errno ∈ [--..--] @@ -98,8 +101,9 @@ head ∈ {{ (item *)&MEMORY }} i ∈ {2} next_free ∈ {16} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -120,12 +124,13 @@ head ∈ {{ (item *)&MEMORY[8] }} i ∈ {3} next_free ∈ {16} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -146,8 +151,9 @@ head ∈ {{ (item *)&MEMORY[8] }} i ∈ {3} next_free ∈ {24} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -170,12 +176,13 @@ head ∈ {{ (item *)&MEMORY[16] }} i ∈ {4} next_free ∈ {24} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -198,8 +205,9 @@ head ∈ {{ (item *)&MEMORY[16] }} i ∈ {4} next_free ∈ {32} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -224,12 +232,13 @@ head ∈ {{ (item *)&MEMORY[24] }} i ∈ {5} next_free ∈ {32} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -254,8 +263,9 @@ head ∈ {{ (item *)&MEMORY[24] }} i ∈ {5} next_free ∈ {40} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -282,12 +292,13 @@ head ∈ {{ (item *)&MEMORY[32] }} i ∈ {6} next_free ∈ {40} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -314,8 +325,9 @@ head ∈ {{ (item *)&MEMORY[32] }} i ∈ {6} next_free ∈ {48} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -344,12 +356,13 @@ head ∈ {{ (item *)&MEMORY[40] }} i ∈ {7} next_free ∈ {48} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -378,8 +391,9 @@ head ∈ {{ (item *)&MEMORY[40] }} i ∈ {7} next_free ∈ {56} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -410,12 +424,13 @@ head ∈ {{ (item *)&MEMORY[48] }} i ∈ {8} next_free ∈ {56} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -446,8 +461,9 @@ head ∈ {{ (item *)&MEMORY[48] }} i ∈ {8} next_free ∈ {64} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -480,12 +496,13 @@ head ∈ {{ (item *)&MEMORY[56] }} i ∈ {9} next_free ∈ {64} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -518,8 +535,9 @@ head ∈ {{ (item *)&MEMORY[56] }} i ∈ {9} next_free ∈ {72} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/linked_list.c line 40 + ==END OF DUMP== +tests/non-free/linked_list.c:40:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -554,12 +572,13 @@ head ∈ {{ (item *)&MEMORY[64] }} i ∈ {10} next_free ∈ {72} - =END OF DUMP== + ==END OF DUMP== [value] computing for function malloc <- main. Called from tests/non-free/linked_list.c:41. [value] Recording results for malloc [value] Done for function malloc -[value] DUMPING STATE of file tests/non-free/linked_list.c line 42 +tests/non-free/linked_list.c:42:[value] Frama_C_dump_each: + # Cvalue domain: MEMORY[bits 0 to 31] ∈ {1} [4..7] ∈ {0} [bits 64 to 95] ∈ {2} @@ -594,39 +613,39 @@ head ∈ {{ (item *)&MEMORY[64] }} i ∈ {10} next_free ∈ {80} - =END OF DUMP== -[value] computing for function printf_0 <- main. + ==END OF DUMP== +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] using specification for function printf_0 -tests/non-free/linked_list.c:51:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] using specification for function printf_va_1 +tests/non-free/linked_list.c:51:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 -[value] computing for function printf_0 <- main. +[value] Done for function printf_va_1 +[value] computing for function printf_va_1 <- main. Called from tests/non-free/linked_list.c:51. -[value] Done for function printf_0 +[value] Done for function printf_va_1 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -666,15 +685,15 @@ tests/non-free/linked_list.c:51:[value] function printf_0: precondition got stat [from] Computing for function main [from] Computing for function Frama_C_dump_each <-main [from] Done for function Frama_C_dump_each -[from] Computing for function printf_0 <-main -[from] Done for function printf_0 +[from] Computing for function printf_va_1 <-main +[from] Done for function printf_va_1 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: [from] Function malloc: next_free FROM size; next_free \result FROM size; next_free -[from] Function printf_0: +[from] Function printf_va_1: __fc_initial_stdout.__fc_FILE_data FROM __fc_initial_stdout; param0; "%d\n" (and SELF) \result FROM __fc_initial_stdout; param0; "%d\n" diff --git a/tests/non-free/oracle/loopalloc.res.oracle b/tests/non-free/oracle/loopalloc.res.oracle deleted file mode 100644 index 7004a953cedcc630d70cc30b52e691265ff00220..0000000000000000000000000000000000000000 --- a/tests/non-free/oracle/loopalloc.res.oracle +++ /dev/null @@ -1,305 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/non-free/loopalloc.i (no preprocessing) -[value] Analyzing a complete application starting at main -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - p ∈ {0} - v ∈ [--..--] -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 17 - p ∈ {0} - v ∈ [--..--] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:18:[value] allocating variable __malloc_main_l18 -tests/non-free/loopalloc.i:19:[value:malloc] strong free on bases: {__malloc_main_l18} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 20 - p ∈ ESCAPINGADDR - v ∈ [--..--] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:15:[value] entering loop for the first time -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 17 - p ∈ ESCAPINGADDR - v ∈ [--..--] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:18:[value] allocating variable __malloc_main_l18_0 -tests/non-free/loopalloc.i:19:[value:malloc] strong free on bases: {__malloc_main_l18_0} -[value] Recording results for main -[value] done for function main -[value] ====== VALUES COMPUTED ====== -tests/non-free/loopalloc.i:18:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype -tests/non-free/loopalloc.i:19:[kernel] warning: Neither code nor specification for function Frama_C_free, generating default assigns from the prototype -[value:final-states] Values at end of function main: - NON TERMINATING FUNCTION -[from] Computing for function main -[from] Computing for function Frama_C_dump_each <-main -[from] Done for function Frama_C_dump_each -[from] Computing for function Frama_C_alloc_size <-main -[from] Done for function Frama_C_alloc_size -[from] Computing for function Frama_C_free <-main -[from] Done for function Frama_C_free -[from] Non-terminating function main (no dependencies) -[from] Done for function main -[from] ====== DEPENDENCIES COMPUTED ====== - These dependencies hold at termination for the executions that terminate: -[from] Function main: - NON TERMINATING - NO EFFECTS -[from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function main: - p -[inout] Inputs for function main: - p -[value] Analyzing a complete application starting at main2 -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - p ∈ {0} - v ∈ [--..--] -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ {0} - v ∈ [--..--] - c ∈ {0; 1} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_0 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_0 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_0} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_1 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_1 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_1} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_2 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_2 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_2} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4; 5} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_3 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_3 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_3} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4; 5} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4; 5; 6} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_4 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_4 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_4} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4; 5; 6} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4; 5; 6; 7} - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_5 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_5 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_5} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ {0; 1; 2; 3; 4; 5; 6; 7} - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..8] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_6 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_6 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_6} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..8] - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..9] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_7 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_7 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_7} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..9] - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..10] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_8 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_8 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_8} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..10] - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 41 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..11] - __retres ∈ UNINITIALIZED - =END OF DUMP== -tests/non-free/loopalloc.i:42:[value] allocating variable __malloc_main2_l42_9 -[value] Called Frama_C_show_each({{ &__malloc_main2_l42_9 }}) -tests/non-free/loopalloc.i:44:[value:malloc] strong free on bases: {__malloc_main2_l42_9} -[value] DUMPING STATE of file tests/non-free/loopalloc.i line 45 - p ∈ ESCAPINGADDR - v ∈ [--..--] - c ∈ [0..11] - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] computing for function incr <- main2. - Called from tests/non-free/loopalloc.i:39. -[value] Recording results for incr -[value] Done for function incr -[value] Recording results for main2 -[value] done for function main2 -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function incr: - c ∈ [0..11] -[value:final-states] Values at end of function main2: - NON TERMINATING FUNCTION -[from] Computing for function incr -[from] Done for function incr -[from] Computing for function main2 -[from] Computing for function Frama_C_dump_each <-main2 -[from] Done for function Frama_C_dump_each -[from] Computing for function Frama_C_alloc_size <-main2 -[from] Done for function Frama_C_alloc_size -[from] Computing for function Frama_C_free <-main2 -[from] Done for function Frama_C_free -[from] Non-terminating function main2 (no dependencies) -[from] Done for function main2 -[from] ====== DEPENDENCIES COMPUTED ====== - These dependencies hold at termination for the executions that terminate: -[from] Function incr: - c FROM v; p_0; c (and SELF) -[from] Function main2: - NON TERMINATING - NO EFFECTS -[from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function incr: - c -[inout] Inputs for function incr: - v; c -[inout] Out (internal) for function main2: - p; c -[inout] Inputs for function main2: - p; v diff --git a/tests/non-free/oracle/malloc-deps.res.oracle b/tests/non-free/oracle/malloc-deps.res.oracle index 3aa8ae0ba9db1208697be54a64d3b294788b6121..2b08bc8c2eb553c27caeee07423847e8cf0ea495 100644 --- a/tests/non-free/oracle/malloc-deps.res.oracle +++ b/tests/non-free/oracle/malloc-deps.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc-deps.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -100,20 +99,20 @@ tests/non-free/malloc-deps.i:28:[value:malloc] resizing variable `__malloc_w_mai [from] Computing for function g [from] Done for function g [from] Computing for function main -[from] Computing for function Frama_C_alloc_size_weak <-main -[from] Done for function Frama_C_alloc_size_weak -[from] Computing for function Frama_C_alloc_size <-main -[from] Done for function Frama_C_alloc_size -[from] Computing for function Frama_C_alloc_by_stack <-main -[from] Done for function Frama_C_alloc_by_stack +[from] Computing for function Frama_C_malloc_fresh_weak <-main +[from] Done for function Frama_C_malloc_fresh_weak +[from] Computing for function Frama_C_malloc_fresh <-main +[from] Done for function Frama_C_malloc_fresh +[from] Computing for function Frama_C_malloc_by_stack <-main +[from] Done for function Frama_C_malloc_by_stack [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_by_stack: +[from] Function Frama_C_malloc_by_stack: \result FROM \nothing -[from] Function Frama_C_alloc_size: +[from] Function Frama_C_malloc_fresh: \result FROM \nothing -[from] Function Frama_C_alloc_size_weak: +[from] Function Frama_C_malloc_fresh_weak: \result FROM \nothing [from] Function g: __malloc_w_main_l28[0..9] FROM p; k (and SELF) @@ -123,11 +122,11 @@ tests/non-free/malloc-deps.i:28:[value:malloc] resizing variable `__malloc_w_mai __malloc_w_main_l28[0..9] FROM v (and SELF) [from] ====== END OF DEPENDENCIES ====== [from] ====== DISPLAYING CALLWISE DEPENDENCIES ====== -[from] call to Frama_C_alloc_size_weak at tests/non-free/malloc-deps.i:17 (by main): +[from] call to Frama_C_malloc_fresh_weak at tests/non-free/malloc-deps.i:17 (by main): \result FROM \nothing -[from] call to Frama_C_alloc_size at tests/non-free/malloc-deps.i:21 (by main): +[from] call to Frama_C_malloc_fresh at tests/non-free/malloc-deps.i:21 (by main): \result FROM \nothing -[from] call to Frama_C_alloc_by_stack at tests/non-free/malloc-deps.i:28 (by main): +[from] call to Frama_C_malloc_by_stack at tests/non-free/malloc-deps.i:28 (by main): \result FROM \nothing [from] call to g at tests/non-free/malloc-deps.i:29 (by main): __malloc_w_main_l28[0..9] FROM p; k (and SELF) diff --git a/tests/non-free/oracle/malloc-optimistic.res.oracle b/tests/non-free/oracle/malloc-optimistic.res.oracle index 4bcbce877c9ed4fcd350ddcc3796842d3d114e63..6acb910aa543ea65d72c9201e3ef1bae0b445f89 100644 --- a/tests/non-free/oracle/malloc-optimistic.res.oracle +++ b/tests/non-free/oracle/malloc-optimistic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc-optimistic.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,24 +6,24 @@ v ∈ [--..--] [value] computing for function main1 <- main. Called from tests/non-free/malloc-optimistic.c:135. -[value] Called Frama_C_show_each_1_1({0}) -[value] Called Frama_C_show_each_1_1({1}) +tests/non-free/malloc-optimistic.c:16:[value] Frama_C_show_each_1_1: {0} +tests/non-free/malloc-optimistic.c:16:[value] Frama_C_show_each_1_1: {1} tests/non-free/malloc-optimistic.c:17:[value] allocating variable __malloc_main1_l17 tests/non-free/malloc-optimistic.c:17:[value:malloc] resizing variable `__malloc_main1_l17' (0..31) to fit 0..63 -[value] Called Frama_C_show_each_1_2({0}) -[value] Called Frama_C_show_each_1_2({1}) +tests/non-free/malloc-optimistic.c:18:[value] Frama_C_show_each_1_2: {0} +tests/non-free/malloc-optimistic.c:18:[value] Frama_C_show_each_1_2: {1} tests/non-free/malloc-optimistic.c:19:[value] warning: out of bounds write. assert \valid(p + i); [value] Recording results for main1 [value] Done for function main1 tests/non-free/malloc-optimistic.c:136:[value:malloc] strong free on bases: {__malloc_main1_l17} [value] computing for function main2 <- main. Called from tests/non-free/malloc-optimistic.c:137. -[value] Called Frama_C_show_each_2_1({2}) -[value] Called Frama_C_show_each_2_1({1}) +tests/non-free/malloc-optimistic.c:26:[value] Frama_C_show_each_2_1: {2} +tests/non-free/malloc-optimistic.c:26:[value] Frama_C_show_each_2_1: {1} tests/non-free/malloc-optimistic.c:27:[value] allocating variable __malloc_main2_l27 tests/non-free/malloc-optimistic.c:27:[value:malloc] resizing variable `__malloc_main2_l27' (0..95) to fit 0..63 -[value] Called Frama_C_show_each_2_2({2}) -[value] Called Frama_C_show_each_2_2({1}) +tests/non-free/malloc-optimistic.c:28:[value] Frama_C_show_each_2_2: {2} +tests/non-free/malloc-optimistic.c:28:[value] Frama_C_show_each_2_2: {1} tests/non-free/malloc-optimistic.c:29:[value] warning: out of bounds write. assert \valid(p + i); [value] Recording results for main2 [value] Done for function main2 @@ -66,7 +65,8 @@ tests/non-free/malloc-optimistic.c:64:[value] allocating variable __malloc_main5 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31) to fit 0..63 tests/non-free/malloc-optimistic.c:65:[value] warning: out of bounds write. assert \valid(p + i); tests/non-free/malloc-optimistic.c:66:[value] warning: out of bounds read. assert \valid_read(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {0} p ∈ {{ &__malloc_main5_l64[0] }} @@ -75,8 +75,9 @@ tests/non-free/malloc-optimistic.c:66:[value] warning: out of bounds read. asser p ∈ ESCAPINGADDR __retres ∈ UNINITIALIZED __malloc_main5_l64[0] ∈ {0} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_main5_l64[0] }} @@ -86,12 +87,13 @@ tests/non-free/malloc-optimistic.c:66:[value] warning: out of bounds read. asser __retres ∈ UNINITIALIZED __malloc_main5_l64[0] ∈ UNINITIALIZED [1] ∈ {0} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/63) to fit 0..63 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/63) to fit 0..95 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_main5_l64[0] }} @@ -101,8 +103,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..1] ∈ UNINITIALIZED [2] ∈ {1} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_main5_l64[0] }} @@ -112,12 +115,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0] ∈ UNINITIALIZED [1] ∈ {1} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/95) to fit 0..95 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/95) to fit 0..127 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_main5_l64[0] }} @@ -127,8 +131,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..2] ∈ UNINITIALIZED [3] ∈ {2} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_main5_l64[0] }} @@ -138,12 +143,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..1] ∈ UNINITIALIZED [2] ∈ {2} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/127) to fit 0..127 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/127) to fit 0..159 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_main5_l64[0] }} @@ -153,8 +159,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..3] ∈ UNINITIALIZED [4] ∈ {3} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_main5_l64[0] }} @@ -164,12 +171,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..2] ∈ UNINITIALIZED [3] ∈ {3} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/159) to fit 0..159 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/159) to fit 0..191 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_main5_l64[0] }} @@ -179,8 +187,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..4] ∈ UNINITIALIZED [5] ∈ {4} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_main5_l64[0] }} @@ -190,12 +199,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..3] ∈ UNINITIALIZED [4] ∈ {4} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/191) to fit 0..191 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/191) to fit 0..223 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_main5_l64[0] }} @@ -205,8 +215,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..5] ∈ UNINITIALIZED [6] ∈ {5} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_main5_l64[0] }} @@ -216,12 +227,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..4] ∈ UNINITIALIZED [5] ∈ {5} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/223) to fit 0..223 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/223) to fit 0..255 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_main5_l64[0] }} @@ -231,8 +243,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..6] ∈ UNINITIALIZED [7] ∈ {6} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_main5_l64[0] }} @@ -242,12 +255,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..5] ∈ UNINITIALIZED [6] ∈ {6} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/255) to fit 0..255 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/255) to fit 0..287 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_main5_l64[0] }} @@ -257,8 +271,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..7] ∈ UNINITIALIZED [8] ∈ {7} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_main5_l64[0] }} @@ -268,12 +283,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..6] ∈ UNINITIALIZED [7] ∈ {7} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/287) to fit 0..287 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/287) to fit 0..319 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_main5_l64[0] }} @@ -283,8 +299,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..8] ∈ UNINITIALIZED [9] ∈ {8} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_main5_l64[0] }} @@ -294,12 +311,13 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..7] ∈ UNINITIALIZED [8] ∈ {8} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/319) to fit 0..319 tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc_main5_l64' (0..31/319) to fit 0..351 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {10} p ∈ {{ &__malloc_main5_l64[0] }} @@ -309,8 +327,9 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..9] ∈ UNINITIALIZED [10] ∈ {9} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 67 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_main5_l64[0] }} @@ -320,7 +339,7 @@ tests/non-free/malloc-optimistic.c:64:[value:malloc] resizing variable `__malloc __retres ∈ UNINITIALIZED __malloc_main5_l64[0..8] ∈ UNINITIALIZED [9] ∈ {9} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} tests/non-free/malloc-optimistic.c:68:[value:malloc] strong free on bases: {__malloc_main5_l64} [value] Recording results for main5 @@ -331,7 +350,8 @@ tests/non-free/malloc-optimistic.c:77:[value] allocating variable __malloc_main6 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_main6_l77' (0..31) to fit 0..63 tests/non-free/malloc-optimistic.c:78:[value] warning: out of bounds write. assert \valid(p + i); tests/non-free/malloc-optimistic.c:79:[value] warning: out of bounds read. assert \valid_read(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {0} p ∈ {{ &__malloc_main6_l77[0] }} @@ -340,8 +360,9 @@ tests/non-free/malloc-optimistic.c:79:[value] warning: out of bounds read. asser p ∈ ESCAPINGADDR __retres ∈ UNINITIALIZED __malloc_main6_l77[0] ∈ {0} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_main6_l77[0] }} @@ -351,13 +372,14 @@ tests/non-free/malloc-optimistic.c:79:[value] warning: out of bounds read. asser __retres ∈ UNINITIALIZED __malloc_main6_l77[0] ∈ UNINITIALIZED [1] ∈ {0} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] strong free on bases: {__malloc_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] marking variable `__malloc_main6_l77' as weak tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/63) to fit 0..63 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/63) to fit 0..95 tests/non-free/malloc-optimistic.c:79:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -368,8 +390,9 @@ tests/non-free/malloc-optimistic.c:79:[value] warning: accessing uninitialized l __malloc_w_main6_l77[0] ∈ UNINITIALIZED [1] ∈ {0} or UNINITIALIZED [2] ∈ {1} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -379,11 +402,12 @@ tests/non-free/malloc-optimistic.c:79:[value] warning: accessing uninitialized l __retres ∈ UNINITIALIZED __malloc_w_main6_l77[0] ∈ UNINITIALIZED [1] ∈ {0; 1} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/95) to fit 0..95 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/95) to fit 0..127 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -395,8 +419,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [1] ∈ {0; 1} or UNINITIALIZED [2] ∈ {1} or UNINITIALIZED [3] ∈ {2} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -407,11 +432,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc __malloc_w_main6_l77[0] ∈ UNINITIALIZED [1] ∈ {0; 1} or UNINITIALIZED [2] ∈ {1; 2} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/127) to fit 0..127 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/127) to fit 0..159 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -424,8 +450,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [2] ∈ {1; 2} or UNINITIALIZED [3] ∈ {2} or UNINITIALIZED [4] ∈ {3} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -437,11 +464,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [1] ∈ {0; 1} or UNINITIALIZED [2] ∈ {1; 2} or UNINITIALIZED [3] ∈ {2; 3} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/159) to fit 0..159 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/159) to fit 0..191 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -455,8 +483,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [3] ∈ {2; 3} or UNINITIALIZED [4] ∈ {3} or UNINITIALIZED [5] ∈ {4} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -469,11 +498,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [2] ∈ {1; 2} or UNINITIALIZED [3] ∈ {2; 3} or UNINITIALIZED [4] ∈ {3; 4} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/191) to fit 0..191 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/191) to fit 0..223 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -488,8 +518,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [4] ∈ {3; 4} or UNINITIALIZED [5] ∈ {4} or UNINITIALIZED [6] ∈ {5} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -503,11 +534,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [3] ∈ {2; 3} or UNINITIALIZED [4] ∈ {3; 4} or UNINITIALIZED [5] ∈ {4; 5} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/223) to fit 0..223 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/223) to fit 0..255 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -523,8 +555,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [5] ∈ {4; 5} or UNINITIALIZED [6] ∈ {5} or UNINITIALIZED [7] ∈ {6} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -539,11 +572,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [4] ∈ {3; 4} or UNINITIALIZED [5] ∈ {4; 5} or UNINITIALIZED [6] ∈ {5; 6} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/255) to fit 0..255 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/255) to fit 0..287 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -560,8 +594,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [6] ∈ {5; 6} or UNINITIALIZED [7] ∈ {6} or UNINITIALIZED [8] ∈ {7} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -577,11 +612,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [5] ∈ {4; 5} or UNINITIALIZED [6] ∈ {5; 6} or UNINITIALIZED [7] ∈ {6; 7} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/287) to fit 0..287 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/287) to fit 0..319 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -599,8 +635,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [7] ∈ {6; 7} or UNINITIALIZED [8] ∈ {7} or UNINITIALIZED [9] ∈ {8} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -617,11 +654,12 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [6] ∈ {5; 6} or UNINITIALIZED [7] ∈ {6; 7} or UNINITIALIZED [8] ∈ {7; 8} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/319) to fit 0..319 tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc_w_main6_l77' (0..31/319) to fit 0..351 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {10} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -640,8 +678,9 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [8] ∈ {7; 8} or UNINITIALIZED [9] ∈ {8} or UNINITIALIZED [10] ∈ {9} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 80 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:80:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_w_main6_l77[0] }} @@ -659,7 +698,7 @@ tests/non-free/malloc-optimistic.c:77:[value:malloc] resizing variable `__malloc [7] ∈ {6; 7} or UNINITIALIZED [8] ∈ {7; 8} or UNINITIALIZED [9] ∈ {8; 9} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:81:[value:malloc] weak free on bases: {__malloc_w_main6_l77} [value] Recording results for main6 [value] Done for function main6 @@ -669,7 +708,8 @@ tests/non-free/malloc-optimistic.c:90:[value] allocating variable __malloc_main7 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31) to fit 0..63 tests/non-free/malloc-optimistic.c:91:[value] warning: out of bounds write. assert \valid(p + i); tests/non-free/malloc-optimistic.c:92:[value] warning: out of bounds read. assert \valid_read(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {0} p ∈ {{ &__malloc_main7_l90[0] }} @@ -689,8 +729,9 @@ tests/non-free/malloc-optimistic.c:92:[value] warning: out of bounds read. asser [9] ∈ {8; 9} or UNINITIALIZED [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0] ∈ {0} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_main7_l90[0] }} @@ -711,12 +752,13 @@ tests/non-free/malloc-optimistic.c:92:[value] warning: out of bounds read. asser [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0] ∈ UNINITIALIZED [1] ∈ {0} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/63) to fit 0..63 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/63) to fit 0..95 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_main7_l90[0] }} @@ -737,8 +779,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..1] ∈ UNINITIALIZED [2] ∈ {1} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_main7_l90[0] }} @@ -759,12 +802,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0] ∈ UNINITIALIZED [1] ∈ {1} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/95) to fit 0..95 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/95) to fit 0..127 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_main7_l90[0] }} @@ -785,8 +829,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..2] ∈ UNINITIALIZED [3] ∈ {2} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_main7_l90[0] }} @@ -807,12 +852,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..1] ∈ UNINITIALIZED [2] ∈ {2} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/127) to fit 0..127 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/127) to fit 0..159 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_main7_l90[0] }} @@ -833,8 +879,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..3] ∈ UNINITIALIZED [4] ∈ {3} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_main7_l90[0] }} @@ -855,12 +902,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..2] ∈ UNINITIALIZED [3] ∈ {3} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/159) to fit 0..159 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/159) to fit 0..191 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_main7_l90[0] }} @@ -881,8 +929,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..4] ∈ UNINITIALIZED [5] ∈ {4} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_main7_l90[0] }} @@ -903,12 +952,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..3] ∈ UNINITIALIZED [4] ∈ {4} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/191) to fit 0..191 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/191) to fit 0..223 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_main7_l90[0] }} @@ -929,8 +979,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..5] ∈ UNINITIALIZED [6] ∈ {5} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_main7_l90[0] }} @@ -951,12 +1002,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..4] ∈ UNINITIALIZED [5] ∈ {5} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/223) to fit 0..223 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/223) to fit 0..255 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_main7_l90[0] }} @@ -977,8 +1029,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..6] ∈ UNINITIALIZED [7] ∈ {6} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_main7_l90[0] }} @@ -999,12 +1052,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..5] ∈ UNINITIALIZED [6] ∈ {6} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/255) to fit 0..255 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/255) to fit 0..287 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1025,8 +1079,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..7] ∈ UNINITIALIZED [8] ∈ {7} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1047,12 +1102,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..6] ∈ UNINITIALIZED [7] ∈ {7} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/287) to fit 0..287 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/287) to fit 0..319 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1073,8 +1129,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..8] ∈ UNINITIALIZED [9] ∈ {8} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1095,12 +1152,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..7] ∈ UNINITIALIZED [8] ∈ {8} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/319) to fit 0..319 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/319) to fit 0..351 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {10} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1121,8 +1179,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..9] ∈ UNINITIALIZED [10] ∈ {9} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1143,12 +1202,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..8] ∈ UNINITIALIZED [9] ∈ {9} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/351) to fit 0..351 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/351) to fit 0..383 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {11} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1169,8 +1229,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..10] ∈ UNINITIALIZED [11] ∈ {10} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {10} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1191,12 +1252,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..9] ∈ UNINITIALIZED [10] ∈ {10} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/383) to fit 0..383 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/383) to fit 0..415 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {12} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1217,8 +1279,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..11] ∈ UNINITIALIZED [12] ∈ {11} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {11} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1239,12 +1302,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..10] ∈ UNINITIALIZED [11] ∈ {11} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/415) to fit 0..415 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/415) to fit 0..447 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {13} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1265,8 +1329,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..12] ∈ UNINITIALIZED [13] ∈ {12} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {12} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1287,12 +1352,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..11] ∈ UNINITIALIZED [12] ∈ {12} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/447) to fit 0..447 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/447) to fit 0..479 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {14} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1313,8 +1379,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..13] ∈ UNINITIALIZED [14] ∈ {13} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {13} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1335,12 +1402,13 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..12] ∈ UNINITIALIZED [13] ∈ {13} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/479) to fit 0..479 tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/479) to fit 0..511 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1361,8 +1429,9 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..14] ∈ UNINITIALIZED [15] ∈ {14} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {14} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1383,13 +1452,14 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..13] ∈ UNINITIALIZED [14] ∈ {14} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:88:[value] entering loop for the first time tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/511) to fit 0..511/543 tests/non-free/malloc-optimistic.c:92:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15; 16} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1410,10 +1480,11 @@ tests/non-free/malloc-optimistic.c:92:[value] warning: accessing uninitialized l [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..14] ∈ UNINITIALIZED [15..16] ∈ {15} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/543) to fit 0..511/575 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15; 16; 17} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1434,10 +1505,11 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..14] ∈ UNINITIALIZED [15..17] ∈ {15; 16} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/575) to fit 0..511/607 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15; 16; 17; 18} p ∈ {{ &__malloc_main7_l90[0] }} @@ -1458,10 +1530,11 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..14] ∈ UNINITIALIZED [15..18] ∈ {15; 16; 17} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc_main7_l90' (0..31/607) to fit 0..511/3231 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 93 +tests/non-free/malloc-optimistic.c:93:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ [15..100] p ∈ {{ &__malloc_main7_l90[0] }} @@ -1482,7 +1555,7 @@ tests/non-free/malloc-optimistic.c:90:[value:malloc] resizing variable `__malloc [10] ∈ {9} or UNINITIALIZED __malloc_main7_l90[0..14] ∈ UNINITIALIZED [15..100] ∈ [15..99] or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:94:[value:malloc] strong free on bases: {__malloc_main7_l90} [value] Recording results for main7 [value] Done for function main7 @@ -1492,7 +1565,8 @@ tests/non-free/malloc-optimistic.c:103:[value] allocating variable __malloc_main tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_main8_l103' (0..31) to fit 0..63 tests/non-free/malloc-optimistic.c:104:[value] warning: out of bounds write. assert \valid(p + i); tests/non-free/malloc-optimistic.c:105:[value] warning: out of bounds read. assert \valid_read(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {0} p ∈ {{ &__malloc_main8_l103[0] }} @@ -1512,8 +1586,9 @@ tests/non-free/malloc-optimistic.c:105:[value] warning: out of bounds read. asse [9] ∈ {8; 9} or UNINITIALIZED [10] ∈ {9} or UNINITIALIZED __malloc_main8_l103[0] ∈ {0} - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_main8_l103[0] }} @@ -1534,13 +1609,14 @@ tests/non-free/malloc-optimistic.c:105:[value] warning: out of bounds read. asse [10] ∈ {9} or UNINITIALIZED __malloc_main8_l103[0] ∈ UNINITIALIZED [1] ∈ {0} - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] strong free on bases: {__malloc_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] marking variable `__malloc_main8_l103' as weak tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/63) to fit 0..63 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/63) to fit 0..95 tests/non-free/malloc-optimistic.c:105:[value] warning: accessing uninitialized left-value. assert \initialized(p + i); -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1562,8 +1638,9 @@ tests/non-free/malloc-optimistic.c:105:[value] warning: accessing uninitialized __malloc_w_main8_l103[0] ∈ UNINITIALIZED [1] ∈ {0} or UNINITIALIZED [2] ∈ {1} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {1} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1584,11 +1661,12 @@ tests/non-free/malloc-optimistic.c:105:[value] warning: accessing uninitialized [10] ∈ {9} or UNINITIALIZED __malloc_w_main8_l103[0] ∈ UNINITIALIZED [1] ∈ {0; 1} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/95) to fit 0..95 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/95) to fit 0..127 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1611,8 +1689,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [1] ∈ {0; 1} or UNINITIALIZED [2] ∈ {1} or UNINITIALIZED [3] ∈ {2} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {2} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1634,11 +1713,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo __malloc_w_main8_l103[0] ∈ UNINITIALIZED [1] ∈ {0; 1} or UNINITIALIZED [2] ∈ {1; 2} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/127) to fit 0..127 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/127) to fit 0..159 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1662,8 +1742,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [2] ∈ {1; 2} or UNINITIALIZED [3] ∈ {2} or UNINITIALIZED [4] ∈ {3} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {3} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1686,11 +1767,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [1] ∈ {0; 1} or UNINITIALIZED [2] ∈ {1; 2} or UNINITIALIZED [3] ∈ {2; 3} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/159) to fit 0..159 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/159) to fit 0..191 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1715,8 +1797,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [3] ∈ {2; 3} or UNINITIALIZED [4] ∈ {3} or UNINITIALIZED [5] ∈ {4} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {4} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1740,11 +1823,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [2] ∈ {1; 2} or UNINITIALIZED [3] ∈ {2; 3} or UNINITIALIZED [4] ∈ {3; 4} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/191) to fit 0..191 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/191) to fit 0..223 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1770,8 +1854,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [4] ∈ {3; 4} or UNINITIALIZED [5] ∈ {4} or UNINITIALIZED [6] ∈ {5} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {5} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1796,11 +1881,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [3] ∈ {2; 3} or UNINITIALIZED [4] ∈ {3; 4} or UNINITIALIZED [5] ∈ {4; 5} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/223) to fit 0..223 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/223) to fit 0..255 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1827,8 +1913,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [5] ∈ {4; 5} or UNINITIALIZED [6] ∈ {5} or UNINITIALIZED [7] ∈ {6} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {6} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1854,11 +1941,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [4] ∈ {3; 4} or UNINITIALIZED [5] ∈ {4; 5} or UNINITIALIZED [6] ∈ {5; 6} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/255) to fit 0..255 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/255) to fit 0..287 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1886,8 +1974,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [6] ∈ {5; 6} or UNINITIALIZED [7] ∈ {6} or UNINITIALIZED [8] ∈ {7} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {7} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1914,11 +2003,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [5] ∈ {4; 5} or UNINITIALIZED [6] ∈ {5; 6} or UNINITIALIZED [7] ∈ {6; 7} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/287) to fit 0..287 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/287) to fit 0..319 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1947,8 +2037,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [7] ∈ {6; 7} or UNINITIALIZED [8] ∈ {7} or UNINITIALIZED [9] ∈ {8} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {8} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -1976,11 +2067,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [6] ∈ {5; 6} or UNINITIALIZED [7] ∈ {6; 7} or UNINITIALIZED [8] ∈ {7; 8} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/319) to fit 0..319 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/319) to fit 0..351 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {10} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2010,8 +2102,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [8] ∈ {7; 8} or UNINITIALIZED [9] ∈ {8} or UNINITIALIZED [10] ∈ {9} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {9} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2040,11 +2133,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [7] ∈ {6; 7} or UNINITIALIZED [8] ∈ {7; 8} or UNINITIALIZED [9] ∈ {8; 9} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/351) to fit 0..351 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/351) to fit 0..383 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {11} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2075,8 +2169,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [9] ∈ {8; 9} or UNINITIALIZED [10] ∈ {9} or UNINITIALIZED [11] ∈ {10} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {10} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2106,11 +2201,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [8] ∈ {7; 8} or UNINITIALIZED [9] ∈ {8; 9} or UNINITIALIZED [10] ∈ {9; 10} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/383) to fit 0..383 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/383) to fit 0..415 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {12} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2142,8 +2238,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [10] ∈ {9; 10} or UNINITIALIZED [11] ∈ {10} or UNINITIALIZED [12] ∈ {11} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {11} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2174,11 +2271,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [9] ∈ {8; 9} or UNINITIALIZED [10] ∈ {9; 10} or UNINITIALIZED [11] ∈ {10; 11} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/415) to fit 0..415 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/415) to fit 0..447 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {13} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2211,8 +2309,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [11] ∈ {10; 11} or UNINITIALIZED [12] ∈ {11} or UNINITIALIZED [13] ∈ {12} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {12} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2244,11 +2343,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [10] ∈ {9; 10} or UNINITIALIZED [11] ∈ {10; 11} or UNINITIALIZED [12] ∈ {11; 12} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/447) to fit 0..447 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/447) to fit 0..479 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {14} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2282,8 +2382,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [12] ∈ {11; 12} or UNINITIALIZED [13] ∈ {12} or UNINITIALIZED [14] ∈ {13} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {13} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2316,11 +2417,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [11] ∈ {10; 11} or UNINITIALIZED [12] ∈ {11; 12} or UNINITIALIZED [13] ∈ {12; 13} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/479) to fit 0..479 tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/479) to fit 0..511 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2355,8 +2457,9 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [13] ∈ {12; 13} or UNINITIALIZED [14] ∈ {13} or UNINITIALIZED [15] ∈ {14} or UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 + ==END OF DUMP== +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {14} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2390,11 +2493,12 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [12] ∈ {11; 12} or UNINITIALIZED [13] ∈ {12; 13} or UNINITIALIZED [14] ∈ {13; 14} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:101:[value] entering loop for the first time tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/511) to fit 0..511/543 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15; 16} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2430,10 +2534,11 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [14] ∈ {13; 14} or UNINITIALIZED [15] ∈ {14; 15} or UNINITIALIZED [16] ∈ {15} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/543) to fit 0..511/575 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15; 16; 17} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2469,10 +2574,11 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [14] ∈ {13; 14} or UNINITIALIZED [15] ∈ {14; 15; 16} or UNINITIALIZED [16..17] ∈ {15; 16} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/575) to fit 0..511/607 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ {15; 16; 17; 18} p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2508,10 +2614,11 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [14] ∈ {13; 14} or UNINITIALIZED [15] ∈ {14; 15; 16; 17} or UNINITIALIZED [16..18] ∈ {15; 16; 17} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/607) to fit 0..511/3231 -[value] DUMPING STATE of file tests/non-free/malloc-optimistic.c line 106 +tests/non-free/malloc-optimistic.c:106:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] i ∈ [15..100] p ∈ {{ &__malloc_w_main8_l103[0] }} @@ -2547,7 +2654,7 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [14] ∈ {13; 14} or UNINITIALIZED [15] ∈ [14..99] or UNINITIALIZED [16..100] ∈ [15..99] or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-optimistic.c:107:[value:malloc] weak free on bases: {__malloc_w_main8_l103} tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__malloc_w_main8_l103' (0..31/3231) to fit 0..511/3231 [value] Recording results for main8 @@ -2555,213 +2662,213 @@ tests/non-free/malloc-optimistic.c:103:[value:malloc] resizing variable `__mallo [value] computing for function main9 <- main. Called from tests/non-free/malloc-optimistic.c:150. tests/non-free/malloc-optimistic.c:119:[value] allocating variable __malloc_main9_l119 -[value] Called Frama_C_show_each({0}, {{ &__malloc_main9_l119 }}) -[value] Called Frama_C_show_each({0}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {0}, {{ &__malloc_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {0} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux tests/non-free/malloc-optimistic.c:119:[value:malloc] marking variable `__malloc_main9_l119' as weak -[value] Called Frama_C_show_each({1}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {1}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({2}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1; 2}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {2}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({3}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1; 2; 3}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {3}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({4}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1; 2; 3; 4}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {4}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({5}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {5}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({6}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5; 6}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {6}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5; 6} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({7}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each({-20; 1; 2; 3; 4; 5; 6; 7}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {7}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: {-20; 1; 2; 3; 4; 5; 6; 7} [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({8}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..8]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {8}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..8] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({9}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..9]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {9}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..9] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({10}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..10]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {10}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..10] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({11}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..11]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {11}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..11] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({12}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..12]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {12}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..12] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({13}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..13]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {13}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..13] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({14}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..14]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {14}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..14] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({15}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..15]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {15}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..15] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({16}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..16]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {16}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..16] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({17}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..17]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {17}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..17] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({18}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..18]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {18}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..18] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({19}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..19]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {19}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..19] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({20}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..20]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {20}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..20] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({21}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..21]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {21}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..21] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({22}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..22]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {22}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..22] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({23}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..23]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {23}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..23] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({24}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..24]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {24}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..24] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({25}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..25]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {25}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..25] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({26}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..26]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {26}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..26] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({27}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..27]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {27}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..27] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({28}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..28]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {28}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..28] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({29}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..29]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {29}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..29] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux tests/non-free/malloc-optimistic.c:118:[value] entering loop for the first time -[value] Called Frama_C_show_each({30}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..30]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {30}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..30] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({30; 31}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..31]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {30; 31}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..31] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each({30; 31; 32}, {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..32]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: {30; 31; 32}, {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..32] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each([30..99], {{ &__malloc_w_main9_l119 }}) -[value] Called Frama_C_show_each([-20..99]) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: [30..99], {{ &__malloc_w_main9_l119 }} +tests/non-free/malloc-optimistic.c:122:[value] Frama_C_show_each: [-20..99] [value] computing for function main9_aux <- main9 <- main. Called from tests/non-free/malloc-optimistic.c:123. [value] Recording results for main9_aux [value] Done for function main9_aux -[value] Called Frama_C_show_each([30..99], {{ &__malloc_w_main9_l119 }}) +tests/non-free/malloc-optimistic.c:120:[value] Frama_C_show_each: [30..99], {{ &__malloc_w_main9_l119 }} [value] Recording results for main9 [value] Done for function main9 [value] Recording results for main diff --git a/tests/non-free/oracle/malloc-size-zero.0.res.oracle b/tests/non-free/oracle/malloc-size-zero.0.res.oracle index f207e811d581ba0e1d33602f2812347c815cb186..e26b2efee1f5dcfc0799f5e15d1c611b778be57d 100644 --- a/tests/non-free/oracle/malloc-size-zero.0.res.oracle +++ b/tests/non-free/oracle/malloc-size-zero.0.res.oracle @@ -1,79 +1,78 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc-size-zero.i (no preprocessing) -[value] user error: no assigns specified for function 'malloc', for which a builtin - or the specification will be used. Potential unsoundness. -[value] user error: no assigns specified for function 'free', for which a builtin - or the specification will be used. Potential unsoundness. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization foo ∈ [--..--] -[value] computing for function calloc <- main. +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:16. -tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_calloc_l10 -[value] Recording results for calloc -[value] Done for function calloc -[value] Called Frama_C_show_each_not_NULL_p1() +tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_my_calloc_l10 +tests/non-free/malloc-size-zero.i:10:[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype +[value] Recording results for my_calloc +[value] Done for function my_calloc +tests/non-free/malloc-size-zero.i:20:[value] Frama_C_show_each_not_NULL_p1: tests/non-free/malloc-size-zero.i:24:[value] warning: pointer comparison. assert \pointer_comparable((void *)(p1 + 1), (void *)0); tests/non-free/malloc-size-zero.i:27:[value] entering loop for the first time -[value] computing for function calloc <- main. +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. -tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_calloc_l10_0 -[value] Recording results for calloc -[value] Done for function calloc -[value] computing for function calloc <- main. +tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_my_calloc_l10_0 +[value] Recording results for my_calloc +[value] Done for function my_calloc +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. -tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_calloc_l10_1 -[value] Recording results for calloc -[value] Done for function calloc -[value] computing for function calloc <- main. +tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_my_calloc_l10_1 +[value] Recording results for my_calloc +[value] Done for function my_calloc +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. -tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_calloc_l10_2 -[value] Recording results for calloc -[value] Done for function calloc -[value] computing for function calloc <- main. +tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_my_calloc_l10_2 +[value] Recording results for my_calloc +[value] Done for function my_calloc +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. -tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_calloc_l10_3 -[value] Recording results for calloc -[value] Done for function calloc -[value] computing for function calloc <- main. +tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_my_calloc_l10_3 +[value] Recording results for my_calloc +[value] Done for function my_calloc +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. -[value] Recording results for calloc -[value] Done for function calloc -[value] DUMPING STATE of file tests/non-free/malloc-size-zero.i line 33 +tests/non-free/malloc-size-zero.i:10:[value:malloc] marking variable `__malloc_my_calloc_l10_3' as weak +[value] Recording results for my_calloc +[value] Done for function my_calloc +tests/non-free/malloc-size-zero.i:33:[value] Frama_C_dump_each: + # Cvalue domain: foo ∈ [--..--] - p1 ∈ {{ &__malloc_calloc_l10[0] }} + p1 ∈ {{ &__malloc_my_calloc_l10[0] }} q1 ∈ - {{ &__malloc_calloc_l10_0[0] ; &__malloc_calloc_l10_1[0] ; - &__malloc_calloc_l10_2[0] ; &__malloc_w_calloc_l10_3[0] }} or UNINITIALIZED - __malloc_calloc_l10∈ ∅ - __malloc_calloc_l10_0∈ ∅ - __malloc_calloc_l10_1∈ ∅ - __malloc_calloc_l10_2∈ ∅ - __malloc_w_calloc_l10_3∈ ∅ - =END OF DUMP== + {{ &__malloc_my_calloc_l10_0[0] ; &__malloc_my_calloc_l10_1[0] ; + &__malloc_my_calloc_l10_2[0] ; &__malloc_w_my_calloc_l10_3[0] }} or UNINITIALIZED + __malloc_my_calloc_l10∈ ∅ + __malloc_my_calloc_l10_0∈ ∅ + __malloc_my_calloc_l10_1∈ ∅ + __malloc_my_calloc_l10_2∈ ∅ + __malloc_w_my_calloc_l10_3∈ ∅ + ==END OF DUMP== tests/non-free/malloc-size-zero.i:35:[value] warning: out of bounds write. assert \valid(p1); tests/non-free/malloc-size-zero.i:35:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -[value] Called Frama_C_show_each({{ &__malloc_calloc_l10_0 ; &__malloc_calloc_l10_1 ; - &__malloc_calloc_l10_2 ; - &__malloc_w_calloc_l10_3 }}) +tests/non-free/malloc-size-zero.i:37:[value:malloc] strong free on bases: {__malloc_my_calloc_l10} +tests/non-free/malloc-size-zero.i:39:[value] Frama_C_show_each: + {{ &__malloc_my_calloc_l10_0 ; &__malloc_my_calloc_l10_1 ; + &__malloc_my_calloc_l10_2 ; &__malloc_w_my_calloc_l10_3 }} tests/non-free/malloc-size-zero.i:40:[value] assertion got status valid. tests/non-free/malloc-size-zero.i:42:[value] warning: accessing uninitialized left-value. assert \initialized(&q1); tests/non-free/malloc-size-zero.i:42:[value] warning: out of bounds write. assert \valid(q1); tests/non-free/malloc-size-zero.i:42:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. tests/non-free/malloc-size-zero.i:44:[value] warning: accessing uninitialized left-value. assert \initialized(&q1); +tests/non-free/malloc-size-zero.i:44:[value:malloc] weak free on bases: {__malloc_my_calloc_l10_0, __malloc_my_calloc_l10_1, + __malloc_my_calloc_l10_2, __malloc_w_my_calloc_l10_3} [value] Recording results for main [value] done for function main tests/non-free/malloc-size-zero.i:35:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/malloc-size-zero.i:42:[value] assertion 'Value,mem_access' got final status invalid. [value] ====== VALUES COMPUTED ====== -tests/non-free/malloc-size-zero.i:10:[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype -[value:final-states] Values at end of function calloc: +[value:final-states] Values at end of function my_calloc: -tests/non-free/malloc-size-zero.i:37:[kernel] warning: Neither code nor specification for function free, generating default assigns from the prototype [value:final-states] Values at end of function main: p1 ∈ ESCAPINGADDR q1 ∈ - {{ &__malloc_calloc_l10_0[0] ; &__malloc_calloc_l10_1[0] ; - &__malloc_calloc_l10_2[0] ; &__malloc_w_calloc_l10_3[0] }} or ESCAPINGADDR + {{ &__malloc_my_calloc_l10_0[0] ; &__malloc_my_calloc_l10_1[0] ; + &__malloc_my_calloc_l10_2[0] ; &__malloc_w_my_calloc_l10_3[0] }} or ESCAPINGADDR diff --git a/tests/non-free/oracle/malloc-size-zero.1.res.oracle b/tests/non-free/oracle/malloc-size-zero.1.res.oracle index 54fec80ffbf3de35730ce930627a1c50d094720f..ba6ef4c8efa06bffa9d21f707cde21a355d34ec4 100644 --- a/tests/non-free/oracle/malloc-size-zero.1.res.oracle +++ b/tests/non-free/oracle/malloc-size-zero.1.res.oracle @@ -1,55 +1,53 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc-size-zero.i (no preprocessing) -[value] user error: no assigns specified for function 'malloc', for which a builtin - or the specification will be used. Potential unsoundness. -[value] user error: no assigns specified for function 'free', for which a builtin - or the specification will be used. Potential unsoundness. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization foo ∈ [--..--] -[value] computing for function calloc <- main. +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:16. tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_main_l16 -[value] Recording results for calloc -[value] Done for function calloc -[value] Called Frama_C_show_each_not_NULL_p1() +tests/non-free/malloc-size-zero.i:10:[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype +[value] Recording results for my_calloc +[value] Done for function my_calloc +tests/non-free/malloc-size-zero.i:20:[value] Frama_C_show_each_not_NULL_p1: tests/non-free/malloc-size-zero.i:24:[value] warning: pointer comparison. assert \pointer_comparable((void *)(p1 + 1), (void *)0); tests/non-free/malloc-size-zero.i:27:[value] entering loop for the first time -[value] computing for function calloc <- main. +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. tests/non-free/malloc-size-zero.i:10:[value] allocating variable __malloc_main_l29 -[value] Recording results for calloc -[value] Done for function calloc -[value] computing for function calloc <- main. +[value] Recording results for my_calloc +[value] Done for function my_calloc +[value] computing for function my_calloc <- main. Called from tests/non-free/malloc-size-zero.i:29. -[value] Recording results for calloc -[value] Done for function calloc -[value] DUMPING STATE of file tests/non-free/malloc-size-zero.i line 33 +tests/non-free/malloc-size-zero.i:10:[value:malloc] marking variable `__malloc_main_l29' as weak +[value] Recording results for my_calloc +[value] Done for function my_calloc +tests/non-free/malloc-size-zero.i:33:[value] Frama_C_dump_each: + # Cvalue domain: foo ∈ [--..--] p1 ∈ {{ &__malloc_main_l16[0] }} q1 ∈ {{ &__malloc_w_main_l29[0] }} or UNINITIALIZED __malloc_main_l16∈ ∅ __malloc_w_main_l29∈ ∅ - =END OF DUMP== + ==END OF DUMP== tests/non-free/malloc-size-zero.i:35:[value] warning: out of bounds write. assert \valid(p1); tests/non-free/malloc-size-zero.i:35:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -[value] Called Frama_C_show_each({{ &__malloc_w_main_l29 }}) +tests/non-free/malloc-size-zero.i:37:[value:malloc] strong free on bases: {__malloc_main_l16} +tests/non-free/malloc-size-zero.i:39:[value] Frama_C_show_each: {{ &__malloc_w_main_l29 }} tests/non-free/malloc-size-zero.i:40:[value] assertion got status valid. tests/non-free/malloc-size-zero.i:42:[value] warning: accessing uninitialized left-value. assert \initialized(&q1); tests/non-free/malloc-size-zero.i:42:[value] warning: out of bounds write. assert \valid(q1); tests/non-free/malloc-size-zero.i:42:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. tests/non-free/malloc-size-zero.i:44:[value] warning: accessing uninitialized left-value. assert \initialized(&q1); +tests/non-free/malloc-size-zero.i:44:[value:malloc] weak free on bases: {__malloc_w_main_l29} [value] Recording results for main [value] done for function main tests/non-free/malloc-size-zero.i:35:[value] assertion 'Value,mem_access' got final status invalid. tests/non-free/malloc-size-zero.i:42:[value] assertion 'Value,mem_access' got final status invalid. [value] ====== VALUES COMPUTED ====== -tests/non-free/malloc-size-zero.i:10:[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype -[value:final-states] Values at end of function calloc: +[value:final-states] Values at end of function my_calloc: -tests/non-free/malloc-size-zero.i:37:[kernel] warning: Neither code nor specification for function free, generating default assigns from the prototype [value:final-states] Values at end of function main: p1 ∈ ESCAPINGADDR q1 ∈ {{ &__malloc_w_main_l29[0] }} or ESCAPINGADDR diff --git a/tests/non-free/oracle/malloc.res.oracle b/tests/non-free/oracle/malloc.res.oracle index a0fbcddb386d7598930659187c18f8328202aef7..17ce1642e75eb759b05a7478a2959b65c9937a35 100644 --- a/tests/non-free/oracle/malloc.res.oracle +++ b/tests/non-free/oracle/malloc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,20 +5,21 @@ [value:initial-state] Values of globals at initialization tests/non-free/malloc.c:13:[value] allocating variable __malloc_main_l13 +tests/non-free/malloc.c:13:[kernel] warning: Neither code nor specification for function Frama_C_malloc_by_stack, generating default assigns from the prototype tests/non-free/malloc.c:19:[value] allocating variable __malloc_main_l19 +tests/non-free/malloc.c:19:[value:malloc] resizing variable `__malloc_main_l19' (0..-1/34359738359) to fit 0..-1 tests/non-free/malloc.c:20:[value] allocating variable __malloc_main_l20 tests/non-free/malloc.c:21:[value] allocating variable __malloc_main_l21 +tests/non-free/malloc.c:21:[kernel] warning: Neither code nor specification for function Frama_C_malloc_fresh, generating default assigns from the prototype tests/non-free/malloc.c:21:[value] allocating variable __malloc_main_l21_0 tests/non-free/malloc.c:22:[value] warning: out of bounds write. assert \valid(p); tests/non-free/malloc.c:23:[value] warning: out of bounds write. assert \valid(p + 2); tests/non-free/malloc.c:24:[value] warning: out of bounds write. assert \valid(p + 24999); -[value] Called Frama_C_show_each({{ &__malloc_main_l20 + {8} }}) -[value] Called Frama_C_show_each({{ &__malloc_main_l20 + {8} }}) +tests/non-free/malloc.c:27:[value] Frama_C_show_each: {{ &__malloc_main_l20 + {8} }} +tests/non-free/malloc.c:27:[value] Frama_C_show_each: {{ &__malloc_main_l20 + {8} }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/malloc.c:13:[kernel] warning: Neither code nor specification for function Frama_C_alloc_by_stack, generating default assigns from the prototype -tests/non-free/malloc.c:21:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype [value:final-states] Values at end of function main: x ∈ {1; 2} s ∈ {{ NULL ; &__malloc_main_l13[0] }} diff --git a/tests/non-free/oracle/malloc_bug_tr.res.oracle b/tests/non-free/oracle/malloc_bug_tr.res.oracle index dfd01f646e4c5fd520a609c967ffb78b6c955461..a4657100d7ba58b7d139a8c5d7f1ec814e3b7f37 100644 --- a/tests/non-free/oracle/malloc_bug_tr.res.oracle +++ b/tests/non-free/oracle/malloc_bug_tr.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc_bug_tr.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] [value] computing for function Frama_C_interval <- main. Called from tests/non-free/malloc_bug_tr.c:12. @@ -25,6 +24,7 @@ tests/non-free/malloc_bug_tr.c:15:[value] Call to builtin memcpy(({{ (void *)&__ tests/non-free/malloc_bug_tr.c:15:[value] warning: out of bounds read. assert \valid_read((p + 5) + (0 .. (unsigned int)1 - 1)); tests/non-free/malloc_bug_tr.c:16:[value] warning: out of bounds write. assert \valid(p + 5); tests/non-free/malloc_bug_tr.c:17:[value] warning: out of bounds read. assert \valid_read(p + 5); +tests/non-free/malloc_bug_tr.c:18:[value:malloc] strong free on bases: {__malloc_main_l12} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/non-free/oracle/malloc_individual.res.oracle b/tests/non-free/oracle/malloc_individual.res.oracle index e8e89e1d1bd4c91bf9c6ea75328a707d06ebc7c1..eb82f538bd21248040081c66257627da9e6282b5 100644 --- a/tests/non-free/oracle/malloc_individual.res.oracle +++ b/tests/non-free/oracle/malloc_individual.res.oracle @@ -1,32 +1,30 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc_individual.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {0} A ∈ {0} B ∈ {0} C ∈ {0} [value] computing for function malloc <- main. - Called from tests/non-free/malloc_individual.c:9. + Called from tests/non-free/malloc_individual.c:12. share/libc/stdlib.c:74:[value] allocating variable __malloc_malloc_l74 -share/libc/stdlib.h:294:[value] warning: function malloc, behavior allocation: postcondition got status unknown. (Behavior may be inactive, no reduction performed.) -share/libc/stdlib.h:299:[value] warning: function malloc, behavior no_allocation: postcondition got status invalid. (Behavior may be inactive, no reduction performed.) +share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_malloc_fresh, generating default assigns from the prototype +share/libc/stdlib.h:320:[value] warning: function malloc, behavior allocation: postcondition got status unknown. [value] Recording results for malloc [value] Done for function malloc -tests/non-free/malloc_individual.c:12:[value] warning: accessing uninitialized left-value. assert \initialized(p); +tests/non-free/malloc_individual.c:15:[value] warning: accessing uninitialized left-value. assert \initialized(p); [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for function Frama_C_alloc_size, generating default assigns from the prototype [value:final-states] Values at end of function malloc: [value:final-states] Values at end of function main: @@ -36,14 +34,14 @@ share/libc/stdlib.c:74:[kernel] warning: Neither code nor specification for func C ∈ {4} __malloc_malloc_l74[bits 0 to 31] ∈ {3} [from] Computing for function malloc -[from] Computing for function Frama_C_alloc_size <-malloc -[from] Done for function Frama_C_alloc_size +[from] Computing for function Frama_C_malloc_fresh <-malloc +[from] Done for function Frama_C_malloc_fresh [from] Done for function malloc [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_size: +[from] Function Frama_C_malloc_fresh: \result FROM size [from] Function malloc: \result FROM size diff --git a/tests/non-free/oracle/malloc_memexec.res.oracle b/tests/non-free/oracle/malloc_memexec.res.oracle index 9fa1afde2bb08443ecb4663efc1e3eac7d907e2e..2f6c74cd499e5a5b1ef7aeb40ca0b9fbdcc30d68 100644 --- a/tests/non-free/oracle/malloc_memexec.res.oracle +++ b/tests/non-free/oracle/malloc_memexec.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc_memexec.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -45,16 +44,16 @@ tests/non-free/malloc_memexec.c:27:[value] allocating weak variable __malloc_w_m [from] Computing for function f [from] Done for function f [from] Computing for function main -[from] Computing for function Frama_C_alloc_size <-main -[from] Done for function Frama_C_alloc_size -[from] Computing for function Frama_C_alloc_size_weak <-main -[from] Done for function Frama_C_alloc_size_weak +[from] Computing for function Frama_C_malloc_fresh <-main +[from] Done for function Frama_C_malloc_fresh +[from] Computing for function Frama_C_malloc_fresh_weak <-main +[from] Done for function Frama_C_malloc_fresh_weak [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_size: +[from] Function Frama_C_malloc_fresh: \result FROM ANYTHING(origin:Unknown) -[from] Function Frama_C_alloc_size_weak: +[from] Function Frama_C_malloc_fresh_weak: \result FROM ANYTHING(origin:Unknown) [from] Function f: __malloc_main_l19 FROM p; i (and SELF) diff --git a/tests/non-free/oracle/malloc_multiple.res.oracle b/tests/non-free/oracle/malloc_multiple.res.oracle index 24b477392c0fd775da5c71593fc918ce39ea8ff5..7746560f72af73528886c45a293122a1bcd4c5d7 100644 --- a/tests/non-free/oracle/malloc_multiple.res.oracle +++ b/tests/non-free/oracle/malloc_multiple.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/malloc_multiple.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] T[0..9] ∈ {0} F[0..9] ∈ {0} [value] computing for function allocate_T <- main. @@ -21,6 +20,7 @@ tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocat tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocate_T_l14_2 tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocate_T_l14_3 tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocate_T_l14_4 +tests/non-free/malloc_multiple.c:14:[value:malloc] marking variable `__malloc_allocate_T_l14_4' as weak [value] Recording results for allocate_T [value] Done for function allocate_T [value] computing for function allocate_T <- main. @@ -32,26 +32,29 @@ tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocat tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocate_T_l14_8 tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocate_T_l14_9 tests/non-free/malloc_multiple.c:14:[value] allocating variable __malloc_allocate_T_l14_10 +tests/non-free/malloc_multiple.c:14:[value:malloc] marking variable `__malloc_allocate_T_l14_10' as weak [value] Recording results for allocate_T [value] Done for function allocate_T [value] computing for function allocate_and_free_last <- main. Called from tests/non-free/malloc_multiple.c:44. tests/non-free/malloc_multiple.c:29:[value] allocating variable __malloc_allocate_and_free_last_l29 -[value] Called Frama_C_show_each_F({{ &__malloc_allocate_and_free_last_l29 }}) +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_allocate_and_free_last_l29 }} tests/non-free/malloc_multiple.c:29:[value] allocating variable __malloc_allocate_and_free_last_l29_0 -[value] Called Frama_C_show_each_F({{ &__malloc_allocate_and_free_last_l29_0 }}) +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_allocate_and_free_last_l29_0 }} tests/non-free/malloc_multiple.c:29:[value] allocating variable __malloc_allocate_and_free_last_l29_1 -[value] Called Frama_C_show_each_F({{ &__malloc_allocate_and_free_last_l29_1 }}) +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_allocate_and_free_last_l29_1 }} tests/non-free/malloc_multiple.c:29:[value] allocating variable __malloc_allocate_and_free_last_l29_2 -[value] Called Frama_C_show_each_F({{ &__malloc_allocate_and_free_last_l29_2 }}) +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_allocate_and_free_last_l29_2 }} tests/non-free/malloc_multiple.c:29:[value] allocating variable __malloc_allocate_and_free_last_l29_3 -[value] Called Frama_C_show_each_F({{ &__malloc_allocate_and_free_last_l29_3 }}) +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_allocate_and_free_last_l29_3 }} tests/non-free/malloc_multiple.c:29:[value] allocating variable __malloc_allocate_and_free_last_l29_4 -[value] Called Frama_C_show_each_F({{ &__malloc_allocate_and_free_last_l29_4 }}) -[value] Called Frama_C_show_each_F({{ &__malloc_w_allocate_and_free_last_l29_4 }}) -[value] Called Frama_C_show_each_F({{ &__malloc_w_allocate_and_free_last_l29_4 }}) -[value] Called Frama_C_show_each_F({{ &__malloc_w_allocate_and_free_last_l29_4 }}) -[value] Called Frama_C_show_each_F({{ &__malloc_w_allocate_and_free_last_l29_4 }}) +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_allocate_and_free_last_l29_4 }} +tests/non-free/malloc_multiple.c:29:[value:malloc] marking variable `__malloc_allocate_and_free_last_l29_4' as weak +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_w_allocate_and_free_last_l29_4 }} +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_w_allocate_and_free_last_l29_4 }} +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_w_allocate_and_free_last_l29_4 }} +tests/non-free/malloc_multiple.c:31:[value] Frama_C_show_each_F: {{ &__malloc_w_allocate_and_free_last_l29_4 }} +tests/non-free/malloc_multiple.c:34:[value:malloc] weak free on bases: {__malloc_w_allocate_and_free_last_l29_4} tests/non-free/malloc_multiple.c:35:[value] assertion got status valid. tests/non-free/malloc_multiple.c:36:[value] warning: assertion got status unknown. tests/non-free/malloc_multiple.c:37:[value] warning: assertion got status unknown. diff --git a/tests/non-free/oracle/memchr.res.oracle b/tests/non-free/oracle/memchr.res.oracle index 280c8e0afb580221db4e8936f460e96b11e38afc..09c227e5b353cec860f35c51e8f2225211114b65 100644 --- a/tests/non-free/oracle/memchr.res.oracle +++ b/tests/non-free/oracle/memchr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memchr.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -25,35 +24,35 @@ [value] computing for function my_memchr <- memchr_small_sets <- main. Called from tests/non-free/memchr.c:81. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr({3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:82:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_small_sets <- main. Called from tests/non-free/memchr.c:85. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "\000bc" + {0; 1} }},{0},{3})) -[value] Called Frama_C_show_each_mymemchr({0; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {0; 3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:86:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_small_sets <- main. Called from tests/non-free/memchr.c:88. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" }},{0},{0})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:89:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_small_sets <- main. Called from tests/non-free/memchr.c:92. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "b\000c" + {0; 2} }},{0},{2})) -[value] Called Frama_C_show_each_mymemchr({1; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1; 3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:93:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_small_sets <- main. Called from tests/non-free/memchr.c:97. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:98:[value] assertion got status valid. @@ -65,14 +64,14 @@ tests/non-free/memchr.c:98:[value] assertion got status valid. Called from tests/non-free/memchr.c:106. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&empty_or_non_terminated }}, {0},{1})) -[value] Called Frama_C_show_each_mymemchr({-1; 0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:107:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_zero_termination <- main. Called from tests/non-free/memchr.c:111. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&non_terminated }},{0},{1})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:112:[value] assertion got status valid. @@ -96,7 +95,7 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void cons Called from tests/non-free/memchr.c:127. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&empty_or_uninitialized }}, {0},{1})) -[value] Called Frama_C_show_each_mymemchr({0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {0} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:128:[value] assertion got status valid. @@ -108,14 +107,14 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void cons [value] computing for function my_memchr <- memchr_initialization <- main. Called from tests/non-free/memchr.c:136. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s }},{0},{2})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:137:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_initialization <- main. Called from tests/non-free/memchr.c:143. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr({3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:144:[value] assertion got status valid. @@ -136,7 +135,7 @@ share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got [value] computing for function my_memchr <- memchr_large <- main. Called from tests/non-free/memchr.c:196. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..30] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..75]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..75] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:197:[value] assertion got status valid. @@ -147,7 +146,7 @@ tests/non-free/memchr.c:198:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large <- main. Called from tests/non-free/memchr.c:201. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [5..17] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..20]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..20] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:202:[value] assertion got status valid. @@ -158,7 +157,7 @@ tests/non-free/memchr.c:203:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large <- main. Called from tests/non-free/memchr.c:206. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [60..74] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..75]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..75] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:207:[value] assertion got status valid. @@ -169,7 +168,7 @@ tests/non-free/memchr.c:208:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large <- main. Called from tests/non-free/memchr.c:211. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [63..80] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..79]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..79] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:212:[value] assertion got status valid. @@ -185,7 +184,7 @@ tests/non-free/memchr.c:184:[value] Call to builtin memset(({{ (void *)&a }},{0; [value] computing for function my_memchr <- memchr_large <- main. Called from tests/non-free/memchr.c:217. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [50..70] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..99]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..99] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:218:[value] assertion got status valid. @@ -210,7 +209,7 @@ tests/non-free/memchr.c:184:[value] Call to builtin memset(({{ (void *)&a[50] }} [value] computing for function my_memchr <- memchr_large_uninit <- main. Called from tests/non-free/memchr.c:232. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..30] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..29]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..29] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:233:[value] assertion got status valid. @@ -221,7 +220,7 @@ tests/non-free/memchr.c:234:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_uninit <- main. Called from tests/non-free/memchr.c:238. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [63..80] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..79]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..79] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:239:[value] assertion got status valid. @@ -232,7 +231,7 @@ tests/non-free/memchr.c:240:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_uninit <- main. Called from tests/non-free/memchr.c:243. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [45..55] }},{0},{100})) -[value] Called Frama_C_show_each_mymemchr([-1..75]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..75] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:244:[value] assertion got status valid. @@ -252,7 +251,7 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" ; "a" ; "aaaaaaaaaaaa" ; "aaaaaaaaaaaaa" }}, {0},{14})) tests/non-free/memchr.c:55:[value] warning: pointer subtraction. assert \base_addr(ss) ≡ \base_addr((char *)p); -[value] Called Frama_C_show_each_mymemchr([0..13]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [0..13] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:269:[value] assertion got status valid. @@ -270,7 +269,7 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void cons Called from tests/non-free/memchr.c:302. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "Hello World\n" ; "Bonjour Monde\n" }}, {0},{15})) -[value] Called Frama_C_show_each_mymemchr({12; 14}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {12; 14} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:303:[value] assertion got status valid. @@ -278,7 +277,7 @@ tests/non-free/memchr.c:303:[value] assertion got status valid. Called from tests/non-free/memchr.c:305. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ &x + {0; 3} }},{0},{12})) tests/non-free/memchr.c:64:[value] warning: builtin Frama_C_memchr: possibly reading indeterminate data -[value] Called Frama_C_show_each_mymemchr2({0}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {0} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:306:[value] assertion got status valid. @@ -290,28 +289,28 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void cons [value] computing for function my_memchr <- memchr_misc <- main. Called from tests/non-free/memchr.c:309. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc\000\000\000abc" }},{0},{9})) -[value] Called Frama_C_show_each_mymemchr({3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:310:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_misc <- main. Called from tests/non-free/memchr.c:311. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc\000\000\000abc" + {4} }},{0},{9})) -[value] Called Frama_C_show_each_mymemchr({4}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {4} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:312:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_misc <- main. Called from tests/non-free/memchr.c:313. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc\000\000\000abc" + {5} }},{0},{9})) -[value] Called Frama_C_show_each_mymemchr({5}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {5} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:314:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_misc <- main. Called from tests/non-free/memchr.c:315. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc\000\000\000abc" + {6} }},{0},{9})) -[value] Called Frama_C_show_each_mymemchr({9}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {9} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:316:[value] assertion got status valid. @@ -324,7 +323,7 @@ tests/non-free/memchr.c:316:[value] assertion got status valid. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} ; "ABCD" + {0; 1} }}, {0},{5})) tests/non-free/memchr.c:69:[value] warning: pointer subtraction. assert \base_addr(s) ≡ \base_addr((char *)base); -[value] Called Frama_C_show_each_mymemchr2({3; 4}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {3; 4} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:326:[value] assertion got status valid. @@ -332,7 +331,7 @@ tests/non-free/memchr.c:326:[value] assertion got status valid. Called from tests/non-free/memchr.c:329. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "efg" + {1; 2} ; "EFGH" + {1; 2} }}, {0},{5})) -[value] Called Frama_C_show_each_mymemchr2({3; 4}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {3; 4} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:330:[value] assertion got status valid. @@ -340,7 +339,7 @@ tests/non-free/memchr.c:333:[value] entering loop for the first time [value] computing for function my_memchr <- memchr_misc2 <- main. Called from tests/non-free/memchr.c:334. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pqr" ; "MNOP\000QRS" }},{0},{10})) -[value] Called Frama_C_show_each_mymemchr({3; 4}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3; 4} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:335:[value] assertion got status valid. @@ -348,14 +347,14 @@ tests/non-free/memchr.c:335:[value] assertion got status valid. Called from tests/non-free/memchr.c:334. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pqr" + {0; 1} ; "MNOP\000QRS" + {0; 1} }},{0},{10})) -[value] Called Frama_C_show_each_mymemchr({3; 4}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3; 4} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_misc2 <- main. Called from tests/non-free/memchr.c:334. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pqr" + {0; 1; 2} ; "MNOP\000QRS" + {0; 1; 2} }},{0},{10})) -[value] Called Frama_C_show_each_mymemchr({3; 4}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3; 4} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_misc2 <- main. @@ -363,7 +362,7 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pq tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pqr" + {0; 1; 2; 3; 4; 5; 6; 7} ; "MNOP\000QRS" + {0; 1; 2; 3; 4; 5; 6; 7} }}, {0},{10})) -[value] Called Frama_C_show_each_mymemchr({3; 4; 7; 8}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3; 4; 7; 8} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_misc2 <- main. @@ -371,13 +370,13 @@ tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pq tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "mno\000pqr" + {0; 1; 2; 3; 4; 5; 6; 7} ; "MNOP\000QRS" + {0; 1; 2; 3; 4; 5; 6; 7} }}, {0},{10})) -[value] Called Frama_C_show_each_mymemchr({3; 4; 7; 8}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {3; 4; 7; 8} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_misc2 <- main. Called from tests/non-free/memchr.c:341. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&maybe_init }},{0},{2})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:342:[value] assertion got status valid. @@ -394,7 +393,7 @@ tests/non-free/memchr.c:161:[value] warning: builtin Frama_C_memchr: reading ind [value] computing for function my_memchr <- memchr_bitfields2 <- main. Called from tests/non-free/memchr.c:178. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s }},{0},{3})) -[value] Called Frama_C_show_each_mymemchr({2}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {2} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:179:[value] assertion got status valid. @@ -406,14 +405,14 @@ tests/non-free/memchr.c:255:[value] warning: locals {x} escaping the scope of a [value] computing for function my_memchr <- memchr_escaping <- main. Called from tests/non-free/memchr.c:258. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr({0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {0} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:259:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_escaping <- main. Called from tests/non-free/memchr.c:261. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr({0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {0} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:262:[value] assertion got status valid. @@ -427,46 +426,46 @@ tests/non-free/memchr.c:356:[value] warning: out of bounds write. assert \valid( [value] computing for function my_memchr <- memchr_big_array <- main. Called from tests/non-free/memchr.c:364. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&u }},{0},{800})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_big_array <- main. Called from tests/non-free/memchr.c:365. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&r }},{0},{805})) tests/non-free/memchr.c:50:[kernel] more than 200(201) locations to update in array. Approximating. -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_big_array <- main. Called from tests/non-free/memchr.c:366. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{0},{4000001})) tests/non-free/memchr.c:50:[kernel] more than 200(1000000) locations to update in array. Approximating. -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr -[value] Called Frama_C_show_each({1}, {1}, {1}) +tests/non-free/memchr.c:367:[value] Frama_C_show_each: {1}, {1}, {1} tests/non-free/memchr.c:368:[value] assertion got status valid. tests/non-free/memchr.c:369:[value] assertion got status valid. tests/non-free/memchr.c:370:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_big_array <- main. Called from tests/non-free/memchr.c:372. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&u }},{0},{1600})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_big_array <- main. Called from tests/non-free/memchr.c:373. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&r }},{0},{1608})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_big_array <- main. Called from tests/non-free/memchr.c:374. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{0},{8000000})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr -[value] Called Frama_C_show_each({1}, {1}, {1}) +tests/non-free/memchr.c:375:[value] Frama_C_show_each: {1}, {1}, {1} tests/non-free/memchr.c:376:[value] assertion got status valid. tests/non-free/memchr.c:377:[value] assertion got status valid. tests/non-free/memchr.c:378:[value] assertion got status valid. @@ -477,35 +476,35 @@ tests/non-free/memchr.c:378:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_no_zero_but_ok <- main. Called from tests/non-free/memchr.c:389. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s }},{0},{5})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:390:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_no_zero_but_ok <- main. Called from tests/non-free/memchr.c:391. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s }},{0},{11})) -[value] Called Frama_C_show_each_mymemchr({10}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {10} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:392:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_no_zero_but_ok <- main. Called from tests/non-free/memchr.c:393. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s{[1], [8]} }},{0},{11})) -[value] Called Frama_C_show_each_mymemchr2({10}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {10} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:394:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_no_zero_but_ok <- main. Called from tests/non-free/memchr.c:395. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s{[7], [11]} }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr2({-1; 10; 14}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {-1; 10; 14} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:396:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_no_zero_but_ok <- main. Called from tests/non-free/memchr.c:397. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ (void const *)&s{[7], [18]} }},{0},{5})) -[value] Called Frama_C_show_each_mymemchr2({10; 18; 19}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {10; 18; 19} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:398:[value] assertion got status valid. @@ -516,42 +515,42 @@ tests/non-free/memchr.c:398:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_small_sets_n <- main. Called from tests/non-free/memchr.c:407. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "abcde" + {0; 1} }},{0},{2; 5})) -[value] Called Frama_C_show_each_mymemchr2({-1; 5}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {-1; 5} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:408:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_small_sets_n <- main. Called from tests/non-free/memchr.c:412. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "\000bcdef" + {0; 1} }},{0},{1; 6})) -[value] Called Frama_C_show_each_mymemchr2({-1; 0; 6}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {-1; 0; 6} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:413:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_small_sets_n <- main. Called from tests/non-free/memchr.c:416. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "bcd\000efg" + {0; 2} }},{0},{4})) -[value] Called Frama_C_show_each_mymemchr2({3}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {3} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:417:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_small_sets_n <- main. Called from tests/non-free/memchr.c:420. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "bcd\000efg" + {0; 2} }},{0},{3; 4})) -[value] Called Frama_C_show_each_mymemchr2({-1; 3}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {-1; 3} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:421:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_small_sets_n <- main. Called from tests/non-free/memchr.c:424. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "bcd\000efg" + {0; 2} }},{0},{2; 3})) -[value] Called Frama_C_show_each_mymemchr2({-1; 3}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {-1; 3} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:425:[value] assertion got status valid. [value] computing for function my_memchr2 <- memchr_small_sets_n <- main. Called from tests/non-free/memchr.c:428. tests/non-free/memchr.c:64:[value] Call to builtin Frama_C_memchr(({{ "bcd\000efg" + {2; 4} }},{0},{2; 7})) -[value] Called Frama_C_show_each_mymemchr2({-1; 3; 7}) +tests/non-free/memchr.c:71:[value] Frama_C_show_each_mymemchr2: {-1; 3; 7} [value] Recording results for my_memchr2 [value] Done for function my_memchr2 tests/non-free/memchr.c:429:[value] assertion got status valid. @@ -573,7 +572,7 @@ tests/non-free/memchr.c:184:[value] Call to builtin memset(({{ (void *)&a }},{1; [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:443. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..30] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..40]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..40] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:444:[value] assertion got status valid. @@ -581,7 +580,7 @@ tests/non-free/memchr.c:445:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:449. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..30] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..40]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..40] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:450:[value] assertion got status valid. @@ -589,7 +588,7 @@ tests/non-free/memchr.c:451:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:454. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..30] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..29]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..29] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:455:[value] assertion got status valid. @@ -600,7 +599,7 @@ tests/non-free/memchr.c:456:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:459. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [5..17] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..29]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..29] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:460:[value] assertion got status valid. @@ -611,7 +610,7 @@ tests/non-free/memchr.c:461:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:464. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [60..74] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..75]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..75] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:465:[value] assertion got status valid. @@ -622,7 +621,7 @@ tests/non-free/memchr.c:466:[value] warning: assertion 'refined' got status unkn [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:469. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [63..80] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..79]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..79] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:470:[value] assertion got status valid. @@ -638,7 +637,7 @@ tests/non-free/memchr.c:184:[value] Call to builtin memset(({{ (void *)&a }},{0; [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:475. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [50..70] }},{0},[10..20])) -[value] Called Frama_C_show_each_mymemchr([-1..89]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..89] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:476:[value] assertion got status valid. @@ -648,7 +647,7 @@ tests/non-free/memchr.c:476:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:479. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [50..70] }},{0},[0..100])) -[value] Called Frama_C_show_each_mymemchr([-1..99]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..99] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:480:[value] assertion got status valid. @@ -661,7 +660,7 @@ tests/non-free/memchr.c:480:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_large_n <- main. Called from tests/non-free/memchr.c:484. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [0..10] }},{0},[0..90])) -[value] Called Frama_C_show_each_mymemchr([-1..99]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..99] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:485:[value] assertion got status valid. @@ -672,21 +671,21 @@ tests/non-free/memchr.c:485:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_unbounded_n <- main. Called from tests/non-free/memchr.c:494. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" }},{0},[0..2147483647])) -[value] Called Frama_C_show_each_mymemchr({-1; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:495:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_unbounded_n <- main. Called from tests/non-free/memchr.c:497. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{0},[0..2147483647])) -[value] Called Frama_C_show_each_mymemchr({-1; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:498:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_unbounded_n <- main. Called from tests/non-free/memchr.c:500. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "bcd\000eg" }},{0},[0..2147483647])) -[value] Called Frama_C_show_each_mymemchr({-1; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 3} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:501:[value] assertion got status valid. @@ -728,7 +727,7 @@ tests/non-free/memchr.c:184:[value] Call to builtin memset(({{ (void *)&a[16] }} [value] computing for function my_memchr <- memchr_intervals <- main. Called from tests/non-free/memchr.c:516. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [0..9] }},{0},[0..10])) -[value] Called Frama_C_show_each_mymemchr([-1..9]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..9] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:517:[value] assertion got status valid. @@ -743,7 +742,7 @@ tests/non-free/memchr.c:518:[value] warning: assertion 'refined' got status unkn Called from tests/non-free/memchr.c:522. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&a{[3], [4], [5], [6], [7], [8], [9]} }},{0},[2..10])) -[value] Called Frama_C_show_each_mymemchr({-1; 7; 8; 9}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 7; 8; 9} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:523:[value] assertion got status valid. @@ -757,7 +756,7 @@ tests/non-free/memchr.c:523:[value] assertion got status valid. Called from tests/non-free/memchr.c:527. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&a{[3], [4], [5], [6], [7], [8], [9]} }},{0},[0..11])) -[value] Called Frama_C_show_each_mymemchr({-1; 7; 8; 9}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 7; 8; 9} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:528:[value] assertion got status valid. @@ -772,7 +771,7 @@ tests/non-free/memchr.c:528:[value] assertion got status valid. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&a{[3], [4], [5], [6], [7], [8], [9], [10]} }}, {0},[0..9])) -[value] Called Frama_C_show_each_mymemchr({-1; 7; 8; 9}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 7; 8; 9} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:533:[value] assertion got status valid. @@ -787,7 +786,7 @@ tests/non-free/memchr.c:533:[value] assertion got status valid. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&a{[3], [4], [5], [6], [7], [8], [9], [10]} }}, {0},[0..10])) -[value] Called Frama_C_show_each_mymemchr({-1; 7; 8; 9}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 7; 8; 9} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:538:[value] assertion got status valid. @@ -802,7 +801,7 @@ tests/non-free/memchr.c:538:[value] assertion got status valid. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&a{[3], [4], [5], [6], [7], [8], [9], [10]} }}, {0},[0..11])) -[value] Called Frama_C_show_each_mymemchr({-1; 7; 8; 9}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 7; 8; 9} [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:543:[value] assertion got status valid. @@ -815,7 +814,7 @@ tests/non-free/memchr.c:543:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_intervals <- main. Called from tests/non-free/memchr.c:547. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..11] }},{0},[0..10])) -[value] Called Frama_C_show_each_mymemchr([-1..19]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..19] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:548:[value] assertion got status valid. @@ -828,7 +827,7 @@ tests/non-free/memchr.c:548:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_intervals <- main. Called from tests/non-free/memchr.c:552. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..11] }},{0},[0..10])) -[value] Called Frama_C_show_each_mymemchr([-1..19]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..19] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:553:[value] assertion got status valid. @@ -841,7 +840,7 @@ tests/non-free/memchr.c:553:[value] assertion got status valid. [value] computing for function my_memchr <- memchr_intervals <- main. Called from tests/non-free/memchr.c:557. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ &a + [3..11] }},{0},[0..11])) -[value] Called Frama_C_show_each_mymemchr([-1..19]) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: [-1..19] [value] Recording results for my_memchr [value] Done for function my_memchr tests/non-free/memchr.c:558:[value] assertion got status valid. @@ -849,7 +848,7 @@ tests/non-free/memchr.c:558:[value] assertion got status valid. [value] Done for function memchr_intervals [value] computing for function memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:662. -[value] Called Frama_C_show_each_c({97}) +tests/non-free/memchr.c:589:[value] Frama_C_show_each_c: {97} [value] computing for function memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:590. @@ -857,46 +856,46 @@ tests/non-free/memchr.c:558:[value] assertion got status valid. memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:566. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{97},{4})) -[value] Called Frama_C_show_each_mymemchr({0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {0} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:569. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "\000bc" + {0; 1} }},{97},{3})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:571. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" }},{97},{0})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:574. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "b\000c" + {0; 2} }},{97},{2})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:578. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{97},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] Recording results for memchr_small_sets_no_assertions [value] Done for function memchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({0}, {-1}, {-1}, {-1}, {-1; 0; 1}) +tests/non-free/memchr.c:591:[value] Frama_C_show_each_res: {0}, {-1}, {-1}, {-1}, {-1; 0; 1} tests/non-free/memchr.c:592:[value] assertion got status valid. tests/non-free/memchr.c:593:[value] assertion got status valid. tests/non-free/memchr.c:594:[value] assertion got status valid. tests/non-free/memchr.c:595:[value] assertion got status valid. tests/non-free/memchr.c:596:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({98}) +tests/non-free/memchr.c:599:[value] Frama_C_show_each_c: {98} [value] computing for function memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:600. @@ -904,46 +903,46 @@ tests/non-free/memchr.c:596:[value] assertion got status valid. memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:566. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{98},{4})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:569. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "\000bc" + {0; 1} }},{98},{3})) -[value] Called Frama_C_show_each_mymemchr({1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:571. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" }},{98},{0})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:574. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "b\000c" + {0; 2} }},{98},{2})) -[value] Called Frama_C_show_each_mymemchr({-1; 0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:578. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{98},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] Recording results for memchr_small_sets_no_assertions [value] Done for function memchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({1}, {1}, {-1}, {-1; 0}, {-1; 0; 1}) +tests/non-free/memchr.c:601:[value] Frama_C_show_each_res: {1}, {1}, {-1}, {-1; 0}, {-1; 0; 1} tests/non-free/memchr.c:602:[value] assertion got status valid. tests/non-free/memchr.c:603:[value] assertion got status valid. tests/non-free/memchr.c:604:[value] assertion got status valid. tests/non-free/memchr.c:605:[value] assertion got status valid. tests/non-free/memchr.c:606:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({97; 98}) +tests/non-free/memchr.c:609:[value] Frama_C_show_each_c: {97; 98} [value] computing for function memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:610. @@ -951,47 +950,47 @@ tests/non-free/memchr.c:606:[value] assertion got status valid. memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:566. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{97; 98},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:569. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "\000bc" + {0; 1} }},{97; 98},{3})) -[value] Called Frama_C_show_each_mymemchr({-1; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:571. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" }},{97; 98},{0})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:574. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "b\000c" + {0; 2} }},{97; 98},{2})) -[value] Called Frama_C_show_each_mymemchr({-1; 0}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:578. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{97; 98},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] Recording results for memchr_small_sets_no_assertions [value] Done for function memchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 0; 1}, {-1; 1}, {-1}, {-1; 0}, {-1; 0; 1}) +tests/non-free/memchr.c:611:[value] Frama_C_show_each_res: {-1; 0; 1}, {-1; 1}, {-1}, {-1; 0}, {-1; 0; 1} tests/non-free/memchr.c:612:[value] assertion got status valid. tests/non-free/memchr.c:613:[value] warning: assertion 'refined' got status unknown. tests/non-free/memchr.c:614:[value] assertion got status valid. tests/non-free/memchr.c:615:[value] assertion got status valid. tests/non-free/memchr.c:616:[value] assertion got status valid. tests/non-free/memchr.c:617:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({98; 99}) +tests/non-free/memchr.c:620:[value] Frama_C_show_each_c: {98; 99} [value] computing for function memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:621. @@ -999,44 +998,40 @@ tests/non-free/memchr.c:617:[value] assertion got status valid. memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:566. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{98; 99},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 1; 2}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 1; 2} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:569. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "\000bc" + {0; 1} }},{98; 99},{3})) -[value] Called Frama_C_show_each_mymemchr({-1; 1; 2}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 1; 2} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:571. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" }},{98; 99},{0})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:574. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "b\000c" + {0; 2} }},{98; 99},{2})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 2}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 2} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:578. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{98; 99},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] Recording results for memchr_small_sets_no_assertions [value] Done for function memchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 1; 2}, - {-1; 1; 2}, - {-1}, - {-1; 0; 2}, - {-1; 0; 1}) +tests/non-free/memchr.c:622:[value] Frama_C_show_each_res: {-1; 1; 2}, {-1; 1; 2}, {-1}, {-1; 0; 2}, {-1; 0; 1} tests/non-free/memchr.c:623:[value] assertion got status valid. tests/non-free/memchr.c:624:[value] warning: assertion 'refined' got status unknown. tests/non-free/memchr.c:625:[value] assertion got status valid. @@ -1044,7 +1039,7 @@ tests/non-free/memchr.c:626:[value] warning: assertion 'refined' got status unkn tests/non-free/memchr.c:627:[value] assertion got status valid. tests/non-free/memchr.c:628:[value] assertion got status valid. tests/non-free/memchr.c:629:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({0; 98; 99}) +tests/non-free/memchr.c:632:[value] Frama_C_show_each_c: {0; 98; 99} [value] computing for function memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:633. @@ -1052,44 +1047,41 @@ tests/non-free/memchr.c:629:[value] assertion got status valid. memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:566. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "abc" + {0; 1} }},{0; 98; 99},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 1; 2; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 1; 2; 3} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:569. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "\000bc" + {0; 1} }},{0; 98; 99},{3})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1; 2; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1; 2; 3} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:571. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "" }},{0; 98; 99},{0})) -[value] Called Frama_C_show_each_mymemchr({-1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:574. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ "b\000c" + {0; 2} }},{0; 98; 99},{2})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1; 2; 3}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1; 2; 3} [value] Recording results for my_memchr [value] Done for function my_memchr [value] computing for function my_memchr <- memchr_small_sets_no_assertions <- memchr_small_sets_chars <- main. Called from tests/non-free/memchr.c:578. tests/non-free/memchr.c:50:[value] Call to builtin Frama_C_memchr(({{ (void const *)&t }},{0; 98; 99},{4})) -[value] Called Frama_C_show_each_mymemchr({-1; 0; 1}) +tests/non-free/memchr.c:57:[value] Frama_C_show_each_mymemchr: {-1; 0; 1} [value] Recording results for my_memchr [value] Done for function my_memchr [value] Recording results for memchr_small_sets_no_assertions [value] Done for function memchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 1; 2; 3}, - {-1; 0; 1; 2; 3}, - {-1}, - {-1; 0; 1; 2; 3}, - {-1; 0; 1}) +tests/non-free/memchr.c:634:[value] Frama_C_show_each_res: + {-1; 1; 2; 3}, {-1; 0; 1; 2; 3}, {-1}, {-1; 0; 1; 2; 3}, {-1; 0; 1} tests/non-free/memchr.c:635:[value] assertion got status valid. tests/non-free/memchr.c:636:[value] warning: assertion 'refined' got status unknown. tests/non-free/memchr.c:637:[value] assertion got status valid. @@ -1580,7 +1572,8 @@ tests/non-free/memchr.c:641:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function init_array_nondet: - from; to; val1; val2; val; tmp; a[0..99]; a[0..99]; a[0..99]; a[0..99] + from; to; val1; val2; val; tmp; a[0..99]; a{[0..39]; [50..94]}; a[0..99]; + a{[0..9]; [11..19]} [inout] Inputs for function init_array_nondet: nondet [inout] Out (internal) for function memchr_bitfields: @@ -1652,8 +1645,8 @@ tests/non-free/memchr.c:641:[value] assertion got status valid. "MNOP\000QRS"[bits 0 to 71]; "abc"; "bcd\000eg"[bits 0 to 55]; "abc"; "\000bc"; ""[bits 0 to 7]; "b\000c" [inout] Out (internal) for function memchr_intervals: - Frama_C_entropy_source; c; a[0..99]; offset; n; z1; z2; z3; z4; z5; - z6; z7; z8; z9 + Frama_C_entropy_source; c; a{[0..9]; [11..19]}; offset; n; z1; z2; + z3; z4; z5; z6; z7; z8; z9 [inout] Inputs for function memchr_intervals: Frama_C_entropy_source; nondet; ""[bits 0 to 7]; "a"[bits 0 to 15]; "aa"[bits 0 to 23]; "aaa"; "aaaa"[bits 0 to 39]; "aaaaa"[bits 0 to 47]; @@ -1690,7 +1683,7 @@ tests/non-free/memchr.c:641:[value] assertion got status valid. "mno\000pqr"[bits 0 to 63]; "MNOP\000QRS"[bits 0 to 71]; "abc"; "bcd\000eg"[bits 0 to 55]; "abc"; "\000bc"; ""[bits 0 to 7]; "b\000c" [inout] Out (internal) for function memchr_large_uninit: - Frama_C_entropy_source; c; a[0..99]; offset; z1; z2; z3 + Frama_C_entropy_source; c; a{[0..39]; [50..94]; [98]}; offset; z1; z2; z3 [inout] Inputs for function memchr_large_uninit: Frama_C_entropy_source; nondet; ""[bits 0 to 7]; "a"[bits 0 to 15]; "aa"[bits 0 to 23]; "aaa"; "aaaa"[bits 0 to 39]; "aaaaa"[bits 0 to 47]; diff --git a/tests/non-free/oracle/memcpy.res.oracle b/tests/non-free/oracle/memcpy.res.oracle index ba9084d6f0b22f48ee5b7bb3b855e8d3a73f6a5e..25d930f3d17e7a75376a6407dd9718ccb660db2b 100644 --- a/tests/non-free/oracle/memcpy.res.oracle +++ b/tests/non-free/oracle/memcpy.res.oracle @@ -1,9 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memcpy.c (with preprocessing) [value] Analyzing a complete application starting at main_all [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization + NULL[rbits 800000 to 800015] ∈ [--..--] Frama_C_entropy_source ∈ [--..--] i ∈ [--..--] src[0..19] ∈ {0} @@ -23,7 +23,7 @@ v5 ∈ {0} t[0..3] ∈ {0} [value] computing for function main <- main_all. - Called from tests/non-free/memcpy.c:216. + Called from tests/non-free/memcpy.c:226. [value] computing for function buggy <- main <- main_all. Called from tests/non-free/memcpy.c:61. tests/non-free/memcpy.c:28:[value] Call to builtin memcpy(({{ (void *)&c ; "abc" }},{{ "d" }},{1})) @@ -43,7 +43,6 @@ tests/non-free/memcpy.c:49:[kernel] more than 150(1000) locations to update in a tests/non-free/memcpy.c:49:[kernel] more than 150(1000) elements to enumerate. Approximating. tests/non-free/memcpy.c:53:[value] Call to builtin memcpy(({{ &ttyp + [0..7992],0%8 }},{{ (void const *)&ty }}, {8})) -tests/non-free/memcpy.c:53:[value:imprecision] In memcpy builtin: precise copy of indeterminate values UNINITIALIZED tests/non-free/memcpy.c:53:[kernel] too many locations to update in array. Approximating. [value] Recording results for many [from] Computing for function many @@ -63,11 +62,15 @@ tests/non-free/memcpy.c:70:[value] Call to builtin memcpy(({{ (void *)&dst2[1] } [10..30],0%2)) tests/non-free/memcpy.c:70:[value] warning: out of bounds read. assert \valid_read(&src[2] + (0 .. (unsigned int)((int)(2 * b)) - 1)); +tests/non-free/memcpy.c:70:[value] warning: out of bounds write. + assert \valid(&dst2[1] + (0 .. (unsigned int)((int)(2 * b)) - 1)); tests/non-free/memcpy.c:72:[value] warning: assertion got status unknown. tests/non-free/memcpy.c:73:[value] Call to builtin memcpy(({{ (void *)&dst3[5] }},{{ (void const *)&src[2] }}, [5..14])) tests/non-free/memcpy.c:75:[value] Call to builtin memcpy(({{ (void *)&dst4[5] }},{{ (void const *)&src[2] }}, [10..28],0%2)) +tests/non-free/memcpy.c:75:[value] warning: out of bounds read. + assert \valid_read(&src[2] + (0 .. (unsigned int)((int)(2 * b)) - 1)); tests/non-free/memcpy.c:75:[value] warning: out of bounds write. assert \valid(&dst4[5] + (0 .. (unsigned int)((int)(2 * b)) - 1)); tests/non-free/memcpy.c:83:[value] Call to builtin memcpy(({{ (void *)&v2 }},{{ (void const *)&v1 }},{36})) @@ -81,25 +84,27 @@ tests/non-free/memcpy.c:87:[value] warning: out of bounds read. tests/non-free/memcpy.c:89:[value] Call to builtin memcpy(({{ garbled mix of &{v4} (origin: Arithmetic {tests/non-free/memcpy.c:89}) }}, {{ (void const *)&v1 }},{16})) -tests/non-free/memcpy.c:89:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:89:[value] warning: out of bounds write. assert \valid((char *)(&v4 + (int)(&v4)) + (0 .. (unsigned int)(sizeof(v1) - 20) - 1)); +tests/non-free/memcpy.c:89:[kernel] writing somewhere in {NULL; v4} because of Arithmetic + {tests/non-free/memcpy.c:89}. tests/non-free/memcpy.c:91:[value] Call to builtin memcpy(({{ garbled mix of &{v5} (origin: Arithmetic {tests/non-free/memcpy.c:91}) }}, {{ (void const *)&v4 }},{16})) -tests/non-free/memcpy.c:91:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:91:[value] warning: out of bounds write. assert \valid((char *)(&v5 + (int)(&v5)) + (0 .. (unsigned int)(sizeof(v4) - 20) - 1)); +tests/non-free/memcpy.c:91:[kernel] writing somewhere in {NULL; v5} because of Arithmetic + {tests/non-free/memcpy.c:91}. tests/non-free/memcpy.c:95:[value] entering loop for the first time tests/non-free/memcpy.c:96:[value] Call to builtin memcpy(({{ (void *)&x }},{{ (void const *)&x }}, [0..4294967295])) -tests/non-free/memcpy.c:96:[value:imprecision] In memcpy builtin: too many sizes to enumerate, possible loss of precision tests/non-free/memcpy.c:96:[value] warning: out of bounds read. assert \valid_read((char *)(&x) + (0 .. i - 1)); tests/non-free/memcpy.c:96:[value] warning: out of bounds write. assert \valid((char *)(&x) + (0 .. i - 1)); +tests/non-free/memcpy.c:96:[value:imprecision] In memcpy builtin: too many sizes to enumerate, possible loss of precision tests/non-free/memcpy.c:96:[value] Call to builtin memcpy(({{ (void *)&x }},{{ (void const *)&x }}, [0..4294967295])) tests/non-free/memcpy.c:101:[value] Call to builtin memcpy(({{ (void *)&dst5{[0], [20]} }}, @@ -111,45 +116,45 @@ tests/non-free/memcpy.c:105:[value:imprecision] In memcpy builtin: too many size tests/non-free/memcpy.c:110:[value] entering loop for the first time tests/non-free/memcpy.c:114:[value] Call to builtin memcpy(({{ &ptop1 + [4..--],0%4 }},{{ (void const *)&src }}, {4})) -tests/non-free/memcpy.c:114:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:114:[value] warning: out of bounds write. assert \valid((char *)pptop + (0 .. (unsigned int)4 - 1)); +tests/non-free/memcpy.c:114:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:118:[value] entering loop for the first time tests/non-free/memcpy.c:122:[value] Call to builtin memcpy(({{ &ptop2 + [--..746],2%4 }}, {{ (void const *)&src[1] }},{4})) -tests/non-free/memcpy.c:122:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:122:[value] warning: out of bounds write. assert \valid((char *)pptop + (0 .. (unsigned int)4 - 1)); +tests/non-free/memcpy.c:122:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:126:[value] entering loop for the first time tests/non-free/memcpy.c:131:[value] Call to builtin memcpy(({{ &ptop3 + [--..--],2%4 }}, {{ (void const *)&src[2] }},{4})) -tests/non-free/memcpy.c:131:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:131:[value] warning: out of bounds write. assert \valid((char *)pptop + (0 .. (unsigned int)4 - 1)); +tests/non-free/memcpy.c:131:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:135:[value] entering loop for the first time tests/non-free/memcpy.c:140:[value] Call to builtin memcpy(({{ &ptop4 + [--..--],2%4 }}, {{ (void const *)&src[2] }},{5})) -tests/non-free/memcpy.c:140:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:140:[value] warning: out of bounds write. assert \valid((char *)pptop + (0 .. (unsigned int)5 - 1)); +tests/non-free/memcpy.c:140:[kernel] too many locations to update in array. Approximating. tests/non-free/memcpy.c:145:[value] Call to builtin memcpy(({{ (void *)&garbledsize[10] }}, {{ (void const *)&src }}, {{ (unsigned int)&garbledsize }})) -tests/non-free/memcpy.c:145:[value:imprecision] In memcpy builtin: too many sizes to enumerate, possible loss of precision tests/non-free/memcpy.c:145:[value] warning: out of bounds read. assert \valid_read((char *)src + (0 .. (unsigned int)((char *)garbledsize) - 1)); tests/non-free/memcpy.c:145:[value] warning: out of bounds write. assert \valid((char *)pgarbledsize + (0 .. (unsigned int)((char *)garbledsize) - 1)); +tests/non-free/memcpy.c:145:[value:imprecision] In memcpy builtin: too many sizes to enumerate, possible loss of precision tests/non-free/memcpy.c:150:[value] warning: assertion got status unknown. tests/non-free/memcpy.c:151:[value] Call to builtin memcpy(({{ (void *)&dstmaybesize1 }}, {{ (void const *)&src }},[0..22])) -tests/non-free/memcpy.c:151:[value:imprecision] In memcpy builtin: too many sizes to enumerate, possible loss of precision tests/non-free/memcpy.c:151:[value] warning: out of bounds read. assert \valid_read((char *)src + (0 .. (unsigned int)maybesize - 1)); tests/non-free/memcpy.c:151:[value] warning: out of bounds write. assert \valid((char *)dstmaybesize1 + (0 .. (unsigned int)maybesize - 1)); +tests/non-free/memcpy.c:151:[value:imprecision] In memcpy builtin: too many sizes to enumerate, possible loss of precision tests/non-free/memcpy.c:152:[value] warning: assertion got status unknown. tests/non-free/memcpy.c:153:[value] Call to builtin memcpy(({{ (void *)&dstmaybesize2 }}, {{ (void const *)&src }},{0; 1; 2; 3; 4; 5; 6})) @@ -158,7 +163,7 @@ tests/non-free/memcpy.c:153:[value] Call to builtin memcpy(({{ (void *)&dstmaybe [from] Done for function main [value] Done for function main [value] computing for function main_uninit <- main_all. - Called from tests/non-free/memcpy.c:217. + Called from tests/non-free/memcpy.c:227. tests/non-free/memcpy.c:172:[value] Call to builtin memcpy(({{ (void *)&b }},{{ (void const *)&a }},{10})) tests/non-free/memcpy.c:172:[value:imprecision] In memcpy builtin: precise copy of indeterminate values UNINITIALIZED tests/non-free/memcpy.c:173:[value] assertion got status valid. @@ -218,10 +223,12 @@ tests/non-free/memcpy.c:201:[value] warning: accessing uninitialized left-value. [from] Done for function main_uninit [value] Done for function main_uninit [value] computing for function main_local <- main_all. - Called from tests/non-free/memcpy.c:218. + Called from tests/non-free/memcpy.c:228. tests/non-free/memcpy.c:209:[value] Call to builtin memcpy(({{ (void *)&p }},{{ (void const *)&q }},{4})) tests/non-free/memcpy.c:210:[value] warning: locals {y} escaping the scope of a block of main_local through p -[value] DUMPING STATE of file tests/non-free/memcpy.c line 212 +tests/non-free/memcpy.c:212:[value] Frama_C_dump_each: + # Cvalue domain: + NULL[rbits 800000 to 800015] ∈ [--..--] Frama_C_entropy_source ∈ [--..--] i ∈ [--..--] src[0..19] ∈ {0} @@ -242,21 +249,32 @@ tests/non-free/memcpy.c:210:[value] warning: locals {y} escaping the scope of a t[0..3] ∈ {0} p ∈ ESCAPINGADDR q ∈ {0} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main_local [from] Computing for function main_local [from] Done for function main_local [value] Done for function main_local -tests/non-free/memcpy.c:219:[value] entering loop for the first time +[value] computing for function copy_0 <- main_all. + Called from tests/non-free/memcpy.c:229. +tests/non-free/memcpy.c:220:[value] Call to builtin memcpy(({0},{{ (void const *)&l }},{0})) +tests/non-free/memcpy.c:221:[value] Call to builtin memcpy(({{ (void *)&l }},{0},{0})) +[value] Recording results for copy_0 +[from] Computing for function copy_0 +[from] Done for function copy_0 +[value] Done for function copy_0 +tests/non-free/memcpy.c:230:[value] entering loop for the first time [value] Recording results for main_all [from] Computing for function main_all [from] Non-terminating function main_all (no dependencies) [from] Done for function main_all [value] done for function main_all +[scope:rm_asserts] removing 1 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function buggy: c ∈ {100} p ∈ {{ &c ; "abc" }} +[value:final-states] Values at end of function copy_0: + [value:final-states] Values at end of function init: src[0] ∈ {1} [1] ∈ {2} @@ -297,7 +315,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time tm[0..999] ∈ {0; 1684234849} um{[0..998]#; [999][bits 0 to 15]} ∈ {0; 25185} repeated %16 [999][bits 16 to 31] ∈ {0} - ttyp[0..999] ∈ [--..--] or UNINITIALIZED + ttyp[0].ts ∈ [--..--] + [0].[bits 16 to 31]# ∈ {0; 8589934593}%64, bits 16 to 31 + [0].ti ∈ [--..--] + [1..999]{.ts#; .ti#; .[bits 16 to 31]#} ∈ + {0; 8589934593} repeated %64 s[0] ∈ {97} [1] ∈ {98} [2] ∈ {99} @@ -305,7 +327,7 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time [4] ∈ {0} p ∈ [0..999] ty.ts ∈ {1} - .[bits 16 to 31] ∈ UNINITIALIZED + .[bits 16 to 31] ∈ {0} .ti ∈ {2} [value:final-states] Values at end of function main: src[0] ∈ {1} @@ -433,7 +455,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time tm[0..999] ∈ {0; 1684234849} um{[0..998]#; [999][bits 0 to 15]} ∈ {0; 25185} repeated %16 [999][bits 16 to 31] ∈ {0} - ttyp[0..999] ∈ [--..--] or UNINITIALIZED + ttyp[0].ts ∈ [--..--] + [0].[bits 16 to 31]# ∈ {0; 8589934593}%64, bits 16 to 31 + [0].ti ∈ [--..--] + [1..999]{.ts#; .ti#; .[bits 16 to 31]#} ∈ + {0; 8589934593} repeated %64 v1.x ∈ {5} .y ∈ {7} {.p; .padding[0..23]} ∈ {0} @@ -484,7 +510,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time NON TERMINATING FUNCTION [from] ====== DISPLAYING CALLWISE DEPENDENCIES ====== [from] call to Frama_C_memcpy at tests/non-free/memcpy.c:28 (by buggy): - c FROM "d"[bits 0 to 7] (and SELF) + c FROM "d"[bits 0 to 7] + \result FROM dest +[from] call to Frama_C_memcpy at tests/non-free/memcpy.c:220 (by copy_0): + \result FROM dest +[from] call to Frama_C_memcpy at tests/non-free/memcpy.c:221 (by copy_0): \result FROM dest [from] call to Frama_C_memcpy at tests/non-free/memcpy.c:209 (by main_local): p FROM q @@ -622,7 +652,7 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time [from] call to Frama_C_memcpy at tests/non-free/memcpy.c:153 (by main): dstmaybesize2[0..5] FROM src[0..5] (and SELF) \result FROM dest -[from] call to main at tests/non-free/memcpy.c:216 (by main_all): +[from] call to main at tests/non-free/memcpy.c:226 (by main_all): src[0..19] FROM \nothing (and SELF) dst1{[0]; [16..19]} FROM \nothing (and SELF) [1..5] FROM src[2..6] @@ -658,9 +688,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time t[1] FROM v2 [2] FROM t[0] [3] FROM v2 (and SELF) -[from] call to main_uninit at tests/non-free/memcpy.c:217 (by main_all): +[from] call to main_uninit at tests/non-free/memcpy.c:227 (by main_all): + NO EFFECTS +[from] call to main_local at tests/non-free/memcpy.c:228 (by main_all): NO EFFECTS -[from] call to main_local at tests/non-free/memcpy.c:218 (by main_all): +[from] call to copy_0 at tests/non-free/memcpy.c:229 (by main_all): NO EFFECTS [from] entry point: NON TERMINATING - NO EFFECTS @@ -671,11 +703,22 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time maybe; "d"[bits 0 to 7] [inout] InOut (internal) for function buggy: Operational inputs: - dest; maybe; "d"[bits 0 to 7] + maybe; "d"[bits 0 to 7] Operational inputs on termination: - dest; maybe; "d"[bits 0 to 7] + maybe; "d"[bits 0 to 7] Sure outputs: - p; tmp + c; p; tmp +[inout] Out (internal) for function copy_0: + \nothing +[inout] Inputs for function copy_0: + \nothing +[inout] InOut (internal) for function copy_0: + Operational inputs: + \nothing + Operational inputs on termination: + \nothing + Sure outputs: + \nothing [inout] Out (internal) for function init: src[0..19]; dst1[0..19]; dst2[0..19]; dst3[0..19]; dst4[0..19]; dst5[0..99]; j @@ -694,9 +737,9 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time \nothing [inout] InOut (internal) for function main_local: Operational inputs: - dest + \nothing Operational inputs on termination: - dest + \nothing Sure outputs: p; q [inout] Out (internal) for function main_uninit: @@ -705,9 +748,9 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time maybe [inout] InOut (internal) for function main_uninit: Operational inputs: - dest; maybe; l; u; a[0..24]; b[11] + maybe; a[0..24]; b[11] Operational inputs on termination: - dest; maybe; l; u; a[0..24]; b[11] + maybe; a[0..24]; b[11] Sure outputs: r [inout] Out (internal) for function many: @@ -717,9 +760,9 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time maybe [inout] InOut (internal) for function many: Operational inputs: - dest; maybe; ty.[bits 16 to 31] + maybe; ty.[bits 16 to 31] Operational inputs on termination: - dest; maybe; ty.[bits 16 to 31] + maybe; ty.[bits 16 to 31] Sure outputs: tm[0]; um[0]; ttyp[0]; s[0..4]; p; ty{.ts; .ti} [inout] Out (internal) for function main: @@ -729,13 +772,14 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time ptop2[2..749]; ptop3[2..797]; ptop4[2..798]; garbledsize[10..99]; pgarbledsize; dstmaybesize1[0..14]; dstmaybesize2[0..5]; maybesize [inout] Inputs for function main: - i; src[0..19]; maybe; v1; v2; v4; t[0..3]; "d"[bits 0 to 7] + NULL[100000..100001]; i; src[0..19]; maybe; v1; v2; + v4{.x; .y; .p; .padding[0..3]}; t[0..3]; "d"[bits 0 to 7] [inout] InOut (internal) for function main: Operational inputs: - dest; i; src[0..19]; maybe; v1{.p; .padding[0..23]}; v2; + i; src[0..19]; maybe; v1{.p; .padding[0..23]}; v2; v4{.x; {.p; .padding[0..3]}}; t{[0]; [3]}; a; b; "d"[bits 0 to 7] Operational inputs on termination: - dest; src[0..19]; maybe; v1{.p; .padding[0..23]}; v2; + src[0..19]; maybe; v1{.p; .padding[0..23]}; v2; v4{.x; {.p; .padding[0..3]}}; t{[0]; [3]}; a; b; "d"[bits 0 to 7] Sure outputs: dst1[1..5]; dst2[1..10]; dst3[5..9]; dst4[5..14]; tm[0]; um[0]; ttyp[0]; @@ -745,11 +789,12 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time dst5[0..99]; tm[0..999]; um{[0..998]; [999][bits 0 to 15]}; ttyp[0..999]; v1{.x; .y}; v2; v3; v4; v5; t[1..3] [inout] Inputs for function main_all: - i; src[0..19]; maybe; v1; v2; v4; t[0..3]; "d"[bits 0 to 7] + NULL[100000..100001]; i; src[0..19]; maybe; v1; v2; + v4{.x; .y; .p; .padding[0..3]}; t[0..3]; "d"[bits 0 to 7] [inout] InOut (internal) for function main_all: Operational inputs: - dest; i; src[0..19]; maybe; v1{.p; .padding[0..23]}; v2; - v4{.x; {.p; .padding[0..3]}}; t{[0]; [3]}; l; u; "d"[bits 0 to 7] + i; src[0..19]; maybe; v1{.p; .padding[0..23]}; v2; + v4{.x; {.p; .padding[0..3]}}; t{[0]; [3]}; "d"[bits 0 to 7] Operational inputs on termination: \nothing Sure outputs: @@ -981,17 +1026,32 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time [ Valid ] Default behavior by Frama-C kernel. +-------------------------------------------------------------------------------- +--- Properties of Function 'Frama_C_size_t_interval' +-------------------------------------------------------------------------------- + +[ Extern ] Post-condition (file share/libc/__fc_builtin.h, line 145) + Unverifiable but considered Valid. +[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 143) + Unverifiable but considered Valid. +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 143) + Unverifiable but considered Valid. +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 144) + Unverifiable but considered Valid. +[ Valid ] Default behavior + by Frama-C kernel. + -------------------------------------------------------------------------------- --- Properties of Function 'Frama_C_float_interval' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/__fc_builtin.h, line 147) +[ Extern ] Post-condition (file share/libc/__fc_builtin.h, line 153) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 145) +[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 151) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 145) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 151) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 146) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 152) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -1000,13 +1060,13 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time --- Properties of Function 'Frama_C_double_interval' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/__fc_builtin.h, line 155) +[ Extern ] Post-condition (file share/libc/__fc_builtin.h, line 161) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 153) +[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 159) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 153) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 159) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 154) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 160) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -1015,11 +1075,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time --- Properties of Function 'Frama_C_memcpy' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 160) +[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 166) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 160) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 166) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 161) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 167) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -1028,11 +1088,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time --- Properties of Function 'Frama_C_memset' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 165) +[ Extern ] Assigns (file share/libc/__fc_builtin.h, line 171) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 165) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 171) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 165) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 171) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -1052,7 +1112,7 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin.h, line 174) +[ Extern ] Froms (file share/libc/__fc_builtin.h, line 180) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -1087,6 +1147,11 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time tried with Value. [ - ] Assertion 'Value,logic_mem_access' (file tests/non-free/memcpy.c, line 70) tried with Value. +[ - ] Assertion 'Value,logic_mem_access' (file tests/non-free/memcpy.c, line 70) + tried with Value. +[ Partial ] Assertion 'Value,logic_mem_access' (file tests/non-free/memcpy.c, line 75) + By RedundantAlarms, with pending: + - Assertion 'Value,logic_mem_access' (file tests/non-free/memcpy.c, line 70) [ - ] Assertion 'Value,logic_mem_access' (file tests/non-free/memcpy.c, line 75) tried with Value. [ - ] Assertion 'Value,logic_mem_access' (file tests/non-free/memcpy.c, line 87) @@ -1182,8 +1247,9 @@ tests/non-free/memcpy.c:219:[value] entering loop for the first time -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- - 34 Completely validated - 83 Considered valid - 25 To be validated - 142 Total + 35 Completely validated + 1 Locally validated + 87 Considered valid + 26 To be validated + 149 Total -------------------------------------------------------------------------------- diff --git a/tests/non-free/oracle/memcpy2.res.oracle b/tests/non-free/oracle/memcpy2.res.oracle index 359c94eb1598214b1d446e821a96d8dcb00e0ea6..a452ff4647eb158ad2a23960f39f183f8a8bca97 100644 --- a/tests/non-free/oracle/memcpy2.res.oracle +++ b/tests/non-free/oracle/memcpy2.res.oracle @@ -1,18 +1,17 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memcpy2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization Frama_C_entropy_source ∈ [--..--] -[value] Call to builtin bzero(({{ (unsigned char *)&s }},{512})) [value] computing for function Frama_C_interval <- main. Called from tests/non-free/memcpy2.c:9. [value] using specification for function Frama_C_interval share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. [value] Done for function Frama_C_interval tests/non-free/memcpy2.c:10:[value] Call to builtin memcpy(({{ (void *)&t }},{{ (void const *)&s }},[0..511])) -[value] DUMPING STATE of file tests/non-free/memcpy2.c line 12 +tests/non-free/memcpy2.c:12:[value] Frama_C_dump_each: + # Cvalue domain: Frama_C_entropy_source ∈ [--..--] c ∈ [--..--] v ∈ {{ NULL ; &S_v[0] }} @@ -25,7 +24,7 @@ tests/non-free/memcpy2.c:10:[value] Call to builtin memcpy(({{ (void *)&t }},{{ [1] ∈ {{ NULL ; &S_1_S_v[0] }} S_0_S_v[0..1] ∈ [--..--] S_1_S_v[0..1] ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] computing for function Frama_C_interval <- main. Called from tests/non-free/memcpy2.c:14. [value] Done for function Frama_C_interval @@ -45,8 +44,6 @@ tests/non-free/memcpy2.c:18:[value] Call to builtin memcpy(({{ (void *)&t }},{{ l ∈ [1..512] __retres ∈ {0} [from] Computing for function main -[from] Computing for function Frama_C_bzero <-main -[from] Done for function Frama_C_bzero [from] Computing for function Frama_C_interval <-main [from] Done for function Frama_C_interval [from] Computing for function Frama_C_memcpy <-main @@ -56,8 +53,6 @@ tests/non-free/memcpy2.c:18:[value] Call to builtin memcpy(({{ (void *)&t }},{{ [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - s[0..511] FROM \nothing [from] Function Frama_C_interval: Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) \result FROM Frama_C_entropy_source; min; max diff --git a/tests/non-free/oracle/memcpy_invalid.res.oracle b/tests/non-free/oracle/memcpy_invalid.res.oracle index 260c5ad65c47bce086701089c1ff18c003ecb92a..b97d8b8fd924b3efd01ac94d49c9a95bf45ec6ab 100644 --- a/tests/non-free/oracle/memcpy_invalid.res.oracle +++ b/tests/non-free/oracle/memcpy_invalid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memcpy_invalid.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -19,6 +18,9 @@ tests/non-free/memcpy_invalid.i:17:[value] warning: out of bounds read. assert \valid_read((&src + i) + (0 .. (unsigned long)((unsigned long)sizeof(src) - i) - 1)); +tests/non-free/memcpy_invalid.i:17:[value] warning: out of bounds write. + assert + \valid(&dst + (0 .. (unsigned long)((unsigned long)sizeof(src) - i) - 1)); [value] Recording results for test [from] Computing for function test [from] Done for function test @@ -30,9 +32,6 @@ tests/non-free/memcpy_invalid.i:17:[value] warning: out of bounds read. [value] Done for function Frama_C_interval tests/non-free/memcpy_invalid.i:17:[value] Call to builtin memcpy(({{ (void *)&dst }},{{ &src + [0..16],0%2 }}, [1..4294967295],1%2)) -tests/non-free/memcpy_invalid.i:17:[value] warning: out of bounds write. - assert - \valid(&dst + (0 .. (unsigned long)((unsigned long)sizeof(src) - i) - 1)); [value] Recording results for test [from] Computing for function test [from] Done for function test diff --git a/tests/non-free/oracle/memexec-malloc.res.oracle b/tests/non-free/oracle/memexec-malloc.res.oracle index 214a013ecf4b09b0ab26e8d90025f659b1217a59..8f279cb46e41f3131d88e7e9cec2c92d3c8d9691 100644 --- a/tests/non-free/oracle/memexec-malloc.res.oracle +++ b/tests/non-free/oracle/memexec-malloc.res.oracle @@ -1,6 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memexec-malloc.c (with preprocessing) -tests/non-free/memexec-malloc.c:15:[kernel] warning: Calling undeclared function Frama_C_alloc_by_stack. Old style K&R code? +tests/non-free/memexec-malloc.c:15:[kernel] warning: Calling undeclared function Frama_C_malloc_by_stack. Old style K&R code? [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -19,9 +18,9 @@ tests/non-free/memexec-malloc.c:10:[value] entering loop for the first time Called from tests/non-free/memexec-malloc.c:25. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each([0..1999]) -[value] Called Frama_C_show_each([0..1999]) -[value] Called Frama_C_show_each([0..1999]) +tests/non-free/memexec-malloc.c:26:[value] Frama_C_show_each: [0..1999] +tests/non-free/memexec-malloc.c:27:[value] Frama_C_show_each: [0..1999] +tests/non-free/memexec-malloc.c:28:[value] Frama_C_show_each: [0..1999] [value] computing for function f <- main. Called from tests/non-free/memexec-malloc.c:29. [value] Recording results for f @@ -29,6 +28,7 @@ tests/non-free/memexec-malloc.c:10:[value] entering loop for the first time [value] computing for function alloc <- main. Called from tests/non-free/memexec-malloc.c:31. tests/non-free/memexec-malloc.c:15:[value] allocating variable __malloc_main_l31 +tests/non-free/memexec-malloc.c:15:[kernel] warning: Neither code nor specification for function Frama_C_malloc_by_stack, generating default assigns from the prototype [value] Recording results for alloc [value] Done for function alloc [value] computing for function alloc <- main. @@ -57,7 +57,6 @@ tests/non-free/memexec-malloc.c:15:[value] allocating variable __malloc_k_l19_0 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/memexec-malloc.c:15:[kernel] warning: Neither code nor specification for function Frama_C_alloc_by_stack, generating default assigns from the prototype [value:final-states] Values at end of function alloc: __retres ∈ {{ &__malloc_main_l31 ; &__malloc_main_l32 ; &__malloc_k_l19 ; @@ -74,8 +73,8 @@ tests/non-free/memexec-malloc.c:15:[kernel] warning: Neither code nor specificat p3 ∈ {{ &__malloc_k_l19 }} p4 ∈ {{ &__malloc_k_l19_0 }} [from] Computing for function alloc -[from] Computing for function Frama_C_alloc_by_stack <-alloc -[from] Done for function Frama_C_alloc_by_stack +[from] Computing for function Frama_C_malloc_by_stack <-alloc +[from] Done for function Frama_C_malloc_by_stack [from] Done for function alloc [from] Computing for function f [from] Done for function f @@ -85,7 +84,7 @@ tests/non-free/memexec-malloc.c:15:[kernel] warning: Neither code nor specificat [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_alloc_by_stack: +[from] Function Frama_C_malloc_by_stack: \result FROM x_0 [from] Function alloc: \result FROM \nothing diff --git a/tests/non-free/oracle/memset.res.oracle b/tests/non-free/oracle/memset.res.oracle index d10d04df3d2b0e875dee842fdf072331aacfdd22..8dbb15041d5f3054496df304ec167559977e2538 100644 --- a/tests/non-free/oracle/memset.res.oracle +++ b/tests/non-free/oracle/memset.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memset.i (no preprocessing) tests/non-free/memset.i:46:[kernel] warning: A.QUESTION: char * does not match int * (different integer types: 'char' and 'int') @@ -24,18 +23,18 @@ tests/non-free/memset.i:33:[value] Call to builtin memset(({{ (void *)&t1 }},{17 tests/non-free/memset.i:34:[value] Call to builtin memset(({{ garbled mix of &{t2} (origin: Arithmetic {tests/non-free/memset.i:34}) }}, {18},{400})) +tests/non-free/memset.i:34:[value] warning: out of bounds write. + assert + \valid((char *)(&t2[(int)((int *)t2)]) + (0 .. (unsigned long)sizeof(t2) - 1)); tests/non-free/memset.i:34:[value:imprecision] Call to builtin precise_memset(({{ garbled mix of &{t2} (origin: Arithmetic {tests/non-free/memset.i:34}) }},{18}, {400})) failed; destination is not exact -tests/non-free/memset.i:34:[value] warning: out of bounds write. - assert - \valid((char *)(&t2[(int)((int *)t2)]) + (0 .. (unsigned long)sizeof(t2) - 1)); tests/non-free/memset.i:35:[value] Call to builtin memset(({{ (void *)&t3[10] }},{17},{{ (unsigned long)&t1 }})) -tests/non-free/memset.i:35:[value:imprecision] Call to builtin precise_memset(({{ (void *)&t3[10] }},{17}, - {{ (unsigned long)&t1 }})) failed; size is imprecise tests/non-free/memset.i:35:[value] warning: out of bounds write. assert \valid((char *)(&t3[10]) + (0 .. (unsigned long)((int *)t1) - 1)); +tests/non-free/memset.i:35:[value:imprecision] Call to builtin precise_memset(({{ (void *)&t3[10] }},{17}, + {{ (unsigned long)&t1 }})) failed; size is imprecise tests/non-free/memset.i:38:[value] Call to builtin memset(({{ (void *)&t4[1] }},{1},{400})) tests/non-free/memset.i:38:[value] warning: out of bounds write. assert \valid((char *)(&t4[1]) + (0 .. (unsigned long)sizeof(t4) - 1)); @@ -45,12 +44,12 @@ tests/non-free/memset.i:44:[value] Call to builtin memset(({{ (void *)&t6[10] ; tests/non-free/memset.i:44:[value:imprecision] Call to builtin precise_memset(({{ (void *)&t6[10] ; (void *)&t7 }},{34}, {16})) failed; destination is not exact tests/non-free/memset.i:47:[value] Call to builtin memset(({{ NULL ; (void *)&t8 }},{34},{16})) -tests/non-free/memset.i:47:[value:imprecision] Call to builtin precise_memset(({{ NULL ; (void *)&t8 }},{34},{16})) failed; destination is not exact tests/non-free/memset.i:47:[value] warning: out of bounds write. assert \valid((char *)p + (0 .. (unsigned long)16 - 1)); +tests/non-free/memset.i:47:[value:imprecision] Call to builtin precise_memset(({{ NULL ; (void *)&t8 }},{34},{16})) failed; destination is not exact tests/non-free/memset.i:50:[value] entering loop for the first time tests/non-free/memset.i:54:[value] Call to builtin memset(({{ &t9 + [80..--],0%4 }},{2302},{4})) -tests/non-free/memset.i:54:[value:imprecision] Call to builtin precise_memset(({{ &t9 + [80..--],0%4 }},{2302},{4})) failed; destination is not exact tests/non-free/memset.i:54:[value] warning: out of bounds write. assert \valid((char *)p + (0 .. (unsigned long)4 - 1)); +tests/non-free/memset.i:54:[value:imprecision] Call to builtin precise_memset(({{ &t9 + [80..--],0%4 }},{2302},{4})) failed; destination is not exact tests/non-free/memset.i:58:[value] Call to builtin memset(({{ (void *)&t10[4] }},{136},{12; 36})) tests/non-free/memset.i:58:[value:imprecision] Call to builtin precise_memset(({{ (void *)&t10[4] }},{136},{12; 36})) failed; size is imprecise tests/non-free/memset.i:65:[value] Call to builtin memset(({{ (void *)&t11{[2], [3]} }},{153},{8; 16})) @@ -178,11 +177,11 @@ tests/non-free/memset.i:38:[value] assertion 'Value,logic_mem_access' got final t8[0..3]; t9[20..99]; t10[4..12]; t11[2..6]; t12[0..96]; ts[0..4]; dst; p; tmp_0; s; s1; k [inout] Inputs for function main: - t1[0..99]; t2[0..99]; t4[0..99]; ts[0..4]; vol + vol [inout] InOut (internal) for function main: Operational inputs: - dst; v; vol + vol Operational inputs on termination: - dst; v; vol + vol Sure outputs: t1[0..99]; t5[0..99]; t10[4..6]; t11[3]; dst; p; tmp_0; s; s1; k diff --git a/tests/non-free/oracle/memset_block.0.res.oracle b/tests/non-free/oracle/memset_block.0.res.oracle index a9078b7fac0e76a67b19f207a7d8080d7ee91a4f..69d9b36b1daf99e1ae483dba79ce6834f31c1036 100644 --- a/tests/non-free/oracle/memset_block.0.res.oracle +++ b/tests/non-free/oracle/memset_block.0.res.oracle @@ -1,13 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memset_block.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Call to builtin bzero(({{ (unsigned char *)&TS }},{1392})) -[value] Call to builtin bzero(({{ (unsigned char *)&T2 }},{600})) -[value] Call to builtin bzero(({{ (unsigned char *)&T }},{40})) [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -42,19 +38,38 @@ y ∈ {40} __retres ∈ {8} [from] Computing for function main -[from] Computing for function Frama_C_bzero <-main -[from] Done for function Frama_C_bzero [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - TS[0..28] FROM \nothing (and SELF) - T2[0..49] FROM \nothing (and SELF) - T[0..9] FROM \nothing (and SELF) [from] Function main: \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - S[0..4]; TS[0..28]; PC[0..5]; T2[0..49]; T[0..9]; U[0..1]; x; y; __retres + S[0..4]; TS[0..28]; PC[0..5]; + T2{[0]{.x2; .y2}; {[0].ptr; [1]{.x2; .y2}}; {[1].ptr; [2]{.x2; .y2}}; + {[2].ptr; [3]{.x2; .y2}}; {[3].ptr; [4]{.x2; .y2}}; + {[4].ptr; [5]{.x2; .y2}}; {[5].ptr; [6]{.x2; .y2}}; + {[6].ptr; [7]{.x2; .y2}}; {[7].ptr; [8]{.x2; .y2}}; + {[8].ptr; [9]{.x2; .y2}}; {[9].ptr; [10]{.x2; .y2}}; + {[10].ptr; [11]{.x2; .y2}}; {[11].ptr; [12]{.x2; .y2}}; + {[12].ptr; [13]{.x2; .y2}}; {[13].ptr; [14]{.x2; .y2}}; + {[14].ptr; [15]{.x2; .y2}}; {[15].ptr; [16]{.x2; .y2}}; + {[16].ptr; [17]{.x2; .y2}}; {[17].ptr; [18]{.x2; .y2}}; + {[18].ptr; [19]{.x2; .y2}}; {[19].ptr; [20]{.x2; .y2}}; + {[20].ptr; [21]{.x2; .y2}}; {[21].ptr; [22]{.x2; .y2}}; + {[22].ptr; [23]{.x2; .y2}}; {[23].ptr; [24]{.x2; .y2}}; + {[24].ptr; [25]{.x2; .y2}}; {[25].ptr; [26]{.x2; .y2}}; + {[26].ptr; [27]{.x2; .y2}}; {[27].ptr; [28]{.x2; .y2}}; + {[28].ptr; [29]{.x2; .y2}}; {[29].ptr; [30]{.x2; .y2}}; + {[30].ptr; [31]{.x2; .y2}}; {[31].ptr; [32]{.x2; .y2}}; + {[32].ptr; [33]{.x2; .y2}}; {[33].ptr; [34]{.x2; .y2}}; + {[34].ptr; [35]{.x2; .y2}}; {[35].ptr; [36]{.x2; .y2}}; + {[36].ptr; [37]{.x2; .y2}}; {[37].ptr; [38]{.x2; .y2}}; + {[38].ptr; [39]{.x2; .y2}}; {[39].ptr; [40]{.x2; .y2}}; + {[40].ptr; [41]{.x2; .y2}}; {[41].ptr; [42]{.x2; .y2}}; + {[42].ptr; [43]{.x2; .y2}}; {[43].ptr; [44]{.x2; .y2}}; + {[44].ptr; [45]{.x2; .y2}}; {[45].ptr; [46]{.x2; .y2}}; + {[46].ptr; [47]{.x2; .y2}}; {[47].ptr; [48]{.x2; .y2}}; + {[48].ptr; [49]{.x2; .y2}}; [49].ptr}; T[0..9]; U[0..1]; x; y; __retres [inout] Inputs for function main: \nothing diff --git a/tests/non-free/oracle/memset_block.1.res.oracle b/tests/non-free/oracle/memset_block.1.res.oracle index 5338c4a746f2e2ff89c5902822a4ac3c810056b7..dcd5fe4bd07d4772647a98a7442edc8a5af7a2dc 100644 --- a/tests/non-free/oracle/memset_block.1.res.oracle +++ b/tests/non-free/oracle/memset_block.1.res.oracle @@ -1,14 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memset_block.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -tests/non-free/memset_block.i:10:[value] Call to builtin copy_block(({{ (unsigned char *)&TS[0].name }},{4},{10})) -tests/non-free/memset_block.i:10:[value] Call to builtin copy_block(({{ (unsigned char *)&TS }},{48},{29})) -tests/non-free/memset_block.i:14:[value] Call to builtin copy_block(({{ (unsigned char *)&T2 }},{12},{50})) -tests/non-free/memset_block.i:16:[value] Call to builtin copy_block(({{ (unsigned char *)&T }},{4},{10})) [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -140,22 +135,38 @@ tests/non-free/memset_block.i:16:[value] Call to builtin copy_block(({{ (unsigne y ∈ {40} __retres ∈ {8} [from] Computing for function main -[from] Computing for function Frama_C_copy_block <-main -[from] Done for function Frama_C_copy_block [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_copy_block: - TS{[0]{.y; .name[0..9]}; [1..28]} - FROM TS{[0]; [1]{.x; .y}}; T2[0..3]; T[0..9] (and SELF) - T2{[0]{.y2; .ptr; .[bits 48 to 63]}; [1..49]} - FROM TS{[0]; [1]{.x; .y}}; T2[0..3]; T[0..9] (and SELF) - T[1..9] FROM TS{[0]; [1]{.x; .y}}; T2[0..3]; T[0..9] (and SELF) [from] Function main: \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - S[0..4]; TS[0..28]; PC[0..5]; T2{[0]{.x2; .y2}; {[0].ptr; [1..49]}}; - T[0..9]; U[0..1]; x; y; __retres + S[0..4]; TS[0..28]; PC[0..5]; + T2{[0]{.x2; .y2}; {[0].ptr; [1]{.x2; .y2}}; {[1].ptr; [2]{.x2; .y2}}; + {[2].ptr; [3]{.x2; .y2}}; {[3].ptr; [4]{.x2; .y2}}; + {[4].ptr; [5]{.x2; .y2}}; {[5].ptr; [6]{.x2; .y2}}; + {[6].ptr; [7]{.x2; .y2}}; {[7].ptr; [8]{.x2; .y2}}; + {[8].ptr; [9]{.x2; .y2}}; {[9].ptr; [10]{.x2; .y2}}; + {[10].ptr; [11]{.x2; .y2}}; {[11].ptr; [12]{.x2; .y2}}; + {[12].ptr; [13]{.x2; .y2}}; {[13].ptr; [14]{.x2; .y2}}; + {[14].ptr; [15]{.x2; .y2}}; {[15].ptr; [16]{.x2; .y2}}; + {[16].ptr; [17]{.x2; .y2}}; {[17].ptr; [18]{.x2; .y2}}; + {[18].ptr; [19]{.x2; .y2}}; {[19].ptr; [20]{.x2; .y2}}; + {[20].ptr; [21]{.x2; .y2}}; {[21].ptr; [22]{.x2; .y2}}; + {[22].ptr; [23]{.x2; .y2}}; {[23].ptr; [24]{.x2; .y2}}; + {[24].ptr; [25]{.x2; .y2}}; {[25].ptr; [26]{.x2; .y2}}; + {[26].ptr; [27]{.x2; .y2}}; {[27].ptr; [28]{.x2; .y2}}; + {[28].ptr; [29]{.x2; .y2}}; {[29].ptr; [30]{.x2; .y2}}; + {[30].ptr; [31]{.x2; .y2}}; {[31].ptr; [32]{.x2; .y2}}; + {[32].ptr; [33]{.x2; .y2}}; {[33].ptr; [34]{.x2; .y2}}; + {[34].ptr; [35]{.x2; .y2}}; {[35].ptr; [36]{.x2; .y2}}; + {[36].ptr; [37]{.x2; .y2}}; {[37].ptr; [38]{.x2; .y2}}; + {[38].ptr; [39]{.x2; .y2}}; {[39].ptr; [40]{.x2; .y2}}; + {[40].ptr; [41]{.x2; .y2}}; {[41].ptr; [42]{.x2; .y2}}; + {[42].ptr; [43]{.x2; .y2}}; {[43].ptr; [44]{.x2; .y2}}; + {[44].ptr; [45]{.x2; .y2}}; {[45].ptr; [46]{.x2; .y2}}; + {[46].ptr; [47]{.x2; .y2}}; {[47].ptr; [48]{.x2; .y2}}; + {[48].ptr; [49]{.x2; .y2}}; [49].ptr}; T[0..9]; U[0..1]; x; y; __retres [inout] Inputs for function main: \nothing diff --git a/tests/non-free/oracle/memset_malloc_0.res.oracle b/tests/non-free/oracle/memset_malloc_0.res.oracle index c33946fadf9067b8aafb6636d46fc731dfca0b86..13d11dfa15eae40bf27999e1b05e2b011b251b6e 100644 --- a/tests/non-free/oracle/memset_malloc_0.res.oracle +++ b/tests/non-free/oracle/memset_malloc_0.res.oracle @@ -1,18 +1,15 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/memset_malloc_0.i (no preprocessing) -[value] user error: no assigns specified for function 'malloc', for which a builtin - or the specification will be used. Potential unsoundness. [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization p ∈ {0} tests/non-free/memset_malloc_0.i:17:[value] allocating variable __malloc_main_l17 +tests/non-free/memset_malloc_0.i:17:[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype tests/non-free/memset_malloc_0.i:18:[value] Call to builtin memset(({{ (void *)&__malloc_main_l17 }},{0},{0})) [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/memset_malloc_0.i:17:[kernel] warning: Neither code nor specification for function malloc, generating default assigns from the prototype [value:final-states] Values at end of function main: p ∈ {{ &__malloc_main_l17[0] }} __retres ∈ {0} diff --git a/tests/non-free/oracle/precise_memset.res.oracle b/tests/non-free/oracle/precise_memset.res.oracle index fa5e976694bca00a38a0f597814441de37c8ad0d..6af000c46337d8d47ba1023ea8ea3a60db246d31 100644 --- a/tests/non-free/oracle/precise_memset.res.oracle +++ b/tests/non-free/oracle/precise_memset.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/precise_memset.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -229,5 +228,4 @@ tests/non-free/precise_memset.c:92:[value] Call to builtin memset(({{ (void *)&t x; t[0..49]; u[0..11]; f; fnan; d; dnan; w1[0..3]; w2[0..3]; bitf; tone[0]; vs{.c2; .t[0..9]}; vv.c3.s; t_b[0..1023]; t_s[0..1023]; n [inout] Inputs for function main: - v; x; t[0..49]; u[0..11]; w1[0..3]; w2[0..3]; bitf; tone[0]; vs.t[0..9]; - t_b[0..1023]; t_s[0..1023] + v diff --git a/tests/non-free/oracle/realloc.res.oracle b/tests/non-free/oracle/realloc.res.oracle index 1d3e49013d69d380da8761d2364321ded5dc01d8..5b08b84c8179a91694686ea904a2ad46b0277367 100644 --- a/tests/non-free/oracle/realloc.res.oracle +++ b/tests/non-free/oracle/realloc.res.oracle @@ -1,44 +1,44 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/realloc.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] v ∈ [--..--] [value] computing for function main1 <- main. Called from tests/non-free/realloc.c:160. tests/non-free/realloc.c:12:[value] allocating variable __malloc_main1_l12 -[value] DUMPING STATE of file tests/non-free/realloc.c line 15 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:15:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {{ &__malloc_main1_l12 }} pp ∈ {{ &__malloc_main1_l12 }} - q ∈ UNINITIALIZED v ∈ [--..--] __malloc_main1_l12 ∈ {17} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main1_l12} tests/non-free/realloc.c:16:[value] allocating variable __realloc_main1_l16 tests/non-free/realloc.c:16:[value:malloc] strong free on bases: {__malloc_main1_l12} -[value] DUMPING STATE of file tests/non-free/realloc.c line 17 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:17:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ ESCAPINGADDR pp ∈ ESCAPINGADDR @@ -46,7 +46,7 @@ tests/non-free/realloc.c:16:[value:malloc] strong free on bases: {__malloc_main1 v ∈ [--..--] __realloc_main1_l16[0] ∈ {17} [1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:18:[value:malloc] strong free on bases: {__realloc_main1_l16} [value] Recording results for main1 [value] Done for function main1 @@ -62,13 +62,14 @@ tests/non-free/realloc.c:24:[value] warning: out of bounds write. assert \valid( [value:malloc] bases_to_realloc: {__malloc_main2_l23} tests/non-free/realloc.c:26:[value] allocating variable __realloc_main2_l26 tests/non-free/realloc.c:26:[value:malloc] strong free on bases: {__malloc_main2_l23} -[value] DUMPING STATE of file tests/non-free/realloc.c line 27 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:27:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] x ∈ {3; 4} r ∈ ESCAPINGADDR @@ -77,7 +78,7 @@ tests/non-free/realloc.c:26:[value:malloc] strong free on bases: {__malloc_main2 __realloc_main2_l26[0..2] ∈ {6} [3] ∈ {6} or UNINITIALIZED [4..5] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:28:[value:malloc] strong free on bases: {__realloc_main2_l26} [value] Recording results for main2 [value] Done for function main2 @@ -88,33 +89,34 @@ tests/non-free/realloc.c:35:[value] allocating variable __malloc_main3_l35 [value] computing for function Frama_C_interval <- main3 <- main. Called from tests/non-free/realloc.c:39. [value] Done for function Frama_C_interval -[value] DUMPING STATE of file tests/non-free/realloc.c line 44 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:44:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] q ∈ {{ &__malloc_main3_l32[0] }} r ∈ {{ &__malloc_main3_l35[0] }} p ∈ {{ &__malloc_main3_l32[0] ; &__malloc_main3_l35[0] }} x ∈ {0; 1} - s ∈ UNINITIALIZED v ∈ [--..--] __malloc_main3_l32[0..4] ∈ {5} __malloc_main3_l35[0..5] ∈ {6} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main3_l32, __malloc_main3_l35} tests/non-free/realloc.c:46:[value] allocating variable __realloc_main3_l46 tests/non-free/realloc.c:46:[value:malloc] weak free on bases: {__malloc_main3_l32, __malloc_main3_l35} -[value] DUMPING STATE of file tests/non-free/realloc.c line 48 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:48:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] q ∈ {{ &__malloc_main3_l32[0] }} or ESCAPINGADDR r ∈ {{ &__malloc_main3_l35[0] }} or ESCAPINGADDR @@ -127,7 +129,7 @@ tests/non-free/realloc.c:46:[value:malloc] weak free on bases: {__malloc_main3_l __realloc_main3_l46[0..4] ∈ {5; 6} [5] ∈ {6} or UNINITIALIZED [6] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:49:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(&q); tests/non-free/realloc.c:49:[value:malloc] strong free on bases: {__malloc_main3_l32} @@ -150,20 +152,19 @@ tests/non-free/realloc.c:56:[value] allocating variable __malloc_main4_l56 tests/non-free/realloc.c:59:[value] warning: out of bounds write. assert \valid(q + i); tests/non-free/realloc.c:58:[value] warning: out of bounds write. assert \valid(p + i); tests/non-free/realloc.c:57:[value] entering loop for the first time -[value] DUMPING STATE of file tests/non-free/realloc.c line 61 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:61:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] sizep ∈ [2..10] sizeq ∈ [0..10] p ∈ {{ &__malloc_main4_l55[0] }} q ∈ {{ &__malloc_main4_l56[0] }} - rp ∈ UNINITIALIZED - rq ∈ UNINITIALIZED v ∈ [--..--] __malloc_main4_l55[0] ∈ {0} [1] ∈ {1} @@ -185,20 +186,21 @@ tests/non-free/realloc.c:57:[value] entering loop for the first time [7] ∈ {7} [8] ∈ {8} [9] ∈ {9} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main4_l55} tests/non-free/realloc.c:67:[value] allocating variable __realloc_main4_l67 tests/non-free/realloc.c:67:[value:malloc] strong free on bases: {__malloc_main4_l55} [value:malloc] bases_to_realloc: {__malloc_main4_l56} tests/non-free/realloc.c:68:[value] allocating variable __realloc_main4_l68 tests/non-free/realloc.c:68:[value:malloc] strong free on bases: {__malloc_main4_l56} -[value] DUMPING STATE of file tests/non-free/realloc.c line 69 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:69:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] sizep ∈ [2..10] sizeq ∈ [0..10] @@ -226,7 +228,7 @@ tests/non-free/realloc.c:68:[value:malloc] strong free on bases: {__malloc_main4 [5] ∈ {5} or UNINITIALIZED [6] ∈ {6} or UNINITIALIZED [7] ∈ {7} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:72:[value:malloc] strong free on bases: {__realloc_main4_l67} tests/non-free/realloc.c:72:[value:malloc] strong free on bases: {__realloc_main4_l68} [value] Recording results for main4 @@ -237,31 +239,32 @@ tests/non-free/realloc.c:76:[value] allocating variable __malloc_main5_l76 [value] computing for function Frama_C_interval <- main5 <- main. Called from tests/non-free/realloc.c:78. [value] Done for function Frama_C_interval -[value] DUMPING STATE of file tests/non-free/realloc.c line 83 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:83:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {{ &__malloc_main5_l76 }} c ∈ {0; 1} q ∈ {{ NULL ; &__malloc_main5_l76 }} - r ∈ UNINITIALIZED v ∈ [--..--] __malloc_main5_l76 ∈ {1} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main5_l76} tests/non-free/realloc.c:85:[value] allocating variable __realloc_main5_l85 tests/non-free/realloc.c:85:[value:malloc] weak free on bases: {__malloc_main5_l76} -[value] DUMPING STATE of file tests/non-free/realloc.c line 86 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:86:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {{ &__malloc_main5_l76 }} or ESCAPINGADDR c ∈ {0; 1} @@ -271,7 +274,7 @@ tests/non-free/realloc.c:85:[value:malloc] weak free on bases: {__malloc_main5_l __malloc_main5_l76 ∈ {1} __realloc_main5_l85[0] ∈ {1} or UNINITIALIZED [1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:88:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(&p); tests/non-free/realloc.c:88:[value:malloc] strong free on bases: {__malloc_main5_l76} @@ -284,7 +287,7 @@ tests/non-free/realloc.c:88:[value:malloc] strong free on bases: {__realloc_main Called from tests/non-free/realloc.c:92. [value] Done for function Frama_C_interval tests/non-free/realloc.c:93:[value] allocating variable __malloc_main6_l93 -[value] Called Frama_C_show_each({{ &x ; &__malloc_main6_l93 + {4} }}) +tests/non-free/realloc.c:102:[value] Frama_C_show_each: {{ &x ; &__malloc_main6_l93 + {4} }} tests/non-free/realloc.c:103:[value] warning: Wrong free: assert(pass a freeable address) tests/non-free/realloc.c:106:[value:malloc] strong free on bases: {__malloc_main6_l93} [value] Recording results for main6 @@ -295,13 +298,14 @@ tests/non-free/realloc.c:110:[value] allocating variable __malloc_main7_l110 [value:malloc] bases_to_realloc: {__malloc_main7_l110} tests/non-free/realloc.c:115:[value] allocating variable __realloc_main7_l115 tests/non-free/realloc.c:115:[value:malloc] strong free on bases: {__malloc_main7_l110} -[value] DUMPING STATE of file tests/non-free/realloc.c line 116 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:116:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ ESCAPINGADDR q ∈ {{ &__realloc_main7_l115[0] }} @@ -309,22 +313,23 @@ tests/non-free/realloc.c:115:[value:malloc] strong free on bases: {__malloc_main v ∈ [--..--] __realloc_main7_l115[0] ∈ {{ &x }} [1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:116:[value] warning: locals {x} escaping the scope of a block of main7 through __realloc_main7_l115 -[value] DUMPING STATE of file tests/non-free/realloc.c line 118 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:118:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ ESCAPINGADDR q ∈ {{ &__realloc_main7_l115[0] }} v ∈ [--..--] __realloc_main7_l115[0] ∈ ESCAPINGADDR [1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:119:[value:malloc] strong free on bases: {__realloc_main7_l115} [value] Recording results for main7 [value] Done for function main7 @@ -334,19 +339,20 @@ tests/non-free/realloc.c:123:[value] allocating variable __malloc_main8_l123 [value:malloc] bases_to_realloc: {__malloc_main8_l123} tests/non-free/realloc.c:126:[value] allocating variable __realloc_main8_l126 tests/non-free/realloc.c:126:[value:malloc] strong free on bases: {__malloc_main8_l123} -[value] DUMPING STATE of file tests/non-free/realloc.c line 127 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:127:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ ESCAPINGADDR q ∈ {{ &__realloc_main8_l126[0] }} v ∈ [--..--] __realloc_main8_l126∈ ∅ - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:128:[value:malloc] strong free on bases: {__realloc_main8_l126} [value] Recording results for main8 [value] Done for function main8 @@ -356,19 +362,20 @@ tests/non-free/realloc.c:132:[value] allocating variable __malloc_main9_l132 [value:malloc] bases_to_realloc: {__malloc_main9_l132} tests/non-free/realloc.c:135:[value] allocating variable __realloc_main9_l135 tests/non-free/realloc.c:135:[value:malloc] strong free on bases: {__malloc_main9_l132} -[value] DUMPING STATE of file tests/non-free/realloc.c line 136 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:136:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ ESCAPINGADDR q ∈ {{ (int *)&__realloc_main9_l135 }} v ∈ [--..--] __realloc_main9_l135# ∈ {1}%32, bits 0 to 7 - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc.c:137:[value:malloc] strong free on bases: {__realloc_main9_l135} [value] Recording results for main9 [value] Done for function main9 @@ -378,39 +385,41 @@ tests/non-free/realloc.c:147:[value] allocating variable __malloc_main10_l147 [value:malloc] bases_to_realloc: {__malloc_main10_l147} tests/non-free/realloc.c:152:[value] allocating variable __realloc_main10_l152 tests/non-free/realloc.c:152:[value:malloc] strong free on bases: {__malloc_main10_l147} -[value] Called Frama_C_show_each_main10({4}) -[value] DUMPING STATE of file tests/non-free/realloc.c line 155 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +tests/non-free/realloc.c:155:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] v ∈ [--..--] p ∈ {{ &__realloc_main10_l152[0] }} q ∈ ESCAPINGADDR __realloc_main10_l152[0] ∈ {4} [1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__realloc_main10_l152} tests/non-free/realloc.c:152:[value:malloc] marking variable `__realloc_main10_l152' as weak tests/non-free/realloc.c:152:[value:malloc] weak free on bases: {__realloc_w_main10_l152} -[value] Called Frama_C_show_each_main10({4}) -[value] DUMPING STATE of file tests/non-free/realloc.c line 155 - __fc_random_counter ∈ {0} +tests/non-free/realloc.c:154:[value] Frama_C_show_each_main10: {4} +tests/non-free/realloc.c:155:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] v ∈ [--..--] p ∈ {{ &__realloc_w_main10_l152[0] }} q ∈ {{ &__realloc_w_main10_l152[0] }} or ESCAPINGADDR __realloc_w_main10_l152[0] ∈ {4} [1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main10 [value] Done for function main10 [value] Recording results for main diff --git a/tests/non-free/oracle/realloc2.res.oracle b/tests/non-free/oracle/realloc2.res.oracle index a66961aaecfbb35f12294a9e72c98aa562234b32..75d50e664eba5e2c5940fc8b416ab9a0396372f4 100644 --- a/tests/non-free/oracle/realloc2.res.oracle +++ b/tests/non-free/oracle/realloc2.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/realloc2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] [value] computing for function test_exact_null <- main. Called from tests/non-free/realloc2.c:194. @@ -579,7 +578,6 @@ tests/non-free/realloc2.c:187:[value:malloc] weak free on bases: {__malloc_test_ __realloc_test_exact_nonnull_shrink_l46[0] ∈ {0} [1] ∈ {1} [value:final-states] Values at end of function test_exact_null: - __fc_heap_status ∈ [--..--] p ∈ {{ &__realloc_test_exact_null_l27[0] }} __realloc_test_exact_null_l27[0] ∈ {0} [1] ∈ {1} @@ -592,7 +590,6 @@ tests/non-free/realloc2.c:187:[value:malloc] weak free on bases: {__malloc_test_ [8] ∈ {8} [9] ∈ {9} [value:final-states] Values at end of function test_exact_null_free: - __fc_heap_status ∈ [--..--] p ∈ {{ &__realloc_test_exact_null_free_l32[0] }} [value:final-states] Values at end of function test_imprecise_both: __fc_heap_status ∈ [--..--] @@ -603,13 +600,11 @@ tests/non-free/realloc2.c:187:[value:malloc] weak free on bases: {__malloc_test_ __realloc_test_imprecise_both_l91[0] ∈ {0} or UNINITIALIZED [1] ∈ {1} or UNINITIALIZED [value:final-states] Values at end of function test_imprecise_size: - __fc_heap_status ∈ [--..--] s ∈ {1; 2} p ∈ {{ &__realloc_test_imprecise_size_l70[0] }} __realloc_test_imprecise_size_l70[0] ∈ {0} [1] ∈ {1} or UNINITIALIZED [value:final-states] Values at end of function test_imprecise_size_but_precise_fill: - __fc_heap_status ∈ [--..--] s ∈ {1; 2} p ∈ {{ &__realloc_test_imprecise_size_but_precise_fill_l76[0] }} __realloc_test_imprecise_size_but_precise_fill_l76[0] ∈ {0} diff --git a/tests/non-free/oracle/realloc_multiple.res.oracle b/tests/non-free/oracle/realloc_multiple.res.oracle index 60fdda05f9b73d85b420db824bd7e8eebd2e732d..f9490507275169edef161f1013283c511d762304 100644 --- a/tests/non-free/oracle/realloc_multiple.res.oracle +++ b/tests/non-free/oracle/realloc_multiple.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/realloc_multiple.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] [value] computing for function main1 <- main. Called from tests/non-free/realloc_multiple.c:75. @@ -20,35 +19,36 @@ tests/non-free/realloc_multiple.c:12:[value] allocating variable __malloc_main1_ [value] using specification for function Frama_C_interval share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. [value] Done for function Frama_C_interval -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 21 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:21:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] q ∈ {{ &__malloc_main1_l9[0] }} r ∈ {{ &__malloc_main1_l12[0] }} p ∈ {{ &__malloc_main1_l9[0] ; &__malloc_main1_l12[0] }} x ∈ {0; 1} - s ∈ UNINITIALIZED v ∈ {1} __malloc_main1_l9[0..4] ∈ {5} __malloc_main1_l12[0..5] ∈ {6} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main1_l12} tests/non-free/realloc_multiple.c:23:[value] allocating variable __realloc_main1_l23 [value:malloc] bases_to_realloc: {__malloc_main1_l9} tests/non-free/realloc_multiple.c:23:[value] allocating variable __realloc_main1_l23_0 tests/non-free/realloc_multiple.c:23:[value:malloc] weak free on bases: {__malloc_main1_l9, __malloc_main1_l12} -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 25 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:25:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] q ∈ {{ &__malloc_main1_l9[0] }} or ESCAPINGADDR r ∈ {{ &__malloc_main1_l12[0] }} or ESCAPINGADDR @@ -62,7 +62,7 @@ tests/non-free/realloc_multiple.c:23:[value:malloc] weak free on bases: {__mallo [6] ∈ UNINITIALIZED __realloc_main1_l23_0[0..4] ∈ {5} [5..6] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc_multiple.c:26:[value:malloc] weak free on bases: {__realloc_main1_l23, __realloc_main1_l23_0} [value] Recording results for main1 [value] Done for function main1 @@ -73,23 +73,23 @@ tests/non-free/realloc_multiple.c:33:[value] allocating variable __malloc_main2_ [value] computing for function Frama_C_interval <- main2 <- main. Called from tests/non-free/realloc_multiple.c:37. [value] Done for function Frama_C_interval -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 43 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:43:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] q ∈ {{ &__malloc_main2_l30[0] }} r ∈ {{ &__malloc_main2_l33[0] }} p ∈ {{ NULL ; &__malloc_main2_l30[0] ; &__malloc_main2_l33[0] }} x ∈ {0; 1; 2} - s ∈ UNINITIALIZED v ∈ {2} __malloc_main2_l30[0..4] ∈ {7} __malloc_main2_l33[0..5] ∈ {8} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main2_l33} tests/non-free/realloc_multiple.c:45:[value] allocating variable __realloc_main2_l45 [value:malloc] bases_to_realloc: {__malloc_main2_l30} @@ -97,13 +97,14 @@ tests/non-free/realloc_multiple.c:45:[value] allocating variable __realloc_main2 [value:malloc] bases_to_realloc: {} tests/non-free/realloc_multiple.c:45:[value] allocating variable __realloc_main2_l45_1 tests/non-free/realloc_multiple.c:45:[value:malloc] weak free on bases: {__malloc_main2_l30, __malloc_main2_l33} -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 47 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:47:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] q ∈ {{ &__malloc_main2_l30[0] }} or ESCAPINGADDR r ∈ {{ &__malloc_main2_l33[0] }} or ESCAPINGADDR @@ -121,7 +122,7 @@ tests/non-free/realloc_multiple.c:45:[value:malloc] weak free on bases: {__mallo __realloc_main2_l45_0[0..4] ∈ {7} [5..6] ∈ UNINITIALIZED __realloc_main2_l45_1[0..6] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc_multiple.c:48:[value:malloc] weak free on bases: {__realloc_main2_l45, __realloc_main2_l45_0, __realloc_main2_l45_1} [value] Recording results for main2 @@ -133,13 +134,14 @@ tests/non-free/realloc_multiple.c:53:[value] allocating variable __malloc_main3_ [value] computing for function Frama_C_interval <- main3 <- main. Called from tests/non-free/realloc_multiple.c:59. [value] Done for function Frama_C_interval -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 64 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:64:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {{ &__malloc_main3_l52 }} q ∈ {{ &__malloc_main3_l53 }} @@ -151,7 +153,7 @@ tests/non-free/realloc_multiple.c:53:[value] allocating variable __malloc_main3_ v ∈ {3} __malloc_main3_l52 ∈ {{ &x }} __malloc_main3_l53 ∈ {{ &y }} - =END OF DUMP== + ==END OF DUMP== [value:malloc] bases_to_realloc: {__malloc_main3_l53} tests/non-free/realloc_multiple.c:65:[value] allocating variable __realloc_main3_l65 [value:malloc] bases_to_realloc: {__malloc_main3_l52} @@ -160,13 +162,14 @@ tests/non-free/realloc_multiple.c:65:[value] allocating variable __realloc_main3 tests/non-free/realloc_multiple.c:65:[value] allocating variable __realloc_main3_l65_1 tests/non-free/realloc_multiple.c:65:[value:malloc] weak free on bases: {__malloc_main3_l52, __malloc_main3_l53} tests/non-free/realloc_multiple.c:66:[value] warning: accessing uninitialized left-value. assert \initialized(s); -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 67 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:67:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {{ &__malloc_main3_l52 }} or ESCAPINGADDR q ∈ {{ &__malloc_main3_l53 }} or ESCAPINGADDR @@ -183,18 +186,19 @@ tests/non-free/realloc_multiple.c:66:[value] warning: accessing uninitialized le __realloc_main3_l65_0[0] ∈ {{ &x }} [1] ∈ UNINITIALIZED __realloc_main3_l65_1[0..1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc_multiple.c:67:[value] warning: locals {x} escaping the scope of a block of main3 through __malloc_main3_l52 tests/non-free/realloc_multiple.c:67:[value] warning: locals {y} escaping the scope of a block of main3 through __malloc_main3_l53 tests/non-free/realloc_multiple.c:67:[value] warning: locals {y} escaping the scope of a block of main3 through __realloc_main3_l65 tests/non-free/realloc_multiple.c:67:[value] warning: locals {x} escaping the scope of a block of main3 through __realloc_main3_l65_0 -[value] DUMPING STATE of file tests/non-free/realloc_multiple.c line 69 - __fc_random_counter ∈ {0} +tests/non-free/realloc_multiple.c:69:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] Frama_C_entropy_source ∈ [--..--] p ∈ {{ &__malloc_main3_l52 }} or ESCAPINGADDR q ∈ {{ &__malloc_main3_l53 }} or ESCAPINGADDR @@ -208,7 +212,7 @@ tests/non-free/realloc_multiple.c:67:[value] warning: locals {x} escaping the sc __realloc_main3_l65_0[0] ∈ ESCAPINGADDR [1] ∈ UNINITIALIZED __realloc_main3_l65_1[0..1] ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/non-free/realloc_multiple.c:70:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(&q); tests/non-free/realloc_multiple.c:70:[value:malloc] strong free on bases: {__malloc_main3_l53} diff --git a/tests/non-free/oracle/str_allocated.res.oracle b/tests/non-free/oracle/str_allocated.res.oracle index deb9adffe27ffb0578057118519927c62d92f495..7d64fb1919987546d7453ee2532a47891065fcbd 100644 --- a/tests/non-free/oracle/str_allocated.res.oracle +++ b/tests/non-free/oracle/str_allocated.res.oracle @@ -1,15 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/str_allocated.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] [value] computing for function memchr_bug <- main. Called from tests/non-free/str_allocated.c:19. @@ -21,12 +20,13 @@ tests/non-free/str_allocated.c:14:[value] warning: accessing uninitialized left- tests/non-free/str_allocated.c:14:[value] Call to builtin Frama_C_memchr(({{ (void const *)&__malloc_w_memchr_bug_l12 }}, {1},{1})) tests/non-free/str_allocated.c:14:[value] warning: builtin Frama_C_memchr: reading indeterminate data +share/libc/string.h:46:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +share/libc/string.h:53:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Recording results for memchr_bug [value] Done for function memchr_bug [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/str_allocated.c:14:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value:final-states] Values at end of function memchr_bug: NON TERMINATING FUNCTION [value:final-states] Values at end of function main: diff --git a/tests/non-free/oracle/strchr.res.oracle b/tests/non-free/oracle/strchr.res.oracle index 39d517678215bbe06b33e5f09201ecd3e7dc91d9..01926711d82d408ca1b7933cbe11fc8b994ecd7d 100644 --- a/tests/non-free/oracle/strchr.res.oracle +++ b/tests/non-free/oracle/strchr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/strchr.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -21,32 +20,32 @@ static_str ∈ {0} zero_str ∈ {0} [value] computing for function strchr_small_sets <- main. - Called from tests/non-free/strchr.c:532. + Called from tests/non-free/strchr.c:538. [value] computing for function my_strchr <- strchr_small_sets <- main. Called from tests/non-free/strchr.c:79. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} }},{0})) -[value] Called Frama_C_show_each_mystrchr({3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:80:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_small_sets <- main. Called from tests/non-free/strchr.c:83. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "\000bc" + {0; 1} }},{0})) -[value] Called Frama_C_show_each_mystrchr({0; 3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0; 3} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:84:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_small_sets <- main. Called from tests/non-free/strchr.c:86. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" }},{0})) -[value] Called Frama_C_show_each_mystrchr({0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:87:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_small_sets <- main. Called from tests/non-free/strchr.c:90. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "b\000c" + {0; 2} }},{0})) -[value] Called Frama_C_show_each_mystrchr({1; 3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1; 3} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:91:[value] assertion got status valid. @@ -54,18 +53,18 @@ tests/non-free/strchr.c:91:[value] assertion got status valid. Called from tests/non-free/strchr.c:95. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{0})) tests/non-free/strchr.c:49:[value] warning: builtin Frama_C_strchr: possibly reading indeterminate data -[value] Called Frama_C_show_each_mystrchr({0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:96:[value] assertion got status valid. [value] Recording results for strchr_small_sets [value] Done for function strchr_small_sets [value] computing for function strchr_zero_termination <- main. - Called from tests/non-free/strchr.c:533. + Called from tests/non-free/strchr.c:539. [value] computing for function my_strchr <- strchr_zero_termination <- main. Called from tests/non-free/strchr.c:104. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &empty_or_non_terminated[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:105:[value] assertion got status valid. @@ -82,11 +81,11 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &non_termi [value] Recording results for strchr_zero_termination [value] Done for function strchr_zero_termination [value] computing for function strchr_initialization <- main. - Called from tests/non-free/strchr.c:534. + Called from tests/non-free/strchr.c:540. [value] computing for function my_strchr <- strchr_initialization <- main. Called from tests/non-free/strchr.c:123. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &empty_or_uninitialized[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:124:[value] assertion got status valid. @@ -98,21 +97,21 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &uninitial [value] computing for function my_strchr <- strchr_initialization <- main. Called from tests/non-free/strchr.c:132. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:133:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_initialization <- main. Called from tests/non-free/strchr.c:139. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:140:[value] assertion got status valid. [value] Recording results for strchr_initialization [value] Done for function strchr_initialization [value] computing for function strchr_large <- main. - Called from tests/non-free/strchr.c:535. + Called from tests/non-free/strchr.c:541. [value] computing for function init_array_nondet <- strchr_large <- main. Called from tests/non-free/strchr.c:188. tests/non-free/strchr.c:180:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{100})) @@ -126,7 +125,7 @@ share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got [value] computing for function my_strchr <- strchr_large <- main. Called from tests/non-free/strchr.c:192. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [3..30] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..75]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..75] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:193:[value] assertion got status valid. @@ -136,7 +135,7 @@ tests/non-free/strchr.c:193:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_large <- main. Called from tests/non-free/strchr.c:196. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [5..17] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..20]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..20] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:197:[value] assertion got status valid. @@ -147,7 +146,7 @@ tests/non-free/strchr.c:198:[value] warning: assertion 'refined' got status unkn [value] computing for function my_strchr <- strchr_large <- main. Called from tests/non-free/strchr.c:201. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [60..74] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..75]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..75] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:202:[value] assertion got status valid. @@ -158,7 +157,7 @@ tests/non-free/strchr.c:203:[value] warning: assertion 'refined' got status unkn [value] computing for function my_strchr <- strchr_large <- main. Called from tests/non-free/strchr.c:206. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [63..80] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..79]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..79] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:207:[value] assertion got status valid. @@ -174,14 +173,14 @@ tests/non-free/strchr.c:180:[value] Call to builtin memset(({{ (void *)&a }},{0; [value] computing for function my_strchr <- strchr_large <- main. Called from tests/non-free/strchr.c:212. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [50..70] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..99]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..99] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:213:[value] assertion got status valid. [value] Recording results for strchr_large [value] Done for function strchr_large [value] computing for function strchr_large_uninit <- main. - Called from tests/non-free/strchr.c:536. + Called from tests/non-free/strchr.c:542. [value] computing for function init_array_nondet <- strchr_large_uninit <- main. Called from tests/non-free/strchr.c:220. tests/non-free/strchr.c:180:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{40})) @@ -198,7 +197,7 @@ tests/non-free/strchr.c:180:[value] Call to builtin memset(({{ (void *)&a[50] }} [value] computing for function my_strchr <- strchr_large_uninit <- main. Called from tests/non-free/strchr.c:226. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [3..30] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..29]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..29] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:227:[value] assertion got status valid. @@ -209,7 +208,7 @@ tests/non-free/strchr.c:228:[value] warning: assertion 'refined' got status unkn [value] computing for function my_strchr <- strchr_large_uninit <- main. Called from tests/non-free/strchr.c:232. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [63..80] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..79]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..79] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:233:[value] assertion got status valid. @@ -220,7 +219,7 @@ tests/non-free/strchr.c:234:[value] warning: assertion 'refined' got status unkn [value] computing for function my_strchr <- strchr_large_uninit <- main. Called from tests/non-free/strchr.c:237. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &a + [45..55] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..75]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..75] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:238:[value] assertion got status valid. @@ -228,7 +227,7 @@ tests/non-free/strchr.c:239:[value] warning: assertion 'refined' got status unkn [value] Recording results for strchr_large_uninit [value] Done for function strchr_large_uninit [value] computing for function strchr_misc_array <- main. - Called from tests/non-free/strchr.c:537. + Called from tests/non-free/strchr.c:543. [value] computing for function Frama_C_interval <- strchr_misc_array <- main. Called from tests/non-free/strchr.c:261. [value] Done for function Frama_C_interval @@ -240,14 +239,14 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" ; "a" ; "aaaaaaaaaaaa" ; "aaaaaaaaaaaaa" }}, {0})) tests/non-free/strchr.c:54:[value] warning: pointer subtraction. assert \base_addr(ss) ≡ \base_addr(s); -[value] Called Frama_C_show_each_mystrchr([0..13]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [0..13] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:263:[value] assertion got status valid. [value] Recording results for strchr_misc_array [value] Done for function strchr_misc_array [value] computing for function strchr_misc <- main. - Called from tests/non-free/strchr.c:538. + Called from tests/non-free/strchr.c:544. [value] computing for function my_strchr <- strchr_misc <- main. Called from tests/non-free/strchr.c:293. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &unterminated_string[0] }},{0})) @@ -257,7 +256,7 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &untermina Called from tests/non-free/strchr.c:296. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "Hello World\n" ; "Bonjour Monde\n" }}, {0})) -[value] Called Frama_C_show_each_mystrchr({12; 14}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {12; 14} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:297:[value] assertion got status valid. @@ -265,7 +264,7 @@ tests/non-free/strchr.c:297:[value] assertion got status valid. Called from tests/non-free/strchr.c:299. tests/non-free/strchr.c:62:[value] Call to builtin Frama_C_strchr(({{ &x + {0; 3} }},{0})) tests/non-free/strchr.c:62:[value] warning: builtin Frama_C_strchr: possibly reading indeterminate data -[value] Called Frama_C_show_each_mystrchr2({0}) +tests/non-free/strchr.c:69:[value] Frama_C_show_each_mystrchr2: {0} [value] Recording results for my_strchr2 [value] Done for function my_strchr2 tests/non-free/strchr.c:300:[value] assertion got status valid. @@ -277,47 +276,47 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &loc_char_ [value] computing for function my_strchr <- strchr_misc <- main. Called from tests/non-free/strchr.c:303. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc\000\000\000abc" }},{0})) -[value] Called Frama_C_show_each_mystrchr({3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:304:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_misc <- main. Called from tests/non-free/strchr.c:305. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc\000\000\000abc" + {4} }},{0})) -[value] Called Frama_C_show_each_mystrchr({4}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {4} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:306:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_misc <- main. Called from tests/non-free/strchr.c:307. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc\000\000\000abc" + {5} }},{0})) -[value] Called Frama_C_show_each_mystrchr({5}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {5} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:308:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_misc <- main. Called from tests/non-free/strchr.c:309. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc\000\000\000abc" + {6} }},{0})) -[value] Called Frama_C_show_each_mystrchr({9}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {9} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:310:[value] assertion got status valid. [value] Recording results for strchr_misc [value] Done for function strchr_misc [value] computing for function strchr_misc2 <- main. - Called from tests/non-free/strchr.c:539. + Called from tests/non-free/strchr.c:545. [value] computing for function my_strchr2 <- strchr_misc2 <- main. Called from tests/non-free/strchr.c:319. tests/non-free/strchr.c:62:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} ; "ABCD" + {0; 1} }},{0})) tests/non-free/strchr.c:67:[value] warning: pointer subtraction. assert \base_addr(s) ≡ \base_addr((char *)base); -[value] Called Frama_C_show_each_mystrchr2({3; 4}) +tests/non-free/strchr.c:69:[value] Frama_C_show_each_mystrchr2: {3; 4} [value] Recording results for my_strchr2 [value] Done for function my_strchr2 tests/non-free/strchr.c:320:[value] assertion got status valid. [value] computing for function my_strchr2 <- strchr_misc2 <- main. Called from tests/non-free/strchr.c:323. tests/non-free/strchr.c:62:[value] Call to builtin Frama_C_strchr(({{ "efg" + {1; 2} ; "EFGH" + {1; 2} }},{0})) -[value] Called Frama_C_show_each_mystrchr2({3; 4}) +tests/non-free/strchr.c:69:[value] Frama_C_show_each_mystrchr2: {3; 4} [value] Recording results for my_strchr2 [value] Done for function my_strchr2 tests/non-free/strchr.c:324:[value] assertion got status valid. @@ -325,7 +324,7 @@ tests/non-free/strchr.c:327:[value] entering loop for the first time [value] computing for function my_strchr <- strchr_misc2 <- main. Called from tests/non-free/strchr.c:328. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pqr" ; "MNOP\000QRS" }},{0})) -[value] Called Frama_C_show_each_mystrchr({3; 4}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3; 4} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:329:[value] assertion got status valid. @@ -333,14 +332,14 @@ tests/non-free/strchr.c:329:[value] assertion got status valid. Called from tests/non-free/strchr.c:328. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pqr" + {0; 1} ; "MNOP\000QRS" + {0; 1} }},{0})) -[value] Called Frama_C_show_each_mystrchr({3; 4}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3; 4} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_misc2 <- main. Called from tests/non-free/strchr.c:328. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pqr" + {0; 1; 2} ; "MNOP\000QRS" + {0; 1; 2} }},{0})) -[value] Called Frama_C_show_each_mystrchr({3; 4}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3; 4} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_misc2 <- main. @@ -348,7 +347,7 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pq tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pqr" + {0; 1; 2; 3; 4; 5; 6; 7} ; "MNOP\000QRS" + {0; 1; 2; 3; 4; 5; 6; 7} }}, {0})) -[value] Called Frama_C_show_each_mystrchr({3; 4; 7; 8}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3; 4; 7; 8} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_misc2 <- main. @@ -356,102 +355,102 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pq tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "mno\000pqr" + {0; 1; 2; 3; 4; 5; 6; 7} ; "MNOP\000QRS" + {0; 1; 2; 3; 4; 5; 6; 7} }}, {0})) -[value] Called Frama_C_show_each_mystrchr({3; 4; 7; 8}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {3; 4; 7; 8} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_misc2 <- main. Called from tests/non-free/strchr.c:335. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &maybe_init[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:336:[value] assertion got status valid. [value] Recording results for strchr_misc2 [value] Done for function strchr_misc2 [value] computing for function strchr_bitfields <- main. - Called from tests/non-free/strchr.c:540. + Called from tests/non-free/strchr.c:546. tests/non-free/strchr.c:157:[value] Call to builtin Frama_C_strchr(({{ (char const *)&s }},{0})) tests/non-free/strchr.c:157:[value] warning: builtin Frama_C_strchr: reading indeterminate data [value] Recording results for strchr_bitfields [value] Done for function strchr_bitfields [value] computing for function strchr_bitfields2 <- main. - Called from tests/non-free/strchr.c:541. + Called from tests/non-free/strchr.c:547. [value] computing for function my_strchr <- strchr_bitfields2 <- main. Called from tests/non-free/strchr.c:174. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&s }},{0})) -[value] Called Frama_C_show_each_mystrchr({2}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {2} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:175:[value] assertion got status valid. [value] Recording results for strchr_bitfields2 [value] Done for function strchr_bitfields2 [value] computing for function strchr_escaping <- main. - Called from tests/non-free/strchr.c:542. + Called from tests/non-free/strchr.c:548. tests/non-free/strchr.c:249:[value] warning: locals {x} escaping the scope of a block of strchr_escaping through s [value] computing for function my_strchr <- strchr_escaping <- main. Called from tests/non-free/strchr.c:252. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:253:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_escaping <- main. Called from tests/non-free/strchr.c:255. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:256:[value] assertion got status valid. [value] Recording results for strchr_escaping [value] Done for function strchr_escaping [value] computing for function strchr_big_array <- main. - Called from tests/non-free/strchr.c:543. + Called from tests/non-free/strchr.c:549. tests/non-free/strchr.c:346:[value] warning: out of bounds write. assert \valid(p); tests/non-free/strchr.c:348:[value] warning: out of bounds write. assert \valid(p); tests/non-free/strchr.c:350:[value] warning: out of bounds write. assert \valid(p); [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:359. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&u }},{0})) -[value] Called Frama_C_show_each_mystrchr({1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:360. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&r }},{0})) tests/non-free/strchr.c:49:[kernel] more than 200(201) locations to update in array. Approximating. -[value] Called Frama_C_show_each_mystrchr({1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:361. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&t }},{0})) tests/non-free/strchr.c:49:[kernel] more than 200(1000000) locations to update in array. Approximating. -[value] Called Frama_C_show_each_mystrchr({1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1} [value] Recording results for my_strchr [value] Done for function my_strchr -[value] Called Frama_C_show_each({1}, {1}, {1}) +tests/non-free/strchr.c:362:[value] Frama_C_show_each: {1}, {1}, {1} tests/non-free/strchr.c:363:[value] assertion got status valid. tests/non-free/strchr.c:364:[value] assertion got status valid. tests/non-free/strchr.c:365:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:367. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &u + [0..4294967295] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..799]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..799] [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:368. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &r + [0..4294967295] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..803]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..803] [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:369. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t + [0..4294967295] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..3999999]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..3999999] [value] Recording results for my_strchr [value] Done for function my_strchr -[value] Called Frama_C_show_each([-1..799], [-1..803], [-1..3999999]) +tests/non-free/strchr.c:370:[value] Frama_C_show_each: [-1..799], [-1..803], [-1..3999999] tests/non-free/strchr.c:371:[value] assertion got status valid. tests/non-free/strchr.c:372:[value] assertion got status valid. tests/non-free/strchr.c:373:[value] assertion got status valid. @@ -479,44 +478,44 @@ tests/non-free/strchr.c:386:[value] warning: out of bounds write. assert \valid( [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:387. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&u }},{0})) -[value] Called Frama_C_show_each_mystrchr([0..799]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [0..799] [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:388. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&r }},{0})) -[value] Called Frama_C_show_each_mystrchr([0..803]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [0..803] [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:389. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ (char const *)&t }},{0})) -[value] Called Frama_C_show_each_mystrchr([0..3999999]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [0..3999999] [value] Recording results for my_strchr [value] Done for function my_strchr -[value] Called Frama_C_show_each([0..799], [0..803], [0..3999999]) +tests/non-free/strchr.c:390:[value] Frama_C_show_each: [0..799], [0..803], [0..3999999] tests/non-free/strchr.c:391:[value] assertion got status valid. tests/non-free/strchr.c:392:[value] assertion got status valid. tests/non-free/strchr.c:393:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:395. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &u + [0..4294967295] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..799]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..799] [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:396. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &r + [0..4294967295] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..803]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..803] [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_big_array <- main. Called from tests/non-free/strchr.c:397. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t + [0..4294967295] }},{0})) -[value] Called Frama_C_show_each_mystrchr([-1..3999999]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..3999999] [value] Recording results for my_strchr [value] Done for function my_strchr -[value] Called Frama_C_show_each([-1..799], [-1..803], [-1..3999999]) +tests/non-free/strchr.c:398:[value] Frama_C_show_each: [-1..799], [-1..803], [-1..3999999] tests/non-free/strchr.c:399:[value] assertion got status valid. tests/non-free/strchr.c:400:[value] assertion got status valid. tests/non-free/strchr.c:401:[value] assertion got status valid. @@ -526,47 +525,47 @@ tests/non-free/strchr.c:404:[value] warning: assertion 'refined' got status unkn [value] Recording results for strchr_big_array [value] Done for function strchr_big_array [value] computing for function strchr_no_zero_but_ok <- main. - Called from tests/non-free/strchr.c:544. + Called from tests/non-free/strchr.c:550. [value] computing for function my_strchr <- strchr_no_zero_but_ok <- main. Called from tests/non-free/strchr.c:415. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({10}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {10} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:416:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_no_zero_but_ok <- main. Called from tests/non-free/strchr.c:417. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s[0] }},{0})) -[value] Called Frama_C_show_each_mystrchr({10}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {10} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:418:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_no_zero_but_ok <- main. Called from tests/non-free/strchr.c:420. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s{[1], [8]} }},{0})) -[value] Called Frama_C_show_each_mystrchr({10}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {10} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:421:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_no_zero_but_ok <- main. Called from tests/non-free/strchr.c:423. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s{[7], [11]} }},{0})) -[value] Called Frama_C_show_each_mystrchr({10; 14; 15; 16; 17; 18; 19}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {10; 14; 15; 16; 17; 18; 19} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:424:[value] assertion got status valid. [value] computing for function my_strchr <- strchr_no_zero_but_ok <- main. Called from tests/non-free/strchr.c:426. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &s{[7], [18]} }},{0})) -[value] Called Frama_C_show_each_mystrchr({10; 18; 19}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {10; 18; 19} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:427:[value] assertion got status valid. [value] Recording results for strchr_no_zero_but_ok [value] Done for function strchr_no_zero_but_ok [value] computing for function strchr_small_sets_chars <- main. - Called from tests/non-free/strchr.c:545. -[value] Called Frama_C_show_each_c({97}) + Called from tests/non-free/strchr.c:551. +tests/non-free/strchr.c:455:[value] Frama_C_show_each_c: {97} [value] computing for function strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:456. @@ -574,40 +573,40 @@ tests/non-free/strchr.c:427:[value] assertion got status valid. strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:435. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} }},{97})) -[value] Called Frama_C_show_each_mystrchr({-1; 0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:438. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "\000bc" + {0; 1} }},{97})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:440. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" }},{97})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:443. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "b\000c" + {0; 2} }},{97})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:447. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{97})) -[value] Called Frama_C_show_each_mystrchr({0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] Recording results for strchr_small_sets_no_assertions [value] Done for function strchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 0}, {-1}, {-1}, {-1}, {0; 1}) +tests/non-free/strchr.c:457:[value] Frama_C_show_each_res: {-1; 0}, {-1}, {-1}, {-1}, {0; 1} tests/non-free/strchr.c:458:[value] assertion got status valid. tests/non-free/strchr.c:459:[value] assertion got status valid. tests/non-free/strchr.c:460:[value] assertion got status valid. @@ -620,46 +619,46 @@ tests/non-free/strchr.c:462:[value] assertion got status valid. strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:435. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} }},{98})) -[value] Called Frama_C_show_each_mystrchr({1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:438. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "\000bc" + {0; 1} }},{98})) -[value] Called Frama_C_show_each_mystrchr({-1; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:440. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" }},{98})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:443. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "b\000c" + {0; 2} }},{98})) -[value] Called Frama_C_show_each_mystrchr({-1; 0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:447. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{98})) -[value] Called Frama_C_show_each_mystrchr({0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] Recording results for strchr_small_sets_no_assertions [value] Done for function strchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({1}, {-1; 1}, {-1}, {-1; 0}, {0; 1}) +tests/non-free/strchr.c:466:[value] Frama_C_show_each_res: {1}, {-1; 1}, {-1}, {-1; 0}, {0; 1} tests/non-free/strchr.c:467:[value] assertion got status valid. tests/non-free/strchr.c:468:[value] assertion got status valid. tests/non-free/strchr.c:469:[value] assertion got status valid. tests/non-free/strchr.c:470:[value] assertion got status valid. tests/non-free/strchr.c:471:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({97; 98}) +tests/non-free/strchr.c:474:[value] Frama_C_show_each_c: {97; 98} [value] computing for function strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:475. @@ -667,46 +666,46 @@ tests/non-free/strchr.c:471:[value] assertion got status valid. strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:435. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} }},{97; 98})) -[value] Called Frama_C_show_each_mystrchr({-1; 0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:438. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "\000bc" + {0; 1} }},{97; 98})) -[value] Called Frama_C_show_each_mystrchr({-1; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:440. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" }},{97; 98})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:443. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "b\000c" + {0; 2} }},{97; 98})) -[value] Called Frama_C_show_each_mystrchr({-1; 0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:447. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{97; 98})) -[value] Called Frama_C_show_each_mystrchr({0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] Recording results for strchr_small_sets_no_assertions [value] Done for function strchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 0; 1}, {-1; 1}, {-1}, {-1; 0}, {0; 1}) +tests/non-free/strchr.c:476:[value] Frama_C_show_each_res: {-1; 0; 1}, {-1; 1}, {-1}, {-1; 0}, {0; 1} tests/non-free/strchr.c:478:[value] assertion got status valid. tests/non-free/strchr.c:479:[value] assertion got status valid. tests/non-free/strchr.c:480:[value] assertion got status valid. tests/non-free/strchr.c:481:[value] assertion got status valid. tests/non-free/strchr.c:482:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({98; 99}) +tests/non-free/strchr.c:485:[value] Frama_C_show_each_c: {98; 99} [value] computing for function strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:486. @@ -714,47 +713,47 @@ tests/non-free/strchr.c:482:[value] assertion got status valid. strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:435. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} }},{98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 1; 2}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 1; 2} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:438. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "\000bc" + {0; 1} }},{98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 1; 2}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 1; 2} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:440. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" }},{98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:443. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "b\000c" + {0; 2} }},{98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 0; 2}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0; 2} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:447. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{98; 99})) -[value] Called Frama_C_show_each_mystrchr({0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] Recording results for strchr_small_sets_no_assertions [value] Done for function strchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 1; 2}, {-1; 1; 2}, {-1}, {-1; 0; 2}, {0; 1}) +tests/non-free/strchr.c:487:[value] Frama_C_show_each_res: {-1; 1; 2}, {-1; 1; 2}, {-1}, {-1; 0; 2}, {0; 1} tests/non-free/strchr.c:488:[value] assertion got status valid. tests/non-free/strchr.c:489:[value] warning: assertion 'refined' got status unknown. tests/non-free/strchr.c:490:[value] assertion got status valid. tests/non-free/strchr.c:491:[value] assertion got status valid. tests/non-free/strchr.c:492:[value] assertion got status valid. tests/non-free/strchr.c:493:[value] assertion got status valid. -[value] Called Frama_C_show_each_c({0; 98; 99}) +tests/non-free/strchr.c:496:[value] Frama_C_show_each_c: {0; 98; 99} [value] computing for function strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:497. @@ -762,44 +761,41 @@ tests/non-free/strchr.c:493:[value] assertion got status valid. strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:435. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abc" + {0; 1} }},{0; 98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 1; 2; 3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 1; 2; 3} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:438. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "\000bc" + {0; 1} }},{0; 98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 0; 1; 2; 3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0; 1; 2; 3} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:440. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "" }},{0; 98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 0}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:443. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "b\000c" + {0; 2} }},{0; 98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 0; 1; 2; 3}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0; 1; 2; 3} [value] Recording results for my_strchr [value] Done for function my_strchr [value] computing for function my_strchr <- strchr_small_sets_no_assertions <- strchr_small_sets_chars <- main. Called from tests/non-free/strchr.c:447. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] }},{0; 98; 99})) -[value] Called Frama_C_show_each_mystrchr({-1; 0; 1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0; 1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] Recording results for strchr_small_sets_no_assertions [value] Done for function strchr_small_sets_no_assertions -[value] Called Frama_C_show_each_res({-1; 1; 2; 3}, - {-1; 0; 1; 2; 3}, - {-1; 0}, - {-1; 0; 1; 2; 3}, - {-1; 0; 1}) +tests/non-free/strchr.c:498:[value] Frama_C_show_each_res: + {-1; 1; 2; 3}, {-1; 0; 1; 2; 3}, {-1; 0}, {-1; 0; 1; 2; 3}, {-1; 0; 1} tests/non-free/strchr.c:499:[value] assertion got status valid. tests/non-free/strchr.c:500:[value] warning: assertion 'refined' got status unknown. tests/non-free/strchr.c:501:[value] assertion got status valid. @@ -809,11 +805,11 @@ tests/non-free/strchr.c:504:[value] assertion got status valid. [value] Recording results for strchr_small_sets_chars [value] Done for function strchr_small_sets_chars [value] computing for function strchr_unbounded <- main. - Called from tests/non-free/strchr.c:546. + Called from tests/non-free/strchr.c:552. [value] computing for function my_strchr <- strchr_unbounded <- main. Called from tests/non-free/strchr.c:511. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ "abcd" }},[-128..127])) -[value] Called Frama_C_show_each_mystrchr({-1; 0; 1; 2; 3; 4}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1; 0; 1; 2; 3; 4} [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:512:[value] assertion got status valid. @@ -821,7 +817,7 @@ tests/non-free/strchr.c:512:[value] assertion got status valid. Called from tests/non-free/strchr.c:516. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }}, [-128..127])) -[value] Called Frama_C_show_each_mystrchr([-1..26]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..26] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:517:[value] assertion got status valid. @@ -834,7 +830,7 @@ tests/non-free/strchr.c:180:[value] Call to builtin memset(({{ (void *)&t }},{0; Called from tests/non-free/strchr.c:519. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t[0] ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }}, [-128..127])) -[value] Called Frama_C_show_each_mystrchr([-1..29]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..29] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:520:[value] assertion got status valid. @@ -843,24 +839,38 @@ tests/non-free/strchr.c:520:[value] assertion got status valid. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ &t + [0..4294967295] ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + [0..4294967295] }},[-128..127])) -[value] Called Frama_C_show_each_mystrchr([-1..29]) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: [-1..29] [value] Recording results for my_strchr [value] Done for function my_strchr tests/non-free/strchr.c:522:[value] assertion got status valid. [value] Recording results for strchr_unbounded [value] Done for function strchr_unbounded [value] computing for function strchr_invalid <- main. - Called from tests/non-free/strchr.c:547. + Called from tests/non-free/strchr.c:553. [value] computing for function my_strchr <- strchr_invalid <- main. Called from tests/non-free/strchr.c:528. tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mix of &{s; "hello"} (origin: Arithmetic {tests/non-free/strchr.c:49}) }},{1})) -[value] Called Frama_C_show_each_mystrchr({-1}) +tests/non-free/strchr.c:56:[value] Frama_C_show_each_mystrchr: {-1} [value] Recording results for my_strchr [value] Done for function my_strchr [value] Recording results for strchr_invalid [value] Done for function strchr_invalid +[value] computing for function strchr_garbled_mix_in_char <- main. + Called from tests/non-free/strchr.c:554. +tests/non-free/strchr.c:533:[value] Assigning imprecise value to garbled. + The imprecision originates from Arithmetic {tests/non-free/strchr.c:533} +tests/non-free/strchr.c:534:[value] Call to builtin Frama_C_strchr(({{ garbled mix of &{x} + (origin: Arithmetic + {tests/non-free/strchr.c:533}) }}, + {{ garbled mix of &{x} + (origin: Arithmetic + {tests/non-free/strchr.c:533}) }})) +tests/non-free/strchr.c:534:[value] warning: builtin Frama_C_strchr: + assert(no address in second argument of Frama_C_strchr) +[value] Recording results for strchr_garbled_mix_in_char +[value] Done for function strchr_garbled_mix_in_char [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -935,6 +945,10 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi [1..3] ∈ ESCAPINGADDR z1 ∈ {0} z2 ∈ {0} +[value:final-states] Values at end of function strchr_garbled_mix_in_char: + garbled ∈ + {{ garbled mix of &{x} + (origin: Arithmetic {tests/non-free/strchr.c:533}) }} [value:final-states] Values at end of function strchr_initialization: c ∈ {0} empty_or_uninitialized[0] ∈ {0} or UNINITIALIZED @@ -1098,6 +1112,8 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi [from] Done for function strchr_bitfields2 [from] Computing for function strchr_escaping [from] Done for function strchr_escaping +[from] Computing for function strchr_garbled_mix_in_char +[from] Done for function strchr_garbled_mix_in_char [from] Computing for function strchr_initialization [from] Done for function strchr_initialization [from] Computing for function strchr_invalid @@ -1147,7 +1163,7 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi uninitialized[0]; s[0..1]; t[0..3]; s; s; a[0..99]; a[0..99]; s[0..3]; loc_char_array[0..4]; x; unterminated_string[0..11]; maybe_init[0..1]; u[0..199]; r[0..200]; t[0..999999]; - s[0..19]; t[0..3]; t[0..29]; s; ""[bits 0 to 7]; + s[0..19]; t[0..3]; t[0..29]; s; x; ""[bits 0 to 7]; "a"[bits 0 to 15]; "aa"[bits 0 to 23]; "aaa"; "aaaa"[bits 0 to 39]; "aaaaa"[bits 0 to 47]; "aaaaaa"[bits 0 to 55]; "aaaaaaaaa"[bits 0 to 79]; @@ -1214,6 +1230,8 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi NO EFFECTS [from] Function strchr_escaping: NO EFFECTS +[from] Function strchr_garbled_mix_in_char: + NO EFFECTS [from] Function strchr_initialization: NO EFFECTS [from] Function strchr_invalid: @@ -1275,8 +1293,8 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function init_array_nondet: - from; to; val1; val2; val; tmp; a[0..99]; a[0..99]; u[0..199]; r[0..200]; - t[0..999999]; t[0..29] + from; to; val1; val2; val; tmp; a[0..99]; a{[0..39]; [50..94]}; u[0..199]; + r[0..200]; t[0..999999]; t[0..29] [inout] Inputs for function init_array_nondet: nondet [inout] Out (internal) for function my_strchr: @@ -1344,6 +1362,10 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi "MNOP\000QRS"[bits 0 to 71]; "abc"; "\000bc"; ""[bits 0 to 7]; "b\000c"; "abcd"[bits 0 to 39]; "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[bits 0 to 215]; "hello"[bits 0 to 47] +[inout] Out (internal) for function strchr_garbled_mix_in_char: + garbled +[inout] Inputs for function strchr_garbled_mix_in_char: + \nothing [inout] Out (internal) for function strchr_initialization: c; empty_or_uninitialized[0]; z1; s[0..1]; z2; t[0..3]; z3 [inout] Inputs for function strchr_initialization: @@ -1384,7 +1406,7 @@ tests/non-free/strchr.c:49:[value] Call to builtin Frama_C_strchr(({{ garbled mi ""[bits 0 to 7]; "b\000c"; "abcd"[bits 0 to 39]; "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[bits 0 to 215]; "hello"[bits 0 to 47] [inout] Out (internal) for function strchr_large_uninit: - Frama_C_entropy_source; c; a[0..99]; offset; z1; z2; z3 + Frama_C_entropy_source; c; a{[0..39]; [50..94]; [98]}; offset; z1; z2; z3 [inout] Inputs for function strchr_large_uninit: Frama_C_entropy_source; nondet; ""[bits 0 to 7]; "a"[bits 0 to 15]; "aa"[bits 0 to 23]; "aaa"; "aaaa"[bits 0 to 39]; "aaaaa"[bits 0 to 47]; diff --git a/tests/non-free/oracle/strlen.res.oracle b/tests/non-free/oracle/strlen.res.oracle index dbb359b69916b8e84db418f2aa0366bb2ac7f058..c1f907990e19b3c34302cba1c2b758e7a7a221c6 100644 --- a/tests/non-free/oracle/strlen.res.oracle +++ b/tests/non-free/oracle/strlen.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/strlen.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -33,7 +32,7 @@ [11] ∈ {100} nondet ∈ [--..--] [value] computing for function small_sets <- main. - Called from tests/non-free/strlen.c:309. + Called from tests/non-free/strlen.c:334. tests/non-free/strlen.c:60:[value] Call to builtin Frama_C_strlen(({{ "abc" + {0; 1} }})) tests/non-free/strlen.c:61:[value] assertion got status valid. tests/non-free/strlen.c:65:[value] Call to builtin Frama_C_strlen(({{ "\000bc" + {0; 1} }})) @@ -48,7 +47,7 @@ tests/non-free/strlen.c:82:[value] assertion got status valid. [value] Recording results for small_sets [value] Done for function small_sets [value] computing for function zero_termination <- main. - Called from tests/non-free/strlen.c:310. + Called from tests/non-free/strlen.c:335. tests/non-free/strlen.c:89:[value] Call to builtin Frama_C_strlen(({{ &empty_or_non_terminated[0] }})) tests/non-free/strlen.c:89:[value] warning: builtin Frama_C_strlen: possibly reading indeterminate data tests/non-free/strlen.c:90:[value] assertion got status valid. @@ -59,7 +58,7 @@ tests/non-free/strlen.c:97:[value] warning: builtin Frama_C_strlen: reading inde [value] Recording results for zero_termination [value] Done for function zero_termination [value] computing for function strlen_initialization <- main. - Called from tests/non-free/strlen.c:311. + Called from tests/non-free/strlen.c:336. [value] computing for function my_strlen <- strlen_initialization <- main. Called from tests/non-free/strlen.c:105. tests/non-free/strlen.c:54:[value] Call to builtin Frama_C_strlen(({{ &empty_or_uninitialized[0] }})) @@ -87,7 +86,7 @@ tests/non-free/strlen.c:125:[value] assertion got status valid. [value] Recording results for strlen_initialization [value] Done for function strlen_initialization [value] computing for function strlen_large <- main. - Called from tests/non-free/strlen.c:312. + Called from tests/non-free/strlen.c:337. [value] computing for function init_array_nondet <- strlen_large <- main. Called from tests/non-free/strlen.c:168. tests/non-free/strlen.c:161:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{100})) @@ -148,7 +147,7 @@ tests/non-free/strlen.c:190:[value] assertion got status valid. [value] Recording results for strlen_large [value] Done for function strlen_large [value] computing for function strlen_large_uninit <- main. - Called from tests/non-free/strlen.c:313. + Called from tests/non-free/strlen.c:338. [value] computing for function init_array_nondet <- strlen_large_uninit <- main. Called from tests/non-free/strlen.c:197. tests/non-free/strlen.c:161:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{40})) @@ -189,7 +188,7 @@ tests/non-free/strlen.c:213:[value] assertion got status valid. [value] Recording results for strlen_large_uninit [value] Done for function strlen_large_uninit [value] computing for function misc <- main. - Called from tests/non-free/strlen.c:314. + Called from tests/non-free/strlen.c:339. tests/non-free/strlen.c:241:[value] Call to builtin Frama_C_strlen(({{ &unterminated_string[0] }})) tests/non-free/strlen.c:241:[value] warning: builtin Frama_C_strlen: reading indeterminate data tests/non-free/strlen.c:244:[value] Call to builtin Frama_C_strlen(({{ "Hello World\n" ; "Bonjour Monde\n" }})) @@ -230,19 +229,19 @@ tests/non-free/strlen.c:278:[value] assertion got status valid. [value] Recording results for misc [value] Done for function misc [value] computing for function bitfields <- main. - Called from tests/non-free/strlen.c:315. + Called from tests/non-free/strlen.c:340. tests/non-free/strlen.c:140:[value] Call to builtin Frama_C_strlen(({{ (char const *)&s }})) tests/non-free/strlen.c:140:[value] warning: builtin Frama_C_strlen: reading indeterminate data [value] Recording results for bitfields [value] Done for function bitfields [value] computing for function bitfields2 <- main. - Called from tests/non-free/strlen.c:316. + Called from tests/non-free/strlen.c:341. tests/non-free/strlen.c:155:[value] Call to builtin Frama_C_strlen(({{ (char const *)&s }})) tests/non-free/strlen.c:156:[value] assertion got status valid. [value] Recording results for bitfields2 [value] Done for function bitfields2 [value] computing for function escaping <- main. - Called from tests/non-free/strlen.c:317. + Called from tests/non-free/strlen.c:342. tests/non-free/strlen.c:222:[value] warning: locals {x} escaping the scope of a block of escaping through s tests/non-free/strlen.c:225:[value] Call to builtin Frama_C_strlen(({{ &s[0] }})) tests/non-free/strlen.c:225:[value] warning: builtin Frama_C_strlen: possible escaping addresses @@ -252,7 +251,7 @@ tests/non-free/strlen.c:229:[value] assertion got status valid. [value] Recording results for escaping [value] Done for function escaping [value] computing for function big_array <- main. - Called from tests/non-free/strlen.c:318. + Called from tests/non-free/strlen.c:343. tests/non-free/strlen.c:287:[value] warning: out of bounds write. assert \valid(p); tests/non-free/strlen.c:289:[value] warning: out of bounds write. assert \valid(p); tests/non-free/strlen.c:291:[value] warning: out of bounds write. assert \valid(p); @@ -264,7 +263,7 @@ tests/non-free/strlen.c:298:[value] warning: builtin Frama_C_strlen: possible un tests/non-free/strlen.c:299:[value] Call to builtin Frama_C_strlen(({{ (char const *)&t }})) tests/non-free/strlen.c:299:[kernel] more than 200(1000000) locations to update in array. Approximating. tests/non-free/strlen.c:299:[value] warning: builtin Frama_C_strlen: possible uninitialized values -[value] Called Frama_C_show_each({1}, {1}, {1}) +tests/non-free/strlen.c:300:[value] Frama_C_show_each: {1}, {1}, {1} tests/non-free/strlen.c:302:[value] Call to builtin Frama_C_strlen(({{ &u + [-8589934592..8589934588],0%4 }})) tests/non-free/strlen.c:302:[value] warning: builtin Frama_C_strlen: possible uninitialized values @@ -279,9 +278,52 @@ tests/non-free/strlen.c:304:[kernel] more than 200(1000000) locations to update tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: possible uninitialized values possibly reading indeterminate data -[value] Called Frama_C_show_each({0; 1; 2; 3}, [0..800], [0..3999996]) +tests/non-free/strlen.c:305:[value] Frama_C_show_each: {0; 1; 2; 3}, [0..800], [0..3999996] [value] Recording results for big_array [value] Done for function big_array +[value] computing for function negative_offsets <- main. + Called from tests/non-free/strlen.c:344. +tests/non-free/strlen.c:310:[value] entering loop for the first time +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strlen.c:314. +[value] Done for function Frama_C_interval +tests/non-free/strlen.c:315:[value] Call to builtin Frama_C_strlen(({{ &buf{[-10], [-9], [-8]} }})) +tests/non-free/strlen.c:315:[value] warning: builtin Frama_C_strlen: reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strlen.c:318. +[value] Done for function Frama_C_interval +tests/non-free/strlen.c:319:[value] Call to builtin Frama_C_strlen(({{ &buf{[-2], [-1]} }})) +tests/non-free/strlen.c:319:[value] warning: builtin Frama_C_strlen: reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strlen.c:321. +[value] Done for function Frama_C_interval +tests/non-free/strlen.c:322:[value] Call to builtin Frama_C_strlen(({{ &buf{[-1], [0]} }})) +tests/non-free/strlen.c:322:[value] warning: builtin Frama_C_strlen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strlen.c:323. +[value] Done for function Frama_C_interval +tests/non-free/strlen.c:324:[value] Call to builtin Frama_C_strlen(({{ &buf{[-1], [0], [1], [2]} }})) +tests/non-free/strlen.c:324:[value] warning: builtin Frama_C_strlen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strlen.c:325. +[value] Done for function Frama_C_interval +tests/non-free/strlen.c:326:[value] Call to builtin Frama_C_strlen(({{ &buf + [-4..7] }})) +tests/non-free/strlen.c:326:[value] warning: builtin Frama_C_strlen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strlen.c:327. +[value] Done for function Frama_C_interval +tests/non-free/strlen.c:329:[value] Call to builtin Frama_C_strlen(({{ &buf + [-10..0] }})) +tests/non-free/strlen.c:329:[value] warning: builtin Frama_C_strlen: + possible uninitialized values + possibly reading indeterminate data +[value] Recording results for negative_offsets +[value] Done for function negative_offsets [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -349,6 +391,21 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: [1] ∈ {0} [value:final-states] Values at end of function my_strlen: __retres ∈ [0..54] +[value:final-states] Values at end of function negative_offsets: + Frama_C_entropy_source ∈ [--..--] + buf[0..98] ∈ {65} or UNINITIALIZED + [99] ∈ {0} + len1 ∈ UNINITIALIZED + len2 ∈ UNINITIALIZED + len3 ∈ {99} + len4 ∈ {97; 98; 99} + len5 ∈ {92; 93; 94; 95; 96; 97; 98; 99} + len6 ∈ {99} + offset3 ∈ {-1; 0} + offset4 ∈ {-1; 0; 1; 2} + offset5 ∈ [-4..7] + offset6 ∈ [-10..0] + p ∈ {{ &buf + [-10..0] }} [value:final-states] Values at end of function small_sets: s ∈ {{ "b\000c" }} p ∈ {{ "b\000c" + {0; 2} }} @@ -427,6 +484,8 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: [from] Done for function misc [from] Computing for function my_strlen [from] Done for function my_strlen +[from] Computing for function negative_offsets +[from] Done for function negative_offsets [from] Computing for function small_sets [from] Done for function small_sets [from] Computing for function strlen_initialization @@ -454,7 +513,7 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: non_terminated2[2..3]; empty_or_uninitialized[0]; uninitialized[0]; s[0..1]; t[0..3]; s; s; a[3..99]; a[3..99]; s[0..3]; loc_char_array[0..4]; x; maybe_init[0..1]; - t[0..999999]; u[0..199]; r[0..200]; + t[0..999999]; u[0..199]; r[0..200]; buf[0..99]; "Hello World\n"[bits 0 to 103]; "abc\000\000\000abc"[bits 0 to 79]; ""[bits 0 to 7]; "a"[bits 0 to 15]; "aa"[bits 0 to 23]; "aaa"; @@ -493,6 +552,8 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: "Bonjour Monde\n"[bits 0 to 119]; "abc"; "ABCD"[bits 0 to 39]; "efg"[bits 8 to 31]; "EFGH"[bits 8 to 39]; "mno\000pqr"[bits 0 to 63]; "MNOP\000QRS"[bits 0 to 71] +[from] Function negative_offsets: + Frama_C_entropy_source FROM Frama_C_entropy_source; nondet (and SELF) [from] Function small_sets: NO EFFECTS [from] Function strlen_initialization: @@ -504,7 +565,7 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: [from] Function zero_termination: NO EFFECTS [from] Function main: - Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) + Frama_C_entropy_source FROM Frama_C_entropy_source; nondet (and SELF) \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function big_array: @@ -524,7 +585,7 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: [inout] Inputs for function escaping: nondet [inout] Out (internal) for function init_array_nondet: - from; to; val1; val2; val; tmp; a[0..99]; a[0..99] + from; to; val1; val2; val; tmp; a[0..99]; a{[0..39]; [50..94]} [inout] Inputs for function init_array_nondet: nondet [inout] Out (internal) for function misc: @@ -547,6 +608,11 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: [inout] Inputs for function my_strlen: empty_or_uninitialized[0]; uninitialized[0]; s[0..1]; t[0..3]; a[0..99]; a[0..99] +[inout] Out (internal) for function negative_offsets: + Frama_C_entropy_source; buf[0..99]; i; len1; len2; len3; len4; len5; + len6; offset1; offset2; offset3; offset4; offset5; offset6; p +[inout] Inputs for function negative_offsets: + Frama_C_entropy_source; nondet [inout] Out (internal) for function small_sets: s; p; tmp; z1; tmp_0; z2; tmp_1; z3; tmp_2; z4; tmp_3; t[0..3]; z5; tmp_4 [inout] Inputs for function small_sets: @@ -560,7 +626,7 @@ tests/non-free/strlen.c:304:[value] warning: builtin Frama_C_strlen: [inout] Inputs for function strlen_large: Frama_C_entropy_source; nondet [inout] Out (internal) for function strlen_large_uninit: - Frama_C_entropy_source; a[0..99]; offset; z1; z2; z3 + Frama_C_entropy_source; a{[0..39]; [50..94]; [98]}; offset; z1; z2; z3 [inout] Inputs for function strlen_large_uninit: Frama_C_entropy_source; nondet [inout] Out (internal) for function zero_termination: diff --git a/tests/non-free/oracle/strlen_align.res.oracle b/tests/non-free/oracle/strlen_align.res.oracle index 477c6c307d9e6f00afc4424896329d88390172db..e550aa081fe56a1ef00b401ffccc97a98b1cd36f 100644 --- a/tests/non-free/oracle/strlen_align.res.oracle +++ b/tests/non-free/oracle/strlen_align.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/strlen_align.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/non-free/oracle/strnlen.res.oracle b/tests/non-free/oracle/strnlen.res.oracle index 5eff9b611d489c7273b3812d605b4df1fd8d60ee..60b55f79cfa55d14d6cd5432aad378bef71b8ecb 100644 --- a/tests/non-free/oracle/strnlen.res.oracle +++ b/tests/non-free/oracle/strnlen.res.oracle @@ -1,9 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/non-free/strnlen.i (no preprocessing) +[kernel] Parsing tests/non-free/strnlen.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] t1[0] ∈ {97} [1] ∈ {98} [2] ∈ {99} @@ -15,14 +20,21 @@ [3] ∈ {100} [4] ∈ {101} [5] ∈ {0} -tests/non-free/strnlen.i:9:[value] Call to builtin Frama_C_strnlen(({{ &t1[0] }},{3})) -tests/non-free/strnlen.i:10:[value] Call to builtin Frama_C_strnlen(({{ &t1[0] }},{5})) -tests/non-free/strnlen.i:11:[value] Call to builtin Frama_C_strnlen(({{ &t1[0] }},{6})) -tests/non-free/strnlen.i:11:[value] warning: builtin Frama_C_strnlen: reading indeterminate data -tests/non-free/strnlen.i:13:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] }},{3})) -tests/non-free/strnlen.i:14:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] }},{5})) -tests/non-free/strnlen.i:15:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] }},{6})) -[value] DUMPING STATE of file tests/non-free/strnlen.i line 17 +tests/non-free/strnlen.c:9:[value] Call to builtin Frama_C_strnlen(({{ &t1[0] }},{3})) +tests/non-free/strnlen.c:10:[value] Call to builtin Frama_C_strnlen(({{ &t1[0] }},{5})) +tests/non-free/strnlen.c:11:[value] Call to builtin Frama_C_strnlen(({{ &t1[0] }},{6})) +tests/non-free/strnlen.c:11:[value] warning: builtin Frama_C_strnlen: reading indeterminate data +tests/non-free/strnlen.c:13:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] }},{3})) +tests/non-free/strnlen.c:14:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] }},{5})) +tests/non-free/strnlen.c:15:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] }},{6})) +tests/non-free/strnlen.c:17:[value] Frama_C_dump_each: + # Cvalue domain: + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] t1[0] ∈ {97} [1] ∈ {98} [2] ∈ {99} @@ -47,11 +59,10 @@ tests/non-free/strnlen.i:15:[value] Call to builtin Frama_C_strnlen(({{ &t2[0] } tmp_3 ∈ {5} tmp_4 ∈ {5} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/non-free/strnlen.i:9:[kernel] warning: Neither code nor specification for function Frama_C_strnlen, generating default assigns from the prototype [value:final-states] Values at end of function main: r1a ∈ {3} r1b ∈ {5} @@ -60,19 +71,19 @@ tests/non-free/strnlen.i:9:[kernel] warning: Neither code nor specification for r2c ∈ {5} __retres ∈ {0} [from] Computing for function main -[from] Computing for function Frama_C_strnlen <-main -[from] Done for function Frama_C_strnlen +[from] Computing for function strnlen <-main +[from] Done for function strnlen [from] Computing for function Frama_C_dump_each <-main [from] Done for function Frama_C_dump_each [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_strnlen: - \result FROM \nothing +[from] Function strnlen: + \result FROM t1[0..4]; t2[0..5] [from] Function main: \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: r1a; r1b; r2a; r2b; r2c; tmp; tmp_0; tmp_1; tmp_2; tmp_3; tmp_4; __retres [inout] Inputs for function main: - \nothing + t1[0..4]; t2[0..5] diff --git a/tests/non-free/oracle/strnlen2.res.oracle b/tests/non-free/oracle/strnlen2.res.oracle index 2b1a9ed7cddde5dad702500e7cb590d02ab85afd..d1fb216242b3020a454d59945922e72b26b3eac0 100644 --- a/tests/non-free/oracle/strnlen2.res.oracle +++ b/tests/non-free/oracle/strnlen2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/strnlen2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -33,7 +32,7 @@ [11] ∈ {100} nondet ∈ [--..--] [value] computing for function small_sets <- main. - Called from tests/non-free/strnlen2.c:488. + Called from tests/non-free/strnlen2.c:513. tests/non-free/strnlen2.c:45:[value] Call to builtin Frama_C_strnlen(({{ "abc" + {0; 1} }},{3})) tests/non-free/strnlen2.c:46:[value] assertion got status valid. tests/non-free/strnlen2.c:49:[value] Call to builtin Frama_C_strnlen(({{ "\000bc" + {0; 1} }},{2})) @@ -47,7 +46,7 @@ tests/non-free/strnlen2.c:62:[value] assertion got status valid. [value] Recording results for small_sets [value] Done for function small_sets [value] computing for function zero_termination <- main. - Called from tests/non-free/strnlen2.c:489. + Called from tests/non-free/strnlen2.c:514. tests/non-free/strnlen2.c:68:[value] Call to builtin Frama_C_strnlen(({{ &empty_or_non_terminated[0] }},{1})) tests/non-free/strnlen2.c:69:[value] assertion got status valid. tests/non-free/strnlen2.c:73:[value] Call to builtin Frama_C_strnlen(({{ &non_terminated[0] }},{2})) @@ -57,7 +56,7 @@ tests/non-free/strnlen2.c:79:[value] warning: builtin Frama_C_strnlen: reading i [value] Recording results for zero_termination [value] Done for function zero_termination [value] computing for function initialization <- main. - Called from tests/non-free/strnlen2.c:491. + Called from tests/non-free/strnlen2.c:516. tests/non-free/strnlen2.c:85:[value] Call to builtin Frama_C_strnlen(({{ &empty_or_uninitialized[0] }},{1})) tests/non-free/strnlen2.c:85:[value] warning: builtin Frama_C_strnlen: possible uninitialized values tests/non-free/strnlen2.c:86:[value] assertion got status valid. @@ -72,7 +71,7 @@ tests/non-free/strnlen2.c:102:[value] assertion got status valid. [value] Recording results for initialization [value] Done for function initialization [value] computing for function large <- main. - Called from tests/non-free/strnlen2.c:492. + Called from tests/non-free/strnlen2.c:517. [value] computing for function init_array_nondet <- large <- main. Called from tests/non-free/strnlen2.c:144. tests/non-free/strnlen2.c:138:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{100})) @@ -115,7 +114,7 @@ tests/non-free/strnlen2.c:166:[value] assertion got status valid. [value] Recording results for large [value] Done for function large [value] computing for function large_uninit <- main. - Called from tests/non-free/strnlen2.c:493. + Called from tests/non-free/strnlen2.c:518. [value] computing for function init_array_nondet <- large_uninit <- main. Called from tests/non-free/strnlen2.c:171. tests/non-free/strnlen2.c:138:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{40})) @@ -149,7 +148,7 @@ tests/non-free/strnlen2.c:187:[value] assertion got status valid. [value] Recording results for large_uninit [value] Done for function large_uninit [value] computing for function misc <- main. - Called from tests/non-free/strnlen2.c:494. + Called from tests/non-free/strnlen2.c:519. tests/non-free/strnlen2.c:215:[value] Call to builtin Frama_C_strnlen(({{ &unterminated_string[0] }},{13})) tests/non-free/strnlen2.c:215:[value] warning: builtin Frama_C_strnlen: reading indeterminate data tests/non-free/strnlen2.c:218:[value] Call to builtin Frama_C_strnlen(({{ "Hello World\n" ; "Bonjour Monde\n" }}, @@ -194,19 +193,19 @@ tests/non-free/strnlen2.c:252:[value] assertion got status valid. [value] Recording results for misc [value] Done for function misc [value] computing for function bitfields <- main. - Called from tests/non-free/strnlen2.c:495. + Called from tests/non-free/strnlen2.c:520. tests/non-free/strnlen2.c:117:[value] Call to builtin Frama_C_strnlen(({{ (char const *)&s }},{3})) tests/non-free/strnlen2.c:117:[value] warning: builtin Frama_C_strnlen: reading indeterminate data [value] Recording results for bitfields [value] Done for function bitfields [value] computing for function bitfields2 <- main. - Called from tests/non-free/strnlen2.c:496. + Called from tests/non-free/strnlen2.c:521. tests/non-free/strnlen2.c:132:[value] Call to builtin Frama_C_strnlen(({{ (char const *)&s }},{3})) tests/non-free/strnlen2.c:133:[value] assertion got status valid. [value] Recording results for bitfields2 [value] Done for function bitfields2 [value] computing for function escaping <- main. - Called from tests/non-free/strnlen2.c:497. + Called from tests/non-free/strnlen2.c:522. tests/non-free/strnlen2.c:196:[value] warning: locals {x} escaping the scope of a block of escaping through s tests/non-free/strnlen2.c:199:[value] Call to builtin Frama_C_strnlen(({{ &s[0] }},{4})) tests/non-free/strnlen2.c:199:[value] warning: builtin Frama_C_strnlen: possible escaping addresses @@ -216,7 +215,7 @@ tests/non-free/strnlen2.c:203:[value] assertion got status valid. [value] Recording results for escaping [value] Done for function escaping [value] computing for function big_array <- main. - Called from tests/non-free/strnlen2.c:498. + Called from tests/non-free/strnlen2.c:523. tests/non-free/strnlen2.c:261:[value] warning: out of bounds write. assert \valid(p); tests/non-free/strnlen2.c:263:[value] warning: out of bounds write. assert \valid(p); tests/non-free/strnlen2.c:265:[value] warning: out of bounds write. assert \valid(p); @@ -231,7 +230,7 @@ tests/non-free/strnlen2.c:274:[value] warning: builtin Frama_C_strnlen: possible tests/non-free/strnlen2.c:275:[value] assertion got status valid. tests/non-free/strnlen2.c:276:[value] assertion got status valid. tests/non-free/strnlen2.c:277:[value] assertion got status valid. -[value] Called Frama_C_show_each({1}, {1}, {1}) +tests/non-free/strnlen2.c:278:[value] Frama_C_show_each: {1}, {1}, {1} tests/non-free/strnlen2.c:282:[value] Call to builtin Frama_C_strnlen(({{ &u + [-8589934592..8589934588],0%4 }}, {801})) tests/non-free/strnlen2.c:282:[value] warning: builtin Frama_C_strnlen: @@ -252,7 +251,7 @@ tests/non-free/strnlen2.c:284:[value] warning: builtin Frama_C_strnlen: tests/non-free/strnlen2.c:285:[value] assertion got status valid. tests/non-free/strnlen2.c:286:[value] assertion got status valid. tests/non-free/strnlen2.c:287:[value] assertion got status valid. -[value] Called Frama_C_show_each({0; 1; 2; 3}, [0..800], [0..3999996]) +tests/non-free/strnlen2.c:288:[value] Frama_C_show_each: {0; 1; 2; 3}, [0..800], [0..3999996] [value] computing for function init_array_nondet <- big_array <- main. Called from tests/non-free/strnlen2.c:291. tests/non-free/strnlen2.c:138:[value] Call to builtin memset(({{ (void *)&u }},{0; 1},{800})) @@ -279,7 +278,7 @@ tests/non-free/strnlen2.c:302:[kernel] more than 200(1000000) locations to updat tests/non-free/strnlen2.c:303:[value] assertion got status valid. tests/non-free/strnlen2.c:304:[value] assertion got status valid. tests/non-free/strnlen2.c:305:[value] assertion got status valid. -[value] Called Frama_C_show_each([0..800], [0..804], [0..4000000]) +tests/non-free/strnlen2.c:306:[value] Frama_C_show_each: [0..800], [0..804], [0..4000000] tests/non-free/strnlen2.c:308:[value] Call to builtin Frama_C_strnlen(({{ &u + [-8589934592..8589934588],0%4 }}, {801})) tests/non-free/strnlen2.c:308:[value] warning: builtin Frama_C_strnlen: possibly reading indeterminate data @@ -294,11 +293,11 @@ tests/non-free/strnlen2.c:310:[value] warning: builtin Frama_C_strnlen: possibly tests/non-free/strnlen2.c:311:[value] assertion got status valid. tests/non-free/strnlen2.c:312:[value] assertion got status valid. tests/non-free/strnlen2.c:313:[value] assertion got status valid. -[value] Called Frama_C_show_each([0..799], [0..803], [0..3999999]) +tests/non-free/strnlen2.c:314:[value] Frama_C_show_each: [0..799], [0..803], [0..3999999] [value] Recording results for big_array [value] Done for function big_array [value] computing for function no_zero_but_ok <- main. - Called from tests/non-free/strnlen2.c:500. + Called from tests/non-free/strnlen2.c:525. tests/non-free/strnlen2.c:325:[value] Call to builtin Frama_C_strnlen(({{ &s[0] }},{5})) tests/non-free/strnlen2.c:326:[value] assertion got status valid. tests/non-free/strnlen2.c:327:[value] Call to builtin Frama_C_strnlen(({{ &s[0] }},{10})) @@ -313,7 +312,7 @@ tests/non-free/strnlen2.c:337:[value] assertion got status valid. [value] Recording results for no_zero_but_ok [value] Done for function no_zero_but_ok [value] computing for function small_sets_n <- main. - Called from tests/non-free/strnlen2.c:501. + Called from tests/non-free/strnlen2.c:526. tests/non-free/strnlen2.c:345:[value] Call to builtin Frama_C_strnlen(({{ "abcde" + {0; 1} }},{2; 5})) tests/non-free/strnlen2.c:346:[value] assertion got status valid. tests/non-free/strnlen2.c:351:[value] Call to builtin Frama_C_strnlen(({{ "\000bcdef" + {0; 1} }},{1; 4})) @@ -327,7 +326,7 @@ tests/non-free/strnlen2.c:367:[value] assertion got status valid. [value] Recording results for small_sets_n [value] Done for function small_sets_n [value] computing for function large_n <- main. - Called from tests/non-free/strnlen2.c:502. + Called from tests/non-free/strnlen2.c:527. [value] computing for function init_array_nondet <- large_n <- main. Called from tests/non-free/strnlen2.c:372. tests/non-free/strnlen2.c:138:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{100})) @@ -387,7 +386,7 @@ tests/non-free/strnlen2.c:415:[value] assertion got status valid. [value] Recording results for large_n [value] Done for function large_n [value] computing for function unbounded_n <- main. - Called from tests/non-free/strnlen2.c:504. + Called from tests/non-free/strnlen2.c:529. tests/non-free/strnlen2.c:423:[value] Call to builtin Frama_C_strnlen(({{ "abc" }},[0..2147483647])) tests/non-free/strnlen2.c:424:[value] assertion got status valid. tests/non-free/strnlen2.c:426:[value] Call to builtin Frama_C_strnlen(({{ "abc" + {0; 1} }},[0..2147483647])) @@ -397,7 +396,7 @@ tests/non-free/strnlen2.c:430:[value] assertion got status valid. [value] Recording results for unbounded_n [value] Done for function unbounded_n [value] computing for function intervals <- main. - Called from tests/non-free/strnlen2.c:505. + Called from tests/non-free/strnlen2.c:530. [value] computing for function init_array_nondet <- intervals <- main. Called from tests/non-free/strnlen2.c:435. tests/non-free/strnlen2.c:138:[value] Call to builtin memset(({{ (void *)&a }},{0; 1},{10})) @@ -517,6 +516,49 @@ tests/non-free/strnlen2.c:483:[value] warning: builtin Frama_C_strnlen: tests/non-free/strnlen2.c:484:[value] assertion got status valid. [value] Recording results for intervals [value] Done for function intervals +[value] computing for function negative_offsets <- main. + Called from tests/non-free/strnlen2.c:532. +tests/non-free/strnlen2.c:489:[value] entering loop for the first time +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strnlen2.c:493. +[value] Done for function Frama_C_interval +tests/non-free/strnlen2.c:494:[value] Call to builtin Frama_C_strnlen(({{ &buf{[-10], [-9], [-8]} }},{100})) +tests/non-free/strnlen2.c:494:[value] warning: builtin Frama_C_strnlen: reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strnlen2.c:497. +[value] Done for function Frama_C_interval +tests/non-free/strnlen2.c:498:[value] Call to builtin Frama_C_strnlen(({{ &buf{[-2], [-1]} }},{100})) +tests/non-free/strnlen2.c:498:[value] warning: builtin Frama_C_strnlen: reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strnlen2.c:500. +[value] Done for function Frama_C_interval +tests/non-free/strnlen2.c:501:[value] Call to builtin Frama_C_strnlen(({{ &buf{[-1], [0]} }},{100})) +tests/non-free/strnlen2.c:501:[value] warning: builtin Frama_C_strnlen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strnlen2.c:502. +[value] Done for function Frama_C_interval +tests/non-free/strnlen2.c:503:[value] Call to builtin Frama_C_strnlen(({{ &buf{[-1], [0], [1], [2]} }},{100})) +tests/non-free/strnlen2.c:503:[value] warning: builtin Frama_C_strnlen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strnlen2.c:504. +[value] Done for function Frama_C_interval +tests/non-free/strnlen2.c:505:[value] Call to builtin Frama_C_strnlen(({{ &buf + [-4..7] }},{100})) +tests/non-free/strnlen2.c:505:[value] warning: builtin Frama_C_strnlen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/strnlen2.c:506. +[value] Done for function Frama_C_interval +tests/non-free/strnlen2.c:508:[value] Call to builtin Frama_C_strnlen(({{ &buf + [-10..0] }},{100})) +tests/non-free/strnlen2.c:508:[value] warning: builtin Frama_C_strnlen: + possible uninitialized values + possibly reading indeterminate data +[value] Recording results for negative_offsets +[value] Done for function negative_offsets [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -662,6 +704,21 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. s2 ∈ {{ "efg" + {1; 2} ; "EFGH" + {1; 2} }} maybe_init[0] ∈ {65} or UNINITIALIZED [1] ∈ {0} +[value:final-states] Values at end of function negative_offsets: + Frama_C_entropy_source ∈ [--..--] + buf[0..98] ∈ {65} or UNINITIALIZED + [99] ∈ {0} + len1 ∈ UNINITIALIZED + len2 ∈ UNINITIALIZED + len3 ∈ {99} + len4 ∈ {97; 98; 99} + len5 ∈ {92; 93; 94; 95; 96; 97; 98; 99} + len6 ∈ {99} + offset3 ∈ {-1; 0} + offset4 ∈ {-1; 0; 1; 2} + offset5 ∈ [-4..7] + offset6 ∈ [-10..0] + p ∈ {{ &buf + [-10..0] }} [value:final-states] Values at end of function no_zero_but_ok: s[0..9] ∈ {1} [10] ∈ {0} @@ -739,6 +796,8 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. [from] Done for function large_uninit [from] Computing for function misc [from] Done for function misc +[from] Computing for function negative_offsets +[from] Done for function negative_offsets [from] Computing for function no_zero_but_ok [from] Done for function no_zero_but_ok [from] Computing for function small_sets @@ -772,7 +831,7 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. uninitialized[0]; s[0..1]; t[0..3]; s; s; a[3..99]; a[3..99]; s[0..3]; loc_char_array[0..4]; x; maybe_init[0..1]; u[0..199]; r[0..200]; t[0..999999]; s[0..19]; a[0..99]; a[0..99]; - "Hello World\n"[bits 0 to 103]; + buf[0..99]; "Hello World\n"[bits 0 to 103]; "abc\000\000\000abc"[bits 0 to 79]; ""[bits 0 to 7]; "a"[bits 0 to 15]; "aa"[bits 0 to 23]; "aaa"; "aaaa"[bits 0 to 39]; "aaaaa"[bits 0 to 47]; @@ -813,6 +872,8 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) [from] Function misc: Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) +[from] Function negative_offsets: + Frama_C_entropy_source FROM Frama_C_entropy_source; nondet (and SELF) [from] Function no_zero_but_ok: NO EFFECTS [from] Function small_sets: @@ -824,7 +885,7 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. [from] Function zero_termination: NO EFFECTS [from] Function main: - Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) + Frama_C_entropy_source FROM Frama_C_entropy_source; nondet (and SELF) \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function bitfields: @@ -840,8 +901,8 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. [inout] Inputs for function escaping: nondet [inout] Out (internal) for function init_array_nondet: - from; to; val1; val2; val; tmp; a[0..99]; a[0..99]; u[0..199]; r[0..200]; - t[0..999999]; a[0..99]; a[0..99] + from; to; val1; val2; val; tmp; a[0..99]; a{[0..39]; [50..94]}; u[0..199]; + r[0..200]; t[0..999999]; a[0..99]; a{[0..9]; [11..19]} [inout] Inputs for function init_array_nondet: nondet [inout] Out (internal) for function big_array: @@ -853,9 +914,9 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. [inout] Inputs for function initialization: nondet [inout] Out (internal) for function intervals: - Frama_C_entropy_source; a[0..99]; offset; n; z1; tmp_1; z2; tmp_2; - z3; tmp_3; z4; tmp_4; z5; tmp_5; z6; tmp_6; z7; tmp_7; z8; tmp_8; z9; - tmp_9 + Frama_C_entropy_source; a{[0..9]; [11..19]}; offset; n; z1; tmp_1; + z2; tmp_2; z3; tmp_3; z4; tmp_4; z5; tmp_5; z6; tmp_6; z7; tmp_7; z8; + tmp_8; z9; tmp_9 [inout] Inputs for function intervals: Frama_C_entropy_source; nondet [inout] Out (internal) for function large: @@ -870,7 +931,8 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. [inout] Inputs for function large_n: Frama_C_entropy_source; nondet [inout] Out (internal) for function large_uninit: - Frama_C_entropy_source; a[0..99]; offset; z1; tmp_0; z2; tmp_1; z3; tmp_2 + Frama_C_entropy_source; a{[0..39]; [50..94]; [98]}; offset; z1; tmp_0; + z2; tmp_1; z3; tmp_2 [inout] Inputs for function large_uninit: Frama_C_entropy_source; nondet [inout] Out (internal) for function misc: @@ -888,6 +950,11 @@ tests/non-free/strnlen2.c:484:[value] assertion got status valid. "Bonjour Monde\n"[bits 0 to 119]; "abc"; "ABCD"[bits 0 to 39]; "efg"[bits 8 to 31]; "EFGH"[bits 8 to 39]; "mno\000pqr"[bits 0 to 63]; "MNOP\000QRS"[bits 0 to 71] +[inout] Out (internal) for function negative_offsets: + Frama_C_entropy_source; buf[0..99]; i; len1; len2; len3; len4; len5; + len6; offset1; offset2; offset3; offset4; offset5; offset6; p +[inout] Inputs for function negative_offsets: + Frama_C_entropy_source; nondet [inout] Out (internal) for function no_zero_but_ok: s[0..19]; z1; tmp; z2; tmp_0; p; tmp_1; z3; tmp_2; z4; tmp_3; z5; tmp_4 [inout] Inputs for function no_zero_but_ok: diff --git a/tests/spec/oracle/custom_annot_char.err.oracle b/tests/non-free/oracle/vla.err.oracle similarity index 100% rename from tests/spec/oracle/custom_annot_char.err.oracle rename to tests/non-free/oracle/vla.err.oracle diff --git a/tests/non-free/oracle/vla.res.oracle b/tests/non-free/oracle/vla.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..d98bba2bf50423ddddf48340f2cfa5d5bdaa6740 --- /dev/null +++ b/tests/non-free/oracle/vla.res.oracle @@ -0,0 +1,109 @@ +[kernel] Parsing tests/non-free/vla.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value] assertion 'alloca_bounds' got status valid. +tests/non-free/vla.c:6:[value] allocating variable __malloc_f_l6 +tests/non-free/vla.c:6:[kernel] warning: Neither code nor specification for function __fc_vla_alloc, generating default assigns from the prototype +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63) to fit 0..95 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:8:[value] warning: out of bounds write. assert \valid(t + i); +tests/non-free/vla.c:9:[value] warning: out of bounds read. assert \valid_read(t + i); +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/95) to fit 0..127 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/127) to fit 0..159 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/159) to fit 0..191 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/191) to fit 0..223 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/223) to fit 0..255 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/255) to fit 0..287 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] computing for function f <- main. + Called from tests/non-free/vla.c:20. +tests/non-free/vla.c:6:[value:malloc] resizing variable `__malloc_f_l6' (0..63/287) to fit 0..319 +tests/non-free/vla.c:7:[value] Frama_C_show_each: {{ &__malloc_f_l6 }} +tests/non-free/vla.c:6:[value:malloc] strong free on bases: {__malloc_f_l6} +[value] Recording results for f +[value] Done for function f +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function f: + t ∈ ESCAPINGADDR + __lengthof_t ∈ [2..10] +[value:final-states] Values at end of function main: + i ∈ {10} +[from] Computing for function f +[from] Computing for function __fc_vla_alloc <-f +[from] Done for function __fc_vla_alloc +[from] Computing for function __fc_vla_free <-f +tests/non-free/vla.c:6:[kernel] warning: Neither code nor specification for function __fc_vla_free, generating default assigns from the prototype +[from] Done for function __fc_vla_free +[from] Done for function f +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function __fc_vla_alloc: + \result FROM \nothing +[from] Function __fc_vla_free: + NO EFFECTS +[from] Function f: + __malloc_f_l6[1..9] FROM i (and SELF) +[from] Function main: + __malloc_f_l6[1..9] FROM \nothing (and SELF) +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function f: + t; __lengthof_t; __malloc_f_l6[1..9] +[inout] Inputs for function f: + __malloc_f_l6[1..9] +[inout] Out (internal) for function main: + i; __malloc_f_l6[1..9] +[inout] Inputs for function main: + __malloc_f_l6[1..9] diff --git a/tests/non-free/oracle/watch.res.oracle b/tests/non-free/oracle/watch.res.oracle index 9b12157449bc47cbe886e321885f0462a3e96747..224a28a8dbf15019ba85fc6191cab1e5283ecb54 100644 --- a/tests/non-free/oracle/watch.res.oracle +++ b/tests/non-free/oracle/watch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/non-free/watch.c (with preprocessing) tests/non-free/watch.c:5:[kernel] warning: Calling undeclared function Frama_C_watch_value. Old style K&R code? tests/non-free/watch.c:11:[kernel] warning: Calling undeclared function u. Old style K&R code? @@ -10,6 +9,7 @@ tests/non-free/watch.c:11:[kernel] warning: Calling undeclared function u. Old s y ∈ {0} z ∈ {0} [value] Call to builtin Frama_C_add_watch(({{ &c }},{4},{2000000000},{5})) +tests/non-free/watch.c:5:[kernel] warning: Neither code nor specification for function Frama_C_watch_value, generating default assigns from the prototype tests/non-free/watch.c:8:[value] Watchpoint: & c [--..--] tests/non-free/watch.c:9:[value] Watchpoint: & c [--..--] [value] computing for function u <- main. @@ -23,7 +23,6 @@ tests/non-free/watch.c:14:[value] Watchpoint: & c [--..--] [value] user error: Degeneration occurred: results are not correct for lines of code that can be reached from the degeneration point. [value] ====== VALUES COMPUTED ====== -tests/non-free/watch.c:5:[kernel] warning: Neither code nor specification for function Frama_C_watch_value, generating default assigns from the prototype [value:final-states] Values at end of function main: NON TERMINATING FUNCTION [from] Computing for function main diff --git a/tests/syntax/oracle/inserted_casts.err.oracle b/tests/non-free/oracle/wcslen.err.oracle similarity index 100% rename from tests/syntax/oracle/inserted_casts.err.oracle rename to tests/non-free/oracle/wcslen.err.oracle diff --git a/tests/non-free/oracle/wcslen.res.oracle b/tests/non-free/oracle/wcslen.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..8a845758cb42ff4e57207a742dc181660ab68743 --- /dev/null +++ b/tests/non-free/oracle/wcslen.res.oracle @@ -0,0 +1,671 @@ +[kernel] Parsing tests/non-free/wcslen.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + Frama_C_entropy_source ∈ [--..--] + __fc_time ∈ [--..--] + __fc_time_tm ∈ {0} + __fc_p_time_tm ∈ {{ &__fc_time_tm }} + static_str ∈ {{ L"Hello World\n" }} + zero_str ∈ {{ L"abc\000\000\000abc" }} + tab_str[0] ∈ {{ L"" }} + [1] ∈ {{ L"a" }} + [2] ∈ {{ L"aa" }} + [3] ∈ {{ L"aaa" }} + [4] ∈ {{ L"aaaa" }} + [5] ∈ {{ L"aaaaa" }} + [6] ∈ {{ L"aaaaaa" }} + [7] ∈ {{ L"aaaaaaaaa" }} + [8] ∈ {{ L"aaaaaaaaaa" }} + [9] ∈ {{ L"aaaaaaaaaaa" }} + [10] ∈ {{ L"aaaaaaaaaaaa" }} + [11] ∈ {{ L"aaaaaaaaaaaaa" }} + unterminated_string[0] ∈ {117} + [1] ∈ {110} + [2] ∈ {116} + [3] ∈ {101} + [4] ∈ {114} + [5] ∈ {109} + [6] ∈ {105} + [7] ∈ {110} + [8] ∈ {97} + [9] ∈ {116} + [10] ∈ {101} + [11] ∈ {100} + nondet ∈ [--..--] +[value] computing for function small_sets <- main. + Called from tests/non-free/wcslen.c:339. +tests/non-free/wcslen.c:60:[value] Call to builtin Frama_C_wcslen(({{ L"abc" + {0; 4} }})) +tests/non-free/wcslen.c:61:[value] assertion got status valid. +tests/non-free/wcslen.c:65:[value] Call to builtin Frama_C_wcslen(({{ L"\000bc" + {0; 4} }})) +tests/non-free/wcslen.c:66:[value] assertion got status valid. +tests/non-free/wcslen.c:70:[value] Call to builtin Frama_C_wcslen(({{ L"" }})) +tests/non-free/wcslen.c:71:[value] assertion got status valid. +tests/non-free/wcslen.c:75:[value] Call to builtin Frama_C_wcslen(({{ L"b\000c" + {0; 8} }})) +tests/non-free/wcslen.c:76:[value] assertion got status valid. +tests/non-free/wcslen.c:81:[value] Call to builtin Frama_C_wcslen(({{ &t[0] }})) +tests/non-free/wcslen.c:81:[value] warning: builtin Frama_C_wcslen: possibly reading indeterminate data +tests/non-free/wcslen.c:82:[value] assertion got status valid. +[value] Recording results for small_sets +[value] Done for function small_sets +[value] computing for function zero_termination <- main. + Called from tests/non-free/wcslen.c:340. +tests/non-free/wcslen.c:89:[value] Call to builtin Frama_C_wcslen(({{ &empty_or_non_terminated[0] }})) +tests/non-free/wcslen.c:89:[value] warning: builtin Frama_C_wcslen: possibly reading indeterminate data +tests/non-free/wcslen.c:90:[value] assertion got status valid. +tests/non-free/wcslen.c:93:[value] Call to builtin Frama_C_wcslen(({{ &non_terminated[0] }})) +tests/non-free/wcslen.c:93:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +tests/non-free/wcslen.c:97:[value] Call to builtin Frama_C_wcslen(({{ &non_terminated2{[2], [3]} }})) +tests/non-free/wcslen.c:97:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +[value] Recording results for zero_termination +[value] Done for function zero_termination +[value] computing for function wcslen_initialization <- main. + Called from tests/non-free/wcslen.c:341. +[value] computing for function my_wcslen <- wcslen_initialization <- main. + Called from tests/non-free/wcslen.c:105. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &empty_or_uninitialized[0] }})) +tests/non-free/wcslen.c:54:[value] warning: builtin Frama_C_wcslen: possible uninitialized values +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:106:[value] assertion got status valid. +[value] computing for function my_wcslen <- wcslen_initialization <- main. + Called from tests/non-free/wcslen.c:109. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &uninitialized[0] }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +[value] computing for function my_wcslen <- wcslen_initialization <- main. + Called from tests/non-free/wcslen.c:116. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &s[0] }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:117:[value] assertion got status valid. +[value] computing for function my_wcslen <- wcslen_initialization <- main. + Called from tests/non-free/wcslen.c:124. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &t[0] }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:125:[value] assertion got status valid. +[value] Recording results for wcslen_initialization +[value] Done for function wcslen_initialization +[value] computing for function wcslen_large <- main. + Called from tests/non-free/wcslen.c:342. +[value] computing for function init_array_nondet <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:168. +tests/non-free/wcslen.c:161:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{400})) +[value] Recording results for init_array_nondet +[value] Done for function init_array_nondet +[value] computing for function Frama_C_interval <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:171. +[value] using specification for function Frama_C_interval +share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:172. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [12..120],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:173:[value] assertion got status valid. +[value] computing for function Frama_C_interval <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:175. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:176. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [20..68],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:177:[value] assertion got status valid. +[value] computing for function Frama_C_interval <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:179. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:180. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [240..296],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:181:[value] assertion got status valid. +[value] computing for function Frama_C_interval <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:183. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:184. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [252..320],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:185:[value] assertion got status valid. +[value] computing for function init_array_nondet <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:187. +tests/non-free/wcslen.c:161:[value] Call to builtin memset(({{ (void *)&a }},{0; 2},{400})) +[value] Recording results for init_array_nondet +[value] Done for function init_array_nondet +[value] computing for function Frama_C_interval <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:188. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large <- main. + Called from tests/non-free/wcslen.c:189. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [200..280],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:190:[value] assertion got status valid. +[value] Recording results for wcslen_large +[value] Done for function wcslen_large +[value] computing for function wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:343. +[value] computing for function init_array_nondet <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:197. +tests/non-free/wcslen.c:161:[value] Call to builtin memset(({{ (void *)&a }},{1; 2},{160})) +[value] Recording results for init_array_nondet +[value] Done for function init_array_nondet +[value] computing for function init_array_nondet <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:198. +tests/non-free/wcslen.c:161:[value] Call to builtin memset(({{ (void *)&a[50] }},{3; 4},{180})) +[value] Recording results for init_array_nondet +[value] Done for function init_array_nondet +[value] computing for function Frama_C_interval <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:202. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:203. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [12..120],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:204:[value] assertion got status valid. +[value] computing for function Frama_C_interval <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:207. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:208. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [252..320],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:209:[value] assertion got status valid. +[value] computing for function Frama_C_interval <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:211. +[value] Done for function Frama_C_interval +[value] computing for function my_wcslen <- wcslen_large_uninit <- main. + Called from tests/non-free/wcslen.c:212. +tests/non-free/wcslen.c:54:[value] Call to builtin Frama_C_wcslen(({{ &a + [180..220],0%4 }})) +[value] Recording results for my_wcslen +[value] Done for function my_wcslen +tests/non-free/wcslen.c:213:[value] assertion got status valid. +[value] Recording results for wcslen_large_uninit +[value] Done for function wcslen_large_uninit +[value] computing for function misc <- main. + Called from tests/non-free/wcslen.c:344. +tests/non-free/wcslen.c:241:[value] Call to builtin Frama_C_wcslen(({{ &unterminated_string[0] }})) +tests/non-free/wcslen.c:241:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +tests/non-free/wcslen.c:244:[value] Call to builtin Frama_C_wcslen(({{ L"Hello World\n" ; L"Bonjour Monde\n" }})) +tests/non-free/wcslen.c:245:[value] assertion got status valid. +tests/non-free/wcslen.c:248:[value] Call to builtin Frama_C_wcslen(({{ &x{[0], [3]} }})) +tests/non-free/wcslen.c:248:[value] warning: builtin Frama_C_wcslen: possibly reading indeterminate data +tests/non-free/wcslen.c:249:[value] assertion got status valid. +[value] computing for function Frama_C_interval <- misc <- main. + Called from tests/non-free/wcslen.c:250. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:252:[value] Call to builtin Frama_C_wcslen(({{ L"" ; L"a" ; L"aa" ; L"aaa" ; L"aaaa" ; + L"aaaaa" ; L"aaaaaa" ; L"aaaaaaaaa" ; + L"aaaaaaaaaa" ; L"aaaaaaaaaaa" ; + L"aaaaaaaaaaaa" ; L"aaaaaaaaaaaaa" }})) +tests/non-free/wcslen.c:253:[value] assertion got status valid. +tests/non-free/wcslen.c:255:[value] Call to builtin Frama_C_wcslen(({{ &loc_char_array[0] }})) +tests/non-free/wcslen.c:255:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +tests/non-free/wcslen.c:256:[value] Call to builtin Frama_C_wcslen(({{ L"abc\000\000\000abc" }})) +tests/non-free/wcslen.c:257:[value] assertion got status valid. +tests/non-free/wcslen.c:260:[value] Call to builtin Frama_C_wcslen(({{ L"abc" + {0; 4} ; L"ABCD" + {0; 4} }})) +tests/non-free/wcslen.c:261:[value] assertion got status valid. +tests/non-free/wcslen.c:265:[value] Call to builtin Frama_C_wcslen(({{ L"efg" + {4; 8} ; L"EFGH" + {4; 8} }})) +tests/non-free/wcslen.c:266:[value] assertion got status valid. +tests/non-free/wcslen.c:269:[value] entering loop for the first time +tests/non-free/wcslen.c:270:[value] Call to builtin Frama_C_wcslen(({{ L"mno\000pqr" ; L"MNOP\000QRS" }})) +tests/non-free/wcslen.c:271:[value] assertion got status valid. +tests/non-free/wcslen.c:270:[value] Call to builtin Frama_C_wcslen(({{ L"mno\000pqr" + {0; 4} ; + L"MNOP\000QRS" + {0; 4} }})) +tests/non-free/wcslen.c:270:[value] Call to builtin Frama_C_wcslen(({{ L"mno\000pqr" + {0; 4; 8} ; + L"MNOP\000QRS" + {0; 4; 8} }})) +tests/non-free/wcslen.c:270:[value] Call to builtin Frama_C_wcslen(({{ L"mno\000pqr" + + {0; 4; 8; 12; 16; 20; 24; 28} ; + L"MNOP\000QRS" + + {0; 4; 8; 12; 16; 20; 24; 28} }})) +tests/non-free/wcslen.c:270:[value] Call to builtin Frama_C_wcslen(({{ L"mno\000pqr" + + {0; 4; 8; 12; 16; 20; 24; 28} ; + L"MNOP\000QRS" + + {0; 4; 8; 12; 16; 20; 24; 28} }})) +tests/non-free/wcslen.c:277:[value] Call to builtin Frama_C_wcslen(({{ &maybe_init[0] }})) +tests/non-free/wcslen.c:277:[value] warning: builtin Frama_C_wcslen: possible uninitialized values +tests/non-free/wcslen.c:278:[value] assertion got status valid. +[value] Recording results for misc +[value] Done for function misc +[value] computing for function bitfields <- main. + Called from tests/non-free/wcslen.c:345. +tests/non-free/wcslen.c:140:[value] Call to builtin Frama_C_wcslen(({{ (wchar_t const *)&s }})) +tests/non-free/wcslen.c:140:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +[value] Recording results for bitfields +[value] Done for function bitfields +[value] computing for function bitfields2 <- main. + Called from tests/non-free/wcslen.c:346. +tests/non-free/wcslen.c:155:[value] Call to builtin Frama_C_wcslen(({{ (wchar_t const *)&s }})) +tests/non-free/wcslen.c:156:[value] assertion got status valid. +[value] Recording results for bitfields2 +[value] Done for function bitfields2 +[value] computing for function escaping <- main. + Called from tests/non-free/wcslen.c:347. +tests/non-free/wcslen.c:222:[value] warning: locals {x} escaping the scope of a block of escaping through s +tests/non-free/wcslen.c:225:[value] Call to builtin Frama_C_wcslen(({{ &s[0] }})) +tests/non-free/wcslen.c:225:[value] warning: builtin Frama_C_wcslen: possible escaping addresses +tests/non-free/wcslen.c:226:[value] assertion got status valid. +tests/non-free/wcslen.c:228:[value] Call to builtin Frama_C_wcslen(({{ &s[0] }})) +tests/non-free/wcslen.c:229:[value] assertion got status valid. +[value] Recording results for escaping +[value] Done for function escaping +[value] computing for function big_array <- main. + Called from tests/non-free/wcslen.c:348. +tests/non-free/wcslen.c:287:[value] warning: out of bounds write. assert \valid(p); +tests/non-free/wcslen.c:291:[value] warning: out of bounds write. assert \valid(p); +tests/non-free/wcslen.c:294:[value] warning: out of bounds write. assert \valid(p); +tests/non-free/wcslen.c:301:[value] Call to builtin Frama_C_wcslen(({{ (wchar_t const *)&u }})) +tests/non-free/wcslen.c:301:[value] warning: builtin Frama_C_wcslen: possible uninitialized values +tests/non-free/wcslen.c:302:[value] Call to builtin Frama_C_wcslen(({{ (wchar_t const *)&r }})) +tests/non-free/wcslen.c:302:[kernel] more than 200(201) locations to update in array. Approximating. +tests/non-free/wcslen.c:302:[value] warning: builtin Frama_C_wcslen: possible uninitialized values +tests/non-free/wcslen.c:303:[value] Call to builtin Frama_C_wcslen(({{ (wchar_t const *)&t }})) +tests/non-free/wcslen.c:303:[kernel] more than 200(1000000) locations to update in array. Approximating. +tests/non-free/wcslen.c:303:[value] warning: builtin Frama_C_wcslen: possible uninitialized values +tests/non-free/wcslen.c:304:[value] Frama_C_show_each: {0}, {0}, {0} +tests/non-free/wcslen.c:306:[value] Call to builtin Frama_C_wcslen(({{ &u + [-17179869184..17179869176],0%8 }})) +tests/non-free/wcslen.c:306:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +tests/non-free/wcslen.c:307:[value] Call to builtin Frama_C_wcslen(({{ &r + [-17179869184..17179869176],0%8 }})) +tests/non-free/wcslen.c:307:[kernel] more than 200(201) locations to update in array. Approximating. +tests/non-free/wcslen.c:307:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +tests/non-free/wcslen.c:308:[value] Call to builtin Frama_C_wcslen(({{ &t + [-17179869184..17179869176],0%8 }})) +tests/non-free/wcslen.c:308:[kernel] more than 200(1000000) locations to update in array. Approximating. +tests/non-free/wcslen.c:308:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +tests/non-free/wcslen.c:309:[value] Frama_C_show_each: {0; 1}, [0..400], [0..1999998] +[value] Recording results for big_array +[value] Done for function big_array +[value] computing for function negative_offsets <- main. + Called from tests/non-free/wcslen.c:349. +tests/non-free/wcslen.c:314:[value] entering loop for the first time +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/wcslen.c:318. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:319:[value] Call to builtin Frama_C_wcslen(({{ &buf{[-10], [-9], [-8]} }})) +tests/non-free/wcslen.c:319:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/wcslen.c:322. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:323:[value] Call to builtin Frama_C_wcslen(({{ &buf{[-2], [-1]} }})) +tests/non-free/wcslen.c:323:[value] warning: builtin Frama_C_wcslen: reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/wcslen.c:325. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:326:[value] Call to builtin Frama_C_wcslen(({{ &buf{[-1], [0]} }})) +tests/non-free/wcslen.c:326:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/wcslen.c:327. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:328:[value] Call to builtin Frama_C_wcslen(({{ &buf{[-1], [0], [1], [2]} }})) +tests/non-free/wcslen.c:328:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/wcslen.c:329. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:330:[value] Call to builtin Frama_C_wcslen(({{ &buf + [-16..28],0%4 }})) +tests/non-free/wcslen.c:330:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +[value] computing for function Frama_C_interval <- negative_offsets <- main. + Called from tests/non-free/wcslen.c:331. +[value] Done for function Frama_C_interval +tests/non-free/wcslen.c:333:[value] Call to builtin Frama_C_wcslen(({{ &buf + [-40..0],0%4 }})) +tests/non-free/wcslen.c:333:[value] warning: builtin Frama_C_wcslen: + possible uninitialized values + possibly reading indeterminate data +[value] Recording results for negative_offsets +[value] Done for function negative_offsets +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function big_array: + t[0..999999] ∈ {1162886966899900416} or UNINITIALIZED + u[0..199] ∈ {1162886966899900416} or UNINITIALIZED + r[0..200] ∈ {1162886966899900416} or UNINITIALIZED + p ∈ {{ &r + [0..1600],0%8 }} + len_u ∈ {0; 1} + len_r ∈ [0..400] + len_t ∈ [0..1999998] +[value:final-states] Values at end of function bitfields: + s.a ∈ {3} + .b ∈ {1} + .c ∈ {7} + .[bits 127 to 127] ∈ UNINITIALIZED + p ∈ {{ (wchar_t *)&s }} +[value:final-states] Values at end of function bitfields2: + s.a ∈ {3} + .b ∈ {1} + .c ∈ {458752} + .[bits 159 to 159] ∈ UNINITIALIZED + p ∈ {{ (wchar_t *)&s }} + z1 ∈ {2} +[value:final-states] Values at end of function escaping: + s[0] ∈ {0} + [1..3] ∈ ESCAPINGADDR + z1 ∈ {0} + z2 ∈ {0} +[value:final-states] Values at end of function init_array_nondet: + from ∈ {-1} + to ∈ {-1} + val1 ∈ {-1} + val2 ∈ {-1} + val ∈ {0; 1; 2; 3; 4} + a[0..99] ∈ {0; 16843009; 33686018} + a[0..39] ∈ {16843009; 33686018} + [40..49] ∈ UNINITIALIZED + [50..94] ∈ {50529027; 67372036} or UNINITIALIZED + [95..99] ∈ UNINITIALIZED +[value:final-states] Values at end of function misc: + Frama_C_entropy_source ∈ [--..--] + loc_str ∈ {{ L"Bonjour Monde\n" }} + loc_char_array[0..2] ∈ UNINITIALIZED + [3] ∈ {0} + [4] ∈ UNINITIALIZED + sz1 ∈ {12; 14} + sz2 ∈ {0} + sz3 ∈ [0..13] + sz4 ∈ {3} + sz5 ∈ {2; 3; 4} + sz6 ∈ {1; 2; 3} + sz7 ∈ {0; 1; 2; 3; 4} or UNINITIALIZED + sz8 ∈ {1} + x[0] ∈ {0} + [1] ∈ {239} + [2] ∈ {205} + [3] ∈ {171} + z[0] ∈ {0} + [1] ∈ {86} + [2] ∈ {35} + [3] ∈ {18} + i ∈ [0..11] + str ∈ + {{ L"" ; L"a" ; L"aa" ; L"aaa" ; L"aaaa" ; L"aaaaa" ; L"aaaaaa" ; + L"aaaaaaaaa" ; L"aaaaaaaaaa" ; L"aaaaaaaaaaa" ; L"aaaaaaaaaaaa" ; + L"aaaaaaaaaaaaa" }} + s1 ∈ {{ L"mno\000pqr" ; L"MNOP\000QRS" }} + s2 ∈ {{ L"efg" + {4; 8} ; L"EFGH" + {4; 8} }} + maybe_init[0] ∈ {65} or UNINITIALIZED + [1] ∈ {0} +[value:final-states] Values at end of function my_wcslen: + __retres ∈ [0..54] +[value:final-states] Values at end of function negative_offsets: + Frama_C_entropy_source ∈ [--..--] + buf[0..88] ∈ {65} or UNINITIALIZED + [89..98] ∈ {0; 65} or UNINITIALIZED + [99] ∈ {0} + len1 ∈ UNINITIALIZED + len2 ∈ UNINITIALIZED + len3 ∈ {99} + len4 ∈ {97; 98; 99} + len5 ∈ {92; 93; 94; 95; 96; 97; 98; 99} + len6 ∈ {99} + offset3 ∈ {-1; 0} + offset4 ∈ {-1; 0; 1; 2} + offset5 ∈ [-4..7] + offset6 ∈ [-10..0] + p ∈ {{ &buf + [-40..0],0%4 }} +[value:final-states] Values at end of function small_sets: + s ∈ {{ L"b\000c" }} + p ∈ {{ L"b\000c" + {0; 8} }} + z1 ∈ {2; 3} + z2 ∈ {0; 2} + z3 ∈ {0} + z4 ∈ {1} + t[0..1] ∈ {0; 1} + [2..3] ∈ {1} + z5 ∈ {0; 1} +[value:final-states] Values at end of function wcslen_initialization: + empty_or_uninitialized[0] ∈ {0} or UNINITIALIZED + z1 ∈ {0} + s[0] ∈ {1} or UNINITIALIZED + [1] ∈ {0} + p ∈ {{ &t[0] }} + z2 ∈ {1} + t[0..1] ∈ {10} + [2] ∈ {10} or UNINITIALIZED + [3] ∈ {0} + z3 ∈ {3} +[value:final-states] Values at end of function wcslen_large: + Frama_C_entropy_source ∈ [--..--] + a[0..99] ∈ {0; 33686018} + offset ∈ [50..70] + z1 ∈ [0..54] + z2 ∈ [3..15] + z3 ∈ [1..15] + z4 ∈ [0..12] + z5 ∈ [0..49] +[value:final-states] Values at end of function wcslen_large_uninit: + Frama_C_entropy_source ∈ [--..--] + a[0..19] ∈ {16843009; 33686018} + [20] ∈ {0} + [21..39] ∈ {16843009; 33686018} + [40..49] ∈ UNINITIALIZED + [50..74] ∈ {50529027; 67372036} + [75] ∈ {0} + [76..94] ∈ {50529027; 67372036} + [95..97] ∈ UNINITIALIZED + [98] ∈ {0} + [99] ∈ UNINITIALIZED + offset ∈ {0} + z1 ∈ [0..17] + z2 ∈ [0..12] + z3 ∈ {20; 21; 22; 23; 24; 25} +[value:final-states] Values at end of function zero_termination: + empty_or_non_terminated[0] ∈ {0; 100} + z1 ∈ {0} + non_terminated[0] ∈ {88} + non_terminated2[0] ∈ {76} + [1] ∈ {0} + [2] ∈ {28} + [3] ∈ {14} + p ∈ {{ &non_terminated2{[2], [3]} }} +[value:final-states] Values at end of function main: + Frama_C_entropy_source ∈ [--..--] + __retres ∈ {0} +[from] Computing for function big_array +[from] Computing for function Frama_C_wcslen <-big_array +[from] Done for function Frama_C_wcslen +[from] Done for function big_array +[from] Computing for function bitfields +[from] Done for function bitfields +[from] Computing for function bitfields2 +[from] Done for function bitfields2 +[from] Computing for function escaping +[from] Done for function escaping +[from] Computing for function init_array_nondet +[from] Computing for function Frama_C_memset <-init_array_nondet +[from] Done for function Frama_C_memset +[from] Done for function init_array_nondet +[from] Computing for function misc +[from] Computing for function Frama_C_interval <-misc +[from] Done for function Frama_C_interval +[from] Done for function misc +[from] Computing for function my_wcslen +[from] Done for function my_wcslen +[from] Computing for function negative_offsets +[from] Done for function negative_offsets +[from] Computing for function small_sets +[from] Done for function small_sets +[from] Computing for function wcslen_initialization +[from] Done for function wcslen_initialization +[from] Computing for function wcslen_large +[from] Done for function wcslen_large +[from] Computing for function wcslen_large_uninit +[from] Done for function wcslen_large_uninit +[from] Computing for function zero_termination +[from] Done for function zero_termination +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function Frama_C_interval: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) + \result FROM Frama_C_entropy_source; min; max +[from] Function Frama_C_memset: + a[0..99] FROM c (and SELF) + a[0..99] FROM c (and SELF) + \result FROM p +[from] Function Frama_C_wcslen: + \result FROM unterminated_string[0..11]; t[0..3]; + empty_or_non_terminated[0]; non_terminated[0]; + non_terminated2[2..3]; empty_or_uninitialized[0]; + uninitialized[0]; s[0..1]; t[0..3]; s; s; a[3..99]; a[3..99]; + s[0..3]; loc_char_array[0..4]; x[0..3]; maybe_init[0..1]; + t[0..999999]; u[0..199]; r[0..200]; buf[0..99]; + L"Hello World\n"[bits 0 to 415]; + L"abc\000\000\000abc"[bits 0 to 319]; L""; L"a"[bits 0 to 63]; + L"aa"[bits 0 to 95]; L"aaa"[bits 0 to 127]; + L"aaaa"[bits 0 to 159]; L"aaaaa"[bits 0 to 191]; + L"aaaaaa"[bits 0 to 223]; L"aaaaaaaaa"[bits 0 to 319]; + L"aaaaaaaaaa"[bits 0 to 351]; L"aaaaaaaaaaa"[bits 0 to 383]; + L"aaaaaaaaaaaa"[bits 0 to 415]; + L"aaaaaaaaaaaaa"[bits 0 to 447]; L"abc"[bits 0 to 127]; + L"\000bc"[bits 0 to 127]; L""; L"b\000c"[bits 0 to 127]; + L"Bonjour Monde\n"[bits 0 to 479]; L"abc"[bits 0 to 127]; + L"ABCD"[bits 0 to 159]; L"efg"[bits 32 to 127]; + L"EFGH"[bits 32 to 159]; L"mno\000pqr"[bits 0 to 255]; + L"MNOP\000QRS"[bits 0 to 287] +[from] Function big_array: + NO EFFECTS +[from] Function bitfields: + NO EFFECTS +[from] Function bitfields2: + NO EFFECTS +[from] Function escaping: + NO EFFECTS +[from] Function init_array_nondet: + a[0..99] FROM val1; val2; nondet (and SELF) + a[0..99] FROM val1; val2; nondet (and SELF) +[from] Function misc: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) +[from] Function my_wcslen: + \result FROM unterminated_string[0..11]; empty_or_uninitialized[0]; + uninitialized[0]; s[0..1]; t[0..3]; a[3..99]; a[3..99]; + L"Hello World\n"[bits 0 to 415]; + L"abc\000\000\000abc"[bits 0 to 319]; L""; L"a"[bits 0 to 63]; + L"aa"[bits 0 to 95]; L"aaa"[bits 0 to 127]; + L"aaaa"[bits 0 to 159]; L"aaaaa"[bits 0 to 191]; + L"aaaaaa"[bits 0 to 223]; L"aaaaaaaaa"[bits 0 to 319]; + L"aaaaaaaaaa"[bits 0 to 351]; L"aaaaaaaaaaa"[bits 0 to 383]; + L"aaaaaaaaaaaa"[bits 0 to 415]; + L"aaaaaaaaaaaaa"[bits 0 to 447]; L"abc"[bits 0 to 127]; + L"\000bc"[bits 0 to 127]; L""; L"b\000c"[bits 0 to 127]; + L"Bonjour Monde\n"[bits 0 to 479]; L"abc"[bits 0 to 127]; + L"ABCD"[bits 0 to 159]; L"efg"[bits 32 to 127]; + L"EFGH"[bits 32 to 159]; L"mno\000pqr"[bits 0 to 255]; + L"MNOP\000QRS"[bits 0 to 287] +[from] Function negative_offsets: + Frama_C_entropy_source FROM Frama_C_entropy_source; nondet (and SELF) +[from] Function small_sets: + NO EFFECTS +[from] Function wcslen_initialization: + NO EFFECTS +[from] Function wcslen_large: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) +[from] Function wcslen_large_uninit: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) +[from] Function zero_termination: + NO EFFECTS +[from] Function main: + Frama_C_entropy_source FROM Frama_C_entropy_source; nondet (and SELF) + \result FROM \nothing +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function big_array: + t[0..999999]; u[0..199]; r[0..200]; p; len_u; len_r; len_t +[inout] Inputs for function big_array: + nondet +[inout] Out (internal) for function bitfields: + s{.a; .b; .c}; p +[inout] Inputs for function bitfields: + nondet +[inout] Out (internal) for function bitfields2: + s{.a; .b; .c}; p; z1; tmp +[inout] Inputs for function bitfields2: + \nothing +[inout] Out (internal) for function escaping: + s[0..3]; z1; tmp; z2; tmp_0 +[inout] Inputs for function escaping: + nondet +[inout] Out (internal) for function init_array_nondet: + from; to; val1; val2; val; tmp; a[0..99]; a{[0..39]; [50..94]} +[inout] Inputs for function init_array_nondet: + nondet +[inout] Out (internal) for function misc: + Frama_C_entropy_source; loc_str; loc_char_array[3]; sz1; sz2; sz3; + sz4; sz5; sz6; sz7; sz8; x[0..3]; z[0..3]; i; str; s1; tmp; s2; tmp_0; + j; maybe_init[0..1] +[inout] Inputs for function misc: + Frama_C_entropy_source; static_str; zero_str; tab_str[0..11]; + unterminated_string[0..11]; nondet; L"Hello World\n"[bits 0 to 415]; + L"abc\000\000\000abc"[bits 0 to 319]; L""; L"a"[bits 0 to 63]; + L"aa"[bits 0 to 95]; L"aaa"[bits 0 to 127]; L"aaaa"[bits 0 to 159]; + L"aaaaa"[bits 0 to 191]; L"aaaaaa"[bits 0 to 223]; + L"aaaaaaaaa"[bits 0 to 319]; L"aaaaaaaaaa"[bits 0 to 351]; + L"aaaaaaaaaaa"[bits 0 to 383]; L"aaaaaaaaaaaa"[bits 0 to 415]; + L"aaaaaaaaaaaaa"[bits 0 to 447]; L"Bonjour Monde\n"[bits 0 to 479]; + L"abc"[bits 0 to 127]; L"ABCD"[bits 0 to 159]; L"efg"[bits 32 to 127]; + L"EFGH"[bits 32 to 159]; L"mno\000pqr"[bits 0 to 255]; + L"MNOP\000QRS"[bits 0 to 287] +[inout] Out (internal) for function my_wcslen: + tmp; __retres +[inout] Inputs for function my_wcslen: + empty_or_uninitialized[0]; uninitialized[0]; s[0..1]; t[0..3]; a[0..99]; + a[0..99] +[inout] Out (internal) for function negative_offsets: + Frama_C_entropy_source; buf[0..99]; i; len1; len2; len3; len4; len5; + len6; offset1; offset2; offset3; offset4; offset5; offset6; p +[inout] Inputs for function negative_offsets: + Frama_C_entropy_source; nondet +[inout] Out (internal) for function small_sets: + s; p; tmp; z1; tmp_0; z2; tmp_1; z3; tmp_2; z4; tmp_3; t[0..3]; z5; tmp_4 +[inout] Inputs for function small_sets: + nondet; L"abc"[bits 0 to 127]; L"\000bc"[bits 0 to 127]; L""; + L"b\000c"[bits 0 to 127] +[inout] Out (internal) for function wcslen_initialization: + empty_or_uninitialized[0]; z1; s[0..1]; p; z2; t[0..3]; z3 +[inout] Inputs for function wcslen_initialization: + nondet +[inout] Out (internal) for function wcslen_large: + Frama_C_entropy_source; a[0..99]; offset; z1; z2; z3; z4; z5 +[inout] Inputs for function wcslen_large: + Frama_C_entropy_source; nondet +[inout] Out (internal) for function wcslen_large_uninit: + Frama_C_entropy_source; a{[0..39]; [50..94]; [98]}; offset; z1; z2; z3 +[inout] Inputs for function wcslen_large_uninit: + Frama_C_entropy_source; nondet +[inout] Out (internal) for function zero_termination: + empty_or_non_terminated[0]; z1; tmp; non_terminated[0]; + non_terminated2[0..3]; p; tmp_0 +[inout] Inputs for function zero_termination: + nondet +[inout] Out (internal) for function main: + Frama_C_entropy_source; __retres +[inout] Inputs for function main: + Frama_C_entropy_source; static_str; zero_str; tab_str[0..11]; + unterminated_string[0..11]; nondet; L"Hello World\n"[bits 0 to 415]; + L"abc\000\000\000abc"[bits 0 to 319]; L""; L"a"[bits 0 to 63]; + L"aa"[bits 0 to 95]; L"aaa"[bits 0 to 127]; L"aaaa"[bits 0 to 159]; + L"aaaaa"[bits 0 to 191]; L"aaaaaa"[bits 0 to 223]; + L"aaaaaaaaa"[bits 0 to 319]; L"aaaaaaaaaa"[bits 0 to 351]; + L"aaaaaaaaaaa"[bits 0 to 383]; L"aaaaaaaaaaaa"[bits 0 to 415]; + L"aaaaaaaaaaaaa"[bits 0 to 447]; L"abc"[bits 0 to 127]; + L"\000bc"[bits 0 to 127]; L""; L"b\000c"[bits 0 to 127]; + L"Bonjour Monde\n"[bits 0 to 479]; L"abc"[bits 0 to 127]; + L"ABCD"[bits 0 to 159]; L"efg"[bits 32 to 127]; L"EFGH"[bits 32 to 159]; + L"mno\000pqr"[bits 0 to 255]; L"MNOP\000QRS"[bits 0 to 287] diff --git a/tests/value/oracle/cond3.err.oracle b/tests/non-free/oracle/write-const.err.oracle similarity index 100% rename from tests/value/oracle/cond3.err.oracle rename to tests/non-free/oracle/write-const.err.oracle diff --git a/tests/non-free/oracle/write-const.res.oracle b/tests/non-free/oracle/write-const.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..5b722984f503cc7d97df76cc291e06a57edbb43c --- /dev/null +++ b/tests/non-free/oracle/write-const.res.oracle @@ -0,0 +1,122 @@ +[kernel] Parsing tests/non-free/write-const.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + v ∈ [--..--] + a ∈ {-1} + b ∈ {0} +[value] computing for function main0 <- main. + Called from tests/non-free/write-const.c:44. +tests/non-free/write-const.c:18:[value] Call to builtin memcpy(({{ (void *)&a ; (void *)&b }},{{ (void const *)&x }}, + {4})) +tests/non-free/write-const.c:18:[value] warning: out of bounds write. assert \valid((char *)p + (0 .. sizeof(x) - 1)); +tests/non-free/write-const.c:19:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + a ∈ {-1} + b ∈ {1} + p ∈ {{ &a ; &b }} + tmp ∈ {{ &a ; &b }} + x ∈ {1} + ==END OF DUMP== +[value] Recording results for main0 +[from] Computing for function main0 +[from] Done for function main0 +[value] Done for function main0 +[value] computing for function main1 <- main. + Called from tests/non-free/write-const.c:45. +tests/non-free/write-const.c:25:[value] Call to builtin memset(({{ (void *)&a ; (void *)&b }},{5},{4})) +tests/non-free/write-const.c:25:[value] warning: out of bounds write. assert \valid((char *)p + (0 .. sizeof(x) - 1)); +tests/non-free/write-const.c:26:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + a ∈ {-1} + b ∈ {84215045} + p ∈ {{ &a ; &b }} + tmp ∈ {{ &a ; &b }} + x ∈ {1} + ==END OF DUMP== +[value] Recording results for main1 +[from] Computing for function main1 +[from] Done for function main1 +[value] Done for function main1 +[value] computing for function main2 <- main. + Called from tests/non-free/write-const.c:46. +tests/non-free/write-const.c:32:[value] warning: out of bounds write. assert \valid(p); +tests/non-free/write-const.c:33:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + a ∈ {-1} + b ∈ {1} + p ∈ {{ &b }} + tmp ∈ {{ &a ; &b }} + ==END OF DUMP== +[value] Recording results for main2 +[from] Computing for function main2 +[from] Done for function main2 +[value] Done for function main2 +[value] computing for function main3 <- main. + Called from tests/non-free/write-const.c:47. +tests/non-free/write-const.c:39:[value] warning: out of bounds write. assert \valid(p); +tests/non-free/write-const.c:40:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + a ∈ {-1} + b ∈ {2} + p ∈ {{ &b }} + tmp ∈ {{ &a ; &b }} + y ∈ {2} + ==END OF DUMP== +[value] Recording results for main3 +[from] Computing for function main3 +[from] Done for function main3 +[value] Done for function main3 +[value] Recording results for main +[from] Computing for function main +[from] Done for function main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main2: + b ∈ {1} + p ∈ {{ &b }} +[value:final-states] Values at end of function main3: + b ∈ {2} + p ∈ {{ &b }} + y ∈ {2} +[value:final-states] Values at end of function main0: + b ∈ {1} + p ∈ {{ &a ; &b }} + x ∈ {1} +[value:final-states] Values at end of function main1: + b ∈ {84215045} + p ∈ {{ &a ; &b }} + x ∈ {1} +[value:final-states] Values at end of function main: + b ∈ {2} +[from] ====== DISPLAYING CALLWISE DEPENDENCIES ====== +[from] call to Frama_C_dump_each at tests/non-free/write-const.c:33 (by main2): + \result FROM \nothing +[from] call to Frama_C_dump_each at tests/non-free/write-const.c:40 (by main3): + \result FROM \nothing +[from] call to memcpy at tests/non-free/write-const.c:18 (by main0): + b FROM x + \result FROM dest +[from] call to Frama_C_dump_each at tests/non-free/write-const.c:19 (by main0): + \result FROM \nothing +[from] call to memset at tests/non-free/write-const.c:25 (by main1): + b FROM c + \result FROM s +[from] call to Frama_C_dump_each at tests/non-free/write-const.c:26 (by main1): + \result FROM \nothing +[from] call to main0 at tests/non-free/write-const.c:44 (by main): + b FROM \nothing +[from] call to main1 at tests/non-free/write-const.c:45 (by main): + b FROM \nothing +[from] call to main2 at tests/non-free/write-const.c:46 (by main): + b FROM v +[from] call to main3 at tests/non-free/write-const.c:47 (by main): + b FROM v +[from] entry point: + b FROM v +[from] ====== END OF CALLWISE DEPENDENCIES ====== diff --git a/tests/non-free/precise_memset.c b/tests/non-free/precise_memset.c index 2bf84b161fcadb8f1cb8efed02c4fad9c9e78764..56878692da1c45066667a186a798eba27d467d7f 100644 --- a/tests/non-free/precise_memset.c +++ b/tests/non-free/precise_memset.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #" -val -inout-callwise -calldeps " + STDOPT: #" -val -calldeps " */ //@ assigns ((char*)dst)[0..] \from v, size; assigns \result \from dst; diff --git a/tests/non-free/realloc.c b/tests/non-free/realloc.c index 2121e194723671edef7ddffb89a26cc297b9e885..0bf087610fefeb15d072afa3e98587bab6845833 100644 --- a/tests/non-free/realloc.c +++ b/tests/non-free/realloc.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-slevel 10 -val-builtin malloc:Frama_C_alloc_size,free:Frama_C_free,realloc:Frama_C_realloc -val-malloc-functions malloc,realloc -val-warn-copy-indeterminate @all" + STDOPT: +"-slevel 10 -val-builtin malloc:Frama_C_malloc_fresh,free:Frama_C_free,realloc:Frama_C_realloc -val-malloc-functions malloc,realloc -val-warn-copy-indeterminate @all" */ #include <stdlib.h> diff --git a/tests/non-free/realloc2.c b/tests/non-free/realloc2.c index 2285f0ec03efcbb49962906230b6522e4bce25a0..0da7c1d2a93a9e994291f3c55b394e2b775fdc49 100644 --- a/tests/non-free/realloc2.c +++ b/tests/non-free/realloc2.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-val-builtin malloc:Frama_C_alloc_by_stack,realloc:Frama_C_realloc,free:Frama_C_free -val-mlevel 0 -inout-callwise -inout-no-print " + STDOPT: #"-val-builtin realloc:Frama_C_realloc -val-mlevel 0 -inout-callwise -inout-no-print " */ #include <stdlib.h> diff --git a/tests/non-free/realloc_multiple.c b/tests/non-free/realloc_multiple.c index ce7e94b29b93b00c2103e8c36ad446765bf85ee9..9b97fde2a3c1e67d4b42f6802ba8090312e63fe1 100644 --- a/tests/non-free/realloc_multiple.c +++ b/tests/non-free/realloc_multiple.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-slevel 10 -val-builtin malloc:Frama_C_alloc_size,free:Frama_C_free,realloc:Frama_C_realloc_multiple -val-malloc-functions malloc,realloc" + STDOPT: +"-slevel 10 -val-builtin malloc:Frama_C_malloc_fresh,free:Frama_C_free,realloc:Frama_C_realloc_multiple -val-malloc-functions malloc,realloc" */ #include <stdlib.h> diff --git a/tests/non-free/str_allocated.c b/tests/non-free/str_allocated.c index 9c4f797d6ca6ab1e773583fd1c2602717c810967..10329fa823ba37f2f1c721689602aba874973a54 100644 --- a/tests/non-free/str_allocated.c +++ b/tests/non-free/str_allocated.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-val-builtin memchr:Frama_C_memchr,malloc:Frama_C_alloc_by_stack" + */ #include <string.h> #include <stdlib.h> diff --git a/tests/non-free/strchr.c b/tests/non-free/strchr.c index 6794a5426ef28456f79e4a3c71c2cb3766c0e71b..77353eab236db937b0e2251f05656771cafedec2 100644 --- a/tests/non-free/strchr.c +++ b/tests/non-free/strchr.c @@ -528,6 +528,12 @@ void strchr_invalid() { my_strchr(s, &s, 1); } +void strchr_garbled_mix_in_char() { + int x; + char *garbled = ((int)(&x + (int)&x)); + strchr(garbled, garbled); // must not crash +} + int main () { strchr_small_sets(); strchr_zero_termination(); @@ -545,6 +551,7 @@ int main () { strchr_small_sets_chars(); strchr_unbounded(); strchr_invalid(); + strchr_garbled_mix_in_char(); return 0; } diff --git a/tests/non-free/strlen.c b/tests/non-free/strlen.c index 78dc9e17a9de1545ed0d72dba3998dcc3a29928e..f45980a6d36ce2b4637e4827c2f8881abf05de35 100644 --- a/tests/non-free/strlen.c +++ b/tests/non-free/strlen.c @@ -305,6 +305,31 @@ void big_array () { Frama_C_show_each(len_u, len_r, len_t); } +void negative_offsets() { + char buf[100]; + for (int i = 0; i < 100; i++) buf[i] = 'A'; //avoid memset due to C++ oracles + buf[99] = 0; + unsigned len1, len2, len3, len4, len5, len6; + if (nondet) { + int offset1 = Frama_C_interval(-10, -8); + len1 = strlen(buf + offset1); + } + if (nondet) { + int offset2 = Frama_C_interval(-2, -1); + len2 = strlen(buf + offset2); + } + int offset3 = Frama_C_interval(-1, -0); + len3 = strlen(buf + offset3); + int offset4 = Frama_C_interval(-1, 2); + len4 = strlen(buf + offset4); + int offset5 = Frama_C_interval(-4, 7); + len5 = strlen(buf + offset5); + int offset6 = Frama_C_interval(-10, 0); + char *p = buf + offset6; + len6 = strlen(p); + char dest[100 * 2]; +} + int main (int c) { small_sets(); zero_termination(); @@ -316,6 +341,6 @@ int main (int c) { bitfields2(); escaping(); big_array(); - + negative_offsets(); return 0; } diff --git a/tests/non-free/strnlen.c b/tests/non-free/strnlen.c new file mode 100644 index 0000000000000000000000000000000000000000..8b4c40a99f320cd95a7f9705139e949487a5976f --- /dev/null +++ b/tests/non-free/strnlen.c @@ -0,0 +1,18 @@ +#include <stdlib.h> // for size_t +#include <string.h> + +char t1[5] = "abcde"; +char t2[] = "abcde"; + +main(int c){ + int r1a, r1b, r1c, r2a, r2b, r2c; + r1a = strnlen(t1, 3); + r1b = strnlen(t1, 5); + if (c & 1) r1c = strnlen(t1, 6); + + r2a = strnlen(t2, 3); + r2b = strnlen(t2, 5); + r2c = strnlen(t2, 6); + + Frama_C_dump_each(); +} diff --git a/tests/non-free/strnlen.i b/tests/non-free/strnlen.i deleted file mode 100644 index 76e0dfdecd4356b4ec4fb73aeaaafc8e230a8e02..0000000000000000000000000000000000000000 --- a/tests/non-free/strnlen.i +++ /dev/null @@ -1,18 +0,0 @@ - -unsigned long Frama_C_strnlen(char *, unsigned long); - -char t1[5] = "abcde"; -char t2[] = "abcde"; - -main(int c){ - int r1a, r1b, r1c, r2a, r2b, r2c; - r1a = Frama_C_strnlen(t1, 3); - r1b = Frama_C_strnlen(t1, 5); - if (c & 1) r1c = Frama_C_strnlen(t1, 6); - - r2a = Frama_C_strnlen(t2, 3); - r2b = Frama_C_strnlen(t2, 5); - r2c = Frama_C_strnlen(t2, 6); - - Frama_C_dump_each(); -} diff --git a/tests/non-free/strnlen2.c b/tests/non-free/strnlen2.c index 375dcf635618716ee4942c368bc3ea8b86a10cbf..dd3a006258be37a2e31b3427f42df228f6bbcd31 100644 --- a/tests/non-free/strnlen2.c +++ b/tests/non-free/strnlen2.c @@ -484,6 +484,31 @@ void intervals() { //@ assert z9 >= 0 && z9 <= 9; } +void negative_offsets() { + char buf[100]; + for (int i = 0; i < 100; i++) buf[i] = 'A'; //avoid memset due to C++ oracles + buf[99] = 0; + unsigned len1, len2, len3, len4, len5, len6; + if (nondet) { + int offset1 = Frama_C_interval(-10, -8); + len1 = strnlen(buf + offset1, 100); + } + if (nondet) { + int offset2 = Frama_C_interval(-2, -1); + len2 = strnlen(buf + offset2, 100); + } + int offset3 = Frama_C_interval(-1, -0); + len3 = strnlen(buf + offset3, 100); + int offset4 = Frama_C_interval(-1, 2); + len4 = strnlen(buf + offset4, 100); + int offset5 = Frama_C_interval(-4, 7); + len5 = strnlen(buf + offset5, 100); + int offset6 = Frama_C_interval(-10, 0); + char *p = buf + offset6; + len6 = strnlen(p, 100); + char dest[100 * 2]; +} + int main (int c) { small_sets(); zero_termination(); @@ -504,5 +529,6 @@ int main (int c) { unbounded_n(); intervals(); + negative_offsets(); return 0; } diff --git a/tests/non-free/test_config b/tests/non-free/test_config index 0e9482838b1fa4cfd5507d681493e5f842a68553..221c9634e2ee63de2a01f920685dbfcd9b7c094c 100644 --- a/tests/non-free/test_config +++ b/tests/non-free/test_config @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -value-msg-key malloc -no-val-malloc-returns-null +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/non-free/test_config_apron b/tests/non-free/test_config_apron index cbd626e44648fba585d65d40ce131ee880f986fa..ee56ce968bd65eb8d6d312f694f032231d791448 100644 --- a/tests/non-free/test_config_apron +++ b/tests/non-free/test_config_apron @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-apron-oct -value-msg-key experimental-ok -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -value-msg-key malloc -no-val-malloc-returns-null -eva-apron-oct -value-msg-key experimental-ok +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/non-free/test_config_bitwise b/tests/non-free/test_config_bitwise index 003e88daba5aa2ef04e99b62b8d41bf9257deae9..4687c6de0812dbd9675b4af70072413c9cff1c36 100644 --- a/tests/non-free/test_config_bitwise +++ b/tests/non-free/test_config_bitwise @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-bitwise-domain -value-msg-key experimental-ok -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -value-msg-key malloc -no-val-malloc-returns-null -eva-bitwise-domain +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/non-free/test_config_equalities b/tests/non-free/test_config_equalities index fb9cae7754819483598a8703400a1070f4f4dc75..a379db1869173445173b40e2e85c4c472e1a8b9c 100644 --- a/tests/non-free/test_config_equalities +++ b/tests/non-free/test_config_equalities @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-equality-domain -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -value-msg-key malloc -no-val-malloc-returns-null -eva-equality-domain +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/non-free/test_config_gauges b/tests/non-free/test_config_gauges index 13ac46f05163a9f49867b3b4745c467a0c447e9b..42c600e7837c2c7b1e1329fcff56e0a006d0c175 100644 --- a/tests/non-free/test_config_gauges +++ b/tests/non-free/test_config_gauges @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-gauges-domain -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -value-msg-key malloc -no-val-malloc-returns-null -eva-gauges-domain +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/non-free/test_config_legacy b/tests/non-free/test_config_legacy deleted file mode 100644 index b2eeb1a3b14ad59249b03fce3d9cdbebbae84463..0000000000000000000000000000000000000000 --- a/tests/non-free/test_config_legacy +++ /dev/null @@ -1,2 +0,0 @@ -MACRO: VALUECONFIG -no-eva -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc diff --git a/tests/non-free/test_config_symblocs b/tests/non-free/test_config_symblocs index 06028c7d951b9310ee1070ad4f2d8a000a4fcaeb..65dedd2addce3afb12355fc212552693afd72b88 100644 --- a/tests/non-free/test_config_symblocs +++ b/tests/non-free/test_config_symblocs @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-symbolic-locations-domain -no-val-malloc-returns-null -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -value-msg-key malloc +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -value-msg-key malloc -no-val-malloc-returns-null -eva-symbolic-locations-domain +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/non-free/vla.c b/tests/non-free/vla.c new file mode 100644 index 0000000000000000000000000000000000000000..f4dbf4375f1884f0559de93f3be23f817f64b224 --- /dev/null +++ b/tests/non-free/vla.c @@ -0,0 +1,21 @@ +/* run.config* + STDOPT: #"-slevel 10 -val-builtins-auto" +*/ + +void f(int i) { + int t[i+1]; + Frama_C_show_each(t); + t[i] = i; + if (t[i] != i) { // test that we can always perform a strong update on the + // base corresponding to the vla. This works with the current allocation + // builtin (Frama_C_malloc_by_stack) because bases that are allocated + // multiple times, but that are never allocated twice _in the same state_ + // are never changed into weak bases. + //@ assert \false; + } +} + +void main() { + for (int i=1; i<10; i++) + f(i); +} diff --git a/tests/non-free/wcslen.c b/tests/non-free/wcslen.c new file mode 100644 index 0000000000000000000000000000000000000000..8d9d2db1d7b8d04d01d27fc85a47a0df8e4b5057 --- /dev/null +++ b/tests/non-free/wcslen.c @@ -0,0 +1,351 @@ +#include "__fc_builtin.h" +#include <wchar.h> +// NOTE: all unnamed assertions should be valid. +// Imprecise results should be defined using named +// assertions placed after the less restrictive ones, +// so that in the final output the following sentence +// never arises: +// Assertion got status unknown. +// Only named assertions may remain unknown, e.g.: +// Assertion 'refined' got status unknown. + +static volatile int nondet; +#define assert_bottom(exp,id) if (nondet) { exp; Frama_C_show_each_unreachable_ ## id(); } +#define wcslen Frama_C_wcslen +//@ assigns \result \from p[0..]; +size_t Frama_C_wcslen(const wchar_t *p); + +// Definitions for C++ oracle checking +typedef int Ival; +typedef int RES; +#define CHAR wchar_t +#define NONDET(a,b) (nondet ? (a) : (b)) +#define NONDET_STR(a,b) NONDET((a),(b)) +#define NONDET_STR2(a,b) NONDET((a),(b)) +#define IF_NONDET(var,val) if (nondet) var = val +#define RANGE(from,to) Frama_C_interval(from,to) +#define CHAR_ARRAY(var,n) wchar_t var[n] +#define CHAR_PTR(var) wchar_t *var +#define STRING(var,str) var = str; + +const wchar_t* static_str = L"Hello World\n"; +const wchar_t* zero_str = L"abc\0\0\0abc"; + +#define TSZ 12 +const wchar_t* tab_str[TSZ] = + { + L"" , // 0 + L"a", // 1 + L"aa" , // 2 + L"aaa" , // 3 + L"aaaa" , // 4 + L"aaaaa" , // 5 + L"aaaaaa" , // 6 + /* hole */ + L"aaaaaaaaa" , // 9 + L"aaaaaaaaaa" , + L"aaaaaaaaaaa", + L"aaaaaaaaaaaa" , + L"aaaaaaaaaaaaa" }; // 13 + +wchar_t unterminated_string[12] = L"unterminated"; + +int my_wcslen(const wchar_t *s, size_t offs) { + return wcslen(s+offs); +} + +void small_sets() { + wchar_t *s = L"abc"; + wchar_t *p = nondet ? s : (s+1); + int z1 = wcslen(p); + //@ assert (z1 == 2 || z1 == 3); + + s = L"\0bc"; + p = nondet ? s : (s+1); + int z2 = wcslen(p); + //@ assert (z2 == 0 || z2 == 2); + + s = L""; + p = s; + int z3 = wcslen(p); + //@ assert (z3 == 0); + + s = L"b\0c"; + p = nondet ? s : (s+2); + int z4 = wcslen(p); + //@ assert (z4 == 1); + + wchar_t t[4]; + t[0] = t[1] = nondet ? 0 : 1; + t[2] = t[3] = 1; + int z5 = Frama_C_wcslen(t); // warning + //@ assert z5 == 0 || z5 == 1; + +} + +void zero_termination() { + wchar_t empty_or_non_terminated[1]; + empty_or_non_terminated[0] = nondet ? 0 : 100; + int z1 = wcslen(empty_or_non_terminated); + //@ assert (z1 == 0); + + wchar_t non_terminated[1] = {'X'}; + assert_bottom(wcslen(non_terminated), non_terminated); + + wchar_t non_terminated2[4] = { 76, 0, 28, 14 }; + wchar_t *p = nondet ? ((wchar_t *)&non_terminated2) + 2 : ((wchar_t *)&non_terminated2) + 3; + assert_bottom(wcslen(p), p); + +} + +//DELPHIC_TEST +void wcslen_initialization() { + CHAR_ARRAY(empty_or_uninitialized, 1); + IF_NONDET(empty_or_uninitialized[0], 0); + RES z1 = my_wcslen(empty_or_uninitialized, 0); + //@ assert (z1 == 0); + + CHAR_ARRAY(uninitialized, 1); + assert_bottom(my_wcslen(uninitialized, 0), uninitialized); + + CHAR_ARRAY(s, 2); + IF_NONDET(s[0], 1); + s[1] = 0; + CHAR_PTR(p); + p = s; + RES z2 = my_wcslen(p, 0); + //@ assert (z2 == 1); + + CHAR_ARRAY(t, 4); + t[0] = t[1] = 10; + IF_NONDET(t[2], 10); + t[3] = 0; + p = t; + RES z3 = my_wcslen(p, 0); + //@ assert (z3 == 3); +} + +typedef struct { + int64_t a:32; + int64_t b:32; + int64_t c:63; +} st; + +void bitfields() { + st s; + s.a = 3; + s.b = 1; + s.c = 7; + wchar_t *p = &s; + assert_bottom(Frama_C_wcslen(p), p); +} + +typedef struct { + int64_t a:33; + int64_t b:63; + int64_t c:63; +} st2; + +void bitfields2() { + st2 s; + s.a = 3; + s.b = 1; + s.c = 0x70000; + wchar_t *p = &s; + int z1 = Frama_C_wcslen(p); + //@assert (z1 == 2); +} + +void init_array_nondet(wchar_t *a, int from, int to, int val1, int val2) { + int val = NONDET(val1, val2); + Frama_C_memset(a + from, val, sizeof(wchar_t)*(to-from+1)); + from = to = val1 = val2 = -1; // reset to minimize oracle changes +} + +//DELPHIC_TEST +void wcslen_large() { + CHAR_ARRAY(a, 100); + init_array_nondet(a, 0, 99, 1, 2); + a[20] = 0; + a[75] = 0; + Ival offset = RANGE(3, 30); + RES z1 = my_wcslen(a, offset); + //@ assert (z1 >= 0 && z1 <= 54); + + offset = RANGE(5, 17); + RES z2 = my_wcslen(a, offset); + //@ assert (z2 >= 3 && z2 <= 15); + + offset = RANGE(60, 74); + RES z3 = my_wcslen(a, offset); + //@ assert (z3 >= 1 && z3 <= 15); + + offset = RANGE(63, 80); + RES z4 = my_wcslen(a, offset); + //@ assert (z4 >= 0 && z4 <= 12); + + init_array_nondet(a, 0, 99, 0, 2); + offset = RANGE(50, 70); + RES z5 = my_wcslen(a, offset); + //@ assert (z5 >= 0 && z5 <= 49); + +} + +//DELPHIC_TEST +void wcslen_large_uninit() { + CHAR_ARRAY(a, 100); + init_array_nondet(a, 0, 39, 1, 2); + init_array_nondet(a, 50, 94, 3, 4); + a[20] = 0; + a[75] = 0; + + Ival offset = RANGE(3, 30); + RES z1 = my_wcslen(a, offset); + //@ assert (z1 >= 0 && z1 <= 17); + + a[98] = 0; + offset = RANGE(63, 80); + RES z2 = my_wcslen(a, offset); + //@ assert (z2 >= 0 && z2 <= 12); + + offset = RANGE(45, 55); + RES z3 = my_wcslen(a, offset); + //@ assert (z3 >= 20 && z3 <= 25); + + offset = 0; // avoid oracle diffs when changed +} + +void escaping() { + wchar_t s[4]; + { + int x; + *((int *)s) = &x; *((int *)&s[1]) = &x; *((int *)&s[2]) = &x; *((int *)&s[3]) = &x; + } + if (nondet) s[0] = 0; + int z1 = wcslen(s); // alarm + //@ assert (z1 == 0); + s[0] = 0; + int z2 = wcslen(s); // no alarm + //@ assert (z2 == 0); +} + +void misc() { + const wchar_t* loc_str = L"Bonjour Monde\n"; + wchar_t loc_char_array[5]; + size_t sz1,sz2,sz3,sz4,sz5,sz6,sz7,sz8; + int x[4]; x[0] = 0; x[1] = 0xef; x[2] = 0xcd; x[3] = 0xab; + int z[4]; z[0] = 0; z[1] = 0x56; z[2] = 0x23; z[3] = 0x12; + int i; + wchar_t *str; + + assert_bottom(Frama_C_wcslen(unterminated_string), unterminated_string); + + str = nondet ? static_str : loc_str; + sz1 = Frama_C_wcslen(str); + //@ assert(sz1 == 12) || (sz1 == 14); + str = x; + str = nondet ? str : str + 3; + sz2 = Frama_C_wcslen(str); + //@ assert(sz2 == 0) ; // no, could also do an RTE + i = Frama_C_interval(0,TSZ-1); + str = tab_str[i]; + sz3 = Frama_C_wcslen(str); + //@ assert (sz3 >= 0) && (sz3 <= 13); + loc_char_array[3] = L'\0'; + assert_bottom(Frama_C_wcslen(loc_char_array), loc_char_array); + sz4 = Frama_C_wcslen(zero_str); + //@ assert(sz4 == 3); + wchar_t *s1 = nondet ? L"abc" : L"ABCD"; + wchar_t *s2 = nondet ? s1 : s1+1; + sz5 = Frama_C_wcslen(s2); + //@ assert(sz5 >= 2 && sz5 <= 4); + + s1 = nondet ? L"efg" : L"EFGH"; + s2 = nondet ? s1+1 : s1+2; + sz6 = Frama_C_wcslen(s2); + //@ assert(sz6 >= 1 && sz6 <= 3); + + s1 = nondet ? L"mno\0pqr" : L"MNOP\0QRS"; + for (int j = 0; j < 8; j++) { + sz7 = Frama_C_wcslen(s1 + j); + //@ assert(sz7 >= 0 && sz7 <= 4); + } + + wchar_t maybe_init[2]; + maybe_init[1] = L'\0'; + if (nondet) maybe_init[0] = L'A'; + sz8 = Frama_C_wcslen(maybe_init); + //@ assert(sz8 == 1); +} + +void big_array () { + int64_t t[1000000]; + int64_t u[200]; + int64_t r[201]; + int64_t *p; + p = &t[nondet]; + *p = 0x1023678900000000; + //int64_t v[2] = {0x00006767, 0x10102323}; + //memcpy(p, v, sizeof(v));// *p = 0x67676767; *(p+1) = 0; *(p+2) = 0x23232323; *(p+3) = 0x10101010; + p = &u[nondet]; + *p = 0x1023678900000000; + //memcpy(p, v, sizeof(v));// *p = 0x67676767; *(p+1) = 0; *(p+2) = 0x23232323; *(p+3) = 0x10101010; + p = &r[nondet]; + *p = 0x1023678900000000; + //memcpy(p, v, sizeof(v));// *p = 0x67676767; *(p+1) = 0; *(p+2) = 0x23232323; *(p+3) = 0x10101010; + + unsigned long len_u; + unsigned long len_r; + unsigned long len_t; + + len_u = wcslen(u); // below plevel; precise + len_r = wcslen(r); // above plevel; imprecise + len_t = wcslen(t); // *far* above plevel + Frama_C_show_each(len_u, len_r, len_t); + + len_u = wcslen(u+nondet); // should be precise + len_r = wcslen(r+nondet); + len_t = wcslen(t+nondet); + Frama_C_show_each(len_u, len_r, len_t); +} + +void negative_offsets() { + wchar_t buf[100]; + for (int i = 0; i < 100; i++) buf[i] = L'A'; //avoid memset due to C++ oracles + buf[99] = 0; + unsigned len1, len2, len3, len4, len5, len6; + if (nondet) { + int offset1 = Frama_C_interval(-10, -8); + len1 = wcslen(buf + offset1); + } + if (nondet) { + int offset2 = Frama_C_interval(-2, -1); + len2 = wcslen(buf + offset2); + } + int offset3 = Frama_C_interval(-1, -0); + len3 = wcslen(buf + offset3); + int offset4 = Frama_C_interval(-1, 2); + len4 = wcslen(buf + offset4); + int offset5 = Frama_C_interval(-4, 7); + len5 = wcslen(buf + offset5); + int offset6 = Frama_C_interval(-10, 0); + wchar_t *p = buf + offset6; + len6 = wcslen(p); + *(p+len6) = 0; + wchar_t dest[100 * 2]; +} + +int main (int c) { + small_sets(); + zero_termination(); + wcslen_initialization(); + wcslen_large(); + wcslen_large_uninit(); + misc(); + bitfields(); + bitfields2(); + escaping(); + big_array(); + negative_offsets(); + return 0; +} diff --git a/tests/non-free/write-const.c b/tests/non-free/write-const.c new file mode 100644 index 0000000000000000000000000000000000000000..a7c1efba2e970f67922eddca322e98a527b698f1 --- /dev/null +++ b/tests/non-free/write-const.c @@ -0,0 +1,48 @@ +/* run.config* + OPT: -val @VALUECONFIG@ -journal-disable -val-builtins-auto -calldeps +*/ + +// This test verifies that writing in a memory location that may be const +// is correctly handled + +#include "string.h" + +volatile int v; + +const int a = -1; +int b; + +void main0() { + int *p = v ? &a : &b; + int x = 1; + memcpy(p, &x, sizeof(x)); + Frama_C_dump_each(); +} + +void main1() { + int *p = v ? &a : &b; + int x = 1; + memset(p, 5, sizeof(x)); + Frama_C_dump_each(); +} + + +void main2() { + int *p = v ? &a : &b; + *p = 1; + Frama_C_dump_each(); +} + +void main3() { + int *p = v ? &a : &b; + int y = 2; + *p = y; + Frama_C_dump_each(); +} + +void main() { + main0(); + main1(); + main2(); + main3(); +} diff --git a/tests/occurrence/oracle/decl_func.res.oracle b/tests/occurrence/oracle/decl_func.res.oracle index 88d91a7b19dd9d7b17803ed291f2e92b6696aef2..48f485ec3acb99a9e9472c20f60dea50a0a48e42 100644 --- a/tests/occurrence/oracle/decl_func.res.oracle +++ b/tests/occurrence/oracle/decl_func.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/occurrence/decl_func.i (no preprocessing) [occurrence] beginning analysis [value] Analyzing a complete application starting at main @@ -20,25 +19,15 @@ [value] Recording results for main [value] done for function main [occurrence] analysis done -[occurrence] variable dest (parameter of Frama_C_bzero): - specification of Frama_C_bzero: dest - variable n (parameter of Frama_C_bzero): - specification of Frama_C_bzero: n - variable dest (parameter of Frama_C_copy_block): - specification of Frama_C_copy_block: dest - variable size (parameter of Frama_C_copy_block): - specification of Frama_C_copy_block: size - variable n (parameter of Frama_C_copy_block): - specification of Frama_C_copy_block: n - variable x (global): +[occurrence] variable x (global): global: x variable y (global): global: y variable x (parameter of f): specification of f: x variable y_0 (local of main): - sid 1: y_0 + sid 2: y_0 variable z (local of main): - sid 2: z + sid 3: z variable tmp_0 (local of main): sid 4: tmp_0 diff --git a/tests/occurrence/oracle/ptr_assert.res.oracle b/tests/occurrence/oracle/ptr_assert.res.oracle index 615f1187fa7ad561d2b8dbf4f1b5c4ba9e17c285..d908e670e651ec983cf02ec56cb4d34f26eed51b 100644 --- a/tests/occurrence/oracle/ptr_assert.res.oracle +++ b/tests/occurrence/oracle/ptr_assert.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/occurrence/ptr_assert.i (no preprocessing) [occurrence] beginning analysis [value] Analyzing a complete application starting at main @@ -12,23 +11,13 @@ tests/occurrence/ptr_assert.i:16:[value] assertion got status valid. [value] Recording results for main [value] done for function main [occurrence] analysis done -[occurrence] variable dest (parameter of Frama_C_bzero): - specification of Frama_C_bzero: dest - variable n (parameter of Frama_C_bzero): - specification of Frama_C_bzero: n - variable dest (parameter of Frama_C_copy_block): - specification of Frama_C_copy_block: dest - variable size (parameter of Frama_C_copy_block): - specification of Frama_C_copy_block: size - variable n (parameter of Frama_C_copy_block): - specification of Frama_C_copy_block: n - variable x (global): - sid 2: x +[occurrence] variable x (global): + sid 1: x variable y (global): - sid 5: y + sid 4: y variable z (parameter of main): - sid 12: z + sid 10: z variable p (local of main): sid 2: p variable q (local of main): - sid 5: q + sid 4: q diff --git a/tests/pdg/annot.c b/tests/pdg/annot.c index 4eb8cea867e94e8cc9822fbc770639dd5ff35d24..b1dcaabf0101b01a631cc987b2b722500c8e2714 100644 --- a/tests/pdg/annot.c +++ b/tests/pdg/annot.c @@ -1,6 +1,6 @@ /* run.config - OPT: -fct-pdg f1 -main f1 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg loop -main loop -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg f1 -main f1 -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg loop -main loop -journal-disable -pdg-print -pdg-verbose 2 */ int G; diff --git a/tests/pdg/array_struct.i b/tests/pdg/array_struct.i index 8f9d83fee801cc5c5c84f28333b3d5ff336266c1..5afe87fcacd1b6e2dc5bc0fecdf5cd067a6d8fbb 100644 --- a/tests/pdg/array_struct.i +++ b/tests/pdg/array_struct.i @@ -1,5 +1,5 @@ /* run.config - OPT: -pdg -pdg-print -journal-disable -pdg-verbose 2 + OPT: -val-show-progress -pdg -pdg-print -journal-disable -pdg-verbose 2 */ typedef struct { diff --git a/tests/pdg/assigns.i b/tests/pdg/assigns.i index 800c97def6c8f12333c5653ac1686f036a8ee52d..b2ade3fe4801c6f5d0430089c0e9b69cb33037c6 100644 --- a/tests/pdg/assigns.i +++ b/tests/pdg/assigns.i @@ -1,5 +1,5 @@ /* run.config - OPT: -journal-disable -pdg -pdg-print -calldeps -pdg-verbose 2 + OPT: -journal-disable -val-show-progress -pdg -pdg-print -calldeps -pdg-verbose 2 */ unsigned int x, y; diff --git a/tests/pdg/bts1194.c b/tests/pdg/bts1194.c index 1b8c901aa082c0e1d85f4e3ae6b447a662be2666..1df47e0ef9d3c96fccc406728c37715471f484f1 100644 --- a/tests/pdg/bts1194.c +++ b/tests/pdg/bts1194.c @@ -1,5 +1,5 @@ /* run.config - OPT: -val -inout-callwise -inout -pdg -pdg-print -calldeps -deps -then -slice-return main -then-on "Slicing export" -print + OPT: -val -inout -val-show-progress -pdg -pdg-print -calldeps -deps -then -slice-return main -then-last -print -val-show-progress */ int Y, X; diff --git a/tests/pdg/call.c b/tests/pdg/call.c index c7d5335a00a3b21647e72740ad18d8f640bad088..ffec257d8e32c489ed20f5804811cd701dc138c6 100644 --- a/tests/pdg/call.c +++ b/tests/pdg/call.c @@ -1,9 +1,9 @@ /* run.config GCC: - OPT: -lib-entry -main g -pdg -pdg-dot tests/pdg/call -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main g -val-show-progress -pdg -pdg-dot tests/pdg/call -journal-disable -pdg-print -pdg-verbose 2 */ -/* Ne pas modifier : exemple utilisé dans le rapport. */ +/* Ne pas modifier : exemple utilisé dans le rapport. */ /*BDOC*/ struct {int a; int b; } G; diff --git a/tests/pdg/calls_and_implicits.c b/tests/pdg/calls_and_implicits.c index 9869e7db2931d392b02f3847dcac388e903bf230..64c5a1a75a450de74b4b31ee8add3725e940c9b7 100644 --- a/tests/pdg/calls_and_implicits.c +++ b/tests/pdg/calls_and_implicits.c @@ -1,6 +1,6 @@ /* run.config * GCC: - * OPT: -fct-pdg main -inout -journal-disable -pdg-print -pdg-verbose 2 + * OPT: -val-show-progress -fct-pdg main -inout -journal-disable -pdg-print -pdg-verbose 2 * */ diff --git a/tests/pdg/calls_and_struct.c b/tests/pdg/calls_and_struct.c index 1d4644e3efb3223092edf3b021ff2d115beed944..9fc0dfcdfb3a1b635775da0508ab2e72052e63d3 100644 --- a/tests/pdg/calls_and_struct.c +++ b/tests/pdg/calls_and_struct.c @@ -1,6 +1,6 @@ /* run.config GCC: - OPT: -deps -input -out -inout -pdg -journal-disable -pdg-print -pdg-verbose 2 + OPT: -deps -input -out -inout -val-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 */ struct Tstr { int a; int b; int c; }; diff --git a/tests/pdg/const.i b/tests/pdg/const.i index 0c5b77842a7a1ece2d9178db56a1dbc77155c46d..620e5a7ccc93df3e8515531de470afb6be4989bc 100644 --- a/tests/pdg/const.i +++ b/tests/pdg/const.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: #" -load-module pdg -calldeps -pdg -pdg-print" + STDOPT: #" -load-module pdg -calldeps -val-show-progress -pdg -pdg-print" */ struct T1 { diff --git a/tests/pdg/decl_dpds.c b/tests/pdg/decl_dpds.c index a072e458b12b32875eb78e320c7639c24c324392..aab018fccbe0bcb048b89047e8264a37a70e1ccb 100644 --- a/tests/pdg/decl_dpds.c +++ b/tests/pdg/decl_dpds.c @@ -1,6 +1,6 @@ /* run.config GCC: - OPT: -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 */ extern int G; diff --git a/tests/pdg/doc_dot.c b/tests/pdg/doc_dot.c index d04c488447d849a8696693efc10fbf7836f8d287..b67d482f569da84dff713e448e37181bdba8d998 100644 --- a/tests/pdg/doc_dot.c +++ b/tests/pdg/doc_dot.c @@ -1,5 +1,5 @@ /* run.config - OPT: -lib-entry -main g -fct-pdg g -pdg-dot tests/pdg/doc -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main g -val-show-progress -fct-pdg g -pdg-dot tests/pdg/doc -journal-disable -pdg-print -pdg-verbose 2 */ /* To build the svg file: * dot -Tsvg tests/pdg/doc.g.dot > tests/pdg/doc.g.svg diff --git a/tests/pdg/dpds_intra.c b/tests/pdg/dpds_intra.c index 130ea81e73457bc4ea134f31d41e54ca7d8246b9..1e48df58645a2c1041effb45870fe0ce5b4993d3 100644 --- a/tests/pdg/dpds_intra.c +++ b/tests/pdg/dpds_intra.c @@ -1,18 +1,18 @@ /* run.config GCC: - OPT: -fct-pdg test_struct -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg test_if_simple -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg test_goto_simple -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg test_goto_arriere -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg test_goto_else -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg test_struct -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg test_if_simple -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg test_goto_simple -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg test_goto_arriere -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg test_goto_else -journal-disable -pdg-print -pdg-verbose 2 OPT: -main test_ctrl_dpd_multiple -journal-disable -pdg-print -pdg-verbose 2 => ne passe pas - OPT: -fct-pdg test_simple_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 - OPT: -fct-pdg multiple_global_inputs -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg test_simple_loop -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg multiple_global_inputs -journal-disable -pdg-print -pdg-verbose 2 */ /* bin/toplevel.opt -deps -main g tests/slicing/dpds_intra.c */ -/* bin/toplevel.opt -fct-pdg test_goto_simple tests/slicing/dpds_intra.c -pdg-dot */ +/* bin/toplevel.opt -val-show-progress -fct-pdg test_goto_simple tests/slicing/dpds_intra.c -pdg-dot */ extern int G; diff --git a/tests/pdg/dyn_dpds.c b/tests/pdg/dyn_dpds.c index ec837cd3edf0035da76152f19c159dfe118ab6ba..85418f85a1ba95f043f60eda69b53adac4c050d1 100644 --- a/tests/pdg/dyn_dpds.c +++ b/tests/pdg/dyn_dpds.c @@ -1,11 +1,11 @@ /* run.config - OPT: -load-script tests/pdg/dyn_dpds.ml -deps -journal-disable -pdg-print -pdg-verbose 2 + OPT: -load-script tests/pdg/dyn_dpds.ml -val-show-progress -deps -journal-disable -pdg-print -pdg-verbose 2 */ /* To have a look at the dot PDG : - bin/toplevel.byte -deps -pdg-dot pdg -fct-pdg main tests/pdg/dyn_dpds.c ; + bin/toplevel.byte -deps -pdg-dot pdg -val-show-progress -fct-pdg main tests/pdg/dyn_dpds.c ; zgrviewer pdg.main.dot or use tests/pdg/dyn_dpds.ml to test the dynamic dependencies. diff --git a/tests/pdg/inter_alias.c b/tests/pdg/inter_alias.c index 3b189b6095fbe865c4b30b4bd2c3a3b12c8f1a1d..75ca41afb7237cf6e6ececd13b1d82de2f3ec77e 100644 --- a/tests/pdg/inter_alias.c +++ b/tests/pdg/inter_alias.c @@ -1,6 +1,6 @@ /* run.config GCC: - OPT: -val -out -input -calldeps -pdg -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val -out -input -calldeps -val-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 */ int G; diff --git a/tests/pdg/inter_alias2.c b/tests/pdg/inter_alias2.c index 80d67585d517811a966ac0a0df0286a22155136c..2bc7dbaf71e2297b37b7446fb2c595303ac51134 100644 --- a/tests/pdg/inter_alias2.c +++ b/tests/pdg/inter_alias2.c @@ -1,9 +1,9 @@ /* run.config * GCC: - * OPT: -val -journal-disable -pdg-print -pdg-verbose 2 - * OPT: -calldeps -fct-pdg incr_ptr -journal-disable -pdg-print -pdg-verbose 2 - * OPT: -calldeps -fct-pdg f1 -journal-disable -pdg-print -pdg-verbose 2 - * OPT: -calldeps -fct-pdg f2 -journal-disable -pdg-print -pdg-verbose 2 + * OPT: -val-show-progress -val -journal-disable -pdg-print -pdg-verbose 2 + * OPT: -calldeps -val-show-progress -fct-pdg incr_ptr -journal-disable -pdg-print -pdg-verbose 2 + * OPT: -calldeps -val-show-progress -fct-pdg f1 -journal-disable -pdg-print -pdg-verbose 2 + * OPT: -calldeps -val-show-progress -fct-pdg f2 -journal-disable -pdg-print -pdg-verbose 2 */ void incr_ptr (int *p) { *p += 1; diff --git a/tests/pdg/loops.c b/tests/pdg/loops.c index 1ff1cc84150912b006b1771141fab6c7dd5878b8..093f8e4ea82ff5165cf08266e91ecb4ec3ef839c 100644 --- a/tests/pdg/loops.c +++ b/tests/pdg/loops.c @@ -1,14 +1,14 @@ /* run.config GCC: - OPT: -lib-entry -main simple -fct-pdg simple -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main simple_with_break -fct-pdg simple_with_break -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main infinite -fct-pdg infinite -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main infinite2 -fct-pdg infinite2 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main maybe_infinite -fct-pdg maybe_infinite -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main two_infinite_loops -fct-pdg two_infinite_loops -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main loop_with_goto -fct-pdg loop_with_goto -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main non_natural_loop -fct-pdg non_natural_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main dead_code -fct-pdg dead_code -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main simple -val-show-progress -fct-pdg simple -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main simple_with_break -val-show-progress -fct-pdg simple_with_break -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main infinite -val-show-progress -fct-pdg infinite -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main infinite2 -val-show-progress -fct-pdg infinite2 -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main maybe_infinite -val-show-progress -fct-pdg maybe_infinite -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main two_infinite_loops -val-show-progress -fct-pdg two_infinite_loops -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main loop_with_goto -val-show-progress -fct-pdg loop_with_goto -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main non_natural_loop -val-show-progress -fct-pdg non_natural_loop -journal-disable -pdg-print -pdg-verbose 2 + OPT: -lib-entry -main dead_code -val-show-progress -fct-pdg dead_code -journal-disable -pdg-print -pdg-verbose 2 @@ -24,11 +24,11 @@ bin/toplevel.opt -lib-entry -main $F -deps -verbose tests/pdg/loops.c zgrviewer ./$F_cfg.dot Pour voir les postdominateurs : -bin/toplevel.opt -lib-entry -main $F -fct-pdg $F -dot-postdom p tests/pdg/loops.c ; +bin/toplevel.opt -lib-entry -main $F -val-show-progress -fct-pdg $F -dot-postdom p tests/pdg/loops.c ; zgrviewer ./p.$F.dot Pour voir le PDG : -bin/toplevel.opt -lib-entry -main $F -fct-pdg $F -pdg-dot pdg tests/pdg/loops.c ; +bin/toplevel.opt -lib-entry -main $F -val-show-progress -fct-pdg $F -pdg-dot pdg tests/pdg/loops.c ; zgrviewer ./pdg.$F.dot */ diff --git a/tests/pdg/multiple_calls.c b/tests/pdg/multiple_calls.c index 8371ee2dbbf5a562484f30730cb0a844f439b501..d795a5ed7da9992b402008d4c510b5d8d01c8eeb 100644 --- a/tests/pdg/multiple_calls.c +++ b/tests/pdg/multiple_calls.c @@ -1,7 +1,7 @@ /* run.config GCC: - OPT: -inout -deps -main appel_ptr_fct -fct-pdg appel_ptr_fct -journal-disable -pdg-print -pdg-verbose 2 - OPT: -inout -deps -main appel_ptr_fct_bis -fct-pdg appel_ptr_fct_bis -journal-disable -pdg-print -pdg-verbose 2 + OPT: -inout -deps -main appel_ptr_fct -val-show-progress -fct-pdg appel_ptr_fct -journal-disable -pdg-print -pdg-verbose 2 + OPT: -inout -deps -main appel_ptr_fct_bis -val-show-progress -fct-pdg appel_ptr_fct_bis -journal-disable -pdg-print -pdg-verbose 2 */ extern int G1, G2, G3, G4; diff --git a/tests/pdg/no_body.c b/tests/pdg/no_body.c index aaddeca7111689e578fc6daf747bee69433f0c18..afa48a8f740b31369ec192c072b5e019ff26e692 100644 --- a/tests/pdg/no_body.c +++ b/tests/pdg/no_body.c @@ -1,9 +1,9 @@ /* run.config * GCC: -* OPT: -fct-pdg main -inout -journal-disable -pdg-print -pdg-verbose 2 +* OPT: -val-show-progress -fct-pdg main -inout -journal-disable -pdg-print -pdg-verbose 2 */ /* - * ledit bin/toplevel.top tests/slicing/no_body.c -fct-pdg main + * ledit bin/toplevel.top tests/slicing/no_body.c -val-show-progress -fct-pdg main * #use "tests/slicing/select.ml";; * test "loop" (select_data "G");; */ diff --git a/tests/pdg/oracle/annot.0.res.oracle b/tests/pdg/oracle/annot.0.res.oracle index 56c1fa311cf7efb7d673a24841062f70238ca1dc..22d7a1032aa5273ffa260449fbdd1f71c4e93d87 100644 --- a/tests/pdg/oracle/annot.0.res.oracle +++ b/tests/pdg/oracle/annot.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/annot.c (with preprocessing) [value] Analyzing a complete application starting at f1 [value] Computing initial state @@ -18,7 +17,7 @@ tests/pdg/annot.c:13:[value] assertion got status valid. {n3}: In1 -[a--]-> 2 {n4}: VarDecl : a - {n5}: a = 10; + {n5}: int a = 10; -[-c-]-> 1 -[a--]-> 4 {n6}: x < 10 diff --git a/tests/pdg/oracle/annot.1.res.oracle b/tests/pdg/oracle/annot.1.res.oracle index dffd8c326667ac9ee44347638371e819b01f1325..115263fd1862ae21e01d800fd4fe37beae762c24 100644 --- a/tests/pdg/oracle/annot.1.res.oracle +++ b/tests/pdg/oracle/annot.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/annot.c (with preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state @@ -20,7 +19,7 @@ tests/pdg/annot.c:26:[value] warning: signed overflow. assert s + 2 ≤ 21474836 -[a--]-> 2 {n4}: VarDecl : i {n5}: VarDecl : s - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 5 {n7}: i = 0; diff --git a/tests/pdg/oracle/array_struct.res.oracle b/tests/pdg/oracle/array_struct.res.oracle index 58b8dfac9e31e23a1006944cbc3dd70eb67fd9a8..bb547f8a632a9cecb7ab76341797fe04d8669f16 100644 --- a/tests/pdg/oracle/array_struct.res.oracle +++ b/tests/pdg/oracle/array_struct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/array_struct.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/assigns.res.oracle b/tests/pdg/oracle/assigns.res.oracle index d152fc70a34c984d981cd94c581907b51c3fc1f2..dccaa4dabb41f4a8839ac4dd1f6c2ad1a527ca37 100644 --- a/tests/pdg/oracle/assigns.res.oracle +++ b/tests/pdg/oracle/assigns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/assigns.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/bts1194.res.oracle b/tests/pdg/oracle/bts1194.res.oracle index c294993c221af5b7a3e16ebde94889c3fa2b7d95..bb1dec6f404bf60e2986c26496440b363a30c8dd 100644 --- a/tests/pdg/oracle/bts1194.res.oracle +++ b/tests/pdg/oracle/bts1194.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/bts1194.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -156,7 +155,7 @@ tests/pdg/bts1194.c:22:[pdg] warning: no final state. Probably unreachable... [pdg] PDG for f {n13}: InCtrl {n14}: VarDecl : l - {n15}: l = 0; + {n15}: int l = 0; -[-c-]-> 13 -[a--]-> 14 {n16}: Call2-InCtrl : Y = input(); @@ -196,7 +195,7 @@ tests/pdg/bts1194.c:22:[pdg] warning: no final state. Probably unreachable... {n29}: In(X) {n30}: In(v) [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] applying all slicing requests... [slicing] applying 0 actions... diff --git a/tests/pdg/oracle/call.res.oracle b/tests/pdg/oracle/call.res.oracle index 8af7e673c48e9d9889f15d2641a11ee0b2afa08f..57dd234ffd2b453d47e6e7709eb59fca4f3572b3 100644 --- a/tests/pdg/oracle/call.res.oracle +++ b/tests/pdg/oracle/call.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/call.c (with preprocessing) [value] Analyzing an incomplete application starting at g [value] Computing initial state @@ -69,25 +68,25 @@ tests/pdg/call.c:14:[value] warning: signed overflow. assert a + G.a ≤ 2147483 {n18}: In3 -[a--]-> 17 {n19}: VarDecl : r - {n20}: Call5-InCtrl : r = f(x + y,z); + {n20}: Call5-InCtrl : int r = f(x + y,z); -[-c-]-> 12 - {n21}: Call5-In1 : r = f(x + y,z); + {n21}: Call5-In1 : int r = f(x + y,z); -[-c-]-> 12 -[--d]-> 13 -[--d]-> 14 -[--d]-> 15 -[--d]-> 16 -[-c-]-> 20 - {n22}: Call5-In2 : r = f(x + y,z); + {n22}: Call5-In2 : int r = f(x + y,z); -[-c-]-> 12 -[--d]-> 17 -[--d]-> 18 -[-c-]-> 20 - {n23}: Call5-Out(G.b) : r = f(x + y,z); + {n23}: Call5-Out(G.b) : int r = f(x + y,z); -[-c-]-> 12 -[-c-]-> 20 -[--d]-> 22 - {n24}: Call5-OutRet : r = f(x + y,z); + {n24}: Call5-OutRet : int r = f(x + y,z); -[-c-]-> 12 -[a--]-> 19 -[-c-]-> 20 diff --git a/tests/pdg/oracle/calls_and_implicits.res.oracle b/tests/pdg/oracle/calls_and_implicits.res.oracle index 840aeeecd5f83e2fb4ad0caf3a34bfa7c5039ebf..248cd305dd4cb8c0691e8ceeb208c683a0938e77 100644 --- a/tests/pdg/oracle/calls_and_implicits.res.oracle +++ b/tests/pdg/oracle/calls_and_implicits.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/calls_and_implicits.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -68,43 +67,43 @@ -[-c-]-> 1 {n4}: G2 = 0; -[-c-]-> 1 - {n5}: Call16-InCtrl : t[G] = f(); + {n5}: Call15-InCtrl : t[G] = f(); -[-c-]-> 1 - {n6}: Call16-Out(G) : t[G] = f(); + {n6}: Call15-Out(G) : t[G] = f(); -[-c-]-> 1 -[--d]-> 3 -[-c-]-> 5 - {n7}: Call16-OutRet : t[G] = f(); + {n7}: Call15-OutRet : t[G] = f(); -[-c-]-> 1 -[-c-]-> 5 -[a--](G)-> 6 - {n8}: Call17-InCtrl : t[G] = f(); + {n8}: Call16-InCtrl : t[G] = f(); -[-c-]-> 1 - {n9}: Call17-Out(G) : t[G] = f(); + {n9}: Call16-Out(G) : t[G] = f(); -[-c-]-> 1 -[--d](G)-> 6 -[-c-]-> 8 - {n10}: Call17-OutRet : t[G] = f(); + {n10}: Call16-OutRet : t[G] = f(); -[-c-]-> 1 -[-c-]-> 8 -[a--](G)-> 9 - {n11}: Call18-InCtrl : G = f2(); + {n11}: Call17-InCtrl : G = f2(); -[-c-]-> 1 - {n12}: Call18-Out(G2) : G = f2(); + {n12}: Call17-Out(G2) : G = f2(); -[-c-]-> 1 -[--d](G)-> 9 -[-c-]-> 11 - {n13}: Call18-OutRet : G = f2(); + {n13}: Call17-OutRet : G = f2(); -[-c-]-> 1 -[--d](G)-> 9 -[-c-]-> 11 - {n14}: Call20-InCtrl : swap(); + {n14}: Call19-InCtrl : swap(); -[-c-]-> 1 - {n15}: Call20-Out(G) : swap(); + {n15}: Call19-Out(G) : swap(); -[-c-]-> 1 -[--d](G2)-> 12 -[-c-]-> 14 - {n16}: Call20-Out(G2) : swap(); + {n16}: Call19-Out(G2) : swap(); -[-c-]-> 1 -[--d]-> 13 -[-c-]-> 14 diff --git a/tests/pdg/oracle/calls_and_struct.res.oracle b/tests/pdg/oracle/calls_and_struct.res.oracle index 693d3371d176c4f93f03078fee221ea6246853fa..8cab2ee46d4021743b6e688769e28f7ba046e43e 100644 --- a/tests/pdg/oracle/calls_and_struct.res.oracle +++ b/tests/pdg/oracle/calls_and_struct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/calls_and_struct.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -83,7 +82,7 @@ {n1}: InCtrl {n2}: VarDecl : s {n3}: VarDecl : __retres - {n4}: s = S; + {n4}: struct Tstr s = S; -[-c-]-> 1 -[a--]-> 2 -[--d]-> 8 @@ -131,9 +130,9 @@ {n20}: InCtrl {n21}: VarDecl : a {n22}: VarDecl : tmp_0 - {n23}: Call11-InCtrl : a = asgn_struct(); + {n23}: Call10-InCtrl : int a = asgn_struct(); -[-c-]-> 20 - {n24}: Call11-OutRet : a = asgn_struct(); + {n24}: Call10-OutRet : int a = asgn_struct(); -[-c-]-> 20 -[a--]-> 21 -[-c-]-> 23 @@ -146,22 +145,22 @@ -[-c-]-> 20 {n27}: C = 3; -[-c-]-> 20 - {n28}: Call15-InCtrl : tmp_0 = f(S); + {n28}: Call14-InCtrl : tmp_0 = f(S); -[-c-]-> 20 - {n29}: Call15-In1 : tmp_0 = f(S); + {n29}: Call14-In1 : tmp_0 = f(S); -[-c-]-> 20 -[-c-]-> 28 -[--d]-> 36 - {n30}: Call15-Out(S.a) : tmp_0 = f(S); + {n30}: Call14-Out(S.a) : tmp_0 = f(S); -[-c-]-> 20 -[-c-]-> 28 -[--d]-> 35 - {n31}: Call15-Out(A) : tmp_0 = f(S); + {n31}: Call14-Out(A) : tmp_0 = f(S); -[-c-]-> 20 -[--d]-> 25 -[-c-]-> 28 -[--d]-> 29 - {n32}: Call15-OutRet : tmp_0 = f(S); + {n32}: Call14-OutRet : tmp_0 = f(S); -[-c-]-> 20 -[a--]-> 22 -[-c-]-> 28 diff --git a/tests/pdg/oracle/const.res.oracle b/tests/pdg/oracle/const.res.oracle index 5767a46b0d064831ebfb1d06d6e9c8b993dfd302..2586fb8fadb5c29a7527fc44d3bb9a61e995bbcd 100644 --- a/tests/pdg/oracle/const.res.oracle +++ b/tests/pdg/oracle/const.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/const.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -100,7 +99,7 @@ {n11}: In1 -[a--]-> 10 {n12}: VarDecl : V1 - {n13}: V1 = 1; + {n13}: int V1 = 1; -[-c-]-> 9 -[a--]-> 12 {n14}: (f2->M5)->M1 = 0; diff --git a/tests/pdg/oracle/decl_dpds.res.oracle b/tests/pdg/oracle/decl_dpds.res.oracle index cfd303bf76abfc72c921958334cab76e66442167..2412b6d07d0c79c86a241f8d930df1f144221ed5 100644 --- a/tests/pdg/oracle/decl_dpds.res.oracle +++ b/tests/pdg/oracle/decl_dpds.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/decl_dpds.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -21,6 +20,7 @@ tests/pdg/decl_dpds.c:25:[value] warning: signed overflow. tests/pdg/decl_dpds.c:25:[value] warning: signed overflow. assert (int)((int)(argc0 + argc1) + G) + S.a ≤ 2147483647; [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 1 assertion(s) [pdg] computing for function main [pdg] done for function main [pdg] PDG for main @@ -52,72 +52,69 @@ tests/pdg/decl_dpds.c:25:[value] warning: signed overflow. assert (int)((int)(ar -[a-d]-> 2 -[--d]-> 3 -[-c-]-> 12 - {n15}: ; - -[-c-]-> 1 - -[-c-]-> 12 - {n16}: argc0 = tmp; + {n15}: int argc0 = tmp; -[-c-]-> 1 -[a--]-> 6 -[--d]-> 7 -[--d]-> 13 - {n17}: argc1 = argc; + {n16}: int argc1 = argc; -[-c-]-> 1 -[--d]-> 2 -[a--]-> 8 -[--d]-> 14 - {n18}: c = *(*(argv + (argc - 1)) + 0); + {n17}: char c = *(*(argv + (argc - 1)) + 0); -[-c-]-> 1 -[--d]-> 2 -[--d]-> 4 -[--d]-> 5 -[a--]-> 9 -[--d]-> 14 + -[--d]-> 28 -[--d]-> 29 -[--d]-> 30 - -[--d]-> 31 - {n19}: *(*(argv + (argc - 1)) + 0) = (char)'a'; + {n18}: *(*(argv + (argc - 1)) + 0) = (char)'a'; -[-c-]-> 1 -[a--]-> 2 -[a--]-> 4 -[a--]-> 5 -[a--]-> 14 - -[a--]-> 29 - {n20}: argc = 0; + -[a--]-> 28 + {n19}: argc = 0; -[-c-]-> 1 -[a--]-> 2 - {n21}: argc0 + {n20}: argc0 -[-c-]-> 1 -[--d]-> 6 - -[--d]-> 16 - {n22}: p = & argc0; + -[--d]-> 15 + {n21}: int *p = & argc0; -[-c-]-> 1 -[--d]-> 6 -[a--]-> 10 - -[-c-]-> 21 - {n23}: (*p) ++; + -[-c-]-> 20 + {n22}: (*p) ++; -[-c-]-> 1 -[a-d]-> 10 - -[--d]-> 16 - -[-c-]-> 21 - -[a-d]-> 22 - {n24}: __retres = ((argc0 + argc1) + G) + S.a; + -[--d]-> 15 + -[-c-]-> 20 + -[a-d]-> 21 + {n23}: __retres = ((argc0 + argc1) + G) + S.a; -[-c-]-> 1 -[--d]-> 6 -[--d]-> 8 -[a--]-> 11 + -[--d]-> 15 -[--d]-> 16 - -[--d]-> 17 - -[--d]-> 23 + -[--d]-> 22 + -[--d]-> 26 -[--d]-> 27 - -[--d]-> 28 - {n25}: return __retres; + {n24}: return __retres; -[-c-]-> 1 -[--d]-> 11 + -[--d]-> 23 + {n25}: OutRet -[--d]-> 24 - {n26}: OutRet - -[--d]-> 25 - {n27}: In(G) - {n28}: In(S.a) - {n29}: In(S_argv[0..3]) - {n30}: In(S_0_S_argv[0]) - {n31}: In(S_1_S_argv[0]) + {n26}: In(G) + {n27}: In(S.a) + {n28}: In(S_argv[0..3]) + {n29}: In(S_0_S_argv[0]) + {n30}: In(S_1_S_argv[0]) diff --git a/tests/pdg/oracle/doc_dot.res.oracle b/tests/pdg/oracle/doc_dot.res.oracle index ad37260885b45c0c2586c07a70f2107078cb2fee..73b393f19a3d1f9ba6dcdfefab0d4767edab7d28 100644 --- a/tests/pdg/oracle/doc_dot.res.oracle +++ b/tests/pdg/oracle/doc_dot.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/doc_dot.c (with preprocessing) [value] Analyzing an incomplete application starting at g [value] Computing initial state @@ -21,20 +20,20 @@ [pdg] PDG for g {n1}: InCtrl {n2}: VarDecl : x - {n3}: Call4-InCtrl : x = f(G1,G2,0); + {n3}: Call4-InCtrl : int x = f(G1,G2,0); -[-c-]-> 1 - {n4}: Call4-In1 : x = f(G1,G2,0); + {n4}: Call4-In1 : int x = f(G1,G2,0); -[-c-]-> 1 -[-c-]-> 3 -[--d]-> 14 - {n5}: Call4-In2 : x = f(G1,G2,0); + {n5}: Call4-In2 : int x = f(G1,G2,0); -[-c-]-> 1 -[-c-]-> 3 -[--d]-> 13 - {n6}: Call4-In3 : x = f(G1,G2,0); + {n6}: Call4-In3 : int x = f(G1,G2,0); -[-c-]-> 1 -[-c-]-> 3 - {n7}: Call4-OutRet : x = f(G1,G2,0); + {n7}: Call4-OutRet : int x = f(G1,G2,0); -[-c-]-> 1 -[a--]-> 2 -[-c-]-> 3 diff --git a/tests/pdg/oracle/dpds_intra.0.res.oracle b/tests/pdg/oracle/dpds_intra.0.res.oracle index c6a78fcb14ffd679f3d99f1d37501020b1c93abb..54c488737c046a1f0a50e1c55539b6c8c3b8657e 100644 --- a/tests/pdg/oracle/dpds_intra.0.res.oracle +++ b/tests/pdg/oracle/dpds_intra.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/dpds_intra.1.res.oracle b/tests/pdg/oracle/dpds_intra.1.res.oracle index b61a567ea14e6fe24b2e7cbb5fbeeec6cab4859c..6a3b05248787c4128b2446463b8e61c7180c4228 100644 --- a/tests/pdg/oracle/dpds_intra.1.res.oracle +++ b/tests/pdg/oracle/dpds_intra.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -72,16 +71,16 @@ tests/pdg/dpds_intra.c:134:[value] warning: signed overflow. assert *p + res ≤ {n4}: VarDecl : x2 {n5}: VarDecl : x3 {n6}: VarDecl : x - {n7}: x0 = 0; + {n7}: int x0 = 0; -[-c-]-> 1 -[a--]-> 2 - {n8}: x1 = 1; + {n8}: int x1 = 1; -[-c-]-> 1 -[a--]-> 3 - {n9}: x2 = 2; + {n9}: int x2 = 2; -[-c-]-> 1 -[a--]-> 4 - {n10}: x3 = 10; + {n10}: int x3 = 10; -[-c-]-> 1 -[a--]-> 5 {n11}: G < x0 diff --git a/tests/pdg/oracle/dpds_intra.2.res.oracle b/tests/pdg/oracle/dpds_intra.2.res.oracle index 1c730f204b8aaa552a3fe87eb33a0f6ce85fe297..ac365ef86c0ea3fc5b53bd9b14ae8250820512f1 100644 --- a/tests/pdg/oracle/dpds_intra.2.res.oracle +++ b/tests/pdg/oracle/dpds_intra.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/dpds_intra.3.res.oracle b/tests/pdg/oracle/dpds_intra.3.res.oracle index 2362c55dbc60612fb2e79ddbc7169cc36d82ca37..c2658866c67a01ff4abfed48dbd671bf0ae4f64d 100644 --- a/tests/pdg/oracle/dpds_intra.3.res.oracle +++ b/tests/pdg/oracle/dpds_intra.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -69,7 +68,7 @@ tests/pdg/dpds_intra.c:134:[value] warning: signed overflow. assert *p + res ≤ {n1}: InCtrl {n2}: VarDecl : x {n3}: VarDecl : tmp - {n4}: x = 1; + {n4}: int x = 1; -[-c-]-> 1 -[a--]-> 2 {n5}: L: diff --git a/tests/pdg/oracle/dpds_intra.4.res.oracle b/tests/pdg/oracle/dpds_intra.4.res.oracle index ef6e9ced85fcfa5af822d74375720f739af14943..7e73e471766b429f19b9910fcd4bbd3f35e8713b 100644 --- a/tests/pdg/oracle/dpds_intra.4.res.oracle +++ b/tests/pdg/oracle/dpds_intra.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -70,7 +69,7 @@ tests/pdg/dpds_intra.c:134:[value] warning: signed overflow. assert *p + res ≤ {n2}: VarDecl : x {n3}: VarDecl : a {n4}: VarDecl : b - {n5}: b = 0; + {n5}: int b = 0; -[-c-]-> 1 -[a--]-> 4 {n6}: G diff --git a/tests/pdg/oracle/dpds_intra.5.res.oracle b/tests/pdg/oracle/dpds_intra.5.res.oracle index c644a8b89aaccd316f7c964e763b8ebfc882497d..8b1665af002a422bbf917ce6b4da28b374bc0c63 100644 --- a/tests/pdg/oracle/dpds_intra.5.res.oracle +++ b/tests/pdg/oracle/dpds_intra.5.res.oracle @@ -1,2 +1 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) diff --git a/tests/pdg/oracle/dpds_intra.6.res.oracle b/tests/pdg/oracle/dpds_intra.6.res.oracle index a7c51b9f99c7c5613b7f4706e2b341bcbb4bb76f..59b9889290198074bd8d6c40a5479ed336ee7f54 100644 --- a/tests/pdg/oracle/dpds_intra.6.res.oracle +++ b/tests/pdg/oracle/dpds_intra.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -73,7 +72,7 @@ tests/pdg/dpds_intra.c:134:[value] warning: signed overflow. assert *p + res ≤ -[a--]-> 2 {n4}: VarDecl : i {n5}: VarDecl : s - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 5 {n7}: i = 0; diff --git a/tests/pdg/oracle/dpds_intra.7.res.oracle b/tests/pdg/oracle/dpds_intra.7.res.oracle index da9ef41cff424ef8bda9c424239fa42689353a7b..22dc8a462739b2cd7ad971f5cf194d97ec8c74aa 100644 --- a/tests/pdg/oracle/dpds_intra.7.res.oracle +++ b/tests/pdg/oracle/dpds_intra.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,227 +95,224 @@ tests/pdg/dpds_intra.c:134:[value] warning: signed overflow. assert *p + res ≤ {n14}: VarDecl : tmp_5 {n15}: VarDecl : tmp_6 {n16}: VarDecl : __retres - {n17}: b = G; + {n17}: int b = G; -[-c-]-> 1 -[a--]-> 3 - -[--d]-> 66 - {n18}: res = 0; + -[--d]-> 65 + {n18}: int res = 0; -[-c-]-> 1 -[a--]-> 4 - {n19}: s.a = 1; - -[-c-]-> 1 - -[a--]-> 5 - {n20}: s.b = 2; + {n19}: Tstr s = {.a = 1, .b = 2}; -[-c-]-> 1 -[a--]-> 5 - {n21}: unspecified sequence + {n20}: unspecified sequence -[-c-]-> 1 - {n22}: tmp = b; + {n21}: tmp = b; -[-c-]-> 1 -[--d]-> 3 -[a--]-> 7 -[--d]-> 17 - -[-c-]-> 21 - {n23}: b ++; + -[-c-]-> 20 + {n22}: b ++; -[-c-]-> 1 -[a-d]-> 3 -[--d]-> 17 - -[-c-]-> 21 - {n24}: a = tmp + s.a; + -[-c-]-> 20 + {n23}: a = tmp + s.a; -[-c-]-> 1 -[a--]-> 2 -[--d]-> 5 -[--d]-> 7 -[--d]-> 19 - -[-c-]-> 21 - -[--d]-> 22 - {n25}: b = 2 * a; + -[-c-]-> 20 + -[--d]-> 21 + {n24}: b = 2 * a; -[-c-]-> 1 -[--d]-> 2 -[a--]-> 3 - -[--d]-> 24 - {n26}: b > G + -[--d]-> 23 + {n25}: b > G -[-c-]-> 1 -[--d]-> 3 - -[--d]-> 25 - -[--d]-> 66 - {n27}: p = & a; + -[--d]-> 24 + -[--d]-> 65 + {n26}: p = & a; -[-c-]-> 1 -[--d]-> 2 -[a--]-> 6 - -[-c-]-> 26 - {n28}: a_0 = 1; + -[-c-]-> 25 + {n27}: int a_0 = 1; -[-c-]-> 1 -[a--]-> 8 - -[-c-]-> 26 - {n29}: p = & b; + -[-c-]-> 25 + {n28}: p = & b; -[-c-]-> 1 -[--d]-> 3 -[a--]-> 6 - -[-c-]-> 26 - {n30}: a_0 ++; + -[-c-]-> 25 + {n29}: a_0 ++; -[-c-]-> 1 -[a-d]-> 8 - -[-c-]-> 26 - -[--d]-> 28 - {n31}: (*p) ++; + -[-c-]-> 25 + -[--d]-> 27 + {n30}: (*p) ++; -[-c-]-> 1 -[a-d]-> 6 + -[--d]-> 23 -[--d]-> 24 - -[--d]-> 25 - -[a-d]-> 27 - -[a-d]-> 29 - {n32}: unspecified sequence + -[a-d]-> 26 + -[a-d]-> 28 + {n31}: unspecified sequence -[-c-]-> 1 - {n33}: Call103-InCtrl : tmp_0 = test_struct(); + {n32}: Call101-InCtrl : tmp_0 = test_struct(); -[-c-]-> 1 - -[-c-]-> 32 - {n34}: Call103-OutRet : tmp_0 = test_struct(); + -[-c-]-> 31 + {n33}: Call101-OutRet : tmp_0 = test_struct(); -[-c-]-> 1 -[a--]-> 9 + -[-c-]-> 31 -[-c-]-> 32 - -[-c-]-> 33 - {n35}: res += tmp_0; + {n34}: res += tmp_0; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 9 -[--d]-> 18 - -[-c-]-> 32 - -[--d]-> 34 - {n36}: unspecified sequence + -[-c-]-> 31 + -[--d]-> 33 + {n35}: unspecified sequence -[-c-]-> 1 - {n37}: Call106-InCtrl : tmp_1 = test_if_simple(); + {n36}: Call104-InCtrl : tmp_1 = test_if_simple(); -[-c-]-> 1 - -[-c-]-> 36 - {n38}: Call106-OutRet : tmp_1 = test_if_simple(); + -[-c-]-> 35 + {n37}: Call104-OutRet : tmp_1 = test_if_simple(); -[-c-]-> 1 -[a--]-> 10 + -[-c-]-> 35 -[-c-]-> 36 - -[-c-]-> 37 - -[--d]-> 66 - {n39}: res += tmp_1; + -[--d]-> 65 + {n38}: res += tmp_1; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 10 - -[--d]-> 35 - -[-c-]-> 36 - -[--d]-> 38 - {n40}: unspecified sequence + -[--d]-> 34 + -[-c-]-> 35 + -[--d]-> 37 + {n39}: unspecified sequence -[-c-]-> 1 - {n41}: Call109-InCtrl : tmp_2 = test_goto_simple(); + {n40}: Call107-InCtrl : tmp_2 = test_goto_simple(); -[-c-]-> 1 - -[-c-]-> 40 - {n42}: Call109-OutRet : tmp_2 = test_goto_simple(); + -[-c-]-> 39 + {n41}: Call107-OutRet : tmp_2 = test_goto_simple(); -[-c-]-> 1 -[a--]-> 11 + -[-c-]-> 39 -[-c-]-> 40 - -[-c-]-> 41 - -[--d]-> 66 - {n43}: res += tmp_2; + -[--d]-> 65 + {n42}: res += tmp_2; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 11 - -[--d]-> 39 - -[-c-]-> 40 - -[--d]-> 42 - {n44}: unspecified sequence + -[--d]-> 38 + -[-c-]-> 39 + -[--d]-> 41 + {n43}: unspecified sequence -[-c-]-> 1 - {n45}: Call112-InCtrl : tmp_3 = test_goto_arriere(); + {n44}: Call110-InCtrl : tmp_3 = test_goto_arriere(); -[-c-]-> 1 - -[-c-]-> 44 - {n46}: Call112-Out(G) : tmp_3 = test_goto_arriere(); + -[-c-]-> 43 + {n45}: Call110-Out(G) : tmp_3 = test_goto_arriere(); -[-c-]-> 1 + -[-c-]-> 43 -[-c-]-> 44 - -[-c-]-> 45 - -[--d]-> 66 - {n47}: Call112-OutRet : tmp_3 = test_goto_arriere(); + -[--d]-> 65 + {n46}: Call110-OutRet : tmp_3 = test_goto_arriere(); -[-c-]-> 1 -[a--]-> 12 + -[-c-]-> 43 -[-c-]-> 44 - -[-c-]-> 45 - -[--d]-> 66 - {n48}: res += tmp_3; + -[--d]-> 65 + {n47}: res += tmp_3; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 12 - -[--d]-> 43 - -[-c-]-> 44 - -[--d]-> 47 - {n49}: unspecified sequence + -[--d]-> 42 + -[-c-]-> 43 + -[--d]-> 46 + {n48}: unspecified sequence -[-c-]-> 1 - {n50}: Call115-InCtrl : tmp_4 = test_goto_else(); + {n49}: Call113-InCtrl : tmp_4 = test_goto_else(); -[-c-]-> 1 - -[-c-]-> 49 - {n51}: Call115-OutRet : tmp_4 = test_goto_else(); + -[-c-]-> 48 + {n50}: Call113-OutRet : tmp_4 = test_goto_else(); -[-c-]-> 1 -[a--]-> 13 + -[-c-]-> 48 -[-c-]-> 49 - -[-c-]-> 50 - {n52}: res += tmp_4; + {n51}: res += tmp_4; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 13 - -[--d]-> 48 - -[-c-]-> 49 - -[--d]-> 51 - {n53}: unspecified sequence + -[--d]-> 47 + -[-c-]-> 48 + -[--d]-> 50 + {n52}: unspecified sequence -[-c-]-> 1 - {n54}: Call118-InCtrl : tmp_5 = test_simple_loop(G); + {n53}: Call116-InCtrl : tmp_5 = test_simple_loop(G); -[-c-]-> 1 - -[-c-]-> 53 - {n55}: Call118-In1 : tmp_5 = test_simple_loop(G); + -[-c-]-> 52 + {n54}: Call116-In1 : tmp_5 = test_simple_loop(G); -[-c-]-> 1 - -[--d](G)-> 46 + -[--d](G)-> 45 + -[-c-]-> 52 -[-c-]-> 53 - -[-c-]-> 54 - {n56}: Call118-OutRet : tmp_5 = test_simple_loop(G); + {n55}: Call116-OutRet : tmp_5 = test_simple_loop(G); -[-c-]-> 1 -[a--]-> 14 + -[-c-]-> 52 -[-c-]-> 53 - -[-c-]-> 54 - -[--d]-> 55 - {n57}: res += tmp_5; + -[--d]-> 54 + {n56}: res += tmp_5; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 14 - -[--d]-> 52 - -[-c-]-> 53 - -[--d]-> 56 - {n58}: unspecified sequence + -[--d]-> 51 + -[-c-]-> 52 + -[--d]-> 55 + {n57}: unspecified sequence -[-c-]-> 1 - {n59}: Call121-InCtrl : tmp_6 = multiple_global_inputs(); + {n58}: Call119-InCtrl : tmp_6 = multiple_global_inputs(); -[-c-]-> 1 - -[-c-]-> 58 - {n60}: Call121-OutRet : tmp_6 = multiple_global_inputs(); + -[-c-]-> 57 + {n59}: Call119-OutRet : tmp_6 = multiple_global_inputs(); -[-c-]-> 1 -[a--]-> 15 - -[--d](G)-> 46 + -[--d](G)-> 45 + -[-c-]-> 57 -[-c-]-> 58 - -[-c-]-> 59 - -[--d]-> 65 - {n61}: res += tmp_6; + -[--d]-> 64 + {n60}: res += tmp_6; -[-c-]-> 1 -[a-d]-> 4 -[--d]-> 15 - -[--d]-> 57 - -[-c-]-> 58 - -[--d]-> 60 - {n62}: __retres = *p + res; + -[--d]-> 56 + -[-c-]-> 57 + -[--d]-> 59 + {n61}: __retres = *p + res; -[-c-]-> 1 -[--d]-> 4 -[--d]-> 6 -[a--]-> 16 + -[--d]-> 23 -[--d]-> 24 - -[--d]-> 25 - -[--d]-> 27 - -[--d]-> 29 - -[--d]-> 31 - -[--d]-> 61 - {n63}: return __retres; + -[--d]-> 26 + -[--d]-> 28 + -[--d]-> 30 + -[--d]-> 60 + {n62}: return __retres; -[-c-]-> 1 -[--d]-> 16 + -[--d]-> 61 + {n63}: OutRet -[--d]-> 62 - {n64}: OutRet - -[--d]-> 63 - {n65}: In(S.a) - {n66}: In(G) + {n64}: In(S.a) + {n65}: In(G) diff --git a/tests/pdg/oracle/dpds_intra.8.res.oracle b/tests/pdg/oracle/dpds_intra.8.res.oracle index 74bd17c65b00f84bb63e27e190e62eb11eeec0ca..ecd77f302d3a6ef39aebf2a91784516da24ba27b 100644 --- a/tests/pdg/oracle/dpds_intra.8.res.oracle +++ b/tests/pdg/oracle/dpds_intra.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dpds_intra.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/dyn_dpds.res.oracle b/tests/pdg/oracle/dyn_dpds.res.oracle index 34a6321e109e7977f316465848600c581a8b5940..19939e65d4778aec30bc1ae61096bbcf31eb6c0a 100644 --- a/tests/pdg/oracle/dyn_dpds.res.oracle +++ b/tests/pdg/oracle/dyn_dpds.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/dyn_dpds.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/globals.0.res.oracle b/tests/pdg/oracle/globals.0.res.oracle index 3aadb6eee88318386d7031ac1460e68da04e5377..6dceb6de09072eba43962fb820ae5e5585cc5dd9 100644 --- a/tests/pdg/oracle/globals.0.res.oracle +++ b/tests/pdg/oracle/globals.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/globals.c (with preprocessing) [value] Analyzing a complete application starting at g [value] Computing initial state diff --git a/tests/pdg/oracle/globals.1.res.oracle b/tests/pdg/oracle/globals.1.res.oracle index 456b57a35053c131dbf4a393a0e757b160268681..122a52e0fa845aa3fed1fc3d0e80b92c86db77b0 100644 --- a/tests/pdg/oracle/globals.1.res.oracle +++ b/tests/pdg/oracle/globals.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/globals.c (with preprocessing) [value] Analyzing a complete application starting at h [value] Computing initial state diff --git a/tests/pdg/oracle/globals.2.res.oracle b/tests/pdg/oracle/globals.2.res.oracle index e1df92375072023d62d5ad9496afc51dbbf7ffa7..3a765a72e1cadefd92db96dbe2d179bd70951b64 100644 --- a/tests/pdg/oracle/globals.2.res.oracle +++ b/tests/pdg/oracle/globals.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/globals.c (with preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/pdg/oracle/inter_alias.res.oracle b/tests/pdg/oracle/inter_alias.res.oracle index dd10e9b7e617978392c219da4aae3c8fa7838208..4f23fdc353841ed2c197dd5108411534509218cd 100644 --- a/tests/pdg/oracle/inter_alias.res.oracle +++ b/tests/pdg/oracle/inter_alias.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/inter_alias.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -95,10 +94,10 @@ {n15}: VarDecl : a {n16}: VarDecl : b {n17}: VarDecl : __retres - {n18}: a = 0; + {n18}: int a = 0; -[-c-]-> 14 -[a--]-> 15 - {n19}: b = 0; + {n19}: int b = 0; -[-c-]-> 14 -[a--]-> 16 {n20}: Call7-InCtrl : f1(& a,3); diff --git a/tests/pdg/oracle/inter_alias2.0.res.oracle b/tests/pdg/oracle/inter_alias2.0.res.oracle index 0f41b3775ebf2ecfa75f60b61c81757740f9abea..46d345950491bbbcbc4505c483ff4d5aedc452b3 100644 --- a/tests/pdg/oracle/inter_alias2.0.res.oracle +++ b/tests/pdg/oracle/inter_alias2.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/inter_alias2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/inter_alias2.1.res.oracle b/tests/pdg/oracle/inter_alias2.1.res.oracle index 60d55180f297f6ef137cd6231fce7970c8489550..f3e5c4fce9eb751f15190207dcf24f46caed8a63 100644 --- a/tests/pdg/oracle/inter_alias2.1.res.oracle +++ b/tests/pdg/oracle/inter_alias2.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/inter_alias2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/pdg/oracle/inter_alias2.2.res.oracle b/tests/pdg/oracle/inter_alias2.2.res.oracle index 33c5b50aa668b782586c569deed950f77a7d975f..d11601ad0bfedfbe83f242cca3edd06e3cf55ff5 100644 --- a/tests/pdg/oracle/inter_alias2.2.res.oracle +++ b/tests/pdg/oracle/inter_alias2.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/inter_alias2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -57,18 +56,18 @@ tests/pdg/inter_alias2.c:26:[value] warning: signed overflow. assert v1 + v2 ≤ {n3}: In1 -[a--]-> 2 {n4}: VarDecl : x1 - {n5}: x1 = a; + {n5}: int x1 = a; -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 -[a--]-> 4 - {n6}: Call6-InCtrl : incr_ptr(& x1); + {n6}: Call5-InCtrl : incr_ptr(& x1); -[-c-]-> 1 - {n7}: Call6-In1 : incr_ptr(& x1); + {n7}: Call5-In1 : incr_ptr(& x1); -[-c-]-> 1 -[--d]-> 4 -[-c-]-> 6 - {n8}: Call6-Out(x1) : incr_ptr(& x1); + {n8}: Call5-Out(x1) : incr_ptr(& x1); -[-c-]-> 1 -[--d]-> 5 -[-c-]-> 6 diff --git a/tests/pdg/oracle/inter_alias2.3.res.oracle b/tests/pdg/oracle/inter_alias2.3.res.oracle index a5cb8cd665d5c932569b564246f8d7026475ef31..62a77fb4d528e666968407ad990223a1855ea2f2 100644 --- a/tests/pdg/oracle/inter_alias2.3.res.oracle +++ b/tests/pdg/oracle/inter_alias2.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/inter_alias2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -57,18 +56,18 @@ tests/pdg/inter_alias2.c:26:[value] warning: signed overflow. assert v1 + v2 ≤ {n3}: In1 -[a--]-> 2 {n4}: VarDecl : x2 - {n5}: x2 = b; + {n5}: int x2 = b; -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 -[a--]-> 4 - {n6}: Call12-InCtrl : incr_ptr(& x2); + {n6}: Call10-InCtrl : incr_ptr(& x2); -[-c-]-> 1 - {n7}: Call12-In1 : incr_ptr(& x2); + {n7}: Call10-In1 : incr_ptr(& x2); -[-c-]-> 1 -[--d]-> 4 -[-c-]-> 6 - {n8}: Call12-Out(x2) : incr_ptr(& x2); + {n8}: Call10-Out(x2) : incr_ptr(& x2); -[-c-]-> 1 -[--d]-> 5 -[-c-]-> 6 diff --git a/tests/pdg/oracle/loops.0.res.oracle b/tests/pdg/oracle/loops.0.res.oracle index f5744210617298fa54be6cad3449025d917867f4..ff2c80819cbc3b97bd058af896bc93c632243767 100644 --- a/tests/pdg/oracle/loops.0.res.oracle +++ b/tests/pdg/oracle/loops.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at simple [value] Computing initial state @@ -19,10 +18,10 @@ tests/pdg/loops.c:42:[value] warning: signed overflow. assert s + 2 ≤ 21474836 -[a--]-> 2 {n4}: VarDecl : s {n5}: VarDecl : i - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 4 - {n7}: i = 0; + {n7}: int i = 0; -[-c-]-> 1 -[a--]-> 5 {n8}: while(1) diff --git a/tests/pdg/oracle/loops.1.res.oracle b/tests/pdg/oracle/loops.1.res.oracle index 2345d493790d959970e77bb881415fe84f697627..35890ee16f339c83fd11c59e38e9a5ea14c83fc4 100644 --- a/tests/pdg/oracle/loops.1.res.oracle +++ b/tests/pdg/oracle/loops.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at simple_with_break [value] Computing initial state @@ -19,10 +18,10 @@ tests/pdg/loops.c:53:[value] warning: signed overflow. assert s + 2 ≤ 21474836 -[a--]-> 2 {n4}: VarDecl : s {n5}: VarDecl : i - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 4 - {n7}: i = 0; + {n7}: int i = 0; -[-c-]-> 1 -[a--]-> 5 {n8}: while(1) diff --git a/tests/pdg/oracle/loops.2.res.oracle b/tests/pdg/oracle/loops.2.res.oracle index e4249672dd3e2d7513cbea5ad37e7c6ba467ccb5..fe53cfa46c80041b2a67c24c347faa4d900b4050 100644 --- a/tests/pdg/oracle/loops.2.res.oracle +++ b/tests/pdg/oracle/loops.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at infinite [value] Computing initial state @@ -21,10 +20,10 @@ tests/pdg/loops.c:70:[pdg] warning: no final state. Probably unreachable... -[a--]-> 2 {n4}: VarDecl : s {n5}: VarDecl : i - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 4 - {n7}: i = 0; + {n7}: int i = 0; -[-c-]-> 1 -[a--]-> 5 {n8}: return s; diff --git a/tests/pdg/oracle/loops.3.res.oracle b/tests/pdg/oracle/loops.3.res.oracle index f4681c24f44d49bd914a58ced635c47c9533f580..b205d85c6423cf74e1db8bc12a85007cbd47afab 100644 --- a/tests/pdg/oracle/loops.3.res.oracle +++ b/tests/pdg/oracle/loops.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at infinite2 [value] Computing initial state @@ -20,10 +19,10 @@ tests/pdg/loops.c:79:[pdg] warning: no final state. Probably unreachable... -[a--]-> 2 {n4}: VarDecl : s {n5}: VarDecl : i - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 4 - {n7}: i = 1; + {n7}: int i = 1; -[-c-]-> 1 -[a--]-> 5 {n8}: while(1) diff --git a/tests/pdg/oracle/loops.4.res.oracle b/tests/pdg/oracle/loops.4.res.oracle index 8cad1258a7fea2189c345e22f17d1c8be9664197..d8d3d6fab32ec686995a750ad877293044684daf 100644 --- a/tests/pdg/oracle/loops.4.res.oracle +++ b/tests/pdg/oracle/loops.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at maybe_infinite [value] Computing initial state @@ -19,10 +18,10 @@ tests/pdg/loops.c:88:[value] warning: signed overflow. assert i + 2 ≤ 21474836 -[a--]-> 2 {n4}: VarDecl : s {n5}: VarDecl : i - {n6}: s = 0; + {n6}: int s = 0; -[-c-]-> 1 -[a--]-> 4 - {n7}: i = 0; + {n7}: int i = 0; -[-c-]-> 1 -[a--]-> 5 {n8}: n > 0 diff --git a/tests/pdg/oracle/loops.5.res.oracle b/tests/pdg/oracle/loops.5.res.oracle index ab91d74759e7d9ce3662bf45ba01a291ed9a679f..f86175d948cd6b12abc7f097e5d9001e590dd6fb 100644 --- a/tests/pdg/oracle/loops.5.res.oracle +++ b/tests/pdg/oracle/loops.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at two_infinite_loops [value] Computing initial state @@ -22,13 +21,13 @@ tests/pdg/loops.c:106:[value] warning: signed overflow. assert i2 + 1 ≤ 214748 {n4}: VarDecl : s {n5}: VarDecl : i1 {n6}: VarDecl : i2 - {n7}: s = 0; + {n7}: int s = 0; -[-c-]-> 1 -[a--]-> 4 - {n8}: i1 = 0; + {n8}: int i1 = 0; -[-c-]-> 1 -[a--]-> 5 - {n9}: i2 = 0; + {n9}: int i2 = 0; -[-c-]-> 1 -[a--]-> 6 {n10}: n > 0 diff --git a/tests/pdg/oracle/loops.6.res.oracle b/tests/pdg/oracle/loops.6.res.oracle index 9b0477972c8eddf27b2d19ac83c6e26b467f3610..9b182bdaceb845350f450ccc1c113bfe1eb3c103 100644 --- a/tests/pdg/oracle/loops.6.res.oracle +++ b/tests/pdg/oracle/loops.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at loop_with_goto [value] Computing initial state diff --git a/tests/pdg/oracle/loops.7.res.oracle b/tests/pdg/oracle/loops.7.res.oracle index d6dd918ee2664d42ce8a8ed486b53934dc3255aa..195b640f81d61e9f2255ef2553c52f14b75ba01c 100644 --- a/tests/pdg/oracle/loops.7.res.oracle +++ b/tests/pdg/oracle/loops.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at non_natural_loop [value] Computing initial state @@ -17,7 +16,7 @@ tests/pdg/loops.c:139:[kernel] warning: Non-natural loop detected. {n3}: In1 -[a--]-> 2 {n4}: VarDecl : x - {n5}: x = 1; + {n5}: int x = 1; -[-c-]-> 1 -[a--]-> 4 {n6}: n < 0 diff --git a/tests/pdg/oracle/loops.8.res.oracle b/tests/pdg/oracle/loops.8.res.oracle index 1c1816c26bde75795d0e5e15e17c997eace4212f..79879a467e2b7e11f38ed51b32c468787f1a18cd 100644 --- a/tests/pdg/oracle/loops.8.res.oracle +++ b/tests/pdg/oracle/loops.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/loops.c (with preprocessing) [value] Analyzing an incomplete application starting at dead_code [value] Computing initial state @@ -16,7 +15,7 @@ {n3}: In1 -[a--]-> 2 {n4}: VarDecl : x - {n5}: x = 0; + {n5}: int x = 0; -[-c-]-> 1 -[a--]-> 4 {n6}: W: diff --git a/tests/pdg/oracle/multiple_calls.0.res.oracle b/tests/pdg/oracle/multiple_calls.0.res.oracle index b823814d32581cf0c35a89da662d54ff7fafba2b..7c6c82f233db6fa7a06e11b1fd08c38a6eebc750 100644 --- a/tests/pdg/oracle/multiple_calls.0.res.oracle +++ b/tests/pdg/oracle/multiple_calls.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/multiple_calls.c (with preprocessing) [value] Analyzing a complete application starting at appel_ptr_fct [value] Computing initial state @@ -65,7 +64,7 @@ tests/pdg/multiple_calls.c:24:[value] warning: signed overflow. assert (int)(x + Operational inputs on termination: G1; G2; c; d Sure outputs: - G3; a; b; pf; tmp; x; __retres + G3; a; b; pf; tmp; x; tmp_0; __retres [pdg] computing for function appel_ptr_fct [pdg] done for function appel_ptr_fct [pdg] PDG for appel_ptr_fct @@ -83,90 +82,96 @@ tests/pdg/multiple_calls.c:24:[value] warning: signed overflow. assert (int)(x + {n8}: VarDecl : pf {n9}: VarDecl : tmp {n10}: VarDecl : x - {n11}: VarDecl : __retres - {n12}: a = 1; + {n11}: VarDecl : tmp_0 + {n12}: VarDecl : __retres + {n13}: int a = 1; -[-c-]-> 1 -[a--]-> 6 - {n13}: b = 2; + {n14}: int b = 2; -[-c-]-> 1 -[a--]-> 7 - {n14}: c + {n15}: c -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 - {n15}: tmp = & fct1; + {n16}: tmp = & fct1; -[-c-]-> 1 -[a--]-> 9 - -[-c-]-> 14 - {n16}: tmp = & fct2; + -[-c-]-> 15 + {n17}: tmp = & fct2; -[-c-]-> 1 -[a--]-> 9 - -[-c-]-> 14 - {n17}: pf = tmp; + -[-c-]-> 15 + {n18}: int (*pf)(int , int , int ) = tmp; -[-c-]-> 1 -[a--]-> 8 -[--d]-> 9 - -[--d]-> 15 -[--d]-> 16 - {n18}: Call19-InCtrl : x = (*pf)(a,b,d); + -[--d]-> 17 + {n19}: Call19-InCtrl : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 - {n19}: Call19-In1 : x = (*pf)(a,b,d); + {n20}: Call19-In1 : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 -[--d]-> 6 - -[--d]-> 12 - -[-c-]-> 18 - {n20}: Call19-In2 : x = (*pf)(a,b,d); + -[--d]-> 13 + -[-c-]-> 19 + {n21}: Call19-In2 : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 -[--d]-> 7 - -[--d]-> 13 - -[-c-]-> 18 - {n21}: Call19-In3 : x = (*pf)(a,b,d); + -[--d]-> 14 + -[-c-]-> 19 + {n22}: Call19-In3 : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 -[--d]-> 4 -[--d]-> 5 - -[-c-]-> 18 - {n22}: Call19-Out(G1) : x = (*pf)(a,b,d); + -[-c-]-> 19 + {n23}: Call19-Out(G1) : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 - -[-c-]-> 17 -[-c-]-> 18 - -[--d]-> 21 - {n23}: Call19-Out(G3) : x = (*pf)(a,b,d); + -[-c-]-> 19 + -[--d]-> 22 + {n24}: Call19-Out(G3) : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 - -[-c-]-> 17 -[-c-]-> 18 - -[--d]-> 19 + -[-c-]-> 19 -[--d]-> 20 - {n24}: Call19-Out(G4) : x = (*pf)(a,b,d); - -[-c-]-> 1 - -[-c-]-> 17 - -[-c-]-> 18 -[--d]-> 21 - {n25}: Call19-OutRet : x = (*pf)(a,b,d); + {n25}: Call19-Out(G4) : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 - -[a--]-> 10 - -[-c-]-> 17 -[-c-]-> 18 - -[--d]-> 19 - -[--d]-> 20 - {n26}: Call19-Out(G2) : x = (*pf)(a,b,d); + -[-c-]-> 19 + -[--d]-> 22 + {n26}: Call19-OutRet : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 - -[-c-]-> 17 + -[a--]-> 11 -[-c-]-> 18 + -[-c-]-> 19 + -[--d]-> 20 -[--d]-> 21 - {n27}: __retres = (x + G1) + G2; + {n27}: Call19-Out(G2) : tmp_0 = (*pf)(a,b,d); -[-c-]-> 1 - -[--d]-> 10 - -[a--]-> 11 - -[--d](G1)-> 22 - -[--d]-> 25 - -[--d](G2)-> 26 - -[--d]-> 30 - -[--d]-> 31 - {n28}: return __retres; + -[-c-]-> 18 + -[-c-]-> 19 + -[--d]-> 22 + {n28}: int x = tmp_0; -[-c-]-> 1 + -[a--]-> 10 -[--d]-> 11 - -[--d]-> 27 - {n29}: OutRet + -[--d]-> 26 + {n29}: __retres = (x + G1) + G2; + -[-c-]-> 1 + -[--d]-> 10 + -[a--]-> 12 + -[--d](G1)-> 23 + -[--d](G2)-> 27 -[--d]-> 28 - {n30}: In(G1) - {n31}: In(G2) + -[--d]-> 32 + -[--d]-> 33 + {n30}: return __retres; + -[-c-]-> 1 + -[--d]-> 12 + -[--d]-> 29 + {n31}: OutRet + -[--d]-> 30 + {n32}: In(G1) + {n33}: In(G2) diff --git a/tests/pdg/oracle/multiple_calls.1.res.oracle b/tests/pdg/oracle/multiple_calls.1.res.oracle index a4b93b263078516f517df00ed232f927202beb48..00acbed3a8bac50ee68be89237f0c9089fd9dd85 100644 --- a/tests/pdg/oracle/multiple_calls.1.res.oracle +++ b/tests/pdg/oracle/multiple_calls.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/multiple_calls.c (with preprocessing) [value] Analyzing a complete application starting at appel_ptr_fct_bis [value] Computing initial state @@ -97,52 +96,52 @@ -[-c-]-> 1 -[a--]-> 11 -[-c-]-> 12 - {n15}: pf = tmp; + {n15}: int (*pf)(int , int , int ) = tmp; -[-c-]-> 1 -[a--]-> 10 -[--d]-> 11 -[--d]-> 13 -[--d]-> 14 - {n16}: Call28-InCtrl : G4 = (*pf)(a,b,d); + {n16}: Call29-InCtrl : G4 = (*pf)(a,b,d); -[-c-]-> 1 - {n17}: Call28-In1 : G4 = (*pf)(a,b,d); + {n17}: Call29-In1 : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[--d]-> 4 -[--d]-> 5 -[-c-]-> 16 - {n18}: Call28-In2 : G4 = (*pf)(a,b,d); + {n18}: Call29-In2 : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[--d]-> 6 -[--d]-> 7 -[-c-]-> 16 - {n19}: Call28-In3 : G4 = (*pf)(a,b,d); + {n19}: Call29-In3 : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[--d]-> 8 -[--d]-> 9 -[-c-]-> 16 - {n20}: Call28-Out(G1) : G4 = (*pf)(a,b,d); + {n20}: Call29-Out(G1) : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[-c-]-> 15 -[-c-]-> 16 -[--d]-> 19 - {n21}: Call28-Out(G3) : G4 = (*pf)(a,b,d); + {n21}: Call29-Out(G3) : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[-c-]-> 15 -[-c-]-> 16 -[--d]-> 17 -[--d]-> 18 - {n22}: Call28-Out(G4) : G4 = (*pf)(a,b,d); + {n22}: Call29-Out(G4) : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[-c-]-> 15 -[-c-]-> 16 -[--d]-> 19 - {n23}: Call28-OutRet : G4 = (*pf)(a,b,d); + {n23}: Call29-OutRet : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[-c-]-> 15 -[-c-]-> 16 -[--d]-> 17 -[--d]-> 18 - {n24}: Call28-Out(G2) : G4 = (*pf)(a,b,d); + {n24}: Call29-Out(G2) : G4 = (*pf)(a,b,d); -[-c-]-> 1 -[-c-]-> 15 -[-c-]-> 16 diff --git a/tests/pdg/oracle/no_body.res.oracle b/tests/pdg/oracle/no_body.res.oracle index a3d5dd67c88f5d8b6dae2256740e1f961c2dd327..e046187872fabca763f59ceae76e0ff6aed418f7 100644 --- a/tests/pdg/oracle/no_body.res.oracle +++ b/tests/pdg/oracle/no_body.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/no_body.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -54,7 +53,7 @@ tests/pdg/no_body.c:17:[value] warning: signed overflow. assert x + 1 ≤ 214748 [pdg] PDG for main {n1}: InCtrl {n2}: VarDecl : x - {n3}: x = 1; + {n3}: int x = 1; -[-c-]-> 1 -[a--]-> 2 {n4}: Call11-InCtrl : G = f(x); diff --git a/tests/pdg/oracle/pb_infinite_loop.0.res.oracle b/tests/pdg/oracle/pb_infinite_loop.0.res.oracle index d95a52ce9cc0519cd88293ddf9bb19bc3adb5f0b..f7a7acd8f96c65a4d3895b88b86ef053e958ade6 100644 --- a/tests/pdg/oracle/pb_infinite_loop.0.res.oracle +++ b/tests/pdg/oracle/pb_infinite_loop.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/pb_infinite_loop.c (with preprocessing) [value] Analyzing a complete application starting at test_infinite_loop [value] Computing initial state @@ -18,7 +17,7 @@ tests/pdg/pb_infinite_loop.c:22:[value] warning: signed overflow. assert G + 1 {n3}: G < 0 -[-c-]-> 1 -[--d]-> 12 - {n4}: i = 0; + {n4}: int i = 0; -[-c-]-> 1 -[a--]-> 2 -[-c-]-> 3 diff --git a/tests/pdg/oracle/pb_infinite_loop.1.res.oracle b/tests/pdg/oracle/pb_infinite_loop.1.res.oracle index 188acc2daef4cc244800254ed7c6d800477e1b49..b3f3cc18eadd4f191072895573bc7cc6ceb4d4ce 100644 --- a/tests/pdg/oracle/pb_infinite_loop.1.res.oracle +++ b/tests/pdg/oracle/pb_infinite_loop.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/pb_infinite_loop.c (with preprocessing) [value] Analyzing a complete application starting at test_infinite_loop_2 [value] Computing initial state @@ -16,7 +15,7 @@ tests/pdg/pb_infinite_loop.c:37:[pdg] warning: no final state. Probably unreacha [pdg] PDG for test_infinite_loop_2 {n1}: InCtrl {n2}: VarDecl : i - {n3}: i = 0; + {n3}: int i = 0; -[-c-]-> 1 -[a--]-> 2 {n4}: return G; diff --git a/tests/pdg/oracle/pb_infinite_loop.2.res.oracle b/tests/pdg/oracle/pb_infinite_loop.2.res.oracle index f6ec03020ceaf1a927a4c4e2f5c4d6f8e7d7be2b..7ae43d0c83e454fc31a0886846c61f598f4d0e78 100644 --- a/tests/pdg/oracle/pb_infinite_loop.2.res.oracle +++ b/tests/pdg/oracle/pb_infinite_loop.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/pb_infinite_loop.c (with preprocessing) [value] Analyzing a complete application starting at test_exit [value] Computing initial state diff --git a/tests/pdg/oracle/postdom.res.oracle b/tests/pdg/oracle/postdom.res.oracle index aa6bc3ae93cc2714cc653dea059a2857318d709e..07506059c1594c19f15fa39ac3924cabc451053e 100644 --- a/tests/pdg/oracle/postdom.res.oracle +++ b/tests/pdg/oracle/postdom.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/postdom.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -76,14 +75,14 @@ tests/pdg/postdom.c:20:[pdg] warning: no final state. Probably unreachable... {n14}: VarDecl : x {n15}: VarDecl : tmp {n16}: VarDecl : __retres - {n17}: sn = 0; + {n17}: int sn = 0; -[-c-]-> 8 -[a--]-> 13 {n18}: return __retres; -[-c-]-> 8 -[--d]-> 16 {n19}: OutRet - {n20}: x = (unsigned int)0; + {n20}: unsigned int x = (unsigned int)0; -[-c-]-> 8 -[a--]-> 14 {n21}: while(1) diff --git a/tests/pdg/oracle/sets.res.oracle b/tests/pdg/oracle/sets.res.oracle index bcfdc66fe99f1a989c590d49adad76497a572eb6..a5697517f904b9351939d8d0d65726827cf0afc1 100644 --- a/tests/pdg/oracle/sets.res.oracle +++ b/tests/pdg/oracle/sets.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/sets.c (with preprocessing) [value] Analyzing an incomplete application starting at f [value] Computing initial state diff --git a/tests/pdg/oracle/simple_call.0.res.oracle b/tests/pdg/oracle/simple_call.0.res.oracle index 0d09da38bcd7b78dde9f716655c9fc32f6285f70..e73a63ab8bc49ce1bffe5e8b4ef50a5e66fe0e85 100644 --- a/tests/pdg/oracle/simple_call.0.res.oracle +++ b/tests/pdg/oracle/simple_call.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/simple_call.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -24,37 +23,37 @@ tests/pdg/simple_call.c:45:[value] warning: signed overflow. assert G + y ≤ 21 {n2}: VarDecl : a {n3}: VarDecl : b {n4}: VarDecl : c - {n5}: a = 0; + {n5}: int a = 0; -[-c-]-> 1 -[a--]-> 2 - {n6}: b = 1; + {n6}: int b = 1; -[-c-]-> 1 -[a--]-> 3 - {n7}: c = 3; + {n7}: int c = 3; -[-c-]-> 1 -[a--]-> 4 - {n8}: Call40-InCtrl : a = call(a + b,b + c); + {n8}: Call39-InCtrl : a = call(a + b,b + c); -[-c-]-> 1 - {n9}: Call40-In1 : a = call(a + b,b + c); + {n9}: Call39-In1 : a = call(a + b,b + c); -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 -[--d]-> 5 -[--d]-> 6 -[-c-]-> 8 - {n10}: Call40-In2 : a = call(a + b,b + c); + {n10}: Call39-In2 : a = call(a + b,b + c); -[-c-]-> 1 -[--d]-> 3 -[--d]-> 4 -[--d]-> 6 -[--d]-> 7 -[-c-]-> 8 - {n11}: Call40-Out(G) : a = call(a + b,b + c); + {n11}: Call39-Out(G) : a = call(a + b,b + c); -[-c-]-> 1 -[-c-]-> 8 -[--d]-> 10 -[--d]-> 15 - {n12}: Call40-OutRet : a = call(a + b,b + c); + {n12}: Call39-OutRet : a = call(a + b,b + c); -[-c-]-> 1 -[a--]-> 2 -[-c-]-> 8 diff --git a/tests/pdg/oracle/simple_call.1.res.oracle b/tests/pdg/oracle/simple_call.1.res.oracle index c39815d474cc4e60cfaa1984174737aeb114b229..9db64f23f28f0dc16ed473b49758c957e7c972c7 100644 --- a/tests/pdg/oracle/simple_call.1.res.oracle +++ b/tests/pdg/oracle/simple_call.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/simple_call.c (with preprocessing) [value] Analyzing a complete application starting at call_in_loop [value] Computing initial state @@ -47,7 +46,7 @@ tests/pdg/simple_call.c:52:[value] warning: signed overflow. assert a + tmp ≤ {n4}: VarDecl : i {n5}: VarDecl : a {n6}: VarDecl : tmp - {n7}: a = 0; + {n7}: int a = 0; -[-c-]-> 1 -[a--]-> 5 {n8}: i = 0; @@ -73,13 +72,13 @@ tests/pdg/simple_call.c:52:[value] warning: signed overflow. assert a + tmp ≤ -[-c-]-> 9 -[-c-]-> 10 -[-c-]-> 19 - {n12}: Call31-InCtrl : tmp = call(i,c); + {n12}: Call30-InCtrl : tmp = call(i,c); -[-c-]-> 1 -[-c-]-> 9 -[-c-]-> 10 -[-c-]-> 11 -[-c-]-> 19 - {n13}: Call31-In1 : tmp = call(i,c); + {n13}: Call30-In1 : tmp = call(i,c); -[-c-]-> 1 -[--d]-> 4 -[--d]-> 8 @@ -89,7 +88,7 @@ tests/pdg/simple_call.c:52:[value] warning: signed overflow. assert a + tmp ≤ -[-c-]-> 12 -[--d]-> 18 -[-c-]-> 19 - {n14}: Call31-In2 : tmp = call(i,c); + {n14}: Call30-In2 : tmp = call(i,c); -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 @@ -98,7 +97,7 @@ tests/pdg/simple_call.c:52:[value] warning: signed overflow. assert a + tmp ≤ -[-c-]-> 11 -[-c-]-> 12 -[-c-]-> 19 - {n15}: Call31-Out(G) : tmp = call(i,c); + {n15}: Call30-Out(G) : tmp = call(i,c); -[-c-]-> 1 -[-c-]-> 9 -[-c-]-> 10 @@ -108,7 +107,7 @@ tests/pdg/simple_call.c:52:[value] warning: signed overflow. assert a + tmp ≤ -[--d](G)-> 15 -[-c-]-> 19 -[--d]-> 22 - {n16}: Call31-OutRet : tmp = call(i,c); + {n16}: Call30-OutRet : tmp = call(i,c); -[-c-]-> 1 -[a--]-> 6 -[-c-]-> 9 diff --git a/tests/pdg/oracle/simple_call.2.res.oracle b/tests/pdg/oracle/simple_call.2.res.oracle index ff56aaa7a63a776ee246e8b0bdd1ecbd234f00ce..552cda92b87710b46ff33b5beb0109199ca81025 100644 --- a/tests/pdg/oracle/simple_call.2.res.oracle +++ b/tests/pdg/oracle/simple_call.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/simple_call.c (with preprocessing) [value] Analyzing a complete application starting at call_mix_G1_G2 [value] Computing initial state @@ -25,13 +24,13 @@ tests/pdg/simple_call.c:31:[value] warning: signed overflow. assert x1 + x2 ≤ {n2}: VarDecl : x1 {n3}: VarDecl : x2 {n4}: VarDecl : __retres - {n5}: Call7-InCtrl : mix_G1_G2(); + {n5}: Call6-InCtrl : mix_G1_G2(); -[-c-]-> 1 - {n6}: Call7-Out(G1) : mix_G1_G2(); + {n6}: Call6-Out(G1) : mix_G1_G2(); -[-c-]-> 1 -[-c-]-> 5 -[--d]-> 14 - {n7}: Call7-Out(G2) : mix_G1_G2(); + {n7}: Call6-Out(G2) : mix_G1_G2(); -[-c-]-> 1 -[-c-]-> 5 -[--d]-> 13 diff --git a/tests/pdg/oracle/simple_call.3.res.oracle b/tests/pdg/oracle/simple_call.3.res.oracle index 95495f312f9f06b2c842c0b3395a4ec7bc585cd8..eb443d907cb1e62ae4411f646824a7e41ae52e42 100644 --- a/tests/pdg/oracle/simple_call.3.res.oracle +++ b/tests/pdg/oracle/simple_call.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/simple_call.c (with preprocessing) [value] Analyzing a complete application starting at call_multiple_global_outputs [value] Computing initial state @@ -29,23 +28,23 @@ -[a--]-> 5 {n5}: In2 -[a--]-> 4 - {n6}: Call17-InCtrl : multiple_global_outputs(x,y); + {n6}: Call16-InCtrl : multiple_global_outputs(x,y); -[-c-]-> 1 - {n7}: Call17-In1 : multiple_global_outputs(x,y); + {n7}: Call16-In1 : multiple_global_outputs(x,y); -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 -[-c-]-> 6 - {n8}: Call17-In2 : multiple_global_outputs(x,y); + {n8}: Call16-In2 : multiple_global_outputs(x,y); -[-c-]-> 1 -[--d]-> 4 -[--d]-> 5 -[-c-]-> 6 - {n9}: Call17-Out(G) : multiple_global_outputs(x,y); + {n9}: Call16-Out(G) : multiple_global_outputs(x,y); -[-c-]-> 1 -[-c-]-> 6 -[--d]-> 8 - {n10}: Call17-Out(S.a) : multiple_global_outputs(x,y); + {n10}: Call16-Out(S.a) : multiple_global_outputs(x,y); -[-c-]-> 1 -[-c-]-> 6 -[--d]-> 7 diff --git a/tests/pdg/oracle/simple_intra_slice.res.oracle b/tests/pdg/oracle/simple_intra_slice.res.oracle index cc95d94427105134d7ead6f43878a982fa575c66..1c89f904be3d6573d8c4afb88c7ee765c5c4ac3f 100644 --- a/tests/pdg/oracle/simple_intra_slice.res.oracle +++ b/tests/pdg/oracle/simple_intra_slice.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/simple_intra_slice.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,6 +8,8 @@ S ∈ {0} S1 ∈ {0} S2 ∈ {0} +tests/pdg/simple_intra_slice.c:96:[value] warning: initialization of volatile variable uninit ignored +tests/pdg/simple_intra_slice.c:96:[value] warning: initialization of volatile variable uninit2 ignored tests/pdg/simple_intra_slice.c:98:[value] entering loop for the first time tests/pdg/simple_intra_slice.c:99:[value] warning: signed overflow. assert -2147483648 ≤ uninit - 1; tests/pdg/simple_intra_slice.c:99:[value] warning: signed overflow. assert Unknown + 1 ≤ 2147483647; @@ -110,10 +111,10 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n6}: VarDecl : a {n7}: VarDecl : b {n8}: VarDecl : __retres - {n9}: a = 1; + {n9}: int a = 1; -[-c-]-> 1 -[a--]-> 6 - {n10}: b = 2; + {n10}: int b = 2; -[-c-]-> 1 -[a--]-> 7 {n11}: G = x + a; @@ -141,34 +142,34 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n17}: VarDecl : b {n18}: VarDecl : c {n19}: VarDecl : tmp - {n20}: a = 1; + {n20}: int a = 1; -[-c-]-> 15 -[a--]-> 16 - {n21}: b = a + 1; + {n21}: int b = a + 1; -[-c-]-> 15 -[--d]-> 16 -[a--]-> 17 -[--d]-> 20 - {n22}: c = 3; + {n22}: int c = 3; -[-c-]-> 15 -[a--]-> 18 - {n23}: Call11-InCtrl : tmp = f1(b,c); + {n23}: Call10-InCtrl : tmp = f1(b,c); -[-c-]-> 15 - {n24}: Call11-In1 : tmp = f1(b,c); + {n24}: Call10-In1 : tmp = f1(b,c); -[-c-]-> 15 -[--d]-> 17 -[--d]-> 21 -[-c-]-> 23 - {n25}: Call11-In2 : tmp = f1(b,c); + {n25}: Call10-In2 : tmp = f1(b,c); -[-c-]-> 15 -[--d]-> 18 -[--d]-> 22 -[-c-]-> 23 - {n26}: Call11-Out(G) : tmp = f1(b,c); + {n26}: Call10-Out(G) : tmp = f1(b,c); -[-c-]-> 15 -[-c-]-> 23 -[--d]-> 24 - {n27}: Call11-OutRet : tmp = f1(b,c); + {n27}: Call10-OutRet : tmp = f1(b,c); -[-c-]-> 15 -[a--]-> 19 -[-c-]-> 23 @@ -188,13 +189,13 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n33}: VarDecl : a {n34}: VarDecl : b {n35}: VarDecl : x - {n36}: a = 1; + {n36}: int a = 1; -[-c-]-> 30 -[a--]-> 33 - {n37}: b = 2; + {n37}: int b = 2; -[-c-]-> 30 -[a--]-> 34 - {n38}: x = 0; + {n38}: int x = 0; -[-c-]-> 30 -[a--]-> 35 {n39}: c > Unknown @@ -230,13 +231,13 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n48}: VarDecl : a {n49}: VarDecl : b {n50}: VarDecl : x - {n51}: a = 1; + {n51}: int a = 1; -[-c-]-> 45 -[a--]-> 48 - {n52}: b = 2; + {n52}: int b = 2; -[-c-]-> 45 -[a--]-> 49 - {n53}: x = 0; + {n53}: int x = 0; -[-c-]-> 45 -[a--]-> 50 {n54}: c > Unknown @@ -270,7 +271,7 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n62}: In1 -[a--]-> 61 {n63}: VarDecl : x - {n64}: x = 0; + {n64}: int x = 0; -[-c-]-> 60 -[a--]-> 63 {n65}: c > Unknown @@ -329,7 +330,7 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[a--]-> 80 {n82}: VarDecl : i {n83}: VarDecl : __retres - {n84}: i = 0; + {n84}: int i = 0; -[-c-]-> 79 -[a--]-> 82 {n85}: while(1) @@ -477,7 +478,7 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n108}: In1 -[a--]-> 107 {n109}: VarDecl : x - {n110}: x = S.a; + {n110}: int x = S.a; -[-c-]-> 106 -[a--]-> 109 -[--d]-> 116 @@ -537,13 +538,13 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a {n133}: VarDecl : tmp_1 {n134}: VarDecl : tmp_2 {n135}: VarDecl : tmp_3 - {n136}: res = 0; + {n136}: int res = 0; -[-c-]-> 127 -[a--]-> 128 - {n137}: uninit = 0; + {n137}: int volatile uninit = 0; -[-c-]-> 127 -[a--]-> 129 - {n138}: uninit2 = 0; + {n138}: int volatile uninit2 = 0; -[-c-]-> 127 -[a--]-> 130 {n139}: while(1) @@ -650,14 +651,14 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[-c-]-> 150 {n151}: unspecified sequence -[-c-]-> 127 - {n152}: Call104-InCtrl : tmp = f2(); + {n152}: Call102-InCtrl : tmp = f2(); -[-c-]-> 127 -[-c-]-> 151 - {n153}: Call104-Out(G) : tmp = f2(); + {n153}: Call102-Out(G) : tmp = f2(); -[-c-]-> 127 -[-c-]-> 151 -[-c-]-> 152 - {n154}: Call104-OutRet : tmp = f2(); + {n154}: Call102-OutRet : tmp = f2(); -[-c-]-> 127 -[a--]-> 131 -[-c-]-> 151 @@ -671,14 +672,14 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[--d]-> 154 {n156}: unspecified sequence -[-c-]-> 127 - {n157}: Call107-InCtrl : tmp_0 = f3(1); + {n157}: Call105-InCtrl : tmp_0 = f3(1); -[-c-]-> 127 -[-c-]-> 156 - {n158}: Call107-In1 : tmp_0 = f3(1); + {n158}: Call105-In1 : tmp_0 = f3(1); -[-c-]-> 127 -[-c-]-> 156 -[-c-]-> 157 - {n159}: Call107-Out(G) : tmp_0 = f3(1); + {n159}: Call105-Out(G) : tmp_0 = f3(1); -[-c-]-> 127 -[--d]-> 142 -[--d]-> 143 @@ -686,7 +687,7 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[-c-]-> 157 -[--d]-> 158 -[--d]-> 202 - {n160}: Call107-OutRet : tmp_0 = f3(1); + {n160}: Call105-OutRet : tmp_0 = f3(1); -[-c-]-> 127 -[a--]-> 132 -[--d]-> 142 @@ -704,14 +705,14 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[--d]-> 160 {n162}: unspecified sequence -[-c-]-> 127 - {n163}: Call110-InCtrl : tmp_1 = f4(1); + {n163}: Call108-InCtrl : tmp_1 = f4(1); -[-c-]-> 127 -[-c-]-> 162 - {n164}: Call110-In1 : tmp_1 = f4(1); + {n164}: Call108-In1 : tmp_1 = f4(1); -[-c-]-> 127 -[-c-]-> 162 -[-c-]-> 163 - {n165}: Call110-Out(G) : tmp_1 = f4(1); + {n165}: Call108-Out(G) : tmp_1 = f4(1); -[-c-]-> 127 -[--d]-> 142 -[--d]-> 143 @@ -719,7 +720,7 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[-c-]-> 163 -[--d]-> 164 -[--d]-> 202 - {n166}: Call110-OutRet : tmp_1 = f4(1); + {n166}: Call108-OutRet : tmp_1 = f4(1); -[-c-]-> 127 -[a--]-> 133 -[--d]-> 142 @@ -737,14 +738,14 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[--d]-> 166 {n168}: unspecified sequence -[-c-]-> 127 - {n169}: Call113-InCtrl : tmp_2 = f5(1); + {n169}: Call111-InCtrl : tmp_2 = f5(1); -[-c-]-> 127 -[-c-]-> 168 - {n170}: Call113-In1 : tmp_2 = f5(1); + {n170}: Call111-In1 : tmp_2 = f5(1); -[-c-]-> 127 -[-c-]-> 168 -[-c-]-> 169 - {n171}: Call113-Out(G) : tmp_2 = f5(1); + {n171}: Call111-Out(G) : tmp_2 = f5(1); -[-c-]-> 127 -[--d]-> 142 -[--d]-> 143 @@ -755,7 +756,7 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[-c-]-> 169 -[--d]-> 170 -[--d]-> 202 - {n172}: Call113-OutRet : tmp_2 = f5(1); + {n172}: Call111-OutRet : tmp_2 = f5(1); -[-c-]-> 127 -[a--]-> 134 -[--d]-> 142 @@ -773,17 +774,17 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[--d]-> 172 {n174}: unspecified sequence -[-c-]-> 127 - {n175}: Call116-InCtrl : tmp_3 = f6(Unknown); + {n175}: Call114-InCtrl : tmp_3 = f6(Unknown); -[-c-]-> 127 -[-c-]-> 174 - {n176}: Call116-In1 : tmp_3 = f6(Unknown); + {n176}: Call114-In1 : tmp_3 = f6(Unknown); -[-c-]-> 127 -[--d]-> 142 -[--d]-> 143 -[-c-]-> 174 -[-c-]-> 175 -[--d]-> 202 - {n177}: Call116-OutRet : tmp_3 = f6(Unknown); + {n177}: Call114-OutRet : tmp_3 = f6(Unknown); -[-c-]-> 127 -[a--]-> 135 -[--d]-> 142 @@ -799,22 +800,22 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[--d]-> 173 -[-c-]-> 174 -[--d]-> 177 - {n179}: Call118-InCtrl : f7(S); + {n179}: Call116-InCtrl : f7(S); -[-c-]-> 127 - {n180}: Call118-In1 : f7(S); + {n180}: Call116-In1 : f7(S); -[-c-]-> 127 -[--d]-> 148 -[--d]-> 149 -[-c-]-> 179 -[--d]-> 204 - {n181}: Call118-Out(S.a) : f7(S); + {n181}: Call116-Out(S.a) : f7(S); -[-c-]-> 127 -[--d]-> 148 -[--d]-> 149 -[-c-]-> 179 -[--d]-> 180 -[--d]-> 203 - {n182}: Call118-Out(S{.b; .c}) : f7(S); + {n182}: Call116-Out(S{.b; .c}) : f7(S); -[-c-]-> 127 -[--d]-> 148 -[--d]-> 149 @@ -826,70 +827,70 @@ tests/pdg/simple_intra_slice.c:82:[value] warning: signed overflow. assert s0.a -[--d]-> 142 -[--d]-> 143 -[--d]-> 202 - {n184}: Call121-InCtrl : f8(& S1); + {n184}: Call119-InCtrl : f8(& S1); -[-c-]-> 127 -[-c-]-> 183 - {n185}: Call121-In1 : f8(& S1); + {n185}: Call119-In1 : f8(& S1); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 184 - {n186}: Call121-Out(S1.a) : f8(& S1); + {n186}: Call119-Out(S1.a) : f8(& S1); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 184 -[--d]-> 185 -[--d]-> 200 -[--d]-> 201 - {n187}: Call121-Out(S1.b) : f8(& S1); + {n187}: Call119-Out(S1.b) : f8(& S1); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 184 -[--d]-> 185 -[--d]-> 198 -[--d]-> 199 - {n188}: Call121-Out(S2.a) : f8(& S1); + {n188}: Call119-Out(S2.a) : f8(& S1); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 184 -[--d]-> 185 -[--d]-> 200 -[--d]-> 201 - {n189}: Call121-Out(S2.b) : f8(& S1); + {n189}: Call119-Out(S2.b) : f8(& S1); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 184 -[--d]-> 185 -[--d]-> 198 -[--d]-> 199 - {n190}: Call122-InCtrl : f8(& S2); + {n190}: Call120-InCtrl : f8(& S2); -[-c-]-> 127 -[-c-]-> 183 - {n191}: Call122-In1 : f8(& S2); + {n191}: Call120-In1 : f8(& S2); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 190 - {n192}: Call122-Out(S1.a) : f8(& S2); + {n192}: Call120-Out(S1.a) : f8(& S2); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 190 -[--d]-> 191 -[--d]-> 200 -[--d]-> 201 - {n193}: Call122-Out(S1.b) : f8(& S2); + {n193}: Call120-Out(S1.b) : f8(& S2); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 190 -[--d]-> 191 -[--d]-> 198 -[--d]-> 199 - {n194}: Call122-Out(S2.a) : f8(& S2); + {n194}: Call120-Out(S2.a) : f8(& S2); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 190 -[--d]-> 191 -[--d]-> 200 -[--d]-> 201 - {n195}: Call122-Out(S2.b) : f8(& S2); + {n195}: Call120-Out(S2.b) : f8(& S2); -[-c-]-> 127 -[-c-]-> 183 -[-c-]-> 190 diff --git a/tests/pdg/oracle/top_pdg_input.res.oracle b/tests/pdg/oracle/top_pdg_input.res.oracle index 56f7cd296d01886eb5a52d484154b8a23c70fa48..2ca2d259e603eb443eb757ea12a952b929523c74 100644 --- a/tests/pdg/oracle/top_pdg_input.res.oracle +++ b/tests/pdg/oracle/top_pdg_input.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/top_pdg_input.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -177,7 +176,7 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ -[a--]-> 2 {n4}: VarDecl : q {n5}: VarDecl : k - {n6}: k = 0; + {n6}: int k = 0; -[-c-]-> 1 -[a--]-> 5 {n7}: q = p; @@ -246,13 +245,13 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ -[-c-]-> 20 -[a--]-> 22 -[-c-]-> 24 - {n26}: i = *(*tmp); + {n26}: int i = *(*tmp); -[-c-]-> 20 -[a--]-> 21 -[--d]-> 22 -[--d]-> 25 -[--d]-> 33 - {n27}: v = tab[i]; + {n27}: int v = tab[i]; -[-c-]-> 20 -[--d]-> 21 -[a--]-> 23 @@ -277,13 +276,13 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ {n36}: VarDecl : tmp {n37}: VarDecl : s {n38}: VarDecl : __retres - {n39}: Call10-InCtrl : tmp = top_input(); + {n39}: Call8-InCtrl : tmp = top_input(); -[-c-]-> 34 - {n40}: Call10-OutRet : tmp = top_input(); + {n40}: Call8-OutRet : tmp = top_input(); -[-c-]-> 34 -[a--]-> 36 -[-c-]-> 39 - {n41}: i = *(*tmp); + {n41}: int i = *(*tmp); -[-c-]-> 34 -[a--]-> 35 -[--d]-> 36 @@ -321,13 +320,13 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ {n52}: VarDecl : i {n53}: VarDecl : tmp_0 {n54}: VarDecl : tmp_1 - {n55}: Call30-InCtrl : i = f1(); + {n55}: Call27-InCtrl : int i = f1(); -[-c-]-> 49 - {n56}: Call30-Out(G) : i = f1(); + {n56}: Call27-Out(G) : int i = f1(); -[-c-]-> 49 -[-c-]-> 55 -[--d]-> 74 - {n57}: Call30-OutRet : i = f1(); + {n57}: Call27-OutRet : int i = f1(); -[-c-]-> 49 -[a--]-> 52 -[-c-]-> 55 @@ -335,14 +334,14 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ -[--d]-> 73 {n58}: unspecified sequence -[-c-]-> 49 - {n59}: Call32-InCtrl : tmp_0 = f2(); + {n59}: Call29-InCtrl : tmp_0 = f2(); -[-c-]-> 49 -[-c-]-> 58 - {n60}: Call32-Out(S.a) : tmp_0 = f2(); + {n60}: Call29-Out(S.a) : tmp_0 = f2(); -[-c-]-> 49 -[-c-]-> 58 -[-c-]-> 59 - {n61}: Call32-OutRet : tmp_0 = f2(); + {n61}: Call29-OutRet : tmp_0 = f2(); -[-c-]-> 49 -[a--]-> 53 -[-c-]-> 58 @@ -356,9 +355,9 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ -[--d]-> 57 -[-c-]-> 58 -[--d]-> 61 - {n63}: Call34-InCtrl : tmp_1 = strlen(*(p_str + i)); + {n63}: Call31-InCtrl : tmp_1 = strlen(*(p_str + i)); -[-c-]-> 49 - {n64}: Call34-In1 : tmp_1 = strlen(*(p_str + i)); + {n64}: Call31-In1 : tmp_1 = strlen(*(p_str + i)); -[-c-]-> 49 -[--d]-> 50 -[--d]-> 51 @@ -367,7 +366,7 @@ tests/pdg/top_pdg_input.c:31:[value] warning: signed overflow. assert k + 1 ≤ -[-c-]-> 63 -[--d]-> 70 -[--d]-> 71 - {n65}: Call34-OutRet : tmp_1 = strlen(*(p_str + i)); + {n65}: Call31-OutRet : tmp_1 = strlen(*(p_str + i)); -[-c-]-> 49 -[a--]-> 54 -[-c-]-> 63 @@ -457,17 +456,17 @@ tests/pdg/top_pdg_input.c:45:[pdg] warning: Ignoring inline assembly code {n83}: InCtrl {n84}: VarDecl : j {n85}: VarDecl : tmp - {n86}: j = 3; + {n86}: int j = 3; -[-c-]-> 83 -[a--]-> 84 - {n87}: Call42-InCtrl : tmp = fun_asm(j); + {n87}: Call39-InCtrl : tmp = fun_asm(j); -[-c-]-> 83 - {n88}: Call42-In1 : tmp = fun_asm(j); + {n88}: Call39-In1 : tmp = fun_asm(j); -[-c-]-> 83 -[--d]-> 84 -[--d]-> 86 -[-c-]-> 87 - {n89}: Call42-OutRet : tmp = fun_asm(j); + {n89}: Call39-OutRet : tmp = fun_asm(j); -[-c-]-> 83 -[a--]-> 85 -[-c-]-> 87 diff --git a/tests/pdg/oracle/variadic.res.oracle b/tests/pdg/oracle/variadic.res.oracle index bb27493c158af28fec0beaacbd2edf62b049a44a..c55986175c6681c54191929375af44fa6ed49f02 100644 --- a/tests/pdg/oracle/variadic.res.oracle +++ b/tests/pdg/oracle/variadic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pdg/variadic.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -79,30 +78,30 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun {n12}: VarDecl : __va_args {n13}: block -[-c-]-> 7 - {n14}: __va_arg0 = a; + {n14}: int __va_arg0 = a; -[-c-]-> 7 -[--d]-> 8 -[--d]-> 9 -[a--]-> 11 -[-c-]-> 13 - {n15}: __va_args[0] = & __va_arg0; + {n15}: void *__va_args[1] = {& __va_arg0}; -[-c-]-> 7 -[--d]-> 11 -[a--]-> 12 -[-c-]-> 13 - {n16}: Call54-InCtrl : tmp = lib_f(1,(void * const *)(__va_args)); + {n16}: Call44-InCtrl : tmp = lib_f(1,(void * const *)(__va_args)); -[-c-]-> 7 -[-c-]-> 13 - {n17}: Call54-In1 : tmp = lib_f(1,(void * const *)(__va_args)); + {n17}: Call44-In1 : tmp = lib_f(1,(void * const *)(__va_args)); -[-c-]-> 7 -[-c-]-> 13 -[-c-]-> 16 - {n18}: Call54-In2 : tmp = lib_f(1,(void * const *)(__va_args)); + {n18}: Call44-In2 : tmp = lib_f(1,(void * const *)(__va_args)); -[-c-]-> 7 -[--d]-> 12 -[-c-]-> 13 -[-c-]-> 16 - {n19}: Call54-OutRet : tmp = lib_f(1,(void * const *)(__va_args)); + {n19}: Call44-OutRet : tmp = lib_f(1,(void * const *)(__va_args)); -[-c-]-> 7 -[a--]-> 10 -[-c-]-> 13 @@ -130,227 +129,215 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun {n30}: VarDecl : __va_args {n31}: block -[-c-]-> 22 - {n32}: __va_arg0 = a; + {n32}: int __va_arg0 = a; -[-c-]-> 22 -[--d]-> 23 -[--d]-> 24 -[a--]-> 28 -[-c-]-> 31 - {n33}: __va_arg1 = b; + {n33}: int __va_arg1 = b; -[-c-]-> 22 -[--d]-> 25 -[--d]-> 26 -[a--]-> 29 -[-c-]-> 31 - {n34}: __va_args[0] = & __va_arg0; + {n34}: void *__va_args[2] = {& __va_arg0, & __va_arg1}; -[-c-]-> 22 -[--d]-> 28 - -[a--]-> 30 - -[-c-]-> 31 - {n35}: __va_args[1] = & __va_arg1; - -[-c-]-> 22 -[--d]-> 29 -[a--]-> 30 -[-c-]-> 31 - {n36}: Call56-InCtrl : tmp = lib_f(2,(void * const *)(__va_args)); + {n35}: Call49-InCtrl : tmp = lib_f(2,(void * const *)(__va_args)); -[-c-]-> 22 -[-c-]-> 31 - {n37}: Call56-In1 : tmp = lib_f(2,(void * const *)(__va_args)); + {n36}: Call49-In1 : tmp = lib_f(2,(void * const *)(__va_args)); -[-c-]-> 22 -[-c-]-> 31 - -[-c-]-> 36 - {n38}: Call56-In2 : tmp = lib_f(2,(void * const *)(__va_args)); + -[-c-]-> 35 + {n37}: Call49-In2 : tmp = lib_f(2,(void * const *)(__va_args)); -[-c-]-> 22 -[--d]-> 30 -[-c-]-> 31 - -[-c-]-> 36 - {n39}: Call56-OutRet : tmp = lib_f(2,(void * const *)(__va_args)); + -[-c-]-> 35 + {n38}: Call49-OutRet : tmp = lib_f(2,(void * const *)(__va_args)); -[-c-]-> 22 -[a--]-> 27 -[-c-]-> 31 - -[-c-]-> 36 - -[--d]-> 37 - {n40}: return tmp; + -[-c-]-> 35 + -[--d]-> 36 + {n39}: return tmp; -[-c-]-> 22 -[--d]-> 27 + -[--d]-> 38 + {n40}: OutRet -[--d]-> 39 - {n41}: OutRet - -[--d]-> 40 [pdg] PDG for f3 - {n42}: InCtrl - {n43}: VarDecl : a - -[a--]-> 44 - {n44}: In1 + {n41}: InCtrl + {n42}: VarDecl : a -[a--]-> 43 - {n45}: VarDecl : b - -[a--]-> 46 - {n46}: In2 + {n43}: In1 + -[a--]-> 42 + {n44}: VarDecl : b -[a--]-> 45 - {n47}: VarDecl : c - -[a--]-> 48 - {n48}: In3 + {n45}: In2 + -[a--]-> 44 + {n46}: VarDecl : c -[a--]-> 47 - {n49}: VarDecl : tmp - {n50}: VarDecl : __va_arg0 - {n51}: VarDecl : __va_arg1 - {n52}: VarDecl : __va_arg2 - {n53}: VarDecl : __va_args - {n54}: block - -[-c-]-> 42 - {n55}: __va_arg0 = a; - -[-c-]-> 42 + {n47}: In3 + -[a--]-> 46 + {n48}: VarDecl : tmp + {n49}: VarDecl : __va_arg0 + {n50}: VarDecl : __va_arg1 + {n51}: VarDecl : __va_arg2 + {n52}: VarDecl : __va_args + {n53}: block + -[-c-]-> 41 + {n54}: int __va_arg0 = a; + -[-c-]-> 41 + -[--d]-> 42 -[--d]-> 43 + -[a--]-> 49 + -[-c-]-> 53 + {n55}: int __va_arg1 = b; + -[-c-]-> 41 -[--d]-> 44 - -[a--]-> 50 - -[-c-]-> 54 - {n56}: __va_arg1 = b; - -[-c-]-> 42 -[--d]-> 45 + -[a--]-> 50 + -[-c-]-> 53 + {n56}: int __va_arg2 = c; + -[-c-]-> 41 -[--d]-> 46 - -[a--]-> 51 - -[-c-]-> 54 - {n57}: __va_arg2 = c; - -[-c-]-> 42 -[--d]-> 47 - -[--d]-> 48 - -[a--]-> 52 - -[-c-]-> 54 - {n58}: __va_args[0] = & __va_arg0; - -[-c-]-> 42 + -[a--]-> 51 + -[-c-]-> 53 + {n57}: void *__va_args[3] = {& __va_arg0, & __va_arg1, & __va_arg2}; + -[-c-]-> 41 + -[--d]-> 49 -[--d]-> 50 - -[a--]-> 53 - -[-c-]-> 54 - {n59}: __va_args[1] = & __va_arg1; - -[-c-]-> 42 -[--d]-> 51 - -[a--]-> 53 - -[-c-]-> 54 - {n60}: __va_args[2] = & __va_arg2; - -[-c-]-> 42 + -[a--]-> 52 + -[-c-]-> 53 + {n58}: Call55-InCtrl : tmp = lib_f(3,(void * const *)(__va_args)); + -[-c-]-> 41 + -[-c-]-> 53 + {n59}: Call55-In1 : tmp = lib_f(3,(void * const *)(__va_args)); + -[-c-]-> 41 + -[-c-]-> 53 + -[-c-]-> 58 + {n60}: Call55-In2 : tmp = lib_f(3,(void * const *)(__va_args)); + -[-c-]-> 41 -[--d]-> 52 - -[a--]-> 53 - -[-c-]-> 54 - {n61}: Call58-InCtrl : tmp = lib_f(3,(void * const *)(__va_args)); - -[-c-]-> 42 - -[-c-]-> 54 - {n62}: Call58-In1 : tmp = lib_f(3,(void * const *)(__va_args)); - -[-c-]-> 42 - -[-c-]-> 54 - -[-c-]-> 61 - {n63}: Call58-In2 : tmp = lib_f(3,(void * const *)(__va_args)); - -[-c-]-> 42 - -[--d]-> 53 - -[-c-]-> 54 - -[-c-]-> 61 - {n64}: Call58-OutRet : tmp = lib_f(3,(void * const *)(__va_args)); - -[-c-]-> 42 - -[a--]-> 49 - -[-c-]-> 54 - -[-c-]-> 61 + -[-c-]-> 53 + -[-c-]-> 58 + {n61}: Call55-OutRet : tmp = lib_f(3,(void * const *)(__va_args)); + -[-c-]-> 41 + -[a--]-> 48 + -[-c-]-> 53 + -[-c-]-> 58 + -[--d]-> 59 + {n62}: return tmp; + -[-c-]-> 41 + -[--d]-> 48 + -[--d]-> 61 + {n63}: OutRet -[--d]-> 62 - {n65}: return tmp; - -[-c-]-> 42 - -[--d]-> 49 - -[--d]-> 64 - {n66}: OutRet - -[--d]-> 65 [pdg] PDG for main - {n67}: InCtrl - {n68}: VarDecl : a1 - {n69}: VarDecl : a2 - {n70}: VarDecl : a3 - {n71}: VarDecl : a4 - {n72}: VarDecl : a5 - {n73}: VarDecl : a6 - {n74}: VarDecl : s - {n75}: VarDecl : s1 - {n76}: VarDecl : s2 - {n77}: VarDecl : s3 - {n78}: a1 = 1; - -[-c-]-> 67 + {n64}: InCtrl + {n65}: VarDecl : a1 + {n66}: VarDecl : a2 + {n67}: VarDecl : a3 + {n68}: VarDecl : a4 + {n69}: VarDecl : a5 + {n70}: VarDecl : a6 + {n71}: VarDecl : s + {n72}: VarDecl : s1 + {n73}: VarDecl : s2 + {n74}: VarDecl : s3 + {n75}: int a1 = 1; + -[-c-]-> 64 + -[a--]-> 65 + {n76}: int a2 = 2; + -[-c-]-> 64 + -[a--]-> 66 + {n77}: int a3 = 3; + -[-c-]-> 64 + -[a--]-> 67 + {n78}: int a4 = 4; + -[-c-]-> 64 -[a--]-> 68 - {n79}: a2 = 2; - -[-c-]-> 67 + {n79}: int a5 = 5; + -[-c-]-> 64 -[a--]-> 69 - {n80}: a3 = 3; - -[-c-]-> 67 + {n80}: int a6 = 6; + -[-c-]-> 64 -[a--]-> 70 - {n81}: a4 = 4; - -[-c-]-> 67 - -[a--]-> 71 - {n82}: a5 = 5; - -[-c-]-> 67 + {n81}: Call32-InCtrl : s1 = f1(a1); + -[-c-]-> 64 + {n82}: Call32-In1 : s1 = f1(a1); + -[-c-]-> 64 + -[--d]-> 65 + -[--d]-> 75 + -[-c-]-> 81 + {n83}: Call32-OutRet : s1 = f1(a1); + -[-c-]-> 64 -[a--]-> 72 - {n83}: a6 = 6; - -[-c-]-> 67 + -[-c-]-> 81 + {n84}: Call33-InCtrl : s2 = f2(a2,a3); + -[-c-]-> 64 + {n85}: Call33-In1 : s2 = f2(a2,a3); + -[-c-]-> 64 + -[--d]-> 66 + -[--d]-> 76 + -[-c-]-> 84 + {n86}: Call33-In2 : s2 = f2(a2,a3); + -[-c-]-> 64 + -[--d]-> 67 + -[--d]-> 77 + -[-c-]-> 84 + {n87}: Call33-OutRet : s2 = f2(a2,a3); + -[-c-]-> 64 -[a--]-> 73 - {n84}: Call32-InCtrl : s1 = f1(a1); - -[-c-]-> 67 - {n85}: Call32-In1 : s1 = f1(a1); - -[-c-]-> 67 + -[-c-]-> 84 + {n88}: Call34-InCtrl : s3 = f3(a4,a5,a6); + -[-c-]-> 64 + {n89}: Call34-In1 : s3 = f3(a4,a5,a6); + -[-c-]-> 64 -[--d]-> 68 -[--d]-> 78 - -[-c-]-> 84 - {n86}: Call32-OutRet : s1 = f1(a1); - -[-c-]-> 67 - -[a--]-> 75 - -[-c-]-> 84 - {n87}: Call33-InCtrl : s2 = f2(a2,a3); - -[-c-]-> 67 - {n88}: Call33-In1 : s2 = f2(a2,a3); - -[-c-]-> 67 + -[-c-]-> 88 + {n90}: Call34-In2 : s3 = f3(a4,a5,a6); + -[-c-]-> 64 -[--d]-> 69 -[--d]-> 79 - -[-c-]-> 87 - {n89}: Call33-In2 : s2 = f2(a2,a3); - -[-c-]-> 67 + -[-c-]-> 88 + {n91}: Call34-In3 : s3 = f3(a4,a5,a6); + -[-c-]-> 64 -[--d]-> 70 -[--d]-> 80 - -[-c-]-> 87 - {n90}: Call33-OutRet : s2 = f2(a2,a3); - -[-c-]-> 67 - -[a--]-> 76 - -[-c-]-> 87 - {n91}: Call34-InCtrl : s3 = f3(a4,a5,a6); - -[-c-]-> 67 - {n92}: Call34-In1 : s3 = f3(a4,a5,a6); - -[-c-]-> 67 - -[--d]-> 71 - -[--d]-> 81 - -[-c-]-> 91 - {n93}: Call34-In2 : s3 = f3(a4,a5,a6); - -[-c-]-> 67 + -[-c-]-> 88 + {n92}: Call34-OutRet : s3 = f3(a4,a5,a6); + -[-c-]-> 64 + -[a--]-> 74 + -[-c-]-> 88 + {n93}: Call35-InCtrl : s = f2(s1,s2); + -[-c-]-> 64 + {n94}: Call35-In1 : s = f2(s1,s2); + -[-c-]-> 64 -[--d]-> 72 - -[--d]-> 82 - -[-c-]-> 91 - {n94}: Call34-In3 : s3 = f3(a4,a5,a6); - -[-c-]-> 67 - -[--d]-> 73 -[--d]-> 83 - -[-c-]-> 91 - {n95}: Call34-OutRet : s3 = f3(a4,a5,a6); - -[-c-]-> 67 - -[a--]-> 77 - -[-c-]-> 91 - {n96}: Call35-InCtrl : s = f2(s1,s2); - -[-c-]-> 67 - {n97}: Call35-In1 : s = f2(s1,s2); - -[-c-]-> 67 - -[--d]-> 75 - -[--d]-> 86 - -[-c-]-> 96 - {n98}: Call35-In2 : s = f2(s1,s2); - -[-c-]-> 67 - -[--d]-> 76 - -[--d]-> 90 - -[-c-]-> 96 - {n99}: Call35-OutRet : s = f2(s1,s2); - -[-c-]-> 67 - -[a--]-> 74 - -[-c-]-> 96 - {n100}: return s; - -[-c-]-> 67 - -[--d]-> 74 - -[--d]-> 99 - {n101}: OutRet - -[--d]-> 100 + -[-c-]-> 93 + {n95}: Call35-In2 : s = f2(s1,s2); + -[-c-]-> 64 + -[--d]-> 73 + -[--d]-> 87 + -[-c-]-> 93 + {n96}: Call35-OutRet : s = f2(s1,s2); + -[-c-]-> 64 + -[a--]-> 71 + -[-c-]-> 93 + {n97}: return s; + -[-c-]-> 64 + -[--d]-> 71 + -[--d]-> 96 + {n98}: OutRet + -[--d]-> 97 diff --git a/tests/pdg/pb_infinite_loop.c b/tests/pdg/pb_infinite_loop.c index 9083865d178553f08a0d1003499dce407f6fd997..df38c001d2b16f3771f40a35f9797a1071db488e 100644 --- a/tests/pdg/pb_infinite_loop.c +++ b/tests/pdg/pb_infinite_loop.c @@ -1,8 +1,8 @@ /* run.config GCC: - OPT: -main test_infinite_loop -fct-pdg test_infinite_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main test_infinite_loop_2 -fct-pdg test_infinite_loop_2 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main test_exit -fct-pdg test_exit -journal-disable -pdg-print -pdg-verbose 2 + OPT: -main test_infinite_loop -val-show-progress -fct-pdg test_infinite_loop -journal-disable -pdg-print -pdg-verbose 2 + OPT: -main test_infinite_loop_2 -val-show-progress -fct-pdg test_infinite_loop_2 -journal-disable -pdg-print -pdg-verbose 2 + OPT: -main test_exit -val-show-progress -fct-pdg test_exit -journal-disable -pdg-print -pdg-verbose 2 */ /* This test is a problem at the moment because the postdominators are Top diff --git a/tests/pdg/postdom.c b/tests/pdg/postdom.c index e16f8615b61db34f6db47a4a675ad744618b56d4..69be6b586656d04c45453b062be3b7fe0a3ac6a0 100644 --- a/tests/pdg/postdom.c +++ b/tests/pdg/postdom.c @@ -1,5 +1,5 @@ /* run.config - OPT: -pdg -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 */ diff --git a/tests/pdg/sets.c b/tests/pdg/sets.c index 69c141215d5d6a603087f48d900ac4ddf7d1dccb..1f14a0d3acfc3ee80b74e496947756176db24c27 100644 --- a/tests/pdg/sets.c +++ b/tests/pdg/sets.c @@ -1,5 +1,5 @@ /* run.config - OPT: -load-script tests/pdg/sets.ml -lib-entry -main f -pdg -inout -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -load-script tests/pdg/sets.ml -lib-entry -main f -pdg -inout -journal-disable -pdg-print -pdg-verbose 2 */ diff --git a/tests/pdg/simple_call.c b/tests/pdg/simple_call.c index c6c94262f37595b51ccbcf1a47c1412ab223d61c..ab967b39431d206b573053f9175c5c6e0cbe35f0 100644 --- a/tests/pdg/simple_call.c +++ b/tests/pdg/simple_call.c @@ -1,9 +1,9 @@ /* run.config GCC: - OPT: -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main call_in_loop -fct-pdg call_in_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main call_mix_G1_G2 -fct-pdg call_mix_G1_G2 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main call_multiple_global_outputs -fct-pdg call_multiple_global_outputs -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 + OPT: -main call_in_loop -val-show-progress -fct-pdg call_in_loop -journal-disable -pdg-print -pdg-verbose 2 + OPT: -main call_mix_G1_G2 -val-show-progress -fct-pdg call_mix_G1_G2 -journal-disable -pdg-print -pdg-verbose 2 + OPT: -main call_multiple_global_outputs -val-show-progress -fct-pdg call_multiple_global_outputs -journal-disable -pdg-print -pdg-verbose 2 */ extern int G, G1, G2; diff --git a/tests/pdg/simple_intra_slice.c b/tests/pdg/simple_intra_slice.c index 103c24db32d4ab8f2b6ac24521ed89173b04ba6b..bfef2ae0175711244d8cfbaf43e70db2f14b4468 100644 --- a/tests/pdg/simple_intra_slice.c +++ b/tests/pdg/simple_intra_slice.c @@ -1,21 +1,21 @@ /* run.config GCC: - OPT: -pdg -journal-disable -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 */ -/* test conçu initialement comme test pour le slicing */ +/* test conçu initialement comme test pour le slicing */ int Unknown; int G; -/* on sélectionne le return. +/* on sélectionne le return. on doit garder juste a (pas G et b) */ int f1 (int x, int y) { int a = 1, b = 2; G = x + a; return y + b; } -/* on sélectionne le return. - pas de réduction intreproc -> b doit être marqué Spare +/* on sélectionne le return. + pas de réduction intreproc -> b doit être marqué Spare et recursivement a aussi. */ int f2 (void) { @@ -23,7 +23,7 @@ int f2 (void) { return f1 (b, c); } -/* avec un IF : sélection de la branche then */ +/* avec un IF : sélection de la branche then */ int f3 (int c) { int a = 1, b = 2; int x = 0; @@ -33,7 +33,7 @@ int f3 (int c) { G = a; return x; } -/* avec un IF : sélection de la branche else */ +/* avec un IF : sélection de la branche else */ int f4 (int c) { int a = 1, b = 2; int x = 0; diff --git a/tests/pdg/top_pdg_input.c b/tests/pdg/top_pdg_input.c index 89faab10e0354298e48a24dcde961f5ac0ef4426..53c8cebd649f7e52c784d7a040b30e8d452bf2cf 100644 --- a/tests/pdg/top_pdg_input.c +++ b/tests/pdg/top_pdg_input.c @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-load-module pdg -pdg -journal-disable -pdg-print -pdg-verbose 2 -then -main main_asm" + STDOPT: +"-no-val-builtins-auto -load-module pdg -pdg -journal-disable -pdg-print -pdg-verbose 2 -then -main main_asm" */ int ** top_input() ; diff --git a/tests/pdg/variadic.c b/tests/pdg/variadic.c index e1b871a77eac9e3b1402589bc9adcaf47b92f37e..ab7d3a04389987c2ead14228d228f35880c47476 100644 --- a/tests/pdg/variadic.c +++ b/tests/pdg/variadic.c @@ -1,5 +1,5 @@ /* run.config -* OPT: -pdg -journal-disable -pdg-print -pdg-verbose 2 +* OPT: -val-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 */ // __builtin_va_start and co do not appear in PDG output because Value forgets to register them in the table of called functions. This is a bug of Value diff --git a/tests/pretty_c/t1.c b/tests/pretty_c/t1.c index b3f88e2f3f78d9a010bedfcefcb4630748f51574..db6799cc5b5262aad82f2ab28246947b478e691e 100644 --- a/tests/pretty_c/t1.c +++ b/tests/pretty_c/t1.c @@ -1,3 +1,6 @@ +/*run.config + STDOPT: +"-no-val-malloc-returns-null" +*/ static int a; static int b = 4; @@ -11,7 +14,7 @@ int main (int c) { a--; x = !!c; p = p + 1; - int * q = Frama_C_alloc_size(sizeof(int)); + int * q = Frama_C_malloc_fresh(sizeof(int)); *q = 12; Frama_C_dump_each(); Frama_C_dump_assert_each(); diff --git a/tests/pretty_printing/oracle/binary_logic_op.res.oracle b/tests/pretty_printing/oracle/binary_logic_op.res.oracle index 333a9b571d115768971760413f982d6051b3736b..6ca4d6391bb0cc3d7b7dccd2e04cc33884c8b672 100644 --- a/tests/pretty_printing/oracle/binary_logic_op.res.oracle +++ b/tests/pretty_printing/oracle/binary_logic_op.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pretty_printing/binary_logic_op.c (with preprocessing) /* Generated by Frama-C */ /*@ @@ -15,7 +14,6 @@ predicate mixed(ℤ x, ℤ y, ℤ z, ℤ t) = x ≡ 0 ∨ y ≡ 0 ∨ z ≡ 0 ∨ t ≡ 0; */ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pretty_printing/result/binary_logic_op.c (with preprocessing) [kernel] Parsing tests/pretty_printing/binary_logic_op.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/pretty_printing/oracle/parenthesis.res.oracle b/tests/pretty_printing/oracle/parenthesis.res.oracle index 9324a63349d6c418ddf0a5455c04fa00768b1a94..746085f613549cba8ca6f6115073102c1e2b01a5 100644 --- a/tests/pretty_printing/oracle/parenthesis.res.oracle +++ b/tests/pretty_printing/oracle/parenthesis.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pretty_printing/parenthesis.c (with preprocessing) /* Generated by Frama-C */ /*@ diff --git a/tests/pretty_printing/oracle/relations.res.oracle b/tests/pretty_printing/oracle/relations.res.oracle index df0ee3f9968d1cb4f32a44949e1ded8ed7176607..94bbc7e081951208d9f06c0696a1d8ac958295b7 100644 --- a/tests/pretty_printing/oracle/relations.res.oracle +++ b/tests/pretty_printing/oracle/relations.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pretty_printing/relations.c (with preprocessing) /* Generated by Frama-C */ /*@ predicate rel1(ℤ x, ℤ y, ℤ z, ℤ t) = x ≤ y ≤ z ∧ z ≥ t; @@ -6,7 +5,6 @@ /*@ predicate rel2(ℤ x, ℤ y, ℤ z, ℤ t) = x ≤ y ≡ z ∧ z ≥ t; */ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/pretty_printing/result/relations.c (with preprocessing) [kernel] Parsing tests/pretty_printing/relations.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/rte/finite_float.c b/tests/rte/finite_float.c new file mode 100644 index 0000000000000000000000000000000000000000..90d3fab07e663ef66c3fb010b434cafb72f0bc89 --- /dev/null +++ b/tests/rte/finite_float.c @@ -0,0 +1,11 @@ +/* run.config + OPT: -rte -warn-not-finite-float -print -machdep x86_32 -journal-disable +*/ +#define _ISOC99_SOURCE +#include <math.h> + +void main() { + double d = 0x1p10000; + d = 0.; + double e = (d/d) + d; +} diff --git a/tests/rte/oracle/addsub.res.oracle b/tests/rte/oracle/addsub.res.oracle index 58536c2f61b4582e50f8af5123756b72d668e813..9b31561595a570f98ed88d6919b9fa1f73144841 100644 --- a/tests/rte/oracle/addsub.res.oracle +++ b/tests/rte/oracle/addsub.res.oracle @@ -1,36 +1,32 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/addsub.c (with preprocessing) [rte] annotating function main tests/rte/addsub.c:9:[rte] warning: guaranteed RTE: assert signed_overflow: 0x7fffffff + 0x7fffffff ≤ 2147483647; tests/rte/addsub.c:10:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 0x7fffffff; +tests/rte/addsub.c:11:[rte] warning: guaranteed RTE: + assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; tests/rte/addsub.c:11:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; -tests/rte/addsub.c:11:[rte] warning: guaranteed RTE: - assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; /* Generated by Frama-C */ int main(void) { int __retres; - int x; - int y; - int z; - x = 0; - y = 0; - z = 0; + int x = 0; + int y = 0; + int z = 0; /*@ assert rte: signed_overflow: 0x7fffffff + 0x7fffffff ≤ 2147483647; */ z = 0x7fffffff + 0x7fffffff; /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 0x7fffffff; */ z = -0x7fffffff - 0x7fffffff; + /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ z = - (-0x7fffffff - 1) - 1; z = 0x7fffffff + 0; z = -0x7fffffff - 1; @@ -39,8 +35,8 @@ int main(void) z = x + y; /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7ffffffc) - y; */ z = -0x7ffffffc - y; - /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-x) - 0x7ffffffc; */ /*@ assert rte: signed_overflow: -2147483647 ≤ x; */ + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-x) - 0x7ffffffc; */ z = - x - 0x7ffffffc; /*@ assert rte: signed_overflow: 0x7ffffffc + y ≤ 2147483647; */ z = 0x7ffffffc + y; diff --git a/tests/rte/oracle/addsub_typedef.res.oracle b/tests/rte/oracle/addsub_typedef.res.oracle index b065933a56c1b89960f82ee8edfb4ea58215bbdf..cdd935d86bd3cb0e0d4ff3c0e14726f44ffbe2b3 100644 --- a/tests/rte/oracle/addsub_typedef.res.oracle +++ b/tests/rte/oracle/addsub_typedef.res.oracle @@ -1,37 +1,33 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/addsub_typedef.c (with preprocessing) [rte] annotating function main tests/rte/addsub_typedef.c:11:[rte] warning: guaranteed RTE: assert signed_overflow: 0x7fffffff + 0x7fffffff ≤ 2147483647; tests/rte/addsub_typedef.c:12:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 0x7fffffff; +tests/rte/addsub_typedef.c:13:[rte] warning: guaranteed RTE: + assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; tests/rte/addsub_typedef.c:13:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; -tests/rte/addsub_typedef.c:13:[rte] warning: guaranteed RTE: - assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; /* Generated by Frama-C */ typedef int tint; int main(void) { int __retres; - tint x; - tint y; - tint z; - x = 0; - y = 0; - z = 0; + tint x = 0; + tint y = 0; + tint z = 0; /*@ assert rte: signed_overflow: 0x7fffffff + 0x7fffffff ≤ 2147483647; */ z = 0x7fffffff + 0x7fffffff; /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 0x7fffffff; */ z = -0x7fffffff - 0x7fffffff; + /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ z = - (-0x7fffffff - 1) - 1; z = 0x7fffffff + 0; z = -0x7fffffff - 1; @@ -40,8 +36,8 @@ int main(void) z = x + y; /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7ffffffc) - y; */ z = -0x7ffffffc - y; - /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-x) - 0x7ffffffc; */ /*@ assert rte: signed_overflow: -2147483647 ≤ x; */ + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-x) - 0x7ffffffc; */ z = - x - 0x7ffffffc; /*@ assert rte: signed_overflow: 0x7ffffffc + y ≤ 2147483647; */ z = 0x7ffffffc + y; diff --git a/tests/rte/oracle/addsub_unsigned.0.res.oracle b/tests/rte/oracle/addsub_unsigned.0.res.oracle index 2b14953424942fbf72a586837ff983de3521caa9..57205aff6748b1684b85d435da5a1d568c72bd30 100644 --- a/tests/rte/oracle/addsub_unsigned.0.res.oracle +++ b/tests/rte/oracle/addsub_unsigned.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/addsub_unsigned.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/addsub_unsigned.1.res.oracle b/tests/rte/oracle/addsub_unsigned.1.res.oracle index c35c64ce65e0dd9c19deefec97adc1111ff2571b..a9efb6e0b2180c568409b4631c3dc091ec03e2ed 100644 --- a/tests/rte/oracle/addsub_unsigned.1.res.oracle +++ b/tests/rte/oracle/addsub_unsigned.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/addsub_unsigned.c (with preprocessing) [rte] annotating function main tests/rte/addsub_unsigned.c:12:[rte] warning: guaranteed RTE: diff --git a/tests/rte/oracle/addsub_unsigned_typedef.0.res.oracle b/tests/rte/oracle/addsub_unsigned_typedef.0.res.oracle index b90707428b4f7d03b9df06e26e76eeef4c71d961..bf5fd406bcb65f9e247ee4564734ef9505682e9d 100644 --- a/tests/rte/oracle/addsub_unsigned_typedef.0.res.oracle +++ b/tests/rte/oracle/addsub_unsigned_typedef.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/addsub_unsigned_typedef.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/addsub_unsigned_typedef.1.res.oracle b/tests/rte/oracle/addsub_unsigned_typedef.1.res.oracle index ba4711be371b70e77fe4ba910de63f8ecf0c7d1d..15a5980c588b1b0e71cecbe0ae9787cc7b4efd53 100644 --- a/tests/rte/oracle/addsub_unsigned_typedef.1.res.oracle +++ b/tests/rte/oracle/addsub_unsigned_typedef.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/addsub_unsigned_typedef.c (with preprocessing) [rte] annotating function main tests/rte/addsub_unsigned_typedef.c:14:[rte] warning: guaranteed RTE: diff --git a/tests/rte/oracle/array_index.0.res.oracle b/tests/rte/oracle/array_index.0.res.oracle index 8635956680db99f1b65fa892b75917ba4792f959..6acdd373586e604dd2da7626f9e3051dfde58a75 100644 --- a/tests/rte/oracle/array_index.0.res.oracle +++ b/tests/rte/oracle/array_index.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/array_index.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/array_index.1.res.oracle b/tests/rte/oracle/array_index.1.res.oracle index 93cbbd33a9c3a305ce031ff254c0508963d47084..31cf7a921b3d4ccc106b05db4eda7683c0acae49 100644 --- a/tests/rte/oracle/array_index.1.res.oracle +++ b/tests/rte/oracle/array_index.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/array_index.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/assign.res.oracle b/tests/rte/oracle/assign.res.oracle index d921f559eabf6a313c861059d4352c132c0ed269..d77452a199dcf345bc90ce64ee01220b9c8f5bb3 100644 --- a/tests/rte/oracle/assign.res.oracle +++ b/tests/rte/oracle/assign.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign.c (with preprocessing) [rte] annotating function rte tests/rte/assign.c:37:[kernel] warning: Neither code nor specification for function fnd4, generating default assigns from the prototype diff --git a/tests/rte/oracle/assign2.res.oracle b/tests/rte/oracle/assign2.res.oracle index 912aafc432d165e8be79580e4f41c49dde5e5914..abef2edefcaef07350bc571bbdac43ceb919895b 100644 --- a/tests/rte/oracle/assign2.res.oracle +++ b/tests/rte/oracle/assign2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign2.c (with preprocessing) [rte] annotating function f tests/rte/assign2.c:16:[kernel] warning: No code nor implicit assigns clause for function any, generating default assigns from the prototype diff --git a/tests/rte/oracle/assign3.res.oracle b/tests/rte/oracle/assign3.res.oracle index 895ee43f4cafb37d42896fd01f0fc4894c956e94..cf38cbd4d178c6b526ebda16c7412040d18e80a9 100644 --- a/tests/rte/oracle/assign3.res.oracle +++ b/tests/rte/oracle/assign3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign3.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/assign4.res.oracle b/tests/rte/oracle/assign4.res.oracle index fc48ba0ffb1bd7879029266369d8ace0913c4c26..e5fcf6e831d207ba530f30296f5e26b16316c558 100644 --- a/tests/rte/oracle/assign4.res.oracle +++ b/tests/rte/oracle/assign4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign4.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ @@ -15,18 +14,16 @@ int choose2(int min, int max); int main(void) { int __retres; - int c1; - int c2; /*@ behavior pre_choose1: assigns c1; assigns c1 \from \nothing; */ - c1 = choose1(5,10); + int c1 = choose1(5,10); /*@ behavior pre_choose2: assigns c2, c2; assigns c2 \from c1, c1; assigns c2 \from c1, c1; */ - c2 = choose2(0,c1); + int c2 = choose2(0,c1); /*@ assert rte: signed_overflow: -2147483648 ≤ c1 + c2; */ /*@ assert rte: signed_overflow: c1 + c2 ≤ 2147483647; */ __retres = c1 + c2; diff --git a/tests/rte/oracle/assign5.res.oracle b/tests/rte/oracle/assign5.res.oracle index f7e029eb53ad0a9afbf696014c0789f9df6ebb55..04b68b3bde58a0dcbbbd2d28aebe740edb9bb0c3 100644 --- a/tests/rte/oracle/assign5.res.oracle +++ b/tests/rte/oracle/assign5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign5.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/assign6.res.oracle b/tests/rte/oracle/assign6.res.oracle index 51b9815eb3bdbea21fe3855112776faeabda604c..959834da79ad086bef49219422c40bf68ed30bdc 100644 --- a/tests/rte/oracle/assign6.res.oracle +++ b/tests/rte/oracle/assign6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign6.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/assign7.res.oracle b/tests/rte/oracle/assign7.res.oracle index 0297f885e97089f508c0b6ccbbf315dc4dff9402..96fda38ffa71a842a6fe34b8973c93e3dd5777f5 100644 --- a/tests/rte/oracle/assign7.res.oracle +++ b/tests/rte/oracle/assign7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/assign7.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/bts0567.res.oracle b/tests/rte/oracle/bts0567.res.oracle index bd12c036b3b3c479b7b572ac3925057808c12590..b02c80d28fdd506e3598d80fbbc009e0b81ec741 100644 --- a/tests/rte/oracle/bts0567.res.oracle +++ b/tests/rte/oracle/bts0567.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/bts0567.c (with preprocessing) [rte] annotating function g tests/rte/bts0567.c:11:[kernel] warning: No code nor implicit assigns clause for function f, generating default assigns from the prototype diff --git a/tests/rte/oracle/bts0576.res.oracle b/tests/rte/oracle/bts0576.res.oracle index 0d8b16c9917080e2df9bc0a89ea2f7368c35d9ac..34e13e25605620817567bff695268a3947d27ab8 100644 --- a/tests/rte/oracle/bts0576.res.oracle +++ b/tests/rte/oracle/bts0576.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/bts0576.c (with preprocessing) tests/rte/bts0576.c:6:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/rte/bts0576.c:6:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. diff --git a/tests/rte/oracle/bts0580.res.oracle b/tests/rte/oracle/bts0580.res.oracle index 81786f79758bce8e22c4e9730c513cdfe5cd7540..2fb977881b12bf8ac6e0a548fd88ad1d60481b31 100644 --- a/tests/rte/oracle/bts0580.res.oracle +++ b/tests/rte/oracle/bts0580.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/bts0580.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/bts0580_2.res.oracle b/tests/rte/oracle/bts0580_2.res.oracle index 8aace82c36e6e4ff1b07b6a0ff18442b6744409d..7b7986e4a6cbb45a562a5aa7c26b445d40a2b137 100644 --- a/tests/rte/oracle/bts0580_2.res.oracle +++ b/tests/rte/oracle/bts0580_2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/bts0580_2.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/bts1052.res.oracle b/tests/rte/oracle/bts1052.res.oracle index 33d496a957ef8688a09d382e0003368eed1b2c85..36f10a6cc2f95d2167bf98f678ba674dec29073c 100644 --- a/tests/rte/oracle/bts1052.res.oracle +++ b/tests/rte/oracle/bts1052.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/bts1052.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/bts621.res.oracle b/tests/rte/oracle/bts621.res.oracle index 1635542bf3b33c1e4d42d05c3b959275a6041648..73b312cf89fee5c614ea2bc6058f9d8022835754 100644 --- a/tests/rte/oracle/bts621.res.oracle +++ b/tests/rte/oracle/bts621.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/bts621.c (with preprocessing) /* Generated by Frama-C */ /*@ assigns *p; */ @@ -6,8 +5,7 @@ float g(float *p); void f(float a) { - /*@ ghost float x; */ - /*@ ghost x = g(& a); */ + /*@ ghost float x = g(& a); */ return; } @@ -19,10 +17,9 @@ float g(float *p); void f(float a) { - /*@ ghost float x; */ /*@ behavior pre_g: assigns x, a; */ - /*@ ghost x = g(& a); */ + /*@ ghost float x = g(& a); */ return; } diff --git a/tests/rte/oracle/castoncall.0.res.oracle b/tests/rte/oracle/castoncall.0.res.oracle index f9b9e55c0f903589a7e82bc5262b0d29eb07ed09..795390cdb4cd013ce9d9f66698a766e6334a9c71 100644 --- a/tests/rte/oracle/castoncall.0.res.oracle +++ b/tests/rte/oracle/castoncall.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/castoncall.c (with preprocessing) [rte] annotating function g [rte] annotating function nondet_ptr @@ -33,7 +32,6 @@ int f(); void g(void) { - char c; int tmp; /*@ behavior pre_f: ensures tmp ≡ 1; @@ -41,7 +39,7 @@ void g(void) tmp = f(); /*@ assert rte: signed_downcast: tmp ≤ 127; */ /*@ assert rte: signed_downcast: -128 ≤ tmp; */ - c = (char)tmp; + char c = (char)tmp; return; } diff --git a/tests/rte/oracle/castoncall.1.res.oracle b/tests/rte/oracle/castoncall.1.res.oracle index f9b9e55c0f903589a7e82bc5262b0d29eb07ed09..795390cdb4cd013ce9d9f66698a766e6334a9c71 100644 --- a/tests/rte/oracle/castoncall.1.res.oracle +++ b/tests/rte/oracle/castoncall.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/castoncall.c (with preprocessing) [rte] annotating function g [rte] annotating function nondet_ptr @@ -33,7 +32,6 @@ int f(); void g(void) { - char c; int tmp; /*@ behavior pre_f: ensures tmp ≡ 1; @@ -41,7 +39,7 @@ void g(void) tmp = f(); /*@ assert rte: signed_downcast: tmp ≤ 127; */ /*@ assert rte: signed_downcast: -128 ≤ tmp; */ - c = (char)tmp; + char c = (char)tmp; return; } diff --git a/tests/rte/oracle/divmod.res.oracle b/tests/rte/oracle/divmod.res.oracle index 9c4f6357df939e783850b3a41a22786256f79f30..fc9024d05e8a9fe69c7c3a8760cdc0d08d448c09 100644 --- a/tests/rte/oracle/divmod.res.oracle +++ b/tests/rte/oracle/divmod.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/divmod.c (with preprocessing) [rte] annotating function main tests/rte/divmod.c:13:[rte] warning: guaranteed RTE: @@ -20,18 +19,12 @@ tests/rte/divmod.c:36:[rte] warning: guaranteed RTE: int main(void) { int __retres; - int x; - int y; - int z; - unsigned int ux; - unsigned int uy; - unsigned int uz; - x = 0; - y = 0; - z = 0; - ux = (unsigned int)0; - uy = (unsigned int)0; - uz = (unsigned int)0; + int x = 0; + int y = 0; + int z = 0; + unsigned int ux = (unsigned int)0; + unsigned int uy = (unsigned int)0; + unsigned int uz = (unsigned int)0; /*@ assert rte: signed_overflow: (int)((int)(-2147483647) - 1) / (int)(-1) ≤ 2147483647; @@ -44,10 +37,10 @@ int main(void) uz = (unsigned int)1 / (0xffffffff + (unsigned int)1); ux = 0x80000000; uy = 0xffffffff; - /*@ assert rte: division_by_zero: (int)uy ≢ 0; */ - /*@ assert rte: signed_overflow: (int)ux / (int)uy ≤ 2147483647; */ /*@ assert rte: signed_downcast: ux ≤ 2147483647; */ /*@ assert rte: signed_downcast: uy ≤ 2147483647; */ + /*@ assert rte: division_by_zero: (int)uy ≢ 0; */ + /*@ assert rte: signed_overflow: (int)ux / (int)uy ≤ 2147483647; */ uz = (unsigned int)((int)ux / (int)uy); /*@ assert rte: division_by_zero: uy ≢ 0; */ uz = ux / uy; @@ -61,9 +54,9 @@ int main(void) uz = (unsigned int)(-0x7fffffff - 1) / 0xffffffff; uz = 0x80000000 / (unsigned int)(-1); uz = (unsigned int)((int)(0x80000000 / 0xffffffff)); - /*@ assert rte: division_by_zero: (int)(x + y) ≢ 0; */ /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ + /*@ assert rte: division_by_zero: (int)(x + y) ≢ 0; */ z = 1 / (x + y); /*@ assert rte: signed_overflow: x / (int)(-1) ≤ 2147483647; */ z = x / -1; diff --git a/tests/rte/oracle/divmod_typedef.res.oracle b/tests/rte/oracle/divmod_typedef.res.oracle index 9a4a51e79e5f19798b9830aea1afabff75aa96ea..dae966b720a1b49ab3cfd11f2292ffe2396d9109 100644 --- a/tests/rte/oracle/divmod_typedef.res.oracle +++ b/tests/rte/oracle/divmod_typedef.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/divmod_typedef.c (with preprocessing) [rte] annotating function main tests/rte/divmod_typedef.c:15:[rte] warning: guaranteed RTE: @@ -22,18 +21,12 @@ typedef unsigned int tuint; int main(void) { int __retres; - tint x; - tint y; - tint z; - tuint ux; - tuint uy; - tuint uz; - x = 0; - y = 0; - z = 0; - ux = (unsigned int)0; - uy = (unsigned int)0; - uz = (unsigned int)0; + tint x = 0; + tint y = 0; + tint z = 0; + tuint ux = (unsigned int)0; + tuint uy = (unsigned int)0; + tuint uz = (unsigned int)0; /*@ assert rte: signed_overflow: (int)((int)(-2147483647) - 1) / (int)(-1) ≤ 2147483647; @@ -46,10 +39,10 @@ int main(void) uz = (unsigned int)1 / (0xffffffff + (unsigned int)1); ux = 0x80000000; uy = 0xffffffff; - /*@ assert rte: division_by_zero: (int)uy ≢ 0; */ - /*@ assert rte: signed_overflow: (int)ux / (int)uy ≤ 2147483647; */ /*@ assert rte: signed_downcast: ux ≤ 2147483647; */ /*@ assert rte: signed_downcast: uy ≤ 2147483647; */ + /*@ assert rte: division_by_zero: (int)uy ≢ 0; */ + /*@ assert rte: signed_overflow: (int)ux / (int)uy ≤ 2147483647; */ uz = (unsigned int)((int)ux / (int)uy); /*@ assert rte: division_by_zero: uy ≢ 0; */ uz = ux / uy; @@ -63,9 +56,9 @@ int main(void) uz = (unsigned int)(-0x7fffffff - 1) / 0xffffffff; uz = 0x80000000 / (unsigned int)(-1); uz = (unsigned int)((int)(0x80000000 / 0xffffffff)); - /*@ assert rte: division_by_zero: (int)(x + y) ≢ 0; */ /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ + /*@ assert rte: division_by_zero: (int)(x + y) ≢ 0; */ z = 1 / (x + y); /*@ assert rte: signed_overflow: x / (int)(-1) ≤ 2147483647; */ z = x / -1; diff --git a/tests/rte/oracle/downcast.0.res.oracle b/tests/rte/oracle/downcast.0.res.oracle index e82d88e9803b8bff491b52069730daa65e6c35c0..e5947116b6bb904f0da499e286708d821ed2bd27 100644 --- a/tests/rte/oracle/downcast.0.res.oracle +++ b/tests/rte/oracle/downcast.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/downcast.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ @@ -14,6 +13,8 @@ int main(void) unsigned int uy; unsigned int uz; unsigned short s; + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)sx + (int)sy; */ + /*@ assert rte: signed_overflow: (int)sx + (int)sy ≤ 2147483647; */ /*@ assert rte: signed_downcast: (int)sx + (int)sy ≤ 127; */ /*@ assert rte: signed_downcast: -128 ≤ (int)sx + (int)sy; */ sz = (signed char)((int)sx + (int)sy); diff --git a/tests/rte/oracle/downcast.1.res.oracle b/tests/rte/oracle/downcast.1.res.oracle index d72565150f5efcca503293a5a322325b453ba51f..eae687cad35a5ef877b52c135c8e2e7eee5e2ec3 100644 --- a/tests/rte/oracle/downcast.1.res.oracle +++ b/tests/rte/oracle/downcast.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/downcast.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/downcast.2.res.oracle b/tests/rte/oracle/downcast.2.res.oracle index 759257a2590a26fa73a05ea62f07dafbc2cd0d7c..c6bce9ea5cadd82ceccd7458e06fa4e5bc74ef05 100644 --- a/tests/rte/oracle/downcast.2.res.oracle +++ b/tests/rte/oracle/downcast.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/downcast.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ @@ -14,13 +13,15 @@ int main(void) unsigned int uy; unsigned int uz; unsigned short s; + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)sx + (int)sy; */ + /*@ assert rte: signed_overflow: (int)sx + (int)sy ≤ 2147483647; */ /*@ assert rte: signed_downcast: (int)sx + (int)sy ≤ 127; */ /*@ assert rte: signed_downcast: -128 ≤ (int)sx + (int)sy; */ sz = (signed char)((int)sx + (int)sy); - /*@ assert rte: unsigned_downcast: (int)sx + (int)sy ≤ 255; */ - /*@ assert rte: unsigned_downcast: 0 ≤ (int)sx + (int)sy; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)sx + (int)sy; */ /*@ assert rte: signed_overflow: (int)sx + (int)sy ≤ 2147483647; */ + /*@ assert rte: unsigned_downcast: (int)sx + (int)sy ≤ 255; */ + /*@ assert rte: unsigned_downcast: 0 ≤ (int)sx + (int)sy; */ uc = (unsigned char)((int)sx + (int)sy); /*@ assert rte: unsigned_downcast: x ≤ 255; */ /*@ assert rte: unsigned_downcast: 0 ≤ x; */ diff --git a/tests/value/oracle/endian.err.oracle b/tests/rte/oracle/finite_float.err.oracle similarity index 100% rename from tests/value/oracle/endian.err.oracle rename to tests/rte/oracle/finite_float.err.oracle diff --git a/tests/rte/oracle/finite_float.res.oracle b/tests/rte/oracle/finite_float.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..3e0ca8cba95bf4e72e96ea68cadaac3b6d34d378 --- /dev/null +++ b/tests/rte/oracle/finite_float.res.oracle @@ -0,0 +1,19 @@ +[kernel] Parsing tests/rte/finite_float.c (with preprocessing) +[rte] annotating function main +/* Generated by Frama-C */ +#include "errno.h" +#include "math.h" +void main(void) +{ + /*@ assert rte: is_nan_or_infinite: \is_finite(0x1p10000); */ + double d = 0x1p10000; + d = 0.; + /*@ assert rte: is_nan_or_infinite: \is_finite((double)(d / d)); */ + /*@ assert + rte: is_nan_or_infinite: \is_finite((double)((double)(d / d) + d)); + */ + double e = d / d + d; + return; +} + + diff --git a/tests/rte/oracle/float_to_int.res.oracle b/tests/rte/oracle/float_to_int.res.oracle index 641cba1e35551d34d649dae0e1c11791c9a15422..55b6844b5d8bf306411f951878a264b0d59f33ce 100644 --- a/tests/rte/oracle/float_to_int.res.oracle +++ b/tests/rte/oracle/float_to_int.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/float_to_int.c (with preprocessing) tests/rte/float_to_int.c:13:[kernel] warning: Floating-point constant 1.5e255 is not represented exactly. Will use 0x1.99309cc247f15p847. See documentation for option -warn-decimal-float [rte] annotating function main @@ -7,33 +6,24 @@ tests/rte/float_to_int.c:16:[rte] warning: guaranteed RTE: assert float_to_int: /* Generated by Frama-C */ void main(void) { - float f; - int i; - long long l; - unsigned short s; - int ci1; - int ci2; - char ci3; - int ci4; - int ci5; - f = (float)0.; + float f = (float)0.; /*@ assert rte: float_to_int: f < 2147483648; */ /*@ assert rte: float_to_int: -2147483649 < f; */ - i = (int)f; + int i = (int)f; /*@ assert rte: float_to_int: f < 9223372036854775808; */ /*@ assert rte: float_to_int: -9223372036854775809 < f; */ - l = (long long)f; + long long l = (long long)f; /*@ assert rte: float_to_int: f < 65536; */ /*@ assert rte: float_to_int: -1 < f; */ - s = (unsigned short)f; - ci1 = (int)1.5; + unsigned short s = (unsigned short)f; + int ci1 = (int)1.5; /*@ assert rte: float_to_int: 1.5e255 < 2147483648; */ - ci2 = (int)1.5e255; + int ci2 = (int)1.5e255; /*@ assert rte: float_to_int: 258. < 128; */ - ci3 = (char)258.; - ci4 = (int)2147483647.5; + char ci3 = (char)258.; + int ci4 = (int)2147483647.5; /*@ assert rte: float_to_int: -2147483649 < -2147483649.5; */ - ci5 = (int)(- 2147483649.5); + int ci5 = (int)(- 2147483649.5); return; } diff --git a/tests/rte/oracle/fptr_assert.res.oracle b/tests/rte/oracle/fptr_assert.res.oracle index 8c1fabc05bfd39a927fde3d1d64ee878d2d277aa..8d9c3c8e3e64d9e2f12857336fc2a5d1bb0bd558 100644 --- a/tests/rte/oracle/fptr_assert.res.oracle +++ b/tests/rte/oracle/fptr_assert.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/fptr_assert.c (with preprocessing) [rte] annotating function f [rte] annotating function g @@ -30,13 +29,7 @@ int main(int i) int __retres; void (*fp1)(); int (*fp2)(int ); - fptr ma[2]; - { /* sequence */ - ; - ; - } - ma[0] = & f; - ma[1] = & h; + fptr ma[2] = {& f, & h}; fp1 = (void (*)())(& g); fp2 = & f; /*@ assert rte: function_pointer: \valid_function(fp1); */ diff --git a/tests/rte/oracle/malloc.res.oracle b/tests/rte/oracle/malloc.res.oracle index efcaede20de6b57b811d55ae5a72b0e781d5b3f1..f5f243c787421b2b1b7be67d251eae97e46cbc4d 100644 --- a/tests/rte/oracle/malloc.res.oracle +++ b/tests/rte/oracle/malloc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/malloc.c (with preprocessing) [rte] annotating function main tests/rte/malloc.c:13:[kernel] warning: No code nor implicit assigns clause for function my_malloc, generating default assigns from the prototype @@ -13,16 +12,15 @@ char *my_malloc(unsigned int n); int main(void) { int __retres; - char *p; - /*@ requires \true; */ - /*@ allocates p; + /*@ requires \true; + allocates p; behavior pre_my_malloc: ensures p ≡ \null ∨ \fresh{Old, Here}(p,10); assigns p; assigns p \from \nothing; */ - p = my_malloc((unsigned int)10); + char *p = my_malloc((unsigned int)10); if (p) { __retres = 1; goto return_label; diff --git a/tests/rte/oracle/memaccess.res.oracle b/tests/rte/oracle/memaccess.res.oracle index 10171b5de854baa1463354cb9ffb3df3ae8bb7fb..689e5453cf4de8f13066f08795e80f17d95728cd 100644 --- a/tests/rte/oracle/memaccess.res.oracle +++ b/tests/rte/oracle/memaccess.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/memaccess.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ @@ -12,8 +11,8 @@ int main(int x) *p = 3; q = p; /*@ assert rte: mem_access: \valid(q); */ - /*@ assert rte: signed_overflow: *p + 5 ≤ 2147483647; */ /*@ assert rte: mem_access: \valid_read(p); */ + /*@ assert rte: signed_overflow: *p + 5 ≤ 2147483647; */ *q = *p + 5; /*@ assert rte: mem_access: \valid_read(q); */ tab[3] = *q; diff --git a/tests/rte/oracle/minus.0.res.oracle b/tests/rte/oracle/minus.0.res.oracle index c65116b27dbc95a85dde99a09ca1039ee3aa7c95..e2e7d10fb3ade7a8105a0b76e97ab87aeecbf861 100644 --- a/tests/rte/oracle/minus.0.res.oracle +++ b/tests/rte/oracle/minus.0.res.oracle @@ -1,39 +1,35 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/minus.c (with preprocessing) [rte] annotating function main tests/rte/minus.c:11:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; tests/rte/minus.c:18:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483648 ≤ (int)((int)(-2147483647) - 1) - 1; +tests/rte/minus.c:19:[rte] warning: guaranteed RTE: + assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; tests/rte/minus.c:19:[rte] warning: guaranteed RTE: assert signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; -tests/rte/minus.c:19:[rte] warning: guaranteed RTE: - assert signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; /* Generated by Frama-C */ int main(void) { int __retres; - int x; - int y; - int z; - unsigned int ux; - unsigned int uy; - unsigned int uz; - short sz; - x = 0; - y = 0; - z = 0; - ux = (unsigned int)0; - uy = (unsigned int)0; - uz = (unsigned int)0; - sz = (short)0; + int x = 0; + int y = 0; + int z = 0; + unsigned int ux = (unsigned int)0; + unsigned int uy = (unsigned int)0; + unsigned int uz = (unsigned int)0; + short sz = (short)0; /*@ assert rte: signed_overflow: -2147483647 ≤ x; */ z = - x; /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ z = - (-0x7fffffff - 1); /*@ assert rte: signed_downcast: -ux ≤ 2147483647; */ z = (int)(- ux); + /*@ assert + rte: signed_overflow: + (int)((unsigned short)((int)(65535 + 3))) + x ≤ 2147483647; + */ /*@ assert rte: signed_downcast: (int)((unsigned short)((int)(65535 + 3))) + x ≤ 32767; @@ -49,11 +45,11 @@ int main(void) rte: signed_overflow: -2147483648 ≤ (int)((int)(-2147483647) - 1) - 1; */ z = (-2147483647 - 1) - 1; + /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ z = - (-0x7fffffff - 1) - 1; __retres = 0; return __retres; diff --git a/tests/rte/oracle/minus.1.res.oracle b/tests/rte/oracle/minus.1.res.oracle index b096e542c020a400290d476b807b8617f4737f8d..e3e98049c15fd1f877d249d27809601ce2cd2f40 100644 --- a/tests/rte/oracle/minus.1.res.oracle +++ b/tests/rte/oracle/minus.1.res.oracle @@ -1,35 +1,37 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/minus.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ int main(void) { int __retres; - int x; - int y; - int z; - unsigned int ux; - unsigned int uy; - unsigned int uz; - short sz; - x = 0; - y = 0; - z = 0; - ux = (unsigned int)0; - uy = (unsigned int)0; - uz = (unsigned int)0; + int x = 0; + int y = 0; + int z = 0; + unsigned int ux = (unsigned int)0; + unsigned int uy = (unsigned int)0; + unsigned int uz = (unsigned int)0; /*@ assert rte: signed_downcast: 0 ≤ 32767; */ /*@ assert rte: signed_downcast: -32768 ≤ 0; */ - sz = (short)0; + short sz = (short)0; /*@ assert rte: signed_overflow: -2147483647 ≤ x; */ z = - x; - /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ + /*@ assert rte: signed_overflow: -2147483647 ≤ 0x7fffffff; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 1; */ /*@ assert rte: signed_overflow: (int)(-0x7fffffff) - 1 ≤ 2147483647; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ 0x7fffffff; */ + /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ z = - (-0x7fffffff - 1); /*@ assert rte: signed_downcast: -ux ≤ 2147483647; */ z = (int)(- ux); + /*@ assert rte: signed_overflow: -2147483648 ≤ 65535 + 3; */ + /*@ assert rte: signed_overflow: 65535 + 3 ≤ 2147483647; */ + /*@ assert + rte: signed_overflow: + -2147483648 ≤ (int)((unsigned short)((int)(65535 + 3))) + x; + */ + /*@ assert + rte: signed_overflow: + (int)((unsigned short)((int)(65535 + 3))) + x ≤ 2147483647; + */ /*@ assert rte: signed_downcast: (int)((unsigned short)((int)(65535 + 3))) + x ≤ 32767; @@ -38,8 +40,6 @@ int main(void) rte: signed_downcast: -32768 ≤ (int)((unsigned short)((int)(65535 + 3))) + x; */ - /*@ assert rte: signed_overflow: -2147483648 ≤ 65535 + 3; */ - /*@ assert rte: signed_overflow: 65535 + 3 ≤ 2147483647; */ sz = (short)((int)((unsigned short)(65535 + 3)) + x); /*@ assert rte: signed_downcast: @@ -51,16 +51,20 @@ int main(void) (unsigned int)(-2147483648) - (unsigned int)1 ≤ 2147483647; */ z = (int)(-2147483648 - (unsigned int)1); + /*@ assert rte: signed_overflow: -2147483647 ≤ 2147483647; */ + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-2147483647) - 1; */ + /*@ assert rte: signed_overflow: (int)(-2147483647) - 1 ≤ 2147483647; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)((int)(-2147483647) - 1) - 1; */ /*@ assert rte: signed_overflow: (int)((int)(-2147483647) - 1) - 1 ≤ 2147483647; */ - /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-2147483647) - 1; */ - /*@ assert rte: signed_overflow: (int)(-2147483647) - 1 ≤ 2147483647; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ 2147483647; */ z = (-2147483647 - 1) - 1; + /*@ assert rte: signed_overflow: -2147483647 ≤ 0x7fffffff; */ + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 1; */ + /*@ assert rte: signed_overflow: (int)(-0x7fffffff) - 1 ≤ 2147483647; */ + /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-((int)((int)(-0x7fffffff) - 1))) - 1; @@ -69,10 +73,6 @@ int main(void) rte: signed_overflow: (int)(-((int)((int)(-0x7fffffff) - 1))) - 1 ≤ 2147483647; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ (int)(-0x7fffffff) - 1; */ - /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(-0x7fffffff) - 1; */ - /*@ assert rte: signed_overflow: (int)(-0x7fffffff) - 1 ≤ 2147483647; */ - /*@ assert rte: signed_overflow: -2147483647 ≤ 0x7fffffff; */ z = - (-0x7fffffff - 1) - 1; __retres = 0; return __retres; diff --git a/tests/rte/oracle/mul.res.oracle b/tests/rte/oracle/mul.res.oracle index ea9025a1b014bca93baea81a9a4f82df4b668a92..a976986397d18a57565d8a6ceba484abc4aab25e 100644 --- a/tests/rte/oracle/mul.res.oracle +++ b/tests/rte/oracle/mul.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/mul.c (with preprocessing) [rte] annotating function main tests/rte/mul.c:22:[rte] warning: guaranteed RTE: assert signed_overflow: 0xffff * 0xffff ≤ 2147483647; @@ -7,18 +6,12 @@ tests/rte/mul.c:25:[rte] warning: guaranteed RTE: assert signed_overflow: 0xffff int main(void) { int __retres; - int x; - int y; - int z; - unsigned int ux; - unsigned int uy; - unsigned int uz; - x = 0; - y = 0; - z = 0; - ux = (unsigned int)0; - uy = (unsigned int)0; - uz = (unsigned int)0; + int x = 0; + int y = 0; + int z = 0; + unsigned int ux = (unsigned int)0; + unsigned int uy = (unsigned int)0; + unsigned int uz = (unsigned int)0; uz = ux * uy; /*@ assert rte: signed_overflow: -2147483648 ≤ x * y; */ /*@ assert rte: signed_overflow: x * y ≤ 2147483647; */ diff --git a/tests/rte/oracle/noresult.res.oracle b/tests/rte/oracle/noresult.res.oracle index 08bb63dd1461741355ff33058ae0f17d1003c44a..99ad21d35f3c0cd9778e784ab4adc3eb7281cb60 100644 --- a/tests/rte/oracle/noresult.res.oracle +++ b/tests/rte/oracle/noresult.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/noresult.c (with preprocessing) [rte] annotating function job /* Generated by Frama-C */ diff --git a/tests/rte/oracle/postcond.res.oracle b/tests/rte/oracle/postcond.res.oracle index 522fa99ccdf069fa7857c67cbd7be3e92afa72ae..ec9c4cf0422b4fcb1bd95ff13be4f52f176df5b2 100644 --- a/tests/rte/oracle/postcond.res.oracle +++ b/tests/rte/oracle/postcond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/postcond.c (with preprocessing) [rte] annotating function f [rte] annotating function g @@ -55,10 +54,8 @@ void g(int y, int *x) int main(void) { - int a; int c; - int b; - a = 5; + int a = 5; /*@ assigns b, c; behavior pre_f: @@ -74,7 +71,7 @@ int main(void) ensures b > 0; assigns b; */ - b = f(a,& c); + int b = f(a,& c); /*@ behavior pre_g: ensures a ≡ \old(b); assigns a; */ diff --git a/tests/rte/oracle/postcond2.res.oracle b/tests/rte/oracle/postcond2.res.oracle index 32f52dcfa53db0166775607c2d9372f0dc49fb11..f89cee99ea50c0539aff74c25338de906e8ec7dd 100644 --- a/tests/rte/oracle/postcond2.res.oracle +++ b/tests/rte/oracle/postcond2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/postcond2.c (with preprocessing) tests/rte/postcond2.c:7:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [rte] annotating function f @@ -23,15 +22,12 @@ int f(int *tab) int main(void) { - int tab[2]; - int a; int tmp_0; - tab[0] = 3; - tab[1] = 4; + int tab[2] = {3, 4}; /*@ behavior pre_f: requires \valid((int *)tab + 0); assigns a; */ - a = f(tab); + int a = f(tab); /*@ assert rte: signed_overflow: 3 - tab[0] ≤ 2147483647; */ /*@ behavior pre_g: requires \valid(&tab[(int)(3 - tab[0])] + a); diff --git a/tests/rte/oracle/precond.res.oracle b/tests/rte/oracle/precond.res.oracle index 08a39667165416a41f4015754339dbad2bba7307..8e01658fce31ee3bb6891af6f73fe009fac8bd9d 100644 --- a/tests/rte/oracle/precond.res.oracle +++ b/tests/rte/oracle/precond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/precond.c (with preprocessing) tests/rte/precond.c:27:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [rte] annotating function f @@ -32,12 +31,12 @@ int global = 15; int f(int x, int y, float z) { int __retres; - /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(x + y) - (int)z; */ - /*@ assert rte: signed_overflow: (int)(x + y) - (int)z ≤ 2147483647; */ /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ /*@ assert rte: float_to_int: z < 2147483648; */ /*@ assert rte: float_to_int: -2147483649 < z; */ + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)(x + y) - (int)z; */ + /*@ assert rte: signed_overflow: (int)(x + y) - (int)z ≤ 2147483647; */ __retres = (x + y) - (int)z; return __retres; } @@ -137,54 +136,33 @@ cell *tabtop_set(top **tab_top, int i, int v) int main(void) { - int a; - int b; - cell c; cell *pc; top T; top tabT[2]; - top *ptabT[3]; top **pptop; - other ot; void *V; - int k; - int l; - int z; - int y; int w; - int tab[4]; int *r; int **rr; - a = 2; - b = 3; - c.val = 20; - c.next = (struct cell *)0; - { /* sequence */ - ; - ; - ; - } - ptabT[0] = & T; - ptabT[1] = & T; - ptabT[2] = & T; - ot.c = c; - k = 1; - l = 1; + int a = 2; + int b = 3; + cell c = {.val = 20, .next = (struct cell *)0}; + top *ptabT[3] = {& T, & T, & T}; + other ot = {.c = c}; + int k = 1; + int l = 1; /*@ behavior pre_f: requires 2 > 0; requires (int)(2 + 3) ≢ 0; */ - z = f(2,3,(float)1.0); + int z = f(2,3,(float)1.0); /*@ assert rte: signed_overflow: -2147483648 ≤ b - a; */ /*@ assert rte: signed_overflow: b - a ≤ 2147483647; */ /*@ behavior pre_f_2: requires (int)(b - a) > 0; requires (int)((int)(b - a) + a) ≢ 0; */ - y = f(b - a,a,(float)2.0); - tab[0] = 1; - tab[1] = 2; - tab[2] = 3; - tab[3] = 4; + int y = f(b - a,a,(float)2.0); + int tab[4] = {1, 2, 3, 4}; /*@ assert rte: signed_overflow: -2147483648 ≤ a + b; */ /*@ assert rte: signed_overflow: a + b ≤ 2147483647; */ /*@ behavior pre_f_3: diff --git a/tests/rte/oracle/precond2.res.oracle b/tests/rte/oracle/precond2.res.oracle index b61f7fd9382bf6280c80ff419d90a05b07ea4fac..fe6990d2adec4845b4284d7e3467fba4efb44131 100644 --- a/tests/rte/oracle/precond2.res.oracle +++ b/tests/rte/oracle/precond2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/precond2.c (with preprocessing) /* Generated by Frama-C */ int global = 15; @@ -20,16 +19,12 @@ int g(int a, int b) int main(void) { - int a; - int b; int tmp_0; int tmp; - a = 2; - b = 3; - { /* sequence */ - tmp = g(a,b); - ; - } + int a = 2; + int b = 3; + tmp = g(a,b); + ; tmp_0 = f(b - a,tmp,(float)1.0); return tmp_0; } @@ -37,8 +32,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = true precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = false precond_status = false [kernel] kf = g rte_gen_status = false precond_status = false [kernel] kf = main rte_gen_status = false precond_status = false @@ -66,16 +59,12 @@ int g(int a, int b) int main(void) { - int a; - int b; int tmp_0; int tmp; - a = 2; - b = 3; - { /* sequence */ - tmp = g(a,b); - ; - } + int a = 2; + int b = 3; + tmp = g(a,b); + ; /*@ behavior pre_f: requires (int)(b - a) > 0; requires (int)((int)(b - a) + tmp) ≢ 0; @@ -87,8 +76,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = true precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = false precond_status = true [kernel] kf = g rte_gen_status = false precond_status = true [kernel] kf = main rte_gen_status = false precond_status = true @@ -117,16 +104,12 @@ int g(int a, int b) int main(void) { - int a; - int b; int tmp_0; int tmp; - a = 2; - b = 3; - { /* sequence */ - tmp = g(a,b); - ; - } + int a = 2; + int b = 3; + tmp = g(a,b); + ; /*@ behavior pre_f: requires (int)(b - a) > 0; requires (int)((int)(b - a) + tmp) ≢ 0; @@ -138,8 +121,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = true precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = false precond_status = true [kernel] kf = g rte_gen_status = false precond_status = true [kernel] kf = main rte_gen_status = false precond_status = true @@ -164,16 +145,12 @@ int g(int a, int b) int main(void) { - int a; - int b; int tmp_0; int tmp; - a = 2; - b = 3; - { /* sequence */ - tmp = g(a,b); - ; - } + int a = 2; + int b = 3; + tmp = g(a,b); + ; /*@ behavior pre_f: requires (int)(b - a) > 0; requires (int)((int)(b - a) + tmp) ≢ 0; @@ -185,8 +162,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = true precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = false precond_status = true [kernel] kf = g rte_gen_status = false precond_status = true [kernel] kf = main rte_gen_status = false precond_status = true diff --git a/tests/rte/oracle/reqlabl.res.oracle b/tests/rte/oracle/reqlabl.res.oracle index c13c7cac16a3825a49c17cde79e5a575050f1307..0777615ac077a8be66cfef05a7f66ce1723ffe08 100644 --- a/tests/rte/oracle/reqlabl.res.oracle +++ b/tests/rte/oracle/reqlabl.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/reqlabl.c (with preprocessing) [rte] annotating function g tests/rte/reqlabl.c:11:[kernel] warning: No code nor implicit assigns clause for function f, generating default assigns from the prototype diff --git a/tests/rte/oracle/reqlabl2.res.oracle b/tests/rte/oracle/reqlabl2.res.oracle index eeddbbf855e000b24b15972177b00ef939f5438a..a3110211479d1500676e8ecfbbdd3e90befb521c 100644 --- a/tests/rte/oracle/reqlabl2.res.oracle +++ b/tests/rte/oracle/reqlabl2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/reqlabl2.c (with preprocessing) [rte] annotating function g tests/rte/reqlabl2.c:16:[kernel] warning: No code nor implicit assigns clause for function f, generating default assigns from the prototype diff --git a/tests/rte/oracle/s64.res.oracle b/tests/rte/oracle/s64.res.oracle index 818109b557c2a65ddbd4847031b41ed5f4c2b3e3..c76519d001e03bd70cf36a0f63ecf9f32bd3d670 100644 --- a/tests/rte/oracle/s64.res.oracle +++ b/tests/rte/oracle/s64.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/s64.c (with preprocessing) [rte] annotating function main tests/rte/s64.c:9:[rte] warning: guaranteed RTE: assert signed_overflow: 5LL << 63 ≤ 9223372036854775807; diff --git a/tests/rte/oracle/shift.res.oracle b/tests/rte/oracle/shift.res.oracle index 802bd03d67ef8f73ac99f2f723f1dcaf0a8b5b5f..aacbf74a72c48fca7902e5c81df1288f88468726 100644 --- a/tests/rte/oracle/shift.res.oracle +++ b/tests/rte/oracle/shift.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/shift.c (with preprocessing) [rte] annotating function main tests/rte/shift.c:13:[rte] warning: guaranteed RTE: assert signed_overflow: 5 << 30 ≤ 2147483647; @@ -17,26 +16,16 @@ tests/rte/shift.c:46:[rte] warning: guaranteed RTE: assert shift: 0 ≤ (int)(-2 int main(void) { int __retres; - int i; - int x; - int y; - int z; - unsigned int ux; - unsigned int uy; - unsigned int uz; - long lx; - long ly; - long lz; - i = 0; - x = 0; - y = 0; - z = 0; - ux = (unsigned int)0; - uy = (unsigned int)0; - uz = (unsigned int)0; - lx = (long)0; - ly = (long)0; - lz = (long)0; + int i = 0; + int x = 0; + int y = 0; + int z = 0; + unsigned int ux = (unsigned int)0; + unsigned int uy = (unsigned int)0; + unsigned int uz = (unsigned int)0; + long lx = (long)0; + long ly = (long)0; + long lz = (long)0; z = (int)(5u << 30); /*@ assert rte: signed_overflow: 5 << 30 ≤ 2147483647; */ uz = (unsigned int)(5 << 30); diff --git a/tests/rte/oracle/shift_machdep.0.res.oracle b/tests/rte/oracle/shift_machdep.0.res.oracle index 3ef4e04a1c88fec2c988017598c2d243fab086cd..c9c7f32cefee1f041fb03d22ae93139cbf56ca44 100644 --- a/tests/rte/oracle/shift_machdep.0.res.oracle +++ b/tests/rte/oracle/shift_machdep.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/shift_machdep.c (with preprocessing) [rte] annotating function main tests/rte/shift_machdep.c:9:[rte] warning: guaranteed RTE: assert signed_overflow: 5 << 30 ≤ 2147483647; diff --git a/tests/rte/oracle/shift_machdep.1.res.oracle b/tests/rte/oracle/shift_machdep.1.res.oracle index 90266d2de9e67c8d9d7566f286dc2fdb51280ecc..3b7fe594720ea52fbb3cd09afec5aa7e5c678219 100644 --- a/tests/rte/oracle/shift_machdep.1.res.oracle +++ b/tests/rte/oracle/shift_machdep.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/shift_machdep.c (with preprocessing) [rte] annotating function main tests/rte/shift_machdep.c:9:[rte] warning: guaranteed RTE: assert signed_overflow: 5 << 30 ≤ 2147483647; diff --git a/tests/rte/oracle/shift_unsigned.0.res.oracle b/tests/rte/oracle/shift_unsigned.0.res.oracle index 81dbd9358c13448c478f98048ec6e1d78b345e5f..b1868cba3e3efae7e96acc8b1523c2e178f5e8c0 100644 --- a/tests/rte/oracle/shift_unsigned.0.res.oracle +++ b/tests/rte/oracle/shift_unsigned.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/shift_unsigned.c (with preprocessing) [rte] annotating function main tests/rte/shift_unsigned.c:11:[rte] warning: guaranteed RTE: assert shift: 0 ≤ (int)(-3) < 32; diff --git a/tests/rte/oracle/shift_unsigned.1.res.oracle b/tests/rte/oracle/shift_unsigned.1.res.oracle index 81dbd9358c13448c478f98048ec6e1d78b345e5f..86a7448d992181f5c221e26dfb9931a11366caf0 100644 --- a/tests/rte/oracle/shift_unsigned.1.res.oracle +++ b/tests/rte/oracle/shift_unsigned.1.res.oracle @@ -1,6 +1,6 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/shift_unsigned.c (with preprocessing) [rte] annotating function main +tests/rte/shift_unsigned.c:10:[rte] warning: guaranteed RTE: assert unsigned_overflow: 0x10000000U << 4 ≤ 4294967295; tests/rte/shift_unsigned.c:11:[rte] warning: guaranteed RTE: assert shift: 0 ≤ (int)(-3) < 32; tests/rte/shift_unsigned.c:12:[rte] warning: guaranteed RTE: assert shift: 0 ≤ (int)(-4); /* Generated by Frama-C */ @@ -10,7 +10,9 @@ int main(void) unsigned int x; unsigned int y; x = 0x10000000U; + /*@ assert rte: unsigned_overflow: x << 4 ≤ 4294967295; */ y = x << 4; + /*@ assert rte: unsigned_overflow: 0x10000000U << 4 ≤ 4294967295; */ y = 0x10000000U << 4; /*@ assert rte: shift: 0 ≤ (int)(-3) < 32; */ y = 1U << -3; diff --git a/tests/rte/oracle/sizeof.res.oracle b/tests/rte/oracle/sizeof.res.oracle index 5645d5bb80559a60b69731bda5973f8048c17501..b039c5780b83a45a59bb0a6cdf7820eab0e2584a 100644 --- a/tests/rte/oracle/sizeof.res.oracle +++ b/tests/rte/oracle/sizeof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/sizeof.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte/oracle/tab.res.oracle b/tests/rte/oracle/tab.res.oracle index 2e7a8d3d6be16f7dd1bb6b5683d33d56d9dd165b..8e702b9380666db861ecbfbff70c2452e01a9362 100644 --- a/tests/rte/oracle/tab.res.oracle +++ b/tests/rte/oracle/tab.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/tab.c (with preprocessing) [rte] annotating function f4 [rte] annotating function g4 @@ -43,10 +42,8 @@ double f4(void) tab[0] = 1.0; tab[1] = 2.0; r = g4(& tab); - { /* sequence */ - tmp = h4(tab); - ; - } + tmp = h4(tab); + ; __retres = r + tmp; return __retres; } diff --git a/tests/rte/oracle/threefunc.res.oracle b/tests/rte/oracle/threefunc.res.oracle index 3dbfd3b5ea6bee0b3f3276c28f60085683ad3dd8..6cdc198c745937c5a33ab06544bdcd8206eb2c22 100644 --- a/tests/rte/oracle/threefunc.res.oracle +++ b/tests/rte/oracle/threefunc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/threefunc.c (with preprocessing) /* Generated by Frama-C */ int g(int x, int y) @@ -35,16 +34,13 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; - tmp = x + y; + int tmp = x + y; y = x - y; x = tmp; } @@ -54,10 +50,8 @@ int main(void) if (y > 0) { int tmp_0; int tmp_1; - { /* sequence */ - tmp_0 = f(x,y); - tmp_1 = g(x,y); - } + tmp_0 = f(x,y); + tmp_1 = g(x,y); __retres = tmp_0 + tmp_1; goto return_label; } @@ -116,18 +110,15 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ - tmp = x + y; + int tmp = x + y; /*@ assert rte: signed_overflow: -2147483648 ≤ x - y; */ /*@ assert rte: signed_overflow: x - y ≤ 2147483647; */ y = x - y; @@ -140,10 +131,8 @@ int main(void) if (y > 0) { int tmp_0; int tmp_1; - { /* sequence */ - tmp_0 = f(x,y); - tmp_1 = g(x,y); - } + tmp_0 = f(x,y); + tmp_1 = g(x,y); /*@ assert rte: signed_overflow: -2147483648 ≤ tmp_0 + tmp_1; */ /*@ assert rte: signed_overflow: tmp_0 + tmp_1 ≤ 2147483647; */ __retres = tmp_0 + tmp_1; @@ -163,8 +152,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = true precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = true precond_status = true [kernel] kf = g rte_gen_status = true precond_status = true [kernel] kf = main rte_gen_status = true precond_status = true @@ -205,16 +192,13 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; - tmp = x + y; + int tmp = x + y; y = x - y; x = tmp; } @@ -224,10 +208,8 @@ int main(void) if (y > 0) { int tmp_0; int tmp_1; - { /* sequence */ - tmp_0 = f(x,y); - tmp_1 = g(x,y); - } + tmp_0 = f(x,y); + tmp_1 = g(x,y); __retres = tmp_0 + tmp_1; goto return_label; } @@ -245,8 +227,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = true precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = true precond_status = true [kernel] kf = g rte_gen_status = true precond_status = true [kernel] kf = main rte_gen_status = true precond_status = true @@ -290,18 +270,15 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ - tmp = x + y; + int tmp = x + y; /*@ assert rte: signed_overflow: -2147483648 ≤ x - y; */ /*@ assert rte: signed_overflow: x - y ≤ 2147483647; */ y = x - y; @@ -314,10 +291,8 @@ int main(void) if (y > 0) { int tmp_0; int tmp_1; - { /* sequence */ - tmp_0 = f(x,y); - tmp_1 = g(x,y); - } + tmp_0 = f(x,y); + tmp_1 = g(x,y); /*@ assert rte: signed_overflow: -2147483648 ≤ tmp_0 + tmp_1; */ /*@ assert rte: signed_overflow: tmp_0 + tmp_1 ≤ 2147483647; */ __retres = tmp_0 + tmp_1; @@ -337,8 +312,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero rte_gen_status = false precond_status = true -[kernel] kf = Frama_C_copy_block rte_gen_status = true precond_status = true [kernel] kf = f rte_gen_status = true precond_status = true [kernel] kf = g rte_gen_status = true precond_status = true [kernel] kf = main rte_gen_status = true precond_status = true diff --git a/tests/rte/oracle/twofunc.res.oracle b/tests/rte/oracle/twofunc.res.oracle index 2404c1676599a9154384eb589f6a2fe2b932b574..327a7d03d9e269a464365ccccd00ab0e72cdc930 100644 --- a/tests/rte/oracle/twofunc.res.oracle +++ b/tests/rte/oracle/twofunc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/twofunc.c (with preprocessing) /* Generated by Frama-C */ int f(int x, int y) @@ -28,16 +27,13 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; - tmp = x + y; + int tmp = x + y; y = x - y; x = tmp; } @@ -95,18 +91,15 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ - tmp = x + y; + int tmp = x + y; /*@ assert rte: signed_overflow: -2147483648 ≤ x - y; */ /*@ assert rte: signed_overflow: x - y ≤ 2147483647; */ y = x - y; @@ -136,28 +129,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero -[kernel] - precondition = true -[kernel] - mem_access = true -[kernel] - pointer_call = true -[kernel] - division_by_zero = true -[kernel] - shift_value_out_of_bounds = true -[kernel] - signed_overflow = true -[kernel] - downcast = true -[kernel] - unsigned_overflow = true -[kernel] - unsigned_downcast = true -[kernel] - float_to_int = true -[kernel] kf = Frama_C_copy_block -[kernel] - precondition = true -[kernel] - mem_access = true -[kernel] - pointer_call = true -[kernel] - division_by_zero = true -[kernel] - shift_value_out_of_bounds = true -[kernel] - signed_overflow = true -[kernel] - downcast = true -[kernel] - unsigned_overflow = true -[kernel] - unsigned_downcast = true -[kernel] - float_to_int = true [kernel] kf = f [kernel] - precondition = true [kernel] - mem_access = true @@ -209,16 +180,13 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; i = 0; while (i < 20) { { - int tmp; - tmp = x + y; + int tmp = x + y; y = x - y; x = tmp; } @@ -245,28 +213,6 @@ int main(void) [kernel] ================================ [kernel] printing status -[kernel] kf = Frama_C_bzero -[kernel] - precondition = true -[kernel] - mem_access = true -[kernel] - pointer_call = true -[kernel] - division_by_zero = true -[kernel] - shift_value_out_of_bounds = true -[kernel] - signed_overflow = true -[kernel] - downcast = true -[kernel] - unsigned_overflow = true -[kernel] - unsigned_downcast = true -[kernel] - float_to_int = true -[kernel] kf = Frama_C_copy_block -[kernel] - precondition = true -[kernel] - mem_access = true -[kernel] - pointer_call = true -[kernel] - division_by_zero = true -[kernel] - shift_value_out_of_bounds = true -[kernel] - signed_overflow = true -[kernel] - downcast = true -[kernel] - unsigned_overflow = true -[kernel] - unsigned_downcast = true -[kernel] - float_to_int = true [kernel] kf = f [kernel] - precondition = true [kernel] - mem_access = true diff --git a/tests/rte/oracle/twofunc3.res.oracle b/tests/rte/oracle/twofunc3.res.oracle index 33436ec3c467e015098693942ca6748e15295048..9bf30e0cefbca45820cdaba50c95b36fe1168949 100644 --- a/tests/rte/oracle/twofunc3.res.oracle +++ b/tests/rte/oracle/twofunc3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/twofunc3.c (with preprocessing) [rte] annotating function f [rte] annotating function main @@ -24,19 +23,16 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; int i; - x = 1; - y = 2; + int x = 1; + int y = 2; /*@ assert y > x; */ ; i = 0; while (i < 20) { { - int tmp; /*@ assert rte: signed_overflow: -2147483648 ≤ x + y; */ /*@ assert rte: signed_overflow: x + y ≤ 2147483647; */ - tmp = x + y; + int tmp = x + y; /*@ assert rte: signed_overflow: -2147483648 ≤ x - y; */ /*@ assert rte: signed_overflow: x - y ≤ 2147483647; */ y = x - y; @@ -59,10 +55,6 @@ int main(void) [kernel] ================================ -[kernel] Rte-generated annotations for function Frama_C_bzero -[kernel] None -[kernel] Rte-generated annotations for function Frama_C_copy_block -[kernel] None [kernel] Rte-generated annotations for function f [kernel] For Statement if (x + y != 0) { if (x == 2147483647) @@ -76,7 +68,7 @@ int main(void) [kernel] assert rte: signed_overflow: -2147483648 ≤ x + y; [kernel] assert rte: signed_overflow: x + y ≤ 2147483647; [kernel] Rte-generated annotations for function main -[kernel] For Statement tmp = x + y; +[kernel] For Statement int tmp = x + y; [kernel] assert rte: signed_overflow: -2147483648 ≤ x + y; [kernel] assert rte: signed_overflow: x + y ≤ 2147483647; [kernel] For Statement y = x - y; diff --git a/tests/rte/oracle/u64.0.res.oracle b/tests/rte/oracle/u64.0.res.oracle index f6746f4841e3b163b0b19de06147908ec4fa151f..54fc3683dc6cc7bb2cc894ff13434413121b18c0 100644 --- a/tests/rte/oracle/u64.0.res.oracle +++ b/tests/rte/oracle/u64.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/u64.i (no preprocessing) [rte] annotating function f /* Generated by Frama-C */ diff --git a/tests/rte/oracle/u64.1.res.oracle b/tests/rte/oracle/u64.1.res.oracle index 621b71d63878586f2e0dc4e2bc94f7cc36074a4b..8d3d11eda576b9dd9e2900b672527387d49ba972 100644 --- a/tests/rte/oracle/u64.1.res.oracle +++ b/tests/rte/oracle/u64.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/u64.i (no preprocessing) [rte] annotating function f /* Generated by Frama-C */ diff --git a/tests/rte/oracle/unspecified_sequence.res.oracle b/tests/rte/oracle/unspecified_sequence.res.oracle index 36df2eb274d187da19cf230d0cb28da1c49b2b7d..18b333c333892781c1e6713f63299187e2050bb8 100644 --- a/tests/rte/oracle/unspecified_sequence.res.oracle +++ b/tests/rte/oracle/unspecified_sequence.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/unspecified_sequence.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/rte/oracle/valid.res.oracle b/tests/rte/oracle/valid.res.oracle index 7511477fea9000d29c2f47d750709668d21c977f..c7afeb7f33da388bc5b4ea7aad6e95ce0caafab1 100644 --- a/tests/rte/oracle/valid.res.oracle +++ b/tests/rte/oracle/valid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/valid.c (with preprocessing) [rte] annotating function main /* Generated by Frama-C */ @@ -32,20 +31,12 @@ int main(void) struct Q q; int *i; int j; - int i0; - int i1; - int i2; - int i3; - int i4; struct P *tmp; - struct P np; - struct P *npp; - struct P *z; - i0 = 0; - i1 = 1; - i2 = 2; - i3 = 3; - i4 = 4; + int i0 = 0; + int i1 = 1; + int i2 = 2; + int i3 = 3; + int i4 = 4; j = 0; i = & j; pp = & p; @@ -53,19 +44,17 @@ int main(void) pppp = & ppp; p.next = pp; p.znexts = pppp; - { /* sequence */ - tmp = pp; - /*@ assert rte: index_bound: 0 ≤ i2; */ - /*@ assert rte: index_bound: i2 < 8; */ - /*@ assert rte: index_bound: 0 ≤ i3; */ - /*@ assert rte: index_bound: i3 < 9; */ - p.nexts[i2][i3] = tmp; - /*@ assert rte: index_bound: 0 ≤ i0; */ - /*@ assert rte: index_bound: i0 < 8; */ - /*@ assert rte: index_bound: 0 ≤ i1; */ - /*@ assert rte: index_bound: i1 < 9; */ - p.nexts[i0][i1] = tmp; - } + tmp = pp; + /*@ assert rte: index_bound: 0 ≤ i2; */ + /*@ assert rte: index_bound: i2 < 8; */ + /*@ assert rte: index_bound: 0 ≤ i3; */ + /*@ assert rte: index_bound: i3 < 9; */ + p.nexts[i2][i3] = tmp; + /*@ assert rte: index_bound: 0 ≤ i0; */ + /*@ assert rte: index_bound: i0 < 8; */ + /*@ assert rte: index_bound: 0 ≤ i1; */ + /*@ assert rte: index_bound: i1 < 9; */ + p.nexts[i0][i1] = tmp; q.next = pp; /*@ assert rte: index_bound: 0 ≤ i0; */ /*@ assert rte: index_bound: i0 < 12; */ @@ -87,8 +76,8 @@ int main(void) /*@ assert rte: index_bound: i3 < 5; */ p.id[i1] = p.id[i3]; /*@ assert rte: mem_access: \valid_read(p.next); */ - np = *(p.next); - npp = p.next; + struct P np = *(p.next); + struct P *npp = p.next; v = p.id[3]; /*@ assert rte: mem_access: \valid_read(&pp->id[3]); */ v = pp->id[3]; @@ -103,7 +92,7 @@ int main(void) /*@ assert rte: index_bound: 0 ≤ i1; */ /*@ assert rte: index_bound: i1 < 9; */ /*@ assert rte: mem_access: \valid_read(&pp->nexts[i0][i1]); */ - z = pp->nexts[i0][i1]; + struct P *z = pp->nexts[i0][i1]; /*@ assert rte: index_bound: 0 ≤ i0; */ /*@ assert rte: index_bound: i0 < 8; */ /*@ assert rte: index_bound: 0 ≤ i1; */ @@ -241,20 +230,12 @@ int main(void) struct Q q; int *i; int j; - int i0; - int i1; - int i2; - int i3; - int i4; struct P *tmp; - struct P np; - struct P *npp; - struct P *z; - i0 = 0; - i1 = 1; - i2 = 2; - i3 = 3; - i4 = 4; + int i0 = 0; + int i1 = 1; + int i2 = 2; + int i3 = 3; + int i4 = 4; j = 0; i = & j; pp = & p; @@ -262,13 +243,11 @@ int main(void) pppp = & ppp; p.next = pp; p.znexts = pppp; - { /* sequence */ - tmp = pp; - /*@ assert rte: mem_access: \valid(&p.nexts[i2][i3]); */ - p.nexts[i2][i3] = tmp; - /*@ assert rte: mem_access: \valid(&p.nexts[i0][i1]); */ - p.nexts[i0][i1] = tmp; - } + tmp = pp; + /*@ assert rte: mem_access: \valid(&p.nexts[i2][i3]); */ + p.nexts[i2][i3] = tmp; + /*@ assert rte: mem_access: \valid(&p.nexts[i0][i1]); */ + p.nexts[i0][i1] = tmp; q.next = pp; /*@ assert rte: mem_access: \valid(&q.id[i0]); */ q.id[i0] = 0; @@ -282,8 +261,8 @@ int main(void) /*@ assert rte: mem_access: \valid_read(&p.id[i3]); */ p.id[i1] = p.id[i3]; /*@ assert rte: mem_access: \valid_read(p.next); */ - np = *(p.next); - npp = p.next; + struct P np = *(p.next); + struct P *npp = p.next; /*@ assert rte: mem_access: \valid_read(&p.id[3]); */ v = p.id[3]; /*@ assert rte: mem_access: \valid_read(&pp->id[3]); */ @@ -295,7 +274,7 @@ int main(void) /*@ assert rte: mem_access: \valid_read(&pp->id[3]); */ v = pp->id[3]; /*@ assert rte: mem_access: \valid_read(&pp->nexts[i0][i1]); */ - z = pp->nexts[i0][i1]; + struct P *z = pp->nexts[i0][i1]; /*@ assert rte: mem_access: \valid_read(&pp->nexts[i0][i1]); */ /*@ assert rte: mem_access: \valid_read(&(pp->nexts[i0][i1])->val); */ v = (pp->nexts[i0][i1])->val; diff --git a/tests/rte/oracle/value_rte.res.oracle b/tests/rte/oracle/value_rte.res.oracle index a063991b845e752b9521ed88451337546836e2da..aa556459ca847075ba2d336382a9f3a89e6479fd 100644 --- a/tests/rte/oracle/value_rte.res.oracle +++ b/tests/rte/oracle/value_rte.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte/value_rte.c (with preprocessing) [rte] annotating function main [value] Analyzing a complete application starting at main @@ -135,6 +134,8 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu by Frama-C kernel. [ Valid ] Axiomatic 'WcsNCmp' by Frama-C kernel. +[ Valid ] Axiomatic 'format_length' + by Frama-C kernel. -------------------------------------------------------------------------------- --- Properties of Function 'remove' @@ -267,9 +268,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'vfprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 150) +[ Extern ] Assigns (file share/libc/stdio.h, line 159) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 150) +[ Extern ] Froms (file share/libc/stdio.h, line 159) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -278,9 +279,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'vfscanf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 155) +[ Extern ] Assigns (file share/libc/stdio.h, line 164) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 155) +[ Extern ] Froms (file share/libc/stdio.h, line 164) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -289,9 +290,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'vprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 161) +[ Extern ] Assigns (file share/libc/stdio.h, line 170) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 161) +[ Extern ] Froms (file share/libc/stdio.h, line 170) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -300,9 +301,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'vscanf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 165) +[ Extern ] Assigns (file share/libc/stdio.h, line 174) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 165) +[ Extern ] Froms (file share/libc/stdio.h, line 174) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -311,9 +312,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'vsnprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 170) +[ Extern ] Assigns (file share/libc/stdio.h, line 179) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 170) +[ Extern ] Froms (file share/libc/stdio.h, line 179) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -322,9 +323,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'vsprintf' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 176) +[ Extern ] Assigns (file share/libc/stdio.h, line 185) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 176) +[ Extern ] Froms (file share/libc/stdio.h, line 185) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -333,7 +334,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fgetc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 187) +[ Extern ] Assigns (file share/libc/stdio.h, line 196) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -342,15 +343,15 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fgets' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 193) +[ Extern ] Post-condition (file share/libc/stdio.h, line 202) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 191) +[ Extern ] Assigns (file share/libc/stdio.h, line 200) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 191) +[ Extern ] Froms (file share/libc/stdio.h, line 200) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 191) +[ Extern ] Froms (file share/libc/stdio.h, line 200) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 192) +[ Extern ] Froms (file share/libc/stdio.h, line 201) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -359,7 +360,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fputc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 198) +[ Extern ] Assigns (file share/libc/stdio.h, line 207) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -368,9 +369,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fputs' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 201) +[ Extern ] Assigns (file share/libc/stdio.h, line 210) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 201) +[ Extern ] Froms (file share/libc/stdio.h, line 210) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -379,11 +380,11 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'getc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 205) +[ Extern ] Assigns (file share/libc/stdio.h, line 214) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 205) +[ Extern ] Froms (file share/libc/stdio.h, line 214) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 205) +[ Extern ] Froms (file share/libc/stdio.h, line 214) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -394,7 +395,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 208) +[ Extern ] Froms (file share/libc/stdio.h, line 217) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -403,13 +404,13 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'gets' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 213) +[ Extern ] Post-condition (file share/libc/stdio.h, line 222) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 211) +[ Extern ] Assigns (file share/libc/stdio.h, line 220) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 211) +[ Extern ] Froms (file share/libc/stdio.h, line 220) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 212) +[ Extern ] Froms (file share/libc/stdio.h, line 221) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -418,9 +419,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'putc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 217) +[ Extern ] Assigns (file share/libc/stdio.h, line 226) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 217) +[ Extern ] Froms (file share/libc/stdio.h, line 226) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -429,9 +430,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'putchar' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 220) +[ Extern ] Assigns (file share/libc/stdio.h, line 229) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 220) +[ Extern ] Froms (file share/libc/stdio.h, line 229) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -440,9 +441,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'puts' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 223) +[ Extern ] Assigns (file share/libc/stdio.h, line 232) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 223) +[ Extern ] Froms (file share/libc/stdio.h, line 232) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -451,9 +452,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'ungetc' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 226) +[ Extern ] Assigns (file share/libc/stdio.h, line 235) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 226) +[ Extern ] Froms (file share/libc/stdio.h, line 235) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -462,15 +463,15 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fread' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 234) +[ Extern ] Post-condition (file share/libc/stdio.h, line 243) Unverifiable but considered Valid. -[ Extern ] Post-condition (file share/libc/stdio.h, line 235) +[ Extern ] Post-condition (file share/libc/stdio.h, line 244) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 232) +[ Extern ] Assigns (file share/libc/stdio.h, line 241) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 232) +[ Extern ] Froms (file share/libc/stdio.h, line 241) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 233) +[ Extern ] Froms (file share/libc/stdio.h, line 242) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -479,13 +480,13 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fwrite' -------------------------------------------------------------------------------- -[ Extern ] Post-condition (file share/libc/stdio.h, line 246) +[ Extern ] Post-condition (file share/libc/stdio.h, line 255) Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/stdio.h, line 245) +[ Extern ] Assigns (file share/libc/stdio.h, line 254) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 245) +[ Extern ] Froms (file share/libc/stdio.h, line 254) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 245) +[ Extern ] Froms (file share/libc/stdio.h, line 254) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -494,9 +495,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fgetpos' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 253) +[ Extern ] Assigns (file share/libc/stdio.h, line 262) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 253) +[ Extern ] Froms (file share/libc/stdio.h, line 262) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -505,9 +506,13 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fseek' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 257) +[ Extern ] Assigns (file share/libc/stdio.h, line 269) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 257) +[ Extern ] Froms (file share/libc/stdio.h, line 269) + Unverifiable but considered Valid. +[ Extern ] Froms (file share/libc/stdio.h, line 270) + Unverifiable but considered Valid. +[ Extern ] Froms (file share/libc/stdio.h, line 270) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -516,9 +521,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'fsetpos' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 261) +[ Extern ] Assigns (file share/libc/stdio.h, line 274) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 261) +[ Extern ] Froms (file share/libc/stdio.h, line 274) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -527,11 +532,11 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'ftell' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 264) +[ Extern ] Assigns (file share/libc/stdio.h, line 277) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 264) +[ Extern ] Froms (file share/libc/stdio.h, line 277) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 264) +[ Extern ] Froms (file share/libc/stdio.h, line 277) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -540,9 +545,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'rewind' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 267) +[ Extern ] Assigns (file share/libc/stdio.h, line 280) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 267) +[ Extern ] Froms (file share/libc/stdio.h, line 280) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -551,9 +556,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'clearerr' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 270) +[ Extern ] Assigns (file share/libc/stdio.h, line 283) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 270) +[ Extern ] Froms (file share/libc/stdio.h, line 283) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -564,7 +569,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 273) +[ Extern ] Froms (file share/libc/stdio.h, line 286) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -575,7 +580,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 276) +[ Extern ] Froms (file share/libc/stdio.h, line 289) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -584,9 +589,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'flockfile' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 279) +[ Extern ] Assigns (file share/libc/stdio.h, line 292) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 279) +[ Extern ] Froms (file share/libc/stdio.h, line 292) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -595,9 +600,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'funlockfile' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 282) +[ Extern ] Assigns (file share/libc/stdio.h, line 295) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 282) +[ Extern ] Froms (file share/libc/stdio.h, line 295) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -606,11 +611,11 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'ftrylockfile' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 285) +[ Extern ] Assigns (file share/libc/stdio.h, line 298) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 285) +[ Extern ] Froms (file share/libc/stdio.h, line 298) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 285) +[ Extern ] Froms (file share/libc/stdio.h, line 298) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -621,7 +626,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 288) +[ Extern ] Froms (file share/libc/stdio.h, line 301) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -630,9 +635,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'perror' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 291) +[ Extern ] Assigns (file share/libc/stdio.h, line 304) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 291) +[ Extern ] Froms (file share/libc/stdio.h, line 304) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -641,11 +646,11 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'getc_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 294) +[ Extern ] Assigns (file share/libc/stdio.h, line 307) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 294) +[ Extern ] Froms (file share/libc/stdio.h, line 307) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 294) +[ Extern ] Froms (file share/libc/stdio.h, line 307) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -656,7 +661,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 296) +[ Extern ] Froms (file share/libc/stdio.h, line 309) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -665,9 +670,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'putc_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 298) +[ Extern ] Assigns (file share/libc/stdio.h, line 311) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 298) +[ Extern ] Froms (file share/libc/stdio.h, line 311) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -676,9 +681,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'putchar_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 300) +[ Extern ] Assigns (file share/libc/stdio.h, line 313) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 300) +[ Extern ] Froms (file share/libc/stdio.h, line 313) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -687,9 +692,9 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu --- Properties of Function 'clearerr_unlocked' -------------------------------------------------------------------------------- -[ Extern ] Assigns (file share/libc/stdio.h, line 303) +[ Extern ] Assigns (file share/libc/stdio.h, line 316) Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 303) +[ Extern ] Froms (file share/libc/stdio.h, line 316) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -700,7 +705,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 305) +[ Extern ] Froms (file share/libc/stdio.h, line 318) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -711,7 +716,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 307) +[ Extern ] Froms (file share/libc/stdio.h, line 320) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -722,7 +727,7 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu [ Extern ] Assigns nothing Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/stdio.h, line 309) +[ Extern ] Froms (file share/libc/stdio.h, line 322) Unverifiable but considered Valid. [ Valid ] Default behavior by Frama-C kernel. @@ -741,8 +746,8 @@ tests/rte/value_rte.c:15:[value] assertion 'rte,signed_overflow' got final statu -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- - 63 Completely validated - 149 Considered valid + 64 Completely validated + 151 Considered valid 1 To be validated - 213 Total + 216 Total -------------------------------------------------------------------------------- diff --git a/tests/rte/value_rte.c b/tests/rte/value_rte.c index bc5b5daec9f04ad1e1ea768d0ef66dc729d1432e..003581e4bb36832f65671b69754832eed22c14e1 100644 --- a/tests/rte/value_rte.c +++ b/tests/rte/value_rte.c @@ -1,5 +1,5 @@ /* run.config -OPT: -rte -then -val -then -report +OPT: -rte -then -val-show-progress -val -then -report */ #include "stdio.h" diff --git a/tests/rte_manual/oracle/bitwise.res.oracle b/tests/rte_manual/oracle/bitwise.res.oracle index 00bd8f696cf6d21f5b89382deb45c083431d9a8e..2945ffc22e55761c814fca27c1fb0ed0567c70da 100644 --- a/tests/rte_manual/oracle/bitwise.res.oracle +++ b/tests/rte_manual/oracle/bitwise.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/bitwise.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/contract.res.oracle b/tests/rte_manual/oracle/contract.res.oracle index 76d3741ac37241990c53197213e946e10243a659..ccae2f4b64dd144a09748dc72e3b96ab67fb590e 100644 --- a/tests/rte_manual/oracle/contract.res.oracle +++ b/tests/rte_manual/oracle/contract.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/contract.i (no preprocessing) [rte] annotating function f [rte] annotating function main diff --git a/tests/rte_manual/oracle/div.res.oracle b/tests/rte_manual/oracle/div.res.oracle index 647fe817033962f14fac9ea409739644af37c977..2761d0472a93a56c753e3ece2db5ed37a009da35 100644 --- a/tests/rte_manual/oracle/div.res.oracle +++ b/tests/rte_manual/oracle/div.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/div.i (no preprocessing) [rte] annotating function f [rte] annotating function main diff --git a/tests/rte_manual/oracle/float.res.oracle b/tests/rte_manual/oracle/float.res.oracle index 16fa5f1b29e4677f12c380f8fad5def74e73b9a1..ac5e6dd6b7b25d0a9a7ad8e27b4213f785873c77 100644 --- a/tests/rte_manual/oracle/float.res.oracle +++ b/tests/rte_manual/oracle/float.res.oracle @@ -1,13 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/float.i (no preprocessing) [rte] annotating function f /* Generated by Frama-C */ int f(float v) { - int i; /*@ assert rte: float_to_int: v + 3.0f < 2147483648; */ /*@ assert rte: float_to_int: -2147483649 < v + 3.0f; */ - i = (int)(v + 3.0f); + int i = (int)(v + 3.0f); return i; } diff --git a/tests/rte_manual/oracle/machdep.0.res.oracle b/tests/rte_manual/oracle/machdep.0.res.oracle index 145bfc8067f981f3ce1f4f1020dabe72ee85944c..51fd6fd55dafb49736ca2127ed756a2792d57cb4 100644 --- a/tests/rte_manual/oracle/machdep.0.res.oracle +++ b/tests/rte_manual/oracle/machdep.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/machdep.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/machdep.1.res.oracle b/tests/rte_manual/oracle/machdep.1.res.oracle index 7c366324a04f458b9648f5fbc3cbb652f54e99e4..a1c80c97a1cf409759945e53c59771e43c2d6c65 100644 --- a/tests/rte_manual/oracle/machdep.1.res.oracle +++ b/tests/rte_manual/oracle/machdep.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/machdep.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/memaccess.res.oracle b/tests/rte_manual/oracle/memaccess.res.oracle index a463c5aabff29bb27e67a2292baed764e1b6cdd5..1ec6b17200d7f905f8c4d8fca0bb2f98b0c0e721 100644 --- a/tests/rte_manual/oracle/memaccess.res.oracle +++ b/tests/rte_manual/oracle/memaccess.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/memaccess.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/safearrays.res.oracle b/tests/rte_manual/oracle/safearrays.res.oracle index da7df5b9b69dddba981969c8f01a5602ab8c0434..32d3710133e57781159b83b8b61d084889a82381 100644 --- a/tests/rte_manual/oracle/safearrays.res.oracle +++ b/tests/rte_manual/oracle/safearrays.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/safearrays.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/signed_downcast.0.res.oracle b/tests/rte_manual/oracle/signed_downcast.0.res.oracle index 284d8c085dd279a85f38bb3a75977a89b483df53..1417c912b4384faceb7fcd2f75770b2afa3037a8 100644 --- a/tests/rte_manual/oracle/signed_downcast.0.res.oracle +++ b/tests/rte_manual/oracle/signed_downcast.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/signed_downcast.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/signed_downcast.1.res.oracle b/tests/rte_manual/oracle/signed_downcast.1.res.oracle index ea031c7a2a0bbb264b5031d5e5cab1d82fea1faa..b53eac56ff97f956af17d3bac2eba60a09f75be7 100644 --- a/tests/rte_manual/oracle/signed_downcast.1.res.oracle +++ b/tests/rte_manual/oracle/signed_downcast.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/signed_downcast.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ @@ -8,6 +7,8 @@ int main(void) signed char cx; signed char cy; signed char cz; + /*@ assert rte: signed_overflow: -2147483648 ≤ (int)cx + (int)cy; */ + /*@ assert rte: signed_overflow: (int)cx + (int)cy ≤ 2147483647; */ /*@ assert rte: signed_downcast: (int)cx + (int)cy ≤ 127; */ /*@ assert rte: signed_downcast: -128 ≤ (int)cx + (int)cy; */ cz = (signed char)((int)cx + (int)cy); diff --git a/tests/rte_manual/oracle/sizeof.res.oracle b/tests/rte_manual/oracle/sizeof.res.oracle index ec6553ca75191ca35840c889f8af2c23e2733883..33b938c9b2e9232834484f7eea7b1c7a5b1a5b3c 100644 --- a/tests/rte_manual/oracle/sizeof.res.oracle +++ b/tests/rte_manual/oracle/sizeof.res.oracle @@ -1,6 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/sizeof.c (with preprocessing) -tests/rte_manual/sizeof.c:4:[kernel] warning: Variable-sized local variable b [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed @@ -9,32 +7,34 @@ tests/rte_manual/sizeof.c:4:[kernel] warning: Variable-sized local variable b [value] computing for function fsize3 <- main. Called from tests/rte_manual/sizeof.c:9. tests/rte_manual/sizeof.c:4:[value] assertion 'alloca_bounds' got status valid. -[value] computing for function alloca <- fsize3 <- main. - Called from tests/rte_manual/sizeof.c:4. -tests/rte_manual/sizeof.c:4:[kernel] warning: Neither code nor specification for function alloca, generating default assigns from the prototype -[value] using specification for function alloca -[value] Done for function alloca +tests/rte_manual/sizeof.c:4:[value] allocating variable __malloc_fsize3_l4 +tests/rte_manual/sizeof.c:4:[kernel] warning: Neither code nor specification for function __fc_vla_alloc, generating default assigns from the prototype [value] Recording results for fsize3 [value] Done for function fsize3 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function fsize3: - b ∈ {{ NULL + [--..--] ; &alloced_return_alloca + [0..2147483647] }} + b ∈ ESCAPINGADDR __lengthof_b ∈ {8} __retres ∈ {8} [value:final-states] Values at end of function main: __retres ∈ {8} [from] Computing for function fsize3 -[from] Computing for function alloca <-fsize3 -[from] Done for function alloca +[from] Computing for function __fc_vla_alloc <-fsize3 +[from] Done for function __fc_vla_alloc +[from] Computing for function __fc_vla_free <-fsize3 +tests/rte_manual/sizeof.c:4:[kernel] warning: Neither code nor specification for function __fc_vla_free, generating default assigns from the prototype +[from] Done for function __fc_vla_free [from] Done for function fsize3 [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function alloca: +[from] Function __fc_vla_alloc: \result FROM \nothing +[from] Function __fc_vla_free: + NO EFFECTS [from] Function fsize3: \result FROM n [from] Function main: @@ -43,8 +43,8 @@ tests/rte_manual/sizeof.c:4:[kernel] warning: Neither code nor specification for [inout] Out (internal) for function fsize3: b; __lengthof_b; __retres [inout] Inputs for function fsize3: - alloced_return_alloca[bits 0 to 17179869183] + \nothing [inout] Out (internal) for function main: tmp; __retres [inout] Inputs for function main: - alloced_return_alloca[bits 0 to 17179869183] + \nothing diff --git a/tests/rte_manual/oracle/unary_minus.res.oracle b/tests/rte_manual/oracle/unary_minus.res.oracle index 2e7e153cf405cef8ed5bc5f58406c43d80c2cdbd..38b2c1623a4865701f8018eb0b2c7e7b0a2c5bbd 100644 --- a/tests/rte_manual/oracle/unary_minus.res.oracle +++ b/tests/rte_manual/oracle/unary_minus.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/unary_minus.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/unsigned.0.res.oracle b/tests/rte_manual/oracle/unsigned.0.res.oracle index e7b78ec86400a1f3b7f50978f6bc4fef8e419362..bff71c694bb155e9ff12591d83b5b75e60a9c896 100644 --- a/tests/rte_manual/oracle/unsigned.0.res.oracle +++ b/tests/rte_manual/oracle/unsigned.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/unsigned.i (no preprocessing) [rte] annotating function f /* Generated by Frama-C */ diff --git a/tests/rte_manual/oracle/unsigned.1.res.oracle b/tests/rte_manual/oracle/unsigned.1.res.oracle index 4bd84f8631b09eb9cce31f55a94a32660d487329..ed1ad94cf29fa2456a9d34125464d34e62674c21 100644 --- a/tests/rte_manual/oracle/unsigned.1.res.oracle +++ b/tests/rte_manual/oracle/unsigned.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/unsigned.i (no preprocessing) [rte] annotating function f /* Generated by Frama-C */ @@ -7,6 +6,7 @@ unsigned int f(unsigned int a, unsigned int b) unsigned int x; unsigned int y; unsigned int z; + /*@ assert rte: unsigned_overflow: a << 3 ≤ 4294967295; */ x = a << 3; /*@ assert rte: unsigned_overflow: 0 ≤ b * (unsigned int)2; */ /*@ assert rte: unsigned_overflow: b * (unsigned int)2 ≤ 4294967295; */ diff --git a/tests/rte_manual/oracle/unsigned_downcast.res.oracle b/tests/rte_manual/oracle/unsigned_downcast.res.oracle index 4949e9c1588fe35720048dfc20aa768edc4c0378..01400f1cd7410007739154ceded5ccfe7c3ac671 100644 --- a/tests/rte_manual/oracle/unsigned_downcast.res.oracle +++ b/tests/rte_manual/oracle/unsigned_downcast.res.oracle @@ -1,14 +1,13 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/rte_manual/unsigned_downcast.i (no preprocessing) [rte] annotating function f /* Generated by Frama-C */ unsigned char f(int a, int b) { unsigned char __retres; - /*@ assert rte: unsigned_downcast: a + b ≤ 255; */ - /*@ assert rte: unsigned_downcast: 0 ≤ a + b; */ /*@ assert rte: signed_overflow: -2147483648 ≤ a + b; */ /*@ assert rte: signed_overflow: a + b ≤ 2147483647; */ + /*@ assert rte: unsigned_downcast: a + b ≤ 255; */ + /*@ assert rte: unsigned_downcast: 0 ≤ a + b; */ __retres = (unsigned char)(a + b); return __retres; } diff --git a/tests/saveload/basic.i b/tests/saveload/basic.i index 94e5cdddef215db8adab8054bf9635baed179d48..2b2346b07ab84c9eecb6a02e7a388768e48a7c04 100644 --- a/tests/saveload/basic.i +++ b/tests/saveload/basic.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s ./tests/saveload/basic.cmxs - EXECNOW: LOG basic_sav.res LOG basic_sav.err BIN basic.sav @frama-c@ -load-module ./tests/saveload/basic -val -out -input -deps ./tests/saveload/basic.i -save ./tests/saveload/result/basic.sav > ./tests/saveload/result/basic_sav.res 2> ./tests/saveload/result/basic_sav.err - EXECNOW: LOG basic_sav.1.res LOG basic_sav.1.err BIN basic.1.sav ./bin/toplevel.opt -save ./tests/saveload/result/basic.1.sav ./tests/saveload/basic.i -val -out -input -deps > ./tests/saveload/result/basic_sav.1.res 2> ./tests/saveload/result/basic_sav.1.err + EXECNOW: LOG basic_sav.res LOG basic_sav.err BIN basic.sav @frama-c@ -load-module ./tests/saveload/basic -val -out -input -deps -val-show-progress ./tests/saveload/basic.i -save ./tests/saveload/result/basic.sav > ./tests/saveload/result/basic_sav.res 2> ./tests/saveload/result/basic_sav.err + EXECNOW: LOG basic_sav.1.res LOG basic_sav.1.err BIN basic.1.sav ./bin/toplevel.opt -save ./tests/saveload/result/basic.1.sav ./tests/saveload/basic.i -val -out -input -deps -val-show-progress > ./tests/saveload/result/basic_sav.1.res 2> ./tests/saveload/result/basic_sav.1.err OPT: -load ./tests/saveload/result/basic.sav -val -out -input -deps -journal-disable CMD: @frama-c@ -load-module ./tests/saveload/basic OPT: -load ./tests/saveload/result/basic.1.sav -val -out -input -deps -journal-disable -print diff --git a/tests/saveload/bool.c b/tests/saveload/bool.c index 49d977291daa9500a9ab13fbe6d298d16a196190..c4a01f42f2b48144273f49f9f7b0ed288bfe8a64 100644 --- a/tests/saveload/bool.c +++ b/tests/saveload/bool.c @@ -1,5 +1,5 @@ /* run.config - EXECNOW: BIN bool.sav LOG bool_sav.res LOG bool_sav.err ./bin/toplevel.opt -save ./tests/saveload/result/bool.sav -val ./tests/saveload/bool.c > tests/saveload/result/bool_sav.res 2> tests/saveload/result/bool_sav.err + EXECNOW: BIN bool.sav LOG bool_sav.res LOG bool_sav.err ./bin/toplevel.opt -save ./tests/saveload/result/bool.sav -val -val-show-progress ./tests/saveload/bool.c > tests/saveload/result/bool_sav.res 2> tests/saveload/result/bool_sav.err OPT: -load ./tests/saveload/result/bool.sav -out -input -deps OPT: -load ./tests/saveload/result/bool.sav -val */ diff --git a/tests/saveload/callbacks.i b/tests/saveload/callbacks.i index 4714cab7213024879ca56a451aa3c7e274692f04..c4293481b869411e4b839908dbab04ce3dd3423a 100644 --- a/tests/saveload/callbacks.i +++ b/tests/saveload/callbacks.i @@ -1,5 +1,5 @@ /* run.config - EXECNOW: LOG callbacks_initial.res LOG callbacks_initial.err BIN callbacks.sav ./bin/toplevel.opt tests/saveload/callbacks.i -inout-callwise -out -calldeps -main main1 -save ./tests/saveload/result/callbacks.sav > ./tests/saveload/result/callbacks_initial.res 2> ./tests/saveload/result/callbacks_initial.err + EXECNOW: LOG callbacks_initial.res LOG callbacks_initial.err BIN callbacks.sav ./bin/toplevel.opt tests/saveload/callbacks.i -out -calldeps -val-show-progress -main main1 -save ./tests/saveload/result/callbacks.sav > ./tests/saveload/result/callbacks_initial.res 2> ./tests/saveload/result/callbacks_initial.err OPT: -load ./tests/saveload/result/callbacks.sav -main main2 -then -main main3 */ diff --git a/tests/saveload/deps.i b/tests/saveload/deps.i index ea55f9929fc06f4ec22ef09d5b447b1bf5209fff..c4fbc356265879ff0a970eb8951212fc916e92f0 100644 --- a/tests/saveload/deps.i +++ b/tests/saveload/deps.i @@ -1,11 +1,11 @@ /* run.config EXECNOW: make -s ./tests/saveload/deps_A.cmxs ./tests/saveload/deps_B.cmxs ./tests/saveload/deps_C.cmxs ./tests/saveload/deps_D.cmxs ./tests/saveload/deps_E.cmxs - EXECNOW: LOG deps_sav.res LOG deps_sav.err BIN deps.sav @frama-c@ -load-module ./tests/saveload/deps_A.cmxs -val -out -input -deps ./tests/saveload/deps.i -save ./tests/saveload/result/deps.sav > ./tests/saveload/result/deps_sav.res 2> ./tests/saveload/result/deps_sav.err - OPT: -load-module ./tests/saveload/deps_A -load ./tests/saveload/result/deps.sav -val -out -input -deps - OPT: -load-module ./tests/saveload/deps_B -load ./tests/saveload/result/deps.sav -out -input -deps - OPT: -load-module ./tests/saveload/deps_C -load ./tests/saveload/result/deps.sav -out -input -deps - OPT: -load-module ./tests/saveload/deps_D -load ./tests/saveload/result/deps.sav -out -input -deps - OPT: -load-module ./tests/saveload/deps_E -load ./tests/saveload/result/deps.sav -out -input -deps + EXECNOW: LOG deps_sav.res LOG deps_sav.err BIN deps.sav @frama-c@ -load-module ./tests/saveload/deps_A.cmxs -val -out -input -deps -val-show-progress ./tests/saveload/deps.i -save ./tests/saveload/result/deps.sav > ./tests/saveload/result/deps_sav.res 2> ./tests/saveload/result/deps_sav.err + OPT: -load-module ./tests/saveload/deps_A -load ./tests/saveload/result/deps.sav -val -out -input -deps -val-show-progress + OPT: -load-module ./tests/saveload/deps_B -load ./tests/saveload/result/deps.sav -out -input -deps -val-show-progress + OPT: -load-module ./tests/saveload/deps_C -load ./tests/saveload/result/deps.sav -out -input -deps -val-show-progress + OPT: -load-module ./tests/saveload/deps_D -load ./tests/saveload/result/deps.sav -out -input -deps -val-show-progress + OPT: -load-module ./tests/saveload/deps_E -load ./tests/saveload/result/deps.sav -out -input -deps -val-show-progress */ int main() { diff --git a/tests/saveload/load_one.i b/tests/saveload/load_one.i index 792ad87ea62e5ee847a8c1ba945100811d9ae81f..7e7668faf7b8af9e3f035316291821284e65d018 100644 --- a/tests/saveload/load_one.i +++ b/tests/saveload/load_one.i @@ -1,9 +1,5 @@ -/* run.config_no_native_dynlink - CMD: bin/toplevel.byte - OPT: -load-script tests/saveload/load_one.ml -*/ /* run.config - OPT: -load-script tests/saveload/load_one.ml + OPT: -load-script tests/saveload/load_one.ml -val-show-progress */ int G; diff --git a/tests/saveload/multi_project.i b/tests/saveload/multi_project.i index f30fbe5a20c4bfc062150dd2086df8ff941daae0..e11edda2a6785a5c42ca135afcd73f49c5e7642f 100644 --- a/tests/saveload/multi_project.i +++ b/tests/saveload/multi_project.i @@ -1,9 +1,9 @@ /* run.config - EXECNOW: BIN multi_project.sav LOG multi_project_sav.res LOG multi_project_sav.err ./bin/toplevel.opt -save ./tests/saveload/result/multi_project.sav -semantic-const-folding ./tests/saveload/multi_project.i > tests/saveload/result/multi_project_sav.res 2> tests/saveload/result/multi_project_sav.err + EXECNOW: BIN multi_project.sav LOG multi_project_sav.res LOG multi_project_sav.err ./bin/toplevel.opt -save ./tests/saveload/result/multi_project.sav -val-show-progress -semantic-const-folding ./tests/saveload/multi_project.i > tests/saveload/result/multi_project_sav.res 2> tests/saveload/result/multi_project_sav.err EXECNOW: make -s ./tests/saveload/multi_project.cmxs OPT: -load ./tests/saveload/result/multi_project.sav -journal-disable CMD: @frama-c@ -load-module ./tests/saveload/multi_project - OPT: -val + OPT: -val -val-show-progress */ int f(int x) { return x + x; diff --git a/tests/saveload/oracle/basic.1.res.oracle b/tests/saveload/oracle/basic.1.res.oracle index ed05affdf618bc26a1dcc10b5b83dfec583e2ede..7d30bd50fbb9d333fd32a57ab03a8abe4f741fd7 100644 --- a/tests/saveload/oracle/basic.1.res.oracle +++ b/tests/saveload/oracle/basic.1.res.oracle @@ -9,12 +9,10 @@ int main(void) /*@ assert i ≡ 10; */ ; while (1) { int tmp; - { /* sequence */ - tmp = i; - /*@ assert Value: signed_overflow: -2147483648 ≤ i - 1; */ - i --; - ; - } + tmp = i; + /*@ assert Value: signed_overflow: -2147483648 ≤ i - 1; */ + i --; + ; if (! tmp) break; } j = 5; diff --git a/tests/saveload/oracle/basic_sav.1.res b/tests/saveload/oracle/basic_sav.1.res index 50983af51c58d1ef8435cf32caa939ca5d271991..7ef4c4f92d2dac3bb55d2c1ed1e745ef96b9616b 100644 --- a/tests/saveload/oracle/basic_sav.1.res +++ b/tests/saveload/oracle/basic_sav.1.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/basic.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/saveload/oracle/basic_sav.res b/tests/saveload/oracle/basic_sav.res index 50983af51c58d1ef8435cf32caa939ca5d271991..7ef4c4f92d2dac3bb55d2c1ed1e745ef96b9616b 100644 --- a/tests/saveload/oracle/basic_sav.res +++ b/tests/saveload/oracle/basic_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/basic.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/saveload/oracle/bool.0.res.oracle b/tests/saveload/oracle/bool.0.res.oracle index de10cd3fcd303ab2ad8a448385cc353ae284ab4a..2f41f265b9c0ce02f9ca6e8fc6f961727570cdc1 100644 --- a/tests/saveload/oracle/bool.0.res.oracle +++ b/tests/saveload/oracle/bool.0.res.oracle @@ -2,39 +2,39 @@ [from] Computing for function f [from] Done for function f [from] Computing for function main -[from] Computing for function printf_0 <-main -[from] Done for function printf_0 -[from] Computing for function printf_1 <-main -[from] Done for function printf_1 -[from] Computing for function printf_2 <-main -[from] Done for function printf_2 -[from] Computing for function printf_3 <-main -[from] Done for function printf_3 -[from] Computing for function printf_4 <-main -[from] Done for function printf_4 +[from] Computing for function printf_va_1 <-main +[from] Done for function printf_va_1 +[from] Computing for function printf_va_2 <-main +[from] Done for function printf_va_2 +[from] Computing for function printf_va_3 <-main +[from] Done for function printf_va_3 +[from] Computing for function printf_va_4 <-main +[from] Done for function printf_va_4 +[from] Computing for function printf_va_5 <-main +[from] Done for function printf_va_5 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: [from] Function f: \result FROM \nothing -[from] Function printf_0: +[from] Function printf_va_1: S___fc_stdout[0].__fc_FILE_data FROM param0; S___fc_stdout[0]; "%d\n" (and SELF) \result FROM param0; S___fc_stdout[0]; "%d\n" -[from] Function printf_1: +[from] Function printf_va_2: S___fc_stdout[0].__fc_FILE_data FROM param0; S___fc_stdout[0]; "%d\n" (and SELF) \result FROM param0; S___fc_stdout[0]; "%d\n" -[from] Function printf_2: +[from] Function printf_va_3: S___fc_stdout[0].__fc_FILE_data FROM param0; param1; S___fc_stdout[0]; "%d,%d\n"[bits 0 to 55] (and SELF) \result FROM param0; param1; S___fc_stdout[0]; "%d,%d\n"[bits 0 to 55] -[from] Function printf_3: +[from] Function printf_va_4: S___fc_stdout[0].__fc_FILE_data FROM param0; S___fc_stdout[0]; "%d\n" (and SELF) \result FROM param0; S___fc_stdout[0]; "%d\n" -[from] Function printf_4: +[from] Function printf_va_5: S___fc_stdout[0].__fc_FILE_data FROM param0; S___fc_stdout[0]; "%d\n" (and SELF) \result FROM param0; S___fc_stdout[0]; "%d\n" diff --git a/tests/saveload/oracle/bool_sav.res b/tests/saveload/oracle/bool_sav.res index 256d99ac9a5f1d97bb44dac67734bc93d7591544..0d116283fa602871aefc64908f5938dd8bbe5932 100644 --- a/tests/saveload/oracle/bool_sav.res +++ b/tests/saveload/oracle/bool_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/bool.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -20,31 +19,31 @@ tests/saveload/bool.c:18:[value] entering loop for the first time tests/saveload/bool.c:18:[value] warning: signed overflow. assert -2147483648 ≤ i - 1; [value] Recording results for f [value] Done for function f -[value] computing for function printf_0 <- main. +[value] computing for function printf_va_1 <- main. Called from tests/saveload/bool.c:27. -[value] using specification for function printf_0 -tests/saveload/bool.c:27:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 -[value] computing for function printf_1 <- main. +[value] using specification for function printf_va_1 +tests/saveload/bool.c:27:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 +[value] computing for function printf_va_2 <- main. Called from tests/saveload/bool.c:29. -[value] using specification for function printf_1 -tests/saveload/bool.c:29:[value] function printf_1: precondition got status valid. -[value] Done for function printf_1 -[value] computing for function printf_2 <- main. +[value] using specification for function printf_va_2 +tests/saveload/bool.c:29:[value] function printf_va_2: precondition got status valid. +[value] Done for function printf_va_2 +[value] computing for function printf_va_3 <- main. Called from tests/saveload/bool.c:31. -[value] using specification for function printf_2 -tests/saveload/bool.c:31:[value] function printf_2: precondition got status valid. -[value] Done for function printf_2 -[value] computing for function printf_3 <- main. +[value] using specification for function printf_va_3 +tests/saveload/bool.c:31:[value] function printf_va_3: precondition got status valid. +[value] Done for function printf_va_3 +[value] computing for function printf_va_4 <- main. Called from tests/saveload/bool.c:33. -[value] using specification for function printf_3 -tests/saveload/bool.c:33:[value] function printf_3: precondition got status valid. -[value] Done for function printf_3 -[value] computing for function printf_4 <- main. +[value] using specification for function printf_va_4 +tests/saveload/bool.c:33:[value] function printf_va_4: precondition got status valid. +[value] Done for function printf_va_4 +[value] computing for function printf_va_5 <- main. Called from tests/saveload/bool.c:35. -[value] using specification for function printf_4 -tests/saveload/bool.c:35:[value] function printf_4: precondition got status valid. -[value] Done for function printf_4 +[value] using specification for function printf_va_5 +tests/saveload/bool.c:35:[value] function printf_va_5: precondition got status valid. +[value] Done for function printf_va_5 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/saveload/oracle/callbacks_initial.res b/tests/saveload/oracle/callbacks_initial.res index 95cf66718db812eedb822ed4c509d234a88b8005..deafd9e086d876ad6c792d35733d20e074b89a64 100644 --- a/tests/saveload/oracle/callbacks_initial.res +++ b/tests/saveload/oracle/callbacks_initial.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/callbacks.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/saveload/oracle/deps_sav.res b/tests/saveload/oracle/deps_sav.res index 3b622a3e6cd4c23a6658a87015f1b1bb26ad3096..d224b173bc8bcba60b819a152638fdcc359e6449 100644 --- a/tests/saveload/oracle/deps_sav.res +++ b/tests/saveload/oracle/deps_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/deps.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/saveload/oracle/load_one.res.oracle b/tests/saveload/oracle/load_one.res.oracle index 989ce3100e3de8a945cbf49254fba52ddae35d66..0a54977cc1fad125af2db0da35e86542f3ab1ef0 100644 --- a/tests/saveload/oracle/load_one.res.oracle +++ b/tests/saveload/oracle/load_one.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/load_one.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -6,17 +5,17 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization G ∈ {0} -tests/saveload/load_one.i:20:[value] assertion got status valid. +tests/saveload/load_one.i:16:[value] assertion got status valid. [value] computing for function f <- main. - Called from tests/saveload/load_one.i:22. + Called from tests/saveload/load_one.i:18. [value] Recording results for f [value] Done for function f [value] computing for function f <- main. - Called from tests/saveload/load_one.i:23. + Called from tests/saveload/load_one.i:19. [value] Recording results for f [value] Done for function f [value] computing for function f <- main. - Called from tests/saveload/load_one.i:24. + Called from tests/saveload/load_one.i:20. [value] Recording results for f [value] Done for function f [value] Recording results for main @@ -45,10 +44,8 @@ int f(int x, int y) int main(void) { - int a; - int b; - a = 1; - b = 1; + int a = 1; + int b = 1; /*@ assert a ≡ 1; */ ; f(0,0); a = f(a,b); @@ -69,10 +66,8 @@ int f(int x, int y) int main(void) { - int a; - int b; - a = 1; - b = 1; + int a = 1; + int b = 1; /*@ assert a ≡ 1; */ ; f(0,0); a = f(a,b); diff --git a/tests/saveload/oracle/multi_project.1.res.oracle b/tests/saveload/oracle/multi_project.1.res.oracle index 9cfff3ff51da5eb2f5181a3a97be309f107ac998..8ea8f56cecb4ea4fe0103b1f35d07962817efd99 100644 --- a/tests/saveload/oracle/multi_project.1.res.oracle +++ b/tests/saveload/oracle/multi_project.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/multi_project.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/saveload/oracle/multi_project_sav.res b/tests/saveload/oracle/multi_project_sav.res index 55aea4e77c7ea60f2ac656d311599440f68d6141..9d104c9f090d381959e633c17bb0e9f9a1d604b6 100644 --- a/tests/saveload/oracle/multi_project_sav.res +++ b/tests/saveload/oracle/multi_project_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/multi_project.i (no preprocessing) [scf] beginning constant propagation [value] Analyzing a complete application starting at main @@ -24,10 +23,8 @@ int f(int x) int main(void) { int __retres; - int x; - int y; - x = 2; - y = f(2); + int x = 2; + int y = f(2); /*@ assert y ≡ 4; */ ; __retres = 8; return __retres; diff --git a/tests/saveload/oracle/segfault_datatypes_sav.res b/tests/saveload/oracle/segfault_datatypes_sav.res index ba7cafabf090f0fa859f9133de63a98773043391..df8854a6235f5ebf70ec47c2d36f71644f8c69c6 100644 --- a/tests/saveload/oracle/segfault_datatypes_sav.res +++ b/tests/saveload/oracle/segfault_datatypes_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/segfault_datatypes.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/saveload/oracle/serialized_queue.res.oracle b/tests/saveload/oracle/serialized_queue.res.oracle index 8556528f7ae252047133d26283dd70b02ae734af..7083d19e1ac9df94fda63df2bc07c5fc2006e7e3 100644 --- a/tests/saveload/oracle/serialized_queue.res.oracle +++ b/tests/saveload/oracle/serialized_queue.res.oracle @@ -8,5 +8,4 @@ [kernel] 1 [kernel] 2 [kernel] 3 -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/serialized_queue.i (no preprocessing) diff --git a/tests/saveload/oracle/sparecode_sav.res b/tests/saveload/oracle/sparecode_sav.res index b09efd8a13d068e10398fd89275a1916caa140e3..f094be0d3373f32b5d4f79194554ce3619f0f20a 100644 --- a/tests/saveload/oracle/sparecode_sav.res +++ b/tests/saveload/oracle/sparecode_sav.res @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/sparecode.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -20,7 +19,7 @@ [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -48,10 +47,8 @@ int f_slice_1(int x, int y) int main(void) { - int a; - int b; - a = 1; - b = 1; + int a = 1; + int b = 1; f_slice_1(a,b); a = f_slice_1(G + 1,b); return a; diff --git a/tests/saveload/oracle/status_sav.res b/tests/saveload/oracle/status_sav.res index 1a10cf8e0348f9da85de5d20d5fb5423e15e0311..9eef1f8314f4c37ab91ef25b8694befcbe60ec41 100644 --- a/tests/saveload/oracle/status_sav.res +++ b/tests/saveload/oracle/status_sav.res @@ -1,3 +1,2 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/saveload/basic.i (no preprocessing) unknown (tried by Test) diff --git a/tests/saveload/segfault_datatypes.i b/tests/saveload/segfault_datatypes.i index a8c40a55e5e41f3cdc7445483418e633c64bff56..f6f120a5ec08ee807067027580544f6d3d9ed118 100644 --- a/tests/saveload/segfault_datatypes.i +++ b/tests/saveload/segfault_datatypes.i @@ -1,6 +1,6 @@ /* run.config EXECNOW: make -s ./tests/saveload/segfault_datatypes_A.cmxs ./tests/saveload/segfault_datatypes_B.cmxs - EXECNOW: LOG segfault_datatypes_sav.res LOG segfault_datatypes_sav.err BIN segfault_datatypes.sav @frama-c@ -load-module ./tests/saveload/segfault_datatypes_A -val -out -input -deps ./tests/saveload/segfault_datatypes.i -save ./tests/saveload/result/segfault_datatypes.sav > ./tests/saveload/result/segfault_datatypes_sav.res 2> ./tests/saveload/result/segfault_datatypes_sav.err + EXECNOW: LOG segfault_datatypes_sav.res LOG segfault_datatypes_sav.err BIN segfault_datatypes.sav @frama-c@ -load-module ./tests/saveload/segfault_datatypes_A -val -out -input -deps -val-show-progress ./tests/saveload/segfault_datatypes.i -save ./tests/saveload/result/segfault_datatypes.sav > ./tests/saveload/result/segfault_datatypes_sav.res 2> ./tests/saveload/result/segfault_datatypes_sav.err CMD: @frama-c@ -load-module ./tests/saveload/segfault_datatypes_B OPT: -load ./tests/saveload/result/segfault_datatypes.sav -val -out -input -deps -journal-disable */ diff --git a/tests/saveload/sparecode.i b/tests/saveload/sparecode.i index 867e7f9806ca4de6c4e030545cfcafe3c7f1ea88..928642b8f68add1a87f829c27df6ef7e775481d5 100644 --- a/tests/saveload/sparecode.i +++ b/tests/saveload/sparecode.i @@ -1,5 +1,5 @@ /* run.config - EXECNOW: BIN sparecode.sav LOG sparecode_sav.res LOG sparecode_sav.err ./bin/toplevel.opt -slicing-level 2 -slice-return main -save ./tests/saveload/result/sparecode.sav tests/saveload/sparecode.i -then-on 'Slicing export' -print > tests/saveload/result/sparecode_sav.res 2> tests/saveload/result/sparecode_sav.err + EXECNOW: BIN sparecode.sav LOG sparecode_sav.res LOG sparecode_sav.err ./bin/toplevel.opt -slicing-level 2 -slice-return main -val-show-progress -save ./tests/saveload/result/sparecode.sav tests/saveload/sparecode.i -then-on 'Slicing export' -print > tests/saveload/result/sparecode_sav.res 2> tests/saveload/result/sparecode_sav.err OPT: -load ./tests/saveload/result/sparecode.sav */ int G; diff --git a/tests/scope/bts383.c b/tests/scope/bts383.c index b7b627ba62ec30fa75919314b705e4f3a1f9ffa3..d3bd151d656889cc25ca832964b4e50576fa2d4e 100644 --- a/tests/scope/bts383.c +++ b/tests/scope/bts383.c @@ -1,5 +1,5 @@ /* run.config - OPT: -val -print -journal-disable -scope-verbose 1 -remove-redundant-alarms -context-width 3 + OPT: -val -val-show-progress -print -journal-disable -scope-verbose 1 -remove-redundant-alarms -context-width 3 */ /* echo '!Db.Scope.check_asserts();;' \ diff --git a/tests/scope/bts971.ml b/tests/scope/bts971.ml index e33c548b53e3abeb7e0385fe4959852341e21516..6028f7c62e410a4f6864f7445bf33202fc9cf907 100644 --- a/tests/scope/bts971.ml +++ b/tests/scope/bts971.ml @@ -10,7 +10,7 @@ let compute_and_print pp str_data = let stmt, kf = pp in let lval_term = !Db.Properties.Interp.term_lval kf str_data in let lval = !Db.Properties.Interp.term_lval_to_lval ~result:None lval_term in - let defs = !Db.Scope.get_defs kf stmt lval in + let defs = Scope.Defs.get_defs kf stmt lval in Format.printf "* @[<v 2>Defs for (%s) at current program point=@[<v 2>@." str_data; let _ = match defs with diff --git a/tests/scope/no-effect.i b/tests/scope/no-effect.i index 9193f509826a9a83799bb4969e02b88b6e132383..bc05110bbe07e7aaeac8581f2161e1993a8138e4 100644 --- a/tests/scope/no-effect.i +++ b/tests/scope/no-effect.i @@ -1,5 +1,5 @@ /* run.config - OPT: -val -print -journal-disable -scope-verbose 1 -remove-redundant-alarms + OPT: -val-show-progress -val -print -journal-disable -scope-verbose 1 -remove-redundant-alarms */ typedef struct { diff --git a/tests/scope/oracle/bts383.res.oracle b/tests/scope/oracle/bts383.res.oracle index b856b8ec452096372d43b1736846996049798863..f070aa6ea292f4e03227b6e6e0d2f470ba9c03db 100644 --- a/tests/scope/oracle/bts383.res.oracle +++ b/tests/scope/oracle/bts383.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/bts383.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -135,9 +134,8 @@ int if2(int c, int *p) void loop1(int *p) { int i; - int n; /*@ assert Value: mem_access: \valid_read(p); */ - n = *p; + int n = *p; i = 0; while (i < n) { /*@ assert Value: mem_access: \valid_read(p); */ @@ -223,11 +221,9 @@ int main(int *p, Tstruct *ps) loop1(p + 1); loop2(x,p + 1); out_string((char const *)(p + 1)); - { /* sequence */ - tmp = fstruct(ps + 1); - /*@ assert Value: signed_overflow: x + tmp ≤ 2147483647; */ - x += tmp; - } + tmp = fstruct(ps + 1); + /*@ assert Value: signed_overflow: x + tmp ≤ 2147483647; */ + x += tmp; return x; } diff --git a/tests/scope/oracle/bts971.res.oracle b/tests/scope/oracle/bts971.res.oracle index f44bef6654d49ac474d16746f5c4a566f537e13a..3ace8872b510045397443a06cc777dbc2a43f0f1 100644 --- a/tests/scope/oracle/bts971.res.oracle +++ b/tests/scope/oracle/bts971.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/bts971.c (with preprocessing) === Tests for Scope.Defs --- Intraprocedural mode (-scope-no-defs-interproc) diff --git a/tests/scope/oracle/no-effect.res.oracle b/tests/scope/oracle/no-effect.res.oracle index f5ccc88742deaf376b8ad430476ecc794d617303..1ae6ace5e2af1fd6f86df571f48fa2593633e357 100644 --- a/tests/scope/oracle/no-effect.res.oracle +++ b/tests/scope/oracle/no-effect.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/no-effect.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -24,10 +23,9 @@ void main(tt const *p1) while (1) /*@ assert Value: mem_access: \valid_read(&(p1 + 1)->v); */ switch ((p1 + 1)->v) { - int tmp; case 1: case 2: case 3: case 4: ; /*@ assert Value: mem_access: \valid_read(&(p1 + 1)->v); */ - tmp = (p1 + 1)->v; + int tmp = (p1 + 1)->v; break; } return; diff --git a/tests/scope/oracle/scope.0.res.oracle b/tests/scope/oracle/scope.0.res.oracle index 0fdef2c308fe2d150e36614ad3563026503a7b1d..a026e7b85e9ee2f2bab1866743e7f4388b4cf971 100644 --- a/tests/scope/oracle/scope.0.res.oracle +++ b/tests/scope/oracle/scope.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/scope.c (with preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/scope/oracle/scope.1.res.oracle b/tests/scope/oracle/scope.1.res.oracle index 64fc71932e1ade7bc0dbd2b2e7d786df7cb78aa7..30df3ce8b6b5c6880b04274c761588434d62554a 100644 --- a/tests/scope/oracle/scope.1.res.oracle +++ b/tests/scope/oracle/scope.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/scope.c (with preprocessing) [value] Analyzing a complete application starting at f2 [value] Computing initial state diff --git a/tests/scope/oracle/scope.2.res.oracle b/tests/scope/oracle/scope.2.res.oracle index 072c273f9fc2c75e846177fab7fa21034a05e7db..16e0c18cad4efc349270b74a7dc48f725078f6ac 100644 --- a/tests/scope/oracle/scope.2.res.oracle +++ b/tests/scope/oracle/scope.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/scope.c (with preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state diff --git a/tests/scope/oracle/zones.res.oracle b/tests/scope/oracle/zones.res.oracle index 52e2310ef5bf290920eab0d1ecac9ae70b4d3580..c8ee6463bf4b3cfb291001ba381b9d86e877d12e 100644 --- a/tests/scope/oracle/zones.res.oracle +++ b/tests/scope/oracle/zones.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/scope/zones.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/scope/scope.c b/tests/scope/scope.c index e9bc96d0d23ff8cc0ef20aaef10ccac0570cc8f5..3604b0fb1c904ad59599c30ea1d2550adb0968cc 100644 --- a/tests/scope/scope.c +++ b/tests/scope/scope.c @@ -1,7 +1,7 @@ /* run.config - OPT: -val -main f -journal-disable - OPT: -val -main f2 -journal-disable - OPT: -val -main loop -journal-disable + OPT: -val -val-show-progress -main f -journal-disable + OPT: -val -val-show-progress -main f2 -journal-disable + OPT: -val -val-show-progress -main loop -journal-disable */ /* * bin/viewer.byte -main f tests/scope/scope.c -val diff --git a/tests/scope/zones.c b/tests/scope/zones.c index 346a484582d4d63eeaee7071ed2a81916afac86e..f23d798f99fa0295e525b9b85c42e74ae8f512e5 100644 --- a/tests/scope/zones.c +++ b/tests/scope/zones.c @@ -1,5 +1,5 @@ /* run.config - OPT: -load-script tests/scope/zones.ml -val -journal-disable + OPT: -load-script tests/scope/zones.ml -val -val-show-progress -journal-disable */ diff --git a/tests/scope/zones.ml b/tests/scope/zones.ml index 351bbfc6cf1db2abdce17e6d2ab083a0004200b8..5b6358d19d5e8e7790fc3461ac451d07283fac48 100644 --- a/tests/scope/zones.ml +++ b/tests/scope/zones.ml @@ -37,9 +37,9 @@ let compute_and_print pp str_data = let stmt, kf = pp in let lval_term = !Db.Properties.Interp.term_lval kf str_data in let lval = !Db.Properties.Interp.term_lval_to_lval ~result:None lval_term in - let (_used_stmts, zones) = !Db.Scope.build_zones kf stmt lval in + let (_used_stmts, zones) = Scope.Zones.build_zones kf stmt lval in Format.printf "Zones for %s at current program point =@.%a\n@\n" - str_data !Db.Scope.pretty_zones zones + str_data Scope.Zones.pretty_zones zones ;; let main _ = diff --git a/tests/slicing/adpcm.c b/tests/slicing/adpcm.c index 53c248a400047c411bff1b960c01baf059399faf..9bc30efd60c3abe41fabbb518ca9bedc95332867 100644 --- a/tests/slicing/adpcm.c +++ b/tests/slicing/adpcm.c @@ -1,6 +1,6 @@ /* run.config EXECNOW: make -s tests/slicing/adpcm.cmxs - OPT: -load-module ./tests/slicing/libSelect.cmxs -load-module ./tests/slicing/adpcm.cmxs -ulevel -1 -deps -slicing-level 2 -journal-disable + OPT: -val-show-progress -load-module ./tests/slicing/libSelect.cmxs -load-module ./tests/slicing/adpcm.cmxs -ulevel -1 -deps -slicing-level 2 -journal-disable */ #include "tests/test/adpcm.c" diff --git a/tests/slicing/anim.ml b/tests/slicing/anim.ml index 2ac91b926f87ff7ade2487f09cbad2c65becce72..845f8405af0070998708af054255c0d803f8ef9d 100644 --- a/tests/slicing/anim.ml +++ b/tests/slicing/anim.ml @@ -9,40 +9,39 @@ (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) -let add_select_fun_calls project kf = +let add_select_fun_calls kf = let selections = Db.Slicing.Select.empty_selects in let selections = - !Db.Slicing.Select.select_func_calls_into selections ~spare:false kf - in !Db.Slicing.Select.iter_selects_internal - (fun s -> !Db.Slicing.Request.add_selection_internal project s) + Slicing.Api.Select.select_func_calls_into selections ~spare:false kf + in Slicing.Api.Select.iter_selects_internal + (fun s -> !Db.Slicing.Request.add_selection_internal s) selections (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) let main _ = let proj_name = "slicing_project" in - let project = !Db.Slicing.Project.mk_project proj_name in let n = 0 in let title = "Before start" in - let n = LibAnim.print_proj proj_name title project n in + let n = LibAnim.print_proj proj_name title n in let kf_send = Globals.Functions.find_by_name "send" in - add_select_fun_calls project kf_send; + add_select_fun_calls kf_send; let title = "Select 'send' calls" in - let n = LibAnim.print_proj proj_name title project n in + let n = LibAnim.print_proj proj_name title n in let title = "Apply : " ^ title in - let n = LibAnim.build_all_graphs proj_name title project n in + let n = LibAnim.build_all_graphs proj_name title n in let kf_send_bis = Globals.Functions.find_by_name "send_bis" in - add_select_fun_calls project kf_send_bis; + add_select_fun_calls kf_send_bis; let title = "Select 'send_bis' calls" in - let n = LibAnim.print_proj proj_name title project n in + let n = LibAnim.print_proj proj_name title n in let title = ("Apply : "^title) in - let _n = LibAnim.build_all_graphs proj_name title project n in + let _n = LibAnim.build_all_graphs proj_name title n in LibAnim.print_help proj_name;; diff --git a/tests/slicing/annot.i b/tests/slicing/annot.i index 21f027de6fd1e98d2bbd56f966aade8e86bae23a..74f1d7cf061627ad144da1815a09f9a031b6add3 100644 --- a/tests/slicing/annot.i +++ b/tests/slicing/annot.i @@ -1,6 +1,6 @@ /* run.config - OPT: -main f1 -slice-assert f1 -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -main f2 -slice-assert f2 -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -main f1 -slice-assert f1 -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -main f2 -slice-assert f2 -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ extern int x, z; diff --git a/tests/slicing/bts0184.i b/tests/slicing/bts0184.i index 22d2f416b0307fe451769bdf05bfcf5aff9ea3f5..37b7184f937b150926de745d1166facca5cebff8 100644 --- a/tests/slicing/bts0184.i +++ b/tests/slicing/bts0184.i @@ -1,5 +1,5 @@ /* run.config - OPT: -check -slice-pragma x -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-pragma x -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check **/ int x(int y, int z) { diff --git a/tests/slicing/bts0190.i b/tests/slicing/bts0190.i index 86fe1d0fc8afb8a265de38439c7f587510e08712..13be23ede7c10bb297de889598108cd951c938da 100644 --- a/tests/slicing/bts0190.i +++ b/tests/slicing/bts0190.i @@ -1,5 +1,5 @@ /* run.config -OPT: -check -slice-rd y -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +OPT: -val-show-progress -check -slice-rd y -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ int z1(void); diff --git a/tests/slicing/bts0950_annot.i b/tests/slicing/bts0950_annot.i index 02035872d12d568974cf3bb51a00acb706e51774..dc1d585f6ed25dfc7f6b4bd84a9b703552d3f015 100644 --- a/tests/slicing/bts0950_annot.i +++ b/tests/slicing/bts0950_annot.i @@ -1,5 +1,5 @@ /* run.config - OPT: -val -slice-value a -then-on "Slicing export" -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -val -slice-value a -then-on "Slicing export" -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ /*@ requires \valid(dest); */ extern void cpy(int *dest, const int *src); diff --git a/tests/slicing/bts1248.i b/tests/slicing/bts1248.i index ebf21968d171286c2bf2efc6d4dda9f6b155df94..f945958a37120ba0bacd9650fbc5dc3709ab2625 100644 --- a/tests/slicing/bts1248.i +++ b/tests/slicing/bts1248.i @@ -1,5 +1,5 @@ /* run.config -OPT: -slice-rd x -main f -slicing-project-name p -then-on 'p export' -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i +OPT: -val-show-progress -slice-rd x -main f -slicing-project-name p -then-on 'p export' -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ int f(void) { diff --git a/tests/slicing/bts1445.i b/tests/slicing/bts1445.i index 3c5a5c48c28b5c3f6b448a329b58b15a3547f092..b312b537bfa086e309964196c91693817c21065d 100644 --- a/tests/slicing/bts1445.i +++ b/tests/slicing/bts1445.i @@ -1,6 +1,6 @@ /* run.config -OPT: -slice-calls main -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -OPT: -slice-calls f -main f -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i +OPT: -val-show-progress -slice-calls main -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i +OPT: -val-show-progress -slice-calls f -main f -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ int x = 0; diff --git a/tests/slicing/bts1684.i b/tests/slicing/bts1684.i index 996b6f9f26949deab524e8cd94fc8a371e2cf9ad..dd4143fc22bb7147c6e34df501c21bc131c02151 100644 --- a/tests/slicing/bts1684.i +++ b/tests/slicing/bts1684.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-calls main -journal-enable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-calls main -journal-enable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ // one bug about JOURNALIZATION and another one about slicing CALLS TO MAIN function. double d1, d2, d3; diff --git a/tests/slicing/bts1768.i b/tests/slicing/bts1768.i index 58105e7598e2508c961069a5caa8fed6844ab71f..ddaa805636b767048afa74d514ed3c3f09c9fbcd 100644 --- a/tests/slicing/bts1768.i +++ b/tests/slicing/bts1768.i @@ -1,5 +1,5 @@ /* run.config - OPT: -main main -slice-pragma main -ulevel 10 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main main -slice-pragma main -ulevel 10 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ int choix ; int state = 1; diff --git a/tests/slicing/bts179.i b/tests/slicing/bts179.i index f6581778b820de4d8eff32261b2795ca66c4b639..2c070bf05dbf4b1ffd0d4c1255645ecd1a75af9a 100644 --- a/tests/slicing/bts179.i +++ b/tests/slicing/bts179.i @@ -1,7 +1,7 @@ /* run.config - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -sparecode-analysis -journal-disable + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -sparecode-analysis -journal-disable */ struct {int a; int ab; int b; int c ; int d;} S; diff --git a/tests/slicing/bts283.i b/tests/slicing/bts283.i index 8de2bccbceef13e6c7945aeae075267eba1ae6e3..7ae8a975a631526043ff576aabb80b2aa945183b 100644 --- a/tests/slicing/bts283.i +++ b/tests/slicing/bts283.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-return main -slice-undef-functions -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-return main -slice-undef-functions -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ int x,y,z; diff --git a/tests/slicing/bts326.i b/tests/slicing/bts326.i index 99858acccaef22fa290ce3cb4738cffd4af70184..bc80f576965e40ccfc64059e9a4ac80e07570995 100644 --- a/tests/slicing/bts326.i +++ b/tests/slicing/bts326.i @@ -1,5 +1,5 @@ /* run.config - OPT: -calldeps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -calldeps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps */ /* Problem : f(1) should be sliced out. See BTS#326 */ int t[2] ; diff --git a/tests/slicing/bts335.i b/tests/slicing/bts335.i index 065b5d94a28c9f53b89a39722bfe5e9e3469b96f..cb9dbca84760d5e90a7eb15122fb1b644b238e75 100644 --- a/tests/slicing/bts335.i +++ b/tests/slicing/bts335.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-pragma g -calldeps -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -slice-pragma g -calldeps -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps */ /* diff --git a/tests/slicing/bts335b.i b/tests/slicing/bts335b.i index 859572f5498038bc3df6e2c20eff4b59bcf931e2..60952187d16f58a87bbb21290fb9ef908b66134d 100644 --- a/tests/slicing/bts335b.i +++ b/tests/slicing/bts335b.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-return main -calldeps -slicing-level 3 -slicing-verbose 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -slice-return main -calldeps -slicing-level 3 -slicing-verbose 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps */ int X, Y; diff --git a/tests/slicing/bts336.i b/tests/slicing/bts336.i index 2f4fc1cea754c3aeac5a8f340d7e723586f4501e..20f6db5ce8a5e5c9bebde0f11dc1c6cb9a2aa971 100644 --- a/tests/slicing/bts336.i +++ b/tests/slicing/bts336.i @@ -1,12 +1,12 @@ /* run.config - OPT: -slice-return main -calldeps -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -main main2 -slice-return main2 -calldeps -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -main main3 -slice-return main3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -journal-disable -main main3 -inout -inout-callwise -calldeps -slice-return main3 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -no-inout - OPT: -journal-disable -main main -calldeps -inout-callwise -slice-return main -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -journal-disable -main main4 -calldeps -inout-callwise -slice-return main4 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -journal-disable -main main4 -calldeps -inout-callwise -slice-return main4 -slicing-level 3 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -journal-disable -main main5 -calldeps -inout-callwise -slice-return main5 -then-on 'Slicing export' -set-project-as-default -print -calldeps -inout-callwise -slice-return main5 -then-on 'Slicing export 2' -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -slice-return main -calldeps -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -main main2 -slice-return main2 -calldeps -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -main main3 -slice-return main3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -journal-disable -main main3 -inout -calldeps -slice-return main3 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress -no-inout + OPT: -val-show-progress -journal-disable -main main -calldeps -slice-return main -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -journal-disable -main main4 -calldeps -slice-return main4 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -journal-disable -main main4 -calldeps -slice-return main4 -slicing-level 3 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -journal-disable -main main5 -calldeps -slice-return main5 -then-on 'Slicing export' -set-project-as-default -print -calldeps -val-show-progress -slice-return main5 -then-on 'Slicing export 2' -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress */ // something to do to have better results... int T[10]; diff --git a/tests/slicing/bts341.i b/tests/slicing/bts341.i index 425b56cfbb68a17ce02bc672066bb8e15196322a..3bb1e8f2b13417b9277b43c189c6883be439a010 100644 --- a/tests/slicing/bts341.i +++ b/tests/slicing/bts341.i @@ -1,5 +1,5 @@ /* run.config - OPT: -check -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ int main (int c) { if (c) diff --git a/tests/slicing/bts344.i b/tests/slicing/bts344.i index ac84ec0876cf37ec6a5f3673c16aa1501b1479b5..0464bb25dfbdfa4674b79e803275a400eb1ff761 100644 --- a/tests/slicing/bts344.i +++ b/tests/slicing/bts344.i @@ -1,6 +1,6 @@ /* run.config - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -slice-return main_bis -main main_bis -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-return main_bis -main main_bis -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ int X, Y ; diff --git a/tests/slicing/bts345.i b/tests/slicing/bts345.i index 82a8aa116be58142c2287bbd0a593aaa329fd108..b7fc9b57739b93b722ed90391a5de6e8bbd37384 100644 --- a/tests/slicing/bts345.i +++ b/tests/slicing/bts345.i @@ -1,9 +1,9 @@ /* run.config - OPT: -check -slice-return call_top -main call_top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return top -main top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return top -main call_top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return called_by_top -main top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return called_by_top -main call_top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return call_top -main call_top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return top -main top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return top -main call_top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return called_by_top -main top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return called_by_top -main call_top -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ int called_indirectly_by_top (int x) { diff --git a/tests/slicing/bts679.i b/tests/slicing/bts679.i index ad624355ed5a5806382526fdd961d111455fcf86..118b9e815578d24cd84c817363963d279113f446 100644 --- a/tests/slicing/bts679.i +++ b/tests/slicing/bts679.i @@ -1,5 +1,5 @@ /* run.config -OPT: -slice-return main -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i +OPT: -val-show-progress -slice-return main -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ void f(void) { return; } int X = 1 ; diff --git a/tests/slicing/bts679b.i b/tests/slicing/bts679b.i index 06b9f727b57e40e4aa4eefb0ddc07841f0e18dd8..6ac2a5334747f1de941d1b39721a4ddfacbc1472 100644 --- a/tests/slicing/bts679b.i +++ b/tests/slicing/bts679b.i @@ -1,5 +1,5 @@ /* run.config -OPT: -slice-assert main -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps +OPT: -val-show-progress -slice-assert main -then-on "Slicing export" -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ int X = 1 ; diff --git a/tests/slicing/bts709.i b/tests/slicing/bts709.i index 52ea3d885ae90aba90609a5db8367e2f53b94fe4..e5eba95f69961a4f106738d49d4f07c899a756a2 100644 --- a/tests/slicing/bts709.i +++ b/tests/slicing/bts709.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-pragma func -no-unicode -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-pragma func -no-unicode -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ int inputsOf_testcase_func (); diff --git a/tests/slicing/bts808.i b/tests/slicing/bts808.i index 20ac89988ea2996baed4ef052aff3f8a6699a603..e5edca28b5f711c1dc4633d58896b598b352d715 100644 --- a/tests/slicing/bts808.i +++ b/tests/slicing/bts808.i @@ -1,5 +1,5 @@ /* run.config -* OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i +* OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ int f0 (void) { diff --git a/tests/slicing/bts827.i b/tests/slicing/bts827.i index 4891fc7d179829fd5b68a10bf1a87ba7c245e66e..59b43073dbd7afdc7ddcb706b59ba7f27695b7a5 100644 --- a/tests/slicing/bts827.i +++ b/tests/slicing/bts827.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ /* The problem was a mix-up between f outputs and retrun value. */ diff --git a/tests/slicing/call_accuracy.i b/tests/slicing/call_accuracy.i index 7ca519ce01ab9242adf150a3836756f436016b85..758bc2db6bce8b20b240ee2367f4b59a6dc39208 100644 --- a/tests/slicing/call_accuracy.i +++ b/tests/slicing/call_accuracy.i @@ -1,5 +1,5 @@ /* run.config - OPT: -calldeps -slice-return main -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -calldeps -slice-return main -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps */ int f_cond (int c, int a, int b) { ++a; diff --git a/tests/slicing/call_demo.i b/tests/slicing/call_demo.i index 95a86ca1ee3dff1be50c73108057fc0eb7cf0b75..0e6f31f3b3e0ada3601af47f7fc82030dafb8815 100644 --- a/tests/slicing/call_demo.i +++ b/tests/slicing/call_demo.i @@ -1,6 +1,6 @@ /* run.config - OPT: -slice-calls call1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -slice-calls call2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-calls call1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-calls call2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ //@ assigns \result \from v; diff --git a/tests/slicing/callwise.i b/tests/slicing/callwise.i index e97eb63808583065b2703da8e483a1e717014cef..de323e7229200b0a6101f90f53ee4084f6a22f5c 100644 --- a/tests/slicing/callwise.i +++ b/tests/slicing/callwise.i @@ -1,5 +1,5 @@ /* run.config - OPT: -calldeps -slice-return main -slicing-level 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -calldeps -slice-return main -slicing-level 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps */ int a = 1, b = 1, c = 1, d = 1, *p; diff --git a/tests/slicing/combine.i b/tests/slicing/combine.i index fdefddedb14f69098f92ed04e3dac93c98e963b5..dd600e55f02f8db40ec191806c8993c979a9d549 100644 --- a/tests/slicing/combine.i +++ b/tests/slicing/combine.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/combine.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/combine.cmxs - OPT: -deps -journal-disable + OPT: -val-show-progress -deps -journal-disable */ //@ assigns \result \from x; diff --git a/tests/slicing/combine.ml b/tests/slicing/combine.ml index 88f1779e74df76d831a15798c0b6e427b6a3fe17..e1e03cc063ed51f84a3c78afb22efb25b31772d2 100644 --- a/tests/slicing/combine.ml +++ b/tests/slicing/combine.ml @@ -16,30 +16,30 @@ let f_slice_names = f_slice_names let main _ = - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); let kf_main = Globals.Functions.find_def_by_name "main" in let kf_f = Globals.Functions.find_def_by_name "f" in - !S.Project.change_slicing_level project kf_f 2; + Slicing.Api.Project.change_slicing_level kf_f 2; - let ff_main = !S.Slice.create project kf_main in - let select = select_retres project kf_main in - let _ = !S.Request.add_slice_selection_internal project ff_main select in - !S.Request.apply_all_internal project; + let ff_main = Slicing.Api.Slice.create kf_main in + let select = select_retres kf_main in + Slicing.Api.Request.add_slice_selection_internal ff_main select; + Slicing.Api.Request.apply_all_internal (); - extract_and_print project; + extract_and_print (); Format.printf "Let's split 'f':@."; - let ff_f = match !S.Slice.get_all project kf_f with + let ff_f = match Slicing.Api.Slice.get_all kf_f with | f :: [] -> f | _ -> assert false in - ignore (!S.Request.split_slice project ff_f); - !S.Request.apply_all_internal project; + ignore (Slicing.Api.Request.split_slice ff_f); + Slicing.Api.Request.apply_all_internal (); - let proj2 = !S.Project.extract "slicing_result" ~f_slice_names project in + let proj2 = Slicing.Api.Project.extract ~f_slice_names "slicing_result" in Project.set_current proj2; Format.printf "After Slicing :@." ; File.pretty_ast (); @@ -62,11 +62,12 @@ let main _ = let new_cil_file = Ast.get () in Cil.visitCilFile infos new_cil_file (* the cil file after slicing *);; *) - + Dynamic.Parameter.Bool.set "-val-show-progress" true; !Db.Value.compute (); let all = Cil_datatype.Fundec.Set.empty in let proj3 = !Db.Constant_Propagation.get all ~cast_intro:true in Project.set_current proj3; + Dynamic.Parameter.Bool.set "-val-show-progress" true; Format.printf "After Constant propagation :@."; File.pretty_ast ~prj:proj3 (); diff --git a/tests/slicing/csmith.i b/tests/slicing/csmith.i index 9dd6d9bf3fe44e0d9b6e43c36c8539ea802abe23..03d656ba655034b8cfdd651134c08d61601eb937 100644 --- a/tests/slicing/csmith.i +++ b/tests/slicing/csmith.i @@ -1,8 +1,8 @@ /* run.config - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i COMMENT: - OPT: -main bts906b -fct-pdg bts906b -pdg-print -pdg-verbose 2 - OPT: -main bts906c -fct-pdg bts906c -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -main bts906b -fct-pdg bts906b -pdg-print -pdg-verbose 2 + OPT: -val-show-progress -main bts906c -fct-pdg bts906c -pdg-print -pdg-verbose 2 COMMENT: The two PDG tests above test interesting case where the slicing may COMMENT: slice away a goto because of an incorrect analyze of some dead code, COMMENT: which make the slicer think that the destination of the goto is the diff --git a/tests/slicing/ex_spec_interproc.i b/tests/slicing/ex_spec_interproc.i index 4ed253d83230a9a9bfa46d3ae17cc98ea82de2c4..91e75145ae1611963999c30881a7d3bb1d6ed7c0 100644 --- a/tests/slicing/ex_spec_interproc.i +++ b/tests/slicing/ex_spec_interproc.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/ex_spec_interproc.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/ex_spec_interproc.cmxs - OPT: -deps -journal-disable + OPT: -val-show-progress -deps -journal-disable */ int X, Y; diff --git a/tests/slicing/ex_spec_interproc.ml b/tests/slicing/ex_spec_interproc.ml index f69673da610dd8fe712fa4a31158f3e55ce1c2b8..a97a0bbebbd542fce41da037a0f1dd13105e4f30 100644 --- a/tests/slicing/ex_spec_interproc.ml +++ b/tests/slicing/ex_spec_interproc.ml @@ -16,11 +16,11 @@ let main _ = let kf_main = Globals.Functions.find_def_by_name "main" in (* add a request to select f result (output 0) in the project *) - let select_f_out0 project = - let ff_f = !S.Slice.create project kf_f in - let select = select_retres project kf_f in - !S.Request.add_slice_selection_internal project ff_f select; - print_requests project; + let select_f_out0 () = + let ff_f = Slicing.Api.Slice.create kf_f in + let select = select_retres kf_f in + Slicing.Api.Request.add_slice_selection_internal ff_f select; + print_requests (); ff_f in @@ -29,82 +29,82 @@ let main _ = (* DEBUT DU TEST *) (*=========================================================================*) (* mode DontSliceCalls *) - !Db.Slicing.set_modes ~calls:0 () ; + Slicing.Api.set_modes ~calls:0 () ; - let project = mk_project () in - let _ff_f = select_f_out0 project in - !S.Request.apply_all_internal project; print_project project; - extract_and_print project; + Slicing.Api.Project.reset_slicing (); + let _ff_f = select_f_out0 () in + Slicing.Api.Request.apply_all_internal (); print_project (); + extract_and_print (); (*=========================================================================*) (* mode PropagateMarksOnly *) - !Db.Slicing.set_modes ~calls:1 () ; + Slicing.Api.set_modes ~calls:1 () ; - let project = mk_project () in - let _ff_f = select_f_out0 project in - !S.Request.apply_all_internal project; print_project project; - extract_and_print project; + Slicing.Api.Project.reset_slicing (); + let _ff_f = select_f_out0 () in + Slicing.Api.Request.apply_all_internal (); print_project (); + extract_and_print (); (*=========================================================================*) (* mode MinimizeNbCalls *) - !Db.Slicing.set_modes ~calls:2 () ; + Slicing.Api.set_modes ~calls:2 () ; - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); (* slice 'f' to compute its result (output 0) and propagate to 'g' *) - let ff_f = select_f_out0 project in - !S.Request.apply_all_internal project; print_project project; + let ff_f = select_f_out0 () in + Slicing.Api.Request.apply_all_internal (); print_project (); (* call 'f' slice in 'main' *) - let ff_main = !S.Slice.create project kf_main in - !S.Request.add_call_slice project ~caller:ff_main ~to_call:ff_f; - !S.Request.apply_all_internal project; - print_project project; + let ff_main = Slicing.Api.Slice.create kf_main in + Slicing.Api.Request.add_call_slice ~caller:ff_main ~to_call:ff_f; + Slicing.Api.Request.apply_all_internal (); + print_project (); - extract_and_print project; + extract_and_print (); (*---------------------------------------------- *) (* test remove_slice and select_stmt_computation *) (* we remove ff_main : ff_f should not be called anymore *) - !S.Slice.remove project ff_main; - print_project project; + Slicing.Api.Slice.remove ff_main; + print_project (); (* try to change ff_f to check that ff_main is not in its called_by anymore *) (* select "a" before inst 14 (d++) *) (* VP: initial value of 34 does not refer to d++ (was 30) 9 corresponds to d++. old ki 34 corresponds to return(X), new ki 13 *) - print_stmt project kf_f; + print_stmt kf_f; let ki = get_stmt 10(*34*) in (* d++ *) - let select = select_data_before_stmt "a" ki project kf_f in - !S.Request.add_slice_selection_internal project ff_f select; - print_requests project; - !S.Request.apply_all_internal project; print_project project; + let select = select_data_before_stmt "a" ki kf_f in + Slicing.Api.Request.add_slice_selection_internal ff_f select; + print_requests (); + Slicing.Api.Request.apply_all_internal (); print_project (); (*=========================================================================*) (* Test 'extract' when there are 2 slices for the same function *) - !Db.Slicing.set_modes ~calls:2 () ; - let project = mk_project () in + Slicing.Api.set_modes ~calls:2 () ; + Slicing.Api.Project.reset_slicing (); - let ff_f_1 = !S.Slice.create project kf_f in - let select = select_retres project kf_f in - !S.Request.add_slice_selection_internal project ff_f_1 select; + let ff_f_1 = Slicing.Api.Slice.create kf_f in + let select = select_retres kf_f in + Slicing.Api.Request.add_slice_selection_internal ff_f_1 select; - let ff_f_2 = !S.Slice.create project kf_f in - let select = select_data "Z" project kf_f in - !S.Request.add_slice_selection_internal project ff_f_2 select; + let ff_f_2 = Slicing.Api.Slice.create kf_f in + let select = select_data "Z" kf_f in + Slicing.Api.Request.add_slice_selection_internal ff_f_2 select; - !S.Request.apply_all_internal project; + Slicing.Api.Request.apply_all_internal (); print_ff ff_f_2; - extract_and_print project; + extract_and_print (); (*=========================================================================*) (* mode PreciseSlices *) - !Db.Slicing.set_modes ~calls:3 () ; + Slicing.Api.set_modes ~calls:3 () ; - let project = test_select_retres ~do_prop_to_callers:true "f" in + test_select_retres ~do_prop_to_callers:true "f"; - print_project project;; + print_project ();; (*=========================================================================*) let () = Db.Main.extend main diff --git a/tests/slicing/filter.i b/tests/slicing/filter.i index d41f7e84053595207530515cbc6d57b8a075fb6a..28f253a5cb38df9c75c51f1d5fdf5c7f28968d2f 100644 --- a/tests/slicing/filter.i +++ b/tests/slicing/filter.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i **/ /* TESTS: this is about [filter] optimisations since sometimes, * slicing results are ok, but the generated new project is not correct. */ diff --git a/tests/slicing/forall_loop_invariant.i b/tests/slicing/forall_loop_invariant.i index 6b5dd549078069e51df148794331d04a2bdb9a35..8ba60fc949f7111887299df5be3c6de46f994ad7 100644 --- a/tests/slicing/forall_loop_invariant.i +++ b/tests/slicing/forall_loop_invariant.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-assert main -then-on 'Slicing export' -print -then-on default -slice-value t -then-on 'Slicing export 2' -print -check -set-project-as-default -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -slice-assert main -then-on 'Slicing export' -print -then-on default -slice-value t -then-on 'Slicing export 2' -print -check -set-project-as-default -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps **/ diff --git a/tests/slicing/horwitz.i b/tests/slicing/horwitz.i index 5cbca9e2e39226e7235985ab26c33570b15a664c..1ee794f6b043f705d8bbe673369e56b96e616598 100644 --- a/tests/slicing/horwitz.i +++ b/tests/slicing/horwitz.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/horwitz.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/horwitz.cmxs - OPT: -deps -slicing-level 0 -journal-disable + OPT: -val-show-progress -deps -slicing-level 0 -journal-disable */ /* bin/toplevel.opt -deps -val tests/slicing/horwitz.c */ diff --git a/tests/slicing/horwitz.ml b/tests/slicing/horwitz.ml index ea2a7fe8bc518823122ec60fedaef89e7569b470..f897fa15e85842c275955a33c927714f609adda0 100644 --- a/tests/slicing/horwitz.ml +++ b/tests/slicing/horwitz.ml @@ -7,7 +7,7 @@ tests/slicing/horwitz.byte -deps tests/slicing/horwitz.c include LibSelect;; -let () = +let () = Db.Main.extend (fun _ -> ignore (test_select_data ~do_prop_to_callers:true "incr" "*pi"));; diff --git a/tests/slicing/if_many_values.i b/tests/slicing/if_many_values.i index 955ddde53d993caba360f463df19981ff7ee3883..a0fdf4f6bdf984e2253c56d79e65c21c9de95c97 100644 --- a/tests/slicing/if_many_values.i +++ b/tests/slicing/if_many_values.i @@ -1,5 +1,5 @@ /* run.config - OPT: -check -slice-value r -journal-disable -slevel 101 -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -slice-value r -journal-disable -slevel 101 -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps **/ int r=1; diff --git a/tests/slicing/initialized.i b/tests/slicing/initialized.i index db0808f47bada41de9b33b8308b82ffb7e194289..02472ce0a83eba7dd2990fda6bf81c84815f8140 100644 --- a/tests/slicing/initialized.i +++ b/tests/slicing/initialized.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-assert main -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -slice-assert main -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check **/ void main() { diff --git a/tests/slicing/keep_annot.i b/tests/slicing/keep_annot.i index 79a205b88b49fcdd3838c0a2375ac4a0461d7dc8..3b4efa002b0cf8a8054d5b500ae166ad30819083 100644 --- a/tests/slicing/keep_annot.i +++ b/tests/slicing/keep_annot.i @@ -1,9 +1,9 @@ /* run.config - OPT: -context-valid-pointers -lib-entry -main f -slice-assert f -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -context-valid-pointers -lib-entry -main f -slice-assert f -slicing-keep-annotations -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -context-valid-pointers -lib-entry -main L -slice-pragma L -slicing-keep-annotations -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -context-valid-pointers -lib-entry -main L -slice-pragma L -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -slice-return bts1110 -main bts1110 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -context-valid-pointers -lib-entry -main f -slice-assert f -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -context-valid-pointers -lib-entry -main f -slice-assert f -slicing-keep-annotations -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -context-valid-pointers -lib-entry -main L -slice-pragma L -slicing-keep-annotations -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -context-valid-pointers -lib-entry -main L -slice-pragma L -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -slice-return bts1110 -main bts1110 -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ diff --git a/tests/slicing/libAnim.ml b/tests/slicing/libAnim.ml index 910d60f61f1bb50c1e84873b39a91bd66507f726..a71ec650781bd5f599018550b7da38dc79315fe3 100644 --- a/tests/slicing/libAnim.ml +++ b/tests/slicing/libAnim.ml @@ -3,11 +3,11 @@ (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) let use_dot = - Sys.os_type <> "Win32" - && (Unix.WEXITED 0) = Unix.system ("which dot > /dev/null 2>&1") + Sys.os_type <> "Win32" + && (Unix.WEXITED 0) = Unix.system ("which dot > /dev/null 2>&1") (* function to append [string_of_int n] on 3 char to basename. *) -let nth_name basename n = +let nth_name basename n = assert (n < 1000); let str_n = string_of_int n in let str_n = if n < 100 then ("0"^str_n) else str_n in @@ -16,11 +16,11 @@ let nth_name basename n = ;; (* generate the nth .jpg file (generate to .dot file and then remove it) *) -let print_proj basename title proj n = +let print_proj basename title n = let name = nth_name basename n in let dot_name = (name^".dot") in let jpg_name = (name^".jpg") in - !Db.Slicing.Project.print_dot ~filename:dot_name ~title:title proj; + Slicing.Api.Project.print_dot ~filename:dot_name ~title:title; if use_dot then ignore (Sys.command ("dot -Tjpg -o "^jpg_name^" "^dot_name^" 2>/dev/null")); Sys.remove dot_name; @@ -30,14 +30,14 @@ let print_proj basename title proj n = (* apply all requests of the project and generate a .jpg file for each step. * (begin at number [n]) *) -let build_all_graphs basename title proj first_n = +let build_all_graphs basename title first_n = Format.printf "Processing %s : " basename; let rec next n = Format.printf ".@?"; try - !Db.Slicing.Request.apply_next_internal proj; + Slicing.Api.Request.apply_next_internal (); let title = title^" ("^(string_of_int (n - first_n))^")" in - let n = print_proj basename title proj n in + let n = print_proj basename title n in next n with Not_found -> n in @@ -59,7 +59,7 @@ let print_help basename = Format.printf "After that, you can clear the generated files with:@\n\t%s@." clean_cmd -let remove_all_files basename = +let remove_all_files basename = Format.printf "removing generated .jpg files@."; ignore (Sys.command (clean_cmd basename)) diff --git a/tests/slicing/libSelect.ml b/tests/slicing/libSelect.ml index fdd18f6a082af1cc1a73cd72511cd8fea0a0bac3..39a9a84a8ea49c3c2fff568e972716c60b05ad56 100644 --- a/tests/slicing/libSelect.ml +++ b/tests/slicing/libSelect.ml @@ -8,8 +8,6 @@ exception No_return exception Unknown_data of string exception Unknown_stmt of int -module S = Db.Slicing - (*--------------------------*) (* Useful functions to find and print thinks *) @@ -26,34 +24,29 @@ let find_kf fct_name = Globals.Functions.find_by_name fct_name let fmt = Format.std_formatter;; -(* affichage des numéros d'instructions -* pour servir d'entrée à d'autres commandes*) -let print_stmt project kf = - Slicing.PrintSlice.print_fct_stmts fmt (project, kf) +(* print instruction number (used as input by other functions) *) +let print_stmt kf = + Slicing.PrintSlice.print_fct_stmts fmt kf -(* affichage de debug du PDG *) -let print_pdg _project kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) ;; +(* print PDG (for debugging purposes) *) +let print_pdg kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) ;; -let print_ff ff = !S.Slice.pretty fmt ff +let print_ff ff = Slicing.Api.Slice.pretty fmt ff -(* affichage du projet : fonctions avec leur marques + actions en attente *) -let print_project project = !S.Project.pretty fmt project ;; +(* print the project (functions with their marks + pending actions) *) +let print_project () = Slicing.Api.Project.pretty fmt ;; -(* affichage des actions en attente *) -let print_requests project = !S.Request.pretty fmt project ;; +(* print pending actions *) +let print_requests () = Slicing.Api.Request.pretty fmt ;; -(* construit l'application correspondant au projet, et affiche le résultat *) -let extract_and_print project = - let prj = !S.Project.extract "Sliced code" project in +(* build the application and print the result *) +let extract_and_print () = + let prj = Slicing.Api.Project.extract "Sliced code" in File.pretty_ast ~prj () - (*--------------------------*) -let project_number = ref 0 - -let mk_project () = project_number := !project_number + 1 ; !S.Project.mk_project ("slicing_" ^ (string_of_int !project_number)) -let apply project = !S.Request.apply_next_internal project; print_project project +let apply () = Slicing.Api.Request.apply_next_internal (); print_project () (*--------------------------*) @@ -83,65 +76,65 @@ let get_stmt sid = fst (Kernel_function.find_from_sid sid) let get_zones str_data (kinst, kf) = let lval_term = !Db.Properties.Interp.term_lval kf str_data in let lval = !Db.Properties.Interp.term_lval_to_lval ~result:None lval_term in - let loc = !Db.Value.lval_to_loc ~with_alarms:CilE.warn_none_mode (Cil_types.Kstmt kinst) lval in - Locations.enumerate_valid_bits ~for_writing:false loc + let loc = !Db.Value.lval_to_loc (Cil_types.Kstmt kinst) lval in + Locations.enumerate_valid_bits ~for_writing:false loc ;; -let select_data_before_stmt str_data kinst _project kf = - let mark = !S.Mark.make ~data:true ~addr:false ~ctrl:false in +let select_data_before_stmt str_data kinst kf = + let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in let zone = get_zones str_data (kinst, kf) in - !S.Select.select_stmt_zone_internal kf kinst true zone mark + Slicing.Api.Select.select_stmt_zone_internal kf kinst true zone mark (** build the selection for returned value of the function *) -let select_retres _project kf = +let select_retres kf = let ki = Kernel_function.find_return kf in try let loc = Db.Value.find_return_loc kf in - let zone = - Locations.enumerate_valid_bits - ~for_writing:false - loc + let zone = + Locations.enumerate_valid_bits + ~for_writing:false + loc in - let mark = !S.Mark.make ~data:true ~addr:false ~ctrl:false in + let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in let before = false in - !S.Select.select_stmt_zone_internal kf ki before zone mark + Slicing.Api.Select.select_stmt_zone_internal kf ki before zone mark with Db.Value.Void_Function -> raise No_return ;; (** build the selection for the [data] at the end of the function *) -let select_data data _project kf = +let select_data data kf = try let ki = Kernel_function.find_return kf in - let mark = !S.Mark.make ~data:true ~addr:false ~ctrl:false in + let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in let zone = get_zones data (ki, kf) in - !S.Select.select_stmt_zone_internal kf ki true zone mark + Slicing.Api.Select.select_stmt_zone_internal kf ki true zone mark (* with Logic_interp.Error (_, str) -> raise (Unknown_data data) *) with _ -> raise (Unknown_data data) ;; (** build the selection ONLY for the control dependencies of the statement * [numstmt]*) -let select_ctrl numstmt _project kf = +let select_ctrl numstmt kf = try let s = get_stmt numstmt in (* - let mark = !S.Mark.make ~data:false ~addr:false ~ctrl:true in - !S.Select.select_stmt_internal kf ki mark + let mark = Slicing.Api.Mark.make ~data:false ~addr:false ~ctrl:true in + Slicing.Api.Select.select_stmt_internal kf ki mark *) - !S.Select.select_stmt_ctrl_internal kf s + Slicing.Api.Select.select_stmt_ctrl_internal kf s with _ -> raise (Unknown_stmt numstmt) ;; (** build recursively all the change_call for all the callers to kf in * order to call ff instead. *) -let prop_to_callers project (kf, ff) = +let prop_to_callers (kf, ff) = let rec prop kf ff = let callers = !Db.Value.callers kf in let process_caller (kf_caller,_) = - let ff_caller = !S.Slice.create project kf_caller in - !S.Request.add_call_slice project ~caller:ff_caller ~to_call:ff; + let ff_caller = Slicing.Api.Slice.create kf_caller in + Slicing.Api.Request.add_call_slice ~caller:ff_caller ~to_call:ff; prop kf_caller ff_caller in List.iter process_caller callers @@ -152,35 +145,30 @@ let prop_to_callers project (kf, ff) = * [select_fct] (which could be [select_retres] or [(select_data str_data)]. * If [do_prop_to_callers] if also recursively computes new functions for * [fname] callers in order to call the new slices. *) -let test ?project fname ?(do_prop_to_callers=false) select_fct = - let project = match project with - | None -> mk_project () - | Some project -> project - in begin - try - let kf = Globals.Functions.find_def_by_name fname in - let ff = !S.Slice.create project kf in - let select = select_fct project kf in - !S.Request.add_slice_selection_internal project ff select; - if do_prop_to_callers then - begin - !S.Request.apply_all_internal project; - prop_to_callers project (kf, ff) - end; - let fmt = Format.std_formatter in - !S.Request.pretty fmt project; - (* !S.Request.apply_next_internal project *) - (* !S.Project.pretty fmt project *) - extract_and_print project - with - | No_return -> - Format.printf - "Impossible to select 'retres' for a void function (%s)\n" fname - | Unknown_data str -> - Format.printf - "Impossible to select this data : %s in %s\n" str fname - end; - project +let test ?(keep_project=false) fname ?(do_prop_to_callers=false) select_fct = + if not keep_project then Slicing.Api.Project.reset_slicing (); + try + let kf = Globals.Functions.find_def_by_name fname in + let ff = Slicing.Api.Slice.create kf in + let select = select_fct kf in + Slicing.Api.Request.add_slice_selection_internal ff select; + if do_prop_to_callers then + begin + Slicing.Api.Request.apply_all_internal (); + prop_to_callers (kf, ff) + end; + let fmt = Format.std_formatter in + Slicing.Api.Request.pretty fmt; + (* Slicing.Api.Request.apply_next_internal *) + (* Slicing.Api.Project.pretty fmt *) + extract_and_print () + with + | No_return -> + Format.printf + "Impossible to select 'retres' for a void function (%s)\n" fname + | Unknown_data str -> + Format.printf + "Impossible to select this data : %s in %s\n" str fname ;; let test_select_retres ?(do_prop_to_callers=false) fname = diff --git a/tests/slicing/loop_infinite.i b/tests/slicing/loop_infinite.i index d07912fe778b226ae2871a588b1f1ad5cb92a03c..578703cca0194042134e14f048a005cdbde9fba5 100644 --- a/tests/slicing/loop_infinite.i +++ b/tests/slicing/loop_infinite.i @@ -1,5 +1,5 @@ /* run.config - OPT: -check -deps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps */ int main() { volatile int a=0,b,c; diff --git a/tests/slicing/loop_simple.i b/tests/slicing/loop_simple.i index 2d9cea68eea662f4f3f7cdbfe5e90cb9182d006b..035a45a338fb8180c281e13dd028877be7517a2e 100644 --- a/tests/slicing/loop_simple.i +++ b/tests/slicing/loop_simple.i @@ -1,5 +1,5 @@ /* run.config - OPT: -deps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ int main() { int a,c; volatile int b = 0; diff --git a/tests/slicing/loops.i b/tests/slicing/loops.i index d4a8e7179cd4e0385bc4e6d7f3f2f12853984ca7..067b5185bccc58bd83102453aaf8c45c569a2a67 100644 --- a/tests/slicing/loops.i +++ b/tests/slicing/loops.i @@ -1,29 +1,29 @@ /* run.config - OPT: -deps -lib-entry -main f1 -slice-pragma f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main f1 -slice-assert f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main f2 -slice-pragma f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main f2 -slice-assert f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main test_infinite_loop_3 -slice-value G -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main test_infinite_loop_4 -slice-value G -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main test_infinite_loop_5 -slice-value G -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main loop -slice-value Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-calls loop -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-pragma loop -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-assert loop -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main loop -slice-rd Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main loop -slice-rd Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main loop -slice-wr Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -main loop -slice-wr Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main stop_f1 -slice-pragma stop_f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main stop_f1 -slice-assert stop_f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main stop_f2 -slice-pragma stop_f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main stop_f2 -slice-assert stop_f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-value Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-rd Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-rd Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-wr Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -slice-wr Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps - OPT: -deps -lib-entry -main alarm -slice-threat alarm -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main f1 -slice-pragma f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main f1 -slice-assert f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main f2 -slice-pragma f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main f2 -slice-assert f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main test_infinite_loop_3 -slice-value G -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main test_infinite_loop_4 -slice-value G -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main test_infinite_loop_5 -slice-value G -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main loop -slice-value Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-calls loop -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-pragma loop -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-assert loop -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main loop -slice-rd Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main loop -slice-rd Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main loop -slice-wr Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -main loop -slice-wr Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main stop_f1 -slice-pragma stop_f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main stop_f1 -slice-assert stop_f1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main stop_f2 -slice-pragma stop_f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main stop_f2 -slice-assert stop_f2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-value Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-rd Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-rd Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-wr Y -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -slice-wr Z -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps + OPT: -val-show-progress -deps -lib-entry -main alarm -slice-threat alarm -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-deps */ diff --git a/tests/slicing/mark_all_slices.i b/tests/slicing/mark_all_slices.i index 278136f554173a0113a00f5a00e4cdfe9fffe66a..634de629e98d92027d44554e624c33f6e62c5435 100644 --- a/tests/slicing/mark_all_slices.i +++ b/tests/slicing/mark_all_slices.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/mark_all_slices.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/mark_all_slices.cmxs - OPT: -deps -slicing-level 3 -no-slice-callers -journal-disable + OPT: -val-show-progress -deps -slicing-level 3 -no-slice-callers -journal-disable */ int A, B, C, D; int A2, B2, C2, D2; diff --git a/tests/slicing/mark_all_slices.ml b/tests/slicing/mark_all_slices.ml index 9f987b939abbde7811e39822baf396bf2ddbf583..0f0ca762df66af1c6f065329b1d14fb81aca0cb7 100644 --- a/tests/slicing/mark_all_slices.ml +++ b/tests/slicing/mark_all_slices.ml @@ -15,59 +15,59 @@ let main _ = (*~~~~~~~~~~~~ Project 1 : *) - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); let kf_main = Globals.Functions.find_def_by_name "main" in let kf_all = Globals.Functions.find_def_by_name "all" in (* create main_1 and select A2 in it *) - let ff_main = !S.Slice.create project kf_main in - let select = select_data "A2" project kf_main in - !S.Request.add_slice_selection_internal project ff_main select; - !S.Request.apply_all_internal project; - extract_and_print project; + let ff_main = Slicing.Api.Slice.create kf_main in + let select = select_data "A2" kf_main in + Slicing.Api.Request.add_slice_selection_internal ff_main select; + Slicing.Api.Request.apply_all_internal (); + extract_and_print (); (* add a global selection in 'all' to always compute its result. * This should modify the existing slice (all_1) * *) - let select = select_retres project kf_all in - !S.Request.add_selection_internal project select; - !S.Request.apply_next_internal project; - print_requests project; - !S.Request.apply_all_internal project; - extract_and_print project; + let select = select_retres kf_all in + Slicing.Api.Request.add_selection_internal select; + Slicing.Api.Request.apply_next_internal (); + print_requests (); + Slicing.Api.Request.apply_all_internal (); + extract_and_print (); (* select B2 in main_1 : this should create a second slice all_2 * and its result should be computed even if it is not needed by this request *) - let select = select_data "B2" project kf_main in - !S.Request.add_slice_selection_internal project ff_main select; - !S.Request.apply_next_internal project; - print_requests project; - !S.Request.apply_all_internal project; - extract_and_print project; + let select = select_data "B2" kf_main in + Slicing.Api.Request.add_slice_selection_internal ff_main select; + Slicing.Api.Request.apply_next_internal (); + print_requests (); + Slicing.Api.Request.apply_all_internal (); + extract_and_print (); (*~~~~~~~~~~~~ Project 2 : *) - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); let kf_main = Globals.Functions.find_def_by_name "main" in let kf_all = Globals.Functions.find_def_by_name "all" in (* first all the global selection in 'all' to always compute its result. * This creates a first all_1 slice : I am not sure that this should be done. * *) - let select = select_retres project kf_all in - !S.Request.add_selection_internal project select; - !S.Request.apply_next_internal project; - print_requests project; - !S.Request.apply_all_internal project; - extract_and_print project; + let select = select_retres kf_all in + Slicing.Api.Request.add_selection_internal select; + Slicing.Api.Request.apply_next_internal (); + print_requests (); + Slicing.Api.Request.apply_all_internal (); + extract_and_print (); (* create main_1 and select A2 in it : this will create a new slice for all * that computes A and the result. *) - let ff_main = !S.Slice.create project kf_main in - let select = select_data "A2" project kf_main in - !S.Request.add_slice_selection_internal project ff_main select; - !S.Request.apply_all_internal project; - extract_and_print project + let ff_main = Slicing.Api.Slice.create kf_main in + let select = select_data "A2" kf_main in + Slicing.Api.Request.add_slice_selection_internal ff_main select; + Slicing.Api.Request.apply_all_internal (); + extract_and_print () let () = Db.Main.extend main diff --git a/tests/slicing/merge.i b/tests/slicing/merge.i index ff8df9a76008b92810e69260669e1dbd716095d9..c578d373ec4052843f5e77ae3cc63bb0d9c75911 100644 --- a/tests/slicing/merge.i +++ b/tests/slicing/merge.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/merge.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/libAnim.cmxs -load-module tests/slicing/merge.cmxs - OPT: -deps -slicing-level 3 -journal-disable + OPT: -val-show-progress -deps -slicing-level 3 -journal-disable */ int G1, G2, G3; diff --git a/tests/slicing/merge.ml b/tests/slicing/merge.ml index f14fca3651496c2b47534c5ecdee63deb2a01cf3..3b12cf6728f01660e87da29ada7c4c7a0e434f1f 100644 --- a/tests/slicing/merge.ml +++ b/tests/slicing/merge.ml @@ -14,7 +14,7 @@ include LibSelect;; let main _ = let proj_name = "slicing_merge" in - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); let kf_init = Globals.Functions.find_def_by_name "init" in let _kf_add = Globals.Functions.find_def_by_name "add" in @@ -24,17 +24,17 @@ let main _ = (* build graphs representation if there is something in [anim_title] *) let build_slice kf data n anim_title apply = - let ff = !S.Slice.create project kf in - let select = select_data data project kf in - let _ = !S.Request.add_slice_selection_internal project ff select in - let n = + let ff = Slicing.Api.Slice.create kf in + let select = select_data data kf in + Slicing.Api.Request.add_slice_selection_internal ff select; + let n = if anim_title = "" - then (if apply then !S.Request.apply_all_internal project; n) - else LibAnim.build_all_graphs proj_name anim_title project n + then (if apply then Slicing.Api.Request.apply_all_internal (); n) + else LibAnim.build_all_graphs proj_name anim_title n in n, ff in - ignore (LibAnim.print_proj proj_name "Beginning" project n); + ignore (LibAnim.print_proj proj_name "Beginning" n); let n = n+1 in let title = "Select G1 in init" in @@ -45,7 +45,7 @@ let main _ = (* Format.printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";; Format.printf "=== Function g_1 computes G1 and should call init_1 :\n"; - !S.Project.export None project;; + Slicing.Api.Project.extract "merge_1";; Format.printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";; *) @@ -58,31 +58,31 @@ let main _ = (* Format.printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";; Format.printf "=== g_2 should call init_2 and g_3, init_3 :\n"; - !S.Project.export None project;; + Slicing.Api.Project.extract "merge_2";; Format.printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";; *) - ignore (LibAnim.print_proj proj_name "After selections" project n); + ignore (LibAnim.print_proj proj_name "After selections" n); let n = n+1 in - ignore (!S.Request.merge_slices project ff_init1 ff_init2 ~replace:true); + ignore (Slicing.Api.Request.merge_slices ff_init1 ff_init2 ~replace:true); let title = "merging init_1 and init_2" in - ignore (LibAnim.print_proj proj_name title project n); + ignore (LibAnim.print_proj proj_name title n); let n = n+1 in let title = "merging init_1 and init_2" in - let n = LibAnim.build_all_graphs proj_name title project n in + let n = LibAnim.build_all_graphs proj_name title n in - !S.Slice.remove project ff_init1; - !S.Slice.remove project ff_init2; + Slicing.Api.Slice.remove ff_init1; + Slicing.Api.Slice.remove ff_init2; let title = "After removing init_1 and init_2" in - ignore (LibAnim.print_proj proj_name title project n); + ignore (LibAnim.print_proj proj_name title n); let _n = n+1 in - let _ = !S.Request.copy_slice project ff_g3 in + let _ = Slicing.Api.Request.copy_slice ff_g3 in - extract_and_print project; + extract_and_print (); (* in automatic tests, we remove the generated files. * Change [view_graphs] below to be able to display the graphs *) diff --git a/tests/slicing/min_call.i b/tests/slicing/min_call.i index d2e21555304f95e58b40396cdbd7918c397e932f..064635c912c0a786bbaeb427da2505aa41691692 100644 --- a/tests/slicing/min_call.i +++ b/tests/slicing/min_call.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/min_call.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/min_call.cmxs - OPT: -deps -lib-entry -main g -journal-disable -slicing-level 3 + OPT: -val-show-progress -deps -lib-entry -main g -journal-disable -slicing-level 3 */ /* dummy source file in order to test minimal calls feature diff --git a/tests/slicing/min_call.ml b/tests/slicing/min_call.ml index d0862bf7ce86f7699a6ae2890a725790001a2c6f..de1b11726f2ce2c0f84dcaa1a34a626845603e33 100644 --- a/tests/slicing/min_call.ml +++ b/tests/slicing/min_call.ml @@ -14,14 +14,14 @@ let main _ = let _kf_f = Globals.Functions.find_def_by_name "f" in let _kf_g = Globals.Functions.find_def_by_name "g" in - let _top_mark = !Db.Slicing.Mark.make ~addr:true ~ctrl:true ~data:true in - - let add_select_fun_calls project to_call = - let selections = Db.Slicing.Select.empty_selects in - let selections = - !Db.Slicing.Select.select_func_calls_into selections ~spare:false to_call - in - !Db.Slicing.Request.add_persistent_selection project selections + let _top_mark = Slicing.Api.Mark.make ~addr:true ~ctrl:true ~data:true in + + let add_select_fun_calls to_call = + let selections = Slicing.Api.Select.empty_selects in + let selections = + Slicing.Api.Select.select_func_calls_into selections ~spare:false to_call + in + Slicing.Api.Request.add_persistent_selection selections in (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (* Project1 : @@ -30,39 +30,39 @@ let main _ = * Then create manually a second slice for [k] : * the call to [send_bis] is visible as wished. *) - let project = mk_project() in + Slicing.Api.Project.reset_slicing (); (*let pdg_k = !Db.Pdg.get kf_k;;*) let calls = !Db.Pdg.find_call_stmts ~caller:kf_k(*pdg_k*) kf_send_bis in let sb_call = match calls with c::[] -> c | _ -> assert false in - let mark = !S.Mark.make ~data:true ~addr:false ~ctrl:false in - let select = !S.Select.select_stmt_internal kf_k sb_call mark in - !S.Request.add_selection_internal project select ; - !S.Request.apply_all_internal project; + let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in + let select = Slicing.Api.Select.select_stmt_internal kf_k sb_call mark in + Slicing.Api.Request.add_selection_internal select ; + Slicing.Api.Request.apply_all_internal (); Log.print_on_output (fun fmt -> Format.fprintf fmt "@[Project1 - result1 :@\n@]") ; - extract_and_print project; + extract_and_print (); - let _ff2_k = !S.Slice.create project kf_k in + let _ff2_k = Slicing.Api.Slice.create kf_k in Log.print_on_output (fun fmt -> Format.fprintf fmt "@[Project1 - result2 :@\n@]") ; - !S.Project.pretty fmt project; - extract_and_print project; + Slicing.Api.Project.pretty fmt; + extract_and_print (); (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (* Project2 : * same than project1, except that we use [select_min_call_internal]. * But as [send_bis] is an undefined function, this makes no difference. *) - let project = mk_project() in + Slicing.Api.Project.reset_slicing (); (*let pdg_k = !Db.Pdg.get kf_k;;*) let calls = !Db.Pdg.find_call_stmts (*pdg_k*)~caller:kf_k kf_send_bis in let sb_call = match calls with c::[] -> c | _ -> assert false in - let mark = !S.Mark.make ~data:true ~addr:false ~ctrl:false in - let select = !S.Select.select_min_call_internal kf_k sb_call mark in - !S.Request.add_selection_internal project select ; - print_requests project; - !S.Request.apply_all_internal project; + let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in + let select = Slicing.Api.Select.select_min_call_internal kf_k sb_call mark in + Slicing.Api.Request.add_selection_internal select ; + print_requests (); + Slicing.Api.Request.apply_all_internal (); Log.print_on_output (fun fmt -> Format.fprintf fmt "@[Project3 - result :@\n@]") ; - !S.Project.pretty fmt project; - extract_and_print project; + Slicing.Api.Project.pretty fmt; + extract_and_print (); (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) (* Project3 : @@ -71,15 +71,15 @@ let main _ = * [f_1] is also called in [g_1] because it calls [k_1]. *) - let project = mk_project() in - add_select_fun_calls project kf_k; - print_requests project; - !S.Request.apply_next_internal project; - print_requests project; - !S.Request.apply_all_internal project; + Slicing.Api.Project.reset_slicing (); + add_select_fun_calls kf_k; + print_requests (); + Slicing.Api.Request.apply_next_internal (); + print_requests (); + Slicing.Api.Request.apply_all_internal (); Log.print_on_output (fun fmt -> Format.fprintf fmt "@[Project3 - result :@\n@]") ; - !S.Project.pretty fmt project; - extract_and_print project + Slicing.Api.Project.pretty fmt; + extract_and_print () (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) @@ -95,19 +95,19 @@ let project = mk_project();; add_select_fun_calls project kf_send;; print_requests project;; -!S.Request.apply_next_internal project;; +Slicing.Api.Request.apply_next_internal project;; print_requests project;; -!S.Request.apply_all_internal project;; +Slicing.Api.Request.apply_all_internal project;; Format.printf "@[CAS 1 - step 1+2 - result :@\n@]";; extract_and_print project;; add_select_fun_calls project kf_send_bis;; print_requests project;; -!S.Request.apply_all_internal project;; +Slicing.Api.Request.apply_all_internal project;; Format.printf "@[CAS 1 - step 3+4 - result :@\n@]";; -!S.Project.pretty fmt project;; +Slicing.Api.Project.pretty fmt project;; extract_and_print project;; *) @@ -124,7 +124,7 @@ add_select_fun_calls project kf_send_bis;; print_requests project;; Format.printf "@[Project 5 - result :@\n@]";; -!S.Project.pretty fmt project;; +Slicing.Api.Project.pretty fmt project;; extract_and_print project;; *) (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*) diff --git a/tests/slicing/oracle/adpcm.res.oracle b/tests/slicing/oracle/adpcm.res.oracle index 7aae5988a24704ecfd09a3ef31c70d87fcd153be..33ee07fe22f075a6aeb6a4cb52c42249425e325d 100644 --- a/tests/slicing/oracle/adpcm.res.oracle +++ b/tests/slicing/oracle/adpcm.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/adpcm.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -1508,7 +1507,7 @@ tests/test/adpcm.c:557:[value] warning: signed overflow. assert -2147483648 ≤ wh_code_table[0..3]; nbh; delay_dhx[0..5]; delay_bph[0..5]; ah1; ah2; ph1; ph2; rh1; rh2; test_data[0..9] (and SELF) [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function uppol2 [pdg] done for function uppol2 [slicing] applying all slicing requests... @@ -1518,7 +1517,7 @@ tests/test/adpcm.c:557:[value] warning: signed overflow. assert -2147483648 ≤ [pdg] done for function encode [pdg] computing for function main [pdg] done for function main -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [main_slice_1 = change_call for call 280 -> encode_slice_1][encode_slice_1 = change_call for call 108 -> uppol2_slice_1][encode_slice_1 = change_call for call 81 -> uppol2_slice_1] [slicing] exporting project to 'Sliced code'... @@ -1824,20 +1823,16 @@ void encode_slice_1(int xin1, int xin2) int tmp_13; h_ptr = h; tqmf_ptr = tqmf; - { /* sequence */ - tmp = tqmf_ptr; - tqmf_ptr ++; - tmp_0 = h_ptr; - h_ptr ++; - xa = (long)*tmp * (long)*tmp_0; - } - { /* sequence */ - tmp_1 = tqmf_ptr; - tqmf_ptr ++; - tmp_2 = h_ptr; - h_ptr ++; - xb = (long)*tmp_1 * (long)*tmp_2; - } + tmp = tqmf_ptr; + tqmf_ptr ++; + tmp_0 = h_ptr; + h_ptr ++; + xa = (long)*tmp * (long)*tmp_0; + tmp_1 = tqmf_ptr; + tqmf_ptr ++; + tmp_2 = h_ptr; + h_ptr ++; + xb = (long)*tmp_1 * (long)*tmp_2; i = 0; /*@ loop pragma UNROLL 11; */ while (i < 10) { @@ -1846,54 +1841,42 @@ void encode_slice_1(int xin1, int xin2) int *tmp_4; int *tmp_5; int *tmp_6; - { /* sequence */ - tmp_3 = tqmf_ptr; - tqmf_ptr ++; - tmp_4 = h_ptr; - h_ptr ++; - xa += (long)*tmp_3 * (long)*tmp_4; - } - { /* sequence */ - tmp_5 = tqmf_ptr; - tqmf_ptr ++; - tmp_6 = h_ptr; - h_ptr ++; - xb += (long)*tmp_5 * (long)*tmp_6; - } + tmp_3 = tqmf_ptr; + tqmf_ptr ++; + tmp_4 = h_ptr; + h_ptr ++; + xa += (long)*tmp_3 * (long)*tmp_4; + tmp_5 = tqmf_ptr; + tqmf_ptr ++; + tmp_6 = h_ptr; + h_ptr ++; + xb += (long)*tmp_5 * (long)*tmp_6; } i ++; } - { /* sequence */ - tmp_7 = tqmf_ptr; - tqmf_ptr ++; - tmp_8 = h_ptr; - h_ptr ++; - xa += (long)*tmp_7 * (long)*tmp_8; - } - { /* sequence */ - tmp_9 = h_ptr; - xb += (long)*tqmf_ptr * (long)*tmp_9; - } + tmp_7 = tqmf_ptr; + tqmf_ptr ++; + tmp_8 = h_ptr; + h_ptr ++; + xa += (long)*tmp_7 * (long)*tmp_8; + tmp_9 = h_ptr; + xb += (long)*tqmf_ptr * (long)*tmp_9; tqmf_ptr1 = tqmf_ptr - 2; i = 0; /*@ loop pragma UNROLL 23; */ while (i < 22) { int *tmp_10; int *tmp_11; - { /* sequence */ - tmp_10 = tqmf_ptr; - tqmf_ptr --; - tmp_11 = tqmf_ptr1; - tqmf_ptr1 --; - *tmp_10 = *tmp_11; - } - i ++; - } - { /* sequence */ - tmp_12 = tqmf_ptr; + tmp_10 = tqmf_ptr; tqmf_ptr --; - *tmp_12 = xin1; + tmp_11 = tqmf_ptr1; + tqmf_ptr1 --; + *tmp_10 = *tmp_11; + i ++; } + tmp_12 = tqmf_ptr; + tqmf_ptr --; + *tmp_12 = xin1; *tqmf_ptr = xin2; xl = (int)((xa + xb) >> 15); xh = (int)((xa - xb) >> 15); @@ -1920,9 +1903,7 @@ void encode_slice_1(int xin1, int xin2) eh = xh - sh; if (eh >= 0) ih = 3; else ih = 1; decis = (int)(564L * (long)deth >> 12L); - { /* sequence */ - tmp_13 = abs_slice_1(eh); - } + tmp_13 = abs_slice_1(eh); if (tmp_13 > decis) ih --; dh = (int)((long)deth * (long)qq2_code2_table[ih] >> 15L); nbh = logsch_slice_1(ih,nbh); @@ -1946,25 +1927,21 @@ int filtez_slice_1(int *bpl, int *dlt_0) long zl; int *tmp; int *tmp_0; - { /* sequence */ - tmp = bpl; - bpl ++; - tmp_0 = dlt_0; - dlt_0 ++; - zl = (long)*tmp * (long)*tmp_0; - } + tmp = bpl; + bpl ++; + tmp_0 = dlt_0; + dlt_0 ++; + zl = (long)*tmp * (long)*tmp_0; i = 1; /*@ loop pragma UNROLL 7; */ while (i < 6) { int *tmp_1; int *tmp_2; - { /* sequence */ - tmp_1 = bpl; - bpl ++; - tmp_2 = dlt_0; - dlt_0 ++; - zl += (long)*tmp_1 * (long)*tmp_2; - } + tmp_1 = bpl; + bpl ++; + tmp_2 = dlt_0; + dlt_0 ++; + zl += (long)*tmp_1 * (long)*tmp_2; i ++; } __retres = (int)(zl >> 14); diff --git a/tests/slicing/oracle/annot.0.res.oracle b/tests/slicing/oracle/annot.0.res.oracle index 92121ccca3554dfab09fe594da00a2f0e9cb375a..81f1bca39013b356882ed119eb94717d8d873efc 100644 --- a/tests/slicing/oracle/annot.0.res.oracle +++ b/tests/slicing/oracle/annot.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at f1 @@ -15,7 +14,7 @@ tests/slicing/annot.i:11:[value] warning: signed overflow. assert (int)(x + x) - tests/slicing/annot.i:15:[value] warning: assertion got status unknown. [value] Recording results for f1 [value] done for function f1 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f1 [pdg] done for function f1 @@ -34,13 +33,11 @@ extern int x; void f1(void) { - int v; - v = 3; + int v = 3; x = 3; /*@ assert x ≡ \at(x,Pre); */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/annot.1.res.oracle b/tests/slicing/oracle/annot.1.res.oracle index f8923878616d2f71d745772e35d7baaeaec7f945..75da8fb95e14c5c801f2bb16049d9ea8374fe73a 100644 --- a/tests/slicing/oracle/annot.1.res.oracle +++ b/tests/slicing/oracle/annot.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at f2 @@ -11,7 +10,7 @@ tests/slicing/annot.i:23:[value] assertion got status valid. [value] Recording results for f2 [value] done for function f2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f2 [pdg] done for function f2 @@ -38,5 +37,4 @@ void f2(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/bts0184.res.oracle b/tests/slicing/oracle/bts0184.res.oracle index 02f53368cca1bb12406971e7ecaa61aa994c2a69..0bb8be16cc92a1b88109db827226870866e67353 100644 --- a/tests/slicing/oracle/bts0184.res.oracle +++ b/tests/slicing/oracle/bts0184.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts0184.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -8,7 +7,7 @@ [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] Nothing to select for an unreachable stmt of x [pdg] computing for function x @@ -27,5 +26,4 @@ [sparecode] removed unused global declarations in new project 'Slicing export' /* Generated by Frama-C */ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts0184.i (no preprocessing) diff --git a/tests/slicing/oracle/bts0190.res.oracle b/tests/slicing/oracle/bts0190.res.oracle index 47ac4764bafc9b96c0c3f9301b40e8e87c8dc4e0..eb06603d6c259410de20b38d1959e9bbb3df289f 100644 --- a/tests/slicing/oracle/bts0190.res.oracle +++ b/tests/slicing/oracle/bts0190.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts0190.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -18,7 +17,7 @@ tests/slicing/bts0190.i:9:[value] assertion got status valid. [value] Done for function x [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] user error: Unbound variable y. Slicing requests from the command line are ignored. [slicing] warning: No internal slicing request from the command line. @@ -46,5 +45,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts0190.i (no preprocessing) diff --git a/tests/slicing/oracle/bts0950_annot.res.oracle b/tests/slicing/oracle/bts0950_annot.res.oracle index 13da51b5c2e86d0d2644f0f0e0e7828bd9b18d54..7b39d81e54ebfb3ff98d42544f7f91a14b53efce 100644 --- a/tests/slicing/oracle/bts0950_annot.res.oracle +++ b/tests/slicing/oracle/bts0950_annot.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts0950_annot.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -19,7 +18,7 @@ tests/slicing/bts0950_annot.i:4:[value] function cpy: precondition got status va [value:final-states] Values at end of function main: a ∈ {2} [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function cpy @@ -56,7 +55,6 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts0950_annot.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/slicing/oracle/bts1248.res.oracle b/tests/slicing/oracle/bts1248.res.oracle index b4b9319420c43c3df8f634653a3d2b2ed680c6c8..f7231b5244c8087679e4d7e37354daff5210abcf 100644 --- a/tests/slicing/oracle/bts1248.res.oracle +++ b/tests/slicing/oracle/bts1248.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts1248.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at f @@ -8,7 +7,7 @@ [value] Recording results for f [value] done for function f -[slicing] making slicing project 'p'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] warning: No internal slicing request from the command line. [slicing] warning: Adding an extra request on the entry point of function: f. @@ -31,5 +30,4 @@ void f(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts1248.i (no preprocessing) diff --git a/tests/slicing/oracle/bts1445.0.res.oracle b/tests/slicing/oracle/bts1445.0.res.oracle index e0b164f0d3eb41731cdc86875189791ad3279fd4..6278ddd273bc81292f2980e6002b1e19ed51f78c 100644 --- a/tests/slicing/oracle/bts1445.0.res.oracle +++ b/tests/slicing/oracle/bts1445.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts1445.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -9,7 +8,7 @@ tests/slicing/bts1445.i:8:[value] entering loop for the first time [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main tests/slicing/bts1445.i:10:[pdg] warning: no final state. Probably unreachable... @@ -32,5 +31,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts1445.i (no preprocessing) diff --git a/tests/slicing/oracle/bts1445.1.res.oracle b/tests/slicing/oracle/bts1445.1.res.oracle index b59b96293e3e076103a85dabec42d62d0e8b724b..973e9dc636300d377f25891a498924d9168237c2 100644 --- a/tests/slicing/oracle/bts1445.1.res.oracle +++ b/tests/slicing/oracle/bts1445.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts1445.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at f @@ -9,7 +8,7 @@ tests/slicing/bts1445.i:14:[value] entering loop for the first time [value] Recording results for f [value] done for function f -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f tests/slicing/bts1445.i:16:[pdg] warning: no final state. Probably unreachable... @@ -32,5 +31,4 @@ void f(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_bts1445.i (no preprocessing) diff --git a/tests/slicing/oracle/bts1684.res.oracle b/tests/slicing/oracle/bts1684.res.oracle index 9b5660c3bbe2fa594991d665fafd14c108617594..3007d3beaf75e61dda76d6a0aaef2627290b92c8 100644 --- a/tests/slicing/oracle/bts1684.res.oracle +++ b/tests/slicing/oracle/bts1684.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts1684.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -17,7 +16,7 @@ [value] Done for function main2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function main2 @@ -59,6 +58,5 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts1684.i (no preprocessing) [kernel] writing journal in file `./frama_c_journal.ml'. diff --git a/tests/slicing/oracle/bts1768.res.oracle b/tests/slicing/oracle/bts1768.res.oracle index af4614f96aa1e033359ffc43da7e7c5dd2c25c41..c8b2ec07f13144da4de08827f957a3f5f3a03158 100644 --- a/tests/slicing/oracle/bts1768.res.oracle +++ b/tests/slicing/oracle/bts1768.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts1768.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -195,7 +194,7 @@ tests/slicing/bts1768.i:35:[value] warning: signed overflow. assert cumul + 1 [value] Done for function fsm_transition [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function lecture @@ -304,5 +303,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts1768.i (no preprocessing) diff --git a/tests/slicing/oracle/bts179.0.res.oracle b/tests/slicing/oracle/bts179.0.res.oracle index 1da7fc0cbc32b2f74c8d237df71cca26b58508b3..fddd238d4ba06562be1a475903bb59757f8f679e 100644 --- a/tests/slicing/oracle/bts179.0.res.oracle +++ b/tests/slicing/oracle/bts179.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts179.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -14,7 +13,7 @@ [value] Done for function g [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function g @@ -56,5 +55,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts179.i (no preprocessing) diff --git a/tests/slicing/oracle/bts179.1.res.oracle b/tests/slicing/oracle/bts179.1.res.oracle index d059760dadba80f91b4026b965b42faf4ee2ad06..12f81345a1ff3f095239d7c165e485ab39f080f5 100644 --- a/tests/slicing/oracle/bts179.1.res.oracle +++ b/tests/slicing/oracle/bts179.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts179.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -14,7 +13,7 @@ [value] Done for function g [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function g @@ -55,5 +54,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_bts179.i (no preprocessing) diff --git a/tests/slicing/oracle/bts179.2.res.oracle b/tests/slicing/oracle/bts179.2.res.oracle index a4eb1a88df2e3bec8fe0b1e8c613c9514e602f73..9c9c758ecc07c24ec84ef9e635bbda41e016af56 100644 --- a/tests/slicing/oracle/bts179.2.res.oracle +++ b/tests/slicing/oracle/bts179.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts179.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -20,14 +19,6 @@ [pdg] done for function main [pdg] computing for function g [pdg] done for function g -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] remove unused global declarations... [sparecode] result in new project 'default without sparecode'. /* Generated by Frama-C */ diff --git a/tests/slicing/oracle/bts283.res.oracle b/tests/slicing/oracle/bts283.res.oracle index f16dd9c8d44ab42f885b1292bbf9f8058a5dd61f..63d4ccf6ffb77025cc1144bd958c8bf2211348e1 100644 --- a/tests/slicing/oracle/bts283.res.oracle +++ b/tests/slicing/oracle/bts283.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts283.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -35,7 +34,7 @@ tests/slicing/bts283.i:23:[value] warning: function k: postcondition got status tests/slicing/bts283.i:36:[value] warning: signed overflow. assert X + z ≤ 2147483647; [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -89,15 +88,12 @@ int main(void) int tmp; x = 1; z = f_slice_1(); - { /* sequence */ - tmp = g_slice_1(1); - z += tmp; - } + tmp = g_slice_1(1); + z += tmp; k_slice_1(3); __retres = X + z; return __retres; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts283.i (no preprocessing) diff --git a/tests/slicing/oracle/bts326.res.oracle b/tests/slicing/oracle/bts326.res.oracle index 6d4564973106959949b16353dc021fb157dbd4b5..89a6dc45bbec4ee8f403a9f434b159c0aa212065 100644 --- a/tests/slicing/oracle/bts326.res.oracle +++ b/tests/slicing/oracle/bts326.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts326.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -82,5 +81,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts326.i (no preprocessing) diff --git a/tests/slicing/oracle/bts335.res.oracle b/tests/slicing/oracle/bts335.res.oracle index 3242f8a7f94f93e10d3488be271361afe4c4b6fc..90c54191b6155df3d0b95a802faa09b9fcaad0c9 100644 --- a/tests/slicing/oracle/bts335.res.oracle +++ b/tests/slicing/oracle/bts335.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts335.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -39,7 +38,7 @@ [1] FROM T[1]; c (and SELF) [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function g [pdg] done for function g @@ -79,5 +78,4 @@ void main(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts335.i (no preprocessing) diff --git a/tests/slicing/oracle/bts335b.res.oracle b/tests/slicing/oracle/bts335b.res.oracle index 7c26128f5c82e42e6a2c990797a1049262546a0c..607b209b2affd30ebcaa66dab86eedb2709055f5 100644 --- a/tests/slicing/oracle/bts335b.res.oracle +++ b/tests/slicing/oracle/bts335b.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts335b.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -53,8 +52,8 @@ tests/slicing/bts335b.i:22:[value] warning: signed overflow. assert r + tmp_0 \result FROM v; b [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... -[slicing] done (making slicing project 'Slicing'). +[slicing] initializing slicing ... +[slicing] done (initializing slicing). [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -114,17 +113,13 @@ int f_slice_1(int c, int x, int y, int z) int main(int v, int w, int a, int b, int i, int j) { - int r; int tmp_0; - r = f_slice_1(1,v,a,i); + int r = f_slice_1(1,v,a,i); j ++; - { /* sequence */ - tmp_0 = g_slice_1(2,w,b,j); - r += tmp_0; - } + tmp_0 = g_slice_1(2,w,b,j); + r += tmp_0; return r; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts335b.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.0.res.oracle b/tests/slicing/oracle/bts336.0.res.oracle index a0961581cac237b91d9841e970cd1d0533512b72..6242c7f29e7706a9f7255ee081484df7ab4810b2 100644 --- a/tests/slicing/oracle/bts336.0.res.oracle +++ b/tests/slicing/oracle/bts336.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -35,7 +34,7 @@ \result FROM T[2] [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -63,12 +62,9 @@ int f_slice_1(int i) int main(void) { - int x2; - f_slice_1(1); - x2 = f_slice_1(2); + int x2 = f_slice_1(2); return x2; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.1.res.oracle b/tests/slicing/oracle/bts336.1.res.oracle index 0c17ca100c4d9262d59af31c1747d821be9bcffe..919561a2acea51af0b964b213128cb7c251a9903 100644 --- a/tests/slicing/oracle/bts336.1.res.oracle +++ b/tests/slicing/oracle/bts336.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state @@ -32,7 +31,7 @@ \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main2 [pdg] done for function main2 @@ -65,5 +64,4 @@ int main2(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.2.res.oracle b/tests/slicing/oracle/bts336.2.res.oracle index 35b332982a881ee93d20966fec3c8cf7d047092e..c4e2efb832f6d965a13b06c60cfe1ee7cc6c4189 100644 --- a/tests/slicing/oracle/bts336.2.res.oracle +++ b/tests/slicing/oracle/bts336.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main3 @@ -21,7 +20,7 @@ [value] Done for function f3 [value] Recording results for main3 [value] done for function main3 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main3 [from] Computing for function f3 @@ -48,12 +47,9 @@ void f3_slice_1(int *p) int main3(void) { - int a; - int b; - int c; - a = 1; - b = 2; - c = 3; + int a = 1; + int b = 2; + int c = 3; f3_slice_1(& a); f3_slice_1(& b); f3_slice_1(& c); @@ -61,5 +57,4 @@ int main3(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.3.res.oracle b/tests/slicing/oracle/bts336.3.res.oracle index c1cbb2bb60cb0c38f3c152d98a68da8049354cb4..6cecbd7a095a0be317c9dde0f4fcae0b1be72d74 100644 --- a/tests/slicing/oracle/bts336.3.res.oracle +++ b/tests/slicing/oracle/bts336.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main3 [value] Computing initial state @@ -53,7 +52,7 @@ Sure outputs: a; b; c [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main3 [pdg] done for function main3 @@ -78,12 +77,10 @@ void f3_slice_1(int *p) int main3(void) { - int b; - b = 2; + int b = 2; f3_slice_1(& b); return b; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.4.res.oracle b/tests/slicing/oracle/bts336.4.res.oracle index b66c7e82fcbc181ef7b4cd344d2e7a0f824e05df..553426263ac118f8c01255704852a71afde583b9 100644 --- a/tests/slicing/oracle/bts336.4.res.oracle +++ b/tests/slicing/oracle/bts336.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -35,7 +34,7 @@ \result FROM T[2] [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -63,11 +62,9 @@ int f_slice_1(int i) int main(void) { - int x2; - x2 = f_slice_1(2); + int x2 = f_slice_1(2); return x2; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.5.res.oracle b/tests/slicing/oracle/bts336.5.res.oracle index 1ee010ee7ecc16cee12406a76054c6eb808c6f67..0df597acf116556a4b2b097c94dedf7cb53e1d35 100644 --- a/tests/slicing/oracle/bts336.5.res.oracle +++ b/tests/slicing/oracle/bts336.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main4 [value] Computing initial state @@ -154,7 +153,7 @@ tests/slicing/bts336.i:84:[value] warning: signed overflow. assert a2 + b4 ≤ 2 \result FROM c [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main4 [pdg] done for function main4 @@ -181,14 +180,10 @@ void f4_slice_1(int *p, int *q) int main4(int volatile c) { int __retres; - int a2; - int b2; - int a4; - int b4; - a2 = 3; - b2 = 4; - a4 = 7; - b4 = 8; + int a2 = 3; + int b2 = 4; + int a4 = 7; + int b4 = 8; while (c) { f4_slice_1(& a2,& b2); f4_slice_1(& a4,& b4); @@ -198,5 +193,4 @@ int main4(int volatile c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.6.res.oracle b/tests/slicing/oracle/bts336.6.res.oracle index e457ea21c3b393ce5ede39cb711e7ee37315921f..9e6d1ee97a033f4b6f474e8addbf85e6390fc2cd 100644 --- a/tests/slicing/oracle/bts336.6.res.oracle +++ b/tests/slicing/oracle/bts336.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main4 [value] Computing initial state @@ -154,7 +153,7 @@ tests/slicing/bts336.i:84:[value] warning: signed overflow. assert a2 + b4 ≤ 2 \result FROM c [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main4 [pdg] done for function main4 @@ -186,10 +185,8 @@ void f4_slice_1(int *q) int main4(int volatile c) { int __retres; - int a2; - int b4; - a2 = 3; - b4 = 8; + int a2 = 3; + int b4 = 8; while (c) { f4_slice_2(& a2); f4_slice_1(& b4); @@ -199,5 +196,4 @@ int main4(int volatile c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts336.7.res.oracle b/tests/slicing/oracle/bts336.7.res.oracle index 4543621518372699eb630ea396a5cfa5f5b05a9b..581877b39d6407aec9470f89a4de4fd1a8d176af 100644 --- a/tests/slicing/oracle/bts336.7.res.oracle +++ b/tests/slicing/oracle/bts336.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts336.i (no preprocessing) [value] Analyzing a complete application starting at main5 [value] Computing initial state @@ -34,7 +33,7 @@ \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main5 [pdg] done for function main5 @@ -80,7 +79,7 @@ \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main5 [pdg] done for function main5 @@ -105,10 +104,8 @@ void f5_slice_1(int *p) int main5(void) { - int a1; - int a2; - a1 = 1; - a2 = 2; + int a1 = 1; + int a2 = 2; f5_slice_1(& a1); f5_slice_1(& a2); return a2; @@ -124,12 +121,10 @@ void f5_slice_1_slice_1(int *p) int main5(void) { - int a2; - a2 = 2; + int a2 = 2; f5_slice_1_slice_1(& a2); return a2; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_bts336.i (no preprocessing) diff --git a/tests/slicing/oracle/bts341.res.oracle b/tests/slicing/oracle/bts341.res.oracle index 7b92f971aff76f6b069999fe9d01126179ce1069..685005372fdcc78f1c975c3357182cbae9580c38 100644 --- a/tests/slicing/oracle/bts341.res.oracle +++ b/tests/slicing/oracle/bts341.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts341.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -10,7 +9,7 @@ tests/slicing/bts341.i:6:[value] entering loop for the first time tests/slicing/bts341.i:7:[value] assertion got status valid. [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -32,5 +31,4 @@ void main(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts341.i (no preprocessing) diff --git a/tests/slicing/oracle/bts344.0.res.oracle b/tests/slicing/oracle/bts344.0.res.oracle index d8615ad85e8a08f57cb37b45708cd6769b5fbf7d..6ef4a773b39b30dad9086422c1a877d3b0e92362 100644 --- a/tests/slicing/oracle/bts344.0.res.oracle +++ b/tests/slicing/oracle/bts344.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts344.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -26,7 +25,7 @@ tests/slicing/bts344.i:9:[value] function k: postcondition got status valid. [value] Done for function k [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -84,5 +83,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts344.i (no preprocessing) diff --git a/tests/slicing/oracle/bts344.1.res.oracle b/tests/slicing/oracle/bts344.1.res.oracle index ab421c95e8e8dd13a28579e592e9adaa767a06e4..165989c8b3e0245055606b8cdb5b0860b7626b72 100644 --- a/tests/slicing/oracle/bts344.1.res.oracle +++ b/tests/slicing/oracle/bts344.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts344.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main_bis @@ -14,7 +13,7 @@ tests/slicing/bts344.i:9:[value] function k: postcondition got status valid. [value] Done for function k [value] Recording results for main_bis [value] done for function main_bis -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main_bis [from] Computing for function k @@ -46,12 +45,10 @@ void k_slice_1(void) int main_bis(void) { - void (*p)(int ); - p = & k; + void (*p)(int ) = & k; k_slice_1(); return Y; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_bts344.i (no preprocessing) diff --git a/tests/slicing/oracle/bts345.0.res.oracle b/tests/slicing/oracle/bts345.0.res.oracle index 33d6ff83a84df5329a5cbc5501bec9c463a1f3a4..f6120ad04866d4ba7b62bf257601f1c6261b2011 100644 --- a/tests/slicing/oracle/bts345.0.res.oracle +++ b/tests/slicing/oracle/bts345.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts345.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at call_top @@ -25,7 +24,7 @@ tests/slicing/bts345.i:10:[value] warning: signed overflow. assert x + 1 ≤ 214 [value] Done for function top [value] Recording results for call_top [value] done for function call_top -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function call_top [from] Computing for function top @@ -60,28 +59,24 @@ int called_indirectly_by_top_slice_1(int x) int called_by_top_slice_1(int x) { - int z; x ++; - z = called_indirectly_by_top_slice_1(x); + int z = called_indirectly_by_top_slice_1(x); return z; } int top_slice_1(int x) { - int z; x ++; - z = called_by_top_slice_1(x); + int z = called_by_top_slice_1(x); return z; } int call_top(int y) { - int z; y ++; - z = top_slice_1(y); + int z = top_slice_1(y); return z; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts345.i (no preprocessing) diff --git a/tests/slicing/oracle/bts345.1.res.oracle b/tests/slicing/oracle/bts345.1.res.oracle index 1bfcc49a5cf0ae18d00de9f0ee48ef3e91a39c93..aaf2fb14880de794c1dd83f7a908cb0ae2d6e7f6 100644 --- a/tests/slicing/oracle/bts345.1.res.oracle +++ b/tests/slicing/oracle/bts345.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts345.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at top @@ -6,6 +5,8 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization +[value:initial-state] creating variable S_0_S___va_params with imprecise size (type void) +[value:initial-state] creating variable S_1_S___va_params with imprecise size (type void) tests/slicing/bts345.i:21:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; [value] computing for function called_by_top <- top. Called from tests/slicing/bts345.i:22. @@ -19,7 +20,7 @@ tests/slicing/bts345.i:10:[value] warning: signed overflow. assert x + 1 ≤ 214 [value] Done for function called_by_top [value] Recording results for top [value] done for function top -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function top [from] Computing for function called_by_top @@ -50,20 +51,17 @@ int called_indirectly_by_top_slice_1(int x) int called_by_top_slice_1(int x) { - int z; x ++; - z = called_indirectly_by_top_slice_1(x); + int z = called_indirectly_by_top_slice_1(x); return z; } int top(int x) { - int z; x ++; - z = called_by_top_slice_1(x); + int z = called_by_top_slice_1(x); return z; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_bts345.i (no preprocessing) diff --git a/tests/slicing/oracle/bts345.2.res.oracle b/tests/slicing/oracle/bts345.2.res.oracle index 4baa87918a7a09fcf1fa9269088949f3e3f6da9b..eef637ba9eef3f6cc006a42601d67045e2534c3e 100644 --- a/tests/slicing/oracle/bts345.2.res.oracle +++ b/tests/slicing/oracle/bts345.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts345.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at call_top @@ -25,7 +24,7 @@ tests/slicing/bts345.i:10:[value] warning: signed overflow. assert x + 1 ≤ 214 [value] Done for function top [value] Recording results for call_top [value] done for function call_top -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function top [from] Computing for function called_by_top @@ -60,17 +59,15 @@ int called_indirectly_by_top_slice_1(int x) int called_by_top_slice_1(int x) { - int z; x ++; - z = called_indirectly_by_top_slice_1(x); + int z = called_indirectly_by_top_slice_1(x); return z; } int top_slice_1(int x) { - int z; x ++; - z = called_by_top_slice_1(x); + int z = called_by_top_slice_1(x); return z; } @@ -82,5 +79,4 @@ void call_top(int y) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_bts345.i (no preprocessing) diff --git a/tests/slicing/oracle/bts345.3.res.oracle b/tests/slicing/oracle/bts345.3.res.oracle index afba88105334b45cf44398e25b61a893ae7837d2..d5e84d7462afb088b9c806d9cb39a881cd311683 100644 --- a/tests/slicing/oracle/bts345.3.res.oracle +++ b/tests/slicing/oracle/bts345.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts345.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at top @@ -6,6 +5,8 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization +[value:initial-state] creating variable S_0_S___va_params with imprecise size (type void) +[value:initial-state] creating variable S_1_S___va_params with imprecise size (type void) tests/slicing/bts345.i:21:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; [value] computing for function called_by_top <- top. Called from tests/slicing/bts345.i:22. @@ -19,7 +20,7 @@ tests/slicing/bts345.i:10:[value] warning: signed overflow. assert x + 1 ≤ 214 [value] Done for function called_by_top [value] Recording results for top [value] done for function top -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function called_by_top [from] Computing for function called_indirectly_by_top @@ -50,9 +51,8 @@ int called_indirectly_by_top_slice_1(int x) int called_by_top_slice_1(int x) { - int z; x ++; - z = called_indirectly_by_top_slice_1(x); + int z = called_indirectly_by_top_slice_1(x); return z; } @@ -64,5 +64,4 @@ void top(int x) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_bts345.i (no preprocessing) diff --git a/tests/slicing/oracle/bts345.4.res.oracle b/tests/slicing/oracle/bts345.4.res.oracle index 0bd2fcc807c3be278174306e9c6ad823e5dc332c..d570ed820b6f7e1cf519d092b7c87b581cdaa643 100644 --- a/tests/slicing/oracle/bts345.4.res.oracle +++ b/tests/slicing/oracle/bts345.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts345.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at call_top @@ -25,7 +24,7 @@ tests/slicing/bts345.i:10:[value] warning: signed overflow. assert x + 1 ≤ 214 [value] Done for function top [value] Recording results for call_top [value] done for function call_top -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function called_by_top [from] Computing for function called_indirectly_by_top @@ -60,9 +59,8 @@ int called_indirectly_by_top_slice_1(int x) int called_by_top_slice_1(int x) { - int z; x ++; - z = called_indirectly_by_top_slice_1(x); + int z = called_indirectly_by_top_slice_1(x); return z; } @@ -81,5 +79,4 @@ void call_top(int y) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_bts345.i (no preprocessing) diff --git a/tests/slicing/oracle/bts679.res.oracle b/tests/slicing/oracle/bts679.res.oracle index 3cf1ffd6dc8d81c64d1c92f347c8bdc3e2fc1439..d5949bca355e457194bfcbc79ac5aac33ffbe710 100644 --- a/tests/slicing/oracle/bts679.res.oracle +++ b/tests/slicing/oracle/bts679.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts679.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -15,7 +14,7 @@ tests/slicing/bts679.i:8:[value] warning: assertion got status unknown. [value] Recording results for main [value] done for function main tests/slicing/bts679.i:8:[value] assertion got final status valid. -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -39,5 +38,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts679.i (no preprocessing) diff --git a/tests/slicing/oracle/bts679b.res.oracle b/tests/slicing/oracle/bts679b.res.oracle index 6c7fd9484a13f854a37a5bab9041850d57e05bda..4407ee7e32612a7980522b25f850cb145832d5ec 100644 --- a/tests/slicing/oracle/bts679b.res.oracle +++ b/tests/slicing/oracle/bts679b.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts679b.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -11,7 +10,7 @@ tests/slicing/bts679b.i:11:[value] warning: assertion got status unknown. [value] Recording results for main [value] done for function main tests/slicing/bts679b.i:11:[value] assertion got final status valid. -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -37,5 +36,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts679b.i (no preprocessing) diff --git a/tests/slicing/oracle/bts709.res.oracle b/tests/slicing/oracle/bts709.res.oracle index 034d25c4aa5ac1c26aeef0d2a466fa19aa2c2c55..14879848f8bea4f95da2326e02274c80640783ff 100644 --- a/tests/slicing/oracle/bts709.res.oracle +++ b/tests/slicing/oracle/bts709.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts709.i (no preprocessing) tests/slicing/bts709.i:36:[kernel] warning: Calling undeclared function assert. Old style K&R code? [slicing] slicing requests in progress... @@ -49,7 +48,7 @@ tests/slicing/bts709.i:36:[kernel] warning: Neither code nor specification for f [value] Done for function inputsOf_testcase_func [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function func [from] Computing for function assert @@ -127,5 +126,4 @@ void inputsOf_testcase_func_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts709.i (no preprocessing) diff --git a/tests/slicing/oracle/bts808.res.oracle b/tests/slicing/oracle/bts808.res.oracle index 24bcf3fe44b08a65c77929b64d5dc724e04f020c..32978af6073df3760a2261e22e53ce9663f9bd0c 100644 --- a/tests/slicing/oracle/bts808.res.oracle +++ b/tests/slicing/oracle/bts808.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts808.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -16,7 +15,7 @@ [value] Done for function f1 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f0 @@ -66,14 +65,11 @@ int main(void) int __retres; int tmp; int tmp_0; - { /* sequence */ - tmp = f0_slice_1(); - tmp_0 = f1_slice_1(); - } + tmp = f0_slice_1(); + tmp_0 = f1_slice_1(); __retres = tmp + tmp_0; return __retres; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts808.i (no preprocessing) diff --git a/tests/slicing/oracle/bts827.res.oracle b/tests/slicing/oracle/bts827.res.oracle index c10d5ed3f77639b7f14e1e512c0a2c9116509b66..a803a5c62b180f9940b7bc8325e8393fb272f7fb 100644 --- a/tests/slicing/oracle/bts827.res.oracle +++ b/tests/slicing/oracle/bts827.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/bts827.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -12,7 +11,7 @@ [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -43,13 +42,10 @@ int f_slice_1(void) int main(void) { int tmp; - { /* sequence */ - tmp = f_slice_1(); - G += tmp; - } + tmp = f_slice_1(); + G += tmp; return G; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_bts827.i (no preprocessing) diff --git a/tests/slicing/oracle/call_accuracy.res.oracle b/tests/slicing/oracle/call_accuracy.res.oracle index 7f9c75e11ccd760abe4754e90fe1775475023e5f..386329775ab74a8cccfadc9ffbbb127e5a21752b 100644 --- a/tests/slicing/oracle/call_accuracy.res.oracle +++ b/tests/slicing/oracle/call_accuracy.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/call_accuracy.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -214,7 +213,7 @@ tests/slicing/call_accuracy.i:65:[value] warning: signed overflow. assert (int)( \result FROM S4.b; x; y [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -279,9 +278,8 @@ int test_set_slice_1(int y) int __retres; int b; struct st s1; - struct st s3; int tab[5]; - s3.b = 2; + struct st s3 = {.a = 1, .b = 2}; f_set_slice_1(& b,y); f_set_slice_1(& s1.b,y); f_set_slice_1(& tab[1],y); @@ -305,16 +303,12 @@ int test_struct_slice_1(void) int main(int x, int y, int z) { int __retres; - int r1; - int r2; - int r3; - r1 = test_struct_slice_1(); - r2 = test_cond_slice_1(x,y,z); - r3 = test_set_slice_1(y); + int r1 = test_struct_slice_1(); + int r2 = test_cond_slice_1(x,y,z); + int r3 = test_set_slice_1(y); __retres = (((r1 + r2) + r3) + S3.b) + S4.b; return __retres; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_call_accuracy.i (no preprocessing) diff --git a/tests/slicing/oracle/call_demo.0.res.oracle b/tests/slicing/oracle/call_demo.0.res.oracle index adfb7061865c549f4eaa2b059049f91a34d58095..f9b56725e252da9d4aa2bebf5593a976157bb797 100644 --- a/tests/slicing/oracle/call_demo.0.res.oracle +++ b/tests/slicing/oracle/call_demo.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/call_demo.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -39,7 +38,7 @@ tests/slicing/call_demo.i:14:[value] warning: signed overflow. assert *p * i ≤ [value] Done for function call2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function oper @@ -73,8 +72,7 @@ void oper_slice_1(int *s, int i) void main(int n) { int i; - int sum; - sum = 0; + int sum = 0; i = 0; while (i < n) { oper_slice_1(& sum,i); @@ -85,5 +83,4 @@ void main(int n) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_call_demo.i (no preprocessing) diff --git a/tests/slicing/oracle/call_demo.1.res.oracle b/tests/slicing/oracle/call_demo.1.res.oracle index b16069a7e4252607fe608c1bec104f7bbda804c6..a8fcb3e35eec6bff318378fb014c7ff66724322b 100644 --- a/tests/slicing/oracle/call_demo.1.res.oracle +++ b/tests/slicing/oracle/call_demo.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/call_demo.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -39,7 +38,7 @@ tests/slicing/call_demo.i:14:[value] warning: signed overflow. assert *p * i ≤ [value] Done for function call2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function oper @@ -73,8 +72,7 @@ void oper_slice_1(int *p, int i) void main(int n) { int i; - int product; - product = 1; + int product = 1; i = 0; while (i < n) { oper_slice_1(& product,i); @@ -85,5 +83,4 @@ void main(int n) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_call_demo.i (no preprocessing) diff --git a/tests/slicing/oracle/callwise.res.oracle b/tests/slicing/oracle/callwise.res.oracle index 5898a87ddf1a4182f5a0d965dc93e4b3a9a02910..df7297e48960514dca4ef8609fd9ce054ddbb362 100644 --- a/tests/slicing/oracle/callwise.res.oracle +++ b/tests/slicing/oracle/callwise.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/callwise.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -135,7 +134,7 @@ tests/slicing/callwise.i:32:[value] warning: accessing uninitialized left-value. \result FROM a; b [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -184,8 +183,7 @@ int fs163_main_slice_1(void) int __retres; int T[5]; { - int i; - i = 0; + int i = 0; while (i < 5) { fs163_f_slice_1(& T[i],i); i ++; @@ -197,24 +195,17 @@ int fs163_main_slice_1(void) int main(void) { - int n; - int m; int tmp; int tmp_0; - n = 2; - m = 3; + int n = 2; + int m = 3; f_slice_1(& a,& b); - { /* sequence */ - tmp = choose_slice_1(1,n,m); - a += tmp; - } - { /* sequence */ - tmp_0 = fs163_main_slice_1(); - a += tmp_0; - } + tmp = choose_slice_1(1,n,m); + a += tmp; + tmp_0 = fs163_main_slice_1(); + a += tmp_0; return a; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_callwise.i (no preprocessing) diff --git a/tests/slicing/oracle/combine.res.oracle b/tests/slicing/oracle/combine.res.oracle index e268ae0e5fb840cc05e9e4f88939a580ebe90692..ddd03c1ceb8bfcccafe9486b78680781a41ae11e 100644 --- a/tests/slicing/oracle/combine.res.oracle +++ b/tests/slicing/oracle/combine.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/combine.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -37,7 +36,7 @@ [from] Function main: \result FROM x [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function main [pdg] done for function main [slicing] applying all slicing requests... @@ -55,11 +54,10 @@ int g(int x); int f_slice_1(int c, int x) { - int y; int tmp; int r; if (c) tmp = 1; else tmp = -1; - y = tmp; + int y = tmp; if (y < 0) r = x + y; else r = 0; r = g(r); return r; @@ -88,11 +86,10 @@ int g(int x); int f_s_2(int c, int x) { - int y; int tmp; int r; if (c) tmp = 1; else tmp = -1; - y = tmp; + int y = tmp; if (y < 0) r = x + y; else r = 0; r = g(r); return r; @@ -100,11 +97,10 @@ int f_s_2(int c, int x) int f(int c, int x) { - int y; int tmp; int r; if (c) tmp = 1; else tmp = -1; - y = tmp; + int y = tmp; if (y < 0) r = x + y; else r = 0; r = g(r); return r; @@ -149,11 +145,10 @@ int g(int x); int f_s_2(int c, int x) { - int y; int tmp; int r; if (1) tmp = 1; else tmp = -1; - y = 1; + int y = 1; if (0) r = x + y; else r = 0; r = g(0); return r; @@ -161,11 +156,10 @@ int f_s_2(int c, int x) int f(int c, int x) { - int y; int tmp; int r; if (0) tmp = 1; else tmp = -1; - y = -1; + int y = -1; if (1) r = x + -1; else r = 0; r = g(r); return r; diff --git a/tests/slicing/oracle/csmith.0.res.oracle b/tests/slicing/oracle/csmith.0.res.oracle index 9e1c308a052cd486a44aac4aadac85d8f370e41b..fa0b14b33167a66429aa5c31e1d9eaa3cf43388d 100644 --- a/tests/slicing/oracle/csmith.0.res.oracle +++ b/tests/slicing/oracle/csmith.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/csmith.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -88,7 +87,7 @@ tests/slicing/csmith.i:248:[value] warning: signed overflow. assert x + tmp_9 (tmp_9 from bts963b()) [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f1 @@ -188,16 +187,14 @@ void f2_slice_1(void) int bts181_slice_1(int c) { - int y; - y = 0; + int y = 0; if (c) y = 3; return y; } int bts181b_slice_1(int c) { - int y; - y = 0; + int y = 0; if (c) y = 3; return y; } @@ -231,10 +228,9 @@ int bts809_slice_1(void) int bts879_slice_1(int c) { int __retres; - int p; int tmp; if (c) tmp = 0; else tmp = 10; - p = tmp; + int p = tmp; if (p) goto _LOR; else if (0) { @@ -248,10 +244,9 @@ int bts879_slice_1(int c) int bts879b_slice_1(int c) { int __retres; - int p; int tmp; if (c) tmp = 0; else tmp = 10; - p = tmp; + int p = tmp; if (p) { __retres = 1; goto return_label; @@ -262,11 +257,9 @@ int bts879b_slice_1(int c) int bts899_slice_1(void) { - int x; - x = 254; + int x = 254; { - int i; - i = 17; + int i = 17; while (i != -9) { if (! i) goto __Cont; x ++; @@ -279,10 +272,8 @@ int bts899_slice_1(void) int bts906_slice_1(void) { int __retres; - int x; - int i; - x = 0; - i = 2; + int x = 0; + int i = 2; while (1) { if (! i) { x ++; @@ -297,10 +288,8 @@ int bts906_slice_1(void) int bts906b_slice_1(void) { int __retres; - int x; - int i; - x = 0; - i = 2; + int x = 0; + int i = 2; while (1) { if (! i) { x ++; @@ -315,8 +304,7 @@ int bts906b_slice_1(void) int bts963_slice_1(void) { int __retres; - int x; - x = 0; + int x = 0; L: ; x ++; if (x < 3) goto L; @@ -330,8 +318,7 @@ int bts963_slice_1(void) int bts963b_slice_1(void) { int __retres; - int x; - x = 0; + int x = 0; L: ; x ++; if (x < 3) goto L; @@ -344,7 +331,6 @@ int bts963b_slice_1(void) int main(int n) { - int x; int tmp; int tmp_0; int tmp_1; @@ -356,60 +342,37 @@ int main(int n) int tmp_7; int tmp_8; int tmp_9; - x = 0; + int x = 0; f1_slice_1(); x += G1; f1b_slice_1(); x += G1b; f2_slice_1(); x += G2; - { /* sequence */ - tmp = bts181_slice_1(n); - x += tmp; - } - { /* sequence */ - tmp_0 = bts181b_slice_1(n); - x += tmp_0; - } - { /* sequence */ - tmp_1 = bts807_slice_1(); - x += tmp_1; - } - { /* sequence */ - tmp_2 = bts809_slice_1(); - x += tmp_2; - } - { /* sequence */ - tmp_3 = bts879_slice_1(n); - x += tmp_3; - } - { /* sequence */ - tmp_4 = bts879b_slice_1(n); - x += tmp_4; - } - { /* sequence */ - tmp_5 = bts899_slice_1(); - x += tmp_5; - } - { /* sequence */ - tmp_6 = bts906_slice_1(); - x += tmp_6; - } - { /* sequence */ - tmp_7 = bts906b_slice_1(); - x += tmp_7; - } - { /* sequence */ - tmp_8 = bts963_slice_1(); - x += tmp_8; - } - { /* sequence */ - tmp_9 = bts963b_slice_1(); - x += tmp_9; - } + tmp = bts181_slice_1(n); + x += tmp; + tmp_0 = bts181b_slice_1(n); + x += tmp_0; + tmp_1 = bts807_slice_1(); + x += tmp_1; + tmp_2 = bts809_slice_1(); + x += tmp_2; + tmp_3 = bts879_slice_1(n); + x += tmp_3; + tmp_4 = bts879b_slice_1(n); + x += tmp_4; + tmp_5 = bts899_slice_1(); + x += tmp_5; + tmp_6 = bts906_slice_1(); + x += tmp_6; + tmp_7 = bts906b_slice_1(); + x += tmp_7; + tmp_8 = bts963_slice_1(); + x += tmp_8; + tmp_9 = bts963b_slice_1(); + x += tmp_9; return x; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_csmith.i (no preprocessing) diff --git a/tests/slicing/oracle/csmith.1.res.oracle b/tests/slicing/oracle/csmith.1.res.oracle index b4fc6850d73b6ef869288b653c5065b6524b26cf..cb5c8582458ac0d080a192122fb8333af06c6a02 100644 --- a/tests/slicing/oracle/csmith.1.res.oracle +++ b/tests/slicing/oracle/csmith.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/csmith.i (no preprocessing) [value] Analyzing a complete application starting at bts906b [value] Computing initial state @@ -18,10 +17,10 @@ tests/slicing/csmith.i:169:[value] entering loop for the first time {n2}: VarDecl : x {n3}: VarDecl : i {n4}: VarDecl : __retres - {n5}: x = 0; + {n5}: int x = 0; -[-c-]-> 1 -[a--]-> 2 - {n6}: i = 2; + {n6}: int i = 2; -[-c-]-> 1 -[a--]-> 3 {n7}: x diff --git a/tests/slicing/oracle/csmith.2.res.oracle b/tests/slicing/oracle/csmith.2.res.oracle index 8dea1d5867ec0c8a1009efa7efbb5e0b1d2a33e0..a1556e6109183c6be881e68fa92cd643d109df01 100644 --- a/tests/slicing/oracle/csmith.2.res.oracle +++ b/tests/slicing/oracle/csmith.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/csmith.i (no preprocessing) [value] Analyzing a complete application starting at bts906c [value] Computing initial state @@ -18,7 +17,7 @@ tests/slicing/csmith.i:190:[value] entering loop for the first time {n2}: VarDecl : x {n3}: VarDecl : i {n4}: VarDecl : __retres - {n5}: x = 0; + {n5}: int x = 0; -[-c-]-> 1 -[a--]-> 2 {n6}: W: @@ -40,7 +39,7 @@ tests/slicing/csmith.i:190:[value] entering loop for the first time -[-c-]-> 15 -[-c-]-> 20 -[-c-]-> 22 - {n8}: i = 2; + {n8}: int i = 2; -[-c-]-> 1 -[a--]-> 3 {n9}: while(1) diff --git a/tests/slicing/oracle/ex_spec_interproc.res.oracle b/tests/slicing/oracle/ex_spec_interproc.res.oracle index 8109ef068b3628b9efed56790d3c82e9f76730c1..858bb04be935701de52ac6f999606ffaf6dbed93 100644 --- a/tests/slicing/oracle/ex_spec_interproc.res.oracle +++ b/tests/slicing/oracle/ex_spec_interproc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/ex_spec_interproc.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -54,10 +53,10 @@ M FROM \nothing \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function f [pdg] done for function f -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f_slice_1 = (n:32(restrict to X) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -122,7 +121,7 @@ int J; int K; int L; int M; -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [slicing] exporting project to 'Sliced code'... @@ -158,8 +157,8 @@ int f_slice_1(int a, int b, int c, int d, int e) } -[slicing] making slicing project 'slicing_2'... -Slicing project worklist [default/slicing_2] = +[slicing] reinitializing slicing ... +Slicing project worklist [default] = [f_slice_1 = (n:32(restrict to X) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -257,7 +256,7 @@ int J; int K; int L; int M; -Slicing project worklist [default/slicing_2] = +Slicing project worklist [default] = [slicing] exporting project to 'Sliced code'... @@ -292,8 +291,8 @@ int f_slice_1(int a, int b, int c, int d, int e) } -[slicing] making slicing project 'slicing_3'... -Slicing project worklist [default/slicing_3] = +[slicing] reinitializing slicing ... +Slicing project worklist [default] = [f_slice_1 = (n:32(restrict to X) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -382,7 +381,7 @@ int J; int K; int L; int M; -Slicing project worklist [default/slicing_3] = +Slicing project worklist [default] = [pdg] computing for function main @@ -505,7 +504,7 @@ Print slice = main_slice_1: (InCtrl: <[--d], [ S ]>) return res; } -Slicing project worklist [default/slicing_3] = +Slicing project worklist [default] = [slicing] exporting project to 'Sliced code'... @@ -630,7 +629,7 @@ int J; int K; int L; int M; -Slicing project worklist [default/slicing_3] = +Slicing project worklist [default] = int f(int a, int b, int c, int d, int e) @@ -654,7 +653,7 @@ int f(int a, int b, int c, int d, int e) return X; } -Slicing project worklist [default/slicing_3] = +Slicing project worklist [default] = [f_slice_1 = (n:13(restrict to a) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -743,10 +742,10 @@ int J; int K; int L; int M; -Slicing project worklist [default/slicing_3] = +Slicing project worklist [default] = -[slicing] making slicing project 'slicing_4'... +[slicing] reinitializing slicing ... [slicing] applying all slicing requests... [slicing] applying 2 actions... [slicing] applying actions: 1/2... @@ -841,11 +840,11 @@ int f_slice_1(int a, int c, int e) } -[slicing] making slicing project 'slicing_5'... +[slicing] reinitializing slicing ... [slicing] applying all slicing requests... [slicing] applying 1 actions... [slicing] applying actions: 1/1... -Slicing project worklist [default/slicing_5] = +Slicing project worklist [default] = [main_slice_1 = change_call for call 24 -> f_slice_1] [slicing] exporting project to 'Sliced code'... @@ -1008,6 +1007,6 @@ Print slice = main_slice_1: (InCtrl: <[--d], [ S ]>) return res; } -Slicing project worklist [default/slicing_5] = +Slicing project worklist [default] = diff --git a/tests/slicing/oracle/filter.res.oracle b/tests/slicing/oracle/filter.res.oracle index 85e2246c4da3addf7f20a00c172672f28c78910f..cff77f160eebeda1a7909bddbbe751c3ef76d41d 100644 --- a/tests/slicing/oracle/filter.res.oracle +++ b/tests/slicing/oracle/filter.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/filter.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -23,7 +22,7 @@ tests/slicing/filter.i:43:[value] warning: signed overflow. assert r + tmp_0 ≤ (tmp_0 from unspec()) [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function bts806 @@ -53,8 +52,7 @@ int f(int); int T[10]; int bts806_slice_1(void) { - int x; - x = 0; + int x = 0; { int z; z = x + 1; @@ -68,10 +66,8 @@ int unspec_slice_1(void) int __retres; { int tmp_0; - { /* sequence */ - tmp_0 = f(T[2]); - T[2] += tmp_0; - } + tmp_0 = f(T[2]); + T[2] += tmp_0; } __retres = T[1] + T[2]; return __retres; @@ -79,21 +75,15 @@ int unspec_slice_1(void) int main(void) { - int r; int tmp; int tmp_0; - r = 0; - { /* sequence */ - tmp = bts806_slice_1(); - r += tmp; - } - { /* sequence */ - tmp_0 = unspec_slice_1(); - r += tmp_0; - } + int r = 0; + tmp = bts806_slice_1(); + r += tmp; + tmp_0 = unspec_slice_1(); + r += tmp_0; return r; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_filter.i (no preprocessing) diff --git a/tests/slicing/oracle/forall_loop_invariant.res.oracle b/tests/slicing/oracle/forall_loop_invariant.res.oracle index 124f10ba355fbe6d32e73a8e5f9e268c435c469f..261dc6ee64477c44ec8c57fd8aad00f6261c4042 100644 --- a/tests/slicing/oracle/forall_loop_invariant.res.oracle +++ b/tests/slicing/oracle/forall_loop_invariant.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/forall_loop_invariant.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -16,7 +15,7 @@ tests/slicing/forall_loop_invariant.i:12:[value] warning: loop invariant got sta tests/slicing/forall_loop_invariant.i:18:[value] warning: assertion got status unknown. [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -36,8 +35,7 @@ int u[10]; void main(void) { { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ 10; loop invariant ∀ int k; 0 ≤ k < i ⇒ t[k] ≡ 1; loop invariant ∀ int k; 0 ≤ k < i ⇒ u[k] ≡ 2; @@ -53,7 +51,7 @@ void main(void) [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] reinitializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] applying all slicing requests... [slicing] applying 0 actions... @@ -72,8 +70,7 @@ int main(void) { int __retres; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ 10; loop invariant ∀ int k; 0 ≤ k < i ⇒ t[k] ≡ 1; loop invariant ∀ int k; 0 ≤ k < i ⇒ u[k] ≡ 2; @@ -89,5 +86,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_forall_loop_invariant.i (no preprocessing) diff --git a/tests/slicing/oracle/horwitz.res.oracle b/tests/slicing/oracle/horwitz.res.oracle index 8dcc7a29822bb82186f13cb300867685352c44fe..653883258a16dc575ecb71761ae7597e9ad37072 100644 --- a/tests/slicing/oracle/horwitz.res.oracle +++ b/tests/slicing/oracle/horwitz.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/horwitz.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -125,7 +124,7 @@ tests/slicing/horwitz.i:12:[value] warning: signed overflow. assert a + b ≤ 21 [from] Function main: \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function incr [pdg] done for function incr [slicing] applying all slicing requests... @@ -135,7 +134,7 @@ tests/slicing/horwitz.i:12:[value] warning: signed overflow. assert a + b ≤ 21 [pdg] done for function A [pdg] computing for function main [pdg] done for function main -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [main_slice_1 = change_call for call 23 -> A_slice_1][A_slice_1 = change_call for call 10 -> incr_slice_1] [slicing] exporting project to 'Sliced code'... @@ -156,10 +155,8 @@ int add(int a, int b) void incr_slice_1(char *pi) { int tmp; - { /* sequence */ - tmp = add((int)*pi,1); - *pi = (char)tmp; - } + tmp = add((int)*pi,1); + *pi = (char)tmp; return; } @@ -171,8 +168,7 @@ void A_slice_1(char *py) void main(void) { - char i; - i = (char)1; + char i = (char)1; while ((int)i < 11) A_slice_1(& i); return; } diff --git a/tests/slicing/oracle/if_many_values.res.oracle b/tests/slicing/oracle/if_many_values.res.oracle index aff17ddecf4f0b72a8a2fe7b08b72a15c60e307f..1ff44e950e1a0906e5730ebb993126a5422dc258 100644 --- a/tests/slicing/oracle/if_many_values.res.oracle +++ b/tests/slicing/oracle/if_many_values.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/if_many_values.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -11,7 +10,7 @@ tests/slicing/if_many_values.i:8:[value] entering loop for the first time tests/slicing/if_many_values.i:11:[value] warning: signed overflow. assert r + 1 ≤ 2147483647; [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -30,8 +29,7 @@ int r = 1; int main(void) { { - int i; - i = -100; + int i = -100; while (i < 100) { if (i != 0) r ++; i ++; @@ -41,5 +39,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_if_many_values.i (no preprocessing) diff --git a/tests/slicing/oracle/initialized.res.oracle b/tests/slicing/oracle/initialized.res.oracle index 47dfeb13a4f0ab5b8f5b2b9bd1e59f6811655508..ebfb78486d6722180b265805fc90451e699559b5 100644 --- a/tests/slicing/oracle/initialized.res.oracle +++ b/tests/slicing/oracle/initialized.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/initialized.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -9,7 +8,7 @@ tests/slicing/initialized.i:12:[value] assertion got status valid. [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -33,5 +32,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_initialized.i (no preprocessing) diff --git a/tests/slicing/oracle/keep_annot.0.res.oracle b/tests/slicing/oracle/keep_annot.0.res.oracle index 718e576475175cfe81a979c4b5fa4553974e2a72..9bc7ea4ea265c6b6ba551b60756491f2e6ef6176 100644 --- a/tests/slicing/oracle/keep_annot.0.res.oracle +++ b/tests/slicing/oracle/keep_annot.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/keep_annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at f @@ -17,7 +16,7 @@ tests/slicing/keep_annot.i:27:[value] assertion got status valid. tests/slicing/keep_annot.i:28:[value] warning: assertion got status unknown. [value] Recording results for f [value] done for function f -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function g @@ -43,8 +42,7 @@ struct __anonstruct_las_1 { typedef struct __anonstruct_las_1 las; void g_slice_1(las *p) { - int i; - i = 0; + int i = 0; while (i < 5) { p->b = (double)i / (double)(i + 1); i ++; @@ -61,5 +59,4 @@ void f(las *p, int n, int m) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_keep_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/keep_annot.1.res.oracle b/tests/slicing/oracle/keep_annot.1.res.oracle index a43bb8a5dc0fed901ad6a11727e78bcd5492a9b0..f20ab87cd6bb8cd8358dbba8dd56cb707ad310fd 100644 --- a/tests/slicing/oracle/keep_annot.1.res.oracle +++ b/tests/slicing/oracle/keep_annot.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/keep_annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at f @@ -17,7 +16,7 @@ tests/slicing/keep_annot.i:27:[value] assertion got status valid. tests/slicing/keep_annot.i:28:[value] warning: assertion got status unknown. [value] Recording results for f [value] done for function f -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function g @@ -43,8 +42,7 @@ struct __anonstruct_las_1 { typedef struct __anonstruct_las_1 las; void g_slice_1(las *p) { - int i; - i = 0; + int i = 0; while (i < 5) { p->b = (double)i / (double)(i + 1); i ++; @@ -64,5 +62,4 @@ void f(las *p, int n, int m) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_keep_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/keep_annot.2.res.oracle b/tests/slicing/oracle/keep_annot.2.res.oracle index b12d557aba262012bac81f0562cddf7ff36a2b8e..85070c545d64cfe69e927023f7e437c2449ee0a4 100644 --- a/tests/slicing/oracle/keep_annot.2.res.oracle +++ b/tests/slicing/oracle/keep_annot.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/keep_annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at L @@ -17,7 +16,7 @@ tests/slicing/keep_annot.i:41:[value] warning: non-finite float value. tests/slicing/keep_annot.i:42:[value] warning: assertion got status unknown. [value] Recording results for L [value] done for function L -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function L [pdg] done for function L @@ -47,5 +46,4 @@ void L(float u, int nn, float *dabs, float *y) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_keep_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/keep_annot.3.res.oracle b/tests/slicing/oracle/keep_annot.3.res.oracle index 67db2ed2328a8ac66e7fbbb18c2f9d4a0f840b37..81514ee797abf125ce13b255db9075bbb4d32680 100644 --- a/tests/slicing/oracle/keep_annot.3.res.oracle +++ b/tests/slicing/oracle/keep_annot.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/keep_annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at L @@ -17,7 +16,7 @@ tests/slicing/keep_annot.i:41:[value] warning: non-finite float value. tests/slicing/keep_annot.i:42:[value] warning: assertion got status unknown. [value] Recording results for L [value] done for function L -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function L [pdg] done for function L @@ -45,5 +44,4 @@ void L(float u, int nn, float *dabs, float *y) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_keep_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/keep_annot.4.res.oracle b/tests/slicing/oracle/keep_annot.4.res.oracle index ee6db1de5ec9a0788f01205bd1271aacf477f74c..a9b2587fe5cb60ed9cbdaa95b18f253817fa8035 100644 --- a/tests/slicing/oracle/keep_annot.4.res.oracle +++ b/tests/slicing/oracle/keep_annot.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/keep_annot.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at bts1110 @@ -10,7 +9,7 @@ tests/slicing/keep_annot.i:50:[value] assertion got status valid. tests/slicing/keep_annot.i:52:[value] warning: assertion got status unknown. [value] Recording results for bts1110 [value] done for function bts1110 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function bts1110 [pdg] done for function bts1110 @@ -33,5 +32,4 @@ int bts1110(int x) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_keep_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/loop_infinite.res.oracle b/tests/slicing/oracle/loop_infinite.res.oracle index dd72a1c7ae75ca0958510f54d64e3277f58f79bb..f3a0d3e22012b68057eea7f9645aad6fd56ad27f 100644 --- a/tests/slicing/oracle/loop_infinite.res.oracle +++ b/tests/slicing/oracle/loop_infinite.res.oracle @@ -1,10 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loop_infinite.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/slicing/loop_infinite.i:5:[value] warning: initialization of volatile variable a ignored tests/slicing/loop_infinite.i:9:[value] entering loop for the first time tests/slicing/loop_infinite.i:10:[value] warning: signed overflow. assert a + 1 ≤ 2147483647; [value] Recording results for main @@ -17,7 +17,7 @@ tests/slicing/loop_infinite.i:10:[value] warning: signed overflow. assert a + 1 \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -40,5 +40,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_loop_infinite.i (no preprocessing) diff --git a/tests/slicing/oracle/loop_simple.res.oracle b/tests/slicing/oracle/loop_simple.res.oracle index 94ec8f0afc8b942b3be17110200acec4d04c21e2..507e85c2ad7157ff64f9ce4497c358b3fc5af3f6 100644 --- a/tests/slicing/oracle/loop_simple.res.oracle +++ b/tests/slicing/oracle/loop_simple.res.oracle @@ -1,10 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loop_simple.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/slicing/loop_simple.i:5:[value] warning: initialization of volatile variable b ignored tests/slicing/loop_simple.i:8:[value] entering loop for the first time tests/slicing/loop_simple.i:10:[value] entering loop for the first time tests/slicing/loop_simple.i:12:[value] entering loop for the first time @@ -19,7 +19,7 @@ tests/slicing/loop_simple.i:16:[value] entering loop for the first time \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -38,8 +38,7 @@ int main(void) { int a; int c; - int volatile b; - b = 0; + int volatile b = 0; a = 1; c = 0; /*@ loop assigns c, a; */ @@ -56,5 +55,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_loop_simple.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.0.res.oracle b/tests/slicing/oracle/loops.0.res.oracle index cfad72ea64f50bffaeac222e4cb3582cb2288c57..8ec03920cc0f5a26570b150fe4bcf9a53b88552b 100644 --- a/tests/slicing/oracle/loops.0.res.oracle +++ b/tests/slicing/oracle/loops.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at f1 [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:35:[value] warning: signed overflow. assert s + 1 ≤ 2147 \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f1 [pdg] done for function f1 @@ -48,5 +47,4 @@ void f1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.1.res.oracle b/tests/slicing/oracle/loops.1.res.oracle index d51a7cab34cc8c0d5454bec17566fb6ab5d2ae36..40485453876dc09e1256f28c1dbe8618419c5588 100644 --- a/tests/slicing/oracle/loops.1.res.oracle +++ b/tests/slicing/oracle/loops.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at f1 [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:35:[value] warning: signed overflow. assert s + 1 ≤ 2147 \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f1 [pdg] done for function f1 @@ -40,8 +39,7 @@ tests/slicing/loops.i:35:[value] warning: signed overflow. assert s + 1 ≤ 2147 /* Generated by Frama-C */ void f1(int c) { - int s; - s = 0; + int s = 0; if (c) while (1) { s ++; @@ -51,5 +49,4 @@ void f1(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.10.res.oracle b/tests/slicing/oracle/loops.10.res.oracle index e6bfe53e19c5f47c1795bf0ca26bad0489ab9f34..94576ddd3a3151e126b6336c7111f7bf0c65161b 100644 --- a/tests/slicing/oracle/loops.10.res.oracle +++ b/tests/slicing/oracle/loops.10.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop tests/slicing/loops.i:187:[pdg] warning: no final state. Probably unreachable... @@ -82,5 +81,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_10_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.11.res.oracle b/tests/slicing/oracle/loops.11.res.oracle index 541e3d83fd4f3bee862385aa17a18e9065d3b0a2..b8005ca5a29049d90bb8ca504d0b1abde2e22cc1 100644 --- a/tests/slicing/oracle/loops.11.res.oracle +++ b/tests/slicing/oracle/loops.11.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 Z FROM Y [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop [pdg] done for function loop @@ -47,5 +46,4 @@ void loop(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_11_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.12.res.oracle b/tests/slicing/oracle/loops.12.res.oracle index 32c80db3dbb1976b3b0d30af2d436aec8675722a..dfa7620f6e06d490900725e50fcac5cf16e4c031 100644 --- a/tests/slicing/oracle/loops.12.res.oracle +++ b/tests/slicing/oracle/loops.12.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 Z FROM Y [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop [pdg] done for function loop @@ -44,8 +43,7 @@ int Z; void loop(int cond) { if (cond) { - int c; - c = 0; + int c = 0; /*@ loop pragma WIDEN_HINTS X, 10, 100; */ while (1) { /*@ slice pragma ctrl; */ ; @@ -58,5 +56,4 @@ void loop(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_12_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.13.res.oracle b/tests/slicing/oracle/loops.13.res.oracle index 101bfffe8c48c6814c3b7d641b592355ad207a1e..0d7f20ebcc2a1a220ce004c53d1fc47b478251a0 100644 --- a/tests/slicing/oracle/loops.13.res.oracle +++ b/tests/slicing/oracle/loops.13.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 Z FROM Y [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop [pdg] done for function loop @@ -44,8 +43,7 @@ int Z; void loop(int cond) { if (cond) { - int c; - c = 0; + int c = 0; /*@ loop pragma WIDEN_HINTS X, 10, 100; */ while (1) { /*@ slice pragma ctrl; */ ; @@ -58,5 +56,4 @@ void loop(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_13_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.14.res.oracle b/tests/slicing/oracle/loops.14.res.oracle index 6fa8d7767f5ff241761d168d81eac0a095bf20d3..d8899423358ab11ff8992a408a300652d318b034 100644 --- a/tests/slicing/oracle/loops.14.res.oracle +++ b/tests/slicing/oracle/loops.14.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 Z FROM Y [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop [pdg] done for function loop @@ -47,5 +46,4 @@ void loop(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_14_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.15.res.oracle b/tests/slicing/oracle/loops.15.res.oracle index 47a89e08bc8e391ac5da2aed028e29b7cb8b4011..3691ee1a8490682041e10c1b68d2aefcfc899853 100644 --- a/tests/slicing/oracle/loops.15.res.oracle +++ b/tests/slicing/oracle/loops.15.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at stop_f1 [value] Computing initial state @@ -31,7 +30,7 @@ tests/slicing/loops.i:70:[kernel] warning: Neither code nor specification for fu \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function stop_f1 [pdg] done for function stop_f1 @@ -56,5 +55,4 @@ void stop_f1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_15_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.16.res.oracle b/tests/slicing/oracle/loops.16.res.oracle index 3b0b898b3dcde5d2b09a47bd5f6883244a6a7636..3fc551929ba869a52c107f6daee890455a0c42f9 100644 --- a/tests/slicing/oracle/loops.16.res.oracle +++ b/tests/slicing/oracle/loops.16.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at stop_f1 [value] Computing initial state @@ -31,7 +30,7 @@ tests/slicing/loops.i:70:[kernel] warning: Neither code nor specification for fu \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function stop_f1 [pdg] done for function stop_f1 @@ -48,8 +47,7 @@ tests/slicing/loops.i:70:[kernel] warning: Neither code nor specification for fu /* Generated by Frama-C */ void stop_f1(int c) { - int s; - s = 0; + int s = 0; if (c) while (s < c) { s ++; @@ -59,5 +57,4 @@ void stop_f1(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_16_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.17.res.oracle b/tests/slicing/oracle/loops.17.res.oracle index 59180ade0290c8ebc081dc33f167b701160eec12..e807c1323e1c4ed0a0be5757af2f30ba3579082d 100644 --- a/tests/slicing/oracle/loops.17.res.oracle +++ b/tests/slicing/oracle/loops.17.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at stop_f2 [value] Computing initial state @@ -32,7 +31,7 @@ tests/slicing/loops.i:89:[kernel] warning: Neither code nor specification for fu NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function stop_f2 [pdg] done for function stop_f2 @@ -49,10 +48,8 @@ tests/slicing/loops.i:89:[kernel] warning: Neither code nor specification for fu /* Generated by Frama-C */ void stop_f2(int c) { - int x1; - int x2; - x1 = 0; - x2 = 0; + int x1 = 0; + int x2 = 0; if (! (x1 + x2 < c + 10)) goto break_cont_1; if (c) x1 ++; /*@ slice pragma expr x1; */ ; @@ -60,5 +57,4 @@ void stop_f2(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_17_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.18.res.oracle b/tests/slicing/oracle/loops.18.res.oracle index 8093b8781d87bf17ab3a535a6b786562d9697911..a2b343b9b7c9a98d41bdf0f656030094de61c00c 100644 --- a/tests/slicing/oracle/loops.18.res.oracle +++ b/tests/slicing/oracle/loops.18.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at stop_f2 [value] Computing initial state @@ -32,7 +31,7 @@ tests/slicing/loops.i:89:[kernel] warning: Neither code nor specification for fu NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function stop_f2 [pdg] done for function stop_f2 @@ -49,10 +48,8 @@ tests/slicing/loops.i:89:[kernel] warning: Neither code nor specification for fu /* Generated by Frama-C */ void stop_f2(int c) { - int x1; - int x2; - x1 = 0; - x2 = 0; + int x1 = 0; + int x2 = 0; if (! (x1 + x2 < c + 10)) goto break_cont_1; if (! c) x2 ++; /*@ assert x2 > 0; */ ; @@ -60,5 +57,4 @@ void stop_f2(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_18_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.19.res.oracle b/tests/slicing/oracle/loops.19.res.oracle index fbd271b8a52f518b91e4c302a21fac54b79d2cd5..be6b55d43ba006ab9a32651700f8d076a55475eb 100644 --- a/tests/slicing/oracle/loops.19.res.oracle +++ b/tests/slicing/oracle/loops.19.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] Nothing to select for Z after unreachable stmt of main [slicing] Nothing to select for an unreachable stmt of main @@ -65,5 +64,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_19_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.2.res.oracle b/tests/slicing/oracle/loops.2.res.oracle index de648a478a5812fe45651148e1b733890e20fc83..5216bf6d8b976cda32ef1962863ac9bb6e214372 100644 --- a/tests/slicing/oracle/loops.2.res.oracle +++ b/tests/slicing/oracle/loops.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at f2 [value] Computing initial state @@ -25,7 +24,7 @@ tests/slicing/loops.i:54:[value] warning: signed overflow. assert x2 + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f2 tests/slicing/loops.i:50:[pdg] warning: no final state. Probably unreachable... @@ -43,8 +42,7 @@ tests/slicing/loops.i:50:[pdg] warning: no final state. Probably unreachable... /* Generated by Frama-C */ void f2(int c) { - int x1; - x1 = 0; + int x1 = 0; while (1) { if (c) x1 ++; /*@ slice pragma expr x1; */ ; @@ -53,5 +51,4 @@ void f2(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.20.res.oracle b/tests/slicing/oracle/loops.20.res.oracle index c0b3755479ff7d57c1f00a208ac2abf1538931c9..ff574d624c60618f612441d10b4f75ab7cf7cb3b 100644 --- a/tests/slicing/oracle/loops.20.res.oracle +++ b/tests/slicing/oracle/loops.20.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] warning: No internal slicing request from the command line. [slicing] warning: Adding an extra request on the entry point of function: main. @@ -65,5 +64,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_20_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.21.res.oracle b/tests/slicing/oracle/loops.21.res.oracle index 53a32895a83ba7cbb7fc3bfff79fef45be2d1e05..a397d2cfa45e4cb02f1531324524dadd2739feea 100644 --- a/tests/slicing/oracle/loops.21.res.oracle +++ b/tests/slicing/oracle/loops.21.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop tests/slicing/loops.i:187:[pdg] warning: no final state. Probably unreachable... @@ -69,8 +68,7 @@ int Z; void loop_slice_1(void) { { - int c; - c = 0; + int c = 0; /*@ loop pragma WIDEN_HINTS X, 10, 100; */ while (1) { /*@ slice pragma ctrl; */ ; @@ -94,5 +92,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_21_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.22.res.oracle b/tests/slicing/oracle/loops.22.res.oracle index cb304fd115454c2388c03ea213d3fda30c18e6b1..8a1f634b98ac8d7e3f967c169f4a1149006f89b0 100644 --- a/tests/slicing/oracle/loops.22.res.oracle +++ b/tests/slicing/oracle/loops.22.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop tests/slicing/loops.i:187:[pdg] warning: no final state. Probably unreachable... @@ -69,8 +68,7 @@ int Z; void loop_slice_1(void) { { - int c; - c = 0; + int c = 0; /*@ loop pragma WIDEN_HINTS X, 10, 100; */ while (1) { /*@ slice pragma ctrl; */ ; @@ -94,5 +92,4 @@ void main(int y) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_22_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.23.res.oracle b/tests/slicing/oracle/loops.23.res.oracle index ea0a504df21a63143fd05c4cccdc89cd438d227e..005f67dbb205e63bbc59d804165dc9a6b5ae85bd 100644 --- a/tests/slicing/oracle/loops.23.res.oracle +++ b/tests/slicing/oracle/loops.23.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main tests/slicing/loops.i:204:[pdg] warning: no final state. Probably unreachable... @@ -67,5 +66,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_23_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.24.res.oracle b/tests/slicing/oracle/loops.24.res.oracle index dabc4b18797891838228c1ef266d243f012c4d62..eef3bfd0b1b6d25cbacc1b1f2776699ba91f14ce 100644 --- a/tests/slicing/oracle/loops.24.res.oracle +++ b/tests/slicing/oracle/loops.24.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at alarm [value] Computing initial state @@ -10,6 +9,7 @@ X ∈ [--..--] Y ∈ [--..--] Z ∈ [--..--] +tests/slicing/loops.i:209:[value] warning: initialization of volatile variable j ignored tests/slicing/loops.i:210:[value] assertion got status valid. tests/slicing/loops.i:211:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; [value] Recording results for alarm @@ -22,7 +22,7 @@ tests/slicing/loops.i:211:[value] warning: signed overflow. assert j + 1 ≤ 214 NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function alarm [pdg] done for function alarm @@ -39,12 +39,10 @@ tests/slicing/loops.i:211:[value] warning: signed overflow. assert j + 1 ≤ 214 /* Generated by Frama-C */ void alarm(void) { - int volatile j; - j = 3; + int volatile j = 3; j ++; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_24_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.3.res.oracle b/tests/slicing/oracle/loops.3.res.oracle index c26bec6bfe4d47ff875966ce0e06122dcf205e25..afc853a07a528a1fa5e3ef73a6ed432e1109e23f 100644 --- a/tests/slicing/oracle/loops.3.res.oracle +++ b/tests/slicing/oracle/loops.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing an incomplete application starting at f2 [value] Computing initial state @@ -25,7 +24,7 @@ tests/slicing/loops.i:54:[value] warning: signed overflow. assert x2 + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f2 tests/slicing/loops.i:50:[pdg] warning: no final state. Probably unreachable... @@ -43,8 +42,7 @@ tests/slicing/loops.i:50:[pdg] warning: no final state. Probably unreachable... /* Generated by Frama-C */ void f2(int c) { - int x2; - x2 = 0; + int x2 = 0; while (1) { if (! c) x2 ++; /*@ assert x2 > 0; */ ; @@ -53,5 +51,4 @@ void f2(int c) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.4.res.oracle b/tests/slicing/oracle/loops.4.res.oracle index afaf22b173ba990f9cbf159b160eb22c1113ab1f..f3df9f51c0255cf0469b7283eacfad6ec89b187a 100644 --- a/tests/slicing/oracle/loops.4.res.oracle +++ b/tests/slicing/oracle/loops.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at test_infinite_loop_3 [value] Computing initial state @@ -21,7 +20,7 @@ tests/slicing/loops.i:108:[value] entering loop for the first time G FROM ctrl1; ctrl2; data1; data2 [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test_infinite_loop_3 [pdg] done for function test_infinite_loop_3 @@ -48,5 +47,4 @@ void test_infinite_loop_3(int ctrl1, int ctrl2, int data1, int data2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.5.res.oracle b/tests/slicing/oracle/loops.5.res.oracle index eccef023d9c233ac60a42e35c58eadaa6f2945c4..b1c10caef5b81488bd4b22d75c941a214225d781 100644 --- a/tests/slicing/oracle/loops.5.res.oracle +++ b/tests/slicing/oracle/loops.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at test_infinite_loop_4 [value] Computing initial state @@ -30,7 +29,7 @@ tests/slicing/loops.i:133:[value] warning: signed overflow. assert G + no_data G FROM ctrl1; ctrl2; data1; data2 [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test_infinite_loop_4 [pdg] done for function test_infinite_loop_4 @@ -57,5 +56,4 @@ void test_infinite_loop_4(int ctrl1, int ctrl2, int data1, int data2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.6.res.oracle b/tests/slicing/oracle/loops.6.res.oracle index 23d81bfc606aaeeef3ffd8aaa0c1903c63232fff..2c8d06d8cc89d9cc6a684a6ad41cd4c5b48fe3b4 100644 --- a/tests/slicing/oracle/loops.6.res.oracle +++ b/tests/slicing/oracle/loops.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at test_infinite_loop_5 [value] Computing initial state @@ -30,7 +29,7 @@ tests/slicing/loops.i:156:[value] warning: signed overflow. assert G + no_data G FROM ctrl1; ctrl2; data1; data2 [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test_infinite_loop_5 [pdg] done for function test_infinite_loop_5 @@ -57,5 +56,4 @@ void test_infinite_loop_5(int ctrl1, int ctrl2, int data1, int data2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.7.res.oracle b/tests/slicing/oracle/loops.7.res.oracle index 8ae4d277861fac2c2ddfa826bc33039bc163ad7a..4ee11de8d41cf189feb22b7bbd8c247adbda7202 100644 --- a/tests/slicing/oracle/loops.7.res.oracle +++ b/tests/slicing/oracle/loops.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state @@ -23,7 +22,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 Z FROM Y [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop [pdg] done for function loop @@ -47,5 +46,4 @@ void loop(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.8.res.oracle b/tests/slicing/oracle/loops.8.res.oracle index 43567b3a0838d1c78d2d8eb54691057d14b3add3..eaa884dd41d6b8f2b270ebecead58ab921ed18cb 100644 --- a/tests/slicing/oracle/loops.8.res.oracle +++ b/tests/slicing/oracle/loops.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main tests/slicing/loops.i:204:[pdg] warning: no final state. Probably unreachable... @@ -69,13 +68,11 @@ void loop_slice_1(void) void main(void) { { - int cond; - cond = C2; + int cond = C2; loop_slice_1(); } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_8_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/loops.9.res.oracle b/tests/slicing/oracle/loops.9.res.oracle index b33964a21fa7f731a5df587f44c133f233f58a85..3be2191fb3b5fe582a925f5df3c5c4d332fd2d10 100644 --- a/tests/slicing/oracle/loops.9.res.oracle +++ b/tests/slicing/oracle/loops.9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/loops.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -41,7 +40,7 @@ tests/slicing/loops.i:179:[value] warning: signed overflow. assert X + 1 ≤ 214 NON TERMINATING - NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop tests/slicing/loops.i:187:[pdg] warning: no final state. Probably unreachable... @@ -64,9 +63,8 @@ int X; void loop_slice_1(void) { /*@ loop pragma WIDEN_HINTS X, 10, 100; */ - while (1) { + while (1) /*@ slice pragma ctrl; */ ; - } return; } @@ -77,5 +75,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_9_loops.i (no preprocessing) diff --git a/tests/slicing/oracle/mark_all_slices.res.oracle b/tests/slicing/oracle/mark_all_slices.res.oracle index 7f06c1d031366a8ee6682f9db74c0b5623931a43..fe9519a3c240d09fa70f21bd34c9fefa576eefdb 100644 --- a/tests/slicing/oracle/mark_all_slices.res.oracle +++ b/tests/slicing/oracle/mark_all_slices.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/mark_all_slices.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -105,7 +104,7 @@ D2 FROM \nothing \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function main [pdg] done for function main [slicing] applying all slicing requests... @@ -142,7 +141,7 @@ void main(void) } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [all_slice_1 = (n:54(restrict to __retres) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -177,7 +176,7 @@ void main(void) } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [main_slice_1 = examine_calls] [slicing] applying all slicing requests... @@ -231,8 +230,8 @@ void main(void) } -[slicing] making slicing project 'slicing_2'... -Slicing project worklist [default/slicing_2] = +[slicing] reinitializing slicing ... +Slicing project worklist [default] = [slicing] applying all slicing requests... diff --git a/tests/slicing/oracle/merge.res.oracle b/tests/slicing/oracle/merge.res.oracle index 5d0b2e948806426180927bfbf898362e112099b3..180a343ec28e16b037f899527ee17e12ae421235 100644 --- a/tests/slicing/oracle/merge.res.oracle +++ b/tests/slicing/oracle/merge.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/merge.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -54,7 +53,7 @@ tests/slicing/merge.i:17:[value] warning: signed overflow. assert G3 + a3 ≤ 21 G2 FROM y G3 FROM z [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function init [pdg] done for function init Processing slicing_merge : ... diff --git a/tests/slicing/oracle/min_call.res.oracle b/tests/slicing/oracle/min_call.res.oracle index 0c880a0b9b6cf96a95ba31b00ac6a08f3396c390..ae4a0ffe9217b24533196848304a39fe15b9e17c 100644 --- a/tests/slicing/oracle/min_call.res.oracle +++ b/tests/slicing/oracle/min_call.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/min_call.i (no preprocessing) [kernel] user error: cannot find entry point `g'. Please use option `-main' for specifying a valid entry point. diff --git a/tests/slicing/oracle/ptr_fct.res.oracle b/tests/slicing/oracle/ptr_fct.res.oracle index 798a5c0fdd2d79a5ca0e03839592a7414a390050..b934bce2d92867357751af0bbca9bf7a2baa77b8 100644 --- a/tests/slicing/oracle/ptr_fct.res.oracle +++ b/tests/slicing/oracle/ptr_fct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/ptr_fct.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at h @@ -22,7 +21,7 @@ tests/slicing/ptr_fct.i:17:[kernel] warning: Neither code nor specification for [value] Done for function g [value] Recording results for h [value] done for function h -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function h [from] Computing for function g @@ -76,5 +75,4 @@ PTF h(int a, int b) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_ptr_fct.i (no preprocessing) diff --git a/tests/slicing/oracle/same_sliced_name_bts1422.res.oracle b/tests/slicing/oracle/same_sliced_name_bts1422.res.oracle index 7c103a4f66ba1d7683225badb9318f3a65947a03..49ff99036e34f3c5836676429e13ce85596db711 100644 --- a/tests/slicing/oracle/same_sliced_name_bts1422.res.oracle +++ b/tests/slicing/oracle/same_sliced_name_bts1422.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/same_sliced_name_bts1422.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at foo @@ -10,7 +9,7 @@ tests/slicing/same_sliced_name_bts1422.i:9:[value] warning: signed overflow. assert x + 1 ≤ 2147483647; [value] Recording results for foo [value] done for function foo -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function foo [pdg] done for function foo @@ -35,5 +34,4 @@ void foo(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_same_sliced_name_bts1422.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.0.res.oracle b/tests/slicing/oracle/select_by_annot.0.res.oracle index b964f2747ea420188a9426723001d935f94e72bd..0da721c3e8b13fd2cc25b37078276638846430db 100644 --- a/tests/slicing/oracle/select_by_annot.0.res.oracle +++ b/tests/slicing/oracle/select_by_annot.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -138,7 +137,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a d FROM \nothing \result FROM d [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function main [pdg] done for function main [slicing] applying all slicing requests... @@ -149,18 +148,18 @@ RESULT for main: {n3}: VarDecl : b {n4}: VarDecl : c {n5}: VarDecl : x - {n6}: a = 0; + {n6}: int a = 0; -[-c-]-> 1 -[a--]-> 2 - {n7}: b = 0; + {n7}: int b = 0; -[-c-]-> 1 -[a--]-> 3 - {n8}: c = 0; + {n8}: int c = 0; -[-c-]-> 1 -[a--]-> 4 {n9}: d > 0 -[-c-]-> 1 - -[--d]-> 58 + -[--d]-> 57 {n10}: ; -[-c-]-> 1 -[-c-]-> 9 @@ -170,9 +169,7 @@ RESULT for main: -[-c-]-> 9 {n12}: ; -[-c-]-> 1 - {n13}: block - -[-c-]-> 1 - {n14}: x = ((a + b) + c) + d; + {n13}: int x = ((a + b) + c) + d; -[-c-]-> 1 -[--d]-> 2 -[--d]-> 3 @@ -182,197 +179,196 @@ RESULT for main: -[--d]-> 7 -[--d]-> 8 -[--d]-> 11 - -[-c-]-> 13 - -[--d]-> 58 - {n15}: Call123-InCtrl : modifS(a,b); + -[--d]-> 57 + {n14}: Call113-InCtrl : modifS(a,b); -[-c-]-> 1 - {n16}: Call123-In1 : modifS(a,b); + {n15}: Call113-In1 : modifS(a,b); -[-c-]-> 1 -[--d]-> 2 -[--d]-> 6 -[--d]-> 11 - -[-c-]-> 15 - {n17}: Call123-In2 : modifS(a,b); + -[-c-]-> 14 + {n16}: Call113-In2 : modifS(a,b); -[-c-]-> 1 -[--d]-> 3 -[--d]-> 7 - -[-c-]-> 15 - {n18}: Call123-Out(S.a) : modifS(a,b); - -[-c-]-> 1 - -[-c-]-> 15 - -[--d]-> 16 - -[--d]-> 57 - {n19}: Call123-Out(S.b) : modifS(a,b); + -[-c-]-> 14 + {n17}: Call113-Out(S.a) : modifS(a,b); -[-c-]-> 1 - -[-c-]-> 15 - -[--d]-> 17 + -[-c-]-> 14 + -[--d]-> 15 -[--d]-> 56 - {n20}: Call124-InCtrl : d = new_int(); + {n18}: Call113-Out(S.b) : modifS(a,b); -[-c-]-> 1 - {n21}: Call124-OutRet : d = new_int(); + -[-c-]-> 14 + -[--d]-> 16 + -[--d]-> 55 + {n19}: Call114-InCtrl : d = new_int(); -[-c-]-> 1 - -[-c-]-> 20 - {n22}: Call125-InCtrl : f1(d); + {n20}: Call114-OutRet : d = new_int(); -[-c-]-> 1 - {n23}: Call125-In1 : f1(d); + -[-c-]-> 19 + {n21}: Call115-InCtrl : f1(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 22 - {n24}: Call125-Out(Sa) : f1(d); + {n22}: Call115-In1 : f1(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 22 - -[--d]-> 23 - {n25}: Call126-InCtrl : f2(d); + -[--d]-> 20 + -[-c-]-> 21 + {n23}: Call115-Out(Sa) : f1(d); -[-c-]-> 1 - {n26}: Call126-In1 : f2(d); + -[--d](S.a)-> 17 + -[-c-]-> 21 + -[--d]-> 22 + {n24}: Call116-InCtrl : f2(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 25 - {n27}: Call126-Out(Sa) : f2(d); + {n25}: Call116-In1 : f2(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 25 - -[--d]-> 26 - {n28}: Call127-InCtrl : f3(d); + -[--d]-> 20 + -[-c-]-> 24 + {n26}: Call116-Out(Sa) : f2(d); -[-c-]-> 1 - {n29}: Call127-In1 : f3(d); + -[--d](S.a)-> 17 + -[-c-]-> 24 + -[--d]-> 25 + {n27}: Call117-InCtrl : f3(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 28 - {n30}: Call127-Out(Sa) : f3(d); + {n28}: Call117-In1 : f3(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 28 - -[--d]-> 29 - {n31}: Call128-InCtrl : f4(d); + -[--d]-> 20 + -[-c-]-> 27 + {n29}: Call117-Out(Sa) : f3(d); -[-c-]-> 1 - {n32}: Call128-In1 : f4(d); + -[--d](S.a)-> 17 + -[-c-]-> 27 + -[--d]-> 28 + {n30}: Call118-InCtrl : f4(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 31 - {n33}: Call128-Out(Sa) : f4(d); + {n31}: Call118-In1 : f4(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 31 - -[--d]-> 32 - {n34}: Call129-InCtrl : f5(d); + -[--d]-> 20 + -[-c-]-> 30 + {n32}: Call118-Out(Sa) : f4(d); -[-c-]-> 1 - {n35}: Call129-In1 : f5(d); + -[--d](S.a)-> 17 + -[-c-]-> 30 + -[--d]-> 31 + {n33}: Call119-InCtrl : f5(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 34 - {n36}: Call129-Out(Sa) : f5(d); + {n34}: Call119-In1 : f5(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 34 - -[--d]-> 35 - {n37}: Call130-InCtrl : f6(d); + -[--d]-> 20 + -[-c-]-> 33 + {n35}: Call119-Out(Sa) : f5(d); -[-c-]-> 1 - {n38}: Call130-In1 : f6(d); + -[--d](S.a)-> 17 + -[-c-]-> 33 + -[--d]-> 34 + {n36}: Call120-InCtrl : f6(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 37 - {n39}: Call130-Out(Sa) : f6(d); + {n37}: Call120-In1 : f6(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 37 - -[--d]-> 38 - {n40}: Call131-InCtrl : f7(d); + -[--d]-> 20 + -[-c-]-> 36 + {n38}: Call120-Out(Sa) : f6(d); -[-c-]-> 1 - {n41}: Call131-In1 : f7(d); + -[--d](S.a)-> 17 + -[-c-]-> 36 + -[--d]-> 37 + {n39}: Call121-InCtrl : f7(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 40 - {n42}: Call131-Out(Sa) : f7(d); + {n40}: Call121-In1 : f7(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 40 - -[--d]-> 41 - {n43}: Call132-InCtrl : f8(d); + -[--d]-> 20 + -[-c-]-> 39 + {n41}: Call121-Out(Sa) : f7(d); -[-c-]-> 1 - {n44}: Call132-In1 : f8(d); + -[--d](S.a)-> 17 + -[-c-]-> 39 + -[--d]-> 40 + {n42}: Call122-InCtrl : f8(d); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 43 - {n45}: Call132-Out(S.a) : f8(d); + {n43}: Call122-In1 : f8(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 43 - -[--d]-> 44 - {n46}: Call132-Out(Sa) : f8(d); + -[--d]-> 20 + -[-c-]-> 42 + {n44}: Call122-Out(S.a) : f8(d); -[-c-]-> 1 - -[--d](S.a)-> 18 - -[-c-]-> 43 - -[--d]-> 44 - {n47}: Call133-InCtrl : f9(d,a); + -[--d](S.a)-> 17 + -[-c-]-> 42 + -[--d]-> 43 + {n45}: Call122-Out(Sa) : f8(d); -[-c-]-> 1 - {n48}: Call133-In1 : f9(d,a); + -[--d](S.a)-> 17 + -[-c-]-> 42 + -[--d]-> 43 + {n46}: Call123-InCtrl : f9(d,a); -[-c-]-> 1 - -[--d]-> 21 - -[-c-]-> 47 - {n49}: Call133-In2 : f9(d,a); + {n47}: Call123-In1 : f9(d,a); + -[-c-]-> 1 + -[--d]-> 20 + -[-c-]-> 46 + {n48}: Call123-In2 : f9(d,a); -[-c-]-> 1 -[--d]-> 2 -[--d]-> 6 -[--d]-> 11 - -[-c-]-> 47 - {n50}: Call133-Out(X9) : f9(d,a); + -[-c-]-> 46 + {n49}: Call123-Out(X9) : f9(d,a); -[-c-]-> 1 - -[-c-]-> 47 + -[-c-]-> 46 + -[--d]-> 47 -[--d]-> 48 - -[--d]-> 49 - {n51}: Call133-Out(Y9) : f9(d,a); + {n50}: Call123-Out(Y9) : f9(d,a); -[-c-]-> 1 - -[-c-]-> 47 - -[--d]-> 55 - {n52}: Call133-Out(Z9) : f9(d,a); + -[-c-]-> 46 + -[--d]-> 54 + {n51}: Call123-Out(Z9) : f9(d,a); -[-c-]-> 1 - -[-c-]-> 47 - -[--d]-> 49 - {n53}: return x; + -[-c-]-> 46 + -[--d]-> 48 + {n52}: return x; -[-c-]-> 1 -[--d]-> 5 - -[--d]-> 14 - {n54}: OutRet - -[--d]-> 53 - {n55}: In(Z9) - {n56}: In(S.b) - {n57}: In(S.a) - {n58}: In(d) + -[--d]-> 13 + {n53}: OutRet + -[--d]-> 52 + {n54}: In(Z9) + {n55}: In(S.b) + {n56}: In(S.a) + {n57}: In(d) [pdg] computing for function modifS [pdg] done for function modifS [slicing] applying all slicing requests... [slicing] applying 1 actions... [slicing] applying actions: 1/1... RESULT for modifS: - {n59}: InCtrl - {n60}: VarDecl : a - -[a--]-> 61 - {n61}: In1 + {n58}: InCtrl + {n59}: VarDecl : a -[a--]-> 60 - {n62}: VarDecl : b - -[a--]-> 63 - {n63}: In2 + {n60}: In1 + -[a--]-> 59 + {n61}: VarDecl : b -[a--]-> 62 - {n64}: S.a += a; - -[-c-]-> 59 + {n62}: In2 + -[a--]-> 61 + {n63}: S.a += a; + -[-c-]-> 58 + -[--d]-> 59 -[--d]-> 60 + -[--d]-> 68 + {n64}: S.b -= b; + -[-c-]-> 58 -[--d]-> 61 - -[--d]-> 69 - {n65}: S.b -= b; - -[-c-]-> 59 -[--d]-> 62 - -[--d]-> 63 - -[--d]-> 68 - {n66}: ; - -[-c-]-> 59 - {n67}: return; - -[-c-]-> 59 - {n68}: In(S.b) - {n69}: In(S.a) -Slicing project worklist [default/slicing_1] = -[modifS = (n:66 ,<[ S ], [---]>)(n:64(restrict to S.a) ,<[--d], [---]>)(n:66 , + -[--d]-> 67 + {n65}: ; + -[-c-]-> 58 + {n66}: return; + -[-c-]-> 58 + {n67}: In(S.b) + {n68}: In(S.a) +Slicing project worklist [default] = +[modifS = (n:65 ,<[ S ], [---]>)(n:63(restrict to S.a) ,<[--d], [---]>)(n:65 , <[ S ], [---]>)] @@ -420,16 +416,12 @@ main_slice_1: /**/int main(void) { - /* <[--d], [---]> */ int a; - /* <[--d], [---]> */ int b; - /* <[---], [---]> */ int c; - /* <[---], [---]> */ int x; /* <[--d], [---]> */ - a = 0; + /* <[--d], [---]> */ int a = 0; /* <[--d], [---]> */ - b = 0; + /* <[--d], [---]> */ int b = 0; /* <[---], [---]> */ - c = 0; + /* <[---], [---]> */ int c = 0; /* <[--d], [---]> */ if (d > 0) { /*@ assert b ≡ 0; */ /* <[---], [---]> */ @@ -439,12 +431,11 @@ main_slice_1: } /*@ slice pragma expr a + b; */ /* <[ S ], [---]> */ ; - /* <[---], [ S ]> */ /*@ assert Value: signed_overflow: (int)((int)(a + b) + c) + d ≤ 2147483647; */ /* <[---], [---]> */ - x = ((a + b) + c) + d; + /* <[---], [---]> */ int x = ((a + b) + c) + d; /* sig call: (InCtrl: <[--d], [---]>) (In1: <[--d], [---]>) */ /* call to modifS_slice_1: @@ -477,7 +468,7 @@ main_slice_1: return x; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [slicing] exporting project to 'Sliced code'... @@ -501,10 +492,8 @@ void modifS_slice_1(int a) int d; void main(void) { - int a; - int b; - a = 0; - b = 0; + int a = 0; + int b = 0; if (d > 0) { /*@ assert b ≡ 0; */ ; a = 1; @@ -559,16 +548,12 @@ main_slice_1: /**/int main(void) { - /* <[--d], [---]> */ int a; - /* <[--d], [---]> */ int b; - /* <[---], [---]> */ int c; - /* <[---], [---]> */ int x; /* <[--d], [---]> */ - a = 0; + /* <[--d], [---]> */ int a = 0; /* <[--d], [---]> */ - b = 0; + /* <[--d], [---]> */ int b = 0; /* <[---], [---]> */ - c = 0; + /* <[---], [---]> */ int c = 0; /* <[--d], [---]> */ if (d > 0) { /*@ assert b ≡ 0; */ /* <[---], [---]> */ @@ -578,12 +563,11 @@ main_slice_1: } /*@ slice pragma expr a + b; */ /* <[ S ], [---]> */ ; - /* <[---], [ S ]> */ /*@ assert Value: signed_overflow: (int)((int)(a + b) + c) + d ≤ 2147483647; */ /* <[---], [---]> */ - x = ((a + b) + c) + d; + /* <[---], [---]> */ int x = ((a + b) + c) + d; /* sig call: (InCtrl: <[--d], [---]>) (In1: <[--d], [---]>) */ /* call to modifS_slice_1: @@ -616,7 +600,7 @@ main_slice_1: return x; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [slicing] exporting project to 'Sliced code'... @@ -640,10 +624,8 @@ void modifS_slice_1(int a) int d; void main(void) { - int a; - int b; - a = 0; - b = 0; + int a = 0; + int b = 0; if (d > 0) { /*@ assert b ≡ 0; */ ; a = 1; diff --git a/tests/slicing/oracle/select_by_annot.1.res.oracle b/tests/slicing/oracle/select_by_annot.1.res.oracle index 954b046c5ce3fb3baafb7fd2d66dd4f1b1f04d5f..8e11a76392495503214e3061cd9be61079066698 100644 --- a/tests/slicing/oracle/select_by_annot.1.res.oracle +++ b/tests/slicing/oracle/select_by_annot.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -157,10 +156,8 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a int d; void main(void) { - int a; - int b; - a = 0; - b = 0; + int a = 0; + int b = 0; if (d > 0) { /*@ assert b ≡ 0; */ ; a = 1; @@ -170,5 +167,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.10.res.oracle b/tests/slicing/oracle/select_by_annot.10.res.oracle index f482f208dcc9588b5616bf45a26a68033b3cb2dd..a165bceaf13c9101444ecf3e0d36a2bc15b5357c 100644 --- a/tests/slicing/oracle/select_by_annot.10.res.oracle +++ b/tests/slicing/oracle/select_by_annot.10.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f7 [pdg] done for function f7 @@ -162,8 +161,7 @@ struct Tstr S; int Sa; void f7_slice_1(int cond) { - int *p; - p = & S.a; + int *p = & S.a; if (cond) { /*@ slice pragma stmt; */ { @@ -175,5 +173,4 @@ void f7_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_10_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.11.res.oracle b/tests/slicing/oracle/select_by_annot.11.res.oracle index 22f71c65011c9e805c452d55c8b07cbd84c8439f..94ba3992aefaa8d14b39c1d319548a9c4f861609 100644 --- a/tests/slicing/oracle/select_by_annot.11.res.oracle +++ b/tests/slicing/oracle/select_by_annot.11.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f8 [pdg] done for function f8 @@ -166,5 +165,4 @@ void f8_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_11_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.12.res.oracle b/tests/slicing/oracle/select_by_annot.12.res.oracle index 4dceef2297f3e1b660a0541a4feeec6b49a63867..378f1d898891a0b8f7d062aecbdcb58c192bb61a 100644 --- a/tests/slicing/oracle/select_by_annot.12.res.oracle +++ b/tests/slicing/oracle/select_by_annot.12.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f8 [pdg] done for function f8 @@ -173,5 +172,4 @@ void f8_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_12_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.13.res.oracle b/tests/slicing/oracle/select_by_annot.13.res.oracle index 29f22ac671be22f74f8b8f62ed9f1718cc8fd6f0..893346a02ee01ac01aee5b253a1f7c378bd38567 100644 --- a/tests/slicing/oracle/select_by_annot.13.res.oracle +++ b/tests/slicing/oracle/select_by_annot.13.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f8 [pdg] done for function f8 @@ -161,8 +160,7 @@ struct Tstr { struct Tstr S; void f8_slice_1(int cond) { - int *p; - p = & S.a; + int *p = & S.a; /*@ loop invariant cond ≥ 0; loop variant cond; */ while (cond) { @@ -173,5 +171,4 @@ void f8_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_13_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.14.res.oracle b/tests/slicing/oracle/select_by_annot.14.res.oracle index 03575b6c2cce93986a9612ab9c64f0415a29342b..59ab45846bff2c8f6bbeb7bbe6f3d166e5cf1918 100644 --- a/tests/slicing/oracle/select_by_annot.14.res.oracle +++ b/tests/slicing/oracle/select_by_annot.14.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f9 [pdg] done for function f9 @@ -165,5 +164,4 @@ void f9_slice_1(int c1, int c2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_14_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.2.res.oracle b/tests/slicing/oracle/select_by_annot.2.res.oracle index 4c9886b94da2318972ada35f907d246d592def53..8144aa595692c5e434358fe3a0fa6f2843b6da01 100644 --- a/tests/slicing/oracle/select_by_annot.2.res.oracle +++ b/tests/slicing/oracle/select_by_annot.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -157,13 +156,11 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a int d; void main(void) { - int b; - b = 0; + int b = 0; if (d > 0) /*@ assert b ≡ 0; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.3.res.oracle b/tests/slicing/oracle/select_by_annot.3.res.oracle index 871481b8b7ace8738fcf3f588dfea3198700caa3..894e939a1549832ac7b14e72acc7e01b0fc00f75 100644 --- a/tests/slicing/oracle/select_by_annot.3.res.oracle +++ b/tests/slicing/oracle/select_by_annot.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function modifS [pdg] done for function modifS @@ -167,5 +166,4 @@ void modifS_slice_1(int a) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.4.res.oracle b/tests/slicing/oracle/select_by_annot.4.res.oracle index bccb60b65df81425f5bebd866b50029f83fe20a5..8ff8efb902b7d99f53b3dc2872ffc111366e20e9 100644 --- a/tests/slicing/oracle/select_by_annot.4.res.oracle +++ b/tests/slicing/oracle/select_by_annot.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f1 [pdg] done for function f1 @@ -161,12 +160,10 @@ struct Tstr { struct Tstr S; void f1_slice_1(void) { - int *p; - p = & S.a; + int *p = & S.a; /*@ slice pragma expr *p; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.5.res.oracle b/tests/slicing/oracle/select_by_annot.5.res.oracle index be6f47aedf112af3dc325fb412109e35a889e051..a334cb6fdcef4872b89639f1d67c5371f4cf55f9 100644 --- a/tests/slicing/oracle/select_by_annot.5.res.oracle +++ b/tests/slicing/oracle/select_by_annot.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f2 [pdg] done for function f2 @@ -166,5 +165,4 @@ void f2_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.6.res.oracle b/tests/slicing/oracle/select_by_annot.6.res.oracle index f5567ddbb88b1784f5c6863548a4a918ea27db76..6328a77cd55136feeb56f8dd441159dd7d45955b 100644 --- a/tests/slicing/oracle/select_by_annot.6.res.oracle +++ b/tests/slicing/oracle/select_by_annot.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f3 [pdg] done for function f3 @@ -162,5 +161,4 @@ void f3_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.7.res.oracle b/tests/slicing/oracle/select_by_annot.7.res.oracle index d56ef77bca84f6af23a786264f512ecbe12e4bd2..22041fa725d0905a569ce72c8373cdffe5c9f04d 100644 --- a/tests/slicing/oracle/select_by_annot.7.res.oracle +++ b/tests/slicing/oracle/select_by_annot.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f4 [pdg] done for function f4 @@ -162,8 +161,7 @@ struct Tstr S; int Sa; void f4_slice_1(int cond) { - int *p; - p = & S.a; + int *p = & S.a; if (cond) /*@ slice pragma stmt; */ Sa = *p; @@ -171,5 +169,4 @@ void f4_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.8.res.oracle b/tests/slicing/oracle/select_by_annot.8.res.oracle index b26747a856884e12aa7ce588e6a19551d543f497..cd44c93f153fdc44a8851b57e6f7bc96efcece4e 100644 --- a/tests/slicing/oracle/select_by_annot.8.res.oracle +++ b/tests/slicing/oracle/select_by_annot.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f5 [pdg] done for function f5 @@ -162,5 +161,4 @@ void f5_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_8_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_by_annot.9.res.oracle b/tests/slicing/oracle/select_by_annot.9.res.oracle index 1a6ee41ffa2e0f53672962fa7678dda341bdf72a..ef309cf69ce6585b13b6269a06cb0163ba0d1ba9 100644 --- a/tests/slicing/oracle/select_by_annot.9.res.oracle +++ b/tests/slicing/oracle/select_by_annot.9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_by_annot.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -139,7 +138,7 @@ tests/slicing/select_by_annot.i:104:[value] warning: signed overflow. assert S.a \result FROM d [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f6 [pdg] done for function f6 @@ -162,8 +161,7 @@ struct Tstr S; int Sa; void f6_slice_1(int cond) { - int *p; - p = & S.a; + int *p = & S.a; /*@ slice pragma stmt; */ if (cond) { Sa = *p; @@ -173,5 +171,4 @@ void f6_slice_1(int cond) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_9_select_by_annot.i (no preprocessing) diff --git a/tests/slicing/oracle/select_calls.0.res.oracle b/tests/slicing/oracle/select_calls.0.res.oracle index c677d43b3c3ec47a86fb371054effd46e62c6abc..5c6ea0047570b610d113a77f147291fc68487e9b 100644 --- a/tests/slicing/oracle/select_calls.0.res.oracle +++ b/tests/slicing/oracle/select_calls.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_calls.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at f @@ -42,7 +41,7 @@ tests/slicing/select_calls.i:30:[kernel] warning: Neither code nor specification [value] Done for function send [value] Recording results for f [value] done for function f -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function send @@ -74,12 +73,9 @@ int c; int d; void f(void) { - int x; - int y; - int z; - x = 0; - y = 1; - z = x; + int x = 0; + int y = 1; + int z = x; send(y); send(z); crypt(& y); @@ -94,5 +90,4 @@ void f(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_select_calls.i (no preprocessing) diff --git a/tests/slicing/oracle/select_calls.1.res.oracle b/tests/slicing/oracle/select_calls.1.res.oracle index 7412876bb9e45c5d048cbe3a965ff88855a73357..6bc173fffa9588c47cac7a7a4964888674be2acf 100644 --- a/tests/slicing/oracle/select_calls.1.res.oracle +++ b/tests/slicing/oracle/select_calls.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_calls.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at g @@ -14,7 +13,7 @@ tests/slicing/select_calls.i:42:[kernel] warning: Neither code nor specification [value] Done for function nothing [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function g [from] Computing for function nothing @@ -41,5 +40,4 @@ void g(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_select_calls.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.0.res.oracle b/tests/slicing/oracle/select_return.0.res.oracle index bc9c9ded19053e76131c844d32174efec2c04af0..57104dd7e2453d709906437f4c0314d11ac32a50 100644 --- a/tests/slicing/oracle/select_return.0.res.oracle +++ b/tests/slicing/oracle/select_return.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -99,8 +98,7 @@ void send_bis(int x); int k(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; H = c; if (cond) send_bis(d); @@ -111,15 +109,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int r; - int z; - r = k(0,y,0,0); - z = k(G,0,0,0); + int r = k(0,y,0,0); + int z = k(G,0,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.1.res.oracle b/tests/slicing/oracle/select_return.1.res.oracle index 8f8549255b86e948afce5c9a32f7d8399db07a84..606706050b8975485237387cfe316e6461d69ed7 100644 --- a/tests/slicing/oracle/select_return.1.res.oracle +++ b/tests/slicing/oracle/select_return.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -105,14 +104,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.10.res.oracle b/tests/slicing/oracle/select_return.10.res.oracle index 4096123667ddb32a0ef44730809e7a184a0b414e..89bb2c1084979dc6f7ff6bdbbda49ef3298852de 100644 --- a/tests/slicing/oracle/select_return.10.res.oracle +++ b/tests/slicing/oracle/select_return.10.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -105,8 +104,7 @@ void send_bis(int x); void k_slice_2(int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return; @@ -114,8 +112,7 @@ void k_slice_2(int b, int d) int k_slice_1(int a, int d) { - int cond; - cond = get(d); + int cond = get(d); if (cond) send_bis(d); return a; } @@ -131,15 +128,13 @@ void g(int b) void f_slice_1(int y) { - int z; k_slice_2(0,0); k_slice_2(y,0); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_10_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.11.res.oracle b/tests/slicing/oracle/select_return.11.res.oracle index f013ef98481cbcdb26966fab40b4912b00c06336..6cde0e3ed0dcfa0ec1d7024e91628b9e62d35a70 100644 --- a/tests/slicing/oracle/select_return.11.res.oracle +++ b/tests/slicing/oracle/select_return.11.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -96,8 +95,7 @@ void send_bis(int x); int k(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; H = c; if (cond) send_bis(d); @@ -108,14 +106,11 @@ int f_slice_1(int y); int f_slice_1(int y) { - int r; - int z; - r = k(0,y,0,0); - z = k(G,0,0,0); + int r = k(0,y,0,0); + int z = k(G,0,0,0); /*@ slice pragma expr z; */ ; return z; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_11_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.12.res.oracle b/tests/slicing/oracle/select_return.12.res.oracle index 2344f777be3a1936a3d8ce968fd2be81bc60d5b7..e4ba55085c41a24e8ce1c1234938beb60895956d 100644 --- a/tests/slicing/oracle/select_return.12.res.oracle +++ b/tests/slicing/oracle/select_return.12.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -102,13 +101,11 @@ int f_slice_1(int y); int f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; return z; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_12_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.13.res.oracle b/tests/slicing/oracle/select_return.13.res.oracle index ab7f7a480450f904acf18514b4ed878bc185a013..be6877cdbfb467eac4045974d09832d5bac83176 100644 --- a/tests/slicing/oracle/select_return.13.res.oracle +++ b/tests/slicing/oracle/select_return.13.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -100,13 +99,11 @@ int f_slice_1(int y); int f_slice_1(int y) { - int z; k_slice_1(0,y); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; return z; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_13_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.14.res.oracle b/tests/slicing/oracle/select_return.14.res.oracle index 10059935261f8ffacdbff0d7875698fbc51b1b40..20e5b5ddd4c6ec45016d11bfaf56d4bb2640a0e8 100644 --- a/tests/slicing/oracle/select_return.14.res.oracle +++ b/tests/slicing/oracle/select_return.14.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -105,13 +104,11 @@ int f_slice_1(int y); int f_slice_1(int y) { - int z; k_slice_2(y); - z = k_slice_1(G); + int z = k_slice_1(G); /*@ slice pragma expr z; */ ; return z; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_14_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.15.res.oracle b/tests/slicing/oracle/select_return.15.res.oracle index e3a9d154317d51850a991d8371ed1fd3cc58f5e7..68451bd51ac6125bcc306b21d321d83162683c67 100644 --- a/tests/slicing/oracle/select_return.15.res.oracle +++ b/tests/slicing/oracle/select_return.15.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -96,8 +95,7 @@ void send_bis(int x); int k(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; H = c; if (cond) send_bis(d); @@ -108,14 +106,11 @@ void f_slice_1(int y); void f_slice_1(int y) { - int r; - int z; - r = k(0,y,0,0); - z = k(G,0,0,0); + int r = k(0,y,0,0); + int z = k(G,0,0,0); /*@ slice pragma expr z; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_15_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.16.res.oracle b/tests/slicing/oracle/select_return.16.res.oracle index d7a19336d1290e8331abf3ef046e9c938af27a9b..19b9e271c38cab866fc727876ba3597c5eab0506 100644 --- a/tests/slicing/oracle/select_return.16.res.oracle +++ b/tests/slicing/oracle/select_return.16.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -102,13 +101,11 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_16_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.17.res.oracle b/tests/slicing/oracle/select_return.17.res.oracle index 0f270bcd4b49f22307ff1d2607702756efd687f0..8a133f4637f01a35d79a17d64cdad4b0d55014fc 100644 --- a/tests/slicing/oracle/select_return.17.res.oracle +++ b/tests/slicing/oracle/select_return.17.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -100,13 +99,11 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_17_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.18.res.oracle b/tests/slicing/oracle/select_return.18.res.oracle index 1a9d49bde8e14c1f4a458f317197f054145fbbbf..896bc3f9546f3f2cfc822d4875c4d140cbbd8ca0 100644 --- a/tests/slicing/oracle/select_return.18.res.oracle +++ b/tests/slicing/oracle/select_return.18.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -105,13 +104,11 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_2(y); - z = k_slice_1(G); + int z = k_slice_1(G); /*@ slice pragma expr z; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_18_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.19.res.oracle b/tests/slicing/oracle/select_return.19.res.oracle index baa67c1849743de47cdf5fd9130d991f0ed93aa1..da575ca555e6ba4368dc8861fb0687790ebbec4a 100644 --- a/tests/slicing/oracle/select_return.19.res.oracle +++ b/tests/slicing/oracle/select_return.19.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function g [from] Computing for function k @@ -118,5 +117,4 @@ void f_slice_1(int y) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_19_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.2.res.oracle b/tests/slicing/oracle/select_return.2.res.oracle index 9e3991d709fb7260bbd898f86223cc3d3bf97ae3..101a3715fe805b57316db4ae629322715287641b 100644 --- a/tests/slicing/oracle/select_return.2.res.oracle +++ b/tests/slicing/oracle/select_return.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -103,14 +102,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.20.res.oracle b/tests/slicing/oracle/select_return.20.res.oracle index aa81bcd1c33cc90e1444400cd5b2fc3866f6bbc3..f07e7f6c96062da599e5fce77a203f6d38bc8752 100644 --- a/tests/slicing/oracle/select_return.20.res.oracle +++ b/tests/slicing/oracle/select_return.20.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function g [from] Computing for function k @@ -115,5 +114,4 @@ void f_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_20_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.21.res.oracle b/tests/slicing/oracle/select_return.21.res.oracle index 2829d8768276e7a50a798204fdc9a8cd1532fc93..46ac86515b74ecc08a981b041f5a65bbe7e5e282 100644 --- a/tests/slicing/oracle/select_return.21.res.oracle +++ b/tests/slicing/oracle/select_return.21.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function g [from] Computing for function k @@ -115,5 +114,4 @@ void f_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_21_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.3.res.oracle b/tests/slicing/oracle/select_return.3.res.oracle index 24482fbc40c4d8f49156d0bfb8770524f4308a98..e9d6ec34383404ee70dd3133a8eaea70045c6d98 100644 --- a/tests/slicing/oracle/select_return.3.res.oracle +++ b/tests/slicing/oracle/select_return.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -108,14 +107,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_2(y); - z = k_slice_1(G); + int z = k_slice_1(G); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.4.res.oracle b/tests/slicing/oracle/select_return.4.res.oracle index 176aab3ffc17e292b5c4d1bcfc8bb7d0319f8cb3..f989ac8131b19f9db901fd1fa245f3306e21f6a6 100644 --- a/tests/slicing/oracle/select_return.4.res.oracle +++ b/tests/slicing/oracle/select_return.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -101,8 +100,7 @@ void send_bis(int x); int k_slice_1(int a, int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return a; @@ -112,14 +110,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.5.res.oracle b/tests/slicing/oracle/select_return.5.res.oracle index ace623ce308217c1c884a726b2c48cc7074953b3..fbfc5a87537b24fb47c2bc6fdb1f2263d9976b84 100644 --- a/tests/slicing/oracle/select_return.5.res.oracle +++ b/tests/slicing/oracle/select_return.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -101,8 +100,7 @@ void send_bis(int x); int k_slice_1(int a, int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return a; @@ -112,14 +110,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.6.res.oracle b/tests/slicing/oracle/select_return.6.res.oracle index 4bd9a3cbd7c974bf6d934cd7f59ade95382d0997..e1a17868589a25f6377e9bac178d1234a6d1a9f9 100644 --- a/tests/slicing/oracle/select_return.6.res.oracle +++ b/tests/slicing/oracle/select_return.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -101,8 +100,7 @@ void send_bis(int x); int k_slice_1(int a, int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return a; @@ -112,14 +110,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.7.res.oracle b/tests/slicing/oracle/select_return.7.res.oracle index 164ee62eed678a0e4e45604096824e83805f7a2a..6b6677607d87f1d578e44210fcfdedbc333738ef 100644 --- a/tests/slicing/oracle/select_return.7.res.oracle +++ b/tests/slicing/oracle/select_return.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -101,8 +100,7 @@ void send_bis(int x); void k_slice_2(int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return; @@ -110,8 +108,7 @@ void k_slice_2(int b, int d) int k_slice_1(int a, int d) { - int cond; - cond = get(d); + int cond = get(d); if (cond) send_bis(d); return a; } @@ -120,14 +117,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_2(y,0); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.8.res.oracle b/tests/slicing/oracle/select_return.8.res.oracle index 83bfaaf548397fbc060ae30244c400ce32b95e46..9144625995a018972c9cb877d978ab612bc7cb7b 100644 --- a/tests/slicing/oracle/select_return.8.res.oracle +++ b/tests/slicing/oracle/select_return.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -105,8 +104,7 @@ void send_bis(int x); int k_slice_1(int a, int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return a; @@ -123,15 +121,13 @@ void g(int b) void f_slice_1(int y) { - int z; k_slice_1(0,0,0); k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_8_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return.9.res.oracle b/tests/slicing/oracle/select_return.9.res.oracle index cf312bb2ae3c777510a4d57883defd1d65590b59..ae30a6443ba34369d4935b106b08640036f60336 100644 --- a/tests/slicing/oracle/select_return.9.res.oracle +++ b/tests/slicing/oracle/select_return.9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return.i (no preprocessing) tests/slicing/select_return.i:45:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -64,7 +63,7 @@ tests/slicing/select_return.i:53:[kernel] warning: Neither code nor specificatio [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -105,8 +104,7 @@ void send_bis(int x); int k_slice_1(int a, int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; if (cond) send_bis(d); return a; @@ -123,15 +121,13 @@ void g(int b) void f_slice_1(int y) { - int z; k_slice_1(0,0,0); k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_9_select_return.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.0.res.oracle b/tests/slicing/oracle/select_return_bis.0.res.oracle index ebab6aa14f48f95fdf2cf029a28c57ac4c310645..c25d87b11de6f3ec22c2e78a67c27eeabae5abf6 100644 --- a/tests/slicing/oracle/select_return_bis.0.res.oracle +++ b/tests/slicing/oracle/select_return_bis.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -124,8 +123,7 @@ void k_bis(int ab, int c, int d) int k(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; k_bis(cond,c,d); return a; @@ -135,15 +133,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int r; - int z; - r = k(0,y,0,0); - z = k(G,0,0,0); + int r = k(0,y,0,0); + int z = k(G,0,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.1.res.oracle b/tests/slicing/oracle/select_return_bis.1.res.oracle index f45331de5e3ecdaf51a370f0f4b13de829452e00..e3437e9872c9a65a298b2273dc80c5b7058ed3d2 100644 --- a/tests/slicing/oracle/select_return_bis.1.res.oracle +++ b/tests/slicing/oracle/select_return_bis.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -131,14 +130,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.10.res.oracle b/tests/slicing/oracle/select_return_bis.10.res.oracle index 34ad3c304ade31b057addcff14cf20a61d6ab94e..5b6a71833251037713f4569e879b5ac4a64562d5 100644 --- a/tests/slicing/oracle/select_return_bis.10.res.oracle +++ b/tests/slicing/oracle/select_return_bis.10.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -131,8 +130,7 @@ void k_bis_slice_1(int ab, int d) void k_slice_2(int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; k_bis_slice_1(cond,d); return; @@ -140,8 +138,7 @@ void k_slice_2(int b, int d) int k_slice_1(int a, int d) { - int cond; - cond = get(d); + int cond = get(d); k_bis_slice_1(cond,d); return a; } @@ -157,15 +154,13 @@ void g(int b) void f_slice_1(int y) { - int z; k_slice_2(0,0); k_slice_2(y,0); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_10_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.2.res.oracle b/tests/slicing/oracle/select_return_bis.2.res.oracle index 30dfcdbc3e05774617ae81d6c61d883401b1d97f..fc8815c1bfb3951a1d5f3c11c654a82ce9438461 100644 --- a/tests/slicing/oracle/select_return_bis.2.res.oracle +++ b/tests/slicing/oracle/select_return_bis.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -121,14 +120,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.3.res.oracle b/tests/slicing/oracle/select_return_bis.3.res.oracle index 9613acdaaaa0f106ffa422cbb72e24dbb4eecea8..39bcafbad65b5b2305869535a6eb918c761b8596 100644 --- a/tests/slicing/oracle/select_return_bis.3.res.oracle +++ b/tests/slicing/oracle/select_return_bis.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -126,14 +125,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_2(y); - z = k_slice_1(G); + int z = k_slice_1(G); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.4.res.oracle b/tests/slicing/oracle/select_return_bis.4.res.oracle index b7cb7c118a2ab986adcc7869013d0b0815591d76..ce30c33e3a34dce118515aae2833e02a52c77d73 100644 --- a/tests/slicing/oracle/select_return_bis.4.res.oracle +++ b/tests/slicing/oracle/select_return_bis.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -133,8 +132,7 @@ void k_bis_slice_1(int ab, int d) int k(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; k_bis(cond,c,d); return a; @@ -144,15 +142,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int r; - int z; - r = k(0,y,0,0); - z = k(G,0,0,0); + int r = k(0,y,0,0); + int z = k(G,0,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.5.res.oracle b/tests/slicing/oracle/select_return_bis.5.res.oracle index 4ad143e11b35a54c5d439ae9f8e2706f8631c760..ecff421023bc550b464e15189f547f3e95b26661 100644 --- a/tests/slicing/oracle/select_return_bis.5.res.oracle +++ b/tests/slicing/oracle/select_return_bis.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -129,8 +128,7 @@ void k_bis_slice_1(int ab, int c, int d) int k_slice_1(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; k_bis_slice_1(cond,c,d); return a; @@ -140,14 +138,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y,0,0); - z = k_slice_1(G,0,0,0); + int z = k_slice_1(G,0,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.6.res.oracle b/tests/slicing/oracle/select_return_bis.6.res.oracle index de66deae4aa37fe6621eff2de06dc5ae13f13086..11fc4cde60d45ce5001ab326a298f047bd72915f 100644 --- a/tests/slicing/oracle/select_return_bis.6.res.oracle +++ b/tests/slicing/oracle/select_return_bis.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -133,14 +132,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_1(0,y); - z = k_slice_1(G,0); + int z = k_slice_1(G,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.7.res.oracle b/tests/slicing/oracle/select_return_bis.7.res.oracle index 0e2554a1e86b06dcbf514544b260e33a288a2e86..dd9e73f641a0c7df1b0473bd6b55f07bb0511bf7 100644 --- a/tests/slicing/oracle/select_return_bis.7.res.oracle +++ b/tests/slicing/oracle/select_return_bis.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -138,14 +137,12 @@ void f_slice_1(int y); void f_slice_1(int y) { - int z; k_slice_2(y); - z = k_slice_1(G); + int z = k_slice_1(G); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.8.res.oracle b/tests/slicing/oracle/select_return_bis.8.res.oracle index 833e7aa4452e575151a9fc21f2b14d9492047036..501c7f618810a8ff541e5011f3c2b44bcf5427c8 100644 --- a/tests/slicing/oracle/select_return_bis.8.res.oracle +++ b/tests/slicing/oracle/select_return_bis.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -133,8 +132,7 @@ void k_bis_slice_1(int ab, int c, int d) int k_slice_1(int a, int b, int c, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; k_bis_slice_1(cond,c,d); return a; @@ -151,15 +149,13 @@ void g(int b, int c) void f_slice_1(int y) { - int z; k_slice_1(0,0,0,0); k_slice_1(0,y,0,0); - z = k_slice_1(G,0,0,0); + int z = k_slice_1(G,0,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_8_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_return_bis.9.res.oracle b/tests/slicing/oracle/select_return_bis.9.res.oracle index 2e041432b32b5a3652bfd63e33526ac959f1b24a..da155cd81df1ce40a8a75da36ba2ce685c005dcc 100644 --- a/tests/slicing/oracle/select_return_bis.9.res.oracle +++ b/tests/slicing/oracle/select_return_bis.9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_return_bis.i (no preprocessing) tests/slicing/select_return_bis.i:36:[kernel] warning: Calling undeclared function f. Old style K&R code? [slicing] slicing requests in progress... @@ -80,7 +79,7 @@ tests/slicing/select_return_bis.i:44:[kernel] warning: Neither code nor specific [value] Done for function f [value] Recording results for g [value] done for function g -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function k @@ -131,8 +130,7 @@ void k_bis_slice_1(int ab, int d) int k_slice_1(int a, int b, int d) { - int cond; - cond = get(d); + int cond = get(d); G = b; k_bis_slice_1(cond,d); return a; @@ -149,15 +147,13 @@ void g(int b) void f_slice_1(int y) { - int z; k_slice_1(0,0,0); k_slice_1(0,y,0); - z = k_slice_1(G,0,0); + int z = k_slice_1(G,0,0); /*@ slice pragma expr z; */ ; send(z); return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_9_select_return_bis.i (no preprocessing) diff --git a/tests/slicing/oracle/select_simple.res.oracle b/tests/slicing/oracle/select_simple.res.oracle index 5958a59ac2ecb00fe29aeea83df1af5ba7f8f144..c1572e87f4bc463bef447a6722d2f3e97926232c 100644 --- a/tests/slicing/oracle/select_simple.res.oracle +++ b/tests/slicing/oracle/select_simple.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/select_simple.i (no preprocessing) [kernel] user error: cannot find entry point `main'. Please use option `-main' for specifying a valid entry point. diff --git a/tests/slicing/oracle/simple_intra_slice.res.oracle b/tests/slicing/oracle/simple_intra_slice.res.oracle index a5dc3645fdbe27147041cbac46dda68a9e30a6c9..28dd2bb539c546f9618bb17f59173dce87b294b3 100644 --- a/tests/slicing/oracle/simple_intra_slice.res.oracle +++ b/tests/slicing/oracle/simple_intra_slice.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/simple_intra_slice.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,6 +8,8 @@ S ∈ {0} S1 ∈ {0} S2 ∈ {0} +tests/slicing/simple_intra_slice.i:96:[value] warning: initialization of volatile variable uninit ignored +tests/slicing/simple_intra_slice.i:96:[value] warning: initialization of volatile variable uninit2 ignored tests/slicing/simple_intra_slice.i:98:[value] entering loop for the first time tests/slicing/simple_intra_slice.i:99:[value] warning: signed overflow. assert -2147483648 ≤ uninit - 1; tests/slicing/simple_intra_slice.i:99:[value] warning: signed overflow. assert Unknown + 1 ≤ 2147483647; @@ -118,7 +119,7 @@ tests/slicing/simple_intra_slice.i:82:[value] warning: signed overflow. assert s .b FROM Unknown; S1.b; S2.b (and SELF) \result FROM Unknown [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function f1 [pdg] done for function f1 RESULT for f1: @@ -134,10 +135,10 @@ RESULT for f1: {n6}: VarDecl : a {n7}: VarDecl : b {n8}: VarDecl : __retres - {n9}: a = 1; + {n9}: int a = 1; -[-c-]-> 1 -[a--]-> 6 - {n10}: b = 2; + {n10}: int b = 2; -[-c-]-> 1 -[a--]-> 7 {n11}: G = x + a; @@ -162,21 +163,19 @@ RESULT for f1: int f1(int x, int y) { int __retres; - int a; - int b; /* 1 */ - a = 1; + int a = 1; /* 2 */ - b = 2; + int b = 2; /* 3 */ G = x + a; /* 5 */ __retres = y + b; - /* 126 */ + /* 124 */ return __retres; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f1_slice_1 = (n:11 ,<[ S ], [---]>)(n:1 ,<[-c-], [---]>)(n:2 ,<[--d], [---]>)(n:3 , <[--d], [---]>)(n:6 ,<[--d], [---]>)(n:9 ,<[--d], [---]>)] @@ -190,12 +189,10 @@ Print slice = f1_slice_1: (InCtrl: <[-cd], [---]>) /**/int f1(/* <[--d], [---]> */ int x, /* <[---], [---]> */ int y) { /* <[---], [---]> */ int __retres; - /* <[--d], [---]> */ int a; - /* <[---], [---]> */ int b; /* <[--d], [---]> */ - a = 1; + /* <[--d], [---]> */ int a = 1; /* <[---], [---]> */ - b = 2; + /* <[---], [---]> */ int b = 2; /* <[ S ], [---]> */ G = x + a; /* <[---], [---]> */ @@ -213,34 +210,34 @@ RESULT for f2: {n17}: VarDecl : b {n18}: VarDecl : c {n19}: VarDecl : tmp - {n20}: a = 1; + {n20}: int a = 1; -[-c-]-> 15 -[a--]-> 16 - {n21}: b = a + 1; + {n21}: int b = a + 1; -[-c-]-> 15 -[--d]-> 16 -[a--]-> 17 -[--d]-> 20 - {n22}: c = 3; + {n22}: int c = 3; -[-c-]-> 15 -[a--]-> 18 - {n23}: Call11-InCtrl : tmp = f1(b,c); + {n23}: Call10-InCtrl : tmp = f1(b,c); -[-c-]-> 15 - {n24}: Call11-In1 : tmp = f1(b,c); + {n24}: Call10-In1 : tmp = f1(b,c); -[-c-]-> 15 -[--d]-> 17 -[--d]-> 21 -[-c-]-> 23 - {n25}: Call11-In2 : tmp = f1(b,c); + {n25}: Call10-In2 : tmp = f1(b,c); -[-c-]-> 15 -[--d]-> 18 -[--d]-> 22 -[-c-]-> 23 - {n26}: Call11-Out(G) : tmp = f1(b,c); + {n26}: Call10-Out(G) : tmp = f1(b,c); -[-c-]-> 15 -[-c-]-> 23 -[--d]-> 24 - {n27}: Call11-OutRet : tmp = f1(b,c); + {n27}: Call10-OutRet : tmp = f1(b,c); -[-c-]-> 15 -[a--]-> 19 -[-c-]-> 23 @@ -253,23 +250,20 @@ RESULT for f2: -[--d]-> 28 int f2(void) { - int a; - int b; - int c; int tmp; /* 7 */ - a = 1; + int a = 1; + /* 8 */ + int b = a + 1; /* 9 */ - b = a + 1; + int c = 3; /* 10 */ - c = 3; - /* 11 */ tmp = f1(b,c); - /* 12 */ + /* 11 */ return tmp; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f2_slice_1 = (n:22 ,<[ S ], [---]>)(n:15 ,<[-c-], [---]>)(n:18 ,<[a--], [---]>)] @@ -280,16 +274,13 @@ Print slice = f2_slice_1: (InCtrl: <[-c-], [---]>) /**/int f2(void) { - /* <[---], [---]> */ int a; - /* <[---], [---]> */ int b; - /* <[a--], [---]> */ int c; /* <[---], [---]> */ int tmp; /* <[---], [---]> */ - a = 1; + /* <[---], [---]> */ int a = 1; /* <[---], [---]> */ - b = a + 1; + /* <[---], [---]> */ int b = a + 1; /* <[ S ], [---]> */ - c = 3; + /* <[a--], [---]> */ int c = 3; /* invisible call */ /* <[---], [---]> */ tmp = f1(b,c); /* <[---], [---]> */ @@ -308,13 +299,13 @@ RESULT for f3: {n33}: VarDecl : a {n34}: VarDecl : b {n35}: VarDecl : x - {n36}: a = 1; + {n36}: int a = 1; -[-c-]-> 30 -[a--]-> 33 - {n37}: b = 2; + {n37}: int b = 2; -[-c-]-> 30 -[a--]-> 34 - {n38}: x = 0; + {n38}: int x = 0; -[-c-]-> 30 -[a--]-> 35 {n39}: c > Unknown @@ -343,29 +334,26 @@ RESULT for f3: {n44}: In(Unknown) int f3(int c) { - int a; - int b; - int x; + /* 13 */ + int a = 1; /* 14 */ - a = 1; + int b = 2; /* 15 */ - b = 2; - /* 16 */ - x = 0; - /* 18 */ + int x = 0; + /* 17 */ if (c > Unknown) { - /* 19 */ + /* 18 */ x = b; } else { - /* 20 */ + /* 19 */ G = a; } - /* 22 */ + /* 21 */ return x; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f3_slice_1 = (n:42(restrict to x) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -380,15 +368,12 @@ f3_slice_1: /**/int f3(/* <[--d], [---]> */ int c) { - /* <[---], [---]> */ int a; - /* <[--d], [---]> */ int b; - /* <[--d], [---]> */ int x; /* <[---], [---]> */ - a = 1; + /* <[---], [---]> */ int a = 1; /* <[--d], [---]> */ - b = 2; + /* <[--d], [---]> */ int b = 2; /* <[--d], [---]> */ - x = 0; + /* <[--d], [---]> */ int x = 0; /* <[--d], [---]> */ if (c > Unknown) { /* <[--d], [---]> */ @@ -414,13 +399,13 @@ RESULT for f4: {n48}: VarDecl : a {n49}: VarDecl : b {n50}: VarDecl : x - {n51}: a = 1; + {n51}: int a = 1; -[-c-]-> 45 -[a--]-> 48 - {n52}: b = 2; + {n52}: int b = 2; -[-c-]-> 45 -[a--]-> 49 - {n53}: x = 0; + {n53}: int x = 0; -[-c-]-> 45 -[a--]-> 50 {n54}: c > Unknown @@ -449,29 +434,26 @@ RESULT for f4: {n59}: In(Unknown) int f4(int c) { - int a; - int b; - int x; + /* 23 */ + int a = 1; /* 24 */ - a = 1; + int b = 2; /* 25 */ - b = 2; - /* 26 */ - x = 0; - /* 28 */ + int x = 0; + /* 27 */ if (c > Unknown) { - /* 29 */ + /* 28 */ G = a; } else { - /* 30 */ + /* 29 */ x = b; } - /* 32 */ + /* 31 */ return x; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f4_slice_1 = (n:57(restrict to x) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -486,15 +468,12 @@ f4_slice_1: /**/int f4(/* <[--d], [---]> */ int c) { - /* <[---], [---]> */ int a; - /* <[--d], [---]> */ int b; - /* <[--d], [---]> */ int x; /* <[---], [---]> */ - a = 1; + /* <[---], [---]> */ int a = 1; /* <[--d], [---]> */ - b = 2; + /* <[--d], [---]> */ int b = 2; /* <[--d], [---]> */ - x = 0; + /* <[--d], [---]> */ int x = 0; /* <[--d], [---]> */ if (c > Unknown) { /* <[---], [---]> */ @@ -509,7 +488,7 @@ f4_slice_1: } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f4_slice_2 = (n:55 ,<[ S ], [---]>)(n:45 ,<[-c-], [---]>)(n:54 ,<[-c-], [---]>)(n:48 , <[--d], @@ -526,15 +505,12 @@ f4_slice_2: /**/int f4(/* <[-c-], [---]> */ int c) { - /* <[--d], [---]> */ int a; - /* <[---], [---]> */ int b; - /* <[---], [---]> */ int x; /* <[--d], [---]> */ - a = 1; + /* <[--d], [---]> */ int a = 1; /* <[---], [---]> */ - b = 2; + /* <[---], [---]> */ int b = 2; /* <[---], [---]> */ - x = 0; + /* <[---], [---]> */ int x = 0; /* <[-c-], [---]> */ if (c > Unknown) { /* <[ S ], [---]> */ @@ -552,7 +528,7 @@ f4_slice_2: [pdg] computing for function f5 [pdg] done for function f5 Sorties de la fonction f5 = G -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f5_slice_1 = (n:73(restrict to G) ,<[--d], [---]>)(n:77(restrict to G) ,<[--d], [---]>)] @@ -568,9 +544,8 @@ f5_slice_1: /**/int f5(/* <[--d], [---]> */ int c) { - /* <[---], [---]> */ int x; /* <[---], [---]> */ - x = 0; + /* <[---], [---]> */ int x = 0; /* <[---], [---]> */ if (c > Unknown) { /* <[---], [---]> */ @@ -601,7 +576,7 @@ RESULT for f5: {n62}: In1 -[a--]-> 61 {n63}: VarDecl : x - {n64}: x = 0; + {n64}: int x = 0; -[-c-]-> 60 -[a--]-> 63 {n65}: c > Unknown @@ -654,32 +629,31 @@ RESULT for f5: {n78}: In(Unknown) int f5(int c) { - int x; - /* 34 */ - x = 0; - /* 36 */ + /* 33 */ + int x = 0; + /* 35 */ if (c > Unknown) { - /* 37 */ + /* 36 */ goto Lsuite; } - /* 39 */ + /* 38 */ x ++; - /* label */ Lsuite: /* 40 */ + /* label */ Lsuite: /* 39 */ ; - /* 41 */ + /* 40 */ if (c < Unknown) { - /* 42 */ + /* 41 */ goto L2; } - /* 44 */ + /* 43 */ G ++; - /* label */ L2: /* 45 */ + /* label */ L2: /* 44 */ x ++; - /* 47 */ + /* 46 */ return x; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f5_slice_2 = (n:75(restrict to x) ,<[--d], [---]>)] [slicing] applying all slicing requests... @@ -694,9 +668,8 @@ f5_slice_2: /**/int f5(/* <[--d], [---]> */ int c) { - /* <[--d], [---]> */ int x; /* <[--d], [---]> */ - x = 0; + /* <[--d], [---]> */ int x = 0; /* <[--d], [---]> */ if (c > Unknown) { /* <[--d], [---]> */ @@ -720,7 +693,7 @@ f5_slice_2: } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f5_slice_3 = (n:60 ,<[-c-], [---]>)] [slicing] applying all slicing requests... @@ -730,9 +703,8 @@ Print slice = f5_slice_3: (InCtrl: <[-c-], [---]>) /**/int f5(/* <[---], [---]> */ int c) { - /* <[---], [---]> */ int x; /* <[---], [---]> */ - x = 0; + /* <[---], [---]> */ int x = 0; /* <[---], [---]> */ if (c > Unknown) { /* <[---], [---]> */ @@ -766,7 +738,7 @@ RESULT for f6: -[a--]-> 80 {n82}: VarDecl : i {n83}: VarDecl : __retres - {n84}: i = 0; + {n84}: int i = 0; -[-c-]-> 79 -[a--]-> 82 {n85}: while(1) @@ -910,48 +882,51 @@ RESULT for f6: int f6(int n) { int __retres; - int i; + /* 48 */ + int i = 0; /* 49 */ - i = 0; - /* 50 */ while (n < 10) { - /* 56 */ + /* 55 */ if (Unknown > 3) { - /* 57 */ + /* 56 */ i = 1; - /* 58 */ + /* 57 */ break; } - /* 61 */ + /* 60 */ if (n % 2) { - /* 62 */ + /* 61 */ continue; } - /* 64 */ + /* 63 */ n ++; } - /* 66 */ + /* 65 */ if (i) { - /* 132 */ - /* 67 */ - __retres = 0; - /* 133 */ - goto return_label; + /* 130 */ + { + /* 66 */ + __retres = 0; + /* 131 */ + goto return_label; + } } else { - /* 134 */ - /*@ assert Value: signed_overflow: -2147483648 ≤ 10 * n; */ - /*@ assert Value: signed_overflow: 10 * n ≤ 2147483647; */ - /* 69 */ - __retres = 10 * n; - /* 135 */ - goto return_label; + /* 132 */ + { + /*@ assert Value: signed_overflow: -2147483648 ≤ 10 * n; */ + /*@ assert Value: signed_overflow: 10 * n ≤ 2147483647; */ + /* 68 */ + __retres = 10 * n; + /* 133 */ + goto return_label; + } } - /* label */ return_label: /* 136 */ + /* label */ return_label: /* 134 */ return __retres; } -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [f6_slice_1 = (n:79 ,<[-c-], [---]>)(n:95 ,<[-c-], [---]>)(n:97 ,<[-c-], [---]>)] @@ -967,9 +942,8 @@ f6_slice_1: /**/int f6(/* <[-c-], [---]> */ int n) { /* <[---], [---]> */ int __retres; - /* <[-c-], [---]> */ int i; /* <[-c-], [---]> */ - i = 0; + /* <[-c-], [---]> */ int i = 0; /* <[-c-], [---]> */ while (n < 10) { /* <[-c-], [---]> */ @@ -990,19 +964,23 @@ f6_slice_1: /* <[-c-], [---]> */ if (i) { /* <[---], [ S ]> */ - /* <[---], [---]> */ - __retres = 0; - /* <[---], [---]> */ - goto return_label; + { + /* <[---], [---]> */ + __retres = 0; + /* <[---], [---]> */ + goto return_label; + } } else { /* <[-c-], [---]> */ - /*@ assert Value: signed_overflow: -2147483648 ≤ 10 * n; */ - /*@ assert Value: signed_overflow: 10 * n ≤ 2147483647; */ - /* <[---], [---]> */ - __retres = 10 * n; - /* <[---], [---]> */ - goto return_label; + { + /*@ assert Value: signed_overflow: -2147483648 ≤ 10 * n; */ + /*@ assert Value: signed_overflow: 10 * n ≤ 2147483647; */ + /* <[---], [---]> */ + __retres = 10 * n; + /* <[---], [---]> */ + goto return_label; + } } /* <[---], [---]> */ return_label: /* <[---], [---]> */ return __retres; @@ -1023,12 +1001,10 @@ Print slice = f1_slice_1: (InCtrl: <[-cd], [---]>) /**/int f1(/* <[--d], [---]> */ int x, /* <[---], [---]> */ int y) { /* <[---], [---]> */ int __retres; - /* <[--d], [---]> */ int a; - /* <[---], [---]> */ int b; /* <[--d], [---]> */ - a = 1; + /* <[--d], [---]> */ int a = 1; /* <[---], [---]> */ - b = 2; + /* <[---], [---]> */ int b = 2; /* <[ S ], [---]> */ G = x + a; /* <[---], [---]> */ @@ -1041,16 +1017,13 @@ Print slice = f2_slice_1: (InCtrl: <[-c-], [---]>) /**/int f2(void) { - /* <[---], [---]> */ int a; - /* <[---], [---]> */ int b; - /* <[a--], [---]> */ int c; /* <[---], [---]> */ int tmp; /* <[---], [---]> */ - a = 1; + /* <[---], [---]> */ int a = 1; /* <[---], [---]> */ - b = a + 1; + /* <[---], [---]> */ int b = a + 1; /* <[ S ], [---]> */ - c = 3; + /* <[a--], [---]> */ int c = 3; /* invisible call */ /* <[---], [---]> */ tmp = f1(b,c); /* <[---], [---]> */ @@ -1066,15 +1039,12 @@ f3_slice_1: /**/int f3(/* <[--d], [---]> */ int c) { - /* <[---], [---]> */ int a; - /* <[--d], [---]> */ int b; - /* <[--d], [---]> */ int x; /* <[---], [---]> */ - a = 1; + /* <[---], [---]> */ int a = 1; /* <[--d], [---]> */ - b = 2; + /* <[--d], [---]> */ int b = 2; /* <[--d], [---]> */ - x = 0; + /* <[--d], [---]> */ int x = 0; /* <[--d], [---]> */ if (c > Unknown) { /* <[--d], [---]> */ @@ -1096,15 +1066,12 @@ f4_slice_2: /**/int f4(/* <[-c-], [---]> */ int c) { - /* <[--d], [---]> */ int a; - /* <[---], [---]> */ int b; - /* <[---], [---]> */ int x; /* <[--d], [---]> */ - a = 1; + /* <[--d], [---]> */ int a = 1; /* <[---], [---]> */ - b = 2; + /* <[---], [---]> */ int b = 2; /* <[---], [---]> */ - x = 0; + /* <[---], [---]> */ int x = 0; /* <[-c-], [---]> */ if (c > Unknown) { /* <[ S ], [---]> */ @@ -1127,15 +1094,12 @@ f4_slice_1: /**/int f4(/* <[--d], [---]> */ int c) { - /* <[---], [---]> */ int a; - /* <[--d], [---]> */ int b; - /* <[--d], [---]> */ int x; /* <[---], [---]> */ - a = 1; + /* <[---], [---]> */ int a = 1; /* <[--d], [---]> */ - b = 2; + /* <[--d], [---]> */ int b = 2; /* <[--d], [---]> */ - x = 0; + /* <[--d], [---]> */ int x = 0; /* <[--d], [---]> */ if (c > Unknown) { /* <[---], [---]> */ @@ -1153,9 +1117,8 @@ Print slice = f5_slice_3: (InCtrl: <[-c-], [---]>) /**/int f5(/* <[---], [---]> */ int c) { - /* <[---], [---]> */ int x; /* <[---], [---]> */ - x = 0; + /* <[---], [---]> */ int x = 0; /* <[---], [---]> */ if (c > Unknown) { /* <[---], [---]> */ @@ -1187,9 +1150,8 @@ f5_slice_2: /**/int f5(/* <[--d], [---]> */ int c) { - /* <[--d], [---]> */ int x; /* <[--d], [---]> */ - x = 0; + /* <[--d], [---]> */ int x = 0; /* <[--d], [---]> */ if (c > Unknown) { /* <[--d], [---]> */ @@ -1221,9 +1183,8 @@ f5_slice_1: /**/int f5(/* <[--d], [---]> */ int c) { - /* <[---], [---]> */ int x; /* <[---], [---]> */ - x = 0; + /* <[---], [---]> */ int x = 0; /* <[---], [---]> */ if (c > Unknown) { /* <[---], [---]> */ @@ -1255,9 +1216,8 @@ f6_slice_1: /**/int f6(/* <[-c-], [---]> */ int n) { /* <[---], [---]> */ int __retres; - /* <[-c-], [---]> */ int i; /* <[-c-], [---]> */ - i = 0; + /* <[-c-], [---]> */ int i = 0; /* <[-c-], [---]> */ while (n < 10) { /* <[-c-], [---]> */ @@ -1278,19 +1238,23 @@ f6_slice_1: /* <[-c-], [---]> */ if (i) { /* <[---], [ S ]> */ - /* <[---], [---]> */ - __retres = 0; - /* <[---], [---]> */ - goto return_label; + { + /* <[---], [---]> */ + __retres = 0; + /* <[---], [---]> */ + goto return_label; + } } else { /* <[-c-], [---]> */ - /*@ assert Value: signed_overflow: -2147483648 ≤ 10 * n; */ - /*@ assert Value: signed_overflow: 10 * n ≤ 2147483647; */ - /* <[---], [---]> */ - __retres = 10 * n; - /* <[---], [---]> */ - goto return_label; + { + /*@ assert Value: signed_overflow: -2147483648 ≤ 10 * n; */ + /*@ assert Value: signed_overflow: 10 * n ≤ 2147483647; */ + /* <[---], [---]> */ + __retres = 10 * n; + /* <[---], [---]> */ + goto return_label; + } } /* <[---], [---]> */ return_label: /* <[---], [---]> */ return __retres; @@ -1299,6 +1263,6 @@ f6_slice_1: Tstr S; Tstr S1; Tstr S2; -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = diff --git a/tests/slicing/oracle/sizeof.0.res.oracle b/tests/slicing/oracle/sizeof.0.res.oracle index 937a59af94f600f50ab21e9e402e588084b2e208..f7b33ac3867711dca1f095bbff2ac019e9eff685 100644 --- a/tests/slicing/oracle/sizeof.0.res.oracle +++ b/tests/slicing/oracle/sizeof.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -221,7 +220,6 @@ unsigned int SizeOfE_tab_acces_1_slice_1(void) int main(void) { - int r; unsigned int tmp; unsigned int tmp_0; unsigned int tmp_1; @@ -232,53 +230,32 @@ int main(void) unsigned int tmp_6; unsigned int tmp_7; unsigned int tmp_8; - r = 0; + int r = 0; r = (int)((unsigned int)r + sizeof(struct St)); /*@ assert r ≢ 0; */ ; - { /* sequence */ - tmp = SizeOf_1_slice_1(); - r = (int)((unsigned int)r + tmp); - } - { /* sequence */ - tmp_0 = SizeOf_2_slice_1(); - r = (int)((unsigned int)r + tmp_0); - } - { /* sequence */ - tmp_1 = SizeOfE_pt1_slice_1(); - r = (int)((unsigned int)r + tmp_1); - } - { /* sequence */ - tmp_2 = SizeOfE_pt2_slice_1(); - r = (int)((unsigned int)r + tmp_2); - } - { /* sequence */ - tmp_3 = SizeOfE_pt3_slice_1(); - r = (int)((unsigned int)r + tmp_3); - } - { /* sequence */ - tmp_4 = SizeOfE_pt_deref_1_slice_1(); - r = (int)((unsigned int)r + tmp_4); - } - { /* sequence */ - tmp_5 = SizeOfE_tab_1_slice_1(); - r = (int)((unsigned int)r + tmp_5); - } - { /* sequence */ - tmp_6 = SizeOfE_pt_tab_1_slice_1(); - r = (int)((unsigned int)r + tmp_6); - } - { /* sequence */ - tmp_7 = SizeOfE_pt_tab_2_slice_1(); - r = (int)((unsigned int)r + tmp_7); - } - { /* sequence */ - tmp_8 = SizeOfE_tab_acces_1_slice_1(); - r = (int)((unsigned int)r + tmp_8); - } + tmp = SizeOf_1_slice_1(); + r = (int)((unsigned int)r + tmp); + tmp_0 = SizeOf_2_slice_1(); + r = (int)((unsigned int)r + tmp_0); + tmp_1 = SizeOfE_pt1_slice_1(); + r = (int)((unsigned int)r + tmp_1); + tmp_2 = SizeOfE_pt2_slice_1(); + r = (int)((unsigned int)r + tmp_2); + tmp_3 = SizeOfE_pt3_slice_1(); + r = (int)((unsigned int)r + tmp_3); + tmp_4 = SizeOfE_pt_deref_1_slice_1(); + r = (int)((unsigned int)r + tmp_4); + tmp_5 = SizeOfE_tab_1_slice_1(); + r = (int)((unsigned int)r + tmp_5); + tmp_6 = SizeOfE_pt_tab_1_slice_1(); + r = (int)((unsigned int)r + tmp_6); + tmp_7 = SizeOfE_pt_tab_2_slice_1(); + r = (int)((unsigned int)r + tmp_7); + tmp_8 = SizeOfE_tab_acces_1_slice_1(); + r = (int)((unsigned int)r + tmp_8); /*@ slice pragma expr r; */ ; return r; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.1.res.oracle b/tests/slicing/oracle/sizeof.1.res.oracle index 241a5dbd7a0ee80e0f7b075cb882b7496af7cfa4..bbdbe93b4f5a2932940a6379ceab32a2026c553c 100644 --- a/tests/slicing/oracle/sizeof.1.res.oracle +++ b/tests/slicing/oracle/sizeof.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOf_1 [pdg] done for function SizeOf_1 @@ -119,5 +118,4 @@ unsigned int SizeOf_1_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.10.res.oracle b/tests/slicing/oracle/sizeof.10.res.oracle index 42b7db60cebf8b5e4395c6642f55ac83fc789d16..addc53553ff1ab757ae8b23dd108def02748a718 100644 --- a/tests/slicing/oracle/sizeof.10.res.oracle +++ b/tests/slicing/oracle/sizeof.10.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_tab_acces_1 [pdg] done for function SizeOfE_tab_acces_1 @@ -121,5 +120,4 @@ unsigned int SizeOfE_tab_acces_1_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_10_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.11.res.oracle b/tests/slicing/oracle/sizeof.11.res.oracle index 1643a8e34c29dd8411eed22e813a95e80cfb6b5e..92980ab5d1fe9a1f618736f6727c2e0264b486e6 100644 --- a/tests/slicing/oracle/sizeof.11.res.oracle +++ b/tests/slicing/oracle/sizeof.11.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -221,7 +220,6 @@ unsigned int SizeOfE_tab_acces_1_slice_1(void) void main(void) { - int r; unsigned int tmp; unsigned int tmp_0; unsigned int tmp_1; @@ -232,53 +230,32 @@ void main(void) unsigned int tmp_6; unsigned int tmp_7; unsigned int tmp_8; - r = 0; + int r = 0; r = (int)((unsigned int)r + sizeof(struct St)); /*@ assert r ≢ 0; */ ; - { /* sequence */ - tmp = SizeOf_1_slice_1(); - r = (int)((unsigned int)r + tmp); - } - { /* sequence */ - tmp_0 = SizeOf_2_slice_1(); - r = (int)((unsigned int)r + tmp_0); - } - { /* sequence */ - tmp_1 = SizeOfE_pt1_slice_1(); - r = (int)((unsigned int)r + tmp_1); - } - { /* sequence */ - tmp_2 = SizeOfE_pt2_slice_1(); - r = (int)((unsigned int)r + tmp_2); - } - { /* sequence */ - tmp_3 = SizeOfE_pt3_slice_1(); - r = (int)((unsigned int)r + tmp_3); - } - { /* sequence */ - tmp_4 = SizeOfE_pt_deref_1_slice_1(); - r = (int)((unsigned int)r + tmp_4); - } - { /* sequence */ - tmp_5 = SizeOfE_tab_1_slice_1(); - r = (int)((unsigned int)r + tmp_5); - } - { /* sequence */ - tmp_6 = SizeOfE_pt_tab_1_slice_1(); - r = (int)((unsigned int)r + tmp_6); - } - { /* sequence */ - tmp_7 = SizeOfE_pt_tab_2_slice_1(); - r = (int)((unsigned int)r + tmp_7); - } - { /* sequence */ - tmp_8 = SizeOfE_tab_acces_1_slice_1(); - r = (int)((unsigned int)r + tmp_8); - } + tmp = SizeOf_1_slice_1(); + r = (int)((unsigned int)r + tmp); + tmp_0 = SizeOf_2_slice_1(); + r = (int)((unsigned int)r + tmp_0); + tmp_1 = SizeOfE_pt1_slice_1(); + r = (int)((unsigned int)r + tmp_1); + tmp_2 = SizeOfE_pt2_slice_1(); + r = (int)((unsigned int)r + tmp_2); + tmp_3 = SizeOfE_pt3_slice_1(); + r = (int)((unsigned int)r + tmp_3); + tmp_4 = SizeOfE_pt_deref_1_slice_1(); + r = (int)((unsigned int)r + tmp_4); + tmp_5 = SizeOfE_tab_1_slice_1(); + r = (int)((unsigned int)r + tmp_5); + tmp_6 = SizeOfE_pt_tab_1_slice_1(); + r = (int)((unsigned int)r + tmp_6); + tmp_7 = SizeOfE_pt_tab_2_slice_1(); + r = (int)((unsigned int)r + tmp_7); + tmp_8 = SizeOfE_tab_acces_1_slice_1(); + r = (int)((unsigned int)r + tmp_8); /*@ slice pragma expr r; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_11_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.12.res.oracle b/tests/slicing/oracle/sizeof.12.res.oracle index e62a86abdd5cf264b70e9d7723303d3b011c623b..eeb69fd71befe61ff51688365579ad180d5b3f76 100644 --- a/tests/slicing/oracle/sizeof.12.res.oracle +++ b/tests/slicing/oracle/sizeof.12.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main @@ -118,13 +117,11 @@ struct St { }; void main(void) { - int r; - r = 0; + int r = 0; r = (int)((unsigned int)r + sizeof(struct St)); /*@ assert r ≢ 0; */ ; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_12_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.2.res.oracle b/tests/slicing/oracle/sizeof.2.res.oracle index aea63a15715a79912a50258829fedb22504de3d5..3914a1d55cb0f843443c2477ac70b68e662e12dc 100644 --- a/tests/slicing/oracle/sizeof.2.res.oracle +++ b/tests/slicing/oracle/sizeof.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOf_2 [pdg] done for function SizeOf_2 @@ -124,5 +123,4 @@ unsigned int SizeOf_2_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.3.res.oracle b/tests/slicing/oracle/sizeof.3.res.oracle index c4784e1ba11df3baf9f9f3d35f85e6e9d6acb004..9588b98ccd9c82a5260a77dd59edd403f3f45c6f 100644 --- a/tests/slicing/oracle/sizeof.3.res.oracle +++ b/tests/slicing/oracle/sizeof.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_pt1 [pdg] done for function SizeOfE_pt1 @@ -120,5 +119,4 @@ unsigned int SizeOfE_pt1_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.4.res.oracle b/tests/slicing/oracle/sizeof.4.res.oracle index 1a13dea1e44bdf4f26ae6e0af888fe1c756daca7..d8416407b83631128609fa95c510b104da9a4987 100644 --- a/tests/slicing/oracle/sizeof.4.res.oracle +++ b/tests/slicing/oracle/sizeof.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_pt2 [pdg] done for function SizeOfE_pt2 @@ -120,5 +119,4 @@ unsigned int SizeOfE_pt2_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.5.res.oracle b/tests/slicing/oracle/sizeof.5.res.oracle index efbbfdcf72872860faadbaedc8cecdc19d965032..dc4b706795a610808b8f028244ccede4b6a001b8 100644 --- a/tests/slicing/oracle/sizeof.5.res.oracle +++ b/tests/slicing/oracle/sizeof.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_pt3 [pdg] done for function SizeOfE_pt3 @@ -121,5 +120,4 @@ unsigned int SizeOfE_pt3_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.6.res.oracle b/tests/slicing/oracle/sizeof.6.res.oracle index b764c711854d29f614f9b577046029ae665160e8..7c5b9858ac03c11026150a72a81ec112affdac0b 100644 --- a/tests/slicing/oracle/sizeof.6.res.oracle +++ b/tests/slicing/oracle/sizeof.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_pt_deref_1 [pdg] done for function SizeOfE_pt_deref_1 @@ -121,5 +120,4 @@ unsigned int SizeOfE_pt_deref_1_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.7.res.oracle b/tests/slicing/oracle/sizeof.7.res.oracle index 5dc8db618aa2eed1a076c0658234165ce16cd8ad..b434cddaf215ab741345e237ef78b51b138d44dd 100644 --- a/tests/slicing/oracle/sizeof.7.res.oracle +++ b/tests/slicing/oracle/sizeof.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_tab_1 [pdg] done for function SizeOfE_tab_1 @@ -120,5 +119,4 @@ unsigned int SizeOfE_tab_1_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.8.res.oracle b/tests/slicing/oracle/sizeof.8.res.oracle index dbcbd31a64925140a44ce408df06b1c1a8ceb962..8c8aae3fedfda979c781c93e8c0d9331db42aee0 100644 --- a/tests/slicing/oracle/sizeof.8.res.oracle +++ b/tests/slicing/oracle/sizeof.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_pt_tab_1 [pdg] done for function SizeOfE_pt_tab_1 @@ -121,5 +120,4 @@ unsigned int SizeOfE_pt_tab_1_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_8_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/sizeof.9.res.oracle b/tests/slicing/oracle/sizeof.9.res.oracle index f6cb91b232f3e820f0a73f9008555e6072c67a8b..c2b6c43a5d9a77959000c0b9ee98ddb19fb358fa 100644 --- a/tests/slicing/oracle/sizeof.9.res.oracle +++ b/tests/slicing/oracle/sizeof.9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -96,7 +95,7 @@ tests/slicing/sizeof.i:93:[value] assertion got status valid. \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function SizeOfE_pt_tab_2 [pdg] done for function SizeOfE_pt_tab_2 @@ -121,5 +120,4 @@ unsigned int SizeOfE_pt_tab_2_slice_1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_9_sizeof.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_behavior.res.oracle b/tests/slicing/oracle/slice_behavior.res.oracle index 79fe3ed29ea9dd51ca316e804d04bfd141783224..be8450a5c1924bfd40023ef3ff2676d840a5d890 100644 --- a/tests/slicing/oracle/slice_behavior.res.oracle +++ b/tests/slicing/oracle/slice_behavior.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_behavior.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -20,7 +19,7 @@ tests/slicing/slice_behavior.i:7:[value] assertion got status valid. [value:final-states] Values at end of function main: __retres ∈ {0} [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [pdg] done for function f @@ -42,8 +41,7 @@ tests/slicing/slice_behavior.i:7:[value] assertion got status valid. /*@ requires a > 0; */ void f_slice_1(int a) { - int b; - b = 2 * a; + int b = 2 * a; /*@ assert a < b; */ ; return; } @@ -55,5 +53,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_slice_behavior.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_no_body.res.oracle b/tests/slicing/oracle/slice_no_body.res.oracle index 99b2a9151ca7a979b078a140bccb744368d96123..66d53541e69600059a8fde9209158cba3981d067 100644 --- a/tests/slicing/oracle/slice_no_body.res.oracle +++ b/tests/slicing/oracle/slice_no_body.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_no_body.i (no preprocessing) [value] Analyzing an incomplete application starting at h [value] Computing initial state @@ -47,7 +46,7 @@ tests/slicing/slice_no_body.i:13:[value] warning: signed overflow. assert c * 2 G FROM \nothing \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function h [pdg] done for function h [pdg] computing for function g @@ -62,32 +61,34 @@ Print slice = g_slice_1: /**/int g(/* <[---], [---]> */ int c) { /* <[---], [---]> */ int __retres; - /* <[---], [---]> */ int x; - /* <[---], [---]> */ int y; /*@ assert Value: signed_overflow: c + 1 ≤ 2147483647; */ /* <[---], [---]> */ - x = c + 1; + /* <[---], [---]> */ int x = c + 1; /*@ assert Value: signed_overflow: -2147483648 ≤ c * 2; */ /*@ assert Value: signed_overflow: c * 2 ≤ 2147483647; */ /* <[---], [---]> */ - y = c * 2; + /* <[---], [---]> */ int y = c * 2; /* <[---], [---]> */ if (c == 0) { /* <[---], [---]> */ int tmp; /* invisible call */ /* <[---], [---]> */ tmp = f(x); /* <[---], [ S ]> */ - /* <[---], [---]> */ - __retres = tmp; - /* <[---], [---]> */ - goto return_label; + { + /* <[---], [---]> */ + __retres = tmp; + /* <[---], [---]> */ + goto return_label; + } } else { /* <[---], [ S ]> */ - /* <[---], [---]> */ - __retres = y; - /* <[---], [---]> */ - goto return_label; + { + /* <[---], [---]> */ + __retres = y; + /* <[---], [---]> */ + goto return_label; + } } /* <[---], [---]> */ return_label: /* <[---], [---]> */ return __retres; @@ -98,15 +99,12 @@ Print slice = h_slice_1: /**/int h(void) { /* <[---], [---]> */ int __retres; - /* <[---], [---]> */ int a; - /* <[---], [---]> */ int b; - /* <[---], [---]> */ int c; /* invisible call */ /* <[---], [---]> */ - a = f(1); + /* <[---], [---]> */ int a = f(1); /* invisible call */ /* <[---], [---]> */ - b = f(2); + /* <[---], [---]> */ int b = f(2); /* invisible call */ /* <[---], [---]> */ - c = f(3); + /* <[---], [---]> */ int c = f(3); /* invisible call */ /* <[---], [---]> */ G = f(4); /* <[---], [---]> */ @@ -120,8 +118,8 @@ Print slice = h_slice_1: return __retres; } -Slicing project worklist [default/slicing_1] = -[h_slice_1 = change_call for call 18 -> g_slice_1][g_slice_1 = change_call for call 7 -> (src:f)][h_slice_1 = change_call for call 15 -> (src:f)][h_slice_1 = change_call for call 14 -> (src:f)][h_slice_1 = change_call for call 13 -> (src:f)][h_slice_1 = change_call for call 12 -> (src:f)] +Slicing project worklist [default] = +[h_slice_1 = change_call for call 16 -> g_slice_1][g_slice_1 = change_call for call 5 -> (src:f)][h_slice_1 = change_call for call 13 -> (src:f)][h_slice_1 = change_call for call 12 -> (src:f)][h_slice_1 = change_call for call 11 -> (src:f)][h_slice_1 = change_call for call 10 -> (src:f)] [slicing] exporting project to 'Sliced code'... [slicing] applying all slicing requests... @@ -140,8 +138,7 @@ int f(int a); void g_slice_1(int c) { - int x; - x = c + 1; + int x = c + 1; if (c == 0) { int tmp; tmp = f(x); @@ -151,19 +148,16 @@ void g_slice_1(int c) void h(void) { - int a; - int b; - int c; - a = f(1); - b = f(2); - c = f(3); + int a = f(1); + int b = f(2); + int c = f(3); G = f(4); if (G > 0) g_slice_1(c); return; } -[slicing] making slicing project 'slicing_2'... +[slicing] reinitializing slicing ... [slicing] applying all slicing requests... [slicing] applying 6 actions... [slicing] applying actions: 1/6... @@ -183,15 +177,13 @@ Print slice = g_slice_1: (InCtrl: <[---], [ S ]>) /**/int g(/* <[---], [ S ]> */ int c) { /* <[---], [---]> */ int __retres; - /* <[---], [ S ]> */ int x; - /* <[---], [---]> */ int y; /*@ assert Value: signed_overflow: c + 1 ≤ 2147483647; */ /* <[---], [ S ]> */ - x = c + 1; + /* <[---], [ S ]> */ int x = c + 1; /*@ assert Value: signed_overflow: -2147483648 ≤ c * 2; */ /*@ assert Value: signed_overflow: c * 2 ≤ 2147483647; */ /* <[---], [---]> */ - y = c * 2; + /* <[---], [---]> */ int y = c * 2; /* <[---], [ S ]> */ if (c == 0) { /* <[---], [ S ]> */ int tmp; @@ -203,17 +195,21 @@ Print slice = g_slice_1: (InCtrl: <[---], [ S ]>) /* <[---], [ S ]> */ tmp = f(x); /* <[---], [ S ]> */ - /* <[---], [---]> */ - __retres = tmp; - /* <[---], [---]> */ - goto return_label; + { + /* <[---], [---]> */ + __retres = tmp; + /* <[---], [---]> */ + goto return_label; + } } else { /* <[---], [ S ]> */ - /* <[---], [---]> */ - __retres = y; - /* <[---], [---]> */ - goto return_label; + { + /* <[---], [---]> */ + __retres = y; + /* <[---], [---]> */ + goto return_label; + } } /* <[---], [---]> */ return_label: /* <[---], [---]> */ return __retres; @@ -224,30 +220,27 @@ Print slice = h_slice_1: (InCtrl: <[---], [ S ]>) /**/int h(void) { /* <[---], [---]> */ int __retres; - /* <[---], [ S ]> */ int a; - /* <[---], [ S ]> */ int b; - /* <[---], [ S ]> */ int c; /* sig call: (InCtrl: <[---], [ S ]>) (In1: <[---], [ S ]>) (OutRet: <[---], [ S ]>) */ /* call to source function */ /* <[---], [ S ]> */ - a = f(1); + /* <[---], [ S ]> */ int a = f(1); /* sig call: (InCtrl: <[---], [ S ]>) (In1: <[---], [ S ]>) (OutRet: <[---], [ S ]>) */ /* call to source function */ /* <[---], [ S ]> */ - b = f(2); + /* <[---], [ S ]> */ int b = f(2); /* sig call: (InCtrl: <[---], [ S ]>) (In1: <[---], [ S ]>) (OutRet: <[---], [ S ]>) */ /* call to source function */ /* <[---], [ S ]> */ - c = f(3); + /* <[---], [ S ]> */ int c = f(3); /* sig call: (InCtrl: <[---], [ S ]>) (In1: <[---], [ S ]>) @@ -270,7 +263,7 @@ Print slice = h_slice_1: (InCtrl: <[---], [ S ]>) return __retres; } -Slicing project worklist [default/slicing_2] = +Slicing project worklist [default] = [slicing] exporting project to 'Sliced code'... @@ -284,8 +277,7 @@ int f(int a); void g_slice_1(int c) { - int x; - x = c + 1; + int x = c + 1; if (c == 0) { int tmp; tmp = f(x); @@ -295,12 +287,9 @@ void g_slice_1(int c) void h(void) { - int a; - int b; - int c; - a = f(1); - b = f(2); - c = f(3); + int a = f(1); + int b = f(2); + int c = f(3); G = f(4); if (G > 0) g_slice_1(c); return; diff --git a/tests/slicing/oracle/slice_pragma_stmt.0.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.0.res.oracle index 3a47cf198d10e528544b2dede31fc7db1a0a7f32..aa0b63da0ad69fa1c530b08a7d5b2020edfb05d3 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.0.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) /* Generated by Frama-C */ int x; @@ -79,11 +78,9 @@ void double_effect2(int c1, int c2) /*@ slice pragma stmt; */ { int tmp; - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } + tmp = y; + y ++; + x += tmp; } return; } @@ -93,27 +90,24 @@ void double_effect3(int c1, int c2) int tmp; if (c2) goto L; L: /*@ slice pragma stmt; */ - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } + { /* sequence */ + tmp = y; + y ++; + x += tmp; + } return; } void double_effect4(int c1, int c2) { if (c2) goto L; - L: - /*@ slice pragma stmt; */ - { - int tmp; - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } - } + L: /*@ slice pragma stmt; */ + { + int tmp; + tmp = y; + y ++; + x += tmp; + } return; } @@ -123,11 +117,9 @@ void double_effect5(int c1, int c2) /*@ slice pragma stmt; */ { int tmp; - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } + tmp = y; + y ++; + x += tmp; } } return; @@ -176,7 +168,7 @@ void test5(int c1, int c2) if (c1 < c2) goto L; c1 = c2; L: /*@ slice pragma stmt; */ - x = c1; + x = c1; y = c2; return; } @@ -187,11 +179,11 @@ void test6(int c1, int c2) if (c1 < c2) goto L; c1 = c2; L: /*@ slice pragma stmt; */ - { /* sequence */ - tmp = c1; - c1 ++; - x = tmp; - } + { /* sequence */ + tmp = c1; + c1 ++; + x = tmp; + } y = c2; return; } @@ -200,17 +192,14 @@ void test7(int c1, int c2) { if (c1 < c2) goto L; c1 = c2; - L: - /*@ slice pragma stmt; */ - { - int tmp; - { /* sequence */ - tmp = c1; - c1 ++; - x = tmp; - } - c2 ++; - } + L: /*@ slice pragma stmt; */ + { + int tmp; + tmp = c1; + c1 ++; + x = tmp; + c2 ++; + } y = c2; return; } @@ -222,11 +211,9 @@ void test8(int c1, int c2) /*@ slice pragma stmt; */ { int tmp; - L: { /* sequence */ - tmp = c1; - c1 ++; - x = tmp; - } + L: tmp = c1; + c1 ++; + x = tmp; c2 ++; } y = c2; diff --git a/tests/slicing/oracle/slice_pragma_stmt.1.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.1.res.oracle index a78fc026bf216c3ae05044fff2f14edae5fc78d4..00a9a2051577dda1aac56db35723bac0ebc772e6 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.1.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop1 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop1 [value] done for function nop1 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop1 [pdg] done for function nop1 @@ -31,5 +30,4 @@ void nop1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.10.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.10.res.oracle index 1972ef11c18d1ead1ddfadb6cd82777c847c6466..f6d460fead23210a8f04cc5eb32f4801bf42491c 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.10.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.10.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at double_effect2 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for double_effect2 [value] done for function double_effect2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function double_effect2 [pdg] done for function double_effect2 @@ -31,15 +30,12 @@ void double_effect2(void) /*@ slice pragma stmt; */ { int tmp; - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } + tmp = y; + y ++; + x += tmp; } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_10_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.11.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.11.res.oracle index c2db751af06a5b222769f452c8b6f1d7fc9b3d5d..0993bb5d5d5c1112b63c7bdeab12e137716c365f 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.11.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.11.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at double_effect3 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for double_effect3 [value] done for function double_effect3 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function double_effect3 [pdg] done for function double_effect3 @@ -39,5 +38,4 @@ void double_effect3(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_11_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.12.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.12.res.oracle index eaa354108806980fd89317c55e536cddbb390932..7f4efe7aa80a01370fadf6fd8cfdbc7e8bb11fd7 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.12.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.12.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at double_effect4 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for double_effect4 [value] done for function double_effect4 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function double_effect4 [pdg] done for function double_effect4 @@ -31,15 +30,12 @@ void double_effect4(void) /*@ slice pragma stmt; */ { int tmp; - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } + tmp = y; + y ++; + x += tmp; } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_12_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.13.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.13.res.oracle index 8f2f46d4ecd77ef26c462bbbfb338f9f4adc3f16..77b2a174043c6a09bd319a51fe41f89a2575be2e 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.13.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.13.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at double_effect5 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for double_effect5 [value] done for function double_effect5 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function double_effect5 [pdg] done for function double_effect5 @@ -32,16 +31,13 @@ void double_effect5(int c2) /*@ slice pragma stmt; */ { int tmp; - { /* sequence */ - tmp = y; - y ++; - x += tmp; - } + tmp = y; + y ++; + x += tmp; } } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_13_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.14.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.14.res.oracle index 02b76ba4dea14dcfb7b6bb27ad74e4613ada66c9..636625c963ddcf65acb40c442c25657d932d4b28 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.14.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.14.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test1 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for test1 [value] done for function test1 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test1 [pdg] done for function test1 @@ -34,5 +33,4 @@ void test1(int c1, int c2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_14_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.15.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.15.res.oracle index c90d622ea3e25ec90e2708a2322f08e7ecb42936..883887f3802c6f14dc65ac5f48820938bc1a9e8b 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.15.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.15.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test2 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for test2 [value] done for function test2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test2 [pdg] done for function test2 @@ -34,5 +33,4 @@ void test2(int c1, int c2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_15_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.16.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.16.res.oracle index b2ea4c5a85e2b53d7187e1ae50d1fa09a8300179..7d85ddb2223a104b71469eb0b9302ba00508d0b6 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.16.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.16.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test3 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for test3 [value] done for function test3 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test3 [pdg] done for function test3 @@ -34,5 +33,4 @@ void test3(int c1, int c2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_16_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.17.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.17.res.oracle index 603a1dc640576c3d59e53e2ee341066a6f77a5ab..38691a40c5bc37abe404b17800c8f1f48b2f10d2 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.17.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.17.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test4 @@ -10,7 +9,7 @@ tests/slicing/slice_pragma_stmt.i:120:[value] warning: signed overflow. assert c2 + 1 ≤ 2147483647; [value] Recording results for test4 [value] done for function test4 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test4 [pdg] done for function test4 @@ -38,5 +37,4 @@ void test4(int c1, int c2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_17_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.18.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.18.res.oracle index 48f09d128f66cf1f2b7ae112957c839dd9d0ed0e..0a8e19ea6ba3263d5c67faafcd99ae024eab5b38 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.18.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.18.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test5 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for test5 [value] done for function test5 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test5 [pdg] done for function test5 @@ -30,10 +29,9 @@ void test5(int c1, int c2) if (c1 < c2) goto L; c1 = c2; L: /*@ slice pragma stmt; */ - x = c1; + x = c1; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_18_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.19.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.19.res.oracle index 271ce1ab92c745caee1fc4ddb892e59bf1fcec3a..490a0192fcfd81f9dfdf3b95954af0fd56165930 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.19.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.19.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test6 @@ -10,7 +9,7 @@ tests/slicing/slice_pragma_stmt.i:136:[value] warning: signed overflow. assert c1 + 1 ≤ 2147483647; [value] Recording results for test6 [value] done for function test6 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test6 [pdg] done for function test6 @@ -32,14 +31,13 @@ void test6(int c1, int c2) if (c1 < c2) goto L; c1 = c2; L: /*@ slice pragma stmt; */ - { /* sequence */ - tmp = c1; - c1 ++; - x = tmp; - } + { /* sequence */ + tmp = c1; + c1 ++; + x = tmp; + } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_19_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.2.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.2.res.oracle index 073c9cdf5de935496ce957932db6903449dc97ea..7f35a2b20229ea19d0abcd28be1fff63bbd0c630 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.2.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop2 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop2 [value] done for function nop2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop2 [pdg] done for function nop2 @@ -31,5 +30,4 @@ void nop2(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.20.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.20.res.oracle index e7bba4c9bf74bb21ac8b316997bb7a06a2e9d5ef..d6301f4a3fd0908cbd237b9c1ccea6d78b0ff328 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.20.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.20.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test7 @@ -11,7 +10,7 @@ tests/slicing/slice_pragma_stmt.i:144:[value] warning: signed overflow. assert c tests/slicing/slice_pragma_stmt.i:144:[value] warning: signed overflow. assert c2 + 1 ≤ 2147483647; [value] Recording results for test7 [value] done for function test7 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test7 [pdg] done for function test7 @@ -31,20 +30,16 @@ void test7(int c1, int c2) { if (c1 < c2) goto L; c1 = c2; - L: - /*@ slice pragma stmt; */ - { - int tmp; - { /* sequence */ - tmp = c1; - c1 ++; - x = tmp; - } - c2 ++; - } + L: /*@ slice pragma stmt; */ + { + int tmp; + tmp = c1; + c1 ++; + x = tmp; + c2 ++; + } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_20_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.21.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.21.res.oracle index 4acb53ab11491780fa23b6349a1fc3a8d4152429..70425451e711e7a1946361107881c799f1cf14aa 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.21.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.21.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test8 @@ -11,7 +10,7 @@ tests/slicing/slice_pragma_stmt.i:152:[value] warning: signed overflow. assert c tests/slicing/slice_pragma_stmt.i:152:[value] warning: signed overflow. assert c2 + 1 ≤ 2147483647; [value] Recording results for test8 [value] done for function test8 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test8 [pdg] done for function test8 @@ -34,16 +33,13 @@ void test8(int c1, int c2) /*@ slice pragma stmt; */ { int tmp; - L: { /* sequence */ - tmp = c1; - c1 ++; - x = tmp; - } + L: tmp = c1; + c1 ++; + x = tmp; c2 ++; } return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_21_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.22.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.22.res.oracle index 94d93c4af523655f7f93ef0f2ed96e9cda0252c2..45aa9b1d8144dabb7e77a8a09223f231c425f3fa 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.22.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.22.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at test9 @@ -10,7 +9,7 @@ tests/slicing/slice_pragma_stmt.i:160:[value] warning: signed overflow. assert c2 + 1 ≤ 2147483647; [value] Recording results for test9 [value] done for function test9 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function test9 [pdg] done for function test9 @@ -39,5 +38,4 @@ void test9(int c1, int c2) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_22_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.3.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.3.res.oracle index a8404ec1c70ec81105cab8c98e46f87281493fec..8011020311dae29a5cbddc218740d65c6448e884 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.3.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop3 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop3 [value] done for function nop3 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop3 [pdg] done for function nop3 @@ -31,5 +30,4 @@ void nop3(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.4.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.4.res.oracle index 53ebd5a8e098a4101bf62850858c157ad9e7394d..c8febdecfe1923dfa0eaf50475fcd30c236fd2af 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.4.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop4 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop4 [value] done for function nop4 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop4 [pdg] done for function nop4 @@ -31,5 +30,4 @@ void nop4(int c1) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.5.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.5.res.oracle index f342001a875be27dbc46ebbc54bfa22fe4f7067a..a40c72f7d313e0dca04ed182363ed9ea25244eb7 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.5.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop5 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop5 [value] done for function nop5 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop5 [pdg] done for function nop5 @@ -31,5 +30,4 @@ void nop5(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_5_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.6.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.6.res.oracle index bfbe3425eb67bb549dd05a8f6131246d926a9134..c8aebf547dcf1da400c0ae0f0dccf6dd5a8b68a3 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.6.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop6 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop6 [value] done for function nop6 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop6 [pdg] done for function nop6 @@ -31,5 +30,4 @@ void nop6(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_6_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.7.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.7.res.oracle index 20132ce209dedb1c21e4091c9093153ab7e614ff..2648b53fc7beb2139cb521a49c3a2653f0f069e0 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.7.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop7 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop7 [value] done for function nop7 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop7 [pdg] done for function nop7 @@ -31,5 +30,4 @@ void nop7(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_7_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.8.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.8.res.oracle index 561638c4f35edaab8d4ee143eef5c1edc4775584..fde94c1741f6e940117e1de47524452ab71b80f6 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.8.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.8.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at nop8 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for nop8 [value] done for function nop8 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function nop8 [pdg] done for function nop8 @@ -31,5 +30,4 @@ void nop8(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_8_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/slice_pragma_stmt.9.res.oracle b/tests/slicing/oracle/slice_pragma_stmt.9.res.oracle index 95b6a6e2bcf38bb2cfde2901309d95343bed2149..848a169155867a83dcccd571b4dc9fcfd55aab9a 100644 --- a/tests/slicing/oracle/slice_pragma_stmt.9.res.oracle +++ b/tests/slicing/oracle/slice_pragma_stmt.9.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/slice_pragma_stmt.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at double_effect1 @@ -9,7 +8,7 @@ y ∈ {0} [value] Recording results for double_effect1 [value] done for function double_effect1 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function double_effect1 [pdg] done for function double_effect1 @@ -39,5 +38,4 @@ void double_effect1(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_9_slice_pragma_stmt.i (no preprocessing) diff --git a/tests/slicing/oracle/switch.res.oracle b/tests/slicing/oracle/switch.res.oracle index d8057e7834d9247a89790cb6ae7258c7984b3838..9b9d933e640765ace333913be082ed9a014910be 100644 --- a/tests/slicing/oracle/switch.res.oracle +++ b/tests/slicing/oracle/switch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/switch.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -14,10 +13,10 @@ [from] Function main: \result FROM choix [from] ====== END OF DEPENDENCIES ====== -[slicing] making slicing project 'slicing_1'... +[slicing] initializing slicing ... [pdg] computing for function main [pdg] done for function main -Slicing project worklist [default/slicing_1] = +Slicing project worklist [default] = [main_slice_1 = (n:7(restrict to x) ,<[--d], [---]>)(n:14(restrict to x) ,<[--d], [---]>)(n:15(restrict to x) ,<[--d], [---]>)] @@ -30,8 +29,7 @@ x) ,<[--d], [---]>)(n:15(restrict to x) ,<[--d], [---]>)] /* Generated by Frama-C */ void main(char choix) { - int x; - x = 0; + int x = 0; switch ((int)choix) { case 'a': x = 1; break; @@ -43,8 +41,8 @@ void main(char choix) } -[slicing] making slicing project 'slicing_2'... -Slicing project worklist [default/slicing_2] = +[slicing] reinitializing slicing ... +Slicing project worklist [default] = [main_slice_1 = (n:8(restrict to y) ,<[--d], [---]>)(n:16(restrict to y) ,<[--d], [---]>)(n:18(restrict to y) ,<[--d], [---]>)] @@ -57,8 +55,7 @@ y) ,<[--d], [---]>)(n:18(restrict to y) ,<[--d], [---]>)] /* Generated by Frama-C */ void main(char choix) { - int y; - y = 0; + int y = 0; switch ((int)choix) { case 'a': ; break; @@ -71,8 +68,8 @@ void main(char choix) } -[slicing] making slicing project 'slicing_3'... -Slicing project worklist [default/slicing_3] = +[slicing] reinitializing slicing ... +Slicing project worklist [default] = [main_slice_1 = (n:21(restrict to z) ,<[--d], [---]>)] [slicing] exporting project to 'Sliced code'... @@ -84,8 +81,7 @@ Slicing project worklist [default/slicing_3] = /* Generated by Frama-C */ void main(void) { - int z; - z = 0; + int z = 0; z ++; return; } diff --git a/tests/slicing/oracle/top.0.res.oracle b/tests/slicing/oracle/top.0.res.oracle index a6088435e7ba8a032d2b3e99374642304fd583c0..6327873032d840f7467f4f6bb22a0aff26c50bfb 100644 --- a/tests/slicing/oracle/top.0.res.oracle +++ b/tests/slicing/oracle/top.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/top.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -16,7 +15,7 @@ tests/slicing/top.i:21:[value] warning: signed overflow. assert k + 1 ≤ 214748 [value] Done for function strlen [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] Nothing to select for an unreachable stmt of uncalled [slicing] applying all slicing requests... @@ -34,5 +33,4 @@ tests/slicing/top.i:21:[value] warning: signed overflow. assert k + 1 ≤ 214748 [sparecode] removed unused global declarations in new project 'Slicing export' /* Generated by Frama-C */ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_top.i (no preprocessing) diff --git a/tests/slicing/oracle/top.1.res.oracle b/tests/slicing/oracle/top.1.res.oracle index 3414723df09e53467bb6bdb881db7106eb0fdb4f..1074992a39ff677cd5b9a1828af813e0d9f80621 100644 --- a/tests/slicing/oracle/top.1.res.oracle +++ b/tests/slicing/oracle/top.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/top.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -16,7 +15,7 @@ tests/slicing/top.i:21:[value] warning: signed overflow. assert k + 1 ≤ 214748 [value] Done for function strlen [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function strlen @@ -38,8 +37,7 @@ tests/slicing/top.i:21:[value] warning: signed overflow. assert k + 1 ≤ 214748 int strlen_slice_1(char *p) { char *q; - int k; - k = 0; + int k = 0; q = p; while (*q) { k ++; @@ -56,5 +54,4 @@ int main(char **p_str, int i) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_top.i (no preprocessing) diff --git a/tests/slicing/oracle/top.2.res.oracle b/tests/slicing/oracle/top.2.res.oracle index cac02130c74844d604ae55a8014a149c18e62419..da9af96e4e30bf70d17e815f8ffa443400d26d40 100644 --- a/tests/slicing/oracle/top.2.res.oracle +++ b/tests/slicing/oracle/top.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/top.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -16,7 +15,7 @@ tests/slicing/top.i:21:[value] warning: signed overflow. assert k + 1 ≤ 214748 [value] Done for function strlen [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function strlen [pdg] done for function strlen @@ -38,8 +37,7 @@ tests/slicing/top.i:21:[value] warning: signed overflow. assert k + 1 ≤ 214748 int strlen_slice_1(char *p) { char *q; - int k; - k = 0; + int k = 0; q = p; while (*q) { k ++; @@ -55,5 +53,4 @@ void main(char **p_str, int i) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_top.i (no preprocessing) diff --git a/tests/slicing/oracle/top2.0.res.oracle b/tests/slicing/oracle/top2.0.res.oracle index fabd3a1ff33b9591f9bdce38019f19dbf6a36d11..a2e5ffacce913e2a86b3e56cb19af8f686dacb75 100644 --- a/tests/slicing/oracle/top2.0.res.oracle +++ b/tests/slicing/oracle/top2.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/top2.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -12,13 +11,14 @@ S ∈ {0} [value] computing for function f <- main. Called from tests/slicing/top2.i:24. +tests/slicing/top2.i:13:[value] warning: initialization of volatile variable i ignored tests/slicing/top2.i:16:[value] warning: accessing out of bounds index. assert 0 ≤ i; tests/slicing/top2.i:16:[value] warning: accessing out of bounds index. assert i < 2; [value] Recording results for f [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -54,5 +54,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_top2.i (no preprocessing) diff --git a/tests/slicing/oracle/top2.1.res.oracle b/tests/slicing/oracle/top2.1.res.oracle index cc1a004b910a63f510dff31fb48f0655dd52a341..43e5bb34eb0235504e1ad8f53f0834b83b2b4bac 100644 --- a/tests/slicing/oracle/top2.1.res.oracle +++ b/tests/slicing/oracle/top2.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/top2.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -12,13 +11,14 @@ S ∈ {0} [value] computing for function f <- main. Called from tests/slicing/top2.i:24. +tests/slicing/top2.i:13:[value] warning: initialization of volatile variable i ignored tests/slicing/top2.i:16:[value] warning: accessing out of bounds index. assert 0 ≤ i; tests/slicing/top2.i:16:[value] warning: accessing out of bounds index. assert i < 2; [value] Recording results for f [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -40,20 +40,17 @@ tests/slicing/top2.i:16:[value] warning: accessing out of bounds index. assert i int tab[2] = {0, 7}; int f_slice_1(void) { - int volatile i; int v; - i = 0; + int volatile i = 0; v = tab[i]; return v; } int main(void) { - int x; - x = f_slice_1(); + int x = f_slice_1(); return x; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_top2.i (no preprocessing) diff --git a/tests/slicing/oracle/undef-fun.res.oracle b/tests/slicing/oracle/undef-fun.res.oracle index c7b69b3fdae5dea3e90333f196edefab59923d95..330d1cc040e8d97be24faecd24a269fc50df846c 100644 --- a/tests/slicing/oracle/undef-fun.res.oracle +++ b/tests/slicing/oracle/undef-fun.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/undef-fun.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -14,7 +13,7 @@ tests/slicing/undef-fun.i:17:[value] warning: signed overflow. assert y + 2 ≤ [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f [from] Computing for function f @@ -43,5 +42,4 @@ void main(int x) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_undef-fun.i (no preprocessing) diff --git a/tests/slicing/oracle/unitialized.0.res.oracle b/tests/slicing/oracle/unitialized.0.res.oracle index ede9ff2f49abafa8106891806d4795d6524b540a..79e597aae3565cc46494182abfa6b2b75cda09e9 100644 --- a/tests/slicing/oracle/unitialized.0.res.oracle +++ b/tests/slicing/oracle/unitialized.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unitialized.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -23,7 +22,7 @@ tests/slicing/unitialized.c:30:[value] warning: accessing uninitialized left-val [value] Recording results for main [value] done for function main tests/slicing/unitialized.c:30:[value] assertion 'Value,initialisation' got final status invalid. -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] Nothing to select for an unreachable stmt of g [pdg] computing for function g @@ -65,5 +64,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_unitialized.i (no preprocessing) diff --git a/tests/slicing/oracle/unitialized.1.res.oracle b/tests/slicing/oracle/unitialized.1.res.oracle index baaa77456d03620a9c423901700121776d28d2be..9c99f993a396d1a101241317bb9c3a2a5967a18d 100644 --- a/tests/slicing/oracle/unitialized.1.res.oracle +++ b/tests/slicing/oracle/unitialized.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unitialized.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -23,7 +22,7 @@ tests/slicing/unitialized.c:30:[value] warning: accessing uninitialized left-val [value] Recording results for main [value] done for function main tests/slicing/unitialized.c:30:[value] assertion 'Value,initialisation' got final status invalid. -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function g [from] Computing for function printf @@ -64,5 +63,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_unitialized.i (no preprocessing) diff --git a/tests/slicing/oracle/unitialized.2.res.oracle b/tests/slicing/oracle/unitialized.2.res.oracle index 58c73d26044c526c021ae36e3baa381ecb5b99e9..e8a842571f7394b775ee9b9d737ff7e6caf65388 100644 --- a/tests/slicing/oracle/unitialized.2.res.oracle +++ b/tests/slicing/oracle/unitialized.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unitialized.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -23,7 +22,7 @@ tests/slicing/unitialized.c:30:[value] warning: accessing uninitialized left-val [value] Recording results for main [value] done for function main tests/slicing/unitialized.c:30:[value] assertion 'Value,initialisation' got final status invalid. -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f1 @@ -55,5 +54,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_unitialized.i (no preprocessing) diff --git a/tests/slicing/oracle/unitialized.3.res.oracle b/tests/slicing/oracle/unitialized.3.res.oracle index 60555d0e0befbd83e4b3c0965ec2ff5c6e976e1e..a3f57528b6418f552a6ad7d0e1f24705304c492a 100644 --- a/tests/slicing/oracle/unitialized.3.res.oracle +++ b/tests/slicing/oracle/unitialized.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unitialized.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -23,7 +22,7 @@ tests/slicing/unitialized.c:30:[value] warning: accessing uninitialized left-val [value] Recording results for main [value] done for function main tests/slicing/unitialized.c:30:[value] assertion 'Value,initialisation' got final status invalid. -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [slicing] Nothing to select for an unreachable stmt of g [slicing] applying all slicing requests... @@ -64,5 +63,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_unitialized.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-flavors.0.res.oracle b/tests/slicing/oracle/unravel-flavors.0.res.oracle index bba708740f7c1e9715666d053e544fbe672c7772..d08b07889eacbc61780e2b149485f5fd922f6e64 100644 --- a/tests/slicing/oracle/unravel-flavors.0.res.oracle +++ b/tests/slicing/oracle/unravel-flavors.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-flavors.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -80,7 +79,7 @@ tests/slicing/unravel-flavors.i:19:[kernel] warning: Neither code nor specificat [value] Done for function send4 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send1 [from] Computing for function printf @@ -143,5 +142,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_unravel-flavors.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-flavors.1.res.oracle b/tests/slicing/oracle/unravel-flavors.1.res.oracle index f56252ca1932afe2a7005bc73da5fc0d380d4e59..5a81d5d3a807012cbcbd183a5d451f3a9ba02d3c 100644 --- a/tests/slicing/oracle/unravel-flavors.1.res.oracle +++ b/tests/slicing/oracle/unravel-flavors.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-flavors.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -80,7 +79,7 @@ tests/slicing/unravel-flavors.i:19:[kernel] warning: Neither code nor specificat [value] Done for function send4 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send2 [from] Computing for function printf @@ -149,5 +148,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_unravel-flavors.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-flavors.2.res.oracle b/tests/slicing/oracle/unravel-flavors.2.res.oracle index f56dcc2338cc4e11c47bb6946defe9982746f815..87f2b1ed829f4ef72cb466a454bf927e35a86a26 100644 --- a/tests/slicing/oracle/unravel-flavors.2.res.oracle +++ b/tests/slicing/oracle/unravel-flavors.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-flavors.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -80,7 +79,7 @@ tests/slicing/unravel-flavors.i:19:[kernel] warning: Neither code nor specificat [value] Done for function send4 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send3 [from] Computing for function printf @@ -142,5 +141,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_unravel-flavors.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-flavors.3.res.oracle b/tests/slicing/oracle/unravel-flavors.3.res.oracle index 5cfd3dc7aefed857d800058bf0a0438eb5ea4b15..be22f59bbe6285feab6d79acd16feafbfcc8f011 100644 --- a/tests/slicing/oracle/unravel-flavors.3.res.oracle +++ b/tests/slicing/oracle/unravel-flavors.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-flavors.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -80,7 +79,7 @@ tests/slicing/unravel-flavors.i:19:[kernel] warning: Neither code nor specificat [value] Done for function send4 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send4 [from] Computing for function printf @@ -143,5 +142,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_unravel-flavors.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-point.0.res.oracle b/tests/slicing/oracle/unravel-point.0.res.oracle index a27658bfce9047a636118a5d5544e3dd56009741..41449e51118c7b81b1fb1b328d073431502e03f7 100644 --- a/tests/slicing/oracle/unravel-point.0.res.oracle +++ b/tests/slicing/oracle/unravel-point.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-point.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -107,7 +106,7 @@ tests/slicing/unravel-point.i:78:[value] warning: accessing uninitialized left-v \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send1 [pdg] done for function send1 @@ -162,5 +161,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_unravel-point.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-point.1.res.oracle b/tests/slicing/oracle/unravel-point.1.res.oracle index b13be58eb00a0eec85abd8e34552f698b9f8378e..6c30721d28d41dbc31f660eb5dcb361697159c98 100644 --- a/tests/slicing/oracle/unravel-point.1.res.oracle +++ b/tests/slicing/oracle/unravel-point.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-point.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -107,7 +106,7 @@ tests/slicing/unravel-point.i:78:[value] warning: accessing uninitialized left-v \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send2 [pdg] done for function send2 @@ -146,5 +145,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_unravel-point.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-point.2.res.oracle b/tests/slicing/oracle/unravel-point.2.res.oracle index a4128946b376bebe8e1c615e9b3d22730945ad87..7e1c3b252fcabfa7ae370ccd16741bfbe6c66e12 100644 --- a/tests/slicing/oracle/unravel-point.2.res.oracle +++ b/tests/slicing/oracle/unravel-point.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-point.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -107,7 +106,7 @@ tests/slicing/unravel-point.i:78:[value] warning: accessing uninitialized left-v \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send3 [pdg] done for function send3 @@ -162,5 +161,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_unravel-point.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-point.3.res.oracle b/tests/slicing/oracle/unravel-point.3.res.oracle index 9f0ea6608b13bef0982d37e5e5c45fc7f56e2915..be3cb4f7f60961424624138abb8080383f5ef185 100644 --- a/tests/slicing/oracle/unravel-point.3.res.oracle +++ b/tests/slicing/oracle/unravel-point.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-point.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -107,7 +106,7 @@ tests/slicing/unravel-point.i:78:[value] warning: accessing uninitialized left-v \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send4 [pdg] done for function send4 @@ -140,5 +139,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_unravel-point.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-point.4.res.oracle b/tests/slicing/oracle/unravel-point.4.res.oracle index 5409770781ea199bfddad62eaaa643318b634d22..3af504e8b18c124dfda2e4c1f1eda807379f5043 100644 --- a/tests/slicing/oracle/unravel-point.4.res.oracle +++ b/tests/slicing/oracle/unravel-point.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-point.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -107,7 +106,7 @@ tests/slicing/unravel-point.i:78:[value] warning: accessing uninitialized left-v \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send1 [pdg] done for function send1 @@ -195,7 +194,7 @@ tests/slicing/unravel-point.i:78:[value] warning: accessing uninitialized left-v NO EFFECTS [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function send1_slice_1 [pdg] done for function send1_slice_1 @@ -307,5 +306,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_unravel-point.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-variance.0.res.oracle b/tests/slicing/oracle/unravel-variance.0.res.oracle index fbfc0a2feec7ccbeea7052d52a6a261e081e5bae..98e315c107b88e94a0f629ee649ae592c489ce1b 100644 --- a/tests/slicing/oracle/unravel-variance.0.res.oracle +++ b/tests/slicing/oracle/unravel-variance.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-variance.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -125,7 +124,7 @@ tests/slicing/unravel-variance.i:56:[kernel] warning: Neither code nor specifica [value] Recording results for main [value] done for function main [scope:rm_asserts] removing 2 assertion(s) -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function scanf @@ -181,5 +180,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_unravel-variance.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-variance.1.res.oracle b/tests/slicing/oracle/unravel-variance.1.res.oracle index f3f402e4ce40c866e54311ed54b0fe14ed5bdb28..2bc86235a3f958cdb758d520f4d7a16ab98219ed 100644 --- a/tests/slicing/oracle/unravel-variance.1.res.oracle +++ b/tests/slicing/oracle/unravel-variance.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-variance.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -125,7 +124,7 @@ tests/slicing/unravel-variance.i:56:[kernel] warning: Neither code nor specifica [value] Recording results for main [value] done for function main [scope:rm_asserts] removing 2 assertion(s) -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function scanf @@ -182,5 +181,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_1_unravel-variance.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-variance.2.res.oracle b/tests/slicing/oracle/unravel-variance.2.res.oracle index 6054b469f331f893bfa96b1aefa116410b38e83c..a884ede1ead03623dfd720c70e96ba45fdfe35f0 100644 --- a/tests/slicing/oracle/unravel-variance.2.res.oracle +++ b/tests/slicing/oracle/unravel-variance.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-variance.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -125,7 +124,7 @@ tests/slicing/unravel-variance.i:56:[kernel] warning: Neither code nor specifica [value] Recording results for main [value] done for function main [scope:rm_asserts] removing 2 assertion(s) -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function scanf @@ -182,5 +181,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_2_unravel-variance.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-variance.3.res.oracle b/tests/slicing/oracle/unravel-variance.3.res.oracle index a24c5d9ddf92968cfdcecb998fd8d7f87d097610..490fc3b05be3edc0d9ac0077feb8cdb97a4a8a74 100644 --- a/tests/slicing/oracle/unravel-variance.3.res.oracle +++ b/tests/slicing/oracle/unravel-variance.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-variance.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -125,7 +124,7 @@ tests/slicing/unravel-variance.i:56:[kernel] warning: Neither code nor specifica [value] Recording results for main [value] done for function main [scope:rm_asserts] removing 2 assertion(s) -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function scanf @@ -190,5 +189,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_3_unravel-variance.i (no preprocessing) diff --git a/tests/slicing/oracle/unravel-variance.4.res.oracle b/tests/slicing/oracle/unravel-variance.4.res.oracle index 06cebe12acedcc25e7a72ffdfb8b3f44528c9aed..986a99d5f875e8d55d0192920a40025d918fcab5 100644 --- a/tests/slicing/oracle/unravel-variance.4.res.oracle +++ b/tests/slicing/oracle/unravel-variance.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unravel-variance.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -125,7 +124,7 @@ tests/slicing/unravel-variance.i:56:[kernel] warning: Neither code nor specifica [value] Recording results for main [value] done for function main [scope:rm_asserts] removing 2 assertion(s) -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function scanf @@ -187,5 +186,4 @@ void main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_4_unravel-variance.i (no preprocessing) diff --git a/tests/slicing/oracle/unsupported.0.res.oracle b/tests/slicing/oracle/unsupported.0.res.oracle index 5204d5869214de21c8b11f284777aecc1f9f0fbf..5c153d7aa476ff4c6d7944d4d837cdcfbd1a59db 100644 --- a/tests/slicing/oracle/unsupported.0.res.oracle +++ b/tests/slicing/oracle/unsupported.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unsupported.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -6,14 +5,11 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Call to builtin bzero(({{ (unsigned char *)&t }},{40})) [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero [pdg] done for function main [slicing] applying all slicing requests... [slicing] applying 0 actions... @@ -23,27 +19,17 @@ [slicing] exporting project to 'Slicing export'... [slicing] applying all slicing requests... [slicing] applying 0 actions... -tests/slicing/unsupported.i:6:[slicing] warning: Dropping unsupported ACSL annotation +tests/slicing/unsupported.i:11:[slicing] warning: Dropping unsupported ACSL annotation [sparecode] remove unused global declarations from project 'Slicing export tmp' [sparecode] removed unused global declarations in new project 'Slicing export' /* Generated by Frama-C */ -/*@ requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(unsigned char *dest, - unsigned long n); - int main(void) { int __retres; - int t[10]; - Frama_C_bzero((unsigned char *)(t),(unsigned long)sizeof(int [10])); - t[2] = 2; + int t[10] = {0, 1, 2}; __retres = t[5] + t[2]; return __retres; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_unsupported.i (no preprocessing) -share/libc/__fc_builtin_for_normalization.i:30:[kernel] warning: found two contracts. Merging them diff --git a/tests/slicing/oracle/unsupported.1.res.oracle b/tests/slicing/oracle/unsupported.1.res.oracle index 812b515522473096675513c62d762c56b563b1c0..2ba864642a3152f61949bfda5f4ca066ee4263e6 100644 --- a/tests/slicing/oracle/unsupported.1.res.oracle +++ b/tests/slicing/oracle/unsupported.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/unsupported.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -6,36 +5,19 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Call to builtin bzero(({{ (unsigned char *)&t }},{40})) [value] Recording results for main [value] done for function main [pdg] computing for function main -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero [pdg] done for function main -[pdg] computing for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block -tests/slicing/unsupported.i:6:[sparecode] warning: Dropping annotation +tests/slicing/unsupported.i:11:[sparecode] warning: Dropping annotation [sparecode] remove unused global declarations... [sparecode] result in new project 'default without sparecode'. /* Generated by Frama-C */ -/*@ assigns \nothing; */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(void); - int main(void) { int __retres; - int t[10]; - /*@ behavior Frama_C_implicit_init: - assigns t[0 .. 10 - 1]; */ - { - Frama_C_bzero(); - t[2] = 2; - } + int t[10] = {0, 1, 2}; + /*@ */ __retres = t[5] + t[2]; return __retres; } diff --git a/tests/slicing/oracle/use_spec.0.res.oracle b/tests/slicing/oracle/use_spec.0.res.oracle index 23901fbd52e2507e5b54b9e22f86fbb7ba5ac4af..0e45c841afde0834e100b3b4ffe89af09bd5893e 100644 --- a/tests/slicing/oracle/use_spec.0.res.oracle +++ b/tests/slicing/oracle/use_spec.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/use_spec.i (no preprocessing) tests/slicing/use_spec.i:18:[kernel] warning: Body of function f falls-through. Adding a return statement [slicing] slicing requests in progress... @@ -18,7 +17,7 @@ tests/slicing/use_spec.i:18:[kernel] warning: Body of function f falls-through. [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -45,5 +44,4 @@ int main(void) } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/result/ocode_0_use_spec.i (no preprocessing) diff --git a/tests/slicing/oracle/use_spec.1.res.oracle b/tests/slicing/oracle/use_spec.1.res.oracle index c31d14f2cc92c54893dbb8a5f742945747a6f93c..9258032b898b0190847eb54de958b5e352ff5a4e 100644 --- a/tests/slicing/oracle/use_spec.1.res.oracle +++ b/tests/slicing/oracle/use_spec.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/use_spec.i (no preprocessing) tests/slicing/use_spec.i:18:[kernel] warning: Body of function f falls-through. Adding a return statement [slicing] slicing requests in progress... @@ -23,7 +22,7 @@ tests/slicing/use_spec.i:41:[value] warning: signed overflow. assert -2147483648 tests/slicing/use_spec.i:41:[value] warning: signed overflow. assert tmp + G2 ≤ 2147483647; [value] Recording results for main2 [value] done for function main2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main2 [from] Computing for function h @@ -83,9 +82,8 @@ void h_slice_1(int b); int main2(int v1, int v4) { int __retres; - int tmp; h_slice_2(v1); - tmp = G1; + int tmp = G1; h_slice_1(v4); /*@ assert Value: signed_overflow: -2147483648 ≤ tmp + G2; */ /*@ assert Value: signed_overflow: tmp + G2 ≤ 2147483647; */ diff --git a/tests/slicing/oracle/variadic.0.res.oracle b/tests/slicing/oracle/variadic.0.res.oracle index b758439f0ad93353e0fbe7b2eee3a74c88c84e02..9c306193c564b3ba0d5fabdd0bc2fc0a5361fb66 100644 --- a/tests/slicing/oracle/variadic.0.res.oracle +++ b/tests/slicing/oracle/variadic.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/variadic.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -38,7 +37,7 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun [value] Done for function f2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f3 [from] Computing for function lib_f diff --git a/tests/slicing/oracle/variadic.1.res.oracle b/tests/slicing/oracle/variadic.1.res.oracle index 00199e787d743c2b3036c4793d43208b11b29590..9f2eb74974588a401445457a35ab33b814042b6c 100644 --- a/tests/slicing/oracle/variadic.1.res.oracle +++ b/tests/slicing/oracle/variadic.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/variadic.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -38,7 +37,7 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun [value] Done for function f2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f3 [from] Computing for function lib_f diff --git a/tests/slicing/oracle/variadic.2.res.oracle b/tests/slicing/oracle/variadic.2.res.oracle index 0a7bccba49c57726c27b25d348d20716136947e4..e3ea42a6a69b820bb1009c5c1cb82608c02dc162 100644 --- a/tests/slicing/oracle/variadic.2.res.oracle +++ b/tests/slicing/oracle/variadic.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/variadic.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -38,7 +37,7 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun [value] Done for function f2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f3 [from] Computing for function lib_f diff --git a/tests/slicing/oracle/variadic.3.res.oracle b/tests/slicing/oracle/variadic.3.res.oracle index 5854d2248a62e0ff8179dadb37c0cf6332afe0be..18112b964ce55e0b18030cfc846f42cbbec84da9 100644 --- a/tests/slicing/oracle/variadic.3.res.oracle +++ b/tests/slicing/oracle/variadic.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/variadic.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -38,7 +37,7 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun [value] Done for function f2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f1 diff --git a/tests/slicing/oracle/variadic.4.res.oracle b/tests/slicing/oracle/variadic.4.res.oracle index 5854d2248a62e0ff8179dadb37c0cf6332afe0be..18112b964ce55e0b18030cfc846f42cbbec84da9 100644 --- a/tests/slicing/oracle/variadic.4.res.oracle +++ b/tests/slicing/oracle/variadic.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/slicing/variadic.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -38,7 +37,7 @@ tests/pdg/variadic.c:23:[kernel] warning: Neither code nor specification for fun [value] Done for function f2 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f1 diff --git a/tests/slicing/ptr_fct.i b/tests/slicing/ptr_fct.i index e72be186e63271bdba5703773b26937ca4e524fa..1f8aaf69381458d3014714aa3d79584352522986 100644 --- a/tests/slicing/ptr_fct.i +++ b/tests/slicing/ptr_fct.i @@ -1,5 +1,5 @@ /* run.config - OPT: -main h -slice-return h -slicing-level 1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main h -slice-return h -slicing-level 1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ int X ; diff --git a/tests/slicing/same_sliced_name_bts1422.i b/tests/slicing/same_sliced_name_bts1422.i index 1933350efc046c4ffbb42f557be2e1068cd0d397..96d34288c945759f6f0627a15b23f83ec760246a 100644 --- a/tests/slicing/same_sliced_name_bts1422.i +++ b/tests/slicing/same_sliced_name_bts1422.i @@ -1,5 +1,5 @@ /* run.config -OPT: -main foo -slice-value y -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +OPT: -val-show-progress -main foo -slice-value y -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ int y; diff --git a/tests/slicing/select_by_annot.i b/tests/slicing/select_by_annot.i index 029345a34d7cd4f83d123fb51ec9c6bd2a66ee9e..25e2ed6ab5daa54aeecc1f56ffdf3a90f5340fef 100644 --- a/tests/slicing/select_by_annot.i +++ b/tests/slicing/select_by_annot.i @@ -1,22 +1,22 @@ /* run.config EXECNOW: make -s tests/slicing/select_by_annot.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/select_by_annot.cmxs - OPT: -deps -lib-entry -main main -journal-disable + OPT: -val-show-progress -deps -lib-entry -main main -journal-disable CMD: bin/toplevel.opt - OPT: -check -deps -lib-entry -main main -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma modifS -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f4 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f5 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f6 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f7 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-loop-inv f8 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f8 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-assert f8 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -lib-entry -main main -slice-pragma f9 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma modifS -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f4 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f5 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f6 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f7 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-loop-inv f8 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f8 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-assert f8 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -lib-entry -main main -slice-pragma f9 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps */ diff --git a/tests/slicing/select_by_annot.ml b/tests/slicing/select_by_annot.ml index e40d6bec8db5c9b59caeb7c5dbc9f99a771f9cc5..75508ce846022c06b09834bfe61bff5c0713672c 100644 --- a/tests/slicing/select_by_annot.ml +++ b/tests/slicing/select_by_annot.ml @@ -6,44 +6,43 @@ open LibSelect;; let main _ = - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); let pretty_pdg fmt kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) in let add_annot kf = - let mark = !S.Mark.make ~data:true ~addr:false ~ctrl:false in - let select = S.Select.empty_selects in - let select = !S.Select.select_func_annots select mark + let mark = Slicing.Api.Mark.make ~data:true ~addr:false ~ctrl:false in + let select = Slicing.Api.Select.empty_selects in + let select = Slicing.Api.Select.select_func_annots select mark ~spare:true ~threat:false ~user_assert:false ~slicing_pragma:true ~loop_inv:true ~loop_var:true kf in - !Db.Slicing.Request.add_persistent_selection project select - (*!S.Request.read_annotations project kf_main ;;*) + Slicing.Api.Request.add_persistent_selection select + (*Slicing.Api.Request.read_annotations project kf_main ;;*) in let kf_main = Globals.Functions.find_def_by_name "main" in add_annot kf_main; Format.printf "@[%a@]@\n" pretty_pdg kf_main; let kf_modifS = Globals.Functions.find_def_by_name "modifS" in - (*!S.Request.read_annotations project kf_modifS ;;*) + (*Slicing.ApiRequest.read_annotations project kf_modifS ;;*) add_annot kf_modifS; Format.printf "@[%a@]@\n" pretty_pdg kf_modifS; - !S.Request.pretty Format.std_formatter project; - !S.Request.apply_all_internal project; + Slicing.Api.Request.pretty Format.std_formatter; + Slicing.Api.Request.apply_all_internal (); - !S.Project.pretty Format.std_formatter project; - extract_and_print project; + Slicing.Api.Project.pretty Format.std_formatter; + extract_and_print (); (** create another slice for "main" to check if it also contains the previous * selection. *) - let ff = !S.Slice.create project kf_main in - let select = LibSelect.select_data "b" project kf_main in - !S.Request.add_slice_selection_internal project ff select; + let ff = Slicing.Api.Slice.create kf_main in + let select = LibSelect.select_data "b" kf_main in + Slicing.Api.Request.add_slice_selection_internal ff select; - !S.Request.apply_all_internal project; + Slicing.Api.Request.apply_all_internal (); - !S.Project.pretty Format.std_formatter project; - extract_and_print project + Slicing.Api.Project.pretty Format.std_formatter; + extract_and_print () let () = Db.Main.extend main - diff --git a/tests/slicing/select_calls.i b/tests/slicing/select_calls.i index 71116046043f52b49ea6e62d158d3d54744170b9..839ca4bbddb7b16175ca7aba51d978ce45941479 100644 --- a/tests/slicing/select_calls.i +++ b/tests/slicing/select_calls.i @@ -1,6 +1,6 @@ /* run.config - OPT: -lib-entry -main f -slice-calls send -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -lib-entry -main g -slice-calls nothing -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -lib-entry -main f -slice-calls send -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -lib-entry -main g -slice-calls nothing -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ void nothing (void); diff --git a/tests/slicing/select_return.i b/tests/slicing/select_return.i index 2e3fff008df7a6728a3107313b3c871d29f62836..d06246fceee4a897cc9a92d84933be9bf5791cf9 100644 --- a/tests/slicing/select_return.i +++ b/tests/slicing/select_return.i @@ -1,26 +1,26 @@ /* run.config - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls "send, send_bis" -lib-entry -main g -slicing-level 1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls "send, send_bis" -lib-entry -main g -slicing-level 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls "send,send_bis" -lib-entry -main g -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return f -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return f -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return f -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-return f -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-pragma f -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-pragma f -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-pragma f -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-pragma f -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-value H -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-value H -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-value H -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls "send, send_bis" -lib-entry -main g -slicing-level 1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls "send, send_bis" -lib-entry -main g -slicing-level 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls "send,send_bis" -lib-entry -main g -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return f -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return f -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return f -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-return f -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-pragma f -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-pragma f -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-pragma f -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-pragma f -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-value H -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-value H -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-value H -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ int G,H,I; diff --git a/tests/slicing/select_return_bis.i b/tests/slicing/select_return_bis.i index 419466e67be73fe35b13de89de73eb465b1fcc80..f523b2466a0428571b5f5ba2e6488b5121009510 100644 --- a/tests/slicing/select_return_bis.i +++ b/tests/slicing/select_return_bis.i @@ -1,15 +1,15 @@ /* run.config - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check - OPT: -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 0 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check + OPT: -val-show-progress -check -slice-calls send,send_bis -lib-entry -main g -slicing-level 3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ int G,H,I; diff --git a/tests/slicing/select_simple.i b/tests/slicing/select_simple.i index 7721c59731039d4201faad79fe39e4aaa18f29a4..75f5038ded1cb88c57e8540dbe19e777540af9ec 100644 --- a/tests/slicing/select_simple.i +++ b/tests/slicing/select_simple.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/select_simple.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/select_simple.cmxs - OPT: -deps -journal-disable + OPT: -val-show-progress -deps -journal-disable */ /* dummy source file in order to test select_simple.ml */ diff --git a/tests/slicing/select_simple.ml b/tests/slicing/select_simple.ml index 59f0764fc1ed22a9d7be9f5c0564e77235524a63..3aa0403891373879e2f3a05719f72ac00fd4c239 100644 --- a/tests/slicing/select_simple.ml +++ b/tests/slicing/select_simple.ml @@ -6,7 +6,7 @@ include LibSelect ;; let main _ = ignore (test_select_data "f1" "G"); ignore (test_select_retres "f1"); - !Db.Slicing.set_modes ~calls:2 (); + Slicing.Api.set_modes ~calls:2 (); ignore (test_select_retres "f2"); ignore (test_select_data "f6" "n"); diff --git a/tests/slicing/simple_intra_slice.i b/tests/slicing/simple_intra_slice.i index 3bd64a0ae6e517e21ad7f40ef18e1c1a8018075a..60021203db5155c4c628ff61962b9afaf788cf26 100644 --- a/tests/slicing/simple_intra_slice.i +++ b/tests/slicing/simple_intra_slice.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/simple_intra_slice.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/simple_intra_slice.cmxs - OPT: -deps -no-slice-callers -journal-disable + OPT: -val-show-progress -deps -no-slice-callers -journal-disable */ int Unknown; int G; diff --git a/tests/slicing/simple_intra_slice.ml b/tests/slicing/simple_intra_slice.ml index 8ec263471b35cac359f56070acbc42bb1a96be64..3746bbdf37d28c52eab3315d0c74485117b40a63 100644 --- a/tests/slicing/simple_intra_slice.ml +++ b/tests/slicing/simple_intra_slice.ml @@ -6,43 +6,43 @@ include LibSelect;; let main _ = - let project = mk_project () in + Slicing.Api.Project.reset_slicing (); let pretty_pdg fmt kf = !Db.Pdg.pretty fmt (!Db.Pdg.get kf) in - let apply_all_actions = !S.Request.apply_all_internal in - let print_slice = !S.Slice.pretty in + let apply_all_actions = Slicing.Api.Request.apply_all_internal in + let print_slice = Slicing.Api.Slice.pretty in let print_fct_stmts kf = - Slicing.PrintSlice.print_fct_stmts fmt (project, kf) in + Slicing.PrintSlice.print_fct_stmts fmt kf in let get_fct name = let kf = Globals.Functions.find_def_by_name name in kf in let select_stmt_and_print kf num_stmt = let stmt = get_stmt num_stmt in - let mark = !S.Mark.make ~data:true ~addr:true ~ctrl:true in - let select = !S.Select.select_stmt_internal kf stmt mark in - let ff = !S.Slice.create project kf in - let _ = !S.Request.add_slice_selection_internal project ff select in - !S.Request.pretty fmt project; - apply_all_actions project; + let mark = Slicing.Api.Mark.make ~data:true ~addr:true ~ctrl:true in + let select = Slicing.Api.Select.select_stmt_internal kf stmt mark in + let ff = Slicing.Api.Slice.create kf in + Slicing.Api.Request.add_slice_selection_internal ff select; + Slicing.Api.Request.pretty fmt; + apply_all_actions (); print_slice fmt ff in let select_and_print kf select = - let ff = !S.Slice.create project kf in - let _ = !S.Request.add_slice_selection_internal project ff select in - !S.Request.pretty fmt project; - apply_all_actions project; + let ff = Slicing.Api.Slice.create kf in + Slicing.Api.Request.add_slice_selection_internal ff select; + Slicing.Api.Request.pretty fmt ; + apply_all_actions (); print_slice fmt ff in let select_out_data_and_print kf data = - let select = select_data data project kf in + let select = select_data data kf in select_and_print kf select in let select_out0_and_print kf = - let select = select_retres project kf in + let select = select_retres kf in select_and_print kf select in let select_ctrl_and_print kf numstmt = - let select = select_ctrl numstmt project kf in + let select = select_ctrl numstmt kf in select_and_print kf select in let print_outputs fct_name = @@ -59,7 +59,7 @@ let main _ = let kf = get_fct "f2" in Format.printf "@[%a@]@\n" pretty_pdg kf; print_fct_stmts kf; - select_stmt_and_print kf 10; (* c=3; *) + select_stmt_and_print kf 9; (* c=3; *) let kf = get_fct "f3" in Format.printf "@[%a@]@\n" pretty_pdg kf; @@ -70,7 +70,7 @@ let main _ = Format.printf "@[%a@]@\n" pretty_pdg kf; print_fct_stmts kf; select_out0_and_print kf; - select_stmt_and_print kf 29; (* G=a; in then branch of if (c>Unknown) *) + select_stmt_and_print kf 28; (* G=a; in then branch of if (c>Unknown) *) let kf = get_fct "f5" in print_outputs "f5"; @@ -78,7 +78,7 @@ let main _ = Format.printf "@[%a@]@\n" pretty_pdg kf; print_fct_stmts kf; select_out0_and_print kf; - select_ctrl_and_print kf 41; + select_ctrl_and_print kf 40; (* G++. VP 2008-02-04: Was ki 113, and corresponded to if(c<Unknown) { goto L2; }, not to G++ Fixed ki number to the test instead of the incrementation. @@ -87,12 +87,13 @@ let main _ = VP 2008-07-17 ki for G++ is 37 BY 2011-04-14 sid for G++ is 38 VP 2012-04-09 sid for G++ is 44 + VP 2017-02-16 sid for G++ is 43 *) let kf = get_fct "f6" in Format.printf "@[%a@]@\n" pretty_pdg kf; print_fct_stmts kf; - select_ctrl_and_print kf 69; + select_ctrl_and_print kf 68; (* return_label VP 2008-02-04: Was ki 135, corresponding to first stmt in the else branch of if (i) { __retres = 0; goto return_label; } @@ -104,7 +105,7 @@ VP 2008-07-17: ki for return_label is 112 BY 2011-04-14 sid for return_label is 128 VP 2012-04-09: sid for return_label is 134 *) - - !S.Project.pretty Format.std_formatter project + + Slicing.Api.Project.pretty Format.std_formatter let () = Db.Main.extend main diff --git a/tests/slicing/sizeof.i b/tests/slicing/sizeof.i index 6bdbf2bee49ec13c67d0c9f277107407aaef9cb9..767ee4eb57a0a97b5328c23db4216af996cfee05 100644 --- a/tests/slicing/sizeof.i +++ b/tests/slicing/sizeof.i @@ -1,17 +1,17 @@ /* run.config - OPT: -check -deps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOf_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOf_2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_pt1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_pt2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_pt3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_pt_deref_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_tab_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_pt_tab_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_pt_tab_2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-return SizeOfE_tab_acces_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps - OPT: -check -deps -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOf_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOf_2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_pt1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_pt2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_pt3 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_pt_deref_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_tab_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_pt_tab_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_pt_tab_2 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-return SizeOfE_tab_acces_1 -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps + OPT: -val-show-progress -check -deps -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-deps */ struct St { int i, *p, tab[5] ; } st ; diff --git a/tests/slicing/slice_behavior.i b/tests/slicing/slice_behavior.i index c72934b8b2febdb9a477e52301a196df0942c8e2..544b8115c5197d59db1d2413b71eaf0cfca76555 100644 --- a/tests/slicing/slice_behavior.i +++ b/tests/slicing/slice_behavior.i @@ -1,5 +1,5 @@ /* run.config - OPT: -check -val -slice-assert f -slicing-level 0 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-val + OPT: -val-show-progress -check -val -slice-assert f -slicing-level 0 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -no-val */ /*@ requires a > 0; */ int f(int a) { diff --git a/tests/slicing/slice_no_body.i b/tests/slicing/slice_no_body.i index 36196b6f5ef0bc4c7a81441eb5566d6d8575df4f..3be2044774f2a794b7c05fe8536fb3263da82feb 100644 --- a/tests/slicing/slice_no_body.i +++ b/tests/slicing/slice_no_body.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/slice_no_body.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/slice_no_body.cmxs - OPT: -deps -lib-entry -main h -journal-disable + OPT: -val-show-progress -deps -lib-entry -main h -journal-disable */ int G; diff --git a/tests/slicing/slice_no_body.ml b/tests/slicing/slice_no_body.ml index 76a1b56dfe3fb5e8be4e5c61abb4f9bc1e801a14..8bbcde8573d6d3d4821df039f2bfcfc92795c5a7 100644 --- a/tests/slicing/slice_no_body.ml +++ b/tests/slicing/slice_no_body.ml @@ -9,37 +9,37 @@ let callers kf = !Db.Value.callers kf (** simple implementation to select every calls to [kf] source function. * The problem of this implementation is that it can generate several slice * for one function during propagation to the callers. -* See [S.Request.select_fun_calls] for a better implementation. +* See [Slicing.Api.Request.select_fun_calls] for a better implementation. * *) -let call_f project kf = +let call_f kf = let callers = callers kf in let process_caller (kf_caller,_) = - let ff_caller = !S.Slice.create project kf_caller in - !S.Request.add_call_fun project ~caller:ff_caller ~to_call:kf; - prop_to_callers project (kf_caller, ff_caller); + let ff_caller = Slicing.Api.Slice.create kf_caller in + Slicing.Api.Request.add_call_fun ~caller:ff_caller ~to_call:kf; + prop_to_callers (kf_caller, ff_caller); in List.iter process_caller callers -let slice_on_fun_calls project kf = +let slice_on_fun_calls kf = let table = Cil_datatype.Varinfo.Hashtbl.create 17 in let get_slice kf = let vf = Kernel_function.get_vi kf in try Cil_datatype.Varinfo.Hashtbl.find table vf with Not_found -> - let ff = !Db.Slicing.Slice.create project kf in + let ff = Slicing.Api.Slice.create kf in Cil_datatype.Varinfo.Hashtbl.add table vf ff; ff in let rec process_ff_caller ff (kf_caller,_) = let ff_caller = get_slice kf_caller in - !Db.Slicing.Request.add_call_slice project ~caller:ff_caller ~to_call:ff; + Slicing.Api.Request.add_call_slice ~caller:ff_caller ~to_call:ff; process_ff_callers (kf_caller, ff_caller) and process_ff_callers (kf, ff) = List.iter (process_ff_caller ff) (callers kf) in let process_src_caller kf_to_call (kf_caller,_) = let ff_caller = get_slice kf_caller in - !Db.Slicing.Request.add_call_fun project ~caller:ff_caller ~to_call:kf_to_call; + Slicing.Api.Request.add_call_fun ~caller:ff_caller ~to_call:kf_to_call; process_ff_callers (kf_caller, ff_caller) in List.iter (process_src_caller kf) (callers kf) @@ -47,18 +47,15 @@ let slice_on_fun_calls project kf = let main _ = let kf_f = find_kf "f" in - let project = mk_project () in - call_f project kf_f; - print_project project; - extract_and_print project; + Slicing.Api.Project.reset_slicing (); + call_f kf_f; + print_project (); + extract_and_print (); - let project = mk_project () in - slice_on_fun_calls project kf_f; - !S.Request.apply_all_internal project; - print_project project; - extract_and_print project + Slicing.Api.Project.reset_slicing (); + slice_on_fun_calls kf_f; + Slicing.Api.Request.apply_all_internal (); + print_project (); + extract_and_print () let () = Db.Main.extend main - - - diff --git a/tests/slicing/slice_pragma_stmt.i b/tests/slicing/slice_pragma_stmt.i index ece767430a14144b8aaa8868ddf7013e0d47614a..bb64b0d3032a6fb11aac4a41079a19ea8b99d550 100644 --- a/tests/slicing/slice_pragma_stmt.i +++ b/tests/slicing/slice_pragma_stmt.i @@ -1,27 +1,27 @@ /* run.config - OPT: -print -journal-disable - OPT: -main nop1 -slice-pragma nop1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop2 -slice-pragma nop2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop3 -slice-pragma nop3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop4 -slice-pragma nop4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop5 -slice-pragma nop5 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop6 -slice-pragma nop6 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop7 -slice-pragma nop7 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main nop8 -slice-pragma nop8 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main double_effect1 -slice-pragma double_effect1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main double_effect2 -slice-pragma double_effect2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main double_effect3 -slice-pragma double_effect3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main double_effect4 -slice-pragma double_effect4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main double_effect5 -slice-pragma double_effect5 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test1 -slice-pragma test1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test2 -slice-pragma test2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test3 -slice-pragma test3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test4 -slice-pragma test4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test5 -slice-pragma test5 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test6 -slice-pragma test6 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test7 -slice-pragma test7 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test8 -slice-pragma test8 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main test9 -slice-pragma test9 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -print -journal-disable + OPT: -val-show-progress -main nop1 -slice-pragma nop1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop2 -slice-pragma nop2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop3 -slice-pragma nop3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop4 -slice-pragma nop4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop5 -slice-pragma nop5 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop6 -slice-pragma nop6 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop7 -slice-pragma nop7 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main nop8 -slice-pragma nop8 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main double_effect1 -slice-pragma double_effect1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main double_effect2 -slice-pragma double_effect2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main double_effect3 -slice-pragma double_effect3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main double_effect4 -slice-pragma double_effect4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main double_effect5 -slice-pragma double_effect5 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test1 -slice-pragma test1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test2 -slice-pragma test2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test3 -slice-pragma test3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test4 -slice-pragma test4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test5 -slice-pragma test5 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test6 -slice-pragma test6 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test7 -slice-pragma test7 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test8 -slice-pragma test8 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main test9 -slice-pragma test9 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ typedef int stmt, expr, slice; int x, y ; diff --git a/tests/slicing/switch.i b/tests/slicing/switch.i index 60921b44ae953576566d358db3242ff869790ba0..10e0d404c4d61d9ba01a929f8fea1899f4346a9e 100644 --- a/tests/slicing/switch.i +++ b/tests/slicing/switch.i @@ -1,7 +1,7 @@ /* run.config EXECNOW: make -s tests/slicing/switch.cmxs CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module tests/slicing/switch.cmxs - OPT: -deps -journal-disable + OPT: -val-show-progress -deps -journal-disable */ int main (char choix) { int x = 0, y = 0, z = 0; diff --git a/tests/slicing/switch.ml b/tests/slicing/switch.ml index e099beaee4969176ab4f7509afe66c2c8726bbf9..bff182f72adf37a9450c052fc63812e540b44896 100644 --- a/tests/slicing/switch.ml +++ b/tests/slicing/switch.ml @@ -4,8 +4,8 @@ include LibSelect ;; let main _ = - ignore (test_select_data "main" "x"); - ignore (test_select_data "main" "y"); - ignore (test_select_data "main" "z") + test_select_data "main" "x"; + test_select_data "main" "y"; + test_select_data "main" "z" let () = Db.Main.extend main diff --git a/tests/slicing/top.i b/tests/slicing/top.i index 9898ed09f5b2961d0ca8ca536f8fd5f7a064e0b6..04fab9c79f45885242461c17f3e1d8303c55fec6 100644 --- a/tests/slicing/top.i +++ b/tests/slicing/top.i @@ -1,7 +1,7 @@ /* run.config -* OPT: -check -slicing-level 0 -slice-return uncalled -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -* OPT: -check -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -* OPT: -check -slicing-level 2 -slice-return strlen -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +* OPT: -val-show-progress -no-val-builtins-auto -check -slicing-level 0 -slice-return uncalled -no-slice-callers -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +* OPT: -val-show-progress -no-val-builtins-auto -check -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +* OPT: -val-show-progress -no-val-builtins-auto -check -slicing-level 2 -slice-return strlen -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check * * * diff --git a/tests/slicing/top2.i b/tests/slicing/top2.i index 4f7510db36d7b55cd827a21a04112ea8e66acace..5dc7cb07e0060f8735f8273aedba2f9890d4e102 100644 --- a/tests/slicing/top2.i +++ b/tests/slicing/top2.i @@ -1,6 +1,6 @@ /* run.config -* OPT: -check -slicing-level 2 -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check -* OPT: -check -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +* OPT: -val-show-progress -check -slicing-level 2 -slice-pragma main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check +* OPT: -val-show-progress -check -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -check -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -check */ diff --git a/tests/slicing/undef-fun.i b/tests/slicing/undef-fun.i index 91cb38679b8b6930dc58426a11aba91e7e368a8c..2ac1ee724d4c7216e920f4ea55e7c12a9d366ef2 100644 --- a/tests/slicing/undef-fun.i +++ b/tests/slicing/undef-fun.i @@ -1,5 +1,5 @@ /* run.config - OPT: -slice-undef-functions -slice-return f -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-undef-functions -slice-return f -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i diff --git a/tests/slicing/unitialized.c b/tests/slicing/unitialized.c index 5dec845ca84ca40f637f823e1c1512d55ee9b1a1..fec6241c418a8a8d4dd55a1018918e0136e22027 100644 --- a/tests/slicing/unitialized.c +++ b/tests/slicing/unitialized.c @@ -1,8 +1,8 @@ /* run.config - OPT: -slice-pragma g -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-assert g -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-return g -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-pragma g -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-assert g -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-assert main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-return g -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ #ifdef __FRAMAC__ //@ assigns \result \from \nothing; diff --git a/tests/slicing/unravel-flavors.i b/tests/slicing/unravel-flavors.i index 0a536a11cbc33130412495956e40dab88eefb1ea..020e6d13cf1f1ea709eef44f1ca3b6da4d5fa6e3 100644 --- a/tests/slicing/unravel-flavors.i +++ b/tests/slicing/unravel-flavors.i @@ -1,8 +1,8 @@ /* run.config - OPT: -slice-undef-functions -slice-return send1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-undef-functions -slice-return send2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-undef-functions -slice-return send3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-undef-functions -slice-return send4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-undef-functions -slice-return send1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-undef-functions -slice-return send2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-undef-functions -slice-return send3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-undef-functions -slice-return send4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ /* Small example derived from examples given for UNRAVEL tool : */ diff --git a/tests/slicing/unravel-point.i b/tests/slicing/unravel-point.i index 56f45aea391ea128a7a0f262fe9f2bdd5daaca4e..071807cfce4b44a9004e5ad3125f875ec7f73928 100644 --- a/tests/slicing/unravel-point.i +++ b/tests/slicing/unravel-point.i @@ -1,9 +1,9 @@ /* run.config - OPT: -calldeps -slice-return send1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -calldeps -slice-return send2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -calldeps -slice-return send3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -calldeps -slice-return send4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps - OPT: -calldeps -slice-return send1 -slice-return send4 -journal-disable -then-on 'Slicing export' -calldeps -slice-return send1_slice_1 -print -then-on 'Slicing export 2' -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps + OPT: -val-show-progress -calldeps -slice-return send1 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -calldeps -slice-return send2 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -calldeps -slice-return send3 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -calldeps -slice-return send4 -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress + OPT: -val-show-progress -calldeps -slice-return send1 -slice-return send4 -journal-disable -then-on 'Slicing export' -val-show-progress -calldeps -slice-return send1_slice_1 -print -then-on 'Slicing export 2' -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -no-calldeps -val-show-progress diff --git a/tests/slicing/unravel-variance.i b/tests/slicing/unravel-variance.i index d679d82fae42e981b9f06fec15736f7e55f50832..4901c68502270cfe44dafbed6b507b7c37736bf6 100644 --- a/tests/slicing/unravel-variance.i +++ b/tests/slicing/unravel-variance.i @@ -1,9 +1,9 @@ /* run.config - OPT: -slice-calls printf1 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-calls printf2 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-calls printf3 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-calls printf4 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -slice-calls printf5 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-calls printf1 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-calls printf2 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-calls printf3 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-calls printf4 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -slice-calls printf5 -journal-disable -float-normal -remove-redundant-alarms -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i */ /* Small example devired from examples given for UNRAVEL tool : */ diff --git a/tests/slicing/unsupported.i b/tests/slicing/unsupported.i index fa38f91317cda4cdada240ffabb8494db69aabce..4fd0c080e404a8cd2191503fcbbfc40c619e1d17 100644 --- a/tests/slicing/unsupported.i +++ b/tests/slicing/unsupported.i @@ -1,8 +1,12 @@ /* run.config - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -sparecode + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -sparecode */ + int main() { int t[10] = {0, 1, 2}; + /*@ requires \valid(t + (0 .. 10 - 1)); + ensures ∀ ℤ i; 0 ≤ i < \old(10) ⇒ *(t + i) ≡ 0; + */ return t[5]+t[2]; } diff --git a/tests/slicing/use_spec.i b/tests/slicing/use_spec.i index 51cf113ffbc153213fc215dafecb2b053d9989d2..9eb6f26ce86f4b2615f2ec989014e04281303997 100644 --- a/tests/slicing/use_spec.i +++ b/tests/slicing/use_spec.i @@ -1,6 +1,6 @@ /* run.config - OPT: -val-use-spec f -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i - OPT: -main main2 -slicing-level 3 -slice-undef-functions -val-use-spec h -slice-return main2 -journal-disable -slicing-keep-annotations -then-on 'Slicing export' -set-project-as-default -print -val -val-use-spec='-@all' + OPT: -val-show-progress -val-use-spec f -slice-return main -journal-disable -then-on 'Slicing export' -set-project-as-default -print -then -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.i + OPT: -val-show-progress -main main2 -slicing-level 3 -slice-undef-functions -val-use-spec h -slice-return main2 -journal-disable -slicing-keep-annotations -then-on 'Slicing export' -set-project-as-default -print -val -val-show-progress -val-use-spec='-@all' diff --git a/tests/slicing/variadic.c b/tests/slicing/variadic.c index 6d67e7fc6e71d3b3d3436b6b8d804039f811519a..9a508c88ddb9ef48c91707a129f81473f354ef7d 100644 --- a/tests/slicing/variadic.c +++ b/tests/slicing/variadic.c @@ -1,9 +1,9 @@ /* run.config - OPT: -slice-return f3 -no-slice-callers -journal-disable -then-on 'Slicing export' -print - OPT: -slice-return f3 -no-slice-callers -journal-disable -no-va -then-last -print - OPT: -slice-return f3 -journal-disable -then-on 'Slicing export' -print - OPT: -slice-return main -journal-disable -then-on 'Slicing export' -print - OPT: -slice-return main -slicing-level 3 -journal-disable -then-on 'Slicing export' -print + OPT: -val-show-progress -slice-return f3 -no-slice-callers -journal-disable -then-on 'Slicing export' -print + OPT: -val-show-progress -slice-return f3 -no-slice-callers -journal-disable -variadic-no-translation -then-last -print + OPT: -val-show-progress -slice-return f3 -journal-disable -then-on 'Slicing export' -print + OPT: -val-show-progress -slice-return main -journal-disable -then-on 'Slicing export' -print + OPT: -val-show-progress -slice-return main -slicing-level 3 -journal-disable -then-on 'Slicing export' -print */ #include "../pdg/variadic.c" diff --git a/tests/sparecode/bts324.i b/tests/sparecode/bts324.i index 898571dfd0e6d0e6e3e7557fad8103c4765d103c..22dbe05bfd8ca1d1c99ded261f41cb3be0e0af7d 100644 --- a/tests/sparecode/bts324.i +++ b/tests/sparecode/bts324.i @@ -1,7 +1,7 @@ /* run.config - OPT: -sparecode-analysis -sparecode-debug 1 -journal-disable - OPT: -sparecode-analysis -sparecode-debug 1 -main main_bis -journal-disable - OPT: -sparecode-analysis -sparecode-debug 1 -main main_ter -journal-disable + OPT: -sparecode-analysis -val-show-progress -sparecode-debug 1 -journal-disable + OPT: -sparecode-analysis -val-show-progress -sparecode-debug 1 -main main_bis -journal-disable + OPT: -sparecode-analysis -val-show-progress -sparecode-debug 1 -main main_ter -journal-disable */ diff --git a/tests/sparecode/bts324_bis.i b/tests/sparecode/bts324_bis.i index ea52a71bdb5848410e6d5afeb648a2a2534f4091..bc5d1cb1dc53bba71610c3eca06258a5468aa5fc 100644 --- a/tests/sparecode/bts324_bis.i +++ b/tests/sparecode/bts324_bis.i @@ -1,7 +1,7 @@ /* run.config - OPT: -sparecode-analysis -sparecode-debug 1 -journal-disable - OPT: -sparecode-analysis -sparecode-debug 1 -main main_bis -journal-disable - OPT: -sparecode-analysis -sparecode-debug 1 -sparecode-no-annot -journal-disable + OPT: -sparecode-analysis -val-show-progress -sparecode-debug 1 -journal-disable + OPT: -sparecode-analysis -val-show-progress -sparecode-debug 1 -main main_bis -journal-disable + OPT: -sparecode-analysis -val-show-progress -sparecode-debug 1 -sparecode-no-annot -journal-disable */ int ki[2], k ; @@ -38,7 +38,7 @@ void main (int c) { if (is_ok) while (1) { loop_body () ; - // note: sparecode conserve les pragmas de slicing et par conséquent ce + // note: sparecode conserve les pragmas de slicing et par conséquent ce // qui calcule "s0", l'option -sparecode-no-annot ni change rien //@ impact pragma expr s0; //@ slice pragma expr s1; diff --git a/tests/sparecode/bts334.i b/tests/sparecode/bts334.i index d0e46fd60f069d17161ee11d3fa168db99e7b7ee..d851de8a71839561c4ab60e101bf6069d35d25ed 100644 --- a/tests/sparecode/bts334.i +++ b/tests/sparecode/bts334.i @@ -1,7 +1,7 @@ /*run.config - OPT: -main main_init -sparecode-analysis -sparecode-no-annot -journal-disable - OPT: -main main_init -slice-pragma loop_body -journal-disable -then-on 'Slicing export' -print - OPT: -main main_init -slice-pragma loop_body -calldeps -journal-disable -then-on 'Slicing export' -print + OPT: -main main_init -sparecode-analysis -val-show-progress -sparecode-no-annot -journal-disable + OPT: -main main_init -val-show-progress -slice-pragma loop_body -journal-disable -then-on 'Slicing export' -print + OPT: -main main_init -val-show-progress -slice-pragma loop_body -calldeps -journal-disable -then-on 'Slicing export' -print */ int kf ; int k[2] ; diff --git a/tests/sparecode/bts927.i b/tests/sparecode/bts927.i index f49bb707f622a9f7f46d2890860e308b4b7a12f9..4af294b492bc9896c270b3825f7074a7a77eb30d 100644 --- a/tests/sparecode/bts927.i +++ b/tests/sparecode/bts927.i @@ -1,6 +1,6 @@ /* run.config - OPT: -no-warn-signed-overflow -sparecode - OPT: -warn-signed-overflow -sparecode + OPT: -no-warn-signed-overflow -sparecode -val-show-progress + OPT: -warn-signed-overflow -sparecode -val-show-progress */ /* The purpose of these tests is to check if the conditions are removed diff --git a/tests/sparecode/calls.i b/tests/sparecode/calls.i index b93e02ca0cee6163b64f5ba0650b0679c751698d..52b622c9acbdb251970cf17167b52ec8a077ecb0 100644 --- a/tests/sparecode/calls.i +++ b/tests/sparecode/calls.i @@ -1,6 +1,6 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable - OPT: -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -print + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable + OPT: -slicing-level 2 -slice-return main -val-show-progress -journal-disable -then-on 'Slicing export' -print */ int G; diff --git a/tests/sparecode/dead_code.i b/tests/sparecode/dead_code.i index 655e0d06a493b4593f43391ab8fb9b6af5c78d15..1e09d240bd389814f84fc0601cf291815cfa75d8 100644 --- a/tests/sparecode/dead_code.i +++ b/tests/sparecode/dead_code.i @@ -1,6 +1,6 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode -journal-disable - OPT: -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -print + OPT: -sparecode-debug 1 -sparecode -val-show-progress -journal-disable + OPT: -slicing-level 2 -slice-return main -val-show-progress -journal-disable -then-on 'Slicing export' -print */ int main (void) { diff --git a/tests/sparecode/glob_decls.i b/tests/sparecode/glob_decls.i index 06c28bc961a5bfe5156f248d008a6143d9397e5e..6e20925029404ba58c993cf5fd255daca0627188 100644 --- a/tests/sparecode/glob_decls.i +++ b/tests/sparecode/glob_decls.i @@ -1,7 +1,7 @@ /* run.config - OPT: -lib-entry -journal-disable -sparecode-debug 1 -sparecode-analysis - OPT: -lib-entry -slice-pragma main -slice-return main -journal-disable -then-on 'Slicing export' -print - OPT: -journal-disable -sparecode-debug 1 -rm-unused-globals + OPT: -lib-entry -journal-disable -sparecode-debug 1 -sparecode-analysis -val-show-progress + OPT: -lib-entry -slice-pragma main -slice-return main -val-show-progress -journal-disable -then-on 'Slicing export' -print + OPT: -journal-disable -sparecode-debug 1 -sparecode-rm-unused-globals */ // can be removed diff --git a/tests/sparecode/intra.i b/tests/sparecode/intra.i index f80b26dd9b64402002d2bc8fa9a11d9576f06557..013b2bc178c66e926918268a042944d697b17639 100644 --- a/tests/sparecode/intra.i +++ b/tests/sparecode/intra.i @@ -1,9 +1,9 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable - OPT: -slicing-level 2 -slice-return main -journal-disable -then-last -print - OPT: -main main2 -sparecode-analysis -journal-disable - OPT: -main main2 -slice-return main2 -journal-disable -then-last -print - OPT: -main main2 -slice-return main2 -slice-assert f10 -journal-disable -then-last -print + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable + OPT: -val-show-progress -slicing-level 2 -slice-return main -journal-disable -then-last -print + OPT: -main main2 -sparecode-analysis -val-show-progress -journal-disable + OPT: -main main2 -slice-return main2 -val-show-progress -journal-disable -then-last -print + OPT: -main main2 -slice-return main2 -val-show-progress -slice-assert f10 -journal-disable -then-last -print */ /* Waiting for results such as: diff --git a/tests/sparecode/issue_157.i b/tests/sparecode/issue_157.i index 47501c85f47a77e9b0b637e0f4e078125f512ea6..40a78c4e9e4da09ac8bba41cf879d0528ba7bc79 100644 --- a/tests/sparecode/issue_157.i +++ b/tests/sparecode/issue_157.i @@ -1,5 +1,5 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable */ int f() { diff --git a/tests/sparecode/oracle/bts324.0.res.oracle b/tests/sparecode/oracle/bts324.0.res.oracle index 5260d0f40a54af974a1f23bde038497cd46fb55d..55b667099023f6245472e338fcfd7d0a493e15b9 100644 --- a/tests/sparecode/oracle/bts324.0.res.oracle +++ b/tests/sparecode/oracle/bts324.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts324.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -12,13 +11,13 @@ [value] computing for function init <- main. Called from tests/sparecode/bts324.i:19. [value] using specification for function init -tests/sparecode/bts324.i:14:[value] warning: no \from part for clause 'assigns *p_res;' of function init +tests/sparecode/bts324.i:14:[value] warning: no \from part for clause 'assigns *p_res;' [value] Done for function init tests/sparecode/bts324.i:21:[value] entering loop for the first time [value] computing for function loop_body <- main. Called from tests/sparecode/bts324.i:22. [value] using specification for function loop_body -tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i0, o0;' of function loop_body +tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i0, o0;' [value] Done for function loop_body [value] computing for function loop_body <- main. Called from tests/sparecode/bts324.i:22. @@ -36,16 +35,6 @@ tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i [sparecode] add selection in function 'main' [pdg] computing for function init [pdg] done for function init -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function init [sparecode] look for annotations in function loop_body [pdg] computing for function loop_body diff --git a/tests/sparecode/oracle/bts324.1.res.oracle b/tests/sparecode/oracle/bts324.1.res.oracle index 8d5a3c79c8243854350ef15e38a2268eebf73b89..b52affc544b1d79a4dcd10c8db542926e4e73860 100644 --- a/tests/sparecode/oracle/bts324.1.res.oracle +++ b/tests/sparecode/oracle/bts324.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts324.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main_bis outputs and entry point @@ -12,13 +11,13 @@ [value] computing for function init <- main_bis. Called from tests/sparecode/bts324.i:26. [value] using specification for function init -tests/sparecode/bts324.i:14:[value] warning: no \from part for clause 'assigns *p_res;' of function init +tests/sparecode/bts324.i:14:[value] warning: no \from part for clause 'assigns *p_res;' [value] Done for function init tests/sparecode/bts324.i:28:[value] entering loop for the first time [value] computing for function loop_body <- main_bis. Called from tests/sparecode/bts324.i:29. [value] using specification for function loop_body -tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i0, o0;' of function loop_body +tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i0, o0;' [value] Done for function loop_body [value] computing for function loop_body <- main_bis. Called from tests/sparecode/bts324.i:29. @@ -36,16 +35,6 @@ tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i [sparecode] add selection in function 'main_bis' [pdg] computing for function init [pdg] done for function init -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function init [sparecode] look for annotations in function loop_body [pdg] computing for function loop_body diff --git a/tests/sparecode/oracle/bts324.2.res.oracle b/tests/sparecode/oracle/bts324.2.res.oracle index 0ea1ba2ceb9826c007907ad91e1447309e0ad919..f0ec95c9aff6544b57e632dc00cf70ad265c5b1a 100644 --- a/tests/sparecode/oracle/bts324.2.res.oracle +++ b/tests/sparecode/oracle/bts324.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts324.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main_ter outputs and entry point @@ -12,13 +11,13 @@ [value] computing for function init <- main_ter. Called from tests/sparecode/bts324.i:35. [value] using specification for function init -tests/sparecode/bts324.i:14:[value] warning: no \from part for clause 'assigns *p_res;' of function init +tests/sparecode/bts324.i:14:[value] warning: no \from part for clause 'assigns *p_res;' [value] Done for function init tests/sparecode/bts324.i:37:[value] entering loop for the first time [value] computing for function loop_body <- main_ter. Called from tests/sparecode/bts324.i:39. [value] using specification for function loop_body -tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i0, o0;' of function loop_body +tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i0, o0;' [value] Done for function loop_body [value] computing for function loop_body <- main_ter. Called from tests/sparecode/bts324.i:39. @@ -36,16 +35,6 @@ tests/sparecode/bts324.i:11:[value] warning: no \from part for clause 'assigns i [sparecode] add selection in function 'main_ter' [pdg] computing for function init [pdg] done for function init -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function init [sparecode] look for annotations in function loop_body [pdg] computing for function loop_body diff --git a/tests/sparecode/oracle/bts324_bis.0.res.oracle b/tests/sparecode/oracle/bts324_bis.0.res.oracle index 70c918923ccaa77a989911fa098ecb59ea282fe5..1ac0094bcd1921c612bfcae2dae9eae481422242 100644 --- a/tests/sparecode/oracle/bts324_bis.0.res.oracle +++ b/tests/sparecode/oracle/bts324_bis.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts324_bis.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -77,16 +76,6 @@ tests/sparecode/bts324_bis.i:47:[pdg] warning: no final state. Probably unreacha [pdg] done for function main [sparecode] add selection in function 'main' [sparecode] selecting output zones ki[0..1]; k; s0; s1; is_ok; si[0..1]; so[0..1] -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [pdg] computing for function f [pdg] done for function f @@ -102,7 +91,7 @@ tests/sparecode/bts324_bis.i:47:[pdg] warning: no final state. Probably unreacha [sparecode] add selection in function 'main' [sparecode] look for annotations in function main_bis [pdg] computing for function main_bis -[pdg] warning: unreachable entry point (sid:35, function main_bis) +[pdg] warning: unreachable entry point (sid:32, function main_bis) [pdg] Bottom for function main_bis [sparecode] pdg bottom: skip annotations [sparecode] finalize call input propagation @@ -119,8 +108,7 @@ static int si[2] = {0}; static int so[2] = {0}; int f(int vi, int i) { - int vo; - vo = so[i] / k + ki[i] * (vi - si[i]); + int vo = so[i] / k + ki[i] * (vi - si[i]); so[i] = vo; si[i] = vi; return vo; @@ -132,14 +120,10 @@ int s0; int s1; void loop_body(void) { - int acq0; - int acq1; - int val0; - int val1; - acq0 = e0; - acq1 = e1; - val0 = f(acq0,0); - val1 = f(acq1,1); + int acq0 = e0; + int acq1 = e1; + int val0 = f(acq0,0); + int val1 = f(acq1,1); s0 = val0; s1 = val1; return; diff --git a/tests/sparecode/oracle/bts324_bis.1.res.oracle b/tests/sparecode/oracle/bts324_bis.1.res.oracle index 27464eb526ec6eb1649586375f34b9ccdcb24fd0..c448eacdd289d32594b490d9a8655f6ddf338dc5 100644 --- a/tests/sparecode/oracle/bts324_bis.1.res.oracle +++ b/tests/sparecode/oracle/bts324_bis.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts324_bis.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main_bis outputs and entry point @@ -77,16 +76,6 @@ tests/sparecode/bts324_bis.i:57:[pdg] warning: no final state. Probably unreacha [pdg] done for function main_bis [sparecode] add selection in function 'main_bis' [sparecode] selecting output zones ki[0..1]; k; s0; s1; is_ok; si[0..1]; so[0..1] -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [pdg] computing for function f [pdg] done for function f @@ -98,7 +87,7 @@ tests/sparecode/bts324_bis.i:57:[pdg] warning: no final state. Probably unreacha [pdg] done for function loop_body [sparecode] look for annotations in function main [pdg] computing for function main -[pdg] warning: unreachable entry point (sid:24, function main) +[pdg] warning: unreachable entry point (sid:21, function main) [pdg] Bottom for function main [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function main_bis diff --git a/tests/sparecode/oracle/bts324_bis.2.res.oracle b/tests/sparecode/oracle/bts324_bis.2.res.oracle index 6915f457dde2f6d1648bd3b14c3ec6d34c5e4ac9..0b6f60216f3106499c2de099ebc49169ad8a8ec0 100644 --- a/tests/sparecode/oracle/bts324_bis.2.res.oracle +++ b/tests/sparecode/oracle/bts324_bis.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts324_bis.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -77,16 +76,6 @@ tests/sparecode/bts324_bis.i:47:[pdg] warning: no final state. Probably unreacha [pdg] done for function main [sparecode] add selection in function 'main' [sparecode] selecting output zones ki[0..1]; k; s0; s1; is_ok; si[0..1]; so[0..1] -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [pdg] computing for function f [pdg] done for function f @@ -101,7 +90,7 @@ tests/sparecode/bts324_bis.i:47:[pdg] warning: no final state. Probably unreacha [sparecode] add selection in function 'main' [sparecode] look for annotations in function main_bis [pdg] computing for function main_bis -[pdg] warning: unreachable entry point (sid:35, function main_bis) +[pdg] warning: unreachable entry point (sid:32, function main_bis) [pdg] Bottom for function main_bis [sparecode] pdg bottom: skip annotations [sparecode] finalize call input propagation @@ -118,8 +107,7 @@ static int si[2] = {0}; static int so[2] = {0}; int f(int vi, int i) { - int vo; - vo = so[i] / k + ki[i] * (vi - si[i]); + int vo = so[i] / k + ki[i] * (vi - si[i]); so[i] = vo; si[i] = vi; return vo; @@ -131,13 +119,10 @@ int s0; int s1; void loop_body(void) { - int acq0; - int acq1; - int val1; - acq0 = e0; - acq1 = e1; + int acq0 = e0; + int acq1 = e1; f(acq0,0); - val1 = f(acq1,1); + int val1 = f(acq1,1); s1 = val1; return; } diff --git a/tests/sparecode/oracle/bts334.0.res.oracle b/tests/sparecode/oracle/bts334.0.res.oracle index 0ab11ba3d850378b08b4046882f8c630a718f15c..0e32f46150c2592420de783d212f19168c9e230f 100644 --- a/tests/sparecode/oracle/bts334.0.res.oracle +++ b/tests/sparecode/oracle/bts334.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts334.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main_init @@ -84,14 +83,6 @@ tests/sparecode/bts334.i:14:[value] warning: signed overflow. assert so[i] / kf [from] Non-terminating function process (no dependencies) [from] Done for function process [pdg] done for function main_init -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [pdg] computing for function f [pdg] done for function f [pdg] computing for function init diff --git a/tests/sparecode/oracle/bts334.1.res.oracle b/tests/sparecode/oracle/bts334.1.res.oracle index ab1abd2bebb54d89f62f7d065f8605c1b19ef492..aceb0368e53d77c7d5028a4c0aa4b6cae375885f 100644 --- a/tests/sparecode/oracle/bts334.1.res.oracle +++ b/tests/sparecode/oracle/bts334.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts334.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main_init @@ -73,7 +72,7 @@ tests/sparecode/bts334.i:14:[value] warning: signed overflow. assert so[i] / kf [value] Done for function process [value] Recording results for main_init [value] done for function main_init -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop_body [from] Computing for function f diff --git a/tests/sparecode/oracle/bts334.2.res.oracle b/tests/sparecode/oracle/bts334.2.res.oracle index 4bbc418b2a3b6812185ff273fac5cfef86845d0b..0f1a3fc0c858cba7cc78040ee5c47e52f54e6874 100644 --- a/tests/sparecode/oracle/bts334.2.res.oracle +++ b/tests/sparecode/oracle/bts334.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts334.i (no preprocessing) [value] Analyzing a complete application starting at main_init [value] Computing initial state @@ -120,7 +119,7 @@ tests/sparecode/bts334.i:14:[value] warning: signed overflow. assert so[i] / kf NO EFFECTS [from] ====== END OF CALLWISE DEPENDENCIES ====== [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function loop_body [pdg] done for function loop_body @@ -158,18 +157,14 @@ int f_slice_1(int vi, int i) } int volatile e0; -int volatile e1; int s0; void loop_body_slice_1(void) { int acq0; - int acq1; int val0; /*@ slice pragma expr s0; */ ; acq0 = e0; - acq1 = e1; val0 = f_slice_1(acq0,0); - f_slice_1(acq1,1); s0 = val0; return; } @@ -178,7 +173,6 @@ void process_slice_1(int conf) { kf = conf; k[0] = 3; - k[1] = 14; while (1) loop_body_slice_1(); return; } diff --git a/tests/sparecode/oracle/bts927.0.res.oracle b/tests/sparecode/oracle/bts927.0.res.oracle index 75b6bd53ee6b427eb1576474c024e18bd688acec..302b74c562c57895d4fe6893bd042089c8de8101 100644 --- a/tests/sparecode/oracle/bts927.0.res.oracle +++ b/tests/sparecode/oracle/bts927.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts927.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -24,22 +23,13 @@ tests/sparecode/bts927.i:10:[value] warning: 2's complement assumed for overflow [pdg] done for function main [pdg] computing for function f [pdg] done for function f -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] remove unused global declarations... [sparecode] result in new project 'default without sparecode'. /* Generated by Frama-C */ int f(int a) { - int c; int tmp; - c = a + 1; + int c = a + 1; if (c > 0) tmp = 1; else tmp = 0; return tmp; } diff --git a/tests/sparecode/oracle/bts927.1.res.oracle b/tests/sparecode/oracle/bts927.1.res.oracle index 6355b227ff4bc45882931382c61fdc64d7a6f75d..f93c697d9e410a69c9d74ccb1492eec440d29352 100644 --- a/tests/sparecode/oracle/bts927.1.res.oracle +++ b/tests/sparecode/oracle/bts927.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/bts927.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main @@ -24,14 +23,6 @@ tests/sparecode/bts927.i:10:[value] warning: signed overflow. assert a + 1 ≤ 2 [pdg] done for function main [pdg] computing for function f [pdg] done for function f -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] remove unused global declarations... [sparecode] result in new project 'default without sparecode'. /* Generated by Frama-C */ diff --git a/tests/sparecode/oracle/calls.0.res.oracle b/tests/sparecode/oracle/calls.0.res.oracle index 4806fa932d955cb6cd7d3f64d91ec74d18d3c1e7..95450d3c27f178b5e551c185fb6a673c9eeb7c9e 100644 --- a/tests/sparecode/oracle/calls.0.res.oracle +++ b/tests/sparecode/oracle/calls.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/calls.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -30,16 +29,6 @@ [sparecode] add selection in function 'main' [pdg] computing for function f [pdg] done for function f -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [sparecode] look for annotations in function main [sparecode] finalize call input propagation @@ -56,10 +45,8 @@ int f(int x, int y) int main(void) { - int a; - int b; - a = 1; - b = 1; + int a = 1; + int b = 1; f(a,b); a = f(G + 1,b); G = 0; diff --git a/tests/sparecode/oracle/calls.1.res.oracle b/tests/sparecode/oracle/calls.1.res.oracle index 1a31edb942e6b53bd62d63dfab764fc394613728..ee507abf8f934127d21d1fb8d7842ce33deb5d11 100644 --- a/tests/sparecode/oracle/calls.1.res.oracle +++ b/tests/sparecode/oracle/calls.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/calls.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -20,7 +19,7 @@ [value] Done for function f [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function f @@ -48,10 +47,8 @@ int f_slice_1(int x, int y) int main(void) { - int a; - int b; - a = 1; - b = 1; + int a = 1; + int b = 1; f_slice_1(a,b); a = f_slice_1(G + 1,b); return a; diff --git a/tests/sparecode/oracle/dead_code.0.res.oracle b/tests/sparecode/oracle/dead_code.0.res.oracle index 224f80af3ff803043f2625c0fca55e511ed72f9f..6a42cce9ed1cbb19aeccb45211c58a66a88c3294 100644 --- a/tests/sparecode/oracle/dead_code.0.res.oracle +++ b/tests/sparecode/oracle/dead_code.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/dead_code.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -14,16 +13,6 @@ [sparecode] add selection in function 'main' [sparecode] selecting output zones \nothing [sparecode] add selection in function 'main' -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function main [sparecode] finalize call input propagation [sparecode] remove unused global declarations... diff --git a/tests/sparecode/oracle/dead_code.1.res.oracle b/tests/sparecode/oracle/dead_code.1.res.oracle index e8eaf16c98c5c78b761e4b35012016386e4bcf07..ff193611ad38c348639bdf304efd790b25be9b2d 100644 --- a/tests/sparecode/oracle/dead_code.1.res.oracle +++ b/tests/sparecode/oracle/dead_code.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/dead_code.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -8,7 +7,7 @@ [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main diff --git a/tests/sparecode/oracle/glob_decls.0.res.oracle b/tests/sparecode/oracle/glob_decls.0.res.oracle index 7f1869504f5e7f68ae243e5240ca70b8172a0651..c52897bcb1b09738e88ed36dd935bb6e278f71dd 100644 --- a/tests/sparecode/oracle/glob_decls.0.res.oracle +++ b/tests/sparecode/oracle/glob_decls.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/glob_decls.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -36,16 +35,6 @@ tests/sparecode/glob_decls.i:49:[value] warning: signed overflow. assert X + x [sparecode] add selection in function 'main' [sparecode] selecting output zones \nothing [sparecode] add selection in function 'main' -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [pdg] computing for function f [pdg] warning: unreachable entry point (sid:2, function f) diff --git a/tests/sparecode/oracle/glob_decls.1.res.oracle b/tests/sparecode/oracle/glob_decls.1.res.oracle index 6321b179133867f33862a53f134fc8accefeaea5..589843e6b1abc40d6e73ba93b553d0c83c4d4108 100644 --- a/tests/sparecode/oracle/glob_decls.1.res.oracle +++ b/tests/sparecode/oracle/glob_decls.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/glob_decls.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing an incomplete application starting at main @@ -30,7 +29,7 @@ tests/sparecode/glob_decls.i:48:[value] warning: assertion got status unknown. tests/sparecode/glob_decls.i:49:[value] warning: signed overflow. assert X + x ≤ 2147483647; [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [pdg] done for function main diff --git a/tests/sparecode/oracle/glob_decls.2.res.oracle b/tests/sparecode/oracle/glob_decls.2.res.oracle index 6e3f8b830a5240ed2659486887083d72337b57e6..ce0cf65dc81cb67da921f682984aff7679db9f75 100644 --- a/tests/sparecode/oracle/glob_decls.2.res.oracle +++ b/tests/sparecode/oracle/glob_decls.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/glob_decls.i (no preprocessing) [sparecode] remove unused global declarations from project 'default' [sparecode] removed unused global declarations in new project 'default (without unused globals)' @@ -39,9 +38,8 @@ int *PX; int main(int x, Ts s) { int __retres; - int y; /*@ slice pragma expr S2; */ ; - y = 3; + int y = 3; y += Y; y += *PX; /*@ assert X > 0; */ ; diff --git a/tests/sparecode/oracle/intra.0.res.oracle b/tests/sparecode/oracle/intra.0.res.oracle index e1b5a700ec425aa9d4e6b3f073cd099625360e89..fe37ceae1b6da3a8a1f3ab5802be2d89ca8f2661 100644 --- a/tests/sparecode/oracle/intra.0.res.oracle +++ b/tests/sparecode/oracle/intra.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/intra.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -91,21 +90,11 @@ tests/sparecode/intra.i:93:[value] entering loop for the first time [pdg] done for function param [pdg] computing for function two_outputs [pdg] done for function two_outputs -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function assign [sparecode] look for annotations in function call_two_outputs [sparecode] look for annotations in function f10 [pdg] computing for function f10 -[pdg] warning: unreachable entry point (sid:83, function f10) +[pdg] warning: unreachable entry point (sid:79, function f10) [pdg] Bottom for function f10 [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function loop @@ -116,7 +105,7 @@ tests/sparecode/intra.i:93:[value] entering loop for the first time [sparecode] selecting annotation : assert \false; [sparecode] look for annotations in function main2 [pdg] computing for function main2 -[pdg] warning: unreachable entry point (sid:92, function main2) +[pdg] warning: unreachable entry point (sid:87, function main2) [pdg] Bottom for function main2 [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function param @@ -141,11 +130,9 @@ tests/sparecode/intra.i:93:[value] entering loop for the first time int G; int tmp(int a) { - int x; - int w; - x = a; + int x = a; /*@ assert x ≡ a; */ ; - w = 1; + int w = 1; /*@ assert w ≡ 1; */ ; return x; } @@ -164,14 +151,10 @@ int two_outputs(int a, int b) int call_two_outputs(void) { int x; - int any_b; - int any_a; - int a; - int b; - any_b = 1; - any_a = 2; - a = 1; - b = any_b; + int any_b = 1; + int any_a = 2; + int a = 1; + int b = any_b; x = two_outputs(a,b); G = 1; b = 2; @@ -188,8 +171,7 @@ void assign(int *p, int *q) int loop(int x, int y, int z) { - int i; - i = 0; + int i = 0; /*@ assert i < z; */ ; /*@ loop invariant i < y; */ while (i < x) i ++; @@ -199,33 +181,22 @@ int loop(int x, int y, int z) int main(void) { int __retres; - int res; - int spare_ref; int x; - int y; int tmp_0; int tmp_1; int tmp_2; int tmp_3; - res = 0; - spare_ref = 3; - y = 2; - { /* sequence */ - tmp_0 = param(2); - res += tmp_0; - } - { /* sequence */ - tmp_1 = tmp(4); - res += tmp_1; - } - { /* sequence */ - tmp_2 = call_two_outputs(); - res += tmp_2; - } - { /* sequence */ - tmp_3 = loop(10,15,20); - res += tmp_3; - } + int res = 0; + int spare_ref = 3; + int y = 2; + tmp_0 = param(2); + res += tmp_0; + tmp_1 = tmp(4); + res += tmp_1; + tmp_2 = call_two_outputs(); + res += tmp_2; + tmp_3 = loop(10,15,20); + res += tmp_3; assign(& x,& y); __retres = (res + G) + x; return __retres; diff --git a/tests/sparecode/oracle/intra.1.res.oracle b/tests/sparecode/oracle/intra.1.res.oracle index 2609a514edae24a4bd86e5278382d2c690c7c3c0..490ff077d9d78e72c30be7c6cbddd44b5231f795 100644 --- a/tests/sparecode/oracle/intra.1.res.oracle +++ b/tests/sparecode/oracle/intra.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/intra.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -57,7 +56,7 @@ tests/sparecode/intra.i:91:[kernel] warning: Neither code nor specification for tests/sparecode/intra.i:93:[value] entering loop for the first time [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function param @@ -103,8 +102,7 @@ tests/sparecode/intra.i:93:[value] entering loop for the first time int G; int tmp_slice_1(int a) { - int x; - x = a; + int x = a; /*@ assert x ≡ a; */ ; return x; } @@ -123,14 +121,10 @@ int two_outputs_slice_1(int a, int b) int call_two_outputs_slice_1(void) { int x; - int any_b; - int any_a; - int a; - int b; - any_b = 1; - any_a = 2; - a = 1; - b = any_b; + int any_b = 1; + int any_a = 2; + int a = 1; + int b = any_b; x = two_outputs_slice_1(a,b); G = 1; b = 2; @@ -147,8 +141,7 @@ void assign_slice_1(int *p, int *q) int loop_slice_1(int x) { - int i; - i = 0; + int i = 0; while (i < x) i ++; return i; } @@ -156,33 +149,22 @@ int loop_slice_1(int x) int main(void) { int __retres; - int res; - int spare_ref; int x; - int y; int tmp_0; int tmp_1; int tmp_2; int tmp_3; - res = 0; - spare_ref = 3; - y = 2; - { /* sequence */ - tmp_0 = param_slice_1(2); - res += tmp_0; - } - { /* sequence */ - tmp_1 = tmp_slice_1(4); - res += tmp_1; - } - { /* sequence */ - tmp_2 = call_two_outputs_slice_1(); - res += tmp_2; - } - { /* sequence */ - tmp_3 = loop_slice_1(10); - res += tmp_3; - } + int res = 0; + int spare_ref = 3; + int y = 2; + tmp_0 = param_slice_1(2); + res += tmp_0; + tmp_1 = tmp_slice_1(4); + res += tmp_1; + tmp_2 = call_two_outputs_slice_1(); + res += tmp_2; + tmp_3 = loop_slice_1(10); + res += tmp_3; assign_slice_1(& x,& y); __retres = (res + G) + x; return __retres; diff --git a/tests/sparecode/oracle/intra.2.res.oracle b/tests/sparecode/oracle/intra.2.res.oracle index fcbdb062368f2fc96144530a4ea5bfe093ca14c3..e6d151543a777874f1544b65f22b72ceee094c57 100644 --- a/tests/sparecode/oracle/intra.2.res.oracle +++ b/tests/sparecode/oracle/intra.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/intra.i (no preprocessing) [sparecode] remove unused code... [value] Analyzing a complete application starting at main2 @@ -21,31 +20,23 @@ tests/sparecode/intra.i:109:[value] assertion got status valid. [pdg] done for function main2 [pdg] computing for function f10 [pdg] done for function f10 -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [pdg] computing for function assign -[pdg] warning: unreachable entry point (sid:35, function assign) +[pdg] warning: unreachable entry point (sid:32, function assign) [pdg] Bottom for function assign [pdg] computing for function call_two_outputs -[pdg] warning: unreachable entry point (sid:22, function call_two_outputs) +[pdg] warning: unreachable entry point (sid:20, function call_two_outputs) [pdg] Bottom for function call_two_outputs [pdg] computing for function loop -[pdg] warning: unreachable entry point (sid:38, function loop) +[pdg] warning: unreachable entry point (sid:35, function loop) [pdg] Bottom for function loop [pdg] computing for function main -[pdg] warning: unreachable entry point (sid:49, function main) +[pdg] warning: unreachable entry point (sid:46, function main) [pdg] Bottom for function main [pdg] computing for function param -[pdg] warning: unreachable entry point (sid:13, function param) +[pdg] warning: unreachable entry point (sid:11, function param) [pdg] Bottom for function param [pdg] computing for function spare_called_fct -[pdg] warning: unreachable entry point (sid:16, function spare_called_fct) +[pdg] warning: unreachable entry point (sid:14, function spare_called_fct) [pdg] Bottom for function spare_called_fct [pdg] computing for function stop [from] Computing for function stop @@ -53,10 +44,10 @@ tests/sparecode/intra.i:110:[kernel] warning: Neither code nor specification for [from] Done for function stop [pdg] done for function stop [pdg] computing for function tmp -[pdg] warning: unreachable entry point (sid:2, function tmp) +[pdg] warning: unreachable entry point (sid:1, function tmp) [pdg] Bottom for function tmp [pdg] computing for function two_outputs -[pdg] warning: unreachable entry point (sid:18, function two_outputs) +[pdg] warning: unreachable entry point (sid:16, function two_outputs) [pdg] Bottom for function two_outputs [sparecode] remove unused global declarations... [sparecode] result in new project 'default without sparecode'. @@ -87,10 +78,8 @@ int main2(void) int tmp_0; Y10 = 0; X10.b = 0; - { /* sequence */ - tmp_0 = f10(3); - X10.a.y += tmp_0; - } + tmp_0 = f10(3); + X10.a.y += tmp_0; __retres = X10.a.x + X10.a.y; return __retres; } diff --git a/tests/sparecode/oracle/intra.3.res.oracle b/tests/sparecode/oracle/intra.3.res.oracle index ff420eb85bf3dd52e18c34580003e98d47805eaf..66bf22dc761841938e5c55fcae4c94f25f1e04fa 100644 --- a/tests/sparecode/oracle/intra.3.res.oracle +++ b/tests/sparecode/oracle/intra.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/intra.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main2 @@ -15,7 +14,7 @@ tests/sparecode/intra.i:109:[value] assertion got status valid. [value] Done for function f10 [value] Recording results for main2 [value] done for function main2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main2 [from] Computing for function f10 @@ -52,10 +51,8 @@ int main2(void) { int __retres; int tmp_0; - { /* sequence */ - tmp_0 = f10_slice_1(3); - X10.a.y += tmp_0; - } + tmp_0 = f10_slice_1(3); + X10.a.y += tmp_0; __retres = X10.a.x + X10.a.y; return __retres; } diff --git a/tests/sparecode/oracle/intra.4.res.oracle b/tests/sparecode/oracle/intra.4.res.oracle index b4eee2e8ec2a0bfbd412b88fdddd329af281ed37..e01c6e69ad3b2fa01a5ccd97226fb553baba5ac3 100644 --- a/tests/sparecode/oracle/intra.4.res.oracle +++ b/tests/sparecode/oracle/intra.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/intra.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main2 @@ -15,7 +14,7 @@ tests/sparecode/intra.i:109:[value] assertion got status valid. [value] Done for function f10 [value] Recording results for main2 [value] done for function main2 -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function f10 [pdg] done for function f10 @@ -55,10 +54,8 @@ int main2(void) { int __retres; int tmp_0; - { /* sequence */ - tmp_0 = f10_slice_1(3); - X10.a.y += tmp_0; - } + tmp_0 = f10_slice_1(3); + X10.a.y += tmp_0; __retres = X10.a.x + X10.a.y; return __retres; } diff --git a/tests/sparecode/oracle/issue_157.res.oracle b/tests/sparecode/oracle/issue_157.res.oracle index eed83b1ec4e59435dbd1edc11488f1c8b39f89ee..18a2139a08acd46dcc140375d7e92d517f14733e 100644 --- a/tests/sparecode/oracle/issue_157.res.oracle +++ b/tests/sparecode/oracle/issue_157.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/issue_157.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -34,16 +33,6 @@ [pdg] done for function f [pdg] computing for function g [pdg] done for function g -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [sparecode] look for annotations in function g [sparecode] look for annotations in function main diff --git a/tests/sparecode/oracle/params.0.res.oracle b/tests/sparecode/oracle/params.0.res.oracle index 55f354aca69baa3be93471a2578763489714c388..3aa813bc4d34cab28e9480b7b09de60f3082a09f 100644 --- a/tests/sparecode/oracle/params.0.res.oracle +++ b/tests/sparecode/oracle/params.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/params.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main outputs and entry point @@ -22,16 +21,6 @@ [sparecode] add selection in function 'main' [pdg] computing for function main1 [pdg] done for function main1 -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function main [sparecode] look for annotations in function main1 [sparecode] finalize call input propagation @@ -47,9 +36,8 @@ int main1(int y) int main(void) { - int b; int tmp; - b = 1; + int b = 1; tmp = main1(b); return tmp; } diff --git a/tests/sparecode/oracle/params.1.res.oracle b/tests/sparecode/oracle/params.1.res.oracle index 9e5e5801ca6680938113a4f6fa2fbb8c36bd33c6..3f0b1fa8387f0d190e37bf0e2e0cae94366918a5 100644 --- a/tests/sparecode/oracle/params.1.res.oracle +++ b/tests/sparecode/oracle/params.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/params.i (no preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -12,7 +11,7 @@ [value] Done for function main1 [value] Recording results for main [value] done for function main -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function main1 @@ -39,9 +38,8 @@ int main1_slice_1(int y) int main(void) { - int b; int tmp; - b = 1; + int b = 1; tmp = main1_slice_1(b); return tmp; } diff --git a/tests/sparecode/oracle/se.res.oracle b/tests/sparecode/oracle/se.res.oracle index 7692ace47fc09b0c87df73aa023d0f8b3188e9ff..a5917a7d33f9e5e77b3f01474300dda436933571 100644 --- a/tests/sparecode/oracle/se.res.oracle +++ b/tests/sparecode/oracle/se.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/se.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function Se outputs and entry point @@ -17,16 +16,6 @@ tests/sparecode/se.i:14:[value] warning: out of bounds read. assert \valid_read( [sparecode] add selection in function 'Se' [sparecode] selecting output zones glob; S_tab[0..1]; S_s1[0]; S_es[0] [sparecode] add selection in function 'Se' -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function Se [sparecode] finalize call input propagation [sparecode] remove unused global declarations... diff --git a/tests/sparecode/oracle/top.0.res.oracle b/tests/sparecode/oracle/top.0.res.oracle index 7eb765525016416dadc9e3a4abbb813d81744ed6..6123ecda41dbe08464d22b9901d0f9daa163bed2 100644 --- a/tests/sparecode/oracle/top.0.res.oracle +++ b/tests/sparecode/oracle/top.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/top.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main_top outputs and entry point @@ -7,6 +6,8 @@ [value] Initial state computed [value:initial-state] Values of globals at initialization +[value:initial-state] creating variable S_0_S___va_params with imprecise size (type void) +[value:initial-state] creating variable S_1_S___va_params with imprecise size (type void) [value] computing for function f <- main_top. Called from tests/sparecode/top.i:21. [value] Recording results for f @@ -20,28 +21,18 @@ [sparecode] add selection in function 'main_top' [sparecode] selecting output zones \nothing [sparecode] add selection in function 'main_top' -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [pdg] computing for function f [pdg] done for function f [sparecode] look for annotations in function main_call_top [pdg] computing for function main_call_top -[pdg] warning: unreachable entry point (sid:13, function main_call_top) +[pdg] warning: unreachable entry point (sid:23, function main_call_top) [pdg] Bottom for function main_call_top [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function main_top [sparecode] look for annotations in function main_top_not_used [pdg] computing for function main_top_not_used -[pdg] warning: unreachable entry point (sid:18, function main_top_not_used) +[pdg] warning: unreachable entry point (sid:28, function main_top_not_used) [pdg] Bottom for function main_top_not_used [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function not_used_in_main_top @@ -61,8 +52,7 @@ tests/sparecode/top.i:16:[kernel] warning: Neither code nor specification for fu /* Generated by Frama-C */ int main_top(void) { - int x; - x = 3; + int x = 3; return x; } diff --git a/tests/sparecode/oracle/top.1.res.oracle b/tests/sparecode/oracle/top.1.res.oracle index b172a51cafc6bd5ebcfa648587662c51db82ba3f..a1ec21585e16ce62373573d53586829a83c4a3ac 100644 --- a/tests/sparecode/oracle/top.1.res.oracle +++ b/tests/sparecode/oracle/top.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/top.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main_call_top outputs and entry point @@ -43,16 +42,6 @@ tests/sparecode/top.i:10:[kernel] warning: Neither code nor specification for fu [pdg] done for function not_used_in_main_top [pdg] computing for function main_top [pdg] done for function main_top -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [pdg] computing for function f [pdg] done for function f @@ -60,7 +49,7 @@ tests/sparecode/top.i:10:[kernel] warning: Neither code nor specification for fu [sparecode] look for annotations in function main_top [sparecode] look for annotations in function main_top_not_used [pdg] computing for function main_top_not_used -[pdg] warning: unreachable entry point (sid:18, function main_top_not_used) +[pdg] warning: unreachable entry point (sid:28, function main_top_not_used) [pdg] Bottom for function main_top_not_used [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function not_used_in_main_top @@ -81,15 +70,13 @@ int not_used_in_main_top(int x) int main_top(void) { - int x; - x = 3; + int x = 3; return x; } int main_call_top(void) { - int x; - x = main_top(); + int x = main_top(); x = not_used_in_main_top(x); return x; } diff --git a/tests/sparecode/oracle/top.2.res.oracle b/tests/sparecode/oracle/top.2.res.oracle index fdc3ac65016ac1f646a580d43933ef59c1bf1d86..fd46cc229f1177a5f8d7f8ec94cbed9de2783ef2 100644 --- a/tests/sparecode/oracle/top.2.res.oracle +++ b/tests/sparecode/oracle/top.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/sparecode/top.i (no preprocessing) [sparecode] remove unused code... [sparecode] selecting function main_top_not_used outputs and entry point @@ -34,20 +33,10 @@ [pdg] done for function f [pdg] computing for function main_top [pdg] done for function main_top -[sparecode] look for annotations in function Frama_C_bzero -[pdg] computing for function Frama_C_bzero -[from] Computing for function Frama_C_bzero -[from] Done for function Frama_C_bzero -[pdg] done for function Frama_C_bzero -[sparecode] look for annotations in function Frama_C_copy_block -[pdg] computing for function Frama_C_copy_block -[from] Computing for function Frama_C_copy_block -[from] Done for function Frama_C_copy_block -[pdg] done for function Frama_C_copy_block [sparecode] look for annotations in function f [sparecode] look for annotations in function main_call_top [pdg] computing for function main_call_top -[pdg] warning: unreachable entry point (sid:13, function main_call_top) +[pdg] warning: unreachable entry point (sid:23, function main_call_top) [pdg] Bottom for function main_call_top [sparecode] pdg bottom: skip annotations [sparecode] look for annotations in function main_top @@ -81,8 +70,7 @@ int f(int a) int main_top_not_used(void) { - int x; - x = f(2); + int x = f(2); return x; } diff --git a/tests/sparecode/params.i b/tests/sparecode/params.i index 2a6d057674b61290df66ec83ac1a178c29402d76..a3067e8f599fcbd3d33931c6c52c951766d45d7e 100644 --- a/tests/sparecode/params.i +++ b/tests/sparecode/params.i @@ -1,6 +1,6 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable - OPT: -slicing-level 2 -slice-return main -journal-disable -then-on 'Slicing export' -print + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable + OPT: -val-show-progress -slicing-level 2 -slice-return main -journal-disable -then-last -print -val-show-progress */ /* This is an example from #529. 'y' in [main1] should be visible to get a diff --git a/tests/sparecode/se.i b/tests/sparecode/se.i index df9723d7947499dc6db1ccc563324babbb7a79ec..4fc82d3410ca3eb7f3c8196eac3400611ffc9bba 100644 --- a/tests/sparecode/se.i +++ b/tests/sparecode/se.i @@ -1,5 +1,5 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode-analysis -lib-entry -main Se -journal-disable + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -lib-entry -main Se -journal-disable */ int glob; diff --git a/tests/sparecode/top.i b/tests/sparecode/top.i index a598118d8e29312b38a8a745dba0fd605fbe1f8b..0a44c18290fe408ead45c6f5784c424d3ac76788 100644 --- a/tests/sparecode/top.i +++ b/tests/sparecode/top.i @@ -1,7 +1,7 @@ /* run.config - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable -main main_top - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable -main main_call_top - OPT: -sparecode-debug 1 -sparecode-analysis -journal-disable -main main_top_not_used + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable -main main_top + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable -main main_call_top + OPT: -sparecode-debug 1 -sparecode-analysis -val-show-progress -journal-disable -main main_top_not_used */ void print (int x); diff --git a/tests/spec/array_typedef.c b/tests/spec/array_typedef.c index 862c17896bc43f906bb4f56ef0d711692f97db8a..0d6a797fd17f4bf58c99e2a0ec0c659a51726950 100644 --- a/tests/spec/array_typedef.c +++ b/tests/spec/array_typedef.c @@ -1,5 +1,5 @@ /*run.config - OPT: -print -val -journal-disable + OPT: -print -val -val-show-progress -journal-disable */ #define IP_FIELD 4 typedef int ip_address[IP_FIELD]; diff --git a/tests/spec/assigns_result.i b/tests/spec/assigns_result.i index ab5b0b5348f7477bdcc93f0b9dded21cff353901..0d2383cab6c2fb5cbaf4c4693a0c0c3c6aea6327 100644 --- a/tests/spec/assigns_result.i +++ b/tests/spec/assigns_result.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-deps" + STDOPT: +"-deps -val-show-progress" */ int X,Y; diff --git a/tests/spec/assigns_void.c b/tests/spec/assigns_void.c index 3226f25bba34b83c889f843620ebdcdbc40d3621..f17ee9da8a40e0717a0207ddf3cd585832fe910d 100644 --- a/tests/spec/assigns_void.c +++ b/tests/spec/assigns_void.c @@ -1,6 +1,6 @@ /* run.config OPT: -print -journal-disable -continue-annot-error - OPT: -val -main g -print -no-annot -journal-disable + OPT: -val -val-show-progress -main g -print -no-annot -journal-disable */ //@ assigns *x; void f(void *x); diff --git a/tests/spec/assume.c b/tests/spec/assume.c index 650c29dcbf897a501c3e802de7a9447e9d6a5011..84e7716baa7aa48fb47e785f9f45cdedc02d4975 100644 --- a/tests/spec/assume.c +++ b/tests/spec/assume.c @@ -4,10 +4,10 @@ void f(int x); void f(int x) { int * p,*q; -//@ for b1,b2: behavior default: assumes \valid(p); // je ne veux pas vérifier cette assert +//@ for b1,b2: behavior default: assumes \valid(p); // je ne veux pas vérifier cette assert q = p ; -//@ assert \valid(q); // je veux vérifier cette assert +//@ assert \valid(q); // je veux vérifier cette assert } diff --git a/tests/spec/behavior_assert.c b/tests/spec/behavior_assert.c index 59ff32d2e616fb5abeac7a80a4fd95258c642bfd..551c74f6054051da247b91e7b25cf5bbce59c6a0 100644 --- a/tests/spec/behavior_assert.c +++ b/tests/spec/behavior_assert.c @@ -1,6 +1,6 @@ /* run.config -OPT: -val -deps -out -input -journal-disable -lib-entry -OPT: -val -deps -out -input -journal-disable +OPT: -val -val-show-progress -deps -out -input -journal-disable -lib-entry +OPT: -val -val-show-progress -deps -out -input -journal-disable */ int e; diff --git a/tests/spec/conf1.h b/tests/spec/conf1.h index 6890402fe3cf3aba619e4d42eddd18a120dcb50a..ff2f07130d12d767f0eef888e2179b9317a8a5d7 100644 --- a/tests/spec/conf1.h +++ b/tests/spec/conf1.h @@ -2,14 +2,14 @@ #define _INCLUDE_conf1 /* -spécification de l'opérateur CONF1 +spécification de l'opérateur CONF1 _E1 : BOOLEAN _S1 : BOOLEAN Calcul : -_S1 = TRUE si la durée de l'état TRUE sur _E1 est >= Time et tant que _E1 = TRUE -_S1 = FALSE si la durée de l'état TRUE sur _E1 est < Time ou si _E1 = FALSE +_S1 = TRUE si la durée de l'état TRUE sur _E1 est >= Time et tant que _E1 = TRUE +_S1 = FALSE si la durée de l'état TRUE sur _E1 est < Time ou si _E1 = FALSE Initialisation : _S1 = FALSE diff --git a/tests/spec/custom_annot_char.i b/tests/spec/custom_annot_char.i deleted file mode 100644 index 9575647c87e9c7b526ab125c29fcd3cbb3157cec..0000000000000000000000000000000000000000 --- a/tests/spec/custom_annot_char.i +++ /dev/null @@ -1,7 +0,0 @@ -/* run.config -OPT: -custom-annot-char="#" -print -*/ - -/*# requires x >= 0; - ensures \result == x; */ -int f(int x) { return x; } diff --git a/tests/spec/merge_assigns_bts1253.i b/tests/spec/merge_assigns_bts1253.i index 596f7890380b1bf608a4a1737c86efcff76daae6..8ef59170cb59a6c0d773f389ebbfbddcb102da9c 100644 --- a/tests/spec/merge_assigns_bts1253.i +++ b/tests/spec/merge_assigns_bts1253.i @@ -8,5 +8,5 @@ double atof(const char *nptr); void f(char *nptr); /*@ assigns *(nptr+(..)); */ -void f(const char *nptr); +void f(char *nptr); diff --git a/tests/spec/multi_axiomatic_1.i b/tests/spec/multi_axiomatic_1.i new file mode 100644 index 0000000000000000000000000000000000000000..cfe295495cc769ee756d766794a22dc1902790ea --- /dev/null +++ b/tests/spec/multi_axiomatic_1.i @@ -0,0 +1,10 @@ +/* run.config +OPT: @PTEST_DIR@/multi_axiomatic_2.i -print +*/ + +/*@ + axiomatic ax { logic int Acc(int m); } + predicate Bnd(integer n,int m) = Acc(m)<=9; +*/ + + diff --git a/tests/spec/multi_axiomatic_2.i b/tests/spec/multi_axiomatic_2.i new file mode 100644 index 0000000000000000000000000000000000000000..d1d8f406ec9815894239b8f8a544798b08e0b894 --- /dev/null +++ b/tests/spec/multi_axiomatic_2.i @@ -0,0 +1,15 @@ +/* run.config +DONTRUN: main configuration in @PTEST_DIR@/multi_axiomatic_1.i +*/ +/*@ + axiomatic ax { logic int Acc(int m); } + predicate Bnd(integer n,int m) = Acc(m)<=9; + predicate Bnd(integer n) = Bnd(n, (int) 0); +*/ + +/*@ + requires Bnd(1); + ensures \true; +*/ +void foo(void) {} + diff --git a/tests/spec/oracle/Extend.res.oracle b/tests/spec/oracle/Extend.res.oracle index 6709d59d122d8b653c2554a352d623bdce7ce638..7d4e6ee071fa7b91f53f290815fefdd2131028c0 100644 --- a/tests/spec/oracle/Extend.res.oracle +++ b/tests/spec/oracle/Extend.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/Extend.i (no preprocessing) tests/spec/Extend.i:30:[kernel] warning: baz is a loop extension only. Ignoring specification of function h [kernel] Reparsing file @@ -17,11 +16,9 @@ int g(int y); bla \trace(6) ∨ \trace(5); */ int f(int x) { - int s; - s = 0; + int s = 0; { - int i; - i = 0; + int i = 0; /*@ loop foo i ≤ x; loop baz \at(i,LoopEntry), 0; */ while (i < x) { diff --git a/tests/spec/oracle/_Bool.res.oracle b/tests/spec/oracle/_Bool.res.oracle index 93a3d3c75a60223f8f53ff340926cfa03ad768df..ab183bac749f09630f88be711cf4afb4ca5e9580 100644 --- a/tests/spec/oracle/_Bool.res.oracle +++ b/tests/spec/oracle/_Bool.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/_Bool.i (no preprocessing) /* Generated by Frama-C */ struct _Z6Point2 { diff --git a/tests/spec/oracle/abrupt.res.oracle b/tests/spec/oracle/abrupt.res.oracle index dc86cf8c9bb5a2f8900699a7000fecf61946da5b..502cd5a494521c75768c8bffab3b8274a9ac3082 100644 --- a/tests/spec/oracle/abrupt.res.oracle +++ b/tests/spec/oracle/abrupt.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/abrupt.i (no preprocessing) /* Generated by Frama-C */ int f(int c) { - int x; - x = 0; + int x = 0; /*@ breaks x ≡ 1; */ if (! c) goto switch_0_0; else @@ -20,21 +18,20 @@ int f(int c) goto switch_0_break; switch_0_1: x = 3; switch_0_2: x ++; - switch_0_default: ; - x ++; + switch_0_default: x ++; switch_0_break: ; while (1) { while_1_continue: ; - __sid_14_label: ; + __sid_13_label: ; /*@ breaks x ≡ \old(x); continues x ≡ \old(x) + 1; */ { if (x < c) { x ++; - /*@ assert x ≡ \at(x,__sid_14_label) + 1; */ ; + /*@ assert x ≡ \at(x,__sid_13_label) + 1; */ ; goto while_1_continue; } - /*@ assert x ≡ \at(x,__sid_14_label); */ ; + /*@ assert x ≡ \at(x,__sid_13_label); */ ; goto while_1_break; } } @@ -45,14 +42,13 @@ int f(int c) /*@ ensures \old(x) ≡ 1 ⇒ \result ≡ 1; */ int f5(int x) { - int y; - y = 0; + int y = 0; if (! (x == 1)) goto switch_0_break; switch_0_1: - while (x > 0) - /*@ breaks x > 0; */ - /*@ assert x > 0; */ - goto while_1_break; + while (x > 0) + /*@ breaks x > 0; */ + /*@ assert x > 0; */ + goto while_1_break; while_1_break: ; y = 1; switch_0_break: ; diff --git a/tests/spec/oracle/acsl_basic_allocator.res.oracle b/tests/spec/oracle/acsl_basic_allocator.res.oracle index c34df217cac689aa2cb75d6f410fd8111aa86741..4dd41ba7333dfc00ed0af8a3e90ffc75c8da8317 100644 --- a/tests/spec/oracle/acsl_basic_allocator.res.oracle +++ b/tests/spec/oracle/acsl_basic_allocator.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/acsl_basic_allocator.c (with preprocessing) /* Generated by Frama-C */ #include "stdlib.h" @@ -60,11 +59,10 @@ predicate valid_memory_pool{L}(memory_pool *mp) = memory_block *memory_alloc(memory_pool *arena, size_t s) { memory_block *__retres; - memory_block_list *mbl; memory_block *mb; size_t mb_size; char *mb_data; - mbl = *arena; + memory_block_list *mbl = *arena; while (mbl != (memory_block_list *)0) { mb = mbl->block; if (mb->free) diff --git a/tests/spec/oracle/acsl_by_example.res.oracle b/tests/spec/oracle/acsl_by_example.res.oracle index bdd982139bedda3d879bdab0c940e76f9500026c..4fd8d431a7e35548b08eb0d653105eac58f5c1fd 100644 --- a/tests/spec/oracle/acsl_by_example.res.oracle +++ b/tests/spec/oracle/acsl_by_example.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/acsl_by_example.c (with preprocessing) tests/spec/acsl_by_example.c:3:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/spec/acsl_by_example.c:5:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. @@ -30,8 +29,7 @@ int equal(int const *a, int n, int const *b) { int __retres; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≡ *(b + k); loop variant n - i; @@ -68,8 +66,7 @@ int find(int const *a, int n, int val) { int __retres; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≢ val; loop variant n - i; @@ -111,8 +108,7 @@ int find2(int const *a, int n, int val) { int __retres; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ¬found(a, i, val); loop variant n - i; @@ -155,18 +151,15 @@ int find_first_of(int const *a, int m, int const *b, int n) { int __retres; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ m; loop invariant ¬found_first_of(a, i, b, n); loop variant m - i; */ while (i < m) { int tmp; - { /* sequence */ - tmp = find(b,n,*(a + i)); - ; - } + tmp = find(b,n,*(a + i)); + ; if (tmp < n) { __retres = i; goto return_label; @@ -201,15 +194,13 @@ int find_first_of(int const *a, int m, int const *b, int n) int max_element(int const *a, int n) { int __retres; - int max; if (n == 0) { __retres = 0; goto return_label; } - max = 0; + int max = 0; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant 0 ≤ max < n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≤ *(a + max); @@ -237,10 +228,8 @@ int max_seq(int const *p, int n) { int __retres; int tmp; - { /* sequence */ - tmp = max_element(p,n); - ; - } + tmp = max_element(p,n); + ; __retres = *(p + tmp); return __retres; } @@ -272,11 +261,9 @@ axiomatic counting_axioms { */ int count(int const *a, int n, int val) { - int cnt; - cnt = 0; + int cnt = 0; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant 0 ≤ cnt ≤ i; loop invariant cnt ≡ counting(a, i, val); @@ -298,8 +285,7 @@ int count(int const *a, int n, int val) */ void swap(int *p, int *q) { - int save; - save = *p; + int const save = *p; *p = *q; *q = save; return; @@ -315,8 +301,7 @@ void swap(int *p, int *q) */ void swap_ranges(int *a, int n, int *b) { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≡ \at(*(b + k),Pre); @@ -338,8 +323,7 @@ void swap_ranges(int *a, int n, int *b) */ void fill(int *a, int n, int val) { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≡ val; loop variant n - i; @@ -359,8 +343,7 @@ void fill(int *a, int n, int val) */ void copy(int const *a, int n, int *b) { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≡ *(b + k); loop assigns *(b + (0 .. i - 1)); @@ -388,8 +371,7 @@ void copy(int const *a, int n, int *b) int replace_copy(int const *a, int n, int *b, int old_val, int new_val) { { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int j; @@ -423,11 +405,9 @@ int replace_copy(int const *a, int n, int *b, int old_val, int new_val) */ int remove_copy(int const *a, int n, int *b, int val) { - int j; - j = 0; + int j = 0; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ j ≤ i ≤ n; loop invariant ∀ int k; j ≤ k < n ⇒ *(b + k) ≡ \at(*(b + k),Pre); @@ -441,11 +421,9 @@ int remove_copy(int const *a, int n, int *b, int val) while (i < n) { if (*(a + i) != val) { int tmp; - { /* sequence */ - tmp = j; - j ++; - *(b + tmp) = *(a + i); - } + tmp = j; + j ++; + *(b + tmp) = *(a + i); } i ++; } @@ -461,8 +439,7 @@ int remove_copy(int const *a, int n, int *b, int val) */ void iota(int *a, int n, int val) { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + k) ≡ val + k; loop assigns *(a + (0 .. i - 1)); @@ -504,8 +481,7 @@ int adjacent_find(int *a, int n) goto return_label; } { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i < n; loop invariant ¬adjacent_found(a, i); loop invariant 0 < i ⇒ *(a + (i - 1)) ≢ *(a + i); @@ -543,15 +519,13 @@ int adjacent_find(int *a, int n) int min_element(int *a, int n) { int __retres; - int min; if (0 == n) { __retres = n; goto return_label; } - min = 0; + int min = 0; { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ n; loop invariant 0 ≤ min < n; loop invariant ∀ int k; 0 ≤ k < i ⇒ *(a + min) ≤ *(a + k); diff --git a/tests/spec/oracle/add_global.res.oracle b/tests/spec/oracle/add_global.res.oracle index 797d14b6d735a8e52db4cce216398a4e4edcb6ee..22f4c88d708bcf48aa99c98f79594fff6ce757e6 100644 --- a/tests/spec/oracle/add_global.res.oracle +++ b/tests/spec/oracle/add_global.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/add_global.i (no preprocessing) /* Generated by Frama-C */ /*@ axiomatic MyAxiomatic { diff --git a/tests/spec/oracle/all.res.oracle b/tests/spec/oracle/all.res.oracle index 13bfc9ffda56cf7f7b1af29352acca5aa091218a..93e72382de12106532e58c72e85b21cf8091ab11 100644 --- a/tests/spec/oracle/all.res.oracle +++ b/tests/spec/oracle/all.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/all.c (with preprocessing) tests/spec/all.c:32:[kernel] warning: Inconsistent relation chain. tests/spec/all.c:50:[kernel] warning: Assignment operators not allowed in annotations. diff --git a/tests/spec/oracle/allocates.res.oracle b/tests/spec/oracle/allocates.res.oracle index bcbf8ea2403361ee637a7dc0af744b79c6c79df8..d2aad6c76411614ae122b640b08e84f67b201c9d 100644 --- a/tests/spec/oracle/allocates.res.oracle +++ b/tests/spec/oracle/allocates.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/allocates.i (no preprocessing) /* Generated by Frama-C */ int *p; diff --git a/tests/spec/oracle/annot_decl_bts1009.res.oracle b/tests/spec/oracle/annot_decl_bts1009.res.oracle index 0235a8457092b0daeeb02a0feb082e74c051768f..1f22bd0edad1a161f64da28e267306efdf39a533 100644 --- a/tests/spec/oracle/annot_decl_bts1009.res.oracle +++ b/tests/spec/oracle/annot_decl_bts1009.res.oracle @@ -1,16 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/annot_decl_bts1009.i (no preprocessing) +[kernel] warning: Statement contract and ACSL pragmas over a local definition are not implemented. Ignoring annotation /* Generated by Frama-C */ void f(void) { int x; - int y; /*@ assert 0 ≡ 0; */ ; - /*@ ensures x ≡ 3; */ - { - x = 3; - y = x; - } + x = 3; + int y = x; x = 0; y = 1; return; diff --git a/tests/spec/oracle/annot_main.res.oracle b/tests/spec/oracle/annot_main.res.oracle index 73be52ccc14550fdc6838547fa7e36b600b064d8..efef97be1fafefce6f5d846118cacb739672a2ce 100644 --- a/tests/spec/oracle/annot_main.res.oracle +++ b/tests/spec/oracle/annot_main.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/annot_main.c (with preprocessing) /* Generated by Frama-C */ extern int ( /* missing proto */ Frama_C_dump_each)(); diff --git a/tests/spec/oracle/array_conversion.res.oracle b/tests/spec/oracle/array_conversion.res.oracle index 23b295e45d3e0c5fb844862f682edb547b0a8f8b..1d331a3a4ddcfd92c780e7a95fbdc324a3f0a0a0 100644 --- a/tests/spec/oracle/array_conversion.res.oracle +++ b/tests/spec/oracle/array_conversion.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/array_conversion.c (with preprocessing) tests/spec/array_conversion.c:5:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/spec/array_conversion.c:21:[kernel] warning: In ACSL, there is no implicit conversion between a C array and a pointer. Either introduce an explicit cast or take the address of the first element of X. Ignoring global annotation diff --git a/tests/spec/oracle/array_prm.res.oracle b/tests/spec/oracle/array_prm.res.oracle index dc70d82faedef5d0c0956e37497baecb835d8d28..1463ce4318af95342e5d2cde3dd917066e939cf7 100644 --- a/tests/spec/oracle/array_prm.res.oracle +++ b/tests/spec/oracle/array_prm.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/array_prm.c (with preprocessing) tests/spec/array_prm.c:5:[kernel] warning: parsing obsolete ACSL construct '\valid_index(addr,idx)'. '\valid(addr+idx)' should be used instead. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/array_typedef.res.oracle b/tests/spec/oracle/array_typedef.res.oracle index 4081c1b256588d3a7b03dd638dade3fc10d35a26..ba6354a9fa6a48a064846b718a1deafc2d42e987 100644 --- a/tests/spec/oracle/array_typedef.res.oracle +++ b/tests/spec/oracle/array_typedef.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/array_typedef.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -25,7 +24,7 @@ tests/spec/array_typedef.c:29:[value] assertion got status valid. [value] computing for function send_addr <- send_msg <- main. Called from tests/spec/array_typedef.c:15. [value] using specification for function send_addr -tests/spec/array_typedef.c:12:[value] warning: no \from part for clause 'assigns \empty;' of function send_addr +tests/spec/array_typedef.c:12:[value] warning: no \from part for clause 'assigns \empty;' [value] Done for function send_addr [value] Recording results for send_msg [value] Done for function send_msg @@ -81,8 +80,7 @@ void send_msg(msg const *msg_0) void host_address(int * /*[4]*/ ip) { - unsigned int i; - i = sizeof(int [4]) / sizeof(int); + unsigned int i = sizeof(int [4]) / sizeof(int); *(ip + 0) = 192; *(ip + 1) = 100; *(ip + 2) = 200; diff --git a/tests/spec/oracle/assert_label.res.oracle b/tests/spec/oracle/assert_label.res.oracle index 9dbb890e8220641731c4892102e14f1696ac750a..cab807c40269df47334618389caa6326922a60fe 100644 --- a/tests/spec/oracle/assert_label.res.oracle +++ b/tests/spec/oracle/assert_label.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assert_label.i (no preprocessing) /* Generated by Frama-C */ void bar(void) diff --git a/tests/spec/oracle/assign_in_spec.res.oracle b/tests/spec/oracle/assign_in_spec.res.oracle index 2b4b99fdc12cd5fe3581184891e4193c0e5eb1be..1a53d562c4de7be3ec86713ec105af94690e05e0 100644 --- a/tests/spec/oracle/assign_in_spec.res.oracle +++ b/tests/spec/oracle/assign_in_spec.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assign_in_spec.c (with preprocessing) tests/spec/assign_in_spec.c:3:[kernel] warning: Assignment operators not allowed in annotations. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/assignable_location.res.oracle b/tests/spec/oracle/assignable_location.res.oracle index 24cbeb47511d059e05df3bdc4e214a2ca8810b88..eb85be111ccc16a4daff00193c2735ba7cbd3932 100644 --- a/tests/spec/oracle/assignable_location.res.oracle +++ b/tests/spec/oracle/assignable_location.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assignable_location.i (no preprocessing) tests/spec/assignable_location.i:36:[kernel] warning: unexpected token ';' tests/spec/assignable_location.i:28:[kernel] warning: not an addressable left value: \result. Ignoring logic specification of function annotations_to_reject diff --git a/tests/spec/oracle/assigns.res.oracle b/tests/spec/oracle/assigns.res.oracle index eec3f84b4160324c7c682ba3a5fc2244f172bd88..85b097876f1cd0cac5b11a9f3caf306bfd30abc5 100644 --- a/tests/spec/oracle/assigns.res.oracle +++ b/tests/spec/oracle/assigns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assigns.c (with preprocessing) /* Generated by Frama-C */ struct list { diff --git a/tests/spec/oracle/assigns_array.res.oracle b/tests/spec/oracle/assigns_array.res.oracle index 975c68cb1236ec7a901c2f62488b2297eeeec833..923a607db05c860fe731c2476345688dc48c203a 100644 --- a/tests/spec/oracle/assigns_array.res.oracle +++ b/tests/spec/oracle/assigns_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assigns_array.c (with preprocessing) tests/spec/assigns_array.c:9:[kernel] warning: not an assignable left value: ghost_loctable. Ignoring logic specification of function acquire_lock /* Generated by Frama-C */ @@ -34,8 +33,7 @@ int Tab[10]; int h(int reset, int n) { int i; - int r; - r = 0; + int r = 0; i = 0; /*@ for foo: loop assigns Tab[0 .. i]; for bar: loop assigns \nothing; */ diff --git a/tests/spec/oracle/assigns_result.res.oracle b/tests/spec/oracle/assigns_result.res.oracle index f67fe83d6026dac2a06688715890a90803c6c24d..771cf3aa4f8be264d30a8892d9554cc420300c17 100644 --- a/tests/spec/oracle/assigns_result.res.oracle +++ b/tests/spec/oracle/assigns_result.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assigns_result.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -12,8 +11,9 @@ [value] Done for function f [value] computing for function g <- main. Called from tests/spec/assigns_result.i:16. +tests/spec/assigns_result.i:16:[inout] warning: failed to interpret assigns clause '\exit_status' [value] using specification for function g -tests/spec/assigns_result.i:16:[value] warning: cannot interpret assigns \exit_status in function g +tests/spec/assigns_result.i:16:[value] warning: cannot interpret assigns \exit_status (unsupported logic var \exit_status); effects will be ignored [value] Done for function g [value] Recording results for main diff --git a/tests/spec/oracle/assigns_void.0.res.oracle b/tests/spec/oracle/assigns_void.0.res.oracle index 6481837ee79af54d63984c9b48bf2eb555f9e7de..4f3702c0330cfc947eda3774fec981f3b0e8c1a6 100644 --- a/tests/spec/oracle/assigns_void.0.res.oracle +++ b/tests/spec/oracle/assigns_void.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assigns_void.c (with preprocessing) tests/spec/assigns_void.c:5:[kernel] warning: Cannot use a pointer to void here. Ignoring specification of function f /* Generated by Frama-C */ @@ -7,8 +6,7 @@ void f(void *x); void g(void) { int y; - int *x; - x = & y; + int *x = & y; f((void *)x); return; } diff --git a/tests/spec/oracle/assigns_void.1.res.oracle b/tests/spec/oracle/assigns_void.1.res.oracle index 5930f5b4780afc74211a0f7335e08d93eeddfc3c..0779cd2f709cce1ddfd91afefa35dc7a24056451 100644 --- a/tests/spec/oracle/assigns_void.1.res.oracle +++ b/tests/spec/oracle/assigns_void.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assigns_void.c (with preprocessing) [value] Analyzing a complete application starting at g [value] Computing initial state @@ -25,8 +24,7 @@ void f(void *x); void g(void) { int y; - int *x; - x = & y; + int *x = & y; f((void *)x); return; } diff --git a/tests/spec/oracle/assume.res.oracle b/tests/spec/oracle/assume.res.oracle index cbbc753c0f9465bbaa12fc91f706c95121c18751..921fcd272deb7c843ab35f288de45d736ec6174c 100644 --- a/tests/spec/oracle/assume.res.oracle +++ b/tests/spec/oracle/assume.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/assume.c (with preprocessing) /* Generated by Frama-C */ void f(int x); diff --git a/tests/spec/oracle/at.res.oracle b/tests/spec/oracle/at.res.oracle index 8473da525d00188534fc8e133dd6efdb98b2ea21..31284982e1e899a3ff33e9be9367f392707e2676 100644 --- a/tests/spec/oracle/at.res.oracle +++ b/tests/spec/oracle/at.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/at.c (with preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/spec/oracle/axiom_ignored_bts1116.res.oracle b/tests/spec/oracle/axiom_ignored_bts1116.res.oracle index 4e5792244020f424c326911c9dfa6908402f7f0b..d4c69d6aaeee5f85a28845dedd956d79eb06318b 100644 --- a/tests/spec/oracle/axiom_ignored_bts1116.res.oracle +++ b/tests/spec/oracle/axiom_ignored_bts1116.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/axiom_ignored_bts1116.i (no preprocessing) tests/spec/axiom_ignored_bts1116.i:2:[kernel] warning: Axiom l is declared outside of an axiomatic. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/axiom_included.res.oracle b/tests/spec/oracle/axiom_included.res.oracle index 47cec8dab560f7e374037c9028046864c43a2f39..276efbedb94e224f92722dfbc93ac847f51e7d07 100644 --- a/tests/spec/oracle/axiom_included.res.oracle +++ b/tests/spec/oracle/axiom_included.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/axiom_included.c (with preprocessing) [kernel] Parsing tests/spec/axiom_included_1.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/spec/oracle/axiom_redef_bts1005.res.oracle b/tests/spec/oracle/axiom_redef_bts1005.res.oracle index cef4f38aeedc6c3a48166942c1f8b6103025baab..94dd77a7d99c1dd47b8d2509dd8ec848c0dc5033 100644 --- a/tests/spec/oracle/axiom_redef_bts1005.res.oracle +++ b/tests/spec/oracle/axiom_redef_bts1005.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/axiom_redef_bts1005.i (no preprocessing) tests/spec/axiom_redef_bts1005.i:5:[kernel] warning: inj1 is already registered as axiom (tests/spec/axiom_redef_bts1005.i:4). Ignoring global annotation /* Generated by Frama-C */ diff --git a/tests/spec/oracle/behavior_assert.0.res.oracle b/tests/spec/oracle/behavior_assert.0.res.oracle index 0a64b7d869965c859e3d1265a2667c91c3e9ddce..320139b681dedfa61589380d7ccebc37b8d05910 100644 --- a/tests/spec/oracle/behavior_assert.0.res.oracle +++ b/tests/spec/oracle/behavior_assert.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/behavior_assert.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/spec/oracle/behavior_assert.1.res.oracle b/tests/spec/oracle/behavior_assert.1.res.oracle index 6371cec3fa4af016d79fd43ae0374548ad3c7971..09578c484b21107db493154485e30b7176e5984d 100644 --- a/tests/spec/oracle/behavior_assert.1.res.oracle +++ b/tests/spec/oracle/behavior_assert.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/behavior_assert.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/spec/oracle/behavior_names.res.oracle b/tests/spec/oracle/behavior_names.res.oracle index 17ccd1b8dafda568073f22347ca10574b7f46833..282ad80ad0a96402a7ca824e00d599506d531c56 100644 --- a/tests/spec/oracle/behavior_names.res.oracle +++ b/tests/spec/oracle/behavior_names.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/behavior_names.c (with preprocessing) tests/spec/behavior_names.c:7:[kernel] warning: reference to unknown behavior UNEXISTENT_BEHAVIOR. Ignoring logic specification of function f tests/spec/behavior_names.c:19:[kernel] warning: reference to unknown behavior UNEXISTENT_BEHAVIOR. Ignoring logic specification of function g @@ -44,8 +43,7 @@ void i(void) void j(void) { - int x; - x = 0; + int x = 0; /*@ behavior foo: ensures \true; */ { diff --git a/tests/spec/oracle/behaviors_decl_def.res.oracle b/tests/spec/oracle/behaviors_decl_def.res.oracle index df0a7abcc2dcf6e4f53bee1130a6dec02f6beba0..271e91145e75b5a043c0888ed1a58b60bf739794 100644 --- a/tests/spec/oracle/behaviors_decl_def.res.oracle +++ b/tests/spec/oracle/behaviors_decl_def.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/behaviors_decl_def.c (with preprocessing) /* Generated by Frama-C */ int G; diff --git a/tests/spec/oracle/bool.res.oracle b/tests/spec/oracle/bool.res.oracle index c5b8b6f19a5831b912503c306cfef9824523d8e7..64d9120c9deb80891a996a4b21cd2bcc50c8f0a7 100644 --- a/tests/spec/oracle/bool.res.oracle +++ b/tests/spec/oracle/bool.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bool.c (with preprocessing) /* Generated by Frama-C */ /*@ logic 𔹠f(int x) = x ≡ 0; diff --git a/tests/spec/oracle/boolean_ops.res.oracle b/tests/spec/oracle/boolean_ops.res.oracle index bae3767bbec4897545efa849cc440082e25c5888..90dfd0c90af48c3014eae48a3c92424033f12aef 100644 --- a/tests/spec/oracle/boolean_ops.res.oracle +++ b/tests/spec/oracle/boolean_ops.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/boolean_ops.c (with preprocessing) /* Generated by Frama-C */ /*@ ensures \old(x) ≡ 0 ∨ \old(y) ≡ 1? \result ≡ 0: \result ≡ 1; */ @@ -14,10 +13,8 @@ int f(int x, int y) int main(void) { int __retres; - int x; - int y; - x = f(42,1); - y = f(0,36); + int x = f(42,1); + int y = f(0,36); __retres = 0; return __retres; } diff --git a/tests/spec/oracle/breaks_continues_unroll.res.oracle b/tests/spec/oracle/breaks_continues_unroll.res.oracle index d7d66d038a7488b3d0c984379d666def498e60b3..09fc878c21ef81be3bc3c48cc87539682631815d 100644 --- a/tests/spec/oracle/breaks_continues_unroll.res.oracle +++ b/tests/spec/oracle/breaks_continues_unroll.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/breaks_continues_unroll.i (no preprocessing) /* Generated by Frama-C */ int unroll(int c) { - int x; - x = 0; + int x = 0; switch (x) { /*@ breaks x ≡ 13; */ { diff --git a/tests/spec/oracle/bsearch.res.oracle b/tests/spec/oracle/bsearch.res.oracle index 1335de09cf4a8ad0ad770401711ad5e04ae9b9da..6c26a4007c420df420cb49425357edabf0af6bca 100644 --- a/tests/spec/oracle/bsearch.res.oracle +++ b/tests/spec/oracle/bsearch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bsearch.c (with preprocessing) tests/spec/bsearch.c:17:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. /* Generated by Frama-C */ @@ -22,18 +21,15 @@ predicate sorted{L}(int t[], ℤ n) = int bsearch(int *t, int n, int v) { int __retres; - int l; - int u; - l = 0; - u = n - 1; + int l = 0; + int u = n - 1; /*@ loop invariant 0 ≤ l ∧ u ≤ n - 1 ∧ (∀ int k; 0 ≤ k < n ⇒ *(t + k) ≡ v ⇒ l ≤ k ≤ u); loop variant u - l; */ while (l <= u) { - int m; - m = (l + u) / 2; + int m = (l + u) / 2; if (*(t + m) < v) l = m + 1; else if (*(t + m) > v) u = m - 1; diff --git a/tests/spec/oracle/bts0254.res.oracle b/tests/spec/oracle/bts0254.res.oracle index 521b9874beacfadad53e776325826b713c8625b4..42a33dd67f61492d9f6237eaf2cd7c450c87625e 100644 --- a/tests/spec/oracle/bts0254.res.oracle +++ b/tests/spec/oracle/bts0254.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0254.i (no preprocessing) /* Generated by Frama-C */ /*@ behavior d: diff --git a/tests/spec/oracle/bts0283.res.oracle b/tests/spec/oracle/bts0283.res.oracle index 706486b074c05e50c9054544a26f96485e819ec0..da6771c805003b666863bc93a3680ccfb1e5eef7 100644 --- a/tests/spec/oracle/bts0283.res.oracle +++ b/tests/spec/oracle/bts0283.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0283.c (with preprocessing) tests/spec/bts0283.c:5:[kernel] warning: incompatible types ℤ and int *. Ignoring code annotation tests/spec/bts0283.c:7:[kernel] warning: incompatible types int and int * diff --git a/tests/spec/oracle/bts0440.res.oracle b/tests/spec/oracle/bts0440.res.oracle index d5cff4378b034bfc97513883faeb6d2ec44936b2..8f6b2fa798589ac292f9365bf0a4c316e6633595 100644 --- a/tests/spec/oracle/bts0440.res.oracle +++ b/tests/spec/oracle/bts0440.res.oracle @@ -1,19 +1,17 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0440.i (no preprocessing) /* Generated by Frama-C */ int fact(int n) { - int r; - r = 1; + int r = 1; while (n > 0) { int tmp; before: - /*@ ensures n ≥ 0; */ - { /* sequence */ - tmp = n; - n --; - r *= tmp; - } + /*@ ensures n ≥ 0; */ + { /* sequence */ + tmp = n; + n --; + r *= tmp; + } /*@ assert r ≡ \at(r * n,before); */ ; } return r; diff --git a/tests/spec/oracle/bts0549.res.oracle b/tests/spec/oracle/bts0549.res.oracle index 6e1d9906b3666bac097098126b63f46dd61e0968..4967eb1f84974796a7b4da375c01237b9ed6bcd0 100644 --- a/tests/spec/oracle/bts0549.res.oracle +++ b/tests/spec/oracle/bts0549.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0549.i (no preprocessing) tests/spec/bts0549.i:6:[kernel] warning: In ACSL, there is no implicit conversion between a C array and a pointer. Either introduce an explicit cast or take the address of the first element of t1. Ignoring global annotation tests/spec/bts0549.i:11:[kernel] warning: \let x = t1; x is a logic array. Only C arrays can be converted to pointers, and this conversion must be explicit (cast or take the address of the first element). Ignoring global annotation diff --git a/tests/spec/oracle/bts0570.res.oracle b/tests/spec/oracle/bts0570.res.oracle index 9df66c8a89df599d80bbd4abe7e11940e5ef6507..04ca8c0ff81dcda1e75c19128a3175abbd8543d9 100644 --- a/tests/spec/oracle/bts0570.res.oracle +++ b/tests/spec/oracle/bts0570.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0570.i (no preprocessing) /* Generated by Frama-C */ int main(char *data) diff --git a/tests/spec/oracle/bts0578.res.oracle b/tests/spec/oracle/bts0578.res.oracle index 4272dcabdb7c86e3fecae98a445d7396f4c89a5b..7c6d8517d86a1a289b4f02db5da2cf00e985955e 100644 --- a/tests/spec/oracle/bts0578.res.oracle +++ b/tests/spec/oracle/bts0578.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0578.i (no preprocessing) /* Generated by Frama-C */ /*@ behavior foo: @@ -21,13 +20,13 @@ void main(void) } L1: /*@ requires \true; ensures \true; */ - t[4] = 42; + t[4] = 42; L2: /*@ requires \true; ensures \true; */ - t[3] = 36; + t[3] = 36; L3: /*@ requires \true; ensures \true; */ - t[2] = 12; + t[2] = 12; return; } diff --git a/tests/spec/oracle/bts0589.res.oracle b/tests/spec/oracle/bts0589.res.oracle index 4e542dcf12ca54cf622f3517218b24d4c783bb91..b4e679db381205226e4850ce901bc9db662b0b0e 100644 --- a/tests/spec/oracle/bts0589.res.oracle +++ b/tests/spec/oracle/bts0589.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0589.i (no preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/spec/oracle/bts0655.res.oracle b/tests/spec/oracle/bts0655.res.oracle index 0daee26cd69ca2bf21f473d5a13a886a0f43a99b..92d1223276d184169ad4fd44424a66b26ba31beb 100644 --- a/tests/spec/oracle/bts0655.res.oracle +++ b/tests/spec/oracle/bts0655.res.oracle @@ -1,98 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0655.i (no preprocessing) -[bts0655] term dest + (0 .. n - 1) has type set<unsigned char *> -[bts0655] term dest has type unsigned char * -[bts0655] term 0 .. n - 1 has type set<ℤ> -[bts0655] term 0 has type ℤ -[bts0655] term n - 1 has type ℤ -[bts0655] term n has type ℤ -[bts0655] term n has type unsigned long -[bts0655] term 1 has type ℤ -[bts0655] term 0 has type ℤ -[bts0655] term i has type ℤ -[bts0655] term i has type ℤ -[bts0655] term \old(n) has type ℤ -[bts0655] term \old(n) has type unsigned long -[bts0655] term n has type unsigned long -[bts0655] term *(\old(dest) + i) has type ℤ -[bts0655] term *(\old(dest) + i) has type unsigned char -[bts0655] term \old(dest) + i has type unsigned char * -[bts0655] term \old(dest) has type unsigned char * -[bts0655] term dest has type unsigned char * -[bts0655] term i has type ℤ -[bts0655] term 0 has type ℤ -[bts0655] term *(dest + (0 .. n - 1)) has type set<unsigned char> -[bts0655] term dest + (0 .. n - 1) has type set<unsigned char *> -[bts0655] term dest has type unsigned char * -[bts0655] term 0 .. n - 1 has type set<ℤ> -[bts0655] term 0 has type ℤ -[bts0655] term n - 1 has type ℤ -[bts0655] term n has type ℤ -[bts0655] term n has type unsigned long -[bts0655] term 1 has type ℤ -[bts0655] term dest + (0 .. size * n - 1) has type set<unsigned char *> -[bts0655] term dest has type unsigned char * -[bts0655] term 0 .. size * n - 1 has type set<ℤ> -[bts0655] term 0 has type ℤ -[bts0655] term size * n - 1 has type ℤ -[bts0655] term size * n has type ℤ -[bts0655] term size has type ℤ -[bts0655] term size has type unsigned long -[bts0655] term n has type ℤ -[bts0655] term n has type unsigned long -[bts0655] term 1 has type ℤ -[bts0655] term n has type ℤ -[bts0655] term n has type unsigned long -[bts0655] term 1 has type ℤ -[bts0655] term 0 has type ℤ -[bts0655] term i has type ℤ -[bts0655] term i has type ℤ -[bts0655] term \old(size) has type ℤ -[bts0655] term \old(size) has type unsigned long -[bts0655] term size has type unsigned long -[bts0655] term 1 has type ℤ -[bts0655] term j has type ℤ -[bts0655] term j has type ℤ -[bts0655] term \old(n) has type ℤ -[bts0655] term \old(n) has type unsigned long -[bts0655] term n has type unsigned long -[bts0655] term *(\old(dest) + (i + j * \old(size))) has type unsigned char -[bts0655] term \old(dest) + (i + j * \old(size)) has type unsigned char * -[bts0655] term \old(dest) has type unsigned char * -[bts0655] term dest has type unsigned char * -[bts0655] term i + j * \old(size) has type ℤ -[bts0655] term i has type ℤ -[bts0655] term j * \old(size) has type ℤ -[bts0655] term j has type ℤ -[bts0655] term \old(size) has type ℤ -[bts0655] term \old(size) has type unsigned long -[bts0655] term size has type unsigned long -[bts0655] term *(\old(dest) + i) has type unsigned char -[bts0655] term \old(dest) + i has type unsigned char * -[bts0655] term \old(dest) has type unsigned char * -[bts0655] term dest has type unsigned char * -[bts0655] term i has type ℤ -[bts0655] term *(dest + (size .. size * n - 1)) has type set<unsigned char> -[bts0655] term dest + (size .. size * n - 1) has type set<unsigned char *> -[bts0655] term dest has type unsigned char * -[bts0655] term size .. size * n - 1 has type set<ℤ> -[bts0655] term size has type unsigned long -[bts0655] term size * n - 1 has type ℤ -[bts0655] term size * n has type ℤ -[bts0655] term size has type ℤ -[bts0655] term size has type unsigned long -[bts0655] term n has type ℤ -[bts0655] term n has type unsigned long -[bts0655] term 1 has type ℤ -[bts0655] term *(dest + (0 .. size - 1)) has type set<unsigned char> -[bts0655] term dest + (0 .. size - 1) has type set<unsigned char *> -[bts0655] term dest has type unsigned char * -[bts0655] term 0 .. size - 1 has type set<ℤ> -[bts0655] term 0 has type ℤ -[bts0655] term size - 1 has type ℤ -[bts0655] term size has type ℤ -[bts0655] term size has type unsigned long -[bts0655] term 1 has type ℤ [bts0655] term i has type ℤ [bts0655] term i has type int [bts0655] term \max(\at(a,Pre), \at(b,Pre)) has type ℤ diff --git a/tests/spec/oracle/bts0698.res.oracle b/tests/spec/oracle/bts0698.res.oracle index 8e13128725ed80a8e018808afe807f54c251682f..b0b945a8a3dc65cd9e8c72ca9fe12f2b76917cc3 100644 --- a/tests/spec/oracle/bts0698.res.oracle +++ b/tests/spec/oracle/bts0698.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0698.i (no preprocessing) tests/spec/bts0698.i:11:[kernel] warning: cannot cast logic array to pointer type. Ignoring global annotation /* Generated by Frama-C */ diff --git a/tests/spec/oracle/bts0812.res.oracle b/tests/spec/oracle/bts0812.res.oracle index 1a5e6ff4138c28f853978f38b9e31ffb39d6d066..7b0563c034bf2fb0f4ed85e7cc7c160b01165c37 100644 --- a/tests/spec/oracle/bts0812.res.oracle +++ b/tests/spec/oracle/bts0812.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts0812.c (with preprocessing) /* Generated by Frama-C */ /*@ lemma fib_3: \true; diff --git a/tests/spec/oracle/bts1068.res.oracle b/tests/spec/oracle/bts1068.res.oracle index 6c16feca76e33bcbd015e7c66fd5eb8ab0b10fd0..d26d6a1c6ebd5d2200b4ba48e71f197c7961c7e2 100644 --- a/tests/spec/oracle/bts1068.res.oracle +++ b/tests/spec/oracle/bts1068.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts1068.i (no preprocessing) tests/spec/bts1068.i:53:[kernel] warning: parsing obsolete ACSL construct '\valid_index(addr,idx)'. '\valid(addr+idx)' should be used instead. tests/spec/bts1068.i:54:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. diff --git a/tests/spec/oracle/bts1262.res.oracle b/tests/spec/oracle/bts1262.res.oracle index ac88c50e9b2096c6251231c956206aab4b1194ae..b645c5a1cee29cc8d40c5d5d7482837becf4e863 100644 --- a/tests/spec/oracle/bts1262.res.oracle +++ b/tests/spec/oracle/bts1262.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts1262.c (with preprocessing) /* Generated by Frama-C */ int main(void) { int __retres; - char *s; - s = (char *)"\\\\.\\"; + char *s = (char *)"\\\\.\\"; /*@ assert *(s + 0) ≡ '\\'; */ ; *(s + 2) = (char)'\\'; __retres = 0; diff --git a/tests/spec/oracle/bts2187-no-empty-contract.res.oracle b/tests/spec/oracle/bts2187-no-empty-contract.res.oracle index b6e6ad504546293fec1cb765e4c1c50215a626a0..4b508785460f81ceeb449068f8c1c6849a3c1cc0 100644 --- a/tests/spec/oracle/bts2187-no-empty-contract.res.oracle +++ b/tests/spec/oracle/bts2187-no-empty-contract.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts2187-no-empty-contract.i (no preprocessing) tests/spec/bts2187-no-empty-contract.i:3:[kernel] warning: Empty annotation is not allowed /* Generated by Frama-C */ diff --git a/tests/spec/oracle/bts_1789.res.oracle b/tests/spec/oracle/bts_1789.res.oracle index 2dbfcd3bd71659968494907a593f38dfa1112c3e..5774df3dce61b6999acbaddf0feeb73b1ec3e300 100644 --- a/tests/spec/oracle/bts_1789.res.oracle +++ b/tests/spec/oracle/bts_1789.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bts_1789.i (no preprocessing) tests/spec/bts_1789.i:8:[kernel] warning: not an assignable left value: the_var{Old}. Ignoring logic specification of function function /* Generated by Frama-C */ diff --git a/tests/spec/oracle/bug96.res.oracle b/tests/spec/oracle/bug96.res.oracle index b3561fad9a7968be330de953af3fb3d74af1ecd5..5f1911bad73ca45588b11fe872f2fa34dcd65611 100644 --- a/tests/spec/oracle/bug96.res.oracle +++ b/tests/spec/oracle/bug96.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/bug96.c (with preprocessing) /* Generated by Frama-C */ struct list; diff --git a/tests/spec/oracle/builtins.res.oracle b/tests/spec/oracle/builtins.res.oracle index f6953379583d68f5d40370b0f33dcb8ad541e667..4fe6a82449a50eb667e768620b7fec79bf9bf8ba 100644 --- a/tests/spec/oracle/builtins.res.oracle +++ b/tests/spec/oracle/builtins.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/builtins.c (with preprocessing) /* Generated by Frama-C */ /*@ lemma cos_pi: \cos(\pi) ≡ -1.0; diff --git a/tests/spec/oracle/cast_enum_bts1546.0.res.oracle b/tests/spec/oracle/cast_enum_bts1546.0.res.oracle index b1c72a306281a9663cb7af8c02b2b191bcd4d838..859426aa635fc488beca0b51816d51a6201d5d15 100644 --- a/tests/spec/oracle/cast_enum_bts1546.0.res.oracle +++ b/tests/spec/oracle/cast_enum_bts1546.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/cast_enum_bts1546.i (no preprocessing) /* Generated by Frama-C */ enum e { diff --git a/tests/spec/oracle/cast_enum_bts1546.1.res.oracle b/tests/spec/oracle/cast_enum_bts1546.1.res.oracle index a1ec557752c5ae8f426914fa530508b4c28f8e24..d17c5bb19cfd512422ec2124b383ce335a6315e3 100644 --- a/tests/spec/oracle/cast_enum_bts1546.1.res.oracle +++ b/tests/spec/oracle/cast_enum_bts1546.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/cast_enum_bts1546.i (no preprocessing) /* Generated by Frama-C */ enum e { diff --git a/tests/spec/oracle/char_cst.res.oracle b/tests/spec/oracle/char_cst.res.oracle index d692d31d94bbbfc8c6129f92481a2216dc7c4054..d117822e70949bacaf9c0f8acf0495962f23a2c7 100644 --- a/tests/spec/oracle/char_cst.res.oracle +++ b/tests/spec/oracle/char_cst.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/char_cst.c (with preprocessing) /* Generated by Frama-C */ /*@ requires c ≢ '0'; diff --git a/tests/spec/oracle/clash_double_file_bts1598.res.oracle b/tests/spec/oracle/clash_double_file_bts1598.res.oracle index ed79482375521981cdd2098323df54f8092d6bbe..0d80a00c1cdb044b88426c7bb655da8ae430b220 100644 --- a/tests/spec/oracle/clash_double_file_bts1598.res.oracle +++ b/tests/spec/oracle/clash_double_file_bts1598.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/clash_double_file_bts1598.c (with preprocessing) /* Generated by Frama-C */ #include "__fc_builtin.h" @@ -20,7 +19,6 @@ #include "time.h" #include "wchar.h" -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/clash_double_file_bts1598.c (with preprocessing) [kernel] Parsing tests/spec/result/foo.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/spec/oracle/comparison.res.oracle b/tests/spec/oracle/comparison.res.oracle index 2568a57615bdf83fe2014fbe7ee7c51016e8f9f3..57d28de1797bd30ccd82c7cb9c1ee62ce77d07bb 100644 --- a/tests/spec/oracle/comparison.res.oracle +++ b/tests/spec/oracle/comparison.res.oracle @@ -1,15 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/comparison.i (no preprocessing) -[kernel] Predicate comparison between 0 of type ℤ and i of type ℤ -[kernel] Predicate comparison between i of type ℤ and \old(n) of type ℤ -[kernel] Predicate comparison between *(\old(dest) + i) of type ℤ and 0 of type ℤ -[kernel] Predicate comparison between n of type ℤ and 1 of type ℤ -[kernel] Predicate comparison between 0 of type ℤ and i of type ℤ -[kernel] Predicate comparison between i of type ℤ and \old(size) of type ℤ -[kernel] Predicate comparison between 1 of type ℤ and j of type ℤ -[kernel] Predicate comparison between j of type ℤ and \old(n) of type ℤ -[kernel] Predicate comparison between *(\old(dest) + (i + j * \old(size))) of type unsigned char and * - (\old(dest) + i) of type unsigned char [kernel] Predicate comparison between a of type 𔹠and b of type 𔹠[kernel] Predicate comparison between x of type int and y of type int [kernel] Predicate comparison between (long)x of type long and z of type long diff --git a/tests/spec/oracle/complete_behaviors.res.oracle b/tests/spec/oracle/complete_behaviors.res.oracle index 30d437edea2f96d037a62b15b4660e9fc7be17c7..a1700313f6549a12dafa09e629651f8520a47732 100644 --- a/tests/spec/oracle/complete_behaviors.res.oracle +++ b/tests/spec/oracle/complete_behaviors.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/complete_behaviors.c (with preprocessing) /* Generated by Frama-C */ enum __anonenum_kind_1 { diff --git a/tests/spec/oracle/concrete_type.res.oracle b/tests/spec/oracle/concrete_type.res.oracle index dcaf211b537ba5cbea5aec68b8fad23ec37d7d60..d8f555521c23ed7de183e1bf5a76c23b3647df09 100644 --- a/tests/spec/oracle/concrete_type.res.oracle +++ b/tests/spec/oracle/concrete_type.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/concrete_type.c (with preprocessing) /* Generated by Frama-C */ /*@ type list<A> = Nil | Cons(A, list<A> ); diff --git a/tests/spec/oracle/const.res.oracle b/tests/spec/oracle/const.res.oracle index 45b671a326bb51d42e67e1b4b5d428e1875a0f4f..28b1fe8a572373c9bd79b9bc3aaf57d2a87baf79 100644 --- a/tests/spec/oracle/const.res.oracle +++ b/tests/spec/oracle/const.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/const.c (with preprocessing) tests/spec/const.c:1:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/const_ptr_bts1729.res.oracle b/tests/spec/oracle/const_ptr_bts1729.res.oracle index d566fdcd9e1a205bb896615ca52b3cbf8d4281d9..3ba0ec938d30ee586aace2bb425e83f3df444117 100644 --- a/tests/spec/oracle/const_ptr_bts1729.res.oracle +++ b/tests/spec/oracle/const_ptr_bts1729.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/const_ptr_bts1729.i (no preprocessing) /* Generated by Frama-C */ static void elem_size(void) diff --git a/tests/spec/oracle/constant_predicate.res.oracle b/tests/spec/oracle/constant_predicate.res.oracle index b5c76e278ce1838a75ec5134fcdb28e787e43aaa..b26d4aba13a716aae31f7a65d07732e35008b442 100644 --- a/tests/spec/oracle/constant_predicate.res.oracle +++ b/tests/spec/oracle/constant_predicate.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/constant_predicate.i (no preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/spec/oracle/contract_assert_bts1470.res.oracle b/tests/spec/oracle/contract_assert_bts1470.res.oracle index 88da9b5bcfedf4b028171f278930243cbb0f2f8e..3f5b2c919b6afe626352d38ad5cea86fa998d31b 100644 --- a/tests/spec/oracle/contract_assert_bts1470.res.oracle +++ b/tests/spec/oracle/contract_assert_bts1470.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/contract_assert_bts1470.i (no preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/spec/oracle/conversion.res.oracle b/tests/spec/oracle/conversion.res.oracle index e401c0a6263937c17e0a7d2988b79c50bd3c973c..1486bc4354a04b7b60decee431cea76ef2402048 100644 --- a/tests/spec/oracle/conversion.res.oracle +++ b/tests/spec/oracle/conversion.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/conversion.c (with preprocessing) /* Generated by Frama-C */ typedef int T; diff --git a/tests/spec/oracle/custom_annot_char.res.oracle b/tests/spec/oracle/custom_annot_char.res.oracle deleted file mode 100644 index 9be53e7e2efdff9f1170ad83b37d972beea8e439..0000000000000000000000000000000000000000 --- a/tests/spec/oracle/custom_annot_char.res.oracle +++ /dev/null @@ -1,11 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/spec/custom_annot_char.i (no preprocessing) -/* Generated by Frama-C */ -/*@ requires x ≥ 0; - ensures \result ≡ \old(x); */ -int f(int x) -{ - return x; -} - - diff --git a/tests/spec/oracle/declspec.res.oracle b/tests/spec/oracle/declspec.res.oracle index f45580bd56ce4b79b7b3a6b88227589151eb9164..c2b31613e668d4fdcde3748b1ecaeeda383ce556 100644 --- a/tests/spec/oracle/declspec.res.oracle +++ b/tests/spec/oracle/declspec.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/declspec.c (with preprocessing) /* Generated by Frama-C */ /*@ axiomatic Foo { diff --git a/tests/spec/oracle/default_assigns_bts0966.res.oracle b/tests/spec/oracle/default_assigns_bts0966.res.oracle index 59c74c26530fb2f4f535371aef5ba7083b4446f1..23bf85f8acaa4df097d2f1f398a10ab2ffdc7b8a 100644 --- a/tests/spec/oracle/default_assigns_bts0966.res.oracle +++ b/tests/spec/oracle/default_assigns_bts0966.res.oracle @@ -1,18 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/default_assigns_bts0966.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization auto_states[0..3] ∈ {0} -[value] computing for function copy <- main. - Called from tests/spec/default_assigns_bts0966.i:34. tests/spec/default_assigns_bts0966.i:34:[kernel] warning: No code nor implicit assigns clause for function copy, generating default assigns from the specification [value] using specification for function copy -tests/spec/default_assigns_bts0966.i:20:[value] warning: no \from part for clause 'assigns auto_states[Init], auto_states[Copy];' of - function copy -[value] Done for function copy -[value] Recording results for main +tests/spec/default_assigns_bts0966.i:20:[value] warning: no \from part for clause 'assigns auto_states[Init], auto_states[Copy];' [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: diff --git a/tests/spec/oracle/doxygen.res.oracle b/tests/spec/oracle/doxygen.res.oracle index 6c0e7bcbee8ac0019a92ff9370b5605f5272acf6..7fc66fb4e1d490537ef3fb430176cfe7ba4fb4ed 100644 --- a/tests/spec/oracle/doxygen.res.oracle +++ b/tests/spec/oracle/doxygen.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/doxygen.c (with preprocessing) /* Generated by Frama-C */ /* run.config @@ -20,7 +19,6 @@ void doxygen_group(void) void main(); -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/doxygen.c (with preprocessing) /* Generated by Frama-C */ /* run.config diff --git a/tests/spec/oracle/enum.res.oracle b/tests/spec/oracle/enum.res.oracle index 5ab4834f473c6cefcfced89f1eb79ae275bc3768..207aab4b5e757ff98355d3faff22dd0913dfb636 100644 --- a/tests/spec/oracle/enum.res.oracle +++ b/tests/spec/oracle/enum.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/enum.c (with preprocessing) /* Generated by Frama-C */ enum __anonenum_T_BOOLEEN_1 { diff --git a/tests/spec/oracle/error_msg.res.oracle b/tests/spec/oracle/error_msg.res.oracle index e499d6319f7b2de75c123bb8c18dd5ea7e646d65..0f3d89e6eeae69fa424b20eea25cb02029461471 100644 --- a/tests/spec/oracle/error_msg.res.oracle +++ b/tests/spec/oracle/error_msg.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/error_msg.i (no preprocessing) tests/spec/error_msg.i:4:[kernel] warning: expecting ';' before ensures tests/spec/error_msg.i:8:[kernel] warning: expecting ';' before end of annotation diff --git a/tests/spec/oracle/exit_clause.res.oracle b/tests/spec/oracle/exit_clause.res.oracle index 9e96ef7423ed5fd16d71dea780bd57a779462034..cc8f4a957af09fed9ae97de794e6ac7de6e4e881 100644 --- a/tests/spec/oracle/exit_clause.res.oracle +++ b/tests/spec/oracle/exit_clause.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/exit_clause.c (with preprocessing) tests/spec/exit_clause.c:23:[kernel] warning: \result meaningless. Ignoring logic specification of function f tests/spec/exit_clause.c:26:[kernel] warning: unbound logic variable \exit_status. Ignoring logic specification of function g diff --git a/tests/spec/oracle/expr_to_term.res.oracle b/tests/spec/oracle/expr_to_term.res.oracle index 51c54c7d46e4404981f9af16352b586dd8e74686..ed2717ba97a03b3e45decf484c8d857f0519c5b6 100644 --- a/tests/spec/oracle/expr_to_term.res.oracle +++ b/tests/spec/oracle/expr_to_term.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/expr_to_term.i (no preprocessing) /* Generated by Frama-C */ struct S { diff --git a/tests/spec/oracle/fct_ptr.res.oracle b/tests/spec/oracle/fct_ptr.res.oracle index 7cb5eea0c8f055c818ea213350563af11ac8e286..38057b4d01d5646fc251a369edba31555c138da8 100644 --- a/tests/spec/oracle/fct_ptr.res.oracle +++ b/tests/spec/oracle/fct_ptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/fct_ptr.c (with preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/spec/oracle/first.res.oracle b/tests/spec/oracle/first.res.oracle index a25cd6ca9c666153f3b95c9762a98cf1f9d11809..90839bd2f38b8b3296e6e2c8f25cc1eea338fa9d 100644 --- a/tests/spec/oracle/first.res.oracle +++ b/tests/spec/oracle/first.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/first.c (with preprocessing) [kernel] Parsing tests/spec/third.c (with preprocessing) [kernel] Parsing tests/spec/second.c (with preprocessing) diff --git a/tests/spec/oracle/footprint.res.oracle b/tests/spec/oracle/footprint.res.oracle index af03388622feab9b461ddabf4feb042ff1380a01..af196479510fd878768710d2e20010035e4377cd 100644 --- a/tests/spec/oracle/footprint.res.oracle +++ b/tests/spec/oracle/footprint.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/footprint.c (with preprocessing) tests/spec/footprint.c:34:[kernel] warning: not an assignable left value: footprint2{Old}(s). Ignoring logic specification of function g /* Generated by Frama-C */ diff --git a/tests/spec/oracle/for_scope.res.oracle b/tests/spec/oracle/for_scope.res.oracle index f1438abf55ea3d4393b3b82f56599a79b9926693..278dc608dec487b75dd37493cedcb5684bd1b913 100644 --- a/tests/spec/oracle/for_scope.res.oracle +++ b/tests/spec/oracle/for_scope.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/for_scope.c (with preprocessing) /* Generated by Frama-C */ void f(void) { - int i; - i = 0; + int i = 0; /*@ loop invariant i ≥ 0; */ while (i < 10) i ++; return; diff --git a/tests/spec/oracle/fptr.res.oracle b/tests/spec/oracle/fptr.res.oracle index 319946f6b537fb7139517883c00138c30b856ac0..b357a953361bc653a5491dce7bddf34c67968bf9 100644 --- a/tests/spec/oracle/fptr.res.oracle +++ b/tests/spec/oracle/fptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/fptr.i (no preprocessing) tests/spec/fptr.i:39:[kernel] warning: invalid implicit conversion from 'void (*)(int )' to 'void (*)(void)'. Ignoring logic specification of function f3 /* Generated by Frama-C */ diff --git a/tests/spec/oracle/homax.res.oracle b/tests/spec/oracle/homax.res.oracle index 032ca4b00ff0ffa6787091cfe47e7a1da7bd0239..118e5b77faa59da7a479b9f2c41b212e0ca47df9 100644 --- a/tests/spec/oracle/homax.res.oracle +++ b/tests/spec/oracle/homax.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/homax.c (with preprocessing) /* Generated by Frama-C */ int max_seq(int *p, int n); @@ -8,11 +7,9 @@ int max_seq(int *p, int n); */ int max_seq(int *p, int n) { - int res; - res = *p; + int res = *p; { - int i; - i = 0; + int i = 0; while (i < n) { if (res < *p) res = *p; p ++; diff --git a/tests/spec/oracle/hosum.res.oracle b/tests/spec/oracle/hosum.res.oracle index ea9458890e703d5f8d7d443ff17760153dd58689..d1153f8ff1cfdbc116455f9441a237af0861e826 100644 --- a/tests/spec/oracle/hosum.res.oracle +++ b/tests/spec/oracle/hosum.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/hosum.c (with preprocessing) /* Generated by Frama-C */ int sqsum(int *p, int n); @@ -12,12 +11,10 @@ int sqsum(int *p, int n); */ int sqsum(int *p, int n) { - int S; int tmp; - S = 0; + int S = 0; { - int i; - i = 0; + int i = 0; while (i < n) { /*@ assert *(p + i) * *(p + i) ≤ 1 << (30 - 1); */ ; tmp = *(p + i) * *(p + i); diff --git a/tests/spec/oracle/if.res.oracle b/tests/spec/oracle/if.res.oracle index f58e8dc705ae752a10d2b9f329829fb5595d79ce..d8c2235c714e407f233506a374f6731c2dbabe5d 100644 --- a/tests/spec/oracle/if.res.oracle +++ b/tests/spec/oracle/if.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/if.c (with preprocessing) tests/spec/if.c:7:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. tests/spec/if.c:12:[kernel] warning: invalid implicit conversion from 'int' to 'char *'. Ignoring code annotation @@ -18,8 +17,7 @@ void g(char *s); void f(void) { - int x; - x = 0; + int x = 0; g((char *)x); return; } diff --git a/tests/spec/oracle/kw.res.oracle b/tests/spec/oracle/kw.res.oracle index a7620a04b6351bf5b97a3b27eb107b6286e353cf..916e6673c1c89285920152a2cb1ee4c22b6e12f1 100644 --- a/tests/spec/oracle/kw.res.oracle +++ b/tests/spec/oracle/kw.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/kw.c (with preprocessing) /* Generated by Frama-C */ typedef int assert; diff --git a/tests/spec/oracle/label_scope_bts1536.res.oracle b/tests/spec/oracle/label_scope_bts1536.res.oracle index ce3a77d5ab99aa88606dfdc10154fa19d597395b..c0b43d416b87872cd5ead9b05bf9d6371f2e3213 100644 --- a/tests/spec/oracle/label_scope_bts1536.res.oracle +++ b/tests/spec/oracle/label_scope_bts1536.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/label_scope_bts1536.i (no preprocessing) /* Generated by Frama-C */ void f(void) diff --git a/tests/spec/oracle/lib.res.oracle b/tests/spec/oracle/lib.res.oracle index 915fea07d24b99f4da0e263492e1a89fde27339d..67bc0a41776183a7c3f99102923341c20065b7d6 100644 --- a/tests/spec/oracle/lib.res.oracle +++ b/tests/spec/oracle/lib.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/lib.c (with preprocessing) tests/spec/lib.h:1:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/liens.res.oracle b/tests/spec/oracle/liens.res.oracle index 78f0cb7673ebaf03fd0ca1a09d66199a9e818daa..9836e6ab691a297385f2d9062701a9f5788c821d 100644 --- a/tests/spec/oracle/liens.res.oracle +++ b/tests/spec/oracle/liens.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/liens.c (with preprocessing) /* Generated by Frama-C */ int e; diff --git a/tests/spec/oracle/list.res.oracle b/tests/spec/oracle/list.res.oracle index 9272ed4505a68a5b6961684a94f6ec0b5801e6f5..90d85e40a085a1f06e4332d16d95b7edf3c105de 100644 --- a/tests/spec/oracle/list.res.oracle +++ b/tests/spec/oracle/list.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/list.i (no preprocessing) /* Generated by Frama-C */ /*@ type List<A> = \list<A> ; diff --git a/tests/spec/oracle/local.res.oracle b/tests/spec/oracle/local.res.oracle index 35729cb403985e5cf7885f773798bec8cdf02778..28a43f750f3d26654085de563d9d6d928fece550 100644 --- a/tests/spec/oracle/local.res.oracle +++ b/tests/spec/oracle/local.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/local.c (with preprocessing) /* Generated by Frama-C */ /*@ ensures \let i = \old(x) + 1; i ≡ \result; diff --git a/tests/spec/oracle/localization.res.oracle b/tests/spec/oracle/localization.res.oracle index 67fa8bfff5a9ceed2ac1599b4491ebac83ddd00a..1a9ab025cab64fc1382a6dc6b529c5b6aa8953ef 100644 --- a/tests/spec/oracle/localization.res.oracle +++ b/tests/spec/oracle/localization.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/localization.c (with preprocessing) tests/spec/localization.c:6:[kernel] warning: unbound logic variable j. Ignoring global annotation tests/spec/localization.c:8:[kernel] warning: unbound logic variable k. Ignoring global annotation @@ -12,18 +11,15 @@ tests/spec/localization.c:33:[kernel] warning: no such type S1. Ignoring global */ void ComposerPage(void) { - int x; - x = 0; + int x = 0; x ++; return; } void f(void) { - /*@ ghost int index; */ - int x; - /*@ ghost index = 0; */ - x = 0; + /*@ ghost int index = 0; */ + int x = 0; return; } diff --git a/tests/spec/oracle/location_char.res.oracle b/tests/spec/oracle/location_char.res.oracle index 208ab62aeeffdf5aa2af5859c9300ec2ad70c7c1..8f343f2964ebdd1960c5056e68c114e6e3314a7d 100644 --- a/tests/spec/oracle/location_char.res.oracle +++ b/tests/spec/oracle/location_char.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/location_char.c (with preprocessing) [kernel] Predicate x ≤ 0: start line 9, char 26 diff --git a/tests/spec/oracle/logic_compare.res.oracle b/tests/spec/oracle/logic_compare.res.oracle index b2beeb0aa1477521872d3c0fbfb2fc972e759bb7..cdbcf0e6bc1bdd68236840066e3bd87382fe7517 100644 --- a/tests/spec/oracle/logic_compare.res.oracle +++ b/tests/spec/oracle/logic_compare.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/logic_compare.c (with preprocessing) /* Generated by Frama-C */ /*@ diff --git a/tests/spec/oracle/logic_def.res.oracle b/tests/spec/oracle/logic_def.res.oracle index 6b8b11b2e1a464d0f7322f5d64e45c8e6397fb7e..df3cf0061275c07e201ec6cb87ba59c5b6e9d7e2 100644 --- a/tests/spec/oracle/logic_def.res.oracle +++ b/tests/spec/oracle/logic_def.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/logic_def.c (with preprocessing) /* Generated by Frama-C */ /*@ logic ℤ foo(int x) = x + 2; @@ -6,8 +5,7 @@ int main(void) { int __retres; - int x; - x = 42; + int x = 42; /*@ assert foo(x) ≥ x; */ ; __retres = 0; return __retres; diff --git a/tests/spec/oracle/logic_label.res.oracle b/tests/spec/oracle/logic_label.res.oracle index c895f12bf95246635a6d933d1d331ac97bb08b00..0291f533d15fea90b427b1c442fddb34fef1eb07 100644 --- a/tests/spec/oracle/logic_label.res.oracle +++ b/tests/spec/oracle/logic_label.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/logic_label.c (with preprocessing) /* Generated by Frama-C */ void f(void) { - int x; - x = 0; + int x = 0; L: x ++; /*@ ensures \at(\true,Pre); */ x ++; @@ -27,8 +25,7 @@ int g(int i) int h(void) { int __retres; - int x; - x = 0; + int x = 0; l: x ++; /*@ assert modified{Here, l}(x) ∧ diff{Here, l}(x) ≡ 1; */ ; __retres = 0; @@ -43,11 +40,9 @@ int u(int *x) { int __retres; int *tmp; - { /* sequence */ - tmp = x; - x ++; - *tmp = 0; - } + tmp = x; + x ++; + *tmp = 0; *x = 1; /*@ assert \at(\true,Pre); */ ; __retres = *x; diff --git a/tests/spec/oracle/logic_labels_wrong.res.oracle b/tests/spec/oracle/logic_labels_wrong.res.oracle index 215069d2f2c2ec405cf62bcf5ac42d380923ebf2..dd4599f0ebe05a4676dda6ddf526e4451969137f 100644 --- a/tests/spec/oracle/logic_labels_wrong.res.oracle +++ b/tests/spec/oracle/logic_labels_wrong.res.oracle @@ -1,6 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/logic_labels_wrong.c (with preprocessing) -tests/spec/logic_labels_wrong.c:4:[kernel] warning: multiply defined label `L'. Ignoring global annotation +tests/spec/logic_labels_wrong.c:4:[kernel] warning: multiple defined label `L'. Ignoring global annotation tests/spec/logic_labels_wrong.c:19:[kernel] warning: \old undefined in this context. Ignoring loop annotation tests/spec/logic_labels_wrong.c:23:[kernel] warning: logic label `L0' not found. Ignoring code annotation tests/spec/logic_labels_wrong.c:26:[kernel] warning: logic label `L1' not found. Ignoring code annotation diff --git a/tests/spec/oracle/logic_type.res.oracle b/tests/spec/oracle/logic_type.res.oracle index b10a9893debdba5f3290b28962a484ade205c6c8..1245f0b480cdb18dbb523170e1162005eab9d316 100644 --- a/tests/spec/oracle/logic_type.res.oracle +++ b/tests/spec/oracle/logic_type.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/logic_type.c (with preprocessing) tests/spec/logic_type.c:1:[kernel] warning: parsing obsolete ACSL construct 'logic type declaration'. 'an axiomatic block' should be used instead. tests/spec/logic_type.c:2:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. diff --git a/tests/spec/oracle/loop_labels.res.oracle b/tests/spec/oracle/loop_labels.res.oracle index 6fe68aa2e0e613a4b8f96f8ac7105b297cd72446..0a33625e622176ce5d1337f3db9818d6c1d070c1 100644 --- a/tests/spec/oracle/loop_labels.res.oracle +++ b/tests/spec/oracle/loop_labels.res.oracle @@ -1,12 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/loop_labels.i (no preprocessing) tests/spec/loop_labels.i:14:[kernel] warning: logic label `LoopEntry' not found. Ignoring code annotation /* Generated by Frama-C */ int main(void) { int __retres; - int x; - x = 0; + int x = 0; /*@ loop invariant \at(x,LoopEntry) ≡ 0; loop invariant \at(x,LoopCurrent) ≤ 15; */ diff --git a/tests/spec/oracle/loop_labels_unroll.res.oracle b/tests/spec/oracle/loop_labels_unroll.res.oracle index d7514e04d1f3ad68263de4a69ffb0e44855d314c..025fed96ca9425f0e073b3560706637c06317c09 100644 --- a/tests/spec/oracle/loop_labels_unroll.res.oracle +++ b/tests/spec/oracle/loop_labels_unroll.res.oracle @@ -1,18 +1,15 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/loop_labels_unroll.i (no preprocessing) /* Generated by Frama-C */ int main(void) { int __retres; - int x; - x = 0; + int x = 0; unrolling_7_loop: ; if (! (x < 15)) goto unrolling_2_loop; { - int i_unroll_32; x ++; /*@ assert x ≡ \at(x,unrolling_7_loop) + 1; */ ; - i_unroll_32 = 0; + int i_unroll_32 = 0; /*@ loop invariant \at(i_unroll_32,LoopEntry) ≡ 0; */ while (i_unroll_32 < 4) { i_unroll_32 ++; @@ -23,10 +20,9 @@ int main(void) unrolling_6_loop: ; if (! (x < 15)) goto unrolling_2_loop; { - int i_unroll_24; x ++; /*@ assert x ≡ \at(x,unrolling_6_loop) + 1; */ ; - i_unroll_24 = 0; + int i_unroll_24 = 0; /*@ loop invariant \at(i_unroll_24,LoopEntry) ≡ 0; */ while (i_unroll_24 < 4) { i_unroll_24 ++; @@ -37,10 +33,9 @@ int main(void) unrolling_5_loop: ; if (! (x < 15)) goto unrolling_2_loop; { - int i_unroll_16; x ++; /*@ assert x ≡ \at(x,unrolling_5_loop) + 1; */ ; - i_unroll_16 = 0; + int i_unroll_16 = 0; /*@ loop invariant \at(i_unroll_16,LoopEntry) ≡ 0; */ while (i_unroll_16 < 4) { i_unroll_16 ++; @@ -51,10 +46,9 @@ int main(void) unrolling_4_loop: ; if (! (x < 15)) goto unrolling_2_loop; { - int i_unroll_8; x ++; /*@ assert x ≡ \at(x,unrolling_4_loop) + 1; */ ; - i_unroll_8 = 0; + int i_unroll_8 = 0; /*@ loop invariant \at(i_unroll_8,LoopEntry) ≡ 0; */ while (i_unroll_8 < 4) { i_unroll_8 ++; @@ -69,10 +63,9 @@ int main(void) loop pragma UNROLL "done", 4; */ while (x < 15) { - int i; x ++; /*@ assert x ≡ \at(x,LoopCurrent) + 1; */ ; - i = 0; + int i = 0; /*@ loop invariant \at(i,LoopEntry) ≡ 0; */ while (i < 4) { i ++; diff --git a/tests/spec/oracle/max.res.oracle b/tests/spec/oracle/max.res.oracle index 489e92a98ea81d19853c3e4d1a0f1b1cb5f20a1f..5b95d35391e0518dd77dcbf130ccb233ab34dad9 100644 --- a/tests/spec/oracle/max.res.oracle +++ b/tests/spec/oracle/max.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/max.c (with preprocessing) tests/spec/max.c:16:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. tests/spec/max.c:46:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. @@ -34,10 +33,9 @@ axiomatic IsMax { int max(int *t, int n) { int __retres; - int imax; int i; /*@ ghost int max_0; */ - imax = 0; + int imax = 0; if (n <= 0) { __retres = -1; goto return_label; @@ -62,20 +60,9 @@ int max(int *t, int n) int main(void) { int __retres; - int test[10]; - int x; - test[0] = 1; - test[1] = 2; - test[2] = 3; - test[3] = 4; - test[4] = 9; - test[5] = 8; - test[6] = 7; - test[7] = 6; - test[8] = 5; - test[9] = 10; + int test[10] = {1, 2, 3, 4, 9, 8, 7, 6, 5, 10}; /*@ assert \valid(&test[0 .. 9]); */ ; - x = max(test,10); + int x = max(test,10); /*@ assert test[x] ≥ 10; */ ; __retres = 0; return __retres; diff --git a/tests/spec/oracle/merge_1.res.oracle b/tests/spec/oracle/merge_1.res.oracle index 30883b52faad1b25c1c9a87555f89c2abd251504..432b32e8b4acebde9ec5f3066701e822f2812d89 100644 --- a/tests/spec/oracle/merge_1.res.oracle +++ b/tests/spec/oracle/merge_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/merge_1.i (no preprocessing) [kernel] Parsing tests/spec/merge_2.i (no preprocessing) tests/spec/merge_2.i:4:[kernel] warning: found two contracts. Merging them diff --git a/tests/spec/oracle/merge_assigns_bts1253.res.oracle b/tests/spec/oracle/merge_assigns_bts1253.res.oracle index 8fa7e286c842b8ddb99f8b9968ea17045fa8e7f6..70ea475ddd6a2aef2fdee14b992ae72eeb6b72e9 100644 --- a/tests/spec/oracle/merge_assigns_bts1253.res.oracle +++ b/tests/spec/oracle/merge_assigns_bts1253.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/merge_assigns_bts1253.i (no preprocessing) /* Generated by Frama-C */ /*@ assigns \result; @@ -6,6 +5,6 @@ double atof(char const *nptr); /*@ assigns *(nptr + (..)); */ -void f(char const *nptr); +void f(char *nptr); diff --git a/tests/spec/oracle/merge_bts938.res.oracle b/tests/spec/oracle/merge_bts938.res.oracle index 62d3224a03519264dbbe30a3fd7fb2d047c4b622..eac25d43ee89177a8291ca97ed41fe504fd875c5 100644 --- a/tests/spec/oracle/merge_bts938.res.oracle +++ b/tests/spec/oracle/merge_bts938.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/merge_bts938.c (with preprocessing) tests/spec/merge_bts938.h:2:[kernel] warning: found two contracts. Merging them [kernel] Parsing tests/spec/merge_bts938_1.c (with preprocessing) diff --git a/tests/spec/oracle/merge_different_assigns.res.oracle b/tests/spec/oracle/merge_different_assigns.res.oracle index 18768cf0e44701171f8764c9d7e1be2e0725d1d1..7cc422583033bbb11fb7fc97842c85d3da022524 100644 --- a/tests/spec/oracle/merge_different_assigns.res.oracle +++ b/tests/spec/oracle/merge_different_assigns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/merge_different_assigns.i (no preprocessing) [kernel] Parsing tests/spec/merge_different_assigns_bis.i (no preprocessing) tests/spec/merge_different_assigns.i:7:[kernel] warning: found two contracts. Merging them diff --git a/tests/spec/oracle/merge_logic_globals_1.res.oracle b/tests/spec/oracle/merge_logic_globals_1.res.oracle index 72ec0903943fe5a6785343279635d472980de3a1..19e8acbfe37b40d537d2da3e8d94bcbe81a30fad 100644 --- a/tests/spec/oracle/merge_logic_globals_1.res.oracle +++ b/tests/spec/oracle/merge_logic_globals_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/merge_logic_globals_1.c (with preprocessing) [kernel] Parsing tests/spec/merge_logic_globals_2.c (with preprocessing) tests/spec/merge_logic_globals.h:14:[kernel] warning: dropping duplicate def'n of func test at tests/spec/merge_logic_globals.h:14 in favor of that at tests/spec/merge_logic_globals.h:14 @@ -10,7 +9,7 @@ typedef struct s_t t; /*@ type invariant inv_t(t x) = x.n > 0; */ int i = 42; -/*@ predicate p(int x) = x ≥ i; +/*@ predicate p{Here}(int x) = x ≥ i; */ /*@ axiomatic Bar { logic ℤ li; diff --git a/tests/spec/oracle/model.res.oracle b/tests/spec/oracle/model.res.oracle index 1eb5a40f30a408cca9a7317469f8b65775356080..a9b4de41c7fb8ed0bf7b192c713da7f8cae6f1a1 100644 --- a/tests/spec/oracle/model.res.oracle +++ b/tests/spec/oracle/model.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/model.i (no preprocessing) tests/spec/model.i:9:[kernel] warning: Cannot add model field x for type struct S: it already exists. Ignoring global annotation tests/spec/model.i:13:[kernel] warning: Cannot add model field z for type T: it already exists. Ignoring global annotation @@ -31,15 +30,10 @@ int f(struct S *s); */ void main(void) { - struct S s; - T t; - int a; - s.x = 0; - s.y = 0; - t.x = 1; - t.y = 2; + struct S s = {.x = 0, .y = 0}; + T t = {.x = 1, .y = 2}; /*@ assert t.t ≡ 6 ∧ t.z ≡ 3; */ ; - a = f(& s); + int a = f(& s); if (a) { if (! s.x) /*@ assert s.y ≢ 0; */ ; @@ -47,8 +41,7 @@ void main(void) } else { _LAND: { - int tmp_2; - tmp_2 = s.x == 1; + int tmp_2 = s.x == 1; } } /*@ assert s.z ≢ 0; */ ; diff --git a/tests/spec/oracle/model1.res.oracle b/tests/spec/oracle/model1.res.oracle index cb41556ad5908f5b6ae383467d1d61f76eb1247d..42684f81ea9d584b26e43695b8a1c067b64a45d8 100644 --- a/tests/spec/oracle/model1.res.oracle +++ b/tests/spec/oracle/model1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/model1.c (with preprocessing) [kernel] Parsing tests/spec/model2.c (with preprocessing) /* Generated by Frama-C */ @@ -41,8 +40,7 @@ void main(void) assigns *s; */ void reset(struct S *s) { - int tmp; - tmp = s->bar == 0; + int tmp = s->bar == 0; return; } diff --git a/tests/value/oracle/sep.0.err.oracle b/tests/spec/oracle/multi_axiomatic_1.err.oracle similarity index 100% rename from tests/value/oracle/sep.0.err.oracle rename to tests/spec/oracle/multi_axiomatic_1.err.oracle diff --git a/tests/spec/oracle/multi_axiomatic_1.res.oracle b/tests/spec/oracle/multi_axiomatic_1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..7cfc1887c0c66bd700c83bfa24bd7878aa6e9eeb --- /dev/null +++ b/tests/spec/oracle/multi_axiomatic_1.res.oracle @@ -0,0 +1,20 @@ +[kernel] Parsing tests/spec/multi_axiomatic_1.i (no preprocessing) +[kernel] Parsing tests/spec/multi_axiomatic_2.i (no preprocessing) +/* Generated by Frama-C */ +/*@ axiomatic ax { + logic int Acc(int m) ; + + } + */ +/*@ predicate Bnd(ℤ n, int m) = Acc(m) ≤ 9; + */ +/*@ predicate Bnd(ℤ n) = Bnd(n, (int)0); + */ +/*@ requires Bnd(1); + ensures \true; */ +void foo(void) +{ + return; +} + + diff --git a/tests/spec/oracle/multi_behavior.res.oracle b/tests/spec/oracle/multi_behavior.res.oracle index c2930151358c353ab735f51bcfaff9f2fbbd7d83..5a3dbdfa777a0ea44c0eb2629ae62faba87074e0 100644 --- a/tests/spec/oracle/multi_behavior.res.oracle +++ b/tests/spec/oracle/multi_behavior.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multi_behavior.c (with preprocessing) /* Generated by Frama-C */ int a; diff --git a/tests/spec/oracle/multi_labels.res.oracle b/tests/spec/oracle/multi_labels.res.oracle index 29716d73caaba882088989fc52b7d9720ebf1f5d..2b41d2e2d6c4c48697469ec42198d3b05f5551af 100644 --- a/tests/spec/oracle/multi_labels.res.oracle +++ b/tests/spec/oracle/multi_labels.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multi_labels.i (no preprocessing) /* Generated by Frama-C */ int labels(void) { - int x; - x = 0; + int x = 0; L1: /*@ assert \at(x,L1) ≡ \at(x,L1); */ ; return x; } diff --git a/tests/spec/oracle/multidecl.res.oracle b/tests/spec/oracle/multidecl.res.oracle index 191a54ce69f176f5f917bfa707989c3dab2a0d5f..4ad8903f21e6b025e74d5e7031800b8be84580ad 100644 --- a/tests/spec/oracle/multidecl.res.oracle +++ b/tests/spec/oracle/multidecl.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multidecl.c (with preprocessing) tests/spec/multidecl.c:9:[kernel] warning: term x has type ℤ, but int is expected.. Ignoring global annotation /* Generated by Frama-C */ diff --git a/tests/spec/oracle/multidim.res.oracle b/tests/spec/oracle/multidim.res.oracle index 0f63332232cb15194ab4afe2cc884bc4c7cb8814..9f14f2acde1e53a98f840b462226e7ff73b4300f 100644 --- a/tests/spec/oracle/multidim.res.oracle +++ b/tests/spec/oracle/multidim.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multidim.c (with preprocessing) tests/spec/multidim.c:14:[kernel] warning: In ACSL, there is no implicit conversion between a C array and a pointer. Either introduce an explicit cast or take the address of the first element of ttt. Ignoring specification of function g /* Generated by Frama-C */ diff --git a/tests/spec/oracle/multiple_decl_def_1.res.oracle b/tests/spec/oracle/multiple_decl_def_1.res.oracle index b44b932355c18ed427c90fdf842797717bee0fad..02eed2cca8a3c9b69bd56d7e53ad2c57b027ac66 100644 --- a/tests/spec/oracle/multiple_decl_def_1.res.oracle +++ b/tests/spec/oracle/multiple_decl_def_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multiple_decl_def_1.c (with preprocessing) [kernel] Parsing tests/spec/multiple_decl_def_2.c (with preprocessing) tests/spec/multiple_decl_def_2.c:5:[kernel] warning: found two contracts. Merging them diff --git a/tests/spec/oracle/multiple_file_1.res.oracle b/tests/spec/oracle/multiple_file_1.res.oracle index 6844df445645aabe5150c78190e0e565a1dae4fb..4a9c492fc0b42632a5866b44ac86e79f699fcdad 100644 --- a/tests/spec/oracle/multiple_file_1.res.oracle +++ b/tests/spec/oracle/multiple_file_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multiple_file_1.c (with preprocessing) [kernel] Parsing tests/spec/multiple_file_2.c (with preprocessing) tests/spec/multiple_file_1.c:10:[kernel] warning: found two contracts. Merging them diff --git a/tests/spec/oracle/multiple_include_2.res.oracle b/tests/spec/oracle/multiple_include_2.res.oracle index 4c72538eef4a8dc3049272d0e8cb8a18ab6dd43b..0466979eebc20da328a08f773e47ca7d4eeeb8b8 100644 --- a/tests/spec/oracle/multiple_include_2.res.oracle +++ b/tests/spec/oracle/multiple_include_2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multiple_include_2.c (with preprocessing) [kernel] Parsing tests/spec/multiple_include_1.c (with preprocessing) [kernel] user error: multiple inclusion of logic function p referring to a static variable diff --git a/tests/spec/oracle/multiple_spec.res.oracle b/tests/spec/oracle/multiple_spec.res.oracle index a1b36a118ee6b097c42ff37dc343f11d9235ebd3..25413e292e0284276da5ad94f872e4d2805739ef 100644 --- a/tests/spec/oracle/multiple_spec.res.oracle +++ b/tests/spec/oracle/multiple_spec.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/multiple_spec.c (with preprocessing) tests/spec/multiple_spec.c:4:[kernel] warning: found two contracts. Merging them /* Generated by Frama-C */ diff --git a/tests/spec/oracle/nested.res.oracle b/tests/spec/oracle/nested.res.oracle index cbfa5d5e2b09db928621bb40f3a7938712691246..e4f38d0ce278602cc08004223af6b2fdf36bc88f 100644 --- a/tests/spec/oracle/nested.res.oracle +++ b/tests/spec/oracle/nested.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/nested.c (with preprocessing) /* Generated by Frama-C */ void g(void) diff --git a/tests/spec/oracle/null_ptr.res.oracle b/tests/spec/oracle/null_ptr.res.oracle index d8d1f00ed5f0226db3d33f2f4b945da98c28b202..477531a37fe5f3f008aa6660962cccd0703bcb0c 100644 --- a/tests/spec/oracle/null_ptr.res.oracle +++ b/tests/spec/oracle/null_ptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/null_ptr.c (with preprocessing) tests/spec/null_ptr.c:18:[kernel] warning: invalid implicit conversion from 𔹠to ℤ. Ignoring logic specification of function h /* Generated by Frama-C */ diff --git a/tests/spec/oracle/old_prm.res.oracle b/tests/spec/oracle/old_prm.res.oracle index 29bda4d07b09d3ef2c04f79fa3d134cc332ff849..83b9ed5c837f9ba28289d68aef3980aab5a491e9 100644 --- a/tests/spec/oracle/old_prm.res.oracle +++ b/tests/spec/oracle/old_prm.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/old_prm.i (no preprocessing) /* Generated by Frama-C */ struct st { diff --git a/tests/spec/oracle/onelineghost.res.oracle b/tests/spec/oracle/onelineghost.res.oracle index 51332c03ef08887c68321415bc30b839cfea142b..3b5acdb1b16bf234d2e77b2c5ece216e745a9a34 100644 --- a/tests/spec/oracle/onelineghost.res.oracle +++ b/tests/spec/oracle/onelineghost.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/onelineghost.c (with preprocessing) /* Generated by Frama-C */ int main(void) { int __retres; - /*@ ghost int x; */ - /*@ ghost x = 0; */ + /*@ ghost int x = 0; */ /*@ ghost x ++; */ __retres = 0; return __retres; diff --git a/tests/spec/oracle/overload_resolution.res.oracle b/tests/spec/oracle/overload_resolution.res.oracle index 41edb6b68752998b2daf7791787a99ee36f28e13..1ef15a7fbeb5e8fcb080ce389402d83c57403eda 100644 --- a/tests/spec/oracle/overload_resolution.res.oracle +++ b/tests/spec/oracle/overload_resolution.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/overload_resolution.i (no preprocessing) /* Generated by Frama-C */ /*@ predicate rel(unsigned long long x, unsigned long long y) = x ≡ y; diff --git a/tests/spec/oracle/parsing.res.oracle b/tests/spec/oracle/parsing.res.oracle index 00f502ade0e12a1da6a76c162bbbc0e42ccf18cf..d10f0156cf6aba2767d354f56360d8e032e25ec7 100644 --- a/tests/spec/oracle/parsing.res.oracle +++ b/tests/spec/oracle/parsing.res.oracle @@ -1,14 +1,13 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/parsing.c (with preprocessing) tests/spec/parsing.c:27:[kernel] warning: unexpected token 'bla' tests/spec/parsing.c:15:[kernel] warning: comparison of incompatible types: 𔹠and ℤ. Ignoring global annotation tests/spec/parsing.c:19:[kernel] warning: comparison of incompatible types: 𔹠and ℤ. Ignoring global annotation /* Generated by Frama-C */ -/*@ lemma bidon: ∀ int *t; ¬(*(t + 0) > 0); +/*@ lemma bidon{Here}: ∀ int *t; ¬(*(t + 0) > 0); */ -/*@ lemma bidon1: ∀ int *t; !(*(t + 0) ≢ 0) ≡ (0 ≢ 0); +/*@ lemma bidon1{Here}: ∀ int *t; !(*(t + 0) ≢ 0) ≡ (0 ≢ 0); */ -/*@ lemma bidon2: ∀ int *t; !(*(t + 0) ≢ 0) ≡ (0 ≢ 0); +/*@ lemma bidon2{Here}: ∀ int *t; !(*(t + 0) ≢ 0) ≡ (0 ≢ 0); */ /*@ predicate foo{L}(int *a, int *b, int length) = diff --git a/tests/spec/oracle/permut.res.oracle b/tests/spec/oracle/permut.res.oracle index a12027eabe00161d3c81225e7478fac13dfc1ed8..fd82bb3e595a89462af5483e2986e7e0cf2aaf65 100644 --- a/tests/spec/oracle/permut.res.oracle +++ b/tests/spec/oracle/permut.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/permut.c (with preprocessing) /* Generated by Frama-C */ /*@ diff --git a/tests/spec/oracle/pi.res.oracle b/tests/spec/oracle/pi.res.oracle index 941865813c1d4acd4cd926ad83d479826bf78fb8..62c791ca1881f35903989975763b3718f4441ce6 100644 --- a/tests/spec/oracle/pi.res.oracle +++ b/tests/spec/oracle/pi.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/pi.c (with preprocessing) /* Generated by Frama-C */ /*@ lemma simplify_dumb_1: 2800 % 14 ≡ 0; @@ -40,15 +39,11 @@ void main(void) { int tmp; d += f[b] * a; - { /* sequence */ - g --; - f[b] = d % g; - } - { /* sequence */ - tmp = g; - g --; - d /= tmp; - } + g --; + f[b] = d % g; + tmp = g; + g --; + d /= tmp; b --; if (! b) break; d *= b; diff --git a/tests/spec/oracle/pointer_cast.res.oracle b/tests/spec/oracle/pointer_cast.res.oracle index 584baea8bdf7fecc693b3486aec634c828867fdf..40df58c42d11be9acf352345009ecca7798ff9b3 100644 --- a/tests/spec/oracle/pointer_cast.res.oracle +++ b/tests/spec/oracle/pointer_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/pointer_cast.c (with preprocessing) tests/spec/pointer_cast.c:3:[kernel] warning: incompatible types int * and int ** . Ignoring code annotation diff --git a/tests/spec/oracle/pointer_comparable.res.oracle b/tests/spec/oracle/pointer_comparable.res.oracle index 248d4887678370e3c1717daf736e320ecbe6d49b..cf7ccc226c4e1902387b9e6611bbc9f6dae6ff5e 100644 --- a/tests/spec/oracle/pointer_comparable.res.oracle +++ b/tests/spec/oracle/pointer_comparable.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/pointer_comparable.c (with preprocessing) /* Generated by Frama-C */ /*@ requires \pointer_comparable((void *)p, (void *)q) ∧ \is_finite(*p); */ diff --git a/tests/spec/oracle/polymorph.res.oracle b/tests/spec/oracle/polymorph.res.oracle index 74cf93304e1c4d476fb5d1d609049f8856427a8a..ad1eccdc4a9a488292bc30d26c7c07dfa039a12c 100644 --- a/tests/spec/oracle/polymorph.res.oracle +++ b/tests/spec/oracle/polymorph.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/polymorph.c (with preprocessing) tests/spec/polymorph.c:1:[kernel] warning: parsing obsolete ACSL construct 'logic type declaration'. 'an axiomatic block' should be used instead. tests/spec/polymorph.c:4:[kernel] warning: unexpected token 'a' diff --git a/tests/spec/oracle/pp_empty_spec.res.oracle b/tests/spec/oracle/pp_empty_spec.res.oracle index a48ac3299007ec71e7c9676abc03964b2b103429..f450b666d423d9828bf40b967056120e9595b2f2 100644 --- a/tests/spec/oracle/pp_empty_spec.res.oracle +++ b/tests/spec/oracle/pp_empty_spec.res.oracle @@ -1,13 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/pp_empty_spec.i (no preprocessing) /* Generated by Frama-C */ int main(void) { int __retres; - int x; - int y; - x = 0; - y = 0; + int x = 0; + int y = 0; /*@ loop invariant invmerger: chekofv_invariant_1_1: x ≡ y; */ while (y < 10) { x ++; @@ -23,10 +20,8 @@ int main(void) int main(void) { int __retres; - int x; - int y; - x = 0; - y = 0; + int x = 0; + int y = 0; /*@ loop invariant invmerger: chekofv_invariant_1_1: x ≡ y; */ while (y < 10) { x ++; @@ -41,10 +36,8 @@ int main(void) int main(void) { int __retres; - int x; - int y; - x = 0; - y = 0; + int x = 0; + int y = 0; /*@ loop invariant invmerger: chekofv_invariant_1_1: x ≡ y; */ while (y < 10) { x ++; @@ -59,10 +52,8 @@ int main(void) int main(void) { int __retres; - int x; - int y; - x = 0; - y = 0; + int x = 0; + int y = 0; /*@ loop invariant invmerger: chekofv_invariant_1_1: x ≡ y; */ while (y < 10) { x ++; @@ -81,10 +72,8 @@ int main(void) int main(void) { int __retres; - int x; - int y; - x = 0; - y = 0; + int x = 0; + int y = 0; /*@ loop invariant invmerger: chekofv_invariant_1_1: x ≡ y; */ while (y < 10) { x ++; @@ -104,10 +93,8 @@ int main(void) int main(void) { int __retres; - int x; - int y; - x = 0; - y = 0; + int x = 0; + int y = 0; /*@ loop invariant invmerger: chekofv_invariant_1_1: x ≡ y; */ while (y < 10) { x ++; diff --git a/tests/spec/oracle/pragma.res.oracle b/tests/spec/oracle/pragma.res.oracle index 76c345a196ea31b0b564c382d3fc0e6c9a389976..c2f15d0c6bfac719140eee89679b6f26e4b2c980 100644 --- a/tests/spec/oracle/pragma.res.oracle +++ b/tests/spec/oracle/pragma.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/pragma.i (no preprocessing) tests/spec/pragma.i:12:[kernel] warning: Unexpected attribute in #pragma tests/spec/pragma.i:14:[kernel] warning: Unexpected attribute in #pragma diff --git a/tests/spec/oracle/precedence.res.oracle b/tests/spec/oracle/precedence.res.oracle index 66e5e9368cf97ba340d2834c9ecb63e7902131ff..d1a1135af18595a2c27d945e93f3f0cebf2d1484 100644 --- a/tests/spec/oracle/precedence.res.oracle +++ b/tests/spec/oracle/precedence.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/precedence.i (no preprocessing) /* Generated by Frama-C */ int x[10]; diff --git a/tests/spec/oracle/pred_def.res.oracle b/tests/spec/oracle/pred_def.res.oracle index c9391e773ceee764e6e2949a8ecdf3bf288be268..353dc6a5b1f1d8dd716c6656a7cefdd0cd2839b8 100644 --- a/tests/spec/oracle/pred_def.res.oracle +++ b/tests/spec/oracle/pred_def.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/pred_def.i (no preprocessing) /* Generated by Frama-C */ /*@ predicate f(ℤ x) = x + 1 ≢ 0; diff --git a/tests/spec/oracle/predicates.res.oracle b/tests/spec/oracle/predicates.res.oracle index 7b212ad97c016875dd3f1dceaa4d73123bed0263..b94d7d89872eeb8ccef3359aa14703e0191404a3 100644 --- a/tests/spec/oracle/predicates.res.oracle +++ b/tests/spec/oracle/predicates.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/predicates.c (with preprocessing) tests/spec/predicates.c:3:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/preprocess.res.oracle b/tests/spec/oracle/preprocess.res.oracle index 53890b07f0b9de20c4711991cfc2c2cee5727554..1d01ed03a38e13e516a5c97bc7a0b3b7c3aa854c 100644 --- a/tests/spec/oracle/preprocess.res.oracle +++ b/tests/spec/oracle/preprocess.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/preprocess.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/spec/oracle/preprocess_string.res.oracle b/tests/spec/oracle/preprocess_string.res.oracle index eebcd52ff0bf6a3f63abd397ea19b9c35251d8ef..faad4fbb46e011807e642a1c349395859cf84044 100644 --- a/tests/spec/oracle/preprocess_string.res.oracle +++ b/tests/spec/oracle/preprocess_string.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] warning: your preprocessor is not known to handle option `-nostdinc'. If pre-processing fails because of it, please add -no-cpp-frama-c-compliant option to Frama-C's command-line. If you do not want to see this warning again, explicitly use option -cpp-frama-c-compliant. [kernel] Parsing tests/spec/preprocess_string.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/spec/oracle/property_test.res.oracle b/tests/spec/oracle/property_test.res.oracle index e0d9e8834474e57875d2e8baca082933b96f4067..4fa383412342756c2947e542e8579cc41b10b151 100644 --- a/tests/spec/oracle/property_test.res.oracle +++ b/tests/spec/oracle/property_test.res.oracle @@ -1,54 +1,17 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/property_test.i (no preprocessing) In project project "default": Status of assert X ≥ \at(X,Pre);: no verification attempted -Status of assigns *(dest + (0 .. n - 1)) \from \nothing;: no verification attempted -Status of assigns *(dest + (0 .. n - 1));: no verification attempted -Status of assigns *(dest + (size .. size * n - 1)) - \from *(dest + (0 .. size - 1));: no verification attempted -Status of assigns *(dest + (size .. size * n - 1));: no verification attempted -Status of default behavior: VALID according to Frama-C kernel (under hypotheses) Status of default behavior: no verification attempted Status of ensures X ≥ 0: no verification attempted -Status of ensures -∀ ℤ i, ℤ j; - 0 ≤ i < \old(size) ∧ 1 ≤ j < \old(n) ⇒ - *(\old(dest) + (i + j * \old(size))) ≡ *(\old(dest) + i): no verification attempted -Status of ensures -∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0: no verification attempted Status of requires X ≥ 0: no verification attempted -Status of requires -\valid(dest + (0 .. n - 1)): no verification attempted -Status of requires -\valid(dest + (0 .. size * n - 1)): no verification attempted -Status of requires -n ≥ 1: no verification attempted In project project "property_test": Status of assert X ≥ \at(X,Pre);: no verification attempted -Status of assigns *(dest + (0 .. n - 1)) \from \nothing;: no verification attempted -Status of assigns *(dest + (0 .. n - 1));: no verification attempted -Status of assigns *(dest + (size .. size * n - 1)) - \from *(dest + (0 .. size - 1));: no verification attempted -Status of assigns *(dest + (size .. size * n - 1));: no verification attempted Status of assigns X \from X, c;: no verification attempted Status of assigns X;: no verification attempted -Status of default behavior: VALID according to Frama-C kernel (under hypotheses) Status of default behavior: no verification attempted Status of ensures X ≥ 0: no verification attempted -Status of ensures -∀ ℤ i, ℤ j; - 0 ≤ i < \old(size) ∧ 1 ≤ j < \old(n) ⇒ - *(\old(dest) + (i + j * \old(size))) ≡ *(\old(dest) + i): no verification attempted -Status of ensures -∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0: no verification attempted Status of requires X ≥ 0: no verification attempted -Status of requires -\valid(dest + (0 .. n - 1)): no verification attempted -Status of requires -\valid(dest + (0 .. size * n - 1)): no verification attempted -Status of requires -n ≥ 1: no verification attempted diff --git a/tests/spec/oracle/prototype_assigns.res.oracle b/tests/spec/oracle/prototype_assigns.res.oracle index 1a33c26014ca8100c97ccc0a99efb05591767ec6..92d6888a3247ffa5f1f64564bd92a40d902a9b6e 100644 --- a/tests/spec/oracle/prototype_assigns.res.oracle +++ b/tests/spec/oracle/prototype_assigns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/prototype_assigns.c (with preprocessing) /* Generated by Frama-C */ /*@ assigns *p; */ diff --git a/tests/spec/oracle/ptr_cast.res.oracle b/tests/spec/oracle/ptr_cast.res.oracle index b563609a36c1f8a4422fc359fb164188ec96ee28..bd7fe04046d9b9ccae253fce721da315c01ac842 100644 --- a/tests/spec/oracle/ptr_cast.res.oracle +++ b/tests/spec/oracle/ptr_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/ptr_cast.c (with preprocessing) /* Generated by Frama-C */ int f(void) diff --git a/tests/spec/oracle/purse.res.oracle b/tests/spec/oracle/purse.res.oracle index f517aa324a78b5f16c6278bceabdd00ef56df9c7..0f30b320efe923b9bcf8414c72c1a5f35efcdc93 100644 --- a/tests/spec/oracle/purse.res.oracle +++ b/tests/spec/oracle/purse.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/purse.c (with preprocessing) /* Generated by Frama-C */ #include "stdlib.h" @@ -62,8 +61,7 @@ int test1(purse *p1, purse *p2) */ purse *new_purse(void) { - purse *p; - p = (purse *)malloc((unsigned int)1 * sizeof(purse)); + purse *p = malloc((unsigned int)1 * sizeof(purse)); p->balance = 0; return p; } @@ -72,10 +70,8 @@ purse *new_purse(void) int test2(void) { int __retres; - purse *p1; - purse *p2; - p1 = new_purse(); - p2 = new_purse(); + purse *p1 = new_purse(); + purse *p2 = new_purse(); credit(p1,100); credit(p2,200); withdraw(p1,50); diff --git a/tests/spec/oracle/range.res.oracle b/tests/spec/oracle/range.res.oracle index e95eaa9ca55843d4d7a8561e051a2fbe9a8c134d..faa777bc1e4760637a0dc74c0ab28cb2fa1ab2b6 100644 --- a/tests/spec/oracle/range.res.oracle +++ b/tests/spec/oracle/range.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/range.c (with preprocessing) /* Generated by Frama-C */ struct foo { diff --git a/tests/spec/oracle/real_typing_bts1309.res.oracle b/tests/spec/oracle/real_typing_bts1309.res.oracle index 400868ccf02ec77b5acb2d9996b1cd7c27315261..263809eb1832681d56202f6c8e08218c15c769e5 100644 --- a/tests/spec/oracle/real_typing_bts1309.res.oracle +++ b/tests/spec/oracle/real_typing_bts1309.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/real_typing_bts1309.i (no preprocessing) /* Generated by Frama-C */ void foo(int c) { - float f; - f = (float)1.0; + float f = (float)1.0; /*@ assert 0.0 ≤ (c ≢ 0? f: 2.0); */ ; return; } diff --git a/tests/spec/oracle/recursive_with_label.res.oracle b/tests/spec/oracle/recursive_with_label.res.oracle index fa9b8b5e37a92037d78e56d5464e3898b512d3da..3b17148a6922332a894754735575e47db38ad8df 100644 --- a/tests/spec/oracle/recursive_with_label.res.oracle +++ b/tests/spec/oracle/recursive_with_label.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/recursive_with_label.i (no preprocessing) /* Generated by Frama-C */ /*@ diff --git a/tests/spec/oracle/regions.res.oracle b/tests/spec/oracle/regions.res.oracle index 7ac0019e85dacba478e73056d0925dfec604e34b..d2c0ef9231ac094eab4e1cba9a4c3216c98197cc 100644 --- a/tests/spec/oracle/regions.res.oracle +++ b/tests/spec/oracle/regions.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/regions.c (with preprocessing) /* Generated by Frama-C */ struct S { diff --git a/tests/spec/oracle/regions2.res.oracle b/tests/spec/oracle/regions2.res.oracle index 10d186ae4fa26bee52fda28ce1c2f0b0fbdd7f9e..9afa25b6203c7d92923da82820ad0014171fc0e6 100644 --- a/tests/spec/oracle/regions2.res.oracle +++ b/tests/spec/oracle/regions2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/regions2.c (with preprocessing) /* Generated by Frama-C */ struct S { diff --git a/tests/spec/oracle/returns.res.oracle b/tests/spec/oracle/returns.res.oracle index c12ec03a89122c4f538dcc1fe750134b21a53937..b65d9a543a75c505c14d918fa30db78d52439803 100644 --- a/tests/spec/oracle/returns.res.oracle +++ b/tests/spec/oracle/returns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/returns.i (no preprocessing) /* Generated by Frama-C */ /*@ ensures \result ≢ \old(c); */ @@ -21,11 +20,9 @@ int g(int *a) { int __retres; int *tmp; - { /* sequence */ - tmp = a; - a ++; - ; - } + tmp = a; + a ++; + ; __sid_13_label: ; /*@ behavior neg: assumes *a < 0; @@ -40,11 +37,9 @@ int g(int *a) } if (*a != 0) { int *tmp_0; - { /* sequence */ - tmp_0 = a; - a ++; - ; - } + tmp_0 = a; + a ++; + ; __retres = 0; goto return_label; } diff --git a/tests/spec/oracle/separated.res.oracle b/tests/spec/oracle/separated.res.oracle index 1d2b46f6127d06f27f1765bfe7bb24309fd2650f..1ae0c91b3cadb0dcd18d3685e06f34d97634e962 100644 --- a/tests/spec/oracle/separated.res.oracle +++ b/tests/spec/oracle/separated.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/separated.c (with preprocessing) /* Generated by Frama-C */ /*@ requires \base_addr(q) ≢ p; @@ -9,20 +8,17 @@ */ void put(char *p, char *q, int n) { - int i; - i = 0; + int i = 0; while (i < n) { { char *tmp; char *tmp_0; /*@ assert \separated(p, q); */ ; - { /* sequence */ - tmp = p; - p ++; - tmp_0 = q; - q ++; - *tmp = *tmp_0; - } + tmp = p; + p ++; + tmp_0 = q; + q ++; + *tmp = *tmp_0; } i ++; } diff --git a/tests/spec/oracle/shifts.res.oracle b/tests/spec/oracle/shifts.res.oracle index c0e8743403e57d71b9918aac9d80cea84da11004..e010d2453f0b78159ec3af39ba4368e8ba4e40be 100644 --- a/tests/spec/oracle/shifts.res.oracle +++ b/tests/spec/oracle/shifts.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/shifts.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/spec/oracle/sizeof.res.oracle b/tests/spec/oracle/sizeof.res.oracle index 577cea242fa8a8bb510b230bb47e6cb614e996a6..2dc684890d4d33f536d3736880fee638ce470263 100644 --- a/tests/spec/oracle/sizeof.res.oracle +++ b/tests/spec/oracle/sizeof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/sizeof.c (with preprocessing) /* Generated by Frama-C */ /*@ requires i > sizeof(int); diff --git a/tests/spec/oracle/sizeof_incomplete_bts1538.res.oracle b/tests/spec/oracle/sizeof_incomplete_bts1538.res.oracle index db72e4f203b27f66b820c44788aad19f4ee94eb8..c7faff9a940476a2160dd0dff1cb210d3faff831 100644 --- a/tests/spec/oracle/sizeof_incomplete_bts1538.res.oracle +++ b/tests/spec/oracle/sizeof_incomplete_bts1538.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/sizeof_incomplete_bts1538.i (no preprocessing) /* Generated by Frama-C */ int t[10]; void main(void) { - int v; - v = (int)sizeof(t); + int v = (int)sizeof(t); /*@ assert /*(type:ℤ *//*(type:int */v/*)*//*)*/ ≡ diff --git a/tests/spec/oracle/sizeof_logic.res.oracle b/tests/spec/oracle/sizeof_logic.res.oracle index 7431c05651b27cbd79b9da46c7329facad08a8c5..c49223e02c8726dcf68b8dedb9df8b35fbe2525d 100644 --- a/tests/spec/oracle/sizeof_logic.res.oracle +++ b/tests/spec/oracle/sizeof_logic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/sizeof_logic.i (no preprocessing) tests/spec/sizeof_logic.i:1:[kernel] warning: sizeof can only handle C types. Ignoring global annotation tests/spec/sizeof_logic.i:3:[kernel] warning: sizeof can only handle C types. Ignoring global annotation diff --git a/tests/spec/oracle/spec_zero_arg.res.oracle b/tests/spec/oracle/spec_zero_arg.res.oracle index 7dddc1c8294bbbf952d5ed397dcad77a7423f933..5f728e4a1c839751034c4118ef876b5bc08ee693 100644 --- a/tests/spec/oracle/spec_zero_arg.res.oracle +++ b/tests/spec/oracle/spec_zero_arg.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/spec_zero_arg.c (with preprocessing) /* Generated by Frama-C */ int e; diff --git a/tests/spec/oracle/statement_behavior.res.oracle b/tests/spec/oracle/statement_behavior.res.oracle index 87320d53abe14ebc5bd0bb47149cf1216ef06676..7726e36761f27408b69dd303a7013aaaacd4d155 100644 --- a/tests/spec/oracle/statement_behavior.res.oracle +++ b/tests/spec/oracle/statement_behavior.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/statement_behavior.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,7 +6,7 @@ [value] computing for function pfsqopfc <- main. Called from tests/spec/statement_behavior.c:23. -tests/spec/statement_behavior.c:13:[value] warning: assuming assembly code has no effects in function pfsqopfc +tests/spec/statement_behavior.c:10:[value] warning: no \from part for clause 'assigns five_times;' tests/spec/statement_behavior.c:17:[value] warning: assertion got status unknown. tests/spec/statement_behavior.c:4:[value] warning: function pfsqopfc: postcondition got status unknown. tests/spec/statement_behavior.c:18:[value] warning: accessing uninitialized left-value. assert \initialized(&five_times); @@ -15,12 +14,13 @@ tests/spec/statement_behavior.c:18:[value] warning: accessing uninitialized left [value] Done for function pfsqopfc [value] Recording results for main [value] done for function main -tests/spec/statement_behavior.c:18:[value] assertion 'Value,initialisation' got final status invalid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function pfsqopfc: [value:final-states] Values at end of function main: - NON TERMINATING FUNCTION + x ∈ {1} + y ∈ [--..--] + __retres ∈ {0} [inout] InOut (internal) for function pfsqopfc: Operational inputs: five_times @@ -34,4 +34,4 @@ tests/spec/statement_behavior.c:18:[value] assertion 'Value,initialisation' got Operational inputs on termination: \nothing Sure outputs: - ANYTHING(origin:Unknown) + x; y; __retres diff --git a/tests/spec/oracle/stmt_contract.res.oracle b/tests/spec/oracle/stmt_contract.res.oracle index 8959fd2f5278cc181923eb3f04fae9b79b56685c..2e4747df70f48ce2b9597abdde5c1f6df5736722 100644 --- a/tests/spec/oracle/stmt_contract.res.oracle +++ b/tests/spec/oracle/stmt_contract.res.oracle @@ -1,14 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/stmt_contract.i (no preprocessing) tests/spec/stmt_contract.i:18:[kernel] warning: \result meaningless. Ignoring loop annotation /* Generated by Frama-C */ int main(int c) { int __retres; - int x; - int y; - x = 5; - y = 2; + int x = 5; + int y = 2; /*@ requires x ≡ 5; */ /*@ requires y ≡ 2; */ x += y; @@ -38,12 +35,10 @@ int main(int c) goto return_label; } /*@ requires x ≡ 7; */ + /*@ ensures x ≡ 7; */ { - /*@ ensures x ≡ 7; */ - { - __retres = 0; - goto return_label; - } + __retres = 0; + goto return_label; } return_label: return __retres; } diff --git a/tests/spec/oracle/string.res.oracle b/tests/spec/oracle/string.res.oracle index 53b38bd7a94c32c4d6e435821d6434aa92df23dc..6ddc869aeb29fe4b1e995f6e775b9bdae7e2f0b0 100644 --- a/tests/spec/oracle/string.res.oracle +++ b/tests/spec/oracle/string.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/string.c (with preprocessing) /* Generated by Frama-C */ /*@ logic char * foo= "Styfoo"; diff --git a/tests/spec/oracle/struct_invariant.res.oracle b/tests/spec/oracle/struct_invariant.res.oracle index 3b84268fc5c67f14f2254205c268211abf274210..dd3bd8e95d9ac2207f097a2dac03355022a987a5 100644 --- a/tests/spec/oracle/struct_invariant.res.oracle +++ b/tests/spec/oracle/struct_invariant.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/struct_invariant.c (with preprocessing) tests/spec/struct_invariant.c:18:[kernel] warning: predicate u_inv is already declared with the same profile. Ignoring global annotation /* Generated by Frama-C */ diff --git a/tests/spec/oracle/tableau_zones.res.oracle b/tests/spec/oracle/tableau_zones.res.oracle index d097b5c0871387154e147341647b94c6cb7ca3d1..e005b7399c057ea9864ef8fbd98e614d4a2451ff 100644 --- a/tests/spec/oracle/tableau_zones.res.oracle +++ b/tests/spec/oracle/tableau_zones.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/tableau_zones.c (with preprocessing) /* Generated by Frama-C */ /*@ requires \valid(p); diff --git a/tests/spec/oracle/temporal.res.oracle b/tests/spec/oracle/temporal.res.oracle index f800615bdeb393a5db100dbe58140540531eaabb..c4808444f234db92d9910ef2e0d5889ba7626560 100644 --- a/tests/spec/oracle/temporal.res.oracle +++ b/tests/spec/oracle/temporal.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/temporal.i (no preprocessing) /* Generated by Frama-C */ enum aorai_States { @@ -195,28 +194,22 @@ int g(int x) aorai_CurTrans[0] = 0; aorai_CurTrans[1] = 0; aorai_CurTrans[2] = 0; - { /* sequence */ - if (G_i == 0) - if (g_calls < NB) - if (aorai_CurStates_old[3]) tmp_0 = 1; else tmp_0 = 0; - else tmp_0 = 0; + if (G_i == 0) + if (g_calls < NB) + if (aorai_CurStates_old[3]) tmp_0 = 1; else tmp_0 = 0; else tmp_0 = 0; - aorai_CurTrans[3] = tmp_0; - } - { /* sequence */ - if (G_i == 0) - if (g_calls == NB) - if (aorai_CurStates_old[3]) tmp_1 = 1; else tmp_1 = 0; - else tmp_1 = 0; + else tmp_0 = 0; + aorai_CurTrans[3] = tmp_0; + if (G_i == 0) + if (g_calls == NB) + if (aorai_CurStates_old[3]) tmp_1 = 1; else tmp_1 = 0; else tmp_1 = 0; - aorai_CurTrans[4] = tmp_1; - } - { /* sequence */ - if (G_i != 0) - if (aorai_CurStates_old[3]) tmp_2 = 1; else tmp_2 = 0; - else tmp_2 = 0; - aorai_CurTrans[5] = tmp_2; - } + else tmp_1 = 0; + aorai_CurTrans[4] = tmp_1; + if (G_i != 0) + if (aorai_CurStates_old[3]) tmp_2 = 1; else tmp_2 = 0; + else tmp_2 = 0; + aorai_CurTrans[5] = tmp_2; aorai_CurTrans[6] = 0; aorai_CurTrans[7] = 0; aorai_CurTrans[8] = 0; @@ -362,16 +355,14 @@ void f(int N) aorai_CurStates_old[S0] = 0; aorai_CurTrans[0] = 0; aorai_CurTrans[1] = 0; - { /* sequence */ - if (NB > 0) - if (g_calls < NB) - if (0 <= g_calls) - if (aorai_CurStates_old[0]) tmp = 1; else tmp = 0; - else tmp = 0; + if (NB > 0) + if (g_calls < NB) + if (0 <= g_calls) + if (aorai_CurStates_old[0]) tmp = 1; else tmp = 0; else tmp = 0; else tmp = 0; - aorai_CurTrans[2] = tmp; - } + else tmp = 0; + aorai_CurTrans[2] = tmp; aorai_CurTrans[3] = 0; aorai_CurTrans[4] = 0; aorai_CurTrans[5] = 0; @@ -430,12 +421,10 @@ void f(int N) aorai_CurStates_old[OK] = 0; aorai_CurStates_old[S0] = 0; aorai_CurTrans[0] = 0; - { /* sequence */ - if (NB <= 0) - if (aorai_CurStates_old[0]) tmp_0 = 1; else tmp_0 = 0; - else tmp_0 = 0; - aorai_CurTrans[1] = tmp_0; - } + if (NB <= 0) + if (aorai_CurStates_old[0]) tmp_0 = 1; else tmp_0 = 0; + else tmp_0 = 0; + aorai_CurTrans[1] = tmp_0; aorai_CurTrans[2] = 0; aorai_CurTrans[3] = 0; aorai_CurTrans[4] = 0; @@ -448,12 +437,10 @@ void f(int N) aorai_CurStates[S3] = 0; aorai_CurStates[S2] = 0; aorai_CurStates[S1] = 0; - { /* sequence */ - if (aorai_CurTrans[8]) tmp_1 = 1; - else - if (aorai_CurTrans[1]) tmp_1 = 1; else tmp_1 = 0; - aorai_CurStates[OK] = tmp_1; - } + if (aorai_CurTrans[8]) tmp_1 = 1; + else + if (aorai_CurTrans[1]) tmp_1 = 1; else tmp_1 = 0; + aorai_CurStates[OK] = tmp_1; aorai_CurStates[S0] = 0; return; } diff --git a/tests/spec/oracle/terminates.res.oracle b/tests/spec/oracle/terminates.res.oracle index 026c99dcbe6f4a44c9619c3fb1053036cb96b11a..08c130d7e87083338c8ed79b0204667734007c79 100644 --- a/tests/spec/oracle/terminates.res.oracle +++ b/tests/spec/oracle/terminates.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/terminates.c (with preprocessing) /* Generated by Frama-C */ /*@ terminates c > 0; diff --git a/tests/spec/oracle/transitive_rel.res.oracle b/tests/spec/oracle/transitive_rel.res.oracle index 3d8684e6524d707e5ed28329fc960b19b0bce495..01d3de4c29fc3914dd6e5199b58dbdd514d8236c 100644 --- a/tests/spec/oracle/transitive_rel.res.oracle +++ b/tests/spec/oracle/transitive_rel.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/transitive_rel.c (with preprocessing) tests/spec/transitive_rel.c:16:[kernel] warning: Inconsistent relation chain. /* Generated by Frama-C */ diff --git a/tests/spec/oracle/tsets.res.oracle b/tests/spec/oracle/tsets.res.oracle index 0038c4543468adf8a5d0c28bfaf9afdbe807bf2a..7d586ef42307d43302353eb3075bde4b31a24adf 100644 --- a/tests/spec/oracle/tsets.res.oracle +++ b/tests/spec/oracle/tsets.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/tsets.c (with preprocessing) tests/spec/tsets.c:36:[kernel] warning: sets of sets are not supported yet. Ignoring global annotation tests/spec/tsets.c:45:[kernel] warning: comparison of incompatible types: set<char> @@ -56,10 +55,8 @@ int h(int x, int c) if (c > 0) tmp_0 = x + 1; else { int tmp; - { /* sequence */ - if (c < 0) tmp = x - 1; else tmp = x; - tmp_0 = tmp; - } + if (c < 0) tmp = x - 1; else tmp = x; + tmp_0 = tmp; } return tmp_0; } diff --git a/tests/value/oracle/sep.1.err.oracle b/tests/spec/oracle/type_constructors_in_env.err.oracle similarity index 100% rename from tests/value/oracle/sep.1.err.oracle rename to tests/spec/oracle/type_constructors_in_env.err.oracle diff --git a/tests/spec/oracle/type_constructors_in_env.res.oracle b/tests/spec/oracle/type_constructors_in_env.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e0acce8ef569faf9903cc774994a836ce21c1ed5 --- /dev/null +++ b/tests/spec/oracle/type_constructors_in_env.res.oracle @@ -0,0 +1,7 @@ +[kernel] Parsing tests/spec/type_constructors_in_env.i (no preprocessing) +/* Generated by Frama-C */ +/*@ type foo = A | B; + */ +/*@ logic foo f(ℤ x) = x ≥ 0? A: B; + */ + diff --git a/tests/spec/oracle/type_of_term.res.oracle b/tests/spec/oracle/type_of_term.res.oracle index e7559ac536328102922fed96281bd6dfe225ae68..fba758a0444655bc9df34e67c54ab9c7855809ee 100644 --- a/tests/spec/oracle/type_of_term.res.oracle +++ b/tests/spec/oracle/type_of_term.res.oracle @@ -1,209 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/type_of_term.i (no preprocessing) -[type_of_term] Term: dest + (0 .. n - 1), type is set<unsigned char *> -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: 0 .. n - 1, type is set<ℤ> -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: n - 1, type is ℤ -[type_of_term] Term: n, type is ℤ -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: 1, type is ℤ -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: \old(n), type is ℤ -[type_of_term] Term: \old(n), type is unsigned long -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: *(\old(dest) + i), type is ℤ -[type_of_term] Term: *(\old(dest) + i), type is unsigned char -[type_of_term] Host: *(\old(dest) + i), type is unsigned char -[type_of_term] Offset: , type is unsigned char -[type_of_term] Lval: *(\old(dest) + i), type is unsigned char -[type_of_term] Term: \old(dest) + i, type is unsigned char * -[type_of_term] Term: \old(dest), type is unsigned char * -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: *(dest + (0 .. n - 1)), type is set<unsigned char> -[type_of_term] Host: *(dest + (0 .. n - 1)), type is set<unsigned char> -[type_of_term] Offset: , type is set<unsigned char> -[type_of_term] Lval: *(dest + (0 .. n - 1)), type is set<unsigned char> -[type_of_term] Term: dest + (0 .. n - 1), type is set<unsigned char *> -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: 0 .. n - 1, type is set<ℤ> -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: n - 1, type is ℤ -[type_of_term] Term: n, type is ℤ -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: 1, type is ℤ -[type_of_term] Term: dest + (0 .. size * n - 1), type is set<unsigned char *> -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: 0 .. size * n - 1, type is set<ℤ> -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: size * n - 1, type is ℤ -[type_of_term] Term: size * n, type is ℤ -[type_of_term] Term: size, type is ℤ -[type_of_term] Term: size, type is unsigned long -[type_of_term] Host: size, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: size, type is unsigned long -[type_of_term] Term: n, type is ℤ -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: 1, type is ℤ -[type_of_term] Term: n, type is ℤ -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: 1, type is ℤ -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: \old(size), type is ℤ -[type_of_term] Term: \old(size), type is unsigned long -[type_of_term] Term: size, type is unsigned long -[type_of_term] Host: size, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: size, type is unsigned long -[type_of_term] Term: 1, type is ℤ -[type_of_term] Term: j, type is ℤ -[type_of_term] Host: j, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: j, type is ℤ -[type_of_term] Term: j, type is ℤ -[type_of_term] Host: j, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: j, type is ℤ -[type_of_term] Term: \old(n), type is ℤ -[type_of_term] Term: \old(n), type is unsigned long -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: *(\old(dest) + (i + j * \old(size))), type is unsigned char -[type_of_term] Host: *(\old(dest) + (i + j * \old(size))), type is unsigned char -[type_of_term] Offset: , type is unsigned char -[type_of_term] Lval: *(\old(dest) + (i + j * \old(size))), type is unsigned char -[type_of_term] Term: \old(dest) + (i + j * \old(size)), type is unsigned char * -[type_of_term] Term: \old(dest), type is unsigned char * -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: i + j * \old(size), type is ℤ -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: j * \old(size), type is ℤ -[type_of_term] Term: j, type is ℤ -[type_of_term] Host: j, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: j, type is ℤ -[type_of_term] Term: \old(size), type is ℤ -[type_of_term] Term: \old(size), type is unsigned long -[type_of_term] Term: size, type is unsigned long -[type_of_term] Host: size, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: size, type is unsigned long -[type_of_term] Term: *(\old(dest) + i), type is unsigned char -[type_of_term] Host: *(\old(dest) + i), type is unsigned char -[type_of_term] Offset: , type is unsigned char -[type_of_term] Lval: *(\old(dest) + i), type is unsigned char -[type_of_term] Term: \old(dest) + i, type is unsigned char * -[type_of_term] Term: \old(dest), type is unsigned char * -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: i, type is ℤ -[type_of_term] Host: i, type is ℤ -[type_of_term] Offset: , type is ℤ -[type_of_term] Lval: i, type is ℤ -[type_of_term] Term: *(dest + (size .. size * n - 1)), type is set<unsigned char> -[type_of_term] Host: *(dest + (size .. size * n - 1)), type is set<unsigned char> -[type_of_term] Offset: , type is set<unsigned char> -[type_of_term] Lval: *(dest + (size .. size * n - 1)), type is set<unsigned char> -[type_of_term] Term: dest + (size .. size * n - 1), type is set<unsigned char *> -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: size .. size * n - 1, type is set<ℤ> -[type_of_term] Term: size, type is unsigned long -[type_of_term] Host: size, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: size, type is unsigned long -[type_of_term] Term: size * n - 1, type is ℤ -[type_of_term] Term: size * n, type is ℤ -[type_of_term] Term: size, type is ℤ -[type_of_term] Term: size, type is unsigned long -[type_of_term] Host: size, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: size, type is unsigned long -[type_of_term] Term: n, type is ℤ -[type_of_term] Term: n, type is unsigned long -[type_of_term] Host: n, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: n, type is unsigned long -[type_of_term] Term: 1, type is ℤ -[type_of_term] Term: *(dest + (0 .. size - 1)), type is set<unsigned char> -[type_of_term] Host: *(dest + (0 .. size - 1)), type is set<unsigned char> -[type_of_term] Offset: , type is set<unsigned char> -[type_of_term] Lval: *(dest + (0 .. size - 1)), type is set<unsigned char> -[type_of_term] Term: dest + (0 .. size - 1), type is set<unsigned char *> -[type_of_term] Term: dest, type is unsigned char * -[type_of_term] Host: dest, type is unsigned char * -[type_of_term] Offset: , type is unsigned char * -[type_of_term] Lval: dest, type is unsigned char * -[type_of_term] Term: 0 .. size - 1, type is set<ℤ> -[type_of_term] Term: 0, type is ℤ -[type_of_term] Term: size - 1, type is ℤ -[type_of_term] Term: size, type is ℤ -[type_of_term] Term: size, type is unsigned long -[type_of_term] Host: size, type is unsigned long -[type_of_term] Offset: , type is unsigned long -[type_of_term] Lval: size, type is unsigned long -[type_of_term] Term: 1, type is ℤ [type_of_term] Term: *(p + (..)), type is set<int> [type_of_term] Host: *(p + (..)), type is set<int> [type_of_term] Offset: , type is set<int> diff --git a/tests/spec/oracle/typedef.res.oracle b/tests/spec/oracle/typedef.res.oracle index 6641d4db7df779be1291eaee42566b098e0ce76b..e50cf68c9e09a646a5b6cf3461b6e85786870fef 100644 --- a/tests/spec/oracle/typedef.res.oracle +++ b/tests/spec/oracle/typedef.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/typedef.c (with preprocessing) /* Generated by Frama-C */ struct _list { diff --git a/tests/spec/oracle/unification.res.oracle b/tests/spec/oracle/unification.res.oracle index 41d38a9670ec682c27ea7c9d54d9b00719647d75..d7ace42a26829a34d9f6d42dc12c6767ddd5657d 100644 --- a/tests/spec/oracle/unification.res.oracle +++ b/tests/spec/oracle/unification.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/unification.c (with preprocessing) /* Generated by Frama-C */ struct _list { diff --git a/tests/spec/oracle/unused.res.oracle b/tests/spec/oracle/unused.res.oracle index 1db80164b37cb8598f73776b7f55e96ed370bb8d..c28824052ed4446fdf10c762e1d7ff2a44fe9876 100644 --- a/tests/spec/oracle/unused.res.oracle +++ b/tests/spec/oracle/unused.res.oracle @@ -1,30 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/unused.c (with preprocessing) /* Generated by Frama-C */ struct __anonstruct_T_1 { int i ; }; -/*@ requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - assigns *(dest + (0 .. n - 1)); - assigns *(dest + (0 .. n - 1)) \from \nothing; - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(unsigned char *dest, - unsigned long n); - -/*@ requires \valid(dest + (0 .. size * n - 1)); - requires n ≥ 1; - ensures - ∀ ℤ i, ℤ j; - 0 ≤ i < \old(size) ∧ 1 ≤ j < \old(n) ⇒ - *(\old(dest) + (i + j * \old(size))) ≡ *(\old(dest) + i); - assigns *(dest + (size .. size * n - 1)); - assigns *(dest + (size .. size * n - 1)) \from *(dest + (0 .. size - 1)); - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_copy_block(unsigned char *dest, - unsigned long size, - unsigned long n); - /*@ lemma toto{L}: ∀ struct __anonstruct_T_1 t; t.i ≡ 0; */ extern int G; diff --git a/tests/spec/oracle/updater.res.oracle b/tests/spec/oracle/updater.res.oracle index 14247977905f1d55a406c060574432b78e4fe098..3fca6d3c70b630f9d3630e26e111633a5de940bb 100644 --- a/tests/spec/oracle/updater.res.oracle +++ b/tests/spec/oracle/updater.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/updater.c (with preprocessing) /* Generated by Frama-C */ struct S { diff --git a/tests/spec/oracle/use.res.oracle b/tests/spec/oracle/use.res.oracle index 4fd5b944bd2869757cd935f0faf55a3ac155c008..4ccf9e44b0e96f000255a7fcf8677ac85a49dd4c 100644 --- a/tests/spec/oracle/use.res.oracle +++ b/tests/spec/oracle/use.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/use.c (with preprocessing) [kernel] Parsing tests/spec/use2.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/spec/oracle/used_before_decl_bts0109.res.oracle b/tests/spec/oracle/used_before_decl_bts0109.res.oracle index 68df20cd8078f2c64e743650b6249e7dfd3ef72e..e4d41345817b8ff34714c4abdc1c451bf699424c 100644 --- a/tests/spec/oracle/used_before_decl_bts0109.res.oracle +++ b/tests/spec/oracle/used_before_decl_bts0109.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/used_before_decl_bts0109.i (no preprocessing) tests/spec/used_before_decl_bts0109.i:3:[kernel] warning: Calling undeclared function h. Old style K&R code? /* Generated by Frama-C */ @@ -15,10 +14,8 @@ int g(void) int __retres; int tmp; int tmp_0; - { /* sequence */ - tmp = f(0); - tmp_0 = h(1); - } + tmp = f(0); + tmp_0 = h(1); __retres = tmp + tmp_0; return __retres; } diff --git a/tests/spec/oracle/va.res.oracle b/tests/spec/oracle/va.res.oracle index 4058716055e7184ffad5e07cd2d1fa35851530d7..99c67e137f360aea917e3bda16f06c0725c2e17c 100644 --- a/tests/spec/oracle/va.res.oracle +++ b/tests/spec/oracle/va.res.oracle @@ -1,6 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/va.c (with preprocessing) -tests/spec/va.c:6:[kernel] warning: The second argument in call to __builtin_va_start should be the last formal argument +tests/spec/va.c:6:[kernel] warning: The last argument in call to __builtin_va_start should be the last formal argument of main /* Generated by Frama-C */ #include "errno.h" #include "stdarg.h" diff --git a/tests/spec/oracle/volatile.res.oracle b/tests/spec/oracle/volatile.res.oracle index 1c6fb334ea124ea8732ac3f38e5420e18f374c0e..70cb1eacc33443e1a5317c115d34f565dd3e3934 100644 --- a/tests/spec/oracle/volatile.res.oracle +++ b/tests/spec/oracle/volatile.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/spec/volatile.c (with preprocessing) [kernel] Parsing tests/spec/volatile_aux.c (with preprocessing) tests/spec/volatile.c:8:[kernel] warning: Overlapping volatile specification: volatile location y already associated to a writes function in annotation at loc tests/spec/volatile.c:7. Ignoring new binding. @@ -64,8 +63,7 @@ int *p; int main(void) { int __retres; - int x_0; - x_0 = v; + int x_0 = v; v = f(x_0); __retres = 0; return __retres; diff --git a/tests/spec/prec_i.h b/tests/spec/prec_i.h index 9dcca02bdb2cfb7041777504a3eeea1051dd91cc..005829236e46fcfb54dcfefcac1909457bf9307d 100644 --- a/tests/spec/prec_i.h +++ b/tests/spec/prec_i.h @@ -4,7 +4,7 @@ #define _INCLUDE_prec_i /* - spécification de l'opérateur PREC_I + spécification de l'opérateur PREC_I _E1 : INTEGER _S1 : INTEGER diff --git a/tests/spec/preprocess.c b/tests/spec/preprocess.c index ef5081d4bf3907c46b8866e9a5a3438442561297..294c1bf784a99fafff061901d9f96c4e35b37727 100644 --- a/tests/spec/preprocess.c +++ b/tests/spec/preprocess.c @@ -1,5 +1,5 @@ /* run.config - OPT: -pp-annot -val -journal-disable + OPT: -pp-annot -val -val-show-progress -journal-disable */ // see bts 1357 diff --git a/tests/spec/prototype_assigns.c b/tests/spec/prototype_assigns.c index 2dcfe8d4c6715a397808c1edb59c4eaf6211432c..6bba4333125893466332728c3d9fc734bd6aa00a 100644 --- a/tests/spec/prototype_assigns.c +++ b/tests/spec/prototype_assigns.c @@ -3,7 +3,7 @@ /*@ assigns *p; */ -extern int f(char * p); // fonction de mise à jour qui "écrit" dans *p +extern int f(char * p); // fonction de mise à jour qui "écrit" dans *p int main(char *x) { diff --git a/tests/spec/purse.c b/tests/spec/purse.c index d7abfe580f88e4146c86bd74dfd0bd4a5d89ed23..2d444b25ee4a8baabc067e2bab89ad0fb8bc025d 100644 --- a/tests/spec/purse.c +++ b/tests/spec/purse.c @@ -2,11 +2,11 @@ /* */ /* The Why/Caduceus/Krakatoa tool suite for program certification */ /* Copyright (C) 2002-2006 */ -/* Jean-François COUCHOT */ +/* Jean-François COUCHOT */ /* Mehdi DOGGUY */ -/* Jean-Christophe FILLIÂTRE */ +/* Jean-Christophe FILLIÂTRE */ /* Thierry HUBERT */ -/* Claude MARCHÉ */ +/* Claude MARCHÉ */ /* Yannick MOY */ /* */ /* This software is free software; you can redistribute it and/or */ diff --git a/tests/spec/shifts.c b/tests/spec/shifts.c index fd5519cbb53aad075db2fb76a91d415bdacdeed6..81e3020d21d458c4505cec016e623861f46c377c 100644 --- a/tests/spec/shifts.c +++ b/tests/spec/shifts.c @@ -1,5 +1,5 @@ /* run.config - OPT: -val -deps -journal-disable + OPT: -val -val-show-progress -deps -journal-disable */ int e; diff --git a/tests/spec/statement_behavior.c b/tests/spec/statement_behavior.c index 26a7d549d7bd8a02e924da594495d0e3d044d7dd..aad0ee41a9feaf53fb283d476be35f6075dd827e 100644 --- a/tests/spec/statement_behavior.c +++ b/tests/spec/statement_behavior.c @@ -1,5 +1,5 @@ /* run.config - OPT: -val -inout -journal-disable + OPT: -val -val-show-progress -inout -journal-disable */ /*@ ensures \result == (int)(5 * x); */ diff --git a/tests/spec/type_constructors_in_env.i b/tests/spec/type_constructors_in_env.i new file mode 100644 index 0000000000000000000000000000000000000000..f60aaadd9d224592b2297d6df9eab1cf6c096d68 --- /dev/null +++ b/tests/spec/type_constructors_in_env.i @@ -0,0 +1,8 @@ +/* run.config +EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs +OPT: -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs +*/ + +/*@ type foo = A | B; */ + +/*@ logic foo f(integer x) = x>=0 ? A : B; */ diff --git a/tests/spec/type_constructors_in_env.ml b/tests/spec/type_constructors_in_env.ml new file mode 100644 index 0000000000000000000000000000000000000000..5d64434081c91a1fb7c2c49b61b33b447331e6ed --- /dev/null +++ b/tests/spec/type_constructors_in_env.ml @@ -0,0 +1,11 @@ +let run () = + Ast.compute (); + (match Logic_env.find_all_logic_functions "f" with + | [] -> Kernel.fatal "f should be in the environment" + | _ -> ()); + (try + ignore (Logic_env.find_logic_ctor "A") + with Not_found -> Kernel.fatal "A should be in the environment"); + File.pretty_ast () + +let () = Db.Main.extend run diff --git a/tests/syntax/Refresh_visitor.i b/tests/syntax/Refresh_visitor.i index d1d47c141d8421527eff9920cf6010dd6c97ee64..1862ff45eac014d0edeb5fbbcf9d1211b4173255 100644 --- a/tests/syntax/Refresh_visitor.i +++ b/tests/syntax/Refresh_visitor.i @@ -1,6 +1,6 @@ /* run.config EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs -OPT: -load-module @PTEST_DIR@/@PTEST_NAME@ +OPT: -load-module @PTEST_DIR@/@PTEST_NAME@ -val-show-progress */ struct S { int i; }; diff --git a/tests/syntax/Refresh_visitor.ml b/tests/syntax/Refresh_visitor.ml index 8c0fe228739d3d748fc25b9d4b34c70ce3baa973..62d1bc3b76e5fc2534d486b563e18866ca3be42c 100644 --- a/tests/syntax/Refresh_visitor.ml +++ b/tests/syntax/Refresh_visitor.ml @@ -70,7 +70,10 @@ let main () = shared_id; end ); - Project.on p !Db.Value.compute (); + Project.on p (fun () -> + Dynamic.Parameter.Bool.set "-val-show-progress" true; + !Db.Value.compute () + ) (); File.pretty_ast ~prj:p () let () = Db.Main.extend main diff --git a/tests/syntax/attributes-declarations-definitions.c b/tests/syntax/attributes-declarations-definitions.c new file mode 100644 index 0000000000000000000000000000000000000000..f090ff912c4773b6d1d3d96dba6be6f682f2c7fd --- /dev/null +++ b/tests/syntax/attributes-declarations-definitions.c @@ -0,0 +1,43 @@ +//@ requires p1 >= 1; +int __attribute__((tret1)) f(int __attribute__((arg1)) p1) __attribute__((f1)); + +//@ requires p2 >= 1; // identical to previous contract +int __attribute__((tret2)) f(int __attribute__((arg2)) const volatile p2) __attribute__((f2)); + +//@ requires p3 >= 3; +int __attribute__((tret3)) f(int __attribute__((arg3)) const p3) +// note: GCC forbids declaring function attributes in function definitions, +// so we cannot add '__attribute__((f3))' here +{ + return p3; +} + +//@ requires p4 >= 4; +int __attribute__((tret4)) f(int __attribute__((arg4)) volatile p4) __attribute__((f4)); + +int __attribute__((tret5)) f() __attribute__((f5)); + +typedef int __attribute__((a1)) aint; + +aint g(); + +aint g(const aint i1); + +volatile aint g(volatile aint i2); + +aint g(int __attribute__((a2)) i3) { + return i3; +} + + +typedef int __attribute__((p1))* __attribute__((p2)) iptr; + +iptr volatile h(const iptr ip1); + +iptr const h(); + +iptr h(volatile iptr ip2) { + return 0; +} + +iptr volatile h(const iptr ip3); diff --git a/tests/syntax/builtin_constant_p.i b/tests/syntax/builtin_constant_p.i new file mode 100644 index 0000000000000000000000000000000000000000..496dd4157853803950e8c7bd51536876ded08f58 --- /dev/null +++ b/tests/syntax/builtin_constant_p.i @@ -0,0 +1,5 @@ +int __builtin_constant_p(int a) { return a; } + +void main() { + __builtin_constant_p(1==1 && 1 || (1 & 1)); +} diff --git a/tests/syntax/composite-tags.i b/tests/syntax/composite-tags.i new file mode 100644 index 0000000000000000000000000000000000000000..b823ffdf4a1ca5ad657d491848a0aa9a2a5f43fe --- /dev/null +++ b/tests/syntax/composite-tags.i @@ -0,0 +1,11 @@ +struct s1 { int a; }; +struct s2 { int a; }; + +int f (struct s1); +int f (struct s2); + +union u1 { int a; }; +union u2 { int a; }; + +int g (union u1); +int g (union u2); diff --git a/tests/syntax/copy_visitor.i b/tests/syntax/copy_visitor.i index b71ecf2d43af1e8a4c8750bc209e1e812a223110..aa7979e8dbbf1d63adc60dcd671062ce1aa9f8cb 100644 --- a/tests/syntax/copy_visitor.i +++ b/tests/syntax/copy_visitor.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-copy" +"-val" + STDOPT: +"-copy -val -val-show-progress" */ struct S { int a; diff --git a/tests/syntax/extern_init.i b/tests/syntax/extern_init.i index 252a4f522f148175240bee167bd4e8c3abedcc30..f89039fe9960277efba6698e2db4628e804de50e 100644 --- a/tests/syntax/extern_init.i +++ b/tests/syntax/extern_init.i @@ -1,6 +1,6 @@ /* run.config -OPT: @PTEST_DIR@/@PTEST_NAME@_1.i @PTEST_DIR@/@PTEST_NAME@_2.i -val -OPT: @PTEST_DIR@/@PTEST_NAME@_2.i @PTEST_DIR@/@PTEST_NAME@_1.i -val +OPT: @PTEST_DIR@/@PTEST_NAME@_1.i @PTEST_DIR@/@PTEST_NAME@_2.i -val -val-show-progress +OPT: @PTEST_DIR@/@PTEST_NAME@_2.i @PTEST_DIR@/@PTEST_NAME@_1.i -val -val-show-progress */ extern int a[] ; diff --git a/tests/syntax/incompatible_qualifiers.c b/tests/syntax/incompatible_qualifiers.c new file mode 100644 index 0000000000000000000000000000000000000000..66371e18b3a593d348c816860bcb5fa6487964ce --- /dev/null +++ b/tests/syntax/incompatible_qualifiers.c @@ -0,0 +1,98 @@ +/*run.config + STDOPT: + STDOPT: #"-cpp-extra-args='-DNOERROR'" + */ +// Note: some of the declarations below are accepted by GCC 7.1.1 with -std=c11 +// (but not -std=c99), mainly due to this warning (use -Wextra to see it): +// warning: type qualifiers ignored on function return type + +int f(int a, char volatile *b); +#ifndef NOERROR +int f(int a, char *b); // conflicting types for 'f' +#endif + +int g(int volatile a, char b); +int g(int a, char b); // allowed + +void h(const char[]); +#ifndef NOERROR +void h(char[]); // conflicting types for 'h' +#endif + +void i(int *f(int)); +void i(int *const f(volatile int)); // allowed + +void j(int *f(int[])); +#ifndef NOERROR +void j(int *f(int const[])); // conflicting types for 'j' +#endif + +void k(int *const f(int)); +const void k(int *f(volatile int)); // accepted by GCC 7.1.1 with -std=c11 + +typedef volatile int(*fp1)(char); +typedef int(*fp2)(const char); + +fp1 *l(int *f(int)); +#ifndef NOERROR +fp2 *l(const int *f(volatile int)); // conflicting types for 'l' +#endif + +fp1 **const m(int *const f(int)); +fp2 **m(int *f(volatile int)); // accepted by GCC 7.1.1 with -std=c11 + +fp1 *const *n(int *f(int, fp1 *[])); +#ifndef NOERROR +fp2 *const *n(int *f(volatile int, fp2 *const[])); // conflicting types for 'n' +#endif + +void o(char r1, char r2); +#ifndef NOERROR +void o(restrict char r1, restrict char r2); +#endif + +void p(const int a); +void p(int a); +void p(volatile int a); + +typedef int* iptr; + +void q(const iptr p); +void q(volatile iptr p); // allowed + +void r(fp1 f, fp1 g); +#ifndef NOERROR +void r(restrict fp1 f, restrict fp2 g); +#endif + +typedef int *restrict irptr; +void s(irptr p1, irptr p2); +#ifndef NOERROR +void s(restrict irptr p1, restrict irptr p2); +typedef int restrict* riptr; +int restrict rga[1]; +int restrict *rgp; +int restrict rgi; +typedef int restrict (*fp3)(const char); +typedef int (*restrict fp4)(const char); +#endif +int *restrict *restrict iprpr; +int *restrict matrix[1]; + +int main() { + f(0, 0); + g(0, 0); + h(0); + i(0); + j(0); + k(0); + l(0); + m(0); + n(0); + o(0, 0); + p(0); + q(0); + r(0, 0); + s(0, 0); + return 0; +} diff --git a/tests/syntax/invalid_constant.i b/tests/syntax/invalid_constant.i index 0d9c6b12e2a435e497145e77a5797b38f694de1e..5f429de862630c8597a556e77917bc234a7caee0 100644 --- a/tests/syntax/invalid_constant.i +++ b/tests/syntax/invalid_constant.i @@ -1,2 +1,2 @@ /* Invalid octal constant */ -int = 0123456789; +int i = 0123456789; diff --git a/tests/syntax/literal-question-no-trigraph.c b/tests/syntax/literal-question-no-trigraph.c new file mode 100644 index 0000000000000000000000000000000000000000..9598e1e8fd95a32185af0427c90b14e0ad36d042 --- /dev/null +++ b/tests/syntax/literal-question-no-trigraph.c @@ -0,0 +1,15 @@ +/* run.config + STDOPT: #"-cpp-extra-args=-Wno-trigraphs" + STDOPT: #"-cpp-extra-args='-trigraphs -Wno-trigraphs'" +*/ +int main() { + char *s1 = "??"; + char *s2 = "??="; + char *s3 = "???"; + char *s4 = "????"; + char *s5 = "?\?\?="; + char *s6 = "??\?="; + char *s7 = "?\??\???=?\?=\\??=?"; + char *s8 = "??\\??="; + return 0; +} diff --git a/tests/syntax/loop-case-switch-for-unroll.c b/tests/syntax/loop-case-switch-for-unroll.c new file mode 100644 index 0000000000000000000000000000000000000000..7ff0d344b7339b5fcb675fb62c1c6d984c13eff8 --- /dev/null +++ b/tests/syntax/loop-case-switch-for-unroll.c @@ -0,0 +1,87 @@ +/* run.config + STDOPT: +"-slevel 100 -val" + STDOPT: +"-ulevel 1 -slevel 100 -val" + STDOPT: +"-ulevel 2 -slevel 100 -val" + COMMENT: compile and run with GCC, save output to a file, and compare it to + the result of Frama-C piped to: + "| grep Frama_C_show_each | sed 's/^.*Frama_C_show_each_//'" +*/ + +#ifdef __FRAMAC__ +#define print(line, s, a) Frama_C_show_each_ ## s ## _(a) +#else +#include <stdio.h> +#define STR(a) _STR(a) +#define _STR(a) #a +#define print(line, s, a) printf("%s_: {%d}\n", STR(s), a) +#endif + +int gen_nondet(int line) { + static int vals[] = + { 1, // goto L1 + 42, // j + 5, // >10? + 1, // goto L + 43, // j + 11, // >10? + 0, // no jump + 1, // goto L0 + 0, // no jump + 44, // j + 12, // >10? + 0, // no jump + 0, // no jump + 1, // goto L3 + 1, // goto L1 + 45, // j + 11, // >10? + 0, 0, 0, // no jump + 0, // no jump + 46, // j + 13, // >10? + 0, 0, 0, // no jump + 0, // no jump + 47, // j + 12, // >10? + 0, 0, 0, // no jump + 48, // j + 15, // >10? + 0, 0, 0, // no jump + }; + static int i = -1; + i = (i+1)%(sizeof(vals)/sizeof(int)); + print(line, nondet, vals[i]); + return vals[i]; +} + +#define nondet() gen_nondet(__LINE__) + +void main() { + int y = 32; + int x; + int n = 3; + L0: switch(1) { + case 0: + L3: + print(__LINE__, n, n); + if (nondet()) goto L; + if (nondet()) goto L1; + do { + case 1: + if (nondet()) goto L1; + L: x = y; + case 2: + for (int i = 0, j; i < 4; i++) { + L1: + j = nondet(); + if (nondet() > 10) i = 10; else i = 0; + print(__LINE__, i, i); + if (nondet()) goto L; + if (nondet()) goto L0; + if (nondet()) goto L3; + } + } while(--n > 0); + print(__LINE__, y, y); + print(__LINE__, x, x); + } +} diff --git a/tests/syntax/no-print-libc-reparse.c b/tests/syntax/no-print-libc-reparse.c new file mode 100644 index 0000000000000000000000000000000000000000..bf0b39507c3aa985e8c30eef3ab7c52166399f8a --- /dev/null +++ b/tests/syntax/no-print-libc-reparse.c @@ -0,0 +1,12 @@ +/*run.config + STDOPT: #"-no-print-libc -print -ocode @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.c -then @PTEST_DIR@/result/ocode_@PTEST_NUMBER@_@PTEST_NAME@.c" +*/ + +// tests that using -no-print-libc on a file with an enum produces output that +// is reparsable by Frama-C + +#include <netinet/in.h> + +int main() { + return IPPROTO_ICMP; // force the enum to be used +} diff --git a/tests/syntax/oracle/Refresh_visitor.res.oracle b/tests/syntax/oracle/Refresh_visitor.res.oracle index 971382afc23bd0ab1c253fae4a8df2968a2939b6..debd2e6209d27b70454e88691ceaaaefb3209c11 100644 --- a/tests/syntax/oracle/Refresh_visitor.res.oracle +++ b/tests/syntax/oracle/Refresh_visitor.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/Refresh_visitor.i (no preprocessing) Start [value] Analyzing a complete application starting at main @@ -28,14 +27,11 @@ struct matrix { /*@ ensures \result ≥ \old(x.i); */ int main(struct S x, struct matrix m) { - int y; - int i; - int j; struct matrix m_t; - y = x.i; + int y = x.i; /*@ assert y ≡ x.i; */ ; - i = 0; - j = 0; + int i = 0; + int j = 0; i = 0; /*@ loop invariant 0 ≤ i ≤ 2; loop invariant 0 ≤ j ≤ 2; diff --git a/tests/syntax/oracle/access_volatile_bts1589.res.oracle b/tests/syntax/oracle/access_volatile_bts1589.res.oracle index aa7204240dd57c606e3a1c723570b41ea1516337..0cb23a5ba27b3953a1bd16eb8941cdd5d3b54d45 100644 --- a/tests/syntax/oracle/access_volatile_bts1589.res.oracle +++ b/tests/syntax/oracle/access_volatile_bts1589.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/access_volatile_bts1589.i (no preprocessing) /* Generated by Frama-C */ typedef int volatile vi; @@ -14,14 +13,10 @@ struct volatile_struct vs; int main(void) { int __retres; - int tmp; - int tmp_3; - int tmp_5; - int tmp_7; - tmp = x; - tmp_3 = y; - tmp_5 = vs.a; - tmp_7 = vs.b; + int tmp = x; + int tmp_3 = y; + int tmp_5 = vs.a; + int tmp_7 = vs.b; __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/add_allocates.res.oracle b/tests/syntax/oracle/add_allocates.res.oracle index 4842522335204575d2451ab7ac1c14e3d524ef28..5ff258a9f6c0e5abeb4dc5ef11c8a04ff2211f4c 100644 --- a/tests/syntax/oracle/add_allocates.res.oracle +++ b/tests/syntax/oracle/add_allocates.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/add_allocates.i (no preprocessing) /* Generated by Frama-C */ int x; @@ -19,10 +18,9 @@ void main(int c) /*@ loop allocates \nothing; */ while (c) { /*@ loop allocates x; */ - while (1) { + while (1) /*@ loop allocates \nothing; */ while (! c) ; - } /*@ loop allocates \nothing; for b: loop allocates x; */ while (1) ; diff --git a/tests/syntax/oracle/aggressive_merging_1.res.oracle b/tests/syntax/oracle/aggressive_merging_1.res.oracle index ab4f0fc146c7509a0e42c5437e6a697fe3aaa951..32f267ee02eb9e9eba94f803b1652ff94f700e0b 100644 --- a/tests/syntax/oracle/aggressive_merging_1.res.oracle +++ b/tests/syntax/oracle/aggressive_merging_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/aggressive_merging_1.i (no preprocessing) [kernel] Parsing tests/syntax/aggressive_merging_2.i (no preprocessing) /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/arg_type.res.oracle b/tests/syntax/oracle/arg_type.res.oracle index 43c1920be9beef85ffbac0ef837d8234e4aca5fe..430f4c57d17cd00f57f49291c1f7e7203d5be81e 100644 --- a/tests/syntax/oracle/arg_type.res.oracle +++ b/tests/syntax/oracle/arg_type.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/arg_type.i (no preprocessing) tests/syntax/arg_type.i:15:[kernel] user error: Declaration of g does not match previous declaration from tests/syntax/arg_type.i:13 (different integer types: 'int' and 'short'). diff --git a/tests/syntax/oracle/array_cast_bts1099.res.oracle b/tests/syntax/oracle/array_cast_bts1099.res.oracle index 9c5200acf4f2d637296dbc8ae70b9b9e91b653f7..dbb7d7ed6ed10ef223ac9e4153c1c66dbdccc788 100644 --- a/tests/syntax/oracle/array_cast_bts1099.res.oracle +++ b/tests/syntax/oracle/array_cast_bts1099.res.oracle @@ -1,5 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/array_cast_bts1099.i (no preprocessing) tests/syntax/array_cast_bts1099.i:7:[kernel] user error: Cast over a non-scalar type int [10] + 5 int tab1[4]; + 6 u* p = &tab1; + 7 t* p2 = (t) p; + ^^^^^^^^^^^^^^^^ + 8 } [kernel] user error: stopping on file "tests/syntax/array_cast_bts1099.i" that has errors. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/array_size_float.res.oracle b/tests/syntax/oracle/array_size_float.res.oracle index cbf4c256c0d0ae208ea793936c9a016f81006d27..bb688151ab05203c8300cee29bf200e8a173bd47 100644 --- a/tests/syntax/oracle/array_size_float.res.oracle +++ b/tests/syntax/oracle/array_size_float.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/array_size_float.i (no preprocessing) tests/syntax/array_size_float.i:1:[kernel] warning: Floating-point constant 50.1 is not represented exactly. Will use 0x1.90ccccccccccdp5. See documentation for option -warn-decimal-float tests/syntax/array_size_float.i:2:[kernel] warning: Unable to do constant-folding on array length (int)6000000000000.1. Some CIL operations on this array may fail. diff --git a/tests/syntax/oracle/asm_goto.res.oracle b/tests/syntax/oracle/asm_goto.res.oracle index 272b5216fe2ab79efff40cf88c162f23def9fbb0..6adad0703a4b063ba99f11a63fa53fd9f07b281a 100644 --- a/tests/syntax/oracle/asm_goto.res.oracle +++ b/tests/syntax/oracle/asm_goto.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/asm_goto.i (no preprocessing) /* Generated by Frama-C */ int main(unsigned short bit) diff --git a/tests/syntax/oracle/asm_with_contracts.res.oracle b/tests/syntax/oracle/asm_with_contracts.res.oracle index ee1bb0f7b8356913057fe9a4d56ef3143be1b00a..915bed6e6f7a47e1bf4858a7377f09fdafd66425 100644 --- a/tests/syntax/oracle/asm_with_contracts.res.oracle +++ b/tests/syntax/oracle/asm_with_contracts.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/asm_with_contracts.i (no preprocessing) /* Generated by Frama-C */ /*@ behavior b: @@ -6,10 +5,8 @@ ensures \true; */ int f(int z) { - int x; - int y; - x = z; - y = 2; + int x = z; + int y = 2; /*@ assigns y; */ __asm__ ("mov %1, %0\n\t" : "=r" (y) : "r" (x)); /*@ assigns x; diff --git a/tests/syntax/oracle/assembly_gmp.0.res.oracle b/tests/syntax/oracle/assembly_gmp.0.res.oracle index 459a57d25f8b5561f46993bd9049a11390c35235..68a66ec5dc807adde9c7b60fa3764fddf2cea32e 100644 --- a/tests/syntax/oracle/assembly_gmp.0.res.oracle +++ b/tests/syntax/oracle/assembly_gmp.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/assembly_gmp.c (with preprocessing) tests/syntax/assembly_gmp.c:137:[kernel] warning: Calling undeclared function USItype. Old style K&R code? /* Generated by Frama-C */ @@ -38,10 +37,8 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, B2modb = *(bmodb + 3); B2mb = B2modb - b; { - UDItype __m0; - UDItype __m1; - __m0 = (unsigned long)r1; - __m1 = (unsigned long)B2modb; + UDItype __m0 = (unsigned long)r1; + UDItype __m1 = (unsigned long)B2modb; /*@ assigns p1; assigns p1 \from r1, B2modb; */ __asm__ ("umulh %r1,%2,%0" : "=r" (p1) : "%rJ" (r1), "rI" (B2modb)); @@ -72,10 +69,8 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, int tmp_5; int tmp_6; { - UDItype __m0_0; - UDItype __m1_0; - __m0_0 = (unsigned long)r1; - __m1_0 = (unsigned long)B2modb; + UDItype __m0_0 = (unsigned long)r1; + UDItype __m1_0 = (unsigned long)B2modb; /*@ assigns p1; assigns p1 \from r1, B2modb; */ __asm__ ("umulh %r1,%2,%0" : "=r" (p1) : "%rJ" (r1), "rI" (B2modb)); @@ -107,13 +102,10 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, cnt = (int)*(bmodb + 1); if (cnt != 0) { mp_limb_t t; - mp_limb_t B1modb_0; - B1modb_0 = *(bmodb + 2); + mp_limb_t B1modb_0 = *(bmodb + 2); { - UDItype __m0_1; - UDItype __m1_1; - __m0_1 = (unsigned long)r1; - __m1_1 = (unsigned long)B1modb_0; + UDItype __m0_1 = (unsigned long)r1; + UDItype __m1_1 = (unsigned long)B1modb_0; /*@ assigns r1; assigns r1 \from r1, B1modb_0; */ __asm__ ("umulh %r1,%2,%0" : "=r" (r1) : "%rJ" (r1), "rI" (B1modb_0)); @@ -125,8 +117,7 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, r0 <<= cnt; } else { - mp_limb_t mask; - mask = - ((long)(r1 >= b)); + mp_limb_t mask = - ((long)(r1 >= b)); r1 -= mask & b; } bi = *(bmodb + 0); diff --git a/tests/syntax/oracle/assembly_gmp.1.res.oracle b/tests/syntax/oracle/assembly_gmp.1.res.oracle index e2401d58cc2ef1728dbe2352f7896f07e2ced29b..d0f7d4a964d2835b3433433aed9359140aa014d1 100644 --- a/tests/syntax/oracle/assembly_gmp.1.res.oracle +++ b/tests/syntax/oracle/assembly_gmp.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/assembly_gmp.c (with preprocessing) /* Generated by Frama-C */ #include "stddef.h" @@ -31,10 +30,8 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, B2modb = *(bmodb + 3); B2mb = B2modb - b; { - UDItype __m0; - UDItype __m1; - __m0 = (unsigned long)r1; - __m1 = (unsigned long)B2modb; + UDItype __m0 = (unsigned long)r1; + UDItype __m1 = (unsigned long)B2modb; /*@ assigns p1; assigns p1 \from r1, B2modb; */ __asm__ ("umulh %r1,%2,%0" : "=r" (p1) : "%rJ" (r1), "rI" (B2modb)); @@ -59,10 +56,8 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, { mp_limb_t cy; { - UDItype __m0_0; - UDItype __m1_0; - __m0_0 = (unsigned long)r1; - __m1_0 = (unsigned long)B2modb; + UDItype __m0_0 = (unsigned long)r1; + UDItype __m1_0 = (unsigned long)B2modb; /*@ assigns p1; assigns p1 \from r1, B2modb; */ __asm__ ("umulh %r1,%2,%0" : "=r" (p1) : "%rJ" (r1), "rI" (B2modb)); @@ -91,13 +86,10 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, cnt = (int)*(bmodb + 1); if (cnt != 0) { mp_limb_t t; - mp_limb_t B1modb_0; - B1modb_0 = *(bmodb + 2); + mp_limb_t B1modb_0 = *(bmodb + 2); { - UDItype __m0_1; - UDItype __m1_1; - __m0_1 = (unsigned long)r1; - __m1_1 = (unsigned long)B1modb_0; + UDItype __m0_1 = (unsigned long)r1; + UDItype __m1_1 = (unsigned long)B1modb_0; /*@ assigns r1; assigns r1 \from r1, B1modb_0; */ __asm__ ("umulh %r1,%2,%0" : "=r" (r1) : "%rJ" (r1), "rI" (B1modb_0)); @@ -109,8 +101,7 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, r0 <<= cnt; } else { - mp_limb_t mask; - mask = - ((long)(r1 >= b)); + mp_limb_t mask = - ((long)(r1 >= b)); r1 -= mask & b; } bi = *(bmodb + 0); diff --git a/tests/syntax/oracle/assembly_gmp.2.res.oracle b/tests/syntax/oracle/assembly_gmp.2.res.oracle index 75c56c592c250af4aa62fe78598d19b2c3751280..ef57ba24fefff9b8d01c61251263c3b47b5032a1 100644 --- a/tests/syntax/oracle/assembly_gmp.2.res.oracle +++ b/tests/syntax/oracle/assembly_gmp.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/assembly_gmp.c (with preprocessing) /* Generated by Frama-C */ #include "stddef.h" @@ -31,10 +30,8 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, B2modb = *(bmodb + 3); B2mb = B2modb - b; { - UDItype __m0; - UDItype __m1; - __m0 = (unsigned long)r1; - __m1 = (unsigned long)B2modb; + UDItype __m0 = (unsigned long)r1; + UDItype __m1 = (unsigned long)B2modb; /*@ assigns p1; assigns p1 \from r1, B2modb; */ __asm__ ("umulh %r1,%2,%0" : "=r" (p1) : "%rJ" (r1), "rI" (B2modb)); @@ -58,10 +55,8 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, { mp_limb_t cy; { - UDItype __m0_0; - UDItype __m1_0; - __m0_0 = (unsigned long)r1; - __m1_0 = (unsigned long)B2modb; + UDItype __m0_0 = (unsigned long)r1; + UDItype __m1_0 = (unsigned long)B2modb; /*@ assigns p1; assigns p1 \from r1, B2modb; */ __asm__ ("umulh %r1,%2,%0" : "=r" (p1) : "%rJ" (r1), "rI" (B2modb)); @@ -90,13 +85,10 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, cnt = (int)*(bmodb + 1); if (cnt != 0) { mp_limb_t t; - mp_limb_t B1modb_0; - B1modb_0 = *(bmodb + 2); + mp_limb_t B1modb_0 = *(bmodb + 2); { - UDItype __m0_1; - UDItype __m1_1; - __m0_1 = (unsigned long)r1; - __m1_1 = (unsigned long)B1modb_0; + UDItype __m0_1 = (unsigned long)r1; + UDItype __m1_1 = (unsigned long)B1modb_0; /*@ assigns r1; assigns r1 \from r1, B1modb_0; */ __asm__ ("umulh %r1,%2,%0" : "=r" (r1) : "%rJ" (r1), "rI" (B1modb_0)); @@ -108,8 +100,7 @@ mp_limb_t mpn_mod_1_1p(mp_srcptr ap, mp_size_t n, mp_limb_t b, r0 <<= cnt; } else { - mp_limb_t mask; - mask = - ((long)(r1 >= b)); + mp_limb_t mask = - ((long)(r1 >= b)); r1 -= mask & b; } bi = *(bmodb + 0); diff --git a/tests/syntax/oracle/ast_init.res.oracle b/tests/syntax/oracle/ast_init.res.oracle index 7cea4a08950f0f07e058a449a0922a290b25933c..94869108ac40a72afe1221d3ff51e1b4720de511 100644 --- a/tests/syntax/oracle/ast_init.res.oracle +++ b/tests/syntax/oracle/ast_init.res.oracle @@ -1,9 +1,7 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/ast_init.i (no preprocessing) /* Generated by Frama-C */ int f(int x) { - ; return x; } diff --git a/tests/value/oracle/sep.2.err.oracle b/tests/syntax/oracle/attributes-declarations-definitions.err.oracle similarity index 100% rename from tests/value/oracle/sep.2.err.oracle rename to tests/syntax/oracle/attributes-declarations-definitions.err.oracle diff --git a/tests/syntax/oracle/attributes-declarations-definitions.res.oracle b/tests/syntax/oracle/attributes-declarations-definitions.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..7b3cd9422f648cda33c0ed96cf82ad4358b99e53 --- /dev/null +++ b/tests/syntax/oracle/attributes-declarations-definitions.res.oracle @@ -0,0 +1,43 @@ +[kernel] Parsing tests/syntax/attributes-declarations-definitions.c (with preprocessing) +tests/syntax/attributes-declarations-definitions.c:1:[kernel] warning: found two contracts. Merging them +tests/syntax/attributes-declarations-definitions.c:8:[kernel] warning: found two contracts. Merging them +/* Generated by Frama-C */ +typedef int __attribute__((__a1__)) aint; +typedef int __attribute__((__p1__)) * __attribute__((__p2__)) iptr; +int __attribute__((__tret5__, __tret4__, __tret3__, __tret2__, __tret1__)) f( +int const __attribute__((__arg3__)) p4) __attribute__((__f5__, __f4__, + __f2__, __f1__)); + +/*@ requires p4 ≥ 3; + requires p4 ≥ 1; + requires p4 ≥ 4; */ +int __attribute__((__tret5__, __tret4__, __tret3__, __tret2__, __tret1__)) f( +int const __attribute__((__arg3__)) p4) __attribute__((__f5__, __f4__, + __f2__, __f1__)); +int __attribute__((__tret5__, __tret4__, __tret3__, __tret2__, __tret1__)) f( +int const __attribute__((__arg3__)) p4) +{ + int __attribute__((__tret5__, __tret4__, __tret3__, __tret2__, __tret1__)) __retres; + __retres = (int __attribute__((__tret3__, __tret2__, __tret1__)))p4; + return __retres; +} + +aint g(int __attribute__((__a2__)) i3); + +aint g(int __attribute__((__a2__)) i3) +{ + aint __retres; + __retres = (int __attribute__((__a1__)))i3; + return __retres; +} + +iptr h(iptr volatile ip3); + +iptr h(iptr volatile ip3) +{ + iptr __retres; + __retres = (int __attribute__((__p1__)) *)0; + return __retres; +} + + diff --git a/tests/syntax/oracle/axiomatic_nested.res.oracle b/tests/syntax/oracle/axiomatic_nested.res.oracle index 156e4ea3d5bb3c5e413f8dd64a2e3f1d96e77c27..44e2bb24b455886206d26d2511499deec50ef9b9 100644 --- a/tests/syntax/oracle/axiomatic_nested.res.oracle +++ b/tests/syntax/oracle/axiomatic_nested.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/axiomatic_nested.i (no preprocessing) tests/syntax/axiomatic_nested.i:4:[kernel] user error: nested axiomatics are not allowed in ACSL [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/bad_return_bts_599.res.oracle b/tests/syntax/oracle/bad_return_bts_599.res.oracle index c1c13ab7606ab02f8fcc2ebe41ad13115dbca68c..21bbd048d0c32bd47e4cd33b55ad5c7e1efd5c63 100644 --- a/tests/syntax/oracle/bad_return_bts_599.res.oracle +++ b/tests/syntax/oracle/bad_return_bts_599.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bad_return_bts_599.i (no preprocessing) tests/syntax/bad_return_bts_599.i:4:[kernel] user error: Return statement without a value in function returning int tests/syntax/bad_return_bts_599.i:9:[kernel] user error: Return statement without a value in function returning int diff --git a/tests/syntax/oracle/basic_asm.res.oracle b/tests/syntax/oracle/basic_asm.res.oracle index 642aacf28f788cd5ffd6e76af1e6e81f984c8e92..872e32640e4c700b61057b52ba89c78af8a4a37e 100644 --- a/tests/syntax/oracle/basic_asm.res.oracle +++ b/tests/syntax/oracle/basic_asm.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/basic_asm.i (no preprocessing) /* Generated by Frama-C */ int main(unsigned short bit) diff --git a/tests/syntax/oracle/bts0323.res.oracle b/tests/syntax/oracle/bts0323.res.oracle index 0adc62d0bc4d91819efa7efb25322cb1b923ca6f..1b93b42634b94e4721d44fb400097af3ac7a396d 100644 --- a/tests/syntax/oracle/bts0323.res.oracle +++ b/tests/syntax/oracle/bts0323.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0323.c (with preprocessing) [kernel] Parsing tests/syntax/bts0323-2.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/bts0442-2.res.oracle b/tests/syntax/oracle/bts0442-2.res.oracle index ea9025450caed55a2477c5823f1c12978b9c7151..f33346dd09ab10e97fe7c00ffccfc0abf8743aab 100644 --- a/tests/syntax/oracle/bts0442-2.res.oracle +++ b/tests/syntax/oracle/bts0442-2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0442-2.i (no preprocessing) [kernel] Parsing tests/syntax/bts0442.i (no preprocessing) [kernel] warning: merging definitions of enum E using int type diff --git a/tests/syntax/oracle/bts0442.res.oracle b/tests/syntax/oracle/bts0442.res.oracle index fa61b324cf521deda3477fecff4849b33b4ff942..1430b4bad44849e219f8a23bccee37827d9c2ab8 100644 --- a/tests/syntax/oracle/bts0442.res.oracle +++ b/tests/syntax/oracle/bts0442.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0442.i (no preprocessing) [kernel] Parsing tests/syntax/bts0442-2.i (no preprocessing) [kernel] warning: merging definitions of enum E using int type diff --git a/tests/syntax/oracle/bts0519.0.res.oracle b/tests/syntax/oracle/bts0519.0.res.oracle index 8d6c08b49ba2da22409f1319dab3e8e67a2674a9..6067683d651f634b92190a87326f54d3d582f447 100644 --- a/tests/syntax/oracle/bts0519.0.res.oracle +++ b/tests/syntax/oracle/bts0519.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0519.c (with preprocessing) /* Generated by Frama-C */ int t[4]; diff --git a/tests/syntax/oracle/bts0519.1.res.oracle b/tests/syntax/oracle/bts0519.1.res.oracle index df4481551f8428fa8f9f2fc58142885d2fb5574d..322c5c6bc65e90553e891d04b7c70c4b5d5348a0 100644 --- a/tests/syntax/oracle/bts0519.1.res.oracle +++ b/tests/syntax/oracle/bts0519.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0519.c (with preprocessing) tests/syntax/bts0519.c:9:[kernel] user error: static specifier inside array argument is allowed only in function argument [kernel] user error: stopping on file "tests/syntax/bts0519.c" that has errors. Add diff --git a/tests/syntax/oracle/bts0577.res.oracle b/tests/syntax/oracle/bts0577.res.oracle index 3d21365578c2dcae639248dcf7c1a4bd67c7b1be..1e57ae66a14c3c625a0331d935043fff1cba9aa1 100644 --- a/tests/syntax/oracle/bts0577.res.oracle +++ b/tests/syntax/oracle/bts0577.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0577.i (no preprocessing) /* Generated by Frama-C */ enum __anonenum_E1_1 { diff --git a/tests/syntax/oracle/bts0588.res.oracle b/tests/syntax/oracle/bts0588.res.oracle index 4b5c5bb822c96ab918a0f2e973d8af43df112fb9..974690514254374dffaeac43e79345266621c961 100644 --- a/tests/syntax/oracle/bts0588.res.oracle +++ b/tests/syntax/oracle/bts0588.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0588.i (no preprocessing) /* Generated by Frama-C */ void g(int a); diff --git a/tests/syntax/oracle/bts0672_link.0.res.oracle b/tests/syntax/oracle/bts0672_link.0.res.oracle index bb04030f645052e7216ff8f960003d99b9ccf1b3..75bfa84ad96960e6c91137a84b74908d2745595a 100644 --- a/tests/syntax/oracle/bts0672_link.0.res.oracle +++ b/tests/syntax/oracle/bts0672_link.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0672_link.c (with preprocessing) [kernel] Parsing tests/syntax/bts0672_link_2.c (with preprocessing) tests/syntax/bts0672_link_2.c:10:[kernel] warning: Calling undeclared function Frama_C_nondet. Old style K&R code? @@ -15,8 +14,7 @@ extern int Frama_C_nondet(int a, int b); void main(void) { - int x; - x = Frama_C_nondet(0,59); + int x = Frama_C_nondet(0,59); return; } diff --git a/tests/syntax/oracle/bts0672_link.1.res.oracle b/tests/syntax/oracle/bts0672_link.1.res.oracle index e33ffcdf275a2ebc4ebd79446ce26226f4f9b453..8cc27d9560b050e042360e39a485117acb2cea9d 100644 --- a/tests/syntax/oracle/bts0672_link.1.res.oracle +++ b/tests/syntax/oracle/bts0672_link.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0672_link.c (with preprocessing) [kernel] Parsing tests/syntax/bts0672_link_2.c (with preprocessing) /* Generated by Frama-C */ @@ -14,8 +13,7 @@ int Frama_C_nondet(int a, int b); void main(void) { - int x; - x = Frama_C_nondet(0,59); + int x = Frama_C_nondet(0,59); return; } diff --git a/tests/syntax/oracle/bts0769.res.oracle b/tests/syntax/oracle/bts0769.res.oracle index f492e027479e4df0af57a9971d99de97fd47ff79..213caf4befe028d5bdfef7ae3db9d64dd3e30f02 100644 --- a/tests/syntax/oracle/bts0769.res.oracle +++ b/tests/syntax/oracle/bts0769.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0769.i (no preprocessing) /* Generated by Frama-C */ struct __anonstruct___1 { diff --git a/tests/syntax/oracle/bts0916.res.oracle b/tests/syntax/oracle/bts0916.res.oracle index 1e1d83d4c1ad729ac2f0d7235a8c6a91167e17bf..4d5b6024081c59e3c99d5225dd7e340c3fc1206d 100644 --- a/tests/syntax/oracle/bts0916.res.oracle +++ b/tests/syntax/oracle/bts0916.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts0916.i (no preprocessing) /* Generated by Frama-C */ /* run.config @@ -7,8 +6,7 @@ /* Use frama-c with option -keep-comments */ void main(void) { - int port; - port = 10; + int port = 10; /* ( port & 0x80 ) == 0 ) */ /* wait for pin1 - Compliant */ /* wait for pin2 */ @@ -16,11 +14,9 @@ void main(void) /* wait for pin3 - Not compliant, no white-space char after ; */ while (1) { int tmp; - { /* sequence */ - tmp = port; - port --; - ; - } + tmp = port; + port --; + ; if (! (tmp > 0)) /* ( port & 0x80 ) == 0 ) */ /* wait for pin1 - Compliant */ /* wait for pin2 */ diff --git a/tests/syntax/oracle/bts1553.res.oracle b/tests/syntax/oracle/bts1553.res.oracle index c25f16896504f11147b9df481319a54e3e6f03c6..d4cb15a9b0d0aed49461a122b1ce537e581f597d 100644 --- a/tests/syntax/oracle/bts1553.res.oracle +++ b/tests/syntax/oracle/bts1553.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts1553.i (no preprocessing) /* Generated by Frama-C */ struct a { diff --git a/tests/syntax/oracle/bts1553_2.res.oracle b/tests/syntax/oracle/bts1553_2.res.oracle index 6c1e63e3af873be8bc86be2fedadfc972cf4bd95..846e3fbe67002671659d47d285c14e667bd10a9c 100644 --- a/tests/syntax/oracle/bts1553_2.res.oracle +++ b/tests/syntax/oracle/bts1553_2.res.oracle @@ -1,20 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel:file] result of parsing ./share/libc/__fc_builtin_for_normalization.i: - /* Generated by Frama-C */ - /* compiler builtin: - __builtin_va_list __builtin_next_arg(void); */ - /* compiler builtin: - void __builtin_stdarg_start(__builtin_va_list); */ - /* compiler builtin: - void __builtin_va_arg(__builtin_va_list, unsigned int, void *); */ - /* compiler builtin: - void __builtin_va_copy(__builtin_va_list, __builtin_va_list); */ - /* compiler builtin: - void __builtin_va_end(__builtin_va_list); */ - /* compiler builtin: - void __builtin_va_start(__builtin_va_list); */ - /* compiler builtin: - void __builtin_varargs_start(__builtin_va_list); */ [kernel] Parsing tests/syntax/bts1553_2.i (no preprocessing) [kernel:file] result of parsing tests/syntax/bts1553_2.i: /* Generated by Frama-C */ @@ -41,11 +24,10 @@ struct a *e[1] = {& __constr_expr_1}; void foo(int c) { - struct a **p; struct a **tmp; if (c) tmp = d; else tmp = e; - p = tmp; + struct a **p = tmp; return; } [kernel] Parsing tests/syntax/bts1553.i (no preprocessing) @@ -90,10 +72,9 @@ static struct a __constr_expr_1 = {.b = 2}; struct a *e[1] = {& __constr_expr_1}; void foo(int c) { - struct a **p; struct a **tmp_0; if (c) tmp_0 = d; else tmp_0 = e; - p = tmp_0; + struct a **p = tmp_0; return; } diff --git a/tests/syntax/oracle/bts59.res.oracle b/tests/syntax/oracle/bts59.res.oracle index a771dd58d9fed2d83ab3444efaf8aa8a8a333689..2b290c69b7b5f4bbc739bc0880090c1424a7729d 100644 --- a/tests/syntax/oracle/bts59.res.oracle +++ b/tests/syntax/oracle/bts59.res.oracle @@ -1,16 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/bts59.i (no preprocessing) /* Generated by Frama-C */ float g(void) { float __retres_5; - double __retres; - int first; - __retres = (double)2; - first = 6; + double __retres = (double)2; + int first = 6; { - int first_0; - first_0 = 5; + int first_0 = 5; __retres_5 = (float)__retres; return __retres_5; } diff --git a/tests/syntax/oracle/built.res.oracle b/tests/syntax/oracle/built.res.oracle index 07f8512d3b1667fb92d0cf2dba48810a6022f452..fd0b3f4265aafe7254298ea4626ac8022dfe6510 100644 --- a/tests/syntax/oracle/built.res.oracle +++ b/tests/syntax/oracle/built.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/built.i (no preprocessing) tests/syntax/built.i:21:[kernel] Case label -1 exceeds range of unsigned int for switch expression. Nothing to worry. /* Generated by Frama-C */ diff --git a/tests/value/oracle/sep.3.err.oracle b/tests/syntax/oracle/builtin_constant_p.err.oracle similarity index 100% rename from tests/value/oracle/sep.3.err.oracle rename to tests/syntax/oracle/builtin_constant_p.err.oracle diff --git a/tests/syntax/oracle/builtin_constant_p.res.oracle b/tests/syntax/oracle/builtin_constant_p.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..b98e37389da84c0cfe0613a128dd38f36f8b2303 --- /dev/null +++ b/tests/syntax/oracle/builtin_constant_p.res.oracle @@ -0,0 +1,13 @@ +[kernel] Parsing tests/syntax/builtin_constant_p.i (no preprocessing) +/* Generated by Frama-C */ +int __builtin_constant_p(int a) +{ + return a; +} + +void main(void) +{ + return; +} + + diff --git a/tests/syntax/oracle/cert-dcl-36.res.oracle b/tests/syntax/oracle/cert-dcl-36.res.oracle index 7c7d80c7555b3e387990ef28d25123b8dc9cf05c..2124442fb9c7f8058a688c3e0b0dc08b8b01a9cf 100644 --- a/tests/syntax/oracle/cert-dcl-36.res.oracle +++ b/tests/syntax/oracle/cert-dcl-36.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/cert-dcl-36.c (with preprocessing) tests/syntax/cert-dcl-36.c:7:[kernel] user error: Inconsistent storage specification for i2. Previous declaration: tests/syntax/cert-dcl-36.c:2 tests/syntax/cert-dcl-36.c:10:[kernel] user error: Inconsistent storage specification for i5. Previous declaration: tests/syntax/cert-dcl-36.c:5 diff --git a/tests/syntax/oracle/char_is_unsigned.res.oracle b/tests/syntax/oracle/char_is_unsigned.res.oracle index 7b216575f628675dd3bc973f2d93a9d9ae27c04b..b970a121e7fe6877ef5e94043f0d7112e2c3a75d 100644 --- a/tests/syntax/oracle/char_is_unsigned.res.oracle +++ b/tests/syntax/oracle/char_is_unsigned.res.oracle @@ -1,28 +1,22 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/char_is_unsigned.i (no preprocessing) /* Generated by Frama-C */ char t[10]; void main(void) { - int r; - char c; - r = (int)t[0] == 'a'; - c = (char)455; + int r = (int)t[0] == 'a'; + char c = (char)455; return; } -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/char_is_unsigned.i (no preprocessing) [rte] annotating function main /* Generated by Frama-C */ char t[10]; void main(void) { - int r; - char c; - r = (int)t[0] == 97; - c = (char)199; + int r = (int)t[0] == 97; + char c = (char)199; return; } diff --git a/tests/syntax/oracle/check_builtin_bts1440.res.oracle b/tests/syntax/oracle/check_builtin_bts1440.res.oracle index 8c53dac61a6252b4b1d86cf5ad2319641894b97d..9e3ec742de560598a7b9cf39254624405721a2db 100644 --- a/tests/syntax/oracle/check_builtin_bts1440.res.oracle +++ b/tests/syntax/oracle/check_builtin_bts1440.res.oracle @@ -1,620 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel:file] result of parsing ./share/libc/__fc_builtin_for_normalization.i: - /* Generated by Frama-C */ - int __builtin___fprintf_chk(void *, int, char const * , ...); - - void *__builtin___memcpy_chk(void *, void const *, unsigned int, unsigned int); - - void *__builtin___memmove_chk(void *, void const *, unsigned int, - unsigned int); - - void *__builtin___mempcpy_chk(void *, void const *, unsigned int, - unsigned int); - - void *__builtin___memset_chk(void *, int, unsigned int, unsigned int); - - int __builtin___printf_chk(int, char const * , ...); - - int __builtin___snprintf_chk(char *, unsigned int, int, unsigned int, - char const * , ...); - - int __builtin___sprintf_chk(char *, int, unsigned int, char const * , ...); - - char *__builtin___stpcpy_chk(char *, char const *, unsigned int); - - char *__builtin___strcat_chk(char *, char const *, unsigned int); - - char *__builtin___strcpy_chk(char *, char const *, unsigned int); - - char *__builtin___strncat_chk(char *, char const *, unsigned int, - unsigned int); - - char *__builtin___strncpy_chk(char *, char const *, unsigned int, - unsigned int); - - int __builtin___vfprintf_chk(void *, int, char const *, __builtin_va_list); - - int __builtin___vprintf_chk(int, char const *, __builtin_va_list); - - int __builtin___vsnprintf_chk(char *, unsigned int, int, unsigned int, - char const *, __builtin_va_list); - - int __builtin___vsprintf_chk(char *, int, unsigned int, char const *, - __builtin_va_list); - - double __builtin_acos(double); - - float __builtin_acosf(float); - - long double __builtin_acosl(long double); - - void *__builtin_alloca(unsigned int); - - double __builtin_asin(double); - - float __builtin_asinf(float); - - long double __builtin_asinl(long double); - - double __builtin_atan(double); - - double __builtin_atan2(double, double); - - float __builtin_atan2f(float, float); - - long double __builtin_atan2l(long double, long double); - - float __builtin_atanf(float); - - long double __builtin_atanl(long double); - - unsigned short __builtin_bswap16(unsigned short); - - unsigned int __builtin_bswap32(unsigned int); - - unsigned long long __builtin_bswap64(unsigned long long); - - double __builtin_ceil(double); - - float __builtin_ceilf(float); - - long double __builtin_ceill(long double); - - int __builtin_clz(unsigned int); - - int __builtin_clzl(unsigned long); - - int __builtin_clzll(unsigned long long); - - int __builtin_constant_p(int); - - double __builtin_cos(double); - - float __builtin_cosf(float); - - double __builtin_cosh(double); - - float __builtin_coshf(float); - - long double __builtin_coshl(long double); - - long double __builtin_cosl(long double); - - int __builtin_ctz(unsigned int); - - int __builtin_ctzl(unsigned long); - - int __builtin_ctzll(unsigned long long); - - double __builtin_exp(double); - - long __builtin_expect(long, long); - - float __builtin_expf(float); - - long double __builtin_expl(long double); - - double __builtin_fabs(double); - - float __builtin_fabsf(float); - - long double __builtin_fabsl(long double); - - int __builtin_ffs(unsigned int); - - int __builtin_ffsl(unsigned long); - - int __builtin_ffsll(unsigned long long); - - double __builtin_floor(double); - - float __builtin_floorf(float); - - long double __builtin_floorl(long double); - - double __builtin_fmod(double); - - float __builtin_fmodf(float); - - long double __builtin_fmodl(long double); - - void *__builtin_frame_address(unsigned int); - - double __builtin_frexp(double, int *); - - float __builtin_frexpf(float, int *); - - long double __builtin_frexpl(long double, int *); - - double __builtin_huge_val(void); - - float __builtin_huge_valf(void); - - long double __builtin_huge_vall(void); - - void __builtin_ia32_lfence(void); - - void __builtin_ia32_mfence(void); - - void __builtin_ia32_sfence(void); - - double __builtin_inf(void); - - float __builtin_inff(void); - - long double __builtin_infl(void); - - double __builtin_ldexp(double, int); - - float __builtin_ldexpf(float, int); - - long double __builtin_ldexpl(long double, int); - - double __builtin_log(double); - - double __builtin_log10(double); - - float __builtin_log10f(float); - - long double __builtin_log10l(long double); - - float __builtin_logf(float); - - long double __builtin_logl(long double); - - void *__builtin_memcpy(void *, void const *, unsigned int); - - void *__builtin_mempcpy(void *, void const *, unsigned int); - - void *__builtin_memset(void *, int, int); - - float __builtin_modff(float, float *); - - long double __builtin_modfl(long double, long double *); - - double __builtin_nan(char const *); - - float __builtin_nanf(char const *); - - long double __builtin_nanl(char const *); - - double __builtin_nans(char const *); - - float __builtin_nansf(char const *); - - long double __builtin_nansl(char const *); - - __builtin_va_list __builtin_next_arg(void); - - unsigned int __builtin_object_size(void *, int); - - int __builtin_parity(unsigned int); - - int __builtin_parityl(unsigned long); - - int __builtin_parityll(unsigned long long); - - int __builtin_popcount(unsigned int); - - int __builtin_popcountl(unsigned long); - - int __builtin_popcountll(unsigned long long); - - double __builtin_powi(double, int); - - float __builtin_powif(float, int); - - long double __builtin_powil(long double, int); - - void __builtin_prefetch(void const * , ...); - - void __builtin_return(void const *); - - void *__builtin_return_address(unsigned int); - - double __builtin_sin(double); - - float __builtin_sinf(float); - - double __builtin_sinh(double); - - float __builtin_sinhf(float); - - long double __builtin_sinhl(long double); - - long double __builtin_sinl(long double); - - double __builtin_sqrt(double); - - float __builtin_sqrtf(float); - - long double __builtin_sqrtl(long double); - - void __builtin_stdarg_start(__builtin_va_list); - - char *__builtin_stpcpy(char *, char const *); - - char *__builtin_strchr(char *, int); - - int __builtin_strcmp(char const *, char const *); - - char *__builtin_strcpy(char *, char const *); - - unsigned int __builtin_strcspn(char const *, char const *); - - char *__builtin_strncat(char *, char const *, unsigned int); - - int __builtin_strncmp(char const *, char const *, unsigned int); - - char *__builtin_strncpy(char *, char const *, unsigned int); - - char *__builtin_strpbrk(char const *, char const *); - - unsigned int __builtin_strspn(char const *, char const *); - - double __builtin_tan(double); - - float __builtin_tanf(float); - - double __builtin_tanh(double); - - float __builtin_tanhf(float); - - long double __builtin_tanhl(long double); - - long double __builtin_tanl(long double); - - int __builtin_types_compatible_p(unsigned int, unsigned int); - - void __builtin_unreachable(void); - - void __builtin_va_arg(__builtin_va_list, unsigned int, void *); - - void __builtin_va_copy(__builtin_va_list, __builtin_va_list); - - void __builtin_va_end(__builtin_va_list); - - void __builtin_va_start(__builtin_va_list); - - void __builtin_varargs_start(__builtin_va_list); - - short __sync_add_and_fetch_int16_t(short *, short , ...); - - int __sync_add_and_fetch_int32_t(int *, int , ...); - - long long __sync_add_and_fetch_int64_t(long long *, long long , ...); - - signed char __sync_add_and_fetch_int8_t(signed char *, signed char , ...); - - unsigned short __sync_add_and_fetch_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_add_and_fetch_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_add_and_fetch_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_add_and_fetch_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_and_and_fetch_int16_t(short *, short , ...); - - int __sync_and_and_fetch_int32_t(int *, int , ...); - - long long __sync_and_and_fetch_int64_t(long long *, long long , ...); - - signed char __sync_and_and_fetch_int8_t(signed char *, signed char , ...); - - unsigned short __sync_and_and_fetch_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_and_and_fetch_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_and_and_fetch_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_and_and_fetch_uint8_t(unsigned char *, unsigned char - , ...); - - int __sync_bool_compare_and_swap_int16_t(short *, short, short , ...); - - int __sync_bool_compare_and_swap_int32_t(int *, int, int , ...); - - int __sync_bool_compare_and_swap_int64_t(long long *, long long, long long - , ...); - - int __sync_bool_compare_and_swap_int8_t(signed char *, signed char, - signed char , ...); - - int __sync_bool_compare_and_swap_uint16_t(unsigned short *, unsigned short, - unsigned short , ...); - - int __sync_bool_compare_and_swap_uint32_t(unsigned int *, unsigned int, - unsigned int , ...); - - int __sync_bool_compare_and_swap_uint64_t(unsigned long long *, - unsigned long long, - unsigned long long , ...); - - int __sync_bool_compare_and_swap_uint8_t(unsigned char *, unsigned char, - unsigned char , ...); - - short __sync_fetch_and_add_int16_t(short *, short , ...); - - int __sync_fetch_and_add_int32_t(int *, int , ...); - - long long __sync_fetch_and_add_int64_t(long long *, long long , ...); - - signed char __sync_fetch_and_add_int8_t(signed char *, signed char , ...); - - unsigned short __sync_fetch_and_add_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_fetch_and_add_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_fetch_and_add_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_fetch_and_add_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_fetch_and_and_int16_t(short *, short , ...); - - int __sync_fetch_and_and_int32_t(int *, int , ...); - - long long __sync_fetch_and_and_int64_t(long long *, long long , ...); - - signed char __sync_fetch_and_and_int8_t(signed char *, signed char , ...); - - unsigned short __sync_fetch_and_and_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_fetch_and_and_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_fetch_and_and_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_fetch_and_and_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_fetch_and_nand_int16_t(short *, short , ...); - - int __sync_fetch_and_nand_int32_t(int *, int , ...); - - long long __sync_fetch_and_nand_int64_t(long long *, long long , ...); - - signed char __sync_fetch_and_nand_int8_t(signed char *, signed char , ...); - - unsigned short __sync_fetch_and_nand_uint16_t(unsigned short *, - unsigned short , ...); - - unsigned int __sync_fetch_and_nand_uint32_t(unsigned int *, unsigned int - , ...); - - unsigned long long __sync_fetch_and_nand_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_fetch_and_nand_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_fetch_and_or_int16_t(short *, short , ...); - - int __sync_fetch_and_or_int32_t(int *, int , ...); - - long long __sync_fetch_and_or_int64_t(long long *, long long , ...); - - signed char __sync_fetch_and_or_int8_t(signed char *, signed char , ...); - - unsigned short __sync_fetch_and_or_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_fetch_and_or_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_fetch_and_or_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_fetch_and_or_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_fetch_and_sub_int16_t(short *, short , ...); - - int __sync_fetch_and_sub_int32_t(int *, int , ...); - - long long __sync_fetch_and_sub_int64_t(long long *, long long , ...); - - signed char __sync_fetch_and_sub_int8_t(signed char *, signed char , ...); - - unsigned short __sync_fetch_and_sub_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_fetch_and_sub_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_fetch_and_sub_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_fetch_and_sub_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_fetch_and_xor_int16_t(short *, short , ...); - - int __sync_fetch_and_xor_int32_t(int *, int , ...); - - long long __sync_fetch_and_xor_int64_t(long long *, long long , ...); - - signed char __sync_fetch_and_xor_int8_t(signed char *, signed char , ...); - - unsigned short __sync_fetch_and_xor_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_fetch_and_xor_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_fetch_and_xor_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_fetch_and_xor_uint8_t(unsigned char *, unsigned char - , ...); - - void __sync_lock_release_int16_t(short * , ...); - - void __sync_lock_release_int32_t(int * , ...); - - void __sync_lock_release_int64_t(long long * , ...); - - void __sync_lock_release_int8_t(signed char * , ...); - - void __sync_lock_release_uint16_t(unsigned short * , ...); - - void __sync_lock_release_uint32_t(unsigned int * , ...); - - void __sync_lock_release_uint64_t(unsigned long long * , ...); - - void __sync_lock_release_uint8_t(unsigned char * , ...); - - short __sync_lock_test_and_set_int16_t(short *, short , ...); - - int __sync_lock_test_and_set_int32_t(int *, int , ...); - - long long __sync_lock_test_and_set_int64_t(long long *, long long , ...); - - signed char __sync_lock_test_and_set_int8_t(signed char *, signed char , ...); - - unsigned short __sync_lock_test_and_set_uint16_t(unsigned short *, - unsigned short , ...); - - unsigned int __sync_lock_test_and_set_uint32_t(unsigned int *, unsigned int - , ...); - - unsigned long long __sync_lock_test_and_set_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_lock_test_and_set_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_nand_and_fetch_int16_t(short *, short , ...); - - int __sync_nand_and_fetch_int32_t(int *, int , ...); - - long long __sync_nand_and_fetch_int64_t(long long *, long long , ...); - - signed char __sync_nand_and_fetch_int8_t(signed char *, signed char , ...); - - unsigned short __sync_nand_and_fetch_uint16_t(unsigned short *, - unsigned short , ...); - - unsigned int __sync_nand_and_fetch_uint32_t(unsigned int *, unsigned int - , ...); - - unsigned long long __sync_nand_and_fetch_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_nand_and_fetch_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_or_and_fetch_int16_t(short *, short , ...); - - int __sync_or_and_fetch_int32_t(int *, int , ...); - - long long __sync_or_and_fetch_int64_t(long long *, long long , ...); - - signed char __sync_or_and_fetch_int8_t(signed char *, signed char , ...); - - unsigned short __sync_or_and_fetch_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_or_and_fetch_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_or_and_fetch_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_or_and_fetch_uint8_t(unsigned char *, unsigned char - , ...); - - short __sync_sub_and_fetch_int16_t(short *, short , ...); - - int __sync_sub_and_fetch_int32_t(int *, int , ...); - - long long __sync_sub_and_fetch_int64_t(long long *, long long , ...); - - signed char __sync_sub_and_fetch_int8_t(signed char *, signed char , ...); - - unsigned short __sync_sub_and_fetch_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_sub_and_fetch_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_sub_and_fetch_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_sub_and_fetch_uint8_t(unsigned char *, unsigned char - , ...); - - void __sync_synchronize(...); - - short __sync_val_compare_and_swap_int16_t(short *, short, short , ...); - - int __sync_val_compare_and_swap_int32_t(int *, int, int , ...); - - long long __sync_val_compare_and_swap_int64_t(long long *, long long, - long long , ...); - - signed char __sync_val_compare_and_swap_int8_t(signed char *, signed char, - signed char , ...); - - unsigned short __sync_val_compare_and_swap_uint16_t(unsigned short *, - unsigned short, - unsigned short , ...); - - unsigned int __sync_val_compare_and_swap_uint32_t(unsigned int *, - unsigned int, unsigned int - , ...); - - unsigned long long __sync_val_compare_and_swap_uint64_t(unsigned long long *, - unsigned long long, - unsigned long long - , ...); - - unsigned char __sync_val_compare_and_swap_uint8_t(unsigned char *, - unsigned char, - unsigned char , ...); - - short __sync_xor_and_fetch_int16_t(short *, short , ...); - - int __sync_xor_and_fetch_int32_t(int *, int , ...); - - long long __sync_xor_and_fetch_int64_t(long long *, long long , ...); - - signed char __sync_xor_and_fetch_int8_t(signed char *, signed char , ...); - - unsigned short __sync_xor_and_fetch_uint16_t(unsigned short *, unsigned short - , ...); - - unsigned int __sync_xor_and_fetch_uint32_t(unsigned int *, unsigned int , ...); - - unsigned long long __sync_xor_and_fetch_uint64_t(unsigned long long *, - unsigned long long , ...); - - unsigned char __sync_xor_and_fetch_uint8_t(unsigned char *, unsigned char - , ...); [kernel] Parsing tests/syntax/check_builtin_bts1440.i (no preprocessing) [kernel:file] result of parsing tests/syntax/check_builtin_bts1440.i: /* Generated by Frama-C */ @@ -1242,9 +625,9 @@ } [kernel:file:annotation] Marking properties /* Generated by Frama-C */ -/*@ ensures /* ip:6 */\result ≥ \old(i); - ensures /* ip:7 */\result ≥ \old(j); - ensures /* ip:8 */\result ≡ \old(i) ∨ \result ≡ \old(j); +/*@ ensures /* ip:1 */\result ≥ \old(i); + ensures /* ip:2 */\result ≥ \old(j); + ensures /* ip:3 */\result ≡ \old(i) ∨ \result ≡ \old(j); */ int max(int i, int j) { diff --git a/tests/syntax/oracle/clone_test.res.oracle b/tests/syntax/oracle/clone_test.res.oracle index e54d5b8cbbc00265c9a8281c8fa90d110cb059e7..43aa672aa3a82b1be49e0301fba42a2716d7cfbf 100644 --- a/tests/syntax/oracle/clone_test.res.oracle +++ b/tests/syntax/oracle/clone_test.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/clone_test.i (no preprocessing) /* Generated by Frama-C */ /*@ requires -3 ≤ c ≤ 4; diff --git a/tests/value/oracle/sep.4.err.oracle b/tests/syntax/oracle/composite-tags.err.oracle similarity index 100% rename from tests/value/oracle/sep.4.err.oracle rename to tests/syntax/oracle/composite-tags.err.oracle diff --git a/tests/syntax/oracle/composite-tags.res.oracle b/tests/syntax/oracle/composite-tags.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..b5c831f723fd40c3b897f0fc5588f1ff196e6d19 --- /dev/null +++ b/tests/syntax/oracle/composite-tags.res.oracle @@ -0,0 +1,5 @@ +[kernel] Parsing tests/syntax/composite-tags.i (no preprocessing) +tests/syntax/composite-tags.i:5:[kernel] user error: Declaration of f does not match previous declaration from tests/syntax/composite-tags.i:4 (structs with different tags). +tests/syntax/composite-tags.i:11:[kernel] user error: Declaration of g does not match previous declaration from tests/syntax/composite-tags.i:10 (unions with different tags). +[kernel] user error: stopping on file "tests/syntax/composite-tags.i" that has errors. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/constfold.res.oracle b/tests/syntax/oracle/constfold.res.oracle index 8b3a8793c881726f4d38d1da685c3d5c7c30cad8..d89b0661aceb87d992c8e2389533e5201813ee37 100644 --- a/tests/syntax/oracle/constfold.res.oracle +++ b/tests/syntax/oracle/constfold.res.oracle @@ -1,13 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/constfold.i (no preprocessing) /* Generated by Frama-C */ int main(void) { int __retres; - int i; - int j; - i = 36; - j = 36; + int i = 36; + int j = 36; __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/copy_logic.res.oracle b/tests/syntax/oracle/copy_logic.res.oracle index 7cf950d857427be4c9e47286a12026bc3173df8d..8bdce7d63a222e4070d33fff423e0e327ee46998 100644 --- a/tests/syntax/oracle/copy_logic.res.oracle +++ b/tests/syntax/oracle/copy_logic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/copy_logic.i (no preprocessing) tests/syntax/copy_logic.i:5:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. tests/syntax/copy_logic.i:7:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. @@ -11,7 +10,6 @@ tests/syntax/copy_logic.i:16:[value] warning: assertion got status unknown. tests/syntax/copy_logic.i:17:[value] warning: signed overflow. assert y + x ≤ 2147483647; tests/syntax/copy_logic.i:18:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates tests/syntax/copy_logic.i:18:[value] warning: assertion got status unknown. -[value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -32,8 +30,7 @@ void f(int *x); int main(int x) { int __retres; - int y; - y = 42; + int y = 42; /*@ assert q(y) ∧ p(x); */ ; /*@ assert Value: signed_overflow: y + x ≤ 2147483647; */ y += x; diff --git a/tests/syntax/oracle/copy_visitor.res.oracle b/tests/syntax/oracle/copy_visitor.res.oracle index de3f57e3333f48f9fe7db6c40e308623fe9e2109..50e8616645e3b93c1a85b94e83be0d3b0929d965 100644 --- a/tests/syntax/oracle/copy_visitor.res.oracle +++ b/tests/syntax/oracle/copy_visitor.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/copy_visitor.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/syntax/oracle/copy_visitor_bts_1073.0.res.oracle b/tests/syntax/oracle/copy_visitor_bts_1073.0.res.oracle index 7971ec33947d6317551cf85d0fb266360773e923..b08086fa1189c8a19bfdcd146efae1e6164eaa05 100644 --- a/tests/syntax/oracle/copy_visitor_bts_1073.0.res.oracle +++ b/tests/syntax/oracle/copy_visitor_bts_1073.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/copy_visitor_bts_1073.c (with preprocessing) /* Generated by Frama-C */ #include "errno.h" @@ -40,7 +39,7 @@ int g1(int y) \from (indirect: __fc_stdout->__fc_FILE_id), __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int printf_0(char const *format); +int printf_va_1(char const *format); /*@ requires valid_read_string(format); requires valid_read_string(param1); @@ -54,7 +53,7 @@ int printf_0(char const *format); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param1 + (0 ..)), param0; */ -int printf_1(char const *format, int param0, char *param1); +int printf_va_2(char const *format, int param0, char *param1); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -67,19 +66,19 @@ int printf_1(char const *format, int param0, char *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_2(char const *format, int param0); +int printf_va_3(char const *format, int param0); int main(int argc, char **argv) { int __retres; int i; - printf_0("Hello !\n"); + printf_va_1("Hello !\n"); i = 0; while (i < argc) { - printf_1("arg %d : %s\n",i,*(argv + i)); + printf_va_2("arg %d : %s\n",i,*(argv + i)); i ++; } - printf_2("Found %d arguments\n",i - 1); + printf_va_3("Found %d arguments\n",i - 1); __retres = 0; return __retres; } @@ -88,13 +87,13 @@ int main1(int argc, char **argv) { int __retres; int i; - printf_0("Hello !\n"); + printf_va_1("Hello !\n"); i = 0; while (i < argc) { - printf_1("arg %d : %s\n",i,*(argv + i)); + printf_va_2("arg %d : %s\n",i,*(argv + i)); i ++; } - printf_2("Found %d arguments\n",i - 1); + printf_va_3("Found %d arguments\n",i - 1); __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/copy_visitor_bts_1073.1.res.oracle b/tests/syntax/oracle/copy_visitor_bts_1073.1.res.oracle index 1c202d11b8591a2d7107b140252a9f179f1989f8..abab08b18e01af58d1da88c6fe19b31b1d214cc0 100644 --- a/tests/syntax/oracle/copy_visitor_bts_1073.1.res.oracle +++ b/tests/syntax/oracle/copy_visitor_bts_1073.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/copy_visitor_bts_1073.c (with preprocessing) [test] start compute [test] exported in new project : filtered @@ -30,7 +29,7 @@ int g(int y) \from (indirect: __fc_stdout->__fc_FILE_id), __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))); */ -int printf_0(char const *format); +int printf_va_1(char const *format); /*@ requires valid_read_string(format); requires valid_read_string(param1); @@ -44,7 +43,7 @@ int printf_0(char const *format); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), *(param1 + (0 ..)), param0; */ -int printf_1(char const *format, int param0, char *param1); +int printf_va_2(char const *format, int param0, char *param1); /*@ requires valid_read_string(format); assigns \result, __fc_stdout->__fc_FILE_data; @@ -57,19 +56,19 @@ int printf_1(char const *format, int param0, char *param1); __fc_stdout->__fc_FILE_data, (indirect: *(format + (0 ..))), param0; */ -int printf_2(char const *format, int param0); +int printf_va_3(char const *format, int param0); int main(int argc, char **argv) { int __retres; int i; - printf_0("Hello !\n"); + printf_va_1("Hello !\n"); i = 0; while (i < argc) { - printf_1("arg %d : %s\n",i,*(argv + i)); + printf_va_2("arg %d : %s\n",i,*(argv + i)); i ++; } - printf_2("Found %d arguments\n",i - 1); + printf_va_3("Found %d arguments\n",i - 1); __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/dangerous_expressions.res.oracle b/tests/syntax/oracle/dangerous_expressions.res.oracle index d51d5b7816e9165b72b5bb2efd635da4240c2cfa..668beae96e2173ccea281acb42342a0a13616be6 100644 --- a/tests/syntax/oracle/dangerous_expressions.res.oracle +++ b/tests/syntax/oracle/dangerous_expressions.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/dangerous_expressions.i (no preprocessing) /* Generated by Frama-C */ struct s { @@ -12,10 +11,8 @@ struct __anonstruct_ss_1 ss; int f(int * /*[10]*/ t, int n, int *ptr) { int __retres; - int tmp; - int tmp_3; - tmp = *(t + n); - tmp_3 = *ptr; + int tmp = *(t + n); + int tmp_3 = *ptr; __retres = 65; return __retres; } @@ -23,12 +20,9 @@ int f(int * /*[10]*/ t, int n, int *ptr) int main(void) { int __retres; - int *p; - int tmp; - int *tmp_3; - p = (int *)0; - tmp = *p; - tmp_3 = ss.s1[2].a; + int *p = (int *)0; + int tmp = *p; + int *tmp_3 = ss.s1[2].a; __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/dangling_else.res.oracle b/tests/syntax/oracle/dangling_else.res.oracle index 214ff184f7ed6a4e3288f8067ae23ee844596918..09f034228c114770fcf92950aa8421662f382737 100644 --- a/tests/syntax/oracle/dangling_else.res.oracle +++ b/tests/syntax/oracle/dangling_else.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/dangling_else.i (no preprocessing) /* Generated by Frama-C */ /*@ requires x ≥ 0; */ diff --git a/tests/syntax/oracle/dangling_reference_bts1475.res.oracle b/tests/syntax/oracle/dangling_reference_bts1475.res.oracle index 28387cc40122717d237a038a6415a51a4d937754..5dd4fb93d1288607a892616a55bcfbcddc474df8 100644 --- a/tests/syntax/oracle/dangling_reference_bts1475.res.oracle +++ b/tests/syntax/oracle/dangling_reference_bts1475.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/dangling_reference_bts1475.i (no preprocessing) /* Generated by Frama-C */ /*@ requires \valid(f5); */ diff --git a/tests/syntax/oracle/decay.res.oracle b/tests/syntax/oracle/decay.res.oracle index 22ff5da71160d46f11a8acbe12d51144b3ed5883..a28cb689138306c141ff5dc9910451df4b3dd16a 100644 --- a/tests/syntax/oracle/decay.res.oracle +++ b/tests/syntax/oracle/decay.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/decay.i (no preprocessing) /* Generated by Frama-C */ struct P { @@ -23,11 +22,9 @@ void multi_dim_array_decay(void) { struct P *pp; struct P p; - int *tmp; - int *tmp_3; pp = & p; - tmp = pp->val[0]; - tmp_3 = p.val[0]; + int *tmp = pp->val[0]; + int *tmp_3 = p.val[0]; return; } diff --git a/tests/syntax/oracle/decl-function.res.oracle b/tests/syntax/oracle/decl-function.res.oracle index 60f36c475221d7f1d088d27dbea6baf39c34d747..870ef925c68fabf8ec54b37ec3e1357b461db2b8 100644 --- a/tests/syntax/oracle/decl-function.res.oracle +++ b/tests/syntax/oracle/decl-function.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/decl-function.i (no preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/syntax/oracle/define_string_logic_pp_bts2101.res.oracle b/tests/syntax/oracle/define_string_logic_pp_bts2101.res.oracle index 8d2a8f5a926961d0c91217f5fd954ca2a40076b4..5a364402dfdadd1df8bf0f4082c6e3b41c7e7ced 100644 --- a/tests/syntax/oracle/define_string_logic_pp_bts2101.res.oracle +++ b/tests/syntax/oracle/define_string_logic_pp_bts2101.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/define_string_logic_pp_bts2101.c (with preprocessing) /* Generated by Frama-C */ /*@ predicate p{L}(char *x) = \at(*(x + 0) ≡ 't',L); @@ -6,22 +5,17 @@ int main(void) { int __retres; - char c[7]; - char d[5]; - char e; - c[0] = (char)'t'; - c[1] = (char)'o'; - c[2] = (char)'/'; - c[3] = (char)'*'; - c[4] = (char)'t'; - c[5] = (char)'o'; - c[6] = (char)'\000'; - d[0] = (char)'t'; - d[1] = (char)'o'; - d[2] = (char)'t'; - d[3] = (char)'o'; - d[4] = (char)'\000'; - e = (char)117; + char const c[7] = + {(char)'t', + (char)'o', + (char)'/', + (char)'*', + (char)'t', + (char)'o', + (char)'\000'}; + char const d[5] = + {(char)'t', (char)'o', (char)'t', (char)'o', (char)'\000'}; + char const e = (char)7815260946135808373ULL; /*@ assert p("to/*to") ∧ p("toto"); */ ; /*@ assert (char)7815260946135808373 ≡ 'u'; */ ; __retres = (int)c[sizeof(c) - (unsigned int)1]; diff --git a/tests/syntax/oracle/designated_init_pretty_print_bts1457.res.oracle b/tests/syntax/oracle/designated_init_pretty_print_bts1457.res.oracle index 15fbc471ce868ccea05bf7f4fedd4720b374c532..e51b04effbcae0363f2878c80ffd4c5e23becb40 100644 --- a/tests/syntax/oracle/designated_init_pretty_print_bts1457.res.oracle +++ b/tests/syntax/oracle/designated_init_pretty_print_bts1457.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/designated_init_pretty_print_bts1457.i (no preprocessing) /* Generated by Frama-C */ int t[10] = {[4] = 5, 5, 5}; diff --git a/tests/syntax/oracle/dowhilezero.res.oracle b/tests/syntax/oracle/dowhilezero.res.oracle index 6967f6bbbc1cc8ae7b44748d351014511712d5e4..44db6bf7edf1afa5217d382026f2527f65654de5 100644 --- a/tests/syntax/oracle/dowhilezero.res.oracle +++ b/tests/syntax/oracle/dowhilezero.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/dowhilezero.c (with preprocessing) /* Generated by Frama-C */ void f1(void) @@ -6,10 +5,8 @@ void f1(void) /*@ loop invariant \true; */ while (1) { { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; } break; } @@ -20,10 +17,8 @@ void f2(void) { while (1) { { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; break; } break; @@ -35,10 +30,8 @@ void f3(void) { while (1) { { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; goto __Cont; } __Cont: break; @@ -50,10 +43,8 @@ void f4(int c) { while (1) { { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; } if (! c) break; } @@ -62,19 +53,15 @@ void f4(int c) void f5(void) { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; return; } void f6(void) { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; while (1) { continue; break; @@ -84,10 +71,8 @@ void f6(void) void f7(void) { - int x; - int y; - x = 1; - y = 2; + int x = 1; + int y = 2; return; } diff --git a/tests/syntax/oracle/duplicated_global_bts1129.res.oracle b/tests/syntax/oracle/duplicated_global_bts1129.res.oracle index 871372c1efeb525bdffa4796e4a8d5635bd92ca6..24c871847f4e377229a56cc7e2e732774bd59c21 100644 --- a/tests/syntax/oracle/duplicated_global_bts1129.res.oracle +++ b/tests/syntax/oracle/duplicated_global_bts1129.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/duplicated_global_bts1129.i (no preprocessing) /* Generated by Frama-C */ void f(int *x); @@ -8,11 +7,9 @@ int X; void f(int *x) { int *tmp; - { /* sequence */ - tmp = x; - x ++; - ; - } + tmp = x; + x ++; + ; return; } diff --git a/tests/syntax/oracle/empty_initializer.res.oracle b/tests/syntax/oracle/empty_initializer.res.oracle index 0430a1be716549fb723b768a62876d6531e78ed3..570c01bb2efedbed14c0fd3088b4dbc6ab4becc2 100644 --- a/tests/syntax/oracle/empty_initializer.res.oracle +++ b/tests/syntax/oracle/empty_initializer.res.oracle @@ -1,54 +1,18 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/empty_initializer.i (no preprocessing) /* Generated by Frama-C */ struct __S { int i ; }; typedef struct __S STR; -/*@ requires \valid(dest + (0 .. n - 1)); - ensures ∀ ℤ i; 0 ≤ i < \old(n) ⇒ *(\old(dest) + i) ≡ 0; - assigns *(dest + (0 .. n - 1)); - assigns *(dest + (0 .. n - 1)) \from \nothing; - */ -extern __attribute__((__FC_BUILTIN__)) void Frama_C_bzero(unsigned char *dest, - unsigned long n); - STR A[3] = {{.i = 0}, {.i = 0}, {.i = 0}}; STR D[3] = {{.i = 0}, {.i = 1}, {.i = 0}}; int E[2][3] = {{}, {}}; int f(void) { int __retres; - STR B[3]; - STR C[3]; - int F[3][4]; - B[0].i = 0; - B[1].i = 0; - B[2].i = 0; - C[0].i = 0; - C[1].i = 3; - C[2].i = 0; - /*@ behavior Frama_C_implicit_init: - ensures ∀ ℤ __i; 0 ≤ __i ≤ 3 ⇒ F[0][__i] ≡ 0; - assigns F[0][0 .. 4 - 1]; - */ - Frama_C_bzero((unsigned char *)(F[0]),(unsigned long)sizeof(int [4])); - /*@ behavior Frama_C_implicit_init: - ensures F[1][0] ≡ 23; - ensures F[1][1] ≡ 45; - ensures ∀ ℤ __i; 2 ≤ __i ≤ 3 ⇒ F[1][__i] ≡ 0; - assigns F[1][0 .. 4 - 1]; - */ - { - Frama_C_bzero((unsigned char *)(F[1]),(unsigned long)sizeof(int [4])); - F[1][0] = 23; - F[1][1] = 45; - } - /*@ behavior Frama_C_implicit_init: - ensures ∀ ℤ __i; 0 ≤ __i ≤ 3 ⇒ F[2][__i] ≡ 0; - assigns F[2][0 .. 4 - 1]; - */ - Frama_C_bzero((unsigned char *)(F[2]),(unsigned long)sizeof(int [4])); + STR B[3] = {{.i = 0}, {.i = 0}, {.i = 0}}; + STR C[3] = {{.i = 0}, {.i = 3}, {.i = 0}}; + int F[3][4] = {{}, {23, 45}, {}}; __retres = B[1].i; return __retres; } diff --git a/tests/syntax/oracle/enum1.res.oracle b/tests/syntax/oracle/enum1.res.oracle index f4207d3688e632e5b94fb132dcbde125517700cb..abf2cfbeaf35d95c60085023adfb33df76a313a5 100644 --- a/tests/syntax/oracle/enum1.res.oracle +++ b/tests/syntax/oracle/enum1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/enum1.c (with preprocessing) [kernel] Parsing tests/syntax/enum2.c (with preprocessing) [kernel] warning: merging definitions of enum f using int type diff --git a/tests/syntax/oracle/enum_call.res.oracle b/tests/syntax/oracle/enum_call.res.oracle index e7a8a7a11492774642d107d8e102c1d5c54022ec..dde2484ac89b015e6eb7c6f9c6b03eaa01316c81 100644 --- a/tests/syntax/oracle/enum_call.res.oracle +++ b/tests/syntax/oracle/enum_call.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/enum_call.i (no preprocessing) /* Generated by Frama-C */ enum E { diff --git a/tests/syntax/oracle/enum_repr.0.res.oracle b/tests/syntax/oracle/enum_repr.0.res.oracle index 0178fc5ace512a8fdcbc96e0f6827d16e82e5bb1..014d931b8d682aa70b59d7e67d50c90122c60a5e 100644 --- a/tests/syntax/oracle/enum_repr.0.res.oracle +++ b/tests/syntax/oracle/enum_repr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/enum_repr.i (no preprocessing) tests/syntax/enum_repr.i:40:[kernel] Inserted implicit cast from unsigned int to enum __anonenum_bu2_4 tests/syntax/enum_repr.i:41:[kernel] Inserted implicit cast from long long to enum __anonenum_bu3_5 @@ -81,30 +80,18 @@ typedef unsigned int bla; int main(void) { int __retres; - foo x; - bar y; - bu1 u1; - bu2 u2; - bu3 u3; - bs1 s1; - bs2 s2; - bs3 s3; - bc1 c1; - bc2 c2; - bd1 d1; - bd2 d2; - x = A; - y = B; - u1 = Bu1; - u2 = Bu2; - u3 = (enum __anonenum_bu3_5)Bu3; - s1 = Bs1; - s2 = Bs2; - s3 = (enum __anonenum_bs3_8)Bs3; - c1 = (enum __anonenum_bc1_9)Bc1; - c2 = (enum __anonenum_bc2_10)Bc2; - d1 = (enum __anonenum_bd1_11)Bd1; - d2 = (enum __anonenum_bd2_12)Bd2; + foo x = A; + bar y = B; + bu1 u1 = Bu1; + bu2 u2 = Bu2; + bu3 u3 = (enum __anonenum_bu3_5)Bu3; + bs1 s1 = Bs1; + bs2 s2 = Bs2; + bs3 s3 = (enum __anonenum_bs3_8)Bs3; + bc1 c1 = (enum __anonenum_bc1_9)Bc1; + bc2 c2 = (enum __anonenum_bc2_10)Bc2; + bd1 d1 = (enum __anonenum_bd1_11)Bd1; + bd2 d2 = (enum __anonenum_bd2_12)Bd2; if (x == A) if (y == B) { __retres = 0; @@ -128,35 +115,23 @@ int h3(foo x); int g(void) { - foo x; - int res; int tmp_0; int tmp_1; int tmp_2; int tmp_3; int tmp_4; - x = A; - res = f1((unsigned int)x); - { /* sequence */ - tmp_0 = f2((unsigned int)x); - res += tmp_0; - } - { /* sequence */ - tmp_1 = f3((unsigned int)x); - res += tmp_1; - } - { /* sequence */ - tmp_2 = h1((enum __anonenum_foo_1)((unsigned int)x)); - res += tmp_2; - } - { /* sequence */ - tmp_3 = h2((enum __anonenum_foo_1)((unsigned int)x)); - res += tmp_3; - } - { /* sequence */ - tmp_4 = h3(x); - res += tmp_4; - } + foo x = A; + int res = f1((unsigned int)x); + tmp_0 = f2((unsigned int)x); + res += tmp_0; + tmp_1 = f3((unsigned int)x); + res += tmp_1; + tmp_2 = h1((enum __anonenum_foo_1)((unsigned int)x)); + res += tmp_2; + tmp_3 = h2((enum __anonenum_foo_1)((unsigned int)x)); + res += tmp_3; + tmp_4 = h3(x); + res += tmp_4; return res; } diff --git a/tests/syntax/oracle/enum_repr.1.res.oracle b/tests/syntax/oracle/enum_repr.1.res.oracle index 41bd380e0054aa78b9ab0b25996f552c53353b18..1c5a866b6739fab099cd26c7b70444ba905e13be 100644 --- a/tests/syntax/oracle/enum_repr.1.res.oracle +++ b/tests/syntax/oracle/enum_repr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/enum_repr.i (no preprocessing) tests/syntax/enum_repr.i:37:[kernel] Inserted implicit cast from int to enum __anonenum_foo_1 tests/syntax/enum_repr.i:38:[kernel] Inserted implicit cast from int to enum __anonenum_bar_2 @@ -83,30 +82,18 @@ typedef unsigned int bla; int main(void) { int __retres; - foo x; - bar y; - bu1 u1; - bu2 u2; - bu3 u3; - bs1 s1; - bs2 s2; - bs3 s3; - bc1 c1; - bc2 c2; - bd1 d1; - bd2 d2; - x = (enum __anonenum_foo_1)A; - y = (enum __anonenum_bar_2)B; - u1 = Bu1; - u2 = Bu2; - u3 = Bu3; - s1 = Bs1; - s2 = (enum __anonenum_bs2_7)Bs2; - s3 = Bs3; - c1 = Bc1; - c2 = Bc2; - d1 = Bd1; - d2 = Bd2; + foo x = (enum __anonenum_foo_1)A; + bar y = (enum __anonenum_bar_2)B; + bu1 u1 = Bu1; + bu2 u2 = Bu2; + bu3 u3 = Bu3; + bs1 s1 = Bs1; + bs2 s2 = (enum __anonenum_bs2_7)Bs2; + bs3 s3 = Bs3; + bc1 c1 = Bc1; + bc2 c2 = Bc2; + bd1 d1 = Bd1; + bd2 d2 = Bd2; if ((int)x == A) if ((int)y == B) { __retres = 0; @@ -130,35 +117,23 @@ int h3(foo x); int g(void) { - foo x; - int res; int tmp_0; int tmp_1; int tmp_2; int tmp_3; int tmp_4; - x = (enum __anonenum_foo_1)A; - res = f1((unsigned int)x); - { /* sequence */ - tmp_0 = f2((unsigned int)x); - res += tmp_0; - } - { /* sequence */ - tmp_1 = f3((unsigned int)x); - res += tmp_1; - } - { /* sequence */ - tmp_2 = h1((enum __anonenum_foo_1)((unsigned int)x)); - res += tmp_2; - } - { /* sequence */ - tmp_3 = h2((enum __anonenum_foo_1)((unsigned int)x)); - res += tmp_3; - } - { /* sequence */ - tmp_4 = h3(x); - res += tmp_4; - } + foo x = (enum __anonenum_foo_1)A; + int res = f1((unsigned int)x); + tmp_0 = f2((unsigned int)x); + res += tmp_0; + tmp_1 = f3((unsigned int)x); + res += tmp_1; + tmp_2 = h1((enum __anonenum_foo_1)((unsigned int)x)); + res += tmp_2; + tmp_3 = h2((enum __anonenum_foo_1)((unsigned int)x)); + res += tmp_3; + tmp_4 = h3(x); + res += tmp_4; return res; } diff --git a/tests/syntax/oracle/enum_repr.2.res.oracle b/tests/syntax/oracle/enum_repr.2.res.oracle index c8f8bf39718396f975c5d96743780cdaaedd23d5..d6cc9f20d2ec31b74215aa70d3888c127d626343 100644 --- a/tests/syntax/oracle/enum_repr.2.res.oracle +++ b/tests/syntax/oracle/enum_repr.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/enum_repr.i (no preprocessing) tests/syntax/enum_repr.i:37:[kernel] Inserted implicit cast from int to enum __anonenum_foo_1 tests/syntax/enum_repr.i:38:[kernel] Inserted implicit cast from int to enum __anonenum_bar_2 @@ -82,30 +81,18 @@ typedef unsigned int bla; int main(void) { int __retres; - foo x; - bar y; - bu1 u1; - bu2 u2; - bu3 u3; - bs1 s1; - bs2 s2; - bs3 s3; - bc1 c1; - bc2 c2; - bd1 d1; - bd2 d2; - x = A; - y = (enum __anonenum_bar_2)B; - u1 = Bu1; - u2 = Bu2; - u3 = Bu3; - s1 = Bs1; - s2 = (enum __anonenum_bs2_7)Bs2; - s3 = Bs3; - c1 = (enum __anonenum_bc1_9)Bc1; - c2 = (enum __anonenum_bc2_10)Bc2; - d1 = (enum __anonenum_bd1_11)Bd1; - d2 = (enum __anonenum_bd2_12)Bd2; + foo x = A; + bar y = (enum __anonenum_bar_2)B; + bu1 u1 = Bu1; + bu2 u2 = Bu2; + bu3 u3 = Bu3; + bs1 s1 = Bs1; + bs2 s2 = (enum __anonenum_bs2_7)Bs2; + bs3 s3 = Bs3; + bc1 c1 = (enum __anonenum_bc1_9)Bc1; + bc2 c2 = (enum __anonenum_bc2_10)Bc2; + bd1 d1 = (enum __anonenum_bd1_11)Bd1; + bd2 d2 = (enum __anonenum_bd2_12)Bd2; if (x == (unsigned int)A) if ((int)y == B) { __retres = 0; @@ -129,35 +116,23 @@ int h3(foo x); int g(void) { - foo x; - int res; int tmp_0; int tmp_1; int tmp_2; int tmp_3; int tmp_4; - x = A; - res = f1((unsigned int)x); - { /* sequence */ - tmp_0 = f2((unsigned int)x); - res += tmp_0; - } - { /* sequence */ - tmp_1 = f3(x); - res += tmp_1; - } - { /* sequence */ - tmp_2 = h1((unsigned int)x); - res += tmp_2; - } - { /* sequence */ - tmp_3 = h2((unsigned int)x); - res += tmp_3; - } - { /* sequence */ - tmp_4 = h3(x); - res += tmp_4; - } + foo x = A; + int res = f1((unsigned int)x); + tmp_0 = f2((unsigned int)x); + res += tmp_0; + tmp_1 = f3(x); + res += tmp_1; + tmp_2 = h1((unsigned int)x); + res += tmp_2; + tmp_3 = h2((unsigned int)x); + res += tmp_3; + tmp_4 = h3(x); + res += tmp_4; return res; } diff --git a/tests/syntax/oracle/enum_size_array.res.oracle b/tests/syntax/oracle/enum_size_array.res.oracle index 7cb661e4b3e57b9831f395b1712b2b68f2d7a503..e9d1a90b22bc8ef96390eaed45ec7280159ba73c 100644 --- a/tests/syntax/oracle/enum_size_array.res.oracle +++ b/tests/syntax/oracle/enum_size_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/enum_size_array.i (no preprocessing) /* Generated by Frama-C */ enum __anonenum_T_E_1 { diff --git a/tests/syntax/oracle/erased_label_bts1502.res.oracle b/tests/syntax/oracle/erased_label_bts1502.res.oracle index 775cf6be4fc586386b6d3156158960bdfb38ab73..3e684891ae5994054897d820c67dd983bc89cf78 100644 --- a/tests/syntax/oracle/erased_label_bts1502.res.oracle +++ b/tests/syntax/oracle/erased_label_bts1502.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/erased_label_bts1502.i (no preprocessing) /* Generated by Frama-C */ void f(int a) diff --git a/tests/syntax/oracle/exit.res.oracle b/tests/syntax/oracle/exit.res.oracle index 1b542036f10acacd19b4f472eaf6de53f5b0ee0c..e36b3e64269a5fb8598463aeda1cb2099025a9c6 100644 --- a/tests/syntax/oracle/exit.res.oracle +++ b/tests/syntax/oracle/exit.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/exit.c (with preprocessing) tests/syntax/exit.c:16:[kernel] warning: Body of function g falls-through. Adding a return statement /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/extern_init.0.res.oracle b/tests/syntax/oracle/extern_init.0.res.oracle index f50cbecbe6dd6979baa7a51340eaa85e31da5628..f81bb13d6093f3e5d76609b417cde9bfca3b90b2 100644 --- a/tests/syntax/oracle/extern_init.0.res.oracle +++ b/tests/syntax/oracle/extern_init.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/extern_init.i (no preprocessing) [kernel] Parsing tests/syntax/extern_init_1.i (no preprocessing) [kernel] Parsing tests/syntax/extern_init_2.i (no preprocessing) diff --git a/tests/syntax/oracle/extern_init.1.res.oracle b/tests/syntax/oracle/extern_init.1.res.oracle index 00a21a02a0ee109183e6741f98a9c91eef672c40..032e51cec632190d203a432e0f91a2acb8bdd45e 100644 --- a/tests/syntax/oracle/extern_init.1.res.oracle +++ b/tests/syntax/oracle/extern_init.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/extern_init.i (no preprocessing) [kernel] Parsing tests/syntax/extern_init_2.i (no preprocessing) [kernel] Parsing tests/syntax/extern_init_1.i (no preprocessing) diff --git a/tests/syntax/oracle/extinline.res.oracle b/tests/syntax/oracle/extinline.res.oracle index 7f26c1c2c9384c9c239a52aaba1b56c7d3da02a8..a240fdd513313ea1b26704c6eb4cfde485937058 100644 --- a/tests/syntax/oracle/extinline.res.oracle +++ b/tests/syntax/oracle/extinline.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/extinline.i (no preprocessing) /* Generated by Frama-C */ extern void f(int a, int b); diff --git a/tests/syntax/oracle/fam.res.oracle b/tests/syntax/oracle/fam.res.oracle index 07d2c99ebf9dc3cdbc7ba058124aa97ac827ad07..ca7809584a7074786f9fc6a3beff9df6bd8cfa6f 100644 --- a/tests/syntax/oracle/fam.res.oracle +++ b/tests/syntax/oracle/fam.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/fam.i (no preprocessing) tests/syntax/fam.i:10:[kernel] user error: static initialization of flexible array members is an unsupported GNU extension tests/syntax/fam.i:22:[kernel] user error: static initialization of flexible array members is an unsupported GNU extension diff --git a/tests/syntax/oracle/float.res.oracle b/tests/syntax/oracle/float.res.oracle index e571f2e8c76f601bdbef6bdbe988dbdcd30f3190..eb68147df1561e0e99fdb7bf4a56bb2e17c74cc9 100644 --- a/tests/syntax/oracle/float.res.oracle +++ b/tests/syntax/oracle/float.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/float.i (no preprocessing) /* Generated by Frama-C */ /*@ requires f ≡ 0.1f; */ diff --git a/tests/syntax/oracle/forloophook.res.oracle b/tests/syntax/oracle/forloophook.res.oracle index b8f778fe80fb97bf4eb9f0ca5e511643a76a828d..283aa39ad04fc2f8fc846aae6cc722990977bed9 100644 --- a/tests/syntax/oracle/forloophook.res.oracle +++ b/tests/syntax/oracle/forloophook.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/forloophook.i (no preprocessing) Found a for loop Local declaration diff --git a/tests/syntax/oracle/formals_decl_leak.res.oracle b/tests/syntax/oracle/formals_decl_leak.res.oracle index 59ae31b7b0c494ec28ba2367bfa6cdb792e84768..e5fb6812b9a653ff20f18fb6865692887a75aac8 100644 --- a/tests/syntax/oracle/formals_decl_leak.res.oracle +++ b/tests/syntax/oracle/formals_decl_leak.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/formals_decl_leak.i (no preprocessing) [kernel] Parsing tests/syntax/formals_decl_leak_1.i (no preprocessing) /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/func_spec_merge.res.oracle b/tests/syntax/oracle/func_spec_merge.res.oracle index 9aac6064f943bcf94b36506663d59c504de98d53..b28a3a9c8151079d8308eceb95201bbe68b7340d 100644 --- a/tests/syntax/oracle/func_spec_merge.res.oracle +++ b/tests/syntax/oracle/func_spec_merge.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/func_spec_merge.i (no preprocessing) /* Generated by Frama-C */ int f(void) diff --git a/tests/syntax/oracle/gcc_builtins.res.oracle b/tests/syntax/oracle/gcc_builtins.res.oracle index afc4361f1dd1bee291d2ef8bd912403962ccd709..a3fb479726b67601cc8fa9be5fc327e18eea1d02 100644 --- a/tests/syntax/oracle/gcc_builtins.res.oracle +++ b/tests/syntax/oracle/gcc_builtins.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/gcc_builtins.c (with preprocessing) /* Generated by Frama-C */ #include "stdint.h" @@ -56,8 +55,7 @@ short __sync_fetch_and_add_int16_t(short *ptr, short value, void * const *__va_params) { - int16_t tmp; - tmp = *ptr; + int16_t tmp = *ptr; *ptr = (short)((int)*ptr + (int)value); return tmp; } @@ -65,8 +63,7 @@ short __sync_fetch_and_add_int16_t(short *ptr, short value, short __sync_fetch_and_sub_int16_t(short *ptr, short value, void * const *__va_params) { - int16_t tmp; - tmp = *ptr; + int16_t tmp = *ptr; *ptr = (short)((int)*ptr - (int)value); return tmp; } @@ -74,8 +71,7 @@ short __sync_fetch_and_sub_int16_t(short *ptr, short value, int __sync_fetch_and_add_int32_t(int *ptr, int value, void * const *__va_params) { - int32_t tmp; - tmp = *ptr; + int32_t tmp = *ptr; *ptr += value; return tmp; } @@ -83,8 +79,7 @@ int __sync_fetch_and_add_int32_t(int *ptr, int value, int __sync_fetch_and_sub_int32_t(int *ptr, int value, void * const *__va_params) { - int32_t tmp; - tmp = *ptr; + int32_t tmp = *ptr; *ptr -= value; return tmp; } @@ -92,8 +87,7 @@ int __sync_fetch_and_sub_int32_t(int *ptr, int value, long long __sync_fetch_and_add_int64_t(long long *ptr, long long value, void * const *__va_params) { - int64_t tmp; - tmp = *ptr; + int64_t tmp = *ptr; *ptr += value; return tmp; } @@ -101,8 +95,7 @@ long long __sync_fetch_and_add_int64_t(long long *ptr, long long value, long long __sync_fetch_and_sub_int64_t(long long *ptr, long long value, void * const *__va_params) { - int64_t tmp; - tmp = *ptr; + int64_t tmp = *ptr; *ptr -= value; return tmp; } @@ -217,136 +210,118 @@ int __sync_bool_compare_and_swap_uint64_t(unsigned long long *ptr, void main(void) { - int x_1; int tmp; { - int16_t content; - int16_t *ptr; - int16_t value; int16_t result; - content = (short)100; - ptr = & content; - value = (short)33; + int16_t content = (short)100; + int16_t *ptr = & content; + int16_t value = (short)33; { - void *__va_args[1]; + void *__va_args[1] = {(void *)0}; result = __sync_fetch_and_add_int16_t(ptr,value, (void * const *)(__va_args)); } /*@ assert result ≡ 100 ∧ content ≡ 133; */ ; { - void *__va_args_35[1]; + void *__va_args_35[1] = {(void *)0}; result = __sync_fetch_and_add_int16_t(ptr,(short)(-11), (void * const *)(__va_args_35)); } /*@ assert result ≡ 133 ∧ content ≡ 122; */ ; { - void *__va_args_37[1]; + void *__va_args_37[1] = {(void *)0}; result = __sync_fetch_and_sub_int16_t(ptr,value, (void * const *)(__va_args_37)); } /*@ assert result ≡ 122 ∧ content ≡ 89; */ ; { - void *__va_args_39[1]; + void *__va_args_39[1] = {(void *)0}; result = __sync_fetch_and_sub_int16_t(ptr,(short)(-11), (void * const *)(__va_args_39)); } /*@ assert result ≡ 89 ∧ content ≡ 100; */ ; } { - int32_t content_0; - int32_t *ptr_0; - int32_t value_0; int32_t result_0; - content_0 = 100; - ptr_0 = & content_0; - value_0 = 33; + int32_t content_0 = 100; + int32_t *ptr_0 = & content_0; + int32_t value_0 = 33; { - void *__va_args_41[1]; + void *__va_args_41[1] = {(void *)0}; result_0 = __sync_fetch_and_add_int32_t(ptr_0,value_0, (void * const *)(__va_args_41)); } /*@ assert result_0 ≡ 100 ∧ content_0 ≡ 133; */ ; { - void *__va_args_43[1]; + void *__va_args_43[1] = {(void *)0}; result_0 = __sync_fetch_and_add_int32_t(ptr_0,-11, (void * const *)(__va_args_43)); } /*@ assert result_0 ≡ 133 ∧ content_0 ≡ 122; */ ; { - void *__va_args_45[1]; + void *__va_args_45[1] = {(void *)0}; result_0 = __sync_fetch_and_sub_int32_t(ptr_0,value_0, (void * const *)(__va_args_45)); } /*@ assert result_0 ≡ 122 ∧ content_0 ≡ 89; */ ; { - void *__va_args_47[1]; + void *__va_args_47[1] = {(void *)0}; result_0 = __sync_fetch_and_sub_int32_t(ptr_0,-11, (void * const *)(__va_args_47)); } /*@ assert result_0 ≡ 89 ∧ content_0 ≡ 100; */ ; } { - int64_t content_1; - int64_t *ptr_1; - int64_t value_1; int64_t result_1; - content_1 = (long long)100; - ptr_1 = & content_1; - value_1 = (long long)33; + int64_t content_1 = (long long)100; + int64_t *ptr_1 = & content_1; + int64_t value_1 = (long long)33; { - void *__va_args_49[1]; + void *__va_args_49[1] = {(void *)0}; result_1 = __sync_fetch_and_add_int64_t(ptr_1,value_1, (void * const *)(__va_args_49)); } /*@ assert result_1 ≡ 100 ∧ content_1 ≡ 133; */ ; { - void *__va_args_51[1]; + void *__va_args_51[1] = {(void *)0}; result_1 = __sync_fetch_and_add_int64_t(ptr_1,(long long)(-11), (void * const *)(__va_args_51)); } /*@ assert result_1 ≡ 133 ∧ content_1 ≡ 122; */ ; { - void *__va_args_53[1]; + void *__va_args_53[1] = {(void *)0}; result_1 = __sync_fetch_and_sub_int64_t(ptr_1,value_1, (void * const *)(__va_args_53)); } /*@ assert result_1 ≡ 122 ∧ content_1 ≡ 89; */ ; { - void *__va_args_55[1]; + void *__va_args_55[1] = {(void *)0}; result_1 = __sync_fetch_and_sub_int64_t(ptr_1,(long long)(-11), (void * const *)(__va_args_55)); } /*@ assert result_1 ≡ 89 ∧ content_1 ≡ 100; */ ; } { - uint16_t content_2; - uint16_t *ptr_2; - uint16_t oldval; - uint16_t newval; int result_2; - content_2 = (unsigned short)100; - ptr_2 = & content_2; - oldval = (unsigned short)100; - newval = (unsigned short)133; + uint16_t content_2 = (unsigned short)100; + uint16_t *ptr_2 = & content_2; + uint16_t oldval = (unsigned short)100; + uint16_t newval = (unsigned short)133; { - void *__va_args_57[1]; + void *__va_args_57[1] = {(void *)0}; result_2 = __sync_bool_compare_and_swap_uint16_t(ptr_2,oldval,newval, (void * const *)(__va_args_57)); } /*@ assert result_2 ≡ 1 ∧ *ptr_2 ≡ newval; */ ; } { - uint32_t content_3; - uint32_t *ptr_3; - uint32_t oldval_0; - uint32_t newval_0; int result_3; - content_3 = (unsigned int)100; - ptr_3 = & content_3; - oldval_0 = (unsigned int)100; - newval_0 = (unsigned int)133; + uint32_t content_3 = (unsigned int)100; + uint32_t *ptr_3 = & content_3; + uint32_t oldval_0 = (unsigned int)100; + uint32_t newval_0 = (unsigned int)133; { - void *__va_args_59[1]; + void *__va_args_59[1] = {(void *)0}; result_3 = __sync_bool_compare_and_swap_uint32_t(ptr_3,oldval_0, newval_0, (void * const *)(__va_args_59)); @@ -354,17 +329,13 @@ void main(void) /*@ assert result_3 ≡ 1 ∧ *ptr_3 ≡ newval_0; */ ; } { - uint64_t content_4; - uint64_t *ptr_4; - uint64_t oldval_1; - uint64_t newval_1; int result_4; - content_4 = (unsigned long long)100; - ptr_4 = & content_4; - oldval_1 = (unsigned long long)100; - newval_1 = (unsigned long long)133; + uint64_t content_4 = (unsigned long long)100; + uint64_t *ptr_4 = & content_4; + uint64_t oldval_1 = (unsigned long long)100; + uint64_t newval_1 = (unsigned long long)133; { - void *__va_args_61[1]; + void *__va_args_61[1] = {(void *)0}; result_4 = __sync_bool_compare_and_swap_uint64_t(ptr_4,oldval_1, newval_1, (void * const *)(__va_args_61)); @@ -372,23 +343,18 @@ void main(void) /*@ assert result_4 ≡ 1 ∧ *ptr_4 ≡ newval_1; */ ; } if ((long)(4 == 4)) { - int x; - x = 1; + int x = 1; } if ((long)(3 == 4)) { - int x_0; - x_0 = 0; - } - x_1 = 2; - { /* sequence */ - ; - tmp = x_1; - x_1 ++; - ; + int x_0 = 0; } + int x_1 = 2; + ; + tmp = x_1; + x_1 ++; + ; if ((long)tmp) { - int y; - y = x_1; + int y = x_1; } return; } diff --git a/tests/syntax/oracle/get_astinfo_bts1136.res.oracle b/tests/syntax/oracle/get_astinfo_bts1136.res.oracle index 50530186a2b7f46589dd0a04ed01af3497b85539..cffcd6e4b73cd1290264656bf7e80aefd76fe204 100644 --- a/tests/syntax/oracle/get_astinfo_bts1136.res.oracle +++ b/tests/syntax/oracle/get_astinfo_bts1136.res.oracle @@ -1,14 +1,13 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/get_astinfo_bts1136.i (no preprocessing) -found variable vid:69 formal in f -found variable vid:72 formal in g -found variable vid:75 formal in h -found variable vid:77 formal in i -found variable vid:79 formal in j -found variable vid:81 formal in k -[do_v] vid:75 formal in h -[do_v] vid:72 formal in g -[do_v] vid:69 formal in f -[do_v] vid:81 local in k -[do_v] vid:79 local in j -[do_v] vid:77 local in i +found variable vid:22 formal in f +found variable vid:25 formal in g +found variable vid:28 formal in h +found variable vid:30 formal in i +found variable vid:32 formal in j +found variable vid:34 formal in k +[do_v] vid:28 formal in h +[do_v] vid:25 formal in g +[do_v] vid:22 formal in f +[do_v] vid:34 local in k +[do_v] vid:32 local in j +[do_v] vid:30 local in i diff --git a/tests/syntax/oracle/ghost_lexing.res.oracle b/tests/syntax/oracle/ghost_lexing.res.oracle index b5cfdeb447847220b058a4762043bc7f0c372eff..5538813fee88d07aeda1a35823019c62f471b398 100644 --- a/tests/syntax/oracle/ghost_lexing.res.oracle +++ b/tests/syntax/oracle/ghost_lexing.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/ghost_lexing.i (no preprocessing) /* Generated by Frama-C */ int G = 0; @@ -7,8 +6,7 @@ void test(char const *); void test2(int x) { - /*@ ghost int y; */ - /*@ ghost y = 0; */ + /*@ ghost int y = 0; */ /*@ ghost if (x > 0) y = x * x; */ G = x * x; test(foo); diff --git a/tests/syntax/oracle/gnu-asm-aesni.res.oracle b/tests/syntax/oracle/gnu-asm-aesni.res.oracle index 1cb586634d08a1682887662053c498cd0865385b..ba58d692e9c5f140c8b433ea7171412d2c550665 100644 --- a/tests/syntax/oracle/gnu-asm-aesni.res.oracle +++ b/tests/syntax/oracle/gnu-asm-aesni.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/gnu-asm-aesni.c (with preprocessing) tests/syntax/gnu-asm-aesni.c:85:[kernel] warning: Clobber list contain "memory" argument. Assuming no side-effect beyond those mentioned in output operands. /* Generated by Frama-C */ @@ -88,76 +87,76 @@ void encrypt_aesni(void) { RIJNDAEL_context ctx; unsigned char b[64]; - unsigned char a_init[64]; unsigned char a[64]; unsigned char test; int i; int j; int k; - a_init[0] = (unsigned char)0x85; - a_init[1] = (unsigned char)0x50; - a_init[2] = (unsigned char)0x43; - a_init[3] = (unsigned char)0xda; - a_init[4] = (unsigned char)0x06; - a_init[5] = (unsigned char)0x99; - a_init[6] = (unsigned char)0xd8; - a_init[7] = (unsigned char)0x3b; - a_init[8] = (unsigned char)0x65; - a_init[9] = (unsigned char)0xf7; - a_init[10] = (unsigned char)0x1d; - a_init[11] = (unsigned char)0xf7; - a_init[12] = (unsigned char)0x95; - a_init[13] = (unsigned char)0xd4; - a_init[14] = (unsigned char)0x34; - a_init[15] = (unsigned char)0x5d; - a_init[16] = (unsigned char)0x6e; - a_init[17] = (unsigned char)0x21; - a_init[18] = (unsigned char)0x01; - a_init[19] = (unsigned char)0xba; - a_init[20] = (unsigned char)0x2a; - a_init[21] = (unsigned char)0xbd; - a_init[22] = (unsigned char)0x7f; - a_init[23] = (unsigned char)0xab; - a_init[24] = (unsigned char)0xa7; - a_init[25] = (unsigned char)0x6d; - a_init[26] = (unsigned char)0xe7; - a_init[27] = (unsigned char)0xcd; - a_init[28] = (unsigned char)0x72; - a_init[29] = (unsigned char)0xcf; - a_init[30] = (unsigned char)0xce; - a_init[31] = (unsigned char)0xa1; - a_init[32] = (unsigned char)0xa7; - a_init[33] = (unsigned char)0x4a; - a_init[34] = (unsigned char)0xb8; - a_init[35] = (unsigned char)0x12; - a_init[36] = (unsigned char)0xef; - a_init[37] = (unsigned char)0x2d; - a_init[38] = (unsigned char)0x6b; - a_init[39] = (unsigned char)0xd5; - a_init[40] = (unsigned char)0xdc; - a_init[41] = (unsigned char)0x09; - a_init[42] = (unsigned char)0xb9; - a_init[43] = (unsigned char)0xdd; - a_init[44] = (unsigned char)0x09; - a_init[45] = (unsigned char)0x27; - a_init[46] = (unsigned char)0x7c; - a_init[47] = (unsigned char)0x86; - a_init[48] = (unsigned char)0x35; - a_init[49] = (unsigned char)0x60; - a_init[50] = (unsigned char)0x99; - a_init[51] = (unsigned char)0xea; - a_init[52] = (unsigned char)0x72; - a_init[53] = (unsigned char)0xbb; - a_init[54] = (unsigned char)0x93; - a_init[55] = (unsigned char)0x9e; - a_init[56] = (unsigned char)0x9e; - a_init[57] = (unsigned char)0x16; - a_init[58] = (unsigned char)0x7b; - a_init[59] = (unsigned char)0xd4; - a_init[60] = (unsigned char)0x8c; - a_init[61] = (unsigned char)0x81; - a_init[62] = (unsigned char)0x8a; - a_init[63] = (unsigned char)0x53; + unsigned char a_init[64] = + {(unsigned char)0x85, + (unsigned char)0x50, + (unsigned char)0x43, + (unsigned char)0xda, + (unsigned char)0x06, + (unsigned char)0x99, + (unsigned char)0xd8, + (unsigned char)0x3b, + (unsigned char)0x65, + (unsigned char)0xf7, + (unsigned char)0x1d, + (unsigned char)0xf7, + (unsigned char)0x95, + (unsigned char)0xd4, + (unsigned char)0x34, + (unsigned char)0x5d, + (unsigned char)0x6e, + (unsigned char)0x21, + (unsigned char)0x01, + (unsigned char)0xba, + (unsigned char)0x2a, + (unsigned char)0xbd, + (unsigned char)0x7f, + (unsigned char)0xab, + (unsigned char)0xa7, + (unsigned char)0x6d, + (unsigned char)0xe7, + (unsigned char)0xcd, + (unsigned char)0x72, + (unsigned char)0xcf, + (unsigned char)0xce, + (unsigned char)0xa1, + (unsigned char)0xa7, + (unsigned char)0x4a, + (unsigned char)0xb8, + (unsigned char)0x12, + (unsigned char)0xef, + (unsigned char)0x2d, + (unsigned char)0x6b, + (unsigned char)0xd5, + (unsigned char)0xdc, + (unsigned char)0x09, + (unsigned char)0xb9, + (unsigned char)0xdd, + (unsigned char)0x09, + (unsigned char)0x27, + (unsigned char)0x7c, + (unsigned char)0x86, + (unsigned char)0x35, + (unsigned char)0x60, + (unsigned char)0x99, + (unsigned char)0xea, + (unsigned char)0x72, + (unsigned char)0xbb, + (unsigned char)0x93, + (unsigned char)0x9e, + (unsigned char)0x9e, + (unsigned char)0x16, + (unsigned char)0x7b, + (unsigned char)0xd4, + (unsigned char)0x8c, + (unsigned char)0x81, + (unsigned char)0x8a, + (unsigned char)0x53}; memcpy((void *)(a),(void const *)(a_init), (unsigned int)64 * sizeof(unsigned char)); i = 0; diff --git a/tests/syntax/oracle/implicit_args_bts1267.res.oracle b/tests/syntax/oracle/implicit_args_bts1267.res.oracle index 3786504eabd862238d72449bdc419a52f1294ead..9c22e6cef9c8857f364086c7fb7de35707bcb6ea 100644 --- a/tests/syntax/oracle/implicit_args_bts1267.res.oracle +++ b/tests/syntax/oracle/implicit_args_bts1267.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/implicit_args_bts1267.i (no preprocessing) /* Generated by Frama-C */ extern unsigned short t[100000]; @@ -7,10 +6,8 @@ int f(int x_0); void main(int i) { - unsigned short *p; - int s; - p = & t[i]; - s = f((int)*p); + unsigned short *p = & t[i]; + int s = f((int)*p); return; } diff --git a/tests/value/oracle/val9.err.oracle b/tests/syntax/oracle/incompatible_qualifiers.0.err.oracle similarity index 100% rename from tests/value/oracle/val9.err.oracle rename to tests/syntax/oracle/incompatible_qualifiers.0.err.oracle diff --git a/tests/syntax/oracle/incompatible_qualifiers.0.res.oracle b/tests/syntax/oracle/incompatible_qualifiers.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..f58f4afd7d37e967f8c1a9599b5f98d32cf595ab --- /dev/null +++ b/tests/syntax/oracle/incompatible_qualifiers.0.res.oracle @@ -0,0 +1,17 @@ +[kernel] Parsing tests/syntax/incompatible_qualifiers.c (with preprocessing) +tests/syntax/incompatible_qualifiers.c:11:[kernel] user error: Declaration of f does not match previous declaration from tests/syntax/incompatible_qualifiers.c:9 (different qualifiers). +tests/syntax/incompatible_qualifiers.c:19:[kernel] user error: Declaration of h does not match previous declaration from tests/syntax/incompatible_qualifiers.c:17 (different qualifiers). +tests/syntax/incompatible_qualifiers.c:27:[kernel] user error: Declaration of j does not match previous declaration from tests/syntax/incompatible_qualifiers.c:25 (different qualifiers). +tests/syntax/incompatible_qualifiers.c:38:[kernel] user error: Declaration of l does not match previous declaration from tests/syntax/incompatible_qualifiers.c:36 (different qualifiers). +tests/syntax/incompatible_qualifiers.c:46:[kernel] user error: Declaration of n does not match previous declaration from tests/syntax/incompatible_qualifiers.c:44 (different qualifiers). +tests/syntax/incompatible_qualifiers.c:51:[kernel] user error: invalid usage of 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:65:[kernel] user error: function pointer type does not allow 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:72:[kernel] user error: invalid usage of 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:73:[kernel] user error: invalid usage of 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:74:[kernel] user error: invalid usage of 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:75:[kernel] user error: invalid usage of 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:76:[kernel] user error: invalid usage of 'restrict' qualifier +tests/syntax/incompatible_qualifiers.c:77:[kernel] user error: function pointer type does not allow 'restrict' qualifier +[kernel] user error: stopping on file "tests/syntax/incompatible_qualifiers.c" that has errors. + Add '-kernel-msg-key pp' for preprocessing command. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/incompatible_qualifiers.1.err.oracle b/tests/syntax/oracle/incompatible_qualifiers.1.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/incompatible_qualifiers.1.res.oracle b/tests/syntax/oracle/incompatible_qualifiers.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..f3cb7685604cbb0a6d515f3932110c3dc2334fa9 --- /dev/null +++ b/tests/syntax/oracle/incompatible_qualifiers.1.res.oracle @@ -0,0 +1,57 @@ +[kernel] Parsing tests/syntax/incompatible_qualifiers.c (with preprocessing) +/* Generated by Frama-C */ +typedef int (*fp1)(char ); +typedef int *iptr; +typedef int * __restrict irptr; +int f(int a, char volatile *b); + +int g(int a, char b); + +void h(char const *); + +void i(int *(*f)(int volatile )); + +void j(int *(*f)(int *)); + +void k(int *(*f)(int volatile )); + +fp1 *l(int *(*f)(int )); + +int (***m(int *(*f)(int volatile )))(char const ); + +fp1 * const *n(int *(*f)(int , fp1 **)); + +void o(char r1, char r2); + +void p(int volatile a); + +void q(iptr volatile p); + +void r(int (*f)(char ), int (*g)(char )); + +void s(irptr p1, irptr p2); + +int * __restrict * __restrict iprpr; +int * __restrict matrix[1]; +int main(void) +{ + int __retres; + f(0,(char volatile *)0); + g(0,(char)0); + h((char const *)0); + i((int *(*)(int volatile ))0); + j((int *(*)(int *))0); + k((int *(*)(int volatile ))0); + l((int *(*)(int ))0); + m((int *(*)(int volatile ))0); + n((int *(*)(int , fp1 **))0); + o((char)0,(char)0); + p(0); + q((int *)0); + r((int (*)(char ))0,(int (*)(char ))0); + s((int *)0,(int *)0); + __retres = 0; + return __retres; +} + + diff --git a/tests/syntax/oracle/incomplete_array.res.oracle b/tests/syntax/oracle/incomplete_array.res.oracle index ed0388d9355d4a83d291d79a4c0ca3dbf6e6dca1..39aca2bee9dc09d36fd0228df85a7f3c641f3b98 100644 --- a/tests/syntax/oracle/incomplete_array.res.oracle +++ b/tests/syntax/oracle/incomplete_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/incomplete_array.i (no preprocessing) tests/syntax/incomplete_array.i:7:[kernel] user error: declaration of array of incomplete type 'struct S` [kernel] user error: stopping on file "tests/syntax/incomplete_array.i" that has errors. diff --git a/tests/syntax/oracle/incomplete_struct_field.res.oracle b/tests/syntax/oracle/incomplete_struct_field.res.oracle index 95d980fd18dd118746cedb8c08d5e5e51a692c65..2336b1f73c7f301430cc1ef80bcebd5e68cdf2f7 100644 --- a/tests/syntax/oracle/incomplete_struct_field.res.oracle +++ b/tests/syntax/oracle/incomplete_struct_field.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/incomplete_struct_field.i (no preprocessing) tests/syntax/incomplete_struct_field.i:1:[kernel] user error: declaration of array of incomplete type 'struct _s` [kernel] user error: type struct _s is circular diff --git a/tests/syntax/oracle/inconsistent_decl.0.res.oracle b/tests/syntax/oracle/inconsistent_decl.0.res.oracle index a933bdc8e6f6e0c114f23dca99d44c0c5a9230fd..34442b229a7b0e14731cc7feb6f371459e0384ed 100644 --- a/tests/syntax/oracle/inconsistent_decl.0.res.oracle +++ b/tests/syntax/oracle/inconsistent_decl.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/inconsistent_decl.c (with preprocessing) tests/syntax/inconsistent_decl.c:11:[kernel] warning: Calling undeclared function f. Old style K&R code? [kernel] Parsing tests/syntax/inconsistent_decl_2.i (no preprocessing) diff --git a/tests/syntax/oracle/inconsistent_decl.1.res.oracle b/tests/syntax/oracle/inconsistent_decl.1.res.oracle index 8f2d68c8cb4e37fff6763cfbab06c0f4d26bc46b..807bd379e556cab1756d41962bc7d86289ed2c72 100644 --- a/tests/syntax/oracle/inconsistent_decl.1.res.oracle +++ b/tests/syntax/oracle/inconsistent_decl.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/inconsistent_decl.c (with preprocessing) [kernel] Parsing tests/syntax/inconsistent_decl_2.i (no preprocessing) [kernel] user error: Incompatible declaration for f: diff --git a/tests/syntax/oracle/init_bts1352.res.oracle b/tests/syntax/oracle/init_bts1352.res.oracle index 6fec8a7449f07a940e837370140b7094b29c4bf1..bdb225654be3a7200781988659486a940e4e671f 100644 --- a/tests/syntax/oracle/init_bts1352.res.oracle +++ b/tests/syntax/oracle/init_bts1352.res.oracle @@ -1,5 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/init_bts1352.i (no preprocessing) tests/syntax/init_bts1352.i:2:[kernel] user error: scalar value (of type int) initialized by compound initializer + 1 int main(void) { + 2 int t /* [5] missing */ = { 1, 2, 3, 4, 5 }; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 } [kernel] user error: stopping on file "tests/syntax/init_bts1352.i" that has errors. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/initializer.res.oracle b/tests/syntax/oracle/initializer.res.oracle index 2a715cc3705e3e56d595b2f94ba46f6f70642594..62b7f7129c7b02e221c4e568087b0cf7d787046c 100644 --- a/tests/syntax/oracle/initializer.res.oracle +++ b/tests/syntax/oracle/initializer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/initializer.i (no preprocessing) tests/syntax/initializer.i:29:[kernel] warning: Floating-point constant 0.1 is not represented exactly. Will use 0x1.999999999999ap-4. See documentation for option -warn-decimal-float /* Generated by Frama-C */ @@ -56,8 +55,7 @@ static unsigned char STR[7] = (unsigned char)'\000'}; void main(void) { - int i; - i = (int)STR[2]; + int i = (int)STR[2]; return; } diff --git a/tests/syntax/oracle/initializers.res.oracle b/tests/syntax/oracle/initializers.res.oracle index f9dfa82bc1f7e6146cca11f33172ce242bddc259..cc0dd3eddf609cf7a8ad46b8077b4f7a235a1146 100644 --- a/tests/syntax/oracle/initializers.res.oracle +++ b/tests/syntax/oracle/initializers.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/initializers.i (no preprocessing) tests/syntax/initializers.i:4:[kernel] warning: Too many initializers for structure /* Generated by Frama-C */ @@ -10,15 +9,13 @@ struct ee { }; void f(void) { - struct e e1; - e1.i1 = 1; + struct e e1 = {.i1 = 1}; return; } void g(void) { - struct ee e2; - e2.i2 = 1; + struct ee e2 = {.i2 = 1}; return; } diff --git a/tests/syntax/oracle/inline_def_1.res.oracle b/tests/syntax/oracle/inline_def_1.res.oracle index 6333a72b8a63e3ac24c7f2cc66762b2f47c9774a..3a5f7e4733cbcbb9adc3e22e97c2579044ad2025 100644 --- a/tests/syntax/oracle/inline_def_1.res.oracle +++ b/tests/syntax/oracle/inline_def_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/inline_def_1.i (no preprocessing) [kernel] Parsing tests/syntax/inline_def_2.i (no preprocessing) /* Generated by Frama-C */ @@ -27,11 +26,9 @@ int g(int x) int tmp; int tmp_0; int tmp_1; - { /* sequence */ - tmp = f__fc_inline(x); - tmp_0 = f1__fc_inline(); - tmp_1 = f2(); - } + tmp = f__fc_inline(x); + tmp_0 = f1__fc_inline(); + tmp_1 = f2(); __retres = (tmp + tmp_0) + tmp_1; return __retres; } @@ -56,11 +53,9 @@ int h(int x) int tmp; int tmp_0; int tmp_1; - { /* sequence */ - tmp = f(x); - tmp_0 = f1__fc_inline_0(); - tmp_1 = f2(); - } + tmp = f(x); + tmp_0 = f1__fc_inline_0(); + tmp_1 = f2(); __retres = (tmp + tmp_0) + tmp_1; return __retres; } diff --git a/tests/syntax/oracle/inline_def_bad_1.res.oracle b/tests/syntax/oracle/inline_def_bad_1.res.oracle index 2a8ceb108aee2c910eb3379a423d034d2767b3fb..95c83b7ab470940e1946252b8d7d13ab7b99f61a 100644 --- a/tests/syntax/oracle/inline_def_bad_1.res.oracle +++ b/tests/syntax/oracle/inline_def_bad_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/inline_def_bad_1.i (no preprocessing) [kernel] Parsing tests/syntax/inline_def_bad_2.i (no preprocessing) tests/syntax/inline_def_bad_2.i:6:[kernel] warning: dropping duplicate def'n of func f at tests/syntax/inline_def_bad_2.i:6 in favor of that at tests/syntax/inline_def_bad_1.i:5 diff --git a/tests/syntax/oracle/inserted_casts.0.res.oracle b/tests/syntax/oracle/inserted_casts.0.res.oracle index 1a21e8340536b86eb01e2bc6b0b6df5e75050d08..8bcf7897b065f6b070bc86d0c71c48a08ad0e487 100644 --- a/tests/syntax/oracle/inserted_casts.0.res.oracle +++ b/tests/syntax/oracle/inserted_casts.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/inserted_casts.c (with preprocessing) [test] Inserting cast for expression a + 3 of type int to type unsigned int [test] Inserting cast for expression a of type int to type unsigned int @@ -18,8 +17,7 @@ int g(int a) { int __retres; unsigned int r; - ptrdiff_t x; - x = & r - & r; + ptrdiff_t x = & r - & r; r = (unsigned int)(a + 3); a = (int)((unsigned int)a * r); __retres = (int)((unsigned int)a - r); diff --git a/tests/syntax/oracle/inserted_casts.1.res.oracle b/tests/syntax/oracle/inserted_casts.1.res.oracle index 1a21e8340536b86eb01e2bc6b0b6df5e75050d08..8bcf7897b065f6b070bc86d0c71c48a08ad0e487 100644 --- a/tests/syntax/oracle/inserted_casts.1.res.oracle +++ b/tests/syntax/oracle/inserted_casts.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/inserted_casts.c (with preprocessing) [test] Inserting cast for expression a + 3 of type int to type unsigned int [test] Inserting cast for expression a of type int to type unsigned int @@ -18,8 +17,7 @@ int g(int a) { int __retres; unsigned int r; - ptrdiff_t x; - x = & r - & r; + ptrdiff_t x = & r - & r; r = (unsigned int)(a + 3); a = (int)((unsigned int)a * r); __retres = (int)((unsigned int)a - r); diff --git a/tests/syntax/oracle/inserted_casts.res.oracle b/tests/syntax/oracle/inserted_casts.res.oracle deleted file mode 100644 index 6d30b9692ec324faabfcccee59ecdf17fb8f9527..0000000000000000000000000000000000000000 --- a/tests/syntax/oracle/inserted_casts.res.oracle +++ /dev/null @@ -1,26 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/syntax/inserted_casts.c (with preprocessing) -[test] Inserting cast for expression a + 3 of type int to type unsigned int -[test] Inserting cast for expression a of type int to type unsigned int -[test] Inserting cast for expression (unsigned int)a * r of type unsigned int to type int -[test] Inserting cast for expression a of type int to type unsigned int -[test] Inserting cast for expression (unsigned int)a - r of type unsigned int to type int -/* Generated by Frama-C */ -int f(int b) -{ - int r; - if (b * b != 0) r = 0; else r = -1; - return r; -} - -int g(int a) -{ - int __retres; - unsigned int r; - r = (unsigned int)(a + 3); - a = (int)((unsigned int)a * r); - __retres = (int)((unsigned int)a - r); - return __retres; -} - - diff --git a/tests/syntax/oracle/invalid_constant.res.oracle b/tests/syntax/oracle/invalid_constant.res.oracle index 0fcbed5ce8cb7be34fb2a9229f748e183f686b92..d0234fda403204d4f6c4bdedce839e9c66db7dc2 100644 --- a/tests/syntax/oracle/invalid_constant.res.oracle +++ b/tests/syntax/oracle/invalid_constant.res.oracle @@ -1,7 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/invalid_constant.i (no preprocessing) -[kernel] syntax error at tests/syntax/invalid_constant.i:2: - 1 /* Invalid octal constant */ - 2 int = 0123456789; - ^^^^^^^^^^^^^^^^^ +tests/syntax/invalid_constant.i:2:[kernel] failure: Invalid digit 8 in integer constant '0123456789' in base 8. +[kernel] user error: stopping on file "tests/syntax/invalid_constant.i" that has errors. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/keep.res.oracle b/tests/syntax/oracle/keep.res.oracle index 0fb9aeb0d93770c40561089cf54c1695ec74e703..281d19c3d8dda28404fa374347403c5b529e88b5 100644 --- a/tests/syntax/oracle/keep.res.oracle +++ b/tests/syntax/oracle/keep.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/keep.i (no preprocessing) /* Generated by Frama-C */ typedef int __attribute__((__FC_BUILTIN__)) foo; diff --git a/tests/syntax/oracle/line_number.res.oracle b/tests/syntax/oracle/line_number.res.oracle index e4ffb4acac001b30aa6cda896ee2e44f796ad4f7..84d2216f4685984cb966c759936d038ecb7bc659 100644 --- a/tests/syntax/oracle/line_number.res.oracle +++ b/tests/syntax/oracle/line_number.res.oracle @@ -1,6 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/line_number.c (with preprocessing) -[kernel] syntax error at tests/syntax/line_number.c:1: +[kernel] syntax error at tests/syntax/line_number.c:1 1 //@ assert \result == 0; ^^^^^^^^^^^^^^^^^^^^^^^^ 2 extern int p(void void); diff --git a/tests/syntax/oracle/literal-question-no-trigraph.0.err.oracle b/tests/syntax/oracle/literal-question-no-trigraph.0.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/literal-question-no-trigraph.0.res.oracle b/tests/syntax/oracle/literal-question-no-trigraph.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..ecaa0faec6d982c885f0e2def51f113cbb23eedb --- /dev/null +++ b/tests/syntax/oracle/literal-question-no-trigraph.0.res.oracle @@ -0,0 +1,18 @@ +[kernel] Parsing tests/syntax/literal-question-no-trigraph.c (with preprocessing) +/* Generated by Frama-C */ +int main(void) +{ + int __retres; + char *s1 = (char *)"?\?"; + char *s2 = (char *)"?\?="; + char *s3 = (char *)"?\?\?"; + char *s4 = (char *)"?\?\?\?"; + char *s5 = (char *)"?\?\?="; + char *s6 = (char *)"?\?\?="; + char *s7 = (char *)"?\?\?\?\?\?=?\?=\\?\?=?"; + char *s8 = (char *)"?\?\\?\?="; + __retres = 0; + return __retres; +} + + diff --git a/tests/syntax/oracle/literal-question-no-trigraph.1.err.oracle b/tests/syntax/oracle/literal-question-no-trigraph.1.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/literal-question-no-trigraph.1.res.oracle b/tests/syntax/oracle/literal-question-no-trigraph.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..6a451b3860194bcf1d9c8fac6c18aaeb87958e6d --- /dev/null +++ b/tests/syntax/oracle/literal-question-no-trigraph.1.res.oracle @@ -0,0 +1,18 @@ +[kernel] Parsing tests/syntax/literal-question-no-trigraph.c (with preprocessing) +/* Generated by Frama-C */ +int main(void) +{ + int __retres; + char *s1 = (char *)"?\?"; + char *s2 = (char *)"#"; + char *s3 = (char *)"?\?\?"; + char *s4 = (char *)"?\?\?\?"; + char *s5 = (char *)"?\?\?="; + char *s6 = (char *)"?\?\?="; + char *s7 = (char *)"?\?\?\?#?\?=\\#?"; + char *s8 = (char *)"?\?\\#"; + __retres = 0; + return __retres; +} + + diff --git a/tests/syntax/oracle/local_uninitialized_bts_1081.res.oracle b/tests/syntax/oracle/local_uninitialized_bts_1081.res.oracle index ad804cf65f73e3622a22d9d2d86ed0b784024e7c..70e5df8bf0bd7282db113e5d388ec1e6ed3f0236 100644 --- a/tests/syntax/oracle/local_uninitialized_bts_1081.res.oracle +++ b/tests/syntax/oracle/local_uninitialized_bts_1081.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/local_uninitialized_bts_1081.i (no preprocessing) /* Generated by Frama-C */ int X; @@ -10,23 +9,17 @@ int main(void) int foo; int x; int y; - int tmp_7; if (foo) { - int tmp; - tmp = x; + int tmp = x; } else { - int tmp_3; - tmp_3 = y; + int tmp_3 = y; } if (! foo) { - int tmp_5; - tmp_5 = y; - } - { /* sequence */ - tmp_7 = foo; - ; + int tmp_5 = y; } + int tmp_7 = foo; + ; __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/logic_env.res.oracle b/tests/syntax/oracle/logic_env.res.oracle index 2ca69d92505f59b6e2887930e004a88e239d08d0..51a98181e5cbc975de63918f0c0942978546c8ac 100644 --- a/tests/syntax/oracle/logic_env.res.oracle +++ b/tests/syntax/oracle/logic_env.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/logic_env.i (no preprocessing) Check OK Check OK diff --git a/tests/syntax/oracle/loop-case-switch-for-unroll.0.err.oracle b/tests/syntax/oracle/loop-case-switch-for-unroll.0.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/loop-case-switch-for-unroll.0.res.oracle b/tests/syntax/oracle/loop-case-switch-for-unroll.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..39006eeef4d1d47ed4fea1fd21b03b2416f148cf --- /dev/null +++ b/tests/syntax/oracle/loop-case-switch-for-unroll.0.res.oracle @@ -0,0 +1,211 @@ +[kernel] Parsing tests/syntax/loop-case-switch-for-unroll.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + vals[0] ∈ {1} + [1] ∈ {42} + [2] ∈ {5} + [3] ∈ {1} + [4] ∈ {43} + [5] ∈ {11} + [6] ∈ {0} + [7] ∈ {1} + [8] ∈ {0} + [9] ∈ {44} + [10] ∈ {12} + [11..12] ∈ {0} + [13..14] ∈ {1} + [15] ∈ {45} + [16] ∈ {11} + [17..20] ∈ {0} + [21] ∈ {46} + [22] ∈ {13} + [23..26] ∈ {0} + [27] ∈ {47} + [28] ∈ {12} + [29..31] ∈ {0} + [32] ∈ {48} + [33] ∈ {15} + [34..36] ∈ {0} + i ∈ {-1} +tests/syntax/loop-case-switch-for-unroll.c:72:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:66:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:74:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {42} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {5} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {43} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {11} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {44} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {12} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:66:[value] Frama_C_show_each_n_: {3} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {45} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {11} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {46} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {13} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {47} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {12} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:84:[value] Frama_C_show_each_y_: {32} +tests/syntax/loop-case-switch-for-unroll.c:85:[value] Frama_C_show_each_x_: {32} +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function gen_nondet: + i ∈ [0..31] + __retres ∈ [0..47] +[value:final-states] Values at end of function main: + y ∈ {32} + x ∈ {32} + n ∈ {0} + i ∈ {31} +/* Generated by Frama-C */ +int gen_nondet(int line); + +static int vals[37] = + {1, + 42, + 5, + 1, + 43, + 11, + 0, + 1, + 0, + 44, + 12, + 0, + 0, + 1, + 1, + 45, + 11, + 0, + 0, + 0, + 0, + 46, + 13, + 0, + 0, + 0, + 0, + 47, + 12, + 0, + 0, + 0, + 48, + 15, + 0, + 0, + 0}; +static int i = -1; +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_nondet_)(); + +int gen_nondet(int line) +{ + int __retres; + i = (int)((unsigned int)(i + 1) % (sizeof(vals) / sizeof(int))); + Frama_C_show_each_nondet_(vals[i]); + __retres = vals[i]; + return __retres; +} + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_n_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_i_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_y_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_x_)(); + +void main(void) +{ + int x; + int y = 32; + int n = 3; + L0: + switch (1) { + int tmp; + int tmp_0; + L3: case 0: Frama_C_show_each_n_(n); + tmp = gen_nondet(67); + if (tmp) goto L; + tmp_0 = gen_nondet(68); + if (tmp_0) goto L1; + while (1) { + { + int tmp_1; + case 1: tmp_1 = gen_nondet(71); + if (tmp_1) goto L1; + L: x = y; + case 2: + { + int j; + int i_0 = 0; + while (i_0 < 4) { + { + int tmp_2; + int tmp_3; + int tmp_4; + int tmp_5; + L1: j = gen_nondet(76); + tmp_2 = gen_nondet(77); + if (tmp_2 > 10) i_0 = 10; else i_0 = 0; + Frama_C_show_each_i_(i_0); + tmp_3 = gen_nondet(79); + if (tmp_3) goto L; + tmp_4 = gen_nondet(80); + if (tmp_4) goto L0; + tmp_5 = gen_nondet(81); + if (tmp_5) goto L3; + } + i_0 ++; + } + } + } + n --; + if (! (n > 0)) break; + } + Frama_C_show_each_y_(y); + Frama_C_show_each_x_(x); + } + return; +} + + diff --git a/tests/syntax/oracle/loop-case-switch-for-unroll.1.err.oracle b/tests/syntax/oracle/loop-case-switch-for-unroll.1.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/loop-case-switch-for-unroll.1.res.oracle b/tests/syntax/oracle/loop-case-switch-for-unroll.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..72444b89183d9faa62f67e12a01b07b80b4caca5 --- /dev/null +++ b/tests/syntax/oracle/loop-case-switch-for-unroll.1.res.oracle @@ -0,0 +1,290 @@ +[kernel] Parsing tests/syntax/loop-case-switch-for-unroll.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + vals[0] ∈ {1} + [1] ∈ {42} + [2] ∈ {5} + [3] ∈ {1} + [4] ∈ {43} + [5] ∈ {11} + [6] ∈ {0} + [7] ∈ {1} + [8] ∈ {0} + [9] ∈ {44} + [10] ∈ {12} + [11..12] ∈ {0} + [13..14] ∈ {1} + [15] ∈ {45} + [16] ∈ {11} + [17..20] ∈ {0} + [21] ∈ {46} + [22] ∈ {13} + [23..26] ∈ {0} + [27] ∈ {47} + [28] ∈ {12} + [29..31] ∈ {0} + [32] ∈ {48} + [33] ∈ {15} + [34..36] ∈ {0} + i ∈ {-1} +tests/syntax/loop-case-switch-for-unroll.c:66:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:74:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:72:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:76:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {42} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {5} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {43} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {11} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {44} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {12} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:66:[value] Frama_C_show_each_n_: {3} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {45} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {11} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {46} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {13} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {47} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {12} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:84:[value] Frama_C_show_each_y_: {32} +tests/syntax/loop-case-switch-for-unroll.c:85:[value] Frama_C_show_each_x_: {32} +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function gen_nondet: + i ∈ [0..31] + __retres ∈ [0..47] +[value:final-states] Values at end of function main: + y ∈ {32} + x ∈ {32} + n ∈ {0} + i ∈ {31} +/* Generated by Frama-C */ +int gen_nondet(int line); + +static int vals[37] = + {1, + 42, + 5, + 1, + 43, + 11, + 0, + 1, + 0, + 44, + 12, + 0, + 0, + 1, + 1, + 45, + 11, + 0, + 0, + 0, + 0, + 46, + 13, + 0, + 0, + 0, + 0, + 47, + 12, + 0, + 0, + 0, + 48, + 15, + 0, + 0, + 0}; +static int i = -1; +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_nondet_)(); + +int gen_nondet(int line) +{ + int __retres; + i = (int)((unsigned int)(i + 1) % (sizeof(vals) / sizeof(int))); + Frama_C_show_each_nondet_(vals[i]); + __retres = vals[i]; + return __retres; +} + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_n_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_i_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_y_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_x_)(); + +void main(void) +{ + int x; + int y = 32; + int n = 3; + L0: + switch (1) { + int tmp; + int tmp_0; + L3: case 0: Frama_C_show_each_n_(n); + tmp = gen_nondet(67); + if (tmp) goto L; + tmp_0 = gen_nondet(68); + if (tmp_0) goto L1; + { + int tmp_1_unroll_41; + case 1: tmp_1_unroll_41 = gen_nondet(71); + if (tmp_1_unroll_41) goto L1_unrolling_11_loop; + L_unrolling_8_loop: x = y; + case 2: + { + int j_unroll_40; + int i_0_unroll_40 = 0; + if (! (i_0_unroll_40 < 4)) goto unrolling_2_loop_unrolling_12_loop; + { + int tmp_2_unroll_12_unroll_26; + int tmp_3_unroll_12_unroll_26; + int tmp_4_unroll_12_unroll_26; + int tmp_5_unroll_12_unroll_26; + L1_unrolling_4_loop_unrolling_9_loop: j_unroll_40 = gen_nondet(76); + tmp_2_unroll_12_unroll_26 = gen_nondet(77); + if (tmp_2_unroll_12_unroll_26 > 10) i_0_unroll_40 = 10; + else i_0_unroll_40 = 0; + Frama_C_show_each_i_(i_0_unroll_40); + tmp_3_unroll_12_unroll_26 = gen_nondet(79); + if (tmp_3_unroll_12_unroll_26) goto L_unrolling_8_loop; + tmp_4_unroll_12_unroll_26 = gen_nondet(80); + if (tmp_4_unroll_12_unroll_26) goto L0; + tmp_5_unroll_12_unroll_26 = gen_nondet(81); + if (tmp_5_unroll_12_unroll_26) goto L3; + } + i_0_unroll_40 ++; + unrolling_3_loop_unrolling_10_loop: ; + /*@ loop pragma UNROLL "done", 1; */ + while (i_0_unroll_40 < 4) { + { + int tmp_2_unroll_37; + int tmp_3_unroll_37; + int tmp_4_unroll_37; + int tmp_5_unroll_37; + L1_unrolling_11_loop: j_unroll_40 = gen_nondet(76); + tmp_2_unroll_37 = gen_nondet(77); + if (tmp_2_unroll_37 > 10) i_0_unroll_40 = 10; + else i_0_unroll_40 = 0; + Frama_C_show_each_i_(i_0_unroll_40); + tmp_3_unroll_37 = gen_nondet(79); + if (tmp_3_unroll_37) goto L_unrolling_8_loop; + tmp_4_unroll_37 = gen_nondet(80); + if (tmp_4_unroll_37) goto L0; + tmp_5_unroll_37 = gen_nondet(81); + if (tmp_5_unroll_37) goto L3; + } + i_0_unroll_40 ++; + } + unrolling_2_loop_unrolling_12_loop: ; + } + } + n --; + if (! (n > 0)) goto unrolling_6_loop; + unrolling_7_loop: ; + /*@ loop pragma UNROLL "done", 1; */ + while (1) { + { + int tmp_1; + tmp_1 = gen_nondet(71); + if (tmp_1) goto L1; + L: x = y; + { + int j; + int i_0 = 0; + if (! (i_0 < 4)) goto unrolling_2_loop; + { + int tmp_2_unroll_12; + int tmp_3_unroll_12; + int tmp_4_unroll_12; + int tmp_5_unroll_12; + L1_unrolling_4_loop: j = gen_nondet(76); + tmp_2_unroll_12 = gen_nondet(77); + if (tmp_2_unroll_12 > 10) i_0 = 10; else i_0 = 0; + Frama_C_show_each_i_(i_0); + tmp_3_unroll_12 = gen_nondet(79); + if (tmp_3_unroll_12) goto L; + tmp_4_unroll_12 = gen_nondet(80); + if (tmp_4_unroll_12) goto L0; + tmp_5_unroll_12 = gen_nondet(81); + if (tmp_5_unroll_12) goto L3; + } + i_0 ++; + unrolling_3_loop: ; + /*@ loop pragma UNROLL "done", 1; */ + while (i_0 < 4) { + { + int tmp_2; + int tmp_3; + int tmp_4; + int tmp_5; + L1: j = gen_nondet(76); + tmp_2 = gen_nondet(77); + if (tmp_2 > 10) i_0 = 10; else i_0 = 0; + Frama_C_show_each_i_(i_0); + tmp_3 = gen_nondet(79); + if (tmp_3) goto L; + tmp_4 = gen_nondet(80); + if (tmp_4) goto L0; + tmp_5 = gen_nondet(81); + if (tmp_5) goto L3; + } + i_0 ++; + } + unrolling_2_loop: ; + } + } + n --; + if (! (n > 0)) break; + } + unrolling_6_loop: ; + Frama_C_show_each_y_(y); + Frama_C_show_each_x_(x); + } + return; +} + + diff --git a/tests/syntax/oracle/loop-case-switch-for-unroll.2.err.oracle b/tests/syntax/oracle/loop-case-switch-for-unroll.2.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/loop-case-switch-for-unroll.2.res.oracle b/tests/syntax/oracle/loop-case-switch-for-unroll.2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..21fcdf3a5beb8418422f3c045bf6a830c2554280 --- /dev/null +++ b/tests/syntax/oracle/loop-case-switch-for-unroll.2.res.oracle @@ -0,0 +1,408 @@ +[kernel] Parsing tests/syntax/loop-case-switch-for-unroll.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + vals[0] ∈ {1} + [1] ∈ {42} + [2] ∈ {5} + [3] ∈ {1} + [4] ∈ {43} + [5] ∈ {11} + [6] ∈ {0} + [7] ∈ {1} + [8] ∈ {0} + [9] ∈ {44} + [10] ∈ {12} + [11..12] ∈ {0} + [13..14] ∈ {1} + [15] ∈ {45} + [16] ∈ {11} + [17..20] ∈ {0} + [21] ∈ {46} + [22] ∈ {13} + [23..26] ∈ {0} + [27] ∈ {47} + [28] ∈ {12} + [29..31] ∈ {0} + [32] ∈ {48} + [33] ∈ {15} + [34..36] ∈ {0} + i ∈ {-1} +tests/syntax/loop-case-switch-for-unroll.c:66:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:74:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:72:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:76:[kernel] warning: Non-natural loop detected. +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {42} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {5} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {43} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {11} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {44} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {12} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:66:[value] Frama_C_show_each_n_: {3} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {1} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {45} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {11} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {46} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {13} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {47} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {12} +tests/syntax/loop-case-switch-for-unroll.c:78:[value] Frama_C_show_each_i_: {10} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:53:[value] Frama_C_show_each_nondet_: {0} +tests/syntax/loop-case-switch-for-unroll.c:84:[value] Frama_C_show_each_y_: {32} +tests/syntax/loop-case-switch-for-unroll.c:85:[value] Frama_C_show_each_x_: {32} +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function gen_nondet: + i ∈ [0..31] + __retres ∈ [0..47] +[value:final-states] Values at end of function main: + y ∈ {32} + x ∈ {32} + n ∈ {0} + i ∈ {31} +/* Generated by Frama-C */ +int gen_nondet(int line); + +static int vals[37] = + {1, + 42, + 5, + 1, + 43, + 11, + 0, + 1, + 0, + 44, + 12, + 0, + 0, + 1, + 1, + 45, + 11, + 0, + 0, + 0, + 0, + 46, + 13, + 0, + 0, + 0, + 0, + 47, + 12, + 0, + 0, + 0, + 48, + 15, + 0, + 0, + 0}; +static int i = -1; +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_nondet_)(); + +int gen_nondet(int line) +{ + int __retres; + i = (int)((unsigned int)(i + 1) % (sizeof(vals) / sizeof(int))); + Frama_C_show_each_nondet_(vals[i]); + __retres = vals[i]; + return __retres; +} + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_n_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_i_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_y_)(); + +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each_x_)(); + +void main(void) +{ + int x; + int y = 32; + int n = 3; + L0: + switch (1) { + int tmp; + int tmp_0; + L3: case 0: Frama_C_show_each_n_(n); + tmp = gen_nondet(67); + if (tmp) goto L; + tmp_0 = gen_nondet(68); + if (tmp_0) goto L1; + { + int tmp_1_unroll_106; + case 1: tmp_1_unroll_106 = gen_nondet(71); + if (tmp_1_unroll_106) goto L1_unrolling_23_loop; + L_unrolling_18_loop: x = y; + case 2: + { + int j_unroll_105; + int i_0_unroll_105 = 0; + if (! (i_0_unroll_105 < 4)) goto unrolling_2_loop_unrolling_24_loop; + { + int tmp_2_unroll_24_unroll_80; + int tmp_3_unroll_24_unroll_80; + int tmp_4_unroll_24_unroll_80; + int tmp_5_unroll_24_unroll_80; + L1_unrolling_6_loop_unrolling_19_loop: + j_unroll_105 = gen_nondet(76); + tmp_2_unroll_24_unroll_80 = gen_nondet(77); + if (tmp_2_unroll_24_unroll_80 > 10) i_0_unroll_105 = 10; + else i_0_unroll_105 = 0; + Frama_C_show_each_i_(i_0_unroll_105); + tmp_3_unroll_24_unroll_80 = gen_nondet(79); + if (tmp_3_unroll_24_unroll_80) goto L_unrolling_18_loop; + tmp_4_unroll_24_unroll_80 = gen_nondet(80); + if (tmp_4_unroll_24_unroll_80) goto L0; + tmp_5_unroll_24_unroll_80 = gen_nondet(81); + if (tmp_5_unroll_24_unroll_80) goto L3; + } + i_0_unroll_105 ++; + unrolling_5_loop_unrolling_20_loop: ; + if (! (i_0_unroll_105 < 4)) goto unrolling_2_loop_unrolling_24_loop; + { + int tmp_2_unroll_12_unroll_91; + int tmp_3_unroll_12_unroll_91; + int tmp_4_unroll_12_unroll_91; + int tmp_5_unroll_12_unroll_91; + L1_unrolling_4_loop_unrolling_21_loop: + j_unroll_105 = gen_nondet(76); + tmp_2_unroll_12_unroll_91 = gen_nondet(77); + if (tmp_2_unroll_12_unroll_91 > 10) i_0_unroll_105 = 10; + else i_0_unroll_105 = 0; + Frama_C_show_each_i_(i_0_unroll_105); + tmp_3_unroll_12_unroll_91 = gen_nondet(79); + if (tmp_3_unroll_12_unroll_91) goto L_unrolling_18_loop; + tmp_4_unroll_12_unroll_91 = gen_nondet(80); + if (tmp_4_unroll_12_unroll_91) goto L0; + tmp_5_unroll_12_unroll_91 = gen_nondet(81); + if (tmp_5_unroll_12_unroll_91) goto L3; + } + i_0_unroll_105 ++; + unrolling_3_loop_unrolling_22_loop: ; + /*@ loop pragma UNROLL "done", 2; */ + while (i_0_unroll_105 < 4) { + { + int tmp_2_unroll_102; + int tmp_3_unroll_102; + int tmp_4_unroll_102; + int tmp_5_unroll_102; + L1_unrolling_23_loop: j_unroll_105 = gen_nondet(76); + tmp_2_unroll_102 = gen_nondet(77); + if (tmp_2_unroll_102 > 10) i_0_unroll_105 = 10; + else i_0_unroll_105 = 0; + Frama_C_show_each_i_(i_0_unroll_105); + tmp_3_unroll_102 = gen_nondet(79); + if (tmp_3_unroll_102) goto L_unrolling_18_loop; + tmp_4_unroll_102 = gen_nondet(80); + if (tmp_4_unroll_102) goto L0; + tmp_5_unroll_102 = gen_nondet(81); + if (tmp_5_unroll_102) goto L3; + } + i_0_unroll_105 ++; + } + unrolling_2_loop_unrolling_24_loop: ; + } + } + n --; + if (! (n > 0)) goto unrolling_8_loop; + unrolling_17_loop: ; + { + int tmp_1_unroll_64; + tmp_1_unroll_64 = gen_nondet(71); + if (tmp_1_unroll_64) goto L1_unrolling_15_loop; + L_unrolling_10_loop: x = y; + { + int j_unroll_63; + int i_0_unroll_63 = 0; + if (! (i_0_unroll_63 < 4)) goto unrolling_2_loop_unrolling_16_loop; + { + int tmp_2_unroll_24_unroll_38; + int tmp_3_unroll_24_unroll_38; + int tmp_4_unroll_24_unroll_38; + int tmp_5_unroll_24_unroll_38; + L1_unrolling_6_loop_unrolling_11_loop: + j_unroll_63 = gen_nondet(76); + tmp_2_unroll_24_unroll_38 = gen_nondet(77); + if (tmp_2_unroll_24_unroll_38 > 10) i_0_unroll_63 = 10; + else i_0_unroll_63 = 0; + Frama_C_show_each_i_(i_0_unroll_63); + tmp_3_unroll_24_unroll_38 = gen_nondet(79); + if (tmp_3_unroll_24_unroll_38) goto L_unrolling_10_loop; + tmp_4_unroll_24_unroll_38 = gen_nondet(80); + if (tmp_4_unroll_24_unroll_38) goto L0; + tmp_5_unroll_24_unroll_38 = gen_nondet(81); + if (tmp_5_unroll_24_unroll_38) goto L3; + } + i_0_unroll_63 ++; + unrolling_5_loop_unrolling_12_loop: ; + if (! (i_0_unroll_63 < 4)) goto unrolling_2_loop_unrolling_16_loop; + { + int tmp_2_unroll_12_unroll_49; + int tmp_3_unroll_12_unroll_49; + int tmp_4_unroll_12_unroll_49; + int tmp_5_unroll_12_unroll_49; + L1_unrolling_4_loop_unrolling_13_loop: + j_unroll_63 = gen_nondet(76); + tmp_2_unroll_12_unroll_49 = gen_nondet(77); + if (tmp_2_unroll_12_unroll_49 > 10) i_0_unroll_63 = 10; + else i_0_unroll_63 = 0; + Frama_C_show_each_i_(i_0_unroll_63); + tmp_3_unroll_12_unroll_49 = gen_nondet(79); + if (tmp_3_unroll_12_unroll_49) goto L_unrolling_10_loop; + tmp_4_unroll_12_unroll_49 = gen_nondet(80); + if (tmp_4_unroll_12_unroll_49) goto L0; + tmp_5_unroll_12_unroll_49 = gen_nondet(81); + if (tmp_5_unroll_12_unroll_49) goto L3; + } + i_0_unroll_63 ++; + unrolling_3_loop_unrolling_14_loop: ; + /*@ loop pragma UNROLL "done", 2; */ + while (i_0_unroll_63 < 4) { + { + int tmp_2_unroll_60; + int tmp_3_unroll_60; + int tmp_4_unroll_60; + int tmp_5_unroll_60; + L1_unrolling_15_loop: j_unroll_63 = gen_nondet(76); + tmp_2_unroll_60 = gen_nondet(77); + if (tmp_2_unroll_60 > 10) i_0_unroll_63 = 10; + else i_0_unroll_63 = 0; + Frama_C_show_each_i_(i_0_unroll_63); + tmp_3_unroll_60 = gen_nondet(79); + if (tmp_3_unroll_60) goto L_unrolling_10_loop; + tmp_4_unroll_60 = gen_nondet(80); + if (tmp_4_unroll_60) goto L0; + tmp_5_unroll_60 = gen_nondet(81); + if (tmp_5_unroll_60) goto L3; + } + i_0_unroll_63 ++; + } + unrolling_2_loop_unrolling_16_loop: ; + } + } + n --; + if (! (n > 0)) goto unrolling_8_loop; + unrolling_9_loop: ; + /*@ loop pragma UNROLL "done", 2; */ + while (1) { + { + int tmp_1; + tmp_1 = gen_nondet(71); + if (tmp_1) goto L1; + L: x = y; + { + int j; + int i_0 = 0; + if (! (i_0 < 4)) goto unrolling_2_loop; + { + int tmp_2_unroll_24; + int tmp_3_unroll_24; + int tmp_4_unroll_24; + int tmp_5_unroll_24; + L1_unrolling_6_loop: j = gen_nondet(76); + tmp_2_unroll_24 = gen_nondet(77); + if (tmp_2_unroll_24 > 10) i_0 = 10; else i_0 = 0; + Frama_C_show_each_i_(i_0); + tmp_3_unroll_24 = gen_nondet(79); + if (tmp_3_unroll_24) goto L; + tmp_4_unroll_24 = gen_nondet(80); + if (tmp_4_unroll_24) goto L0; + tmp_5_unroll_24 = gen_nondet(81); + if (tmp_5_unroll_24) goto L3; + } + i_0 ++; + unrolling_5_loop: ; + if (! (i_0 < 4)) goto unrolling_2_loop; + { + int tmp_2_unroll_12; + int tmp_3_unroll_12; + int tmp_4_unroll_12; + int tmp_5_unroll_12; + L1_unrolling_4_loop: j = gen_nondet(76); + tmp_2_unroll_12 = gen_nondet(77); + if (tmp_2_unroll_12 > 10) i_0 = 10; else i_0 = 0; + Frama_C_show_each_i_(i_0); + tmp_3_unroll_12 = gen_nondet(79); + if (tmp_3_unroll_12) goto L; + tmp_4_unroll_12 = gen_nondet(80); + if (tmp_4_unroll_12) goto L0; + tmp_5_unroll_12 = gen_nondet(81); + if (tmp_5_unroll_12) goto L3; + } + i_0 ++; + unrolling_3_loop: ; + /*@ loop pragma UNROLL "done", 2; */ + while (i_0 < 4) { + { + int tmp_2; + int tmp_3; + int tmp_4; + int tmp_5; + L1: j = gen_nondet(76); + tmp_2 = gen_nondet(77); + if (tmp_2 > 10) i_0 = 10; else i_0 = 0; + Frama_C_show_each_i_(i_0); + tmp_3 = gen_nondet(79); + if (tmp_3) goto L; + tmp_4 = gen_nondet(80); + if (tmp_4) goto L0; + tmp_5 = gen_nondet(81); + if (tmp_5) goto L3; + } + i_0 ++; + } + unrolling_2_loop: ; + } + } + n --; + if (! (n > 0)) break; + } + unrolling_8_loop: ; + Frama_C_show_each_y_(y); + Frama_C_show_each_x_(x); + } + return; +} + + diff --git a/tests/syntax/oracle/loop_annot.0.res.oracle b/tests/syntax/oracle/loop_annot.0.res.oracle index b6254c5d211ebb36bf40911911a8a8005ae0cb34..40f84dee56b26d83e5294dd49285924c7bed95e6 100644 --- a/tests/syntax/oracle/loop_annot.0.res.oracle +++ b/tests/syntax/oracle/loop_annot.0.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/loop_annot.i (no preprocessing) /* Generated by Frama-C */ void f(void) { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ 10; */ while (i < 10) { i ++; diff --git a/tests/syntax/oracle/loop_annot.1.res.oracle b/tests/syntax/oracle/loop_annot.1.res.oracle index b6254c5d211ebb36bf40911911a8a8005ae0cb34..40f84dee56b26d83e5294dd49285924c7bed95e6 100644 --- a/tests/syntax/oracle/loop_annot.1.res.oracle +++ b/tests/syntax/oracle/loop_annot.1.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/loop_annot.i (no preprocessing) /* Generated by Frama-C */ void f(void) { - int i; - i = 0; + int i = 0; /*@ loop invariant 0 ≤ i ≤ 10; */ while (i < 10) { i ++; diff --git a/tests/syntax/oracle/lvalvoid.res.oracle b/tests/syntax/oracle/lvalvoid.res.oracle index 21a750c26748b4ea9f93b4f82d8669d03db74c31..97af920bba1fbcddf208c42c1fcca92967609fec 100644 --- a/tests/syntax/oracle/lvalvoid.res.oracle +++ b/tests/syntax/oracle/lvalvoid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/lvalvoid.i (no preprocessing) tests/syntax/lvalvoid.i:4:[kernel] failure: lvalue of type void: *(src + i) [kernel] user error: stopping on file "tests/syntax/lvalvoid.i" that has errors. diff --git a/tests/syntax/oracle/macro_escape_chars.res.oracle b/tests/syntax/oracle/macro_escape_chars.res.oracle index 770e0a41786a53f58a20ff381bd947a4a80618b3..7bd05a5b0d0f2ffdd96015ecc9a865c79e24b319 100644 --- a/tests/syntax/oracle/macro_escape_chars.res.oracle +++ b/tests/syntax/oracle/macro_escape_chars.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/macro_escape_chars.c (with preprocessing) /* Generated by Frama-C */ struct file; @@ -20,8 +19,7 @@ extern int fputs(char const *, FILE *); int main(int argc, char **argv) { int __retres; - FILE *f; - f = fopen("/tmp/testfile.out","w"); + FILE *f = fopen("/tmp/testfile.out","w"); putc('\\',f); fputs("\\",f); fclose(f); diff --git a/tests/syntax/oracle/merge_attrs_align.0.res.oracle b/tests/syntax/oracle/merge_attrs_align.0.res.oracle index 6432c8c43f14b197e0e68a3b596e89d54d77c740..83274361b08dee2ab5bb129329a2c21e8b072d71 100644 --- a/tests/syntax/oracle/merge_attrs_align.0.res.oracle +++ b/tests/syntax/oracle/merge_attrs_align.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align1.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align2.c (with preprocessing) diff --git a/tests/syntax/oracle/merge_attrs_align.1.res.oracle b/tests/syntax/oracle/merge_attrs_align.1.res.oracle index 15d13dd95d020d28281a76a25ac02c6458f63e08..8076a7cff10105e4f6227fe8ff03e3069c0b40bf 100644 --- a/tests/syntax/oracle/merge_attrs_align.1.res.oracle +++ b/tests/syntax/oracle/merge_attrs_align.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align1.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align3.c (with preprocessing) diff --git a/tests/syntax/oracle/merge_attrs_align.2.res.oracle b/tests/syntax/oracle/merge_attrs_align.2.res.oracle index ca3c465f13e607b177acb3afc1d064cbd2da7ef0..854a6431c54af65a5a54b7031c7effd2853838bd 100644 --- a/tests/syntax/oracle/merge_attrs_align.2.res.oracle +++ b/tests/syntax/oracle/merge_attrs_align.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align1.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align4.c (with preprocessing) diff --git a/tests/syntax/oracle/merge_attrs_align.3.res.oracle b/tests/syntax/oracle/merge_attrs_align.3.res.oracle index 7a77f6b3a725000c21b5ab6044fb385ab8cf01e9..13c892dee1cd5a804b83de0092e509e4da0d6fed 100644 --- a/tests/syntax/oracle/merge_attrs_align.3.res.oracle +++ b/tests/syntax/oracle/merge_attrs_align.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align2.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align3.c (with preprocessing) diff --git a/tests/syntax/oracle/merge_attrs_align.4.res.oracle b/tests/syntax/oracle/merge_attrs_align.4.res.oracle index 4f5571e84ee048b35c22c69eb178441874ad145b..8b34eb97fb5541fa8063b2942af75ed30b4e5341 100644 --- a/tests/syntax/oracle/merge_attrs_align.4.res.oracle +++ b/tests/syntax/oracle/merge_attrs_align.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align2.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align4.c (with preprocessing) diff --git a/tests/syntax/oracle/merge_attrs_align.5.res.oracle b/tests/syntax/oracle/merge_attrs_align.5.res.oracle index b7398db022a82fd4a01fccce29dd303404877d9d..0f2aa9d95212a9e126feb20cfd4c1d1f7656afd1 100644 --- a/tests/syntax/oracle/merge_attrs_align.5.res.oracle +++ b/tests/syntax/oracle/merge_attrs_align.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align3.c (with preprocessing) [kernel] Parsing tests/syntax/merge_attrs_align4.c (with preprocessing) diff --git a/tests/syntax/oracle/merge_bts0948.res.oracle b/tests/syntax/oracle/merge_bts0948.res.oracle index d5dbdd9a37e290ae7486a2d771969ce8d0115514..6b2c8bd904ce8da87f0f6dae41c078b793105014 100644 --- a/tests/syntax/oracle/merge_bts0948.res.oracle +++ b/tests/syntax/oracle/merge_bts0948.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_bts0948.i (no preprocessing) [kernel] Parsing tests/syntax/merge_bts0948_1.i (no preprocessing) [kernel] Parsing tests/syntax/merge_bts0948_2.i (no preprocessing) diff --git a/tests/syntax/oracle/merge_inline_1.res.oracle b/tests/syntax/oracle/merge_inline_1.res.oracle index 9b1d1ab6332185c8d80c268ad8d2c9d7a2c561da..6af5ae4e754057d2da874f2d5767a96df546e6c5 100644 --- a/tests/syntax/oracle/merge_inline_1.res.oracle +++ b/tests/syntax/oracle/merge_inline_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_inline_1.c (with preprocessing) [kernel] Parsing tests/syntax/merge_inline_2.c (with preprocessing) /* Generated by Frama-C */ @@ -15,10 +14,8 @@ int main(void) { int __retres; int tmp; - { /* sequence */ - tmp = getfoo2(); - ; - } + tmp = getfoo2(); + ; if (tmp != (int)(& foo)) { __retres = 1; goto return_label; diff --git a/tests/syntax/oracle/merge_loc.res.oracle b/tests/syntax/oracle/merge_loc.res.oracle index 846e030db42a78f2a8bf7e4385828f0ddfc398e1..9db961df904e7321bd9951260869f80ed821a08b 100644 --- a/tests/syntax/oracle/merge_loc.res.oracle +++ b/tests/syntax/oracle/merge_loc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/merge_loc.i (no preprocessing) /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/multiline_macro.res.oracle b/tests/syntax/oracle/multiline_macro.res.oracle index 137684929f7eeffaaf1bc3150c6d3d2f32200aa4..a9bd5972b65edcca566fae843881faaf0ea43b86 100644 --- a/tests/syntax/oracle/multiline_macro.res.oracle +++ b/tests/syntax/oracle/multiline_macro.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/multiline_macro.c (with preprocessing) /* Generated by Frama-C */ /*@ ensures \result ≡ ((((1 + 2) + 3) + 5) + 6) + 7; */ diff --git a/tests/syntax/oracle/multiple_decls_contracts.0.res.oracle b/tests/syntax/oracle/multiple_decls_contracts.0.res.oracle index e0972b6a2ee85f6a61965f0b3f44d25d4de6a69a..465e078934af1d4cdacb25fd8ec1dd8ba3f0b861 100644 --- a/tests/syntax/oracle/multiple_decls_contracts.0.res.oracle +++ b/tests/syntax/oracle/multiple_decls_contracts.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing share/libc/string.h (with preprocessing) [kernel] Parsing tests/syntax/multiple_decls_contracts.c (with preprocessing) [kernel] Parsing tests/syntax/multiple_decls_contracts.c (with preprocessing) diff --git a/tests/syntax/oracle/multiple_decls_contracts.1.res.oracle b/tests/syntax/oracle/multiple_decls_contracts.1.res.oracle index e4629781078dcb41d01c635a8e0d492e83267dcc..474096962af6174e2a17fe2375ad6d9ea456f193 100644 --- a/tests/syntax/oracle/multiple_decls_contracts.1.res.oracle +++ b/tests/syntax/oracle/multiple_decls_contracts.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/multiple_decls_contracts.c (with preprocessing) [kernel] Parsing share/libc/string.h (with preprocessing) [kernel] Parsing tests/syntax/multiple_decls_contracts.c (with preprocessing) diff --git a/tests/syntax/oracle/multiple_decls_contracts.2.res.oracle b/tests/syntax/oracle/multiple_decls_contracts.2.res.oracle index 1364d2df0639acb018d590699a62a94aa6d5326f..13cfd3436153b22d609bf3ce31d6369234d9b1f7 100644 --- a/tests/syntax/oracle/multiple_decls_contracts.2.res.oracle +++ b/tests/syntax/oracle/multiple_decls_contracts.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/multiple_decls_contracts.c (with preprocessing) [kernel] Parsing tests/syntax/multiple_decls_contracts.c (with preprocessing) [kernel] Parsing share/libc/string.h (with preprocessing) diff --git a/tests/syntax/oracle/mutually_recursive_struct.res.oracle b/tests/syntax/oracle/mutually_recursive_struct.res.oracle index 123983ec672a35ba04086463bfae221021f3879d..63008b4353f9ccd0740002b98e72ee8cc6446860 100644 --- a/tests/syntax/oracle/mutually_recursive_struct.res.oracle +++ b/tests/syntax/oracle/mutually_recursive_struct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/mutually_recursive_struct.i (no preprocessing) tests/syntax/mutually_recursive_struct.i:4:[kernel] user error: declaration of array of incomplete type 'struct S2` [kernel] user error: type struct S2 is circular diff --git a/tests/syntax/oracle/no-print-libc-reparse.err.oracle b/tests/syntax/oracle/no-print-libc-reparse.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/no-print-libc-reparse.res.oracle b/tests/syntax/oracle/no-print-libc-reparse.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..14b8e9144a14ecdc1211dd42161145f8df9841ab --- /dev/null +++ b/tests/syntax/oracle/no-print-libc-reparse.res.oracle @@ -0,0 +1,2 @@ +[kernel] Parsing tests/syntax/no-print-libc-reparse.c (with preprocessing) +[kernel] Parsing tests/syntax/result/ocode_0_no-print-libc-reparse.c (with preprocessing) diff --git a/tests/syntax/oracle/noret.res.oracle b/tests/syntax/oracle/noret.res.oracle index 90fd8fd1a837d5b971f37dfb510a13bd3865749e..b5507da79c8326ba4add5d5ab543cb22b29186c9 100644 --- a/tests/syntax/oracle/noret.res.oracle +++ b/tests/syntax/oracle/noret.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/noret.i (no preprocessing) tests/syntax/noret.i:5:[kernel] warning: Body of function foo falls-through. Adding a return statement /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/offset.res.oracle b/tests/syntax/oracle/offset.res.oracle index d9d5dd4f0d46f2c707ad95ab173f66553b1fd7da..aa0eeab933cdfd0e6a1b98df3fc8ca7f2005cb8b 100644 --- a/tests/syntax/oracle/offset.res.oracle +++ b/tests/syntax/oracle/offset.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/offset.c (with preprocessing) /* Generated by Frama-C */ #include "__fc_define_off_t.h" diff --git a/tests/syntax/oracle/offsetof.res.oracle b/tests/syntax/oracle/offsetof.res.oracle index 55acf68f953b51d11b7117da3bd7cc0921ee868b..ac9886f97c2ae844c60f2ab7e83ba27da8464b48 100644 --- a/tests/syntax/oracle/offsetof.res.oracle +++ b/tests/syntax/oracle/offsetof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/offsetof.c (with preprocessing) /* Generated by Frama-C */ #include "stddef.h" diff --git a/tests/syntax/oracle/one_ret_assert.res.oracle b/tests/syntax/oracle/one_ret_assert.res.oracle index f5f865b257fa3848ca4b82c13d074870a3ccc797..0543355924c830c414336236ff6385b0639fc4b0 100644 --- a/tests/syntax/oracle/one_ret_assert.res.oracle +++ b/tests/syntax/oracle/one_ret_assert.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/one_ret_assert.i (no preprocessing) tests/syntax/one_ret_assert.i:8:[kernel] warning: Body of function g falls-through. Adding a return statement /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/orig_name.res.oracle b/tests/syntax/oracle/orig_name.res.oracle index 76cfd424e6b67283fee842e49d1bc4d5e9645d0d..359da5180a5fc91815d04f2c92e9740e6c6e1136 100644 --- a/tests/syntax/oracle/orig_name.res.oracle +++ b/tests/syntax/oracle/orig_name.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/orig_name.i (no preprocessing) tests/syntax/orig_name.i:10:[kernel] Variable x has been renamed to x_1 tests/syntax/orig_name.i:7:[kernel] Variable x has been renamed to x_0 @@ -6,17 +5,13 @@ tests/syntax/orig_name.i:7:[kernel] Variable x has been renamed to x_0 int x = 1; int f(int x_0) { - int y; - y = 0; + int y = 0; if (x_0 == 0) { - int x_1; int tmp; - x_1 = 3; - { /* sequence */ - tmp = x_1; - x_1 ++; - y = tmp; - } + int x_1 = 3; + tmp = x_1; + x_1 ++; + y = tmp; } y += x_0; return y; diff --git a/tests/syntax/oracle/osx_attribute.err.oracle b/tests/syntax/oracle/osx_attribute.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/osx_attribute.res.oracle b/tests/syntax/oracle/osx_attribute.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..4d6fa4fd707b5ff1d7d65986ffd6db9c6f9f9173 --- /dev/null +++ b/tests/syntax/oracle/osx_attribute.res.oracle @@ -0,0 +1,13 @@ +[kernel] Parsing tests/syntax/osx_attribute.i (no preprocessing) +/* Generated by Frama-C */ +void f(void) __attribute__((__availability__(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7))); + +int main(void) +{ + int __retres; + f(); + __retres = 0; + return __retres; +} + + diff --git a/tests/syntax/oracle/preprocessed.res.oracle b/tests/syntax/oracle/preprocessed.res.oracle index 947999338bdb9c8ce5e078eaf59d0ac01748f93e..fbac227190fd236153fa1474b4163e1d4cc803f2 100644 --- a/tests/syntax/oracle/preprocessed.res.oracle +++ b/tests/syntax/oracle/preprocessed.res.oracle @@ -1,11 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/preprocessed.ci (external front-end) /* Generated by Frama-C */ /*@ ensures \result ≡ 42; */ int foo(void) { - int FOO; - FOO = 42; + int FOO = 42; return FOO; } diff --git a/tests/syntax/oracle/ptr_null_cmp_bts1027.res.oracle b/tests/syntax/oracle/ptr_null_cmp_bts1027.res.oracle index 80f0aae0ba117b24298ea5fadc9aad2d12c67d02..932aada7a728bdb09fd925a48dab07becb5b5dab 100644 --- a/tests/syntax/oracle/ptr_null_cmp_bts1027.res.oracle +++ b/tests/syntax/oracle/ptr_null_cmp_bts1027.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/ptr_null_cmp_bts1027.i (no preprocessing) /* Generated by Frama-C */ /*@ behavior normal: diff --git a/tests/syntax/oracle/reject_use_decl_mismatch_bts728.0.res.oracle b/tests/syntax/oracle/reject_use_decl_mismatch_bts728.0.res.oracle index 2cc4c230810ea043ecfbc3eac18d0accf6932eb8..8ccc90f5a6084cdd540ccb4488a5596f8065365b 100644 --- a/tests/syntax/oracle/reject_use_decl_mismatch_bts728.0.res.oracle +++ b/tests/syntax/oracle/reject_use_decl_mismatch_bts728.0.res.oracle @@ -1,7 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/reject_use_decl_mismatch_bts728.c (with preprocessing) tests/syntax/reject_use_decl_mismatch_bts728.c:19:[kernel] user error: Declaration of f does not match previous declaration from tests/syntax/reject_use_decl_mismatch_bts728.c:7 (different number of arguments). -[kernel] user error: Inconsistent formals +tests/syntax/reject_use_decl_mismatch_bts728.c:19:[kernel] user error: Inconsistent formals + 17 } + 18 + 19 int f(int x,int y, int z, int t,int t1,int t2,int t3,int t4,int t5,int t6) { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 20 x = 17; + 21 y=18; [kernel] user error: stopping on file "tests/syntax/reject_use_decl_mismatch_bts728.c" that has errors. Add '-kernel-msg-key pp' for preprocessing command. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/reject_use_decl_mismatch_bts728.1.res.oracle b/tests/syntax/oracle/reject_use_decl_mismatch_bts728.1.res.oracle index a6efb2c3842ebfcc2872775c55ee91a422d7d665..307d111edd670429500878c02d0a2552c4d7f608 100644 --- a/tests/syntax/oracle/reject_use_decl_mismatch_bts728.1.res.oracle +++ b/tests/syntax/oracle/reject_use_decl_mismatch_bts728.1.res.oracle @@ -1,8 +1,13 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/reject_use_decl_mismatch_bts728.c (with preprocessing) tests/syntax/reject_use_decl_mismatch_bts728.c:15:[kernel] warning: Calling undeclared function f. Old style K&R code? tests/syntax/reject_use_decl_mismatch_bts728.c:19:[kernel] user error: Declaration of f does not match previous declaration from tests/syntax/reject_use_decl_mismatch_bts728.c:15 (different number of arguments). -[kernel] user error: Inconsistent formals +tests/syntax/reject_use_decl_mismatch_bts728.c:19:[kernel] user error: Inconsistent formals + 17 } + 18 + 19 int f(int x,int y, int z, int t,int t1,int t2,int t3,int t4,int t5,int t6) { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 20 x = 17; + 21 y=18; [kernel] user error: stopping on file "tests/syntax/reject_use_decl_mismatch_bts728.c" that has errors. Add '-kernel-msg-key pp' for preprocessing command. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/reorder.res.oracle b/tests/syntax/oracle/reorder.res.oracle index d9970d9dc770011368e3ee59beebe95d90746c84..446708bfa1ce0a04272dfc3ceb4dca721cb7b986 100644 --- a/tests/syntax/oracle/reorder.res.oracle +++ b/tests/syntax/oracle/reorder.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/reorder.i (no preprocessing) /* Generated by Frama-C */ /*@ logic ℤ l= 1; @@ -31,10 +30,10 @@ void g(void); /*@ logic ℤ l= 1; */ int x; -/*@ logic ℤ j= l; - */ /*@ logic ℤ k= l; */ +/*@ logic ℤ j= l; + */ /*@ logic ℤ i= j + k; */ /*@ ensures i ≡ i; */ diff --git a/tests/syntax/oracle/rettype.res.oracle b/tests/syntax/oracle/rettype.res.oracle index 4dad10241415f3bc0032c6162b1de83feba139f0..2a08ea721a559da972205ca08f9b463e279573da 100644 --- a/tests/syntax/oracle/rettype.res.oracle +++ b/tests/syntax/oracle/rettype.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/rettype.i (no preprocessing) tests/syntax/rettype.i:8:[kernel] user error: Declaration of foo does not match previous declaration from tests/syntax/rettype.i:5 (different integer types: 'int' and 'unsigned short'). diff --git a/tests/syntax/oracle/simp_switch.res.oracle b/tests/syntax/oracle/simp_switch.res.oracle index ca437d576899c3680578a0b3932b953ed521f97d..8f500b1764565f5232783ed688c653e4898f25e9 100644 --- a/tests/syntax/oracle/simp_switch.res.oracle +++ b/tests/syntax/oracle/simp_switch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/simp_switch.i (no preprocessing) /* Generated by Frama-C */ void main(void) diff --git a/tests/syntax/oracle/sizeof_bts1414.res.oracle b/tests/syntax/oracle/sizeof_bts1414.res.oracle index 24b0835955f02a6cecd435488e84d8ce2d8900d3..6fd2775f94799010b498d2d831355b42f6f88d4f 100644 --- a/tests/syntax/oracle/sizeof_bts1414.res.oracle +++ b/tests/syntax/oracle/sizeof_bts1414.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/sizeof_bts1414.i (no preprocessing) tests/syntax/sizeof_bts1414.i:5:[kernel] Dropping side-effect in sizeof. Nothing to worry, this is by the book. tests/syntax/sizeof_bts1414.i:7:[kernel] Dropping side-effect in sizeof. Nothing to worry, this is by the book. @@ -13,8 +12,7 @@ int g(int *a) int tmp_0; case (int)sizeof(tmp_0): __retres = 1; goto return_label; - default: ; - __retres = 0; + default: __retres = 0; goto return_label; } __retres = x; diff --git a/tests/syntax/oracle/spurious_brace_bts_1273.res.oracle b/tests/syntax/oracle/spurious_brace_bts_1273.res.oracle index e8e50ea26aa07bec48e7bdfa812a675ad17e6bc8..717ad8e1901c268e10a9e1209b959d13c4d6b590 100644 --- a/tests/syntax/oracle/spurious_brace_bts_1273.res.oracle +++ b/tests/syntax/oracle/spurious_brace_bts_1273.res.oracle @@ -1,10 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/spurious_brace_bts_1273.i (no preprocessing) -[kernel] syntax error at tests/syntax/spurious_brace_bts_1273.i:3: +[kernel] syntax error at tests/syntax/spurious_brace_bts_1273.i, between lines 1 and 3, before or at token: } + 1 void foo() { 2 } 3 } - ^ + 4 5 void main () { [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/static_formals_1.res.oracle b/tests/syntax/oracle/static_formals_1.res.oracle index 46dda5fb9a99f074ed3345766d28d286b449be54..a699b713faad14c29361449e3f4a8152e80d9635 100644 --- a/tests/syntax/oracle/static_formals_1.res.oracle +++ b/tests/syntax/oracle/static_formals_1.res.oracle @@ -1,25 +1,24 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/static_formals_1.c (with preprocessing) [kernel] Parsing tests/syntax/static_formals_2.c (with preprocessing) /* Generated by Frama-C */ -/*@ requires /* vid:70, lvid:70 */x < 10; */ -static int /* vid:99 */f(int /* vid:70, lvid:70 */x); +/*@ requires /* vid:23, lvid:23 */x < 10; */ +static int /* vid:52 */f(int /* vid:23, lvid:23 */x); -int /* vid:73 */g(void) +int /* vid:26 */g(void) { - int /* vid:74 */tmp; - /* vid:74 */tmp = /* vid:99 */f(4); - return /* vid:74 */tmp; + int /* vid:27 */tmp; + /* vid:27 */tmp = /* vid:52 */f(4); + return /* vid:27 */tmp; } -/*@ requires /* vid:94, lvid:94 */x < 10; */ -static int /* vid:100 */f_0(int /* vid:94, lvid:94 */x); +/*@ requires /* vid:47, lvid:47 */x < 10; */ +static int /* vid:53 */f_0(int /* vid:47, lvid:47 */x); -int /* vid:97 */h(void) +int /* vid:50 */h(void) { - int /* vid:98 */tmp; - /* vid:98 */tmp = /* vid:100 */f_0(6); - return /* vid:98 */tmp; + int /* vid:51 */tmp; + /* vid:51 */tmp = /* vid:53 */f_0(6); + return /* vid:51 */tmp; } diff --git a/tests/syntax/oracle/struct_copy.res.oracle b/tests/syntax/oracle/struct_copy.res.oracle index 6bd8c6f1746c819f7721cfaf931fd8104fcb4abc..b207ba55be30f267c6aaca2dd12aeee42c480bf0 100644 --- a/tests/syntax/oracle/struct_copy.res.oracle +++ b/tests/syntax/oracle/struct_copy.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/struct_copy.i (no preprocessing) /* Generated by Frama-C */ struct inner { diff --git a/tests/syntax/oracle/switch-default.err.oracle b/tests/syntax/oracle/switch-default.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/switch-default.res.oracle b/tests/syntax/oracle/switch-default.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..4f34125fc0b2b3c382a4c62be4d26b22dc2ccefa --- /dev/null +++ b/tests/syntax/oracle/switch-default.res.oracle @@ -0,0 +1,34 @@ +[kernel] Parsing tests/syntax/switch-default.i (no preprocessing) +/* Generated by Frama-C */ +extern int ( /* missing proto */ Frama_C_show_each_i)(); + +int main(void) +{ + int __retres; + int x = 42; + { + int i = 0; + while (i < 4) { + switch (x) { + default: Frama_C_show_each_i(i); + break; + } + i ++; + } + } + __retres = 0; + return __retres; +} + +void f(void) +{ + int i; + switch (0) { + case 0: i = 1; + break; + default: i = 9; + } + return; +} + + diff --git a/tests/syntax/oracle/syntactic_hook.res.oracle b/tests/syntax/oracle/syntactic_hook.res.oracle index c8945ba59b03ac9d87ec5e9614500b4c87dc3ace..08085da47c6de3499c4ca33194834d946180a998 100644 --- a/tests/syntax/oracle/syntactic_hook.res.oracle +++ b/tests/syntax/oracle/syntactic_hook.res.oracle @@ -1,48 +1,42 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -share/libc/__fc_builtin_for_normalization.i:34:[kernel] New global node introducing identifier Frama_C_bzero(24) -[kernel] First occurrence of Frama_C_bzero -share/libc/__fc_builtin_for_normalization.i:43:[kernel] New global node introducing identifier Frama_C_copy_block(40) -[kernel] First occurrence of Frama_C_copy_block [kernel] Parsing tests/syntax/syntactic_hook.i (no preprocessing) -tests/syntax/syntactic_hook.i:5:[kernel] New global node introducing identifier f(69) +tests/syntax/syntactic_hook.i:5:[kernel] New global node introducing identifier f(22) [kernel] First occurrence of f -tests/syntax/syntactic_hook.i:7:[kernel] New global node introducing identifier h(72) -[kernel] First occurrence of h -tests/syntax/syntactic_hook.i:9:[kernel] warning: [SH]: definition of h does not use exactly the same prototype as declared on line 7 -tests/syntax/syntactic_hook.i:9:[kernel] New global node introducing identifier h(72) -[kernel] New occurrence of existing identifier h -tests/syntax/syntactic_hook.i:11:[kernel] New global node introducing identifier k(79) +tests/syntax/syntactic_hook.i:7:[kernel] New global node introducing identifier k(25) [kernel] First occurrence of k -tests/syntax/syntactic_hook.i:13:[kernel] New global node introducing identifier k(79) +tests/syntax/syntactic_hook.i:9:[kernel] New global node introducing identifier k(25) [kernel] New occurrence of existing identifier k -tests/syntax/syntactic_hook.i:15:[kernel] New global node introducing identifier main(85) +tests/syntax/syntactic_hook.i:11:[kernel] New global node introducing identifier main(31) [kernel] First occurrence of main -tests/syntax/syntactic_hook.i:17:[kernel] New global node introducing identifier t(89) +tests/syntax/syntactic_hook.i:13:[kernel] New global node introducing identifier t(35) [kernel] First occurrence of t -tests/syntax/syntactic_hook.i:17:[kernel] warning: [SH]: definition of local function t -:0:[kernel] New global node introducing identifier g(91) +tests/syntax/syntactic_hook.i:13:[kernel] warning: [SH]: definition of local function t +:0:[kernel] New global node introducing identifier g(37) [kernel] First occurrence of g -tests/syntax/syntactic_hook.i:21:[kernel] warning: Calling undeclared function g. Old style K&R code? -tests/syntax/syntactic_hook.i:21:[kernel] warning: [SH]: implicit declaration for prototype g -tests/syntax/syntactic_hook.i:22:[kernel] Dropping side-effect in sizeof. Nothing to worry, this is by the book. -tests/syntax/syntactic_hook.i:22:[kernel] warning: [SH]: dropping side effect in sizeof: x++ is converted to tmp -tests/syntax/syntactic_hook.i:24:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x +tests/syntax/syntactic_hook.i:17:[kernel] warning: Calling undeclared function g. Old style K&R code? +tests/syntax/syntactic_hook.i:17:[kernel] warning: [SH]: implicit declaration for prototype g +tests/syntax/syntactic_hook.i:18:[kernel] Dropping side-effect in sizeof. Nothing to worry, this is by the book. +tests/syntax/syntactic_hook.i:18:[kernel] warning: [SH]: dropping side effect in sizeof: x++ is converted to tmp +tests/syntax/syntactic_hook.i:20:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x && x++. It is not always executed -tests/syntax/syntactic_hook.i:25:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x +tests/syntax/syntactic_hook.i:21:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x && (x++ || x). It is not always executed -tests/syntax/syntactic_hook.i:26:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x +tests/syntax/syntactic_hook.i:22:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x || x++. It is not always executed -tests/syntax/syntactic_hook.i:27:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x +tests/syntax/syntactic_hook.i:23:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x ? x++ : x++. It is not always executed -tests/syntax/syntactic_hook.i:27:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x +tests/syntax/syntactic_hook.i:23:[kernel] warning: [SH]: side effect of expression x++ occurs in conditional part of expression x ? x++ : x++. It is not always executed -tests/syntax/syntactic_hook.i:31:[kernel] user error: Declaration of f does not match previous declaration from tests/syntax/syntactic_hook.i:5 (different number of arguments). -tests/syntax/syntactic_hook.i:31:[kernel] warning: [SH]: conflict with declaration of f at line 5: different number of arguments -[kernel] user error: Inconsistent formals +tests/syntax/syntactic_hook.i:27:[kernel] user error: Declaration of f does not match previous declaration from tests/syntax/syntactic_hook.i:5 (different number of arguments). +tests/syntax/syntactic_hook.i:27:[kernel] warning: [SH]: conflict with declaration of f at line 5: different number of arguments +tests/syntax/syntactic_hook.i:27:[kernel] user error: Inconsistent formals + 25 } + 26 + 27 int f(int); //error: conflicting decls + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [kernel] user error: stopping on file "tests/syntax/syntactic_hook.i" that has errors. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/ternary_brace.err.oracle b/tests/syntax/oracle/ternary_brace.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/ternary_brace.res.oracle b/tests/syntax/oracle/ternary_brace.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e0ef33060190e253b2c8511759c324172db89c63 --- /dev/null +++ b/tests/syntax/oracle/ternary_brace.res.oracle @@ -0,0 +1,28 @@ +[kernel] Parsing tests/syntax/ternary_brace.i (no preprocessing) +/* Generated by Frama-C */ +int main(void) +{ + int i = 1; + if (i < 2) { + i ++; + i = i; + } + else { + int tmp; + tmp = i; + i ++; + i = tmp; + } + if (i < 2) { + i ++; + i = i; + } + else { + int tmp_0 = i; + i ++; + i = tmp_0; + } + return i; +} + + diff --git a/tests/syntax/oracle/ternary_bts1503.res.oracle b/tests/syntax/oracle/ternary_bts1503.res.oracle index 39204927dbec821514fd9377cf31996721446545..6b55466241027fbe63aba064e85a9f3964a6b7e6 100644 --- a/tests/syntax/oracle/ternary_bts1503.res.oracle +++ b/tests/syntax/oracle/ternary_bts1503.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/ternary_bts1503.i (no preprocessing) /* Generated by Frama-C */ void f(void) diff --git a/tests/syntax/oracle/type_branch_bts_1081.res.oracle b/tests/syntax/oracle/type_branch_bts_1081.res.oracle index d1b7094c1bdfc391b299fa6cb145169c6fcdc1c2..8976d69c61b9a16e942ab887b4a1f822ce632450 100644 --- a/tests/syntax/oracle/type_branch_bts_1081.res.oracle +++ b/tests/syntax/oracle/type_branch_bts_1081.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/type_branch_bts_1081.i (no preprocessing) tests/syntax/type_branch_bts_1081.i:5:[kernel] failure: invalid implicit conversion from void to signed char [kernel] user error: stopping on file "tests/syntax/type_branch_bts_1081.i" that has errors. diff --git a/tests/syntax/oracle/type_redef.0.res.oracle b/tests/syntax/oracle/type_redef.0.res.oracle index 2563fbd5d451b92657cc47aa5eae93b337b5b99b..c6e75066ef3e9212933543eba069696ab1d4c242 100644 --- a/tests/syntax/oracle/type_redef.0.res.oracle +++ b/tests/syntax/oracle/type_redef.0.res.oracle @@ -1,12 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/type_redef.i (no preprocessing) tests/syntax/type_redef.i:7:[kernel] user error: redefinition of type 'myint' in the same scope is only allowed in C11 (option -c11). Previous declaration was at tests/syntax/type_redef.i:6 tests/syntax/type_redef.i:10:[kernel] user error: redefinition of type 'list' in the same scope is only allowed in C11 (option -c11). Previous declaration was at tests/syntax/type_redef.i:9 -tests/syntax/type_redef.i:13:[kernel] user error: redefinition of type 'st' in the same scope with conflicting type. +tests/syntax/type_redef.i:13:[kernel] user error: redefinition of type 'st' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:12 -tests/syntax/type_redef.i:18:[kernel] user error: redefinition of type 'u' in the same scope with conflicting type. +tests/syntax/type_redef.i:18:[kernel] user error: redefinition of type 'u' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:17 tests/syntax/type_redef.i:21:[kernel] user error: redefinition of 'A' in the same scope. Previous declaration was at tests/syntax/type_redef.i:20 @@ -14,7 +13,7 @@ tests/syntax/type_redef.i:21:[kernel] user error: redefinition of type 'e' in th Previous declaration was at tests/syntax/type_redef.i:20 tests/syntax/type_redef.i:24:[kernel] user error: redefinition of 'B' in the same scope. Previous declaration was at tests/syntax/type_redef.i:23 -tests/syntax/type_redef.i:26:[kernel] user error: redefinition of type 'st1' in the same scope with conflicting type. +tests/syntax/type_redef.i:26:[kernel] user error: redefinition of type 'st1' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:15 tests/syntax/type_redef.i:30:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported tests/syntax/type_redef.i:31:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported @@ -28,7 +27,7 @@ tests/syntax/type_redef.i:44:[kernel] user error: redefinition of type 'ftest_t' Previous declaration was at tests/syntax/type_redef.i:43 tests/syntax/type_redef.i:48:[kernel] user error: redefinition of type 'stt' in the same scope is only allowed in C11 (option -c11). Previous declaration was at tests/syntax/type_redef.i:47 -tests/syntax/type_redef.i:49:[kernel] user error: redefinition of type 'stt' in the same scope with conflicting type. +tests/syntax/type_redef.i:49:[kernel] user error: redefinition of type 'stt' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:47 tests/syntax/type_redef.i:53:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported tests/syntax/type_redef.i:57:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported diff --git a/tests/syntax/oracle/type_redef.1.res.oracle b/tests/syntax/oracle/type_redef.1.res.oracle index a7daa8d0caa5cb6c73a139bfb20e6aad6178e9f3..13b9ec74acb2e72ff77bf7233d8b5c4e1b5d8c4b 100644 --- a/tests/syntax/oracle/type_redef.1.res.oracle +++ b/tests/syntax/oracle/type_redef.1.res.oracle @@ -1,8 +1,7 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/type_redef.i (no preprocessing) -tests/syntax/type_redef.i:13:[kernel] user error: redefinition of type 'st' in the same scope with conflicting type. +tests/syntax/type_redef.i:13:[kernel] user error: redefinition of type 'st' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:12 -tests/syntax/type_redef.i:18:[kernel] user error: redefinition of type 'u' in the same scope with conflicting type. +tests/syntax/type_redef.i:18:[kernel] user error: redefinition of type 'u' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:17 tests/syntax/type_redef.i:21:[kernel] user error: redefinition of 'A' in the same scope. Previous declaration was at tests/syntax/type_redef.i:20 @@ -10,7 +9,7 @@ tests/syntax/type_redef.i:21:[kernel] user error: redefinition of type 'e' in th Previous declaration was at tests/syntax/type_redef.i:20 tests/syntax/type_redef.i:24:[kernel] user error: redefinition of 'B' in the same scope. Previous declaration was at tests/syntax/type_redef.i:23 -tests/syntax/type_redef.i:26:[kernel] user error: redefinition of type 'st1' in the same scope with conflicting type. +tests/syntax/type_redef.i:26:[kernel] user error: redefinition of type 'st1' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:15 tests/syntax/type_redef.i:30:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported tests/syntax/type_redef.i:31:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported @@ -20,7 +19,7 @@ tests/syntax/type_redef.i:38:[kernel] user error: redefinition of type 'ci' in t Previous declaration was at tests/syntax/type_redef.i:37 tests/syntax/type_redef.i:44:[kernel] user error: redefinition of type 'ftest_t' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:43 -tests/syntax/type_redef.i:49:[kernel] user error: redefinition of type 'stt' in the same scope with conflicting type. +tests/syntax/type_redef.i:49:[kernel] user error: redefinition of type 'stt' in the same scope with incompatible type. Previous declaration was at tests/syntax/type_redef.i:47 tests/syntax/type_redef.i:53:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported tests/syntax/type_redef.i:57:[kernel] failure: redefinition of a typedef in a non-global scope is currently unsupported diff --git a/tests/syntax/oracle/typedef_multi_1.res.oracle b/tests/syntax/oracle/typedef_multi_1.res.oracle index 27b6bed3508c1711696aed805c4d7de7d56596ae..0b5a63e42cebfcb3ad43092a4253817fd443537a 100644 --- a/tests/syntax/oracle/typedef_multi_1.res.oracle +++ b/tests/syntax/oracle/typedef_multi_1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/typedef_multi_1.c (with preprocessing) [kernel] Parsing tests/syntax/typedef_multi_2.c (with preprocessing) /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/typedef_namespace_bts1500.0.res.oracle b/tests/syntax/oracle/typedef_namespace_bts1500.0.res.oracle index a68244b4a806d57957a96ee33878cdf9de6874d5..dac79fa8c28ed0d122f90ee83dc0ac7e7dd0a8f9 100644 --- a/tests/syntax/oracle/typedef_namespace_bts1500.0.res.oracle +++ b/tests/syntax/oracle/typedef_namespace_bts1500.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/typedef_namespace_bts1500.c (with preprocessing) /* Generated by Frama-C */ typedef int digit; @@ -9,10 +8,8 @@ digit A; int main(void) { int __retres; - digit x; - int digit_0; - x = 4; - digit_0 = 3; + digit x = 4; + int digit_0 = 3; __retres = (x + digit_0) + A; return __retres; } diff --git a/tests/syntax/oracle/typedef_namespace_bts1500.1.res.oracle b/tests/syntax/oracle/typedef_namespace_bts1500.1.res.oracle index 4ba3351930e255bf73a61473f3b8952189c17644..5f6d05d5985f01a62ba5e58af4ae85e7c269cfcc 100644 --- a/tests/syntax/oracle/typedef_namespace_bts1500.1.res.oracle +++ b/tests/syntax/oracle/typedef_namespace_bts1500.1.res.oracle @@ -1,10 +1,13 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/typedef_namespace_bts1500.c (with preprocessing) -[kernel] syntax error at tests/syntax/typedef_namespace_bts1500.c:23: +[kernel] syntax error at tests/syntax/typedef_namespace_bts1500.c, between lines 20 and 23, before or at token: y + 18 int main () { + 19 digit x = 4; + + 20 int digit = 3; 21 // error: digit is now a variable 22 #ifdef HIDING_TYPEDEF 23 digit y = 5; - ^^^^^^^^^^^^^^ + 24 #endif 25 return x + digit+A; [kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/typedef_namespace_bts1500.2.res.oracle b/tests/syntax/oracle/typedef_namespace_bts1500.2.res.oracle index 639ab4610caafe0515610b79553c65617888c06c..e67bbec973f7b25c17a858169ff0f3af6af44851 100644 --- a/tests/syntax/oracle/typedef_namespace_bts1500.2.res.oracle +++ b/tests/syntax/oracle/typedef_namespace_bts1500.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/typedef_namespace_bts1500.c (with preprocessing) tests/syntax/typedef_namespace_bts1500.c:31:[kernel] user error: redefinition of 'digit' with different kind in the same scope. Previous declaration was at tests/syntax/typedef_namespace_bts1500.c:6 diff --git a/tests/syntax/oracle/typeof.res.oracle b/tests/syntax/oracle/typeof.res.oracle index 1022ee23e878051bea619b19faa086aad57ba5f5..29192b8646f7072640be7e2e0ee26d30bb417c97 100644 --- a/tests/syntax/oracle/typeof.res.oracle +++ b/tests/syntax/oracle/typeof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/typeof.i (no preprocessing) /* Generated by Frama-C */ int f(int x) diff --git a/tests/syntax/oracle/undeclared_local_bts1113.res.oracle b/tests/syntax/oracle/undeclared_local_bts1113.res.oracle index dc465079d9ee6e988518073ae85a9d871ed18bc0..95054276f8a5385a005ed47d4ac697d8c3dfdb30 100644 --- a/tests/syntax/oracle/undeclared_local_bts1113.res.oracle +++ b/tests/syntax/oracle/undeclared_local_bts1113.res.oracle @@ -1,52 +1,39 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/undeclared_local_bts1113.c (with preprocessing) -tests/syntax/undeclared_local_bts1113.c:3:[kernel] warning: Variable-sized local variable k -tests/syntax/undeclared_local_bts1113.c:4:[kernel] warning: Variable-sized local variable kk -tests/syntax/undeclared_local_bts1113.c:7:[kernel] warning: Variable-sized local variable k_long_long_size /* Generated by Frama-C */ -void *alloca(unsigned int); + __attribute__((__FC_BUILTIN__)) void __fc_vla_free(void *); + +void *__fc_vla_alloc(unsigned int); void funk(int rounds) { - int *k; unsigned int __lengthof_k; - int *kk; unsigned int __lengthof_kk; int i; - long long j; - int *k_long_long_size; unsigned int __lengthof_k_long_long_size; - { /* sequence */ - /*@ assert alloca_bounds: 0 < sizeof(*k) * (2 * rounds) ≤ 4294967295; - */ - ; - __lengthof_k = (unsigned int)(2 * rounds); - k = (int *)alloca(sizeof(*k) * __lengthof_k); - } - { /* sequence */ - /*@ - assert - alloca_bounds: - 0 < sizeof(*kk) * (unsigned int)(2 * rounds) ≤ 4294967295; - */ - ; - __lengthof_kk = (unsigned int)(2 * rounds); - kk = (int *)alloca(sizeof(*kk) * __lengthof_kk); - } - j = (long long)(rounds * rounds); - { /* sequence */ - /*@ - assert - alloca_bounds: 0 < sizeof(*k_long_long_size) * (j * 2) ≤ 4294967295; */ - ; - __lengthof_k_long_long_size = (unsigned int)(j * (long long)2); - k_long_long_size = (int *)alloca(sizeof(*k_long_long_size) * __lengthof_k_long_long_size); - } + /*@ assert alloca_bounds: 0 < sizeof(int) * (2 * rounds) ≤ 4294967295; */ + ; + __lengthof_k = (unsigned int)(2 * rounds); + int *k = __fc_vla_alloc(sizeof(int) * __lengthof_k); + /*@ + assert + alloca_bounds: 0 < sizeof(int) * (unsigned int)(2 * rounds) ≤ 4294967295; + */ + ; + __lengthof_kk = (unsigned int)(2 * rounds); + int *kk = __fc_vla_alloc(sizeof(int) * __lengthof_kk); + long long j = (long long)(rounds * rounds); + /*@ assert alloca_bounds: 0 < sizeof(int) * (j * 2) ≤ 4294967295; */ ; + __lengthof_k_long_long_size = (unsigned int)(j * (long long)2); + int *k_long_long_size = + __fc_vla_alloc(sizeof(int) * __lengthof_k_long_long_size); i = 0; while (i < 2 * rounds) { *(k + i) = i; i ++; } + __fc_vla_free((void *)k_long_long_size); + __fc_vla_free((void *)kk); + __fc_vla_free((void *)k); return; } diff --git a/tests/syntax/oracle/undeclared_local_bts1126.res.oracle b/tests/syntax/oracle/undeclared_local_bts1126.res.oracle index 0be0668b2c4a22f1734a4be3447cb77c8447f238..f088e10cf3332963d51b18d465c995f535e8200f 100644 --- a/tests/syntax/oracle/undeclared_local_bts1126.res.oracle +++ b/tests/syntax/oracle/undeclared_local_bts1126.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/undeclared_local_bts1126.c (with preprocessing) tests/syntax/undeclared_local_bts1126.c:35:[kernel] warning: Calling undeclared function _gnutls_epoch_get. Old style K&R code? tests/syntax/undeclared_local_bts1126.c:37:[kernel] warning: Calling undeclared function gnutls_assert_val. Old style K&R code? @@ -64,14 +63,10 @@ int _gnutls_epoch_set_cipher_suite(gnutls_session_t session, int epoch_rel, __retres = tmp_0; goto return_label; } - { /* sequence */ - tmp_1 = _gnutls_cipher_suite_get_cipher_algo(suite); - cipher_algo = (void (*)(int ))tmp_1; - } - { /* sequence */ - tmp_2 = _gnutls_cipher_suite_get_mac_algo(suite); - mac_algo = (void (*)(int ))tmp_2; - } + tmp_1 = _gnutls_cipher_suite_get_cipher_algo(suite); + cipher_algo = (void (*)(int ))tmp_1; + tmp_2 = _gnutls_cipher_suite_get_mac_algo(suite); + mac_algo = (void (*)(int ))tmp_2; tmp_4 = _gnutls_cipher_is_ok(cipher_algo); if (tmp_4 != 0) goto _LOR_0; else { diff --git a/tests/syntax/oracle/unroll_const.res.oracle b/tests/syntax/oracle/unroll_const.res.oracle index f2291b1241e8f1c9c39649106a2639bd35bc283d..37481c4b7191ee1e164a633efc2fb1681462ac58 100644 --- a/tests/syntax/oracle/unroll_const.res.oracle +++ b/tests/syntax/oracle/unroll_const.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unroll_const.i (no preprocessing) /* Generated by Frama-C */ struct __anonstruct_u_1 { @@ -21,8 +20,7 @@ struct s const s = {.i = 5, .j = 8, .v = {.k = 3, .l = 0}}; int volatile c; void main(void) { - unsigned int i; - i = (unsigned int)0; + unsigned int i = (unsigned int)0; if (! c) goto unrolling_2_loop; i ++; unrolling_6_loop: ; diff --git a/tests/syntax/oracle/unroll_labels.0.res.oracle b/tests/syntax/oracle/unroll_labels.0.res.oracle index de145dee338acc7cebd6c91d16e0231d4e7a4a0b..9c45c40a92acdcd02c58f8d7ee625264fd45e48e 100644 --- a/tests/syntax/oracle/unroll_labels.0.res.oracle +++ b/tests/syntax/oracle/unroll_labels.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unroll_labels.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -22,11 +21,9 @@ enum __anonenum_1 { int volatile foo; void main(void) { - int j; - j = 0; + int j = 0; { - int i; - i = 1; + int i = 1; if (! (i < 4)) goto unrolling_2_loop; switch (i) { case 1: j ++; @@ -37,8 +34,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_6_loop: ; @@ -52,8 +48,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_5_loop: ; @@ -67,8 +62,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_4_loop: ; @@ -82,8 +76,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_3_loop: ; @@ -101,50 +94,44 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; } unrolling_2_loop: ; } { - int x; - x = 0; + int x = 0; L: - if (! (x < 5)) goto unrolling_8_loop; - { - int y_unroll_32; - y_unroll_32 = 0; - x ++; - y_unroll_32 ++; - } - unrolling_11_loop: ; - if (! (x < 5)) goto unrolling_8_loop; - { - int y_unroll_28; - y_unroll_28 = 0; - x ++; - y_unroll_28 ++; - } - unrolling_10_loop: ; - if (! (x < 5)) goto unrolling_8_loop; - { - int y_unroll_24; - y_unroll_24 = 0; - x ++; - y_unroll_24 ++; - } - unrolling_9_loop: ; - /*@ loop pragma UNROLL 3; - loop pragma UNROLL "done", 3; */ - while (x < 5) { - int y; - y = 0; - x ++; - y ++; - } - unrolling_8_loop: ; + if (! (x < 5)) goto unrolling_8_loop; + { + int y_unroll_32 = 0; + x ++; + y_unroll_32 ++; + } + unrolling_11_loop: ; + if (! (x < 5)) goto unrolling_8_loop; + { + int y_unroll_28 = 0; + x ++; + y_unroll_28 ++; + } + unrolling_10_loop: ; + if (! (x < 5)) goto unrolling_8_loop; + { + int y_unroll_24 = 0; + x ++; + y_unroll_24 ++; + } + unrolling_9_loop: ; + /*@ loop pragma UNROLL 3; + loop pragma UNROLL "done", 3; */ + while (x < 5) { + int y = 0; + x ++; + y ++; + } + unrolling_8_loop: ; } j = 0; if (! foo) goto unrolling_18_loop; @@ -152,19 +139,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; - j ++; - unrolling_16_loop_unrolling_45_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; - j ++; - unrolling_15_loop_unrolling_46_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; - j ++; - unrolling_14_loop_unrolling_47_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_48_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; + j ++; + unrolling_16_loop_unrolling_45_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; + j ++; + unrolling_15_loop_unrolling_46_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; + j ++; + unrolling_14_loop_unrolling_47_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_48_loop: ; break; case 5: j = -1; break; @@ -177,19 +164,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; - j ++; - unrolling_16_loop_unrolling_40_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; - j ++; - unrolling_15_loop_unrolling_41_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; - j ++; - unrolling_14_loop_unrolling_42_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_43_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; + j ++; + unrolling_16_loop_unrolling_40_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; + j ++; + unrolling_15_loop_unrolling_41_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; + j ++; + unrolling_14_loop_unrolling_42_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_43_loop: ; break; case 5: j = -1; break; @@ -202,19 +189,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; - j ++; - unrolling_16_loop_unrolling_35_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; - j ++; - unrolling_15_loop_unrolling_36_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; - j ++; - unrolling_14_loop_unrolling_37_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_38_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; + j ++; + unrolling_16_loop_unrolling_35_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; + j ++; + unrolling_15_loop_unrolling_36_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; + j ++; + unrolling_14_loop_unrolling_37_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_38_loop: ; break; case 5: j = -1; break; @@ -227,19 +214,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; - j ++; - unrolling_16_loop_unrolling_30_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; - j ++; - unrolling_15_loop_unrolling_31_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; - j ++; - unrolling_14_loop_unrolling_32_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_33_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; + j ++; + unrolling_16_loop_unrolling_30_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; + j ++; + unrolling_15_loop_unrolling_31_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; + j ++; + unrolling_14_loop_unrolling_32_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_33_loop: ; break; case 5: j = -1; break; @@ -252,19 +239,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; - j ++; - unrolling_16_loop_unrolling_25_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; - j ++; - unrolling_15_loop_unrolling_26_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; - j ++; - unrolling_14_loop_unrolling_27_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_28_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; + j ++; + unrolling_16_loop_unrolling_25_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; + j ++; + unrolling_15_loop_unrolling_26_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; + j ++; + unrolling_14_loop_unrolling_27_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_28_loop: ; break; case 5: j = -1; break; @@ -277,19 +264,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; - j ++; - unrolling_16_loop_unrolling_20_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; - j ++; - unrolling_15_loop_unrolling_21_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; - j ++; - unrolling_14_loop_unrolling_22_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_23_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; + j ++; + unrolling_16_loop_unrolling_20_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; + j ++; + unrolling_15_loop_unrolling_21_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; + j ++; + unrolling_14_loop_unrolling_22_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_23_loop: ; break; case 5: j = -1; break; @@ -304,19 +291,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop; - j ++; - unrolling_16_loop: ; - if (! (j < 5)) goto unrolling_13_loop; - j ++; - unrolling_15_loop: ; - if (! (j < 5)) goto unrolling_13_loop; - j ++; - unrolling_14_loop: ; - /*@ loop pragma UNROLL 3; - loop pragma UNROLL "done", 3; */ - while (j < 5) j ++; - unrolling_13_loop: ; + if (! (j < 5)) goto unrolling_13_loop; + j ++; + unrolling_16_loop: ; + if (! (j < 5)) goto unrolling_13_loop; + j ++; + unrolling_15_loop: ; + if (! (j < 5)) goto unrolling_13_loop; + j ++; + unrolling_14_loop: ; + /*@ loop pragma UNROLL 3; + loop pragma UNROLL "done", 3; */ + while (j < 5) j ++; + unrolling_13_loop: ; break; case 5: j = -1; break; @@ -328,30 +315,28 @@ void main(void) if (j == 1) goto un; goto return_label; zero: - if (! (j < 5)) goto unrolling_50_loop; - un_unrolling_56_loop: j ++; - unrolling_55_loop: ; - if (! (j < 5)) goto unrolling_50_loop; - un_unrolling_54_loop: j ++; - unrolling_53_loop: ; - if (! (j < 5)) goto unrolling_50_loop; - un_unrolling_52_loop: j ++; - unrolling_51_loop: ; - /*@ loop pragma UNROLL 3; - loop pragma UNROLL "done", 3; */ - while (j < 5) un: j ++; - unrolling_50_loop: ; + if (! (j < 5)) goto unrolling_50_loop; + un_unrolling_56_loop: j ++; + unrolling_55_loop: ; + if (! (j < 5)) goto unrolling_50_loop; + un_unrolling_54_loop: j ++; + unrolling_53_loop: ; + if (! (j < 5)) goto unrolling_50_loop; + un_unrolling_52_loop: j ++; + unrolling_51_loop: ; + /*@ loop pragma UNROLL 3; + loop pragma UNROLL "done", 3; */ + while (j < 5) un: j ++; + unrolling_50_loop: ; return_label: return; } void main2(void) { - int i; - i = 0; + int i = 0; if (! (i < 2)) goto unrolling_58_loop; { - int j_unroll_192; - j_unroll_192 = 0; + int j_unroll_192 = 0; while (j_unroll_192 < 2) { i ++; goto foo_unrolling_62_loop; @@ -364,8 +349,7 @@ void main2(void) unrolling_61_loop: ; if (! (i < 2)) goto unrolling_58_loop; { - int j_unroll_184; - j_unroll_184 = 0; + int j_unroll_184 = 0; while (j_unroll_184 < 2) { i ++; goto foo_unrolling_60_loop; @@ -380,8 +364,7 @@ void main2(void) loop pragma UNROLL "done", 2; */ while (i < 2) { { - int j; - j = 0; + int j = 0; while (j < 2) { i ++; goto foo; @@ -398,14 +381,12 @@ void main2(void) void main2_done(void) { - int i; - i = 0; + int i = 0; /*@ loop pragma UNROLL 2; loop pragma UNROLL "done", 2; */ while (i < 2) { { - int j; - j = 0; + int j = 0; if (! (j < 2)) goto unrolling_64_loop; i ++; goto foo_unrolling_68_loop; @@ -438,13 +419,11 @@ void main2_done(void) void main3(int c) { - int i; - i = 0; + int i = 0; if (c == 0) goto foo; if (! (i < 5)) goto unrolling_70_loop; { - int j_unroll_244; - j_unroll_244 = 0; + int j_unroll_244 = 0; if (i == j_unroll_244) goto foo_unrolling_77_loop; if (i == 1) goto unrolling_70_loop; if (i == 2) goto __Cont_unrolling_80_loop; @@ -463,8 +442,7 @@ void main3(int c) unrolling_76_loop: ; if (! (i < 5)) goto unrolling_70_loop; { - int j_unroll_222; - j_unroll_222 = 0; + int j_unroll_222 = 0; if (i == j_unroll_222) goto foo_unrolling_72_loop; if (i == 1) goto unrolling_70_loop; if (i == 2) goto __Cont_unrolling_75_loop; @@ -485,8 +463,7 @@ void main3(int c) loop pragma UNROLL "done", 2; */ while (i < 5) { { - int j; - j = 0; + int j = 0; if (i == j) goto foo; if (i == 1) break; if (i == 2) goto __Cont; diff --git a/tests/syntax/oracle/unroll_labels.1.res.oracle b/tests/syntax/oracle/unroll_labels.1.res.oracle index aabcfc53b90e24be824d0ec47d1e09b84a983836..0bdf9e3a9ae9271b0f433be26a18cd9f9c648e10 100644 --- a/tests/syntax/oracle/unroll_labels.1.res.oracle +++ b/tests/syntax/oracle/unroll_labels.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unroll_labels.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state @@ -17,11 +16,9 @@ enum __anonenum_1 { int volatile foo; void main(void) { - int j; - j = 0; + int j = 0; { - int i; - i = 1; + int i = 1; if (! (i < 4)) goto unrolling_2_loop; switch (i) { case 1: j ++; @@ -32,8 +29,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_6_loop: ; @@ -47,8 +43,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_5_loop: ; @@ -62,8 +57,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_4_loop: ; @@ -77,8 +71,7 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; unrolling_3_loop: ; @@ -96,50 +89,44 @@ void main(void) break; case 4: j += 7; break; - default: ; - j = 0; + default: j = 0; } i ++; } unrolling_2_loop: ; } { - int x; - x = 0; + int x = 0; L: - if (! (x < 5)) goto unrolling_8_loop; - { - int y_unroll_32; - y_unroll_32 = 0; - x ++; - y_unroll_32 ++; - } - unrolling_11_loop: ; - if (! (x < 5)) goto unrolling_8_loop; - { - int y_unroll_28; - y_unroll_28 = 0; - x ++; - y_unroll_28 ++; - } - unrolling_10_loop: ; - if (! (x < 5)) goto unrolling_8_loop; - { - int y_unroll_24; - y_unroll_24 = 0; - x ++; - y_unroll_24 ++; - } - unrolling_9_loop: ; - /*@ loop pragma UNROLL 3; - loop pragma UNROLL "done", 3; */ - while (x < 5) { - int y; - y = 0; - x ++; - y ++; - } - unrolling_8_loop: ; + if (! (x < 5)) goto unrolling_8_loop; + { + int y_unroll_32 = 0; + x ++; + y_unroll_32 ++; + } + unrolling_11_loop: ; + if (! (x < 5)) goto unrolling_8_loop; + { + int y_unroll_28 = 0; + x ++; + y_unroll_28 ++; + } + unrolling_10_loop: ; + if (! (x < 5)) goto unrolling_8_loop; + { + int y_unroll_24 = 0; + x ++; + y_unroll_24 ++; + } + unrolling_9_loop: ; + /*@ loop pragma UNROLL 3; + loop pragma UNROLL "done", 3; */ + while (x < 5) { + int y = 0; + x ++; + y ++; + } + unrolling_8_loop: ; } j = 0; if (! foo) goto unrolling_18_loop; @@ -147,19 +134,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; - j ++; - unrolling_16_loop_unrolling_45_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; - j ++; - unrolling_15_loop_unrolling_46_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; - j ++; - unrolling_14_loop_unrolling_47_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_48_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; + j ++; + unrolling_16_loop_unrolling_45_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; + j ++; + unrolling_15_loop_unrolling_46_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_48_loop; + j ++; + unrolling_14_loop_unrolling_47_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_48_loop: ; break; case 5: j = -1; break; @@ -172,19 +159,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; - j ++; - unrolling_16_loop_unrolling_40_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; - j ++; - unrolling_15_loop_unrolling_41_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; - j ++; - unrolling_14_loop_unrolling_42_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_43_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; + j ++; + unrolling_16_loop_unrolling_40_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; + j ++; + unrolling_15_loop_unrolling_41_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_43_loop; + j ++; + unrolling_14_loop_unrolling_42_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_43_loop: ; break; case 5: j = -1; break; @@ -197,19 +184,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; - j ++; - unrolling_16_loop_unrolling_35_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; - j ++; - unrolling_15_loop_unrolling_36_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; - j ++; - unrolling_14_loop_unrolling_37_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_38_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; + j ++; + unrolling_16_loop_unrolling_35_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; + j ++; + unrolling_15_loop_unrolling_36_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_38_loop; + j ++; + unrolling_14_loop_unrolling_37_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_38_loop: ; break; case 5: j = -1; break; @@ -222,19 +209,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; - j ++; - unrolling_16_loop_unrolling_30_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; - j ++; - unrolling_15_loop_unrolling_31_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; - j ++; - unrolling_14_loop_unrolling_32_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_33_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; + j ++; + unrolling_16_loop_unrolling_30_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; + j ++; + unrolling_15_loop_unrolling_31_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_33_loop; + j ++; + unrolling_14_loop_unrolling_32_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_33_loop: ; break; case 5: j = -1; break; @@ -247,19 +234,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; - j ++; - unrolling_16_loop_unrolling_25_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; - j ++; - unrolling_15_loop_unrolling_26_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; - j ++; - unrolling_14_loop_unrolling_27_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_28_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; + j ++; + unrolling_16_loop_unrolling_25_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; + j ++; + unrolling_15_loop_unrolling_26_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_28_loop; + j ++; + unrolling_14_loop_unrolling_27_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_28_loop: ; break; case 5: j = -1; break; @@ -272,19 +259,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; - j ++; - unrolling_16_loop_unrolling_20_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; - j ++; - unrolling_15_loop_unrolling_21_loop: ; - if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; - j ++; - unrolling_14_loop_unrolling_22_loop: ; - /*@ loop pragma UNROLL "done", 3; - loop pragma UNROLL 3; */ - while (j < 5) j ++; - unrolling_13_loop_unrolling_23_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; + j ++; + unrolling_16_loop_unrolling_20_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; + j ++; + unrolling_15_loop_unrolling_21_loop: ; + if (! (j < 5)) goto unrolling_13_loop_unrolling_23_loop; + j ++; + unrolling_14_loop_unrolling_22_loop: ; + /*@ loop pragma UNROLL "done", 3; + loop pragma UNROLL 3; */ + while (j < 5) j ++; + unrolling_13_loop_unrolling_23_loop: ; break; case 5: j = -1; break; @@ -299,19 +286,19 @@ void main(void) case -1: j ++; break; case 0: - if (! (j < 5)) goto unrolling_13_loop; - j ++; - unrolling_16_loop: ; - if (! (j < 5)) goto unrolling_13_loop; - j ++; - unrolling_15_loop: ; - if (! (j < 5)) goto unrolling_13_loop; - j ++; - unrolling_14_loop: ; - /*@ loop pragma UNROLL 3; - loop pragma UNROLL "done", 3; */ - while (j < 5) j ++; - unrolling_13_loop: ; + if (! (j < 5)) goto unrolling_13_loop; + j ++; + unrolling_16_loop: ; + if (! (j < 5)) goto unrolling_13_loop; + j ++; + unrolling_15_loop: ; + if (! (j < 5)) goto unrolling_13_loop; + j ++; + unrolling_14_loop: ; + /*@ loop pragma UNROLL 3; + loop pragma UNROLL "done", 3; */ + while (j < 5) j ++; + unrolling_13_loop: ; break; case 5: j = -1; break; @@ -323,30 +310,28 @@ void main(void) if (j == 1) goto un; goto return_label; zero: - if (! (j < 5)) goto unrolling_50_loop; - un_unrolling_56_loop: j ++; - unrolling_55_loop: ; - if (! (j < 5)) goto unrolling_50_loop; - un_unrolling_54_loop: j ++; - unrolling_53_loop: ; - if (! (j < 5)) goto unrolling_50_loop; - un_unrolling_52_loop: j ++; - unrolling_51_loop: ; - /*@ loop pragma UNROLL 3; - loop pragma UNROLL "done", 3; */ - while (j < 5) un: j ++; - unrolling_50_loop: ; + if (! (j < 5)) goto unrolling_50_loop; + un_unrolling_56_loop: j ++; + unrolling_55_loop: ; + if (! (j < 5)) goto unrolling_50_loop; + un_unrolling_54_loop: j ++; + unrolling_53_loop: ; + if (! (j < 5)) goto unrolling_50_loop; + un_unrolling_52_loop: j ++; + unrolling_51_loop: ; + /*@ loop pragma UNROLL 3; + loop pragma UNROLL "done", 3; */ + while (j < 5) un: j ++; + unrolling_50_loop: ; return_label: return; } void main2(void) { - int i; - i = 0; + int i = 0; if (! (i < 2)) goto unrolling_58_loop; { - int j_unroll_192; - j_unroll_192 = 0; + int j_unroll_192 = 0; while (j_unroll_192 < 2) { i ++; goto foo_unrolling_62_loop; @@ -359,8 +344,7 @@ void main2(void) unrolling_61_loop: ; if (! (i < 2)) goto unrolling_58_loop; { - int j_unroll_184; - j_unroll_184 = 0; + int j_unroll_184 = 0; while (j_unroll_184 < 2) { i ++; goto foo_unrolling_60_loop; @@ -375,8 +359,7 @@ void main2(void) loop pragma UNROLL "done", 2; */ while (i < 2) { { - int j; - j = 0; + int j = 0; while (j < 2) { i ++; goto foo; @@ -393,14 +376,12 @@ void main2(void) void main2_done(void) { - int i; - i = 0; + int i = 0; /*@ loop pragma UNROLL 2; loop pragma UNROLL "done", 2; */ while (i < 2) { { - int j; - j = 0; + int j = 0; if (! (j < 2)) goto unrolling_64_loop; i ++; goto foo_unrolling_68_loop; @@ -433,13 +414,11 @@ void main2_done(void) void main3(int c) { - int i; - i = 0; + int i = 0; if (c == 0) goto foo; if (! (i < 5)) goto unrolling_70_loop; { - int j_unroll_244; - j_unroll_244 = 0; + int j_unroll_244 = 0; if (i == j_unroll_244) goto foo_unrolling_77_loop; if (i == 1) goto unrolling_70_loop; if (i == 2) goto __Cont_unrolling_80_loop; @@ -458,8 +437,7 @@ void main3(int c) unrolling_76_loop: ; if (! (i < 5)) goto unrolling_70_loop; { - int j_unroll_222; - j_unroll_222 = 0; + int j_unroll_222 = 0; if (i == j_unroll_222) goto foo_unrolling_72_loop; if (i == 1) goto unrolling_70_loop; if (i == 2) goto __Cont_unrolling_75_loop; @@ -480,8 +458,7 @@ void main3(int c) loop pragma UNROLL "done", 2; */ while (i < 5) { { - int j; - j = 0; + int j = 0; if (i == j) goto foo; if (i == 1) break; if (i == 2) goto __Cont; diff --git a/tests/syntax/oracle/unroll_property_status_bts1442.0.res.oracle b/tests/syntax/oracle/unroll_property_status_bts1442.0.res.oracle index 573510ee8ce639b74892d4abebbbf02950d2803c..1c13f959a1933e72639cb0b6ffdcc4dd2edc68dd 100644 --- a/tests/syntax/oracle/unroll_property_status_bts1442.0.res.oracle +++ b/tests/syntax/oracle/unroll_property_status_bts1442.0.res.oracle @@ -1,49 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unroll_property_status_bts1442.i (no preprocessing) [report] Computing properties status... - -------------------------------------------------------------------------------- ---- Properties of Function 'Frama_C_bzero' --------------------------------------------------------------------------------- - -[ Extern ] Post-condition (file share/libc/__fc_builtin_for_normalization.i, line 32) - Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Valid ] Default behavior - by Frama-C kernel. - --------------------------------------------------------------------------------- ---- Properties of Function 'main1' --------------------------------------------------------------------------------- - -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Assigns for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Behavior 'Frama_C_implicit_init' at block - by Frama-C kernel. - --------------------------------------------------------------------------------- ---- Status Report Summary --------------------------------------------------------------------------------- - 11 Completely validated - 3 Considered valid - 14 Total +--- No status to report -------------------------------------------------------------------------------- diff --git a/tests/syntax/oracle/unroll_property_status_bts1442.1.res.oracle b/tests/syntax/oracle/unroll_property_status_bts1442.1.res.oracle index 573510ee8ce639b74892d4abebbbf02950d2803c..1c13f959a1933e72639cb0b6ffdcc4dd2edc68dd 100644 --- a/tests/syntax/oracle/unroll_property_status_bts1442.1.res.oracle +++ b/tests/syntax/oracle/unroll_property_status_bts1442.1.res.oracle @@ -1,49 +1,5 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unroll_property_status_bts1442.i (no preprocessing) [report] Computing properties status... - -------------------------------------------------------------------------------- ---- Properties of Function 'Frama_C_bzero' --------------------------------------------------------------------------------- - -[ Extern ] Post-condition (file share/libc/__fc_builtin_for_normalization.i, line 32) - Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Valid ] Default behavior - by Frama-C kernel. - --------------------------------------------------------------------------------- ---- Properties of Function 'main1' --------------------------------------------------------------------------------- - -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Post-condition for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Assigns for 'Frama_C_implicit_init' (file tests/syntax/unroll_property_status_bts1442.i, line 19) at block - by Frama-C kernel. -[ Valid ] Behavior 'Frama_C_implicit_init' at block - by Frama-C kernel. - --------------------------------------------------------------------------------- ---- Status Report Summary --------------------------------------------------------------------------------- - 11 Completely validated - 3 Considered valid - 14 Total +--- No status to report -------------------------------------------------------------------------------- diff --git a/tests/syntax/oracle/unroll_visit.res.oracle b/tests/syntax/oracle/unroll_visit.res.oracle index 10f925ef6071be1c66f2dc94d8c9b7dec1a5a5de..4110a69598edc43d2d5f1ab6f1efffb313acd6a8 100644 --- a/tests/syntax/oracle/unroll_visit.res.oracle +++ b/tests/syntax/oracle/unroll_visit.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unroll_visit.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -26,8 +25,7 @@ tests/syntax/unroll_visit.i:6:[value] entering loop for the first time /* Generated by Frama-C */ void main(void) { - int i; - i = 0; + int i = 0; if (! (i < 100)) goto unrolling_2_loop; i --; /*@ assert i < 100; */ ; diff --git a/tests/syntax/oracle/unspecified_access_call_bts0888.res.oracle b/tests/syntax/oracle/unspecified_access_call_bts0888.res.oracle index 11efeded376b56e7fc9c065f32a11fe587485a26..cc6cd921d712d54687ba4dd78b222e6f5a069b26 100644 --- a/tests/syntax/oracle/unspecified_access_call_bts0888.res.oracle +++ b/tests/syntax/oracle/unspecified_access_call_bts0888.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unspecified_access_call_bts0888.i (no preprocessing) tests/syntax/unspecified_access_call_bts0888.i:9:[kernel] warning: Unspecified sequence with side effect: /* y x <- */ @@ -33,23 +32,17 @@ int main(void) int z; x = 2; x = f(x); - { /* sequence */ - y = 2; - x = f(y); - z = 3; - y = x + z; - } - { /* sequence */ - y = 2; - x = f(y); - z = x + y; - } - { /* sequence */ - y = 2; - x = f(y); - y = 3; - y = x + y; - } + y = 2; + x = f(y); + z = 3; + y = x + z; + y = 2; + x = f(y); + z = x + y; + y = 2; + x = f(y); + y = 3; + y = x + y; __retres = 0; return __retres; } diff --git a/tests/syntax/oracle/unspecified_access_if_bts01114.res.oracle b/tests/syntax/oracle/unspecified_access_if_bts01114.res.oracle index a954a19756ea6aaa8f4925928b20315c5a72e7d4..dd920eefecc0741cf2a4bef2b87e2fc8c71c516d 100644 --- a/tests/syntax/oracle/unspecified_access_if_bts01114.res.oracle +++ b/tests/syntax/oracle/unspecified_access_if_bts01114.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unspecified_access_if_bts01114.i (no preprocessing) /* Generated by Frama-C */ int x; diff --git a/tests/syntax/oracle/unspecified_access_ptr_bts1519.res.oracle b/tests/syntax/oracle/unspecified_access_ptr_bts1519.res.oracle index 7fa9484cac671237f4608a7fd6211e5f919271e4..4a464f7250638d3a8873ede6ebe2dce544892900 100644 --- a/tests/syntax/oracle/unspecified_access_ptr_bts1519.res.oracle +++ b/tests/syntax/oracle/unspecified_access_ptr_bts1519.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unspecified_access_ptr_bts1519.i (no preprocessing) /* Generated by Frama-C */ int t[10]; @@ -8,28 +7,22 @@ int i = 4; int j = 0; void main(void) { - int *p1; - int *p2; int tmp; int tmp_0; - p1 = & v[i]; - p2 = & v[j]; - { /* sequence */ - tmp = *p1; - /*effects: (t[i]) <- */ - (*p1) ++; - /*effects: (t[i]) *p1 <- p1*/ - t[i] += tmp + *p2; - /*effects: (t[i]) t[i] <- i, tmp, *p2, p2*/ - } - { /* sequence */ - tmp_0 = v[i]; - /*effects: (t[i]) <- */ - (v[i]) ++; - /*effects: (t[i]) v[i] <- i*/ - t[i] += tmp_0 + v[j]; - /*effects: (t[i]) t[i] <- i, tmp_0, v[j], j*/ - } + int *p1 = & v[i]; + int *p2 = & v[j]; + tmp = *p1; + /*effects: (t[i]) <- */ + (*p1) ++; + /*effects: (t[i]) *p1 <- p1*/ + t[i] += tmp + *p2; + /*effects: (t[i]) t[i] <- i, tmp, *p2, p2*/ + tmp_0 = v[i]; + /*effects: (t[i]) <- */ + (v[i]) ++; + /*effects: (t[i]) v[i] <- i*/ + t[i] += tmp_0 + v[j]; + /*effects: (t[i]) t[i] <- i, tmp_0, v[j], j*/ return; } diff --git a/tests/syntax/oracle/unspecified_access_struct.res.oracle b/tests/syntax/oracle/unspecified_access_struct.res.oracle index 54a0d85f046af749ebfad414a1757d5363c24e37..41f6edc403076100e52746ef2bcf273d418ada36 100644 --- a/tests/syntax/oracle/unspecified_access_struct.res.oracle +++ b/tests/syntax/oracle/unspecified_access_struct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/unspecified_access_struct.i (no preprocessing) /* Generated by Frama-C */ struct S { @@ -7,18 +6,15 @@ struct S { int main(void) { int __retres; - struct S s1; struct S s2; struct S s3; struct S s4; struct S s5; - s1.f = 0; - { /* sequence */ - s5.f = s1.f; - s4.f = s5.f; - s3.f = s4.f; - s2.f = s3.f; - } + struct S s1 = {.f = 0}; + s5.f = s1.f; + s4.f = s5.f; + s3.f = s4.f; + s2.f = s3.f; __retres = s2.f; return __retres; } diff --git a/tests/syntax/oracle/variadic.res.oracle b/tests/syntax/oracle/variadic.res.oracle index 44832bf97b3228ce4d7400da953390ca6db98728..73d20723598fc99aa452d1ebebdae36e7e4c98e0 100644 --- a/tests/syntax/oracle/variadic.res.oracle +++ b/tests/syntax/oracle/variadic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/variadic.i (no preprocessing) tests/syntax/variadic.i:20:[kernel] warning: Calling undeclared function f. Old style K&R code? /* Generated by Frama-C */ @@ -25,34 +24,25 @@ extern int ( /* missing proto */ f)(int x_0, int x_1); void g(void) { { - void *__va_args[9]; - double __va_arg8; - long double __va_arg7; - struct T __va_arg6; - int __va_arg5; - unsigned long long __va_arg4; - int __va_arg3; - double __va_arg2; - int __va_arg1; - unsigned int __va_arg0; - __va_arg0 = 1u; - __va_arg1 = (int)uchar; - __va_arg2 = (double)3.0f; - __va_arg3 = (int)ushort; - __va_arg4 = ll; - __va_arg5 = (int)abstract; - __va_arg6 = st; - __va_arg7 = ld; - __va_arg8 = d; - __va_args[0] = & __va_arg0; - __va_args[1] = & __va_arg1; - __va_args[2] = & __va_arg2; - __va_args[3] = & __va_arg3; - __va_args[4] = & __va_arg4; - __va_args[5] = & __va_arg5; - __va_args[6] = & __va_arg6; - __va_args[7] = & __va_arg7; - __va_args[8] = & __va_arg8; + unsigned int __va_arg0 = 1u; + int __va_arg1 = (int)uchar; + double __va_arg2 = (double)3.0f; + int __va_arg3 = (int)ushort; + unsigned long long __va_arg4 = ll; + int __va_arg5 = (int)abstract; + struct T __va_arg6 = st; + long double __va_arg7 = ld; + double __va_arg8 = d; + void *__va_args[9] = + {& __va_arg0, + & __va_arg1, + & __va_arg2, + & __va_arg3, + & __va_arg4, + & __va_arg5, + & __va_arg6, + & __va_arg7, + & __va_arg8}; vf(1,(void * const *)(__va_args)); } f(1,(int)uchar); diff --git a/tests/syntax/oracle/vdefined_bts1241.res.oracle b/tests/syntax/oracle/vdefined_bts1241.res.oracle index 326ede20b711291e33a2dacb1a0dac95288c4aef..339ab85121b3d94365871b73414ef0223e6d1065 100644 --- a/tests/syntax/oracle/vdefined_bts1241.res.oracle +++ b/tests/syntax/oracle/vdefined_bts1241.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/vdefined_bts1241.i (no preprocessing) [kernel] Parsing tests/syntax/vdefined_bts1241_1.i (no preprocessing) /* Generated by Frama-C */ diff --git a/tests/syntax/oracle/vdescr_bts1387.res.oracle b/tests/syntax/oracle/vdescr_bts1387.res.oracle index 789fb834d05346cadec92dabc4377067270b31a9..160bd923a4fcff0cbab6f758d3003bf6909c06c5 100644 --- a/tests/syntax/oracle/vdescr_bts1387.res.oracle +++ b/tests/syntax/oracle/vdescr_bts1387.res.oracle @@ -1,12 +1,4 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/vdescr_bts1387.i (no preprocessing) -[kernel] Variable Frama_C_bzero has vdescr '' -[kernel] Variable dest has vdescr '' -[kernel] Variable n has vdescr '' -[kernel] Variable Frama_C_copy_block has vdescr '' -[kernel] Variable dest has vdescr '' -[kernel] Variable size has vdescr '' -[kernel] Variable n has vdescr '' [kernel] Variable f has vdescr '' [kernel] Variable has vdescr '' [kernel] Variable g has vdescr '' diff --git a/tests/syntax/oracle/visit_create_local.res.oracle b/tests/syntax/oracle/visit_create_local.res.oracle index 17fcbb674e43aa45163dfa6d9d2faceaf32a513d..5efc760902a5e859ae058af7cc5686fa71a18062 100644 --- a/tests/syntax/oracle/visit_create_local.res.oracle +++ b/tests/syntax/oracle/visit_create_local.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/visit_create_local.i (no preprocessing) /* Generated by Frama-C */ void main(void) diff --git a/tests/syntax/oracle/vla_goto.err.oracle b/tests/syntax/oracle/vla_goto.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/vla_goto.res.oracle b/tests/syntax/oracle/vla_goto.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..590d761be1b95629884820149a30718a82567cd9 --- /dev/null +++ b/tests/syntax/oracle/vla_goto.res.oracle @@ -0,0 +1,3 @@ +[kernel] Parsing tests/syntax/vla_goto.i (no preprocessing) +[kernel] user error: tests/syntax/vla_goto.i:5, cannot jump from goto statement bypassing initialization of variable b2, declared at tests/syntax/vla_goto.i:9 +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/vla_goto2.err.oracle b/tests/syntax/oracle/vla_goto2.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/vla_goto2.res.oracle b/tests/syntax/oracle/vla_goto2.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..726cc274d9862c47e7b2688ea0b68056ad38c9ff --- /dev/null +++ b/tests/syntax/oracle/vla_goto2.res.oracle @@ -0,0 +1,49 @@ +[kernel] Parsing tests/syntax/vla_goto2.i (no preprocessing) +/* Generated by Frama-C */ + __attribute__((__FC_BUILTIN__)) void __fc_vla_free(void *); + +void *__fc_vla_alloc(unsigned int); + +int case2(int arg) +{ + int __retres; + { + unsigned int __lengthof_a2; + /*@ assert alloca_bounds: 0 < sizeof(int) * arg ≤ 4294967295; */ ; + __lengthof_a2 = (unsigned int)arg; + int *a2 = __fc_vla_alloc(sizeof(int) * __lengthof_a2); + if (arg) { + __fc_vla_free((void *)a2); + goto L; + } + __fc_vla_free((void *)a2); + } + { + unsigned int __lengthof_b2; + L: ; + /*@ assert alloca_bounds: 0 < sizeof(int) * arg ≤ 4294967295; */ ; + __lengthof_b2 = (unsigned int)arg; + int *b2 = __fc_vla_alloc(sizeof(int) * __lengthof_b2); + __fc_vla_free((void *)b2); + } + __retres = 0; + return __retres; +} + +int case3(int arg) +{ + int __retres; + unsigned int __lengthof_vla; + /*@ assert alloca_bounds: 0 < sizeof(int) * arg ≤ 4294967295; */ ; + __lengthof_vla = (unsigned int)arg; + int *vla = __fc_vla_alloc(sizeof(int) * __lengthof_vla); + if (arg >= 10) { + __retres = 1; + goto return_label; + } + __retres = 0; + return_label: __fc_vla_free((void *)vla); + return __retres; +} + + diff --git a/tests/syntax/oracle/vla_loop.err.oracle b/tests/syntax/oracle/vla_loop.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/vla_loop.res.oracle b/tests/syntax/oracle/vla_loop.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..ef2e6f8e11543a85e74a2a7c3535e462a5e091bf --- /dev/null +++ b/tests/syntax/oracle/vla_loop.res.oracle @@ -0,0 +1,83 @@ +[kernel] Parsing tests/syntax/vla_loop.i (no preprocessing) +/* Generated by Frama-C */ + __attribute__((__FC_BUILTIN__)) void __fc_vla_free(void *); + +void *__fc_vla_alloc(unsigned int); + +void awhile(int x) +{ + int *p; + while (1) { + { + unsigned int __lengthof_a1; + /*@ assert alloca_bounds: 0 < sizeof(int) * x ≤ 4294967295; */ ; + __lengthof_a1 = (unsigned int)x; + int *a1 = __fc_vla_alloc(sizeof(int) * __lengthof_a1); + p = (int *)(& a1); + if (x) { + __fc_vla_free((void *)a1); + break; + } + else { + __fc_vla_free((void *)a1); + continue; + } + } + } + return; +} + +int main(int argc, char **argv) +{ + int *p; + switch (argc) { + default: + { + unsigned int __lengthof_a; + /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ; + __lengthof_a = (unsigned int)argc; + int *a = __fc_vla_alloc(sizeof(int) * __lengthof_a); + while (1) { + p = (int *)(& a); + break; + } + ; + __fc_vla_free((void *)a); + } + } + { + unsigned int __lengthof_b; + /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ; + __lengthof_b = (unsigned int)argc; + int *b = __fc_vla_alloc(sizeof(int) * __lengthof_b); + while (1) { + p = (int *)(& b); + break; + } + ; + __fc_vla_free((void *)b); + } + { + unsigned int __lengthof_c; + /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ; + __lengthof_c = (unsigned int)argc; + int *c = __fc_vla_alloc(sizeof(int) * __lengthof_c); + switch (argc) { + case 1: p = (int *)(& c); + break; + } + ; + __fc_vla_free((void *)c); + } + { + unsigned int __lengthof_d; + /*@ assert alloca_bounds: 0 < sizeof(int) * argc ≤ 4294967295; */ ; + __lengthof_d = (unsigned int)argc; + int *d = __fc_vla_alloc(sizeof(int) * __lengthof_d); + switch (argc) case 1: p = (int *)(& d); + __fc_vla_free((void *)d); + } + return argc; +} + + diff --git a/tests/syntax/oracle/vla_strlen.err.oracle b/tests/syntax/oracle/vla_strlen.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/vla_strlen.res.oracle b/tests/syntax/oracle/vla_strlen.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e38cc3c48892bbccf67be975a45606d0770be48a --- /dev/null +++ b/tests/syntax/oracle/vla_strlen.res.oracle @@ -0,0 +1,33 @@ +[kernel] Parsing tests/syntax/vla_strlen.c (with preprocessing) +/* Generated by Frama-C */ +#include "stddef.h" +#include "string.h" +#include "strings.h" + __attribute__((__FC_BUILTIN__)) void __fc_vla_free(void *); + +void *__fc_vla_alloc(unsigned int); + +void f(char *s) +{ + unsigned int __lengthof_t; + size_t tmp; + tmp = strlen((char const *)s); + /*@ assert alloca_bounds: 0 < sizeof(char) * (tmp + 1) ≤ 4294967295; */ ; + __lengthof_t = tmp + (size_t)1; + char *t = __fc_vla_alloc(sizeof(char) * __lengthof_t); + char *p = t; + while (*s) { + char *tmp_0; + char *tmp_1; + tmp_0 = p; + p ++; + tmp_1 = s; + s ++; + *tmp_0 = *tmp_1; + } + *p = (char)0; + __fc_vla_free((void *)t); + return; +} + + diff --git a/tests/syntax/oracle/vla_switch.err.oracle b/tests/syntax/oracle/vla_switch.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/syntax/oracle/vla_switch.res.oracle b/tests/syntax/oracle/vla_switch.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..72092efb6fb436c6acb7b90b648f560f2530e3ae --- /dev/null +++ b/tests/syntax/oracle/vla_switch.res.oracle @@ -0,0 +1,4 @@ +[kernel] Parsing tests/syntax/vla_switch.i (no preprocessing) +tests/syntax/vla_switch.i:11:[kernel] warning: Body of function case3 falls-through. Adding a return statement +[kernel] user error: tests/syntax/vla_switch.i:2, cannot jump from switch statement bypassing initialization of variable b, declared at tests/syntax/vla_switch.i:4 +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/volatile_clause.res.oracle b/tests/syntax/oracle/volatile_clause.res.oracle index e8e7f4fc3ad01041555dfe6eb83655dc70cfc23e..7b90b4b2c68f1e57ada35dba3b6bf2d51224cf8a 100644 --- a/tests/syntax/oracle/volatile_clause.res.oracle +++ b/tests/syntax/oracle/volatile_clause.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/syntax/volatile_clause.i (no preprocessing) /* Generated by Frama-C */ typedef unsigned int volatile Vunsigned; diff --git a/tests/syntax/osx_attribute.i b/tests/syntax/osx_attribute.i new file mode 100644 index 0000000000000000000000000000000000000000..3e3e8c7d5dce5ead1d1de847779d436afdc964df --- /dev/null +++ b/tests/syntax/osx_attribute.i @@ -0,0 +1,3 @@ +void f(void) __attribute__((availability(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7))); + +int main () { f(); } diff --git a/tests/syntax/switch-default.i b/tests/syntax/switch-default.i new file mode 100644 index 0000000000000000000000000000000000000000..c1daa219230c3181c92215c5065642f48116e000 --- /dev/null +++ b/tests/syntax/switch-default.i @@ -0,0 +1,20 @@ +int main() { + int x = 42; + for (int i = 0; i < 4; i++) { + switch (x) + default: { + Frama_C_show_each_i(i); + break; + } + } + return 0; +} + +void f () { + int i; + switch (0) { + case 0: { i=1; break; } + default: i=9; + } + return; +} diff --git a/tests/syntax/syntactic_hook.i b/tests/syntax/syntactic_hook.i index b8df34f54266b0dff72a1eceb5724853769919d3..e5c19d372e4d3f7ba2012a42514e35805d4e4d72 100644 --- a/tests/syntax/syntactic_hook.i +++ b/tests/syntax/syntactic_hook.i @@ -4,10 +4,6 @@ int f(void); -int h(const int*); - -int h(int *x) { return *x; } // warns different decls. - int k(int *); int k(int * x) { return (*x)++; } @@ -28,4 +24,4 @@ int main () { return x; } -int f(int); //warns conflicting decls +int f(int); //error: conflicting decls diff --git a/tests/syntax/ternary_brace.i b/tests/syntax/ternary_brace.i new file mode 100644 index 0000000000000000000000000000000000000000..fd3e7ebf726f09485bb41e6fc512f28a8af194f3 --- /dev/null +++ b/tests/syntax/ternary_brace.i @@ -0,0 +1,7 @@ +int main() { + int i = 1; + i = (i < 2 ? ++i : i++); + + if (i < 2) { ++i; i = i; } else { int tmp = i; i++; i=tmp; } + return i; +} diff --git a/tests/syntax/unroll_labels.i b/tests/syntax/unroll_labels.i index 6f651c46e57a68a0f271ae47ba1af0a20a8ce6cd..ece369aa07bfe1cfee932ab297c638c15a9e8ede 100644 --- a/tests/syntax/unroll_labels.i +++ b/tests/syntax/unroll_labels.i @@ -1,6 +1,6 @@ /* run.config - STDOPT: +"-val" - STDOPT: +"-val" +"-main main2" +"-slevel 3" + STDOPT: +"-val -val-show-progress" + STDOPT: +"-val -val-show-progress -main main2 -slevel 3" */ enum { SIX = 6 } ; volatile foo; diff --git a/tests/syntax/unroll_visit.i b/tests/syntax/unroll_visit.i index 661fd05dd1d211d768d39f57cc621130ef814819..fc3a9b126d0474c3ab08b233c0f947d65d0d05a3 100644 --- a/tests/syntax/unroll_visit.i +++ b/tests/syntax/unroll_visit.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-val" +"-deps" +"-out" +"-input" +"-deps" + STDOPT: +"-val -val-show-progress -deps -out -input -deps" */ void main() { /*@ loop pragma UNROLL 2; */ diff --git a/tests/syntax/vla_goto.i b/tests/syntax/vla_goto.i new file mode 100644 index 0000000000000000000000000000000000000000..7f760f860d66bb3e85c187ec6dd38a411b5d412f --- /dev/null +++ b/tests/syntax/vla_goto.i @@ -0,0 +1,15 @@ +int case2(int arg) { + { + int a2[arg]; + if (arg) + goto L; // goto L is invalid, see 6.8.6.1§1 + } + + { + int b2[arg]; +L: ; + /* When execution lands to this point it executes __fc_vla_free(b2) + * without executing __fc_vla_alloc first. */ + } + return 0; +} diff --git a/tests/syntax/vla_goto2.i b/tests/syntax/vla_goto2.i new file mode 100644 index 0000000000000000000000000000000000000000..06658ccd18cbfac0a565050fe64e4043b6756b8a --- /dev/null +++ b/tests/syntax/vla_goto2.i @@ -0,0 +1,26 @@ +int case2(int arg) { + { + int a2[arg]; + if (arg) + goto L; // goto L is valid. + } + + { + L: ; // although we are jumping in a block where a vla is defined, + // the target of the jump dominates the declaration of the vla + // so that it is outside of the scope of the vla and the + // program is correctly defined + + int b2[arg]; + } + return 0; +} + +int case3(int arg) { + int vla[arg]; + /* The return under the if is transformed into a goto to a unique return + statement. The destructor for vla is inserted before this unique return + statement. The goto must be changed to target this destructor. */ + if (arg >= 10) return 1; + return 0; +} diff --git a/tests/syntax/vla_loop.i b/tests/syntax/vla_loop.i new file mode 100644 index 0000000000000000000000000000000000000000..9c402bb716ab4b7d5fdde1c9eccf0906b468a83a --- /dev/null +++ b/tests/syntax/vla_loop.i @@ -0,0 +1,45 @@ +void awhile(int x) { + int *p; + while(1) { + int a1[x]; + p = &a1; + if (x) + break; + else continue; + } +} + +int main(int argc, char **argv) { + int *p; + switch(argc) { + default: { + int a[argc]; + { + while(1) { + p = &a; + break; + } + } + } + } + { + int b[argc]; + while(1) { + p = &b; + break; + } + } + { int c[argc]; + { switch(argc) { + case 1: { p = &c; break; } + } + } + } + { int d[argc]; + { switch(argc) { + case 1: { p = &d; } + } + } + } + return argc; +} diff --git a/tests/syntax/vla_strlen.c b/tests/syntax/vla_strlen.c new file mode 100644 index 0000000000000000000000000000000000000000..22984e4102cfe94a2686edb872a80f9a0a8ff798 --- /dev/null +++ b/tests/syntax/vla_strlen.c @@ -0,0 +1,8 @@ +#include "string.h" + +void f(char* s) { + char t[strlen(s) + 1]; + char* p = t; + while(*s) *p++ = *s++; + *p = 0; +} diff --git a/tests/syntax/vla_switch.i b/tests/syntax/vla_switch.i new file mode 100644 index 0000000000000000000000000000000000000000..afa7dd0affc9fe027771ce5e87ad5bd0a44a3ed6 --- /dev/null +++ b/tests/syntax/vla_switch.i @@ -0,0 +1,15 @@ +int case3(int arg) { + switch(arg) { + // Illegal according to 6.8.4.2§2 + int b[arg]; + case 1: { + int *p; + p = &b; + } + case 2: { + int a[arg]; + if (arg) + break; + } + } +} diff --git a/tests/test/oracle/adpcm.res.oracle b/tests/test/oracle/adpcm.res.oracle index 0f5624de06342b0db564b3fdf8b22eacf6657c14..842427ba4854810f1a4caa3efe58bf7c27d81b42 100644 --- a/tests/test/oracle/adpcm.res.oracle +++ b/tests/test/oracle/adpcm.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/test/adpcm.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/test_config b/tests/test_config index 1007bb197823a6ec5f942a2fe7d2d020dcc55e7d..2b1c519b0a5d47c7be63eadf015d3cf65a376f96 100644 --- a/tests/test_config +++ b/tests/test_config @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps -no-autoload-plugins -load-module from,inout,value +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope +OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/test_config_apron b/tests/test_config_apron index 5a55485d29418b645550de9e9db3fa2450a6bf02..47991b5e052a5d5be84b3fc057c1211ae0cb06da 100644 --- a/tests/test_config_apron +++ b/tests/test_config_apron @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-apron-oct -value-msg-key experimental-ok +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -eva-apron-oct -value-msg-key experimental-ok OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/test_config_bitwise b/tests/test_config_bitwise index a723150b251a8f8ea3b443c8bde94459a7d0387f..d26e0df22256602fca3cedc8e900fb3c1f3a2f61 100644 --- a/tests/test_config_bitwise +++ b/tests/test_config_bitwise @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-bitwise-domain +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -eva-bitwise-domain OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/test_config_equalities b/tests/test_config_equalities index cb0cfb1aca7d615f3063193f8695ac65e8dfefed..fd0ea12fb4ff03cfd618feb9a2b09d9beee7e789 100644 --- a/tests/test_config_equalities +++ b/tests/test_config_equalities @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-equality-domain +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -eva-equality-domain OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/test_config_gauges b/tests/test_config_gauges index b0a0c69f7335702a6aed006b453daa15f85a2f8b..e901dda87504a56ac7976e31c4f43e94d5833d56 100644 --- a/tests/test_config_gauges +++ b/tests/test_config_gauges @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-gauges-domain +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -eva-gauges-domain OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/test_config_legacy b/tests/test_config_legacy deleted file mode 100644 index 7dcfa7106e12cf4a866568f4b280c89363f57423..0000000000000000000000000000000000000000 --- a/tests/test_config_legacy +++ /dev/null @@ -1,2 +0,0 @@ -MACRO: VALUECONFIG -no-eva -OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/test_config_symblocs b/tests/test_config_symblocs index 026b5eac986a850e03922b18a83f566239e9eaa1..570f19483657fdc40960a56830bd75c3c9e5f0ff 100644 --- a/tests/test_config_symblocs +++ b/tests/test_config_symblocs @@ -1,2 +1,2 @@ -MACRO: VALUECONFIG -eva-symbolic-locations-domain +MACRO: VALUECONFIG -val-show-progress -no-autoload-plugins -load-module from,inout,value,scope -eva-symbolic-locations-domain OPT: -val @VALUECONFIG@ -journal-disable -out -input -deps diff --git a/tests/value/asm_contracts.c b/tests/value/asm_contracts.c new file mode 100644 index 0000000000000000000000000000000000000000..0e6fee5fa7110246e08a9775e6c580cdad22ee12 --- /dev/null +++ b/tests/value/asm_contracts.c @@ -0,0 +1,42 @@ + + + +#include <stdint.h> + +void f1() { + int src = 1; + int dst = 0; + + asm ("mov %1, %0\n\t" + "add $1, %0" + : "=r" (dst) + : "r" (src)); + + //@ assert OK: src == 1; + //@ assert UNKNOWN1: dst != 0; + //@ assert UNKNOWN2: dst == 2; +} + +void f2() { + uint32_t dwRes; + uint32_t dwSomeValue = 42; + asm ("bsfl %1,%0" + : "=r" (dwRes) + : "r" (dwSomeValue) + : "cc"); // FLAGS register is clobbered + //@ assert OK: dwSomeValue == 42; + //@ assert UNKNOWN1: dwRes != 0; +} + +void f3() { + int x = 1; + asm ("bla"); + //@ assert UNKNOWN: x == 1; +} + +int main() { + f1(); + f2(); + f3(); + return 0; +} diff --git a/tests/value/assigns.i b/tests/value/assigns.i index b1bb3d318a8d47276809b946a713233faea243f0..96e6e4fd57a67253292801bb27a57b018b3d234a 100644 --- a/tests/value/assigns.i +++ b/tests/value/assigns.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #" -inout-callwise" +"-print -inout" + STDOPT: +"-print -inout" */ volatile int v; int G; @@ -35,7 +35,7 @@ void j(int *p); int x; int k = 53; -/*@ assigns \at(x, Post) \from \at(x, Post); +/*@ assigns x \from \at(x, Post); assigns Tpost[\at(i, Post)]; assigns Tpost[\at(k, Post)]; */ diff --git a/tests/value/assigns_from.i b/tests/value/assigns_from.i index e2ce13c1c2edecab142ea82f8da176f9173dd767..683e09c5d47ccd85edcec64c3c2ffe67ee809699 100644 --- a/tests/value/assigns_from.i +++ b/tests/value/assigns_from.i @@ -197,6 +197,27 @@ void main17(int *p, int i) { } } +typedef struct { + int *addr; + int i; +} s18; + +//@ assigns *x, *y \from *x, *y; +void f18 (s18 *x, s18 *y); + +void main18() { + int base_a = 17; + s18 a; + a.addr = & base_a; + int base_b = 11; + s18 b; + b.addr = & base_b; + f18(&a, &b); /* There are bottom bits in a and b. Make sure that the proper + conflate_bottom is used to evaluate the contents of the from + clauses */ +} + + void main(void) { constante = 2; @@ -229,6 +250,7 @@ void main(void) main14(); main16(); main17(t17, 10); + main18(); } diff --git a/tests/value/automalloc.i b/tests/value/automalloc.i index 6706323538a6a8e7a1d418facc0cba95a8498fb6..fc6caf094cd20a09b5d9244faab3396737db66ef 100644 --- a/tests/value/automalloc.i +++ b/tests/value/automalloc.i @@ -1,3 +1,6 @@ +/* run.config* + STDOPT: #"-no-val-builtins-auto" +*/ typedef unsigned int size_t; /*@ allocates \result; ensures \fresh(\result, s); */ void*malloc(size_t s); diff --git a/tests/value/behavior_statuses.i b/tests/value/behavior_statuses.i index 1c438ce8b476f0c5abf0eedb800742bb378f0340..065398db65beecdeab5e70554ad9c2111adad2bf 100644 --- a/tests/value/behavior_statuses.i +++ b/tests/value/behavior_statuses.i @@ -1,9 +1,4 @@ -/* run.config - STDOPT: +"-kernel-msg-key property_status -kernel-verbose 3" - STDOPT: +"-kernel-msg-key property_status -kernel-verbose 3 -val-use-spec f" -*/ - -/* run.config_legacy +/* run.config* STDOPT: +"-kernel-msg-key property_status -kernel-verbose 3" STDOPT: +"-kernel-msg-key property_status -kernel-verbose 3 -val-use-spec f" */ diff --git a/tests/value/behaviors2.c b/tests/value/behaviors2.c index b021fe1fc6935c9489bffa5e28da3bde5702ba5c..64201a79484b65c1e3335c0003d25a4bddff9eea 100644 --- a/tests/value/behaviors2.c +++ b/tests/value/behaviors2.c @@ -306,6 +306,20 @@ void test5() { f4(x); } +// test below not directly related to behaviors; tests the precision of +// logic reductions +/*@ + assigns p == \null ? \empty : *p \from indirect:p; + ensures p == \null || *p == 1; // if p non-null, then *p must equal 1; + */ +void opt_ptr(int *p); + +void test_red() { + int a = 2; + opt_ptr(&a); + //@ assert a == 1; +} + int main() { int quotient, remainder, sign; char errmsg[MAX_ERRMSG_LEN]; @@ -316,6 +330,7 @@ int main() { test3(); test4(); test5(); + test_red(); return 0; } diff --git a/tests/value/bitfield.i b/tests/value/bitfield.i index ac6aec432527d85ae1567aae3615a827ad3200de..68a89a0c4ccc1fbf1dfcf3f7f16acba1862d4568 100644 --- a/tests/value/bitfield.i +++ b/tests/value/bitfield.i @@ -1,5 +1,9 @@ /* run.config_equalities - STDOPT: +"-value-msg-key d-eq" + STDOPT: +"-value-msg-key d-eqs -print -kernel-msg-key printer:bitfields" +*/ + +/* run.config* + STDOPT: +"-print -kernel-msg-key printer:bitfields" */ struct t1 { unsigned int a:2; int b:4; int c:22;int d:32;} h; @@ -146,9 +150,21 @@ void eq_bitfields() { } } +struct char_short { + unsigned char c: 1; + unsigned short s: 2; +}; + +void char_short () { + struct char_short S = { 1, 2}; + int x = S.c + 0; + int y = S.s + 0; +} + void main() { main_old(); imprecise_bts_1671(); logic(); eq_bitfields(); + char_short(); } diff --git a/tests/value/bitwise.i b/tests/value/bitwise.i index 44773e853bf3303d5ad7f23842041f7781daeebb..686fd8eb2e2e78fafd4593de5c1db30b8193b983 100644 --- a/tests/value/bitwise.i +++ b/tests/value/bitwise.i @@ -40,9 +40,31 @@ void main_bug2() { if ((t & 7) == 1) { Frama_C_show_each_then(); } else { Frama_C_show_each_else(); } } +/* See issue Value/Value#82 on the bitwise domain. */ +void main_bug3 () { + unsigned long l_1180 = 10022045811482781039u; + unsigned long foo = ~ (l_1180 ^ (unsigned long)(l_1180 != 0UL)); + Frama_C_dump_each(); + foo ^= 0; +} + +/* Due to signedness mismatches, the bitwise domain incorrectly returned + Bottom on one of the branches. */ +void main_bug4() { + int g_2 = v ? -1 : 0; + short tmp = -0x1578; + if ((g_2 | (int)tmp) & 1) { + Frama_C_show_each_then(); + } else { + Frama_C_show_each_else(); + } +} + void main() { main_and_or_rel(); main_bitwise(); main_bug1(); main_bug2(); + main_bug3(); + main_bug4(); } diff --git a/tests/value/cond.i b/tests/value/cond.i index c9b69155c8e0847ac34afce191f58ee57b04956f..5c6628a7c82af3a62faa09bedc1a56376da17097 100644 --- a/tests/value/cond.i +++ b/tests/value/cond.i @@ -5,7 +5,7 @@ int f() { return G?0:(-51); } -int i,t[]={ 1, 2, 3, 4, 5, 6, 7, 8 },(*p)[8],z, R; +int i,t[]={ 1, 2, 3, 4, 5, 6, 7, 8 },(*p)[8],z, R, U[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 }; int main(int argc, char**argv) { @@ -45,6 +45,14 @@ int main(int argc, char**argv) Frama_C_show_each_6(v); Frama_C_show_each_7(v); + unsigned w = unknf(); + if (U[w] != 0) {// The alarm guarantees that 0 <= w <= 12, and then backward + // propagation tries the values 0 and 12 separately + // (because 0-terminated arrays are frequent in embedded code) + Frama_C_show_each_w(w); + //@ assert w != 0 && w != 12; + } + return inRet; } diff --git a/tests/value/cond3.i b/tests/value/cond3.i deleted file mode 100644 index 7c8c9fd196f1f9b5756cbd10f2b606709dfdd5f9..0000000000000000000000000000000000000000 --- a/tests/value/cond3.i +++ /dev/null @@ -1,88 +0,0 @@ -int Gx,r,x; -int main(void) { - r = -1; - x = Gx ? 0 : 1 ; - if (x <= 0) {} - else goto fin; - r = x; - fin: - return r; -} - -int main1(void) { - r = -1; - x = Gx ? 0 : 1 ; - if (x <= 0) {goto fin;} - else r=x; - r = x; - fin: - return r; -} - - -int main2(void) { - r = -1; - x = Gx ? 0 : 1 ; - Gx = -2; - if (x <= 0) {Gx = x;} - else goto fin; - r = x; - fin: - return r; -} - - -int main3(void) { - r = -1; - x = Gx ? 0 : 1 ; - Gx = -2; - if (x <= 0) {goto fin;} - r = x; - fin: - return r; -} - - -int main4(void) { - r = -1; - x = Gx ? 0 : 1 ; - Gx = -2; - if (x <= 0) {Gx=5;} - r = x; - fin: - return r; -} - -int main5(void) { - r = -1; - x = Gx ? 0 : 1 ; - if (x <= 0) {} - else {Gx=5;} - r = x; - fin: - return r; -} - -int main6(void) { - r = -1; - x = Gx ? 0 : 1 ; - if (x <= 0) {Gx=5;} - else r=x; - r = x; - fin: - return r; -} - - -int main7(void) { - r = -1; - x = Gx ? 0 : 1 ; - Gx = -2; - if (x <= 0) {} - else {} - r = x; - fin: - return r; -} - - diff --git a/tests/value/const.i b/tests/value/const.i index 131d96d975f4355f76c1ba8a30117b359bad5380..340e801892654ac72d44aa776c2627a27b69e27d 100644 --- a/tests/value/const.i +++ b/tests/value/const.i @@ -80,6 +80,24 @@ void pointer_to_const_logic(const int *p) { if (v) *p = 12; } + +int f() { return 7; } + +void local_const () { + const int x = 5; + const int y = f(); +} + +const int aux_ret_const() { + return 1; +} + +// the 'const' qualifier of aux_ret_const must not influence the assignments +// performed in the engine for the return value. Nothing should be const here +int ret_const() { + return aux_ret_const(); +} + void main () { const_formal(G); const_formal(42); @@ -91,4 +109,6 @@ void main () { constrain_G (); pointer_to_const_logic (&J); + local_const (); + ret_const(); } diff --git a/tests/value/const_typedef.i b/tests/value/const_typedef.i index 3f57de32e45f709e87c26bc1631a1a0cdbff64de..45159aa72abf7d089c1dfd57919cf2b5e383cf27 100644 --- a/tests/value/const_typedef.i +++ b/tests/value/const_typedef.i @@ -25,7 +25,7 @@ const INT4 y1 = {0, 1, 2, 3, 4}; const INT5 y2 = {1, 2, 3, 4, 5}; extern const INT4 y3; -const int y3[7] = {1, 2}; +const int y4[7] = {1, 2}; int main() { } diff --git a/tests/value/dangling.i b/tests/value/dangling.i index eef1c590870f518b00bdffe55862b58f580fcb71..1b0d88e142ef9a3b6a60e796ae2ca0a6668c5ce9 100644 --- a/tests/value/dangling.i +++ b/tests/value/dangling.i @@ -23,4 +23,13 @@ void main() { //@ assert \dangling(&x); int j = *x + 1; } + + int *p[2]; + { + int z; + p[0] = &z; + p[1] = 42; + } + //@ assert !\dangling(&p[0..1]); + } diff --git a/tests/value/dead_inout.i b/tests/value/dead_inout.i index 2779e8989dffa7e833d9d4f57f63350bc36a9ead..27070fc23e5626c93bafc1f382a21cef4afc6b0f 100644 --- a/tests/value/dead_inout.i +++ b/tests/value/dead_inout.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -no-autoload-plugins -load-module from,inout @VALUECONFIG@ -out -input -inout -inout -inout-callwise -main main_all + OPT: -no-autoload-plugins -load-module from,inout @VALUECONFIG@ -out -input -inout -inout -main main_all */ // This tests a potential imprecision with the computation of input and outputs if one forgets to test that a statement is dead diff --git a/tests/value/diff_apron b/tests/value/diff_apron index 539e64328a15481ffeaeb8a0029770492d3000d5..907dfc6092725d6f76f12537468b1308e669b47d 100644 --- a/tests/value/diff_apron +++ b/tests/value/diff_apron @@ -1,344 +1,271 @@ diff tests/value/oracle/alias.1.res.oracle tests/value/oracle_apron/alias.1.res.oracle -79c79 +78c78 < z ∈ {0; 1; 2} --- > z ∈ {0; 2} diff tests/value/oracle/alias.2.res.oracle tests/value/oracle_apron/alias.2.res.oracle -73c73 +72c72 < z ∈ {-5; -4; -3; -2; -1; 0; 1; 1000} --- > z ∈ {-1; 1000} diff tests/value/oracle/alias.3.res.oracle tests/value/oracle_apron/alias.3.res.oracle -67c67 +66c66 < z ∈ {0; 1; 2} --- > z ∈ {0; 2} diff tests/value/oracle/alias.6.res.oracle tests/value/oracle_apron/alias.6.res.oracle -83c83 +82c82 < t ∈ {4; 5; 6} --- > t ∈ {5} diff tests/value/oracle/array_degenerating_loop.res.oracle tests/value/oracle_apron/array_degenerating_loop.res.oracle -11,12c11 +10,11c10 < tests/value/array_degenerating_loop.i:9:[value] warning: signed overflow. assert G + t[i] ≤ 2147483647; -< [value] Called Frama_C_show_each([55..2147483647], [-2147483648..99]) ---- -> [value] Called Frama_C_show_each([55..155], [-2147483648..99]) -17c16 -< G ∈ [55..2147483647] ---- -> G ∈ [55..155] -Only in tests/value/oracle: behavior_statuses.0.err.oracle -Only in tests/value/oracle: behavior_statuses.0.res.oracle -Only in tests/value/oracle: behavior_statuses.1.err.oracle -Only in tests/value/oracle: behavior_statuses.1.res.oracle -Only in tests/value/oracle_apron: behavior_statuses.err.oracle -Only in tests/value/oracle_apron: behavior_statuses.res.oracle +< tests/value/array_degenerating_loop.i:10:[value] Frama_C_show_each: [55..2147483647], [-2147483648..99] +--- +> tests/value/array_degenerating_loop.i:10:[value] Frama_C_show_each: [55..155], [-2147483648..99] diff tests/value/oracle/call_simple.res.oracle tests/value/oracle_apron/call_simple.res.oracle -28c28 +27c27 < c ∈ [--..--] --- > c ∈ [-2147483648..2147483646] -diff tests/value/oracle/cast_fun.res.oracle tests/value/oracle_apron/cast_fun.res.oracle -39,40d38 -< tests/value/cast_fun.i:103:[value] warning: pointer to function with incompatible type. assert \valid_function(p3); -< tests/value/cast_fun.i:108:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); -42c40 -< Called from tests/value/cast_fun.i:113. ---- -> Called from tests/value/cast_fun.i:103. -44a43,48 -> [value] computing for function f9 <- main. -> Called from tests/value/cast_fun.i:108. -> [value] Done for function f9 -> [value] computing for function f10 <- main. -> Called from tests/value/cast_fun.i:113. -> [value] Done for function f10 -52c56 -< tests/value/cast_fun.i:98:[from] warning: variadic call detected. Using only 1 argument(s). ---- -> tests/value/cast_fun.i:103:[from] warning: variadic call detected. Using only 0 argument(s). -59,60d62 -< tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. -< tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. -68,69c70,71 -< p3 ∈ {{ &f9 }} or UNINITIALIZED -< p4 ∈ {{ &f10 }} or UNINITIALIZED ---- -> p3 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -> p4 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -119a122,125 -> [from] call to f10 at tests/value/cast_fun.i:103 (by main): -> NO EFFECTS -> [from] call to f9 at tests/value/cast_fun.i:108 (by main): -> NO EFFECTS -126c132,133 -< p1; p2; p3; p4; x; s ---- -> p1; p2; p3; p4; x; s; __va_arg0; __va_args[0]; __va_arg0_11; -> __va_args_13[0] diff tests/value/oracle/divneg.res.oracle tests/value/oracle_apron/divneg.res.oracle 56c56 < vic ∈ {4294967295} --- > vic ∈ {-1} diff tests/value/oracle/downcast.res.oracle tests/value/oracle_apron/downcast.res.oracle -45c45 -< [value] Called Frama_C_show_each([100000..2147483647], +48c48 +< [100000..2147483647], [100145..2147483647], [100145..2147483647] --- -> [value] Called Frama_C_show_each([100000..2147483502], -124c124 -< x_0 ∈ [100000..2147483647] ---- -> x_0 ∈ [100000..2147483502] +> [100000..2147483502], [100145..2147483647], [100145..2147483647] diff tests/value/oracle/dur.res.oracle tests/value/oracle_apron/dur.res.oracle -311c311 +310c310 < V6 ∈ [--..--] or UNINITIALIZED --- > V6 ∈ [0..32767] or UNINITIALIZED diff tests/value/oracle/find_ivaltop.res.oracle tests/value/oracle_apron/find_ivaltop.res.oracle -33,34c33,34 +32,33c32,33 < j ∈ {0; 1; 2; 3; 4; 5; 6; 7} < X ∈ {1; 2; 3; 4; 5; 6; 7; 8} --- > j ∈ {7} > X ∈ {8} -40c40 +39c39 < \result FROM t[0..7] --- > \result FROM t[7] -45c45 +44c44 < t[0..7] --- > t[7] diff tests/value/oracle/for_loops.1.res.oracle tests/value/oracle_apron/for_loops.1.res.oracle -38,39c38 +37,38c37 < tests/value/for_loops.c:16:[value] warning: signed overflow. assert w + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each_F([0..2147483647]) +< tests/value/for_loops.c:17:[value] Frama_C_show_each_F: [0..2147483647] --- -> [value] Called Frama_C_show_each_F([0..100]) -45c44 +> tests/value/for_loops.c:17:[value] Frama_C_show_each_F: [0..100] +44c43 < j ∈ [0..2147483647] --- > j ∈ [0..100] diff tests/value/oracle/for_loops.2.res.oracle tests/value/oracle_apron/for_loops.2.res.oracle -33,34c33 +34,35c34 < tests/value/for_loops.c:42:[value] warning: signed overflow. assert w + T[j] ≤ 2147483647; -< [value] Called Frama_C_show_each([0..2147483647]) ---- -> [value] Called Frama_C_show_each([0..1000]) -43c42 -< w ∈ [0..2147483647] +< tests/value/for_loops.c:43:[value] Frama_C_show_each: [0..2147483647] --- -> w ∈ [0..1000] +> tests/value/for_loops.c:43:[value] Frama_C_show_each: [0..1000] diff tests/value/oracle/gauges.res.oracle tests/value/oracle_apron/gauges.res.oracle -32d31 +31d30 < tests/value/gauges.i:24:[value] warning: signed overflow. assert l + 1 ≤ 2147483647; -56d54 +55d53 < tests/value/gauges.i:46:[value] warning: signed overflow. assert l + 1 ≤ 2147483647; -96a95,96 -> [value] Called Frama_C_show_each({{ "outer" }}) -> [value] Called Frama_C_show_each({{ "inner" }}) -104c104 -< [value] Called Frama_C_show_each([0..2147483647]) ---- -> [value] Called Frama_C_show_each([15..2147483647]) -118d117 +95a94,95 +> tests/value/gauges.i:81:[value] Frama_C_show_each: {{ "outer" }} +> tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +103c103 +< tests/value/gauges.i:84:[value] Frama_C_show_each: [0..2147483647] +--- +> tests/value/gauges.i:84:[value] Frama_C_show_each: [15..2147483647] +117d116 < tests/value/gauges.i:97:[value] warning: signed overflow. assert c + 1 ≤ 2147483647; -159d157 +157d155 < tests/value/gauges.i:138:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -254d251 +250d247 < tests/value/gauges.i:218:[value] warning: signed overflow. assert -2147483648 ≤ n - 1; -268,269c265 +264,265c261 < tests/value/gauges.i:238:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({45; 46; 47; 48; 49; 50; 51}, [0..2147483647]) +< tests/value/gauges.i:240:[value] Frama_C_show_each: {45; 46; 47; 48; 49; 50; 51}, [0..2147483647] --- -> [value] Called Frama_C_show_each({45; 46; 47; 48; 49; 50; 51}, [0..46]) -275,276c271 +> tests/value/gauges.i:240:[value] Frama_C_show_each: {45; 46; 47; 48; 49; 50; 51}, [0..46] +271,272c267 < tests/value/gauges.i:249:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({48; 49; 50; 51; 52; 53; 54}, [0..2147483647]) +< tests/value/gauges.i:252:[value] Frama_C_show_each: {48; 49; 50; 51; 52; 53; 54}, [0..2147483647] --- -> [value] Called Frama_C_show_each({48; 49; 50; 51; 52; 53; 54}, [0..49]) -282,283c277 +> tests/value/gauges.i:252:[value] Frama_C_show_each: {48; 49; 50; 51; 52; 53; 54}, [0..49] +278,279c273 < tests/value/gauges.i:261:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({-59; -58; -57; -56; -55; -54; -53}, [0..2147483647]) +< tests/value/gauges.i:263:[value] Frama_C_show_each: {-59; -58; -57; -56; -55; -54; -53}, [0..2147483647] --- -> [value] Called Frama_C_show_each({-59; -58; -57; -56; -55; -54; -53}, [0..65]) -289,290c283 +> tests/value/gauges.i:263:[value] Frama_C_show_each: {-59; -58; -57; -56; -55; -54; -53}, [0..65] +285,286c279 < tests/value/gauges.i:272:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({-64; -63; -62; -61; -60; -59; -58}, [0..2147483647]) +< tests/value/gauges.i:274:[value] Frama_C_show_each: {-64; -63; -62; -61; -60; -59; -58}, [0..2147483647] --- -> [value] Called Frama_C_show_each({-64; -63; -62; -61; -60; -59; -58}, [0..70]) -298,300c291 +> tests/value/gauges.i:274:[value] Frama_C_show_each: {-64; -63; -62; -61; -60; -59; -58}, [0..70] +294,295c287 < tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({-593; -592; -591; -590; -589; -588}, -< [0..2147483647]) +< tests/value/gauges.i:295:[value] Frama_C_show_each: {-593; -592; -591; -590; -589; -588}, [0..2147483647] --- -> [value] Called Frama_C_show_each({-593; -592; -591; -590; -589; -588}, [0..598]) -310c301 +> tests/value/gauges.i:295:[value] Frama_C_show_each: {-593; -592; -591; -590; -589; -588}, [0..598] +583c575 < l ∈ [4..2147483647] --- > l ∈ [4..101] -315c306 +588c580 < l ∈ [4..2147483647] --- > l ∈ [4..101] -366c357 +639c631 < n ∈ [-2147483648..99] --- > n ∈ [-2147483547..99] -369c360 +642c634 < i ∈ [0..2147483647] --- > i ∈ [10..2147483647] -373c364 -< j ∈ [0..2147483647] ---- -> j ∈ [0..46] -376c367 -< j ∈ [0..2147483647] ---- -> j ∈ [0..49] -379c370 -< j ∈ [0..2147483647] ---- -> j ∈ [0..65] -382c373 -< j ∈ [0..2147483647] ---- -> j ∈ [0..70] -388c379 -< j ∈ [0..2147483647] ---- -> j ∈ [0..598] -393c384 -< k ∈ [0..2147483647] ---- -> k ∈ [15..2147483647] -398c389 +678c670 < i ∈ [0..2147483647] --- > i ∈ [0..21] diff tests/value/oracle/ghost.res.oracle tests/value/oracle_apron/ghost.res.oracle -11d10 +10d9 < tests/value/ghost.i:17:[value] warning: signed overflow. assert G + 1 ≤ 2147483647; diff tests/value/oracle/initialized_copy.1.res.oracle tests/value/oracle_apron/initialized_copy.1.res.oracle -21,24c21 +22,25c22 < c_0[bits 0 to 7] ∈ {1} or UNINITIALIZED < [bits 8 to 15] ∈ {2} < [bits 16 to 23] ∈ {3} < [bits 24 to 31] ∈ {4} --- > c_0 ∈ {67305985} or UNINITIALIZED -26,29c23 +27,30c24 < a_2[bits 0 to 7] ∈ {1} or UNINITIALIZED < [bits 8 to 15] ∈ {2} < [bits 16 to 23] ∈ {3} < [bits 24 to 31] ∈ {4} --- > a_2 ∈ {67305985} or UNINITIALIZED -diff tests/value/oracle/input.res.oracle tests/value/oracle_apron/input.res.oracle -22d21 -< tests/value/input.i:7:[from] warning: variadic call detected. Using only 1 argument(s). -32c31 -< tmp ---- -> tmp; __va_arg0; __va_args[0] diff tests/value/oracle/local_slevel.res.oracle tests/value/oracle_apron/local_slevel.res.oracle -14,16c14,16 -< [value] Called Frama_C_show_each({1}, {1}, {0; 1}) -< [value] Called Frama_C_show_each({-1}, {0}, {0; 1}) -< [value] Called Frama_C_show_each({1}, {1}, {0; 1; 2}) ---- -> [value] Called Frama_C_show_each({1}, {1}, {1}) -> [value] Called Frama_C_show_each({-1}, {0}, {0}) -> [value] Called Frama_C_show_each({1}, {1}, {1}) -18c18 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3}) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, {1; 2; 3}) -20c20 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3; 4}) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, {1; 2; 3; 4}) -22,27c22,23 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483647]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483647]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483648]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483648]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..4294967295]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..4294967295]) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, [1..79]) -> [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..78]) -141c137 +13,15c13,15 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1; 2} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +17c17 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3} +19c19 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3; 4} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3; 4} +21,26c21,22 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..4294967295] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..4294967295] +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [1..79] +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..78] +140c136 < r ∈ [--..--] --- > r ∈ [0..2147483647] -397,399c393,395 -< [value] Called Frama_C_show_each({1}, {1}, {0; 1}) -< [value] Called Frama_C_show_each({-1}, {0}, {0; 1}) -< [value] Called Frama_C_show_each({1}, {1}, {0; 1; 2}) ---- -> [value] Called Frama_C_show_each({1}, {1}, {1}) -> [value] Called Frama_C_show_each({-1}, {0}, {0}) -> [value] Called Frama_C_show_each({1}, {1}, {1}) -401c397 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3}) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, {1; 2; 3}) -403c399 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3; 4}) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, {1; 2; 3; 4}) -405,410c401,402 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483647]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483647]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483648]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483648]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..4294967295]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..4294967295]) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, [1..79]) -> [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..78]) -524c516 +381,383c377,379 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1; 2} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +385c381 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3} +387c383 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3; 4} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3; 4} +389,394c385,386 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..4294967295] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..4294967295] +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [1..79] +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..78] +508c500 < r ∈ [--..--] --- > r ∈ [0..2147483647] diff tests/value/oracle/loop_wvar.1.res.oracle tests/value/oracle_apron/loop_wvar.1.res.oracle -12d11 +11d10 < tests/value/loop_wvar.i:57:[value] warning: signed overflow. assert next + 1 ≤ 2147483647; -23,24c22 -< [value] Called Frama_C_show_each([0..9], [0..17], [0..11]) -< [value] Called Frama_C_show_each([0..9], [0..18], [0..12]) +22,23c21 +< tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..17], [0..11] +< tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..18], [0..12] --- -> [value] Called Frama_C_show_each([0..9], [0..9], [0..9]) -33,34c31,32 +> tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..9], [0..9] +32,33c30,31 < j ∈ [0..18] < k ∈ [0..12] --- > j ∈ [0..17] > k ∈ [0..11] -37c35 +36c34 < next ∈ [0..2147483647] --- > next ∈ [0..25] +diff tests/value/oracle/loopinv.res.oracle tests/value/oracle_apron/loopinv.res.oracle +48,49c48 +< tests/value/loopinv.c:45:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; +< tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..99], [0..2147483647] +--- +> tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..99], [0..100] +129,130d127 +< [ - ] Assertion 'Value,signed_overflow' (file tests/value/loopinv.c, line 45) +< tried with Value. +143,144c140,141 +< 4 To be validated +< 13 Total +--- +> 3 To be validated +> 12 Total diff tests/value/oracle/memexec.res.oracle tests/value/oracle_apron/memexec.res.oracle -26c26,29 +25c25,28 < tests/value/memexec.c:13:[value] Reusing old results for call to f11 --- > [value] computing for function f11 <- f1 <- main. > Called from tests/value/memexec.c:13. > [value] Recording results for f11 > [value] Done for function f11 -28c31,34 +27c30,33 < tests/value/memexec.c:16:[value] Reusing old results for call to f11 --- > [value] computing for function f11 <- f1 <- main. > Called from tests/value/memexec.c:16. > [value] Recording results for f11 > [value] Done for function f11 -30c36,39 +29c35,38 < tests/value/memexec.c:20:[value] Reusing old results for call to f11 --- > [value] computing for function f11 <- f1 <- main. @@ -346,75 +273,90 @@ diff tests/value/oracle/memexec.res.oracle tests/value/oracle_apron/memexec.res. > [value] Recording results for f11 > [value] Done for function f11 diff tests/value/oracle/modulo.res.oracle tests/value/oracle_apron/modulo.res.oracle -39a40,61 -> [value] Called Frama_C_show_each_1([-10..-1], [-9..-1], [-8..0]) -> [value] Called Frama_C_show_each_1([-10..-1], [1..9], [-8..0]) -> [value] Called Frama_C_show_each_1([1..10], [-9..-1], [0..8]) -> [value] Called Frama_C_show_each_1([1..10], [1..9], [0..8]) -> [value] Called Frama_C_show_each_1([1..9], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_1([-9..-1], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1([1..9], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_1([-9..-1], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-8; -7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6}) -47a70,91 -> [value] Called Frama_C_show_each_2([-10..-1], [1..9], [-8..0]) -> [value] Called Frama_C_show_each_2([-10..-1], [-9..-1], [-8..0]) -> [value] Called Frama_C_show_each_2([1..10], [1..9], [0..8]) -> [value] Called Frama_C_show_each_2([1..10], [-9..-1], [0..8]) -> [value] Called Frama_C_show_each_2([-9..-1], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2([1..9], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_2([-9..-1], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2([1..9], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_2({-8; -7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6}) -54a99,100 -> [value] Called Frama_C_show_each_3([-10..10], [-9..9], [-8..8]) -> [value] Called Frama_C_show_each_3([-9..9], [-8..8], [-7..7]) +38a39,56 +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [-9..-1], [-8..0] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [1..9], [-8..0] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [-9..-1], [0..8] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [1..9], [0..8] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [1..9], {1; 2; 3; 4; 5; 6; 7; 8}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [-9..-1], {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [1..9], {-8; -7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [-9..-1], {-8; -7; -6; -5; -4; -3; -2; -1}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-8; -7; -6; -5; -4; -3; -2; -1}, +> {1; 2; 3; 4; 5; 6; 7}, +> {-6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6} +46a65,82 +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..-1], [1..9], [-8..0] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..-1], [-9..-1], [-8..0] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [1..10], [1..9], [0..8] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [1..10], [-9..-1], [0..8] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [-9..-1], {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [1..9], {1; 2; 3; 4; 5; 6; 7; 8}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [-9..-1], {-8; -7; -6; -5; -4; -3; -2; -1}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [1..9], {-8; -7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-8; -7; -6; -5; -4; -3; -2; -1}, +> {1; 2; 3; 4; 5; 6; 7}, +> {-6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6} +53a90,91 +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-10..10], [-9..9], [-8..8] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-9..9], [-8..8], [-7..7] +diff tests/value/oracle/offsetmap.res.oracle tests/value/oracle_apron/offsetmap.res.oracle +59,64c59,61 +< a[bits 0 to 7] ∈ {1; 6} +< [bits 8 to 31]# ∈ {6}%32, bits 8 to 31 +< b[bits 0 to 7] ∈ {0; 1} +< [bits 8 to 31]# ∈ {0; 6}%32, bits 8 to 31 +< a7[bits 0 to 7] ∈ {1} +< [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 +--- +> a ∈ {1; 6} +> b ∈ {0; 1} +> a7 ∈ {1} +104,109c101,103 +< a[bits 0 to 7] ∈ {1; 6} +< [bits 8 to 31]# ∈ {6}%32, bits 8 to 31 +< b[bits 0 to 7] ∈ {0; 1} +< [bits 8 to 31]# ∈ {0; 6}%32, bits 8 to 31 +< a7[bits 0 to 7] ∈ {1} +< [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 +--- +> a ∈ {1; 6} +> b ∈ {0; 1} +> a7 ∈ {1} diff tests/value/oracle/ptr_relation.1.res.oracle tests/value/oracle_apron/ptr_relation.1.res.oracle -25c25 +24c24 < j ∈ {-1; 0; 1} --- > j ∈ {0} diff tests/value/oracle/raz.res.oracle tests/value/oracle_apron/raz.res.oracle -15c15 +14c14 < i ∈ [0..2147483647] --- > i ∈ [0..10] diff tests/value/oracle/reevaluate_alarms.res.oracle tests/value/oracle_apron/reevaluate_alarms.res.oracle -58c58 +57c57 < S ∈ [0..2147483647] --- > S ∈ [4..2147483647] diff tests/value/oracle/relation_reduction.res.oracle tests/value/oracle_apron/relation_reduction.res.oracle -24,25d23 +23,24d22 < tests/value/relation_reduction.i:20:[value] warning: accessing out of bounds index. assert 0 ≤ y; < tests/value/relation_reduction.i:20:[value] warning: accessing out of bounds index. assert y < 9; -32,34c30,32 +31,33c29,31 < R1 ∈ [-2147483648..2147483637] < R2 ∈ [-2147483638..2147483647] < R3 ∈ [--..--] @@ -452,7 +394,7 @@ diff tests/value/oracle/relation_shift.res.oracle tests/value/oracle_apron/relat > y ∈ [-2147483648..2147483640] > z ∈ [-2147483641..2147483647] diff tests/value/oracle/relations.res.oracle tests/value/oracle_apron/relations.res.oracle -71,72c71,73 +70,71c70,72 < e ∈ [--..--] < f ∈ [--..--] --- @@ -465,9 +407,9 @@ diff tests/value/oracle/relations2.res.oracle tests/value/oracle_apron/relations --- > len ∈ [0..1023] 33c33 -< [value] Called Frama_C_show_each_end([0..4294967295], [0..64]) +< tests/value/relations2.i:17:[value] Frama_C_show_each_end: [0..4294967295], [0..64] --- -> [value] Called Frama_C_show_each_end([0..1023], [0..64]) +> tests/value/relations2.i:17:[value] Frama_C_show_each_end: [0..1023], [0..64] 65,66d64 < tests/value/relations2.i:34:[value] warning: accessing out of bounds index. < assert (unsigned int)(i - (unsigned int)(t + 1)) < 514; @@ -478,152 +420,52 @@ diff tests/value/oracle/relations2.res.oracle tests/value/oracle_apron/relations --- > len ∈ [0..1023] diff tests/value/oracle/struct2.res.oracle tests/value/oracle_apron/struct2.res.oracle -63,64d62 +62,63d61 < tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(i + j); < tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert (int)(i + j) < 2; +76d73 +< [scope:rm_asserts] removing 2 assertion(s) diff tests/value/oracle/test.0.res.oracle tests/value/oracle_apron/test.0.res.oracle 24c24 < j ∈ [-1073741822..1] --- > j ∈ {-1; 0; 1} diff tests/value/oracle/unroll.res.oracle tests/value/oracle_apron/unroll.res.oracle -13d12 +12d11 < tests/value/unroll.i:34:[value] warning: signed overflow. assert -2147483648 ≤ j - 1; -26c25 +25c24 < j ∈ [-2147483648..-123] --- > j ∈ {-238} diff tests/value/oracle/unroll_simple.res.oracle tests/value/oracle_apron/unroll_simple.res.oracle -9d8 +8d7 < tests/value/unroll_simple.i:11:[value] warning: signed overflow. assert -2147483648 ≤ j - 1; -21c20 +20c19 < j ∈ [-2147483648..-126] --- > j ∈ {-250} -diff tests/value/oracle/usp.res.oracle tests/value/oracle_apron/usp.res.oracle -18c18 -< b ∈ {5; 4294967295} ---- -> b ∈ {-1; 5} -diff tests/value/oracle/va_list.res.oracle tests/value/oracle_apron/va_list.res.oracle -12d11 -< tests/value/va_list.c:9:[value] user error: functions returning variadic arguments must be stubbed -18c17,19 -< vlParameters ∈ [--..--] ---- -> vlParameters ∈ -> {{ NULL + [0..4294967295] ; -> &alloced_return___builtin_next_arg + [0..2147483644],0%4 }} -diff tests/value/oracle/va_list2.res.oracle tests/value/oracle_apron/va_list2.res.oracle -10c10,24 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) ---- -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read((int *)*args); -> tests/value/va_list2.c:11:[value] Assigning imprecise value to tmp. -> The imprecision originates from Well -> tests/value/va_list2.c:11:[value] Assigning imprecise value to i. -> The imprecision originates from Well -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read((float *)*args); -> tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(*((float *)*args)); -> tests/value/va_list2.c:16:[value] Assigning imprecise value to tmp_0. -> The imprecision originates from Well -13c27,33 -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:16:[value] Assigning imprecise value to f. -> The imprecision originates from Well -> tests/value/va_list2.c:17:[value] warning: non-finite float value. assert \is_finite(f); -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -15,16c35,46 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -20,22d49 -< tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -< tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -< tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype -24a52 -> args ∈ {{ NULL ; &S___va_params{[0], [1], [2]} }} -26,31d53 -< [from] Computing for function __builtin_va_start <-main -< [from] Done for function __builtin_va_start -< [from] Computing for function __builtin_va_arg <-main -< [from] Done for function __builtin_va_arg -< [from] Computing for function __builtin_va_end <-main -< [from] Done for function __builtin_va_end -39c61 -< fmt; i; f ---- -> fmt; args; i; tmp; f; tmp_0 -41c63,64 -< S_fmt[0..1] ---- -> S___va_params[0..1]; S_0_S___va_params[bits 0 to ..]; -> S_1_S___va_params[bits 0 to ..]; S_fmt[0..1] -diff tests/value/oracle/val9.res.oracle tests/value/oracle_apron/val9.res.oracle -48,53c48,50 -< a[bits 0 to 7] ∈ {1; 6} -< [bits 8 to 31]# ∈ {6}%32, bits 8 to 31 -< b[bits 0 to 7] ∈ {0; 1} -< [bits 8 to 31]# ∈ {0; 6}%32, bits 8 to 31 -< a7[bits 0 to 7] ∈ {1} -< [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 ---- -> a ∈ {1; 6} -> b ∈ {0; 1} -> a7 ∈ {1} diff tests/value/oracle/widen_non_constant.res.oracle tests/value/oracle_apron/widen_non_constant.res.oracle -27c27 -< [value] Called Frama_C_show_each_in([0..23], [1..23]) +26c26 +< tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: [0..23], [1..23] --- -> [value] Called Frama_C_show_each_in([0..22], [1..23]) -42c42 -< [value] Called Frama_C_show_each_in([0..25], [1..23]) +> tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: [0..22], [1..23] +41c41 +< tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: [0..25], [1..23] --- -> [value] Called Frama_C_show_each_in([0..22], [1..23]) -58,60c58 -< [value] Called Frama_C_show_each_in([0..2147483647], [1..23]) +> tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: [0..22], [1..23] +57,59c57 +< tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: [0..2147483647], [1..23] < tests/value/widen_non_constant.i:49:[value] warning: out of bounds read. assert \valid_read(p + j); < tests/value/widen_non_constant.i:45:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; --- -> [value] Called Frama_C_show_each_in([0..22], [1..23]) -81c79 +> tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: [0..22], [1..23] +80c78 < j ∈ {23; 24; 25; 26} --- > j ∈ {23; 24; 25} -132c130 -< N; B[0..25] ---- -> N; B[0..23] -144c142 -< N; A[0..23]; B[0..25]; C[0..23] ---- -> N; A[0..23]; B[0..23]; C[0..23] diff tests/value/oracle/widen_on_non_monotonic.res.oracle tests/value/oracle_apron/widen_on_non_monotonic.res.oracle -21a22,23 -> tests/value/widen_on_non_monotonic.i:26:[value] entering loop for the first time +21a22 > tests/value/widen_on_non_monotonic.i:21:[value] entering loop for the first time diff tests/value/oracle/with_comment.res.oracle tests/value/oracle_apron/with_comment.res.oracle -10d9 +9d8 < tests/value/with_comment.i:21:[value] warning: signed overflow. assert G + 1 ≤ 2147483647; diff --git a/tests/value/diff_bitwise b/tests/value/diff_bitwise index 32411651a10fce841f32d4b8fd66b4a4b6aa92f3..36ffa24c4e670246fe20f03a43c8085acc9b86c8 100644 --- a/tests/value/diff_bitwise +++ b/tests/value/diff_bitwise @@ -1,35 +1,44 @@ diff tests/value/oracle/addition.res.oracle tests/value/oracle_bitwise/addition.res.oracle -106a107 +78d77 +< The imprecision originates from Arithmetic {tests/value/addition.i:52} +105a105 > {{ garbled mix of &{p1} (origin: Misaligned {tests/value/addition.i:52}) }} -108a110 +107a108 > {{ garbled mix of &{p2} (origin: Misaligned {tests/value/addition.i:56}) }} -146c148 +143,146c144,145 +< p10 ∈ +< {{ garbled mix of &{p1} +< (origin: Arithmetic {tests/value/addition.i:52}) }} < p11 ∈ [-2147483648..0] --- +> p10 ∈ {{ garbled mix of &{p1} }} > p11 ∈ [-2147483648..0],0%4 -324a327 +324a324 > {{ garbled mix of &{p1} (origin: Misaligned {tests/value/addition.i:52}) }} -365c368 +363,366c363,364 +< p10 ∈ +< {{ garbled mix of &{p1} +< (origin: Arithmetic {tests/value/addition.i:52}) }} < p11 ∈ [-2147483648..0] --- +> p10 ∈ {{ garbled mix of &{p1} }} > p11 ∈ [-2147483648..0],0%4 -Only in tests/value/oracle: behavior_statuses.0.err.oracle -Only in tests/value/oracle: behavior_statuses.0.res.oracle -Only in tests/value/oracle: behavior_statuses.1.err.oracle -Only in tests/value/oracle: behavior_statuses.1.res.oracle -Only in tests/value/oracle_bitwise: behavior_statuses.err.oracle -Only in tests/value/oracle_bitwise: behavior_statuses.res.oracle diff tests/value/oracle/bitwise_or.res.oracle tests/value/oracle_bitwise/bitwise_or.res.oracle -54c54 +53c53 < uand4 ∈ [8..24] --- > uand4 ∈ {8; 16; 24} -60,61c60,61 +59,60c59,60 < v1 ∈ [0..0x1FFFE],0%2 < v2 ∈ [0..0x3FFFF] --- > v1 ∈ [0..0x1FFFC],0%4 > v2 ∈ [0..0x3FFFE],0%2 +diff tests/value/oracle/bitwise_pointer.res.oracle tests/value/oracle_bitwise/bitwise_pointer.res.oracle +33d32 +< The imprecision originates from Arithmetic {tests/value/bitwise_pointer.i:18} +36d34 +< The imprecision originates from Arithmetic {tests/value/bitwise_pointer.i:22} diff tests/value/oracle/cast.res.oracle tests/value/oracle_bitwise/cast.res.oracle 69c69 < G ∈ [0..12] @@ -39,140 +48,6 @@ diff tests/value/oracle/cast.res.oracle tests/value/oracle_bitwise/cast.res.orac < G ∈ [0..12] --- > G ∈ [2..12] -diff tests/value/oracle/cast_fun.res.oracle tests/value/oracle_bitwise/cast_fun.res.oracle -39,40d38 -< tests/value/cast_fun.i:103:[value] warning: pointer to function with incompatible type. assert \valid_function(p3); -< tests/value/cast_fun.i:108:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); -42c40 -< Called from tests/value/cast_fun.i:113. ---- -> Called from tests/value/cast_fun.i:103. -44a43,48 -> [value] computing for function f9 <- main. -> Called from tests/value/cast_fun.i:108. -> [value] Done for function f9 -> [value] computing for function f10 <- main. -> Called from tests/value/cast_fun.i:113. -> [value] Done for function f10 -52c56 -< tests/value/cast_fun.i:98:[from] warning: variadic call detected. Using only 1 argument(s). ---- -> tests/value/cast_fun.i:103:[from] warning: variadic call detected. Using only 0 argument(s). -59,60d62 -< tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. -< tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. -68,69c70,71 -< p3 ∈ {{ &f9 }} or UNINITIALIZED -< p4 ∈ {{ &f10 }} or UNINITIALIZED ---- -> p3 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -> p4 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -119a122,125 -> [from] call to f10 at tests/value/cast_fun.i:103 (by main): -> NO EFFECTS -> [from] call to f9 at tests/value/cast_fun.i:108 (by main): -> NO EFFECTS -126c132,133 -< p1; p2; p3; p4; x; s ---- -> p1; p2; p3; p4; x; s; __va_arg0; __va_args[0]; __va_arg0_11; -> __va_args_13[0] -diff tests/value/oracle/input.res.oracle tests/value/oracle_bitwise/input.res.oracle -22d21 -< tests/value/input.i:7:[from] warning: variadic call detected. Using only 1 argument(s). -32c31 -< tmp ---- -> tmp; __va_arg0; __va_args[0] -diff tests/value/oracle/merge_bits.res.oracle tests/value/oracle_bitwise/merge_bits.res.oracle -30,34c30 -< [value] Called Frama_C_show_each_F([bits 0 to 7] ∈ {1} -< [bits 8 to 15] ∈ {0} -< [bits 16 to 31]# ∈ -< {-1879048176}%32, bits 0 to 15 -< This amounts to: {1048577}) ---- -> [value] Called Frama_C_show_each_F({1048577}) -39,41c35,36 -< T[0] ∈ {1} -< [1] ∈ {0} -< [bits 16 to 47] ∈ {-1879048176} ---- -> T[bits 0 to 31] ∈ {1048577} -> [bits 32 to 47]# ∈ {-1879048176}%32, bits 16 to 31 -diff tests/value/oracle/va_list.res.oracle tests/value/oracle_bitwise/va_list.res.oracle -12d11 -< tests/value/va_list.c:9:[value] user error: functions returning variadic arguments must be stubbed -18c17,19 -< vlParameters ∈ [--..--] ---- -> vlParameters ∈ -> {{ NULL + [0..4294967295] ; -> &alloced_return___builtin_next_arg + [0..2147483644],0%4 }} -diff tests/value/oracle/va_list2.res.oracle tests/value/oracle_bitwise/va_list2.res.oracle -10c10,24 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) ---- -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read((int *)*args); -> tests/value/va_list2.c:11:[value] Assigning imprecise value to tmp. -> The imprecision originates from Well -> tests/value/va_list2.c:11:[value] Assigning imprecise value to i. -> The imprecision originates from Well -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read((float *)*args); -> tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(*((float *)*args)); -> tests/value/va_list2.c:16:[value] Assigning imprecise value to tmp_0. -> The imprecision originates from Well -13c27,33 -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:16:[value] Assigning imprecise value to f. -> The imprecision originates from Well -> tests/value/va_list2.c:17:[value] warning: non-finite float value. assert \is_finite(f); -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -15,16c35,46 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -20,22d49 -< tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -< tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -< tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype -24a52 -> args ∈ {{ NULL ; &S___va_params{[0], [1], [2]} }} -26,31d53 -< [from] Computing for function __builtin_va_start <-main -< [from] Done for function __builtin_va_start -< [from] Computing for function __builtin_va_arg <-main -< [from] Done for function __builtin_va_arg -< [from] Computing for function __builtin_va_end <-main -< [from] Done for function __builtin_va_end -39c61 -< fmt; i; f ---- -> fmt; args; i; tmp; f; tmp_0 -41c63,64 -< S_fmt[0..1] ---- -> S___va_params[0..1]; S_0_S___va_params[bits 0 to ..]; -> S_1_S___va_params[bits 0 to ..]; S_fmt[0..1] +diff tests/value/oracle/logic_ptr_cast.res.oracle tests/value/oracle_bitwise/logic_ptr_cast.res.oracle +9d8 +< The imprecision originates from Arithmetic {tests/value/logic_ptr_cast.i:8} diff --git a/tests/value/diff_equalities b/tests/value/diff_equalities index eaba3ddcd28b73b997a1e248f0716db7001d25c0..fca5051e4bedd1b4d9965030b246776606262182 100644 --- a/tests/value/diff_equalities +++ b/tests/value/diff_equalities @@ -1,24 +1,24 @@ diff tests/value/oracle/CruiseControl.0.res.oracle tests/value/oracle_equalities/CruiseControl.0.res.oracle -972c972 +971c971 < [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {0; 1} --- > [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {1} -1010c1010 +1009c1009 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle{._I0_ThrottleIn; ._O0_ThrottleOut} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._I0_ThrottleIn ∈ -1011a1012,1013 +1010a1011,1012 > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._O0_ThrottleOut ∈ > [-0.0000000000000000 .. 1.9999998807907104*2^127] -1025c1027 +1024c1026 < [-1.9999998807907104*2^127 .. 1.9999998807907104*2^127] --- > [-0.0000000000000000 .. 1.9999998807907104*2^127] -1210c1212 +1209c1211 < [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {0; 1} --- > [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {1} -1222c1224,1228 +1221c1223,1227 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._I1_CruiseSpeed; ._I2_VehiculeSpeed; ._O0_Throttle; ._L1_CruiseControl; ._L2_CruiseControl; ._L3_CruiseControl} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._I1_CruiseSpeed; ._I2_VehiculeSpeed} ∈ @@ -26,45 +26,45 @@ diff tests/value/oracle/CruiseControl.0.res.oracle tests/value/oracle_equalities > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._O0_Throttle ∈ > [-0.0000000000000000 .. 1.9999998807907104*2^127] > [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._L1_CruiseControl; ._L2_CruiseControl; ._L3_CruiseControl} ∈ -1240c1246 +1239c1245 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._L4_CruiseControl; ._L13_CruiseControl} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._L4_CruiseControl ∈ -1241a1248,1249 +1240a1247,1248 > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._L13_CruiseControl ∈ > [-0.0000000000000000 .. 1.9999998807907104*2^127] -1248c1256 +1247c1255 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle{._I0_ThrottleIn; ._O0_ThrottleOut} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._I0_ThrottleIn ∈ -1249a1258,1259 +1248a1257,1258 > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._O0_ThrottleOut ∈ > [-0.0000000000000000 .. 1.9999998807907104*2^127] -1263c1273 +1262c1272 < [-1.9999998807907104*2^127 .. 1.9999998807907104*2^127] --- > [-0.0000000000000000 .. 1.9999998807907104*2^127] diff tests/value/oracle/CruiseControl.1.res.oracle tests/value/oracle_equalities/CruiseControl.1.res.oracle -974c974 +973c973 < [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {0; 1} --- > [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {1} -1012c1012 +1011c1011 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle{._I0_ThrottleIn; ._O0_ThrottleOut} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._I0_ThrottleIn ∈ -1013a1014,1015 +1012a1013,1014 > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._O0_ThrottleOut ∈ > [-0x0.0000000000000p-1022 .. 0x1.fffffe0000000p127] -1027c1029 +1026c1028 < [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] --- > [-0x0.0000000000000p-1022 .. 0x1.fffffe0000000p127] -1211c1213 +1210c1212 < [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {0; 1} --- > [0]._C4_ThrottleCmd._I0_Regul_ON ∈ {1} -1223c1225,1229 +1222c1224,1228 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._I1_CruiseSpeed; ._I2_VehiculeSpeed; ._O0_Throttle; ._L1_CruiseControl; ._L2_CruiseControl; ._L3_CruiseControl} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._I1_CruiseSpeed; ._I2_VehiculeSpeed} ∈ @@ -72,73 +72,77 @@ diff tests/value/oracle/CruiseControl.1.res.oracle tests/value/oracle_equalities > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._O0_Throttle ∈ > [-0x0.0000000000000p-1022 .. 0x1.fffffe0000000p127] > [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._L1_CruiseControl; ._L2_CruiseControl; ._L3_CruiseControl} ∈ -1241c1247 +1240c1246 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation{._L4_CruiseControl; ._L13_CruiseControl} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._L4_CruiseControl ∈ -1242a1249,1250 +1241a1248,1249 > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._L13_CruiseControl ∈ > [-0x0.0000000000000p-1022 .. 0x1.fffffe0000000p127] -1249c1257 +1248c1256 < [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle{._I0_ThrottleIn; ._O0_ThrottleOut} ∈ --- > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._I0_ThrottleIn ∈ -1250a1259,1260 +1249a1258,1259 > [0]._C4_ThrottleCmd._C0_ThrottleRegulation._C0_SaturateThrottle._O0_ThrottleOut ∈ > [-0x0.0000000000000p-1022 .. 0x1.fffffe0000000p127] -1264c1274 +1263c1273 < [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] --- > [-0x0.0000000000000p-1022 .. 0x1.fffffe0000000p127] diff tests/value/oracle/addition.res.oracle tests/value/oracle_equalities/addition.res.oracle -86,87d85 +85,86d84 < tests/value/addition.i:61:[value] warning: signed overflow. assert -2147483648 ≤ (int)*((char *)(&q1)) + 2; < tests/value/addition.i:61:[value] warning: signed overflow. assert (int)*((char *)(&q1)) + 2 ≤ 2147483647; -307,308d304 +110d107 +< [scope:rm_asserts] removing 2 assertion(s) +307,308d303 < tests/value/addition.i:61:[value] warning: signed overflow. assert -2147483648 ≤ (int)*((char *)(&q1)) + 2; < tests/value/addition.i:61:[value] warning: signed overflow. assert (int)*((char *)(&q1)) + 2 ≤ 2147483647; +329d323 +< [scope:rm_asserts] removing 2 assertion(s) diff tests/value/oracle/alias.0.res.oracle tests/value/oracle_equalities/alias.0.res.oracle -108,109c108,109 +104,105c104,105 < t ∈ {1; 2; 4} < u ∈ {2; 3; 4; 5} --- > t ∈ {4} > u ∈ {5} -115c115 +111c111 < t2 ∈ {0; 3; 6} --- > t2 ∈ {6} diff tests/value/oracle/alias.1.res.oracle tests/value/oracle_equalities/alias.1.res.oracle -79c79 +78c78 < z ∈ {0; 1; 2} --- > z ∈ {0; 2} -81,82c81,82 +80,81c80,81 < v2 ∈ {-1; 0; 1; 2; 3; 4} < PTR1 ∈ {{ &p2{[0], [1], [2]} }} --- > v2 ∈ {0; 1; 2} > PTR1 ∈ {{ &p2{[0], [1]} }} -84c84 +83c83 < PTR3 ∈ {{ &p2{[1], [2], [4]} }} --- > PTR3 ∈ {{ &p2{[1], [2]} }} -104c104 +103c103 < t2 FROM p2[0..2]; c --- > t2 FROM p2[0..1]; c diff tests/value/oracle/alias.2.res.oracle tests/value/oracle_equalities/alias.2.res.oracle -73c73 +72c72 < z ∈ {-5; -4; -3; -2; -1; 0; 1; 1000} --- > z ∈ {-2; -1; 0; 1000} diff tests/value/oracle/alias.3.res.oracle tests/value/oracle_equalities/alias.3.res.oracle -67c67 +66c66 < z ∈ {0; 1; 2} --- > z ∈ {0; 2} diff tests/value/oracle/alias.4.res.oracle tests/value/oracle_equalities/alias.4.res.oracle -80c80 +79c79 < y ∈ {0; 3; 77} --- > y ∈ {77} @@ -148,187 +152,130 @@ diff tests/value/oracle/alias.5.res.oracle tests/value/oracle_equalities/alias.5 --- > y ∈ {77} diff tests/value/oracle/alias.6.res.oracle tests/value/oracle_equalities/alias.6.res.oracle -87c87 +86c86 < x ∈ {0; 4; 33} --- > x ∈ {33} +diff tests/value/oracle/assigns.res.oracle tests/value/oracle_equalities/assigns.res.oracle +121a122 +> tests/value/assigns.i:104:[kernel] more than 200(4294967296) elements to enumerate. Approximating. diff tests/value/oracle/backward_add_ptr.res.oracle tests/value/oracle_equalities/backward_add_ptr.res.oracle -11c11 -< [value] Called Frama_C_show_each_only_a({0; 1}, {{ &a }}, {0}) ---- -> [value] Called Frama_C_show_each_only_a({0}, {{ &a }}, {0}) -Only in tests/value/oracle: behavior_statuses.0.err.oracle -Only in tests/value/oracle: behavior_statuses.0.res.oracle -Only in tests/value/oracle: behavior_statuses.1.err.oracle -Only in tests/value/oracle: behavior_statuses.1.res.oracle -Only in tests/value/oracle_equalities: behavior_statuses.err.oracle -Only in tests/value/oracle_equalities: behavior_statuses.res.oracle +10c10 +< tests/value/backward_add_ptr.c:26:[value] Frama_C_show_each_only_a: {0; 1}, {{ &a }}, {0} +--- +> tests/value/backward_add_ptr.c:26:[value] Frama_C_show_each_only_a: {0}, {{ &a }}, {0} +175a176,179 +> (origin: Arithmetic {tests/value/backward_add_ptr.c:33}) }} +> {{ garbled mix of &{a} +> (origin: Arithmetic {tests/value/backward_add_ptr.c:33}) }} +> {{ garbled mix of &{b} +178a183,186 +> {{ garbled mix of &{b} +> (origin: Arithmetic {tests/value/backward_add_ptr.c:39}) }} +> {{ garbled mix of &{a} +> (origin: Arithmetic {tests/value/backward_add_ptr.c:39}) }} diff tests/value/oracle/bitfield.res.oracle tests/value/oracle_equalities/bitfield.res.oracle -68a69,70 -> [value] DUMPING EQ STATE of file tests/value/bitfield.i line 21 -> Eqs: -184a187,188 -> [value] DUMPING EQ STATE of file tests/value/bitfield.i line 143 -> Eqs: {(e)(unsigned int)i = (l)s.a} {(e)(int)i = (l)s.c} +67a68,69 +> # Equality domain: +> +175a178,180 +> # Equality domain: +> {(unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))))i = s.a} +> {(int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))))i = s.c} diff tests/value/oracle/bitwise_pointer.res.oracle tests/value/oracle_equalities/bitwise_pointer.res.oracle -55c55 +54c54 < x ∈ [0..9] --- > x ∈ {5} -68c68 +67c67 < x1 ∈ [0..9] --- > x1 ∈ {5} diff tests/value/oracle/call_simple.res.oracle tests/value/oracle_equalities/call_simple.res.oracle -28c28 +27c27 < c ∈ [--..--] --- > c ∈ [-2147483648..2147483646] diff tests/value/oracle/case_analysis.0.res.oracle tests/value/oracle_equalities/case_analysis.0.res.oracle -19c19 +18c18 < rq ∈ [-0.0000000000000000 .. 100.0000000000000000] --- > rq ∈ [0.0000000000000000 .. 100.0000000000000000] diff tests/value/oracle/case_analysis.1.res.oracle tests/value/oracle_equalities/case_analysis.1.res.oracle -20c20 +19c19 < rq ∈ [-0.0000000000000000 .. 100.0000000000000000] --- > rq ∈ [0.0000000000000000 .. 100.0000000000000000] -diff tests/value/oracle/cast_fun.res.oracle tests/value/oracle_equalities/cast_fun.res.oracle -39,40d38 -< tests/value/cast_fun.i:103:[value] warning: pointer to function with incompatible type. assert \valid_function(p3); -< tests/value/cast_fun.i:108:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); -42c40 -< Called from tests/value/cast_fun.i:113. ---- -> Called from tests/value/cast_fun.i:103. -44a43,48 -> [value] computing for function f9 <- main. -> Called from tests/value/cast_fun.i:108. -> [value] Done for function f9 -> [value] computing for function f10 <- main. -> Called from tests/value/cast_fun.i:113. -> [value] Done for function f10 -52c56 -< tests/value/cast_fun.i:98:[from] warning: variadic call detected. Using only 1 argument(s). ---- -> tests/value/cast_fun.i:103:[from] warning: variadic call detected. Using only 0 argument(s). -59,60d62 -< tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. -< tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. -68,69c70,71 -< p3 ∈ {{ &f9 }} or UNINITIALIZED -< p4 ∈ {{ &f10 }} or UNINITIALIZED ---- -> p3 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -> p4 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -119a122,125 -> [from] call to f10 at tests/value/cast_fun.i:103 (by main): -> NO EFFECTS -> [from] call to f9 at tests/value/cast_fun.i:108 (by main): -> NO EFFECTS -126c132,133 -< p1; p2; p3; p4; x; s ---- -> p1; p2; p3; p4; x; s; __va_arg0; __va_args[0]; __va_arg0_11; -> __va_args_13[0] diff tests/value/oracle/downcast.res.oracle tests/value/oracle_equalities/downcast.res.oracle -663c663 +676c676 < ux ∈ [--..--] --- > ux ∈ [0..65535] -706c706 +719c719 < ux ∈ [--..--] --- > ux ∈ [0..65535] -diff tests/value/oracle/input.res.oracle tests/value/oracle_equalities/input.res.oracle -22d21 -< tests/value/input.i:7:[from] warning: variadic call detected. Using only 1 argument(s). -32c31 -< tmp ---- -> tmp; __va_arg0; __va_args[0] diff tests/value/oracle/leaf.res.oracle tests/value/oracle_equalities/leaf.res.oracle -42c42 -< [value] Called Frama_C_show_each_F([-2147483648..2147483647]) +41c41 +< tests/value/leaf.i:53:[value] Frama_C_show_each_F: [-2147483648..2147483647] --- -> [value] Called Frama_C_show_each_F({5}) +> tests/value/leaf.i:53:[value] Frama_C_show_each_F: {5} diff tests/value/oracle/library.res.oracle tests/value/oracle_equalities/library.res.oracle -95d94 +100d99 < tests/value/library.i:44:[value] warning: non-finite float value. assert \is_finite((float)(*pf + *pf)); diff tests/value/oracle/modulo.res.oracle tests/value/oracle_equalities/modulo.res.oracle -39a40,61 -> [value] Called Frama_C_show_each_1([-10..-1], [-9..-1], [-8..0]) -> [value] Called Frama_C_show_each_1([-10..-1], [1..9], [-8..0]) -> [value] Called Frama_C_show_each_1([1..10], [-9..-1], [0..8]) -> [value] Called Frama_C_show_each_1([1..10], [1..9], [0..8]) -> [value] Called Frama_C_show_each_1([1..9], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_1([-9..-1], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1([1..9], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_1([-9..-1], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-8; -7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6}) -47a70,91 -> [value] Called Frama_C_show_each_2([-10..-1], [1..9], [-8..0]) -> [value] Called Frama_C_show_each_2([-10..-1], [-9..-1], [-8..0]) -> [value] Called Frama_C_show_each_2([1..10], [1..9], [0..8]) -> [value] Called Frama_C_show_each_2([1..10], [-9..-1], [0..8]) -> [value] Called Frama_C_show_each_2([-9..-1], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2([1..9], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_2([-9..-1], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2([1..9], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_2({-8; -7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6}) -54a99,100 -> [value] Called Frama_C_show_each_3([-10..10], [-9..9], [-8..8]) -> [value] Called Frama_C_show_each_3([-9..9], [-8..8], [-7..7]) +38a39,50 +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [-9..-1], [-8..0] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [1..9], [-8..0] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [-9..-1], [0..8] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [1..9], [0..8] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [1..9], {1; 2; 3; 4; 5; 6; 7; 8}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [-9..-1], {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [1..9], {-8; -7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [-9..-1], {-8; -7; -6; -5; -4; -3; -2; -1}, {-7; -6; -5; -4; -3; -2; -1; 0} +46a59,70 +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..-1], [1..9], [-8..0] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..-1], [-9..-1], [-8..0] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [1..10], [1..9], [0..8] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [1..10], [-9..-1], [0..8] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [-9..-1], {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [1..9], {1; 2; 3; 4; 5; 6; 7; 8}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [-9..-1], {-8; -7; -6; -5; -4; -3; -2; -1}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [1..9], {-8; -7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6; 7} +53a78,79 +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-10..10], [-9..9], [-8..8] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-9..9], [-8..8], [-7..7] diff tests/value/oracle/non_natural.res.oracle tests/value/oracle_equalities/non_natural.res.oracle -54a55,56 +53a54,55 > tests/value/non_natural.i:23:[kernel] more than 200(12500) elements to enumerate. Approximating. > tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. -55a58,59 +54a57,58 > tests/value/non_natural.i:24:[kernel] more than 200(12500) elements to enumerate. Approximating. > tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. -58a63 +57a62 > tests/value/non_natural.i:25:[kernel] more than 200(12500) elements to enumerate. Approximating. -61a67 +60a66 > tests/value/non_natural.i:26:[kernel] more than 200(12500) elements to enumerate. Approximating. -64a71 +63a70 > tests/value/non_natural.i:27:[kernel] more than 200(12500) elements to enumerate. Approximating. -67a75 +66a74 > tests/value/non_natural.i:28:[kernel] more than 200(12500) elements to enumerate. Approximating. -70a79 +69a78 > tests/value/non_natural.i:29:[kernel] more than 200(12500) elements to enumerate. Approximating. -73a83 +72a82 > tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate. Approximating. -131a142 -> tests/value/non_natural.i:39:[kernel] more than 200(12500) elements to enumerate. Approximating. -180,187d190 +96,105d105 +< tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. < tests/value/non_natural.i:23:[kernel] more than 200(12500) elements to enumerate. Approximating. +< tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. < tests/value/non_natural.i:24:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:25:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:26:[kernel] more than 200(12500) elements to enumerate. Approximating. @@ -336,90 +283,85 @@ diff tests/value/oracle/non_natural.res.oracle tests/value/oracle_equalities/non < tests/value/non_natural.i:28:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:29:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate. Approximating. -200,201d202 -< tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. -< tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. +140a141 +> tests/value/non_natural.i:39:[kernel] more than 200(12500) elements to enumerate. Approximating. +diff tests/value/oracle/nonlin.res.oracle tests/value/oracle_equalities/nonlin.res.oracle +61c61 +< q ∈ {{ &x + [-400..400],0%4 }} +--- +> q ∈ {{ &x }} +diff tests/value/oracle/offsetmap.res.oracle tests/value/oracle_equalities/offsetmap.res.oracle +36d35 +< [value] Recording results for g +37a37 +> [value] Recording results for g diff tests/value/oracle/origin.0.res.oracle tests/value/oracle_equalities/origin.0.res.oracle -190,191c190 +186,187c186 < pm2[bits 0 to 15]# ∈ {{ (? *)&a }}%32, bits 16 to 31 < [bits 16 to 31]# ∈ {{ (? *)&b }}%32, bits 0 to 15 --- > pm2 ∈ {{ &a + {-4} ; &b + {-4} }} -230,231c229 +226,227c225 < pm2[bits 0 to 15]# ∈ {{ (? *)&a }}%32, bits 16 to 31 < [bits 16 to 31]# ∈ {{ (? *)&b }}%32, bits 0 to 15 --- > pm2 ∈ {{ &a + {-4} ; &b + {-4} }} +diff tests/value/oracle/period.res.oracle tests/value/oracle_equalities/period.res.oracle +83,85d82 +< tests/value/period.c:53:[value] Assigning imprecise value to p. +< The imprecision originates from Arithmetic {tests/value/period.c:53} +< tests/value/period.c:54:[value] warning: out of bounds read. assert \valid_read(p); diff tests/value/oracle/plevel.res.oracle tests/value/oracle_equalities/plevel.res.oracle -11a12 -> tests/value/plevel.i:21:[kernel] more than 40(65) elements to enumerate. Approximating. -15d15 -< tests/value/plevel.i:21:[kernel] more than 40(65) elements to enumerate. Approximating. +11d10 +< [value] Recording results for main +12a12 +> [value] Recording results for main diff tests/value/oracle/pointer_comparison.1.res.oracle tests/value/oracle_equalities/pointer_comparison.1.res.oracle -30d29 -< [value] Called Frama_C_show_each_5e({{ &x + {16} }}) -88d86 -< [value] Called Frama_C_show_each_5e({{ &x + {16} }}) -172d169 -< [value] Called Frama_C_show_each_5e({{ &x + {16} }}) -diff tests/value/oracle/precise_locations.res.oracle tests/value/oracle_equalities/precise_locations.res.oracle -221d220 -< tests/value/precise_locations.i:49:[value] warning: signed overflow. assert t[j].f1[i] + 1 ≤ 2147483647; -405,406d403 -< [ - ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 49) -< tried with Value. -423,424c420,421 -< 8 To be validated -< 12 Total ---- -> 7 To be validated -> 11 Total -832d828 -< tests/value/precise_locations.i:49:[value] assertion 'Value,signed_overflow' got final status valid. -1225,1226d1220 -< [ Valid ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 49) -< by Value (v2). -1241c1235 -< 10 Completely validated ---- -> 9 Completely validated -1243c1237 -< 12 Total ---- -> 11 Total +29c29 +< tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: {{ &x + {16} }} +--- +> tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: Bottom +84c84 +< tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: {{ &x + {16} }} +--- +> tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: Bottom +168c168 +< tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: {{ &x + {16} }} +--- +> tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: Bottom diff tests/value/oracle/ptr_relation.0.res.oracle tests/value/oracle_equalities/ptr_relation.0.res.oracle -24c24 +23c23 < i ∈ {0; 77; 333} --- > i ∈ {77} diff tests/value/oracle/redundant_alarms.res.oracle tests/value/oracle_equalities/redundant_alarms.res.oracle -11,12d10 +10,11d9 < tests/value/redundant_alarms.c:11:[value] warning: accessing uninitialized left-value. assert \initialized(p); < tests/value/redundant_alarms.c:12:[value] warning: accessing uninitialized left-value. assert \initialized(p); -20d17 +19d16 < tests/value/redundant_alarms.c:21:[value] warning: accessing uninitialized left-value. assert \initialized(&t[i]); -42,43c39 +48,49c45 < [scope:rm_asserts] removing 3 assertion(s) < tests/value/redundant_alarms.c:12:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(p); --- > [scope:rm_asserts] removing 2 assertion(s) -85d80 +90d85 < /*@ assert Value: initialisation: \initialized(p); */ -87d81 +92d86 < /*@ assert Value: initialisation: \initialized(p); */ -104d97 +109d102 < /*@ assert Value: initialisation: \initialized(&t[i]); */ -167d159 -< int w; -170,172d161 +178a172 +> int z; +181,183d174 < *p = 1; -< z = *p + 1; -< w = *p + 2; +< int z = *p + 1; +< int w = *p + 2; diff tests/value/oracle/relation_reduction.res.oracle tests/value/oracle_equalities/relation_reduction.res.oracle -24,25d23 +23,24d22 < tests/value/relation_reduction.i:20:[value] warning: accessing out of bounds index. assert 0 ≤ y; < tests/value/relation_reduction.i:20:[value] warning: accessing out of bounds index. assert y < 9; -32,35c30,33 +31,34c29,32 < R1 ∈ [-2147483648..2147483637] < R2 ∈ [-2147483638..2147483647] < R3 ∈ [--..--] @@ -429,11 +371,11 @@ diff tests/value/oracle/relation_reduction.res.oracle tests/value/oracle_equalit > R2 ∈ {0; 12} > R3 ∈ {0; 7} > R4 ∈ {0; 2} -46c44 +45c43 < R4 FROM tab[0..8]; x (and SELF) --- > R4 FROM tab[0..5]; x (and SELF) -51c49 +50c48 < y; t; tab[0..8] --- > y; t; tab[0..5] @@ -451,12 +393,12 @@ diff tests/value/oracle/relation_shift.res.oracle tests/value/oracle_equalities/ > x ∈ [-2147483647..2147483642] > y ∈ [-2147483648..2147483645] diff tests/value/oracle/relations.res.oracle tests/value/oracle_equalities/relations.res.oracle -51,52c51 +50,51c50 < u[0] ∈ [-2147483648..2147483646] < [1] ∈ [--..--] --- > u[0..1] ∈ [-2147483648..2147483646] -58,61c57,60 +57,60c56,59 < R1 ∈ [--..--] < R2 ∈ [--..--] < R3 ∈ [-2147483648..2147483646] @@ -467,18 +409,18 @@ diff tests/value/oracle/relations.res.oracle tests/value/oracle_equalities/relat > R3 ∈ {0; 2} > R4 ∈ {0; 2} diff tests/value/oracle/relations2.res.oracle tests/value/oracle_equalities/relations2.res.oracle -54c54 +55c55 < n ∈ [0..512] --- > n ∈ [1..512] 123d122 -< [value] Called Frama_C_show_each_NO2() +< tests/value/relations2.i:57:[value] Frama_C_show_each_NO2: diff tests/value/oracle/struct2.res.oracle tests/value/oracle_equalities/struct2.res.oracle -50a51 +49a50 > tests/value/struct2.i:78:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -52d52 +51d51 < tests/value/struct2.i:82:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(tab2[i] + j); -76a77 +75a76 > tests/value/struct2.i:185:[value] assertion 'Value,index_bound' got final status valid. 113,115c114,116 < tab3[0..1] ∈ [--..--] @@ -497,79 +439,3 @@ diff tests/value/oracle/struct2.res.oracle tests/value/oracle_equalities/struct2 < [9].a}; s1; s2; s5.e[0].b; s6.b; s8; tabl[0..1]; tab1[0..1]; --- > [9].a}; s1; s2; s5.e[0].b; s6.b; s8; tabl[0..1]; tab1[0]; -diff tests/value/oracle/va_list.res.oracle tests/value/oracle_equalities/va_list.res.oracle -12d11 -< tests/value/va_list.c:9:[value] user error: functions returning variadic arguments must be stubbed -18c17,19 -< vlParameters ∈ [--..--] ---- -> vlParameters ∈ -> {{ NULL + [0..4294967295] ; -> &alloced_return___builtin_next_arg + [0..2147483644],0%4 }} -diff tests/value/oracle/va_list2.res.oracle tests/value/oracle_equalities/va_list2.res.oracle -10c10,24 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) ---- -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read((int *)*args); -> tests/value/va_list2.c:11:[value] Assigning imprecise value to tmp. -> The imprecision originates from Well -> tests/value/va_list2.c:11:[value] Assigning imprecise value to i. -> The imprecision originates from Well -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read((float *)*args); -> tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(*((float *)*args)); -> tests/value/va_list2.c:16:[value] Assigning imprecise value to tmp_0. -> The imprecision originates from Well -13c27,33 -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:16:[value] Assigning imprecise value to f. -> The imprecision originates from Well -> tests/value/va_list2.c:17:[value] warning: non-finite float value. assert \is_finite(f); -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -15,16c35,46 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -20,22d49 -< tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -< tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -< tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype -24a52 -> args ∈ {{ NULL ; &S___va_params{[0], [1], [2]} }} -26,31d53 -< [from] Computing for function __builtin_va_start <-main -< [from] Done for function __builtin_va_start -< [from] Computing for function __builtin_va_arg <-main -< [from] Done for function __builtin_va_arg -< [from] Computing for function __builtin_va_end <-main -< [from] Done for function __builtin_va_end -39c61 -< fmt; i; f ---- -> fmt; args; i; tmp; f; tmp_0 -41c63,64 -< S_fmt[0..1] ---- -> S___va_params[0..1]; S_0_S___va_params[bits 0 to ..]; -> S_1_S___va_params[bits 0 to ..]; S_fmt[0..1] diff --git a/tests/value/diff_gauges b/tests/value/diff_gauges index 615536415ebbca9ae1c9589953b8acf207d17202..241ea4ba5c82ec8b67c1409c66e3ac6a34143a60 100644 --- a/tests/value/diff_gauges +++ b/tests/value/diff_gauges @@ -1,231 +1,292 @@ -Only in tests/value/oracle: behavior_statuses.0.err.oracle -Only in tests/value/oracle: behavior_statuses.0.res.oracle -Only in tests/value/oracle: behavior_statuses.1.err.oracle -Only in tests/value/oracle: behavior_statuses.1.res.oracle -Only in tests/value/oracle_gauges: behavior_statuses.err.oracle -Only in tests/value/oracle_gauges: behavior_statuses.res.oracle diff tests/value/oracle/bitfield.res.oracle tests/value/oracle_gauges/bitfield.res.oracle -122a123,133 -> [value] Called Frama_C_show_each({{ garbled mix of &{b} -> (origin: Misaligned {tests/value/bitfield.i:70}) }}) -> [value] Called Frama_C_show_each({{ garbled mix of &{b} -> (origin: Misaligned {tests/value/bitfield.i:70}) }}) +115a116,126 +> tests/value/bitfield.i:75:[value] Frama_C_show_each: +> {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} +> tests/value/bitfield.i:77:[value] Frama_C_show_each: +> {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} > [value] computing for function leaf <- imprecise_bts_1671 <- main. -> Called from tests/value/bitfield.i:70. +> Called from tests/value/bitfield.i:74. > [value] Done for function leaf -> [value] Called Frama_C_show_each({{ garbled mix of &{b} -> (origin: Misaligned {tests/value/bitfield.i:70}) }}) -> [value] Called Frama_C_show_each({{ garbled mix of &{b} -> (origin: Misaligned {tests/value/bitfield.i:70}) }}) -diff tests/value/oracle/cast_fun.res.oracle tests/value/oracle_gauges/cast_fun.res.oracle -39,40d38 -< tests/value/cast_fun.i:103:[value] warning: pointer to function with incompatible type. assert \valid_function(p3); -< tests/value/cast_fun.i:108:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); -42c40 -< Called from tests/value/cast_fun.i:113. ---- -> Called from tests/value/cast_fun.i:103. -44a43,48 -> [value] computing for function f9 <- main. -> Called from tests/value/cast_fun.i:108. -> [value] Done for function f9 -> [value] computing for function f10 <- main. -> Called from tests/value/cast_fun.i:113. -> [value] Done for function f10 -52c56 -< tests/value/cast_fun.i:98:[from] warning: variadic call detected. Using only 1 argument(s). ---- -> tests/value/cast_fun.i:103:[from] warning: variadic call detected. Using only 0 argument(s). -59,60d62 -< tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. -< tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. -68,69c70,71 -< p3 ∈ {{ &f9 }} or UNINITIALIZED -< p4 ∈ {{ &f10 }} or UNINITIALIZED ---- -> p3 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -> p4 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -119a122,125 -> [from] call to f10 at tests/value/cast_fun.i:103 (by main): -> NO EFFECTS -> [from] call to f9 at tests/value/cast_fun.i:108 (by main): -> NO EFFECTS -126c132,133 -< p1; p2; p3; p4; x; s ---- -> p1; p2; p3; p4; x; s; __va_arg0; __va_args[0]; __va_arg0_11; -> __va_args_13[0] +> tests/value/bitfield.i:75:[value] Frama_C_show_each: +> {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} +> tests/value/bitfield.i:77:[value] Frama_C_show_each: +> {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} diff tests/value/oracle/for_loops.1.res.oracle tests/value/oracle_gauges/for_loops.1.res.oracle -38,39c38 +37,38c37 < tests/value/for_loops.c:16:[value] warning: signed overflow. assert w + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each_F([0..2147483647]) +< tests/value/for_loops.c:17:[value] Frama_C_show_each_F: [0..2147483647] --- -> [value] Called Frama_C_show_each_F([0..100]) +> tests/value/for_loops.c:17:[value] Frama_C_show_each_F: [0..100] diff tests/value/oracle/for_loops.2.res.oracle tests/value/oracle_gauges/for_loops.2.res.oracle -33,34c33 +34,35c34 < tests/value/for_loops.c:42:[value] warning: signed overflow. assert w + T[j] ≤ 2147483647; -< [value] Called Frama_C_show_each([0..2147483647]) +< tests/value/for_loops.c:43:[value] Frama_C_show_each: [0..2147483647] --- -> [value] Called Frama_C_show_each([0..1000]) -43c42 -< w ∈ [0..2147483647] ---- -> w ∈ [0..1000] +> tests/value/for_loops.c:43:[value] Frama_C_show_each: [0..1000] diff tests/value/oracle/gauges.res.oracle tests/value/oracle_gauges/gauges.res.oracle -27d26 +26d25 < tests/value/gauges.i:21:[value] warning: signed overflow. assert -2147483648 ≤ j - 4; -32c31,32 +31c30,31 < tests/value/gauges.i:24:[value] warning: signed overflow. assert l + 1 ≤ 2147483647; --- -> [value] Called Frama_C_show_each_0({{ "in" }}) -> [value] Called Frama_C_show_each_1({{ "in" }}) -50a51,52 -> [value] Called Frama_C_show_each_0({{ "in" }}) -> [value] Called Frama_C_show_each_1({{ "in" }}) -56d57 +> tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +> tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +49a50,51 +> tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +> tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +55d56 < tests/value/gauges.i:46:[value] warning: signed overflow. assert l + 1 ≤ 2147483647; -68d68 +67d67 < tests/value/gauges.i:56:[value] warning: accessing out of bounds index. assert j < 38; -81,84d80 +80,83d79 < tests/value/gauges.i:69:[value] warning: out of bounds write. assert \valid(tmp); < (tmp from p++) -< [value] Called Frama_C_show_each() -< [value] Called Frama_C_show_each() -97d92 +< tests/value/gauges.i:70:[value] Frama_C_show_each: +< tests/value/gauges.i:70:[value] Frama_C_show_each: +96d91 < tests/value/gauges.i:79:[value] warning: signed overflow. assert k + 1 ≤ 2147483647; -99d93 +98d92 < tests/value/gauges.i:82:[value] warning: signed overflow. assert k + 1 ≤ 2147483647; -104c98,100 -< [value] Called Frama_C_show_each([0..2147483647]) +103c97,99 +< tests/value/gauges.i:84:[value] Frama_C_show_each: [0..2147483647] --- -> [value] Called Frama_C_show_each({{ "inner" }}) -> [value] Called Frama_C_show_each({{ "outer" }}) -> [value] Called Frama_C_show_each({390}) -118d113 +> tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +> tests/value/gauges.i:81:[value] Frama_C_show_each: {{ "outer" }} +> tests/value/gauges.i:84:[value] Frama_C_show_each: {390} +117d112 < tests/value/gauges.i:97:[value] warning: signed overflow. assert c + 1 ≤ 2147483647; -151,153c146,147 -< [value] Called Frama_C_show_each({{ &y + [4..36],0%4 }}) -< [value] Called Frama_C_show_each({{ &y + [4..40],0%4 }}) +149,151c144,145 +< tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + [4..36],0%4 }} +< tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + [4..40],0%4 }} < tests/value/gauges.i:128:[value] warning: out of bounds write. assert \valid(p); --- -> [value] Called Frama_C_show_each({{ &y + {4; 8; 12; 16; 20; 24} }}) -> [value] Called Frama_C_show_each({{ &y + {4; 8; 12; 16; 20; 24} }}) -159d152 +> tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4; 8; 12; 16; 20; 24} }} +> tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4; 8; 12; 16; 20; 24} }} +157d150 < tests/value/gauges.i:138:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -176,177d168 +174,175d166 < tests/value/gauges.i:156:[value] warning: out of bounds write. assert \valid(tmp); < (tmp from p--) -216,217d206 +214,215d204 < tests/value/gauges.i:190:[value] warning: out of bounds write. assert \valid(p); < tests/value/gauges.i:191:[value] warning: out of bounds write. assert \valid(q); -227,230d215 +223,226d211 < tests/value/gauges.i:200:[value] warning: out of bounds read. assert \valid_read(tmp); < (tmp from A++) < tests/value/gauges.i:200:[value] warning: out of bounds read. assert \valid_read(tmp_0); < (tmp_0 from B++) -268,269c253 +264,265c249 < tests/value/gauges.i:238:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({45; 46; 47; 48; 49; 50; 51}, [0..2147483647]) +< tests/value/gauges.i:240:[value] Frama_C_show_each: {45; 46; 47; 48; 49; 50; 51}, [0..2147483647] --- -> [value] Called Frama_C_show_each({47; 48}, {6}) -275,276c259 +> tests/value/gauges.i:240:[value] Frama_C_show_each: {47; 48}, {6} +271,272c255 < tests/value/gauges.i:249:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({48; 49; 50; 51; 52; 53; 54}, [0..2147483647]) +< tests/value/gauges.i:252:[value] Frama_C_show_each: {48; 49; 50; 51; 52; 53; 54}, [0..2147483647] --- -> [value] Called Frama_C_show_each({48; 49; 50; 51; 52; 53; 54}, {6; 7}) -282,283c265 +> tests/value/gauges.i:252:[value] Frama_C_show_each: {48; 49; 50; 51; 52; 53; 54}, {6; 7} +278,279c261 < tests/value/gauges.i:261:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({-59; -58; -57; -56; -55; -54; -53}, [0..2147483647]) +< tests/value/gauges.i:263:[value] Frama_C_show_each: {-59; -58; -57; -56; -55; -54; -53}, [0..2147483647] --- -> [value] Called Frama_C_show_each({-58; -57}, {9}) -289,290c271 +> tests/value/gauges.i:263:[value] Frama_C_show_each: {-58; -57}, {9} +285,286c267 < tests/value/gauges.i:272:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({-64; -63; -62; -61; -60; -59; -58}, [0..2147483647]) +< tests/value/gauges.i:274:[value] Frama_C_show_each: {-64; -63; -62; -61; -60; -59; -58}, [0..2147483647] --- -> [value] Called Frama_C_show_each({-64; -63; -62; -61; -60; -59; -58}, {9; 10}) -298,300c279 +> tests/value/gauges.i:274:[value] Frama_C_show_each: {-64; -63; -62; -61; -60; -59; -58}, {9; 10} +294,295c275 < tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -< [value] Called Frama_C_show_each({-593; -592; -591; -590; -589; -588}, -< [0..2147483647]) ---- -> [value] Called Frama_C_show_each({-593; -592; -591; -590; -589; -588}, [99..119]) -310c289 +< tests/value/gauges.i:295:[value] Frama_C_show_each: {-593; -592; -591; -590; -589; -588}, [0..2147483647] +--- +> tests/value/gauges.i:295:[value] Frama_C_show_each: {-593; -592; -591; -590; -589; -588}, [99..119] +343a324,327 +> # Gauges domain: +> V: [{[ p -> {{ &x }} +> i -> {1} ]}] +> s395: λ(0) +387a372,375 +> # Gauges domain: +> V: [{[ i -> {1} ]}] +> s395: λ([0 .. 1]) +> {[ i -> {1} ]} +431a420,423 +> # Gauges domain: +> V: [{[ i -> {1} ]}] +> s395: λ([0 .. 2]) +> {[ i -> {1} ]} +475a468,471 +> # Gauges domain: +> V: [{[ i -> {1} ]}] +> s395: λ([0 .. 10]) +> {[ i -> {1} ]} +526a523,527 +> # Gauges domain: +> V: [{[ p -> {{ &a }} +> i -> {2} ]}] +> s409: λ(0) +> s408: λ(0) +572a574,676 +> # Gauges domain: +> V: [{[ i -> {2} ]}] +> s409: λ(0) +> s408: λ([0 .. 1]) +> {[ i -> {0} ]} +> ==END OF DUMP== +> tests/value/gauges.i:323:[value] Frama_C_dump_each: +> # Cvalue domain: +> v ∈ [--..--] +> t[0..4] ∈ {0} +> [5] ∈ [0..48],0%3 +> [6] ∈ {0} +> [7] ∈ [0..48],0%3 +> [8] ∈ {0} +> [9] ∈ [0..48],0%3 +> [10] ∈ {0} +> [11] ∈ [0..48],0%3 +> [12] ∈ {0} +> [13] ∈ [0..48],0%3 +> [14] ∈ {0} +> [15] ∈ [0..48],0%3 +> [16] ∈ {0} +> [17] ∈ [0..48],0%3 +> [18] ∈ {0} +> [19] ∈ [0..48],0%3 +> [20] ∈ {0} +> [21] ∈ [0..48],0%3 +> [22] ∈ {0} +> [23] ∈ [0..48],0%3 +> [24] ∈ {0} +> [25] ∈ [0..48],0%3 +> [26] ∈ {0} +> [27] ∈ [0..48],0%3 +> [28] ∈ {0} +> [29] ∈ [0..48],0%3 +> [30] ∈ {0} +> [31] ∈ [0..48],0%3 +> [32] ∈ {0} +> [33] ∈ [0..48],0%3 +> [34] ∈ {0} +> [35] ∈ [0..48],0%3 +> [36] ∈ {0} +> [37] ∈ [0..48],0%3 +> u[0..99] ∈ [0..100] +> T[0..99] ∈ [--..--] +> a ∈ {1} +> b ∈ {0} +> p ∈ {{ &a ; &b }} +> i ∈ {2} +> # Gauges domain: +> V: [{[ i -> {2} ]}] +> s409: λ(0) +> s408: λ([0 .. 2]) +> {[ i -> {0} ]} +> ==END OF DUMP== +> tests/value/gauges.i:323:[value] Frama_C_dump_each: +> # Cvalue domain: +> v ∈ [--..--] +> t[0..4] ∈ {0} +> [5] ∈ [0..48],0%3 +> [6] ∈ {0} +> [7] ∈ [0..48],0%3 +> [8] ∈ {0} +> [9] ∈ [0..48],0%3 +> [10] ∈ {0} +> [11] ∈ [0..48],0%3 +> [12] ∈ {0} +> [13] ∈ [0..48],0%3 +> [14] ∈ {0} +> [15] ∈ [0..48],0%3 +> [16] ∈ {0} +> [17] ∈ [0..48],0%3 +> [18] ∈ {0} +> [19] ∈ [0..48],0%3 +> [20] ∈ {0} +> [21] ∈ [0..48],0%3 +> [22] ∈ {0} +> [23] ∈ [0..48],0%3 +> [24] ∈ {0} +> [25] ∈ [0..48],0%3 +> [26] ∈ {0} +> [27] ∈ [0..48],0%3 +> [28] ∈ {0} +> [29] ∈ [0..48],0%3 +> [30] ∈ {0} +> [31] ∈ [0..48],0%3 +> [32] ∈ {0} +> [33] ∈ [0..48],0%3 +> [34] ∈ {0} +> [35] ∈ [0..48],0%3 +> [36] ∈ {0} +> [37] ∈ [0..48],0%3 +> u[0..99] ∈ [0..100] +> T[0..99] ∈ [--..--] +> a ∈ {1} +> b ∈ {0} +> p ∈ {{ &a ; &b }} +> i ∈ {2} +> # Gauges domain: +> V: [{[ i -> {2} ]}] +> s409: λ(0) +> s408: λ([0 .. +oo]) +> {[ i -> {0} ]} +583c687 < l ∈ [4..2147483647] --- > l ∈ [4..53] -315c294 +588c692 < l ∈ [4..2147483647] --- > l ∈ [4..53] -353,354c332,333 +626,627c730,731 < A ∈ {{ &A + [0..--],0%4 }} < B ∈ {{ &B + [0..--],0%4 }} --- > A ∈ {{ &A + [0..36],0%4 }} > B ∈ {{ &B + [0..36],0%4 }} -372,373c351,352 +645c749 < i ∈ {45; 46; 47; 48; 49; 50; 51} -< j ∈ [0..2147483647] ---- -> i ∈ {47; 48} -> j ∈ {6} -376c355 -< j ∈ [0..2147483647] --- -> j ∈ {6; 7} -378,379c357,358 +> i ∈ {45; 46; 47; 48} +651c755 < i ∈ {-59; -58; -57; -56; -55; -54; -53} -< j ∈ [0..2147483647] ---- -> i ∈ {-58; -57} -> j ∈ {9} -382c361 -< j ∈ [0..2147483647] ---- -> j ∈ {9; 10} -388c367 -< j ∈ [0..2147483647] --- -> j ∈ [99..119] -391c370 +> i ∈ {-58; -57; -56; -55; -54; -53} +671c775 < p ∈ {{ &u + [0..--],0%4 }} --- > p ∈ {{ &u + [0..400],0%4 }} -393c372 +673c777 < k ∈ [0..2147483647] --- -> k ∈ {390} -398c377 +> k ∈ [0..390] +678c782 < i ∈ [0..2147483647] --- > i ∈ [0..21] -409,410c388,390 +689,690c793,795 < [1..9] ∈ {4; 5; 6; 7; 8; 9} or UNINITIALIZED < p ∈ {{ &y + [4..40],0%4 }} --- > [1..6] ∈ {4; 5; 6; 7; 8; 9} or UNINITIALIZED > [7..9] ∈ UNINITIALIZED > p ∈ {{ &y[7] }} -421c401 +701c806 < p ∈ {{ &T + [--..396],0%4 }} --- > p ∈ {{ &T + [-4..396],0%4 }} -548,549c528,529 +829,830c934,935 < p FROM p; A; B; n; p; A[0..9]; B[0..9] (and SELF) < \result FROM p; A; B; n; p; A[0..9]; B[0..9] --- > p FROM p; A; B; n; p; A[0..8]; B[0..8] (and SELF) > \result FROM p; A; B; n; p; A[0..8]; B[0..8] -617c597 +902c1007 < p; A[0..9]; B[0..9] --- > p; A[0..8]; B[0..8] -675c655 -< x[0..2]; y[0..9]; p; i ---- -> x[0..2]; y[0..6]; p; i diff tests/value/oracle/infinite.res.oracle tests/value/oracle_gauges/infinite.res.oracle -13a14,22 +12a13,21 > [value] computing for function pause <- main. > Called from tests/value/infinite.i:9. > [value] Done for function pause @@ -235,254 +296,245 @@ diff tests/value/oracle/infinite.res.oracle tests/value/oracle_gauges/infinite.r > [value] computing for function pause <- main. > Called from tests/value/infinite.i:9. > [value] Done for function pause -diff tests/value/oracle/input.res.oracle tests/value/oracle_gauges/input.res.oracle -22d21 -< tests/value/input.i:7:[from] warning: variadic call detected. Using only 1 argument(s). -32c31 -< tmp ---- -> tmp; __va_arg0; __va_args[0] diff tests/value/oracle/local_slevel.res.oracle tests/value/oracle_gauges/local_slevel.res.oracle -14,16c14,16 -< [value] Called Frama_C_show_each({1}, {1}, {0; 1}) -< [value] Called Frama_C_show_each({-1}, {0}, {0; 1}) -< [value] Called Frama_C_show_each({1}, {1}, {0; 1; 2}) ---- -> [value] Called Frama_C_show_each({1}, {1}, {1}) -> [value] Called Frama_C_show_each({-1}, {0}, {0}) -> [value] Called Frama_C_show_each({1}, {1}, {1}) -18c18 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3}) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, {1; 2; 3}) -20c20 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3; 4}) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, {1; 2; 3; 4}) -22,27c22,23 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483647]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483647]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483648]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483648]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..4294967295]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..4294967295]) ---- -> [value] Called Frama_C_show_each({1}, [1..79],1%2, [1..79]) -> [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..78]) -141c137 +13,15c13,15 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1; 2} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +17c17 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3} +19c19 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3; 4} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3; 4} +21,26c21,22 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..4294967295] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..4294967295] +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [1..79] +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..78] +140c136 +< r ∈ [--..--] +--- +> r ∈ [0..2147483647] +381,383c377,379 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0; 1} +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1; 2} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0} +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {1} +385c381 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3} +387c383 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3; 4} +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {1; 2; 3; 4} +389,394c385,386 +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483647] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483648] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..4294967295] +< tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..4294967295] +--- +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [1..79] +> tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..78] +508c500 < r ∈ [--..--] --- > r ∈ [0..2147483647] diff tests/value/oracle/loop_wvar.1.res.oracle tests/value/oracle_gauges/loop_wvar.1.res.oracle -23,24c23 -< [value] Called Frama_C_show_each([0..9], [0..17], [0..11]) -< [value] Called Frama_C_show_each([0..9], [0..18], [0..12]) +22,23c22 +< tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..17], [0..11] +< tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..18], [0..12] --- -> [value] Called Frama_C_show_each([0..9], [0..9], [0..9]) -33,34c32,33 +> tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..9], [0..9] +32,33c31,32 < j ∈ [0..18] < k ∈ [0..12] --- > j ∈ [0..17] > k ∈ [0..11] diff tests/value/oracle/modulo.res.oracle tests/value/oracle_gauges/modulo.res.oracle -39a40,111 -> [value] Called Frama_C_show_each_1([-10..-1], [-9..-1], [-8..0]) -> [value] Called Frama_C_show_each_1([-10..-1], [1..9], [-8..0]) -> [value] Called Frama_C_show_each_1([1..10], [-9..-1], [0..8]) -> [value] Called Frama_C_show_each_1([1..10], [1..9], [0..8]) -> [value] Called Frama_C_show_each_1([1..9], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_1([-9..-1], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1([1..9], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_1([-9..-1], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-8; -7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6; 7; 8}, -> {1; 2; 3; 4; 5; 6; 7}, -> {0; 1; 2; 3; 4; 5; 6}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6; 7}, -> {1; 2; 3; 4; 5; 6}, -> {0; 1; 2; 3; 4; 5}) -> [value] Called Frama_C_show_each_1({-7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6}, -> {-5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5}) -> [value] Called Frama_C_show_each_1({-7; -6; -5; -4; -3; -2; -1}, -> {-6; -5; -4; -3; -2; -1}, -> {-5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-6; -5; -4; -3; -2; -1}, -> {-5; -4; -3; -2; -1}, -> {-4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5}, -> {-4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6}, -> {-5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5; 6}, -> {1; 2; 3; 4; 5}, -> {0; 1; 2; 3; 4}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5}, {1; 2; 3; 4}, {0; 1; 2; 3}) -> [value] Called Frama_C_show_each_1({-5; -4; -3; -2; -1}, -> {1; 2; 3; 4}, -> {-3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4; 5}, {-4; -3; -2; -1}, {0; 1; 2; 3}) -> [value] Called Frama_C_show_each_1({-5; -4; -3; -2; -1}, -> {-4; -3; -2; -1}, -> {-3; -2; -1; 0}) -> [value] Called Frama_C_show_each_1({-4; -3; -2; -1}, {-3; -2; -1}, {-2; -1; 0}) -> [value] Called Frama_C_show_each_1({-4; -3; -2; -1}, {1; 2; 3}, {-2; -1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4}, {-3; -2; -1}, {0; 1; 2}) -> [value] Called Frama_C_show_each_1({1; 2; 3; 4}, {1; 2; 3}, {0; 1; 2}) -> [value] Called Frama_C_show_each_1({1; 2; 3}, {1; 2}, {0; 1}) -> [value] Called Frama_C_show_each_1({-3; -2; -1}, {1; 2}, {-1; 0}) -> [value] Called Frama_C_show_each_1({1; 2; 3}, {-2; -1}, {0; 1}) -> [value] Called Frama_C_show_each_1({-3; -2; -1}, {-2; -1}, {-1; 0}) -> [value] Called Frama_C_show_each_1({-2; -1}, {-1}, {0}) -> [value] Called Frama_C_show_each_1({-2; -1}, {1}, {0}) -> [value] Called Frama_C_show_each_1({1; 2}, {-1}, {0}) -> [value] Called Frama_C_show_each_1({1; 2}, {1}, {0}) -47a120,191 -> [value] Called Frama_C_show_each_2([-10..-1], [1..9], [-8..0]) -> [value] Called Frama_C_show_each_2([-10..-1], [-9..-1], [-8..0]) -> [value] Called Frama_C_show_each_2([1..10], [1..9], [0..8]) -> [value] Called Frama_C_show_each_2([1..10], [-9..-1], [0..8]) -> [value] Called Frama_C_show_each_2([-9..-1], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2([1..9], -> {1; 2; 3; 4; 5; 6; 7; 8}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_2([-9..-1], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2([1..9], -> {-8; -7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6; 7}) -> [value] Called Frama_C_show_each_2({-8; -7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({-8; -7; -6; -5; -4; -3; -2; -1}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {-6; -5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6; 7; 8}, -> {1; 2; 3; 4; 5; 6; 7}, -> {0; 1; 2; 3; 4; 5; 6}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6; 7; 8}, -> {-7; -6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5; 6}) -> [value] Called Frama_C_show_each_2({-7; -6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5; 6}, -> {-5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6; 7}, -> {1; 2; 3; 4; 5; 6}, -> {0; 1; 2; 3; 4; 5}) -> [value] Called Frama_C_show_each_2({-7; -6; -5; -4; -3; -2; -1}, -> {-6; -5; -4; -3; -2; -1}, -> {-5; -4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6; 7}, -> {-6; -5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4; 5}) -> [value] Called Frama_C_show_each_2({-6; -5; -4; -3; -2; -1}, -> {1; 2; 3; 4; 5}, -> {-4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({-6; -5; -4; -3; -2; -1}, -> {-5; -4; -3; -2; -1}, -> {-4; -3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6}, -> {1; 2; 3; 4; 5}, -> {0; 1; 2; 3; 4}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5; 6}, -> {-5; -4; -3; -2; -1}, -> {0; 1; 2; 3; 4}) -> [value] Called Frama_C_show_each_2({-5; -4; -3; -2; -1}, -> {1; 2; 3; 4}, -> {-3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5}, {1; 2; 3; 4}, {0; 1; 2; 3}) -> [value] Called Frama_C_show_each_2({-5; -4; -3; -2; -1}, -> {-4; -3; -2; -1}, -> {-3; -2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4; 5}, {-4; -3; -2; -1}, {0; 1; 2; 3}) -> [value] Called Frama_C_show_each_2({-4; -3; -2; -1}, {1; 2; 3}, {-2; -1; 0}) -> [value] Called Frama_C_show_each_2({-4; -3; -2; -1}, {-3; -2; -1}, {-2; -1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4}, {1; 2; 3}, {0; 1; 2}) -> [value] Called Frama_C_show_each_2({1; 2; 3; 4}, {-3; -2; -1}, {0; 1; 2}) -> [value] Called Frama_C_show_each_2({-3; -2; -1}, {1; 2}, {-1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3}, {1; 2}, {0; 1}) -> [value] Called Frama_C_show_each_2({-3; -2; -1}, {-2; -1}, {-1; 0}) -> [value] Called Frama_C_show_each_2({1; 2; 3}, {-2; -1}, {0; 1}) -> [value] Called Frama_C_show_each_2({-2; -1}, {1}, {0}) -> [value] Called Frama_C_show_each_2({-2; -1}, {-1}, {0}) -> [value] Called Frama_C_show_each_2({1; 2}, {1}, {0}) -> [value] Called Frama_C_show_each_2({1; 2}, {-1}, {0}) -54a199,211 -> [value] Called Frama_C_show_each_3([-10..10], [-9..9], [-8..8]) -> [value] Called Frama_C_show_each_3([-9..9], [-8..8], [-7..7]) -> [value] Called Frama_C_show_each_3([-8..8], [-7..7], [-6..6]) -> [value] Called Frama_C_show_each_3([-7..7], [-6..6], [-5..5]) -> [value] Called Frama_C_show_each_3([-6..6], [-5..5], [-4..4]) -> [value] Called Frama_C_show_each_3([-5..5], -> {-4; -3; -2; -1; 1; 2; 3; 4}, -> {-3; -2; -1; 0; 1; 2; 3}) -> [value] Called Frama_C_show_each_3({-4; -3; -2; -1; 1; 2; 3; 4}, -> {-3; -2; -1; 1; 2; 3}, -> {-2; -1; 0; 1; 2}) -> [value] Called Frama_C_show_each_3({-3; -2; -1; 1; 2; 3}, {-2; -1; 1; 2}, {-1; 0; 1}) -> [value] Called Frama_C_show_each_3({-2; -1; 1; 2}, {-1; 1}, {0}) +38a39,95 +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [-9..-1], [-8..0] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [1..9], [-8..0] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [-9..-1], [0..8] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [1..9], [0..8] +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [1..9], {1; 2; 3; 4; 5; 6; 7; 8}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [-9..-1], {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [1..9], {-8; -7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> [-9..-1], {-8; -7; -6; -5; -4; -3; -2; -1}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-8; -7; -6; -5; -4; -3; -2; -1}, +> {-7; -6; -5; -4; -3; -2; -1}, +> {-6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-8; -7; -6; -5; -4; -3; -2; -1}, +> {1; 2; 3; 4; 5; 6; 7}, +> {-6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {1; 2; 3; 4; 5; 6; 7; 8}, {1; 2; 3; 4; 5; 6; 7}, {0; 1; 2; 3; 4; 5; 6} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {1; 2; 3; 4; 5; 6; 7}, {1; 2; 3; 4; 5; 6}, {0; 1; 2; 3; 4; 5} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-7; -6; -5; -4; -3; -2; -1}, {1; 2; 3; 4; 5; 6}, {-5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {1; 2; 3; 4; 5; 6; 7}, {-6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-7; -6; -5; -4; -3; -2; -1}, +> {-6; -5; -4; -3; -2; -1}, +> {-5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-6; -5; -4; -3; -2; -1}, {-5; -4; -3; -2; -1}, {-4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {-6; -5; -4; -3; -2; -1}, {1; 2; 3; 4; 5}, {-4; -3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: +> {1; 2; 3; 4; 5; 6}, {-5; -4; -3; -2; -1}, {0; 1; 2; 3; 4} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3; 4; 5; 6}, {1; 2; 3; 4; 5}, {0; 1; 2; 3; 4} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3; 4; 5}, {1; 2; 3; 4}, {0; 1; 2; 3} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-5; -4; -3; -2; -1}, {1; 2; 3; 4}, {-3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3; 4; 5}, {-4; -3; -2; -1}, {0; 1; 2; 3} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-5; -4; -3; -2; -1}, {-4; -3; -2; -1}, {-3; -2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-4; -3; -2; -1}, {-3; -2; -1}, {-2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-4; -3; -2; -1}, {1; 2; 3}, {-2; -1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3; 4}, {-3; -2; -1}, {0; 1; 2} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3; 4}, {1; 2; 3}, {0; 1; 2} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3}, {1; 2}, {0; 1} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-3; -2; -1}, {1; 2}, {-1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2; 3}, {-2; -1}, {0; 1} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-3; -2; -1}, {-2; -1}, {-1; 0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-2; -1}, {-1}, {0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {-2; -1}, {1}, {0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2}, {-1}, {0} +> tests/value/modulo.i:41:[value] Frama_C_show_each_1: {1; 2}, {1}, {0} +46a104,160 +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..-1], [1..9], [-8..0] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..-1], [-9..-1], [-8..0] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [1..10], [1..9], [0..8] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: [1..10], [-9..-1], [0..8] +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [-9..-1], {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [1..9], {1; 2; 3; 4; 5; 6; 7; 8}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [-9..-1], {-8; -7; -6; -5; -4; -3; -2; -1}, {-7; -6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> [1..9], {-8; -7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6; 7} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-8; -7; -6; -5; -4; -3; -2; -1}, +> {1; 2; 3; 4; 5; 6; 7}, +> {-6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-8; -7; -6; -5; -4; -3; -2; -1}, +> {-7; -6; -5; -4; -3; -2; -1}, +> {-6; -5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {1; 2; 3; 4; 5; 6; 7; 8}, {1; 2; 3; 4; 5; 6; 7}, {0; 1; 2; 3; 4; 5; 6} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {1; 2; 3; 4; 5; 6; 7; 8}, {-7; -6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5; 6} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-7; -6; -5; -4; -3; -2; -1}, {1; 2; 3; 4; 5; 6}, {-5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {1; 2; 3; 4; 5; 6; 7}, {1; 2; 3; 4; 5; 6}, {0; 1; 2; 3; 4; 5} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-7; -6; -5; -4; -3; -2; -1}, +> {-6; -5; -4; -3; -2; -1}, +> {-5; -4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {1; 2; 3; 4; 5; 6; 7}, {-6; -5; -4; -3; -2; -1}, {0; 1; 2; 3; 4; 5} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-6; -5; -4; -3; -2; -1}, {1; 2; 3; 4; 5}, {-4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {-6; -5; -4; -3; -2; -1}, {-5; -4; -3; -2; -1}, {-4; -3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3; 4; 5; 6}, {1; 2; 3; 4; 5}, {0; 1; 2; 3; 4} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: +> {1; 2; 3; 4; 5; 6}, {-5; -4; -3; -2; -1}, {0; 1; 2; 3; 4} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-5; -4; -3; -2; -1}, {1; 2; 3; 4}, {-3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3; 4; 5}, {1; 2; 3; 4}, {0; 1; 2; 3} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-5; -4; -3; -2; -1}, {-4; -3; -2; -1}, {-3; -2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3; 4; 5}, {-4; -3; -2; -1}, {0; 1; 2; 3} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-4; -3; -2; -1}, {1; 2; 3}, {-2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-4; -3; -2; -1}, {-3; -2; -1}, {-2; -1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3; 4}, {1; 2; 3}, {0; 1; 2} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3; 4}, {-3; -2; -1}, {0; 1; 2} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-3; -2; -1}, {1; 2}, {-1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3}, {1; 2}, {0; 1} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-3; -2; -1}, {-2; -1}, {-1; 0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2; 3}, {-2; -1}, {0; 1} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-2; -1}, {1}, {0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {-2; -1}, {-1}, {0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2}, {1}, {0} +> tests/value/modulo.i:53:[value] Frama_C_show_each_2: {1; 2}, {-1}, {0} +53a168,178 +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-10..10], [-9..9], [-8..8] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-9..9], [-8..8], [-7..7] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-8..8], [-7..7], [-6..6] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-7..7], [-6..6], [-5..5] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-6..6], [-5..5], [-4..4] +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: +> [-5..5], {-4; -3; -2; -1; 1; 2; 3; 4}, {-3; -2; -1; 0; 1; 2; 3} +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: +> {-4; -3; -2; -1; 1; 2; 3; 4}, {-3; -2; -1; 1; 2; 3}, {-2; -1; 0; 1; 2} +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: {-3; -2; -1; 1; 2; 3}, {-2; -1; 1; 2}, {-1; 0; 1} +> tests/value/modulo.i:64:[value] Frama_C_show_each_3: {-2; -1; 1; 2}, {-1; 1}, {0} diff tests/value/oracle/precise_locations.res.oracle tests/value/oracle_gauges/precise_locations.res.oracle 63a64,67 > [value] computing for function ct <- main. > Called from tests/value/precise_locations.i:39. > [value] Recording results for ct > [value] Done for function ct -542a547,550 +532a537,540 > [value] computing for function ct <- main. > Called from tests/value/precise_locations.i:39. > [value] Recording results for ct > [value] Done for function ct diff tests/value/oracle/reevaluate_alarms.res.oracle tests/value/oracle_gauges/reevaluate_alarms.res.oracle -14,15d13 +13,14d12 < tests/value/reevaluate_alarms.i:14:[value] warning: out of bounds write. assert \valid(tmp); < (tmp from p++) -121,122d118 +120,121d117 < [ - ] Assertion 'Value,mem_access' (file tests/value/reevaluate_alarms.i, line 14) < tried with Value. -141,142c137,138 +140,141c136,137 < 4 To be validated < 4 Total --- > 3 To be validated > 3 Total -178d173 +177d172 < tests/value/reevaluate_alarms.i:14:[value] assertion 'Value,mem_access' got final status valid. -267,268d261 +266,267d260 < [ Valid ] Assertion 'Value,mem_access' (file tests/value/reevaluate_alarms.i, line 14) < by Value (v2). -287,288c280,281 +286,287c279,280 < 4 Completely validated < 4 Total --- > 3 Completely validated > 3 Total diff tests/value/oracle/semaphore.res.oracle tests/value/oracle_gauges/semaphore.res.oracle -24a25,33 +23a24,32 > [value] computing for function V <- g. > Called from tests/value/semaphore.i:31. > [value] Done for function V @@ -493,140 +545,49 @@ diff tests/value/oracle/semaphore.res.oracle tests/value/oracle_gauges/semaphore > Called from tests/value/semaphore.i:31. > [value] Done for function V diff tests/value/oracle/unroll.res.oracle tests/value/oracle_gauges/unroll.res.oracle -26c26 +25c25 < j ∈ [-2147483648..-123] --- > j ∈ {-238} diff tests/value/oracle/unroll_simple.res.oracle tests/value/oracle_gauges/unroll_simple.res.oracle -21c21 +20c20 < j ∈ [-2147483648..-126] --- > j ∈ {-250} -diff tests/value/oracle/va_list.res.oracle tests/value/oracle_gauges/va_list.res.oracle -12d11 -< tests/value/va_list.c:9:[value] user error: functions returning variadic arguments must be stubbed -18c17,19 -< vlParameters ∈ [--..--] ---- -> vlParameters ∈ -> {{ NULL + [0..4294967295] ; -> &alloced_return___builtin_next_arg + [0..2147483644],0%4 }} diff tests/value/oracle/va_list2.res.oracle tests/value/oracle_gauges/va_list2.res.oracle -10c10,24 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) ---- -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read((int *)*args); -> tests/value/va_list2.c:11:[value] Assigning imprecise value to tmp. -> The imprecision originates from Well -> tests/value/va_list2.c:11:[value] Assigning imprecise value to i. -> The imprecision originates from Well -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read((float *)*args); -> tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(*((float *)*args)); -> tests/value/va_list2.c:16:[value] Assigning imprecise value to tmp_0. -> The imprecision originates from Well -13c27,33 -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:16:[value] Assigning imprecise value to f. -> The imprecision originates from Well -> tests/value/va_list2.c:17:[value] warning: non-finite float value. assert \is_finite(f); -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -15,16c35,58 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -20,22d61 -< tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -< tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -< tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype -24a64 -> args ∈ {{ NULL ; &S___va_params{[0], [1], [2]} }} -26,31d65 -< [from] Computing for function __builtin_va_start <-main -< [from] Done for function __builtin_va_start -< [from] Computing for function __builtin_va_arg <-main -< [from] Done for function __builtin_va_arg -< [from] Computing for function __builtin_va_end <-main -< [from] Done for function __builtin_va_end -39c73 -< fmt; i; f ---- -> fmt; args; i; tmp; f; tmp_0 -41c75,76 -< S_fmt[0..1] ---- -> S___va_params[0..1]; S_0_S___va_params[bits 0 to ..]; -> S_1_S___va_params[bits 0 to ..]; S_fmt[0..1] +17a18,21 +> tests/value/va_list2.c:12:[value] Frama_C_show_each_i: [-2147483648..2147483647] +> tests/value/va_list2.c:17:[value] Frama_C_show_each_f: [-3.40282346639e+38 .. 3.40282346639e+38] +> tests/value/va_list2.c:12:[value] Frama_C_show_each_i: [-2147483648..2147483647] +> tests/value/va_list2.c:17:[value] Frama_C_show_each_f: [-3.40282346639e+38 .. 3.40282346639e+38] diff tests/value/oracle/widen_non_constant.res.oracle tests/value/oracle_gauges/widen_non_constant.res.oracle -27c27 -< [value] Called Frama_C_show_each_in([0..23], [1..23]) ---- -> [value] Called Frama_C_show_each_in([0..22], [1..23]) -42c42 -< [value] Called Frama_C_show_each_in([0..25], [1..23]) ---- -> [value] Called Frama_C_show_each_in({0; 1; 2}, [1..23]) -43a44 -> [value] Called Frama_C_show_each_in([0..22], [1..23]) -58,60c59 -< [value] Called Frama_C_show_each_in([0..2147483647], [1..23]) +26c26 +< tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: [0..23], [1..23] +--- +> tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: [0..22], [1..23] +41c41 +< tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: [0..25], [1..23] +--- +> tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: {0; 1; 2}, [1..23] +42a43 +> tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: [0..22], [1..23] +57,59c58 +< tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: [0..2147483647], [1..23] < tests/value/widen_non_constant.i:49:[value] warning: out of bounds read. assert \valid_read(p + j); < tests/value/widen_non_constant.i:45:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; --- -> [value] Called Frama_C_show_each_in({0; 1; 2}, [1..23]) -61a61 -> [value] Called Frama_C_show_each_in([0..22], [1..23]) -78c78 +> tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: {0; 1; 2}, [1..23] +60a60 +> tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: [0..22], [1..23] +77c77 < j ∈ {23; 24} --- > j ∈ {23} -81c81 +80c80 < j ∈ {23; 24; 25; 26} --- > j ∈ {23; 24; 25} -132c132 -< N; B[0..25] ---- -> N; B[0..23] -144c144 -< N; A[0..23]; B[0..25]; C[0..23] ---- -> N; A[0..23]; B[0..23]; C[0..23] diff tests/value/oracle/widen_on_non_monotonic.res.oracle tests/value/oracle_gauges/widen_on_non_monotonic.res.oracle -22a23,25 -> tests/value/widen_on_non_monotonic.i:26:[value] entering loop for the first time +22a23,24 > tests/value/widen_on_non_monotonic.i:21:[value] entering loop for the first time > tests/value/widen_on_non_monotonic.i:18:[value] entering loop for the first time diff --git a/tests/value/diff_legacy b/tests/value/diff_legacy deleted file mode 100644 index 864a026fc90c26888278400a513594063eb30205..0000000000000000000000000000000000000000 --- a/tests/value/diff_legacy +++ /dev/null @@ -1,2313 +0,0 @@ -diff tests/value/oracle/addition.res.oracle tests/value/oracle_legacy/addition.res.oracle -101d100 -< {{ garbled mix of &{p2} (origin: Arithmetic {tests/value/addition.i:42}) }} -102a102 -> {{ garbled mix of &{p2} (origin: Arithmetic {tests/value/addition.i:42}) }} -319d318 -< {{ garbled mix of &{p2} (origin: Arithmetic {tests/value/addition.i:42}) }} -320a320 -> {{ garbled mix of &{p2} (origin: Arithmetic {tests/value/addition.i:42}) }} -diff tests/value/oracle/align_char_array.res.oracle tests/value/oracle_legacy/align_char_array.res.oracle -35,36c35,36 -< overlapread1 ∈ {16843009} -< overlapread2 ∈ {16843009} ---- -> overlapread1# ∈ {1} repeated %8 -> overlapread2# ∈ {1} repeated %8 -diff tests/value/oracle/array_access.res.oracle tests/value/oracle_legacy/array_access.res.oracle -154c154,157 -< R ∈ {16777472; 16777473} ---- -> R[bits 0 to 7] ∈ {0; 1} -> [bits 8 to 15] ∈ {1} -> [bits 16 to 23] ∈ {0} -> [bits 24 to 31] ∈ {1} -diff tests/value/oracle/array_bounds.0.res.oracle tests/value/oracle_legacy/array_bounds.0.res.oracle -41c41,42 -< [value] Called Frama_C_show_each([0..11]) ---- -> [value] Called Frama_C_show_each([0..12]) -> tests/value/array_bounds.i:16:[value] warning: accessing out of bounds index. assert i < 12; -diff tests/value/oracle/array_bounds.1.res.oracle tests/value/oracle_legacy/array_bounds.1.res.oracle -41c41,45 -< [value] Called Frama_C_show_each([0..11]) ---- -> [value] Called Frama_C_show_each([0..12]) -> tests/value/array_bounds.i:14:[value] warning: signed overflow. assert i + 5 ≤ 2147483647; -> [value] Called Frama_C_show_each([0..2147483647]) -> tests/value/array_bounds.i:16:[value] warning: out of bounds write. assert \valid(&u.T[i]); -> tests/value/array_bounds.i:14:[value] warning: signed overflow. assert i + 1 ≤ 2147483647; -43a48,49 -> tests/value/array_bounds.i:20:[value] warning: out of bounds write. assert \valid(&s.T[j]); -> tests/value/array_bounds.i:19:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -51,52c57 -< .T[0..11] ∈ [--..--] -< .b ∈ {20} ---- -> {.T[0..11]; .b} ∈ [--..--] -62c67 -< .T[0..11] FROM c (and SELF) ---- -> {.T[0..11]; .b} FROM c (and SELF) -65c70 -< s; u{.a; .T[0..11]}; i; j ---- -> s; u; i; j -diff tests/value/oracle/assigns.res.oracle tests/value/oracle_legacy/assigns.res.oracle -76a77 -> tests/value/assigns.i:57:[value] warning: locals escaping the scope of main1 through x -369c370 -< x ∈ {{ ANYTHING }} ---- -> x ∈ {{ ANYTHING }} or ESCAPINGADDR -diff tests/value/oracle/backward_add_ptr.res.oracle tests/value/oracle_legacy/backward_add_ptr.res.oracle -11c11,13 -< [value] Called Frama_C_show_each_only_a({0; 1}, {{ &a }}, {0}) ---- -> [value] Called Frama_C_show_each_only_a({0; 1}, -> {{ NULL + [0..4294967295] ; &a }}, -> {{ NULL + [0..4294967295] ; &b }}) -13,15c15,17 -< [value] Called Frama_C_show_each_reduced_offset({0; 1}, -< {{ NULL + {0; 1; 2; 3} ; &a }}, -< {{ NULL + {0; 1; 2; 3} ; &b }}) ---- -> [value] Called Frama_C_show_each_reduced_offset([-128..127], -> {{ NULL + [0..4294967295] ; &a }}, -> {{ NULL + [0..4294967295] ; &b }}) -26,27c28,31 -< [value] Called Frama_C_show_each_int_if({{ &a }}, {0}) -< [value] Called Frama_C_show_each_int_else({0}, {{ &b }}) ---- -> [value] Called Frama_C_show_each_int_if({{ NULL + [0..4294967295] ; &a }}, -> {{ NULL + [0..4294967295] ; &b }}) -> [value] Called Frama_C_show_each_int_else({{ NULL + [0..4294967295] ; &a }}, -> {{ NULL + [0..4294967295] ; &b }}) -29,31c33,36 -< [value] Called Frama_C_show_each_char_if({{ NULL + {1; 2; 3} ; &a }}, -< {{ NULL + {0; 1; 2; 3} ; &b }}) -< [value] Called Frama_C_show_each_char_else({0}, {{ &b }}) ---- -> [value] Called Frama_C_show_each_char_if({{ NULL + [0..4294967295] ; &a }}, -> {{ NULL + [0..4294967295] ; &b }}) -> [value] Called Frama_C_show_each_char_else({{ NULL + [0..4294967295] ; &a }}, -> {{ NULL + [0..4294967295] ; &b }}) -41,43d45 -< tests/value/backward_add_ptr.c:68:[value] Assigning imprecise value to \result<gm>. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -46,48d47 -< tests/value/backward_add_ptr.c:75:[value] Assigning imprecise value to p. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -50,51c49,55 -< [value] Called Frama_C_show_each_GM_only_a({{ &a + [-17179869180..0],0%4 }}, -< [0..4294967295]) ---- -> tests/value/backward_add_ptr.c:82:[value] Reading left-value p. -> It contains a garbled mix of {a} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -> [value] Called Frama_C_show_each_GM_only_a({{ garbled mix of &{a} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}, -> {{ NULL + [0..4294967295] ; &b }}) -53,54c57,62 -< [value] Called Frama_C_show_each_GM_reduce_p_offset({{ NULL + {0; 1; 2; 3} ; -< &a + [-4294967295..3] }}, ---- -> tests/value/backward_add_ptr.c:88:[value] Reading left-value p. -> It contains a garbled mix of {a} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -> [value] Called Frama_C_show_each_GM_reduce_p_offset({{ garbled mix of &{a} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}, -60,62d67 -< tests/value/backward_add_ptr.c:91:[value] Assigning imprecise value to p. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -63a69,75 -> tests/value/backward_add_ptr.c:97:[value] Reading left-value p. -> It contains a garbled mix of {a} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -> [value] Called Frama_C_show_each_GM_BOTTOM({{ garbled mix of &{a} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}, -> {{ &b }}) -68,70d79 -< tests/value/backward_add_ptr.c:100:[value] Assigning imprecise value to p. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -83,85d91 -< tests/value/backward_add_ptr.c:110:[value] Assigning imprecise value to p. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -87c93,99 -< [value] Called Frama_C_show_each_GM_only_c({0}, {{ &c }}) ---- -> tests/value/backward_add_ptr.c:116:[value] Reading left-value p. -> It contains a garbled mix of {a; b} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -> [value] Called Frama_C_show_each_GM_only_c({{ garbled mix of &{a; b} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}, -> {{ NULL + [0..4294967295] ; &c }}) -89,90c101,107 -< [value] Called Frama_C_show_each_GM_only_b({{ &b + [-17179869180..0],0%4 }}, -< [0..4294967295]) ---- -> tests/value/backward_add_ptr.c:122:[value] Reading left-value p. -> It contains a garbled mix of {a; b} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -> [value] Called Frama_C_show_each_GM_only_b({{ garbled mix of &{a; b} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}, -> {{ NULL + [0..4294967295] ; &c }}) -95,97d111 -< tests/value/backward_add_ptr.c:125:[value] Assigning imprecise value to p. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -98a113,119 -> tests/value/backward_add_ptr.c:131:[value] Reading left-value p. -> It contains a garbled mix of {a; b} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -> [value] Called Frama_C_show_each_GM_BOTTOM({{ garbled mix of &{a; b} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}, -> {{ NULL + [0..4294967295] ; &b }}) -101c122 -< It contains a garbled mix of {b} because of Arithmetic ---- -> It contains a garbled mix of {a; b} because of Arithmetic -103c124 -< [value] Called Frama_C_show_each_GM_only_b_and_gm({{ garbled mix of &{b} ---- -> [value] Called Frama_C_show_each_GM_only_b_and_gm({{ garbled mix of &{a; b} -115,117d135 -< tests/value/backward_add_ptr.c:145:[value] Assigning imprecise value to tmp_0. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -125,127d142 -< tests/value/backward_add_ptr.c:146:[value] Assigning imprecise value to q. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -141a157,159 -> tests/value/backward_add_ptr.c:157:[value] Reading left-value q. -> It contains a garbled mix of {c} because of Arithmetic -> {tests/value/backward_add_ptr.c:68}. -143c161 -< It contains a garbled mix of {b} because of Arithmetic ---- -> It contains a garbled mix of {a; b} because of Arithmetic -145c163 -< [value] Called Frama_C_show_each_2GM_only_b({{ garbled mix of &{b} ---- -> [value] Called Frama_C_show_each_2GM_only_b({{ garbled mix of &{a; b} -148c166,168 -< [0..4294967295]) ---- -> {{ garbled mix of &{c} -> (origin: Arithmetic -> {tests/value/backward_add_ptr.c:68}) }}) -153,155d172 -< tests/value/backward_add_ptr.c:160:[value] Assigning imprecise value to p. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -160,162d176 -< tests/value/backward_add_ptr.c:161:[value] Assigning imprecise value to q. -< The imprecision originates from Arithmetic -< {tests/value/backward_add_ptr.c:68} -165c179 -< It contains a garbled mix of {b} because of Arithmetic ---- -> It contains a garbled mix of {b; c} because of Arithmetic -168c182 -< It contains a garbled mix of {b} because of Arithmetic ---- -> It contains a garbled mix of {a; b} because of Arithmetic -170c184 -< [value] Called Frama_C_show_each_2GM_TEST({{ garbled mix of &{b} ---- -> [value] Called Frama_C_show_each_2GM_TEST({{ garbled mix of &{a; b} -173c187 -< {{ garbled mix of &{b} ---- -> {{ garbled mix of &{b; c} -178c192 -< It contains a garbled mix of {b} because of Arithmetic ---- -> It contains a garbled mix of {b; c} because of Arithmetic -186c200 -< {{ garbled mix of &{b} ---- -> {{ garbled mix of &{b; c} -194c208 -< It contains a garbled mix of {b} because of Arithmetic ---- -> It contains a garbled mix of {a; b} because of Arithmetic -196c210 -< [value] Called Frama_C_show_each_2GM_gm_of_b_c({{ garbled mix of &{b} ---- -> [value] Called Frama_C_show_each_2GM_gm_of_b_c({{ garbled mix of &{a; b} -241,242d254 -< {{ garbled mix of &{a; b} -< (origin: Arithmetic {tests/value/backward_add_ptr.c:115}) }} -263,264c275,276 -< p ∈ {{ NULL + [0..4294967295] ; &a }} -< q ∈ {{ NULL + [0..4294967295] ; &b }} ---- -> p ∈ {{ NULL + [--..--] ; &a }} -> q ∈ {{ NULL + [--..--] ; &b }} -266c278 -< w ∈ {0; 1} or UNINITIALIZED ---- -> w ∈ [--..--] or UNINITIALIZED -269,272c281,283 -< b[bits 0 to 7] ∈ {1} -< [bits 8 to 31]# ∈ {1}%32, bits 8 to 31 -< p ∈ {{ NULL + [0..4294967295] ; &a }} -< q ∈ {{ NULL + [0..4294967295] ; &b }} ---- -> b ∈ {1} -> p ∈ {{ NULL + [--..--] ; &a }} -> q ∈ {{ NULL + [--..--] ; &b }} -275,278c286,287 -< b[bits 0 to 7] ∈ {1} -< [bits 8 to 31]# ∈ {1}%32, bits 8 to 31 -< c[bits 0 to 7] ∈ {2} -< [bits 8 to 31]# ∈ {2}%32, bits 8 to 31 ---- -> b ∈ {1} -> c ∈ {2} -284c293 -< w ∈ {0; 1} or UNINITIALIZED ---- -> w ∈ [--..--] or UNINITIALIZED -287,290c296,297 -< b[bits 0 to 7] ∈ {1} -< [bits 8 to 31]# ∈ {1}%32, bits 8 to 31 -< c[bits 0 to 7] ∈ {2} -< [bits 8 to 31]# ∈ {2}%32, bits 8 to 31 ---- -> b ∈ {1} -> c ∈ {2} -diff tests/value/oracle/behaviors1.res.oracle tests/value/oracle_legacy/behaviors1.res.oracle -247,249d246 -< tests/value/behaviors1.i:473:[value] Assigning imprecise value to tmp. -< The imprecision originates from Library function -< {tests/value/behaviors1.i:473} -256,258d252 -< tests/value/behaviors1.i:474:[value] Assigning imprecise value to tmp_0. -< The imprecision originates from Library function -< {tests/value/behaviors1.i:474} -459c453 -< a ∈ [--..--] or UNINITIALIZED ---- -> a ∈ [--..--] -462c456 -< a ∈ [--..--] ---- -> a ∈ [--..--] or UNINITIALIZED -diff tests/value/oracle/bitfield.res.oracle tests/value/oracle_legacy/bitfield.res.oracle -82a83 -> tests/value/bitfield.i:135:[value] warning: locals {v} escaping the scope of main_old through h -85d85 -< tests/value/bitfield.i:150:[value] warning: locals {v} escaping the scope of main_old through h -110a111,113 -> tests/value/bitfield.i:70:[value] Reading left-value c. -> It contains a garbled mix of {b; ee} because of Misaligned -> {tests/value/bitfield.i:70}. -154c157 -< .b ∈ {8} ---- -> .b ∈ {-8} -225c228 -< .b ∈ {8} ---- -> .b ∈ {-8} -250c253 -< .b ∈ {8} ---- -> .b ∈ {-8} -diff tests/value/oracle/bitwise_pointer.res.oracle tests/value/oracle_legacy/bitwise_pointer.res.oracle -43,53c43 -< t[0] ∈ {0; 5} -< [1] ∈ {1; 5} -< [2] ∈ {2; 5} -< [3] ∈ {3; 5} -< [4] ∈ {4; 5} -< [5] ∈ {5} -< [6] ∈ {5; 6} -< [7] ∈ {5; 7} -< [8] ∈ {5; 8} -< [9] ∈ {5; 9} -< [10..99] ∈ {0; 5} ---- -> t[0..99] ∈ [--..--] -55,66c45,46 -< x ∈ [0..9] -< t1[0] ∈ {0; 5} -< [1] ∈ {1; 5} -< [2] ∈ {2; 5} -< [3] ∈ {3; 5} -< [4] ∈ {4; 5} -< [5] ∈ {5} -< [6] ∈ {5; 6} -< [7] ∈ {5; 7} -< [8] ∈ {5; 8} -< [9] ∈ {5; 9} -< [10..99] ∈ {0; 5} ---- -> x ∈ [-128..127] -> t1[0..99] ∈ [--..--] -68c48 -< x1 ∈ [0..9] ---- -> x1 ∈ [-128..127] -diff tests/value/oracle/bitwise_reduction.res.oracle tests/value/oracle_legacy/bitwise_reduction.res.oracle -14c14,15 -< [value] Called Frama_C_show_each_then1({1}, {0; 1}) ---- -> [value] Called Frama_C_show_each_then1({1}, -> {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000}) -22c23,24 -< [value] Called Frama_C_show_each_then2({{ &t + {4} }}, {0; 1}) ---- -> [value] Called Frama_C_show_each_then2({{ &t + {4} }}, -> {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000}) -diff tests/value/oracle/bts0506.0.res.oracle tests/value/oracle_legacy/bts0506.0.res.oracle -113,120c113,117 -< r13 ∈ -< {{ NULL + [0..4294967295] ; &alloced_return_f6 + [0..2147483644],0%4 }} -< r14 ∈ -< {{ NULL + [0..4294967295] ; &alloced_return_f6 + [0..2147483644],0%4 }} -< r15 ∈ -< {{ NULL + [0..4294967295] ; &alloced_return_f6 + [0..2147483644],0%4 }} -< r16 ∈ {{ NULL + [0..4294967295] ; &alloced_return_f7 + [0..2147483647] }} -< r17 ∈ {{ NULL + [0..4294967295] ; &alloced_return_f7 + [0..2147483647] }} ---- -> r13 ∈ {{ NULL + [--..--] ; &alloced_return_f6 + [0..2147483644],0%4 }} -> r14 ∈ {{ NULL + [--..--] ; &alloced_return_f6 + [0..2147483644],0%4 }} -> r15 ∈ {{ NULL + [--..--] ; &alloced_return_f6 + [0..2147483644],0%4 }} -> r16 ∈ {{ NULL + [--..--] ; &alloced_return_f7 + [0..2147483647] }} -> r17 ∈ {{ NULL + [--..--] ; &alloced_return_f7 + [0..2147483647] }} -diff tests/value/oracle/bts0506.1.res.oracle tests/value/oracle_legacy/bts0506.1.res.oracle -54a55 -> tests/value/bts0506.i:28:[kernel] warning: non-finite float value being returned: assert(\is_finite(\returned_value)) -104c105 -< r10 ∈ [--..--] ---- -> r10 ∈ [-3.40282346639e+38 .. 3.40282346639e+38] -diff tests/value/oracle/call_2.res.oracle tests/value/oracle_legacy/call_2.res.oracle -9d8 -< tests/value/call_2.i:15:[value] warning: non-finite float value. assert \is_finite(f); -13a13 -> tests/value/call_2.i:6:[value] warning: non-finite float value. assert \is_finite(f); -25c25 -< f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] ---- -> f ∈ [--..--] -diff tests/value/oracle/cast_fun.res.oracle tests/value/oracle_legacy/cast_fun.res.oracle -13c13,14 -< tests/value/cast_fun.i:63:[value] warning: pointer to function with incompatible type. assert \valid_function(p1); ---- -> tests/value/cast_fun.i:63:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(p1); -24,25c25,28 -< tests/value/cast_fun.i:73:[value] warning: pointer to function with incompatible type. assert \valid_function(p1); -< tests/value/cast_fun.i:78:[value] warning: pointer to function with incompatible type. assert \valid_function(p1); ---- -> tests/value/cast_fun.i:73:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p1); -> tests/value/cast_fun.i:78:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p1); -34c37,38 -< tests/value/cast_fun.i:93:[value] warning: pointer to function with incompatible type. assert \valid_function(p2); ---- -> tests/value/cast_fun.i:93:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p2); -39,40d42 -< tests/value/cast_fun.i:103:[value] warning: pointer to function with incompatible type. assert \valid_function(p3); -< tests/value/cast_fun.i:108:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); -42c44 -< Called from tests/value/cast_fun.i:113. ---- -> Called from tests/value/cast_fun.i:103. -45,47c47,58 -< tests/value/cast_fun.i:118:[value] warning: pointer to function with incompatible type. assert \valid_function(p1); -< tests/value/cast_fun.i:123:[value] warning: pointer to function with incompatible type. assert \valid_function(p1); -< tests/value/cast_fun.i:128:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); ---- -> [value] computing for function f9 <- main. -> Called from tests/value/cast_fun.i:108. -> [value] Done for function f9 -> [value] computing for function f10 <- main. -> Called from tests/value/cast_fun.i:113. -> [value] Done for function f10 -> tests/value/cast_fun.i:118:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p1); -> tests/value/cast_fun.i:123:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p1); -> tests/value/cast_fun.i:128:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p4); -52c63 -< tests/value/cast_fun.i:98:[from] warning: variadic call detected. Using only 1 argument(s). ---- -> tests/value/cast_fun.i:103:[from] warning: variadic call detected. Using only 0 argument(s). -59,60d69 -< tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. -< tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. -68,69c77,78 -< p3 ∈ {{ &f9 }} or UNINITIALIZED -< p4 ∈ {{ &f10 }} or UNINITIALIZED ---- -> p3 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -> p4 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -119a129,132 -> [from] call to f10 at tests/value/cast_fun.i:103 (by main): -> NO EFFECTS -> [from] call to f9 at tests/value/cast_fun.i:108 (by main): -> NO EFFECTS -126c139,140 -< p1; p2; p3; p4; x; s ---- -> p1; p2; p3; p4; x; s; __va_arg0; __va_args[0]; __va_arg0_11; -> __va_args_13[0] -diff tests/value/oracle/cast_return.0.res.oracle tests/value/oracle_legacy/cast_return.0.res.oracle -25d24 -< tests/value/cast_return.c:31:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -diff tests/value/oracle/cmp_ptr.0.res.oracle tests/value/oracle_legacy/cmp_ptr.0.res.oracle -37d36 -< tests/value/cmp_ptr.i:21:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -41,42d39 -< tests/value/cmp_ptr.i:22:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -< tests/value/cmp_ptr.i:22:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -44d40 -< tests/value/cmp_ptr.i:24:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -47d42 -< tests/value/cmp_ptr.i:28:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -56d50 -< tests/value/cmp_ptr.i:30:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -59d52 -< tests/value/cmp_ptr.i:32:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -diff tests/value/oracle/cmp_ptr.1.res.oracle tests/value/oracle_legacy/cmp_ptr.1.res.oracle -37,40d36 -< tests/value/cmp_ptr.i:21:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr.i:21:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0; 1} because of UPCPA -< tests/value/cmp_ptr.i:21:[value:pointer-comparison] not reducing {{ &T + [-8589934588..8589934592],0%4 }} to {{ &T + -< [-8589934588..16],0%4 }} because of UPCPA -42,43d37 -< tests/value/cmp_ptr.i:21:[value:pointer-comparison] not reducing {{ &T + [-8589934588..8589934592],0%4 }} to {{ &T + -< [20..8589934592],0%4 }} because of UPCPA -46,49d39 -< tests/value/cmp_ptr.i:22:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -< tests/value/cmp_ptr.i:22:[value:pointer-comparison] evaluating operator ! to {0; 1} instead of {0} because of UPCPA -< tests/value/cmp_ptr.i:22:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr.i:22:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -51,52d40 -< tests/value/cmp_ptr.i:24:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -< tests/value/cmp_ptr.i:24:[value:pointer-comparison] evaluating operator ! to {0; 1} instead of {0; 1} because of UPCPA -55,56d42 -< tests/value/cmp_ptr.i:28:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr.i:28:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -65,66d50 -< tests/value/cmp_ptr.i:30:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr.i:30:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -69,70d52 -< tests/value/cmp_ptr.i:32:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr.i:32:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -73d54 -< tests/value/cmp_ptr.i:32:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -diff tests/value/oracle/cmp_ptr_follow_all_branches.0.res.oracle tests/value/oracle_legacy/cmp_ptr_follow_all_branches.0.res.oracle -10d9 -< tests/value/cmp_ptr_follow_all_branches.i:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -15d13 -< tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -diff tests/value/oracle/cmp_ptr_follow_all_branches.1.res.oracle tests/value/oracle_legacy/cmp_ptr_follow_all_branches.1.res.oracle -10,11d9 -< tests/value/cmp_ptr_follow_all_branches.i:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr_follow_all_branches.i:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -15d12 -< tests/value/cmp_ptr_follow_all_branches.i:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -18,19d14 -< tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -23d17 -< tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -diff tests/value/oracle/context_free.res.oracle tests/value/oracle_legacy/context_free.res.oracle -91c91 -< (pointing to S_qvoid with offsets [0..34359738360],0%8). ---- -> (pointing to S_qvoid with offsets [0..34359738360]). -93c93,95 -< tests/value/context_free.i:62:[value] warning: pointer to function with incompatible type. assert \valid_function(g); ---- -> tests/value/context_free.i:62:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(g); -> tests/value/context_free.i:64:[value] warning: locals {pvoid} escaping the scope of f through S_qvoid -diff tests/value/oracle/conversion.res.oracle tests/value/oracle_legacy/conversion.res.oracle -48d47 -< tests/value/conversion.i:39:[value] warning: non-finite float value. assert \is_finite(*((float *)(&x))); -65a65 -> tests/value/conversion.i:52:[value] warning: accessing uninitialized left-value. assert \initialized((float *)(&l)); -71,72c71,72 -< f ∈ [7.00649232162e-45 .. 2.10194769649e-44] or UNINITIALIZED -< l ∈ [5..15] or UNINITIALIZED ---- -> f ∈ [7.00649232162e-45 .. 2.10194769649e-44] -> l ∈ [5..15] -81,82c81,82 -< f ∈ [7.00649232162e-45 .. 2.10194769649e-44] or UNINITIALIZED -< l ∈ [5..15] or UNINITIALIZED ---- -> f ∈ [7.00649232162e-45 .. 2.10194769649e-44] -> l ∈ [5..15] -126c126 -< y ∈ [--..--] ---- -> y ∈ [-10..10] -133c133 -< y ∈ [--..--] ---- -> y ∈ [-10..10] -137,139d136 -< tests/value/conversion.i:39:[value] warning: non-finite float value. assert \is_finite(*((float *)(&x))); -< tests/value/conversion.i:39:[value] Assigning imprecise value to f. -< The imprecision originates from Arithmetic {tests/value/conversion.i:39} -143,145c140,141 -< y ∈ [--..--] -< f ∈ -< {{ garbled mix of &{x} (origin: Arithmetic {tests/value/conversion.i:39}) }} ---- -> y ∈ [-10..10] -> f ∈ {{ (float)&x }} -152,153c148,150 -< y ∈ [--..--] -< f ∈ {1.83672393614e-40} ---- -> y ∈ [-10..10] -> f[bits 0 to 15] ∈ {1} -> [bits 16 to 31] ∈ {2} -161c158 -< y ∈ [--..--] ---- -> y ∈ [-10..10] -163c160 -< l ∈ [7.00649232162e-45 .. 2.10194769649e-44] ---- -> l ∈ [5..15] -171c168 -< y ∈ [--..--] ---- -> y ∈ [-10..10] -173c170 -< l ∈ [7.00649232162e-45 .. 2.10194769649e-44] ---- -> l ∈ [5..15] -diff tests/value/oracle/copy_stdin.res.oracle tests/value/oracle_legacy/copy_stdin.res.oracle -19,21c19 -< toto ∈ -< {{ NULL + [0..4294967295] ; -< &alloced_return_leaf + [0..2147483644],0%4 }} ---- -> toto ∈ {{ NULL + [--..--] ; &alloced_return_leaf + [0..2147483644],0%4 }} -diff tests/value/oracle/degeneration2.res.oracle tests/value/oracle_legacy/degeneration2.res.oracle -15a16,18 -> tests/value/degeneration2.i:17:[value] Assigning imprecise value to A. -> The imprecision originates from Misaligned {tests/value/degeneration2.i:17} -> tests/value/degeneration2.i:25:[value] warning: accessing out of bounds index. assert x < 10; -24c27 -< (origin: Arithmetic {tests/value/degeneration2.i:14}) }} ---- -> (origin: Misaligned {tests/value/degeneration2.i:17}) }} -diff tests/value/oracle/deps_addr.res.oracle tests/value/oracle_legacy/deps_addr.res.oracle -15c15 -< NON TERMINATING FUNCTION ---- -> __retres ∈ {0} -17d16 -< [from] Non-terminating function main (no dependencies) -22c21 -< NON TERMINATING - NO EFFECTS ---- -> \result FROM t; a -27c26 -< t ---- -> t; a -diff tests/value/oracle/deps_mixed.res.oracle tests/value/oracle_legacy/deps_mixed.res.oracle -19,22d18 -< [value] computing for function g <- main. -< Called from tests/value/deps_mixed.i:22. -< [value] Recording results for g -< [value] Done for function g -26a23,26 -> [value] computing for function g <- main. -> Called from tests/value/deps_mixed.i:22. -> [value] Recording results for g -> [value] Done for function g -29,30d28 -< tests/value/deps_mixed.i:24:[value] Assigning imprecise value to \result<main>. -< The imprecision originates from Arithmetic {tests/value/deps_mixed.i:24} -41c39 -< r ∈ {2} ---- -> r ∈ {0; 2} -61c59 -< r FROM v; c; d (and SELF) ---- -> r FROM a; b; v; c; d (and SELF) -76c74 -< p; q; v; t[0..1] ---- -> p; q; a; b; v; t[0..1] -diff tests/value/oracle/div.0.res.oracle tests/value/oracle_legacy/div.0.res.oracle -39d38 -< tests/value/div.i:34:[value] warning: division by zero. assert (int)(&X + 2) ≢ 0; -40a40 -> tests/value/div.i:34:[value] warning: division by zero. assert (int)(&X + 2) ≢ 0; -diff tests/value/oracle/div.1.res.oracle tests/value/oracle_legacy/div.1.res.oracle -53d52 -< tests/value/div.i:34:[value] warning: division by zero. assert (int)(&X + 2) ≢ 0; -54a54 -> tests/value/div.i:34:[value] warning: division by zero. assert (int)(&X + 2) ≢ 0; -diff tests/value/oracle/divneg.res.oracle tests/value/oracle_legacy/divneg.res.oracle -26c26 -< r2 ∈ [-98..-3],2%5 ---- -> r2 ∈ [-100..100] -38c38 -< rc ∈ [-176..-14],4%18 or UNINITIALIZED ---- -> rc ∈ [-185..-5],4%9 or UNINITIALIZED -48c48 -< r2 ∈ [-98..-3],2%5 ---- -> r2 ∈ [-100..100] -diff tests/value/oracle/downcast.res.oracle tests/value/oracle_legacy/downcast.res.oracle -19,21d18 -< tests/value/downcast.i:19:[value] warning: signed downcast. assert -128 ≤ (int)sx + (int)sy; -< tests/value/downcast.i:19:[value] warning: signed downcast. assert (int)sx + (int)sy ≤ 127; -< tests/value/downcast.i:22:[value] warning: signed downcast. assert uy + uz ≤ 2147483647; -26d22 -< tests/value/downcast.i:32:[value] warning: signed downcast. assert i ≤ 15; -31,32d26 -< tests/value/downcast.i:38:[value] warning: signed downcast. assert -128 ≤ x_0; -< tests/value/downcast.i:38:[value] warning: signed downcast. assert x_0 ≤ 127; -37d30 -< tests/value/downcast.i:48:[value] warning: signed downcast. assert p ≤ 2147483647; -44d36 -< tests/value/downcast.i:58:[value] warning: signed downcast. assert y ≤ 2147483647; -46,48c38,40 -< [100145..2147483647], -< [100145..2147483647]) -< tests/value/downcast.i:60:[value] assertion got status valid. ---- -> [100145..2147483792], -> [-2147483648..2147483647]) -> tests/value/downcast.i:60:[value] warning: assertion got status unknown. -53,55d44 -< tests/value/downcast.i:67:[value] warning: signed downcast. assert 65300u ≤ 32767; -< tests/value/downcast.i:78:[value] warning: signed downcast. assert e_0 ≤ 32767; -< tests/value/downcast.i:83:[value] warning: signed downcast. assert e_1 ≤ 32767; -64,68d52 -< tests/value/downcast.i:104:[value] warning: signed downcast. assert S.i1 ≤ 31; -< tests/value/downcast.i:105:[value] warning: signed downcast. assert S.i1 ≤ 127; -< tests/value/downcast.i:109:[value] warning: signed downcast. assert S.i1 ≤ 31; -< tests/value/downcast.i:110:[value] warning: signed downcast. assert S.i1 ≤ 127; -< tests/value/downcast.i:114:[value] warning: signed downcast. assert S.i1 ≤ 31; -73,74c57 -< tests/value/downcast.i:123:[value] warning: signed downcast. assert bf.a ≤ 1023; -< tests/value/downcast.i:127:[value] warning: signed downcast. assert bf.a ≤ 127; ---- -> tests/value/downcast.i:124:[value] assertion got status valid. -80d62 -< tests/value/downcast.i:137:[value] warning: signed downcast. assert bf.b ≤ 127; -85,95d66 -< tests/value/downcast.i:32:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:67:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:78:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:83:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:104:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:105:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:109:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:110:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:114:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:123:[value] assertion 'Value,signed_downcast' got final status invalid. -< tests/value/downcast.i:127:[value] assertion 'Value,signed_downcast' got final status invalid. -100c71 -< x ∈ [0..2147483647] ---- -> x ∈ [--..--] -104c75 -< c ∈ [0..127] or UNINITIALIZED ---- -> c ∈ [--..--] or UNINITIALIZED -111c82 -< ss.i ∈ UNINITIALIZED ---- -> ss.i ∈ {-11} or UNINITIALIZED -115c86 -< x_0 ∈ [-128..127] ---- -> x_0 ∈ [--..--] -125,126c96,97 -< y ∈ [100145..2147483647] -< z ∈ [100145..2147483647] ---- -> y ∈ [100145..2147483792] -> z ∈ [--..--] -134,135c105,107 -< {.i2; .[bits 24 to 31]} ∈ UNINITIALIZED -< c ∈ {65} or UNINITIALIZED ---- -> .i2 ∈ {-1; 1} or UNINITIALIZED -> .[bits 24 to 31] ∈ UNINITIALIZED -> c ∈ {-1; 1; 65} or UNINITIALIZED -139c111 -< c ∈ UNINITIALIZED ---- -> c ∈ {112} or UNINITIALIZED -143c115 -< x ∈ [0..2147483647] ---- -> x ∈ [--..--] -248,282d219 -< --- Properties of Function 'main1' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 19) -< tried with Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 19) -< tried with Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 22) -< tried with Value. -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main2_bitfield' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 32) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 32) -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main3_reduction' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 38) -< tried with Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 38) -< tried with Value. -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main4_pointer' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 48) -< tried with Value. -< -< -------------------------------------------------------------------------------- -290,292c227 -< [ Valid ] Assertion (file tests/value/downcast.i, line 60) -< by Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 58) ---- -> [ - ] Assertion (file tests/value/downcast.i, line 60) -296,329d230 -< --- Properties of Function 'main6_val_warn_converted_signed' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 67) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 67) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 78) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 78) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 83) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 83) -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main8_bitfields' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 104) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 104) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 105) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 105) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 109) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 109) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 110) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 110) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 114) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 114) -< -< -------------------------------------------------------------------------------- -333,343c234 -< [ Dead ] Assertion (file tests/value/downcast.i, line 124) -< Locally valid, but unreachable. -< By Value because: -< - Unreachable program point (file tests/value/downcast.i, line 124) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 123) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 123) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 127) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 127) -< [Unreachable] Unreachable program point (file tests/value/downcast.i, line 124) ---- -> [ Valid ] Assertion (file tests/value/downcast.i, line 124) -347,353d237 -< --- Properties of Function 'main10_loop' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) -< tried with Value. -< -< -------------------------------------------------------------------------------- -357,361c241,242 -< 9 To be validated -< 11 Alarms emitted -< 1 Dead property -< 1 Unreachable -< 24 Total ---- -> 2 To be validated -> 4 Total -390,391d270 -< /*@ assert Value: signed_downcast: -128 ≤ (int)sx + (int)sy; */ -< /*@ assert Value: signed_downcast: (int)sx + (int)sy ≤ 127; */ -395d273 -< /*@ assert Value: signed_downcast: uy + uz ≤ 2147483647; */ -409,411c287 -< if (v) -< /*@ assert Value: signed_downcast: i ≤ 15; */ -< ss.i = (int)i; ---- -> if (v) ss.i = (int)i; -423,424d298 -< /*@ assert Value: signed_downcast: -128 ≤ x_0; */ -< /*@ assert Value: signed_downcast: x_0 ≤ 127; */ -439d312 -< /*@ assert Value: signed_downcast: p ≤ 2147483647; */ -458d330 -< /*@ assert Value: signed_downcast: y ≤ 2147483647; */ -469d340 -< /*@ assert Value: signed_downcast: 65300u ≤ 32767; */ -486d356 -< /*@ assert Value: signed_downcast: e_0 ≤ 32767; */ -493d362 -< /*@ assert Value: signed_downcast: e_1 ≤ 32767; */ -513,518c382,383 -< if (v) -< /*@ assert Value: signed_downcast: S.i1 ≤ 31; */ -< S.i2 = (int)S.i1; -< if (v) -< /*@ assert Value: signed_downcast: S.i1 ≤ 127; */ -< c = (signed char)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -> if (v) c = (signed char)S.i1; -520,525c385,386 -< if (v) -< /*@ assert Value: signed_downcast: S.i1 ≤ 31; */ -< S.i2 = (int)S.i1; -< if (v) -< /*@ assert Value: signed_downcast: S.i1 ≤ 127; */ -< c = (signed char)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -> if (v) c = (signed char)S.i1; -527,529c388 -< if (v) -< /*@ assert Value: signed_downcast: S.i1 ≤ 31; */ -< S.i2 = (int)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -541d399 -< /*@ assert Value: signed_downcast: bf.a ≤ 1023; */ -545,547c403 -< if (v) -< /*@ assert Value: signed_downcast: bf.a ≤ 127; */ -< c = (signed char)bf.a; ---- -> if (v) c = (signed char)bf.a; -559,561c415 -< if (v) -< /*@ assert Value: signed_downcast: bf.b ≤ 127; */ -< c = (signed char)bf.b; ---- -> if (v) c = (signed char)bf.b; -599,602d452 -< tests/value/downcast.i:20:[value] warning: unsigned downcast. assert 0 ≤ (int)sx + (int)sy; -< tests/value/downcast.i:21:[value] warning: unsigned downcast. assert 0 ≤ x; -< tests/value/downcast.i:21:[value] warning: unsigned downcast. assert x ≤ 255; -< tests/value/downcast.i:24:[value] warning: unsigned downcast. assert uy + uz ≤ 65535; -607d456 -< tests/value/downcast.i:33:[value] warning: unsigned downcast. assert j ≤ 31; -612,613d460 -< tests/value/downcast.i:40:[value] warning: unsigned downcast. assert 0 ≤ v; -< tests/value/downcast.i:41:[value] warning: unsigned downcast. assert y ≤ 255; -625d471 -< tests/value/downcast.i:60:[value] warning: assertion got status unknown. -630,631d475 -< tests/value/downcast.i:77:[value] warning: unsigned downcast. assert 0 ≤ -12; -< tests/value/downcast.i:82:[value] warning: unsigned downcast. assert 0 ≤ -64000; -644d487 -< tests/value/downcast.i:124:[value] assertion got status valid. -649,650d491 -< tests/value/downcast.i:136:[value] warning: unsigned downcast. assert 0 ≤ v; -< tests/value/downcast.i:136:[value] warning: unsigned downcast. assert v ≤ 1023; -655,657d495 -< tests/value/downcast.i:33:[value] assertion 'Value,unsigned_downcast' got final status invalid. -< tests/value/downcast.i:77:[value] assertion 'Value,unsigned_downcast' got final status invalid. -< tests/value/downcast.i:82:[value] assertion 'Value,unsigned_downcast' got final status invalid. -674c512,513 -< {.j; .[bits 10 to 31]} ∈ UNINITIALIZED ---- -> .j ∈ {30} or UNINITIALIZED -> .[bits 10 to 31] ∈ UNINITIALIZED -678c517 -< y ∈ [0..255] ---- -> y ∈ [--..--] -788c627 -< s_0; u; e; b; e_0; e_1 ---- -> s_0; u; e; b; e_0; b_0; e_1; b_1 -810,839d648 -< --- Properties of Function 'main1' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 20) -< tried with Value. -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 21) -< tried with Value. -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 21) -< tried with Value. -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 24) -< tried with Value. -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main2_bitfield' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 33) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 33) -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main3_reduction' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 40) -< tried with Value. -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 41) -< tried with Value. -< -< -------------------------------------------------------------------------------- -851,861d659 -< --- Properties of Function 'main6_val_warn_converted_signed' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 77) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 77) -< [ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 82) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 82) -< -< -------------------------------------------------------------------------------- -869,877d666 -< --- Properties of Function 'main10_loop' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 136) -< tried with Value. -< [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 136) -< tried with Value. -< -< -------------------------------------------------------------------------------- -881,883c670,671 -< 10 To be validated -< 3 Alarms emitted -< 15 Total ---- -> 2 To be validated -> 4 Total -913d700 -< /*@ assert Value: unsigned_downcast: 0 ≤ (int)sx + (int)sy; */ -915,916d701 -< /*@ assert Value: unsigned_downcast: 0 ≤ x; */ -< /*@ assert Value: unsigned_downcast: x ≤ 255; */ -920d704 -< /*@ assert Value: unsigned_downcast: uy + uz ≤ 65535; */ -932,936c716,717 -< if (v) -< ss.i = (int)i; -< if (v) -< /*@ assert Value: unsigned_downcast: j ≤ 31; */ -< ss.j = (unsigned int)j; ---- -> if (v) ss.i = (int)i; -> if (v) ss.j = (unsigned int)j; -948d728 -< /*@ assert Value: unsigned_downcast: 0 ≤ v; */ -950d729 -< /*@ assert Value: unsigned_downcast: y ≤ 255; */ -1006d784 -< /*@ assert Value: unsigned_downcast: 0 ≤ -12; */ -1013d790 -< /*@ assert Value: unsigned_downcast: 0 ≤ -64000; */ -1034,1037c811,812 -< if (v) -< S.i2 = (int)S.i1; -< if (v) -< c = (signed char)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -> if (v) c = (signed char)S.i1; -1039,1042c814,815 -< if (v) -< S.i2 = (int)S.i1; -< if (v) -< c = (signed char)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -> if (v) c = (signed char)S.i1; -1044,1045c817 -< if (v) -< S.i2 = (int)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -1060,1061c832 -< if (v) -< c = (signed char)bf.a; ---- -> if (v) c = (signed char)bf.a; -1072,1073d842 -< /*@ assert Value: unsigned_downcast: 0 ≤ v; */ -< /*@ assert Value: unsigned_downcast: v ≤ 1023; */ -1075,1076c844 -< if (v) -< c = (signed char)bf.b; ---- -> if (v) c = (signed char)bf.b; -1114,1115d881 -< tests/value/downcast.i:19:[value] warning: signed downcast. assert -128 ≤ (int)sx + (int)sy; -< tests/value/downcast.i:19:[value] warning: signed downcast. assert (int)sx + (int)sy ≤ 127; -1120d885 -< tests/value/downcast.i:32:[value] warning: signed downcast. assert i ≤ 15; -1125,1126d889 -< tests/value/downcast.i:38:[value] warning: signed downcast. assert -128 ≤ x_0; -< tests/value/downcast.i:38:[value] warning: signed downcast. assert x_0 ≤ 127; -1131d893 -< tests/value/downcast.i:48:[value] warning: signed downcast. assert p ≤ 2147483647; -1143,1144d904 -< tests/value/downcast.i:67:[value] warning: signed downcast. assert (int)65300u ≤ 32767; -< tests/value/downcast.i:83:[value] warning: signed downcast. assert -32768 ≤ (int)e_1; -1153,1155d912 -< tests/value/downcast.i:109:[value] warning: signed downcast. assert (int)S.i1 ≤ 31; -< tests/value/downcast.i:110:[value] warning: signed downcast. assert (int)S.i1 ≤ 127; -< tests/value/downcast.i:114:[value] warning: signed downcast. assert (int)S.i1 ≤ 31; -1160d916 -< tests/value/downcast.i:127:[value] warning: signed downcast. assert -128 ≤ (int)bf.a; -1165,1166d920 -< tests/value/downcast.i:137:[value] warning: signed downcast. assert -128 ≤ (int)bf.b; -< tests/value/downcast.i:137:[value] warning: signed downcast. assert (int)bf.b ≤ 127; -1186c940 -< ss.i ∈ UNINITIALIZED ---- -> ss.i ∈ {-11} or UNINITIALIZED -1190c944 -< x_0 ∈ [-128..127] ---- -> x_0 ∈ [--..--] -1209c963 -< .i2 ∈ {-1} or UNINITIALIZED ---- -> .i2 ∈ {-1; 1} or UNINITIALIZED -1211c965 -< c ∈ {-1; 65} or UNINITIALIZED ---- -> c ∈ {-1; 1; 65} or UNINITIALIZED -1215c969 -< c ∈ UNINITIALIZED ---- -> c ∈ {112} or UNINITIALIZED -1324,1356d1077 -< --- Properties of Function 'main1' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 19) -< tried with Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 19) -< tried with Value. -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main2_bitfield' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 32) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 32) -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main3_reduction' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 38) -< tried with Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 38) -< tried with Value. -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main4_pointer' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 48) -< tried with Value. -< -< -------------------------------------------------------------------------------- -1368,1392d1088 -< --- Properties of Function 'main6_val_warn_converted_signed' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 67) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 67) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 83) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 83) -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main8_bitfields' -< -------------------------------------------------------------------------------- -< -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 109) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 109) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 110) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 110) -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 114) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 114) -< -< -------------------------------------------------------------------------------- -1398,1409d1093 -< [ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 127) -< By Value, with pending: -< - Unreachable instruction (file tests/value/downcast.i, line 127) -< -< -------------------------------------------------------------------------------- -< --- Properties of Function 'main10_loop' -< -------------------------------------------------------------------------------- -< -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) -< tried with Value. -< [ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) -< tried with Value. -1415,1417c1099,1100 -< 9 To be validated -< 7 Alarms emitted -< 18 Total ---- -> 2 To be validated -> 4 Total -1446,1447d1128 -< /*@ assert Value: signed_downcast: -128 ≤ (int)sx + (int)sy; */ -< /*@ assert Value: signed_downcast: (int)sx + (int)sy ≤ 127; */ -1464,1468c1145,1146 -< if (v) -< /*@ assert Value: signed_downcast: i ≤ 15; */ -< ss.i = (int)i; -< if (v) -< ss.j = (unsigned int)j; ---- -> if (v) ss.i = (int)i; -> if (v) ss.j = (unsigned int)j; -1479,1480d1156 -< /*@ assert Value: signed_downcast: -128 ≤ x_0; */ -< /*@ assert Value: signed_downcast: x_0 ≤ 127; */ -1495d1170 -< /*@ assert Value: signed_downcast: p ≤ 2147483647; */ -1524d1198 -< /*@ assert Value: signed_downcast: (int)65300u ≤ 32767; */ -1547d1220 -< /*@ assert Value: signed_downcast: -32768 ≤ (int)e_1; */ -1567,1570c1240,1241 -< if (v) -< S.i2 = (int)S.i1; -< if (v) -< c = (signed char)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -> if (v) c = (signed char)S.i1; -1572,1577c1243,1244 -< if (v) -< /*@ assert Value: signed_downcast: (int)S.i1 ≤ 31; */ -< S.i2 = (int)S.i1; -< if (v) -< /*@ assert Value: signed_downcast: (int)S.i1 ≤ 127; */ -< c = (signed char)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -> if (v) c = (signed char)S.i1; -1579,1581c1246 -< if (v) -< /*@ assert Value: signed_downcast: (int)S.i1 ≤ 31; */ -< S.i2 = (int)S.i1; ---- -> if (v) S.i2 = (int)S.i1; -1596,1598c1261 -< if (v) -< /*@ assert Value: signed_downcast: -128 ≤ (int)bf.a; */ -< c = (signed char)bf.a; ---- -> if (v) c = (signed char)bf.a; -1610,1613c1273 -< if (v) -< /*@ assert Value: signed_downcast: -128 ≤ (int)bf.b; */ -< /*@ assert Value: signed_downcast: (int)bf.b ≤ 127; */ -< c = (signed char)bf.b; ---- -> if (v) c = (signed char)bf.b; -1649,1651d1308 -< [value] Called Frama_C_show_each([100000..2147483502], -< [100145..2147483647], -< [100145..2147483647]) -1654a1312,1315 -> [value] Called Frama_C_show_each([100000..2147483502], -> [100145..2147483647], -> [100145..2147483647]) -> tests/value/downcast.i:60:[value] assertion got status valid. -diff tests/value/oracle/endian.res.oracle tests/value/oracle_legacy/endian.res.oracle -31c31,32 -< G1 ∈ {65532} ---- -> G1[bits 0 to 15] ∈ {65532} -> [bits 16 to 31] ∈ {0} -33c34 -< G3 ∈ {252} ---- -> G3# ∈ {65532}%16, bits 0 to 7 -diff tests/value/oracle/extern.res.oracle tests/value/oracle_legacy/extern.res.oracle -22d21 -< tests/value/extern.i:19:[value] warning: accessing uninitialized left-value. assert \initialized(&T3[3]); -23a23 -> tests/value/extern.i:19:[value] warning: accessing uninitialized left-value. assert \initialized(&T3[3]); -diff tests/value/oracle/fptr.0.res.oracle tests/value/oracle_legacy/fptr.0.res.oracle -24c24 -< tests/value/fptr.i:44:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fptr.i:44:[value] warning: Function pointer and pointed function have completely incompatible types. -26c26 -< tests/value/fptr.i:45:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fptr.i:45:[value] warning: Function pointer and pointed function have completely incompatible types. -42,45d41 -< [value] computing for function hh <- f <- main. -< Called from tests/value/fptr.i:9. -< [value] Recording results for hh -< [value] Done for function hh -49a46,49 -> [value] computing for function hh <- f <- main. -> Called from tests/value/fptr.i:9. -> [value] Recording results for hh -> [value] Done for function hh -56,60c56,57 -< tests/value/fptr.i:9:[value] warning: pointer to function with incompatible type. assert \valid_function(ptr); -< [value] computing for function hh <- f <- main. -< Called from tests/value/fptr.i:9. -< [value] Recording results for hh -< [value] Done for function hh ---- -> tests/value/fptr.i:9:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(ptr); -64a62,65 -> [value] computing for function hh <- f <- main. -> Called from tests/value/fptr.i:9. -> [value] Recording results for hh -> [value] Done for function hh -71,74d71 -< [value] computing for function hh <- f <- main. -< Called from tests/value/fptr.i:9. -< [value] Recording results for hh -< [value] Done for function hh -78a76,79 -> [value] computing for function hh <- f <- main. -> Called from tests/value/fptr.i:9. -> [value] Recording results for hh -> [value] Done for function hh -82,85d82 -< [value] computing for function hh <- main. -< Called from tests/value/fptr.i:56. -< [value] Recording results for hh -< [value] Done for function hh -89a87,90 -> [value] computing for function hh <- main. -> Called from tests/value/fptr.i:56. -> [value] Recording results for hh -> [value] Done for function hh -diff tests/value/oracle/fptr.1.res.oracle tests/value/oracle_legacy/fptr.1.res.oracle -29,32d28 -< [value] computing for function hh <- f <- main_uninit. -< Called from tests/value/fptr.i:9. -< [value] Recording results for hh -< [value] Done for function hh -36a33,36 -> [value] computing for function hh <- f <- main_uninit. -> Called from tests/value/fptr.i:9. -> [value] Recording results for hh -> [value] Done for function hh -42,46c42,43 -< tests/value/fptr.i:9:[value] warning: pointer to function with incompatible type. assert \valid_function(ptr); -< [value] computing for function hh <- f <- main_uninit. -< Called from tests/value/fptr.i:9. -< [value] Recording results for hh -< [value] Done for function hh ---- -> tests/value/fptr.i:9:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(ptr); -50a48,51 -> [value] computing for function hh <- f <- main_uninit. -> Called from tests/value/fptr.i:9. -> [value] Recording results for hh -> [value] Done for function hh -56,59d56 -< [value] computing for function hh <- f <- main_uninit. -< Called from tests/value/fptr.i:9. -< [value] Recording results for hh -< [value] Done for function hh -63a61,64 -> [value] computing for function hh <- f <- main_uninit. -> Called from tests/value/fptr.i:9. -> [value] Recording results for hh -> [value] Done for function hh -82c83,94 -< NON TERMINATING FUNCTION ---- -> R ∈ {1; 2; 77} -> n ∈ {0; 1; 2} -> X ∈ {1; 2; 77} -> XH ∈ {0; 1} -> XHH ∈ {0; 1} -> GLOBAL[0] ∈ {{ &h }} -> [1] ∈ {{ &hh }} -> [2] ∈ [--..--] -> [3..9] ∈ {0} -> G ∈ {0; 1; 2} -> i ∈ {3} -> j ∈ [--..--] -90d101 -< [from] Non-terminating function main_uninit (no dependencies) -110c121,127 -< NON TERMINATING - NO EFFECTS ---- -> R FROM \nothing (and SELF) -> n FROM \nothing (and SELF) -> X FROM \nothing (and SELF) -> XH FROM \nothing (and SELF) -> XHH FROM \nothing (and SELF) -> GLOBAL[0..2] FROM \nothing -> G FROM \nothing (and SELF) -diff tests/value/oracle/fun_ptr.0.res.oracle tests/value/oracle_legacy/fun_ptr.0.res.oracle -15c15 -< tests/value/fun_ptr.i:28:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fun_ptr.i:28:[value] warning: Function pointer and pointed function have incompatible types. -25c25 -< tests/value/fun_ptr.i:33:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fun_ptr.i:33:[value] warning: Function pointer and pointed function have incompatible types. -27,30d26 -< [value] computing for function g <- test2 <- main. -< Called from tests/value/fun_ptr.i:33. -< [value] Recording results for g -< [value] Done for function g -34a31,34 -> [value] computing for function g <- test2 <- main. -> Called from tests/value/fun_ptr.i:33. -> [value] Recording results for g -> [value] Done for function g -39c39 -< tests/value/fun_ptr.i:38:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fun_ptr.i:38:[value] warning: Function pointer and pointed function have completely incompatible types. -51c51,52 -< tests/value/fun_ptr.i:56:[value] warning: pointer to function with incompatible type. assert \valid_function(p); ---- -> tests/value/fun_ptr.i:56:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(p); -60c61,62 -< tests/value/fun_ptr.i:70:[value] warning: pointer to function with incompatible type. assert \valid_function(p); ---- -> tests/value/fun_ptr.i:70:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(p); -65c67,68 -< tests/value/fun_ptr.i:73:[value] warning: pointer to function with incompatible type. assert \valid_function(p); ---- -> tests/value/fun_ptr.i:73:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p); -diff tests/value/oracle/fun_ptr.1.res.oracle tests/value/oracle_legacy/fun_ptr.1.res.oracle -15c15 -< tests/value/fun_ptr.i:28:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fun_ptr.i:28:[value] warning: Function pointer and pointed function have incompatible types. -25c25 -< tests/value/fun_ptr.i:33:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fun_ptr.i:33:[value] warning: Function pointer and pointed function have incompatible types. -27,30d26 -< [value] computing for function g <- test2 <- main. -< Called from tests/value/fun_ptr.i:33. -< [value] Recording results for g -< [value] Done for function g -34a31,34 -> [value] computing for function g <- test2 <- main. -> Called from tests/value/fun_ptr.i:33. -> [value] Recording results for g -> [value] Done for function g -39c39 -< tests/value/fun_ptr.i:38:[value] warning: pointer to function with incompatible type. ---- -> tests/value/fun_ptr.i:38:[value] warning: Function pointer and pointed function have completely incompatible types. -51c51,52 -< tests/value/fun_ptr.i:56:[value] warning: pointer to function with incompatible type. assert \valid_function(p); ---- -> tests/value/fun_ptr.i:56:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(p); -60c61,62 -< tests/value/fun_ptr.i:70:[value] warning: pointer to function with incompatible type. assert \valid_function(p); ---- -> tests/value/fun_ptr.i:70:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(p); -65c67,68 -< tests/value/fun_ptr.i:73:[value] warning: pointer to function with incompatible type. assert \valid_function(p); ---- -> tests/value/fun_ptr.i:73:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(p); -diff tests/value/oracle/function_return_serial_casts.res.oracle tests/value/oracle_legacy/function_return_serial_casts.res.oracle -25c25 -< l ∈ {65526} ---- -> l ∈ {-10} -diff tests/value/oracle/global_bug.res.oracle tests/value/oracle_legacy/global_bug.res.oracle -11a12,14 -> [from] Computing for function main -> [from] Non-terminating function main (no dependencies) -> [from] Done for function main -13a17,18 -> [from] Function main: -> NON TERMINATING - NO EFFECTS -14a20,23 -> [inout] Out (internal) for function main: -> \nothing -> [inout] Inputs for function main: -> \nothing -diff tests/value/oracle/initialized_copy.0.res.oracle tests/value/oracle_legacy/initialized_copy.0.res.oracle -23c23,26 -< c_0 ∈ {67305985} ---- -> c_0[bits 0 to 7] ∈ {1} -> [bits 8 to 15] ∈ {2} -> [bits 16 to 23] ∈ {3} -> [bits 24 to 31] ∈ {4} -25c28,31 -< a_2 ∈ {67305985} ---- -> a_2[bits 0 to 7] ∈ {1} -> [bits 8 to 15] ∈ {2} -> [bits 16 to 23] ∈ {3} -> [bits 24 to 31] ∈ {4} -diff tests/value/oracle/inout_diff.res.oracle tests/value/oracle_legacy/inout_diff.res.oracle -58c58 -< c ∈ {0; 7; 14; 21; 28; 35; 42} ---- -> c ∈ {0; 7; 14; 21; 28; 35; 42; 49} -diff tests/value/oracle/input.res.oracle tests/value/oracle_legacy/input.res.oracle -22d21 -< tests/value/input.i:7:[from] warning: variadic call detected. Using only 1 argument(s). -32c31 -< tmp ---- -> tmp; __va_arg0; __va_args[0] -diff tests/value/oracle/invalid_loc_return.res.oracle tests/value/oracle_legacy/invalid_loc_return.res.oracle -67d66 -< tests/value/invalid_loc_return.i:17:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -diff tests/value/oracle/label.res.oracle tests/value/oracle_legacy/label.res.oracle -15,17d14 -< (pointing to p with offsets {0}). -< The imprecision originates from Misaligned {tests/value/label.i:18} -< tests/value/label.i:18:[value] Assigning imprecise value to *((char *)(& p) + i) -19c16 -< The imprecision originates from Misaligned {tests/value/label.i:18} ---- -> The imprecision originates from Merge {tests/value/label.i:18} -22c19 -< The imprecision originates from Misaligned {tests/value/label.i:18} ---- -> The imprecision originates from Merge {tests/value/label.i:18} -25c22 -< The imprecision originates from Misaligned {tests/value/label.i:18} ---- -> The imprecision originates from Merge {tests/value/label.i:18} -33,34c30 -< p ∈ -< {{ garbled mix of &{a; b} (origin: Misaligned {tests/value/label.i:18}) }} ---- -> p ∈ {{ garbled mix of &{a; b} (origin: Merge {tests/value/label.i:18}) }} -diff tests/value/oracle/lazy.0.res.oracle tests/value/oracle_legacy/lazy.0.res.oracle -14d13 -< tests/value/lazy.i:11:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -16d14 -< tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -18d15 -< tests/value/lazy.i:19:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -31d27 -< tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -diff tests/value/oracle/lazy.1.res.oracle tests/value/oracle_legacy/lazy.1.res.oracle -14,15d13 -< tests/value/lazy.i:11:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/lazy.i:11:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -17,19d14 -< tests/value/lazy.i:11:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -< tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/lazy.i:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -21,23d15 -< tests/value/lazy.i:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -< tests/value/lazy.i:19:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/lazy.i:19:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -25d16 -< tests/value/lazy.i:19:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -38,39d28 -< tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -< tests/value/lazy.i:14:[value:pointer-comparison] evaluating operator ! to {0; 1} instead of {0} because of UPCPA -diff tests/value/oracle/leaf.res.oracle tests/value/oracle_legacy/leaf.res.oracle -41a42 -> tests/value/leaf.i:52:[value] warning: out of bounds write. assert \valid(p); -50c51,52 -< The location is {{ alloced_return_f_int_star_int_star_int -> [0..17179869152],0%32 }}. ---- -> The location is {{ NULL -> [0..34359738360],0%8; -> alloced_return_f_int_star_int_star_int -> [0..17179869152],0%32 }}. -54a57 -> tests/value/leaf.i:57:[value] warning: out of bounds read. assert \valid_read(pp); -57c60,61 -< The location is {{ alloced_return_f_int_star_int_star_int -> [0..34359738336],0%8 }}. ---- -> The location is a garbled mix of {alloced_return_f_int_star_int_star_int} -> because of Library function {tests/value/leaf.i:55}. -70c74,75 -< The location is {{ alloced_return_f_int_star_int_star_int -> [0..34359738336],0%8 }}. ---- -> The location is a garbled mix of {alloced_return_f_int_star_int_star_int} -> because of Library function {tests/value/leaf.i:55}. -100,101d104 -< tests/value/leaf.i:68:[value] Assigning imprecise value to st_star_cint_1. -< The imprecision originates from Library function {tests/value/leaf.i:68} -107,108d109 -< tests/value/leaf.i:69:[value] Assigning imprecise value to st_star_int_1. -< The imprecision originates from Library function {tests/value/leaf.i:69} -diff tests/value/oracle/leaf2.res.oracle tests/value/oracle_legacy/leaf2.res.oracle -15,16d14 -< tests/value/leaf2.i:6:[value] Assigning imprecise value to G. -< The imprecision originates from Library function {tests/value/leaf2.i:6} -diff tests/value/oracle/library.res.oracle tests/value/oracle_legacy/library.res.oracle -81,83c81,86 -< tests/value/library.i:38:[value] warning: pointer to function with incompatible type. assert \valid_function(f); -< tests/value/library.i:39:[value] warning: pointer to function with incompatible type. assert \valid_function(g); -< tests/value/library.i:40:[value] warning: pointer to function with incompatible type. assert \valid_function(h); ---- -> tests/value/library.i:38:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(f); -> tests/value/library.i:39:[value] warning: Function pointer and pointed function have completely incompatible types. -> assert \valid_function(g); -> tests/value/library.i:40:[value] warning: Function pointer and pointed function have incompatible types. -> assert \valid_function(h); -diff tests/value/oracle/local.res.oracle tests/value/oracle_legacy/local.res.oracle -14a15,16 -> tests/value/local.i:7:[value] warning: locals {b} escaping the scope of f through \result -> tests/value/local.i:7:[value] warning: locals {a} escaping the scope of f through X -17,18d18 -< tests/value/local.i:33:[value] warning: locals {a} escaping the scope of f through X -< tests/value/local.i:33:[value] warning: locals {b} escaping the scope of f through \result<f> -25,26d24 -< tests/value/local.i:13:[value] warning: locals {a} escaping the scope of f through X -< tests/value/local.i:13:[value] warning: locals {b} escaping the scope of f through \result<f> -28a27,28 -> tests/value/local.i:15:[value] warning: locals {d} escaping the scope of g through \result -> tests/value/local.i:15:[value] warning: locals {d} escaping the scope of g through U -31,32d30 -< tests/value/local.i:34:[value] warning: locals {d} escaping the scope of g through U -< tests/value/local.i:34:[value] warning: locals {d} escaping the scope of g through \result<g> -diff tests/value/oracle/local_slevel.res.oracle tests/value/oracle_legacy/local_slevel.res.oracle -18,27c18,27 -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3}) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, {0; 1; 2; 3}) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3; 4}) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, {0; 1; 2; 3; 4}) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483647]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483647]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483648]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483648]) -< [value] Called Frama_C_show_each({1}, [1..79],1%2, [0..4294967295]) -< [value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..4294967295]) ---- -> [value] Called Frama_C_show_each({1}, [0..79], {0; 1; 2; 3}) -> [value] Called Frama_C_show_each({-1}, [0..79], {0; 1; 2; 3}) -> [value] Called Frama_C_show_each({1}, [0..79], {0; 1; 2; 3; 4}) -> [value] Called Frama_C_show_each({-1}, [0..79], {0; 1; 2; 3; 4}) -> [value] Called Frama_C_show_each({1}, [0..79], [0..2147483647]) -> [value] Called Frama_C_show_each({-1}, [0..79], [0..2147483647]) -> [value] Called Frama_C_show_each({1}, [0..79], [0..2147483648]) -> [value] Called Frama_C_show_each({-1}, [0..79], [0..2147483648]) -> [value] Called Frama_C_show_each({1}, [0..79], [0..4294967295]) -> [value] Called Frama_C_show_each({-1}, [0..79], [0..4294967295]) -diff tests/value/oracle/max_pointed.res.oracle tests/value/oracle_legacy/max_pointed.res.oracle -14c14 -< min ∈ {11.} ---- -> min ∈ [11. .. 42.] -diff tests/value/oracle/memexec.res.oracle tests/value/oracle_legacy/memexec.res.oracle -53a54 -> tests/value/memexec.c:43:[value] warning: locals {x} escaping the scope of bug through p -56d56 -< tests/value/memexec.c:157:[value] warning: locals {x} escaping the scope of bug through p -diff tests/value/oracle/misaligned_tabs.res.oracle tests/value/oracle_legacy/misaligned_tabs.res.oracle -61c61 -< [1] ∈ {0} ---- -> [1]# ∈ {1; 2}%32, bits 8 to 15 -diff tests/value/oracle/mixed_val.res.oracle tests/value/oracle_legacy/mixed_val.res.oracle -18c18 -< T[0] ∈ {-2999} ---- -> T[0]# ∈ {128073}%32, bits 0 to 15 -diff tests/value/oracle/narrow_behaviors.res.oracle tests/value/oracle_legacy/narrow_behaviors.res.oracle -40,41c40,41 -< nondet ∈ {1} -< r{.x; .y} ∈ {2} ---- -> nondet ∈ {0} -> r{.x; .y} ∈ {1} -46,47c46,47 -< nondet ∈ {0} -< r{.x; .y} ∈ {1} ---- -> nondet ∈ {1} -> r{.x; .y} ∈ {2} -52a53,57 -> tests/value/narrow_behaviors.i:63:[value] function f2, behavior b: assumes got status invalid; behavior not evaluated. -> tests/value/narrow_behaviors.i:63:[value] function f2, behavior c: assumes got status invalid; behavior not evaluated. -> [value] Done for function f2 -> [value] computing for function f2 <- main. -> Called from tests/value/narrow_behaviors.i:63. -59,63d63 -< [value] Done for function f2 -< [value] computing for function f2 <- main. -< Called from tests/value/narrow_behaviors.i:63. -< tests/value/narrow_behaviors.i:63:[value] function f2, behavior b: assumes got status invalid; behavior not evaluated. -< tests/value/narrow_behaviors.i:63:[value] function f2, behavior c: assumes got status invalid; behavior not evaluated. -diff tests/value/oracle/nonlin.res.oracle tests/value/oracle_legacy/nonlin.res.oracle -13,14c13,14 -< tests/value/nonlin.c:18:[value:nonlin] non-linear 'i1 * i1', lv 'i1' -< tests/value/nonlin.c:18:[value:nonlin] non-linear '(i2 + (long long)3) * (i2 + (long long)3)', lv 'i2' ---- -> tests/value/nonlin.c:18:[value:nonlin] non-linear 'i1 * i1 + (i2 + (long long)3) * (i2 + (long long)3)', lv 'i1' -> tests/value/nonlin.c:18:[value:nonlin] non-linear 'i1 * i1 + (i2 + (long long)3) * (i2 + (long long)3)', lv 'i2' -16d15 -< tests/value/nonlin.c:23:[value:nonlin] non-linear '(int)idx * (int)idx', lv 'idx' -28c27 -< r ∈ [-2..2147614724] ---- -> r ∈ [-1073709050..2147614724] -diff tests/value/oracle/origin.0.res.oracle tests/value/oracle_legacy/origin.0.res.oracle -111,112d110 -< tests/value/origin.i:48:[value] Assigning imprecise value to pm1. -< The imprecision originates from Misaligned {tests/value/origin.i:48} -144a143,146 -> tests/value/origin.i:89:[value] warning: locals {arg} escaping the scope of local_escape_1 through esc1 -> tests/value/origin.i:89:[value] warning: locals {local1} escaping the scope of local_escape_1 through esc2 -> tests/value/origin.i:89:[value] warning: locals {arg} escaping the scope of local_escape_1 through esc3 -> tests/value/origin.i:89:[value] warning: locals {local1} escaping the scope of local_escape_1 through esc4 -147,150d148 -< tests/value/origin.i:108:[value] warning: locals {arg} escaping the scope of local_escape_1 through esc1 -< tests/value/origin.i:108:[value] warning: locals {local1} escaping the scope of local_escape_1 through esc2 -< tests/value/origin.i:108:[value] warning: locals {arg} escaping the scope of local_escape_1 through esc3 -< tests/value/origin.i:108:[value] warning: locals {local1} escaping the scope of local_escape_1 through esc4 -diff tests/value/oracle/origin.1.res.oracle tests/value/oracle_legacy/origin.1.res.oracle -67,68d66 -< tests/value/origin.i:131:[value] Assigning imprecise value to \result<origin>. -< The imprecision originates from Misaligned {tests/value/origin.i:126} -diff tests/value/oracle/pointer_comparison.0.res.oracle tests/value/oracle_legacy/pointer_comparison.0.res.oracle -11d10 -< tests/value/pointer_comparison.c:10:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -13d11 -< tests/value/pointer_comparison.c:12:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -15d12 -< tests/value/pointer_comparison.c:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -17d13 -< tests/value/pointer_comparison.c:16:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -20d15 -< tests/value/pointer_comparison.c:18:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -diff tests/value/oracle/pointer_comparison.1.res.oracle tests/value/oracle_legacy/pointer_comparison.1.res.oracle -11,13d10 -< tests/value/pointer_comparison.c:10:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/pointer_comparison.c:10:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -< tests/value/pointer_comparison.c:10:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -16,18d12 -< tests/value/pointer_comparison.c:12:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/pointer_comparison.c:12:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -< tests/value/pointer_comparison.c:12:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -21,23d14 -< tests/value/pointer_comparison.c:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/pointer_comparison.c:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -< tests/value/pointer_comparison.c:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -26,28d16 -< tests/value/pointer_comparison.c:16:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/pointer_comparison.c:16:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -< tests/value/pointer_comparison.c:16:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -32,34d19 -< tests/value/pointer_comparison.c:18:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -< tests/value/pointer_comparison.c:18:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -< tests/value/pointer_comparison.c:18:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -diff tests/value/oracle/postcondition.res.oracle tests/value/oracle_legacy/postcondition.res.oracle -36d35 -< tests/value/postcondition.i:12:[value] warning: function get_index: postcondition got status unknown. -37a37 -> tests/value/postcondition.i:12:[value] warning: function get_index: postcondition got status unknown. -diff tests/value/oracle/precise_locations.res.oracle tests/value/oracle_legacy/precise_locations.res.oracle -338c338,339 -< q ∈ [--..--] ---- -> q[bits 0 to 7] ∈ [--..--] -> [bits 8 to 31]# ∈ {0; 10; 20}%32, bits 8 to 31 -diff tests/value/oracle/ptr_call_object.res.oracle tests/value/oracle_legacy/ptr_call_object.res.oracle -12,18d11 -< [value] computing for function next_0 <- main. -< Called from tests/value/ptr_call_object.c:34. -< [value] Called Frama_C_show_each_p_in_next_0({{ &o0 }}, -< .next ∈ {{ &next_0 }} -< .i ∈ UNINITIALIZED) -< [value] Recording results for next_0 -< [value] Done for function next_0 -25a19,25 -> [value] computing for function next_0 <- main. -> Called from tests/value/ptr_call_object.c:34. -> [value] Called Frama_C_show_each_p_in_next_0({{ &o0 }}, -> .next ∈ {{ &next_0 }} -> .i ∈ UNINITIALIZED) -> [value] Recording results for next_0 -> [value] Done for function next_0 -diff tests/value/oracle/ptr_relation.2.res.oracle tests/value/oracle_legacy/ptr_relation.2.res.oracle -20,23d19 -< [value] computing for function g2 <- main2. -< Called from tests/value/ptr_relation.i:38. -< [value] Recording results for g2 -< [value] Done for function g2 -27a24,27 -> [value] computing for function g2 <- main2. -> Called from tests/value/ptr_relation.i:38. -> [value] Recording results for g2 -> [value] Done for function g2 -diff tests/value/oracle/recursion.1.res.oracle tests/value/oracle_legacy/recursion.1.res.oracle -18,19c18,104 -< tests/value/recursion.i:8:[value] user error: Recursive call to a function. -< [kernel] Plug-in value aborted: invalid user input. ---- -> [value] user error: Recursive call on an unspecified function. Using potentially invalid -> inferred assigns 'assigns \result \from \nothing;' -> [value] using specification for function ff -> [value] Recording results for ff -> [value] Done for function ff -> [value] computing for function g <- main. -> Called from tests/value/recursion.i:68. -> tests/value/recursion.i:39:[value] warning: recursive call during value analysis -> of g (g <- g :: tests/value/recursion.i:68 <- main). -> Using specification of g. -> [value] user error: Recursive call on an unspecified function. Using potentially invalid -> inferred assigns 'assigns \nothing' -> [value] using specification for function g -> [value] Recording results for g -> [value] Done for function g -> [value] computing for function h <- main. -> Called from tests/value/recursion.i:70. -> tests/value/recursion.i:44:[value] warning: recursive call during value analysis -> of h (h <- h :: tests/value/recursion.i:70 <- main). -> Using specification of h. -> [value] user error: Recursive call on an unspecified function. Using potentially invalid -> inferred assigns 'assigns *p1 \from *p1, *p2; assigns *p2 \from *p1, *p2;' -> [value] using specification for function h -> [value] Recording results for h -> [value] Done for function h -> [value] Called Frama_C_show_each([-2147483648..2147483647], [-2147483648..2147483647]) -> [value] computing for function escaping_formal <- main. -> Called from tests/value/recursion.i:72. -> tests/value/recursion.i:52:[value] function escaping_formal: precondition got status valid. -> [value] Called Frama_C_show_each({{ &i }}, {10}, {0}, {10}) -> tests/value/recursion.i:59:[value] warning: recursive call during value analysis -> of escaping_formal (escaping_formal <- escaping_formal :: tests/value/recursion.i:72 <- -> main). -> Using specification of escaping_formal. -> [value] using specification for function escaping_formal -> tests/value/recursion.i:52:[value] warning: function escaping_formal: precondition got status unknown. -> tests/value/recursion.i:54:[value] warning: function escaping_formal: postcondition got status unknown. -> [value] Called Frama_C_show_each({{ &i }}, -> [-2147483648..2147483647], -> {0}, -> [-2147483648..2147483647]) -> tests/value/recursion.i:54:[value] function escaping_formal: postcondition got status valid. -> [value] Recording results for escaping_formal -> [value] Done for function escaping_formal -> [value] computing for function f <- main. -> Called from tests/value/recursion.i:73. -> [value] Called Frama_C_show_each({2}, {0}) -> tests/value/recursion.i:30:[value] warning: recursive call during value analysis -> of f (f <- f :: tests/value/recursion.i:73 <- main). -> Using specification of f. -> [value] using specification for function f -> [value] Called Frama_C_show_each([-2147483648..2147483647], {0}) -> [value] Recording results for f -> [value] Done for function f -> [value] Called Frama_C_show_each([-2147483648..2147483647]) -> tests/value/recursion.i:75:[value] warning: signed overflow. assert r.f1 + 1 ≤ 2147483647; -> [value] Recording results for main -> [value] done for function main -> [value] ====== VALUES COMPUTED ====== -> tests/value/recursion.i:59:[inout] warning: During inout context analysis of escaping_formal: -> ignoring probable recursive call. -> [value:final-states] Values at end of function escaping_formal: -> pg ∈ {0} -> tests/value/recursion.i:30:[inout] warning: During inout context analysis of f: -> ignoring probable recursive call. -> [value:final-states] Values at end of function f: -> x ∈ [--..--] -> s ∈ [--..--] -> tests/value/recursion.i:8:[inout] warning: During inout context analysis of ff: -> ignoring probable recursive call. -> [value:final-states] Values at end of function ff: -> __retres ∈ {5} -> tests/value/recursion.i:39:[inout] warning: During inout context analysis of g: -> ignoring probable recursive call. -> [value:final-states] Values at end of function g: -> -> tests/value/recursion.i:44:[inout] warning: During inout context analysis of h: -> ignoring probable recursive call. -> [value:final-states] Values at end of function h: -> -> [value:final-states] Values at end of function main: -> G ∈ {5} -> x ∈ [--..--] -> s ∈ [--..--] -> pg ∈ {0} -> r ∈ [--..--] -> __retres ∈ [-2147483647..2147483647] -diff tests/value/oracle/reduce_by_valid.res.oracle tests/value/oracle_legacy/reduce_by_valid.res.oracle -100,101c100,101 -< [value] Called Frama_C_show_each_main10_3({{ &t_0 + [-2..34] }}) -< tests/value/reduce_by_valid.i:188:[value] assertion got status valid. ---- -> [value] Called Frama_C_show_each_main10_3({{ &t_0 + [-2147483648..2147483647] }}) -> tests/value/reduce_by_valid.i:188:[value] warning: assertion got status unknown. -diff tests/value/oracle/reduce_formals.res.oracle tests/value/oracle_legacy/reduce_formals.res.oracle -44c44 -< [value] Called Frama_C_show_each_v({10; 11; 12; 13; 14; 15}) ---- -> [value] Called Frama_C_show_each_v([-2147483648..15]) -50c50 -< [value] Called Frama_C_show_each_v({16; 17; 18; 19; 20}) ---- -> [value] Called Frama_C_show_each_v([16..2147483647]) -73c73 -< [value] Called Frama_C_show_each_6({3}) ---- -> [value] Called Frama_C_show_each_6({4; 5; 6; 7; 8; 9; 10}) -101c101 -< g ∈ {3} ---- -> g ∈ {4; 5; 6; 7; 8; 9; 10} -103c103 -< g ∈ {3} ---- -> g ∈ {4; 5; 6; 7; 8; 9; 10} -diff tests/value/oracle/reduce_index.res.oracle tests/value/oracle_legacy/reduce_index.res.oracle -131c131 -< c11 ∈ {0; 1; 2; 3} ---- -> c11 ∈ {0; 1; 2; 3; 4; 5; 6} -236c236 -< c11 ∈ {0; 1; 2; 3} ---- -> c11 ∈ {0; 1; 2; 3; 4; 5; 6} -diff tests/value/oracle/relation_reduction.res.oracle tests/value/oracle_legacy/relation_reduction.res.oracle -30c30 -< y ∈ [-2147483648..2147483637] ---- -> y ∈ [--..--] -32c32 -< R1 ∈ [-2147483648..2147483637] ---- -> R1 ∈ [--..--] -diff tests/value/oracle/relations.res.oracle tests/value/oracle_legacy/relations.res.oracle -51,52c51 -< u[0] ∈ [-2147483648..2147483646] -< [1] ∈ [--..--] ---- -> u[0..1] ∈ [--..--] -60c59 -< R3 ∈ [-2147483648..2147483646] ---- -> R3 ∈ [--..--] -diff tests/value/oracle/relations2.res.oracle tests/value/oracle_legacy/relations2.res.oracle -53c53 -< t ∈ [0..511] ---- -> t ∈ [0..512] -71c71 -< t ∈ [0..511] ---- -> t ∈ [0..512] -87c87 -< t ∈ [0..511] ---- -> t ∈ [0..512] -103c103 -< t ∈ [0..511] ---- -> t ∈ [0..512] -diff tests/value/oracle/replace_by_show_each.res.oracle tests/value/oracle_legacy/replace_by_show_each.res.oracle -23c23 -< j ∈ [-2147483648..2147483646] ---- -> j ∈ [--..--] -diff tests/value/oracle/sep.0.res.oracle tests/value/oracle_legacy/sep.0.res.oracle -3d2 -< [value] Part of a case analysis: 0 of 0..3 -4a4 -> [value] Part of a case analysis: 0 of 0..3 -diff tests/value/oracle/sep.1.res.oracle tests/value/oracle_legacy/sep.1.res.oracle -3d2 -< [value] Part of a case analysis: 1 of 0..3 -4a4 -> [value] Part of a case analysis: 1 of 0..3 -diff tests/value/oracle/sep.2.res.oracle tests/value/oracle_legacy/sep.2.res.oracle -3d2 -< [value] Part of a case analysis: 2 of 0..3 -4a4 -> [value] Part of a case analysis: 2 of 0..3 -diff tests/value/oracle/sep.3.res.oracle tests/value/oracle_legacy/sep.3.res.oracle -3d2 -< [value] Part of a case analysis: 3 of 0..3 -4a4 -> [value] Part of a case analysis: 3 of 0..3 -diff tests/value/oracle/shift.0.res.oracle tests/value/oracle_legacy/shift.0.res.oracle -50c50 -< z ∈ [-2147483648..2147483615] ---- -> z ∈ [--..--] -diff tests/value/oracle/shift.1.res.oracle tests/value/oracle_legacy/shift.1.res.oracle -57c57 -< z ∈ [-2147483648..2147483631] ---- -> z ∈ [--..--] -diff tests/value/oracle/sizeof.res.oracle tests/value/oracle_legacy/sizeof.res.oracle -45c45,46 -< p ∈ {{ &s1 + [-36..36] }} ---- -> p ∈ -> {{ garbled mix of &{s1} (origin: Arithmetic {tests/value/sizeof.i:32}) }} -diff tests/value/oracle/split_return.3.res.oracle tests/value/oracle_legacy/split_return.3.res.oracle -29,30d28 -< [value] Called Frama_C_show_each_f2({5}, {5}) -< [value] Called Frama_C_show_each_f2({0}, {0}) -31a30,31 -> [value] Called Frama_C_show_each_f2({0}, {0}) -> [value] Called Frama_C_show_each_f2({5}, {5}) -33d32 -< [value] Called Frama_C_show_each_f2_2({5}, {5}) -34a34 -> [value] Called Frama_C_show_each_f2_2({5}, {5}) -44d43 -< [value] Called Frama_C_show_each_f3({-2}, {0}) -45a45 -> [value] Called Frama_C_show_each_f3({-2}, {0}) -56d55 -< [value] Called Frama_C_show_each_f3({-2}, {0}) -57a57 -> [value] Called Frama_C_show_each_f3({-2}, {0}) -66d65 -< [value] Called Frama_C_show_each_f4({4}, {0}) -67a67 -> [value] Called Frama_C_show_each_f4({4}, {0}) -78d77 -< [value] Called Frama_C_show_each_f4({4}, {0}) -79a79 -> [value] Called Frama_C_show_each_f4({4}, {0}) -88d87 -< [value] Called Frama_C_show_each_f4({4}, {0}) -89a89 -> [value] Called Frama_C_show_each_f4({4}, {0}) -98d97 -< [value] Called Frama_C_show_each_f4({4}, {0}) -99a99 -> [value] Called Frama_C_show_each_f4({4}, {0}) -diff tests/value/oracle/split_return.4.res.oracle tests/value/oracle_legacy/split_return.4.res.oracle -32,33d31 -< [value] Called Frama_C_show_each_f2({5}, {5}) -< [value] Called Frama_C_show_each_f2({0}, {0}) -34a33,34 -> [value] Called Frama_C_show_each_f2({0}, {0}) -> [value] Called Frama_C_show_each_f2({5}, {5}) -36d35 -< [value] Called Frama_C_show_each_f2_2({5}, {5}) -37a37 -> [value] Called Frama_C_show_each_f2_2({5}, {5}) -47d46 -< [value] Called Frama_C_show_each_f3({-2}, {0}) -48a48 -> [value] Called Frama_C_show_each_f3({-2}, {0}) -59d58 -< [value] Called Frama_C_show_each_f3({-2}, {0}) -60a60 -> [value] Called Frama_C_show_each_f3({-2}, {0}) -69d68 -< [value] Called Frama_C_show_each_f4({4}, {0}) -70a70 -> [value] Called Frama_C_show_each_f4({4}, {0}) -81d80 -< [value] Called Frama_C_show_each_f4({4}, {0}) -82a82 -> [value] Called Frama_C_show_each_f4({4}, {0}) -91d90 -< [value] Called Frama_C_show_each_f4({4}, {0}) -92a92 -> [value] Called Frama_C_show_each_f4({4}, {0}) -101d100 -< [value] Called Frama_C_show_each_f4({4}, {0}) -102a102 -> [value] Called Frama_C_show_each_f4({4}, {0}) -435d434 -< [value] Called Frama_C_show_each_f3({-2}, {0}) -436a436 -> [value] Called Frama_C_show_each_f3({-2}, {0}) -445d444 -< [value] Called Frama_C_show_each_f3({-2}, {0}) -446a446 -> [value] Called Frama_C_show_each_f3({-2}, {0}) -455d454 -< [value] Called Frama_C_show_each_f4({4}, {0}) -456a456 -> [value] Called Frama_C_show_each_f4({4}, {0}) -465d464 -< [value] Called Frama_C_show_each_f4({4}, {0}) -466a466 -> [value] Called Frama_C_show_each_f4({4}, {0}) -475d474 -< [value] Called Frama_C_show_each_f4({4}, {0}) -476a476 -> [value] Called Frama_C_show_each_f4({4}, {0}) -485d484 -< [value] Called Frama_C_show_each_f4({4}, {0}) -486a486 -> [value] Called Frama_C_show_each_f4({4}, {0}) -diff tests/value/oracle/struct2.res.oracle tests/value/oracle_legacy/struct2.res.oracle -46a47 -> tests/value/struct2.i:76:[value] warning: signed overflow. assert i + j ≤ 2147483647; -49d49 -< tests/value/struct2.i:76:[value] warning: signed overflow. assert i + j ≤ 2147483647; -51a52 -> tests/value/struct2.i:82:[value] warning: signed overflow. assert tab2[i] + j ≤ 2147483647; -62a64 -> tests/value/struct2.i:185:[value] warning: signed overflow. assert i + j ≤ 2147483647; -65,66d66 -< tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert 0 ≤ k; -< tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert k < 2; -69,70d68 -< tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(tab3[l] + m); -< tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert (int)(tab3[l] + m) < 10; -72a71,74 -> tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(tab3[l] + m); -> tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert (int)(tab3[l] + m) < 10; -> tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert 0 ≤ k; -> tests/value/struct2.i:185:[value] warning: accessing out of bounds index. assert k < 2; -diff tests/value/oracle/test.0.res.oracle tests/value/oracle_legacy/test.0.res.oracle -15d14 -< tests/value/test.i:11:[value] warning: signed overflow. assert j + ecart ≤ 2147483647; -24c23 -< j ∈ [-1073741822..1] ---- -> j ∈ [-1073741823..1] -diff tests/value/oracle/unknown_sizeof.0.res.oracle tests/value/oracle_legacy/unknown_sizeof.0.res.oracle -11c11,19 -< tests/value/unknown_sizeof.i:19:[value] user error: function g returns a value of unknown size. Aborting ---- -> tests/value/unknown_sizeof.i:8:[kernel] imprecise size for variable r (abstract type 'struct s') -> [value] computing for function g <- main1. -> Called from tests/value/unknown_sizeof.i:19. -> tests/value/unknown_sizeof.i:19:[kernel] imprecise size for variable __retres (abstract type 'struct s') -> tests/value/unknown_sizeof.i:15:[value] warning: out of bounds write. assert \valid(&__retres); -> tests/value/unknown_sizeof.i:15:[value] warning: accessing uninitialized left-value. -> assert \initialized((struct s *)((char *)(&s) + 1)); -> tests/value/unknown_sizeof.i:15:[value] warning: out of bounds read. assert \valid_read((struct s *)((char *)(&s) + 1)); -> tests/value/unknown_sizeof.i:15:[value] user error: Function g returns a value of unknown size. Aborting -diff tests/value/oracle/unop.res.oracle tests/value/oracle_legacy/unop.res.oracle -11,12c11,12 -< [value] Called Frama_C_show_each_1_then([-2147483648. .. -3.]) -< [value] Called Frama_C_show_each_1_else([-2.99999976158 .. 2147483648.]) ---- -> [value] Called Frama_C_show_each_1_then([-2147483648. .. 2147483648.]) -> [value] Called Frama_C_show_each_1_else([-2147483648. .. 2147483648.]) -19,20c19,20 -< [value] Called Frama_C_show_each_2_then([-2147483647..-3]) -< [value] Called Frama_C_show_each_2_else([-2..2147483647]) ---- -> [value] Called Frama_C_show_each_2_then([-2147483648..2147483647]) -> [value] Called Frama_C_show_each_2_else([-2147483648..2147483647]) -diff tests/value/oracle/va_list.res.oracle tests/value/oracle_legacy/va_list.res.oracle -12d11 -< tests/value/va_list.c:9:[value] user error: functions returning variadic arguments must be stubbed -18c17,19 -< vlParameters ∈ [--..--] ---- -> vlParameters ∈ -> {{ NULL + [--..--] ; -> &alloced_return___builtin_next_arg + [0..2147483644],0%4 }} -diff tests/value/oracle/va_list2.res.oracle tests/value/oracle_legacy/va_list2.res.oracle -10,13c10,30 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(tmp_0); -< (tmp_0 from vararg) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read((int *)*args); -> tests/value/va_list2.c:11:[value] Assigning imprecise value to tmp. -> The imprecision originates from Well -> tests/value/va_list2.c:11:[value] Assigning imprecise value to i. -> The imprecision originates from Well -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read((float *)*args); -> tests/value/va_list2.c:16:[value] Assigning imprecise value to tmp_0. -> The imprecision originates from Well -> tests/value/va_list2.c:16:[value] Assigning imprecise value to f. -> The imprecision originates from Well -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> tests/value/va_list2.c:17:[value] warning: non-finite float value. assert \is_finite(f); -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -15,16c32,43 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -20,22d46 -< tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -< tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -< tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype -24a49 -> args ∈ {{ NULL ; &S___va_params{[0], [1], [2]} }} -26,31d50 -< [from] Computing for function __builtin_va_start <-main -< [from] Done for function __builtin_va_start -< [from] Computing for function __builtin_va_arg <-main -< [from] Done for function __builtin_va_arg -< [from] Computing for function __builtin_va_end <-main -< [from] Done for function __builtin_va_end -39c58 -< fmt; i; f ---- -> fmt; args; i; tmp; f; tmp_0 -41c60,61 -< S_fmt[0..1] ---- -> S___va_params[0..1]; S_0_S___va_params[bits 0 to ..]; -> S_1_S___va_params[bits 0 to ..]; S_fmt[0..1] -diff tests/value/oracle/val9.res.oracle tests/value/oracle_legacy/val9.res.oracle -54c54,55 -< b7 ∈ {1} ---- -> b7[bits 0 to 7] ∈ {1} -> [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 -diff tests/value/oracle/volatile.res.oracle tests/value/oracle_legacy/volatile.res.oracle -93a94 -> tests/value/volatile.c:114:[value] warning: signed overflow. assert v + 1 ≤ 2147483647; -103a105,106 -> tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; -> tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; -110a114,115 -> tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; -> tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; -118a124 -> tests/value/volatile.c:118:[value] warning: signed overflow. assert *v_ptr + 1 ≤ 2147483647; -128a135,136 -> tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; -> tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; -135a144,145 -> tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; -> tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; -143a154 -> tests/value/volatile.c:125:[value] warning: signed overflow. assert svol.f[0] + 1 ≤ 2147483647; -153a165,166 -> tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; -> tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; -160a174,175 -> tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; -> tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; -168a184 -> tests/value/volatile.c:129:[value] warning: signed overflow. assert svol_ptr->f[0] + 1 ≤ 2147483647; -178a195,196 -> tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; -> tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; -185a204,205 -> tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; -> tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; -193a214 -> tests/value/volatile.c:136:[value] warning: signed overflow. assert sdeepvol.g[0] + 1 ≤ 2147483647; -203a225,226 -> tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; -> tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; -210a234,235 -> tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; -> tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; -218a244 -> tests/value/volatile.c:140:[value] warning: signed overflow. assert volt[0].f[0] + 1 ≤ 2147483647; -228a255,256 -> tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; -> tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; -235a264,265 -> tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; -> tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; -243a274 -> tests/value/volatile.c:144:[value] warning: signed overflow. assert deepvolt[0].g[0] + 1 ≤ 2147483647; -253a285,286 -> tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; -> tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; -258a292,293 -> tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; -> tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; -diff tests/value/oracle/widen_on_non_monotonic.res.oracle tests/value/oracle_legacy/widen_on_non_monotonic.res.oracle -21a22 -> tests/value/widen_on_non_monotonic.i:26:[value] entering loop for the first time diff --git a/tests/value/diff_symblocs b/tests/value/diff_symblocs index c9fc61a55206c51c5b44f203ad4aa140709d3388..14fee98321effcce0b6f641f20a68448d3de5447 100644 --- a/tests/value/diff_symblocs +++ b/tests/value/diff_symblocs @@ -1,16 +1,16 @@ diff tests/value/oracle/alias.0.res.oracle tests/value/oracle_symblocs/alias.0.res.oracle -108,109c108,109 +104,105c104,105 < t ∈ {1; 2; 4} < u ∈ {2; 3; 4; 5} --- > t ∈ {4} > u ∈ {5} -115c115 +111c111 < t2 ∈ {0; 3; 6} --- > t2 ∈ {6} diff tests/value/oracle/alias.4.res.oracle tests/value/oracle_symblocs/alias.4.res.oracle -80c80 +79c79 < y ∈ {0; 3; 77} --- > y ∈ {77} @@ -20,122 +20,67 @@ diff tests/value/oracle/alias.5.res.oracle tests/value/oracle_symblocs/alias.5.r --- > y ∈ {77} diff tests/value/oracle/alias.6.res.oracle tests/value/oracle_symblocs/alias.6.res.oracle -87c87 +86c86 < x ∈ {0; 4; 33} --- > x ∈ {33} -Only in tests/value/oracle: behavior_statuses.0.err.oracle -Only in tests/value/oracle: behavior_statuses.0.res.oracle -Only in tests/value/oracle: behavior_statuses.1.err.oracle -Only in tests/value/oracle: behavior_statuses.1.res.oracle -Only in tests/value/oracle_symblocs: behavior_statuses.err.oracle -Only in tests/value/oracle_symblocs: behavior_statuses.res.oracle diff tests/value/oracle/bitwise_pointer.res.oracle tests/value/oracle_symblocs/bitwise_pointer.res.oracle -55c55 +54c54 < x ∈ [0..9] --- > x ∈ {5} -68c68 +67c67 < x1 ∈ [0..9] --- > x1 ∈ {5} diff tests/value/oracle/bitwise_reduction.res.oracle tests/value/oracle_symblocs/bitwise_reduction.res.oracle -16c16 -< {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; +15c15 +< {0; 1}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} --- -> {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; -19,20c19,20 -< {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; -< 0xF000; 0xFF00}) +> {0; 1}, {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} +17c17 +< {0; 1}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} --- -> {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; -> 0xFF00}) -24c24 -< {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; +> {0; 1}, {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} +21c21 +< {{ &t + {0; 4} }}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} --- -> {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; -27,28c27,28 -< {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; -< 0xF000; 0xFF00}) +> {{ &t + {0; 4} }}, {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} +23c23 +< {0; 1}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} --- -> {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; -> 0xFF00}) -diff tests/value/oracle/cast_fun.res.oracle tests/value/oracle_symblocs/cast_fun.res.oracle -39,40d38 -< tests/value/cast_fun.i:103:[value] warning: pointer to function with incompatible type. assert \valid_function(p3); -< tests/value/cast_fun.i:108:[value] warning: pointer to function with incompatible type. assert \valid_function(p4); -42c40 -< Called from tests/value/cast_fun.i:113. ---- -> Called from tests/value/cast_fun.i:103. -44a43,48 -> [value] computing for function f9 <- main. -> Called from tests/value/cast_fun.i:108. -> [value] Done for function f9 -> [value] computing for function f10 <- main. -> Called from tests/value/cast_fun.i:113. -> [value] Done for function f10 -52c56 -< tests/value/cast_fun.i:98:[from] warning: variadic call detected. Using only 1 argument(s). ---- -> tests/value/cast_fun.i:103:[from] warning: variadic call detected. Using only 0 argument(s). -59,60d62 -< tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. -< tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. -68,69c70,71 -< p3 ∈ {{ &f9 }} or UNINITIALIZED -< p4 ∈ {{ &f10 }} or UNINITIALIZED ---- -> p3 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -> p4 ∈ {{ &f9 ; &f10 }} or UNINITIALIZED -119a122,125 -> [from] call to f10 at tests/value/cast_fun.i:103 (by main): -> NO EFFECTS -> [from] call to f9 at tests/value/cast_fun.i:108 (by main): -> NO EFFECTS -126c132,133 -< p1; p2; p3; p4; x; s ---- -> p1; p2; p3; p4; x; s; __va_arg0; __va_args[0]; __va_arg0_11; -> __va_args_13[0] -diff tests/value/oracle/input.res.oracle tests/value/oracle_symblocs/input.res.oracle -22d21 -< tests/value/input.i:7:[from] warning: variadic call detected. Using only 1 argument(s). -32c31 -< tmp ---- -> tmp; __va_arg0; __va_args[0] +> {0; 1}, {0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} diff tests/value/oracle/leaf.res.oracle tests/value/oracle_symblocs/leaf.res.oracle -42c42 -< [value] Called Frama_C_show_each_F([-2147483648..2147483647]) +41c41 +< tests/value/leaf.i:53:[value] Frama_C_show_each_F: [-2147483648..2147483647] --- -> [value] Called Frama_C_show_each_F({5}) +> tests/value/leaf.i:53:[value] Frama_C_show_each_F: {5} diff tests/value/oracle/library.res.oracle tests/value/oracle_symblocs/library.res.oracle -95d94 +100d99 < tests/value/library.i:44:[value] warning: non-finite float value. assert \is_finite((float)(*pf + *pf)); diff tests/value/oracle/non_natural.res.oracle tests/value/oracle_symblocs/non_natural.res.oracle -54a55,56 +53a54,55 > tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. > tests/value/non_natural.i:23:[kernel] more than 200(12500) elements to enumerate. Approximating. -55a58,59 +54a57,58 > tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. > tests/value/non_natural.i:24:[kernel] more than 200(12500) elements to enumerate. Approximating. -58a63 +57a62 > tests/value/non_natural.i:25:[kernel] more than 200(12500) elements to enumerate. Approximating. -61a67 +60a66 > tests/value/non_natural.i:26:[kernel] more than 200(12500) elements to enumerate. Approximating. -64a71 +63a70 > tests/value/non_natural.i:27:[kernel] more than 200(12500) elements to enumerate. Approximating. -67a75 +66a74 > tests/value/non_natural.i:28:[kernel] more than 200(12500) elements to enumerate. Approximating. -70a79 +69a78 > tests/value/non_natural.i:29:[kernel] more than 200(12500) elements to enumerate. Approximating. -73a83 +72a82 > tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate. Approximating. -131a142 -> tests/value/non_natural.i:39:[kernel] more than 200(12500) elements to enumerate. Approximating. -180,187d190 +96,105d105 +< tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. < tests/value/non_natural.i:23:[kernel] more than 200(12500) elements to enumerate. Approximating. +< tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. < tests/value/non_natural.i:24:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:25:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:26:[kernel] more than 200(12500) elements to enumerate. Approximating. @@ -143,61 +88,65 @@ diff tests/value/oracle/non_natural.res.oracle tests/value/oracle_symblocs/non_n < tests/value/non_natural.i:28:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:29:[kernel] more than 200(12500) elements to enumerate. Approximating. < tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate. Approximating. -200,201d202 -< tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. -< tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. +140a141 +> tests/value/non_natural.i:39:[kernel] more than 200(12500) elements to enumerate. Approximating. +diff tests/value/oracle/offsetmap.res.oracle tests/value/oracle_symblocs/offsetmap.res.oracle +36d35 +< [value] Recording results for g +37a37 +> [value] Recording results for g diff tests/value/oracle/plevel.res.oracle tests/value/oracle_symblocs/plevel.res.oracle -11a12 -> tests/value/plevel.i:21:[kernel] more than 40(65) elements to enumerate. Approximating. -15d15 -< tests/value/plevel.i:21:[kernel] more than 40(65) elements to enumerate. Approximating. +11d10 +< [value] Recording results for main +12a12 +> [value] Recording results for main diff tests/value/oracle/ptr_relation.0.res.oracle tests/value/oracle_symblocs/ptr_relation.0.res.oracle -24c24 +23c23 < i ∈ {0; 77; 333} --- > i ∈ {77} diff tests/value/oracle/redundant_alarms.res.oracle tests/value/oracle_symblocs/redundant_alarms.res.oracle -11,12d10 +10,11d9 < tests/value/redundant_alarms.c:11:[value] warning: accessing uninitialized left-value. assert \initialized(p); < tests/value/redundant_alarms.c:12:[value] warning: accessing uninitialized left-value. assert \initialized(p); -20,21d17 +19,20d16 < tests/value/redundant_alarms.c:21:[value] warning: accessing uninitialized left-value. assert \initialized(&t[i]); < tests/value/redundant_alarms.c:22:[value] warning: accessing uninitialized left-value. assert \initialized(&t[i]); -29,30d24 +28,29d23 < tests/value/redundant_alarms.c:32:[value] warning: accessing uninitialized left-value. assert \initialized(&t[j]); < tests/value/redundant_alarms.c:33:[value] warning: accessing uninitialized left-value. assert \initialized(&t[i]); -42,45d35 +48,51d41 < [scope:rm_asserts] removing 3 assertion(s) < tests/value/redundant_alarms.c:12:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(p); < tests/value/redundant_alarms.c:32:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(&t[j]); < tests/value/redundant_alarms.c:33:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(&t[i]); -85d74 +90d79 < /*@ assert Value: initialisation: \initialized(p); */ -87d75 +92d80 < /*@ assert Value: initialisation: \initialized(p); */ -104d91 +109d96 < /*@ assert Value: initialisation: \initialized(&t[i]); */ -106d92 +111d97 < /*@ assert Value: initialisation: \initialized(&t[i]); */ -120d105 +124d109 < /*@ assert Value: initialisation: \initialized(&t[j]); */ -122d106 +126d110 < /*@ assert Value: initialisation: \initialized(&t[i]); */ -167d150 -< int w; -170,172d152 +178a163 +> int z; +181,183d165 < *p = 1; -< z = *p + 1; -< w = *p + 2; +< int z = *p + 1; +< int w = *p + 2; diff tests/value/oracle/relations2.res.oracle tests/value/oracle_symblocs/relations2.res.oracle 123d122 -< [value] Called Frama_C_show_each_NO2() +< tests/value/relations2.i:57:[value] Frama_C_show_each_NO2: diff tests/value/oracle/struct2.res.oracle tests/value/oracle_symblocs/struct2.res.oracle -50a51 +49a50 > tests/value/struct2.i:78:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. -52d52 +51d51 < tests/value/struct2.i:82:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(tab2[i] + j); -76a77 +75a76 > tests/value/struct2.i:185:[value] assertion 'Value,index_bound' got final status valid. 114,115c115 < tab4[0] ∈ {0; 2} @@ -214,143 +163,78 @@ diff tests/value/oracle/struct2.res.oracle tests/value/oracle_symblocs/struct2.r --- > [9].a}; s1; s2; s5.e[0].b; s6.b; s8; tabl[0..1]; tab1[0]; diff tests/value/oracle/symbolic_locs.res.oracle tests/value/oracle_symblocs/symbolic_locs.res.oracle -19a20,25 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 32 -> V: {[ (l)t[i] -> {4} ]} -> Z: {[ (l)t[i] -> t[0..8]; i ]} -> I: {[ t -> {(l)t[i]} -> i -> {(l)t[i]} ]} -> S: {[ i -> {(l)t[i]} ]} +18a19,24 +> # Symbolic locations domain: +> V: {[ t[i] -> {4} ]} +> Z: {[ t[i] -> t[0..8]; i ]} +> I: {[ t -> {t[i]} +> i -> {t[i]} ]} +> S: {[ i -> {t[i]} ]} 28a35,39 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 34 -> V: {[ ]} -> Z: {[ ]} -> I: {[ ]} -> S: {[ ]} -42a54,59 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 44 -> V: {[ (l)t[i] -> {4} ]} -> Z: {[ (l)t[i] -> t[0..8]; i ]} -> I: {[ t -> {(l)t[i]} -> i -> {(l)t[i]} ]} -> S: {[ i -> {(l)t[i]} ]} -51a69,73 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 46 -> V: {[ ]} -> Z: {[ ]} -> I: {[ ]} -> S: {[ ]} -66a89,95 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 55 -> V: {[ (l)t[i] -> {{ &x }} ]} -> Z: {[ (l)t[i] -> t[0..8]; i ]} -> I: {[ t -> {(l)t[i]} -> i -> {(l)t[i]} ]} -> S: {[ i -> {(l)t[i]} -> x -> {(l)t[i]} ]} -76a106,110 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 57 -> V: {[ ]} -> Z: {[ ]} -> I: {[ ]} -> S: {[ ]} -89a124,129 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 65 -> V: {[ (l)t[i] -> {1} ]} -> Z: {[ (l)t[i] -> t[0..8]; i ]} -> I: {[ t -> {(l)t[i]} -> i -> {(l)t[i]} ]} -> S: {[ i -> {(l)t[i]} ]} -96a137,141 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 67 -> V: {[ ]} -> Z: {[ ]} -> I: {[ ]} -> S: {[ ]} -104a150,154 -> [value:d-symblocs] DUMPING SYMBLOCS STATE of file tests/value/symbolic_locs.i line 76 -> V: {[ ]} -> Z: {[ ]} -> I: {[ ]} -> S: {[ ]} +> # Symbolic locations domain: +> V: {[ ]} +> Z: {[ ]} +> I: {[ ]} +> S: {[ ]} +43a55,60 +> # Symbolic locations domain: +> V: {[ t[i] -> {4} ]} +> Z: {[ t[i] -> t[0..8]; i ]} +> I: {[ t -> {t[i]} +> i -> {t[i]} ]} +> S: {[ i -> {t[i]} ]} +53a71,75 +> # Symbolic locations domain: +> V: {[ ]} +> Z: {[ ]} +> I: {[ ]} +> S: {[ ]} +69a92,98 +> # Symbolic locations domain: +> V: {[ t[i] -> {{ &x }} ]} +> Z: {[ t[i] -> t[0..8]; i ]} +> I: {[ t -> {t[i]} +> i -> {t[i]} ]} +> S: {[ i -> {t[i]} +> x -> {t[i]} ]} +80a110,114 +> # Symbolic locations domain: +> V: {[ ]} +> Z: {[ ]} +> I: {[ ]} +> S: {[ ]} +94a129,134 +> # Symbolic locations domain: +> V: {[ t[i] -> {1} ]} +> Z: {[ t[i] -> t[0..8]; i ]} +> I: {[ t -> {t[i]} +> i -> {t[i]} ]} +> S: {[ i -> {t[i]} ]} +102a143,147 +> # Symbolic locations domain: +> V: {[ ]} +> Z: {[ ]} +> I: {[ ]} +> S: {[ ]} +116a162,166 +> # Symbolic locations domain: +> V: {[ ]} +> Z: {[ ]} +> I: {[ ]} +> S: {[ ]} +124,125c174 +< tests/value/symbolic_locs.i:111:[value] warning: signed overflow. assert *p + 1 ≤ 2147483647; +< tests/value/symbolic_locs.i:113:[value] Frama_C_show_each: [0..2147483647] +--- +> tests/value/symbolic_locs.i:113:[value] Frama_C_show_each: [10001..2147483647] +133a183,187 +> # Symbolic locations domain: +> V: {[ ]} +> Z: {[ ]} +> I: {[ ]} +> S: {[ ]} diff tests/value/oracle/test.0.res.oracle tests/value/oracle_symblocs/test.0.res.oracle 26c26 < tmp ∈ [--..--] or UNINITIALIZED --- > tmp ∈ [-2147483647..2147483647] or UNINITIALIZED -diff tests/value/oracle/va_list.res.oracle tests/value/oracle_symblocs/va_list.res.oracle -12d11 -< tests/value/va_list.c:9:[value] user error: functions returning variadic arguments must be stubbed -18c17,19 -< vlParameters ∈ [--..--] ---- -> vlParameters ∈ -> {{ NULL + [0..4294967295] ; -> &alloced_return___builtin_next_arg + [0..2147483644],0%4 }} -diff tests/value/oracle/va_list2.res.oracle tests/value/oracle_symblocs/va_list2.res.oracle -10c10,24 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) ---- -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:11:[value] warning: out of bounds read. assert \valid_read((int *)*args); -> tests/value/va_list2.c:11:[value] Assigning imprecise value to tmp. -> The imprecision originates from Well -> tests/value/va_list2.c:11:[value] Assigning imprecise value to i. -> The imprecision originates from Well -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read(args); -> tests/value/va_list2.c:16:[value] warning: out of bounds read. assert \valid_read((float *)*args); -> tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(*((float *)*args)); -> tests/value/va_list2.c:16:[value] Assigning imprecise value to tmp_0. -> The imprecision originates from Well -13c27,33 -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:16:[value] Assigning imprecise value to f. -> The imprecision originates from Well -> tests/value/va_list2.c:17:[value] warning: non-finite float value. assert \is_finite(f); -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params} because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params} -> (origin: Well) }}) -15,16c35,46 -< [value] Called Frama_C_show_each_i([-2147483648..2147483647]) -< [value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) ---- -> tests/value/va_list2.c:12:[value] Reading left-value i. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_i({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -> tests/value/va_list2.c:17:[value] Reading left-value f. -> It contains a garbled mix of {S_0_S___va_params; S_1_S___va_params} -> because of Well. -> [value] Called Frama_C_show_each_f({{ garbled mix of &{S_0_S___va_params; -> S_1_S___va_params} -> (origin: Well) }}) -20,22d49 -< tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -< tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -< tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype -24a52 -> args ∈ {{ NULL ; &S___va_params{[0], [1], [2]} }} -26,31d53 -< [from] Computing for function __builtin_va_start <-main -< [from] Done for function __builtin_va_start -< [from] Computing for function __builtin_va_arg <-main -< [from] Done for function __builtin_va_arg -< [from] Computing for function __builtin_va_end <-main -< [from] Done for function __builtin_va_end -39c61 -< fmt; i; f ---- -> fmt; args; i; tmp; f; tmp_0 -41c63,64 -< S_fmt[0..1] ---- -> S___va_params[0..1]; S_0_S___va_params[bits 0 to ..]; -> S_1_S___va_params[bits 0 to ..]; S_fmt[0..1] diff --git a/tests/value/downcast.i b/tests/value/downcast.i index 79d33016a55bc91f8e3b57b0750e3f3f1aec2172..9e22608e0088cc18ec7caf539b1a0a08b1777394 100644 --- a/tests/value/downcast.i +++ b/tests/value/downcast.i @@ -41,11 +41,15 @@ void main3_reduction() { unsigned char d = y; } +/* The cvalue abstraction does not represent how an address is represented in a + C type. Thus alarms should always be emitted on a downcast of pointer values, + as we don't known if they fit in the destination type. */ void main4_pointer() { int x; long long int p = (long long int)(&x); - unsigned int q = p; // downcast, but no alarm - signed int r = p; // alarm on upper range + p += 100; + unsigned int q = p; + signed int r = p; } // Perform a computation that overflows on signed integers without alarm. The assertions can be proven with enough slevel @@ -82,6 +86,12 @@ void main6_val_warn_converted_signed() { unsigned int e = -64000; // No warning on unsigned casts short b = (short)e; // Warning, as -64000 does not fit in short } + if (v) { + int *p = &v; + int x = p; // No warning as an address fits in an integer. + short y = p; // Warnings, as an address may not fit in short. + unsigned short z = p; // No warninng on unsigned casts. + } } void main7_signed_upcast() { diff --git a/tests/value/empty_struct.c b/tests/value/empty_struct.c index c5b512a22e9962eaae08d1a94d6d3dd7fa0ca801..16c497a7830e09e08f877d5f8d3b58bf06bb4ad0 100644 --- a/tests/value/empty_struct.c +++ b/tests/value/empty_struct.c @@ -3,6 +3,8 @@ STDOPT: +" -machdep gcc_x86_32 -cpp-extra-args=-DP2 -lib-entry" STDOPT: +" -machdep gcc_x86_32 -cpp-extra-args=-DP3 -lib-entry" STDOPT: +" -cpp-extra-args=-DP1 -lib-entry" + STDOPT: +" -cpp-extra-args=-DP1 -absolute-valid-range 0-1 -main main2" + STDOPT: +" -cpp-extra-args=\"-DP1 -DP5\" -machdep gcc_x86_32 -absolute-valid-range 0-1 -main main3" */ // BTS 1416 and 1874 @@ -57,5 +59,29 @@ struct super_block { /* pas de return */ } -void main(); +#endif + +// tests that dereferencing a (invalid) pointer to an empty struct does not +// crash when -valid-absolute-range is set +struct empty {}; +void main2(int n) { + struct empty * ptr_ret = (struct empty *)0x2; + if (n) *ptr_ret; // invalid access, but should not crash +} + +#ifdef P5 +#include <stdlib.h> +struct empty empties[100]; +volatile int nondet; +void main3(int n) { + struct empty *q = malloc(0); + struct empty *r = realloc(q, 0); + struct empty *p = empties; + for (int i = 0; i < 100; i++) { + empties[i] = *r; + } + *p = empties[99]; + *p = *r; + free(r); +} #endif diff --git a/tests/value/endian.i b/tests/value/endian.i index 35fb2146e48a02828fb7dd4b38c640d422406be3..89a6fbca3628d15de1434ef99772ae2448f62f21 100644 --- a/tests/value/endian.i +++ b/tests/value/endian.i @@ -1,10 +1,12 @@ +/* run.config* + STDOPT: +"-machdep x86_32" + STDOPT: +"-machdep ppc_32" +*/ + struct S {unsigned char a; unsigned char b; char c; unsigned char d;} v1; union U {unsigned int full; struct S part;} UU; -unsigned char b0,b1,b2,b3; -unsigned int f; - union U0 { unsigned short f0 ; @@ -13,16 +15,11 @@ union U0 { unsigned char const f3 ; }; -unsigned short G0 ; -int G1 ; -int G2; -unsigned char G3 ; -union U0 G={(unsigned short)65532U}; - - - -void main (void) { +void main0 (void) { + unsigned char b0,b1,b2,b3; + unsigned int f; union U data0; + data0.full = 0xFF030201; b0 = data0.part.a + 1 - 1; b1 = data0.part.b + 1 - 1; @@ -31,10 +28,76 @@ void main (void) { data0.part.a = 0; f = data0.full + 1 -1; + unsigned short G0 ; + int G1 ; + int G2; + unsigned char G3 ; + union U0 G= {(unsigned short)65532U}; + G0=G.f0; G1=G.f1; G2=G.f2; G3=G.f3; +} + + +/* A structure with bitfields to access each bit. */ +struct bitfield { + unsigned char bit0: 1; + unsigned char bit1: 1; + unsigned char bit2: 1; + unsigned char bit3: 1; + unsigned char bit4: 1; + unsigned char bit5: 1; + unsigned char bit6: 1; + unsigned char bit7: 1; +}; + +/* An unsigned char with direct access to each bit. */ +union bitint { + unsigned char integer; + struct bitfield bits; +}; + +volatile int undet; + +/* Tests the bitwise interpretation of integers, according to the endianness of + the machdep : we modify the bits of a bitint union, and then compute the + value of the corresponding unsigned integer. */ +void interpret_bits () { + union bitint x; + x.integer = 0; + x.bits.bit3 = 1; + /* {8} in little-endian, {16} in big-endian. */ + unsigned char a = x.integer; + x.integer = (unsigned char) -1; + x.bits.bit4 = 0; + /* {239} in little-endian, {247} in big-endian. */ + unsigned char b = x.integer; + x.integer = 0; + if (undet) x.bits.bit7 = 1; + /* {0; 128} in little-endian, {0; 1} in big-endian. */ + unsigned char c = x.integer; + x.integer = 0; + if (undet) x.bits.bit0 = 1; + /* {0; 1} in little-endian, {0; 128} in big-endian. */ + unsigned char d = x.integer; + x.integer = (unsigned char) -1; + if (undet) x.bits.bit2 = 0; + /* {251; 255} in little-endian, {223; 255} in big-endian. */ + unsigned char e = x.integer; + x.integer = 0; + x.bits.bit1 = 1; + if (undet) x.bits.bit3 = 1; + if (undet) x.bits.bit4 = 1; + if (undet) x.bits.bit5 = 1; + if (undet) x.bits.bit6 = 1; + /* [2..122]2%8 in little-endian, [64..94]0%2 in big-endian. */ + unsigned char f = x.integer; +} +void main () { + main0 (); + interpret_bits (); } diff --git a/tests/value/fptr.i b/tests/value/fptr.i index 66aec7cdb378fd5ec3ba26516fef849385fa302a..40a4b52eaccf942804f5e1003e4aee2a4314c203 100644 --- a/tests/value/fptr.i +++ b/tests/value/fptr.i @@ -1,7 +1,7 @@ /* run.config* GCC: OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -journal-disable -then -deps -out - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -main main_uninit -journal-disable -inout-callwise -then -deps -out + OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -main main_uninit -journal-disable -then -deps -out */ int R=77; volatile int v; int n; diff --git a/tests/value/gauges.i b/tests/value/gauges.i index 445cf7a4b19a08bd3a53011bfe9b019b0e1f02d9..19452432fea2227e933d379f2adf68282527b72c 100644 --- a/tests/value/gauges.i +++ b/tests/value/gauges.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +" -slevel-function main8_aux:2,main5_bis:4" + STDOPT: +" -slevel-function main8_aux:2,main5_bis:4 -value-msg-key d-gauges" */ volatile v; @@ -295,6 +295,43 @@ void main14() { Frama_C_show_each(i, j); } +void main15 () { + int x, y; + int *p = &x; + int i = 0; + while(i <= 10) { + i++; + Frama_C_dump_each(); // After the first iteration, nothing should be known on p + p = &y; + } +} + +void main16() { + /* Bug found by Csmith. Widening was incorrectly implemented, and returned + false results when a pointer points to multiple bases in multiple + iterations. Nested loops were probably needed for the bug to manifest + itself. */ + int a = 1; + int b = 1; + int *p = &a; + L1: // This is a loop head + b = 0; + while (b < 1) { + int i; + for (i = 0; i < 3; i++); + for (i = 0; i < 2; i++); + Frama_C_dump_each(); + for (i = 0; i < 1; i++); + while (i < 3) { + if (*p) { + p = &b; + goto L1; + } else + return; + } + } +} + void main() { main0(); main0_bis(); @@ -313,4 +350,6 @@ void main() { main12(); main13(); main14(); + main15(); + main16(); } diff --git a/tests/value/ghost.i b/tests/value/ghost.i index 8714f0bbf6a00ad3b91bb07c096c94f16c53bc6e..6e602983f0bf0cb8d833469da4b37cd393922909 100644 --- a/tests/value/ghost.i +++ b/tests/value/ghost.i @@ -26,4 +26,4 @@ int main () { /* ICI avant H */ int H; -/* ICI après H */ +/* ICI après H */ diff --git a/tests/value/ilevel.i b/tests/value/ilevel.i index ea8be25d69cbb1d9ab801e10cd706f0baeecbcc8..8380fd7505e0d56e1356ef9b80953fe1514e2d35 100644 --- a/tests/value/ilevel.i +++ b/tests/value/ilevel.i @@ -1,5 +1,5 @@ /* run.config* - OPT: -no-autoload-plugins -load-module inout,slicing,sparecode,value -val @VALUECONFIG@ -slice-return main -then-on "Slicing export" -val -val-ilevel 16 -then-on "default" -val-ilevel 17 -then -val-ilevel 48 + OPT: -no-autoload-plugins -load-module inout,slicing,sparecode,value -val @VALUECONFIG@ -slice-return main -then-on "Slicing export" -val -val-ilevel 16 -val-show-progress -then-on "default" -val-ilevel 17 -then -val-ilevel 48 */ // Test in particular that ilevel is by-project, even though it is an ocaml ref volatile int v; diff --git a/tests/value/initialized.c b/tests/value/initialized.c index b6c897212b57fb55806d0b6c8b5279e483255bf7..cad6b37c561964a880adbefa08a59ea25f24b213 100644 --- a/tests/value/initialized.c +++ b/tests/value/initialized.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-big-ints-hex 257 -inout-callwise -val-warn-copy-indeterminate=-g6" + STDOPT: #"-big-ints-hex 257 -val-warn-copy-indeterminate=-g6" */ #include "__fc_builtin.h" @@ -148,6 +148,11 @@ void g6() { //@ assert !\initialized(&i6); } +void g7() { + unsigned char key[128]; + Frama_C_make_unknown(key, 64); + //@ assert !\initialized(&key[0..127]); +} int main () { g1(); @@ -156,5 +161,6 @@ int main () { if (rand) g4(); g5(); g6(); + g7(); return 0; } diff --git a/tests/value/inout_proto.i b/tests/value/inout_proto.i index 45bc1b875062983523769d8ec0659df52ea2edcd..3248cc92d7e49b84698ee000af5e834de2b172cb 100644 --- a/tests/value/inout_proto.i +++ b/tests/value/inout_proto.i @@ -1,5 +1,5 @@ /*run.config* - OPT: -no-autoload-plugins -load-module from,inout @VALUECONFIG@ -inout -input-with-formals -inout-with-formals -inout-callwise -main main_main + OPT: -no-autoload-plugins -load-module from,inout @VALUECONFIG@ -inout -input-with-formals -inout-with-formals -main main_main */ typedef unsigned char BYTE; diff --git a/tests/value/local_cleanup.c b/tests/value/local_cleanup.c index 03ef6873c02a34aa1ccab75124e8bf2e27a87367..6874e791f4386b0f51b3a90fbb44d6b02cba41bf 100644 --- a/tests/value/local_cleanup.c +++ b/tests/value/local_cleanup.c @@ -1,6 +1,10 @@ -/* run.config* - STDOPT: #"-inout-callwise" -*/ +int h() { + int x = 1; + { + int y = 2; + return y; // y must leave scope, even though the 'return' is not in the outermost scope + } +} void f(int *p){ p[1]=12; @@ -15,4 +19,6 @@ void main(){ int lmain[2]; f(lmain); g(2); + h(); + Frama_C_dump_each(); } diff --git a/tests/value/local_slevel.i b/tests/value/local_slevel.i index 65dfa29ecf3dcba1e086ae97ba4f2dcead362c21..c7f7cac7d1e58e037f9438de2719cef2c4f0a9df 100644 --- a/tests/value/local_slevel.i +++ b/tests/value/local_slevel.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-load-module frama-c-constant_propagation -slevel-function main2:100000 -print -then -scf -then-on propagated -val -no-scf" + STDOPT: +" -load-module frama-c-constant_propagation -slevel-function main2:100000 -print -then -scf -then-on propagated -val -val-show-progress -no-scf" */ int *p; diff --git a/tests/value/local_variables.i b/tests/value/local_variables.i index 40b0329160e51808a2bf304276de563e662f154e..098389f6fcf6d89bdd8a9c2d3459816dc5338705 100644 --- a/tests/value/local_variables.i +++ b/tests/value/local_variables.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-inout-callwise" +"-inout" + STDOPT: +"-inout" */ int w(int *, int*); int unkn(void); int A,B,C,D,R,S; diff --git a/tests/value/logicdeps.i b/tests/value/logicdeps.i index 8c67fa45649c68567aeef42b0bf386c69286680f..2d462f330596a7c2051e05565f67fa8341600163 100644 --- a/tests/value/logicdeps.i +++ b/tests/value/logicdeps.i @@ -1,5 +1,5 @@ /* run.config* - STDOPT: +"-memexec-all -inout-callwise -calldeps -no-deps -no-input -no-out -then -inout" + STDOPT: +"-memexec-all -calldeps -no-deps -no-input -no-out -then -inout" */ int t[50]; diff --git a/tests/value/loop1.i b/tests/value/loop1.i index 31e41368051556e86d0231a2b96a10abebb3121c..a0252cc4b3b199e4f3da8997bbf22bdf79bf42a5 100644 --- a/tests/value/loop1.i +++ b/tests/value/loop1.i @@ -4,6 +4,9 @@ void main1 () { int i; for(i=0;i<100; i++) { + // these assertions are meaningless; used to test if Value does not crash + /*@ assert i >= \at(i,LoopCurrent); */ + /*@ assert i >= \at(i,LoopEntry); */ U[i]=7; } diff --git a/tests/value/loop_wvar.i b/tests/value/loop_wvar.i index 7a7151bc4678d7b63c100248c04e3590c61e47ef..2b1e3a4e1fcbe9a3069ea811064ad5be892c307e 100644 --- a/tests/value/loop_wvar.i +++ b/tests/value/loop_wvar.i @@ -9,7 +9,7 @@ void main(void) { int n = 13; int i,j; -// ceci était une annotation, mais on ne fait pas moins bien sans +// ceci était une annotation, mais on ne fait pas moins bien sans // maintenant: // loop pragma WIDEN_VARIABLES i; /*@ loop widen_hints i, 12, 13; */ diff --git a/tests/value/loopinv.c b/tests/value/loopinv.c index 505b4e6efd6ff82ee39ba3eb619ab32170def8c3..036beda27813a4c7f25638e6f915ffe33b59d7b4 100644 --- a/tests/value/loopinv.c +++ b/tests/value/loopinv.c @@ -1,5 +1,5 @@ /* run.config* -OPT: -no-autoload-plugins -load-module from,inout,value,report -slevel-function main2:20 -pp-annot -val -then -report +OPT: @VALUECONFIG@ -no-autoload-plugins -load-module from,inout,value,report -slevel-function main2:20 -pp-annot -val -then -report */ /*@ requires \valid(&t[0..s-1]); @@ -47,8 +47,21 @@ void main3() { // Widening is completely inactivated on this example } } +/* The result of the widening should be reduced by the loop invariant, + but the loop invariant must have an unknown status if it still does not hold + in the reduced state —here due to the missing backward propagation on the + multiplication. Change the invariant for a more complicated one when this + propagator is implemented. */ +void main4 () { + int a = 9; + int x = 0; + /*@ loop invariant x<10 && x*x<10; */ + while(x < a) x++; +} + void main(int c) { main1(c); if (c) main2(); main3(); + main4(); } diff --git a/tests/value/merge_bits.i b/tests/value/merge_bits.i index eee2badcb26da58e2438e129d5a03a40e5c14b0d..760af6579a39e26089224b6304aac9af236cbbd1 100644 --- a/tests/value/merge_bits.i +++ b/tests/value/merge_bits.i @@ -1,5 +1,26 @@ char T[] = { 1,0,0,0,1,2,3,4,5,0,1,1,1 } ; -int main() { + +volatile int nondet; + +union u { + int i; + short s[2]; +}; + +/* This function tests the join of two offsetmaps with the same bitwise + representation, but different structured values. Ideally, the resulting + offsetmap should be a singleton. */ +void join_offsetmap () { + union u u; + if (nondet) + u.i = -2; + else { + u.s[0] = -2; u.s[1] = -1; + } + int r = u.i; +} + +int merge_bits () { Frama_C_show_each_F(*((int*)(T))); Frama_C_show_each_F(*((int*)(T+1))); Frama_C_show_each_F(*((int*)(T+4))); @@ -8,3 +29,9 @@ int main() { Frama_C_show_each_F(*((int*)(T))); return 0; } + + +int main () { + join_offsetmap (); + merge_bits (); +} diff --git a/tests/value/no_results.c b/tests/value/no_results.c index bf337ad57f6ccce483ecf768ee608afdfde7dbf3..1f2355186c9fb157e5d69aa965e1476a3dee0c14 100644 --- a/tests/value/no_results.c +++ b/tests/value/no_results.c @@ -1,5 +1,5 @@ /* run.config* - STDOPT: #"-no-results-function init -inout-callwise -calldeps -slevel 10000" +"-inout" + STDOPT: #"-no-results-function init -calldeps -slevel 10000" +"-inout" */ #define N 3000 diff --git a/tests/value/nonlin.c b/tests/value/nonlin.c index c9c3a2687683cd9f4708a4e2764c0b7a362cf386..6b651cc74b4adf289c5057d3b0269919817ee4a6 100644 --- a/tests/value/nonlin.c +++ b/tests/value/nonlin.c @@ -2,9 +2,30 @@ STDOPT: +"-val-subdivide-non-linear 14 -value-msg-key nonlin" */ +#include "__fc_builtin.h" + volatile int v; volatile short vs; -void main() { +/* Checks that the subdivision does not fail when pointer values get involved. */ +void subdivide_pointer () { + int y, x = 17; + int *p = &x; + int i = Frama_C_interval(0,100); + + /* The complete expression is a pointer. */ + int *q = p + i - i; + + /* The complete expression is an integer, but the subterm on which the + subdivision is done is a pointer. */ + y = *(p + i - i); + + /* The splitted lvalue contains a pointer value. */ + i = v ? i : &x; + y = *(p + i - i); +} + + +void subdivide_integer () { int y; short z = v; int k = (z+675) * (z+675); @@ -22,3 +43,8 @@ void main() { //@ assert 0 <= idx <= 10; t[idx*idx] = 1; } + +void main () { + subdivide_integer (); + subdivide_pointer (); +} diff --git a/tests/value/offsetmap.i b/tests/value/offsetmap.i new file mode 100644 index 0000000000000000000000000000000000000000..60a85ab047e995c96a41dea094db46a693ca1414 --- /dev/null +++ b/tests/value/offsetmap.i @@ -0,0 +1,76 @@ +/* run.config* + GCC: + STDOPT: #"-val-warn-copy-indeterminate=-f" +*/ + +int TT[10]={1,2,3}; +int T[10]={1,2,3}; +int i,a,b; +int a7, b7; + +int O1[20]; +int O2[20]; +int *p; + +int x2,*b2,a2; + +void f() { + for (i = 0; i <= 8; i++) { + TT[i] = i; + *((int*)((char*)&(TT[i]) + 1)) = 0; + } + + a = 1; + if (b) i=5; else i=6; + a=3; + if (i>=2) { a = i ; T[i] = 7 ; } + + for (i = 0; i <= 8; i++) { + *(char *) &a = 1; + b = a; + + *((int*)(((char*)&(T[i])) + 1)) = 0; + } + + a7 = 'a'; + *(char *) &a7 = 1; + b7 = (char)a7; + + ((int*)O1)[1]=17; + ((char*)O1)[1]=18; + + ((int*)O2)[0]=10; + ((char*)O2)[1]=11; + + O1[6]=0; + p=O1+9; + *p=1; + + x2 = 777; + a2 = (int)&x2; + b2 = (int*) a2; + *((int*)a2) = 0; + *b2=*b2+1; +} + + +int s[10000000]; + +/* Performance test on reading a value in an offsetmap. Here the offsetmap for s + contains one value of 4 bytes repeated 10000000 times, and we read 1 byte at + an unknown position in this offsetmap. 4 consecutive reads of 1 byte each are + required to be sound. Doing 40000000 reads would be harshly inefficient + (leading the analysis to not terminate on this function). */ +void g(int i) { + s[i] = 0x1030807; + char *p = &s[i]; + char c1 = *p; + char *q = (char*)&s+i; + char c2 = *q; +} + + +void main (int i) { + f(); + g(i); +} diff --git a/tests/value/oracle/CruiseControl.0.res.oracle b/tests/value/oracle/CruiseControl.0.res.oracle index ad947f840c81c817a3ca7696db8fba915488320d..0cfec86de8ee6fd017891e57a4e3d3156b331324 100644 --- a/tests/value/oracle/CruiseControl.0.res.oracle +++ b/tests/value/oracle/CruiseControl.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/CruiseControl.c (with preprocessing) tests/value/CruiseControl.c:577:[kernel] warning: Floating-point constant 8.113 is not represented exactly. Will use 0x1.039db22d0e560p3. See documentation for option -warn-decimal-float [kernel] Parsing tests/value/CruiseControl_const.c (with preprocessing) diff --git a/tests/value/oracle/CruiseControl.1.res.oracle b/tests/value/oracle/CruiseControl.1.res.oracle index 156447c9f2d48a6d3f6f66464343df909f55a71f..7a6676797f4eadbec870c57522fa7624815d792d 100644 --- a/tests/value/oracle/CruiseControl.1.res.oracle +++ b/tests/value/oracle/CruiseControl.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/CruiseControl.c (with preprocessing) tests/value/CruiseControl.c:577:[kernel] warning: Floating-point constant 8.113 is not represented exactly. Will use 0x1.039db22d0e560p3. See documentation for option -warn-decimal-float [kernel] Parsing tests/value/CruiseControl_const.c (with preprocessing) diff --git a/tests/value/oracle/FP5.res.oracle b/tests/value/oracle/FP5.res.oracle index 2b4e0fd3be9fa17907708b980f7944ffa57d5bcc..41694d2da729d9e0eeea4beb8be89f7ece360166 100644 --- a/tests/value/oracle/FP5.res.oracle +++ b/tests/value/oracle/FP5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/FP5.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/abs.res.oracle b/tests/value/oracle/abs.res.oracle index ec1882e4eb9f05fdf770988cd451283337220ee6..a772bd48e04ffdf1f0ca93473a001f25cc77c3e9 100644 --- a/tests/value/oracle/abs.res.oracle +++ b/tests/value/oracle/abs.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/abs.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/abs_addr.res.oracle b/tests/value/oracle/abs_addr.res.oracle index 8a7887f43f02a57ece2d9c300613542ff29cce66..268f182a8a9e8b54daba80b807ec300f84e18024 100644 --- a/tests/value/oracle/abs_addr.res.oracle +++ b/tests/value/oracle/abs_addr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/abs_addr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/absolute_pointer.res.oracle b/tests/value/oracle/absolute_pointer.res.oracle index a857169bb4f33e711ceb93c0f3b06562b41d2b48..4e7bc65e81b292e21cb4a58ead0dbf68b38fb642 100644 --- a/tests/value/oracle/absolute_pointer.res.oracle +++ b/tests/value/oracle/absolute_pointer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/absolute_pointer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/abstract_struct_1.res.oracle b/tests/value/oracle/abstract_struct_1.res.oracle index 6ec1419e020f0cd0e8284d7973237942b72b5d7f..22cc79338080e3651e78efa96892476cf728b81c 100644 --- a/tests/value/oracle/abstract_struct_1.res.oracle +++ b/tests/value/oracle/abstract_struct_1.res.oracle @@ -1,11 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/abstract_struct_1.c (with preprocessing) [kernel] Parsing tests/value/abstract_struct_2.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state +[value:initial-state] creating variable S_data_0_S_repositories with imprecise size (type struct abstracttype [2]) tests/value/abstract_struct_1.c:10:[value] warning: during initialization of variable 'repositories', size of type 'struct abstracttype' cannot be computed (abstract type 'struct abstracttype') +[value:initial-state] creating variable S_data_1_S_repositories with imprecise size (type struct abstracttype [2]) [value] Initial state computed [value:initial-state] Values of globals at initialization __fc_random_counter ∈ [--..--] @@ -21,19 +22,13 @@ tests/value/abstract_struct_1.c:10:[value] warning: during initialization of var {{ NULL ; (struct abstracttype *)&S_data_1_S_repositories }} S_data_0_S_repositories[bits 0 to ..] ∈ [--..--] or UNINITIALIZED S_data_1_S_repositories[bits 0 to ..] ∈ [--..--] or UNINITIALIZED -[value] computing for function calloc <- main. - Called from tests/value/abstract_struct_1.c:13. -tests/value/abstract_struct_1.c:13:[kernel] warning: No code nor implicit assigns clause for function calloc, generating default assigns from the prototype -[value] using specification for function calloc -share/libc/stdlib.h:276:[value] function calloc: precondition got status valid. -[value] Done for function calloc +tests/value/abstract_struct_1.c:13:[value] allocating variable __calloc_main_l13 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: - repositories ∈ - {{ NULL + [--..--] ; - &alloced_return_calloc + [0..2147483647] }} + __fc_heap_status ∈ [--..--] + repositories ∈ {{ NULL ; &__calloc_main_l13 }} [from] Computing for function main [from] Computing for function calloc <-main [from] Done for function calloc @@ -41,11 +36,13 @@ share/libc/stdlib.h:276:[value] function calloc: precondition got status valid. [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: [from] Function calloc: - \result FROM nmemb; size + __fc_heap_status FROM __fc_heap_status; nmemb; size (and SELF) + \result FROM __fc_heap_status; nmemb; size [from] Function main: - repositories FROM \nothing + __fc_heap_status FROM __fc_heap_status (and SELF) + repositories FROM __fc_heap_status [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - repositories + __fc_heap_status; repositories [inout] Inputs for function main: - \nothing + __fc_heap_status diff --git a/tests/value/oracle/access_path.res.oracle b/tests/value/oracle/access_path.res.oracle index a27648d6e541d9a4e4c3daab61899c2b2b6ccd63..c6314d48ef919a87a953c3a5ca5d0cd49128860f 100644 --- a/tests/value/oracle/access_path.res.oracle +++ b/tests/value/oracle/access_path.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/access_path.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/add_approx.res.oracle b/tests/value/oracle/add_approx.res.oracle index 5b3082eafc76441ee8272f52f287edfaef3c5891..65006e6346e7c6c7d25e6c2cb8ed68256b04dafa 100644 --- a/tests/value/oracle/add_approx.res.oracle +++ b/tests/value/oracle/add_approx.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/add_approx.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/addition.res.oracle b/tests/value/oracle/addition.res.oracle index 0a36accf9a0cbf7b2f2309719228296a73f61b77..84d82d670e5c79b563c9ec65533c5b0d7c48f6fc 100644 --- a/tests/value/oracle/addition.res.oracle +++ b/tests/value/oracle/addition.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/addition.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -88,7 +87,7 @@ tests/value/addition.i:61:[value] warning: signed overflow. assert (int)*((char tests/value/addition.i:61:[value] Assigning imprecise value to p14. The imprecision originates from Misaligned {tests/value/addition.i:61} tests/value/addition.i:66:[value] warning: out of bounds read. assert \valid_read(*((int **)45)); -[value] Called Frama_C_show_each_1([-10..15]) +tests/value/addition.i:87:[value] Frama_C_show_each_1: [-10..15] tests/value/addition.i:88:[value] assertion got status valid. [value] Recording results for main [value] done for function main @@ -108,6 +107,7 @@ tests/value/addition.i:88:[value] assertion got status valid. {{ garbled mix of &{p1} (origin: Arithmetic {tests/value/addition.i:56}) }} {{ garbled mix of &{p1} (origin: Misaligned {tests/value/addition.i:59}) }} {{ garbled mix of &{p1} (origin: Misaligned {tests/value/addition.i:61}) }} +[scope:rm_asserts] removing 2 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: t[0] ∈ {0} @@ -307,7 +307,7 @@ tests/value/addition.i:59:[value] warning: signed overflow. assert (int)*((char tests/value/addition.i:61:[value] warning: signed overflow. assert -2147483648 ≤ (int)*((char *)(&q1)) + 2; tests/value/addition.i:61:[value] warning: signed overflow. assert (int)*((char *)(&q1)) + 2 ≤ 2147483647; tests/value/addition.i:66:[value] warning: out of bounds read. assert \valid_read(*((int **)45)); -[value] Called Frama_C_show_each_1([-10..15]) +tests/value/addition.i:87:[value] Frama_C_show_each_1: [-10..15] [value] Recording results for main [value] done for function main [value] warning: Garbled mix generated during analysis: @@ -326,6 +326,7 @@ tests/value/addition.i:66:[value] warning: out of bounds read. assert \valid_rea {{ garbled mix of &{p1} (origin: Arithmetic {tests/value/addition.i:56}) }} {{ garbled mix of &{p1} (origin: Misaligned {tests/value/addition.i:59}) }} {{ garbled mix of &{p1} (origin: Misaligned {tests/value/addition.i:61}) }} +[scope:rm_asserts] removing 2 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: t[0] ∈ {0} diff --git a/tests/value/oracle/addr.0.res.oracle b/tests/value/oracle/addr.0.res.oracle index 658fecb224c14e7a6f920863ef02883db3549344..a283e447e1ed1b1fff570003d2d2dd8ca723831d 100644 --- a/tests/value/oracle/addr.0.res.oracle +++ b/tests/value/oracle/addr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/addr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/addr.1.res.oracle b/tests/value/oracle/addr.1.res.oracle index 577dd891b6116373eaa2bb92a01ef7f3ed1996dc..24cc35579ab6d384dbaa7fc0ebde558cd0440442 100644 --- a/tests/value/oracle/addr.1.res.oracle +++ b/tests/value/oracle/addr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/addr.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/addr2.res.oracle b/tests/value/oracle/addr2.res.oracle index ac6e2a512c4b4d96c93b46a15e4a6209fc95a87f..0016b9d30c97b1eec4699940f50b4652c45a7e96 100644 --- a/tests/value/oracle/addr2.res.oracle +++ b/tests/value/oracle/addr2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/addr2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,10 +6,10 @@ x ∈ {0} t[0..12] ∈ {0} tests/value/addr2.i:13:[value] entering loop for the first time -[value] Called Frama_C_show_each_F({0}) -[value] Called Frama_C_show_each_F({0; 1}) -[value] Called Frama_C_show_each_F({0; 1; 2}) -[value] Called Frama_C_show_each_F([0..12]) +tests/value/addr2.i:19:[value] Frama_C_show_each_F: {0} +tests/value/addr2.i:19:[value] Frama_C_show_each_F: {0; 1} +tests/value/addr2.i:19:[value] Frama_C_show_each_F: {0; 1; 2} +tests/value/addr2.i:19:[value] Frama_C_show_each_F: [0..12] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/addrofstring.res.oracle b/tests/value/oracle/addrofstring.res.oracle index d3bb72d2cabe9e35ad77131ad8519f85263e4724..9698edacac621b3341e89233208f12bd2c51a3d9 100644 --- a/tests/value/oracle/addrofstring.res.oracle +++ b/tests/value/oracle/addrofstring.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/addrofstring.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/affect_corrupt.0.res.oracle b/tests/value/oracle/affect_corrupt.0.res.oracle index e64ee562a6e6d9eef9282dec1872770fba090694..f660626e37e945625d2237155bda2db35fe5bb6a 100644 --- a/tests/value/oracle/affect_corrupt.0.res.oracle +++ b/tests/value/oracle/affect_corrupt.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/affect_corrupt.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/affect_corrupt.1.res.oracle b/tests/value/oracle/affect_corrupt.1.res.oracle index 21b9db54edd07ac38ef61a3977be2afdfdc8756f..c7760814e664d1288dde1489100cb607784cef61 100644 --- a/tests/value/oracle/affect_corrupt.1.res.oracle +++ b/tests/value/oracle/affect_corrupt.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/affect_corrupt.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ai_annot.res.oracle b/tests/value/oracle/ai_annot.res.oracle index a0289d16ad090675e448e5111173fe0e43895ec3..e70eaf7fd4ada31c12b6334d88f1edfa48a6185e 100644 --- a/tests/value/oracle/ai_annot.res.oracle +++ b/tests/value/oracle/ai_annot.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ai_annot.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/alias.0.res.oracle b/tests/value/oracle/alias.0.res.oracle index 45ef07034ae39c0e13f99a5cf2eeb6bd516e7df4..9361a27f10b32c8d9afcf71b3cfeea3fbdeed76e 100644 --- a/tests/value/oracle/alias.0.res.oracle +++ b/tests/value/oracle/alias.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -57,6 +56,7 @@ U ∈ {0} char1 ∈ {0} ll1 ∈ {0} +tests/value/alias.i:40:[value] warning: initialization of volatile variable vol ignored [value] computing for function f <- main. Called from tests/value/alias.i:45. [value] Recording results for f @@ -69,12 +69,8 @@ Called from tests/value/alias.i:47. [value] Recording results for f [value] Done for function f -tests/value/alias.i:82:[value] warning: signed overflow. assert -2147483648 ≤ p3[1] - vol; -tests/value/alias.i:82:[value] warning: signed overflow. assert p3[1] - vol ≤ 2147483647; -[value] Called Frama_C_show_each_d0([-2147483648..2147483647]) -tests/value/alias.i:84:[value] warning: signed overflow. assert -2147483648 ≤ p3[1] - vol; -tests/value/alias.i:84:[value] warning: signed overflow. assert p3[1] - vol ≤ 2147483647; -[value] Called Frama_C_show_each_d2([-2147483648..2147483647]) +tests/value/alias.i:82:[value] Frama_C_show_each_d0: [-2147483648..2147483647] +tests/value/alias.i:84:[value] Frama_C_show_each_d2: [-2147483648..2147483647] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/alias.1.res.oracle b/tests/value/oracle/alias.1.res.oracle index 2b82fda3baa38dbcb9e1ce2ff540b07cdae15b25..4cc9dbc102a98876f8e5f06dff89c7432b301ab6 100644 --- a/tests/value/oracle/alias.1.res.oracle +++ b/tests/value/oracle/alias.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main3 [value] Computing initial state diff --git a/tests/value/oracle/alias.2.res.oracle b/tests/value/oracle/alias.2.res.oracle index adbbb149ae5327afb3d1d515c421660e5768ff42..9bd5d827799ef1d30e8185911e854abc51b508ac 100644 --- a/tests/value/oracle/alias.2.res.oracle +++ b/tests/value/oracle/alias.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main4 [value] Computing initial state diff --git a/tests/value/oracle/alias.3.res.oracle b/tests/value/oracle/alias.3.res.oracle index f7558707d9b00aaf7c565d64a938f8e3bc76b032..fd3fccfa88430d0200149836e2980c17be9a2f70 100644 --- a/tests/value/oracle/alias.3.res.oracle +++ b/tests/value/oracle/alias.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main5 [value] Computing initial state diff --git a/tests/value/oracle/alias.4.res.oracle b/tests/value/oracle/alias.4.res.oracle index 0097c67ceff99178af4c941ebd2d9ab9c1e4f0c2..be8466d1caad799ab63f55dfb6ce0a85fb85cd92 100644 --- a/tests/value/oracle/alias.4.res.oracle +++ b/tests/value/oracle/alias.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main6 [value] Computing initial state diff --git a/tests/value/oracle/alias.5.res.oracle b/tests/value/oracle/alias.5.res.oracle index 5b8626b5da1485d72531a9633356d23197d61d43..8ad6b6d1082ce42b2df92bfb7205de105ad0343e 100644 --- a/tests/value/oracle/alias.5.res.oracle +++ b/tests/value/oracle/alias.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main11 [value] Computing initial state @@ -61,7 +60,8 @@ tests/value/alias.i:260:[value] entering loop for the first time [value] computing for function f2 <- main11. Called from tests/value/alias.i:268. -[value] DUMPING STATE of file tests/value/alias.i line 23 +tests/value/alias.i:23:[value] Frama_C_dump_each: + # Cvalue domain: NULL[rbits 0 to 2047] ∈ [--..--] x_0 ∈ {{ (char *)&p2 }} q_0 ∈ {{ &p2 + {1} }} @@ -122,7 +122,7 @@ tests/value/alias.i:260:[value] entering loop for the first time char1 ∈ {0} ll1 ∈ {0} i_0 ∈ {0} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for f2 [value] Done for function f2 tests/value/alias.i:271:[value] warning: signed overflow. assert c2 + 1 ≤ 2147483647; diff --git a/tests/value/oracle/alias.6.res.oracle b/tests/value/oracle/alias.6.res.oracle index 71863253129d9f45c6e6426b015f361023f3b564..e8d178c19260b0f476daf3480dbedc9180f11aca 100644 --- a/tests/value/oracle/alias.6.res.oracle +++ b/tests/value/oracle/alias.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/alias.i (no preprocessing) [value] Analyzing a complete application starting at main8 [value] Computing initial state diff --git a/tests/value/oracle/align.res.oracle b/tests/value/oracle/align.res.oracle index da9f94f60ace3c684ce7c37c049f4e9e4bf79190..5cf293b5a809f44f69c336906e7fabdd56fc39d9 100644 --- a/tests/value/oracle/align.res.oracle +++ b/tests/value/oracle/align.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/align.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/align_char_array.res.oracle b/tests/value/oracle/align_char_array.res.oracle index 2daffca989e750a97212a3dbfda2912cfb411325..876d134b11effc15c24de2527855a46d87cd4b3c 100644 --- a/tests/value/oracle/align_char_array.res.oracle +++ b/tests/value/oracle/align_char_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/align_char_array.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -26,6 +25,7 @@ tests/value/align_char_array.c:28:[value] warning: signed overflow. assert -2147 tests/value/align_char_array.c:28:[value] warning: signed overflow. assert (int)((char (*)[10])t) + 2 ≤ 2147483647; [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 4 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: d1 ∈ {1} diff --git a/tests/value/oracle/annot.res.oracle b/tests/value/oracle/annot.res.oracle index c4d6072fc4f7c9c09e16930dc82322d4883ed679..f618cf2c1c8973bccb3a4170428ac8de82cf5707 100644 --- a/tests/value/oracle/annot.res.oracle +++ b/tests/value/oracle/annot.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/annot.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -12,15 +11,15 @@ w ∈ {0} tests/value/annot.i:5:[value] warning: function main: precondition got status unknown. tests/value/annot.i:15:[value] assertion got status valid. -[value] Called Frama_C_show_each_diff({1}) +tests/value/annot.i:16:[value] Frama_C_show_each_diff: {1} tests/value/annot.i:21:[value] assertion got status valid. tests/value/annot.i:28:[value] warning: assertion got status unknown. tests/value/annot.i:33:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_elseif_A_B({0}, {2}) +tests/value/annot.i:34:[value] Frama_C_show_each_elseif_A_B: {0}, {2} tests/value/annot.i:38:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_else_A_B({0; 1}, {0; 2}) +tests/value/annot.i:39:[value] Frama_C_show_each_else_A_B: {0; 1}, {0; 2} tests/value/annot.i:42:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_mn([0..9], [0..9]) +tests/value/annot.i:43:[value] Frama_C_show_each_mn: [0..9], [0..9] tests/value/annot.i:46:[value] assertion got status valid. tests/value/annot.i:47:[value] assertion got status valid. tests/value/annot.i:51:[value] warning: assertion got status unknown. diff --git a/tests/value/oracle/annot_valid.res.oracle b/tests/value/oracle/annot_valid.res.oracle index f28d0a1d4803772e9b67eec93c344ba4a23ecf93..10fcfc452879ac35ea4c9a9734e175a178dae72e 100644 --- a/tests/value/oracle/annot_valid.res.oracle +++ b/tests/value/oracle/annot_valid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/annot_valid.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/anonymous_field.res.oracle b/tests/value/oracle/anonymous_field.res.oracle index 38f63e191266d672f776709a3bfb39d11f3abae0..51792672aaf7758ebc0e53e66b7f53cbc21a2f92 100644 --- a/tests/value/oracle/anonymous_field.res.oracle +++ b/tests/value/oracle/anonymous_field.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/anonymous_field.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/any_int.res.oracle b/tests/value/oracle/any_int.res.oracle index 35ea1747c03bae35686537fe03a3cb966e83f1f6..152128004a07587f35b2e466a534aee6649b595f 100644 --- a/tests/value/oracle/any_int.res.oracle +++ b/tests/value/oracle/any_int.res.oracle @@ -1,10 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/any_int.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/value/any_int.c:6:[value] warning: initialization of volatile variable y ignored tests/value/any_int.c:9:[value] entering loop for the first time tests/value/any_int.c:9:[value] warning: signed overflow. assert y + 1 ≤ 2147483647; tests/value/any_int.c:9:[value] warning: signed overflow. assert y + 1 ≤ 2147483647; diff --git a/tests/value/oracle/arch.res.oracle b/tests/value/oracle/arch.res.oracle index 7a5e8e9e57443194c756b39e7587d8b9f7a73a17..bbc0f79def96d34a8cee21a8a8250186873c24f6 100644 --- a/tests/value/oracle/arch.res.oracle +++ b/tests/value/oracle/arch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/arch.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/arg_array.res.oracle b/tests/value/oracle/arg_array.res.oracle index ed61813c26e48b209dea05bafd69f3ee8ef9fb85..83994f13c6ec55b38b479665ca38bd655ac3fb94 100644 --- a/tests/value/oracle/arg_array.res.oracle +++ b/tests/value/oracle/arg_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/arg_array.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/arith_pointer.res.oracle b/tests/value/oracle/arith_pointer.res.oracle index 2e943c39ecb7308447ff8bd5fa7e4a9d14e7baac..ed5695453cb2e49ba0e7834a807eaa4f1ac729e4 100644 --- a/tests/value/oracle/arith_pointer.res.oracle +++ b/tests/value/oracle/arith_pointer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/arith_pointer.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -14,20 +13,20 @@ [value] computing for function main2 <- main. Called from tests/value/arith_pointer.c:70. tests/value/arith_pointer.c:30:[value] warning: pointer subtraction. assert \base_addr(p1) ≡ \base_addr(p2); -[value] Called Frama_C_show_each({-1}) -[value] Called Frama_C_show_each({0}) +tests/value/arith_pointer.c:36:[value] Frama_C_show_each: {-1} +tests/value/arith_pointer.c:40:[value] Frama_C_show_each: {0} tests/value/arith_pointer.c:49:[value] warning: pointer subtraction. assert \base_addr(p2) ≡ \base_addr(p1); -[value] Called Frama_C_show_each({6; 11}) +tests/value/arith_pointer.c:50:[value] Frama_C_show_each: {6; 11} tests/value/arith_pointer.c:51:[value] warning: pointer subtraction. assert \base_addr(p2) ≡ \base_addr(p2); -[value] Called Frama_C_show_each({0}) +tests/value/arith_pointer.c:52:[value] Frama_C_show_each: {0} tests/value/arith_pointer.c:54:[value] Assigning imprecise value to p1. The imprecision originates from Arithmetic {tests/value/arith_pointer.c:54} tests/value/arith_pointer.c:56:[value] warning: pointer subtraction. assert \base_addr(p2) ≡ \base_addr(p1); tests/value/arith_pointer.c:56:[value] warning: signed overflow. assert -2147483648 ≤ p2 - p1; tests/value/arith_pointer.c:56:[value] warning: signed overflow. assert p2 - p1 ≤ 2147483647; -[value] Called Frama_C_show_each([-2147483648..2147483647]) +tests/value/arith_pointer.c:57:[value] Frama_C_show_each: [-2147483648..2147483647] tests/value/arith_pointer.c:60:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each([-3..5]) +tests/value/arith_pointer.c:64:[value] Frama_C_show_each: [-3..5] tests/value/arith_pointer.c:65:[value] warning: assertion got status unknown. [value] Recording results for main2 [value] Done for function main2 @@ -102,42 +101,31 @@ tests/value/arith_pointer.c:30:[value] warning: signed overflow. assert -2147483 tests/value/arith_pointer.c:30:[value] warning: signed overflow. assert p1 - p2 ≤ 2147483647; tests/value/arith_pointer.c:30:[value] Assigning imprecise value to d. The imprecision originates from Arithmetic {tests/value/arith_pointer.c:30} -tests/value/arith_pointer.c:31:[value] Reading left-value d. - It contains a garbled mix of {x; y} because of Arithmetic - {tests/value/arith_pointer.c:30}. -[value] Called Frama_C_show_each({{ garbled mix of &{x; y} - (origin: Arithmetic - {tests/value/arith_pointer.c:30}) }}) -[value] Called Frama_C_show_each({-1}) -[value] Called Frama_C_show_each({0}) +tests/value/arith_pointer.c:31:[value] Frama_C_show_each: + {{ garbled mix of &{x; y} + (origin: Arithmetic {tests/value/arith_pointer.c:30}) }} +tests/value/arith_pointer.c:36:[value] Frama_C_show_each: {-1} +tests/value/arith_pointer.c:40:[value] Frama_C_show_each: {0} tests/value/arith_pointer.c:49:[value] warning: signed overflow. assert -2147483648 ≤ p2 - p1; tests/value/arith_pointer.c:49:[value] warning: signed overflow. assert p2 - p1 ≤ 2147483647; tests/value/arith_pointer.c:49:[value] Assigning imprecise value to d. The imprecision originates from Arithmetic {tests/value/arith_pointer.c:49} -tests/value/arith_pointer.c:50:[value] Reading left-value d. - It contains a garbled mix of {x; y} because of Arithmetic - {tests/value/arith_pointer.c:49}. -[value] Called Frama_C_show_each({{ garbled mix of &{x; y} - (origin: Arithmetic - {tests/value/arith_pointer.c:49}) }}) +tests/value/arith_pointer.c:50:[value] Frama_C_show_each: + {{ garbled mix of &{x; y} + (origin: Arithmetic {tests/value/arith_pointer.c:49}) }} tests/value/arith_pointer.c:51:[value] warning: signed overflow. assert -2147483648 ≤ p2 - p2; tests/value/arith_pointer.c:51:[value] warning: signed overflow. assert p2 - p2 ≤ 2147483647; tests/value/arith_pointer.c:51:[value] Assigning imprecise value to d. The imprecision originates from Arithmetic {tests/value/arith_pointer.c:51} -tests/value/arith_pointer.c:52:[value] Reading left-value d. - It contains a garbled mix of {x; y} because of Arithmetic - {tests/value/arith_pointer.c:51}. -[value] Called Frama_C_show_each({{ garbled mix of &{x; y} - (origin: Arithmetic - {tests/value/arith_pointer.c:51}) }}) +tests/value/arith_pointer.c:52:[value] Frama_C_show_each: + {{ garbled mix of &{x; y} + (origin: Arithmetic {tests/value/arith_pointer.c:51}) }} tests/value/arith_pointer.c:56:[value] warning: signed overflow. assert -2147483648 ≤ p2 - p1; tests/value/arith_pointer.c:56:[value] warning: signed overflow. assert p2 - p1 ≤ 2147483647; tests/value/arith_pointer.c:56:[value] Assigning imprecise value to d. The imprecision originates from Arithmetic -tests/value/arith_pointer.c:57:[value] Reading left-value d. - It contains a garbled mix of {x} because of Arithmetic. -[value] Called Frama_C_show_each({{ garbled mix of &{x} (origin: Arithmetic) }}) -[value] Called Frama_C_show_each([-3..5]) +tests/value/arith_pointer.c:57:[value] Frama_C_show_each: {{ garbled mix of &{x} (origin: Arithmetic) }} +tests/value/arith_pointer.c:64:[value] Frama_C_show_each: [-3..5] [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main diff --git a/tests/value/oracle/array_access.res.oracle b/tests/value/oracle/array_access.res.oracle index 5286d2dc92e9e1817d8e84b2b04ba838049ba6fd..2a60e8f5f23e0d27c2658da1ed32ee7f70c984c7 100644 --- a/tests/value/oracle/array_access.res.oracle +++ b/tests/value/oracle/array_access.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_access.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -128,7 +127,6 @@ [105] ∈ {3} [106] ∈ {4} R ∈ {0} -[value] Call to builtin bzero(({{ (unsigned char *)< }},{40})) [value] computing for function any_int <- main. Called from tests/value/array_access.c:16. [value] using specification for function any_int @@ -136,7 +134,7 @@ [value] computing for function any_int <- main. Called from tests/value/array_access.c:16. [value] Done for function any_int -[value] Called Frama_C_show_each_I([0..8]) +tests/value/array_access.c:18:[value] Frama_C_show_each_I: [0..8] tests/value/array_access.c:19:[value] warning: accessing out of bounds index. assert 0 ≤ (int)((int)(-i) - 1); tests/value/array_access.c:19:[value] warning: accessing out of bounds index. assert (int)((int)(-i) - 1) < 10; [value] computing for function any_int <- main. @@ -160,15 +158,11 @@ tests/value/array_access.c:19:[value] assertion 'Value,index_bound' got final st LT[0] ∈ {1} [1..9] ∈ {0} [from] Computing for function main -[from] Computing for function Frama_C_bzero <-main -[from] Done for function Frama_C_bzero [from] Computing for function any_int <-main [from] Done for function any_int [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - LT[0..9] FROM \nothing [from] Function any_int: \result FROM \nothing [from] Function main: diff --git a/tests/value/oracle/array_array.0.res.oracle b/tests/value/oracle/array_array.0.res.oracle index b62515fa71bd9db903bec7ab4ab652ffaeb600c0..fda3e186eb04a813eb2220c7d87d36420fa9d559 100644 --- a/tests/value/oracle/array_array.0.res.oracle +++ b/tests/value/oracle/array_array.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_array.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,11 +8,11 @@ next_free ∈ {0} [value] computing for function LIB_MEM_StaticAlloc <- main. Called from tests/value/array_array.c:24. -[value] Called Frama_C_show_each_ALLOCATION_WITH_STATIC_ALLOC({24}) +tests/value/array_array.c:13:[value] Frama_C_show_each_ALLOCATION_WITH_STATIC_ALLOC: {24} [value] Recording results for LIB_MEM_StaticAlloc [value] Done for function LIB_MEM_StaticAlloc tests/value/array_array.c:26:[value] entering loop for the first time -[value] Called Frama_C_show_each_I({29}) +tests/value/array_array.c:27:[value] Frama_C_show_each_I: {29} tests/value/array_array.c:28:[value] warning: accessing out of bounds index. assert i < 3; tests/value/array_array.c:28:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] Recording results for main diff --git a/tests/value/oracle/array_array.1.res.oracle b/tests/value/oracle/array_array.1.res.oracle index 9e9fa7798c32dae583ec4b68177c8a8863f1fc2c..6a413d22f6017ffdfb1a365264f672c87c415170 100644 --- a/tests/value/oracle/array_array.1.res.oracle +++ b/tests/value/oracle/array_array.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_array.c (with preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state @@ -9,12 +8,12 @@ next_free ∈ {0} [value] computing for function LIB_MEM_StaticAlloc <- main2. Called from tests/value/array_array.c:41. -[value] Called Frama_C_show_each_ALLOCATION_WITH_STATIC_ALLOC({24}) +tests/value/array_array.c:13:[value] Frama_C_show_each_ALLOCATION_WITH_STATIC_ALLOC: {24} [value] Recording results for LIB_MEM_StaticAlloc [value] Done for function LIB_MEM_StaticAlloc tests/value/array_array.c:45:[value] entering loop for the first time -[value] Called Frama_C_show_each_TMP({0}) -[value] Called Frama_C_show_each_I({29}) +tests/value/array_array.c:46:[value] Frama_C_show_each_TMP: {0} +tests/value/array_array.c:47:[value] Frama_C_show_each_I: {29} tests/value/array_array.c:48:[value] warning: accessing out of bounds index. assert i < 3; tests/value/array_array.c:48:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] Recording results for main2 diff --git a/tests/value/oracle/array_array.2.res.oracle b/tests/value/oracle/array_array.2.res.oracle index e211fd85563df3b33c980383a87d95ee040737c8..f4518b544ce590d6853b8986fed267f211430a73 100644 --- a/tests/value/oracle/array_array.2.res.oracle +++ b/tests/value/oracle/array_array.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_array.c (with preprocessing) [value] Analyzing a complete application starting at main3 [value] Computing initial state @@ -9,7 +8,7 @@ next_free ∈ {0} [value] computing for function LIB_MEM_StaticAlloc <- main3. Called from tests/value/array_array.c:66. -[value] Called Frama_C_show_each_ALLOCATION_WITH_STATIC_ALLOC({24}) +tests/value/array_array.c:13:[value] Frama_C_show_each_ALLOCATION_WITH_STATIC_ALLOC: {24} [value] Recording results for LIB_MEM_StaticAlloc [value] Done for function LIB_MEM_StaticAlloc tests/value/array_array.c:68:[value] entering loop for the first time diff --git a/tests/value/oracle/array_bounds.0.res.oracle b/tests/value/oracle/array_bounds.0.res.oracle index 085bc2d591d7455063c1738b198bca3493cc08c8..a889fe2e56f9e9b5f8285aee31d0fbb3c2a87395 100644 --- a/tests/value/oracle/array_bounds.0.res.oracle +++ b/tests/value/oracle/array_bounds.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_bounds.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -34,11 +33,11 @@ .T[11] ∈ {11} .b ∈ {20} tests/value/array_bounds.i:14:[value] entering loop for the first time -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({0; 1}) -[value] Called Frama_C_show_each({0; 1; 2}) -[value] Called Frama_C_show_each([0..11]) -[value] Called Frama_C_show_each([0..11]) +tests/value/array_bounds.i:15:[value] Frama_C_show_each: {0} +tests/value/array_bounds.i:15:[value] Frama_C_show_each: {0; 1} +tests/value/array_bounds.i:15:[value] Frama_C_show_each: {0; 1; 2} +tests/value/array_bounds.i:15:[value] Frama_C_show_each: [0..11] +tests/value/array_bounds.i:15:[value] Frama_C_show_each: [0..11] tests/value/array_bounds.i:19:[value] entering loop for the first time tests/value/array_bounds.i:20:[value] warning: accessing out of bounds index. assert j < 12; [value] Recording results for main diff --git a/tests/value/oracle/array_bounds.1.res.oracle b/tests/value/oracle/array_bounds.1.res.oracle index a9f011c1eccb2225fe33e13a04a9d36e7978afd3..683de652f8008328253f2a07b95b949469a1b1eb 100644 --- a/tests/value/oracle/array_bounds.1.res.oracle +++ b/tests/value/oracle/array_bounds.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_bounds.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -34,11 +33,11 @@ .T[11] ∈ {11} .b ∈ {20} tests/value/array_bounds.i:14:[value] entering loop for the first time -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({0; 1}) -[value] Called Frama_C_show_each({0; 1; 2}) -[value] Called Frama_C_show_each([0..11]) -[value] Called Frama_C_show_each([0..11]) +tests/value/array_bounds.i:15:[value] Frama_C_show_each: {0} +tests/value/array_bounds.i:15:[value] Frama_C_show_each: {0; 1} +tests/value/array_bounds.i:15:[value] Frama_C_show_each: {0; 1; 2} +tests/value/array_bounds.i:15:[value] Frama_C_show_each: [0..11] +tests/value/array_bounds.i:15:[value] Frama_C_show_each: [0..11] tests/value/array_bounds.i:19:[value] entering loop for the first time tests/value/array_bounds.i:19:[value] warning: signed overflow. assert j + 5 ≤ 2147483647; [value] Recording results for main diff --git a/tests/value/oracle/array_degenerating_loop.res.oracle b/tests/value/oracle/array_degenerating_loop.res.oracle index af04a27d9b15560856a791e4bd44a6299ef930d0..0b6a671286793e54c4edca278e5f15365f539c12 100644 --- a/tests/value/oracle/array_degenerating_loop.res.oracle +++ b/tests/value/oracle/array_degenerating_loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_degenerating_loop.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,7 +8,7 @@ tests/value/array_degenerating_loop.i:8:[value] entering loop for the first time tests/value/array_degenerating_loop.i:9:[value] warning: accessing out of bounds index. assert i < 100; tests/value/array_degenerating_loop.i:9:[value] warning: signed overflow. assert G + t[i] ≤ 2147483647; -[value] Called Frama_C_show_each([55..2147483647], [-2147483648..99]) +tests/value/array_degenerating_loop.i:10:[value] Frama_C_show_each: [55..2147483647], [-2147483648..99] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/array_initializer.res.oracle b/tests/value/oracle/array_initializer.res.oracle index ef9849c7abebe11cc8efc9ec72542768d5897429..d05f2e4aedbc5de3d0e9af7041b62c581fbff6e8 100644 --- a/tests/value/oracle/array_initializer.res.oracle +++ b/tests/value/oracle/array_initializer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_initializer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/array_loop.res.oracle b/tests/value/oracle/array_loop.res.oracle index 6586f0e8837c495d3ffbac1f3cd7dfc52fcdc908..46fb57deb17131095f462b1690ed60e1d55b0169 100644 --- a/tests/value/oracle/array_loop.res.oracle +++ b/tests/value/oracle/array_loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_loop.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/array_overlap.res.oracle b/tests/value/oracle/array_overlap.res.oracle index 4291060142f1e353ae974c8f243cb1bf28737565..36c386e2edb00eb275c1388fc299331f56fd0f30 100644 --- a/tests/value/oracle/array_overlap.res.oracle +++ b/tests/value/oracle/array_overlap.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_overlap.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/array_ptr.res.oracle b/tests/value/oracle/array_ptr.res.oracle index f9bdb30a8cd4cfe3c61b9c43321221f32a4681be..12d40fd962e00b8ed6a2dac6edca6879de7e4467 100644 --- a/tests/value/oracle/array_ptr.res.oracle +++ b/tests/value/oracle/array_ptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/array_zero_length.0.res.oracle b/tests/value/oracle/array_zero_length.0.res.oracle index deda1c6f88d87dbb1a3b7379bb9f80d605ec228f..0586b9211ad617d029b9502d643137f878c50546 100644 --- a/tests/value/oracle/array_zero_length.0.res.oracle +++ b/tests/value/oracle/array_zero_length.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_zero_length.i (no preprocessing) tests/value/array_zero_length.i:10:[kernel] warning: declaration of array of 'zero-length arrays' ('char [0]`); zero-length arrays are a compiler extension @@ -8,13 +7,10 @@ tests/value/array_zero_length.i:15:[kernel] warning: declaration of array of 'ze [value] Computing initial state tests/value/array_zero_length.i:7:[value] warning: during initialization of variable 'T', size of type 'char []' cannot be computed (Size of array without number of elements.) -tests/value/array_zero_length.i:7:[kernel] imprecise size for variable T (Size of array without number of elements.) tests/value/array_zero_length.i:9:[value] warning: during initialization of variable 'V', size of type 'char [][2]' cannot be computed (Size of array without number of elements.) -tests/value/array_zero_length.i:9:[kernel] imprecise size for variable V (Size of array without number of elements.) tests/value/array_zero_length.i:10:[value] warning: during initialization of variable 'W', size of type 'char [][0]' cannot be computed (Size of array without number of elements.) -tests/value/array_zero_length.i:10:[kernel] imprecise size for variable W (Size of array without number of elements.) [value] Initial state computed [value:initial-state] Values of globals at initialization T[0..4294967295] ∈ {0} or UNINITIALIZED diff --git a/tests/value/oracle/array_zero_length.1.res.oracle b/tests/value/oracle/array_zero_length.1.res.oracle index b881f0788f34cb7d3eaf14575dcd70724bf2aaac..a11451180ace2c2a889ba98fa35d504cb88c5761 100644 --- a/tests/value/oracle/array_zero_length.1.res.oracle +++ b/tests/value/oracle/array_zero_length.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_zero_length.i (no preprocessing) tests/value/array_zero_length.i:10:[kernel] warning: declaration of array of 'zero-length arrays' ('char [0]`); zero-length arrays are a compiler extension @@ -6,13 +5,10 @@ tests/value/array_zero_length.i:15:[kernel] warning: declaration of array of 'ze zero-length arrays are a compiler extension [value] Analyzing an incomplete application starting at main [value] Computing initial state -tests/value/array_zero_length.i:7:[kernel] imprecise size for variable T (Size of array without number of elements.) tests/value/array_zero_length.i:7:[value] warning: during initialization of variable 'T', size of type 'char []' cannot be computed (Size of array without number of elements.) -tests/value/array_zero_length.i:9:[kernel] imprecise size for variable V (Size of array without number of elements.) tests/value/array_zero_length.i:9:[value] warning: during initialization of variable 'V', size of type 'char [][2]' cannot be computed (Size of array without number of elements.) -tests/value/array_zero_length.i:10:[kernel] imprecise size for variable W (Size of array without number of elements.) tests/value/array_zero_length.i:10:[value] warning: during initialization of variable 'W', size of type 'char [][0]' cannot be computed (Size of array without number of elements.) [value] Initial state computed diff --git a/tests/value/oracle/array_zero_length.2.res.oracle b/tests/value/oracle/array_zero_length.2.res.oracle index a4fde976b35e2485970164f3a930a1507dc2a2ca..590662a75f76ba49abbafb7d498254135d160e46 100644 --- a/tests/value/oracle/array_zero_length.2.res.oracle +++ b/tests/value/oracle/array_zero_length.2.res.oracle @@ -1,7 +1,12 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/array_zero_length.i (no preprocessing) tests/value/array_zero_length.i:10:[kernel] user error: declaration of array of 'zero-length arrays' ('char [0]`); zero-length arrays are not allowed in C99 tests/value/array_zero_length.i:12:[kernel] user error: empty initializers only allowed for GCC/MSVC + 10 char W[][0]; + 11 + 12 char T1[] = {}; + ^^^^^^^^^^^^^^^ + 13 char U1[0] = {}; + 14 char V1[][2] = {}; [kernel] user error: stopping on file "tests/value/array_zero_length.i" that has errors. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/value/oracle/asm_contracts.err.oracle b/tests/value/oracle/asm_contracts.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/oracle/asm_contracts.res.oracle b/tests/value/oracle/asm_contracts.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..a259fc09d0b2f34c958929e709ac25a9b85fd8db --- /dev/null +++ b/tests/value/oracle/asm_contracts.res.oracle @@ -0,0 +1,72 @@ +[kernel] Parsing tests/value/asm_contracts.c (with preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + +[value] computing for function f1 <- main. + Called from tests/value/asm_contracts.c:38. +tests/value/asm_contracts.c:15:[value] assertion 'OK' got status valid. +tests/value/asm_contracts.c:16:[value] warning: assertion 'UNKNOWN1' got status unknown. +tests/value/asm_contracts.c:17:[value] warning: assertion 'UNKNOWN2' got status unknown. +[value] Recording results for f1 +[value] Done for function f1 +[value] computing for function f2 <- main. + Called from tests/value/asm_contracts.c:39. +tests/value/asm_contracts.c:27:[value] assertion 'OK' got status valid. +tests/value/asm_contracts.c:28:[value] warning: assertion 'UNKNOWN1' got status unknown. +[value] Recording results for f2 +[value] Done for function f2 +[value] computing for function f3 <- main. + Called from tests/value/asm_contracts.c:40. +tests/value/asm_contracts.c:33:[value] warning: assuming assembly code has no effects in function f3 +tests/value/asm_contracts.c:34:[value] assertion 'UNKNOWN' got status valid. +[value] Recording results for f3 +[value] Done for function f3 +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function f1: + src ∈ {1} + dst ∈ {2} +[value:final-states] Values at end of function f2: + dwSomeValue ∈ {42} +[value:final-states] Values at end of function f3: + x ∈ {1} +[value:final-states] Values at end of function main: + __retres ∈ {0} +[from] Computing for function f1 +[from] Done for function f1 +[from] Computing for function f2 +[from] Done for function f2 +[from] Computing for function f3 +[from] Done for function f3 +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function f1: + NO EFFECTS +[from] Function f2: + NO EFFECTS +[from] Function f3: + NO EFFECTS +[from] Function main: + \result FROM \nothing +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function f1: + src; dst +[inout] Inputs for function f1: + \nothing +[inout] Out (internal) for function f2: + dwSomeValue +[inout] Inputs for function f2: + \nothing +[inout] Out (internal) for function f3: + x +[inout] Inputs for function f3: + \nothing +[inout] Out (internal) for function main: + __retres +[inout] Inputs for function main: + \nothing diff --git a/tests/value/oracle/assert_builtin.res.oracle b/tests/value/oracle/assert_builtin.res.oracle index babd55dbe7bb3e3b2a5f6d3c1f87816539e5795f..4f891fe718546731fb6e57beafa3809bf92a7826 100644 --- a/tests/value/oracle/assert_builtin.res.oracle +++ b/tests/value/oracle/assert_builtin.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/assert_builtin.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,10 +5,10 @@ [value:initial-state] Values of globals at initialization t[0..9] ∈ {0} tests/value/assert_builtin.i:6:[value] warning: Frama_C_assert: unknown +tests/value/assert_builtin.i:6:[kernel] warning: Neither code nor specification for function Frama_C_assert, generating default assigns from the prototype [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/value/assert_builtin.i:6:[kernel] warning: Neither code nor specification for function Frama_C_assert, generating default assigns from the prototype [value:final-states] Values at end of function main: __retres ∈ {0} [from] Computing for function main diff --git a/tests/value/oracle/assert_ptr.res.oracle b/tests/value/oracle/assert_ptr.res.oracle index aabfefcc9aadafd8f36ae749638cfa6c2c8bedfc..7aa1d8267249b351ebac5ca5c3934b6b2bf642b7 100644 --- a/tests/value/oracle/assert_ptr.res.oracle +++ b/tests/value/oracle/assert_ptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/assert_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,9 +9,9 @@ a ∈ {0} r ∈ {0} tests/value/assert_ptr.i:8:[value] assertion got status valid. -[value] Called Frama_C_show_each_ptr({{ NULL ; &a }}) +tests/value/assert_ptr.i:9:[value] Frama_C_show_each_ptr: {{ NULL ; &a }} tests/value/assert_ptr.i:12:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_q({{ &a }}) +tests/value/assert_ptr.i:13:[value] Frama_C_show_each_q: {{ &a }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/assign-leaf-indirect.res.oracle b/tests/value/oracle/assign-leaf-indirect.res.oracle index 31817d15ff07ee69a89d599d15d522db0d935d06..cd563d99e41c195ccb1c71093e17e4984998ce47 100644 --- a/tests/value/oracle/assign-leaf-indirect.res.oracle +++ b/tests/value/oracle/assign-leaf-indirect.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/assign-leaf-indirect.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/assigns.res.oracle b/tests/value/oracle/assigns.res.oracle index c7e7a284a466007958566f8ff8a98cce7bedb91c..222c40788892fabb105d157f1fa429a8e05bcef5 100644 --- a/tests/value/oracle/assigns.res.oracle +++ b/tests/value/oracle/assigns.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/assigns.i (no preprocessing) tests/value/assigns.i:31:[kernel] warning: parsing obsolete ACSL construct 'logic declaration'. 'an axiomatic block' should be used instead. [value] Analyzing a complete application starting at main @@ -58,7 +57,7 @@ tests/value/assigns.i:52:[value] warning: signed overflow. assert 2 * (int)(&t3) [value] Done for function h [value] computing for function j <- main1 <- main. Called from tests/value/assigns.i:54. -tests/value/assigns.i:54:[value] Cannot evaluate range bound foo(*p) +tests/value/assigns.i:32:[value] Cannot evaluate range bound foo(*p) (unsupported ACSL construct: logic functions or predicates). Approximating [value] using specification for function j [value] Done for function j @@ -66,12 +65,12 @@ tests/value/assigns.i:54:[value] Cannot evaluate range bound foo(*p) Called from tests/value/assigns.i:56. [value] using specification for function assigns_post tests/value/assigns.i:39:[value] warning: no \from part - for clause 'assigns Tpost[\at(\old(i),Post)], Tpost[\at(k,Post)];' of - function assigns_post -tests/value/assigns.i:56:[value] warning: cannot interpret 'from' clause 'assigns \at(x,Post) \from \at(x,Post);' - of function assigns_post + for clause 'assigns Tpost[\at(\old(i),Post)], Tpost[\at(k,Post)];' +tests/value/assigns.i:56:[value] warning: cannot interpret 'from' clause 'assigns x \from \at(x,Post);' (no environment to evaluate \at(_,Post)) -tests/value/assigns.i:56:[value] warning: cannot interpret assigns Tpost[\at(k,Post)] in function assigns_post +tests/value/assigns.i:56:[value] warning: cannot interpret assigns Tpost[\at(\old(i),Post)] + (no environment to evaluate \at(_,Post)); effects will be ignored +tests/value/assigns.i:56:[value] warning: cannot interpret assigns Tpost[\at(k,Post)] (no environment to evaluate \at(_,Post)); effects will be ignored [value] Done for function assigns_post [value] Recording results for main1 @@ -86,7 +85,7 @@ tests/value/assigns.i:60:[value] warning: no 'assigns \result \from ...' clause [value] computing for function ff3 <- main2 <- main. Called from tests/value/assigns.i:78. [value] using specification for function ff3 -tests/value/assigns.i:68:[value] warning: no \from part for clause 'assigns y1, y3;' of function ff3 +tests/value/assigns.i:68:[value] warning: no \from part for clause 'assigns y1, y3;' [value] Done for function ff3 [value] computing for function ff4 <- main2 <- main. Called from tests/value/assigns.i:79. @@ -136,9 +135,7 @@ tests/value/assigns.i:105:[kernel] more than 200(1000) locations to update in ar [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main1: T[0..99] ∈ [--..--] - Tpost[0..17] ∈ {0} - [18] ∈ [--..--] - [19..99] ∈ {0} + Tpost[0..99] ∈ {0} t[0].f1 ∈ {0} {[0].f2; [1..5]} ∈ [--..--] [6..9] ∈ {0} @@ -358,9 +355,7 @@ tests/value/assigns.i:105:[kernel] more than 200(1000) locations to update in ar [99].f2 ∈ {0} [value:final-states] Values at end of function main: T[0..99] ∈ [--..--] - Tpost[0..17] ∈ {0} - [18] ∈ [--..--] - [19..99] ∈ {0} + Tpost[0..99] ∈ {0} t[0].f1 ∈ {0} {[0].f2; [1..5]} ∈ [--..--] [6..9] ∈ {0} @@ -587,6 +582,7 @@ tests/value/assigns.i:105:[kernel] more than 200(1000) locations to update in ar [from] Computing for function j <-main1 [from] Done for function j [from] Computing for function assigns_post <-main1 +tests/value/assigns.i:56:[value] warning: Failed to interpret inputs in assigns clause 'assigns x \from \at(x,Post);'no environment to evaluate \at(_,Post) [from] Done for function assigns_post [from] Done for function main1 [from] Computing for function main2 @@ -621,7 +617,7 @@ tests/value/assigns.i:105:[kernel] more than 200(1000) dependencies to update. A T[0..99] FROM T[0..99] (and SELF) [from] Function assigns_post: Tpost{[18]; [53]} FROM ANYTHING(origin:Unknown) (and SELF) - x FROM x (and SELF) + x FROM ANYTHING(origin:Unknown) (and SELF) [from] Function f: t{[0].f2; [1..5]} FROM t{[1..5]; [6].f1} (and SELF) [from] Function f_main4_1: @@ -686,7 +682,7 @@ tests/value/assigns.i:105:[kernel] more than 200(1000) dependencies to update. A t{[0].f2; [1..5]} FROM t{[1..5]; [6].f1} (and SELF) t2[0..99999] FROM \nothing (and SELF) t3[0..99999] FROM \nothing (and SELF) - x FROM x (and SELF) + x FROM ANYTHING(origin:Unknown) (and SELF) [from] Function main2: y1 FROM ANYTHING(origin:Unknown) (and SELF) y2 FROM y2 (and SELF) @@ -722,7 +718,7 @@ tests/value/assigns.i:105:[kernel] more than 200(1000) dependencies to update. A t{[0].f2; [1..5]} FROM t{[1..5]; [6].f1} (and SELF) t2[0..99999] FROM \nothing (and SELF) t3[0..99999] FROM \nothing (and SELF) - x FROM x (and SELF) + x FROM ANYTHING(origin:Unknown) (and SELF) y1 FROM ANYTHING(origin:Unknown) (and SELF) y2 FROM y2 (and SELF) y3 FROM ANYTHING(origin:Unknown) (and SELF) @@ -894,8 +890,8 @@ void j(int *p); int x; int k = 53; -/*@ assigns \at(x,Post), Tpost[\at(\old(i),Post)], Tpost[\at(k,Post)]; - assigns \at(x,Post) \from \at(x,Post); +/*@ assigns x, Tpost[\at(\old(i),Post)], Tpost[\at(k,Post)]; + assigns x \from \at(x,Post); */ void assigns_post(int i); @@ -903,8 +899,7 @@ void main1(void) { F1(T); { - int i; - i = 0; + int i = 0; while (i <= 5) { f((char *)(& t[i].f2)); i ++; @@ -948,15 +943,12 @@ int ff5(); int main2(void) { int __retres; - int l; - int *p; - int *q; - l = ff1(); + int l = ff1(); ff3(); ff4(); ff5(); - p = ff2(); - q = ff2_bis(); + int *p = ff2(); + int *q = ff2_bis(); /*@ assert Value: ptr_comparison: \pointer_comparable((void *)p, (void *)(&x)); */ diff --git a/tests/value/oracle/assigns_from.res.oracle b/tests/value/oracle/assigns_from.res.oracle index 7a6cf47388369e21e4effc15bb16ac533e72906b..13216e1d6675d2da446717fb8494dc9e5dcc7bce 100644 --- a/tests/value/oracle/assigns_from.res.oracle +++ b/tests/value/oracle/assigns_from.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/assigns_from.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,7 +12,7 @@ p_t ∈ {{ &t[0] }} t17[0..9] ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/assigns_from.i:203. + Called from tests/value/assigns_from.i:224. [value] computing for function f <- main1 <- main. Called from tests/value/assigns_from.i:30. [value] Recording results for f @@ -35,7 +34,7 @@ tests/value/assigns_from.i:23:[value] function main1, behavior wrong: \from ... tests/value/assigns_from.i:24:[value] warning: function main1, behavior wrong: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main1 [value] computing for function main15 <- main. - Called from tests/value/assigns_from.i:204. + Called from tests/value/assigns_from.i:225. [value] Recording results for main15 [from] Computing for function main15 [from] Done for function main15 @@ -45,7 +44,7 @@ tests/value/assigns_from.i:37:[value] function main15: \from ... part in assign tests/value/assigns_from.i:37:[value] function main15: \from ... part in assign clause got status valid. [value] Done for function main15 [value] computing for function main2 <- main. - Called from tests/value/assigns_from.i:205. + Called from tests/value/assigns_from.i:226. [value] Recording results for main2 [from] Computing for function main2 [from] Done for function main2 @@ -61,11 +60,11 @@ tests/value/assigns_from.i:60:[value] function main2, behavior wrongfrom: assign tests/value/assigns_from.i:60:[value] warning: function main2, behavior wrongfrom: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main2 [value] computing for function Frama_C_interval <- main. - Called from tests/value/assigns_from.i:206. + Called from tests/value/assigns_from.i:227. [value] using specification for function Frama_C_interval [value] Done for function Frama_C_interval [value] computing for function main3 <- main. - Called from tests/value/assigns_from.i:207. + Called from tests/value/assigns_from.i:228. [value] Recording results for main3 [from] Computing for function main3 [from] Done for function main3 @@ -73,14 +72,14 @@ tests/value/assigns_from.i:67:[value] function main3: assigns got status valid. tests/value/assigns_from.i:67:[value] function main3: \from ... part in assign clause got status valid. [value] Done for function main3 [value] computing for function main3 <- main. - Called from tests/value/assigns_from.i:208. + Called from tests/value/assigns_from.i:229. [value] Recording results for main3 [from] Computing for function main3 [from] Done for function main3 tests/value/assigns_from.i:67:[value] warning: function main3: assigns got status unknown. [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/assigns_from.i:209. + Called from tests/value/assigns_from.i:230. [value] Recording results for main4 [from] Computing for function main4 [from] Done for function main4 @@ -90,7 +89,7 @@ tests/value/assigns_from.i:82:[value] function main4, behavior wrong: assigns go tests/value/assigns_from.i:82:[value] warning: function main4, behavior wrong: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/assigns_from.i:210. + Called from tests/value/assigns_from.i:231. [value] Recording results for main5 [from] Computing for function main5 [from] Done for function main5 @@ -100,27 +99,27 @@ tests/value/assigns_from.i:95:[value] function main5, behavior true: assigns got tests/value/assigns_from.i:95:[value] function main5, behavior true: \from ... part in assign clause got status valid. [value] Done for function main5 [value] computing for function Frama_C_interval <- main. - Called from tests/value/assigns_from.i:211. + Called from tests/value/assigns_from.i:232. [value] Done for function Frama_C_interval [value] computing for function Frama_C_interval <- main. - Called from tests/value/assigns_from.i:212. + Called from tests/value/assigns_from.i:233. [value] Done for function Frama_C_interval [value] computing for function main6_right <- main. - Called from tests/value/assigns_from.i:213. + Called from tests/value/assigns_from.i:234. [value] Recording results for main6_right [from] Computing for function main6_right [from] Done for function main6_right tests/value/assigns_from.i:111:[value] function main6_right: assigns got status valid. [value] Done for function main6_right [value] computing for function main6_wrong <- main. - Called from tests/value/assigns_from.i:214. + Called from tests/value/assigns_from.i:235. [value] Recording results for main6_wrong [from] Computing for function main6_wrong [from] Done for function main6_wrong tests/value/assigns_from.i:102:[value] warning: function main6_wrong: assigns got status unknown. [value] Done for function main6_wrong [value] computing for function main7 <- main. - Called from tests/value/assigns_from.i:215. + Called from tests/value/assigns_from.i:236. [value] Recording results for main7 [from] Computing for function main7 [from] Done for function main7 @@ -128,7 +127,7 @@ tests/value/assigns_from.i:119:[value] function main7, behavior right: assigns g tests/value/assigns_from.i:122:[value] warning: function main7, behavior wrong: assigns got status unknown. [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/assigns_from.i:218. + Called from tests/value/assigns_from.i:239. [value] Recording results for main8 [from] Computing for function main8 [from] Done for function main8 @@ -136,14 +135,14 @@ tests/value/assigns_from.i:130:[value] function main8: assigns got status valid. tests/value/assigns_from.i:130:[value] function main8: \from ... part in assign clause got status valid. [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/assigns_from.i:220. + Called from tests/value/assigns_from.i:241. [value] Recording results for main8 [from] Computing for function main8 [from] Done for function main8 tests/value/assigns_from.i:130:[value] warning: function main8: assigns got status unknown. [value] Done for function main8 [value] computing for function main9 <- main. - Called from tests/value/assigns_from.i:222. + Called from tests/value/assigns_from.i:243. [value] Recording results for main9 [from] Computing for function main9 [from] Done for function main9 @@ -151,7 +150,7 @@ tests/value/assigns_from.i:141:[kernel] warning: using size of 'void' tests/value/assigns_from.i:135:[value] function main9: assigns got status valid. [value] Done for function main9 [value] computing for function main10 <- main. - Called from tests/value/assigns_from.i:223. + Called from tests/value/assigns_from.i:244. tests/value/assigns_from.i:152:[value] entering loop for the first time [value] computing for function c <- main10 <- main. Called from tests/value/assigns_from.i:152. @@ -176,7 +175,7 @@ tests/value/assigns_from.i:154:[value] warning: assertion got status unknown. [from] Done for function main10 [value] Done for function main10 [value] computing for function main11 <- main. - Called from tests/value/assigns_from.i:224. + Called from tests/value/assigns_from.i:245. [value] Recording results for main11 [from] Computing for function main11 [from] Done for function main11 @@ -184,7 +183,7 @@ tests/value/assigns_from.i:157:[value] function main11: assigns got status valid tests/value/assigns_from.i:157:[value] function main11: \from ... part in assign clause got status valid. [value] Done for function main11 [value] computing for function main11 <- main. - Called from tests/value/assigns_from.i:225. + Called from tests/value/assigns_from.i:246. [value] Recording results for main11 [from] Computing for function main11 [from] Done for function main11 @@ -192,16 +191,16 @@ tests/value/assigns_from.i:157:[value] warning: function main11: assigns got sta tests/value/assigns_from.i:157:[value] warning: function main11: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main11 [value] computing for function Frama_C_interval <- main. - Called from tests/value/assigns_from.i:226. + Called from tests/value/assigns_from.i:247. [value] Done for function Frama_C_interval [value] computing for function main11 <- main. - Called from tests/value/assigns_from.i:226. + Called from tests/value/assigns_from.i:247. [value] Recording results for main11 [from] Computing for function main11 [from] Done for function main11 [value] Done for function main11 [value] computing for function main12 <- main. - Called from tests/value/assigns_from.i:227. + Called from tests/value/assigns_from.i:248. [value] Recording results for main12 [from] Computing for function main12 [from] Done for function main12 @@ -209,7 +208,7 @@ tests/value/assigns_from.i:169:[value] function main12, behavior ok: assigns got tests/value/assigns_from.i:167:[value] function main12, behavior ok: \from ... part in assign clause got status valid. [value] Done for function main12 [value] computing for function main13 <- main. - Called from tests/value/assigns_from.i:228. + Called from tests/value/assigns_from.i:249. [value] Recording results for main13 [from] Computing for function main13 [from] Done for function main13 @@ -219,7 +218,7 @@ tests/value/assigns_from.i:179:[value] function main13, behavior bad: assigns go tests/value/assigns_from.i:177:[value] warning: function main13, behavior bad: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main13 [value] computing for function main14 <- main. - Called from tests/value/assigns_from.i:229. + Called from tests/value/assigns_from.i:250. tests/value/assigns_from.i:183:[value] entering loop for the first time [value] Recording results for main14 [from] Computing for function main14 @@ -228,7 +227,7 @@ tests/value/assigns_from.i:181:[value] function main14: assigns got status valid tests/value/assigns_from.i:181:[value] warning: function main14: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main14 [value] computing for function main16 <- main. - Called from tests/value/assigns_from.i:230. + Called from tests/value/assigns_from.i:251. tests/value/assigns_from.i:188:[value] entering loop for the first time [value] Recording results for main16 [from] Computing for function main16 @@ -237,7 +236,7 @@ tests/value/assigns_from.i:186:[value] function main16: assigns got status valid tests/value/assigns_from.i:186:[value] warning: function main16: \from ... part in assign clause got status unknown (cannot validate direct dependencies). [value] Done for function main16 [value] computing for function main17 <- main. - Called from tests/value/assigns_from.i:231. + Called from tests/value/assigns_from.i:252. tests/value/assigns_from.i:195:[value] entering loop for the first time [value] Recording results for main17 [from] Computing for function main17 @@ -245,6 +244,16 @@ tests/value/assigns_from.i:195:[value] entering loop for the first time tests/value/assigns_from.i:193:[value] function main17: assigns got status valid. tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part in assign clause got status unknown (cannot validate direct and indirect dependencies). [value] Done for function main17 +[value] computing for function main18 <- main. + Called from tests/value/assigns_from.i:253. +[value] computing for function f18 <- main18 <- main. + Called from tests/value/assigns_from.i:215. +[value] using specification for function f18 +[value] Done for function f18 +[value] Recording results for main18 +[from] Computing for function main18 +[from] Done for function main18 +[value] Done for function main18 [value] Recording results for main [from] Computing for function main [from] Done for function main @@ -308,6 +317,21 @@ tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part [9][bits 0 to 7] ∈ [0..9] [9][bits 8 to 31] ∈ {0} j ∈ [10..2147483647] +[value:final-states] Values at end of function main18: + base_a ∈ {17} + a_0.addr ∈ + {{ garbled mix of &{base_a; base_b} + (origin: Misaligned {tests/value/assigns_from.i:215}) }} + .i ∈ + {{ garbled mix of &{base_a; base_b} + (origin: Misaligned {tests/value/assigns_from.i:215}) }} or UNINITIALIZED + base_b ∈ {11} + b.addr ∈ + {{ garbled mix of &{base_a; base_b} + (origin: Misaligned {tests/value/assigns_from.i:215}) }} + .i ∈ + {{ garbled mix of &{base_a; base_b} + (origin: Misaligned {tests/value/assigns_from.i:215}) }} or UNINITIALIZED [value:final-states] Values at end of function main2: a[0..2] ∈ {0} [3] ∈ {2} @@ -416,6 +440,10 @@ tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part [from] Done for function main16 [from] Computing for function main17 [from] Done for function main17 +[from] Computing for function main18 +[from] Computing for function f18 <-main18 +[from] Done for function f18 +[from] Done for function main18 [from] Computing for function main2 [from] Done for function main2 [from] Computing for function main3 @@ -446,6 +474,9 @@ tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part \result FROM \nothing [from] Function f: k FROM u +[from] Function f18: + a_0 FROM a_0; b (and SELF) + b FROM a_0; b (and SELF) [from] Function main1: u FROM v k FROM \nothing @@ -468,6 +499,8 @@ tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part [4][bits 0 to 7]; [5][bits 0 to 7]; [6][bits 0 to 7]; [7][bits 0 to 7]; [8][bits 0 to 7]; [9][bits 0 to 7]} FROM p; i (and SELF) +[from] Function main18: + NO EFFECTS [from] Function main2: a[3..5] FROM \nothing [from] Function main3: @@ -504,63 +537,68 @@ tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part k FROM u [from] call to c at tests/value/assigns_from.i:152 (by main10): \result FROM \nothing -[from] call to main1 at tests/value/assigns_from.i:203 (by main): +[from] call to f18 at tests/value/assigns_from.i:215 (by main18): + a_0 FROM a_0; b (and SELF) + b FROM a_0; b (and SELF) +[from] call to main1 at tests/value/assigns_from.i:224 (by main): u FROM v k FROM \nothing -[from] call to main15 at tests/value/assigns_from.i:204 (by main): +[from] call to main15 at tests/value/assigns_from.i:225 (by main): a[3..5] FROM \nothing -[from] call to main2 at tests/value/assigns_from.i:205 (by main): +[from] call to main2 at tests/value/assigns_from.i:226 (by main): a[3..5] FROM \nothing -[from] call to Frama_C_interval at tests/value/assigns_from.i:206 (by main): +[from] call to Frama_C_interval at tests/value/assigns_from.i:227 (by main): \result FROM a; b -[from] call to main3 at tests/value/assigns_from.i:207 (by main): +[from] call to main3 at tests/value/assigns_from.i:228 (by main): a[6] FROM i -[from] call to main3 at tests/value/assigns_from.i:208 (by main): +[from] call to main3 at tests/value/assigns_from.i:229 (by main): a[0..9] FROM i (and SELF) -[from] call to main4 at tests/value/assigns_from.i:209 (by main): +[from] call to main4 at tests/value/assigns_from.i:230 (by main): a[2] FROM \nothing -[from] call to main5 at tests/value/assigns_from.i:210 (by main): +[from] call to main5 at tests/value/assigns_from.i:231 (by main): a[2] FROM a[4] -[from] call to Frama_C_interval at tests/value/assigns_from.i:211 (by main): +[from] call to Frama_C_interval at tests/value/assigns_from.i:232 (by main): \result FROM a; b -[from] call to Frama_C_interval at tests/value/assigns_from.i:212 (by main): +[from] call to Frama_C_interval at tests/value/assigns_from.i:233 (by main): \result FROM a; b -[from] call to main6_right at tests/value/assigns_from.i:213 (by main): +[from] call to main6_right at tests/value/assigns_from.i:234 (by main): a[3..5] FROM \nothing -[from] call to main6_wrong at tests/value/assigns_from.i:214 (by main): +[from] call to main6_wrong at tests/value/assigns_from.i:235 (by main): a[2..6] FROM \nothing -[from] call to main7 at tests/value/assigns_from.i:215 (by main): +[from] call to main7 at tests/value/assigns_from.i:236 (by main): a{[2]; [7..8]} FROM \nothing -[from] call to main8 at tests/value/assigns_from.i:218 (by main): +[from] call to main8 at tests/value/assigns_from.i:239 (by main): c_0 FROM p -[from] call to main8 at tests/value/assigns_from.i:220 (by main): +[from] call to main8 at tests/value/assigns_from.i:241 (by main): c_0 FROM p (and SELF) d FROM p (and SELF) -[from] call to main9 at tests/value/assigns_from.i:222 (by main): +[from] call to main9 at tests/value/assigns_from.i:243 (by main): NO EFFECTS -[from] call to main10 at tests/value/assigns_from.i:223 (by main): +[from] call to main10 at tests/value/assigns_from.i:244 (by main): NO EFFECTS -[from] call to main11 at tests/value/assigns_from.i:224 (by main): +[from] call to main11 at tests/value/assigns_from.i:245 (by main): a[2] FROM \nothing -[from] call to main11 at tests/value/assigns_from.i:225 (by main): +[from] call to main11 at tests/value/assigns_from.i:246 (by main): a[2] FROM \nothing -[from] call to main11 at tests/value/assigns_from.i:226 (by main): +[from] call to main11 at tests/value/assigns_from.i:247 (by main): a[2] FROM \nothing -[from] call to Frama_C_interval at tests/value/assigns_from.i:226 (by main): +[from] call to Frama_C_interval at tests/value/assigns_from.i:247 (by main): \result FROM a; b -[from] call to main12 at tests/value/assigns_from.i:227 (by main): +[from] call to main12 at tests/value/assigns_from.i:248 (by main): \result FROM \nothing -[from] call to main13 at tests/value/assigns_from.i:228 (by main): +[from] call to main13 at tests/value/assigns_from.i:249 (by main): \result FROM p_t -[from] call to main14 at tests/value/assigns_from.i:229 (by main): +[from] call to main14 at tests/value/assigns_from.i:250 (by main): t[2..38] FROM \nothing (and SELF) -[from] call to main16 at tests/value/assigns_from.i:230 (by main): +[from] call to main16 at tests/value/assigns_from.i:251 (by main): t[1..19] FROM \nothing (and SELF) -[from] call to main17 at tests/value/assigns_from.i:231 (by main): +[from] call to main17 at tests/value/assigns_from.i:252 (by main): t17{[0][bits 0 to 7]; [1][bits 0 to 7]; [2][bits 0 to 7]; [3][bits 0 to 7]; [4][bits 0 to 7]; [5][bits 0 to 7]; [6][bits 0 to 7]; [7][bits 0 to 7]; [8][bits 0 to 7]; [9][bits 0 to 7]} FROM p; i (and SELF) +[from] call to main18 at tests/value/assigns_from.i:253 (by main): + NO EFFECTS [from] entry point: u FROM v k FROM \nothing @@ -615,6 +653,10 @@ tests/value/assigns_from.i:193:[value] warning: function main17: \from ... part [8][bits 0 to 7]; [9][bits 0 to 7]}; j [inout] Inputs for function main17: \nothing +[inout] Out (internal) for function main18: + base_a; a_0; base_b; b +[inout] Inputs for function main18: + \nothing [inout] Out (internal) for function main2: a[3..5] [inout] Inputs for function main2: diff --git a/tests/value/oracle/assigns_from_direct.res.oracle b/tests/value/oracle/assigns_from_direct.res.oracle index c4133b5029de69d36ce11e3f7dc337bd7d9fef87..c602ea86d99268617f7ab27f8d32a08f3ac6c1f6 100644 --- a/tests/value/oracle/assigns_from_direct.res.oracle +++ b/tests/value/oracle/assigns_from_direct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/assigns_from_direct.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/attribute-aligned.res.oracle b/tests/value/oracle/attribute-aligned.res.oracle index 2c16c28198ceafac3b67376718134ac79b91a037..8c0bb7f723d369717f56848808ba62c1327e50c0 100644 --- a/tests/value/oracle/attribute-aligned.res.oracle +++ b/tests/value/oracle/attribute-aligned.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/attribute-aligned.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/automalloc.res.oracle b/tests/value/oracle/automalloc.res.oracle index 2bd8cc1a5f267cec68e228d064fd2a8c7efa85f7..56a84d1ac7d4c9c955b1a698e4bf68e14156e203 100644 --- a/tests/value/oracle/automalloc.res.oracle +++ b/tests/value/oracle/automalloc.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/automalloc.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,16 +5,16 @@ [value:initial-state] Values of globals at initialization [value] computing for function malloc <- main. - Called from tests/value/automalloc.i:11. -tests/value/automalloc.i:11:[kernel] warning: No code nor implicit assigns clause for function malloc, generating default assigns from the prototype + Called from tests/value/automalloc.i:14. +tests/value/automalloc.i:14:[kernel] warning: No code nor implicit assigns clause for function malloc, generating default assigns from the prototype [value] using specification for function malloc [value] Done for function malloc [value] computing for function realloc <- main. - Called from tests/value/automalloc.i:12. -tests/value/automalloc.i:12:[kernel] warning: Neither code nor specification for function realloc, generating default assigns from the prototype + Called from tests/value/automalloc.i:15. +tests/value/automalloc.i:15:[kernel] warning: Neither code nor specification for function realloc, generating default assigns from the prototype [value] using specification for function realloc [value] Done for function realloc -tests/value/automalloc.i:14:[value] warning: out of bounds write. assert \valid(buf + 1); +tests/value/automalloc.i:17:[value] warning: out of bounds write. assert \valid(buf + 1); [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -27,11 +26,11 @@ tests/value/automalloc.i:14:[value] warning: out of bounds write. assert \valid( alloced_return_malloc[bits 0 to ..] ∈ {{ garbled mix of &{alloced_return_malloc} (origin: Library function - {tests/value/automalloc.i:11}) }} + {tests/value/automalloc.i:14}) }} alloced_return_realloc[bits 0 to ..] ∈ {{ garbled mix of &{alloced_return_realloc} (origin: Library function - {tests/value/automalloc.i:12}) }} + {tests/value/automalloc.i:15}) }} [from] Computing for function main [from] Computing for function malloc <-main [from] Done for function malloc diff --git a/tests/value/oracle/backward_add_ptr.res.oracle b/tests/value/oracle/backward_add_ptr.res.oracle index e402c89f900760189419dc9f101b37139c6ce820..86774e83f553154b6c2361e2bc31e9f86089bfbf 100644 --- a/tests/value/oracle/backward_add_ptr.res.oracle +++ b/tests/value/oracle/backward_add_ptr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/backward_add_ptr.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,27 +7,25 @@ [value] computing for function main1 <- main. Called from tests/value/backward_add_ptr.c:185. tests/value/backward_add_ptr.c:25:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)q); -[value] Called Frama_C_show_each_only_a({0; 1}, {{ &a }}, {0}) +tests/value/backward_add_ptr.c:26:[value] Frama_C_show_each_only_a: {0; 1}, {{ &a }}, {0} tests/value/backward_add_ptr.c:32:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -[value] Called Frama_C_show_each_reduced_offset({0; 1}, - {{ NULL + {0; 1; 2; 3} ; &a }}, - {{ NULL + {0; 1; 2; 3} ; &b }}) +tests/value/backward_add_ptr.c:33:[value] Frama_C_show_each_reduced_offset: + {0; 1}, {{ NULL + {0; 1; 2; 3} ; &a }}, {{ NULL + {0; 1; 2; 3} ; &b }} tests/value/backward_add_ptr.c:38:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)((unsigned int)q / 4)); -[value] Called Frama_C_show_each_no_reduction({0; 1}, - {{ NULL + [0..4294967295] ; &a }}, - {{ NULL + [0..4294967295] ; &b }}) +tests/value/backward_add_ptr.c:39:[value] Frama_C_show_each_no_reduction: + {0; 1}, {{ NULL + [0..4294967295] ; &a }}, {{ NULL + [0..4294967295] ; &b }} [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/backward_add_ptr.c:186. tests/value/backward_add_ptr.c:54:[value] warning: out of bounds read. assert \valid_read((int *)((char *)p + (unsigned int)q)); -[value] Called Frama_C_show_each_int_if({{ &a }}, {0}) -[value] Called Frama_C_show_each_int_else({0}, {{ &b }}) +tests/value/backward_add_ptr.c:55:[value] Frama_C_show_each_int_if: {{ &a }}, {0} +tests/value/backward_add_ptr.c:57:[value] Frama_C_show_each_int_else: {0}, {{ &b }} tests/value/backward_add_ptr.c:60:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -[value] Called Frama_C_show_each_char_if({{ NULL + {1; 2; 3} ; &a }}, - {{ NULL + {0; 1; 2; 3} ; &b }}) -[value] Called Frama_C_show_each_char_else({0}, {{ &b }}) +tests/value/backward_add_ptr.c:61:[value] Frama_C_show_each_char_if: + {{ NULL + {1; 2; 3} ; &a }}, {{ NULL + {0; 1; 2; 3} ; &b }} +tests/value/backward_add_ptr.c:63:[value] Frama_C_show_each_char_else: {0}, {{ &b }} [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. @@ -47,12 +44,12 @@ tests/value/backward_add_ptr.c:75:[value] Assigning imprecise value to p. The imprecision originates from Arithmetic {tests/value/backward_add_ptr.c:68} tests/value/backward_add_ptr.c:81:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)q); -[value] Called Frama_C_show_each_GM_only_a({{ &a + [-17179869180..0],0%4 }}, - [0..4294967295]) +tests/value/backward_add_ptr.c:82:[value] Frama_C_show_each_GM_only_a: + {{ &a + [-17179869180..0],0%4 }}, [0..4294967295] tests/value/backward_add_ptr.c:87:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -[value] Called Frama_C_show_each_GM_reduce_p_offset({{ NULL + {0; 1; 2; 3} ; - &a + [-4294967295..3] }}, - {{ NULL + [0..4294967295] ; &b }}) +tests/value/backward_add_ptr.c:88:[value] Frama_C_show_each_GM_reduce_p_offset: + {{ NULL + {0; 1; 2; 3} ; &a + [-4294967295..3] }}, + {{ NULL + [0..4294967295] ; &b }} [value] computing for function gm <- main3 <- main. Called from tests/value/backward_add_ptr.c:91. [value] Recording results for gm @@ -69,13 +66,10 @@ tests/value/backward_add_ptr.c:100:[value] Assigning imprecise value to p. The imprecision originates from Arithmetic {tests/value/backward_add_ptr.c:68} tests/value/backward_add_ptr.c:106:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)q); -tests/value/backward_add_ptr.c:107:[value] Reading left-value p. - It contains a garbled mix of {a; b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_GM_no_reduction({{ garbled mix of &{a; b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - {{ NULL + [0..4294967295] ; &b }}) +tests/value/backward_add_ptr.c:107:[value] Frama_C_show_each_GM_no_reduction: + {{ garbled mix of &{a; b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + {{ NULL + [0..4294967295] ; &b }} [value] computing for function gm <- main3 <- main. Called from tests/value/backward_add_ptr.c:110. [value] Recording results for gm @@ -84,10 +78,10 @@ tests/value/backward_add_ptr.c:110:[value] Assigning imprecise value to p. The imprecision originates from Arithmetic {tests/value/backward_add_ptr.c:68} tests/value/backward_add_ptr.c:115:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -[value] Called Frama_C_show_each_GM_only_c({0}, {{ &c }}) +tests/value/backward_add_ptr.c:116:[value] Frama_C_show_each_GM_only_c: {0}, {{ &c }} tests/value/backward_add_ptr.c:121:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)q); -[value] Called Frama_C_show_each_GM_only_b({{ &b + [-17179869180..0],0%4 }}, - [0..4294967295]) +tests/value/backward_add_ptr.c:122:[value] Frama_C_show_each_GM_only_b: + {{ &b + [-17179869180..0],0%4 }}, [0..4294967295] [value] computing for function gm <- main3 <- main. Called from tests/value/backward_add_ptr.c:125. [value] Recording results for gm @@ -97,13 +91,10 @@ tests/value/backward_add_ptr.c:125:[value] Assigning imprecise value to p. {tests/value/backward_add_ptr.c:68} tests/value/backward_add_ptr.c:130:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); tests/value/backward_add_ptr.c:136:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -tests/value/backward_add_ptr.c:137:[value] Reading left-value p. - It contains a garbled mix of {b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_GM_only_b_and_gm({{ garbled mix of &{b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - {{ NULL + [0..4294967295] ; &b }}) +tests/value/backward_add_ptr.c:137:[value] Frama_C_show_each_GM_only_b_and_gm: + {{ garbled mix of &{b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + {{ NULL + [0..4294967295] ; &b }} [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. @@ -126,26 +117,16 @@ tests/value/backward_add_ptr.c:146:[value] Assigning imprecise value to q. The imprecision originates from Arithmetic {tests/value/backward_add_ptr.c:68} tests/value/backward_add_ptr.c:150:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)q); -tests/value/backward_add_ptr.c:151:[value] Reading left-value q. - It contains a garbled mix of {c} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -tests/value/backward_add_ptr.c:151:[value] Reading left-value p. - It contains a garbled mix of {a; b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_2GM_no_reduction({{ garbled mix of &{a; b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - {{ garbled mix of &{c} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}) +tests/value/backward_add_ptr.c:151:[value] Frama_C_show_each_2GM_no_reduction: + {{ garbled mix of &{a; b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + {{ garbled mix of &{c} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }} tests/value/backward_add_ptr.c:156:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -tests/value/backward_add_ptr.c:157:[value] Reading left-value p. - It contains a garbled mix of {b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_2GM_only_b({{ garbled mix of &{b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - [0..4294967295]) +tests/value/backward_add_ptr.c:157:[value] Frama_C_show_each_2GM_only_b: + {{ garbled mix of &{b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + [0..4294967295] [value] computing for function gm <- main4 <- main. Called from tests/value/backward_add_ptr.c:160. [value] Recording results for gm @@ -161,44 +142,23 @@ tests/value/backward_add_ptr.c:161:[value] Assigning imprecise value to q. The imprecision originates from Arithmetic {tests/value/backward_add_ptr.c:68} tests/value/backward_add_ptr.c:165:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -tests/value/backward_add_ptr.c:166:[value] Reading left-value q. - It contains a garbled mix of {b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -tests/value/backward_add_ptr.c:166:[value] Reading left-value p. - It contains a garbled mix of {b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_2GM_TEST({{ garbled mix of &{b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - {{ garbled mix of &{b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}) +tests/value/backward_add_ptr.c:166:[value] Frama_C_show_each_2GM_TEST: + {{ garbled mix of &{b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + {{ garbled mix of &{b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }} tests/value/backward_add_ptr.c:171:[value] warning: out of bounds read. assert \valid_read(p + (unsigned int)q); -tests/value/backward_add_ptr.c:172:[value] Reading left-value q. - It contains a garbled mix of {b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -tests/value/backward_add_ptr.c:172:[value] Reading left-value p. - It contains a garbled mix of {a; b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_2GM_gm_of_a_b({{ garbled mix of &{a; b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - {{ garbled mix of &{b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}) +tests/value/backward_add_ptr.c:172:[value] Frama_C_show_each_2GM_gm_of_a_b: + {{ garbled mix of &{a; b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + {{ garbled mix of &{b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }} tests/value/backward_add_ptr.c:177:[value] warning: out of bounds read. assert \valid_read((char *)p + (unsigned int)q); -tests/value/backward_add_ptr.c:178:[value] Reading left-value q. - It contains a garbled mix of {b; c} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -tests/value/backward_add_ptr.c:178:[value] Reading left-value p. - It contains a garbled mix of {b} because of Arithmetic - {tests/value/backward_add_ptr.c:68}. -[value] Called Frama_C_show_each_2GM_gm_of_b_c({{ garbled mix of &{b} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}, - {{ garbled mix of &{b; c} - (origin: Arithmetic - {tests/value/backward_add_ptr.c:68}) }}) +tests/value/backward_add_ptr.c:178:[value] Frama_C_show_each_2GM_gm_of_b_c: + {{ garbled mix of &{b} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }}, + {{ garbled mix of &{b; c} + (origin: Arithmetic {tests/value/backward_add_ptr.c:68}) }} [value] Recording results for main4 [value] Done for function main4 [value] Recording results for main diff --git a/tests/value/oracle/bad_loop.res.oracle b/tests/value/oracle/bad_loop.res.oracle index a72c3b1d872b8bcea382f7a0fa282caa5dfc2498..0293503bb38b79a2e349c87eccaa038de214cde3 100644 --- a/tests/value/oracle/bad_loop.res.oracle +++ b/tests/value/oracle/bad_loop.res.oracle @@ -1,10 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bad_loop.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization c ∈ [--..--] +tests/value/bad_loop.i:3:[value] warning: initialization of volatile variable d ignored +tests/value/bad_loop.i:3:[value] warning: initialization of volatile variable e ignored tests/value/bad_loop.i:6:[value] entering loop for the first time tests/value/bad_loop.i:12:[value] entering loop for the first time [value] Recording results for main diff --git a/tests/value/oracle/base_addr_offset_block_length.res.oracle b/tests/value/oracle/base_addr_offset_block_length.res.oracle index 6a63d1bfcab9345369a7c7dec98cb5e386570817..17917e3f976bb29d223213499299297d30b159ce 100644 --- a/tests/value/oracle/base_addr_offset_block_length.res.oracle +++ b/tests/value/oracle/base_addr_offset_block_length.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/base_addr_offset_block_length.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/behavior_statuses.0.res.oracle b/tests/value/oracle/behavior_statuses.0.res.oracle index 952ca59ff9386f51ec505fd98d6e1f9de604c591..abab13c4b08e8ce0bfb29f0af996748236cd4ceb 100644 --- a/tests/value/oracle/behavior_statuses.0.res.oracle +++ b/tests/value/oracle/behavior_statuses.0.res.oracle @@ -1,26 +1,16 @@ [kernel] computing the AST [kernel] parsing -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing ./share/libc/__fc_builtin_for_normalization.i to Cabs -[kernel] Parsing ./share/libc/__fc_builtin_for_normalization.i -[kernel] Converting ./share/libc/__fc_builtin_for_normalization.i from Cabs to CIL [kernel] Parsing tests/value/behavior_statuses.i (no preprocessing) [kernel] Parsing tests/value/behavior_statuses.i to Cabs [kernel] Parsing tests/value/behavior_statuses.i [kernel] Converting tests/value/behavior_statuses.i from Cabs to CIL [kernel] cleaning unused parts [kernel] symbolic link -[kernel] Pre-merging (0) ./share/libc/__fc_builtin_for_normalization.i -[kernel] Pre-merging (1) tests/value/behavior_statuses.i -[kernel] Final merging phase: ./share/libc/__fc_builtin_for_normalization.i +[kernel] Pre-merging (0) tests/value/behavior_statuses.i [kernel] Final merging phase: tests/value/behavior_statuses.i [kernel] preparing the AST [kernel] First check done [kernel] register globals done -[kernel:property_status] Frama-C kernel emits status unknown for property default behavior - under 3 hypothesis -[kernel:property_status] Frama-C kernel emits status unknown for property default behavior - under 3 hypothesis [kernel:property_status] Frama-C kernel emits status unknown for property default behavior under 2 hypothesis [kernel:property_status] Frama-C kernel emits status unknown for property behavior t_null @@ -33,10 +23,10 @@ [value:initial-state] Values of globals at initialization nondet ∈ [--..--] [value] computing for function f <- main. - Called from tests/value/behavior_statuses.i:31. + Called from tests/value/behavior_statuses.i:26. [kernel:property_status] Call Preconditions emits status unknown for property requires \valid_read(filename) under 2 hypothesis -tests/value/behavior_statuses.i:15:[value] function f: precondition got status valid. +tests/value/behavior_statuses.i:10:[value] function f: precondition got status valid. [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(filename)' of f at stmt 4 under 0 hypothesis [kernel:property_status] Value emits status VALID for property status of 'requires @@ -50,12 +40,12 @@ tests/value/behavior_statuses.i:15:[value] function f: precondition got status v [value] Recording results for f [value] Done for function f [value] computing for function f <- main. - Called from tests/value/behavior_statuses.i:32. + Called from tests/value/behavior_statuses.i:27. [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(filename)' of f at stmt 5 under 0 hypothesis [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(filename)' of f at stmt 5 under 0 hypothesis -tests/value/behavior_statuses.i:21:[value] function f, behavior t_not_null: precondition got status valid. +tests/value/behavior_statuses.i:16:[value] function f, behavior t_not_null: precondition got status valid. [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(t)' of f at stmt 5 under 0 hypothesis [kernel:property_status] Value emits status VALID for property status of 'requires diff --git a/tests/value/oracle/behavior_statuses.1.res.oracle b/tests/value/oracle/behavior_statuses.1.res.oracle index f95843699ac643d347275063447a8eb4e9b8244b..e79e5e757c8f30b1f116c3643718dd179f684976 100644 --- a/tests/value/oracle/behavior_statuses.1.res.oracle +++ b/tests/value/oracle/behavior_statuses.1.res.oracle @@ -1,26 +1,16 @@ [kernel] computing the AST [kernel] parsing -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing ./share/libc/__fc_builtin_for_normalization.i to Cabs -[kernel] Parsing ./share/libc/__fc_builtin_for_normalization.i -[kernel] Converting ./share/libc/__fc_builtin_for_normalization.i from Cabs to CIL [kernel] Parsing tests/value/behavior_statuses.i (no preprocessing) [kernel] Parsing tests/value/behavior_statuses.i to Cabs [kernel] Parsing tests/value/behavior_statuses.i [kernel] Converting tests/value/behavior_statuses.i from Cabs to CIL [kernel] cleaning unused parts [kernel] symbolic link -[kernel] Pre-merging (0) ./share/libc/__fc_builtin_for_normalization.i -[kernel] Pre-merging (1) tests/value/behavior_statuses.i -[kernel] Final merging phase: ./share/libc/__fc_builtin_for_normalization.i +[kernel] Pre-merging (0) tests/value/behavior_statuses.i [kernel] Final merging phase: tests/value/behavior_statuses.i [kernel] preparing the AST [kernel] First check done [kernel] register globals done -[kernel:property_status] Frama-C kernel emits status unknown for property default behavior - under 3 hypothesis -[kernel:property_status] Frama-C kernel emits status unknown for property default behavior - under 3 hypothesis [kernel:property_status] Frama-C kernel emits status unknown for property default behavior under 2 hypothesis [kernel:property_status] Frama-C kernel emits status unknown for property behavior t_null @@ -33,11 +23,11 @@ [value:initial-state] Values of globals at initialization nondet ∈ [--..--] [value] computing for function f <- main. - Called from tests/value/behavior_statuses.i:31. + Called from tests/value/behavior_statuses.i:26. [value] using specification for function f [kernel:property_status] Call Preconditions emits status unknown for property requires \valid_read(filename) under 2 hypothesis -tests/value/behavior_statuses.i:15:[value] function f: precondition got status valid. +tests/value/behavior_statuses.i:10:[value] function f: precondition got status valid. [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(filename)' of f at stmt 4 under 0 hypothesis [kernel:property_status] Value emits status VALID for property status of 'requires @@ -50,12 +40,12 @@ tests/value/behavior_statuses.i:15:[value] function f: precondition got status v \valid_read(t)' of f at stmt 4 under 0 hypothesis [value] Done for function f [value] computing for function f <- main. - Called from tests/value/behavior_statuses.i:32. + Called from tests/value/behavior_statuses.i:27. [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(filename)' of f at stmt 5 under 0 hypothesis [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(filename)' of f at stmt 5 under 0 hypothesis -tests/value/behavior_statuses.i:21:[value] function f, behavior t_not_null: precondition got status valid. +tests/value/behavior_statuses.i:16:[value] function f, behavior t_not_null: precondition got status valid. [kernel:property_status] Value emits status VALID for property status of 'requires \valid_read(t)' of f at stmt 5 under 0 hypothesis [kernel:property_status] Value emits status VALID for property status of 'requires diff --git a/tests/value/oracle/behaviors1.res.oracle b/tests/value/oracle/behaviors1.res.oracle index 1cfff60d5a95cd7571f9404bcb36c59bd2d0ebf6..2d943d893e93364a6545ecdd5e1cd8d87d957989 100644 --- a/tests/value/oracle/behaviors1.res.oracle +++ b/tests/value/oracle/behaviors1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/behaviors1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -348,7 +347,7 @@ tests/value/behaviors1.i:580:[value] function f8_bis: precondition got status va [value] computing for function f9 <- test_promote <- main. Called from tests/value/behaviors1.i:609. [value] using specification for function f9 -tests/value/behaviors1.i:609:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +tests/value/behaviors1.i:601:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates tests/value/behaviors1.i:609:[value] function f9, behavior b1: assumes got status invalid; behavior not evaluated. [value] Done for function f9 [value] Recording results for test_promote @@ -358,7 +357,10 @@ tests/value/behaviors1.i:609:[value] function f9, behavior b1: assumes got statu [value] computing for function f10 <- test_narrow <- main. Called from tests/value/behaviors1.i:634. [value] using specification for function f10 -tests/value/behaviors1.i:634:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +tests/value/behaviors1.i:616:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +tests/value/behaviors1.i:619:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +tests/value/behaviors1.i:622:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates +tests/value/behaviors1.i:625:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates [value] Done for function f10 [value] Recording results for test_narrow [value] Done for function test_narrow diff --git a/tests/value/oracle/behaviors2.res.oracle b/tests/value/oracle/behaviors2.res.oracle index dc8e00bee7f92018228a44e7a7299a0e1c1c020d..b4219ac0da7865cfb231087fb5c1f16c89efb66f 100644 --- a/tests/value/oracle/behaviors2.res.oracle +++ b/tests/value/oracle/behaviors2.res.oracle @@ -1,18 +1,17 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/behaviors2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization - __fc_random_counter ∈ {0} + __fc_random_counter ∈ [--..--] __fc_rand_max ∈ {32767} __fc_heap_status ∈ [--..--] - __fc_mblen_state ∈ {0} - __fc_mbtowc_state ∈ {0} - __fc_wctomb_state ∈ {0} + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] nondet ∈ [--..--] [value] computing for function test1 <- main. - Called from tests/value/behaviors2.c:314. + Called from tests/value/behaviors2.c:328. [value] computing for function divi <- test1 <- main. Called from tests/value/behaviors2.c:178. [value] using specification for function divi @@ -85,51 +84,60 @@ tests/value/behaviors2.c:192:[value] function divi, behavior invalid_parameter: [value] Recording results for test1 [value] Done for function test1 [value] computing for function test2 <- main. - Called from tests/value/behaviors2.c:315. + Called from tests/value/behaviors2.c:329. [value] computing for function f1 <- test2 <- main. Called from tests/value/behaviors2.c:229. [value] using specification for function f1 tests/value/behaviors2.c:197:[value] warning: function f1: precondition got status unknown. -tests/value/behaviors2.c:204:[value] function f1, behavior b1: precondition got status valid. -tests/value/behaviors2.c:205:[value] function f1, behavior b1: precondition got status valid. tests/value/behaviors2.c:213:[value] function f1, behavior b2: precondition got status valid. tests/value/behaviors2.c:214:[value] function f1, behavior b2: precondition got status valid. +tests/value/behaviors2.c:204:[value] function f1, behavior b1: precondition got status valid. +tests/value/behaviors2.c:205:[value] function f1, behavior b1: precondition got status valid. [value] Done for function f1 [value] Recording results for test2 [value] Done for function test2 [value] computing for function test3 <- main. - Called from tests/value/behaviors2.c:316. + Called from tests/value/behaviors2.c:330. [value] computing for function f2 <- test3 <- main. Called from tests/value/behaviors2.c:265. [value] using specification for function f2 tests/value/behaviors2.c:233:[value] warning: function f2: precondition got status unknown. -tests/value/behaviors2.c:240:[value] function f2, behavior b1: precondition got status valid. -tests/value/behaviors2.c:241:[value] function f2, behavior b1: precondition got status valid. tests/value/behaviors2.c:249:[value] function f2, behavior b2: precondition got status valid. tests/value/behaviors2.c:250:[value] function f2, behavior b2: precondition got status valid. +tests/value/behaviors2.c:240:[value] function f2, behavior b1: precondition got status valid. +tests/value/behaviors2.c:241:[value] function f2, behavior b1: precondition got status valid. [value] Done for function f2 [value] Recording results for test3 [value] Done for function test3 [value] computing for function test4 <- main. - Called from tests/value/behaviors2.c:317. + Called from tests/value/behaviors2.c:331. [value] computing for function f3 <- test4 <- main. Called from tests/value/behaviors2.c:285. [value] using specification for function f3 tests/value/behaviors2.c:269:[value] warning: function f3: precondition got status unknown. -tests/value/behaviors2.c:285:[value] function f3, behavior b3: requires got status invalid; postconditions not evaluated. +tests/value/behaviors2.c:285:[value] function f3, behavior b3: assumes got status invalid; behavior not evaluated. [value] Done for function f3 [value] Recording results for test4 [value] Done for function test4 [value] computing for function test5 <- main. - Called from tests/value/behaviors2.c:318. + Called from tests/value/behaviors2.c:332. [value] computing for function f4 <- test5 <- main. Called from tests/value/behaviors2.c:306. [value] using specification for function f4 tests/value/behaviors2.c:289:[value] warning: function f4: precondition got status unknown. -tests/value/behaviors2.c:306:[value] function f4, behavior b3: requires got status invalid; postconditions not evaluated. +tests/value/behaviors2.c:306:[value] function f4, behavior b3: assumes got status invalid; behavior not evaluated. [value] Done for function f4 [value] Recording results for test5 [value] Done for function test5 +[value] computing for function test_red <- main. + Called from tests/value/behaviors2.c:333. +[value] computing for function opt_ptr <- test_red <- main. + Called from tests/value/behaviors2.c:319. +[value] using specification for function opt_ptr +[value] Done for function opt_ptr +tests/value/behaviors2.c:320:[value] assertion got status valid. +[value] Recording results for test_red +[value] Done for function test_red [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -150,18 +158,20 @@ tests/value/behaviors2.c:306:[value] function f4, behavior b3: requires got stat a ∈ {1} b ∈ {2} p ∈ {{ &a ; &b }} - y ∈ {-4; -2; 2; 4} + y ∈ {-4; 2} x ∈ {2; 4} [value:final-states] Values at end of function test3: a ∈ {1} b ∈ {2} p ∈ {{ &a ; &b }} - y ∈ {-4; -2; 2; 4} + y ∈ {-4; 2} x ∈ {2; 4} [value:final-states] Values at end of function test4: x ∈ {2; 4} [value:final-states] Values at end of function test5: x ∈ {4} +[value:final-states] Values at end of function test_red: + a ∈ {1} [value:final-states] Values at end of function main: __retres ∈ {0} [from] Computing for function test1 @@ -184,6 +194,10 @@ tests/value/behaviors2.c:306:[value] function f4, behavior b3: requires got stat [from] Computing for function f4 <-test5 [from] Done for function f4 [from] Done for function test5 +[from] Computing for function test_red +[from] Computing for function opt_ptr <-test_red +[from] Done for function opt_ptr +[from] Done for function test_red [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== @@ -204,6 +218,8 @@ tests/value/behaviors2.c:306:[value] function f4, behavior b3: requires got stat \result FROM x [from] Function f4: \result FROM x +[from] Function opt_ptr: + a FROM p [from] Function test1: NO EFFECTS [from] Function test2: @@ -214,6 +230,8 @@ tests/value/behaviors2.c:306:[value] function f4, behavior b3: requires got stat NO EFFECTS [from] Function test5: NO EFFECTS +[from] Function test_red: + NO EFFECTS [from] Function main: \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== @@ -237,6 +255,10 @@ tests/value/behaviors2.c:306:[value] function f4, behavior b3: requires got stat x [inout] Inputs for function test5: nondet +[inout] Out (internal) for function test_red: + a +[inout] Inputs for function test_red: + \nothing [inout] Out (internal) for function main: __retres [inout] Inputs for function main: diff --git a/tests/value/oracle/big_lib_entry.res.oracle b/tests/value/oracle/big_lib_entry.res.oracle index c7db2fca3a625d016987056ee3735025a10716a3..59f210a62cbf42d3553a598ac803437b1290026c 100644 --- a/tests/value/oracle/big_lib_entry.res.oracle +++ b/tests/value/oracle/big_lib_entry.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/big_lib_entry.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bigarray.res.oracle b/tests/value/oracle/bigarray.res.oracle index 2474fa18c97031309e0ec0bad21aaa047553f40b..9f73ed0ba1f9fd1d1680b34658aa80c603b6a268 100644 --- a/tests/value/oracle/bigarray.res.oracle +++ b/tests/value/oracle/bigarray.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bigarray.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bitfield.res.oracle b/tests/value/oracle/bitfield.res.oracle index 16fde0f63991ff22ba38fff7b7ab39cabbf7ace1..f3213d4b3cef3bbf73f42dcab52ffb4f0c6807e3 100644 --- a/tests/value/oracle/bitfield.res.oracle +++ b/tests/value/oracle/bitfield.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitfield.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -26,16 +25,17 @@ foo ∈ [--..--] y ∈ [--..--] [value] computing for function main_old <- main. - Called from tests/value/bitfield.i:150. -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({3}) -tests/value/bitfield.i:120:[value] Assigning imprecise value to v.c. - The imprecision originates from Arithmetic {tests/value/bitfield.i:120} -tests/value/bitfield.i:122:[value] warning: signed overflow. assert -2147483648 ≤ (int)v.d + 1; -tests/value/bitfield.i:122:[value] warning: signed overflow. assert (int)v.d + 1 ≤ 2147483647; + Called from tests/value/bitfield.i:165. +tests/value/bitfield.i:114:[value] Frama_C_show_each: {1} +tests/value/bitfield.i:118:[value] Frama_C_show_each: {3} +tests/value/bitfield.i:124:[value] Assigning imprecise value to v.c. + The imprecision originates from Arithmetic {tests/value/bitfield.i:124} +tests/value/bitfield.i:126:[value] warning: signed overflow. assert -2147483648 ≤ (int)v.d + 1; +tests/value/bitfield.i:126:[value] warning: signed overflow. assert (int)v.d + 1 ≤ 2147483647; [value] computing for function f <- main_old <- main. - Called from tests/value/bitfield.i:125. -[value] DUMPING STATE of file tests/value/bitfield.i line 21 + Called from tests/value/bitfield.i:129. +tests/value/bitfield.i:25:[value] Frama_C_dump_each: + # Cvalue domain: h ∈ {0} k ∈ {0} k8 ∈ {0} @@ -61,87 +61,79 @@ tests/value/bitfield.i:122:[value] warning: signed overflow. assert (int)v.d + 1 v.a ∈ {0} .b ∈ {7} .c ∈ - {{ garbled mix of &{v} (origin: Arithmetic {tests/value/bitfield.i:120}) }} + {{ garbled mix of &{v} (origin: Arithmetic {tests/value/bitfield.i:124}) }} .[bits 28 to 31] ∈ UNINITIALIZED .d ∈ {{ &v + {9} }} l_161{.f0; .f1[bits 0 to 31]} ∈ {-1} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for f [value] Done for function f -tests/value/bitfield.i:126:[value] warning: signed overflow. assert -2147483648 ≤ foo + foo; -tests/value/bitfield.i:126:[value] warning: signed overflow. assert foo + foo ≤ 2147483647; -tests/value/bitfield.i:127:[value] Assigning imprecise value to h.c. - The imprecision originates from Arithmetic {tests/value/bitfield.i:127} +tests/value/bitfield.i:130:[value] warning: signed overflow. assert -2147483648 ≤ foo + foo; +tests/value/bitfield.i:130:[value] warning: signed overflow. assert foo + foo ≤ 2147483647; +tests/value/bitfield.i:131:[value] Assigning imprecise value to h.c. + The imprecision originates from Arithmetic {tests/value/bitfield.i:131} [value] computing for function return_8 <- main_old <- main. - Called from tests/value/bitfield.i:130. + Called from tests/value/bitfield.i:134. [value] Recording results for return_8 [value] Done for function return_8 [value] computing for function g <- main_old <- main. - Called from tests/value/bitfield.i:133. + Called from tests/value/bitfield.i:137. [value] Recording results for g [value] Done for function g [value] Recording results for main_old [value] Done for function main_old -tests/value/bitfield.i:150:[value] warning: locals {v} escaping the scope of main_old through h +tests/value/bitfield.i:165:[value] warning: locals {v} escaping the scope of main_old through h [value] computing for function imprecise_bts_1671 <- main. - Called from tests/value/bitfield.i:151. -tests/value/bitfield.i:69:[value] entering loop for the first time + Called from tests/value/bitfield.i:166. +tests/value/bitfield.i:73:[value] entering loop for the first time [value] computing for function leaf <- imprecise_bts_1671 <- main. - Called from tests/value/bitfield.i:70. -tests/value/bitfield.i:70:[kernel] warning: Neither code nor specification for function leaf, generating default assigns from the prototype + Called from tests/value/bitfield.i:74. +tests/value/bitfield.i:74:[kernel] warning: Neither code nor specification for function leaf, generating default assigns from the prototype [value] using specification for function leaf [value] Done for function leaf -tests/value/bitfield.i:71:[value] Reading left-value ee. - It contains a garbled mix of {b} because of Misaligned - {tests/value/bitfield.i:70}. -[value] Called Frama_C_show_each({{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }}) -tests/value/bitfield.i:73:[value] Reading left-value ee. - It contains a garbled mix of {b} because of Misaligned - {tests/value/bitfield.i:70}. -[value] Called Frama_C_show_each(.next ∈ - {{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }} - .bitf ∈ {0} - .[bits 65 to 95] ∈ - {{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }}) -tests/value/bitfield.i:74:[value] Assigning imprecise value to c. - The imprecision originates from Misaligned {tests/value/bitfield.i:70} +tests/value/bitfield.i:75:[value] Frama_C_show_each: + {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} +tests/value/bitfield.i:77:[value] Frama_C_show_each: + .next ∈ + {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} + .bitf ∈ {0} + .[bits 65 to 95] ∈ + {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} +tests/value/bitfield.i:78:[value] Assigning imprecise value to c. + The imprecision originates from Misaligned {tests/value/bitfield.i:74} [value] computing for function leaf <- imprecise_bts_1671 <- main. - Called from tests/value/bitfield.i:70. + Called from tests/value/bitfield.i:74. [value] Done for function leaf -[value] Called Frama_C_show_each({{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }}) -tests/value/bitfield.i:72:[value] warning: out of bounds write. assert \valid(&c->bitf); -[value] Called Frama_C_show_each({{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }}) -tests/value/bitfield.i:74:[value] warning: out of bounds read. assert \valid_read(&c->next.next); +tests/value/bitfield.i:75:[value] Frama_C_show_each: + {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} +tests/value/bitfield.i:76:[value] warning: out of bounds write. assert \valid(&c->bitf); +tests/value/bitfield.i:77:[value] Frama_C_show_each: + {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} +tests/value/bitfield.i:78:[value] warning: out of bounds read. assert \valid_read(&c->next.next); [value] computing for function leaf <- imprecise_bts_1671 <- main. - Called from tests/value/bitfield.i:70. + Called from tests/value/bitfield.i:74. [value] Done for function leaf [value] Recording results for imprecise_bts_1671 [value] Done for function imprecise_bts_1671 [value] computing for function logic <- main. - Called from tests/value/bitfield.i:152. -[value] Called Frama_C_show_each(.v0_3 ∈ [--..--] - .v4 ∈ {0} - .v5_31 ∈ [--..--]) -[value] Called Frama_C_show_each(.v0_3 ∈ [--..--] - .v4 ∈ {0} - .v5_31 ∈ [--..--]) -[value] Called Frama_C_show_each({0}) -tests/value/bitfield.i:93:[value] assertion got status valid. -[value] Called Frama_C_show_each([bits 0 to 2] ∈ [--..--] - [bits 3 to 3] ∈ {0} - [bits 4 to 31] ∈ [--..--]) -tests/value/bitfield.i:99:[value] assertion got status valid. -tests/value/bitfield.i:101:[value] warning: accessing uninitialized left-value. assert \initialized(&w.v4); + Called from tests/value/bitfield.i:167. +tests/value/bitfield.i:93:[value] Frama_C_show_each: .v0_3 ∈ [--..--] + .v4 ∈ {0} + .v5_31 ∈ [--..--] +tests/value/bitfield.i:95:[value] Frama_C_show_each: .v0_3 ∈ [--..--] + .v4 ∈ {0} + .v5_31 ∈ [--..--] +tests/value/bitfield.i:96:[value] Frama_C_show_each: {0} +tests/value/bitfield.i:97:[value] assertion got status valid. +tests/value/bitfield.i:99:[value] Frama_C_show_each: [0..4294967287] +tests/value/bitfield.i:103:[value] assertion got status valid. +tests/value/bitfield.i:105:[value] warning: accessing uninitialized left-value. assert \initialized(&w.v4); [value] Recording results for logic [value] Done for function logic [value] computing for function eq_bitfields <- main. - Called from tests/value/bitfield.i:153. -[value] DUMPING STATE of file tests/value/bitfield.i line 143 + Called from tests/value/bitfield.i:168. +tests/value/bitfield.i:147:[value] Frama_C_dump_each: + # Cvalue domain: h.a ∈ {0} .b ∈ [--..--] .c ∈ [--..--] or ESCAPINGADDR @@ -169,9 +161,9 @@ tests/value/bitfield.i:101:[value] warning: accessing uninitialized left-value. b ∈ {0} c ∈ {{ garbled mix of &{b; ee} - (origin: Misaligned {tests/value/bitfield.i:70}) }} + (origin: Misaligned {tests/value/bitfield.i:74}) }} ee ∈ - {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:70}) }} + {{ garbled mix of &{b} (origin: Misaligned {tests/value/bitfield.i:74}) }} foo ∈ [--..--] y.v0_3 ∈ [--..--] .v4 ∈ {0} @@ -181,13 +173,23 @@ tests/value/bitfield.i:101:[value] warning: accessing uninitialized left-value. .b ∈ UNINITIALIZED .c ∈ {16; 17} {.d; .[bits 28 to 31]} ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for eq_bitfields [value] Done for function eq_bitfields +[value] computing for function char_short <- main. + Called from tests/value/bitfield.i:169. +[value] Recording results for char_short +[value] Done for function char_short [value] Recording results for main [value] done for function main -tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final status invalid. +tests/value/bitfield.i:105:[value] assertion 'Value,initialisation' got final status invalid. [value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function char_short: + S.c ∈ {1} + .s ∈ {2} + .[bits 3 to 15] ∈ {0} + x_0 ∈ {1} + y_0 ∈ {2} [value:final-states] Values at end of function eq_bitfields: i ∈ [--..--] [value:final-states] Values at end of function f: @@ -199,10 +201,10 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st b ∈ {0} c ∈ {{ garbled mix of &{b; ee} - (origin: Misaligned {tests/value/bitfield.i:70}) }} + (origin: Misaligned {tests/value/bitfield.i:74}) }} ee ∈ {{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }} + (origin: Misaligned {tests/value/bitfield.i:74}) }} [value:final-states] Values at end of function logic: y.v0_3 ∈ [--..--] .v4 ∈ {0} @@ -216,7 +218,7 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st .b ∈ [--..--] .c ∈ {{ garbled mix of &{v} - (origin: Arithmetic {tests/value/bitfield.i:127}) }} + (origin: Arithmetic {tests/value/bitfield.i:131}) }} {.d; .[bits 28 to 31]} ∈ {0} k8.a ∈ {0} .b ∈ {-8} @@ -234,7 +236,7 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st .b ∈ {7} .c ∈ {{ garbled mix of &{v} - (origin: Arithmetic {tests/value/bitfield.i:120}) }} + (origin: Arithmetic {tests/value/bitfield.i:124}) }} .[bits 28 to 31] ∈ UNINITIALIZED .d ∈ {{ &v + {9} }} l_161{.f0; .f1[bits 0 to 31]} ∈ {-1} @@ -258,13 +260,15 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st b ∈ {0} c ∈ {{ garbled mix of &{b; ee} - (origin: Misaligned {tests/value/bitfield.i:70}) }} + (origin: Misaligned {tests/value/bitfield.i:74}) }} ee ∈ {{ garbled mix of &{b} - (origin: Misaligned {tests/value/bitfield.i:70}) }} + (origin: Misaligned {tests/value/bitfield.i:74}) }} y.v0_3 ∈ [--..--] .v4 ∈ {0} .v5_31 ∈ [--..--] +[from] Computing for function char_short +[from] Done for function char_short [from] Computing for function eq_bitfields [from] Computing for function Frama_C_dump_each <-eq_bitfields [from] Done for function Frama_C_dump_each @@ -287,6 +291,8 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: +[from] Function char_short: + NO EFFECTS [from] Function eq_bitfields: NO EFFECTS [from] Function f: @@ -335,6 +341,10 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st .next.prev FROM ee{.next.next; {.bitf; .[bits 65 to 95]}}; foo y.v4 FROM y.v4 (and SELF) [from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function char_short: + S{.c; .s}; x_0; y_0 +[inout] Inputs for function char_short: + \nothing [inout] Out (internal) for function eq_bitfields: i; s{.a; .c} [inout] Inputs for function eq_bitfields: @@ -367,3 +377,206 @@ tests/value/bitfield.i:101:[value] assertion 'Value,initialisation' got final st h{.a; .b; .c}; k8.b; kr8.b; ll.b; VV; X; G; H; b; c; ee; y.v4 [inout] Inputs for function main: h{.a; .b}; VV; q4; x; us; c; ee; foo; y +/* Generated by Frama-C */ +struct t1 { + unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))) a : 2 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))) b : 4 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))) c : 22 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))) d : 32 ; +}; +struct t2 { + unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))) a : 2 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))) b : 4 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))) c : 22 ; + int d ; +}; +struct t3 { + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(16))) b : 16 ; +}; +struct S { + unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))) f : 32 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))) sf : 32 ; +}; +union U1 { + int f0 ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(15))) f1 : 15 ; +}; +struct foo; +struct B { + struct foo *next ; + struct foo **prev ; +}; +struct A { + struct B next ; + int __attribute__((__FRAMA_C_BITFIELD_SIZE__(1))) bitf : 1 ; +}; +struct bitf { + unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(3))) v0_3 : 3 ; + unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(1))) v4 : 1 ; + unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(28))) v5_31 : 28 ; +}; +struct char_short { + unsigned char __attribute__((__FRAMA_C_BITFIELD_SIZE__(1))) c : 1 ; + unsigned short __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))) s : 2 ; +}; +struct t1 h; +struct t2 k; +struct t2 k8; +struct t2 kr8; +struct t3 ll; +struct t1 ini = + {.a = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))))14, + .b = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))))(-55), + .c = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))))99999, + .d = 0}; +unsigned int VV = (unsigned int)55; +unsigned short q4 = (unsigned short)40000; +int X; +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_dump_each)(); + +void f(int x_0) +{ + X = x_0; + Frama_C_dump_each(); + return; +} + +int return_8(void) +{ + int __retres; + __retres = 8; + return __retres; +} + +struct S x = + {.f = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))))28349, + .sf = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))))28349}; +unsigned short us = (unsigned short)0xDC23L; +int G; +int H; +int g(void) +{ + int r = + ((unsigned int)x.f ^ (unsigned int)((short)(-87))) >= (unsigned int)us; + H = ((int)x.sf ^ (int)((short)(-87))) >= (int)us; + return r; +} + +struct A *b; +struct A *c; +struct A ee; +/*@ assigns *p1; + assigns *p1 \from *p1; */ +void leaf(struct A *p1); + +int volatile foo; +/*@ assigns \result; + assigns \result \from \nothing; */ +extern int ( /* missing proto */ Frama_C_show_each)(); + +void imprecise_bts_1671(void) +{ + ee.next.prev = (struct foo **)(& b); + c = & ee; + while (foo) { + leaf(c); + Frama_C_show_each(ee); + /*@ assert Value: mem_access: \valid(&c->bitf); */ + c->bitf = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(1))))0; + Frama_C_show_each(ee); + /*@ assert Value: mem_access: \valid_read(&c->next.next); */ + c = (struct A *)c->next.next; + } + return; +} + +extern struct bitf y; + +void logic(void) +{ + struct bitf w; + if (y.v4) { + y.v4 = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(1))))0; + Frama_C_show_each(y); + } + else Frama_C_show_each(y); + Frama_C_show_each(y.v4); + /*@ assert y.v4 ≡ 0; */ ; + Frama_C_show_each(*((unsigned int *)(& y))); + w.v0_3 = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(3))))1; + /*@ assert ¬\initialized(&w.v4); */ ; + if (foo) { + /*@ assert Value: initialisation: \initialized(&w.v4); */ + int wc = (int)w.v4 + 1; + } + return; +} + +void main_old(void) +{ + struct t1 v; + union U1 l_161; + l_161.f0 = (int)(-1L); + Frama_C_show_each(1); + if (! l_161.f0 <= (int)l_161.f1) Frama_C_show_each(2); + else Frama_C_show_each(3); + VV = (unsigned int)h.a; + h.a = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))))VV; + v.c = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))))(& v); + v.d = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))))(& v + 1); + /*@ assert Value: signed_overflow: -2147483648 ≤ (int)v.d + 1; */ + /*@ assert Value: signed_overflow: (int)v.d + 1 ≤ 2147483647; */ + v.d = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(32))))((int)v.d + 1); + v.a = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))))4; + v.b = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))))7; + f((int)v.b); + /*@ assert Value: signed_overflow: -2147483648 ≤ foo + foo; */ + /*@ assert Value: signed_overflow: foo + foo ≤ 2147483647; */ + h.b = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))))(((foo + foo) + (int)h.a) + (int)h.b); + h.c = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))))(& v + 1); + k8.b = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))))8; + kr8.b = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(4))))return_8(); + ll.b = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(16))))q4; + G = g(); + return; +} + +extern int ( /* missing proto */ Frama_C_show_each_unreachable)(); + +void eq_bitfields(void) +{ + int i = foo; + if (i >= 16) + if (i <= 17) { + struct t1 s; + s.a = (unsigned int __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))))i; + s.c = (int __attribute__((__FRAMA_C_BITFIELD_SIZE__(22))))i; + Frama_C_dump_each(); + if ((int)s.a == (int)s.c) Frama_C_show_each_unreachable(); + } + return; +} + +void char_short(void) +{ + struct char_short S = + {.c = (unsigned char __attribute__((__FRAMA_C_BITFIELD_SIZE__(1))))1, + .s = (unsigned short __attribute__((__FRAMA_C_BITFIELD_SIZE__(2))))2}; + int x_0 = (int)S.c + 0; + int y_0 = (int)S.s + 0; + return; +} + +void main(void) +{ + main_old(); + imprecise_bts_1671(); + logic(); + eq_bitfields(); + char_short(); + return; +} + + diff --git a/tests/value/oracle/bitfield_assign.res.oracle b/tests/value/oracle/bitfield_assign.res.oracle index 5ffdb1e9dac1c6d1918f30536252e79b12bb58a0..a11786f7ff6d118135c918ab402bf14c43b6e318 100644 --- a/tests/value/oracle/bitfield_assign.res.oracle +++ b/tests/value/oracle/bitfield_assign.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitfield_assign.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,7 +10,7 @@ {52} [0]{.f0[bits 7 to 159]; .f1[bits 7 to 159]; .f2[bits 7 to 159]; .f3{.f0[bits 7 to 31]; .f1; .f2; .f3; .[bits 48 to 63]; .[bits 90 to 95]}} ∈ {0} -[value] Called Frama_C_show_each({21668890}) +tests/value/bitfield_assign.i:34:[value] Frama_C_show_each: {21668890} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/bitfield_longlong.res.oracle b/tests/value/oracle/bitfield_longlong.res.oracle index 08e4fe2d464ab9d95753388b736b961bad639af9..6c431d1adcc82956e6242f47b79d0af65bd08d0e 100644 --- a/tests/value/oracle/bitfield_longlong.res.oracle +++ b/tests/value/oracle/bitfield_longlong.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitfield_longlong.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,8 +9,8 @@ .[bits 10 to 31] ∈ {0} u32.z ∈ {4294967295} s32.z ∈ {-1} -[value] Called Frama_C_show_each({{ "%zu %zu %zu %zu\n" }}, {8}, {4}, {8}, {4}) -[value] Called Frama_C_show_each({{ "%d %d\n" }}, {1}, {0}) +tests/value/bitfield_longlong.c:25:[value] Frama_C_show_each: {{ "%zu %zu %zu %zu\n" }}, {8}, {4}, {8}, {4} +tests/value/bitfield_longlong.c:31:[value] Frama_C_show_each: {{ "%d %d\n" }}, {1}, {0} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/bitfield_receives_result.res.oracle b/tests/value/oracle/bitfield_receives_result.res.oracle index b348c64d1ed899715a7a658365bfb5975ef8d2dc..c1ccbed7f02f6df8b143d696af1579ee7c20a86b 100644 --- a/tests/value/oracle/bitfield_receives_result.res.oracle +++ b/tests/value/oracle/bitfield_receives_result.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitfield_receives_result.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,11 +8,12 @@ Called from tests/value/bitfield_receives_result.i:9. [value] Recording results for f [value] Done for function f -[value] DUMPING STATE of file tests/value/bitfield_receives_result.i line 10 +tests/value/bitfield_receives_result.i:10:[value] Frama_C_dump_each: + # Cvalue domain: s.b ∈ {-1} .[bits 31 to 31] ∈ {0} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/bitwise.res.oracle b/tests/value/oracle/bitwise.res.oracle index 00a48a0ac7f9b7423ecfbc14d5ba6ebb89b23df4..ff4f44cda799b07d6b10fe9c4e99244522e83de5 100644 --- a/tests/value/oracle/bitwise.res.oracle +++ b/tests/value/oracle/bitwise.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitwise.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,24 +5,40 @@ [value:initial-state] Values of globals at initialization v ∈ [--..--] [value] computing for function main_and_or_rel <- main. - Called from tests/value/bitwise.i:44. + Called from tests/value/bitwise.i:64. tests/value/bitwise.i:13:[value] warning: assertion got status unknown. [value] Recording results for main_and_or_rel [value] Done for function main_and_or_rel [value] computing for function main_bitwise <- main. - Called from tests/value/bitwise.i:45. + Called from tests/value/bitwise.i:65. [value] Recording results for main_bitwise [value] Done for function main_bitwise [value] computing for function main_bug1 <- main. - Called from tests/value/bitwise.i:46. + Called from tests/value/bitwise.i:66. [value] Recording results for main_bug1 [value] Done for function main_bug1 [value] computing for function main_bug2 <- main. - Called from tests/value/bitwise.i:47. -[value] Called Frama_C_show_each_then() -[value] Called Frama_C_show_each_else() + Called from tests/value/bitwise.i:67. +tests/value/bitwise.i:40:[value] Frama_C_show_each_then: +tests/value/bitwise.i:40:[value] Frama_C_show_each_else: [value] Recording results for main_bug2 [value] Done for function main_bug2 +[value] computing for function main_bug3 <- main. + Called from tests/value/bitwise.i:68. +tests/value/bitwise.i:47:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + l_1180 ∈ {69166447} + foo ∈ {4225800849} + ==END OF DUMP== +[value] Recording results for main_bug3 +[value] Done for function main_bug3 +[value] computing for function main_bug4 <- main. + Called from tests/value/bitwise.i:69. +tests/value/bitwise.i:57:[value] Frama_C_show_each_then: +tests/value/bitwise.i:59:[value] Frama_C_show_each_else: +[value] Recording results for main_bug4 +[value] Done for function main_bug4 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -44,6 +59,12 @@ tests/value/bitwise.i:13:[value] warning: assertion got status unknown. p2 ∈ {0} [value:final-states] Values at end of function main_bug2: t ∈ {1; 2} +[value:final-states] Values at end of function main_bug3: + l_1180 ∈ {69166447} + foo ∈ {4225800849} +[value:final-states] Values at end of function main_bug4: + g_2 ∈ {-1; 0} + tmp_0 ∈ {-5496} [value:final-states] Values at end of function main: [from] Computing for function main_and_or_rel @@ -54,6 +75,12 @@ tests/value/bitwise.i:13:[value] warning: assertion got status unknown. [from] Done for function main_bug1 [from] Computing for function main_bug2 [from] Done for function main_bug2 +[from] Computing for function main_bug3 +[from] Computing for function Frama_C_dump_each <-main_bug3 +[from] Done for function Frama_C_dump_each +[from] Done for function main_bug3 +[from] Computing for function main_bug4 +[from] Done for function main_bug4 [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== @@ -66,6 +93,10 @@ tests/value/bitwise.i:13:[value] warning: assertion got status unknown. NO EFFECTS [from] Function main_bug2: NO EFFECTS +[from] Function main_bug3: + NO EFFECTS +[from] Function main_bug4: + NO EFFECTS [from] Function main: NO EFFECTS [from] ====== END OF DEPENDENCIES ====== @@ -85,6 +116,14 @@ tests/value/bitwise.i:13:[value] warning: assertion got status unknown. t; tmp [inout] Inputs for function main_bug2: v +[inout] Out (internal) for function main_bug3: + l_1180; foo +[inout] Inputs for function main_bug3: + \nothing +[inout] Out (internal) for function main_bug4: + g_2; tmp; tmp_0 +[inout] Inputs for function main_bug4: + v [inout] Out (internal) for function main: \nothing [inout] Inputs for function main: diff --git a/tests/value/oracle/bitwise_float.res.oracle b/tests/value/oracle/bitwise_float.res.oracle index b6f5d241d28643276f6c3abb16815d207c93ec88..2caa2e550b20868982349d8c28567ae603172b66 100644 --- a/tests/value/oracle/bitwise_float.res.oracle +++ b/tests/value/oracle/bitwise_float.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitwise_float.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,7 +5,7 @@ [value:initial-state] Values of globals at initialization tests/value/bitwise_float.c:1:[value] warning: function main: precondition got status unknown. -[value] Called Frama_C_show_each_x([1028443341..1084227584]) +tests/value/bitwise_float.c:5:[value] Frama_C_show_each_x: [1028443341..1084227584] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/bitwise_or.res.oracle b/tests/value/oracle/bitwise_or.res.oracle index 63a39ebb7355f3c8a65d39cb3debaf82f18acbd9..0f689c10bb86b0e75d5c490b0490536f03bf4dd7 100644 --- a/tests/value/oracle/bitwise_or.res.oracle +++ b/tests/value/oracle/bitwise_or.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitwise_or.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bitwise_pointer.res.oracle b/tests/value/oracle/bitwise_pointer.res.oracle index 4d685c6d091ea89afeddd158480464a2831faf9f..48a20a4b22a973499b6cff779c28c6b2d6309653 100644 --- a/tests/value/oracle/bitwise_pointer.res.oracle +++ b/tests/value/oracle/bitwise_pointer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitwise_pointer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bitwise_reduction.res.oracle b/tests/value/oracle/bitwise_reduction.res.oracle index de387eedbc3d32359a51c5fc54c12bd02eabb987..c746ef97c8b5b83669b9f8fa62ff1656496997ed 100644 --- a/tests/value/oracle/bitwise_reduction.res.oracle +++ b/tests/value/oracle/bitwise_reduction.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bitwise_reduction.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,21 +10,17 @@ tests/value/bitwise_reduction.i:10:[value] warning: assertion got status unknown tests/value/bitwise_reduction.i:11:[value] warning: assertion got status unknown. tests/value/bitwise_reduction.i:14:[value] warning: accessing out of bounds index. assert 0 ≤ i; tests/value/bitwise_reduction.i:14:[value] warning: accessing out of bounds index. assert i < 2; -[value] Called Frama_C_show_each_then1({1}, {0; 1}) -[value] Called Frama_C_show_each_else1({0; 1}, - {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; - 0xFF00}) -[value] Called Frama_C_show_each_else_then1({0; 1}, - {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; - 0xF000; 0xFF00}) +tests/value/bitwise_reduction.i:15:[value] Frama_C_show_each_then1: {1}, {0; 1} +tests/value/bitwise_reduction.i:17:[value] Frama_C_show_each_else1: + {0; 1}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} +tests/value/bitwise_reduction.i:19:[value] Frama_C_show_each_else_then1: + {0; 1}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} tests/value/bitwise_reduction.i:23:[value] warning: out of bounds read. assert \valid_read(p); -[value] Called Frama_C_show_each_then2({{ &t + {4} }}, {0; 1}) -[value] Called Frama_C_show_each_else2({{ &t + {0; 4} }}, - {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; - 0xFF00}) -[value] Called Frama_C_show_each_else_then2({0; 1}, - {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; - 0xF000; 0xFF00}) +tests/value/bitwise_reduction.i:24:[value] Frama_C_show_each_then2: {{ &t + {4} }}, {0; 1} +tests/value/bitwise_reduction.i:26:[value] Frama_C_show_each_else2: + {{ &t + {0; 4} }}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} +tests/value/bitwise_reduction.i:28:[value] Frama_C_show_each_else_then2: + {0; 1}, {0; 1; 0x3000; 0x3001; 0x3200; 0x3201; 0xF000; 0xFF00} [value] Recording results for main1 [value] Done for function main1 [value] Recording results for main diff --git a/tests/value/oracle/biz.res.oracle b/tests/value/oracle/biz.res.oracle index 01d4b0c2713b975a482cc097ebad8335486bdae3..7419748a830954a67fce0d0de92c0cae2b52c15e 100644 --- a/tests/value/oracle/biz.res.oracle +++ b/tests/value/oracle/biz.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/biz.i (no preprocessing) [value] Analyzing a complete application starting at f2 [value] Computing initial state diff --git a/tests/value/oracle/bool.res.oracle b/tests/value/oracle/bool.res.oracle index 7a98955649814e047ef9f454f1ca66dccd82ab0b..2161d1a802812b182ed6e4c7d630e01484323a80 100644 --- a/tests/value/oracle/bool.res.oracle +++ b/tests/value/oracle/bool.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bool.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,11 +5,11 @@ [value:initial-state] Values of globals at initialization x ∈ {0} y ∈ {0} -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({1}, {2}) -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({1}) +tests/value/bool.i:12:[value] Frama_C_show_each: {0} +tests/value/bool.i:14:[value] Frama_C_show_each: {1} +tests/value/bool.i:16:[value] Frama_C_show_each: {1}, {2} +tests/value/bool.i:18:[value] Frama_C_show_each: {1} +tests/value/bool.i:20:[value] Frama_C_show_each: {1} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/branch.res.oracle b/tests/value/oracle/branch.res.oracle index 4ec1e021c3f3dc3813b27d92dde666f3fa0d833f..ae9d7e2dea22e51fbd20f06bb5f4b6bace73d0ef 100644 --- a/tests/value/oracle/branch.res.oracle +++ b/tests/value/oracle/branch.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/branch.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/branch2.res.oracle b/tests/value/oracle/branch2.res.oracle index b0e246f5919bf9b3073c3b6bd264959f6314d5a9..eea32d243f1a1083c104454309b29fe2a1d5eac7 100644 --- a/tests/value/oracle/branch2.res.oracle +++ b/tests/value/oracle/branch2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/branch2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/broken_loop.res.oracle b/tests/value/oracle/broken_loop.res.oracle index bc6a2acb2832765502fddbda6115ad6755fa5d66..23db040f8597d6be5c185f9e0102aecddffeb875 100644 --- a/tests/value/oracle/broken_loop.res.oracle +++ b/tests/value/oracle/broken_loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/broken_loop.i (no preprocessing) [value] Analyzing a complete application starting at loop [value] Computing initial state diff --git a/tests/value/oracle/bts0506.0.res.oracle b/tests/value/oracle/bts0506.0.res.oracle index 23500e9f49f865b2c6133a9beb136294d1fe65f3..8546a0b013e8086a1202506f11f84fc982e16e69 100644 --- a/tests/value/oracle/bts0506.0.res.oracle +++ b/tests/value/oracle/bts0506.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bts0506.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -209,83 +208,65 @@ void *f7(); void main2(void) { - long r1; int tmp; - short r2; int tmp_0; - int r3; int tmp_1; - unsigned int r4; int tmp_2; - long r5; long tmp_3; - int r6; long tmp_4; - unsigned long r7; long tmp_5; - unsigned int r8; unsigned int tmp_6; - int r8bis; unsigned int tmp_7; - float r9; float tmp_8; - double r10; float tmp_9; - float r11; double tmp_10; - double r12; double tmp_11; - void *r13; int *tmp_12; - int *r14; int *tmp_13; - char *r15; int *tmp_14; - void *r16; void *tmp_15; - int *r17; void *tmp_16; tmp = f1(); - r1 = (long)tmp; + long r1 = (long)tmp; tmp_0 = f1(); - r2 = (short)tmp_0; + short r2 = (short)tmp_0; tmp_1 = f1(); - r3 = tmp_1; + int r3 = tmp_1; tmp_2 = f1(); - r4 = (unsigned int)tmp_2; + unsigned int r4 = (unsigned int)tmp_2; tmp_3 = f2(); - r5 = tmp_3; + long r5 = tmp_3; tmp_4 = f2(); - r6 = (int)tmp_4; + int r6 = (int)tmp_4; tmp_5 = f2(); - r7 = (unsigned long)tmp_5; + unsigned long r7 = (unsigned long)tmp_5; tmp_6 = f3(); - r8 = tmp_6; + unsigned int r8 = tmp_6; tmp_7 = f3(); - r8bis = (int)tmp_7; + int r8bis = (int)tmp_7; tmp_8 = f4(); /*@ assert Value: is_nan_or_infinite: \is_finite(tmp_8); */ - r9 = tmp_8; + float r9 = tmp_8; tmp_9 = f4(); /*@ assert Value: is_nan_or_infinite: \is_finite(tmp_9); */ - r10 = (double)tmp_9; + double r10 = (double)tmp_9; tmp_10 = f5(); /*@ assert Value: is_nan_or_infinite: \is_finite(tmp_10); */ /*@ assert Value: is_nan_or_infinite: \is_finite((float)tmp_10); */ - r11 = (float)tmp_10; + float r11 = (float)tmp_10; tmp_11 = f5(); /*@ assert Value: is_nan_or_infinite: \is_finite(tmp_11); */ - r12 = tmp_11; + double r12 = tmp_11; tmp_12 = f6(); - r13 = (void *)tmp_12; + void *r13 = (void *)tmp_12; tmp_13 = f6(); - r14 = tmp_13; + int *r14 = tmp_13; tmp_14 = f6(); - r15 = (char *)tmp_14; + char *r15 = (char *)tmp_14; tmp_15 = f7(); - r16 = tmp_15; + void *r16 = tmp_15; tmp_16 = f7(); - r17 = (int *)tmp_16; + int *r17 = (int *)tmp_16; return; } @@ -298,13 +279,10 @@ int f(int x) void main(void) { - short x; int tmp; - x = (short)4; - { /* sequence */ - tmp = f(42); - x = (short)tmp; - } + short x = (short)4; + tmp = f(42); + x = (short)tmp; main2(); return; } diff --git a/tests/value/oracle/bts0506.1.res.oracle b/tests/value/oracle/bts0506.1.res.oracle index d0c39fb1aa48b28850ee13f464405e4aa245a78e..a504d6c26eea627e93e39bbc7230a5fd931e1cf8 100644 --- a/tests/value/oracle/bts0506.1.res.oracle +++ b/tests/value/oracle/bts0506.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bts0506.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -198,54 +197,36 @@ void *f7(); void main2(void) { - long r1; - short r2; int tmp_0; - int r3; - unsigned int r4; int tmp_2; - long r5; - int r6; - unsigned long r7; long tmp_5; - unsigned int r8; - int r8bis; unsigned int tmp_7; - float r9; - double r10; - float r11; double tmp_10; - double r12; - void *r13; - int *r14; - char *r15; - void *r16; - int *r17; - r1 = (long)f1(); + long r1 = f1(); tmp_0 = f1(); - r2 = (short)tmp_0; - r3 = f1(); + short r2 = (short)tmp_0; + int r3 = f1(); tmp_2 = f1(); - r4 = (unsigned int)tmp_2; - r5 = f2(); - r6 = (int)f2(); + unsigned int r4 = (unsigned int)tmp_2; + long r5 = f2(); + int r6 = f2(); tmp_5 = f2(); - r7 = (unsigned long)tmp_5; - r8 = f3(); + unsigned long r7 = (unsigned long)tmp_5; + unsigned int r8 = f3(); tmp_7 = f3(); - r8bis = (int)tmp_7; - r9 = f4(); - r10 = (double)f4(); + int r8bis = (int)tmp_7; + float r9 = f4(); + double r10 = f4(); tmp_10 = f5(); /*@ assert Value: is_nan_or_infinite: \is_finite(tmp_10); */ /*@ assert Value: is_nan_or_infinite: \is_finite((float)tmp_10); */ - r11 = (float)tmp_10; - r12 = f5(); - r13 = (void *)f6(); - r14 = f6(); - r15 = (char *)f6(); - r16 = f7(); - r17 = (int *)f7(); + float r11 = (float)tmp_10; + double r12 = f5(); + void *r13 = f6(); + int *r14 = f6(); + char *r15 = f6(); + void *r16 = f7(); + int *r17 = f7(); return; } @@ -258,13 +239,10 @@ int f(int x) void main(void) { - short x; int tmp; - x = (short)4; - { /* sequence */ - tmp = f(42); - x = (short)tmp; - } + short x = (short)4; + tmp = f(42); + x = (short)tmp; main2(); return; } diff --git a/tests/value/oracle/bts0775.res.oracle b/tests/value/oracle/bts0775.res.oracle index 75936640caeb9219c6c44c509fac3b67f51587c4..43dff1e988ba2af4846ded293acbde8e729dd689 100644 --- a/tests/value/oracle/bts0775.res.oracle +++ b/tests/value/oracle/bts0775.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bts0775.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bts0858.res.oracle b/tests/value/oracle/bts0858.res.oracle index ed9014c6cfaba7d27bd3cb39df9b0bf4fdf793fe..559907493a99980acafa9a8471c52e714073018d 100644 --- a/tests/value/oracle/bts0858.res.oracle +++ b/tests/value/oracle/bts0858.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bts0858.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bts1306.res.oracle b/tests/value/oracle/bts1306.res.oracle index dff4315ada2c4c60fc69545697c3751c042f66bb..0c655face8e29f5e14d105303ade234798b70efe 100644 --- a/tests/value/oracle/bts1306.res.oracle +++ b/tests/value/oracle/bts1306.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bts1306.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -20,9 +19,8 @@ tests/value/bts1306.i:5:[value] warning: non-finite double value. assert \is_fin /* Generated by Frama-C */ void g(double x) { - double y; /*@ assert Value: is_nan_or_infinite: \is_finite((double)(x * x)); */ - y = x * x; + double y = x * x; return; } @@ -55,9 +53,8 @@ tests/value/bts1306.i:5:[value] warning: non-finite double value. assert \is_fin /* Generated by Frama-C */ void g(double x) { - double y; /*@ assert Value: is_nan_or_infinite: \is_finite((double)(x * x)); */ - y = x * x; + double y = x * x; return; } diff --git a/tests/value/oracle/buffer_overflow.0.res.oracle b/tests/value/oracle/buffer_overflow.0.res.oracle index 12d5294b8375b0fe3d85a070424a076d4441fe66..68cddc419a7fab7bfb8bc3727db9ac7c822e54a6 100644 --- a/tests/value/oracle/buffer_overflow.0.res.oracle +++ b/tests/value/oracle/buffer_overflow.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/buffer_overflow.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/buffer_overflow.1.res.oracle b/tests/value/oracle/buffer_overflow.1.res.oracle index 08cab798e5370257c7fac3d5b26cc51a7e010fa1..b2f90f8779cbb945d780369fa3b6843a997210f5 100644 --- a/tests/value/oracle/buffer_overflow.1.res.oracle +++ b/tests/value/oracle/buffer_overflow.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/buffer_overflow.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bug.res.oracle b/tests/value/oracle/bug.res.oracle index 6f07f10e0d1192ef846f94619391fd1792e290d3..7aa360ecee3185922444514ec55eef367b22a34a 100644 --- a/tests/value/oracle/bug.res.oracle +++ b/tests/value/oracle/bug.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/bug0196.res.oracle b/tests/value/oracle/bug0196.res.oracle index eacb7065182b8f91d25f62d552c0c6f03435a61a..9a99117f10a92fdfe04c3272ae4863b246cee1cf 100644 --- a/tests/value/oracle/bug0196.res.oracle +++ b/tests/value/oracle/bug0196.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug0196.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -45,18 +44,15 @@ tests/value/bug0196.c:10:[value] warning: signed overflow. assert r * tmp ≤ 21 /* Generated by Frama-C */ int fact(int n) { - int r; - r = 1; + int r = 1; while (n > 0) { int tmp; /*@ assert n > 0; */ ; before: - { /* sequence */ - tmp = n; - n --; - /*@ assert Value: signed_overflow: r * tmp ≤ 2147483647; */ - r *= tmp; - } + tmp = n; + n --; + /*@ assert Value: signed_overflow: r * tmp ≤ 2147483647; */ + r *= tmp; /*@ assert r ≡ \at(r * n,before); */ ; } while_0_break: ; diff --git a/tests/value/oracle/bug0223.0.res.oracle b/tests/value/oracle/bug0223.0.res.oracle index 7da840723dd4cd2032ec7df143618b72dbd9c2e7..d08097c4ff9221070e0b2123334f02d672ae0f3e 100644 --- a/tests/value/oracle/bug0223.0.res.oracle +++ b/tests/value/oracle/bug0223.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug0223.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bug0223.1.res.oracle b/tests/value/oracle/bug0223.1.res.oracle index 7da840723dd4cd2032ec7df143618b72dbd9c2e7..d08097c4ff9221070e0b2123334f02d672ae0f3e 100644 --- a/tests/value/oracle/bug0223.1.res.oracle +++ b/tests/value/oracle/bug0223.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug0223.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bug0245.res.oracle b/tests/value/oracle/bug0245.res.oracle index 9ac06d94e55af1405703e0dcc39cd76af23e96e7..34300d2fb37a931196e23dd5454c3db7b9c69598 100644 --- a/tests/value/oracle/bug0245.res.oracle +++ b/tests/value/oracle/bug0245.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug0245.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bug_023.res.oracle b/tests/value/oracle/bug_023.res.oracle index fbd66596ce2805a996d669f26517a1af5fee808e..85eccd9b5708f60cf870aa7301539dc658d0a05c 100644 --- a/tests/value/oracle/bug_023.res.oracle +++ b/tests/value/oracle/bug_023.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug_023.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/bug_0244.res.oracle b/tests/value/oracle/bug_0244.res.oracle index fc3aae490e74eca5482e56fbb913dc6743a67bc5..6c6c04f0f910ee6e15084a90db46f2a117bc8a6f 100644 --- a/tests/value/oracle/bug_0244.res.oracle +++ b/tests/value/oracle/bug_0244.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/bug_0244.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/call.res.oracle b/tests/value/oracle/call.res.oracle index 264272d65dc1e245ee299d0f9b0e65356a5a3823..aa4bc603bc32357bc47a386615866d189e5769f7 100644 --- a/tests/value/oracle/call.res.oracle +++ b/tests/value/oracle/call.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/call_2.res.oracle b/tests/value/oracle/call_2.res.oracle index 796c24c3fbba09ae38c28059ec8b6954ed29a777..5a594cb4cc67e14e340771c2d62b904b8f762fc7 100644 --- a/tests/value/oracle/call_2.res.oracle +++ b/tests/value/oracle/call_2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,9 +10,8 @@ tests/value/call_2.i:15:[value] warning: signed overflow. assert -2147483648 ≤ tests/value/call_2.i:15:[value] warning: signed overflow. assert i + j ≤ 2147483647; [value] computing for function ff <- main. Called from tests/value/call_2.i:15. -[value] Called Frama_C_show_each([-2147483648..2147483647], - [-3.40282346639e+38 .. 3.40282346639e+38], - {1}) +tests/value/call_2.i:6:[value] Frama_C_show_each: + [-2147483648..2147483647], [-3.40282346639e+38 .. 3.40282346639e+38], {1} [value] Recording results for ff [value] Done for function ff [value] Recording results for main diff --git a/tests/value/oracle/call_3.res.oracle b/tests/value/oracle/call_3.res.oracle index f9efb7a584ed839ba62b499afef3c87af45b4673..9a5277114f442f1a4ea614bf026a729e5f226382 100644 --- a/tests/value/oracle/call_3.res.oracle +++ b/tests/value/oracle/call_3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_3.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/call_alias.0.res.oracle b/tests/value/oracle/call_alias.0.res.oracle index f1f3294030d3ffb3544b9edf8353de9fae04dbee..f0077c59e9de27f0ea89157763a70f0eff5e902a 100644 --- a/tests/value/oracle/call_alias.0.res.oracle +++ b/tests/value/oracle/call_alias.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_alias.i (no preprocessing) [value] Analyzing a complete application starting at main0 [value] Computing initial state diff --git a/tests/value/oracle/call_alias.1.res.oracle b/tests/value/oracle/call_alias.1.res.oracle index 55a8db00d402d39e34ed7b4bb57a49c57155d8b1..fc4bd83c241c87a12758939fd18073e186dd4657 100644 --- a/tests/value/oracle/call_alias.1.res.oracle +++ b/tests/value/oracle/call_alias.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_alias.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/value/oracle/call_alias.2.res.oracle b/tests/value/oracle/call_alias.2.res.oracle index da4e0c9177e012ad775faad6b8d4f26533984999..5d908e7b783e5c8f675f45a0a5b9f0bbc0b85e3e 100644 --- a/tests/value/oracle/call_alias.2.res.oracle +++ b/tests/value/oracle/call_alias.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_alias.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state diff --git a/tests/value/oracle/call_deep.res.oracle b/tests/value/oracle/call_deep.res.oracle index e604d6c4d838d728fe57a34837ff20def7af6063..f1bd5049cc25e8cc21381651167f3259f5a8c504 100644 --- a/tests/value/oracle/call_deep.res.oracle +++ b/tests/value/oracle/call_deep.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_deep.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/call_multi.res.oracle b/tests/value/oracle/call_multi.res.oracle index e0fbd0a616c804203558c65ab547dcd7672b5712..a19482bd003c711eaf401e458942a49362e5244e 100644 --- a/tests/value/oracle/call_multi.res.oracle +++ b/tests/value/oracle/call_multi.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_multi.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,22 +6,22 @@ G ∈ {0} [value] computing for function uppol2 <- main. Called from tests/value/call_multi.i:29. -[value] Called Frama_C_show_each_GOT({128}) +tests/value/call_multi.i:23:[value] Frama_C_show_each_GOT: {128} [value] Recording results for uppol2 [value] Done for function uppol2 [value] computing for function uppol2 <- main. Called from tests/value/call_multi.i:30. -[value] Called Frama_C_show_each_GOT({128}) +tests/value/call_multi.i:23:[value] Frama_C_show_each_GOT: {128} [value] Recording results for uppol2 [value] Done for function uppol2 [value] computing for function uppol2 <- main. Called from tests/value/call_multi.i:31. -[value] Called Frama_C_show_each_GOT({-128}) +tests/value/call_multi.i:23:[value] Frama_C_show_each_GOT: {-128} [value] Recording results for uppol2 [value] Done for function uppol2 [value] computing for function uppol2 <- main. Called from tests/value/call_multi.i:32. -[value] Called Frama_C_show_each_GOT({128}) +tests/value/call_multi.i:23:[value] Frama_C_show_each_GOT: {128} [value] Recording results for uppol2 [value] Done for function uppol2 [value] Recording results for main diff --git a/tests/value/oracle/call_simple.res.oracle b/tests/value/oracle/call_simple.res.oracle index 10f8eadc49323fbb4d2ec2f32ca759d16e0dc4d3..cda7e851fe05669a6122d40ffcee208dcbd69a51 100644 --- a/tests/value/oracle/call_simple.res.oracle +++ b/tests/value/oracle/call_simple.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/call_simple.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/case_analysis.0.res.oracle b/tests/value/oracle/case_analysis.0.res.oracle index 84f0b3666d779296658268de1c25a45aa0fdf39d..d2989f03c0c615e7fea52a3a0db093955c8cebd6 100644 --- a/tests/value/oracle/case_analysis.0.res.oracle +++ b/tests/value/oracle/case_analysis.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/case_analysis.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/case_analysis.1.res.oracle b/tests/value/oracle/case_analysis.1.res.oracle index eb05f0a48636fca2edf971ea95ac48ca591a863b..bc28f1362094c0ad41e0d6365df56ec159a26f92 100644 --- a/tests/value/oracle/case_analysis.1.res.oracle +++ b/tests/value/oracle/case_analysis.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/case_analysis.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cast.res.oracle b/tests/value/oracle/cast.res.oracle index d979e3353db8b9de77fb6c667b9345cae2db44c6..d1bbfcf525297485f7c1dc9c78f5965832fde80b 100644 --- a/tests/value/oracle/cast.res.oracle +++ b/tests/value/oracle/cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -26,37 +25,38 @@ Called from tests/value/cast.i:73. [value] computing for function any_int_4 <- main1 <- main. Called from tests/value/cast.i:33. +tests/value/cast.i:27:[value] warning: initialization of volatile variable i_0 ignored [value] Recording results for any_int_4 [value] Done for function any_int_4 -[value] computing for function printf_0 <- main1 <- main. +[value] computing for function printf_va_1 <- main1 <- main. Called from tests/value/cast.i:46. -[value] using specification for function printf_0 -tests/value/cast.i:46:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 +[value] using specification for function printf_va_1 +tests/value/cast.i:46:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/cast.i:74. tests/value/cast.i:64:[value] entering loop for the first time -[value] computing for function printf_1 <- main2 <- main. +[value] computing for function printf_va_2 <- main2 <- main. Called from tests/value/cast.i:67. -[value] using specification for function printf_1 -tests/value/cast.i:67:[value] function printf_1: precondition got status valid. -[value] Done for function printf_1 -[value] computing for function printf_1 <- main2 <- main. +[value] using specification for function printf_va_2 +tests/value/cast.i:67:[value] function printf_va_2: precondition got status valid. +[value] Done for function printf_va_2 +[value] computing for function printf_va_2 <- main2 <- main. Called from tests/value/cast.i:67. -[value] Done for function printf_1 -[value] computing for function printf_1 <- main2 <- main. +[value] Done for function printf_va_2 +[value] computing for function printf_va_2 <- main2 <- main. Called from tests/value/cast.i:67. -[value] Done for function printf_1 -[value] computing for function printf_1 <- main2 <- main. +[value] Done for function printf_va_2 +[value] computing for function printf_va_2 <- main2 <- main. Called from tests/value/cast.i:67. -[value] Done for function printf_1 -[value] computing for function printf_2 <- main2 <- main. +[value] Done for function printf_va_2 +[value] computing for function printf_va_3 <- main2 <- main. Called from tests/value/cast.i:69. -[value] using specification for function printf_2 -tests/value/cast.i:69:[value] function printf_2: precondition got status valid. -[value] Done for function printf_2 +[value] using specification for function printf_va_3 +tests/value/cast.i:69:[value] function printf_va_3: precondition got status valid. +[value] Done for function printf_va_3 [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main @@ -98,14 +98,14 @@ tests/value/cast.i:69:[value] function printf_2: precondition got status valid. [from] Computing for function any_int_4 [from] Done for function any_int_4 [from] Computing for function main1 -[from] Computing for function printf_0 <-main1 -[from] Done for function printf_0 +[from] Computing for function printf_va_1 <-main1 +[from] Done for function printf_va_1 [from] Done for function main1 [from] Computing for function main2 -[from] Computing for function printf_1 <-main2 -[from] Done for function printf_1 -[from] Computing for function printf_2 <-main2 -[from] Done for function printf_2 +[from] Computing for function printf_va_2 <-main2 +[from] Done for function printf_va_2 +[from] Computing for function printf_va_3 <-main2 +[from] Done for function printf_va_3 [from] Done for function main2 [from] Computing for function main [from] Done for function main @@ -113,7 +113,7 @@ tests/value/cast.i:69:[value] function printf_2: precondition got status valid. These dependencies hold at termination for the executions that terminate: [from] Function any_int_4: \result FROM \nothing -[from] Function printf_0: +[from] Function printf_va_1: S___fc_stdout[0].__fc_FILE_data FROM param0; S___fc_stdout[0]; "%ud\n"[bits 0 to 39] (and SELF) @@ -131,13 +131,13 @@ tests/value/cast.i:69:[value] function printf_2: precondition got status valid. ull FROM \nothing S___fc_stdout[0].__fc_FILE_data FROM S___fc_stdout[0]; "%ud\n"[bits 0 to 39] (and SELF) -[from] Function printf_1: +[from] Function printf_va_2: S___fc_stdout[0].__fc_FILE_data FROM param0; param1; S___fc_stdout[0]; "cast:%d formule:%d\n"[bits 0 to 159] (and SELF) \result FROM param0; param1; S___fc_stdout[0]; "cast:%d formule:%d\n"[bits 0 to 159] -[from] Function printf_2: +[from] Function printf_va_3: S___fc_stdout[0].__fc_FILE_data FROM param0; S___fc_stdout[0]; "usc: %ud"[bits 0 to 71] (and SELF) diff --git a/tests/value/oracle/cast1.res.oracle b/tests/value/oracle/cast1.res.oracle index aed46fdb66fa74b9753fce066c034b6bb6df52b1..1c2daeb394ad2d25507f08159572525b2abbf03c 100644 --- a/tests/value/oracle/cast1.res.oracle +++ b/tests/value/oracle/cast1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cast2.res.oracle b/tests/value/oracle/cast2.res.oracle index 72b985e083417e89bdab67d981c87c4364560bcc..f97add07abaca8c23633f7ba8e74e77f8eb8c4d9 100644 --- a/tests/value/oracle/cast2.res.oracle +++ b/tests/value/oracle/cast2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -23,7 +22,7 @@ tests/value/cast2.i:9:[value] warning: signed overflow. assert t + 1 ≤ 2147483 [value] computing for function any_int <- passcast <- main. Called from tests/value/cast2.i:20. [value] Done for function any_int -[value] Called Frama_C_show_each([-128..100]) +tests/value/cast2.i:23:[value] Frama_C_show_each: [-128..100] tests/value/cast2.i:24:[value] entering loop for the first time [value] Recording results for passcast [value] Done for function passcast diff --git a/tests/value/oracle/cast_axalto.res.oracle b/tests/value/oracle/cast_axalto.res.oracle index a4bc0f8b5c5dafa9a4565b745014cf2ed8ec967c..bf690548a6e4a6d20fe64757483a7f3633d3b95d 100644 --- a/tests/value/oracle/cast_axalto.res.oracle +++ b/tests/value/oracle/cast_axalto.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast_axalto.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cast_fun.res.oracle b/tests/value/oracle/cast_fun.res.oracle index e6939d5de83e6b5fb656f2f71f46f1ea77f773d0..f05536f88a18aad31363dc794249aea258d95a59 100644 --- a/tests/value/oracle/cast_fun.res.oracle +++ b/tests/value/oracle/cast_fun.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast_fun.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -27,10 +26,7 @@ tests/value/cast_fun.i:78:[value] warning: pointer to function with incompatible Called from tests/value/cast_fun.i:83. [value] using specification for function f6 [value] Done for function f6 -[value] computing for function f7 <- main. - Called from tests/value/cast_fun.i:88. -[value] using specification for function f7 -[value] Done for function f7 +tests/value/cast_fun.i:88:[value] warning: pointer to function with incompatible type. assert \valid_function(p2); tests/value/cast_fun.i:93:[value] warning: pointer to function with incompatible type. assert \valid_function(p2); [value] computing for function f9 <- main. Called from tests/value/cast_fun.i:98. @@ -55,6 +51,7 @@ tests/value/cast_fun.i:113:[from] warning: variadic call detected. Using only 0 [value] done for function main tests/value/cast_fun.i:73:[value] assertion 'Value,function_pointer' got final status invalid. tests/value/cast_fun.i:78:[value] assertion 'Value,function_pointer' got final status invalid. +tests/value/cast_fun.i:88:[value] assertion 'Value,function_pointer' got final status invalid. tests/value/cast_fun.i:93:[value] assertion 'Value,function_pointer' got final status invalid. tests/value/cast_fun.i:103:[value] assertion 'Value,function_pointer' got final status invalid. tests/value/cast_fun.i:108:[value] assertion 'Value,function_pointer' got final status invalid. @@ -64,7 +61,7 @@ tests/value/cast_fun.i:128:[value] assertion 'Value,function_pointer' got final [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: p1 ∈ {{ &f1 ; (int (*)(int ))&f2 ; &f3 }} or UNINITIALIZED - p2 ∈ {{ &f6 ; (void (*)(struct s1 ))&f7 }} or UNINITIALIZED + p2 ∈ {{ &f6 }} or UNINITIALIZED p3 ∈ {{ &f9 }} or UNINITIALIZED p4 ∈ {{ &f10 }} or UNINITIALIZED x ∈ [--..--] or UNINITIALIZED @@ -78,8 +75,6 @@ tests/value/cast_fun.i:128:[value] assertion 'Value,function_pointer' got final [from] Done for function f3 [from] Computing for function f6 <-main [from] Done for function f6 -[from] Computing for function f7 <-main -[from] Done for function f7 [from] Computing for function f9 <-main [from] Done for function f9 [from] Computing for function f10 <-main @@ -97,8 +92,6 @@ tests/value/cast_fun.i:128:[value] assertion 'Value,function_pointer' got final \result FROM ANYTHING(origin:Unknown) [from] Function f6: NO EFFECTS -[from] Function f7: - NO EFFECTS [from] Function f9: NO EFFECTS [from] Function main: @@ -113,8 +106,6 @@ tests/value/cast_fun.i:128:[value] assertion 'Value,function_pointer' got final \result FROM ANYTHING(origin:Unknown) [from] call to f6 at tests/value/cast_fun.i:83 (by main): NO EFFECTS -[from] call to f7 at tests/value/cast_fun.i:88 (by main): - NO EFFECTS [from] call to f9 at tests/value/cast_fun.i:98 (by main): NO EFFECTS [from] call to f10 at tests/value/cast_fun.i:113 (by main): diff --git a/tests/value/oracle/cast_hetero.res.oracle b/tests/value/oracle/cast_hetero.res.oracle index 0f33de05bd25891c334ffbc166aa56f2ed5580f3..ffeb4530bf49bf913ecfdf83a12c75de1696e193 100644 --- a/tests/value/oracle/cast_hetero.res.oracle +++ b/tests/value/oracle/cast_hetero.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast_hetero.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cast_return.0.res.oracle b/tests/value/oracle/cast_return.0.res.oracle index 6b1bb307597d495a84ab19120055d61690faf895..19176ae722a85f6aa7e2c703aeb0ebf0f17612c5 100644 --- a/tests/value/oracle/cast_return.0.res.oracle +++ b/tests/value/oracle/cast_return.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast_return.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -16,7 +15,7 @@ Called from tests/value/cast_return.c:27. [value] Recording results for g [value] Done for function g -tests/value/cast_return.c:27:[kernel] warning: returned value may be uninitialized: assert \initialized(\returned_value) +tests/value/cast_return.c:27:[value] warning: returned value may be uninitialized: assert \initialized(\returned_value) [value] computing for function h <- main1 <- main. Called from tests/value/cast_return.c:31. [value] Recording results for h @@ -31,12 +30,12 @@ tests/value/cast_return.c:31:[kernel] warning: all target addresses were invalid Called from tests/value/cast_return.c:50. [value] Recording results for fl1 [value] Done for function fl1 -tests/value/cast_return.c:50:[kernel] warning: returned value may be uninitialized: assert \initialized(\returned_value) +tests/value/cast_return.c:50:[value] warning: returned value may be uninitialized: assert \initialized(\returned_value) [value] computing for function fl2 <- main2 <- main. Called from tests/value/cast_return.c:51. [value] Recording results for fl2 [value] Done for function fl2 -tests/value/cast_return.c:51:[kernel] warning: returned value may be uninitialized: assert \initialized(\returned_value) +tests/value/cast_return.c:51:[value] warning: returned value may be uninitialized: assert \initialized(\returned_value) [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. @@ -178,20 +177,16 @@ char h(void) void main1(void) { if (c) { - float f_; int tmp; tmp = f(); - f_ = (float)tmp; + float f_ = (float)tmp; } if (c) { - long long v; - v = (long long)g(); + long long v = g(); } if (c) { - int *x; - int **p; - x = (int *)0; - p = & x; + int *x = (int *)0; + int **p = & x; /*@ assert Value: mem_access: \valid(*p); */ *(*p) = (int)h(); } @@ -227,11 +222,9 @@ float ret_float(); void main3(void) { - float f1; - float f2; - f1 = ret_float(); + float f1 = ret_float(); /*@ assert Value: is_nan_or_infinite: \is_finite(f1); */ - f2 = f1 + (float)1; + float f2 = f1 + (float)1; return; } diff --git a/tests/value/oracle/cast_return.1.res.oracle b/tests/value/oracle/cast_return.1.res.oracle index cd0b34e9ef14cba6004663b29153f35b02bd9e03..bf4ef51df53b8207550e51c152da95c236b15444 100644 --- a/tests/value/oracle/cast_return.1.res.oracle +++ b/tests/value/oracle/cast_return.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cast_return.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -186,29 +185,23 @@ char h(void) void main1(void) { if (c) { - float f_; int tmp; tmp = f(); - f_ = (float)tmp; + float f_ = (float)tmp; } if (c) { - long long v; int tmp_0; tmp_0 = g(); /*@ assert Value: initialisation: \initialized(&tmp_0); */ - v = (long long)tmp_0; + long long v = (long long)tmp_0; } if (c) { - int *x; - int **p; char tmp_1; - x = (int *)0; - p = & x; - { /* sequence */ - tmp_1 = h(); - /*@ assert Value: mem_access: \valid(*p); */ - *(*p) = (int)tmp_1; - } + int *x = (int *)0; + int **p = & x; + tmp_1 = h(); + /*@ assert Value: mem_access: \valid(*p); */ + *(*p) = (int)tmp_1; } return; } @@ -234,17 +227,13 @@ void main2(void) float tmp_0; if (c) { float tmp; - { /* sequence */ - tmp = fl1(); - /*@ assert Value: initialisation: \initialized(&tmp); */ - d1 = (double)tmp; - } - } - { /* sequence */ - tmp_0 = fl2(); - /*@ assert Value: initialisation: \initialized(&tmp_0); */ - d2 = (double)tmp_0; + tmp = fl1(); + /*@ assert Value: initialisation: \initialized(&tmp); */ + d1 = (double)tmp; } + tmp_0 = fl2(); + /*@ assert Value: initialisation: \initialized(&tmp_0); */ + d2 = (double)tmp_0; return; } @@ -254,13 +243,11 @@ float ret_float(); void main3(void) { - float f1; float tmp; - float f2; tmp = ret_float(); /*@ assert Value: is_nan_or_infinite: \is_finite(tmp); */ - f1 = tmp; - f2 = f1 + (float)1; + float f1 = tmp; + float f2 = f1 + (float)1; return; } diff --git a/tests/value/oracle/cert_exp35_c.res.oracle b/tests/value/oracle/cert_exp35_c.res.oracle index 76d866119a828580c26c80da6a9464a772940d13..1235dcc034a706a2d5ca51e76e0a01874cdabf4c 100644 --- a/tests/value/oracle/cert_exp35_c.res.oracle +++ b/tests/value/oracle/cert_exp35_c.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cert_exp35_c.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,11 +9,11 @@ Called from tests/value/cert_exp35_c.i:24. [value] Recording results for addressee [value] Done for function addressee -[value] computing for function printf_0 <- main. +[value] computing for function printf_va_1 <- main. Called from tests/value/cert_exp35_c.i:24. -[value] using specification for function printf_0 -tests/value/cert_exp35_c.i:24:[value] function printf_0: precondition got status valid. -[value] Done for function printf_0 +[value] using specification for function printf_va_1 +tests/value/cert_exp35_c.i:24:[value] function printf_va_1: precondition got status valid. +[value] Done for function printf_va_1 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -31,14 +30,14 @@ tests/value/cert_exp35_c.i:24:[value] function printf_0: precondition got status [from] Computing for function addressee [from] Done for function addressee [from] Computing for function main -[from] Computing for function printf_0 <-main -[from] Done for function printf_0 +[from] Computing for function printf_va_1 <-main +[from] Done for function printf_va_1 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: [from] Function addressee: \result FROM \nothing -[from] Function printf_0: +[from] Function printf_va_1: S___fc_stdout[0].__fc_FILE_data FROM tmp; S___fc_stdout[0]; "Hello, %s!\n"[bits 0 to 95] (and SELF) diff --git a/tests/value/oracle/changeret.res.oracle b/tests/value/oracle/changeret.res.oracle index e9bb49d46f30522d6cf0bd5ace539e8d95f40431..52ac05746e1359f9f3cd34045c04375bba2c99f2 100644 --- a/tests/value/oracle/changeret.res.oracle +++ b/tests/value/oracle/changeret.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/changeret.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cmp.res.oracle b/tests/value/oracle/cmp.res.oracle index 0075a05b951282a297769b22df05fe65836b97e1..06e7db6307e6cf32413bfb5b7b41ce1868953ccd 100644 --- a/tests/value/oracle/cmp.res.oracle +++ b/tests/value/oracle/cmp.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cmp.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cmp_ptr.0.res.oracle b/tests/value/oracle/cmp_ptr.0.res.oracle index 945a75c5748c90de7308c43600e39118fce02256..cedb32b0f1b219c535ea2ba2406124a1b32c7e45 100644 --- a/tests/value/oracle/cmp_ptr.0.res.oracle +++ b/tests/value/oracle/cmp_ptr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cmp_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/cmp_ptr.1.res.oracle b/tests/value/oracle/cmp_ptr.1.res.oracle index 6f4df3082f915a302f3c90df6293825c447a53db..8b5ea43845ecb2ab0f880b31bdcdde37fc3caf91 100644 --- a/tests/value/oracle/cmp_ptr.1.res.oracle +++ b/tests/value/oracle/cmp_ptr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cmp_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -38,6 +37,8 @@ tests/value/cmp_ptr.i:21:[value:pointer-comparison] invalid pointer comparison: tests/value/cmp_ptr.i:21:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0; 1} because of UPCPA tests/value/cmp_ptr.i:21:[value:pointer-comparison] not reducing {{ &T + [-8589934588..8589934592],0%4 }} to {{ &T + [-8589934588..16],0%4 }} because of UPCPA +tests/value/cmp_ptr.i:21:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA +tests/value/cmp_ptr.i:21:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA tests/value/cmp_ptr.i:21:[value] warning: pointer comparison. assert \pointer_comparable((void *)p, (void *)(&T[5])); tests/value/cmp_ptr.i:21:[value:pointer-comparison] not reducing {{ &T + [-8589934588..8589934592],0%4 }} to {{ &T + [20..8589934592],0%4 }} because of UPCPA diff --git a/tests/value/oracle/cmp_ptr_follow_all_branches.0.res.oracle b/tests/value/oracle/cmp_ptr_follow_all_branches.0.res.oracle index befc116f3974ae2a6b11086fc81dc6030564ca93..668d8a8990f996c016843aab29fda4e02947359a 100644 --- a/tests/value/oracle/cmp_ptr_follow_all_branches.0.res.oracle +++ b/tests/value/oracle/cmp_ptr_follow_all_branches.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cmp_ptr_follow_all_branches.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,12 +10,12 @@ tests/value/cmp_ptr_follow_all_branches.i:14:[value:pointer-comparison] invalid tests/value/cmp_ptr_follow_all_branches.i:14:[value] warning: pointer comparison. assert \pointer_comparable((void *)(p + (unsigned int)((int)(-5))), (void *)p); -[value] Called Frama_C_show_each_2() +tests/value/cmp_ptr_follow_all_branches.i:14:[value] Frama_C_show_each_2: tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/cmp_ptr_follow_all_branches.i:15:[value] warning: pointer comparison. assert \pointer_comparable((void *)(q + (unsigned int)((int)(-5))), (void *)q); -[value] Called Frama_C_show_each_4() +tests/value/cmp_ptr_follow_all_branches.i:15:[value] Frama_C_show_each_4: [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/cmp_ptr_follow_all_branches.1.res.oracle b/tests/value/oracle/cmp_ptr_follow_all_branches.1.res.oracle index 00d4d3ba5d41aa0717c626bd98be38a777dcc729..8d52af082f068790d729b8a5145ff14d5542ed1d 100644 --- a/tests/value/oracle/cmp_ptr_follow_all_branches.1.res.oracle +++ b/tests/value/oracle/cmp_ptr_follow_all_branches.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cmp_ptr_follow_all_branches.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,16 +12,16 @@ tests/value/cmp_ptr_follow_all_branches.i:14:[value] warning: pointer comparison assert \pointer_comparable((void *)(p + (unsigned int)((int)(-5))), (void *)p); tests/value/cmp_ptr_follow_all_branches.i:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -[value] Called Frama_C_show_each_1() -[value] Called Frama_C_show_each_2() +tests/value/cmp_ptr_follow_all_branches.i:14:[value] Frama_C_show_each_1: +tests/value/cmp_ptr_follow_all_branches.i:14:[value] Frama_C_show_each_2: tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA tests/value/cmp_ptr_follow_all_branches.i:15:[value] warning: pointer comparison. assert \pointer_comparable((void *)(q + (unsigned int)((int)(-5))), (void *)q); tests/value/cmp_ptr_follow_all_branches.i:15:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA -[value] Called Frama_C_show_each_3() -[value] Called Frama_C_show_each_4() +tests/value/cmp_ptr_follow_all_branches.i:15:[value] Frama_C_show_each_3: +tests/value/cmp_ptr_follow_all_branches.i:15:[value] Frama_C_show_each_4: [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/cond.res.oracle b/tests/value/oracle/cond.res.oracle index 21c7763985b58e0420558fdc177432d97fee1a52..dfc8ee8d7a993996d432de9b21b4b9d006013f6b 100644 --- a/tests/value/oracle/cond.res.oracle +++ b/tests/value/oracle/cond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cond.i (no preprocessing) tests/value/cond.i:34:[kernel] warning: Calling undeclared function unknf. Old style K&R code? [value] Analyzing a complete application starting at main @@ -20,6 +19,19 @@ tests/value/cond.i:34:[kernel] warning: Calling undeclared function unknf. Old s p ∈ {0} z ∈ {0} R ∈ {0} + U[0] ∈ {0} + [1] ∈ {1} + [2] ∈ {2} + [3] ∈ {3} + [4] ∈ {4} + [5] ∈ {5} + [6] ∈ {6} + [7] ∈ {7} + [8] ∈ {8} + [9] ∈ {9} + [10] ∈ {10} + [11] ∈ {11} + [12] ∈ {0} tests/value/cond.i:14:[value] warning: out of bounds read. assert \valid_read(argv); tests/value/cond.i:14:[value] warning: out of bounds read. assert \valid_read(*argv); [value] computing for function f <- main. @@ -31,12 +43,18 @@ tests/value/cond.i:14:[value] warning: out of bounds read. assert \valid_read(*a tests/value/cond.i:34:[kernel] warning: Neither code nor specification for function unknf, generating default assigns from the prototype [value] using specification for function unknf [value] Done for function unknf -[value] Called Frama_C_show_each_2({0; 1; 2; 4; 5; 6; 7; 8}) -[value] Called Frama_C_show_each_3([0..8]) -[value] Called Frama_C_show_each_4([0..16],0%2) -[value] Called Frama_C_show_each_5([0..16],0%2) -[value] Called Frama_C_show_each_6({0; 2; 4; 6; 8; 12; 14; 16}) -[value] Called Frama_C_show_each_7([0..16],0%2) +tests/value/cond.i:37:[value] Frama_C_show_each_2: {0; 1; 2; 4; 5; 6; 7; 8} +tests/value/cond.i:38:[value] Frama_C_show_each_3: [0..8] +tests/value/cond.i:42:[value] Frama_C_show_each_4: [0..16],0%2 +tests/value/cond.i:43:[value] Frama_C_show_each_5: [0..16],0%2 +tests/value/cond.i:45:[value] Frama_C_show_each_6: {0; 2; 4; 6; 8; 12; 14; 16} +tests/value/cond.i:46:[value] Frama_C_show_each_7: [0..16],0%2 +[value] computing for function unknf <- main. + Called from tests/value/cond.i:48. +[value] Done for function unknf +tests/value/cond.i:49:[value] warning: accessing out of bounds index. assert w < 13; +tests/value/cond.i:52:[value] Frama_C_show_each_w: [1..11] +tests/value/cond.i:53:[value] assertion got status valid. [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -55,6 +73,7 @@ tests/value/cond.i:34:[kernel] warning: Neither code nor specification for funct s ∈ [--..--] u ∈ [0..8] v ∈ [0..16],0%2 + w ∈ [0..12] [from] Computing for function f [from] Done for function f [from] Computing for function main @@ -81,6 +100,6 @@ tests/value/cond.i:34:[kernel] warning: Neither code nor specification for funct [inout] Inputs for function f: G [inout] Out (internal) for function main: - x; y; i; p; z; R; r; inRet; c; s; tmp; tmp_0; u; tmp_1; v + x; y; i; p; z; R; r; inRet; c; s; tmp; tmp_0; u; tmp_1; v; w; tmp_2 [inout] Inputs for function main: - G; i; t[1..7]; p; S_argv[0]; S_0_S_argv[0] + G; i; t[1..7]; p; U[0..12]; S_argv[0]; S_0_S_argv[0] diff --git a/tests/value/oracle/cond2.0.res.oracle b/tests/value/oracle/cond2.0.res.oracle index 950dabcfe98da8f55449c1dd4f526710d96749bb..70229195b3b5bdfe87955bd32b769adb7d8df42e 100644 --- a/tests/value/oracle/cond2.0.res.oracle +++ b/tests/value/oracle/cond2.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cond2.i (no preprocessing) [value] Analyzing a complete application starting at zero_ou_un_0 [value] Computing initial state diff --git a/tests/value/oracle/cond2.1.res.oracle b/tests/value/oracle/cond2.1.res.oracle index 88f4698912f82dc6de248fa2bcb98ef6833ea607..2b35ae636ec6cfcb4c46d8f4d2648bbe4be1e9c6 100644 --- a/tests/value/oracle/cond2.1.res.oracle +++ b/tests/value/oracle/cond2.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cond2.i (no preprocessing) [value] Analyzing a complete application starting at un_1 [value] Computing initial state diff --git a/tests/value/oracle/cond3.res.oracle b/tests/value/oracle/cond3.res.oracle deleted file mode 100644 index e3402fbaf9a7083af0c9331524761a5bf1398064..0000000000000000000000000000000000000000 --- a/tests/value/oracle/cond3.res.oracle +++ /dev/null @@ -1,28 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/cond3.i (no preprocessing) -[value] Analyzing a complete application starting at main -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - Gx ∈ {0} - r ∈ {0} - x ∈ {0} -[value] Recording results for main -[value] done for function main -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function main: - r ∈ {-1} - x ∈ {1} -[from] Computing for function main -[from] Done for function main -[from] ====== DEPENDENCIES COMPUTED ====== - These dependencies hold at termination for the executions that terminate: -[from] Function main: - r FROM \nothing - x FROM Gx - \result FROM \nothing -[from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function main: - r; x -[inout] Inputs for function main: - Gx; r; x diff --git a/tests/value/oracle/cond_integer_cast_of_float.res.oracle b/tests/value/oracle/cond_integer_cast_of_float.res.oracle index 2293209fd4262232f42cc5e4bd2dc65d7751ae1a..d0e3701ebe368a7bd9c069125e6bdbb8199a266b 100644 --- a/tests/value/oracle/cond_integer_cast_of_float.res.oracle +++ b/tests/value/oracle/cond_integer_cast_of_float.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/cond_integer_cast_of_float.i (no preprocessing) tests/value/cond_integer_cast_of_float.i:79:[kernel] warning: Floating-point constant 1.17 is not represented exactly. Will use 0x1.2b851eb851eb8p0. See documentation for option -warn-decimal-float [value] Analyzing a complete application starting at main @@ -17,20 +16,21 @@ tests/value/cond_integer_cast_of_float.i:79:[kernel] warning: Floating-point con [value] computing for function main1 <- main. Called from tests/value/cond_integer_cast_of_float.i:121. tests/value/cond_integer_cast_of_float.i:13:[value] warning: function main1: precondition got status unknown. -[value] Called Frama_C_show_each_float_([2. .. 8.]) -[value] Called Frama_C_show_each_float_([-0. .. 4.99999952316]) -[value] Called Frama_C_show_each_float_([1. .. 8.]) -[value] Called Frama_C_show_each_float_([3. .. 3.99999976158]) -[value] Called Frama_C_show_each_double([2. .. 8.]) -[value] Called Frama_C_show_each_double([-0. .. 5.]) -[value] Called Frama_C_show_each_double([1. .. 8.]) -[value] Called Frama_C_show_each_double([3. .. 4.]) -[value] Called Frama_C_show_each([-0. .. 8.], [0..8]) +tests/value/cond_integer_cast_of_float.i:17:[value] Frama_C_show_each_float_: [2. .. 8.] +tests/value/cond_integer_cast_of_float.i:20:[value] Frama_C_show_each_float_: [-0. .. 4.99999952316] +tests/value/cond_integer_cast_of_float.i:23:[value] Frama_C_show_each_float_: [1. .. 8.] +tests/value/cond_integer_cast_of_float.i:26:[value] Frama_C_show_each_float_: [3. .. 3.99999976158] +tests/value/cond_integer_cast_of_float.i:29:[value] Frama_C_show_each_double: [2. .. 8.] +tests/value/cond_integer_cast_of_float.i:32:[value] Frama_C_show_each_double: [-0. .. 5.] +tests/value/cond_integer_cast_of_float.i:35:[value] Frama_C_show_each_double: [1. .. 8.] +tests/value/cond_integer_cast_of_float.i:38:[value] Frama_C_show_each_double: [3. .. 4.] +tests/value/cond_integer_cast_of_float.i:73:[value] Frama_C_show_each: [-0. .. 8.], [0..8] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/cond_integer_cast_of_float.i:123. -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 78 +tests/value/cond_integer_cast_of_float.i:78:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [1.17000007629 .. 3.40282346639e+38] f2 ∈ [-3.40282346639e+38 .. 3.40282346639e+38] @@ -40,8 +40,9 @@ tests/value/cond_integer_cast_of_float.i:13:[value] warning: function main1: pre d2 ∈ [-1.79769313486e+308 .. 1.79769313486e+308] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 81 + ==END OF DUMP== +tests/value/cond_integer_cast_of_float.i:81:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [-3.40282346639e+38 .. 1.16999995708] f2 ∈ [-3.40282346639e+38 .. 3.40282346639e+38] @@ -51,9 +52,9 @@ tests/value/cond_integer_cast_of_float.i:13:[value] warning: function main1: pre d2 ∈ [-1.79769313486e+308 .. 1.79769313486e+308] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== -[value] Called Frama_C_show_each_double([1.16999995708 .. 1.79769313486e+308]) -[value] Called Frama_C_show_each_double([1.17 .. 1.79769313486e+308]) + ==END OF DUMP== +tests/value/cond_integer_cast_of_float.i:84:[value] Frama_C_show_each_double: [1.16999995708 .. 1.79769313486e+308] +tests/value/cond_integer_cast_of_float.i:88:[value] Frama_C_show_each_double: [1.17 .. 1.79769313486e+308] [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. @@ -67,7 +68,8 @@ tests/value/cond_integer_cast_of_float.i:106:[value] warning: assertion got stat tests/value/cond_integer_cast_of_float.i:109:[value] warning: assertion got status unknown. tests/value/cond_integer_cast_of_float.i:112:[value] warning: assertion got status unknown. tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 115 +tests/value/cond_integer_cast_of_float.i:115:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [10.0000009537 .. 3.40282346639e+38] f2 ∈ [10.0000009537 .. 3.40282346639e+38] @@ -77,12 +79,13 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat d2 ∈ [-1000. .. 1000.] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main3 [value] Done for function main3 [value] computing for function main3 <- main. Called from tests/value/cond_integer_cast_of_float.i:127. -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 115 +tests/value/cond_integer_cast_of_float.i:115:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [10.0000009537 .. 3.40282346639e+38] f2 ∈ [10.0000009537 .. 3.40282346639e+38] @@ -92,7 +95,7 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat d2 ∈ [-1000. .. 1000.] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main3 [value] Done for function main3 [value] Recording results for main @@ -115,21 +118,21 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat Called from tests/value/cond_integer_cast_of_float.i:132. [value] computing for function main1 <- main <- mainbis. Called from tests/value/cond_integer_cast_of_float.i:121. -[value] Called Frama_C_show_each_float_([0x1.0000000000000p1 .. 0x1.0000000000000p3]) -[value] Called Frama_C_show_each_float_([-0x0.0000000000000p-1022 .. 0x1.3ffffe0000000p2]) -[value] Called Frama_C_show_each_float_([0x1.0000000000000p0 .. 0x1.0000000000000p3]) -[value] Called Frama_C_show_each_float_([0x1.8000000000000p1 .. 0x1.fffffe0000000p1]) -[value] Called Frama_C_show_each_double([0x1.0000000000000p1 .. 0x1.0000000000000p3]) -[value] Called Frama_C_show_each_double([-0x0.0000000000000p-1022 .. 0x1.3ffffffffffffp2]) -[value] Called Frama_C_show_each_double([0x1.0000000000000p0 .. 0x1.0000000000000p3]) -[value] Called Frama_C_show_each_double([0x1.8000000000000p1 .. 0x1.fffffffffffffp1]) -[value] Called Frama_C_show_each([-0x0.0000000000000p-1022 .. 0x1.0000000000000p3], - [0..8]) +tests/value/cond_integer_cast_of_float.i:17:[value] Frama_C_show_each_float_: [0x1.0000000000000p1 .. 0x1.0000000000000p3] +tests/value/cond_integer_cast_of_float.i:20:[value] Frama_C_show_each_float_: [-0x0.0000000000000p-1022 .. 0x1.3ffffe0000000p2] +tests/value/cond_integer_cast_of_float.i:23:[value] Frama_C_show_each_float_: [0x1.0000000000000p0 .. 0x1.0000000000000p3] +tests/value/cond_integer_cast_of_float.i:26:[value] Frama_C_show_each_float_: [0x1.8000000000000p1 .. 0x1.fffffe0000000p1] +tests/value/cond_integer_cast_of_float.i:29:[value] Frama_C_show_each_double: [0x1.0000000000000p1 .. 0x1.0000000000000p3] +tests/value/cond_integer_cast_of_float.i:32:[value] Frama_C_show_each_double: [-0x0.0000000000000p-1022 .. 0x1.3ffffffffffffp2] +tests/value/cond_integer_cast_of_float.i:35:[value] Frama_C_show_each_double: [0x1.0000000000000p0 .. 0x1.0000000000000p3] +tests/value/cond_integer_cast_of_float.i:38:[value] Frama_C_show_each_double: [0x1.8000000000000p1 .. 0x1.fffffffffffffp1] +tests/value/cond_integer_cast_of_float.i:73:[value] Frama_C_show_each: [-0x0.0000000000000p-1022 .. 0x1.0000000000000p3], [0..8] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main <- mainbis. Called from tests/value/cond_integer_cast_of_float.i:123. -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 78 +tests/value/cond_integer_cast_of_float.i:78:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [0x1.2b85200000000p0 .. 0x1.fffffe0000000p127] f2 ∈ [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] @@ -139,8 +142,9 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat d2 ∈ [-0x1.fffffffffffffp1023 .. 0x1.fffffffffffffp1023] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 81 + ==END OF DUMP== +tests/value/cond_integer_cast_of_float.i:81:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [-0x1.fffffe0000000p127 .. 0x1.2b851e0000000p0] f2 ∈ [-0x1.fffffe0000000p127 .. 0x1.fffffe0000000p127] @@ -150,14 +154,15 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat d2 ∈ [-0x1.fffffffffffffp1023 .. 0x1.fffffffffffffp1023] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== -[value] Called Frama_C_show_each_double([0x1.2b851e0000001p0 .. 0x1.fffffffffffffp1023]) -[value] Called Frama_C_show_each_double([0x1.2b851eb851eb9p0 .. 0x1.fffffffffffffp1023]) + ==END OF DUMP== +tests/value/cond_integer_cast_of_float.i:84:[value] Frama_C_show_each_double: [0x1.2b851e0000001p0 .. 0x1.fffffffffffffp1023] +tests/value/cond_integer_cast_of_float.i:88:[value] Frama_C_show_each_double: [0x1.2b851eb851eb9p0 .. 0x1.fffffffffffffp1023] [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main <- mainbis. Called from tests/value/cond_integer_cast_of_float.i:125. -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 115 +tests/value/cond_integer_cast_of_float.i:115:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [0x1.4000020000000p3 .. 0x1.fffffe0000000p127] f2 ∈ [0x1.4000020000000p3 .. 0x1.fffffe0000000p127] @@ -167,12 +172,13 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat d2 ∈ [-0x1.f400000000000p9 .. 0x1.f400000000000p9] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main3 [value] Done for function main3 [value] computing for function main3 <- main <- mainbis. Called from tests/value/cond_integer_cast_of_float.i:127. -[value] DUMPING STATE of file tests/value/cond_integer_cast_of_float.i line 115 +tests/value/cond_integer_cast_of_float.i:115:[value] Frama_C_dump_each: + # Cvalue domain: b ∈ {0} f1 ∈ [0x1.4000020000000p3 .. 0x1.fffffe0000000p127] f2 ∈ [0x1.4000020000000p3 .. 0x1.fffffe0000000p127] @@ -182,7 +188,7 @@ tests/value/cond_integer_cast_of_float.i:113:[value] warning: assertion got stat d2 ∈ [-0x1.f400000000000p9 .. 0x1.f400000000000p9] i ∈ [--..--] c ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main3 [value] Done for function main3 [value] Recording results for main diff --git a/tests/value/oracle/conditional_initializer.res.oracle b/tests/value/oracle/conditional_initializer.res.oracle index 3f078c50039f04cb64cf9374ad401ca33d279d37..dfcd8ca4588885efa487f44efc77f3c0ba6dc61c 100644 --- a/tests/value/oracle/conditional_initializer.res.oracle +++ b/tests/value/oracle/conditional_initializer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/conditional_initializer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/const.res.oracle b/tests/value/oracle/const.res.oracle index b7e211b51a37e7d24b4d360b3813ed556176bdc7..a8096c32355506fbaf9876cda55090ddbd3dfab4 100644 --- a/tests/value/oracle/const.res.oracle +++ b/tests/value/oracle/const.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/const.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -19,96 +18,114 @@ [5] ∈ {6} [6..9] ∈ {0} [value] computing for function const_formal <- main. - Called from tests/value/const.i:84. -[value] Called Frama_C_show_each([-2147483648..2147483647]) + Called from tests/value/const.i:102. +tests/value/const.i:20:[value] Frama_C_show_each: [-2147483648..2147483647] [value] Recording results for const_formal [value] Done for function const_formal [value] computing for function const_formal <- main. - Called from tests/value/const.i:85. -[value] Called Frama_C_show_each({42}) + Called from tests/value/const.i:103. +tests/value/const.i:20:[value] Frama_C_show_each: {42} [value] Recording results for const_formal [value] Done for function const_formal [value] computing for function modify_I <- main. - Called from tests/value/const.i:87. -[value] Called Frama_C_show_each({2}) + Called from tests/value/const.i:105. +tests/value/const.i:37:[value] Frama_C_show_each: {2} [value] computing for function pointer_to_const <- modify_I <- main. Called from tests/value/const.i:39. -[value] Called Frama_C_show_each({2; 3}) -[value] Called Frama_C_show_each_dead() +tests/value/const.i:25:[value] Frama_C_show_each: {2; 3} +tests/value/const.i:27:[value] Frama_C_show_each_dead: [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_I <- main. Called from tests/value/const.i:40. -[value] Called Frama_C_show_each({0; 2; 3}) -[value] Called Frama_C_show_each({{ &I }}) +tests/value/const.i:31:[value] Frama_C_show_each: {0; 2; 3} +tests/value/const.i:33:[value] Frama_C_show_each: {{ &I }} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_I [value] Done for function modify_I [value] computing for function modify_J <- main. - Called from tests/value/const.i:88. -[value] Called Frama_C_show_each({8}) + Called from tests/value/const.i:106. +tests/value/const.i:44:[value] Frama_C_show_each: {8} [value] computing for function pointer_to_const <- modify_J <- main. Called from tests/value/const.i:46. -[value] Called Frama_C_show_each({8; 9}) -[value] Called Frama_C_show_each_dead() +tests/value/const.i:25:[value] Frama_C_show_each: {8; 9} +tests/value/const.i:27:[value] Frama_C_show_each_dead: [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_J <- main. Called from tests/value/const.i:47. -[value] Called Frama_C_show_each({0; 8; 9}) -[value] Called Frama_C_show_each({{ &J }}) +tests/value/const.i:31:[value] Frama_C_show_each: {0; 8; 9} +tests/value/const.i:33:[value] Frama_C_show_each: {{ &J }} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_J [value] Done for function modify_J [value] computing for function modify_s <- main. - Called from tests/value/const.i:89. -[value] Called Frama_C_show_each({3}) + Called from tests/value/const.i:107. +tests/value/const.i:51:[value] Frama_C_show_each: {3} [value] computing for function pointer_to_const <- modify_s <- main. Called from tests/value/const.i:53. -[value] Called Frama_C_show_each({4}) -[value] Called Frama_C_show_each_dead() +tests/value/const.i:25:[value] Frama_C_show_each: {4} +tests/value/const.i:27:[value] Frama_C_show_each_dead: [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_s <- main. Called from tests/value/const.i:54. -[value] Called Frama_C_show_each({0; 4}) -[value] Called Frama_C_show_each({{ &s + {4} }}) +tests/value/const.i:31:[value] Frama_C_show_each: {0; 4} +tests/value/const.i:33:[value] Frama_C_show_each: {{ &s + {4} }} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_s [value] Done for function modify_s [value] computing for function modify_t <- main. - Called from tests/value/const.i:90. -[value] Called Frama_C_show_each({6}) + Called from tests/value/const.i:108. +tests/value/const.i:58:[value] Frama_C_show_each: {6} [value] computing for function pointer_to_const <- modify_t <- main. Called from tests/value/const.i:60. -[value] Called Frama_C_show_each({4}) -[value] Called Frama_C_show_each_dead() +tests/value/const.i:25:[value] Frama_C_show_each: {4} +tests/value/const.i:27:[value] Frama_C_show_each_dead: [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_t <- main. Called from tests/value/const.i:61. -[value] Called Frama_C_show_each({3}) -[value] Called Frama_C_show_each({{ &t + {8} }}) +tests/value/const.i:31:[value] Frama_C_show_each: {3} +tests/value/const.i:33:[value] Frama_C_show_each: {{ &t + {8} }} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_t [value] Done for function modify_t [value] computing for function constrain_G <- main. - Called from tests/value/const.i:91. + Called from tests/value/const.i:109. tests/value/const.i:71:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({1; 4}) +tests/value/const.i:74:[value] Frama_C_show_each: {1; 4} [value] Recording results for constrain_G [value] Done for function constrain_G [value] computing for function pointer_to_const_logic <- main. - Called from tests/value/const.i:93. + Called from tests/value/const.i:111. [value] Recording results for pointer_to_const_logic [value] Done for function pointer_to_const_logic +[value] computing for function local_const <- main. + Called from tests/value/const.i:112. +[value] computing for function f <- local_const <- main. + Called from tests/value/const.i:88. +[value] Recording results for f +[value] Done for function f +[value] Recording results for local_const +[value] Done for function local_const +[value] computing for function ret_const <- main. + Called from tests/value/const.i:113. +[value] computing for function aux_ret_const <- ret_const <- main. + Called from tests/value/const.i:98. +[value] Recording results for aux_ret_const +[value] Done for function aux_ret_const +[value] Recording results for ret_const +[value] Done for function ret_const [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function aux_ret_const: + __retres ∈ {1} [value:final-states] Values at end of function const_destination: I ∈ {0; 2; 3} J ∈ {0; 8; 9} @@ -125,6 +142,11 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. i ∈ [--..--] [value:final-states] Values at end of function constrain_G: r ∈ {3; 5} +[value:final-states] Values at end of function f: + __retres ∈ {7} +[value:final-states] Values at end of function local_const: + x ∈ {5} + y ∈ {7} [value:final-states] Values at end of function pointer_to_const: I ∈ {0; 2; 3} J ∈ {0; 8; 9} @@ -139,45 +161,12 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. [6..9] ∈ {0} [value:final-states] Values at end of function modify_I: I ∈ {0; 2; 3} - J ∈ {8} - s.i1 ∈ {3} - .i2 ∈ {4} - t[0] ∈ {1} - [1] ∈ {2} - [2] ∈ {3} - [3] ∈ {4} - [4] ∈ {5} - [5] ∈ {6} - [6..9] ∈ {0} [value:final-states] Values at end of function modify_J: - I ∈ {0; 2; 3} J ∈ {0; 8; 9} - s.i1 ∈ {3} - .i2 ∈ {4} - t[0] ∈ {1} - [1] ∈ {2} - [2] ∈ {3} - [3] ∈ {4} - [4] ∈ {5} - [5] ∈ {6} - [6..9] ∈ {0} [value:final-states] Values at end of function modify_s: - I ∈ {0; 2; 3} - J ∈ {0; 8; 9} s.i1 ∈ {3; 4} .i2 ∈ {0; 4} - t[0] ∈ {1} - [1] ∈ {2} - [2] ∈ {3} - [3] ∈ {4} - [4] ∈ {5} - [5] ∈ {6} - [6..9] ∈ {0} [value:final-states] Values at end of function modify_t: - I ∈ {0; 2; 3} - J ∈ {0; 8; 9} - s.i1 ∈ {3; 4} - .i2 ∈ {0; 4} t[0] ∈ {1} [1] ∈ {2} [2] ∈ {0; 3} @@ -187,6 +176,8 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. [6..9] ∈ {0} [value:final-states] Values at end of function pointer_to_const_logic: J ∈ {0; 8; 9; 12} +[value:final-states] Values at end of function ret_const: + [value:final-states] Values at end of function main: I ∈ {0; 2; 3} J ∈ {0; 8; 9; 12} @@ -199,12 +190,18 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. [4] ∈ {5} [5] ∈ {6; 7} [6..9] ∈ {0} +[from] Computing for function aux_ret_const +[from] Done for function aux_ret_const [from] Computing for function const_destination [from] Done for function const_destination [from] Computing for function const_formal [from] Done for function const_formal [from] Computing for function constrain_G [from] Done for function constrain_G +[from] Computing for function f +[from] Done for function f +[from] Computing for function local_const +[from] Done for function local_const [from] Computing for function pointer_to_const [from] Done for function pointer_to_const [from] Computing for function modify_I @@ -217,10 +214,14 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. [from] Done for function modify_t [from] Computing for function pointer_to_const_logic [from] Done for function pointer_to_const_logic +[from] Computing for function ret_const +[from] Done for function ret_const [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: +[from] Function aux_ret_const: + \result FROM \nothing [from] Function const_destination: I FROM p (and SELF) J FROM p (and SELF) @@ -230,6 +231,10 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. NO EFFECTS [from] Function constrain_G: NO EFFECTS +[from] Function f: + \result FROM \nothing +[from] Function local_const: + NO EFFECTS [from] Function pointer_to_const: I FROM p (and SELF) J FROM p (and SELF) @@ -259,6 +264,8 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. [5] FROM v; t[5] (and SELF) [from] Function pointer_to_const_logic: J FROM v; p (and SELF) +[from] Function ret_const: + \result FROM \nothing [from] Function main: I FROM I; v (and SELF) J FROM J; v (and SELF) @@ -267,6 +274,10 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. t[2..3] FROM v (and SELF) [5] FROM v; t[5] (and SELF) [from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function aux_ret_const: + __retres +[inout] Inputs for function aux_ret_const: + \nothing [inout] Out (internal) for function const_destination: I; J; s.i2; t[2] [inout] Inputs for function const_destination: @@ -279,30 +290,42 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. r [inout] Inputs for function constrain_G: G +[inout] Out (internal) for function f: + __retres +[inout] Inputs for function f: + \nothing +[inout] Out (internal) for function local_const: + x; y +[inout] Inputs for function local_const: + \nothing [inout] Out (internal) for function pointer_to_const: I; J; s.i2; t[3] [inout] Inputs for function pointer_to_const: I; J; s.i2; t[3] [inout] Out (internal) for function modify_I: - I; J; s.i2; t[2..3] + I [inout] Inputs for function modify_I: I; J; v; s.i2; t[2..3] [inout] Out (internal) for function modify_J: - I; J; s.i2; t[2..3] + J [inout] Inputs for function modify_J: I; J; v; s.i2; t[2..3] [inout] Out (internal) for function modify_s: - I; J; s; t[2..3] + s [inout] Inputs for function modify_s: I; J; v; s; t[2..3] [inout] Out (internal) for function modify_t: - I; J; s.i2; t{[2..3]; [5]} + t{[2..3]; [5]} [inout] Inputs for function modify_t: I; J; v; s.i2; t{[2..3]; [5]} [inout] Out (internal) for function pointer_to_const_logic: J [inout] Inputs for function pointer_to_const_logic: v +[inout] Out (internal) for function ret_const: + tmp +[inout] Inputs for function ret_const: + \nothing [inout] Out (internal) for function main: I; J; s; t{[2..3]; [5]} [inout] Inputs for function main: @@ -326,32 +349,32 @@ tests/value/const.i:71:[value] warning: assertion got status unknown. [5] ∈ {6} [6..9] ∈ {0} [value] computing for function const_formal <- main. - Called from tests/value/const.i:84. -[value] Called Frama_C_show_each([-2147483648..2147483647]) + Called from tests/value/const.i:102. +tests/value/const.i:20:[value] Frama_C_show_each: [-2147483648..2147483647] tests/value/const.i:21:[value] warning: out of bounds write. assert \valid(&i); tests/value/const.i:21:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] Recording results for const_formal [value] Done for function const_formal [value] computing for function const_formal <- main. - Called from tests/value/const.i:85. -[value] Called Frama_C_show_each({42}) + Called from tests/value/const.i:103. +tests/value/const.i:20:[value] Frama_C_show_each: {42} [value] Recording results for const_formal [value] Done for function const_formal [value] computing for function modify_I <- main. - Called from tests/value/const.i:87. -[value] Called Frama_C_show_each({2}) + Called from tests/value/const.i:105. +tests/value/const.i:37:[value] Frama_C_show_each: {2} tests/value/const.i:38:[value] warning: out of bounds write. assert \valid(&I); tests/value/const.i:38:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] computing for function pointer_to_const <- modify_I <- main. Called from tests/value/const.i:39. -[value] Called Frama_C_show_each({2}) +tests/value/const.i:25:[value] Frama_C_show_each: {2} tests/value/const.i:26:[value] warning: out of bounds write. assert \valid(p); tests/value/const.i:26:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_I <- main. Called from tests/value/const.i:40. -[value] Called Frama_C_show_each({2}) +tests/value/const.i:31:[value] Frama_C_show_each: {2} tests/value/const.i:32:[value] warning: out of bounds write. assert \valid(p); tests/value/const.i:32:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] Recording results for const_destination @@ -359,66 +382,82 @@ tests/value/const.i:32:[kernel] warning: all target addresses were invalid. This [value] Recording results for modify_I [value] Done for function modify_I [value] computing for function modify_J <- main. - Called from tests/value/const.i:88. -[value] Called Frama_C_show_each({8}) + Called from tests/value/const.i:106. +tests/value/const.i:44:[value] Frama_C_show_each: {8} [value] computing for function pointer_to_const <- modify_J <- main. Called from tests/value/const.i:46. -[value] Called Frama_C_show_each({8; 9}) +tests/value/const.i:25:[value] Frama_C_show_each: {8; 9} [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_J <- main. Called from tests/value/const.i:47. -[value] Called Frama_C_show_each({8; 9}) -[value] Called Frama_C_show_each({{ &J }}) +tests/value/const.i:31:[value] Frama_C_show_each: {8; 9} +tests/value/const.i:33:[value] Frama_C_show_each: {{ &J }} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_J [value] Done for function modify_J [value] computing for function modify_s <- main. - Called from tests/value/const.i:89. -[value] Called Frama_C_show_each({3}) + Called from tests/value/const.i:107. +tests/value/const.i:51:[value] Frama_C_show_each: {3} tests/value/const.i:52:[value] warning: out of bounds write. assert \valid(&s.i1); tests/value/const.i:52:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] computing for function pointer_to_const <- modify_s <- main. Called from tests/value/const.i:53. -[value] Called Frama_C_show_each({4}) +tests/value/const.i:25:[value] Frama_C_show_each: {4} [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_s <- main. Called from tests/value/const.i:54. -[value] Called Frama_C_show_each({4}) +tests/value/const.i:31:[value] Frama_C_show_each: {4} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_s [value] Done for function modify_s [value] computing for function modify_t <- main. - Called from tests/value/const.i:90. -[value] Called Frama_C_show_each({6}) + Called from tests/value/const.i:108. +tests/value/const.i:58:[value] Frama_C_show_each: {6} tests/value/const.i:59:[value] warning: out of bounds write. assert \valid(&t[5]); tests/value/const.i:59:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] computing for function pointer_to_const <- modify_t <- main. Called from tests/value/const.i:60. -[value] Called Frama_C_show_each({4}) +tests/value/const.i:25:[value] Frama_C_show_each: {4} [value] Recording results for pointer_to_const [value] Done for function pointer_to_const [value] computing for function const_destination <- modify_t <- main. Called from tests/value/const.i:61. -[value] Called Frama_C_show_each({3}) +tests/value/const.i:31:[value] Frama_C_show_each: {3} [value] Recording results for const_destination [value] Done for function const_destination [value] Recording results for modify_t [value] Done for function modify_t [value] computing for function constrain_G <- main. - Called from tests/value/const.i:91. -[value] Called Frama_C_show_each({1; 4}) + Called from tests/value/const.i:109. +tests/value/const.i:74:[value] Frama_C_show_each: {1; 4} [value] Recording results for constrain_G [value] Done for function constrain_G [value] computing for function pointer_to_const_logic <- main. - Called from tests/value/const.i:93. + Called from tests/value/const.i:111. tests/value/const.i:80:[value] warning: out of bounds write. assert \valid(p); tests/value/const.i:80:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. [value] Recording results for pointer_to_const_logic [value] Done for function pointer_to_const_logic +[value] computing for function local_const <- main. + Called from tests/value/const.i:112. +[value] computing for function f <- local_const <- main. + Called from tests/value/const.i:88. +[value] Recording results for f +[value] Done for function f +[value] Recording results for local_const +[value] Done for function local_const +[value] computing for function ret_const <- main. + Called from tests/value/const.i:113. +[value] computing for function aux_ret_const <- ret_const <- main. + Called from tests/value/const.i:98. +[value] Recording results for aux_ret_const +[value] Done for function aux_ret_const +[value] Recording results for ret_const +[value] Done for function ret_const [value] Recording results for main [value] done for function main tests/value/const.i:21:[value] assertion 'Value,mem_access' got final status invalid. @@ -428,32 +467,47 @@ tests/value/const.i:52:[value] assertion 'Value,mem_access' got final status inv tests/value/const.i:59:[value] assertion 'Value,mem_access' got final status invalid. tests/value/const.i:80:[value] assertion 'Value,mem_access' got final status invalid. [value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function aux_ret_const: + __retres ∈ {1} [value:final-states] Values at end of function const_destination: J ∈ {0} [value:final-states] Values at end of function const_formal: [value:final-states] Values at end of function constrain_G: r ∈ {3; 5} +[value:final-states] Values at end of function f: + __retres ∈ {7} +[value:final-states] Values at end of function local_const: + x ∈ {5} + y ∈ {7} [value:final-states] Values at end of function pointer_to_const: NON TERMINATING FUNCTION [value:final-states] Values at end of function modify_I: - J ∈ {8} + [value:final-states] Values at end of function modify_J: J ∈ {0; 8; 9} [value:final-states] Values at end of function modify_s: - J ∈ {0; 8; 9} + [value:final-states] Values at end of function modify_t: - J ∈ {0; 8; 9} + [value:final-states] Values at end of function pointer_to_const_logic: +[value:final-states] Values at end of function ret_const: + [value:final-states] Values at end of function main: J ∈ {0; 8; 9} +[from] Computing for function aux_ret_const +[from] Done for function aux_ret_const [from] Computing for function const_destination [from] Done for function const_destination [from] Computing for function const_formal [from] Done for function const_formal [from] Computing for function constrain_G [from] Done for function constrain_G +[from] Computing for function f +[from] Done for function f +[from] Computing for function local_const +[from] Done for function local_const [from] Computing for function pointer_to_const [from] Non-terminating function pointer_to_const (no dependencies) [from] Done for function pointer_to_const @@ -467,16 +521,24 @@ tests/value/const.i:80:[value] assertion 'Value,mem_access' got final status inv [from] Done for function modify_t [from] Computing for function pointer_to_const_logic [from] Done for function pointer_to_const_logic +[from] Computing for function ret_const +[from] Done for function ret_const [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: +[from] Function aux_ret_const: + \result FROM \nothing [from] Function const_destination: J FROM p [from] Function const_formal: NO EFFECTS [from] Function constrain_G: NO EFFECTS +[from] Function f: + \result FROM \nothing +[from] Function local_const: + NO EFFECTS [from] Function pointer_to_const: NON TERMINATING - NO EFFECTS [from] Function modify_I: @@ -489,9 +551,15 @@ tests/value/const.i:80:[value] assertion 'Value,mem_access' got final status inv J FROM v (and SELF) [from] Function pointer_to_const_logic: J FROM v; p (and SELF) +[from] Function ret_const: + \result FROM \nothing [from] Function main: J FROM J; v (and SELF) [from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function aux_ret_const: + __retres +[inout] Inputs for function aux_ret_const: + \nothing [inout] Out (internal) for function const_destination: J [inout] Inputs for function const_destination: @@ -504,12 +572,20 @@ tests/value/const.i:80:[value] assertion 'Value,mem_access' got final status inv r [inout] Inputs for function constrain_G: G +[inout] Out (internal) for function f: + __retres +[inout] Inputs for function f: + \nothing +[inout] Out (internal) for function local_const: + x; y +[inout] Inputs for function local_const: + \nothing [inout] Out (internal) for function pointer_to_const: \nothing [inout] Inputs for function pointer_to_const: I; J; s.i2; t[3] [inout] Out (internal) for function modify_I: - J + \nothing [inout] Inputs for function modify_I: I; J; v; s.i2; t[2..3] [inout] Out (internal) for function modify_J: @@ -517,17 +593,21 @@ tests/value/const.i:80:[value] assertion 'Value,mem_access' got final status inv [inout] Inputs for function modify_J: I; J; v; s.i2; t[2..3] [inout] Out (internal) for function modify_s: - J + \nothing [inout] Inputs for function modify_s: I; J; v; s; t[2..3] [inout] Out (internal) for function modify_t: - J + \nothing [inout] Inputs for function modify_t: I; J; v; s.i2; t{[2..3]; [5]} [inout] Out (internal) for function pointer_to_const_logic: \nothing [inout] Inputs for function pointer_to_const_logic: v +[inout] Out (internal) for function ret_const: + tmp +[inout] Inputs for function ret_const: + \nothing [inout] Out (internal) for function main: J [inout] Inputs for function main: diff --git a/tests/value/oracle/const2.res.oracle b/tests/value/oracle/const2.res.oracle index 63222883e639695a782b8e9d05121bbb539dfbfc..c87fe74c5b97136e3cc2efce8b332fac411b591f 100644 --- a/tests/value/oracle/const2.res.oracle +++ b/tests/value/oracle/const2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/const2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/const_syntax.res.oracle b/tests/value/oracle/const_syntax.res.oracle index eb37aa8c2703cea5dba6f293d31315b5a999c076..0a7cb6de2d1590bec73e78746434ac7755e18f23 100644 --- a/tests/value/oracle/const_syntax.res.oracle +++ b/tests/value/oracle/const_syntax.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/const_syntax.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/const_typedef.res.oracle b/tests/value/oracle/const_typedef.res.oracle index f40b0a64515781e3c6236d8dcce455276c8836fd..174d2d1e78161d7f277ed0f2f7e8e7669a6c33b5 100644 --- a/tests/value/oracle/const_typedef.res.oracle +++ b/tests/value/oracle/const_typedef.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/const_typedef.i (no preprocessing) /* Generated by Frama-C */ typedef int INT[3][3]; @@ -17,9 +16,7 @@ ts const __attribute__((__BLA__)) s[3] = {{.s1 = 1, .s2 = 2}, {.s1 = 3, .s2 = 4}, {.s1 = 5, .s2 = 0}}; INT4 const y1 = {0, 1, 2, 3, 4}; int const y2[5] = {1, 2, 3, 4, 5}; -int const y3[7]; - -int const y3[7] = {1, 2}; +int const y4[7] = {1, 2}; int main(void) { int __retres; @@ -74,7 +71,7 @@ int main(void) [2] ∈ {3} [3] ∈ {4} [4] ∈ {5} - y3[0] ∈ {1} + y4[0] ∈ {1} [1] ∈ {2} [2..6] ∈ {0} [value] Recording results for main diff --git a/tests/value/oracle/constarraystructlibentry.res.oracle b/tests/value/oracle/constarraystructlibentry.res.oracle index 4247799b7a96314e8b0b1ce0d8aa631fb0d45f1f..0c7210f23990ddbcf38ab7523545fa742d9cb960 100644 --- a/tests/value/oracle/constarraystructlibentry.res.oracle +++ b/tests/value/oracle/constarraystructlibentry.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/constarraystructlibentry.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/context_free.res.oracle b/tests/value/oracle/context_free.res.oracle index 34b8fa6910086630543fc3b4141e295fbe7a4368..39d77b803363cf4e10596c978feb078e0d0abbea 100644 --- a/tests/value/oracle/context_free.res.oracle +++ b/tests/value/oracle/context_free.res.oracle @@ -1,7 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/context_free.i (no preprocessing) [value] Analyzing an incomplete application starting at f [value] Computing initial state +[value:initial-state] creating variable S_p_svoid with imprecise size (type void) +[value:initial-state] creating variable S_qvoid with imprecise size (type void) [value] Initial state computed [value:initial-state] Values of globals at initialization a ∈ [--..--] @@ -72,6 +73,9 @@ S_p_svoid[bits 0 to ..] ∈ {{ garbled mix of &{S_p_svoid} (origin: Well) }} S_qvoid[bits 0 to ..] ∈ {{ garbled mix of &{S_qvoid} (origin: Well) }} +[value:initial-state] creating variable S_0_S_vvv with imprecise size (type void) +[value:initial-state] creating variable S_1_S_vvv with imprecise size (type void) +[value:initial-state] creating variable S_vv with imprecise size (type void) tests/value/context_free.i:46:[value] warning: out of bounds write. assert \valid(p); tests/value/context_free.i:51:[value] Assigning imprecise value to vv. The imprecision originates from Well diff --git a/tests/value/oracle/context_free_simple.res.oracle b/tests/value/oracle/context_free_simple.res.oracle index f917abea2b2324901ac45cd8b7b55360842ccb3a..317e4fa14a11209e71ca458f822300cb13a72b64 100644 --- a/tests/value/oracle/context_free_simple.res.oracle +++ b/tests/value/oracle/context_free_simple.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/context_free_simple.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/context_width.res.oracle b/tests/value/oracle/context_width.res.oracle index 7a91292807f52f82a11fe784b8ef8282bdff05d6..7b06aa48f222751cb4828c42f3878ec2f3472421 100644 --- a/tests/value/oracle/context_width.res.oracle +++ b/tests/value/oracle/context_width.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/context_width.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/control.res.oracle b/tests/value/oracle/control.res.oracle index a42bc83c9263e1196d20b69c4839aff4e7d3629d..dfe3f7fe1ce9f98524e7c4c8624da716f8c31b85 100644 --- a/tests/value/oracle/control.res.oracle +++ b/tests/value/oracle/control.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/control.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/conversion.res.oracle b/tests/value/oracle/conversion.res.oracle index 4e7eabf2618f3a28693c91e70e070b9d707392a3..442a7d52e6e37f17265773c8ad2bbe35e7ec8f2a 100644 --- a/tests/value/oracle/conversion.res.oracle +++ b/tests/value/oracle/conversion.res.oracle @@ -1,59 +1,65 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/conversion.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization v ∈ [--..--] -[value] DUMPING STATE of file tests/value/conversion.i line 16 +tests/value/conversion.i:16:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ {1} y ∈ UNINITIALIZED f ∈ {1.40129846432e-45} l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:19:[value] warning: assertion 'ASSUME' got status unknown. -[value] DUMPING STATE of file tests/value/conversion.i line 21 +tests/value/conversion.i:21:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [0..1120000000] y ∈ UNINITIALIZED f ∈ [0. .. 96.921875] l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:24:[value] warning: assertion 'ASSUME' got status unknown. tests/value/conversion.i:25:[value] warning: non-finite float value. assert \is_finite(*((float *)(&x))); -[value] DUMPING STATE of file tests/value/conversion.i line 26 +tests/value/conversion.i:26:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [-10..10] y ∈ UNINITIALIZED f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:29:[value] warning: assertion 'ASSUME' got status unknown. -[value] DUMPING STATE of file tests/value/conversion.i line 31 +tests/value/conversion.i:31:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [-10..10] y ∈ [-10..10] f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:34:[value] warning: assertion 'ASSUME' got status unknown. -[value] DUMPING STATE of file tests/value/conversion.i line 36 +tests/value/conversion.i:36:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [1077936128..1084227584] y ∈ [-10..10] f ∈ [3. .. 5.] l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:39:[value] warning: non-finite float value. assert \is_finite(*((float *)(&x))); -[value] DUMPING STATE of file tests/value/conversion.i line 40 +tests/value/conversion.i:40:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ {{ (int)&x }} y ∈ [-10..10] f ∈ {{ (float)&x }} l ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/value/conversion.i line 45 + ==END OF DUMP== +tests/value/conversion.i:45:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x[bits 0 to 15] ∈ {1} [bits 16 to 31] ∈ {2} @@ -61,16 +67,17 @@ tests/value/conversion.i:39:[value] warning: non-finite float value. assert \is_ f[bits 0 to 15] ∈ {1} [bits 16 to 31] ∈ {2} l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:50:[value] warning: assertion 'ASSUME' got status unknown. -[value] DUMPING STATE of file tests/value/conversion.i line 53 +tests/value/conversion.i:53:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x[bits 0 to 15] ∈ {1} [bits 16 to 31] ∈ {2} y ∈ [-10..10] f ∈ [7.00649232162e-45 .. 2.10194769649e-44] or UNINITIALIZED l ∈ [5..15] or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -98,70 +105,78 @@ tests/value/conversion.i:50:[value] warning: assertion 'ASSUME' got status unkno [value] Initial state computed [value:initial-state] Values of globals at initialization v ∈ [--..--] -[value] DUMPING STATE of file tests/value/conversion.i line 16 +tests/value/conversion.i:16:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ {1} y ∈ UNINITIALIZED f ∈ {1.40129846432e-45} l ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/value/conversion.i line 21 + ==END OF DUMP== +tests/value/conversion.i:21:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [0..1120000000] y ∈ UNINITIALIZED f ∈ [0. .. 96.921875] l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:25:[value] warning: non-finite float value. assert \is_finite(*((float *)(&x))); -[value] DUMPING STATE of file tests/value/conversion.i line 26 +tests/value/conversion.i:26:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [-10..10] y ∈ UNINITIALIZED f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] l ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/value/conversion.i line 31 + ==END OF DUMP== +tests/value/conversion.i:31:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [-10..10] y ∈ [--..--] f ∈ [-3.40282346639e+38 .. 3.40282346639e+38] l ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/value/conversion.i line 36 + ==END OF DUMP== +tests/value/conversion.i:36:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ [1077936128..1084227584] y ∈ [--..--] f ∈ [3. .. 5.] l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:39:[value] warning: non-finite float value. assert \is_finite(*((float *)(&x))); tests/value/conversion.i:39:[value] Assigning imprecise value to f. The imprecision originates from Arithmetic {tests/value/conversion.i:39} -[value] DUMPING STATE of file tests/value/conversion.i line 40 +tests/value/conversion.i:40:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x ∈ {{ (int)&x }} y ∈ [--..--] f ∈ {{ garbled mix of &{x} (origin: Arithmetic {tests/value/conversion.i:39}) }} l ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/value/conversion.i line 45 + ==END OF DUMP== +tests/value/conversion.i:45:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x[bits 0 to 15] ∈ {1} [bits 16 to 31] ∈ {2} y ∈ [--..--] f ∈ {1.83672393614e-40} l ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/conversion.i:52:[value] warning: accessing uninitialized left-value. assert \initialized((float *)(&l)); -[value] DUMPING STATE of file tests/value/conversion.i line 53 +tests/value/conversion.i:53:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] x[bits 0 to 15] ∈ {1} [bits 16 to 31] ∈ {2} y ∈ [--..--] f ∈ [7.00649232162e-45 .. 2.10194769649e-44] l ∈ [7.00649232162e-45 .. 2.10194769649e-44] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/copy_paste.res.oracle b/tests/value/oracle/copy_paste.res.oracle index ba665f443e14a1249dd832352891cb3761c1ebfe..b15cc5e48067be7b9e72a5d54a51683a0e30cd5a 100644 --- a/tests/value/oracle/copy_paste.res.oracle +++ b/tests/value/oracle/copy_paste.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/copy_paste.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,6 +5,7 @@ [value:initial-state] Values of globals at initialization t[0..11] ∈ {0} G ∈ {0} +tests/value/copy_paste.i:4:[value] warning: initialization of volatile variable l ignored tests/value/copy_paste.i:8:[value] warning: accessing out of bounds index. assert 0 ≤ j; tests/value/copy_paste.i:8:[value] warning: accessing out of bounds index. assert j < 12; tests/value/copy_paste.i:9:[value] warning: out of bounds read. assert \valid_read((int *)l); diff --git a/tests/value/oracle/copy_paste_hidden_by_dummy_cast.res.oracle b/tests/value/oracle/copy_paste_hidden_by_dummy_cast.res.oracle index e2428c541370c114091ee7acf1e981a84906c956..a11dff3ae14c5f5b7140b943e800de0fd649cd5f 100644 --- a/tests/value/oracle/copy_paste_hidden_by_dummy_cast.res.oracle +++ b/tests/value/oracle/copy_paste_hidden_by_dummy_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/copy_paste_hidden_by_dummy_cast.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/copy_stdin.res.oracle b/tests/value/oracle/copy_stdin.res.oracle index fd88fc1d407baf066ce618f81769ed7f500e23fc..1b6c3d09d79d4184dab02b58791fc0f0e9989f7f 100644 --- a/tests/value/oracle/copy_stdin.res.oracle +++ b/tests/value/oracle/copy_stdin.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/copy_stdin.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/dangling.res.oracle b/tests/value/oracle/dangling.res.oracle index 0712b7c6f74792513585434953187b6a0da658ab..d63c85d4a0c36cd280f7e42a2cbaf7eddfdd9128 100644 --- a/tests/value/oracle/dangling.res.oracle +++ b/tests/value/oracle/dangling.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dangling.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,13 +12,18 @@ tests/value/dangling.i:19:[value] warning: accessing left-value that contains es tests/value/dangling.i:23:[value] warning: assertion got status unknown. tests/value/dangling.i:24:[value] warning: accessing left-value that contains escaping addresses. assert ¬\dangling(&x); +tests/value/dangling.i:31:[value] warning: locals {z} escaping the scope of a block of main through p +tests/value/dangling.i:33:[value] assertion got status valid. [value] Recording results for main [value] done for function main tests/value/dangling.i:24:[value] assertion 'Value,dangling_pointer' got final status invalid. +[scope:rm_asserts] removing 1 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: x ∈ {{ &y }} or ESCAPINGADDR y ∈ {1} + p[0] ∈ ESCAPINGADDR + [1] ∈ {42} [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== @@ -28,6 +32,6 @@ tests/value/dangling.i:24:[value] assertion 'Value,dangling_pointer' got final s NO EFFECTS [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - x; y; i; j; j_0 + x; y; i; j; j_0; p[0..1] [inout] Inputs for function main: v diff --git a/tests/value/oracle/dataflow_order.res.oracle b/tests/value/oracle/dataflow_order.res.oracle index b0206b845290d4995d00c0b2c1a9b8f999ebd18d..c5dccfb5e72fa0ab919b6cba669b3fd946375db9 100644 --- a/tests/value/oracle/dataflow_order.res.oracle +++ b/tests/value/oracle/dataflow_order.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dataflow_order.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,95 +7,95 @@ j ∈ {0} k ∈ {0} tests/value/dataflow_order.i:17:[value] entering loop for the first time -[value] Called Frama_C_show_each_1({0}, {0}) -[value] Called Frama_C_show_each_then({1}, {0}) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: {0}, {0} +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: {1}, {0} [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else({1}, {0}) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: {1}, {0} [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1({0; 1}, {0; 1}) -[value] Called Frama_C_show_each_then({1; 2}, {0; 1}) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: {0; 1}, {0; 1} +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: {1; 2}, {0; 1} [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else({1; 2}, {0; 1}) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: {1; 2}, {0; 1} [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1({0; 1; 2}, {0; 1; 2}) -[value] Called Frama_C_show_each_then({1; 2; 3}, {0; 1; 2}) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: {0; 1; 2}, {0; 1; 2} +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: {1; 2; 3}, {0; 1; 2} [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else({1; 2; 3}, {0; 1; 2}) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: {1; 2; 3}, {0; 1; 2} [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1([0..64999], {0; 1; 2; 3}) -[value] Called Frama_C_show_each_then([1..65000], {0; 1; 2; 3}) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: [0..64999], {0; 1; 2; 3} +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: [1..65000], {0; 1; 2; 3} [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else([1..65000], {0; 1; 2; 3}) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: [1..65000], {0; 1; 2; 3} [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1([0..64999], {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each_then([1..65000], {0; 1; 2; 3; 4}) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: [0..64999], {0; 1; 2; 3; 4} +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: [1..65000], {0; 1; 2; 3; 4} [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else([1..65000], {0; 1; 2; 3; 4}) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: [1..65000], {0; 1; 2; 3; 4} [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1([0..64999], [0..2147483647]) -[value] Called Frama_C_show_each_then([1..65000], [0..2147483647]) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: [0..64999], [0..2147483647] +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: [1..65000], [0..2147483647] [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else([1..65000], [0..2147483647]) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: [1..65000], [0..2147483647] [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1([0..64999], [0..2147483648]) -[value] Called Frama_C_show_each_then([1..65000], [0..2147483648]) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: [0..64999], [0..2147483648] +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: [1..65000], [0..2147483648] [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else([1..65000], [0..2147483648]) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: [1..65000], [0..2147483648] [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_1([0..64999], [0..4294967295]) -[value] Called Frama_C_show_each_then([1..65000], [0..4294967295]) +tests/value/dataflow_order.i:18:[value] Frama_C_show_each_1: [0..64999], [0..4294967295] +tests/value/dataflow_order.i:21:[value] Frama_C_show_each_then: [1..65000], [0..4294967295] [value] computing for function f <- main. Called from tests/value/dataflow_order.i:22. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_else([1..65000], [0..4294967295]) +tests/value/dataflow_order.i:24:[value] Frama_C_show_each_else: [1..65000], [0..4294967295] [value] computing for function g <- main. Called from tests/value/dataflow_order.i:25. [value] Recording results for g [value] Done for function g -[value] Called Frama_C_show_each_end() +tests/value/dataflow_order.i:28:[value] Frama_C_show_each_end: [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/dead_code.res.oracle b/tests/value/oracle/dead_code.res.oracle index 2619d6d360e2223931d2621319c1e85c71bd3099..fa996a22575e6e53851cf37826f74da0f5f880d4 100644 --- a/tests/value/oracle/dead_code.res.oracle +++ b/tests/value/oracle/dead_code.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dead_code.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/dead_code2.res.oracle b/tests/value/oracle/dead_code2.res.oracle index 72981fac3a41bf5cc14020ec2068ebce8ebb5bc0..98e6f205062dd7e29b0ebba18b172b28b08c0ede 100644 --- a/tests/value/oracle/dead_code2.res.oracle +++ b/tests/value/oracle/dead_code2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dead_code2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/dead_inout.res.oracle b/tests/value/oracle/dead_inout.res.oracle index 4a27a568fb2e07cf03bb2b83800109df422fae63..a6beec4c58b384bb8d78ad210442b3286fa1d037 100644 --- a/tests/value/oracle/dead_inout.res.oracle +++ b/tests/value/oracle/dead_inout.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dead_inout.i (no preprocessing) [value] Analyzing a complete application starting at main_all [value] Computing initial state diff --git a/tests/value/oracle/dead_statuses.res.oracle b/tests/value/oracle/dead_statuses.res.oracle index c8a32d2c6f52f324efc44ec262ff11a19dccaf91..0bc28912ceac4e898cf2df8969221cf55e69849e 100644 --- a/tests/value/oracle/dead_statuses.res.oracle +++ b/tests/value/oracle/dead_statuses.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dead_statuses.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -35,19 +34,6 @@ tests/value/dead_statuses.i:5:[value] function f: precondition got status valid. \nothing [report] Computing properties status... --------------------------------------------------------------------------------- ---- Properties of Function 'Frama_C_bzero' --------------------------------------------------------------------------------- - -[ Extern ] Post-condition (file share/libc/__fc_builtin_for_normalization.i, line 32) - Unverifiable but considered Valid. -[ Extern ] Assigns (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Extern ] Froms (file share/libc/__fc_builtin_for_normalization.i, line 31) - Unverifiable but considered Valid. -[ Valid ] Default behavior - by Frama-C kernel. - -------------------------------------------------------------------------------- --- Properties of Function 'f' -------------------------------------------------------------------------------- @@ -63,28 +49,10 @@ tests/value/dead_statuses.i:5:[value] function f: precondition got status valid. --- Properties of Function 'main' -------------------------------------------------------------------------------- -[ Dead ] Post-condition for 'Frama_C_implicit_init' (file tests/value/dead_statuses.i, line 14) at block - Locally valid, but unreachable. - By Frama-C kernel because: - - Unreachable block (after it) - By Value because: - - Unreachable block (after it) -[ Dead ] Post-condition for 'Frama_C_implicit_init' (file tests/value/dead_statuses.i, line 14) at block - Locally valid, but unreachable. - By Frama-C kernel because: - - Unreachable block (after it) - By Value because: - - Unreachable block (after it) [ Dead ] Pre-condition (file tests/value/dead_statuses.i, line 18) at instruction (file tests/value/dead_statuses.i, line 19) Locally valid, but unreachable. By Value because: - Unreachable instruction (file tests/value/dead_statuses.i, line 19) -[ Dead ] Assigns for 'Frama_C_implicit_init' (file tests/value/dead_statuses.i, line 14) at block - Locally valid, but unreachable. - By Frama-C kernel because: - - Unreachable block (after it) - By Value because: - - Unreachable block (after it) [ Dead ] Assertion (file tests/value/dead_statuses.i, line 15) Locally valid, but unreachable. By Value because: @@ -93,16 +61,10 @@ tests/value/dead_statuses.i:5:[value] function f: precondition got status valid. Locally valid, but unreachable. By Value because: - Unreachable loop (file tests/value/dead_statuses.i, line 17) -[ Dead ] Behavior 'Frama_C_implicit_init' at block - Locally valid, but unreachable. - By Frama-C kernel because: - - Unreachable block (after it) [ Valid ] Default behavior at instruction (file tests/value/dead_statuses.i, line 19) by Frama-C kernel. [Unreachable] Unreachable call 'f' (file tests/value/dead_statuses.i, line 13) by Value. -[Unreachable] Unreachable block (after it) - by Value. [Unreachable] Unreachable program point (file tests/value/dead_statuses.i, line 15) by Value. [Unreachable] Unreachable loop (file tests/value/dead_statuses.i, line 17) @@ -124,9 +86,9 @@ tests/value/dead_statuses.i:5:[value] function f: precondition got status valid. -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- - 6 Completely validated - 4 Considered valid - 8 Dead properties - 5 Unreachable - 23 Total + 5 Completely validated + 1 Considered valid + 4 Dead properties + 4 Unreachable + 14 Total -------------------------------------------------------------------------------- diff --git a/tests/value/oracle/deep_conditionals.res.oracle b/tests/value/oracle/deep_conditionals.res.oracle index ff65f73092107685d6db914f2b295e4f9776bf24..cca349e4eb84f817ec6766b349a09f089b71ffb7 100644 --- a/tests/value/oracle/deep_conditionals.res.oracle +++ b/tests/value/oracle/deep_conditionals.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deep_conditionals.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/degeneration2.res.oracle b/tests/value/oracle/degeneration2.res.oracle index 9a66b60f4aac9d24f55b18acd5f459f0fd7051f4..22555a353d4ae8d90dbd9d90a639b58d5cf6f62a 100644 --- a/tests/value/oracle/degeneration2.res.oracle +++ b/tests/value/oracle/degeneration2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/degeneration2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/deps.0.res.oracle b/tests/value/oracle/deps.0.res.oracle index b16461230449cc36692bbbde18f5020bb26f6505..25d3c9c94548ee1efedbdee3b44a22dcad9a8c6c 100644 --- a/tests/value/oracle/deps.0.res.oracle +++ b/tests/value/oracle/deps.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/deps.1.res.oracle b/tests/value/oracle/deps.1.res.oracle index a944fd81341f9b024c859e4835c451e63aede573..20ef00aa1af64ec88c5f5bbaa941f943d659ead2 100644 --- a/tests/value/oracle/deps.1.res.oracle +++ b/tests/value/oracle/deps.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps.i (no preprocessing) [value] Analyzing a complete application starting at fonc1 [value] Computing initial state diff --git a/tests/value/oracle/deps.2.res.oracle b/tests/value/oracle/deps.2.res.oracle index b78cc886fa1435d2a65f4f560b0f0e664ddf7e6a..e76aaa5203106fbfc7091786d056be8b30383446 100644 --- a/tests/value/oracle/deps.2.res.oracle +++ b/tests/value/oracle/deps.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps.i (no preprocessing) [value] Analyzing a complete application starting at fonc2 [value] Computing initial state diff --git a/tests/value/oracle/deps_addr.res.oracle b/tests/value/oracle/deps_addr.res.oracle index 443f85f3579e81429b39f83292e8f6ce38e77bb5..56a58610b4dec7c171dcd1a4ce5fef4134ed5ebc 100644 --- a/tests/value/oracle/deps_addr.res.oracle +++ b/tests/value/oracle/deps_addr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps_addr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/deps_compose.res.oracle b/tests/value/oracle/deps_compose.res.oracle index ecd556c9cddae7ce37399cf5df25ba696ab593ee..30040ed3347c7b66abb91bcf51ac5e7eb75f7e36 100644 --- a/tests/value/oracle/deps_compose.res.oracle +++ b/tests/value/oracle/deps_compose.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps_compose.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/deps_local.res.oracle b/tests/value/oracle/deps_local.res.oracle index d240ca5a06dd7990cdb72500a0faf655eb163e9c..0d13820cdc7b57920b5b3fcc18cdc121d7624c04 100644 --- a/tests/value/oracle/deps_local.res.oracle +++ b/tests/value/oracle/deps_local.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps_local.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/deps_mixed.res.oracle b/tests/value/oracle/deps_mixed.res.oracle index 5fc1ad917bf980796ca20fabca2e703dffbe0f6b..53f861d37768372dc69d4c0e76786d886f63a119 100644 --- a/tests/value/oracle/deps_mixed.res.oracle +++ b/tests/value/oracle/deps_mixed.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps_mixed.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/deps_unitialized_locals.res.oracle b/tests/value/oracle/deps_unitialized_locals.res.oracle index ee98475377afbb40828a2201263257b11be5e1ef..5d224f3ad5617ded004597a17d51b3ec0e9d26e2 100644 --- a/tests/value/oracle/deps_unitialized_locals.res.oracle +++ b/tests/value/oracle/deps_unitialized_locals.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deps_unitialized_locals.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -34,10 +33,10 @@ tests/value/deps_unitialized_locals.i:23:[value] warning: accessing uninitialize [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function f: v1.ts ∈ {1} - .[bits 16 to 31] ∈ UNINITIALIZED + .[bits 16 to 31] ∈ {0} .ti ∈ {2} ty.ts ∈ {1} - .[bits 16 to 31] ∈ UNINITIALIZED + .[bits 16 to 31] ∈ {0} .ti ∈ {2} [value:final-states] Values at end of function g: v ∈ {1} @@ -47,10 +46,10 @@ tests/value/deps_unitialized_locals.i:23:[value] warning: accessing uninitialize i ∈ {1} [value:final-states] Values at end of function main: v1.ts ∈ {1} - .[bits 16 to 31] ∈ UNINITIALIZED + .[bits 16 to 31] ∈ {0} .ti ∈ {2} v2.ts ∈ {1} - .[bits 16 to 31] ∈ UNINITIALIZED + .[bits 16 to 31] ∈ {0} .ti ∈ {2} v ∈ {1} x ∈ {1} diff --git a/tests/value/oracle/deref.res.oracle b/tests/value/oracle/deref.res.oracle index 458c6dcb993dfa749dbc22087325659ed9b47259..92670cdc1b13646a79ef9da0d3cf56b40c06b27d 100644 --- a/tests/value/oracle/deref.res.oracle +++ b/tests/value/oracle/deref.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/deref.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/disjoint_status.res.oracle b/tests/value/oracle/disjoint_status.res.oracle index 82cfd0d55667f2b73f0a2f286c2c5f79d2b306c1..3ea134972c05602392c4dd83c77598f4ef6ba9b8 100644 --- a/tests/value/oracle/disjoint_status.res.oracle +++ b/tests/value/oracle/disjoint_status.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/disjoint_status.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/div.0.res.oracle b/tests/value/oracle/div.0.res.oracle index 6068cdf3253e28221be0d557489e2abd58a5c2e9..d75cb699c814c9f2be3d43e1a3e3adf4cdf571df 100644 --- a/tests/value/oracle/div.0.res.oracle +++ b/tests/value/oracle/div.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/div.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -25,6 +24,7 @@ [2] ∈ {3} [3..4] ∈ {0} p ∈ {0} +tests/value/div.i:13:[value] warning: initialization of volatile variable c ignored tests/value/div.i:14:[value] entering loop for the first time tests/value/div.i:14:[value] warning: signed overflow. assert c + 1 ≤ 2147483647; tests/value/div.i:17:[value] warning: signed overflow. assert c + 2 ≤ 2147483647; diff --git a/tests/value/oracle/div.1.res.oracle b/tests/value/oracle/div.1.res.oracle index 3c8a3d8d44e93cd00a2f6566adcc53f952ea7b0d..279171a38ef855991f6a5a7903d985168d6b8c58 100644 --- a/tests/value/oracle/div.1.res.oracle +++ b/tests/value/oracle/div.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/div.i (no preprocessing) [rte] annotating function main [value] Analyzing a complete application starting at main @@ -26,6 +25,7 @@ [2] ∈ {3} [3..4] ∈ {0} p ∈ {0} +tests/value/div.i:13:[value] warning: initialization of volatile variable c ignored tests/value/div.i:14:[value] entering loop for the first time tests/value/div.i:14:[value] warning: assertion 'rte,signed_overflow' got status unknown. tests/value/div.i:14:[value] warning: signed overflow. assert c + 1 ≤ 2147483647; @@ -79,6 +79,7 @@ tests/value/div.i:28:[value] assertion 'rte,signed_overflow' got final status va tests/value/div.i:34:[value] assertion 'rte,division_by_zero' got final status valid. tests/value/div.i:35:[value] assertion 'rte,division_by_zero' got final status valid. tests/value/div.i:36:[value] assertion 'rte,division_by_zero' got final status valid. +[scope:rm_asserts] removing 1 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: X ∈ [--..--] diff --git a/tests/value/oracle/div_strange.res.oracle b/tests/value/oracle/div_strange.res.oracle index 313dbae9a825d1ee085b560b3012b0a9b5936014..cc2a4dd92e73df75640d7799c6c7e2cba04e8f69 100644 --- a/tests/value/oracle/div_strange.res.oracle +++ b/tests/value/oracle/div_strange.res.oracle @@ -1,11 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/div_strange.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each_F({1073741823}) +tests/value/div_strange.i:7:[value] Frama_C_show_each_F: {1073741823} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/divneg.res.oracle b/tests/value/oracle/divneg.res.oracle index e136b8775816e11f09dfe8c7bceb1720f989f003..b39225ee070f17d6ba4da318cd7034473c372cab 100644 --- a/tests/value/oracle/divneg.res.oracle +++ b/tests/value/oracle/divneg.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/divneg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -18,8 +17,9 @@ rn4 ∈ {-3} rn5 ∈ {0} vic ∈ {0} -[value] Called Frama_C_show_each([-185..-5],4%9, [1..61],1%3) -[value] DUMPING STATE of file tests/value/divneg.i line 42 +tests/value/divneg.i:13:[value] Frama_C_show_each: [-185..-5],4%9, [1..61],1%3 +tests/value/divneg.i:42:[value] Frama_C_dump_each: + # Cvalue domain: i ∈ [-100..100] r0 ∈ [-100..100],0%5 r1 ∈ [1..96],1%5 @@ -32,13 +32,13 @@ rn2 ∈ [-100..100],0%2 rn3 ∈ [-100..100],0%2 rn4 ∈ [-99..99],1%2 - rn5 ∈ [-100..100] + rn5 ∈ [-100..99] vic ∈ {0} c ∈ [-185..-5],4%9 rc ∈ [-176..-14],4%18 or UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each_should({-1}) + ==END OF DUMP== +tests/value/divneg.i:52:[value] Frama_C_show_each_should: {-1} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -52,7 +52,7 @@ rn2 ∈ [-100..100],0%2 rn3 ∈ [-100..100],0%2 rn4 ∈ [-99..99],1%2 - rn5 ∈ [-100..100] + rn5 ∈ [-100..99] vic ∈ {4294967295} c ∈ [5..185],5%9 rc ∈ [14..176],14%18 diff --git a/tests/value/oracle/downcast.res.oracle b/tests/value/oracle/downcast.res.oracle index 4056f462fb827e5fc4312c60cd5c352585bb8acd..ba8f119e61967b6202bc0856d7ca759b96de7410 100644 --- a/tests/value/oracle/downcast.res.oracle +++ b/tests/value/oracle/downcast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/downcast.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -15,84 +14,90 @@ s ∈ [--..--] v ∈ [--..--] [value] computing for function main1 <- main. - Called from tests/value/downcast.i:142. + Called from tests/value/downcast.i:152. tests/value/downcast.i:19:[value] warning: signed downcast. assert -128 ≤ (int)sx + (int)sy; tests/value/downcast.i:19:[value] warning: signed downcast. assert (int)sx + (int)sy ≤ 127; tests/value/downcast.i:22:[value] warning: signed downcast. assert uy + uz ≤ 2147483647; [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2_bitfield <- main. - Called from tests/value/downcast.i:143. + Called from tests/value/downcast.i:153. tests/value/downcast.i:32:[value] warning: signed downcast. assert i ≤ 15; [value] Recording results for main2_bitfield [value] Done for function main2_bitfield [value] computing for function main3_reduction <- main. - Called from tests/value/downcast.i:144. + Called from tests/value/downcast.i:154. tests/value/downcast.i:38:[value] warning: signed downcast. assert -128 ≤ x_0; tests/value/downcast.i:38:[value] warning: signed downcast. assert x_0 ≤ 127; [value] Recording results for main3_reduction [value] Done for function main3_reduction [value] computing for function main4_pointer <- main. - Called from tests/value/downcast.i:145. -tests/value/downcast.i:48:[value] warning: signed downcast. assert p ≤ 2147483647; + Called from tests/value/downcast.i:155. +tests/value/downcast.i:50:[value] warning: signed overflow. assert -9223372036854775808 ≤ p + (long long)100; +tests/value/downcast.i:50:[value] warning: signed overflow. assert p + (long long)100 ≤ 9223372036854775807; +tests/value/downcast.i:52:[value] warning: signed downcast. assert -2147483648 ≤ p; +tests/value/downcast.i:52:[value] warning: signed downcast. assert p ≤ 2147483647; [value] Recording results for main4_pointer [value] Done for function main4_pointer [value] computing for function main5_wrap_signed <- main. - Called from tests/value/downcast.i:146. -tests/value/downcast.i:54:[value] warning: assertion 'ASSUME' got status unknown. -tests/value/downcast.i:55:[value] assertion got status valid. -tests/value/downcast.i:58:[value] warning: signed downcast. assert y ≤ 2147483647; -[value] Called Frama_C_show_each([100000..2147483647], - [100145..2147483647], - [100145..2147483647]) -tests/value/downcast.i:60:[value] assertion got status valid. + Called from tests/value/downcast.i:156. +tests/value/downcast.i:58:[value] warning: assertion 'ASSUME' got status unknown. +tests/value/downcast.i:59:[value] assertion got status valid. +tests/value/downcast.i:62:[value] warning: signed downcast. assert y ≤ 2147483647; +tests/value/downcast.i:63:[value] Frama_C_show_each: + [100000..2147483647], [100145..2147483647], [100145..2147483647] +tests/value/downcast.i:64:[value] assertion got status valid. [value] Recording results for main5_wrap_signed [value] Done for function main5_wrap_signed [value] computing for function main6_val_warn_converted_signed <- main. - Called from tests/value/downcast.i:147. -tests/value/downcast.i:67:[value] warning: signed downcast. assert 65300u ≤ 32767; -tests/value/downcast.i:78:[value] warning: signed downcast. assert e_0 ≤ 32767; -tests/value/downcast.i:83:[value] warning: signed downcast. assert e_1 ≤ 32767; + Called from tests/value/downcast.i:157. +tests/value/downcast.i:71:[value] warning: signed downcast. assert 65300u ≤ 32767; +tests/value/downcast.i:82:[value] warning: signed downcast. assert e_0 ≤ 32767; +tests/value/downcast.i:87:[value] warning: signed downcast. assert e_1 ≤ 32767; +tests/value/downcast.i:91:[value] warning: signed downcast. assert p ≤ 2147483647; +tests/value/downcast.i:92:[value] warning: signed downcast. assert p ≤ 32767; +tests/value/downcast.i:93:[value] Assigning imprecise value to z. + The imprecision originates from Arithmetic {tests/value/downcast.i:93} [value] Recording results for main6_val_warn_converted_signed [value] Done for function main6_val_warn_converted_signed [value] computing for function main7_signed_upcast <- main. - Called from tests/value/downcast.i:148. + Called from tests/value/downcast.i:158. [value] Recording results for main7_signed_upcast [value] Done for function main7_signed_upcast [value] computing for function main8_bitfields <- main. - Called from tests/value/downcast.i:149. -tests/value/downcast.i:104:[value] warning: signed downcast. assert S.i1 ≤ 31; -tests/value/downcast.i:105:[value] warning: signed downcast. assert S.i1 ≤ 127; -tests/value/downcast.i:109:[value] warning: signed downcast. assert S.i1 ≤ 31; -tests/value/downcast.i:110:[value] warning: signed downcast. assert S.i1 ≤ 127; + Called from tests/value/downcast.i:159. tests/value/downcast.i:114:[value] warning: signed downcast. assert S.i1 ≤ 31; +tests/value/downcast.i:115:[value] warning: signed downcast. assert S.i1 ≤ 127; +tests/value/downcast.i:119:[value] warning: signed downcast. assert S.i1 ≤ 31; +tests/value/downcast.i:120:[value] warning: signed downcast. assert S.i1 ≤ 127; +tests/value/downcast.i:124:[value] warning: signed downcast. assert S.i1 ≤ 31; [value] Recording results for main8_bitfields [value] Done for function main8_bitfields [value] computing for function main9_bitfield <- main. - Called from tests/value/downcast.i:150. -tests/value/downcast.i:123:[value] warning: signed downcast. assert bf.a ≤ 1023; -tests/value/downcast.i:127:[value] warning: signed downcast. assert bf.a ≤ 127; + Called from tests/value/downcast.i:160. +tests/value/downcast.i:133:[value] warning: signed downcast. assert bf.a ≤ 1023; +tests/value/downcast.i:137:[value] warning: signed downcast. assert bf.a ≤ 127; [value] Recording results for main9_bitfield [value] Done for function main9_bitfield [value] computing for function main10_loop <- main. - Called from tests/value/downcast.i:151. -tests/value/downcast.i:135:[value] entering loop for the first time -tests/value/downcast.i:137:[value] warning: signed downcast. assert bf.b ≤ 127; + Called from tests/value/downcast.i:161. +tests/value/downcast.i:145:[value] entering loop for the first time +tests/value/downcast.i:147:[value] warning: signed downcast. assert bf.b ≤ 127; [value] Recording results for main10_loop [value] Done for function main10_loop [value] Recording results for main [value] done for function main tests/value/downcast.i:32:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:67:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:78:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:83:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:104:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:105:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:109:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:110:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:71:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:82:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:87:[value] assertion 'Value,signed_downcast' got final status invalid. tests/value/downcast.i:114:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:123:[value] assertion 'Value,signed_downcast' got final status invalid. -tests/value/downcast.i:127:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:115:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:119:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:120:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:124:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:133:[value] assertion 'Value,signed_downcast' got final status invalid. +tests/value/downcast.i:137:[value] assertion 'Value,signed_downcast' got final status invalid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main1: sz ∈ [--..--] @@ -117,9 +122,9 @@ tests/value/downcast.i:127:[value] assertion 'Value,signed_downcast' got final s y ∈ [--..--] d ∈ [--..--] [value:final-states] Values at end of function main4_pointer: - p ∈ {{ (long long)&x_0 }} - q ∈ {{ (unsigned int)&x_0 }} - r ∈ {{ (int)&x_0 }} + p ∈ {{ &x_0 + {100} }} + q ∈ {{ &x_0 + {100} }} + r ∈ {{ &x_0 + {100} }} [value:final-states] Values at end of function main5_wrap_signed: x_0 ∈ [100000..2147483647] y ∈ [100145..2147483647] @@ -223,7 +228,7 @@ tests/value/downcast.i:127:[value] assertion 'Value,signed_downcast' got final s [inout] Inputs for function main5_wrap_signed: v [inout] Out (internal) for function main6_val_warn_converted_signed: - s_0; u; e; b; e_0; b_0; e_1; b_1 + s_0; u; e; b; e_0; b_0; e_1; b_1; p; x_0; y; z [inout] Inputs for function main6_val_warn_converted_signed: v [inout] Out (internal) for function main7_signed_upcast: @@ -276,89 +281,99 @@ tests/value/downcast.i:127:[value] assertion 'Value,signed_downcast' got final s --- Properties of Function 'main4_pointer' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 48) +[ - ] Assertion 'Value,signed_overflow' (file tests/value/downcast.i, line 50) + tried with Value. +[ - ] Assertion 'Value,signed_overflow' (file tests/value/downcast.i, line 50) + tried with Value. +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 52) + tried with Value. +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 52) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main5_wrap_signed' -------------------------------------------------------------------------------- -[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 54) +[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 58) tried with Value. -[ Valid ] Assertion (file tests/value/downcast.i, line 55) +[ Valid ] Assertion (file tests/value/downcast.i, line 59) by Value. -[ Valid ] Assertion (file tests/value/downcast.i, line 60) +[ Valid ] Assertion (file tests/value/downcast.i, line 64) by Value. -[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 58) +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 62) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main6_val_warn_converted_signed' -------------------------------------------------------------------------------- -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 67) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 71) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 67) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 78) + - Unreachable initialization of 's_0' (file tests/value/downcast.i, line 71) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 82) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 78) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 83) + - Unreachable initialization of 'b_0' (file tests/value/downcast.i, line 82) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 87) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 83) + - Unreachable initialization of 'b_1' (file tests/value/downcast.i, line 87) +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 91) + tried with Value. +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 92) + tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main8_bitfields' -------------------------------------------------------------------------------- -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 104) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 114) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 104) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 105) + - Unreachable instruction (file tests/value/downcast.i, line 114) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 115) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 105) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 109) + - Unreachable instruction (file tests/value/downcast.i, line 115) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 119) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 109) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 110) + - Unreachable instruction (file tests/value/downcast.i, line 119) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 120) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 110) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 114) + - Unreachable instruction (file tests/value/downcast.i, line 120) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 124) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 114) + - Unreachable instruction (file tests/value/downcast.i, line 124) -------------------------------------------------------------------------------- --- Properties of Function 'main9_bitfield' -------------------------------------------------------------------------------- -[ Dead ] Assertion (file tests/value/downcast.i, line 124) +[ Dead ] Assertion (file tests/value/downcast.i, line 134) Locally valid, but unreachable. By Value because: - - Unreachable program point (file tests/value/downcast.i, line 124) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 123) + - Unreachable program point (file tests/value/downcast.i, line 134) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 133) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 123) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 127) + - Unreachable initialization of 'signed_a' (file tests/value/downcast.i, line 133) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 127) -[Unreachable] Unreachable program point (file tests/value/downcast.i, line 124) + - Unreachable instruction (file tests/value/downcast.i, line 137) +[Unreachable] Unreachable program point (file tests/value/downcast.i, line 134) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'main10_loop' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 147) tried with Value. -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- 2 Completely validated - 9 To be validated + 14 To be validated 11 Alarms emitted 1 Dead property 1 Unreachable - 24 Total + 29 Total -------------------------------------------------------------------------------- /* Generated by Frama-C */ struct s { @@ -401,11 +416,9 @@ void main1(void) void main2_bitfield(void) { - int i; - unsigned int j; struct s ss; - i = 117; - j = (unsigned int)254; + int i = 117; + unsigned int j = (unsigned int)254; if (v) /*@ assert Value: signed_downcast: i ≤ 15; */ ss.i = (int)i; @@ -415,29 +428,30 @@ void main2_bitfield(void) void main3_reduction(void) { - int x_0; - char c; - unsigned int y; - unsigned char d; - x_0 = v; + int x_0 = v; /*@ assert Value: signed_downcast: -128 ≤ x_0; */ /*@ assert Value: signed_downcast: x_0 ≤ 127; */ - c = (char)x_0; - y = (unsigned int)v; - d = (unsigned char)y; + char c = (char)x_0; + unsigned int y = (unsigned int)v; + unsigned char d = (unsigned char)y; return; } void main4_pointer(void) { int x_0; - long long p; - unsigned int q; - int r; - p = (long long)(& x_0); - q = (unsigned int)p; + long long p = (long long)(& x_0); + /*@ assert + Value: signed_overflow: -9223372036854775808 ≤ p + (long long)100; + */ + /*@ assert + Value: signed_overflow: p + (long long)100 ≤ 9223372036854775807; + */ + p += (long long)100; + unsigned int q = (unsigned int)p; + /*@ assert Value: signed_downcast: -2147483648 ≤ p; */ /*@ assert Value: signed_downcast: p ≤ 2147483647; */ - r = (int)p; + int r = (int)p; return; } @@ -447,16 +461,13 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main5_wrap_signed(void) { - int x_0; - unsigned int y; - int z; - x_0 = v; + int x_0 = v; /*@ assert ASSUME: x_0 ≥ 100000; */ ; /*@ assert x_0 > 0x7FFFFFFF - 145 ∨ x_0 ≤ 0x7FFFFFFF - 145; */ ; - y = (unsigned int)x_0; + unsigned int y = (unsigned int)x_0; y += (unsigned int)145; /*@ assert Value: signed_downcast: y ≤ 2147483647; */ - z = (int)y; + int z = (int)y; Frama_C_show_each(x_0,y,z); /*@ assert z ≥ 100000 + 145 ∨ z ≤ (int)(0x7FFFFFFF + 145); */ ; return; @@ -465,43 +476,41 @@ void main5_wrap_signed(void) void main6_val_warn_converted_signed(void) { if (v) { - short s_0; /*@ assert Value: signed_downcast: 65300u ≤ 32767; */ - s_0 = (short)65300u; + short s_0 = (short)65300u; } if (v) { - unsigned short u; - u = (unsigned short)65300u; + unsigned short u = (unsigned short)65300u; } if (v) { - unsigned long e; - short b; - e = (unsigned long)17; - b = (short)e; + unsigned long e = (unsigned long)17; + short b = (short)e; } if (v) { - unsigned long e_0; - short b_0; - e_0 = (unsigned long)(-12); + unsigned long e_0 = (unsigned long)(-12); /*@ assert Value: signed_downcast: e_0 ≤ 32767; */ - b_0 = (short)e_0; + short b_0 = (short)e_0; } if (v) { - unsigned int e_1; - short b_1; - e_1 = (unsigned int)(-64000); + unsigned int e_1 = (unsigned int)(-64000); /*@ assert Value: signed_downcast: e_1 ≤ 32767; */ - b_1 = (short)e_1; + short b_1 = (short)e_1; + } + if (v) { + int *p = (int *)(& v); + /*@ assert Value: signed_downcast: p ≤ 2147483647; */ + int x_0 = (int)p; + /*@ assert Value: signed_downcast: p ≤ 32767; */ + short y = (short)p; + unsigned short z = (unsigned short)p; } return; } void main7_signed_upcast(void) { - unsigned char c; - int i; - c = (unsigned char)240; - i = (int)c; + unsigned char c = (unsigned char)240; + int i = (int)c; return; } @@ -537,9 +546,8 @@ void main9_bitfield(void) signed char c; bf.a = (unsigned int)1648; if (v) { - int signed_a; /*@ assert Value: signed_downcast: bf.a ≤ 1023; */ - signed_a = (int)((int)bf.a); + int signed_a = (int)((int)bf.a); /*@ assert signed_a ≡ -400; */ ; } if (v) @@ -552,8 +560,7 @@ void main10_loop(void) { signed char c; struct __anonstruct_bf_2 bf; - int k; - k = 0; + int k = 0; while (k < 10) { bf.b = (unsigned int)v; if (v) @@ -595,7 +602,7 @@ void main(void) s ∈ [--..--] v ∈ [--..--] [value] computing for function main1 <- main. - Called from tests/value/downcast.i:142. + Called from tests/value/downcast.i:152. tests/value/downcast.i:20:[value] warning: unsigned downcast. assert 0 ≤ (int)sx + (int)sy; tests/value/downcast.i:21:[value] warning: unsigned downcast. assert 0 ≤ x; tests/value/downcast.i:21:[value] warning: unsigned downcast. assert x ≤ 255; @@ -603,58 +610,64 @@ tests/value/downcast.i:24:[value] warning: unsigned downcast. assert uy + uz ≤ [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2_bitfield <- main. - Called from tests/value/downcast.i:143. + Called from tests/value/downcast.i:153. tests/value/downcast.i:33:[value] warning: unsigned downcast. assert j ≤ 31; [value] Recording results for main2_bitfield [value] Done for function main2_bitfield [value] computing for function main3_reduction <- main. - Called from tests/value/downcast.i:144. + Called from tests/value/downcast.i:154. tests/value/downcast.i:40:[value] warning: unsigned downcast. assert 0 ≤ v; tests/value/downcast.i:41:[value] warning: unsigned downcast. assert y ≤ 255; [value] Recording results for main3_reduction [value] Done for function main3_reduction [value] computing for function main4_pointer <- main. - Called from tests/value/downcast.i:145. + Called from tests/value/downcast.i:155. +tests/value/downcast.i:50:[value] warning: signed overflow. assert -9223372036854775808 ≤ p + (long long)100; +tests/value/downcast.i:50:[value] warning: signed overflow. assert p + (long long)100 ≤ 9223372036854775807; +tests/value/downcast.i:51:[value] warning: unsigned downcast. assert 0 ≤ p; +tests/value/downcast.i:51:[value] warning: unsigned downcast. assert p ≤ 4294967295; [value] Recording results for main4_pointer [value] Done for function main4_pointer [value] computing for function main5_wrap_signed <- main. - Called from tests/value/downcast.i:146. -[value] Called Frama_C_show_each([100000..2147483647], - [100145..2147483792], - [-2147483648..2147483647]) -tests/value/downcast.i:60:[value] warning: assertion got status unknown. + Called from tests/value/downcast.i:156. +tests/value/downcast.i:63:[value] Frama_C_show_each: + [100000..2147483647], [100145..2147483792], [-2147483648..2147483647] +tests/value/downcast.i:64:[value] warning: assertion got status unknown. [value] Recording results for main5_wrap_signed [value] Done for function main5_wrap_signed [value] computing for function main6_val_warn_converted_signed <- main. - Called from tests/value/downcast.i:147. -tests/value/downcast.i:77:[value] warning: unsigned downcast. assert 0 ≤ -12; -tests/value/downcast.i:82:[value] warning: unsigned downcast. assert 0 ≤ -64000; + Called from tests/value/downcast.i:157. +tests/value/downcast.i:81:[value] warning: unsigned downcast. assert 0 ≤ -12; +tests/value/downcast.i:86:[value] warning: unsigned downcast. assert 0 ≤ -64000; +tests/value/downcast.i:92:[value] Assigning imprecise value to y. + The imprecision originates from Arithmetic {tests/value/downcast.i:92} +tests/value/downcast.i:93:[value] warning: unsigned downcast. assert p ≤ 65535; [value] Recording results for main6_val_warn_converted_signed [value] Done for function main6_val_warn_converted_signed [value] computing for function main7_signed_upcast <- main. - Called from tests/value/downcast.i:148. + Called from tests/value/downcast.i:158. [value] Recording results for main7_signed_upcast [value] Done for function main7_signed_upcast [value] computing for function main8_bitfields <- main. - Called from tests/value/downcast.i:149. + Called from tests/value/downcast.i:159. [value] Recording results for main8_bitfields [value] Done for function main8_bitfields [value] computing for function main9_bitfield <- main. - Called from tests/value/downcast.i:150. -tests/value/downcast.i:124:[value] assertion got status valid. + Called from tests/value/downcast.i:160. +tests/value/downcast.i:134:[value] assertion got status valid. [value] Recording results for main9_bitfield [value] Done for function main9_bitfield [value] computing for function main10_loop <- main. - Called from tests/value/downcast.i:151. -tests/value/downcast.i:136:[value] warning: unsigned downcast. assert 0 ≤ v; -tests/value/downcast.i:136:[value] warning: unsigned downcast. assert v ≤ 1023; + Called from tests/value/downcast.i:161. +tests/value/downcast.i:146:[value] warning: unsigned downcast. assert 0 ≤ v; +tests/value/downcast.i:146:[value] warning: unsigned downcast. assert v ≤ 1023; [value] Recording results for main10_loop [value] Done for function main10_loop [value] Recording results for main [value] done for function main tests/value/downcast.i:33:[value] assertion 'Value,unsigned_downcast' got final status invalid. -tests/value/downcast.i:77:[value] assertion 'Value,unsigned_downcast' got final status invalid. -tests/value/downcast.i:82:[value] assertion 'Value,unsigned_downcast' got final status invalid. +tests/value/downcast.i:81:[value] assertion 'Value,unsigned_downcast' got final status invalid. +tests/value/downcast.i:86:[value] assertion 'Value,unsigned_downcast' got final status invalid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main1: sz ∈ [--..--] @@ -678,9 +691,9 @@ tests/value/downcast.i:82:[value] assertion 'Value,unsigned_downcast' got final y ∈ [0..255] d ∈ [--..--] [value:final-states] Values at end of function main4_pointer: - p ∈ {{ (long long)&x_0 }} - q ∈ {{ (unsigned int)&x_0 }} - r ∈ {{ (int)&x_0 }} + p ∈ {{ &x_0 + {100} }} + q ∈ {{ &x_0 + {100} }} + r ∈ {{ &x_0 + {100} }} [value:final-states] Values at end of function main5_wrap_signed: x_0 ∈ [100000..2147483647] y ∈ [100145..2147483792] @@ -785,7 +798,7 @@ tests/value/downcast.i:82:[value] assertion 'Value,unsigned_downcast' got final [inout] Inputs for function main5_wrap_signed: v [inout] Out (internal) for function main6_val_warn_converted_signed: - s_0; u; e; b; e_0; e_1 + s_0; u; e; b; e_0; e_1; p; x_0; y; z [inout] Inputs for function main6_val_warn_converted_signed: v [inout] Out (internal) for function main7_signed_upcast: @@ -836,51 +849,66 @@ tests/value/downcast.i:82:[value] assertion 'Value,unsigned_downcast' got final [ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 41) tried with Value. +-------------------------------------------------------------------------------- +--- Properties of Function 'main4_pointer' +-------------------------------------------------------------------------------- + +[ - ] Assertion 'Value,signed_overflow' (file tests/value/downcast.i, line 50) + tried with Value. +[ - ] Assertion 'Value,signed_overflow' (file tests/value/downcast.i, line 50) + tried with Value. +[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 51) + tried with Value. +[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 51) + tried with Value. + -------------------------------------------------------------------------------- --- Properties of Function 'main5_wrap_signed' -------------------------------------------------------------------------------- -[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 54) +[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 58) tried with Value. -[ Valid ] Assertion (file tests/value/downcast.i, line 55) +[ Valid ] Assertion (file tests/value/downcast.i, line 59) by Value. -[ - ] Assertion (file tests/value/downcast.i, line 60) +[ - ] Assertion (file tests/value/downcast.i, line 64) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main6_val_warn_converted_signed' -------------------------------------------------------------------------------- -[ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 77) +[ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 81) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 77) -[ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 82) + - Unreachable initialization of 'e_0' (file tests/value/downcast.i, line 81) +[ Alarm ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 86) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 82) + - Unreachable initialization of 'e_1' (file tests/value/downcast.i, line 86) +[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 93) + tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main9_bitfield' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/downcast.i, line 124) +[ Valid ] Assertion (file tests/value/downcast.i, line 134) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'main10_loop' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 136) +[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 146) tried with Value. -[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 136) +[ - ] Assertion 'Value,unsigned_downcast' (file tests/value/downcast.i, line 146) tried with Value. -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- 2 Completely validated - 10 To be validated + 15 To be validated 3 Alarms emitted - 15 Total + 20 Total -------------------------------------------------------------------------------- /* Generated by Frama-C */ struct s { @@ -924,11 +952,9 @@ void main1(void) void main2_bitfield(void) { - int i; - unsigned int j; struct s ss; - i = 117; - j = (unsigned int)254; + int i = 117; + unsigned int j = (unsigned int)254; if (v) ss.i = (int)i; if (v) @@ -939,28 +965,30 @@ void main2_bitfield(void) void main3_reduction(void) { - int x_0; - char c; - unsigned int y; - unsigned char d; - x_0 = v; - c = (char)x_0; + int x_0 = v; + char c = (char)x_0; /*@ assert Value: unsigned_downcast: 0 ≤ v; */ - y = (unsigned int)v; + unsigned int y = (unsigned int)v; /*@ assert Value: unsigned_downcast: y ≤ 255; */ - d = (unsigned char)y; + unsigned char d = (unsigned char)y; return; } void main4_pointer(void) { int x_0; - long long p; - unsigned int q; - int r; - p = (long long)(& x_0); - q = (unsigned int)p; - r = (int)p; + long long p = (long long)(& x_0); + /*@ assert + Value: signed_overflow: -9223372036854775808 ≤ p + (long long)100; + */ + /*@ assert + Value: signed_overflow: p + (long long)100 ≤ 9223372036854775807; + */ + p += (long long)100; + /*@ assert Value: unsigned_downcast: 0 ≤ p; */ + /*@ assert Value: unsigned_downcast: p ≤ 4294967295; */ + unsigned int q = (unsigned int)p; + int r = (int)p; return; } @@ -970,15 +998,12 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main5_wrap_signed(void) { - int x_0; - unsigned int y; - int z; - x_0 = v; + int x_0 = v; /*@ assert ASSUME: x_0 ≥ 100000; */ ; /*@ assert x_0 > 0x7FFFFFFF - 145 ∨ x_0 ≤ 0x7FFFFFFF - 145; */ ; - y = (unsigned int)x_0; + unsigned int y = (unsigned int)x_0; y += (unsigned int)145; - z = (int)y; + int z = (int)y; Frama_C_show_each(x_0,y,z); /*@ assert z ≥ 100000 + 145 ∨ z ≤ (int)(0x7FFFFFFF + 145); */ ; return; @@ -987,42 +1012,39 @@ void main5_wrap_signed(void) void main6_val_warn_converted_signed(void) { if (v) { - short s_0; - s_0 = (short)65300u; + short s_0 = (short)65300u; } if (v) { - unsigned short u; - u = (unsigned short)65300u; + unsigned short u = (unsigned short)65300u; } if (v) { - unsigned long e; - short b; - e = (unsigned long)17; - b = (short)e; + unsigned long e = (unsigned long)17; + short b = (short)e; } if (v) { - unsigned long e_0; - short b_0; /*@ assert Value: unsigned_downcast: 0 ≤ -12; */ - e_0 = (unsigned long)(-12); - b_0 = (short)e_0; + unsigned long e_0 = (unsigned long)(-12); + short b_0 = (short)e_0; } if (v) { - unsigned int e_1; - short b_1; /*@ assert Value: unsigned_downcast: 0 ≤ -64000; */ - e_1 = (unsigned int)(-64000); - b_1 = (short)e_1; + unsigned int e_1 = (unsigned int)(-64000); + short b_1 = (short)e_1; + } + if (v) { + int *p = (int *)(& v); + int x_0 = (int)p; + short y = (short)p; + /*@ assert Value: unsigned_downcast: p ≤ 65535; */ + unsigned short z = (unsigned short)p; } return; } void main7_signed_upcast(void) { - unsigned char c; - int i; - c = (unsigned char)240; - i = (int)c; + unsigned char c = (unsigned char)240; + int i = (int)c; return; } @@ -1053,8 +1075,7 @@ void main9_bitfield(void) signed char c; bf.a = (unsigned int)1648; if (v) { - int signed_a; - signed_a = (int)((int)bf.a); + int signed_a = (int)((int)bf.a); /*@ assert signed_a ≡ -400; */ ; } if (v) @@ -1066,8 +1087,7 @@ void main10_loop(void) { signed char c; struct __anonstruct_bf_2 bf; - int k; - k = 0; + int k = 0; while (k < 10) { /*@ assert Value: unsigned_downcast: 0 ≤ v; */ /*@ assert Value: unsigned_downcast: v ≤ 1023; */ @@ -1110,60 +1130,64 @@ void main(void) s ∈ [--..--] v ∈ [--..--] [value] computing for function main1 <- main. - Called from tests/value/downcast.i:142. + Called from tests/value/downcast.i:152. tests/value/downcast.i:19:[value] warning: signed downcast. assert -128 ≤ (int)sx + (int)sy; tests/value/downcast.i:19:[value] warning: signed downcast. assert (int)sx + (int)sy ≤ 127; [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2_bitfield <- main. - Called from tests/value/downcast.i:143. + Called from tests/value/downcast.i:153. tests/value/downcast.i:32:[value] warning: signed downcast. assert i ≤ 15; [value] Recording results for main2_bitfield [value] Done for function main2_bitfield [value] computing for function main3_reduction <- main. - Called from tests/value/downcast.i:144. + Called from tests/value/downcast.i:154. tests/value/downcast.i:38:[value] warning: signed downcast. assert -128 ≤ x_0; tests/value/downcast.i:38:[value] warning: signed downcast. assert x_0 ≤ 127; [value] Recording results for main3_reduction [value] Done for function main3_reduction [value] computing for function main4_pointer <- main. - Called from tests/value/downcast.i:145. -tests/value/downcast.i:48:[value] warning: signed downcast. assert p ≤ 2147483647; + Called from tests/value/downcast.i:155. +tests/value/downcast.i:50:[value] warning: signed overflow. assert -9223372036854775808 ≤ p + (long long)100; +tests/value/downcast.i:50:[value] warning: signed overflow. assert p + (long long)100 ≤ 9223372036854775807; +tests/value/downcast.i:52:[value] warning: signed downcast. assert -2147483648 ≤ p; +tests/value/downcast.i:52:[value] warning: signed downcast. assert p ≤ 2147483647; [value] Recording results for main4_pointer [value] Done for function main4_pointer [value] computing for function main5_wrap_signed <- main. - Called from tests/value/downcast.i:146. -[value] Called Frama_C_show_each([100000..2147483647], - [100145..2147483792], - [-2147483648..2147483647]) + Called from tests/value/downcast.i:156. +tests/value/downcast.i:63:[value] Frama_C_show_each: + [100000..2147483647], [100145..2147483792], [-2147483648..2147483647] [value] Recording results for main5_wrap_signed [value] Done for function main5_wrap_signed [value] computing for function main6_val_warn_converted_signed <- main. - Called from tests/value/downcast.i:147. -tests/value/downcast.i:67:[value] warning: signed downcast. assert (int)65300u ≤ 32767; -tests/value/downcast.i:83:[value] warning: signed downcast. assert -32768 ≤ (int)e_1; + Called from tests/value/downcast.i:157. +tests/value/downcast.i:71:[value] warning: signed downcast. assert (int)65300u ≤ 32767; +tests/value/downcast.i:87:[value] warning: signed downcast. assert -32768 ≤ (int)e_1; +tests/value/downcast.i:92:[value] warning: signed downcast. assert -32768 ≤ (int)p; +tests/value/downcast.i:92:[value] warning: signed downcast. assert (int)p ≤ 32767; [value] Recording results for main6_val_warn_converted_signed [value] Done for function main6_val_warn_converted_signed [value] computing for function main7_signed_upcast <- main. - Called from tests/value/downcast.i:148. + Called from tests/value/downcast.i:158. [value] Recording results for main7_signed_upcast [value] Done for function main7_signed_upcast [value] computing for function main8_bitfields <- main. - Called from tests/value/downcast.i:149. -tests/value/downcast.i:109:[value] warning: signed downcast. assert (int)S.i1 ≤ 31; -tests/value/downcast.i:110:[value] warning: signed downcast. assert (int)S.i1 ≤ 127; -tests/value/downcast.i:114:[value] warning: signed downcast. assert (int)S.i1 ≤ 31; + Called from tests/value/downcast.i:159. +tests/value/downcast.i:119:[value] warning: signed downcast. assert (int)S.i1 ≤ 31; +tests/value/downcast.i:120:[value] warning: signed downcast. assert (int)S.i1 ≤ 127; +tests/value/downcast.i:124:[value] warning: signed downcast. assert (int)S.i1 ≤ 31; [value] Recording results for main8_bitfields [value] Done for function main8_bitfields [value] computing for function main9_bitfield <- main. - Called from tests/value/downcast.i:150. -tests/value/downcast.i:127:[value] warning: signed downcast. assert -128 ≤ (int)bf.a; + Called from tests/value/downcast.i:160. +tests/value/downcast.i:137:[value] warning: signed downcast. assert -128 ≤ (int)bf.a; [value] Recording results for main9_bitfield [value] Done for function main9_bitfield [value] computing for function main10_loop <- main. - Called from tests/value/downcast.i:151. -tests/value/downcast.i:137:[value] warning: signed downcast. assert -128 ≤ (int)bf.b; -tests/value/downcast.i:137:[value] warning: signed downcast. assert (int)bf.b ≤ 127; + Called from tests/value/downcast.i:161. +tests/value/downcast.i:147:[value] warning: signed downcast. assert -128 ≤ (int)bf.b; +tests/value/downcast.i:147:[value] warning: signed downcast. assert (int)bf.b ≤ 127; [value] Recording results for main10_loop [value] Done for function main10_loop [value] Recording results for main @@ -1192,9 +1216,9 @@ tests/value/downcast.i:137:[value] warning: signed downcast. assert (int)bf.b y ∈ [--..--] d ∈ [--..--] [value:final-states] Values at end of function main4_pointer: - p ∈ {{ (long long)&x_0 }} - q ∈ {{ (unsigned int)&x_0 }} - r ∈ {{ (int)&x_0 }} + p ∈ {{ &x_0 + {100} }} + q ∈ {{ &x_0 + {100} }} + r ∈ {{ &x_0 + {100} }} [value:final-states] Values at end of function main5_wrap_signed: x_0 ∈ [100000..2147483647] y ∈ [100145..2147483792] @@ -1299,7 +1323,7 @@ tests/value/downcast.i:137:[value] warning: signed downcast. assert (int)bf.b [inout] Inputs for function main5_wrap_signed: v [inout] Out (internal) for function main6_val_warn_converted_signed: - s_0; u; e; b; e_0; b_0; e_1; b_1 + s_0; u; e; b; e_0; b_0; e_1; b_1; p; x_0; y; z [inout] Inputs for function main6_val_warn_converted_signed: v [inout] Out (internal) for function main7_signed_upcast: @@ -1350,71 +1374,81 @@ tests/value/downcast.i:137:[value] warning: signed downcast. assert (int)bf.b --- Properties of Function 'main4_pointer' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 48) +[ - ] Assertion 'Value,signed_overflow' (file tests/value/downcast.i, line 50) + tried with Value. +[ - ] Assertion 'Value,signed_overflow' (file tests/value/downcast.i, line 50) + tried with Value. +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 52) + tried with Value. +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 52) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main5_wrap_signed' -------------------------------------------------------------------------------- -[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 54) +[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 58) tried with Value. -[ Valid ] Assertion (file tests/value/downcast.i, line 55) +[ Valid ] Assertion (file tests/value/downcast.i, line 59) by Value. -[ - ] Assertion (file tests/value/downcast.i, line 60) +[ - ] Assertion (file tests/value/downcast.i, line 64) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main6_val_warn_converted_signed' -------------------------------------------------------------------------------- -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 67) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 71) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 67) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 83) + - Unreachable initialization of 's_0' (file tests/value/downcast.i, line 71) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 87) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 83) + - Unreachable initialization of 'b_1' (file tests/value/downcast.i, line 87) +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 92) + tried with Value. +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 92) + tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main8_bitfields' -------------------------------------------------------------------------------- -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 109) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 119) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 109) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 110) + - Unreachable instruction (file tests/value/downcast.i, line 119) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 120) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 110) -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 114) + - Unreachable instruction (file tests/value/downcast.i, line 120) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 124) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 114) + - Unreachable instruction (file tests/value/downcast.i, line 124) -------------------------------------------------------------------------------- --- Properties of Function 'main9_bitfield' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/downcast.i, line 124) +[ Valid ] Assertion (file tests/value/downcast.i, line 134) by Value. -[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 127) +[ Alarm ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) By Value, with pending: - - Unreachable instruction (file tests/value/downcast.i, line 127) + - Unreachable instruction (file tests/value/downcast.i, line 137) -------------------------------------------------------------------------------- --- Properties of Function 'main10_loop' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 147) tried with Value. -[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 137) +[ - ] Assertion 'Value,signed_downcast' (file tests/value/downcast.i, line 147) tried with Value. -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- 2 Completely validated - 9 To be validated + 14 To be validated 7 Alarms emitted - 18 Total + 23 Total -------------------------------------------------------------------------------- /* Generated by Frama-C */ struct s { @@ -1456,11 +1490,9 @@ void main1(void) void main2_bitfield(void) { - int i; - unsigned int j; struct s ss; - i = 117; - j = (unsigned int)254; + int i = 117; + unsigned int j = (unsigned int)254; if (v) /*@ assert Value: signed_downcast: i ≤ 15; */ ss.i = (int)i; @@ -1471,29 +1503,30 @@ void main2_bitfield(void) void main3_reduction(void) { - int x_0; - char c; - unsigned int y; - unsigned char d; - x_0 = v; + int x_0 = v; /*@ assert Value: signed_downcast: -128 ≤ x_0; */ /*@ assert Value: signed_downcast: x_0 ≤ 127; */ - c = (char)x_0; - y = (unsigned int)v; - d = (unsigned char)y; + char c = (char)x_0; + unsigned int y = (unsigned int)v; + unsigned char d = (unsigned char)y; return; } void main4_pointer(void) { int x_0; - long long p; - unsigned int q; - int r; - p = (long long)(& x_0); - q = (unsigned int)p; + long long p = (long long)(& x_0); + /*@ assert + Value: signed_overflow: -9223372036854775808 ≤ p + (long long)100; + */ + /*@ assert + Value: signed_overflow: p + (long long)100 ≤ 9223372036854775807; + */ + p += (long long)100; + unsigned int q = (unsigned int)p; + /*@ assert Value: signed_downcast: -2147483648 ≤ p; */ /*@ assert Value: signed_downcast: p ≤ 2147483647; */ - r = (int)p; + int r = (int)p; return; } @@ -1503,15 +1536,12 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main5_wrap_signed(void) { - int x_0; - unsigned int y; - int z; - x_0 = v; + int x_0 = v; /*@ assert ASSUME: x_0 ≥ 100000; */ ; /*@ assert x_0 > 0x7FFFFFFF - 145 ∨ x_0 ≤ 0x7FFFFFFF - 145; */ ; - y = (unsigned int)x_0; + unsigned int y = (unsigned int)x_0; y += (unsigned int)145; - z = (int)y; + int z = (int)y; Frama_C_show_each(x_0,y,z); /*@ assert z ≥ 100000 + 145 ∨ z ≤ (int)(0x7FFFFFFF + 145); */ ; return; @@ -1520,42 +1550,40 @@ void main5_wrap_signed(void) void main6_val_warn_converted_signed(void) { if (v) { - short s_0; /*@ assert Value: signed_downcast: (int)65300u ≤ 32767; */ - s_0 = (short)65300u; + short s_0 = (short)65300u; } if (v) { - unsigned short u; - u = (unsigned short)65300u; + unsigned short u = (unsigned short)65300u; } if (v) { - unsigned long e; - short b; - e = (unsigned long)17; - b = (short)e; + unsigned long e = (unsigned long)17; + short b = (short)e; } if (v) { - unsigned long e_0; - short b_0; - e_0 = (unsigned long)(-12); - b_0 = (short)e_0; + unsigned long e_0 = (unsigned long)(-12); + short b_0 = (short)e_0; } if (v) { - unsigned int e_1; - short b_1; - e_1 = (unsigned int)(-64000); + unsigned int e_1 = (unsigned int)(-64000); /*@ assert Value: signed_downcast: -32768 ≤ (int)e_1; */ - b_1 = (short)e_1; + short b_1 = (short)e_1; + } + if (v) { + int *p = (int *)(& v); + int x_0 = (int)p; + /*@ assert Value: signed_downcast: -32768 ≤ (int)p; */ + /*@ assert Value: signed_downcast: (int)p ≤ 32767; */ + short y = (short)p; + unsigned short z = (unsigned short)p; } return; } void main7_signed_upcast(void) { - unsigned char c; - int i; - c = (unsigned char)240; - i = (int)c; + unsigned char c = (unsigned char)240; + int i = (int)c; return; } @@ -1589,8 +1617,7 @@ void main9_bitfield(void) signed char c; bf.a = (unsigned int)1648; if (v) { - int signed_a; - signed_a = (int)((int)bf.a); + int signed_a = (int)((int)bf.a); /*@ assert signed_a ≡ -400; */ ; } if (v) @@ -1603,8 +1630,7 @@ void main10_loop(void) { signed char c; struct __anonstruct_bf_2 bf; - int k; - k = 0; + int k = 0; while (k < 10) { bf.b = (unsigned int)v; if (v) @@ -1646,12 +1672,12 @@ void main(void) uz ∈ [--..--] s ∈ [--..--] v ∈ [--..--] -[value] Called Frama_C_show_each([100000..2147483502], - [100145..2147483647], - [100145..2147483647]) -[value] Called Frama_C_show_each([2147483503..2147483647], - [2147483648..2147483792], - [-2147483648..-2147483504]) +tests/value/downcast.i:63:[value] Frama_C_show_each: + [2147483503..2147483647], + [2147483648..2147483792], + [-2147483648..-2147483504] +tests/value/downcast.i:63:[value] Frama_C_show_each: + [100000..2147483502], [100145..2147483647], [100145..2147483647] [value] Recording results for main5_wrap_signed [value] done for function main5_wrap_signed [value] ====== VALUES COMPUTED ====== @@ -1676,22 +1702,22 @@ void main(void) --- Properties of Function 'main5_wrap_signed' -------------------------------------------------------------------------------- -[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 54) +[ - ] Assertion 'ASSUME' (file tests/value/downcast.i, line 58) tried with Value (v2). -[ Valid ] Assertion (file tests/value/downcast.i, line 55) +[ Valid ] Assertion (file tests/value/downcast.i, line 59) by Value (v2). -[ Valid ] Assertion (file tests/value/downcast.i, line 60) +[ Valid ] Assertion (file tests/value/downcast.i, line 64) by Value (v2). -------------------------------------------------------------------------------- --- Properties of Function 'main9_bitfield' -------------------------------------------------------------------------------- -[ Dead ] Assertion (file tests/value/downcast.i, line 124) +[ Dead ] Assertion (file tests/value/downcast.i, line 134) Locally valid, but unreachable. By Value (v2) because: - - Unreachable program point (file tests/value/downcast.i, line 124) -[Unreachable] Unreachable program point (file tests/value/downcast.i, line 124) + - Unreachable program point (file tests/value/downcast.i, line 134) +[Unreachable] Unreachable program point (file tests/value/downcast.i, line 134) by Value (v2). -------------------------------------------------------------------------------- diff --git a/tests/value/oracle/dur.res.oracle b/tests/value/oracle/dur.res.oracle index e1199cb4a2b54fbc9d8d1696e48204ddebd29ee3..a8a7604babf60dfa1c3f1b4a477facc5080aca19 100644 --- a/tests/value/oracle/dur.res.oracle +++ b/tests/value/oracle/dur.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/dur.i (no preprocessing) [value] Analyzing a complete application starting at F2 [value] Computing initial state diff --git a/tests/value/oracle/empty_base.0.res.oracle b/tests/value/oracle/empty_base.0.res.oracle index ff0423057b58b7b90290ef45b764315f365ffa7e..b7c7fa587926dae1b26249a186224b69b65a239a 100644 --- a/tests/value/oracle/empty_base.0.res.oracle +++ b/tests/value/oracle/empty_base.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_base.c (with preprocessing) tests/value/empty_base.c:62:[kernel] user error: variable `c' has initializer but incomplete type tests/value/empty_base.c:66:[kernel] warning: Too many initializers for structure diff --git a/tests/value/oracle/empty_base.1.res.oracle b/tests/value/oracle/empty_base.1.res.oracle index d085ae7900cefdde1bc45f71501c6daac34cb8ae..a7acab697a46e79fb2f2b1f4e03de499274353bd 100644 --- a/tests/value/oracle/empty_base.1.res.oracle +++ b/tests/value/oracle/empty_base.1.res.oracle @@ -1,6 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_base.c (with preprocessing) tests/value/empty_base.c:49:[kernel] user error: empty initializers only allowed for GCC/MSVC + 47 struct empty empty_array_of_empty[0]; + 48 struct empty array_of_empty[1]; + 49 struct empty many_empty[3] = {{}}; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 50 + 51 comp array_of_comp[1] = {{.a = 17, .b = 45, .e = {}}}; [kernel] user error: stopping on file "tests/value/empty_base.c" that has errors. Add '-kernel-msg-key pp' for preprocessing command. [kernel] Frama-C aborted: invalid user input. diff --git a/tests/value/oracle/empty_struct.0.res.oracle b/tests/value/oracle/empty_struct.0.res.oracle index 94388f5bea39c2812178f50f9c803da89cea5b12..92890df89e90b66e5af8d64a2fc8e7e258779270 100644 --- a/tests/value/oracle/empty_struct.0.res.oracle +++ b/tests/value/oracle/empty_struct.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_struct.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/empty_struct.1.res.oracle b/tests/value/oracle/empty_struct.1.res.oracle index b0ad12c5f217c760c866ed4be67f93e320b93fdc..d19f80983668751c153619863c05a58d46507807 100644 --- a/tests/value/oracle/empty_struct.1.res.oracle +++ b/tests/value/oracle/empty_struct.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_struct.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/empty_struct.2.res.oracle b/tests/value/oracle/empty_struct.2.res.oracle index b0ad12c5f217c760c866ed4be67f93e320b93fdc..d19f80983668751c153619863c05a58d46507807 100644 --- a/tests/value/oracle/empty_struct.2.res.oracle +++ b/tests/value/oracle/empty_struct.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_struct.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/empty_struct.3.res.oracle b/tests/value/oracle/empty_struct.3.res.oracle index e5de4f39fdcd29160b71f67f1f55c171b7a2ba58..35a0cc13e1cff51ced07a4186815f68595a66ce7 100644 --- a/tests/value/oracle/empty_struct.3.res.oracle +++ b/tests/value/oracle/empty_struct.3.res.oracle @@ -1,7 +1,6 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_struct.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state -tests/value/empty_struct.c:19:[value] user error: empty structs are unsupported (type 'struct s', location s) +tests/value/empty_struct.c:21:[value] user error: empty structs are unsupported (type 'struct s', location s) in C99 (only allowed as GCC/MSVC extension). Aborting. [kernel] Plug-in value aborted: invalid user input. diff --git a/tests/value/oracle/empty_struct.4.err.oracle b/tests/value/oracle/empty_struct.4.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/oracle/empty_struct.4.res.oracle b/tests/value/oracle/empty_struct.4.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..aef2c7a83d0e7af5ad895996bc608753095f9afd --- /dev/null +++ b/tests/value/oracle/empty_struct.4.res.oracle @@ -0,0 +1,23 @@ +[kernel] Parsing tests/value/empty_struct.c (with preprocessing) +[value] Analyzing a complete application starting at main2 +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + NULL[rbits 0 to 15] ∈ [--..--] + s2 ∈ {0} +[value] Recording results for main2 +[value] done for function main2 +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main2: + ptr_ret ∈ {2} +[from] Computing for function main2 +[from] Done for function main2 +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function main2: + NO EFFECTS +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main2: + ptr_ret +[inout] Inputs for function main2: + \nothing diff --git a/tests/value/oracle/empty_struct.5.err.oracle b/tests/value/oracle/empty_struct.5.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/oracle/empty_struct.5.res.oracle b/tests/value/oracle/empty_struct.5.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..50c0b6b1b53f55ea343e258a3ac8ecd916b7a828 --- /dev/null +++ b/tests/value/oracle/empty_struct.5.res.oracle @@ -0,0 +1,50 @@ +[kernel] Parsing tests/value/empty_struct.c (with preprocessing) +[value] Analyzing a complete application starting at main3 +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + NULL[rbits 0 to 15] ∈ [--..--] + s2 ∈ {0} + __fc_random_counter ∈ [--..--] + __fc_rand_max ∈ {32767} + __fc_heap_status ∈ [--..--] + __fc_mblen_state ∈ [--..--] + __fc_mbtowc_state ∈ [--..--] + __fc_wctomb_state ∈ [--..--] + nondet ∈ [--..--] +tests/value/empty_struct.c:77:[value] allocating variable __malloc_main3_l77 +tests/value/empty_struct.c:78:[value] allocating variable __realloc_main3_l78 +tests/value/empty_struct.c:80:[value] entering loop for the first time +[value] Recording results for main3 +[value] done for function main3 +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function main3: + __fc_heap_status ∈ [--..--] + q ∈ {{ NULL ; &__malloc_main3_l77[-1] }} or ESCAPINGADDR + r ∈ ESCAPINGADDR + p ∈ {{ &empties[-1] }} +[from] Computing for function main3 +[from] Computing for function malloc <-main3 +[from] Done for function malloc +[from] Computing for function realloc <-main3 +[from] Done for function realloc +[from] Computing for function free <-main3 +[from] Done for function free +[from] Done for function main3 +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function free: + __fc_heap_status FROM __fc_heap_status (and SELF) +[from] Function malloc: + __fc_heap_status FROM __fc_heap_status; size (and SELF) + \result FROM __fc_heap_status; size +[from] Function realloc: + __fc_heap_status FROM __fc_heap_status (and SELF) + \result FROM __fc_heap_status; ptr; size +[from] Function main3: + __fc_heap_status FROM __fc_heap_status (and SELF) +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function main3: + __fc_heap_status; q; r; p; i +[inout] Inputs for function main3: + __fc_heap_status diff --git a/tests/value/oracle/empty_struct2.res.oracle b/tests/value/oracle/empty_struct2.res.oracle index 5488f1ea5e29e4208eb06dea8a1597160f6feba5..627a4f866723540e08d9a9a4227e33199647447c 100644 --- a/tests/value/oracle/empty_struct2.res.oracle +++ b/tests/value/oracle/empty_struct2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_struct2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,32 +5,19 @@ [value:initial-state] Values of globals at initialization nondet ∈ [--..--] tests/value/empty_struct2.c:41:[value] assertion got status valid. -[value] Called Frama_C_show_each_global_empty(∅) -[value] Called Frama_C_show_each_e1(∅) -[value] computing for function memcpy <- main. - Called from tests/value/empty_struct2.c:45. -[value] using specification for function memcpy -share/libc/string.h:60:[value] function memcpy: precondition 'valid_dst' got status valid. -share/libc/string.h:61:[value] function memcpy: precondition 'valid_src' got status valid. -share/libc/string.h:62:[value] function memcpy: precondition got status valid. -tests/value/empty_struct2.c:45:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -[value] Done for function memcpy -[value] computing for function memcpy <- main. - Called from tests/value/empty_struct2.c:50. -tests/value/empty_struct2.c:50:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -[value] Done for function memcpy -[value] Called Frama_C_show_each_c2([--..--]) -[value] Called Frama_C_show_each_c2_e(∅) +tests/value/empty_struct2.c:43:[value] Frama_C_show_each_global_empty: ∅ +tests/value/empty_struct2.c:44:[value] Frama_C_show_each_e1: ∅ +tests/value/empty_struct2.c:45:[value] Call to builtin memcpy(({{ (void *)&e2 }},{{ (void const *)&e1 }},{0})) +tests/value/empty_struct2.c:50:[value] Call to builtin memcpy(({{ (void *)&c2 }},{{ (void const *)&c1 }},{8})) +tests/value/empty_struct2.c:51:[value] Frama_C_show_each_c2: .a ∈ {42} + .b ∈ {77} +tests/value/empty_struct2.c:52:[value] Frama_C_show_each_c2_e: ∅ [value] computing for function f <- main. Called from tests/value/empty_struct2.c:53. -tests/value/empty_struct2.c:27:[value] warning: accessing uninitialized left-value. assert \initialized(&s.b); -tests/value/empty_struct2.c:27:[value] warning: signed overflow. assert s.b + 10 ≤ 2147483647; -tests/value/empty_struct2.c:28:[value] warning: accessing uninitialized left-value. assert \initialized(&s.a); -tests/value/empty_struct2.c:28:[value] warning: signed overflow. assert -2147483648 ≤ s.a - 3; [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_res(.a ∈ [-2147483638..2147483647] - .b ∈ [-2147483648..2147483644]) +tests/value/empty_struct2.c:55:[value] Frama_C_show_each_res: .a ∈ {87} + .b ∈ {39} tests/value/empty_struct2.c:59:[value] assertion got status valid. [value] computing for function ret_empty <- main. Called from tests/value/empty_struct2.c:61. @@ -47,14 +33,15 @@ tests/value/empty_struct2.c:63:[value] warning: out of bounds read. assert \vali [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function f: - res.a ∈ [-2147483638..2147483647] - .b ∈ [-2147483648..2147483644] + res.a ∈ {87} + .b ∈ {39} [value:final-states] Values at end of function main: c1.a ∈ {42} .b ∈ {77} - c2 ∈ [--..--] or UNINITIALIZED - res.a ∈ [-2147483638..2147483647] - .b ∈ [-2147483648..2147483644] + c2.a ∈ {42} + .b ∈ {77} + res.a ∈ {87} + .b ∈ {39} cb.i ∈ {91} ce.ch ∈ {90} p ∈ {{ (struct empty *)&cb }} diff --git a/tests/value/oracle/empty_union.res.oracle b/tests/value/oracle/empty_union.res.oracle index c0ac8a45bb180d7e6fe17768b8a26a59b8ca80be..b0ec7d0990a0fe884ef487e65578cab257398dc4 100644 --- a/tests/value/oracle/empty_union.res.oracle +++ b/tests/value/oracle/empty_union.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/empty_union.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state tests/value/empty_union.c:59:[value] warning: during initialization of variable 'f1', size of type 'int []' cannot be computed (Size of array without number of elements.) -tests/value/empty_union.c:59:[kernel] imprecise size for variable f1 (Size of array without number of elements.) [value] Initial state computed [value:initial-state] Values of globals at initialization nondet ∈ [--..--] @@ -14,22 +12,12 @@ tests/value/empty_union.c:59:[kernel] imprecise size for variable f1 (Size of ar .data[1..2] ∈ {0} tests/value/empty_union.c:75:[value] assertion got status valid. tests/value/empty_union.c:76:[value] assertion got status valid. -[value] Called Frama_C_show_each_global_empty(∅) -[value] Called Frama_C_show_each_e1(∅) -[value] computing for function memcpy <- main. - Called from tests/value/empty_union.c:80. -[value] using specification for function memcpy -share/libc/string.h:60:[value] function memcpy: precondition 'valid_dst' got status valid. -share/libc/string.h:61:[value] function memcpy: precondition 'valid_src' got status valid. -share/libc/string.h:62:[value] function memcpy: precondition got status valid. -tests/value/empty_union.c:80:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -[value] Done for function memcpy -[value] computing for function memcpy <- main. - Called from tests/value/empty_union.c:85. -tests/value/empty_union.c:85:[value] cannot evaluate ACSL term, unsupported ACSL construct: logic functions or predicates -[value] Done for function memcpy -[value] Called Frama_C_show_each_c2([--..--]) -[value] Called Frama_C_show_each_c2_e(∅) +tests/value/empty_union.c:78:[value] Frama_C_show_each_global_empty: ∅ +tests/value/empty_union.c:79:[value] Frama_C_show_each_e1: ∅ +tests/value/empty_union.c:80:[value] Call to builtin memcpy(({{ (void *)&e2 }},{{ (void const *)&e1 }},{0})) +tests/value/empty_union.c:85:[value] Call to builtin memcpy(({{ (void *)&c2 }},{{ (void const *)&c1 }},{4})) +tests/value/empty_union.c:86:[value] Frama_C_show_each_c2: {77} +tests/value/empty_union.c:87:[value] Frama_C_show_each_c2_e: ∅ [value] computing for function f <- main. Called from tests/value/empty_union.c:88. [value] Recording results for f @@ -39,7 +27,7 @@ tests/value/empty_union.c:85:[value] cannot evaluate ACSL term, unsupported ACSL tests/value/empty_union.c:37:[value] function copy_empty: postcondition got status valid. [value] Recording results for copy_empty [value] Done for function copy_empty -[value] Called Frama_C_show_each_res({74}) +tests/value/empty_union.c:91:[value] Frama_C_show_each_res: {74} [value] computing for function gcc_zero_length_examples <- main. Called from tests/value/empty_union.c:102. [value] Recording results for gcc_zero_length_examples @@ -55,7 +43,7 @@ tests/value/empty_union.c:37:[value] function copy_empty: postcondition got stat [value:final-states] Values at end of function main: c1{.a; .e{}; .b} ∈ {77} - c2 ∈ [--..--] or UNINITIALIZED + c2{.a; .e{}; .b} ∈ {77} res{.a; .e{}; .b} ∈ {74} cb{.s{}; .i} ∈ {91} ce{.ch; .ss{}} ∈ {90} diff --git a/tests/value/oracle/endian.0.err.oracle b/tests/value/oracle/endian.0.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/oracle/endian.0.res.oracle b/tests/value/oracle/endian.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..661efc4e41e1d7c3d2a440f4cc1fd7d0a5ec3dd1 --- /dev/null +++ b/tests/value/oracle/endian.0.res.oracle @@ -0,0 +1,77 @@ +[kernel] Parsing tests/value/endian.i (no preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + v1 ∈ {0} + UU ∈ {0} + undet ∈ [--..--] +[value] computing for function main0 <- main. + Called from tests/value/endian.i:101. +[value] Recording results for main0 +[value] Done for function main0 +[value] computing for function interpret_bits <- main. + Called from tests/value/endian.i:102. +[value] Recording results for interpret_bits +[value] Done for function interpret_bits +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function interpret_bits: + x{.integer[bits 0 to 0]; .bits.bit0} ∈ {0} + {.integer[bits 1 to 1]; .bits.bit1} ∈ {1} + {.integer[bits 2 to 2]; .bits.bit2} ∈ {0} + {.integer[bits 3 to 6]; .bits{.bit3; .bit4; .bit5; .bit6}} ∈ [--..--] + {.integer[bits 7 to 7]; .bits.bit7} ∈ {0} + a ∈ {8} + b ∈ {239} + c ∈ {0; 128} + d ∈ {0; 1} + e ∈ {251; 255} + f ∈ [2..122],2%8 +[value:final-states] Values at end of function main0: + b0 ∈ {1} + b1 ∈ {2} + b2 ∈ {3} + b3 ∈ {255} + f ∈ {4278387200} + data0{.full[bits 0 to 7]; .part.a} ∈ {0} + {.full[bits 8 to 31]#; .part{.b#; .c#; .d#}} ∈ + {4278387201}%32, bits 8 to 31 + G0 ∈ {65532} + G1 ∈ {65532} + G2 ∈ {-4} + G3 ∈ {252} + G{.f0; .f1[bits 0 to 15]; .f2[bits 0 to 15]; .f3[bits 0 to 15]} ∈ {65532} + {.f0[bits 16 to 31]; .f1[bits 16 to 31]; .f2[bits 16 to 31]; .f3[bits 16 to 31]} ∈ + {0} +[value:final-states] Values at end of function main: + +[from] Computing for function interpret_bits +[from] Done for function interpret_bits +[from] Computing for function main0 +[from] Done for function main0 +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function interpret_bits: + NO EFFECTS +[from] Function main0: + NO EFFECTS +[from] Function main: + NO EFFECTS +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function interpret_bits: + x; a; b; c; d; e; f +[inout] Inputs for function interpret_bits: + undet +[inout] Out (internal) for function main0: + b0; b1; b2; b3; f; data0; G0; G1; G2; G3; + G{.f0; .f1[bits 0 to 15]; .f2[bits 0 to 15]; .f3[bits 0 to 15]} +[inout] Inputs for function main0: + \nothing +[inout] Out (internal) for function main: + \nothing +[inout] Inputs for function main: + undet diff --git a/tests/value/oracle/endian.1.err.oracle b/tests/value/oracle/endian.1.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/oracle/endian.1.res.oracle b/tests/value/oracle/endian.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..5aa90fa7666d498a0d4c68f649c3342a90f87110 --- /dev/null +++ b/tests/value/oracle/endian.1.res.oracle @@ -0,0 +1,77 @@ +[kernel] Parsing tests/value/endian.i (no preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + v1 ∈ {0} + UU ∈ {0} + undet ∈ [--..--] +[value] computing for function main0 <- main. + Called from tests/value/endian.i:101. +[value] Recording results for main0 +[value] Done for function main0 +[value] computing for function interpret_bits <- main. + Called from tests/value/endian.i:102. +[value] Recording results for interpret_bits +[value] Done for function interpret_bits +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function interpret_bits: + x{.integer[bits 0 to 0]; .bits.bit0} ∈ {0} + {.integer[bits 1 to 1]; .bits.bit1} ∈ {1} + {.integer[bits 2 to 2]; .bits.bit2} ∈ {0} + {.integer[bits 3 to 6]; .bits{.bit3; .bit4; .bit5; .bit6}} ∈ [--..--] + {.integer[bits 7 to 7]; .bits.bit7} ∈ {0} + a ∈ {16} + b ∈ {247} + c ∈ {0; 1} + d ∈ {0; 128} + e ∈ {223; 255} + f ∈ [64..94],0%2 +[value:final-states] Values at end of function main0: + b0 ∈ {255} + b1 ∈ {3} + b2 ∈ {2} + b3 ∈ {1} + f ∈ {197121} + data0{.full[bits 0 to 7]; .part.a} ∈ {0} + {.full[bits 8 to 31]#; .part{.b#; .c#; .d#}} ∈ + {4278387201}%32, bits 8 to 31 + G0 ∈ {65532} + G1 ∈ {-262144} + G2 ∈ {-1} + G3 ∈ {255} + G{.f0; .f1[bits 0 to 15]; .f2[bits 0 to 15]; .f3[bits 0 to 15]} ∈ {65532} + {.f0[bits 16 to 31]; .f1[bits 16 to 31]; .f2[bits 16 to 31]; .f3[bits 16 to 31]} ∈ + {0} +[value:final-states] Values at end of function main: + +[from] Computing for function interpret_bits +[from] Done for function interpret_bits +[from] Computing for function main0 +[from] Done for function main0 +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function interpret_bits: + NO EFFECTS +[from] Function main0: + NO EFFECTS +[from] Function main: + NO EFFECTS +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function interpret_bits: + x; a; b; c; d; e; f +[inout] Inputs for function interpret_bits: + undet +[inout] Out (internal) for function main0: + b0; b1; b2; b3; f; data0; G0; G1; G2; G3; + G{.f0; .f1[bits 0 to 15]; .f2[bits 0 to 15]; .f3[bits 0 to 15]} +[inout] Inputs for function main0: + \nothing +[inout] Out (internal) for function main: + \nothing +[inout] Inputs for function main: + undet diff --git a/tests/value/oracle/endian.res.oracle b/tests/value/oracle/endian.res.oracle deleted file mode 100644 index 3c65aaa826fb3d6c3344df44a4e58255837e2879..0000000000000000000000000000000000000000 --- a/tests/value/oracle/endian.res.oracle +++ /dev/null @@ -1,55 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/endian.i (no preprocessing) -[value] Analyzing a complete application starting at main -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - v1 ∈ {0} - UU ∈ {0} - b0 ∈ {0} - b1 ∈ {0} - b2 ∈ {0} - b3 ∈ {0} - f ∈ {0} - G0 ∈ {0} - G1 ∈ {0} - G2 ∈ {0} - G3 ∈ {0} - G{.f0; .f1[bits 0 to 15]; .f2[bits 0 to 15]; .f3[bits 0 to 15]} ∈ {65532} - {.f0[bits 16 to 31]; .f1[bits 16 to 31]; .f2[bits 16 to 31]; .f3[bits 16 to 31]} ∈ - {0} -[value] Recording results for main -[value] done for function main -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function main: - b0 ∈ {1} - b1 ∈ {2} - b2 ∈ {3} - b3 ∈ {255} - f ∈ {4278387200} - G0 ∈ {65532} - G1 ∈ {65532} - G2 ∈ {-4} - G3 ∈ {252} - data0{.full[bits 0 to 7]; .part.a} ∈ {0} - {.full[bits 8 to 31]#; .part{.b#; .c#; .d#}} ∈ - {4278387201}%32, bits 8 to 31 -[from] Computing for function main -[from] Done for function main -[from] ====== DEPENDENCIES COMPUTED ====== - These dependencies hold at termination for the executions that terminate: -[from] Function main: - b0 FROM \nothing - b1 FROM \nothing - b2 FROM \nothing - b3 FROM \nothing - f FROM \nothing - G0 FROM G{.f0; .f1[bits 0 to 15]; .f2[bits 0 to 15]; .f3[bits 0 to 15]} - G1 FROM G - G2 FROM G{.f0[bits 0 to 4]; .f1[bits 0 to 4]; .f2; .f3[bits 0 to 4]} - G3 FROM G{.f0[bits 0 to 7]; .f1[bits 0 to 7]; .f2[bits 0 to 7]; .f3} -[from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function main: - b0; b1; b2; b3; f; G0; G1; G2; G3; data0 -[inout] Inputs for function main: - G diff --git a/tests/value/oracle/enum.res.oracle b/tests/value/oracle/enum.res.oracle index 048e8502cff554d8e890f764377eaae4b79bcd2b..8ccb7b3a0737b0a9fed3d31b48312e3a13c0cd93 100644 --- a/tests/value/oracle/enum.res.oracle +++ b/tests/value/oracle/enum.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/enum.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state @@ -8,7 +7,6 @@ [1..2] ∈ {0} u[0] ∈ {2} [1..2] ∈ {0} -[value] Call to builtin bzero(({{ (unsigned char *)&i }},{12})) tests/value/enum.i:16:[value] entering loop for the first time tests/value/enum.i:20:[value] assertion got status valid. [value] Recording results for f @@ -26,13 +24,9 @@ tests/value/enum.i:20:[value] assertion got status valid. j ∈ {2} k ∈ {0} [from] Computing for function f -[from] Computing for function Frama_C_bzero <-f -[from] Done for function Frama_C_bzero [from] Done for function f [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - i[0..2] FROM \nothing [from] Function f: t[2] FROM \nothing u[2] FROM \nothing diff --git a/tests/value/oracle/enum2.res.oracle b/tests/value/oracle/enum2.res.oracle index e4527369cc485ed24f2d911d159d8e1c715aef26..d7f5e0829a447c4d17857b6a3aead79b2268d83c 100644 --- a/tests/value/oracle/enum2.res.oracle +++ b/tests/value/oracle/enum2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/enum2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,7 +7,7 @@ must_be_zero ∈ {0} [value] computing for function enum1_sgn1_inf_sgn0 <- main. Called from tests/value/enum2.c:33. -[value] Called Frama_C_show_each_enum1_sgn1_inf_sgn0({0}) +tests/value/enum2.c:27:[value] Frama_C_show_each_enum1_sgn1_inf_sgn0: {0} [value] Recording results for enum1_sgn1_inf_sgn0 [value] Done for function enum1_sgn1_inf_sgn0 [value] computing for function enum1_sgn1_positif <- main. @@ -17,10 +16,10 @@ Called from tests/value/enum2.c:21. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_enum1_sgn1_positif({1}) +tests/value/enum2.c:22:[value] Frama_C_show_each_enum1_sgn1_positif: {1} [value] Recording results for enum1_sgn1_positif [value] Done for function enum1_sgn1_positif -[value] Called Frama_C_show_each_sizeof_enum1({8}) +tests/value/enum2.c:35:[value] Frama_C_show_each_sizeof_enum1: {8} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/eval_separated.res.oracle b/tests/value/oracle/eval_separated.res.oracle index 57e68093bb10cbf0bde2cf36bb88b8f1df7be6e7..62daf774f0602b5fbd0fdf48dec5b90571cd0c24 100644 --- a/tests/value/oracle/eval_separated.res.oracle +++ b/tests/value/oracle/eval_separated.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/eval_separated.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -42,6 +41,7 @@ tests/value/eval_separated.c:43:[value] warning: assertion got status unknown. tests/value/eval_separated.c:45:[value] warning: assertion got status unknown. [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 1 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: p ∈ {{ &t1 + [-8589934592..8589934588],0%4 }} diff --git a/tests/value/oracle/extern.res.oracle b/tests/value/oracle/extern.res.oracle index 22dc38804147f0e57074dec9ce7641826a7896ac..32c12281dc74e7d4991ee9cda1d46e9ddaa156bc 100644 --- a/tests/value/oracle/extern.res.oracle +++ b/tests/value/oracle/extern.res.oracle @@ -1,11 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/extern.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state -tests/value/extern.i:4:[kernel] imprecise size for variable T3 (Size of array without number of elements.) tests/value/extern.i:4:[value] warning: during initialization of variable 'T3', size of type 'int []' cannot be computed (Size of array without number of elements.) -tests/value/extern.i:5:[kernel] imprecise size for variable T4 (Size of array without number of elements.) tests/value/extern.i:5:[value] warning: during initialization of variable 'T4', size of type 'int const []' cannot be computed (Size of array without number of elements.) tests/value/extern.i:14:[value] no size specified for array, assuming 0 diff --git a/tests/value/oracle/f1.res.oracle b/tests/value/oracle/f1.res.oracle index dc97ab23c9e65b4c0c9a759a351bd7fde299d9c1..25663544e5f3dd17116243eabdf60ac3bf4ffcb8 100644 --- a/tests/value/oracle/f1.res.oracle +++ b/tests/value/oracle/f1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/f1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/f2.res.oracle b/tests/value/oracle/f2.res.oracle index 6bd1b847b8b7e41a52933382a0e3ece9052df115..359ec053af6336e950547cf584eafaec9031f780 100644 --- a/tests/value/oracle/f2.res.oracle +++ b/tests/value/oracle/f2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/f2.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/false.res.oracle b/tests/value/oracle/false.res.oracle index d648a3cf7e65d310a4f31e198b0614fa0022792c..6c2800f24cfd6c2be04346b55b83c7fb24d58dab 100644 --- a/tests/value/oracle/false.res.oracle +++ b/tests/value/oracle/false.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/false.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/fam_sizeof.res.oracle b/tests/value/oracle/fam_sizeof.res.oracle index 797fc76c84d9b6616637b9172a935e6895aa4947..ff8fb760d905da9034060e4b927d8f9845fbb801 100644 --- a/tests/value/oracle/fam_sizeof.res.oracle +++ b/tests/value/oracle/fam_sizeof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/fam_sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -31,4 +30,4 @@ tests/value/fam_sizeof.i:50:[value] assertion got status valid. [inout] Out (internal) for function main: z1; z2; z3; z4; z5; __retres [inout] Inputs for function main: - fam; nested; fam2 + \nothing diff --git a/tests/value/oracle/find_ivaltop.res.oracle b/tests/value/oracle/find_ivaltop.res.oracle index dc34aef57f545e321afd3c419205188c7b5b0dbf..0fdd3eb68fd8eda25b45ac668f523488edaee0bd 100644 --- a/tests/value/oracle/find_ivaltop.res.oracle +++ b/tests/value/oracle/find_ivaltop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/find_ivaltop.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/folding.res.oracle b/tests/value/oracle/folding.res.oracle index c8868c43919db8098c46e9492ac58218c10994a9..5c6ea76be49506a5b119d921102574b6a4cd4519 100644 --- a/tests/value/oracle/folding.res.oracle +++ b/tests/value/oracle/folding.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/folding.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -15,6 +14,7 @@ [value] Done for function g [value] computing for function foo <- main. Called from tests/value/folding.i:24. +tests/value/folding.i:15:[value] warning: initialization of volatile variable unknown ignored [value] Recording results for foo [value] Done for function foo [value] computing for function foo <- main. diff --git a/tests/value/oracle/for_loops.0.res.oracle b/tests/value/oracle/for_loops.0.res.oracle index a4d68d369bdb4e45f78eff4e8e89c4f41fc0946c..4e24019a036eb0268df5f70c11e5d7988bf4d366 100644 --- a/tests/value/oracle/for_loops.0.res.oracle +++ b/tests/value/oracle/for_loops.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/for_loops.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,10 +12,10 @@ share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got [value] Done for function Frama_C_interval tests/value/for_loops.c:27:[value] entering loop for the first time tests/value/for_loops.c:29:[value] entering loop for the first time -[value] Called Frama_C_show_each_F({0}) -[value] Called Frama_C_show_each_F({0; 1}) -[value] Called Frama_C_show_each_F({0; 1; 2}) -[value] Called Frama_C_show_each_F([0..2147483647]) +tests/value/for_loops.c:30:[value] Frama_C_show_each_F: {0} +tests/value/for_loops.c:30:[value] Frama_C_show_each_F: {0; 1} +tests/value/for_loops.c:30:[value] Frama_C_show_each_F: {0; 1; 2} +tests/value/for_loops.c:30:[value] Frama_C_show_each_F: [0..2147483647] tests/value/for_loops.c:27:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; [value] Recording results for main [value] done for function main diff --git a/tests/value/oracle/for_loops.1.res.oracle b/tests/value/oracle/for_loops.1.res.oracle index f316368eb13b565d9dd92c9b85e3059a4668f8b1..31820ca7403fb830b7a3f7d3a9253050c2032c6a 100644 --- a/tests/value/oracle/for_loops.1.res.oracle +++ b/tests/value/oracle/for_loops.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/for_loops.c (with preprocessing) [value] Analyzing a complete application starting at main_2 [value] Computing initial state @@ -15,28 +14,28 @@ tests/value/for_loops.c:16:[value] entering loop for the first time [value] computing for function Frama_C_interval <- main_2. Called from tests/value/for_loops.c:16. [value] Done for function Frama_C_interval -[value] Called Frama_C_show_each_F({0; 1}) +tests/value/for_loops.c:17:[value] Frama_C_show_each_F: {0; 1} [value] computing for function Frama_C_interval <- main_2. Called from tests/value/for_loops.c:16. [value] Done for function Frama_C_interval -[value] Called Frama_C_show_each_F({0; 1; 2}) +tests/value/for_loops.c:17:[value] Frama_C_show_each_F: {0; 1; 2} [value] computing for function Frama_C_interval <- main_2. Called from tests/value/for_loops.c:16. [value] Done for function Frama_C_interval -[value] Called Frama_C_show_each_F({0; 1; 2; 3}) +tests/value/for_loops.c:17:[value] Frama_C_show_each_F: {0; 1; 2; 3} [value] computing for function Frama_C_interval <- main_2. Called from tests/value/for_loops.c:16. [value] Done for function Frama_C_interval -[value] Called Frama_C_show_each_F({0; 1; 2; 3; 4}) +tests/value/for_loops.c:17:[value] Frama_C_show_each_F: {0; 1; 2; 3; 4} [value] computing for function Frama_C_interval <- main_2. Called from tests/value/for_loops.c:16. [value] Done for function Frama_C_interval -[value] Called Frama_C_show_each_F({0; 1; 2; 3; 4; 5}) +tests/value/for_loops.c:17:[value] Frama_C_show_each_F: {0; 1; 2; 3; 4; 5} [value] computing for function Frama_C_interval <- main_2. Called from tests/value/for_loops.c:16. [value] Done for function Frama_C_interval tests/value/for_loops.c:16:[value] warning: signed overflow. assert w + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_F([0..2147483647]) +tests/value/for_loops.c:17:[value] Frama_C_show_each_F: [0..2147483647] [value] Recording results for main_2 [value] done for function main_2 [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/for_loops.2.res.oracle b/tests/value/oracle/for_loops.2.res.oracle index 183666057633dfebb3527c071f65388a2316ed1c..bba752a14e6a9d04a517bc6c84a4665a0c0e2c4b 100644 --- a/tests/value/oracle/for_loops.2.res.oracle +++ b/tests/value/oracle/for_loops.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/for_loops.c (with preprocessing) [value] Analyzing a complete application starting at main_3 [value] Computing initial state @@ -11,27 +10,29 @@ [value] using specification for function Frama_C_interval share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. [value] Done for function Frama_C_interval -[value] DUMPING STATE of file tests/value/for_loops.c line 39 +tests/value/for_loops.c:39:[value] Frama_C_dump_each: + # Cvalue domain: Frama_C_entropy_source ∈ [--..--] x ∈ {0} j ∈ UNINITIALIZED T[0..999] ∈ UNINITIALIZED nSelectors ∈ [0..1000] w ∈ {0} - =END OF DUMP== + ==END OF DUMP== tests/value/for_loops.c:40:[value] entering loop for the first time -[value] DUMPING STATE of file tests/value/for_loops.c line 41 +tests/value/for_loops.c:41:[value] Frama_C_dump_each: + # Cvalue domain: Frama_C_entropy_source ∈ [--..--] x ∈ {0} j ∈ [0..1000] T[0..999] ∈ {1} or UNINITIALIZED nSelectors ∈ [0..1000] w ∈ {0} - =END OF DUMP== + ==END OF DUMP== tests/value/for_loops.c:42:[value] entering loop for the first time tests/value/for_loops.c:42:[value] warning: accessing uninitialized left-value. assert \initialized(&T[j]); tests/value/for_loops.c:42:[value] warning: signed overflow. assert w + T[j] ≤ 2147483647; -[value] Called Frama_C_show_each([0..2147483647]) +tests/value/for_loops.c:43:[value] Frama_C_show_each: [0..2147483647] [value] Recording results for main_3 [value] done for function main_3 [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/for_loops.3.res.oracle b/tests/value/oracle/for_loops.3.res.oracle index c6432089f7767aa5f886ed080a1f5c91cddd9078..6f53aa9ed5092506c3faab824fb9738d8da772aa 100644 --- a/tests/value/oracle/for_loops.3.res.oracle +++ b/tests/value/oracle/for_loops.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/for_loops.c (with preprocessing) [value] Analyzing a complete application starting at main_4 [value] Computing initial state @@ -8,10 +7,10 @@ x ∈ {0} tests/value/for_loops.c:50:[value] entering loop for the first time tests/value/for_loops.c:52:[value] entering loop for the first time -[value] Called Frama_C_show_each_F({0}, {0}) -[value] Called Frama_C_show_each_F({0; 1}, [0..2147483647]) -[value] Called Frama_C_show_each_F({0; 1; 2}, [0..2147483647]) -[value] Called Frama_C_show_each_F({0; 1; 2; 3; 4; 5}, [0..2147483647]) +tests/value/for_loops.c:55:[value] Frama_C_show_each_F: {0}, {0} +tests/value/for_loops.c:55:[value] Frama_C_show_each_F: {0; 1}, [0..2147483647] +tests/value/for_loops.c:55:[value] Frama_C_show_each_F: {0; 1; 2}, [0..2147483647] +tests/value/for_loops.c:55:[value] Frama_C_show_each_F: {0; 1; 2; 3; 4; 5}, [0..2147483647] [value] Recording results for main_4 [value] done for function main_4 [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/forall.res.oracle b/tests/value/oracle/forall.res.oracle index fbce3849193e672f13042127265928941b9e0363..261557a86563f3ff4a64764027cfe6329615d3f7 100644 --- a/tests/value/oracle/forall.res.oracle +++ b/tests/value/oracle/forall.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/forall.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/fptr.0.res.oracle b/tests/value/oracle/fptr.0.res.oracle index 4e8fd4b511bc2d720be46fe3f219fc6e23cbb459..0f845a4309ea9fc5804a5cea905b4a5f3190f7a4 100644 --- a/tests/value/oracle/fptr.0.res.oracle +++ b/tests/value/oracle/fptr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/fptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -26,7 +25,7 @@ tests/value/fptr.i:44:[value] warning: pointer to function with incompatible typ tests/value/fptr.i:45:[value] warning: pointer to function with incompatible type. assert \valid_function((short (*)())(&retint)); tests/value/fptr.i:50:[value] entering loop for the first time -[value] Called Frama_C_show_each_F({{ &h }}) +tests/value/fptr.i:51:[value] Frama_C_show_each_F: {{ &h }} [value] computing for function f <- main. Called from tests/value/fptr.i:52. [value] computing for function h <- f <- main. @@ -35,8 +34,8 @@ tests/value/fptr.i:50:[value] entering loop for the first time [value] Done for function h [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each_F({{ &h ; &hh }}) +tests/value/fptr.i:52:[value] Frama_C_show_each: {0} +tests/value/fptr.i:51:[value] Frama_C_show_each_F: {{ &h ; &hh }} [value] computing for function f <- main. Called from tests/value/fptr.i:52. [value] computing for function hh <- f <- main. @@ -49,8 +48,8 @@ tests/value/fptr.i:50:[value] entering loop for the first time [value] Done for function h [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each({0; 1}) -[value] Called Frama_C_show_each_F({{ NULL ; &h ; &hh }}) +tests/value/fptr.i:52:[value] Frama_C_show_each: {0; 1} +tests/value/fptr.i:51:[value] Frama_C_show_each_F: {{ NULL ; &h ; &hh }} [value] computing for function f <- main. Called from tests/value/fptr.i:52. tests/value/fptr.i:9:[value] warning: pointer to function with incompatible type. assert \valid_function(ptr); @@ -64,8 +63,8 @@ tests/value/fptr.i:9:[value] warning: pointer to function with incompatible type [value] Done for function h [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each({0; 1; 2}) -[value] Called Frama_C_show_each_F({{ NULL ; &h ; &hh }}) +tests/value/fptr.i:52:[value] Frama_C_show_each: {0; 1} +tests/value/fptr.i:51:[value] Frama_C_show_each_F: {{ NULL ; &h ; &hh }} [value] computing for function f <- main. Called from tests/value/fptr.i:52. [value] computing for function hh <- f <- main. diff --git a/tests/value/oracle/fptr.1.res.oracle b/tests/value/oracle/fptr.1.res.oracle index 6ae32f007c067125b7384eb9b4619e0f382a7fb5..6ff02d0dd0f4797964c55142fd3647305fb0c826 100644 --- a/tests/value/oracle/fptr.1.res.oracle +++ b/tests/value/oracle/fptr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/fptr.i (no preprocessing) [value] Analyzing a complete application starting at main_uninit [value] Computing initial state @@ -13,8 +12,9 @@ GLOBAL[0..9] ∈ {0} G ∈ {0} TA ∈ {0} +tests/value/fptr.i:62:[value] warning: initialization of volatile variable j ignored tests/value/fptr.i:66:[value] entering loop for the first time -[value] Called Frama_C_show_each_F({{ &h }}) +tests/value/fptr.i:67:[value] Frama_C_show_each_F: {{ &h }} [value] computing for function f <- main_uninit. Called from tests/value/fptr.i:68. [value] computing for function h <- f <- main_uninit. @@ -23,7 +23,7 @@ tests/value/fptr.i:66:[value] entering loop for the first time [value] Done for function h [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_F({{ &h ; &hh }}) +tests/value/fptr.i:67:[value] Frama_C_show_each_F: {{ &h ; &hh }} [value] computing for function f <- main_uninit. Called from tests/value/fptr.i:68. [value] computing for function hh <- f <- main_uninit. @@ -36,7 +36,7 @@ tests/value/fptr.i:66:[value] entering loop for the first time [value] Done for function h [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_F({{ NULL + [0..4294967295] ; &h ; &hh }}) +tests/value/fptr.i:67:[value] Frama_C_show_each_F: {{ NULL + [0..4294967295] ; &h ; &hh }} [value] computing for function f <- main_uninit. Called from tests/value/fptr.i:68. tests/value/fptr.i:9:[value] warning: pointer to function with incompatible type. assert \valid_function(ptr); @@ -50,7 +50,7 @@ tests/value/fptr.i:9:[value] warning: pointer to function with incompatible type [value] Done for function h [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_F({{ NULL + [0..4294967295] ; &h ; &hh }}) +tests/value/fptr.i:67:[value] Frama_C_show_each_F: {{ NULL + [0..4294967295] ; &h ; &hh }} [value] computing for function f <- main_uninit. Called from tests/value/fptr.i:68. [value] computing for function hh <- f <- main_uninit. diff --git a/tests/value/oracle/from1.res.oracle b/tests/value/oracle/from1.res.oracle index 883cb73715bb46623a101bbc969017b5cdfc6220..9bc846d3e7e23e356d3a062c2fe6f90614a5d525 100644 --- a/tests/value/oracle/from1.res.oracle +++ b/tests/value/oracle/from1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_call.0.res.oracle b/tests/value/oracle/from_call.0.res.oracle index 6651d3ff3e6e52eecd86c41b122d51b2be0d9a2e..599ed5d0521bf3787e1486f34144a9d675713b1b 100644 --- a/tests/value/oracle/from_call.0.res.oracle +++ b/tests/value/oracle/from_call.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_call.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_call.1.res.oracle b/tests/value/oracle/from_call.1.res.oracle index e10d10ff39538819798d2dce5f1f6a2227864e15..274d163b44483a944c30c740a9489a68ade4481c 100644 --- a/tests/value/oracle/from_call.1.res.oracle +++ b/tests/value/oracle/from_call.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_call.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_global.res.oracle b/tests/value/oracle/from_global.res.oracle index fedbb11a970e9f2e67c11c0aca52ca2588c6bee4..dc0d504bfa93248b5534681fab8ad41d4f9bf21a 100644 --- a/tests/value/oracle/from_global.res.oracle +++ b/tests/value/oracle/from_global.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_global.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_ind.res.oracle b/tests/value/oracle/from_ind.res.oracle index 6016a0eef251b97fccb876281828babb476e8da2..d37963477fd74c3b29813aba4027331994f43051 100644 --- a/tests/value/oracle/from_ind.res.oracle +++ b/tests/value/oracle/from_ind.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_ind.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_pb.0.res.oracle b/tests/value/oracle/from_pb.0.res.oracle index eeee252095ca6c0392409644a7f7326961cf9a2d..af2e8731266eb010b55a5a73585afc9fe22d50c1 100644 --- a/tests/value/oracle/from_pb.0.res.oracle +++ b/tests/value/oracle/from_pb.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main0 [value] Computing initial state diff --git a/tests/value/oracle/from_pb.1.res.oracle b/tests/value/oracle/from_pb.1.res.oracle index 4496ae64e00b53f3bb36ae0124589040a7d1ce61..c6a8aac7080fc30e1cee0caf1514224f57e378d5 100644 --- a/tests/value/oracle/from_pb.1.res.oracle +++ b/tests/value/oracle/from_pb.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/value/oracle/from_pb.2.res.oracle b/tests/value/oracle/from_pb.2.res.oracle index 5b9d94492e2cb89740b8347abdb988d697c69c9c..634586f0e13205edb83cecb6b95c44c9012be1ef 100644 --- a/tests/value/oracle/from_pb.2.res.oracle +++ b/tests/value/oracle/from_pb.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state diff --git a/tests/value/oracle/from_pb.3.res.oracle b/tests/value/oracle/from_pb.3.res.oracle index 30a4843c6e2716647fe2ff72635cd0b865feb222..5e9a2b726c29b41ff9c8c6c48735996fcfc28fd9 100644 --- a/tests/value/oracle/from_pb.3.res.oracle +++ b/tests/value/oracle/from_pb.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main3 [value] Computing initial state diff --git a/tests/value/oracle/from_pb.4.res.oracle b/tests/value/oracle/from_pb.4.res.oracle index 95122d216276994143f155e0a55662f9c58edf4e..e42903d712dfdbdbb77245889b0ef4f8f44a4d4c 100644 --- a/tests/value/oracle/from_pb.4.res.oracle +++ b/tests/value/oracle/from_pb.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main4 [value] Computing initial state diff --git a/tests/value/oracle/from_pb.5.res.oracle b/tests/value/oracle/from_pb.5.res.oracle index 00ae187f29adb3b217248ed2c385c72ec9bc2d69..f41a9ae4d1d8f8a843745f4193712e4a20916ec4 100644 --- a/tests/value/oracle/from_pb.5.res.oracle +++ b/tests/value/oracle/from_pb.5.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main4bis [value] Computing initial state diff --git a/tests/value/oracle/from_pb.6.res.oracle b/tests/value/oracle/from_pb.6.res.oracle index 5f5da01c45786af36d8457e09f8cf1ac7a2c4bb3..1bab62faed228bf0ad375bb9ea2b194e045ff327 100644 --- a/tests/value/oracle/from_pb.6.res.oracle +++ b/tests/value/oracle/from_pb.6.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main5 [value] Computing initial state diff --git a/tests/value/oracle/from_pb.7.res.oracle b/tests/value/oracle/from_pb.7.res.oracle index 2fc59c7ffbf9d193b5b3a86f59e40f8a8648fe19..d233c25891175adc6a89ede2196b7aa5292a60ff 100644 --- a/tests/value/oracle/from_pb.7.res.oracle +++ b/tests/value/oracle/from_pb.7.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_pb.i (no preprocessing) [value] Analyzing a complete application starting at main5bis [value] Computing initial state diff --git a/tests/value/oracle/from_ptr.0.res.oracle b/tests/value/oracle/from_ptr.0.res.oracle index fa6ef20956aaff3956231716078c364d0eda38d4..dfb71fe7e31116b094c1bd5ab636829fd3958f3f 100644 --- a/tests/value/oracle/from_ptr.0.res.oracle +++ b/tests/value/oracle/from_ptr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_ptr.1.res.oracle b/tests/value/oracle/from_ptr.1.res.oracle index 2eb1e5b63734ef77ca12dd064b7822a6c8ba206c..9a474b0aac9378656b90924b8f931ef4ec462b49 100644 --- a/tests/value/oracle/from_ptr.1.res.oracle +++ b/tests/value/oracle/from_ptr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/value/oracle/from_ptr2.res.oracle b/tests/value/oracle/from_ptr2.res.oracle index 5c8a80a047aa312090fd9d452d1dfac9362123c3..dbb3b93a198e82f8b65a85138ff0bd310eaaad10 100644 --- a/tests/value/oracle/from_ptr2.res.oracle +++ b/tests/value/oracle/from_ptr2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_ptr2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_res_2.res.oracle b/tests/value/oracle/from_res_2.res.oracle index 09fa3810baf9cc84636f211e55ea6ad7f031ddf3..ca450fb52b237e69a826256f95b9fa6a663bce45 100644 --- a/tests/value/oracle/from_res_2.res.oracle +++ b/tests/value/oracle/from_res_2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_res_2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/from_termin.res.oracle b/tests/value/oracle/from_termin.res.oracle index 860caeeaee244a2706fcf0dee025e4c184bde6cf..efe7e711bae0294b01182822d806a25d9056ff29 100644 --- a/tests/value/oracle/from_termin.res.oracle +++ b/tests/value/oracle/from_termin.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/from_termin.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/fun_ptr.0.res.oracle b/tests/value/oracle/fun_ptr.0.res.oracle index a64d4f525b9c22108ab612421154c362b049a830..9511dba55858179b1f57bf23fc502e8dd5ffc661 100644 --- a/tests/value/oracle/fun_ptr.0.res.oracle +++ b/tests/value/oracle/fun_ptr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/fun_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -40,8 +39,8 @@ tests/value/fun_ptr.i:38:[value] warning: pointer to function with incompatible assert \valid_function((double (*)(int ))t[nd]); [value] Recording results for test3 [value] Done for function test3 -tests/value/fun_ptr.i:83:[value] warning: Function type must match type at call site: assert(function type matches) -tests/value/fun_ptr.i:85:[value] warning: Function type must match type at call site: assert(function type matches) +tests/value/fun_ptr.i:83:[value] warning: pointer to function with incompatible type. assert \valid_function(*ph); +tests/value/fun_ptr.i:85:[value] warning: pointer to function with incompatible type. assert \valid_function(*ph); [value] computing for function h <- main. Called from tests/value/fun_ptr.i:87. [value] Recording results for h diff --git a/tests/value/oracle/fun_ptr.1.res.oracle b/tests/value/oracle/fun_ptr.1.res.oracle index b818469156c0c5a5b43543e234c1b6b9a40d3375..467e9b5596a1cf577098ec6144dec5d591a62670 100644 --- a/tests/value/oracle/fun_ptr.1.res.oracle +++ b/tests/value/oracle/fun_ptr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/fun_ptr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -40,8 +39,8 @@ tests/value/fun_ptr.i:38:[value] warning: pointer to function with incompatible assert \valid_function((double (*)(int ))t[nd]); [value] Recording results for test3 [value] Done for function test3 -tests/value/fun_ptr.i:83:[value] warning: Function type must match type at call site: assert(function type matches) -tests/value/fun_ptr.i:85:[value] warning: Function type must match type at call site: assert(function type matches) +tests/value/fun_ptr.i:83:[value] warning: pointer to function with incompatible type. assert \valid_function(*ph); +tests/value/fun_ptr.i:85:[value] warning: pointer to function with incompatible type. assert \valid_function(*ph); [value] computing for function h <- main. Called from tests/value/fun_ptr.i:87. [value] Recording results for h diff --git a/tests/value/oracle/function_return_serial_casts.res.oracle b/tests/value/oracle/function_return_serial_casts.res.oracle index 51b7fc8f0fafe1b44e60479820f4444cc2844ba2..4128d4272a6b9210141fcb018a5acd356a9623b8 100644 --- a/tests/value/oracle/function_return_serial_casts.res.oracle +++ b/tests/value/oracle/function_return_serial_casts.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/function_return_serial_casts.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/g1.res.oracle b/tests/value/oracle/g1.res.oracle index 632e1b01ac03816cb4415724a70854c4e7cfef21..13151482ee5f40d6de73bbfa268ec77b44dabc95 100644 --- a/tests/value/oracle/g1.res.oracle +++ b/tests/value/oracle/g1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/g1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/garbled_init.res.oracle b/tests/value/oracle/garbled_init.res.oracle index 0377915aa6bfe8ce3d8f9b7c0f3e0c0edc10c7b7..ac9315d408a571a085696e1fbbf8650a78f11b5a 100644 --- a/tests/value/oracle/garbled_init.res.oracle +++ b/tests/value/oracle/garbled_init.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/garbled_init.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/gauges.res.oracle b/tests/value/oracle/gauges.res.oracle index 19c4e36cf3df729dc4c66ab4ef48eb211e15934f..e160781c6d331b005afc0e0688bc851b49e348a5 100644 --- a/tests/value/oracle/gauges.res.oracle +++ b/tests/value/oracle/gauges.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/gauges.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,161 +8,160 @@ u[0..99] ∈ {0} T[0..99] ∈ [--..--] [value] computing for function main0 <- main. - Called from tests/value/gauges.i:299. + Called from tests/value/gauges.i:336. tests/value/gauges.i:14:[value] entering loop for the first time tests/value/gauges.i:16:[value] entering loop for the first time -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} tests/value/gauges.i:21:[value] warning: signed overflow. assert -2147483648 ≤ j - 4; -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:17:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:19:[value] Frama_C_show_each_1: {{ "in" }} tests/value/gauges.i:24:[value] warning: signed overflow. assert l + 1 ≤ 2147483647; [value] Recording results for main0 [value] Done for function main0 [value] computing for function main0_bis <- main. - Called from tests/value/gauges.i:300. + Called from tests/value/gauges.i:337. tests/value/gauges.i:36:[value] entering loop for the first time tests/value/gauges.i:38:[value] entering loop for the first time -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} tests/value/gauges.i:43:[value] warning: signed overflow. assert -2147483648 ≤ j - 4; -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) -[value] Called Frama_C_show_each_0({{ "in" }}) -[value] Called Frama_C_show_each_1({{ "in" }}) +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} +tests/value/gauges.i:39:[value] Frama_C_show_each_0: {{ "in" }} +tests/value/gauges.i:41:[value] Frama_C_show_each_1: {{ "in" }} tests/value/gauges.i:46:[value] warning: signed overflow. assert l + 1 ≤ 2147483647; [value] Recording results for main0_bis [value] Done for function main0_bis [value] computing for function main1 <- main. - Called from tests/value/gauges.i:301. + Called from tests/value/gauges.i:338. tests/value/gauges.i:55:[value] entering loop for the first time -[value] Called Frama_C_show_each({{ "in" }}) -[value] Called Frama_C_show_each({{ "in" }}) -[value] Called Frama_C_show_each({{ "in" }}) -[value] Called Frama_C_show_each({{ "in" }}) -[value] Called Frama_C_show_each({{ "in" }}) -[value] Called Frama_C_show_each({{ "in" }}) +tests/value/gauges.i:57:[value] Frama_C_show_each: {{ "in" }} +tests/value/gauges.i:57:[value] Frama_C_show_each: {{ "in" }} +tests/value/gauges.i:57:[value] Frama_C_show_each: {{ "in" }} +tests/value/gauges.i:57:[value] Frama_C_show_each: {{ "in" }} +tests/value/gauges.i:57:[value] Frama_C_show_each: {{ "in" }} +tests/value/gauges.i:57:[value] Frama_C_show_each: {{ "in" }} tests/value/gauges.i:56:[value] warning: accessing out of bounds index. assert j < 38; -[value] Called Frama_C_show_each({{ "out" }}) +tests/value/gauges.i:60:[value] Frama_C_show_each: {{ "out" }} [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/gauges.i:302. + Called from tests/value/gauges.i:339. tests/value/gauges.i:68:[value] entering loop for the first time -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() +tests/value/gauges.i:70:[value] Frama_C_show_each: +tests/value/gauges.i:70:[value] Frama_C_show_each: +tests/value/gauges.i:70:[value] Frama_C_show_each: +tests/value/gauges.i:70:[value] Frama_C_show_each: +tests/value/gauges.i:70:[value] Frama_C_show_each: +tests/value/gauges.i:70:[value] Frama_C_show_each: tests/value/gauges.i:69:[value] warning: out of bounds write. assert \valid(tmp); (tmp from p++) -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() +tests/value/gauges.i:70:[value] Frama_C_show_each: +tests/value/gauges.i:70:[value] Frama_C_show_each: [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/gauges.i:303. + Called from tests/value/gauges.i:340. tests/value/gauges.i:76:[value] entering loop for the first time tests/value/gauges.i:77:[value] entering loop for the first time -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "inner" }}) +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} tests/value/gauges.i:79:[value] warning: signed overflow. assert k + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({{ "outer" }}) +tests/value/gauges.i:81:[value] Frama_C_show_each: {{ "outer" }} tests/value/gauges.i:82:[value] warning: signed overflow. assert k + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "outer" }}) -[value] Called Frama_C_show_each({{ "inner" }}) -[value] Called Frama_C_show_each({{ "outer" }}) -[value] Called Frama_C_show_each([0..2147483647]) +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:81:[value] Frama_C_show_each: {{ "outer" }} +tests/value/gauges.i:78:[value] Frama_C_show_each: {{ "inner" }} +tests/value/gauges.i:81:[value] Frama_C_show_each: {{ "outer" }} +tests/value/gauges.i:84:[value] Frama_C_show_each: [0..2147483647] [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/gauges.i:304. + Called from tests/value/gauges.i:341. [value] computing for function main4_search <- main4 <- main. Called from tests/value/gauges.i:105. tests/value/gauges.i:94:[value] entering loop for the first time -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() +tests/value/gauges.i:95:[value] Frama_C_show_each: +tests/value/gauges.i:95:[value] Frama_C_show_each: +tests/value/gauges.i:95:[value] Frama_C_show_each: +tests/value/gauges.i:95:[value] Frama_C_show_each: +tests/value/gauges.i:95:[value] Frama_C_show_each: +tests/value/gauges.i:95:[value] Frama_C_show_each: tests/value/gauges.i:97:[value] warning: signed overflow. assert c + 1 ≤ 2147483647; [value] Recording results for main4_search [value] Done for function main4_search [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/gauges.i:305. + Called from tests/value/gauges.i:342. tests/value/gauges.i:111:[value] entering loop for the first time -[value] Called Frama_C_show_each({{ &x }}) -[value] Called Frama_C_show_each({{ &x + {0; 4} }}) -[value] Called Frama_C_show_each({{ &x + {0; 4; 8} }}) -[value] Called Frama_C_show_each({{ &x + {0; 4; 8; 12} ; &y }}) -[value] Called Frama_C_show_each({{ &x + {0; 4; 8; 12; 16} ; &y + {0; 4} }}) -[value] Called Frama_C_show_each({{ &x + {0; 4; 8; 12; 16; 20} ; &y + {0; 4; 8} }}) -[value] Called Frama_C_show_each({{ &x + {0; 4; 8; 12; 16; 20; 24} ; - &y + {0; 4; 8; 12} }}) -[value] Called Frama_C_show_each({{ &x + [0..36],0%4 ; &y + [0..36],0%4 }}) -[value] Called Frama_C_show_each({{ &x + [0..40],0%4 ; &y + [0..40],0%4 }}) +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + {0; 4} }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + {0; 4; 8} }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + {0; 4; 8; 12} ; &y }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + {0; 4; 8; 12; 16} ; &y + {0; 4} }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + {0; 4; 8; 12; 16; 20} ; &y + {0; 4; 8} }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + {0; 4; 8; 12; 16; 20; 24} ; &y + {0; 4; 8; 12} }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + [0..36],0%4 ; &y + [0..36],0%4 }} +tests/value/gauges.i:114:[value] Frama_C_show_each: {{ &x + [0..40],0%4 ; &y + [0..40],0%4 }} tests/value/gauges.i:115:[value] warning: out of bounds write. assert \valid(p); [value] Recording results for main5 [value] Done for function main5 [value] computing for function main5_bis <- main. - Called from tests/value/gauges.i:306. -[value] Called Frama_C_show_each({{ &x }}) -[value] Called Frama_C_show_each({{ &x + {4} }}) -[value] Called Frama_C_show_each({{ &x + {8} }}) -[value] Called Frama_C_show_each({{ &y }}) + Called from tests/value/gauges.i:343. +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &x }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &x + {4} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &x + {8} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y }} tests/value/gauges.i:124:[value] entering loop for the first time -[value] Called Frama_C_show_each({{ &y + {4} }}) -[value] Called Frama_C_show_each({{ &y + {4; 8} }}) -[value] Called Frama_C_show_each({{ &y + {4; 8; 12} }}) -[value] Called Frama_C_show_each({{ &y + {4; 8; 12; 16} }}) -[value] Called Frama_C_show_each({{ &y + {4; 8; 12; 16; 20} }}) -[value] Called Frama_C_show_each({{ &y + [4..36],0%4 }}) -[value] Called Frama_C_show_each({{ &y + [4..40],0%4 }}) +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4; 8} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4; 8; 12} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4; 8; 12; 16} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + {4; 8; 12; 16; 20} }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + [4..36],0%4 }} +tests/value/gauges.i:127:[value] Frama_C_show_each: {{ &y + [4..40],0%4 }} tests/value/gauges.i:128:[value] warning: out of bounds write. assert \valid(p); [value] Recording results for main5_bis [value] Done for function main5_bis [value] computing for function main6 <- main. - Called from tests/value/gauges.i:307. + Called from tests/value/gauges.i:344. tests/value/gauges.i:136:[value] entering loop for the first time tests/value/gauges.i:138:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/gauges.i:308. + Called from tests/value/gauges.i:345. [value] computing for function main7_aux <- main7 <- main. Called from tests/value/gauges.i:162. -[value] Called Frama_C_show_each() +tests/value/gauges.i:143:[value] Frama_C_show_each: tests/value/gauges.i:145:[value] entering loop for the first time tests/value/gauges.i:147:[value] warning: out of bounds write. assert \valid(tmp); (tmp from p--) @@ -171,7 +169,7 @@ tests/value/gauges.i:147:[value] warning: out of bounds write. assert \valid(tmp [value] Done for function main7_aux [value] computing for function main7_aux2 <- main7 <- main. Called from tests/value/gauges.i:163. -[value] Called Frama_C_show_each() +tests/value/gauges.i:152:[value] Frama_C_show_each: tests/value/gauges.i:154:[value] entering loop for the first time tests/value/gauges.i:156:[value] warning: out of bounds write. assert \valid(tmp); (tmp from p--) @@ -181,30 +179,30 @@ tests/value/gauges.i:154:[value] warning: signed overflow. assert -2147483648 [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/gauges.i:309. + Called from tests/value/gauges.i:346. [value] computing for function main8_aux <- main8 <- main. Called from tests/value/gauges.i:176. -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({4294967295}) +tests/value/gauges.i:170:[value] Frama_C_show_each: {0} +tests/value/gauges.i:170:[value] Frama_C_show_each: {4294967295} tests/value/gauges.i:169:[value] entering loop for the first time -[value] Called Frama_C_show_each({4294967294}) -[value] Called Frama_C_show_each({4294967293; 4294967294}) -[value] Called Frama_C_show_each({4294967292; 4294967293; 4294967294}) -[value] Called Frama_C_show_each([2147483647..4294967294]) -[value] Called Frama_C_show_each([2147483646..4294967294]) -[value] Called Frama_C_show_each([1..4294967294]) -[value] Called Frama_C_show_each([1..4294967294]) -[value] Called Frama_C_show_each([1..4294967294]) -[value] Called Frama_C_show_each([1..4294967294]) +tests/value/gauges.i:170:[value] Frama_C_show_each: {4294967294} +tests/value/gauges.i:170:[value] Frama_C_show_each: {4294967293; 4294967294} +tests/value/gauges.i:170:[value] Frama_C_show_each: {4294967292; 4294967293; 4294967294} +tests/value/gauges.i:170:[value] Frama_C_show_each: [2147483647..4294967294] +tests/value/gauges.i:170:[value] Frama_C_show_each: [2147483646..4294967294] +tests/value/gauges.i:170:[value] Frama_C_show_each: [1..4294967294] +tests/value/gauges.i:170:[value] Frama_C_show_each: [1..4294967294] +tests/value/gauges.i:170:[value] Frama_C_show_each: [1..4294967294] +tests/value/gauges.i:170:[value] Frama_C_show_each: [1..4294967294] tests/value/gauges.i:171:[value] warning: out of bounds write. assert \valid(tmp); (tmp from p++) -[value] Called Frama_C_show_each([1..4294967294]) +tests/value/gauges.i:170:[value] Frama_C_show_each: [1..4294967294] [value] Recording results for main8_aux [value] Done for function main8_aux [value] Recording results for main8 [value] Done for function main8 [value] computing for function main9 <- main. - Called from tests/value/gauges.i:310. + Called from tests/value/gauges.i:347. tests/value/gauges.i:184:[value] entering loop for the first time tests/value/gauges.i:186:[value] warning: signed overflow. assert -2147483648 ≤ (int)p + (int)q; tests/value/gauges.i:186:[value] warning: signed overflow. assert (int)p + (int)q ≤ 2147483647; @@ -218,9 +216,7 @@ tests/value/gauges.i:191:[value] warning: out of bounds write. assert \valid(q); [value] Recording results for main9 [value] Done for function main9 [value] computing for function main10 <- main. - Called from tests/value/gauges.i:311. -[value] Call to builtin bzero(({{ (unsigned char *)&A }},{40})) -[value] Call to builtin bzero(({{ (unsigned char *)&B }},{40})) + Called from tests/value/gauges.i:348. [value] computing for function main10_aux <- main10 <- main. Called from tests/value/gauges.i:209. tests/value/gauges.i:199:[value] entering loop for the first time @@ -240,66 +236,343 @@ tests/value/gauges.i:209:[value] warning: overflow in conversion from floating-p [value] Recording results for main10 [value] Done for function main10 [value] computing for function main11 <- main. - Called from tests/value/gauges.i:312. + Called from tests/value/gauges.i:349. tests/value/gauges.i:215:[value] entering loop for the first time -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() +tests/value/gauges.i:216:[value] Frama_C_show_each: +tests/value/gauges.i:216:[value] Frama_C_show_each: +tests/value/gauges.i:216:[value] Frama_C_show_each: +tests/value/gauges.i:216:[value] Frama_C_show_each: tests/value/gauges.i:217:[value] warning: signed overflow. assert i + 1 ≤ 2147483647; -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() -[value] Called Frama_C_show_each() +tests/value/gauges.i:216:[value] Frama_C_show_each: +tests/value/gauges.i:216:[value] Frama_C_show_each: +tests/value/gauges.i:216:[value] Frama_C_show_each: +tests/value/gauges.i:216:[value] Frama_C_show_each: tests/value/gauges.i:218:[value] warning: signed overflow. assert -2147483648 ≤ n - 1; [value] Recording results for main11 [value] Done for function main11 [value] computing for function main12 <- main. - Called from tests/value/gauges.i:313. + Called from tests/value/gauges.i:350. tests/value/gauges.i:223:[value] entering loop for the first time tests/value/gauges.i:223:[value] warning: signed overflow. assert i + 1 ≤ 2147483647; [value] Recording results for main12 [value] Done for function main12 [value] computing for function main13 <- main. - Called from tests/value/gauges.i:314. + Called from tests/value/gauges.i:351. [value] computing for function main13_1 <- main13 <- main. Called from tests/value/gauges.i:278. tests/value/gauges.i:236:[value] entering loop for the first time tests/value/gauges.i:238:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({45; 46; 47; 48; 49; 50; 51}, [0..2147483647]) +tests/value/gauges.i:240:[value] Frama_C_show_each: {45; 46; 47; 48; 49; 50; 51}, [0..2147483647] [value] Recording results for main13_1 [value] Done for function main13_1 [value] computing for function main13_2 <- main13 <- main. Called from tests/value/gauges.i:279. tests/value/gauges.i:247:[value] entering loop for the first time tests/value/gauges.i:249:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({48; 49; 50; 51; 52; 53; 54}, [0..2147483647]) +tests/value/gauges.i:252:[value] Frama_C_show_each: {48; 49; 50; 51; 52; 53; 54}, [0..2147483647] [value] Recording results for main13_2 [value] Done for function main13_2 [value] computing for function main13_3 <- main13 <- main. Called from tests/value/gauges.i:280. tests/value/gauges.i:259:[value] entering loop for the first time tests/value/gauges.i:261:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({-59; -58; -57; -56; -55; -54; -53}, [0..2147483647]) +tests/value/gauges.i:263:[value] Frama_C_show_each: {-59; -58; -57; -56; -55; -54; -53}, [0..2147483647] [value] Recording results for main13_3 [value] Done for function main13_3 [value] computing for function main13_4 <- main13 <- main. Called from tests/value/gauges.i:281. tests/value/gauges.i:270:[value] entering loop for the first time tests/value/gauges.i:272:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({-64; -63; -62; -61; -60; -59; -58}, [0..2147483647]) +tests/value/gauges.i:274:[value] Frama_C_show_each: {-64; -63; -62; -61; -60; -59; -58}, [0..2147483647] [value] Recording results for main13_4 [value] Done for function main13_4 [value] Recording results for main13 [value] Done for function main13 [value] computing for function main14 <- main. - Called from tests/value/gauges.i:315. + Called from tests/value/gauges.i:352. tests/value/gauges.i:289:[value] entering loop for the first time tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each({-593; -592; -591; -590; -589; -588}, - [0..2147483647]) +tests/value/gauges.i:295:[value] Frama_C_show_each: {-593; -592; -591; -590; -589; -588}, [0..2147483647] [value] Recording results for main14 [value] Done for function main14 +[value] computing for function main15 <- main. + Called from tests/value/gauges.i:353. +tests/value/gauges.i:302:[value] entering loop for the first time +tests/value/gauges.i:304:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..4] ∈ {0} + [5] ∈ [0..48],0%3 + [6] ∈ {0} + [7] ∈ [0..48],0%3 + [8] ∈ {0} + [9] ∈ [0..48],0%3 + [10] ∈ {0} + [11] ∈ [0..48],0%3 + [12] ∈ {0} + [13] ∈ [0..48],0%3 + [14] ∈ {0} + [15] ∈ [0..48],0%3 + [16] ∈ {0} + [17] ∈ [0..48],0%3 + [18] ∈ {0} + [19] ∈ [0..48],0%3 + [20] ∈ {0} + [21] ∈ [0..48],0%3 + [22] ∈ {0} + [23] ∈ [0..48],0%3 + [24] ∈ {0} + [25] ∈ [0..48],0%3 + [26] ∈ {0} + [27] ∈ [0..48],0%3 + [28] ∈ {0} + [29] ∈ [0..48],0%3 + [30] ∈ {0} + [31] ∈ [0..48],0%3 + [32] ∈ {0} + [33] ∈ [0..48],0%3 + [34] ∈ {0} + [35] ∈ [0..48],0%3 + [36] ∈ {0} + [37] ∈ [0..48],0%3 + u[0..99] ∈ [0..100] + T[0..99] ∈ [--..--] + x ∈ UNINITIALIZED + y ∈ UNINITIALIZED + p ∈ {{ &x }} + i ∈ {1} + ==END OF DUMP== +tests/value/gauges.i:304:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..4] ∈ {0} + [5] ∈ [0..48],0%3 + [6] ∈ {0} + [7] ∈ [0..48],0%3 + [8] ∈ {0} + [9] ∈ [0..48],0%3 + [10] ∈ {0} + [11] ∈ [0..48],0%3 + [12] ∈ {0} + [13] ∈ [0..48],0%3 + [14] ∈ {0} + [15] ∈ [0..48],0%3 + [16] ∈ {0} + [17] ∈ [0..48],0%3 + [18] ∈ {0} + [19] ∈ [0..48],0%3 + [20] ∈ {0} + [21] ∈ [0..48],0%3 + [22] ∈ {0} + [23] ∈ [0..48],0%3 + [24] ∈ {0} + [25] ∈ [0..48],0%3 + [26] ∈ {0} + [27] ∈ [0..48],0%3 + [28] ∈ {0} + [29] ∈ [0..48],0%3 + [30] ∈ {0} + [31] ∈ [0..48],0%3 + [32] ∈ {0} + [33] ∈ [0..48],0%3 + [34] ∈ {0} + [35] ∈ [0..48],0%3 + [36] ∈ {0} + [37] ∈ [0..48],0%3 + u[0..99] ∈ [0..100] + T[0..99] ∈ [--..--] + x ∈ UNINITIALIZED + y ∈ UNINITIALIZED + p ∈ {{ &x ; &y }} + i ∈ {1; 2} + ==END OF DUMP== +tests/value/gauges.i:304:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..4] ∈ {0} + [5] ∈ [0..48],0%3 + [6] ∈ {0} + [7] ∈ [0..48],0%3 + [8] ∈ {0} + [9] ∈ [0..48],0%3 + [10] ∈ {0} + [11] ∈ [0..48],0%3 + [12] ∈ {0} + [13] ∈ [0..48],0%3 + [14] ∈ {0} + [15] ∈ [0..48],0%3 + [16] ∈ {0} + [17] ∈ [0..48],0%3 + [18] ∈ {0} + [19] ∈ [0..48],0%3 + [20] ∈ {0} + [21] ∈ [0..48],0%3 + [22] ∈ {0} + [23] ∈ [0..48],0%3 + [24] ∈ {0} + [25] ∈ [0..48],0%3 + [26] ∈ {0} + [27] ∈ [0..48],0%3 + [28] ∈ {0} + [29] ∈ [0..48],0%3 + [30] ∈ {0} + [31] ∈ [0..48],0%3 + [32] ∈ {0} + [33] ∈ [0..48],0%3 + [34] ∈ {0} + [35] ∈ [0..48],0%3 + [36] ∈ {0} + [37] ∈ [0..48],0%3 + u[0..99] ∈ [0..100] + T[0..99] ∈ [--..--] + x ∈ UNINITIALIZED + y ∈ UNINITIALIZED + p ∈ {{ &x ; &y }} + i ∈ {1; 2; 3} + ==END OF DUMP== +tests/value/gauges.i:304:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..4] ∈ {0} + [5] ∈ [0..48],0%3 + [6] ∈ {0} + [7] ∈ [0..48],0%3 + [8] ∈ {0} + [9] ∈ [0..48],0%3 + [10] ∈ {0} + [11] ∈ [0..48],0%3 + [12] ∈ {0} + [13] ∈ [0..48],0%3 + [14] ∈ {0} + [15] ∈ [0..48],0%3 + [16] ∈ {0} + [17] ∈ [0..48],0%3 + [18] ∈ {0} + [19] ∈ [0..48],0%3 + [20] ∈ {0} + [21] ∈ [0..48],0%3 + [22] ∈ {0} + [23] ∈ [0..48],0%3 + [24] ∈ {0} + [25] ∈ [0..48],0%3 + [26] ∈ {0} + [27] ∈ [0..48],0%3 + [28] ∈ {0} + [29] ∈ [0..48],0%3 + [30] ∈ {0} + [31] ∈ [0..48],0%3 + [32] ∈ {0} + [33] ∈ [0..48],0%3 + [34] ∈ {0} + [35] ∈ [0..48],0%3 + [36] ∈ {0} + [37] ∈ [0..48],0%3 + u[0..99] ∈ [0..100] + T[0..99] ∈ [--..--] + x ∈ UNINITIALIZED + y ∈ UNINITIALIZED + p ∈ {{ &x ; &y }} + i ∈ [1..11] + ==END OF DUMP== +[value] Recording results for main15 +[value] Done for function main15 +[value] computing for function main16 <- main. + Called from tests/value/gauges.i:354. +tests/value/gauges.i:319:[value] entering loop for the first time +tests/value/gauges.i:321:[value] entering loop for the first time +tests/value/gauges.i:322:[value] entering loop for the first time +tests/value/gauges.i:323:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..4] ∈ {0} + [5] ∈ [0..48],0%3 + [6] ∈ {0} + [7] ∈ [0..48],0%3 + [8] ∈ {0} + [9] ∈ [0..48],0%3 + [10] ∈ {0} + [11] ∈ [0..48],0%3 + [12] ∈ {0} + [13] ∈ [0..48],0%3 + [14] ∈ {0} + [15] ∈ [0..48],0%3 + [16] ∈ {0} + [17] ∈ [0..48],0%3 + [18] ∈ {0} + [19] ∈ [0..48],0%3 + [20] ∈ {0} + [21] ∈ [0..48],0%3 + [22] ∈ {0} + [23] ∈ [0..48],0%3 + [24] ∈ {0} + [25] ∈ [0..48],0%3 + [26] ∈ {0} + [27] ∈ [0..48],0%3 + [28] ∈ {0} + [29] ∈ [0..48],0%3 + [30] ∈ {0} + [31] ∈ [0..48],0%3 + [32] ∈ {0} + [33] ∈ [0..48],0%3 + [34] ∈ {0} + [35] ∈ [0..48],0%3 + [36] ∈ {0} + [37] ∈ [0..48],0%3 + u[0..99] ∈ [0..100] + T[0..99] ∈ [--..--] + a ∈ {1} + b ∈ {0} + p ∈ {{ &a }} + i ∈ {2} + ==END OF DUMP== +tests/value/gauges.i:324:[value] entering loop for the first time +tests/value/gauges.i:325:[value] entering loop for the first time +tests/value/gauges.i:323:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..4] ∈ {0} + [5] ∈ [0..48],0%3 + [6] ∈ {0} + [7] ∈ [0..48],0%3 + [8] ∈ {0} + [9] ∈ [0..48],0%3 + [10] ∈ {0} + [11] ∈ [0..48],0%3 + [12] ∈ {0} + [13] ∈ [0..48],0%3 + [14] ∈ {0} + [15] ∈ [0..48],0%3 + [16] ∈ {0} + [17] ∈ [0..48],0%3 + [18] ∈ {0} + [19] ∈ [0..48],0%3 + [20] ∈ {0} + [21] ∈ [0..48],0%3 + [22] ∈ {0} + [23] ∈ [0..48],0%3 + [24] ∈ {0} + [25] ∈ [0..48],0%3 + [26] ∈ {0} + [27] ∈ [0..48],0%3 + [28] ∈ {0} + [29] ∈ [0..48],0%3 + [30] ∈ {0} + [31] ∈ [0..48],0%3 + [32] ∈ {0} + [33] ∈ [0..48],0%3 + [34] ∈ {0} + [35] ∈ [0..48],0%3 + [36] ∈ {0} + [37] ∈ [0..48],0%3 + u[0..99] ∈ [0..100] + T[0..99] ∈ [--..--] + a ∈ {1} + b ∈ {0} + p ∈ {{ &a ; &b }} + i ∈ {2} + ==END OF DUMP== +[value] Recording results for main16 +[value] Done for function main16 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -386,6 +659,13 @@ tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147 i ∈ {-593; -592; -591; -590; -589; -588} s ∈ {5; 6} j ∈ [0..2147483647] +[value:final-states] Values at end of function main15: + p ∈ {{ &x ; &y }} + i ∈ {11} +[value:final-states] Values at end of function main16: + a ∈ {1} + b ∈ {0} + p ∈ {{ &b }} [value:final-states] Values at end of function main2: u[0..99] ∈ [0..100] p ∈ {{ &u + [0..--],0%4 }} @@ -484,8 +764,6 @@ tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147 [from] Computing for function main10_aux [from] Done for function main10_aux [from] Computing for function main10 -[from] Computing for function Frama_C_bzero <-main10 -[from] Done for function Frama_C_bzero [from] Done for function main10 [from] Computing for function main11 [from] Done for function main11 @@ -503,6 +781,12 @@ tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147 [from] Done for function main13 [from] Computing for function main14 [from] Done for function main14 +[from] Computing for function main15 +[from] Computing for function Frama_C_dump_each <-main15 +[from] Done for function Frama_C_dump_each +[from] Done for function main15 +[from] Computing for function main16 +[from] Done for function main16 [from] Computing for function main2 [from] Done for function main2 [from] Computing for function main3 @@ -533,9 +817,6 @@ tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147 [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - A[0..9] FROM \nothing (and SELF) - B[0..9] FROM \nothing (and SELF) [from] Function main0: NO EFFECTS [from] Function main0_bis: @@ -565,6 +846,10 @@ tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147 NO EFFECTS [from] Function main14: NO EFFECTS +[from] Function main15: + NO EFFECTS +[from] Function main16: + NO EFFECTS [from] Function main2: u[0..99] FROM \nothing (and SELF) [from] Function main3: @@ -651,6 +936,14 @@ tests/value/gauges.i:291:[value] warning: signed overflow. assert j + 1 ≤ 2147 i; s; tmp; j [inout] Inputs for function main14: v +[inout] Out (internal) for function main15: + p; i +[inout] Inputs for function main15: + \nothing +[inout] Out (internal) for function main16: + a; b; p; i +[inout] Inputs for function main16: + \nothing [inout] Out (internal) for function main2: u[0..99]; p; i; tmp [inout] Inputs for function main2: diff --git a/tests/value/oracle/ghost.res.oracle b/tests/value/oracle/ghost.res.oracle index 6b2bc668e4fbf7ac4176aabf45b8a30041103d27..64ed1fe745f0abc16c60b5a696d0b14aef6c1f1e 100644 --- a/tests/value/oracle/ghost.res.oracle +++ b/tests/value/oracle/ghost.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ghost.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/global_bug.res.oracle b/tests/value/oracle/global_bug.res.oracle index 624cfabd7c0182970966fd04f8c7ebc7c16d3939..e9e085dea1715833388c94951340be257e971bdd 100644 --- a/tests/value/oracle/global_bug.res.oracle +++ b/tests/value/oracle/global_bug.res.oracle @@ -1,9 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/global_bug.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state tests/value/global_bug.i:6:[value] warning: invalid RHS operand for shift. assert 0 ≤ 63 < 32; -tests/value/global_bug.i:7:[value] Evaluation of initializer '99 << 63' failed +tests/value/global_bug.i:7:[value] evaluation of initializer '99 << 63' failed [value] Initial state computed [value:initial-state] Values of globals at initialization NOT ACCESSIBLE diff --git a/tests/value/oracle/goto.res.oracle b/tests/value/oracle/goto.res.oracle index e584f305debcaaa503677da645d11f16cc3e3145..dd36023dea13eca31ab47fa155016149d059607f 100644 --- a/tests/value/oracle/goto.res.oracle +++ b/tests/value/oracle/goto.res.oracle @@ -1,10 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/goto.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/value/goto.i:7:[value] warning: initialization of volatile variable c ignored [value] computing for function stop <- main. Called from tests/value/goto.i:10. [value] Recording results for stop diff --git a/tests/value/oracle/if.0.res.oracle b/tests/value/oracle/if.0.res.oracle index 2b75dee3434d08b9ff6992defc49d2535e599d83..4d9a457ca9a5ad168fceb713b92babc2ee431660 100644 --- a/tests/value/oracle/if.0.res.oracle +++ b/tests/value/oracle/if.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/if.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/if.1.res.oracle b/tests/value/oracle/if.1.res.oracle index a54cd31ab7ba191a1e6244eb95eb5036e8887f11..f25eeef6be769212be2fbe7537f74a10af51480d 100644 --- a/tests/value/oracle/if.1.res.oracle +++ b/tests/value/oracle/if.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/if.i (no preprocessing) [value] Analyzing a complete application starting at main6 [value] Computing initial state diff --git a/tests/value/oracle/if2.res.oracle b/tests/value/oracle/if2.res.oracle index ec60801979f0baebd0f28bd787179ebb9788e310..3998c5d2490824ea7cb1ed9e662f614caeb7cbe4 100644 --- a/tests/value/oracle/if2.res.oracle +++ b/tests/value/oracle/if2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/if2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ilevel.res.oracle b/tests/value/oracle/ilevel.res.oracle index 7f36e87b66a0e9c5700632667af4f95f4c1a9574..ab223e8edc9a1107a491b30f33e265bfec169b85 100644 --- a/tests/value/oracle/ilevel.res.oracle +++ b/tests/value/oracle/ilevel.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ilevel.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,7 +12,7 @@ tests/value/ilevel.i:9:[value] entering loop for the first time tests/value/ilevel.i:12:[value] entering loop for the first time tests/value/ilevel.i:20:[value] warning: assertion got status unknown. tests/value/ilevel.i:22:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each([0..9]) +tests/value/ilevel.i:24:[value] Frama_C_show_each: [0..9] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -24,7 +23,7 @@ tests/value/ilevel.i:22:[value] warning: assertion got status unknown. l ∈ [0..9] __retres ∈ [0..47] [slicing] slicing requests in progress... -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main [from] Computing for function Frama_C_show_each @@ -70,7 +69,7 @@ tests/value/ilevel.i:26:[value] warning: signed overflow. assert (int)((int)(i + j ∈ {0} k ∈ {0} l ∈ {0} -[value] Called Frama_C_show_each({0; 1; 2; 3; 4; 6; 7; 8; 9}) +tests/value/ilevel.i:24:[value] Frama_C_show_each: {0; 1; 2; 3; 4; 6; 7; 8; 9} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -89,7 +88,7 @@ tests/value/ilevel.i:26:[value] warning: signed overflow. assert (int)((int)(i + j ∈ {0} k ∈ {0} l ∈ {0} -[value] Called Frama_C_show_each({0; 1; 2; 3; 4; 6; 7; 8; 9}) +tests/value/ilevel.i:24:[value] Frama_C_show_each: {0; 1; 2; 3; 4; 6; 7; 8; 9} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/implies.res.oracle b/tests/value/oracle/implies.res.oracle index 352368bc57ef8dd334a80f913883539ba03616c1..0bf8c9d95598a6c463e70c217897d468aff6aee1 100644 --- a/tests/value/oracle/implies.res.oracle +++ b/tests/value/oracle/implies.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/implies.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/imprecise_invalid_write.res.oracle b/tests/value/oracle/imprecise_invalid_write.res.oracle index 692195bdcb5a0359781e8e44b1b5b026149a83f4..f8a28bfea76d8501a675f229f99fc96d0a13ba69 100644 --- a/tests/value/oracle/imprecise_invalid_write.res.oracle +++ b/tests/value/oracle/imprecise_invalid_write.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/imprecise_invalid_write.i (no preprocessing) tests/value/imprecise_invalid_write.i:5:[kernel] warning: Body of function main1 falls-through. Adding a return statement tests/value/imprecise_invalid_write.i:10:[kernel] warning: Body of function main2 falls-through. Adding a return statement diff --git a/tests/value/oracle/incorrect_reduce_expr.res.oracle b/tests/value/oracle/incorrect_reduce_expr.res.oracle index 0051978ac0da09799a01222bc6f02f3c90bc6303..fed7bcf4eaf389292edadfcb1c7ee2aefab3116b 100644 --- a/tests/value/oracle/incorrect_reduce_expr.res.oracle +++ b/tests/value/oracle/incorrect_reduce_expr.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/incorrect_reduce_expr.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ineq.res.oracle b/tests/value/oracle/ineq.res.oracle index e4f71c9b5664f2499d9f75a3a868303cd4c52eec..64bf2f7028a97604843bd03b079edf54c1c3de37 100644 --- a/tests/value/oracle/ineq.res.oracle +++ b/tests/value/oracle/ineq.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ineq.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/infinite.res.oracle b/tests/value/oracle/infinite.res.oracle index 91163289d7a0672beb4263fe170e1f8f4b3d53b2..0032ec50c0aa8bde7d6c9d9d9a14d79a09833e0d 100644 --- a/tests/value/oracle/infinite.res.oracle +++ b/tests/value/oracle/infinite.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/infinite.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/init.0.res.oracle b/tests/value/oracle/init.0.res.oracle index aed4056b01701ef8c800ced85946b8935f66ea16..d1ccbb78ae0f13154c7910a3e25c1e13107359a2 100644 --- a/tests/value/oracle/init.0.res.oracle +++ b/tests/value/oracle/init.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/init.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -50,4 +49,4 @@ [inout] Out (internal) for function main: __retres [inout] Inputs for function main: - U[0..1] + \nothing diff --git a/tests/value/oracle/init.1.res.oracle b/tests/value/oracle/init.1.res.oracle index 07e61cb7008a6c55d304bedbe539e6366be14981..22739aeba29ba98738815c70b2c3d9846c7ac22a 100644 --- a/tests/value/oracle/init.1.res.oracle +++ b/tests/value/oracle/init.1.res.oracle @@ -1,5 +1,4 @@ [value] warning: This option is deprecated. Use -val-initialization-padding-globals instead -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/init.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -150,4 +149,4 @@ [inout] Out (internal) for function main: __retres [inout] Inputs for function main: - U[0..1] + \nothing diff --git a/tests/value/oracle/init_const_guard.res.oracle b/tests/value/oracle/init_const_guard.res.oracle index 0c0b1411d7c1e440dd16736b522617e7b1497aaf..7dd38af0854bd22f966cc64d7ccaedeed41f2cc5 100644 --- a/tests/value/oracle/init_const_guard.res.oracle +++ b/tests/value/oracle/init_const_guard.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/init_const_guard.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state @@ -215,9 +214,9 @@ tests/value/init_const_guard.i:35:[value] assertion 'Value,mem_access' got final [value:initial-state] Values of globals at initialization x ∈ [--..--] q ∈ {{ &x }} - p ∈ {{ NULL ; &S_p[0] }} + p ∈ {{ NULL ; &S_p_0[0] }} v ∈ [--..--] - S_p[0..1] ∈ [--..--] + S_p_0[0..1] ∈ [--..--] tests/value/init_const_guard.i:35:[value] warning: out of bounds write. assert \valid(p); [value] Recording results for g [value] done for function g diff --git a/tests/value/oracle/initialized.res.oracle b/tests/value/oracle/initialized.res.oracle index 67c012256a914d844bfb91f50906763730524364..a18907dff94a7d307669c40ccc398c010450b9f5 100644 --- a/tests/value/oracle/initialized.res.oracle +++ b/tests/value/oracle/initialized.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/initialized.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -15,7 +14,7 @@ v1 ∈ {0} i6 ∈ [--..--] [value] computing for function g1 <- main. - Called from tests/value/initialized.c:153. + Called from tests/value/initialized.c:158. tests/value/initialized.c:19:[value] entering loop for the first time tests/value/initialized.c:21:[value] warning: assertion got status unknown. tests/value/initialized.c:22:[value] warning: assertion got status unknown. @@ -52,14 +51,15 @@ tests/value/initialized.c:38:[value] warning: assertion got status unknown. [value] Recording results for g1 [value] Done for function g1 [value] computing for function g2 <- main. - Called from tests/value/initialized.c:154. + Called from tests/value/initialized.c:159. tests/value/initialized.c:50:[value] warning: signed overflow. assert -2147483648 ≤ (int)(&b4) + (int)(&b4); tests/value/initialized.c:50:[value] warning: signed overflow. assert (int)(&b4) + (int)(&b4) ≤ 2147483647; tests/value/initialized.c:50:[value] Assigning imprecise value to t[6]. The imprecision originates from Arithmetic {tests/value/initialized.c:50} tests/value/initialized.c:51:[value] Assigning imprecise value to t[7]. The imprecision originates from Arithmetic {tests/value/initialized.c:50} -[value] DUMPING STATE of file tests/value/initialized.c line 63 +tests/value/initialized.c:63:[value] Frama_C_dump_each: + # Cvalue domain: Frama_C_entropy_source ∈ [--..--] b1 ∈ [--..--] b2 ∈ [--..--] @@ -82,13 +82,13 @@ tests/value/initialized.c:51:[value] Assigning imprecise value to t[7]. {[12][bits 24 to 31]#; [13][bits 0 to 23]#} ∈ {0x11111111; 0x22222222} or UNINITIALIZED [13][bits 24 to 31] ∈ {0} or UNINITIALIZED - p_0 ∈ UNINITIALIZED v1 ∈ {0} i6 ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized.c:66:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/initialized.c line 68 +tests/value/initialized.c:68:[value] Frama_C_dump_each: + # Cvalue domain: Frama_C_entropy_source ∈ [--..--] b1 ∈ [--..--] b2 ∈ [--..--] @@ -119,10 +119,8 @@ tests/value/initialized.c:66:[value] warning: assertion got status unknown. v1 ∈ {0} i6 ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each([bits 0 to 7]# ∈ {0x11223344}%32, bits 24 to 31 - [bits 8 to 31]# ∈ {0x55667788}%32, bits 0 to 23 - This amounts to: {0x66778811}) + ==END OF DUMP== +tests/value/initialized.c:70:[value] Frama_C_show_each: {0x66778811} tests/value/initialized.c:72:[value] warning: assertion got status unknown. tests/value/initialized.c:74:[value] warning: assertion got status unknown. tests/value/initialized.c:76:[value] warning: assertion got status unknown. @@ -131,7 +129,7 @@ tests/value/initialized.c:80:[value] warning: assertion got status unknown. [value] Recording results for g2 [value] Done for function g2 [value] computing for function g3 <- main. - Called from tests/value/initialized.c:155. + Called from tests/value/initialized.c:160. tests/value/initialized.c:89:[value] warning: assertion got status unknown. tests/value/initialized.c:93:[value] warning: accessing uninitialized left-value. assert \initialized(&r2); tests/value/initialized.c:96:[value] warning: accessing uninitialized left-value. assert \initialized(&x3); @@ -148,12 +146,12 @@ tests/value/initialized.c:8:[value] warning: function f: postcondition got statu [value] Recording results for g3 [value] Done for function g3 [value] computing for function g4 <- main. - Called from tests/value/initialized.c:156. + Called from tests/value/initialized.c:161. tests/value/initialized.c:104:[value] warning: accessing uninitialized left-value. assert \initialized(&y); [value] Recording results for g4 [value] Done for function g4 [value] computing for function g5 <- main. - Called from tests/value/initialized.c:157. + Called from tests/value/initialized.c:162. [value] computing for function wrong_assigns <- g5 <- main. Called from tests/value/initialized.c:127. [value] using specification for function wrong_assigns @@ -167,7 +165,7 @@ tests/value/initialized.c:133:[value] warning: assertion got status unknown. [value] Recording results for g5 [value] Done for function g5 [value] computing for function g6 <- main. - Called from tests/value/initialized.c:158. + Called from tests/value/initialized.c:163. tests/value/initialized.c:143:[value] warning: assertion got status unknown. tests/value/initialized.c:144:[value] warning: assertion got status unknown. tests/value/initialized.c:145:[value] warning: assertion got status unknown. @@ -176,10 +174,21 @@ tests/value/initialized.c:147:[value] warning: assertion got status unknown. tests/value/initialized.c:148:[value] assertion got status valid. [value] Recording results for g6 [value] Done for function g6 +[value] computing for function g7 <- main. + Called from tests/value/initialized.c:164. +[value] computing for function Frama_C_make_unknown <- g7 <- main. + Called from tests/value/initialized.c:153. +[value] using specification for function Frama_C_make_unknown +share/libc/__fc_builtin.h:33:[value] function Frama_C_make_unknown: precondition got status valid. +[value] Done for function Frama_C_make_unknown +tests/value/initialized.c:154:[value] assertion got status valid. +[value] Recording results for g7 +[value] Done for function g7 [value] Recording results for main [value] done for function main tests/value/initialized.c:93:[value] assertion 'Value,initialisation' got final status invalid. tests/value/initialized.c:104:[value] assertion 'Value,initialisation' got final status invalid. +[scope:rm_asserts] removing 3 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function f: t1[0] ∈ UNINITIALIZED @@ -245,6 +254,10 @@ tests/value/initialized.c:104:[value] assertion 'Value,initialisation' got final NON TERMINATING FUNCTION [value:final-states] Values at end of function g6: i6 ∈ UNINITIALIZED +[value:final-states] Values at end of function g7: + Frama_C_entropy_source ∈ [--..--] + key[0..63] ∈ [--..--] + [64..127] ∈ UNINITIALIZED [value:final-states] Values at end of function g5: v ∈ UNINITIALIZED p ∈ {{ &v1 ; &v2 }} @@ -269,6 +282,10 @@ tests/value/initialized.c:104:[value] assertion 'Value,initialisation' got final [from] Done for function g4 [from] Computing for function g6 [from] Done for function g6 +[from] Computing for function g7 +[from] Computing for function Frama_C_make_unknown <-g7 +[from] Done for function Frama_C_make_unknown +[from] Done for function g7 [from] Computing for function g5 [from] Computing for function wrong_assigns <-g5 [from] Done for function wrong_assigns @@ -280,6 +297,9 @@ tests/value/initialized.c:104:[value] assertion 'Value,initialisation' got final [from] Function Frama_C_interval: Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) \result FROM Frama_C_entropy_source; min; max +[from] Function Frama_C_make_unknown: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) + key[0..63] FROM Frama_C_entropy_source [from] Function f: t1[1..4] FROM m; t; n (and SELF) t2[1..248] FROM m; t; n (and SELF) @@ -293,6 +313,8 @@ tests/value/initialized.c:104:[value] assertion 'Value,initialisation' got final NON TERMINATING - NO EFFECTS [from] Function g6: i6 FROM rand (and SELF) +[from] Function g7: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) [from] Function wrong_assigns: v{.a; .b} FROM \nothing [from] Function g5: @@ -327,6 +349,10 @@ tests/value/initialized.c:104:[value] assertion 'Value,initialisation' got final i6 [inout] Inputs for function g6: rand +[inout] Out (internal) for function g7: + Frama_C_entropy_source; key[0..63] +[inout] Inputs for function g7: + Frama_C_entropy_source [inout] Out (internal) for function g5: v{.a; .b}; p; tmp [inout] Inputs for function g5: diff --git a/tests/value/oracle/initialized_copy.0.res.oracle b/tests/value/oracle/initialized_copy.0.res.oracle index 12359e3a53addee04890cc6c2b7f4a57f1abd0b9..aeb2d49686dc3fab67a24ae2c8fa8f42673e937e 100644 --- a/tests/value/oracle/initialized_copy.0.res.oracle +++ b/tests/value/oracle/initialized_copy.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/initialized_copy.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,34 +7,37 @@ v ∈ [--..--] tests/value/initialized_copy.i:29:[value] warning: accessing uninitialized left-value. assert \initialized(&b); tests/value/initialized_copy.i:37:[value] warning: accessing uninitialized left-value. assert \initialized(&b_0); -[value] DUMPING STATE of file tests/value/initialized_copy.i line 38 +tests/value/initialized_copy.i:38:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0} v ∈ [--..--] b_0 ∈ {1} a_0 ∈ {1} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized_copy.i:47:[value] warning: accessing uninitialized left-value. assert \initialized(&c); tests/value/initialized_copy.i:64:[value] warning: accessing uninitialized left-value. assert \initialized(&c_0); -[value] DUMPING STATE of file tests/value/initialized_copy.i line 65 +tests/value/initialized_copy.i:65:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0} v ∈ [--..--] c_0 ∈ {67305985} p_0 ∈ {{ &c_0 + {3} }} a_2 ∈ {67305985} __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each(.c ∈ {1} - .[bits 8 to 31] ∈ UNINITIALIZED - .i ∈ {5}) -[value] Called Frama_C_show_each({{ }}) -[value] Called Frama_C_show_each(.i1 ∈ {1} - .i2 ∈ UNINITIALIZED) + ==END OF DUMP== +tests/value/initialized_copy.i:73:[value] Frama_C_show_each: .c ∈ {1} + .[bits 8 to 31] ∈ UNINITIALIZED + .i ∈ {5} +tests/value/initialized_copy.i:79:[value] Frama_C_show_each: UNINITIALIZED +tests/value/initialized_copy.i:85:[value] Frama_C_show_each: .i1 ∈ {1} + .i2 ∈ UNINITIALIZED tests/value/initialized_copy.i:90:[value] warning: assertion got status unknown. tests/value/initialized_copy.i:92:[value] warning: accessing uninitialized left-value. assert \initialized(&v_0[i]); tests/value/initialized_copy.i:98:[value] warning: assertion got status unknown. tests/value/initialized_copy.i:101:[value] warning: accessing uninitialized left-value. assert \initialized(&v_1[i_0]); -[value] DUMPING STATE of file tests/value/initialized_copy.i line 102 +tests/value/initialized_copy.i:102:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0} v ∈ [--..--] i_0 ∈ [0..9] @@ -44,10 +46,11 @@ tests/value/initialized_copy.i:101:[value] warning: accessing uninitialized left [1] ∈ {1} [2..9] ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized_copy.i:108:[value] warning: assertion got status unknown. tests/value/initialized_copy.i:111:[value] warning: accessing uninitialized left-value. assert \initialized(&v_2[i_1]); -[value] DUMPING STATE of file tests/value/initialized_copy.i line 112 +tests/value/initialized_copy.i:112:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0; 12} v ∈ [--..--] i_1 ∈ [0..9] @@ -55,7 +58,7 @@ tests/value/initialized_copy.i:111:[value] warning: accessing uninitialized left [1] ∈ {12} [2..9] ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized_copy.i:117:[value] warning: accessing uninitialized left-value. assert \initialized(&a_3); tests/value/initialized_copy.i:124:[value] warning: accessing uninitialized left-value. assert \initialized(&a_4); tests/value/initialized_copy.i:129:[value] warning: accessing uninitialized left-value. assert \initialized(&a_5); @@ -65,24 +68,26 @@ tests/value/initialized_copy.i:143:[value] warning: accessing uninitialized left Called from tests/value/initialized_copy.i:143. [value] Recording results for f [value] Done for function f -[value] DUMPING STATE of file tests/value/initialized_copy.i line 144 +tests/value/initialized_copy.i:144:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0; 12} v ∈ [--..--] a_7 ∈ {1} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized_copy.i:151:[value] warning: accessing uninitialized left-value. assert \initialized(&a_8); [value] computing for function g <- main. Called from tests/value/initialized_copy.i:151. tests/value/initialized_copy.i:151:[kernel] warning: Neither code nor specification for function g, generating default assigns from the prototype [value] using specification for function g [value] Done for function g -[value] DUMPING STATE of file tests/value/initialized_copy.i line 152 +tests/value/initialized_copy.i:152:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0; 12} v ∈ [--..--] a_8 ∈ {1} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main tests/value/initialized_copy.i:29:[value] assertion 'Value,initialisation' got final status invalid. diff --git a/tests/value/oracle/initialized_copy.1.res.oracle b/tests/value/oracle/initialized_copy.1.res.oracle index 2cf64afb009d68413e6f293c9be6cb7af4e5dc73..0eef4bd28e5d12d50b1b258ed62f04d9e2af2056 100644 --- a/tests/value/oracle/initialized_copy.1.res.oracle +++ b/tests/value/oracle/initialized_copy.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/initialized_copy.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,16 +5,18 @@ [value:initial-state] Values of globals at initialization w[0..9] ∈ {0} v ∈ [--..--] -[value] Called Frama_C_show_each_unreached() -[value] DUMPING STATE of file tests/value/initialized_copy.i line 38 +tests/value/initialized_copy.i:30:[value] Frama_C_show_each_unreached: +tests/value/initialized_copy.i:38:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0} v ∈ [--..--] b_0 ∈ {1} or UNINITIALIZED a_0 ∈ {1} or UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each_unreached() -[value] DUMPING STATE of file tests/value/initialized_copy.i line 65 + ==END OF DUMP== +tests/value/initialized_copy.i:48:[value] Frama_C_show_each_unreached: +tests/value/initialized_copy.i:65:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0} v ∈ [--..--] c_0[bits 0 to 7] ∈ {1} or UNINITIALIZED @@ -28,17 +29,18 @@ [bits 16 to 23] ∈ {3} [bits 24 to 31] ∈ {4} __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] Called Frama_C_show_each(.c ∈ {1} - .[bits 8 to 31] ∈ UNINITIALIZED - .i ∈ {5}) -[value] Called Frama_C_show_each({{ }}) -[value] Called Frama_C_show_each(.i1 ∈ {1} - .i2 ∈ UNINITIALIZED) + ==END OF DUMP== +tests/value/initialized_copy.i:73:[value] Frama_C_show_each: .c ∈ {1} + .[bits 8 to 31] ∈ UNINITIALIZED + .i ∈ {5} +tests/value/initialized_copy.i:79:[value] Frama_C_show_each: UNINITIALIZED +tests/value/initialized_copy.i:85:[value] Frama_C_show_each: .i1 ∈ {1} + .i2 ∈ UNINITIALIZED tests/value/initialized_copy.i:90:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_unreached() +tests/value/initialized_copy.i:93:[value] Frama_C_show_each_unreached: tests/value/initialized_copy.i:98:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/initialized_copy.i line 102 +tests/value/initialized_copy.i:102:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0} v ∈ [--..--] i_0 ∈ [0..9] @@ -47,9 +49,10 @@ tests/value/initialized_copy.i:98:[value] warning: assertion got status unknown. [1] ∈ {1} [2..9] ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized_copy.i:108:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/initialized_copy.i line 112 +tests/value/initialized_copy.i:112:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0; 12} or UNINITIALIZED v ∈ [--..--] i_1 ∈ [0..9] @@ -57,35 +60,37 @@ tests/value/initialized_copy.i:108:[value] warning: assertion got status unknown [1] ∈ {12} [2..9] ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] computing for function f <- main. Called from tests/value/initialized_copy.i:129. [value] Recording results for f [value] Done for function f -[value] Called Frama_C_show_each_unreached() +tests/value/initialized_copy.i:130:[value] Frama_C_show_each_unreached: tests/value/initialized_copy.i:135:[value] warning: accessing uninitialized left-value. assert \initialized(&a_6); [value] computing for function f <- main. Called from tests/value/initialized_copy.i:143. [value] Recording results for f [value] Done for function f -[value] DUMPING STATE of file tests/value/initialized_copy.i line 144 +tests/value/initialized_copy.i:144:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0; 12} or UNINITIALIZED v ∈ [--..--] a_7 ∈ {1} or UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/initialized_copy.i:151:[value] warning: accessing uninitialized left-value. assert \initialized(&a_8); [value] computing for function g <- main. Called from tests/value/initialized_copy.i:151. tests/value/initialized_copy.i:151:[kernel] warning: Neither code nor specification for function g, generating default assigns from the prototype [value] using specification for function g [value] Done for function g -[value] DUMPING STATE of file tests/value/initialized_copy.i line 152 +tests/value/initialized_copy.i:152:[value] Frama_C_dump_each: + # Cvalue domain: w[0..9] ∈ {0; 12} or UNINITIALIZED v ∈ [--..--] a_8 ∈ {1} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main tests/value/initialized_copy.i:135:[value] assertion 'Value,initialisation' got final status invalid. diff --git a/tests/value/oracle/inout.0.res.oracle b/tests/value/oracle/inout.0.res.oracle index ef85e1d9c496a1f8ac94dae716901ddf2e4ec2d0..bd47998ec29f2450c846ae1a518821558ce46dc5 100644 --- a/tests/value/oracle/inout.0.res.oracle +++ b/tests/value/oracle/inout.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout.i (no preprocessing) [value] Analyzing a complete application starting at inout_11_0 [value] Computing initial state diff --git a/tests/value/oracle/inout.1.res.oracle b/tests/value/oracle/inout.1.res.oracle index 344c58b800a1c07fb269d9748e869ddb447b7017..11e08fe96834dec00f5382c343003aacfa917521 100644 --- a/tests/value/oracle/inout.1.res.oracle +++ b/tests/value/oracle/inout.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout.i (no preprocessing) [value] Analyzing a complete application starting at inout_11_3 [value] Computing initial state diff --git a/tests/value/oracle/inout.2.res.oracle b/tests/value/oracle/inout.2.res.oracle index b7e7bad5f99295f2e63ae869eb6b955f69f6154e..c571c63426a98d1c5abb8a7e916c52a8a7c6dd9b 100644 --- a/tests/value/oracle/inout.2.res.oracle +++ b/tests/value/oracle/inout.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout.i (no preprocessing) [value] Analyzing a complete application starting at never_terminate [value] Computing initial state diff --git a/tests/value/oracle/inout.3.res.oracle b/tests/value/oracle/inout.3.res.oracle index 5497c9df29566e25fe5705153ab198a667e10e06..0436149c72dff00192ac3d96a0ff6ce3aa9f6a25 100644 --- a/tests/value/oracle/inout.3.res.oracle +++ b/tests/value/oracle/inout.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout.i (no preprocessing) [value] Analyzing a complete application starting at may_not_terminate [value] Computing initial state diff --git a/tests/value/oracle/inout.4.res.oracle b/tests/value/oracle/inout.4.res.oracle index 27dd3450b411588fef40a77ca16d249c77063d5c..2589412e6cf3fdb0192a1f42eadcaf79a6bdb8aa 100644 --- a/tests/value/oracle/inout.4.res.oracle +++ b/tests/value/oracle/inout.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout.i (no preprocessing) [value] Analyzing a complete application starting at call_may_not_terminate [value] Computing initial state diff --git a/tests/value/oracle/inout_diff.res.oracle b/tests/value/oracle/inout_diff.res.oracle index 9f2b0d4ea805b5a58c9aa80124719388da1e5e47..a2bbb4a699d47dd1eb6bccdc9bbc33ebab0db7cf 100644 --- a/tests/value/oracle/inout_diff.res.oracle +++ b/tests/value/oracle/inout_diff.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout_diff.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/inout_formals.res.oracle b/tests/value/oracle/inout_formals.res.oracle index 7a480519876ba5abf813815dae2489a14030301a..66ca7c6dec5d714ab261d3de9671de41c57cbc43 100644 --- a/tests/value/oracle/inout_formals.res.oracle +++ b/tests/value/oracle/inout_formals.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout_formals.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,7 +6,7 @@ x ∈ {0} y ∈ {0} tests/value/inout_formals.i:7:[value] warning: out of bounds write. assert \valid(i); -[value] Called Frama_C_show_each({{ &S_i }}) +tests/value/inout_formals.i:8:[value] Frama_C_show_each: {{ &S_i }} [value] Recording results for main [value] done for function main [inout] InOut (internal) for function main: diff --git a/tests/value/oracle/inout_on_alarms.res.oracle b/tests/value/oracle/inout_on_alarms.res.oracle index 9187855a2da4241afd7e0edc97eab5b4a3553df3..9bc12bc9db88824a8e14b0403e3051e043a33b11 100644 --- a/tests/value/oracle/inout_on_alarms.res.oracle +++ b/tests/value/oracle/inout_on_alarms.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout_on_alarms.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/inout_proto.res.oracle b/tests/value/oracle/inout_proto.res.oracle index d2f4c94f41ee8298664bf45a3516cc70d164c057..993aa5e06f883d6837b38ebfca03523014f90fa8 100644 --- a/tests/value/oracle/inout_proto.res.oracle +++ b/tests/value/oracle/inout_proto.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inout_proto.i (no preprocessing) [value] Analyzing a complete application starting at main_main [value] Computing initial state @@ -99,9 +98,9 @@ u[8..10]; p [inout] InOut (internal) for function main: Operational inputs: - length; msg + msg Operational inputs on termination: - length; msg + msg Sure outputs: ret [inout] InOut (with formals) for function main: @@ -131,9 +130,9 @@ b; t{[3..4]; [6..7]}; u[8..10]; i [inout] InOut (internal) for function main_main: Operational inputs: - length; b; t[6..7]; u[8..10]; msg; i + b; t[6..7]; u[8..10]; msg; i Operational inputs on termination: - length; b; t[6..7]; u[8..10]; msg; i + b; t[6..7]; u[8..10]; msg; i Sure outputs: a; c; t[0..5] [inout] InOut (with formals) for function main_main: diff --git a/tests/value/oracle/input.res.oracle b/tests/value/oracle/input.res.oracle index 791e9f8ea9ca11567e781f160694ea71e8821aa3..8111f74ebd3ffc6fc41407d13f53c3523106697a 100644 --- a/tests/value/oracle/input.res.oracle +++ b/tests/value/oracle/input.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/input.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/integers.res.oracle b/tests/value/oracle/integers.res.oracle index ad67bb4b1da33f207bea015d905730694aa9c8f1..abd72952b0abd2f876f9d5f2a604b4bb66d7ff7b 100644 --- a/tests/value/oracle/integers.res.oracle +++ b/tests/value/oracle/integers.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/integers.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/interpol.res.oracle b/tests/value/oracle/interpol.res.oracle index ef2a3a64930957774067a4c82eb2c703bb4efe02..a1e2defa3384b72efa76e04320391305da378ec7 100644 --- a/tests/value/oracle/interpol.res.oracle +++ b/tests/value/oracle/interpol.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/interpol.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,11 +12,10 @@ [6] ∈ {64} [7] ∈ {128} tests/value/interpol.c:10:[value] entering loop for the first time -[value] Called Frama_C_show_each_ok({0}, {-1}) -[value] Called Frama_C_show_each_ok({0; 1}, {-2; -1}) -[value] Called Frama_C_show_each_ok({0; 1; 2}, {-4; -2; -1}) -[value] Called Frama_C_show_each_ok({0; 1; 2; 3; 4; 5; 6}, - {-64; -32; -16; -8; -4; -2; -1}) +tests/value/interpol.c:16:[value] Frama_C_show_each_ok: {0}, {-1} +tests/value/interpol.c:16:[value] Frama_C_show_each_ok: {0; 1}, {-2; -1} +tests/value/interpol.c:16:[value] Frama_C_show_each_ok: {0; 1; 2}, {-4; -2; -1} +tests/value/interpol.c:16:[value] Frama_C_show_each_ok: {0; 1; 2; 3; 4; 5; 6}, {-64; -32; -16; -8; -4; -2; -1} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/invalid_loc_return.res.oracle b/tests/value/oracle/invalid_loc_return.res.oracle index 9e7d0872724ffc55da3918d21763728c1dc47179..6eaa13402698d595d621bd5ead5fb59a74338988 100644 --- a/tests/value/oracle/invalid_loc_return.res.oracle +++ b/tests/value/oracle/invalid_loc_return.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/invalid_loc_return.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/value/oracle/invalid_lval_arg.res.oracle b/tests/value/oracle/invalid_lval_arg.res.oracle index caf804edca9ec843ba4cb9a35634ba8e6b2b51c4..14ef79224678a2cb886fa18d21addd5a0d970cbc 100644 --- a/tests/value/oracle/invalid_lval_arg.res.oracle +++ b/tests/value/oracle/invalid_lval_arg.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/invalid_lval_arg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -14,8 +13,8 @@ tests/value/invalid_lval_arg.i:19:[value] warning: out of bounds read. assert \v tests/value/invalid_lval_arg.i:15:[value] assertion 'Value,mem_access' got final status invalid. tests/value/invalid_lval_arg.i:17:[value] assertion 'Value,mem_access' got final status invalid. tests/value/invalid_lval_arg.i:19:[value] assertion 'Value,mem_access' got final status invalid. -[value] ====== VALUES COMPUTED ====== tests/value/invalid_lval_arg.i:15:[kernel] warning: Neither code nor specification for function f, generating default assigns from the prototype +[value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: NON TERMINATING FUNCTION [from] Computing for function main diff --git a/tests/value/oracle/inversion.res.oracle b/tests/value/oracle/inversion.res.oracle index 5e35e4ef9d6f67a5558489f6b3ad754ac2308faa..f3292ac2027ce4bf977bc27c74a7e7f3664b5e44 100644 --- a/tests/value/oracle/inversion.res.oracle +++ b/tests/value/oracle/inversion.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inversion.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -23,6 +22,7 @@ [2].p ∈ {{ &px }} [3..4] ∈ {0} ii[0..1] ∈ {0} +tests/value/inversion.i:21:[value] warning: initialization of volatile variable k ignored tests/value/inversion.i:23:[value] entering loop for the first time tests/value/inversion.i:30:[value] entering loop for the first time [value] Recording results for main diff --git a/tests/value/oracle/inversion2.res.oracle b/tests/value/oracle/inversion2.res.oracle index 1186f31bdd2db436bbd766c21d697a66d6a00c0a..b13f7e1a0a433b3bfcdb64c9b34951f5910ac27d 100644 --- a/tests/value/oracle/inversion2.res.oracle +++ b/tests/value/oracle/inversion2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/inversion2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/jacques.res.oracle b/tests/value/oracle/jacques.res.oracle index 1d9889e0ec8a22689fd19353bfd605a36a467387..bfcdffafb823a479e960e37f5f5cdda6e7308acd 100644 --- a/tests/value/oracle/jacques.res.oracle +++ b/tests/value/oracle/jacques.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/jacques.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,9 +9,9 @@ A ∈ {0} B ∈ {0} C ∈ {0} -[value] Called Frama_C_show_each_f({{ NULL ; &S_pp }}) +tests/value/jacques.i:21:[value] Frama_C_show_each_f: {{ NULL ; &S_pp }} tests/value/jacques.i:23:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_f({{ &S_pp }}) +tests/value/jacques.i:25:[value] Frama_C_show_each_f: {{ &S_pp }} tests/value/jacques.i:29:[value] assertion got status valid. [value] computing for function f <- main. Called from tests/value/jacques.i:36. diff --git a/tests/value/oracle/join_misaligned.res.oracle b/tests/value/oracle/join_misaligned.res.oracle index 45b64a80d1a5b81316fd56dd88b13f26428d5325..19275bc2b72788a9d2035b7b3cf5ae8996ca9663 100644 --- a/tests/value/oracle/join_misaligned.res.oracle +++ b/tests/value/oracle/join_misaligned.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/join_misaligned.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/label.res.oracle b/tests/value/oracle/label.res.oracle index 236001f35ca5dd810b7062fa149aae69cab2468a..78503901e7302676a98c99cdadc7c144d4e2d7bb 100644 --- a/tests/value/oracle/label.res.oracle +++ b/tests/value/oracle/label.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/label.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/lazy.0.res.oracle b/tests/value/oracle/lazy.0.res.oracle index bb7d3bb0951f1ec6f5290932f86ff033439deb71..a8ee277995f1955f7ae4aff7298f5692f14db4a7 100644 --- a/tests/value/oracle/lazy.0.res.oracle +++ b/tests/value/oracle/lazy.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/lazy.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -18,6 +17,7 @@ tests/value/lazy.i:14:[value] warning: pointer comparison. assert \pointer_compa tests/value/lazy.i:19:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/lazy.i:19:[value] warning: pointer comparison. assert \pointer_comparable((void *)0, (void *)(&a + 2)); [value] Recording results for main +tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -28,7 +28,6 @@ tests/value/lazy.i:19:[value] warning: pointer comparison. assert \pointer_compa s ∈ {{ &a + {-4; 0} }} S_p[0..1] ∈ [--..--] [from] Computing for function main -tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: diff --git a/tests/value/oracle/lazy.1.res.oracle b/tests/value/oracle/lazy.1.res.oracle index 7b58b7e549d11e3680dbdbf24fec2467976e653f..ca762ed1fef82c290b97a8f5e7e516724287d9a1 100644 --- a/tests/value/oracle/lazy.1.res.oracle +++ b/tests/value/oracle/lazy.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/lazy.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -24,6 +23,8 @@ tests/value/lazy.i:19:[value:pointer-comparison] evaluating condition to {0; 1} tests/value/lazy.i:19:[value] warning: pointer comparison. assert \pointer_comparable((void *)0, (void *)(&a + 2)); tests/value/lazy.i:19:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA [value] Recording results for main +tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) +tests/value/lazy.i:14:[value:pointer-comparison] evaluating operator ! to {0; 1} instead of {0} because of UPCPA [value] done for function main [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: @@ -35,8 +36,6 @@ tests/value/lazy.i:19:[value:pointer-comparison] evaluating condition to {0; 1} t ∈ {{ NULL ; &a + {-4} }} S_p[0..1] ∈ [--..--] [from] Computing for function main -tests/value/lazy.i:14:[value:pointer-comparison] invalid pointer negation: invalid pointer(s) -tests/value/lazy.i:14:[value:pointer-comparison] evaluating operator ! to {0; 1} instead of {0} because of UPCPA [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: diff --git a/tests/value/oracle/leaf.res.oracle b/tests/value/oracle/leaf.res.oracle index c93f9684702b73c81d5aac717caf55a6a8387d96..cd2166be0e6433b053ef7e1c46365d55b3a7d1de 100644 --- a/tests/value/oracle/leaf.res.oracle +++ b/tests/value/oracle/leaf.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/leaf.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -37,41 +36,26 @@ tests/value/leaf.i:48:[kernel] warning: Neither code nor specification for funct tests/value/leaf.i:50:[kernel] warning: No code nor implicit assigns clause for function f_int_star_int, generating default assigns from the prototype [value] using specification for function f_int_star_int [value] Done for function f_int_star_int -tests/value/leaf.i:51:[value] warning: out of bounds read. assert \valid_read(p); -[value] Called Frama_C_show_each_F([-2147483648..2147483647]) -[value] Called Frama_C_show_each_F([-2147483648..2147483647]) +tests/value/leaf.i:51:[value] Frama_C_show_each_F: [-2147483648..2147483647] +tests/value/leaf.i:52:[value] warning: out of bounds write. assert \valid(p); +tests/value/leaf.i:53:[value] Frama_C_show_each_F: [-2147483648..2147483647] [value] computing for function f_int_star_int_star_int <- main. Called from tests/value/leaf.i:55. tests/value/leaf.i:55:[kernel] warning: No code nor implicit assigns clause for function f_int_star_int_star_int, generating default assigns from the prototype [value] using specification for function f_int_star_int_star_int [value] Done for function f_int_star_int_star_int -tests/value/leaf.i:56:[value] warning: out of bounds read. assert \valid_read(pp); -tests/value/leaf.i:56:[value] Reading left-value *pp. - The location is {{ alloced_return_f_int_star_int_star_int -> [0..17179869152],0%32 }}. - It contains a garbled mix of {alloced_return_f_int_star_int_star_int} - because of Library function {tests/value/leaf.i:55}. -[value] Called Frama_C_show_each_G({{ garbled mix of &{alloced_return_f_int_star_int_star_int} - (origin: Library function {tests/value/leaf.i:55}) }}) -tests/value/leaf.i:57:[value] warning: out of bounds read. assert \valid_read(*pp); -tests/value/leaf.i:57:[value] Reading left-value *(*pp). - The location is {{ alloced_return_f_int_star_int_star_int -> [0..34359738336],0%8 }}. - It contains a garbled mix of {alloced_return_f_int_star_int_star_int} - because of Library function {tests/value/leaf.i:55}. -[value] Called Frama_C_show_each_F({{ garbled mix of &{alloced_return_f_int_star_int_star_int} - (origin: Library function {tests/value/leaf.i:55}) }}) -tests/value/leaf.i:59:[value] Reading left-value *pp. - The location is {{ alloced_return_f_int_star_int_star_int -> [0..17179869152],0%32 }}. - It contains a garbled mix of {alloced_return_f_int_star_int_star_int} - because of Library function {tests/value/leaf.i:55}. -[value] Called Frama_C_show_each_G({{ garbled mix of &{alloced_return_f_int_star_int_star_int} - (origin: Library function {tests/value/leaf.i:55}) }}) -tests/value/leaf.i:60:[value] warning: out of bounds read. assert \valid_read(*pp); -tests/value/leaf.i:60:[value] Reading left-value *(*pp). - The location is {{ alloced_return_f_int_star_int_star_int -> [0..34359738336],0%8 }}. - It contains a garbled mix of {alloced_return_f_int_star_int_star_int} - because of Library function {tests/value/leaf.i:55}. -[value] Called Frama_C_show_each_F({{ garbled mix of &{alloced_return_f_int_star_int_star_int} - (origin: Library function {tests/value/leaf.i:55}) }}) +tests/value/leaf.i:56:[value] Frama_C_show_each_G: + {{ garbled mix of &{alloced_return_f_int_star_int_star_int} + (origin: Library function {tests/value/leaf.i:55}) }} +tests/value/leaf.i:57:[value] Frama_C_show_each_F: + {{ garbled mix of &{alloced_return_f_int_star_int_star_int} + (origin: Library function {tests/value/leaf.i:55}) }} +tests/value/leaf.i:59:[value] Frama_C_show_each_G: + {{ garbled mix of &{alloced_return_f_int_star_int_star_int} + (origin: Library function {tests/value/leaf.i:55}) }} +tests/value/leaf.i:60:[value] Frama_C_show_each_F: + {{ garbled mix of &{alloced_return_f_int_star_int_star_int} + (origin: Library function {tests/value/leaf.i:55}) }} [value] computing for function f_star_int_cint <- main. Called from tests/value/leaf.i:62. tests/value/leaf.i:62:[kernel] warning: Neither code nor specification for function f_star_int_cint, generating default assigns from the prototype @@ -157,7 +141,9 @@ tests/value/leaf.i:74:[kernel] warning: Neither code nor specification for funct st_tab3_int_1 ∈ [--..--] st_tab3_int_3 ∈ [--..--] p ∈ {{ &alloced_return_f_int_star_int + [0..2147483644],0%4 }} - pp ∈ {{ &alloced_return_f_int_star_int_star_int + [0..2147483644],0%4 }} + pp ∈ + {{ NULL + [--..--] ; + &alloced_return_f_int_star_int_star_int + [0..2147483644],0%4 }} alloced_return_f_int_star_int[bits 0 to ..] ∈ [--..--] [from] Computing for function main [from] Computing for function f_int_int <-main diff --git a/tests/value/oracle/leaf2.res.oracle b/tests/value/oracle/leaf2.res.oracle index bfcf9d730a704b74cf501587f9078bbf83bd8e65..94f59ddd7751ef6e25fd566d771d2ae331f33649 100644 --- a/tests/value/oracle/leaf2.res.oracle +++ b/tests/value/oracle/leaf2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/leaf2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/leaf_spec.0.res.oracle b/tests/value/oracle/leaf_spec.0.res.oracle index 1b0311f3eb9ccb7155f7e87dc574ec5bc852624e..988bf3ef655f13f1feae0eb9f6d995ff13f78006 100644 --- a/tests/value/oracle/leaf_spec.0.res.oracle +++ b/tests/value/oracle/leaf_spec.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/leaf_spec.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/leaf_spec.1.res.oracle b/tests/value/oracle/leaf_spec.1.res.oracle index 8a97133b84b843ba90178a94e3594ae472445dcb..070326cc86192ef7f49ae3e3d459c53dde157e3f 100644 --- a/tests/value/oracle/leaf_spec.1.res.oracle +++ b/tests/value/oracle/leaf_spec.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/leaf_spec.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/value/oracle/library.res.oracle b/tests/value/oracle/library.res.oracle index 06037e66333c87d2d4f628db77c1bf58265e8a3a..8dfe0d497040a6e234040686ffb93abea97085b8 100644 --- a/tests/value/oracle/library.res.oracle +++ b/tests/value/oracle/library.res.oracle @@ -1,9 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/library.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state +[value:initial-state] creating variable S_0_p_ss with imprecise size (type struct ss [2]) tests/value/library.i:57:[value] warning: during initialization of variable 'ss', size of type 'struct ss' cannot be computed (abstract type 'struct ss') +[value:initial-state] creating variable S_1_p_ss with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_0_0_S_q_ss with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_1_0_S_q_ss with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_0_1_S_q_ss with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_1_1_S_q_ss with imprecise size (type struct ss [2]) [value] Initial state computed [value:initial-state] Values of globals at initialization G ∈ {{ NULL ; &S_G[0] }} @@ -159,7 +164,7 @@ tests/value/library.i:39:[value] assertion 'Value,function_pointer' got final st alloced_return_k[bits 0 to 17179869183] FROM \nothing (and SELF) [from] ====== END OF DEPENDENCIES ====== [inout] Out (internal) for function main: - G0; G1; x; y; h; z1; z2; z3; pf; vf; pd; S_0_S_0_S_0_S_G[0]; + G0; G1; x; y; h; tmp_0; tmp_1; z3; tmp_2; pf; vf; pd; S_0_S_0_S_0_S_G[0]; alloced_return_f_star_int[bits 0 to 17179869183]; alloced_return_i[bits 0 to 17179869183]; alloced_return_k[bits 0 to 17179869183] @@ -168,67 +173,76 @@ tests/value/library.i:39:[value] assertion 'Value,function_pointer' got final st alloced_return_i[bits 0 to 17179869183] [value] Analyzing an incomplete application starting at main2 [value] Computing initial state +[value:initial-state] creating variable S_0_p_ss_0 with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_1_p_ss_0 with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_0_0_S_q_ss_0 with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_1_0_S_q_ss_0 with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_0_1_S_q_ss_0 with imprecise size (type struct ss [2]) +[value:initial-state] creating variable S_1_1_S_q_ss_0 with imprecise size (type struct ss [2]) [value] Initial state computed [value:initial-state] Values of globals at initialization - G ∈ {{ NULL ; &S_G[0] }} + G ∈ {{ NULL ; &S_G_0[0] }} v ∈ [--..--] G0 ∈ [--..--] - G1 ∈ {{ NULL ; &S_G1[0] }} + G1 ∈ {{ NULL ; &S_G1_0[0] }} f ∈ {0} s ∈ {0} - ss.p[0] ∈ {{ NULL ; (struct ss *)&S_0_p_ss }} - .p[1] ∈ {{ NULL ; (struct ss *)&S_1_p_ss }} - .p[2..7] ∈ {{ NULL ; (struct ss *)&S_0_p_ss ; (struct ss *)&S_1_p_ss }} - .q ∈ {{ NULL ; &S_q_ss[0] }} + ss.p[0] ∈ {{ NULL ; (struct ss *)&S_0_p_ss_0 }} + .p[1] ∈ {{ NULL ; (struct ss *)&S_1_p_ss_0 }} + .p[2..7] ∈ + {{ NULL ; (struct ss *)&S_0_p_ss_0 ; (struct ss *)&S_1_p_ss_0 }} + .q ∈ {{ NULL ; &S_q_ss_0[0] }} ff ∈ {0} s_bitfield.bf1 ∈ [--..--] .[bits 5 to 15] ∈ UNINITIALIZED .control ∈ [--..--] .[bits 30 to 31] ∈ UNINITIALIZED - S_G[0] ∈ {{ NULL ; &S_0_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_G[0] }} - S_0_S_G[0] ∈ {{ NULL ; &S_0_S_0_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_G[0] }} - S_0_S_0_S_G[0] ∈ {{ NULL ; &S_0_S_0_S_0_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_0_S_G[0] }} - S_0_S_0_S_0_S_G[0..1] ∈ [--..--] - S_1_S_0_S_0_S_G[0..1] ∈ [--..--] - S_1_S_0_S_G[0] ∈ {{ NULL ; &S_0_S_1_S_0_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_0_S_G[0] }} - S_0_S_1_S_0_S_G[0..1] ∈ [--..--] - S_1_S_1_S_0_S_G[0..1] ∈ [--..--] - S_1_S_G[0] ∈ {{ NULL ; &S_0_S_1_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_G[0] }} - S_0_S_1_S_G[0] ∈ {{ NULL ; &S_0_S_0_S_1_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_1_S_G[0] }} - S_0_S_0_S_1_S_G[0..1] ∈ [--..--] - S_1_S_0_S_1_S_G[0..1] ∈ [--..--] - S_1_S_1_S_G[0] ∈ {{ NULL ; &S_0_S_1_S_1_S_G[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_1_S_G[0] }} - S_0_S_1_S_1_S_G[0..1] ∈ [--..--] - S_1_S_1_S_1_S_G[0..1] ∈ [--..--] - S_G1[0..1] ∈ [--..--] - S_0_p_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_p_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_q_ss[0][0] ∈ {{ NULL ; (struct ss *)&S_0_0_S_q_ss }} - [0][1] ∈ {{ NULL ; (struct ss *)&S_1_0_S_q_ss }} - [0][2..7] ∈ - {{ NULL ; (struct ss *)&S_0_0_S_q_ss ; (struct ss *)&S_1_0_S_q_ss }} - [1][0] ∈ {{ NULL ; (struct ss *)&S_0_1_S_q_ss }} - [1][1] ∈ {{ NULL ; (struct ss *)&S_1_1_S_q_ss }} - [1][2..7] ∈ - {{ NULL ; (struct ss *)&S_0_1_S_q_ss ; (struct ss *)&S_1_1_S_q_ss }} - S_0_0_S_q_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_0_S_q_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_0_1_S_q_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_1_S_q_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_G_0[0] ∈ {{ NULL ; &S_0_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_G_0[0] }} + S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_G_0[0] }} + S_0_S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_0_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_0_S_G_0[0] }} + S_0_S_0_S_0_S_G_0[0..1] ∈ [--..--] + S_1_S_0_S_0_S_G_0[0..1] ∈ [--..--] + S_1_S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_0_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_0_S_G_0[0] }} + S_0_S_1_S_0_S_G_0[0..1] ∈ [--..--] + S_1_S_1_S_0_S_G_0[0..1] ∈ [--..--] + S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_G_0[0] }} + S_0_S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_1_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_1_S_G_0[0] }} + S_0_S_0_S_1_S_G_0[0..1] ∈ [--..--] + S_1_S_0_S_1_S_G_0[0..1] ∈ [--..--] + S_1_S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_1_S_G_0[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_1_S_G_0[0] }} + S_0_S_1_S_1_S_G_0[0..1] ∈ [--..--] + S_1_S_1_S_1_S_G_0[0..1] ∈ [--..--] + S_G1_0[0..1] ∈ [--..--] + S_0_p_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_p_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_q_ss_0[0][0] ∈ {{ NULL ; (struct ss *)&S_0_0_S_q_ss_0 }} + [0][1] ∈ {{ NULL ; (struct ss *)&S_1_0_S_q_ss_0 }} + [0][2..7] ∈ + {{ NULL ; (struct ss *)&S_0_0_S_q_ss_0 ; + (struct ss *)&S_1_0_S_q_ss_0 }} + [1][0] ∈ {{ NULL ; (struct ss *)&S_0_1_S_q_ss_0 }} + [1][1] ∈ {{ NULL ; (struct ss *)&S_1_1_S_q_ss_0 }} + [1][2..7] ∈ + {{ NULL ; (struct ss *)&S_0_1_S_q_ss_0 ; + (struct ss *)&S_1_1_S_q_ss_0 }} + S_0_0_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_0_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_0_1_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_1_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED tests/value/library.i:69:[value] warning: assertion 'Unknown' got status unknown. tests/value/library.i:70:[value] assertion got status valid. tests/value/library.i:71:[value] assertion got status valid. tests/value/library.i:73:[value] warning: assertion 'Unknown' got status unknown. -[value] Called Frama_C_show_each_reached_1() +tests/value/library.i:74:[value] Frama_C_show_each_reached_1: tests/value/library.i:77:[value] warning: assertion 'Unknown' got status unknown. -[value] Called Frama_C_show_each_reached_2() +tests/value/library.i:78:[value] Frama_C_show_each_reached_2: tests/value/library.i:81:[value] warning: assertion 'Unknown_Invalid' got status invalid (stopping propagation). [value] Recording results for main2 [value] done for function main2 @@ -248,232 +262,252 @@ tests/value/library.i:81:[value] warning: assertion 'Unknown_Invalid' got status v [value] Analyzing an incomplete application starting at main2 [value] Computing initial state +[value:initial-state] creating variable S_0_p_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_1_p_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_2_p_ss with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_3_p_ss with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_0_0_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_1_0_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_2_0_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_3_0_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_0_1_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_1_1_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_2_1_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_3_1_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_0_2_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_1_2_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_2_2_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_3_2_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_0_3_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_1_3_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_2_3_S_q_ss_1 with imprecise size (type struct ss [4]) +[value:initial-state] creating variable S_3_3_S_q_ss_1 with imprecise size (type struct ss [4]) [value] Initial state computed [value:initial-state] Values of globals at initialization - G ∈ {{ NULL ; &S_G_0[0] }} + G ∈ {{ NULL ; &S_G_1[0] }} v ∈ [--..--] G0 ∈ [--..--] - G1 ∈ {{ NULL ; &S_G1_0[0] }} + G1 ∈ {{ NULL ; &S_G1_1[0] }} f ∈ {0} s ∈ {0} - ss.p[0] ∈ {{ NULL ; (struct ss *)&S_0_p_ss_0 }} - .p[1] ∈ {{ NULL ; (struct ss *)&S_1_p_ss_0 }} + ss.p[0] ∈ {{ NULL ; (struct ss *)&S_0_p_ss_1 }} + .p[1] ∈ {{ NULL ; (struct ss *)&S_1_p_ss_1 }} .p[2] ∈ {{ NULL ; (struct ss *)&S_2_p_ss }} .p[3] ∈ {{ NULL ; (struct ss *)&S_3_p_ss }} .p[4..7] ∈ - {{ NULL ; (struct ss *)&S_0_p_ss_0 ; (struct ss *)&S_1_p_ss_0 ; + {{ NULL ; (struct ss *)&S_0_p_ss_1 ; (struct ss *)&S_1_p_ss_1 ; (struct ss *)&S_2_p_ss ; (struct ss *)&S_3_p_ss }} - .q ∈ {{ NULL ; &S_q_ss_0[0] }} + .q ∈ {{ NULL ; &S_q_ss_1[0] }} ff ∈ {0} s_bitfield.bf1 ∈ [--..--] .[bits 5 to 15] ∈ UNINITIALIZED .control ∈ [--..--] .[bits 30 to 31] ∈ UNINITIALIZED - S_G_0[0] ∈ {{ NULL ; &S_0_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_G_0[0] }} - S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_0_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_0_S_G_0[0] }} - S_0_S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_0_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_0_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_0_S_0_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_0_S_0_S_G_0[0] }} - S_0_S_0_S_0_S_G_0[0..3] ∈ [--..--] - S_1_S_0_S_0_S_G_0[0..3] ∈ [--..--] - S_2_S_0_S_0_S_G_0[0..3] ∈ [--..--] - S_3_S_0_S_0_S_G_0[0..3] ∈ [--..--] - S_1_S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_0_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_0_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_1_S_0_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_1_S_0_S_G_0[0] }} - S_0_S_1_S_0_S_G_0[0..3] ∈ [--..--] - S_1_S_1_S_0_S_G_0[0..3] ∈ [--..--] - S_2_S_1_S_0_S_G_0[0..3] ∈ [--..--] - S_3_S_1_S_0_S_G_0[0..3] ∈ [--..--] - S_2_S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_2_S_0_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_2_S_0_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_2_S_0_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_2_S_0_S_G_0[0] }} - S_0_S_2_S_0_S_G_0[0..3] ∈ [--..--] - S_1_S_2_S_0_S_G_0[0..3] ∈ [--..--] - S_2_S_2_S_0_S_G_0[0..3] ∈ [--..--] - S_3_S_2_S_0_S_G_0[0..3] ∈ [--..--] - S_3_S_0_S_G_0[0] ∈ {{ NULL ; &S_0_S_3_S_0_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_3_S_0_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_3_S_0_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_3_S_0_S_G_0[0] }} - S_0_S_3_S_0_S_G_0[0..3] ∈ [--..--] - S_1_S_3_S_0_S_G_0[0..3] ∈ [--..--] - S_2_S_3_S_0_S_G_0[0..3] ∈ [--..--] - S_3_S_3_S_0_S_G_0[0..3] ∈ [--..--] - S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_1_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_1_S_G_0[0] }} - S_0_S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_1_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_1_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_0_S_1_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_0_S_1_S_G_0[0] }} - S_0_S_0_S_1_S_G_0[0..3] ∈ [--..--] - S_1_S_0_S_1_S_G_0[0..3] ∈ [--..--] - S_2_S_0_S_1_S_G_0[0..3] ∈ [--..--] - S_3_S_0_S_1_S_G_0[0..3] ∈ [--..--] - S_1_S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_1_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_1_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_1_S_1_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_1_S_1_S_G_0[0] }} - S_0_S_1_S_1_S_G_0[0..3] ∈ [--..--] - S_1_S_1_S_1_S_G_0[0..3] ∈ [--..--] - S_2_S_1_S_1_S_G_0[0..3] ∈ [--..--] - S_3_S_1_S_1_S_G_0[0..3] ∈ [--..--] - S_2_S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_2_S_1_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_2_S_1_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_2_S_1_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_2_S_1_S_G_0[0] }} - S_0_S_2_S_1_S_G_0[0..3] ∈ [--..--] - S_1_S_2_S_1_S_G_0[0..3] ∈ [--..--] - S_2_S_2_S_1_S_G_0[0..3] ∈ [--..--] - S_3_S_2_S_1_S_G_0[0..3] ∈ [--..--] - S_3_S_1_S_G_0[0] ∈ {{ NULL ; &S_0_S_3_S_1_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_3_S_1_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_3_S_1_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_3_S_1_S_G_0[0] }} - S_0_S_3_S_1_S_G_0[0..3] ∈ [--..--] - S_1_S_3_S_1_S_G_0[0..3] ∈ [--..--] - S_2_S_3_S_1_S_G_0[0..3] ∈ [--..--] - S_3_S_3_S_1_S_G_0[0..3] ∈ [--..--] - S_2_S_G_0[0] ∈ {{ NULL ; &S_0_S_2_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_2_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_2_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_2_S_G_0[0] }} - S_0_S_2_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_2_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_2_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_0_S_2_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_0_S_2_S_G_0[0] }} - S_0_S_0_S_2_S_G_0[0..3] ∈ [--..--] - S_1_S_0_S_2_S_G_0[0..3] ∈ [--..--] - S_2_S_0_S_2_S_G_0[0..3] ∈ [--..--] - S_3_S_0_S_2_S_G_0[0..3] ∈ [--..--] - S_1_S_2_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_2_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_2_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_1_S_2_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_1_S_2_S_G_0[0] }} - S_0_S_1_S_2_S_G_0[0..3] ∈ [--..--] - S_1_S_1_S_2_S_G_0[0..3] ∈ [--..--] - S_2_S_1_S_2_S_G_0[0..3] ∈ [--..--] - S_3_S_1_S_2_S_G_0[0..3] ∈ [--..--] - S_2_S_2_S_G_0[0] ∈ {{ NULL ; &S_0_S_2_S_2_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_2_S_2_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_2_S_2_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_2_S_2_S_G_0[0] }} - S_0_S_2_S_2_S_G_0[0..3] ∈ [--..--] - S_1_S_2_S_2_S_G_0[0..3] ∈ [--..--] - S_2_S_2_S_2_S_G_0[0..3] ∈ [--..--] - S_3_S_2_S_2_S_G_0[0..3] ∈ [--..--] - S_3_S_2_S_G_0[0] ∈ {{ NULL ; &S_0_S_3_S_2_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_3_S_2_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_3_S_2_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_3_S_2_S_G_0[0] }} - S_0_S_3_S_2_S_G_0[0..3] ∈ [--..--] - S_1_S_3_S_2_S_G_0[0..3] ∈ [--..--] - S_2_S_3_S_2_S_G_0[0..3] ∈ [--..--] - S_3_S_3_S_2_S_G_0[0..3] ∈ [--..--] - S_3_S_G_0[0] ∈ {{ NULL ; &S_0_S_3_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_3_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_3_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_3_S_G_0[0] }} - S_0_S_3_S_G_0[0] ∈ {{ NULL ; &S_0_S_0_S_3_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_0_S_3_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_0_S_3_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_0_S_3_S_G_0[0] }} - S_0_S_0_S_3_S_G_0[0..3] ∈ [--..--] - S_1_S_0_S_3_S_G_0[0..3] ∈ [--..--] - S_2_S_0_S_3_S_G_0[0..3] ∈ [--..--] - S_3_S_0_S_3_S_G_0[0..3] ∈ [--..--] - S_1_S_3_S_G_0[0] ∈ {{ NULL ; &S_0_S_1_S_3_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_1_S_3_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_1_S_3_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_1_S_3_S_G_0[0] }} - S_0_S_1_S_3_S_G_0[0..3] ∈ [--..--] - S_1_S_1_S_3_S_G_0[0..3] ∈ [--..--] - S_2_S_1_S_3_S_G_0[0..3] ∈ [--..--] - S_3_S_1_S_3_S_G_0[0..3] ∈ [--..--] - S_2_S_3_S_G_0[0] ∈ {{ NULL ; &S_0_S_2_S_3_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_2_S_3_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_2_S_3_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_2_S_3_S_G_0[0] }} - S_0_S_2_S_3_S_G_0[0..3] ∈ [--..--] - S_1_S_2_S_3_S_G_0[0..3] ∈ [--..--] - S_2_S_2_S_3_S_G_0[0..3] ∈ [--..--] - S_3_S_2_S_3_S_G_0[0..3] ∈ [--..--] - S_3_S_3_S_G_0[0] ∈ {{ NULL ; &S_0_S_3_S_3_S_G_0[0] }} - [1] ∈ {{ NULL ; &S_1_S_3_S_3_S_G_0[0] }} - [2] ∈ {{ NULL ; &S_2_S_3_S_3_S_G_0[0] }} - [3] ∈ {{ NULL ; &S_3_S_3_S_3_S_G_0[0] }} - S_0_S_3_S_3_S_G_0[0..3] ∈ [--..--] - S_1_S_3_S_3_S_G_0[0..3] ∈ [--..--] - S_2_S_3_S_3_S_G_0[0..3] ∈ [--..--] - S_3_S_3_S_3_S_G_0[0..3] ∈ [--..--] - S_G1_0[0..3] ∈ [--..--] - S_0_p_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_p_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_G_1[0] ∈ {{ NULL ; &S_0_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_G_1[0] }} + S_0_S_G_1[0] ∈ {{ NULL ; &S_0_S_0_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_0_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_0_S_G_1[0] }} + S_0_S_0_S_G_1[0] ∈ {{ NULL ; &S_0_S_0_S_0_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_0_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_0_S_0_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_0_S_0_S_G_1[0] }} + S_0_S_0_S_0_S_G_1[0..3] ∈ [--..--] + S_1_S_0_S_0_S_G_1[0..3] ∈ [--..--] + S_2_S_0_S_0_S_G_1[0..3] ∈ [--..--] + S_3_S_0_S_0_S_G_1[0..3] ∈ [--..--] + S_1_S_0_S_G_1[0] ∈ {{ NULL ; &S_0_S_1_S_0_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_0_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_1_S_0_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_1_S_0_S_G_1[0] }} + S_0_S_1_S_0_S_G_1[0..3] ∈ [--..--] + S_1_S_1_S_0_S_G_1[0..3] ∈ [--..--] + S_2_S_1_S_0_S_G_1[0..3] ∈ [--..--] + S_3_S_1_S_0_S_G_1[0..3] ∈ [--..--] + S_2_S_0_S_G_1[0] ∈ {{ NULL ; &S_0_S_2_S_0_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_2_S_0_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_2_S_0_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_2_S_0_S_G_1[0] }} + S_0_S_2_S_0_S_G_1[0..3] ∈ [--..--] + S_1_S_2_S_0_S_G_1[0..3] ∈ [--..--] + S_2_S_2_S_0_S_G_1[0..3] ∈ [--..--] + S_3_S_2_S_0_S_G_1[0..3] ∈ [--..--] + S_3_S_0_S_G_1[0] ∈ {{ NULL ; &S_0_S_3_S_0_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_3_S_0_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_3_S_0_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_3_S_0_S_G_1[0] }} + S_0_S_3_S_0_S_G_1[0..3] ∈ [--..--] + S_1_S_3_S_0_S_G_1[0..3] ∈ [--..--] + S_2_S_3_S_0_S_G_1[0..3] ∈ [--..--] + S_3_S_3_S_0_S_G_1[0..3] ∈ [--..--] + S_1_S_G_1[0] ∈ {{ NULL ; &S_0_S_1_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_1_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_1_S_G_1[0] }} + S_0_S_1_S_G_1[0] ∈ {{ NULL ; &S_0_S_0_S_1_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_1_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_0_S_1_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_0_S_1_S_G_1[0] }} + S_0_S_0_S_1_S_G_1[0..3] ∈ [--..--] + S_1_S_0_S_1_S_G_1[0..3] ∈ [--..--] + S_2_S_0_S_1_S_G_1[0..3] ∈ [--..--] + S_3_S_0_S_1_S_G_1[0..3] ∈ [--..--] + S_1_S_1_S_G_1[0] ∈ {{ NULL ; &S_0_S_1_S_1_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_1_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_1_S_1_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_1_S_1_S_G_1[0] }} + S_0_S_1_S_1_S_G_1[0..3] ∈ [--..--] + S_1_S_1_S_1_S_G_1[0..3] ∈ [--..--] + S_2_S_1_S_1_S_G_1[0..3] ∈ [--..--] + S_3_S_1_S_1_S_G_1[0..3] ∈ [--..--] + S_2_S_1_S_G_1[0] ∈ {{ NULL ; &S_0_S_2_S_1_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_2_S_1_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_2_S_1_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_2_S_1_S_G_1[0] }} + S_0_S_2_S_1_S_G_1[0..3] ∈ [--..--] + S_1_S_2_S_1_S_G_1[0..3] ∈ [--..--] + S_2_S_2_S_1_S_G_1[0..3] ∈ [--..--] + S_3_S_2_S_1_S_G_1[0..3] ∈ [--..--] + S_3_S_1_S_G_1[0] ∈ {{ NULL ; &S_0_S_3_S_1_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_3_S_1_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_3_S_1_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_3_S_1_S_G_1[0] }} + S_0_S_3_S_1_S_G_1[0..3] ∈ [--..--] + S_1_S_3_S_1_S_G_1[0..3] ∈ [--..--] + S_2_S_3_S_1_S_G_1[0..3] ∈ [--..--] + S_3_S_3_S_1_S_G_1[0..3] ∈ [--..--] + S_2_S_G_1[0] ∈ {{ NULL ; &S_0_S_2_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_2_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_2_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_2_S_G_1[0] }} + S_0_S_2_S_G_1[0] ∈ {{ NULL ; &S_0_S_0_S_2_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_2_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_0_S_2_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_0_S_2_S_G_1[0] }} + S_0_S_0_S_2_S_G_1[0..3] ∈ [--..--] + S_1_S_0_S_2_S_G_1[0..3] ∈ [--..--] + S_2_S_0_S_2_S_G_1[0..3] ∈ [--..--] + S_3_S_0_S_2_S_G_1[0..3] ∈ [--..--] + S_1_S_2_S_G_1[0] ∈ {{ NULL ; &S_0_S_1_S_2_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_2_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_1_S_2_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_1_S_2_S_G_1[0] }} + S_0_S_1_S_2_S_G_1[0..3] ∈ [--..--] + S_1_S_1_S_2_S_G_1[0..3] ∈ [--..--] + S_2_S_1_S_2_S_G_1[0..3] ∈ [--..--] + S_3_S_1_S_2_S_G_1[0..3] ∈ [--..--] + S_2_S_2_S_G_1[0] ∈ {{ NULL ; &S_0_S_2_S_2_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_2_S_2_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_2_S_2_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_2_S_2_S_G_1[0] }} + S_0_S_2_S_2_S_G_1[0..3] ∈ [--..--] + S_1_S_2_S_2_S_G_1[0..3] ∈ [--..--] + S_2_S_2_S_2_S_G_1[0..3] ∈ [--..--] + S_3_S_2_S_2_S_G_1[0..3] ∈ [--..--] + S_3_S_2_S_G_1[0] ∈ {{ NULL ; &S_0_S_3_S_2_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_3_S_2_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_3_S_2_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_3_S_2_S_G_1[0] }} + S_0_S_3_S_2_S_G_1[0..3] ∈ [--..--] + S_1_S_3_S_2_S_G_1[0..3] ∈ [--..--] + S_2_S_3_S_2_S_G_1[0..3] ∈ [--..--] + S_3_S_3_S_2_S_G_1[0..3] ∈ [--..--] + S_3_S_G_1[0] ∈ {{ NULL ; &S_0_S_3_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_3_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_3_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_3_S_G_1[0] }} + S_0_S_3_S_G_1[0] ∈ {{ NULL ; &S_0_S_0_S_3_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_0_S_3_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_0_S_3_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_0_S_3_S_G_1[0] }} + S_0_S_0_S_3_S_G_1[0..3] ∈ [--..--] + S_1_S_0_S_3_S_G_1[0..3] ∈ [--..--] + S_2_S_0_S_3_S_G_1[0..3] ∈ [--..--] + S_3_S_0_S_3_S_G_1[0..3] ∈ [--..--] + S_1_S_3_S_G_1[0] ∈ {{ NULL ; &S_0_S_1_S_3_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_1_S_3_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_1_S_3_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_1_S_3_S_G_1[0] }} + S_0_S_1_S_3_S_G_1[0..3] ∈ [--..--] + S_1_S_1_S_3_S_G_1[0..3] ∈ [--..--] + S_2_S_1_S_3_S_G_1[0..3] ∈ [--..--] + S_3_S_1_S_3_S_G_1[0..3] ∈ [--..--] + S_2_S_3_S_G_1[0] ∈ {{ NULL ; &S_0_S_2_S_3_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_2_S_3_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_2_S_3_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_2_S_3_S_G_1[0] }} + S_0_S_2_S_3_S_G_1[0..3] ∈ [--..--] + S_1_S_2_S_3_S_G_1[0..3] ∈ [--..--] + S_2_S_2_S_3_S_G_1[0..3] ∈ [--..--] + S_3_S_2_S_3_S_G_1[0..3] ∈ [--..--] + S_3_S_3_S_G_1[0] ∈ {{ NULL ; &S_0_S_3_S_3_S_G_1[0] }} + [1] ∈ {{ NULL ; &S_1_S_3_S_3_S_G_1[0] }} + [2] ∈ {{ NULL ; &S_2_S_3_S_3_S_G_1[0] }} + [3] ∈ {{ NULL ; &S_3_S_3_S_3_S_G_1[0] }} + S_0_S_3_S_3_S_G_1[0..3] ∈ [--..--] + S_1_S_3_S_3_S_G_1[0..3] ∈ [--..--] + S_2_S_3_S_3_S_G_1[0..3] ∈ [--..--] + S_3_S_3_S_3_S_G_1[0..3] ∈ [--..--] + S_G1_1[0..3] ∈ [--..--] + S_0_p_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_p_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED S_2_p_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED S_3_p_ss[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_q_ss_0[0][0] ∈ {{ NULL ; (struct ss *)&S_0_0_S_q_ss_0 }} - [0][1] ∈ {{ NULL ; (struct ss *)&S_1_0_S_q_ss_0 }} - [0][2] ∈ {{ NULL ; (struct ss *)&S_2_0_S_q_ss_0 }} - [0][3] ∈ {{ NULL ; (struct ss *)&S_3_0_S_q_ss_0 }} + S_q_ss_1[0][0] ∈ {{ NULL ; (struct ss *)&S_0_0_S_q_ss_1 }} + [0][1] ∈ {{ NULL ; (struct ss *)&S_1_0_S_q_ss_1 }} + [0][2] ∈ {{ NULL ; (struct ss *)&S_2_0_S_q_ss_1 }} + [0][3] ∈ {{ NULL ; (struct ss *)&S_3_0_S_q_ss_1 }} [0][4..7] ∈ - {{ NULL ; (struct ss *)&S_0_0_S_q_ss_0 ; - (struct ss *)&S_1_0_S_q_ss_0 ; (struct ss *)&S_2_0_S_q_ss_0 ; - (struct ss *)&S_3_0_S_q_ss_0 }} - [1][0] ∈ {{ NULL ; (struct ss *)&S_0_1_S_q_ss_0 }} - [1][1] ∈ {{ NULL ; (struct ss *)&S_1_1_S_q_ss_0 }} - [1][2] ∈ {{ NULL ; (struct ss *)&S_2_1_S_q_ss_0 }} - [1][3] ∈ {{ NULL ; (struct ss *)&S_3_1_S_q_ss_0 }} + {{ NULL ; (struct ss *)&S_0_0_S_q_ss_1 ; + (struct ss *)&S_1_0_S_q_ss_1 ; (struct ss *)&S_2_0_S_q_ss_1 ; + (struct ss *)&S_3_0_S_q_ss_1 }} + [1][0] ∈ {{ NULL ; (struct ss *)&S_0_1_S_q_ss_1 }} + [1][1] ∈ {{ NULL ; (struct ss *)&S_1_1_S_q_ss_1 }} + [1][2] ∈ {{ NULL ; (struct ss *)&S_2_1_S_q_ss_1 }} + [1][3] ∈ {{ NULL ; (struct ss *)&S_3_1_S_q_ss_1 }} [1][4..7] ∈ - {{ NULL ; (struct ss *)&S_0_1_S_q_ss_0 ; - (struct ss *)&S_1_1_S_q_ss_0 ; (struct ss *)&S_2_1_S_q_ss_0 ; - (struct ss *)&S_3_1_S_q_ss_0 }} - [2][0] ∈ {{ NULL ; (struct ss *)&S_0_2_S_q_ss_0 }} - [2][1] ∈ {{ NULL ; (struct ss *)&S_1_2_S_q_ss_0 }} - [2][2] ∈ {{ NULL ; (struct ss *)&S_2_2_S_q_ss_0 }} - [2][3] ∈ {{ NULL ; (struct ss *)&S_3_2_S_q_ss_0 }} + {{ NULL ; (struct ss *)&S_0_1_S_q_ss_1 ; + (struct ss *)&S_1_1_S_q_ss_1 ; (struct ss *)&S_2_1_S_q_ss_1 ; + (struct ss *)&S_3_1_S_q_ss_1 }} + [2][0] ∈ {{ NULL ; (struct ss *)&S_0_2_S_q_ss_1 }} + [2][1] ∈ {{ NULL ; (struct ss *)&S_1_2_S_q_ss_1 }} + [2][2] ∈ {{ NULL ; (struct ss *)&S_2_2_S_q_ss_1 }} + [2][3] ∈ {{ NULL ; (struct ss *)&S_3_2_S_q_ss_1 }} [2][4..7] ∈ - {{ NULL ; (struct ss *)&S_0_2_S_q_ss_0 ; - (struct ss *)&S_1_2_S_q_ss_0 ; (struct ss *)&S_2_2_S_q_ss_0 ; - (struct ss *)&S_3_2_S_q_ss_0 }} - [3][0] ∈ {{ NULL ; (struct ss *)&S_0_3_S_q_ss_0 }} - [3][1] ∈ {{ NULL ; (struct ss *)&S_1_3_S_q_ss_0 }} - [3][2] ∈ {{ NULL ; (struct ss *)&S_2_3_S_q_ss_0 }} - [3][3] ∈ {{ NULL ; (struct ss *)&S_3_3_S_q_ss_0 }} + {{ NULL ; (struct ss *)&S_0_2_S_q_ss_1 ; + (struct ss *)&S_1_2_S_q_ss_1 ; (struct ss *)&S_2_2_S_q_ss_1 ; + (struct ss *)&S_3_2_S_q_ss_1 }} + [3][0] ∈ {{ NULL ; (struct ss *)&S_0_3_S_q_ss_1 }} + [3][1] ∈ {{ NULL ; (struct ss *)&S_1_3_S_q_ss_1 }} + [3][2] ∈ {{ NULL ; (struct ss *)&S_2_3_S_q_ss_1 }} + [3][3] ∈ {{ NULL ; (struct ss *)&S_3_3_S_q_ss_1 }} [3][4..7] ∈ - {{ NULL ; (struct ss *)&S_0_3_S_q_ss_0 ; - (struct ss *)&S_1_3_S_q_ss_0 ; (struct ss *)&S_2_3_S_q_ss_0 ; - (struct ss *)&S_3_3_S_q_ss_0 }} - S_0_0_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_0_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_2_0_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_3_0_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_0_1_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_1_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_2_1_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_3_1_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_0_2_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_2_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_2_2_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_3_2_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_0_3_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_1_3_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_2_3_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED - S_3_3_S_q_ss_0[bits 0 to ..] ∈ [--..--] or UNINITIALIZED -[value] Called Frama_C_show_each_reached_1() -[value] Called Frama_C_show_each_reached_2() + {{ NULL ; (struct ss *)&S_0_3_S_q_ss_1 ; + (struct ss *)&S_1_3_S_q_ss_1 ; (struct ss *)&S_2_3_S_q_ss_1 ; + (struct ss *)&S_3_3_S_q_ss_1 }} + S_0_0_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_0_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_2_0_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_3_0_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_0_1_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_1_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_2_1_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_3_1_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_0_2_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_2_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_2_2_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_3_2_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_0_3_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_1_3_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_2_3_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED + S_3_3_S_q_ss_1[bits 0 to ..] ∈ [--..--] or UNINITIALIZED +tests/value/library.i:74:[value] Frama_C_show_each_reached_1: +tests/value/library.i:78:[value] Frama_C_show_each_reached_2: tests/value/library.i:81:[value] warning: assertion 'Unknown_Invalid' got status unknown. -[value] Called Frama_C_show_each_reached_3() +tests/value/library.i:82:[value] Frama_C_show_each_reached_3: [value] Recording results for main2 [value] done for function main2 [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/library_precond.res.oracle b/tests/value/oracle/library_precond.res.oracle index 56650356ba51ba344886c7d903c389ac795089da..cb905be25575bcf99a2eb5090fa24d8aa9505e79 100644 --- a/tests/value/oracle/library_precond.res.oracle +++ b/tests/value/oracle/library_precond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/library_precond.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,6 +7,7 @@ [value] computing for function mxml <- main. Called from tests/value/library_precond.i:9. [value] using specification for function mxml +tests/value/library_precond.i:5:[value] warning: no 'assigns \result \from ...' clause specified for function mxml tests/value/library_precond.i:3:[value] warning: function mxml: precondition got status invalid. [value] Done for function mxml [value] Recording results for main diff --git a/tests/value/oracle/limits.res.oracle b/tests/value/oracle/limits.res.oracle index b19eebfd8f62603f4e8fc1b1a085bc9249cde87c..3bdad55a4632be3632482a01ca30243884c0a6b5 100644 --- a/tests/value/oracle/limits.res.oracle +++ b/tests/value/oracle/limits.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/limits.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/local.res.oracle b/tests/value/oracle/local.res.oracle index 991640308af89fdd0c323f8a9779785f8643da88..1fb8faa9f31626406a898d855e1114339b47623e 100644 --- a/tests/value/oracle/local.res.oracle +++ b/tests/value/oracle/local.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/local.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -18,6 +17,7 @@ tests/value/local.i:33:[value] warning: locals {a} escaping the scope of f throu tests/value/local.i:33:[value] warning: locals {b} escaping the scope of f through \result<f> [value] computing for function g <- main. Called from tests/value/local.i:34. +tests/value/local.i:12:[value] warning: initialization of volatile variable d ignored [value] computing for function f <- g <- main. Called from tests/value/local.i:13. [value] Recording results for f @@ -30,7 +30,8 @@ tests/value/local.i:14:[value] warning: accessing left-value that contains escap [value] Done for function g tests/value/local.i:34:[value] warning: locals {d} escaping the scope of g through U tests/value/local.i:34:[value] warning: locals {d} escaping the scope of g through \result<g> -[value] DUMPING STATE of file tests/value/local.i line 35 +tests/value/local.i:35:[value] Frama_C_dump_each: + # Cvalue domain: X ∈ ESCAPINGADDR Y ∈ ESCAPINGADDR Z ∈ ESCAPINGADDR @@ -38,7 +39,7 @@ tests/value/local.i:34:[value] warning: locals {d} escaping the scope of g throu U ∈ ESCAPINGADDR V ∈ {0} e ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] computing for function h <- main. Called from tests/value/local.i:36. [value] Recording results for h diff --git a/tests/value/oracle/local_cleanup.res.oracle b/tests/value/oracle/local_cleanup.res.oracle index 82a52f7c2fc64d0f762c245d9b0f9b65ba84812c..1d12c9865e58b64e1c74a2c0752ef5b17728312c 100644 --- a/tests/value/oracle/local_cleanup.res.oracle +++ b/tests/value/oracle/local_cleanup.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/local_cleanup.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,17 +5,26 @@ [value:initial-state] Values of globals at initialization [value] computing for function f <- main. - Called from tests/value/local_cleanup.c:16. + Called from tests/value/local_cleanup.c:20. [value] Recording results for f [value] Done for function f [value] computing for function g <- main. - Called from tests/value/local_cleanup.c:17. + Called from tests/value/local_cleanup.c:21. [value] computing for function f <- g <- main. - Called from tests/value/local_cleanup.c:11. + Called from tests/value/local_cleanup.c:15. [value] Recording results for f [value] Done for function f [value] Recording results for g [value] Done for function g +[value] computing for function h <- main. + Called from tests/value/local_cleanup.c:22. +[value] Recording results for h +[value] Done for function h +tests/value/local_cleanup.c:23:[value] Frama_C_dump_each: + # Cvalue domain: + lmain[0] ∈ UNINITIALIZED + [1] ∈ {12} + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -28,6 +36,8 @@ [value:final-states] Values at end of function g: t[0] ∈ UNINITIALIZED [1] ∈ {12} +[value:final-states] Values at end of function h: + x ∈ {1} [value:final-states] Values at end of function main: lmain[0] ∈ UNINITIALIZED [1] ∈ {12} @@ -35,7 +45,11 @@ [from] Done for function f [from] Computing for function g [from] Done for function g +[from] Computing for function h +[from] Done for function h [from] Computing for function main +[from] Computing for function Frama_C_dump_each <-main +[from] Done for function Frama_C_dump_each [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: @@ -44,6 +58,8 @@ lmain[1] FROM p (and SELF) [from] Function g: lmain[1] FROM \nothing (and SELF) +[from] Function h: + \result FROM \nothing [from] Function main: NO EFFECTS [from] ====== END OF DEPENDENCIES ====== @@ -55,6 +71,10 @@ t[1] [inout] Inputs for function g: \nothing +[inout] Out (internal) for function h: + x; y +[inout] Inputs for function h: + \nothing [inout] Out (internal) for function main: lmain[1] [inout] Inputs for function main: diff --git a/tests/value/oracle/local_slevel.res.oracle b/tests/value/oracle/local_slevel.res.oracle index 66889335241f00e0a10e83dcb93dd437a0639f92..e45e1d741c4ccb892d581ef44bab63b64fcec4eb 100644 --- a/tests/value/oracle/local_slevel.res.oracle +++ b/tests/value/oracle/local_slevel.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/local_slevel.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,126 +9,126 @@ [value] computing for function main1 <- main. Called from tests/value/local_slevel.i:47. tests/value/local_slevel.i:10:[value] entering loop for the first time -[value] Called Frama_C_show_each({-1}, {0}, {0}) -[value] Called Frama_C_show_each({1}, {1}, {0; 1}) -[value] Called Frama_C_show_each({-1}, {0}, {0; 1}) -[value] Called Frama_C_show_each({1}, {1}, {0; 1; 2}) -[value] Called Frama_C_show_each({-1}, {0; 2}, {0; 1; 2}) -[value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3}) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, {0; 1; 2; 3}) -[value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483647]) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483647]) -[value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483648]) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483648]) -[value] Called Frama_C_show_each({1}, [1..79],1%2, [0..4294967295]) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..4294967295]) +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0; 1} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1; 2} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0; 2}, {0; 1; 2} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, {0; 1; 2; 3} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3; 4} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, {0; 1; 2; 3; 4} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483647] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483647] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483648] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483648] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..4294967295] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..4294967295] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/local_slevel.i:48. -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({2}) -[value] Called Frama_C_show_each({3}) -[value] Called Frama_C_show_each({4}) -[value] Called Frama_C_show_each({5}) -[value] Called Frama_C_show_each({6}) -[value] Called Frama_C_show_each({7}) -[value] Called Frama_C_show_each({8}) -[value] Called Frama_C_show_each({9}) -[value] Called Frama_C_show_each({10}) -[value] Called Frama_C_show_each({11}) -[value] Called Frama_C_show_each({12}) -[value] Called Frama_C_show_each({13}) -[value] Called Frama_C_show_each({14}) -[value] Called Frama_C_show_each({15}) -[value] Called Frama_C_show_each({16}) -[value] Called Frama_C_show_each({17}) -[value] Called Frama_C_show_each({18}) -[value] Called Frama_C_show_each({19}) -[value] Called Frama_C_show_each({20}) -[value] Called Frama_C_show_each({21}) -[value] Called Frama_C_show_each({22}) -[value] Called Frama_C_show_each({23}) -[value] Called Frama_C_show_each({24}) -[value] Called Frama_C_show_each({25}) -[value] Called Frama_C_show_each({26}) -[value] Called Frama_C_show_each({27}) -[value] Called Frama_C_show_each({28}) -[value] Called Frama_C_show_each({29}) -[value] Called Frama_C_show_each({30}) -[value] Called Frama_C_show_each({31}) -[value] Called Frama_C_show_each({32}) -[value] Called Frama_C_show_each({33}) -[value] Called Frama_C_show_each({34}) -[value] Called Frama_C_show_each({35}) -[value] Called Frama_C_show_each({36}) -[value] Called Frama_C_show_each({37}) -[value] Called Frama_C_show_each({38}) -[value] Called Frama_C_show_each({39}) -[value] Called Frama_C_show_each({40}) -[value] Called Frama_C_show_each({41}) -[value] Called Frama_C_show_each({42}) -[value] Called Frama_C_show_each({43}) -[value] Called Frama_C_show_each({44}) -[value] Called Frama_C_show_each({45}) -[value] Called Frama_C_show_each({46}) -[value] Called Frama_C_show_each({47}) -[value] Called Frama_C_show_each({48}) -[value] Called Frama_C_show_each({49}) +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {0} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {1} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {2} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {3} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {4} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {5} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {6} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {7} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {8} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {9} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {10} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {11} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {12} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {13} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {14} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {15} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {16} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {17} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {18} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {19} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {20} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {21} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {22} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {23} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {24} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {25} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {26} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {27} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {28} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {29} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {30} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {31} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {32} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {33} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {34} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {35} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {36} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {37} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {38} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {39} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {40} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {41} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {42} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {43} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {44} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {45} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {46} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {47} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {48} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {49} [value] Semantic level unrolling superposing up to 100 states -[value] Called Frama_C_show_each({50}) -[value] Called Frama_C_show_each({51}) -[value] Called Frama_C_show_each({52}) -[value] Called Frama_C_show_each({53}) -[value] Called Frama_C_show_each({54}) -[value] Called Frama_C_show_each({55}) -[value] Called Frama_C_show_each({56}) -[value] Called Frama_C_show_each({57}) -[value] Called Frama_C_show_each({58}) -[value] Called Frama_C_show_each({59}) -[value] Called Frama_C_show_each({60}) -[value] Called Frama_C_show_each({61}) -[value] Called Frama_C_show_each({62}) -[value] Called Frama_C_show_each({63}) -[value] Called Frama_C_show_each({64}) -[value] Called Frama_C_show_each({65}) -[value] Called Frama_C_show_each({66}) -[value] Called Frama_C_show_each({67}) -[value] Called Frama_C_show_each({68}) -[value] Called Frama_C_show_each({69}) -[value] Called Frama_C_show_each({70}) -[value] Called Frama_C_show_each({71}) -[value] Called Frama_C_show_each({72}) -[value] Called Frama_C_show_each({73}) -[value] Called Frama_C_show_each({74}) -[value] Called Frama_C_show_each({75}) -[value] Called Frama_C_show_each({76}) -[value] Called Frama_C_show_each({77}) -[value] Called Frama_C_show_each({78}) -[value] Called Frama_C_show_each({79}) -[value] Called Frama_C_show_each({80}) -[value] Called Frama_C_show_each({81}) -[value] Called Frama_C_show_each({82}) -[value] Called Frama_C_show_each({83}) -[value] Called Frama_C_show_each({84}) -[value] Called Frama_C_show_each({85}) -[value] Called Frama_C_show_each({86}) -[value] Called Frama_C_show_each({87}) -[value] Called Frama_C_show_each({88}) -[value] Called Frama_C_show_each({89}) -[value] Called Frama_C_show_each({90}) -[value] Called Frama_C_show_each({91}) -[value] Called Frama_C_show_each({92}) -[value] Called Frama_C_show_each({93}) -[value] Called Frama_C_show_each({94}) -[value] Called Frama_C_show_each({95}) -[value] Called Frama_C_show_each({96}) -[value] Called Frama_C_show_each({97}) -[value] Called Frama_C_show_each({98}) -[value] Called Frama_C_show_each({99}) +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {50} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {51} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {52} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {53} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {54} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {55} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {56} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {57} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {58} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {59} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {60} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {61} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {62} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {63} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {64} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {65} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {66} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {67} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {68} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {69} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {70} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {71} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {72} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {73} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {74} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {75} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {76} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {77} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {78} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {79} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {80} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {81} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {82} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {83} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {84} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {85} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {86} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {87} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {88} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {89} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {90} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {91} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {92} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {93} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {94} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {95} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {96} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {97} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {98} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {99} [value] Semantic level unrolling superposing up to 200 states [value] Recording results for main2 [value] Done for function main2 @@ -180,11 +179,9 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main1(void) { int v; - unsigned int r; - r = (unsigned int)0; + unsigned int r = (unsigned int)0; { - int i; - i = 0; + int i = 0; while (i < 80) { /*@ ensures \true; slevel 50; @@ -202,8 +199,7 @@ void main1(void) void g(void) { - int i; - i = 0; + int i = 0; if (! (i < 5)) goto unrolling_2_loop; i ++; unrolling_3_loop: ; @@ -218,13 +214,11 @@ int t[100]; int volatile vol; void main2(void) { - int i; - i = 0; + int i = 0; while (i < 100) { { - int n; Frama_C_show_each(i); - n = vol; + int n = vol; if (n >= 3) t[i] = n; else t[i] = (n + (1 << 30)) + 1; /*@ slevel merge; */ ; } @@ -251,11 +245,9 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main1(void) { int v; - unsigned int r; - r = 0U; + unsigned int r = 0U; { - int i; - i = 0; + int i = 0; while (i < 80) { /*@ ensures \true; slevel 50; @@ -273,8 +265,7 @@ void main1(void) void g(void) { - int i; - i = 0; + int i = 0; if (! (i < 5)) goto unrolling_2_loop; i ++; unrolling_3_loop: ; @@ -289,13 +280,11 @@ int t[100]; int volatile vol; void main2(void) { - int i; - i = 0; + int i = 0; while (i < 100) { { - int n; Frama_C_show_each(i); - n = vol; + int n = vol; if (n >= 3) t[i] = n; else t[i] = (n + 1073741824) + 1; /*@ slevel merge; */ ; } @@ -322,11 +311,9 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main1(void) { int v; - unsigned int r; - r = (unsigned int)0; + unsigned int r = (unsigned int)0; { - int i; - i = 0; + int i = 0; while (i < 80) { /*@ ensures \true; slevel 50; @@ -344,8 +331,7 @@ void main1(void) void g(void) { - int i; - i = 0; + int i = 0; if (! (i < 5)) goto unrolling_2_loop; i ++; unrolling_3_loop: ; @@ -360,13 +346,11 @@ int t[100]; int volatile vol; void main2(void) { - int i; - i = 0; + int i = 0; while (i < 100) { { - int n; Frama_C_show_each(i); - n = vol; + int n = vol; if (n >= 3) t[i] = n; else t[i] = (n + (1 << 30)) + 1; /*@ slevel merge; */ ; } @@ -393,126 +377,126 @@ void main(void) [value] computing for function main1 <- main. Called from tests/value/local_slevel.i:47. tests/value/local_slevel.i:10:[value] entering loop for the first time -[value] Called Frama_C_show_each({-1}, {0}, {0}) -[value] Called Frama_C_show_each({1}, {1}, {0; 1}) -[value] Called Frama_C_show_each({-1}, {0}, {0; 1}) -[value] Called Frama_C_show_each({1}, {1}, {0; 1; 2}) -[value] Called Frama_C_show_each({-1}, {0; 2}, {0; 1; 2}) -[value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3}) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, {0; 1; 2; 3}) -[value] Called Frama_C_show_each({1}, [1..79],1%2, {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483647]) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483647]) -[value] Called Frama_C_show_each({1}, [1..79],1%2, [0..2147483648]) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..2147483648]) -[value] Called Frama_C_show_each({1}, [1..79],1%2, [0..4294967295]) -[value] Called Frama_C_show_each({-1}, [0..78],0%2, [0..4294967295]) +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0}, {0; 1} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, {1}, {0; 1; 2} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, {0; 2}, {0; 1; 2} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, {0; 1; 2; 3} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, {0; 1; 2; 3; 4} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, {0; 1; 2; 3; 4} +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483647] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483647] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..2147483648] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..2147483648] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {1}, [1..79],1%2, [0..4294967295] +tests/value/local_slevel.i:17:[value] Frama_C_show_each: {-1}, [0..78],0%2, [0..4294967295] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/local_slevel.i:48. -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({1}) -[value] Called Frama_C_show_each({2}) -[value] Called Frama_C_show_each({3}) -[value] Called Frama_C_show_each({4}) -[value] Called Frama_C_show_each({5}) -[value] Called Frama_C_show_each({6}) -[value] Called Frama_C_show_each({7}) -[value] Called Frama_C_show_each({8}) -[value] Called Frama_C_show_each({9}) -[value] Called Frama_C_show_each({10}) -[value] Called Frama_C_show_each({11}) -[value] Called Frama_C_show_each({12}) -[value] Called Frama_C_show_each({13}) -[value] Called Frama_C_show_each({14}) -[value] Called Frama_C_show_each({15}) -[value] Called Frama_C_show_each({16}) -[value] Called Frama_C_show_each({17}) -[value] Called Frama_C_show_each({18}) -[value] Called Frama_C_show_each({19}) -[value] Called Frama_C_show_each({20}) -[value] Called Frama_C_show_each({21}) -[value] Called Frama_C_show_each({22}) -[value] Called Frama_C_show_each({23}) -[value] Called Frama_C_show_each({24}) -[value] Called Frama_C_show_each({25}) -[value] Called Frama_C_show_each({26}) -[value] Called Frama_C_show_each({27}) -[value] Called Frama_C_show_each({28}) -[value] Called Frama_C_show_each({29}) -[value] Called Frama_C_show_each({30}) -[value] Called Frama_C_show_each({31}) -[value] Called Frama_C_show_each({32}) -[value] Called Frama_C_show_each({33}) -[value] Called Frama_C_show_each({34}) -[value] Called Frama_C_show_each({35}) -[value] Called Frama_C_show_each({36}) -[value] Called Frama_C_show_each({37}) -[value] Called Frama_C_show_each({38}) -[value] Called Frama_C_show_each({39}) -[value] Called Frama_C_show_each({40}) -[value] Called Frama_C_show_each({41}) -[value] Called Frama_C_show_each({42}) -[value] Called Frama_C_show_each({43}) -[value] Called Frama_C_show_each({44}) -[value] Called Frama_C_show_each({45}) -[value] Called Frama_C_show_each({46}) -[value] Called Frama_C_show_each({47}) -[value] Called Frama_C_show_each({48}) -[value] Called Frama_C_show_each({49}) +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {0} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {1} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {2} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {3} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {4} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {5} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {6} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {7} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {8} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {9} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {10} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {11} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {12} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {13} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {14} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {15} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {16} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {17} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {18} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {19} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {20} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {21} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {22} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {23} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {24} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {25} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {26} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {27} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {28} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {29} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {30} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {31} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {32} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {33} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {34} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {35} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {36} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {37} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {38} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {39} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {40} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {41} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {42} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {43} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {44} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {45} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {46} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {47} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {48} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {49} [value] Semantic level unrolling superposing up to 100 states -[value] Called Frama_C_show_each({50}) -[value] Called Frama_C_show_each({51}) -[value] Called Frama_C_show_each({52}) -[value] Called Frama_C_show_each({53}) -[value] Called Frama_C_show_each({54}) -[value] Called Frama_C_show_each({55}) -[value] Called Frama_C_show_each({56}) -[value] Called Frama_C_show_each({57}) -[value] Called Frama_C_show_each({58}) -[value] Called Frama_C_show_each({59}) -[value] Called Frama_C_show_each({60}) -[value] Called Frama_C_show_each({61}) -[value] Called Frama_C_show_each({62}) -[value] Called Frama_C_show_each({63}) -[value] Called Frama_C_show_each({64}) -[value] Called Frama_C_show_each({65}) -[value] Called Frama_C_show_each({66}) -[value] Called Frama_C_show_each({67}) -[value] Called Frama_C_show_each({68}) -[value] Called Frama_C_show_each({69}) -[value] Called Frama_C_show_each({70}) -[value] Called Frama_C_show_each({71}) -[value] Called Frama_C_show_each({72}) -[value] Called Frama_C_show_each({73}) -[value] Called Frama_C_show_each({74}) -[value] Called Frama_C_show_each({75}) -[value] Called Frama_C_show_each({76}) -[value] Called Frama_C_show_each({77}) -[value] Called Frama_C_show_each({78}) -[value] Called Frama_C_show_each({79}) -[value] Called Frama_C_show_each({80}) -[value] Called Frama_C_show_each({81}) -[value] Called Frama_C_show_each({82}) -[value] Called Frama_C_show_each({83}) -[value] Called Frama_C_show_each({84}) -[value] Called Frama_C_show_each({85}) -[value] Called Frama_C_show_each({86}) -[value] Called Frama_C_show_each({87}) -[value] Called Frama_C_show_each({88}) -[value] Called Frama_C_show_each({89}) -[value] Called Frama_C_show_each({90}) -[value] Called Frama_C_show_each({91}) -[value] Called Frama_C_show_each({92}) -[value] Called Frama_C_show_each({93}) -[value] Called Frama_C_show_each({94}) -[value] Called Frama_C_show_each({95}) -[value] Called Frama_C_show_each({96}) -[value] Called Frama_C_show_each({97}) -[value] Called Frama_C_show_each({98}) -[value] Called Frama_C_show_each({99}) +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {50} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {51} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {52} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {53} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {54} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {55} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {56} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {57} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {58} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {59} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {60} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {61} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {62} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {63} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {64} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {65} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {66} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {67} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {68} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {69} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {70} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {71} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {72} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {73} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {74} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {75} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {76} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {77} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {78} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {79} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {80} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {81} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {82} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {83} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {84} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {85} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {86} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {87} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {88} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {89} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {90} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {91} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {92} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {93} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {94} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {95} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {96} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {97} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {98} +tests/value/local_slevel.i:36:[value] Frama_C_show_each: {99} [value] Semantic level unrolling superposing up to 200 states [value] Recording results for main2 [value] Done for function main2 diff --git a/tests/value/oracle/local_variables.res.oracle b/tests/value/oracle/local_variables.res.oracle index bb3aeffbaf8e2f27d5b212b526a3c41d7062d1ab..c7c0069d1a56a249775a9c57ff906345a4982dd2 100644 --- a/tests/value/oracle/local_variables.res.oracle +++ b/tests/value/oracle/local_variables.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/local_variables.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/lock.res.oracle b/tests/value/oracle/lock.res.oracle index 0aff38815e8c071563ed3d8b698e96fcb019ee53..008cf26454c03edd8ca01f974b626774bf1b818e 100644 --- a/tests/value/oracle/lock.res.oracle +++ b/tests/value/oracle/lock.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/lock.i (no preprocessing) [value] Analyzing a complete application starting at locks0_good [value] Computing initial state @@ -11,15 +10,13 @@ tests/value/lock.i:48:[value] warning: function locks0_good: precondition got st Called from tests/value/lock.i:51. [value] using specification for function acquire_lock tests/value/lock.i:19:[value] warning: function acquire_lock: precondition got status unknown. -tests/value/lock.i:21:[value] warning: no \from part for clause 'assigns ghost_loctable[0 .. 99];' of - function acquire_lock +tests/value/lock.i:21:[value] warning: no \from part for clause 'assigns ghost_loctable[0 .. 99];' [value] Done for function acquire_lock [value] computing for function release_lock <- locks0_good. Called from tests/value/lock.i:52. [value] using specification for function release_lock tests/value/lock.i:27:[value] warning: function release_lock: precondition got status unknown. -tests/value/lock.i:29:[value] warning: no \from part for clause 'assigns ghost_loctable[..];' of - function release_lock +tests/value/lock.i:29:[value] warning: no \from part for clause 'assigns ghost_loctable[..];' [value] Done for function release_lock [value] Recording results for locks0_good [value] done for function locks0_good diff --git a/tests/value/oracle/logic.res.oracle b/tests/value/oracle/logic.res.oracle index 92c44a4c5143265b4840e91a271280e5d0e8c9af..0f13efced2b897353b2bbcc801b37719054fe11a 100644 --- a/tests/value/oracle/logic.res.oracle +++ b/tests/value/oracle/logic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/logic.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,7 +12,7 @@ v ∈ [--..--] [value] computing for function eq_tsets <- main. Called from tests/value/logic.c:155. -tests/value/logic.c:7:[value] cannot evaluate ACSL term, unsupported ACSL construct: == operation on non-supported type set<_#2> +tests/value/logic.c:7:[value] cannot evaluate ACSL term, unsupported ACSL construct: == operation on non-supported type set<_#1> tests/value/logic.c:7:[value] warning: assertion got status unknown. tests/value/logic.c:9:[value] assertion got status valid. tests/value/logic.c:10:[value] warning: assertion got status unknown. @@ -51,7 +50,7 @@ tests/value/logic.c:47:[value] warning: assertion got status unknown. [value] Done for function eq_tsets [value] computing for function eq_char <- main. Called from tests/value/logic.c:156. -[value] Called Frama_C_show_each({-126}) +tests/value/logic.c:53:[value] Frama_C_show_each: {-126} tests/value/logic.c:54:[value] assertion got status valid. tests/value/logic.c:55:[value] assertion got status valid. [value] Recording results for eq_char @@ -85,24 +84,24 @@ tests/value/logic.c:78:[value] warning: assertion got status unknown. Called from tests/value/logic.c:160. tests/value/logic.c:86:[value] warning: assertion 'ASSUME' got status unknown. tests/value/logic.c:88:[value] warning: assertion 'UNK' got status unknown. -[value] Called Frama_C_show_each({-1; 1}) +tests/value/logic.c:89:[value] Frama_C_show_each: {-1; 1} tests/value/logic.c:90:[value] warning: assertion 'UNK' got status unknown. -[value] Called Frama_C_show_each({-1; 1}) +tests/value/logic.c:91:[value] Frama_C_show_each: {-1; 1} tests/value/logic.c:93:[value] warning: assertion 'ASSUME' got status unknown. tests/value/logic.c:94:[value] assertion 'OK' got status valid. -[value] Called Frama_C_show_each({1}) +tests/value/logic.c:95:[value] Frama_C_show_each: {1} tests/value/logic.c:96:[value] assertion 'OK' got status valid. -[value] Called Frama_C_show_each({1}) +tests/value/logic.c:97:[value] Frama_C_show_each: {1} tests/value/logic.c:101:[value] warning: assertion 'ASSUME' got status unknown. tests/value/logic.c:102:[value] warning: assertion 'UNK' got status unknown. -[value] Called Frama_C_show_each({0; 1}) +tests/value/logic.c:103:[value] Frama_C_show_each: {0; 1} tests/value/logic.c:104:[value] warning: assertion 'UNK' got status unknown. -[value] Called Frama_C_show_each({0; 1}) +tests/value/logic.c:105:[value] Frama_C_show_each: {0; 1} tests/value/logic.c:107:[value] warning: assertion 'ASSUME' got status unknown. tests/value/logic.c:108:[value] assertion 'OK' got status valid. -[value] Called Frama_C_show_each({1}) +tests/value/logic.c:109:[value] Frama_C_show_each: {1} tests/value/logic.c:110:[value] assertion 'OK' got status valid. -[value] Called Frama_C_show_each({1}) +tests/value/logic.c:111:[value] Frama_C_show_each: {1} [value] Recording results for alarms [value] Done for function alarms [value] computing for function cond_in_lval <- main. @@ -135,6 +134,7 @@ tests/value/logic.c:150:[value] warning: assertion got status unknown. [value] Done for function cond_in_lval [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 4 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function alarms: x_0 ∈ {1} diff --git a/tests/value/oracle/logic_ptr_cast.res.oracle b/tests/value/oracle/logic_ptr_cast.res.oracle index 82030b85cb882f582184bc2a626a4d981cfbee7a..07e22554e3ac4557baa84938954c50d63d9ab7b7 100644 --- a/tests/value/oracle/logic_ptr_cast.res.oracle +++ b/tests/value/oracle/logic_ptr_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/logic_ptr_cast.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,13 +8,15 @@ tests/value/logic_ptr_cast.i:8:[value] Assigning imprecise value to p. The imprecision originates from Arithmetic {tests/value/logic_ptr_cast.i:8} tests/value/logic_ptr_cast.i:9:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({{ &t + {0; 1; 2; 3; 4; 5; 6; 7} }}) +tests/value/logic_ptr_cast.i:14:[value] Frama_C_show_each: {{ &t + {0; 1; 2; 3; 4; 5; 6; 7} }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== /* Generated by Frama-C */ int *p; int t[90]; +/*@ assigns \result; + assigns \result \from \nothing; */ extern int ( /* missing proto */ Frama_C_show_each)(); int main(void) diff --git a/tests/value/oracle/logicdeps.res.oracle b/tests/value/oracle/logicdeps.res.oracle index 69ceb1afd995329857d8a92a12dd42fa277ab394..678653efb35436f0a974b1434c7d091c85bc79f4 100644 --- a/tests/value/oracle/logicdeps.res.oracle +++ b/tests/value/oracle/logicdeps.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/logicdeps.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/long.res.oracle b/tests/value/oracle/long.res.oracle index 97957a769d5be944a7da24750f6640f9868a5066..ea90b622c1b6fed293107c84d68dc72ad9d7e2fc 100644 --- a/tests/value/oracle/long.res.oracle +++ b/tests/value/oracle/long.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/long.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/long_const.0.res.oracle b/tests/value/oracle/long_const.0.res.oracle index 5af3488cbda6fc4852ffc29d219dc836295fdf5b..8b027d0ce673dd040d66e244d87137fbf3df8767 100644 --- a/tests/value/oracle/long_const.0.res.oracle +++ b/tests/value/oracle/long_const.0.res.oracle @@ -1,11 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/long_const.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each_f({4}, {18446603611099103232}, {0}) +tests/value/long_const.i:35:[value] Frama_C_show_each_f: {4}, {18446603611099103232}, {0} [value] computing for function div64 <- main. Called from tests/value/long_const.i:37. tests/value/long_const.i:11:[value] warning: function div64: precondition got status unknown. @@ -18,10 +17,11 @@ tests/value/long_const.i:12:[value] warning: function div64: precondition got st Called from tests/value/long_const.i:25. [value] Recording results for LL_ABS [value] Done for function LL_ABS -[value] Called Frama_C_show_each([-9223372036854775807..9223372036854775807], - [0..9223372036854775807], - [-9223372036854775807..9223372036854775807], - [0..9223372036854775807]) +tests/value/long_const.i:26:[value] Frama_C_show_each: + [-9223372036854775807..9223372036854775807], + [0..9223372036854775807], + [-9223372036854775807..9223372036854775807], + [0..9223372036854775807] [value] Recording results for div64 [value] Done for function div64 [value] Recording results for main diff --git a/tests/value/oracle/long_const.1.res.oracle b/tests/value/oracle/long_const.1.res.oracle index 5af3488cbda6fc4852ffc29d219dc836295fdf5b..8b027d0ce673dd040d66e244d87137fbf3df8767 100644 --- a/tests/value/oracle/long_const.1.res.oracle +++ b/tests/value/oracle/long_const.1.res.oracle @@ -1,11 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/long_const.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each_f({4}, {18446603611099103232}, {0}) +tests/value/long_const.i:35:[value] Frama_C_show_each_f: {4}, {18446603611099103232}, {0} [value] computing for function div64 <- main. Called from tests/value/long_const.i:37. tests/value/long_const.i:11:[value] warning: function div64: precondition got status unknown. @@ -18,10 +17,11 @@ tests/value/long_const.i:12:[value] warning: function div64: precondition got st Called from tests/value/long_const.i:25. [value] Recording results for LL_ABS [value] Done for function LL_ABS -[value] Called Frama_C_show_each([-9223372036854775807..9223372036854775807], - [0..9223372036854775807], - [-9223372036854775807..9223372036854775807], - [0..9223372036854775807]) +tests/value/long_const.i:26:[value] Frama_C_show_each: + [-9223372036854775807..9223372036854775807], + [0..9223372036854775807], + [-9223372036854775807..9223372036854775807], + [0..9223372036854775807] [value] Recording results for div64 [value] Done for function div64 [value] Recording results for main diff --git a/tests/value/oracle/loop.res.oracle b/tests/value/oracle/loop.res.oracle index 0fbad08d910b43d793650a753a925f77da484538..6f702c004e632dbf5e03cafb4a043f647b132065 100644 --- a/tests/value/oracle/loop.res.oracle +++ b/tests/value/oracle/loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,12 +10,12 @@ r ∈ {0} G ∈ {0} tests/value/loop.i:7:[value] entering loop for the first time -[value] Called Frama_C_show_each_F({0}) -[value] Called Frama_C_show_each_F({0; 2}) -[value] Called Frama_C_show_each_F({0; 2; 4}) -[value] Called Frama_C_show_each_F([0..48],0%2) -[value] Called Frama_C_show_each_F([0..48],0%2) -[value] Called Frama_C_show_each_F([0..48],0%2) +tests/value/loop.i:8:[value] Frama_C_show_each_F: {0} +tests/value/loop.i:8:[value] Frama_C_show_each_F: {0; 2} +tests/value/loop.i:8:[value] Frama_C_show_each_F: {0; 2; 4} +tests/value/loop.i:8:[value] Frama_C_show_each_F: [0..48],0%2 +tests/value/loop.i:8:[value] Frama_C_show_each_F: [0..48],0%2 +tests/value/loop.i:8:[value] Frama_C_show_each_F: [0..48],0%2 tests/value/loop.i:9:[value] warning: signed overflow. assert i_0 + r ≤ 2147483647; [value] Recording results for main [value] done for function main diff --git a/tests/value/oracle/loop1.res.oracle b/tests/value/oracle/loop1.res.oracle index 2e5e55c3f6b57285587eb35a7c5e88012ee1de5a..3fa598168098fa52252171b338e0dcc4f34ebabc 100644 --- a/tests/value/oracle/loop1.res.oracle +++ b/tests/value/oracle/loop1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,14 +8,18 @@ [2..99] ∈ {0} NULL_GLOBAL_LOOSING_BITS_ONE_BY_ONE ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/loop1.i:22. + Called from tests/value/loop1.i:25. tests/value/loop1.i:5:[value] entering loop for the first time +tests/value/loop1.i:8:[value] cannot evaluate ACSL term, no environment to evaluate \at(_,LoopCurrent) +tests/value/loop1.i:8:[value] warning: assertion got status unknown. +tests/value/loop1.i:9:[value] cannot evaluate ACSL term, no environment to evaluate \at(_,LoopEntry) +tests/value/loop1.i:9:[value] warning: assertion got status unknown. [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/loop1.i:23. -tests/value/loop1.i:14:[value] entering loop for the first time -tests/value/loop1.i:16:[value] warning: accessing out of bounds index. assert i < 100; + Called from tests/value/loop1.i:26. +tests/value/loop1.i:17:[value] entering loop for the first time +tests/value/loop1.i:19:[value] warning: accessing out of bounds index. assert i < 100; [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main diff --git a/tests/value/oracle/loop2.res.oracle b/tests/value/oracle/loop2.res.oracle index 052ce6d2b5a7436582fea1325a80571acbee77a3..df0ce687b9764732120e0314a0c2d8d666efc696 100644 --- a/tests/value/oracle/loop2.res.oracle +++ b/tests/value/oracle/loop2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop3.res.oracle b/tests/value/oracle/loop3.res.oracle index 4303b1f4ec09f7b87d7f8be6cf9667a99d7d2c43..7bdccdde65f129dd21c58ba718f7584a1241c1c2 100644 --- a/tests/value/oracle/loop3.res.oracle +++ b/tests/value/oracle/loop3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop3.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop_array.res.oracle b/tests/value/oracle/loop_array.res.oracle index d47a0afb25ef31935d3a13c6bdd23d2786799c2b..982f5d0f87d994748aa24a7e4e1cbbf32c5b98f7 100644 --- a/tests/value/oracle/loop_array.res.oracle +++ b/tests/value/oracle/loop_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_array.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop_join.res.oracle b/tests/value/oracle/loop_join.res.oracle index db48b9c75b05bb351e100516ad898a2eb5425834..7602c92c9c71c6199ceabe48141f4fa08459be29 100644 --- a/tests/value/oracle/loop_join.res.oracle +++ b/tests/value/oracle/loop_join.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_join.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop_long.res.oracle b/tests/value/oracle/loop_long.res.oracle index 098a0e11f47f3f2b3b16ede36d1879d02bf5b1df..d529299148a1fd22d3b5d95aa714a8041ad61d58 100644 --- a/tests/value/oracle/loop_long.res.oracle +++ b/tests/value/oracle/loop_long.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_long.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop_no_var.res.oracle b/tests/value/oracle/loop_no_var.res.oracle index 1b2b3f5e4214ef4e4484b15811b927b263c8f508..a5b5769c1f35a56cf3f1aaf1ec968f522ab34e8c 100644 --- a/tests/value/oracle/loop_no_var.res.oracle +++ b/tests/value/oracle/loop_no_var.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_no_var.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop_simple.res.oracle b/tests/value/oracle/loop_simple.res.oracle index 288e96b5496792a695a1fd80260072c66526b11c..50777294d5e84fa5abc53c65ccd11a4ae0b2b944 100644 --- a/tests/value/oracle/loop_simple.res.oracle +++ b/tests/value/oracle/loop_simple.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_simple.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/loop_test.0.res.oracle b/tests/value/oracle/loop_test.0.res.oracle index 84e22bdca8dbbc1f9921141b1973270161f43838..55ea3d12a4d71e00f5e51189e3f9ec0f39a0fa88 100644 --- a/tests/value/oracle/loop_test.0.res.oracle +++ b/tests/value/oracle/loop_test.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_test.i (no preprocessing) [value] Analyzing a complete application starting at test_onzes [value] Computing initial state diff --git a/tests/value/oracle/loop_test.1.res.oracle b/tests/value/oracle/loop_test.1.res.oracle index 66e2f70f6ef0f743feafdcc124fd31f8b8c155a6..e99dc136551f90e54dc5a9d0145069ca8e4a44b6 100644 --- a/tests/value/oracle/loop_test.1.res.oracle +++ b/tests/value/oracle/loop_test.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_test.i (no preprocessing) [value] Analyzing a complete application starting at test_cent_onzes [value] Computing initial state diff --git a/tests/value/oracle/loop_wvar.0.res.oracle b/tests/value/oracle/loop_wvar.0.res.oracle index 4e581a3d66623a72b8ea161442cacfa4ce666b20..505ac81bd54c9afab2f1d686b2a2da73beb00618 100644 --- a/tests/value/oracle/loop_wvar.0.res.oracle +++ b/tests/value/oracle/loop_wvar.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_wvar.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,7 +12,6 @@ tests/value/loop_wvar.i:16:[value] entering loop for the first time n ∈ {13} i ∈ [13..2147483647] j ∈ [7..55],3%4 or UNINITIALIZED -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_wvar.i (no preprocessing) tests/value/loop_wvar.i:38:[kernel] warning: invalid pragma '12'. Ignoring loop annotation [value] Analyzing a complete application starting at main diff --git a/tests/value/oracle/loop_wvar.1.res.oracle b/tests/value/oracle/loop_wvar.1.res.oracle index 8e92ffad9b85e7293b38b20b8ab4b0ba979941ca..8d0d3d7a1140e555a5ebb2830084f7312b7091ea 100644 --- a/tests/value/oracle/loop_wvar.1.res.oracle +++ b/tests/value/oracle/loop_wvar.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_wvar.i (no preprocessing) tests/value/loop_wvar.i:38:[kernel] warning: invalid pragma '12'. Ignoring loop annotation [value] Analyzing a complete application starting at main3 @@ -15,13 +14,13 @@ tests/value/loop_wvar.i:57:[value] warning: signed overflow. assert next + 1 ≤ [value] computing for function main_multiple_hints <- main3. Called from tests/value/loop_wvar.i:85. tests/value/loop_wvar.i:69:[value] entering loop for the first time -[value] Called Frama_C_show_each({0}, {0}, {0}) -[value] Called Frama_C_show_each({0; 1}, {0; 1}, {0; 1}) -[value] Called Frama_C_show_each({0; 1; 2}, {0; 1; 2}, {0; 1; 2}) -[value] Called Frama_C_show_each([0..9], {0; 1; 2; 3}, {0; 1; 2; 3}) -[value] Called Frama_C_show_each([0..9], {0; 1; 2; 3; 4}, {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each([0..9], [0..17], [0..11]) -[value] Called Frama_C_show_each([0..9], [0..18], [0..12]) +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: {0}, {0}, {0} +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: {0; 1}, {0; 1}, {0; 1} +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: {0; 1; 2}, {0; 1; 2}, {0; 1; 2} +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], {0; 1; 2; 3}, {0; 1; 2; 3} +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], {0; 1; 2; 3; 4}, {0; 1; 2; 3; 4} +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..17], [0..11] +tests/value/loop_wvar.i:71:[value] Frama_C_show_each: [0..9], [0..18], [0..12] [value] Recording results for main_multiple_hints [value] Done for function main_multiple_hints [value] Recording results for main3 diff --git a/tests/value/oracle/loop_wvar.2.res.oracle b/tests/value/oracle/loop_wvar.2.res.oracle index cf7e717addcf989a23e1ab487a62606175036c54..4cf26b1763a1e601f2dd42728cc4630f5687936d 100644 --- a/tests/value/oracle/loop_wvar.2.res.oracle +++ b/tests/value/oracle/loop_wvar.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_wvar.i (no preprocessing) tests/value/loop_wvar.i:38:[kernel] warning: invalid pragma '12'. Ignoring loop annotation [value] Analyzing a complete application starting at main_err1 diff --git a/tests/value/oracle/loop_wvar.3.res.oracle b/tests/value/oracle/loop_wvar.3.res.oracle index abd0fc395ffd021675ab2a06fdf203e6a6ef330a..ae4e8509d839950eb6c4d14baa9baea0595ccc1b 100644 --- a/tests/value/oracle/loop_wvar.3.res.oracle +++ b/tests/value/oracle/loop_wvar.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loop_wvar.i (no preprocessing) tests/value/loop_wvar.i:38:[kernel] warning: invalid pragma '12'. Ignoring loop annotation [value] Analyzing a complete application starting at main_err2 diff --git a/tests/value/oracle/loopfun.res.oracle b/tests/value/oracle/loopfun.res.oracle index be377b109764c7b65a785ceb9fe4c6599eeecebe..298163476e53dbad64ef85c6d56ea9e5f81a2c75 100644 --- a/tests/value/oracle/loopfun.res.oracle +++ b/tests/value/oracle/loopfun.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loopfun.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -17,7 +16,7 @@ Called from tests/value/loopfun.i:16. [value] Recording results for test [value] Done for function test -[value] Called Frama_C_show_each_t({5}) +tests/value/loopfun.i:16:[value] Frama_C_show_each_t: {5} [value] computing for function test <- main. Called from tests/value/loopfun.i:14. [value] Recording results for test @@ -30,7 +29,7 @@ Called from tests/value/loopfun.i:16. [value] Recording results for test [value] Done for function test -[value] Called Frama_C_show_each_t({2}) +tests/value/loopfun.i:16:[value] Frama_C_show_each_t: {2} [value] computing for function test <- main. Called from tests/value/loopfun.i:14. [value] Recording results for test diff --git a/tests/value/oracle/loopinv.res.oracle b/tests/value/oracle/loopinv.res.oracle index 6d46b077cc998a74707673427b465f019a077c5c..b0af85eeb476a7890a5c94d144e4416d4ee9bd58 100644 --- a/tests/value/oracle/loopinv.res.oracle +++ b/tests/value/oracle/loopinv.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/loopinv.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,7 +5,7 @@ [value:initial-state] Values of globals at initialization [value] computing for function main1 <- main. - Called from tests/value/loopinv.c:51. + Called from tests/value/loopinv.c:63. [value] computing for function init <- main1 <- main. Called from tests/value/loopinv.c:22. tests/value/loopinv.c:5:[value] function init: precondition got status valid. @@ -22,74 +21,41 @@ tests/value/loopinv.c:10:[value] entering loop for the first time [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/loopinv.c:52. + Called from tests/value/loopinv.c:64. tests/value/loopinv.c:32:[value] loop invariant got status valid. tests/value/loopinv.c:33:[value] loop invariant got status valid. tests/value/loopinv.c:32:[value] warning: loop invariant got status invalid (stopping propagation). [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/loopinv.c:53. + Called from tests/value/loopinv.c:65. tests/value/loopinv.c:42:[value] loop invariant got status valid. tests/value/loopinv.c:43:[value] entering loop for the first time -[value] Called Frama_C_show_each({0}, {0}) -[value] Called Frama_C_show_each({0; 1}, {0; 1}) +tests/value/loopinv.c:46:[value] Frama_C_show_each: {0}, {0} +tests/value/loopinv.c:46:[value] Frama_C_show_each: {0; 1}, {0; 1} tests/value/loopinv.c:42:[value] warning: loop invariant got status unknown. -[value] Called Frama_C_show_each({0; 1; 2}, {0; 1; 2}) -[value] Called Frama_C_show_each({0; 1; 2; 3; 4; 5}, {0; 1; 2; 3}) -[value] Called Frama_C_show_each({0; 1; 2; 3; 4; 5; 6}, {0; 1; 2; 3; 4}) -[value] Called Frama_C_show_each([0..9], {0; 1; 2; 3; 4; 5}) -[value] Called Frama_C_show_each([0..10], {0; 1; 2; 3; 4; 5; 6}) -[value] Called Frama_C_show_each([0..13], {0; 1; 2; 3; 4; 5; 6; 7}) -[value] Called Frama_C_show_each([0..14], [0..8]) -[value] Called Frama_C_show_each([0..17], [0..9]) -[value] Called Frama_C_show_each([0..18], [0..10]) -[value] Called Frama_C_show_each([0..21], [0..11]) -[value] Called Frama_C_show_each([0..22], [0..12]) -[value] Called Frama_C_show_each([0..25], [0..13]) -[value] Called Frama_C_show_each([0..26], [0..14]) -[value] Called Frama_C_show_each([0..29], [0..15]) -[value] Called Frama_C_show_each([0..30], [0..16]) -[value] Called Frama_C_show_each([0..33], [0..17]) -[value] Called Frama_C_show_each([0..34], [0..18]) -[value] Called Frama_C_show_each([0..37], [0..19]) -[value] Called Frama_C_show_each([0..38], [0..20]) -[value] Called Frama_C_show_each([0..41], [0..21]) -[value] Called Frama_C_show_each([0..42], [0..22]) -[value] Called Frama_C_show_each([0..45], [0..23]) -[value] Called Frama_C_show_each([0..46], [0..24]) -[value] Called Frama_C_show_each([0..49], [0..25]) -[value] Called Frama_C_show_each([0..50], [0..26]) -[value] Called Frama_C_show_each([0..53], [0..27]) -[value] Called Frama_C_show_each([0..54], [0..28]) -[value] Called Frama_C_show_each([0..57], [0..29]) -[value] Called Frama_C_show_each([0..58], [0..30]) -[value] Called Frama_C_show_each([0..61], [0..31]) -[value] Called Frama_C_show_each([0..62], [0..32]) -[value] Called Frama_C_show_each([0..65], [0..33]) -[value] Called Frama_C_show_each([0..66], [0..34]) -[value] Called Frama_C_show_each([0..69], [0..35]) -[value] Called Frama_C_show_each([0..70], [0..36]) -[value] Called Frama_C_show_each([0..73], [0..37]) -[value] Called Frama_C_show_each([0..74], [0..38]) -[value] Called Frama_C_show_each([0..77], [0..39]) -[value] Called Frama_C_show_each([0..78], [0..40]) -[value] Called Frama_C_show_each([0..81], [0..41]) -[value] Called Frama_C_show_each([0..82], [0..42]) -[value] Called Frama_C_show_each([0..85], [0..43]) -[value] Called Frama_C_show_each([0..86], [0..44]) -[value] Called Frama_C_show_each([0..89], [0..45]) -[value] Called Frama_C_show_each([0..90], [0..46]) -[value] Called Frama_C_show_each([0..93], [0..47]) -[value] Called Frama_C_show_each([0..94], [0..48]) -[value] Called Frama_C_show_each([0..97], [0..49]) -[value] Called Frama_C_show_each([0..98], [0..50]) -[value] Called Frama_C_show_each([0..99], [0..51]) -[value] Called Frama_C_show_each([0..99], [0..52]) +tests/value/loopinv.c:46:[value] Frama_C_show_each: {0; 1; 2}, {0; 1; 2} +tests/value/loopinv.c:46:[value] Frama_C_show_each: {0; 1; 2; 3; 4; 5}, {0; 1; 2; 3} +tests/value/loopinv.c:46:[value] Frama_C_show_each: {0; 1; 2; 3; 4; 5; 6}, {0; 1; 2; 3; 4} +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..9], {0; 1; 2; 3; 4; 5} +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..10], {0; 1; 2; 3; 4; 5; 6} +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..13], {0; 1; 2; 3; 4; 5; 6; 7} +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..14], [0..8] +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..17], [0..9] +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..18], [0..10] +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..21], [0..11] +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..23], [0..12] tests/value/loopinv.c:45:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each([0..99], [0..2147483647]) +tests/value/loopinv.c:46:[value] Frama_C_show_each: [0..99], [0..2147483647] [value] Recording results for main3 [value] Done for function main3 +[value] computing for function main4 <- main. + Called from tests/value/loopinv.c:66. +tests/value/loopinv.c:58:[value] loop invariant got status valid. +tests/value/loopinv.c:59:[value] entering loop for the first time +tests/value/loopinv.c:58:[value] warning: loop invariant got status unknown. +[value] Recording results for main4 +[value] Done for function main4 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -108,6 +74,9 @@ tests/value/loopinv.c:45:[value] warning: signed overflow. assert j + 1 ≤ 2147 NON TERMINATING FUNCTION [value:final-states] Values at end of function main3: j ∈ [0..2147483647] +[value:final-states] Values at end of function main4: + a ∈ {9} + x ∈ {9} [value:final-states] Values at end of function main: [report] Computing properties status... @@ -160,10 +129,17 @@ tests/value/loopinv.c:45:[value] warning: signed overflow. assert j + 1 ≤ 2147 [ - ] Assertion 'Value,signed_overflow' (file tests/value/loopinv.c, line 45) tried with Value. +-------------------------------------------------------------------------------- +--- Properties of Function 'main4' +-------------------------------------------------------------------------------- + +[ - ] Invariant (file tests/value/loopinv.c, line 58) + tried with Value. + -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- 9 Completely validated - 3 To be validated - 12 Total + 4 To be validated + 13 Total -------------------------------------------------------------------------------- diff --git a/tests/value/oracle/machdep.res.oracle b/tests/value/oracle/machdep.res.oracle index 832d1e38b0faef8b36face46f7223bfa8149ad46..3bdb458ddb2d38fda556034c2e6348baa4372b9f 100644 --- a/tests/value/oracle/machdep.res.oracle +++ b/tests/value/oracle/machdep.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/machdep.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -20,7 +19,6 @@ c2 ∈ {0} [value:final-states] Values at end of function main: -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/machdep.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -42,7 +40,6 @@ c2 ∈ {1} [value:final-states] Values at end of function main: -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/machdep.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/max_pointed.res.oracle b/tests/value/oracle/max_pointed.res.oracle index 427bc0724736fd5fc0632ca9a21cb1ce764854cd..8fe239e2dc1b9e4bca1a0cc065fb4d4b68863c57 100644 --- a/tests/value/oracle/max_pointed.res.oracle +++ b/tests/value/oracle/max_pointed.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/max_pointed.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/memexec.res.oracle b/tests/value/oracle/memexec.res.oracle index 5a3a29187e74490a06d5bac544eb13937844e3c4..d688a43c256b6a2a64bbf299f696a3f3607e504e 100644 --- a/tests/value/oracle/memexec.res.oracle +++ b/tests/value/oracle/memexec.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/memexec.c (with preprocessing) [rte] annotating function fbug [value] Analyzing a complete application starting at main @@ -95,13 +94,10 @@ tests/value/memexec.c:96:[value] warning: assertion got status unknown. tests/value/memexec.c:98:[value] entering loop for the first time [value] Recording results for f5_aux [value] Done for function f5_aux -[value] Called Frama_C_show_each_f5([9..2147483647], - [-2147483648..6], - [-2147483648..7]) +tests/value/memexec.c:108:[value] Frama_C_show_each_f5: [9..2147483647], [-2147483648..6], [-2147483648..7] tests/value/memexec.c:113:[value] Reusing old results for call to f5_aux -[value] Called Frama_C_show_each_f5([9..2147483647], - [-2147483648..2147483647], - [-2147483648..7]) +tests/value/memexec.c:114:[value] Frama_C_show_each_f5: + [9..2147483647], [-2147483648..2147483647], [-2147483648..7] [value] Recording results for f5 [value] Done for function f5 [value] computing for function f6 <- main. diff --git a/tests/value/oracle/merge_bits.res.oracle b/tests/value/oracle/merge_bits.res.oracle index 9504ec153502f2c06b1ff098227f04a389efe7c8..e4f2cf70d01ef91cb20d4ef78a43a565e8d88a62 100644 --- a/tests/value/oracle/merge_bits.res.oracle +++ b/tests/value/oracle/merge_bits.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/merge_bits.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,28 +12,37 @@ [8] ∈ {5} [9] ∈ {0} [10..12] ∈ {1} -[value] Called Frama_C_show_each_F([bits 0 to 7] ∈ {1} - [bits 8 to 31] ∈ {0} - This amounts to: {1}) -[value] Called Frama_C_show_each_F([bits 0 to 23] ∈ {0} - [bits 24 to 31] ∈ {1} - This amounts to: {16777216}) -[value] Called Frama_C_show_each_F([bits 0 to 7] ∈ {1} - [bits 8 to 15] ∈ {2} - [bits 16 to 23] ∈ {3} - [bits 24 to 31] ∈ {4} - This amounts to: {67305985}) -[value] Called Frama_C_show_each_F([bits 0 to 7] ∈ {0} - [bits 8 to 31]# ∈ {1} repeated %8 - This amounts to: {16843008}) -[value] Called Frama_C_show_each_F([bits 0 to 7] ∈ {1} - [bits 8 to 15] ∈ {0} - [bits 16 to 31]# ∈ - {-1879048176}%32, bits 0 to 15 - This amounts to: {1048577}) + nondet ∈ [--..--] +[value] computing for function join_offsetmap <- main. + Called from tests/value/merge_bits.i:35. +[value] Recording results for join_offsetmap +[value] Done for function join_offsetmap +[value] computing for function merge_bits <- main. + Called from tests/value/merge_bits.i:36. +tests/value/merge_bits.i:24:[value] Frama_C_show_each_F: {1} +tests/value/merge_bits.i:25:[value] Frama_C_show_each_F: {16777216} +tests/value/merge_bits.i:26:[value] Frama_C_show_each_F: {67305985} +tests/value/merge_bits.i:27:[value] Frama_C_show_each_F: {16843008} +tests/value/merge_bits.i:29:[value] Frama_C_show_each_F: {1048577} +[value] Recording results for merge_bits +[value] Done for function merge_bits [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function join_offsetmap: + u{.i[bits 0 to 15]; .s[0]} ∈ {65534} + {.i[bits 16 to 31]; .s[1]} ∈ {65535} + r ∈ {-2} +[value:final-states] Values at end of function merge_bits: + T[0] ∈ {1} + [1] ∈ {0} + [bits 16 to 47] ∈ {-1879048176} + [6] ∈ {3} + [7] ∈ {4} + [8] ∈ {5} + [9] ∈ {0} + [10..12] ∈ {1} + __retres ∈ {0} [value:final-states] Values at end of function main: T[0] ∈ {1} [1] ∈ {0} @@ -45,15 +53,32 @@ [9] ∈ {0} [10..12] ∈ {1} __retres ∈ {0} +[from] Computing for function join_offsetmap +[from] Done for function join_offsetmap +[from] Computing for function merge_bits +[from] Done for function merge_bits [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: +[from] Function join_offsetmap: + NO EFFECTS +[from] Function merge_bits: + T[2..5] FROM \nothing + \result FROM \nothing [from] Function main: T[2..5] FROM \nothing \result FROM \nothing [from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function join_offsetmap: + u; r +[inout] Inputs for function join_offsetmap: + nondet +[inout] Out (internal) for function merge_bits: + T[2..5]; __retres +[inout] Inputs for function merge_bits: + T{[0..7]; [9..12]} [inout] Out (internal) for function main: T[2..5]; __retres [inout] Inputs for function main: - T{[0..7]; [9..12]} + T{[0..7]; [9..12]}; nondet diff --git a/tests/value/oracle/mini_pointrer.res.oracle b/tests/value/oracle/mini_pointrer.res.oracle index 011c0c7fa2618942bc7feb3ba85f01d7497b8e17..7f40dd655a93e4ff5e2636911d73da25a9b5d7fe 100644 --- a/tests/value/oracle/mini_pointrer.res.oracle +++ b/tests/value/oracle/mini_pointrer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/mini_pointrer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/misaligned_tabs.res.oracle b/tests/value/oracle/misaligned_tabs.res.oracle index 1769b101139bf74943b538958f613f3072f56bfe..0518d79d51b340c12d596a61c07f092a49e56e34 100644 --- a/tests/value/oracle/misaligned_tabs.res.oracle +++ b/tests/value/oracle/misaligned_tabs.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/misaligned_tabs.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -19,24 +18,24 @@ {.i3; .i4} ∈ {4369} [value] computing for function misaligned_struct <- main. Called from tests/value/misaligned_tabs.i:58. -[value] Called Frama_C_show_each_1({1}) -[value] Called Frama_C_show_each_2({1}) -[value] Called Frama_C_show_each_3({1}) -[value] Called Frama_C_show_each_4({1}) -[value] Called Frama_C_show_each_5({1}) -[value] Called Frama_C_show_each_6({1}) -[value] Called Frama_C_show_each_7({1}) -[value] Called Frama_C_show_each_8({1}) -[value] Called Frama_C_show_each_9({1}) -[value] Called Frama_C_show_each_a({1}) -[value] Called Frama_C_show_each_b({1}) -[value] Called Frama_C_show_each_c({1}) -[value] Called Frama_C_show_each_d({1}) -[value] Called Frama_C_show_each_e({1}) -[value] Called Frama_C_show_each_f({1}) +tests/value/misaligned_tabs.i:10:[value] Frama_C_show_each_1: {1} +tests/value/misaligned_tabs.i:13:[value] Frama_C_show_each_2: {1} +tests/value/misaligned_tabs.i:14:[value] Frama_C_show_each_3: {1} +tests/value/misaligned_tabs.i:15:[value] Frama_C_show_each_4: {1} +tests/value/misaligned_tabs.i:19:[value] Frama_C_show_each_5: {1} +tests/value/misaligned_tabs.i:20:[value] Frama_C_show_each_6: {1} +tests/value/misaligned_tabs.i:21:[value] Frama_C_show_each_7: {1} +tests/value/misaligned_tabs.i:22:[value] Frama_C_show_each_8: {1} +tests/value/misaligned_tabs.i:41:[value] Frama_C_show_each_9: {1} +tests/value/misaligned_tabs.i:42:[value] Frama_C_show_each_a: {1} +tests/value/misaligned_tabs.i:43:[value] Frama_C_show_each_b: {1} +tests/value/misaligned_tabs.i:44:[value] Frama_C_show_each_c: {1} +tests/value/misaligned_tabs.i:45:[value] Frama_C_show_each_d: {1} +tests/value/misaligned_tabs.i:46:[value] Frama_C_show_each_e: {1} +tests/value/misaligned_tabs.i:47:[value] Frama_C_show_each_f: {1} [value] Recording results for misaligned_struct [value] Done for function misaligned_struct -[value] Called Frama_C_show_each_g({1}) +tests/value/misaligned_tabs.i:64:[value] Frama_C_show_each_g: {1} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/mixed_val.res.oracle b/tests/value/oracle/mixed_val.res.oracle index 159c76918e0bd8fc4e2fafa3ce5323e6cb86bdaa..ee28a34a0d3ab99a0386bfdcebde8d7e9cb092fc 100644 --- a/tests/value/oracle/mixed_val.res.oracle +++ b/tests/value/oracle/mixed_val.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/mixed_val.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/modifies.res.oracle b/tests/value/oracle/modifies.res.oracle index e54c7c19605cba5e194113927ca8310928b16bc7..a5819042795b796d05c1b8a0dc27da4b25e17f8a 100644 --- a/tests/value/oracle/modifies.res.oracle +++ b/tests/value/oracle/modifies.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/modifies.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/modulo.res.oracle b/tests/value/oracle/modulo.res.oracle index 2de8e2c753d62062fee22cb80cb8d8ceb93b3b1b..38f30304c02ef153e16b0571e0feb39ac82d052d 100644 --- a/tests/value/oracle/modulo.res.oracle +++ b/tests/value/oracle/modulo.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/modulo.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -31,27 +30,27 @@ tests/value/modulo.i:34:[value] warning: function pgcd1: precondition got status unknown. tests/value/modulo.i:37:[value] loop invariant got status valid. tests/value/modulo.i:38:[value] loop invariant got status valid. -[value] Called Frama_C_show_each_1([1..10], [1..10], [0..9]) -[value] Called Frama_C_show_each_1({0}, [1..10], {0}) -[value] Called Frama_C_show_each_1([-10..-1], [1..10], [-9..0]) -[value] Called Frama_C_show_each_1([1..10], [-10..-1], [0..9]) -[value] Called Frama_C_show_each_1({0}, [-10..-1], {0}) -[value] Called Frama_C_show_each_1([-10..-1], [-10..-1], [-9..0]) +tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [1..10], [0..9] +tests/value/modulo.i:41:[value] Frama_C_show_each_1: {0}, [1..10], {0} +tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [1..10], [-9..0] +tests/value/modulo.i:41:[value] Frama_C_show_each_1: [1..10], [-10..-1], [0..9] +tests/value/modulo.i:41:[value] Frama_C_show_each_1: {0}, [-10..-1], {0} +tests/value/modulo.i:41:[value] Frama_C_show_each_1: [-10..-1], [-10..-1], [-9..0] [value] Recording results for pgcd1 [value] Done for function pgcd1 [value] computing for function pgcd2 <- main. Called from tests/value/modulo.i:152. tests/value/modulo.i:47:[value] warning: function pgcd2: precondition got status unknown. tests/value/modulo.i:50:[value] loop invariant got status valid. -[value] Called Frama_C_show_each_2([-10..10], [1..10], [-9..9]) -[value] Called Frama_C_show_each_2([-10..10], [-10..-1], [-9..9]) +tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..10], [1..10], [-9..9] +tests/value/modulo.i:53:[value] Frama_C_show_each_2: [-10..10], [-10..-1], [-9..9] [value] Recording results for pgcd2 [value] Done for function pgcd2 [value] computing for function pgcd3 <- main. Called from tests/value/modulo.i:153. tests/value/modulo.i:59:[value] warning: function pgcd3: precondition got status unknown. tests/value/modulo.i:63:[value] warning: division by zero. assert b_0 ≢ 0; -[value] Called Frama_C_show_each_3([-10..10], [-10..10], [-9..9]) +tests/value/modulo.i:64:[value] Frama_C_show_each_3: [-10..10], [-10..10], [-9..9] [value] Recording results for pgcd3 [value] Done for function pgcd3 [value] computing for function main2 <- main. @@ -94,6 +93,7 @@ tests/value/modulo.i:146:[value] warning: assertion got status unknown. [value] Done for function pos_rem [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 2 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function extract_bits_modulo: i ∈ [0..10] diff --git a/tests/value/oracle/multi_access.res.oracle b/tests/value/oracle/multi_access.res.oracle index 03c6758c5b72db5b9318bf6d9db5471ec00b5b2c..9c4208644e1bbf71cd78ae6593d68b102ed5ea7c 100644 --- a/tests/value/oracle/multi_access.res.oracle +++ b/tests/value/oracle/multi_access.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/multi_access.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/narrow_behaviors.res.oracle b/tests/value/oracle/narrow_behaviors.res.oracle index a4e61e4de1a0f87cb867960f8ec997255b1dcdc8..924fe297cf51f822273ebbe4d17b236f12f987d1 100644 --- a/tests/value/oracle/narrow_behaviors.res.oracle +++ b/tests/value/oracle/narrow_behaviors.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/narrow_behaviors.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -9,66 +8,99 @@ Called from tests/value/narrow_behaviors.i:56. [value] using specification for function f1 [value] Done for function f1 -[value] DUMPING STATE of file tests/value/narrow_behaviors.i line 56 +tests/value/narrow_behaviors.i:56:[value] Frama_C_dump_each: + # Cvalue domain: nondet ∈ [--..--] - p{.x; .y} ∈ {1; 2} - q ∈ UNINITIALIZED + p.x ∈ {2} + .y ∈ {1; 2} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== +tests/value/narrow_behaviors.i:56:[value] Frama_C_dump_each: + # Cvalue domain: + nondet ∈ {0} + p{.x; .y} ∈ {1} + __retres ∈ UNINITIALIZED + ==END OF DUMP== [value] computing for function f2 <- main. Called from tests/value/narrow_behaviors.i:57. [value] using specification for function f2 [value] Done for function f2 -[value] DUMPING STATE of file tests/value/narrow_behaviors.i line 57 +[value] computing for function f2 <- main. + Called from tests/value/narrow_behaviors.i:57. +tests/value/narrow_behaviors.i:57:[value] function f2, behavior b: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:57:[value] function f2, behavior c: assumes got status invalid; behavior not evaluated. +[value] Done for function f2 +tests/value/narrow_behaviors.i:57:[value] Frama_C_dump_each: + # Cvalue domain: nondet ∈ [--..--] - p{.x; .y} ∈ {1; 2} - q{.x; .y} ∈ {1; 2} + p.x ∈ {2} + .y ∈ {1; 2} + q.x ∈ {2} + .y ∈ {1; 2} + __retres ∈ UNINITIALIZED + ==END OF DUMP== +tests/value/narrow_behaviors.i:57:[value] Frama_C_dump_each: + # Cvalue domain: + nondet ∈ {0} + p.x ∈ {2} + .y ∈ {1; 2} + q.x ∈ {1; 2} + .y ∈ {1} + __retres ∈ UNINITIALIZED + ==END OF DUMP== +tests/value/narrow_behaviors.i:57:[value] Frama_C_dump_each: + # Cvalue domain: + nondet ∈ {0} + p{.x; .y} ∈ {1} + q.x ∈ {1; 2} + .y ∈ {1} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/narrow_behaviors.i:61:[value] warning: assertion got status unknown. [value] computing for function f1 <- main. Called from tests/value/narrow_behaviors.i:62. -tests/value/narrow_behaviors.i:62:[value] function f1, behavior a: assumes got status invalid; behavior not evaluated. -tests/value/narrow_behaviors.i:62:[value] function f1, behavior d: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:62:[value] function f1, behavior b: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:62:[value] function f1, behavior c: assumes got status invalid; behavior not evaluated. [value] Done for function f1 [value] computing for function f1 <- main. Called from tests/value/narrow_behaviors.i:62. -tests/value/narrow_behaviors.i:62:[value] function f1, behavior b: assumes got status invalid; behavior not evaluated. -tests/value/narrow_behaviors.i:62:[value] function f1, behavior c: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:62:[value] function f1, behavior a: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:62:[value] function f1, behavior d: assumes got status invalid; behavior not evaluated. [value] Done for function f1 -[value] DUMPING STATE of file tests/value/narrow_behaviors.i line 62 - nondet ∈ {1} - r{.x; .y} ∈ {2} - s ∈ UNINITIALIZED - __retres ∈ UNINITIALIZED - =END OF DUMP== -[value] DUMPING STATE of file tests/value/narrow_behaviors.i line 62 +tests/value/narrow_behaviors.i:62:[value] Frama_C_dump_each: + # Cvalue domain: nondet ∈ {0} r{.x; .y} ∈ {1} - s ∈ UNINITIALIZED __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== +tests/value/narrow_behaviors.i:62:[value] Frama_C_dump_each: + # Cvalue domain: + nondet ∈ {1} + r{.x; .y} ∈ {2} + __retres ∈ UNINITIALIZED + ==END OF DUMP== +[value] computing for function f2 <- main. + Called from tests/value/narrow_behaviors.i:63. +tests/value/narrow_behaviors.i:63:[value] function f2, behavior b: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:63:[value] function f2, behavior c: assumes got status invalid; behavior not evaluated. +[value] Done for function f2 [value] computing for function f2 <- main. Called from tests/value/narrow_behaviors.i:63. tests/value/narrow_behaviors.i:63:[value] function f2, behavior a: assumes got status invalid; behavior not evaluated. tests/value/narrow_behaviors.i:63:[value] function f2, behavior d: assumes got status invalid; behavior not evaluated. -tests/value/narrow_behaviors.i:39:[value] warning: function f2, behavior b: this postcondition evaluates to false in this +tests/value/narrow_behaviors.i:43:[value] warning: function f2, behavior c: this postcondition evaluates to false in this context. If it is valid, either a precondition was not verified for this call, or some assigns/from clauses are incomplete (or incorrect). -tests/value/narrow_behaviors.i:40:[value] function f2, behavior b: no state left in which to evaluate postcondition, status not computed. -[value] Done for function f2 -[value] computing for function f2 <- main. - Called from tests/value/narrow_behaviors.i:63. -tests/value/narrow_behaviors.i:63:[value] function f2, behavior b: assumes got status invalid; behavior not evaluated. -tests/value/narrow_behaviors.i:63:[value] function f2, behavior c: assumes got status invalid; behavior not evaluated. +tests/value/narrow_behaviors.i:44:[value] function f2, behavior c: no state left in which to evaluate postcondition, status not computed. [value] Done for function f2 -[value] DUMPING STATE of file tests/value/narrow_behaviors.i line 63 +tests/value/narrow_behaviors.i:63:[value] Frama_C_dump_each: + # Cvalue domain: nondet ∈ {0} r{.x; .y} ∈ {1} s.x ∈ {1; 2} .y ∈ {1} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/nested_struct_init.res.oracle b/tests/value/oracle/nested_struct_init.res.oracle index bc0b2fac6b54a73d9ef847e013d299f1a8bc1683..f97519575b1f2dfef023ff70bcd561c599596692 100644 --- a/tests/value/oracle/nested_struct_init.res.oracle +++ b/tests/value/oracle/nested_struct_init.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/nested_struct_init.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/no_results.res.oracle b/tests/value/oracle/no_results.res.oracle index f9ea6f431ea199a65e858de5605277a278d36505..0307c9f934d735a1625dff42ace7c76271ee620c 100644 --- a/tests/value/oracle/no_results.res.oracle +++ b/tests/value/oracle/no_results.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/no_results.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/non_iso_initializer.res.oracle b/tests/value/oracle/non_iso_initializer.res.oracle index 156e2e54e9dac87a1e495bedaf66cd8be7f630fb..95bf50a9c7834c9190a2273f8d90cd73a66c1b3f 100644 --- a/tests/value/oracle/non_iso_initializer.res.oracle +++ b/tests/value/oracle/non_iso_initializer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/non_iso_initializer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/non_natural.res.oracle b/tests/value/oracle/non_natural.res.oracle index f2c4e30ec937ca29063203446f1646046390931b..b85fa8ca753dfaee495bf1f920c6e1049e767978 100644 --- a/tests/value/oracle/non_natural.res.oracle +++ b/tests/value/oracle/non_natural.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/non_natural.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,11 +7,11 @@ [value] computing for function main1 <- main. Called from tests/value/non_natural.i:63. tests/value/non_natural.i:13:[kernel] warning: Non-natural loop detected. -[value] Called Frama_C_show_each({0}) -[value] Called Frama_C_show_each({0; 1}) -[value] Called Frama_C_show_each({0; 1; 2}) -[value] Called Frama_C_show_each({0; 1; 2; 3}) -[value] Called Frama_C_show_each([0..999999]) +tests/value/non_natural.i:11:[value] Frama_C_show_each: {0} +tests/value/non_natural.i:11:[value] Frama_C_show_each: {0; 1} +tests/value/non_natural.i:11:[value] Frama_C_show_each: {0; 1; 2} +tests/value/non_natural.i:11:[value] Frama_C_show_each: {0; 1; 2; 3} +tests/value/non_natural.i:11:[value] Frama_C_show_each: [0..999999] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. @@ -21,7 +20,7 @@ tests/value/non_natural.i:13:[kernel] warning: Non-natural loop detected. Called from tests/value/non_natural.i:57. tests/value/non_natural.i:21:[kernel] warning: Non-natural loop detected. tests/value/non_natural.i:21:[value] entering loop for the first time -[value] Called Frama_C_show_each({{ &p2 }}) +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 }} tests/value/non_natural.i:23:[value] warning: accessing uninitialized left-value. assert \initialized(tmp_0); (tmp_0 from from++) @@ -46,11 +45,11 @@ tests/value/non_natural.i:29:[value] warning: accessing uninitialized left-value tests/value/non_natural.i:30:[value] warning: accessing uninitialized left-value. assert \initialized(tmp_14); (tmp_14 from from++) -[value] Called Frama_C_show_each({{ &p2 + {0; 32} }}) -[value] Called Frama_C_show_each({{ &p2 + {0; 32; 64} }}) -[value] Called Frama_C_show_each({{ &p2 + {0; 32; 64; 96} }}) -[value] Called Frama_C_show_each({{ &p2 + {0; 32; 64; 96; 128} }}) -[value] Called Frama_C_show_each({{ &p2 + [0..399968],0%32 }}) +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + {0; 32} }} +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + {0; 32; 64} }} +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + {0; 32; 64; 96} }} +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + {0; 32; 64; 96; 128} }} +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + [0..399968],0%32 }} tests/value/non_natural.i:23:[kernel] more than 200(12500) locations to update in array. Approximating. tests/value/non_natural.i:24:[kernel] more than 200(12500) locations to update in array. Approximating. tests/value/non_natural.i:25:[value] warning: out of bounds read. assert \valid_read(tmp_4); @@ -71,7 +70,7 @@ tests/value/non_natural.i:29:[kernel] more than 200(12500) locations to update i tests/value/non_natural.i:30:[value] warning: out of bounds read. assert \valid_read(tmp_14); (tmp_14 from from++) tests/value/non_natural.i:30:[kernel] more than 200(12500) locations to update in array. Approximating. -[value] Called Frama_C_show_each({{ &p2 + [0..400000],0%32 }}) +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + [0..400000],0%32 }} tests/value/non_natural.i:23:[value] warning: out of bounds write. assert \valid(tmp); (tmp from to++) tests/value/non_natural.i:23:[value] warning: out of bounds read. assert \valid_read(tmp_0); @@ -92,15 +91,25 @@ tests/value/non_natural.i:29:[value] warning: out of bounds write. assert \valid (tmp_11 from to++) tests/value/non_natural.i:30:[value] warning: out of bounds write. assert \valid(tmp_13); (tmp_13 from to++) -[value] Called Frama_C_show_each({{ &p2 + [0..--],0%32 }}) +tests/value/non_natural.i:22:[value] Frama_C_show_each: {{ &p2 + [0..--],0%32 }} [value] Recording results for duff1 +tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. +tests/value/non_natural.i:23:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. +tests/value/non_natural.i:24:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:25:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:26:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:27:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:28:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:29:[kernel] more than 200(12500) elements to enumerate. Approximating. +tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate. Approximating. [value] Done for function duff1 tests/value/non_natural.i:58:[value] warning: accessing out of bounds index. assert 0 ≤ o; tests/value/non_natural.i:58:[value] warning: accessing out of bounds index. assert o < 100002; [value] computing for function duff2 <- main2 <- main. Called from tests/value/non_natural.i:59. tests/value/non_natural.i:38:[kernel] warning: Non-natural loop detected. -[value] Called Frama_C_show_each({{ &p2 }}) +tests/value/non_natural.i:38:[value] Frama_C_show_each: {{ &p2 }} tests/value/non_natural.i:39:[value] warning: accessing uninitialized left-value. assert \initialized(tmp_0); (tmp_0 from from++) @@ -125,9 +134,9 @@ tests/value/non_natural.i:45:[value] warning: accessing uninitialized left-value tests/value/non_natural.i:46:[value] warning: accessing uninitialized left-value. assert \initialized(tmp_14); (tmp_14 from from++) -[value] Called Frama_C_show_each({{ &p2 + {0; 32} }}) -[value] Called Frama_C_show_each({{ &p2 + {0; 32; 64} }}) -[value] Called Frama_C_show_each({{ &p2 + [0..399968],0%32 }}) +tests/value/non_natural.i:38:[value] Frama_C_show_each: {{ &p2 + {0; 32} }} +tests/value/non_natural.i:38:[value] Frama_C_show_each: {{ &p2 + {0; 32; 64} }} +tests/value/non_natural.i:38:[value] Frama_C_show_each: {{ &p2 + [0..399968],0%32 }} tests/value/non_natural.i:39:[kernel] more than 200(12500) locations to update in array. Approximating. tests/value/non_natural.i:40:[kernel] more than 200(12500) locations to update in array. Approximating. tests/value/non_natural.i:41:[value] warning: out of bounds read. assert \valid_read(tmp_4); @@ -148,7 +157,7 @@ tests/value/non_natural.i:45:[kernel] more than 200(12500) locations to update i tests/value/non_natural.i:46:[value] warning: out of bounds read. assert \valid_read(tmp_14); (tmp_14 from from++) tests/value/non_natural.i:46:[kernel] more than 200(12500) locations to update in array. Approximating. -[value] Called Frama_C_show_each({{ &p2 + [0..400000],0%32 }}) +tests/value/non_natural.i:38:[value] Frama_C_show_each: {{ &p2 + [0..400000],0%32 }} tests/value/non_natural.i:39:[value] warning: out of bounds write. assert \valid(tmp); (tmp from to++) tests/value/non_natural.i:39:[value] warning: out of bounds read. assert \valid_read(tmp_0); @@ -169,7 +178,7 @@ tests/value/non_natural.i:45:[value] warning: out of bounds write. assert \valid (tmp_11 from to++) tests/value/non_natural.i:46:[value] warning: out of bounds write. assert \valid(tmp_13); (tmp_13 from to++) -[value] Called Frama_C_show_each({{ &p2 + [0..--],0%32 }}) +tests/value/non_natural.i:38:[value] Frama_C_show_each: {{ &p2 + [0..--],0%32 }} [value] Recording results for duff2 [value] Done for function duff2 [value] Recording results for main2 @@ -177,14 +186,6 @@ tests/value/non_natural.i:46:[value] warning: out of bounds write. assert \valid [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/value/non_natural.i:23:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:24:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:25:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:26:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:27:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:28:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:29:[kernel] more than 200(12500) elements to enumerate. Approximating. -tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate. Approximating. [value:final-states] Values at end of function duff1: to ∈ {{ &p2 + [32..--],0%32 }} from ∈ {{ &p1 + [32..--],0%32 }} @@ -197,8 +198,6 @@ tests/value/non_natural.i:30:[kernel] more than 200(12500) elements to enumerate p2[0..99999] ∈ {1; 2} or UNINITIALIZED [value:final-states] Values at end of function main1: c ∈ {1000000} -tests/value/non_natural.i:23:[kernel] more than 200(12501) elements to enumerate. Approximating. -tests/value/non_natural.i:24:[kernel] more than 200(12501) elements to enumerate. Approximating. [value:final-states] Values at end of function main2: p1[0..100001] ∈ {1; 2} or UNINITIALIZED p2[0..99999] ∈ {1; 2} or UNINITIALIZED diff --git a/tests/value/oracle/nonlin.res.oracle b/tests/value/oracle/nonlin.res.oracle index 9a4123993b14036bc61d7c3e0be0e0d858b855e2..0761285aac2a992a3d82acc405f0ce4ee83a07bf 100644 --- a/tests/value/oracle/nonlin.res.oracle +++ b/tests/value/oracle/nonlin.res.oracle @@ -1,23 +1,46 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/nonlin.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization + Frama_C_entropy_source ∈ [--..--] v ∈ [--..--] vs ∈ [--..--] -tests/value/nonlin.c:10:[value:nonlin] non-linear '((int)z + 675) * ((int)z + 675)', lv 'z' -tests/value/nonlin.c:11:[value:nonlin] non-linear '((int)z + 17817) * ((int)z + 17817)', lv 'z' -tests/value/nonlin.c:11:[value] warning: signed overflow. +[value] computing for function subdivide_integer <- main. + Called from tests/value/nonlin.c:48. +tests/value/nonlin.c:31:[value:nonlin] non-linear '((int)z + 675) * ((int)z + 675)', lv 'z' +tests/value/nonlin.c:31:[value:nonlin] subdividing on z +tests/value/nonlin.c:32:[value:nonlin] non-linear '((int)z + 17817) * ((int)z + 17817)', lv 'z' +tests/value/nonlin.c:32:[value:nonlin] subdividing on z +tests/value/nonlin.c:32:[value] warning: signed overflow. assert (int)((int)z + 17817) * (int)((int)z + 17817) ≤ 2147483647; -tests/value/nonlin.c:18:[value:nonlin] non-linear 'i1 * i1', lv 'i1' -tests/value/nonlin.c:18:[value:nonlin] non-linear '(i2 + (long long)3) * (i2 + (long long)3)', lv 'i2' -tests/value/nonlin.c:22:[value] warning: assertion got status unknown. -tests/value/nonlin.c:23:[value:nonlin] non-linear '(int)idx * (int)idx', lv 'idx' +tests/value/nonlin.c:39:[value:nonlin] non-linear '(i2 + (long long)3) * (i2 + (long long)3)', lv 'i2' +tests/value/nonlin.c:39:[value:nonlin] non-linear 'i1 * i1', lv 'i1' +tests/value/nonlin.c:39:[value:nonlin] subdividing on i2 +tests/value/nonlin.c:39:[value:nonlin] subdividing on i1 +tests/value/nonlin.c:43:[value] warning: assertion got status unknown. +tests/value/nonlin.c:44:[value:nonlin] non-linear '(int)idx * (int)idx', lv 'idx' +tests/value/nonlin.c:44:[value:nonlin] subdividing on idx +[value] Recording results for subdivide_integer +[value] Done for function subdivide_integer +[value] computing for function subdivide_pointer <- main. + Called from tests/value/nonlin.c:49. +[value] computing for function Frama_C_interval <- subdivide_pointer <- main. + Called from tests/value/nonlin.c:13. +[value] using specification for function Frama_C_interval +share/libc/__fc_builtin.h:52:[value] function Frama_C_interval: precondition got status valid. +[value] Done for function Frama_C_interval +tests/value/nonlin.c:20:[value:nonlin] non-linear '(p + i) - i', lv 'i' +tests/value/nonlin.c:20:[value:nonlin] subdividing on i +tests/value/nonlin.c:20:[value] warning: out of bounds read. assert \valid_read((p + i) - i); +tests/value/nonlin.c:24:[value:nonlin] subdividing on i +tests/value/nonlin.c:24:[value] warning: out of bounds read. assert \valid_read((p + i) - i); +[value] Recording results for subdivide_pointer +[value] Done for function subdivide_pointer [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function main: +[value:final-states] Values at end of function subdivide_integer: z ∈ [-32768..28523] k ∈ [-2..1118367364] l ∈ [0..2147395600] @@ -29,14 +52,44 @@ tests/value/nonlin.c:23:[value:nonlin] non-linear '(int)idx * (int)idx', lv 'idx t[0..100] ∈ {1} or UNINITIALIZED [101] ∈ UNINITIALIZED idx ∈ [0..10] +[value:final-states] Values at end of function subdivide_pointer: + Frama_C_entropy_source ∈ [--..--] + y ∈ {17} + x ∈ {17} + p ∈ {{ &x }} + i ∈ {{ NULL + [0..100] ; (int)&x }} + q ∈ {{ &x + [-400..400],0%4 }} +[value:final-states] Values at end of function main: + Frama_C_entropy_source ∈ [--..--] +[from] Computing for function subdivide_integer +[from] Done for function subdivide_integer +[from] Computing for function subdivide_pointer +[from] Computing for function Frama_C_interval <-subdivide_pointer +[from] Done for function Frama_C_interval +[from] Done for function subdivide_pointer [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function main: +[from] Function Frama_C_interval: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) + \result FROM Frama_C_entropy_source; min; max +[from] Function subdivide_integer: NO EFFECTS +[from] Function subdivide_pointer: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) +[from] Function main: + Frama_C_entropy_source FROM Frama_C_entropy_source (and SELF) [from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function main: +[inout] Out (internal) for function subdivide_integer: z; k; l; x; p; i1; i2; r; t[0..100]; idx -[inout] Inputs for function main: +[inout] Inputs for function subdivide_integer: v; vs +[inout] Out (internal) for function subdivide_pointer: + Frama_C_entropy_source; y; x; p; i; q +[inout] Inputs for function subdivide_pointer: + Frama_C_entropy_source; v +[inout] Out (internal) for function main: + Frama_C_entropy_source +[inout] Inputs for function main: + Frama_C_entropy_source; v; vs diff --git a/tests/value/oracle/noreturn.res.oracle b/tests/value/oracle/noreturn.res.oracle index 9cfce259c4a02e960aba061cfa794b18381a9218..17bf69c6eb6b8dd355e78ed14b32010eaef5901f 100644 --- a/tests/value/oracle/noreturn.res.oracle +++ b/tests/value/oracle/noreturn.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/noreturn.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/not.res.oracle b/tests/value/oracle/not.res.oracle index 610f0ac332ff8d427202c02768ac2dd74c6da4d4..e39706bf51bceba5dfe661ebdde83c1ab7003e4a 100644 --- a/tests/value/oracle/not.res.oracle +++ b/tests/value/oracle/not.res.oracle @@ -1,10 +1,10 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/not.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization x ∈ {0} +tests/value/not.i:4:[value] warning: initialization of volatile variable loc ignored [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/not_ct_array_arg.res.oracle b/tests/value/oracle/not_ct_array_arg.res.oracle index ebede30f6ef4dcef9680c6afcffb59a28bc2f8c3..c23496803bd8b6237e31af3d96f9d0d01a434030 100644 --- a/tests/value/oracle/not_ct_array_arg.res.oracle +++ b/tests/value/oracle/not_ct_array_arg.res.oracle @@ -1,14 +1,15 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/not_ct_array_arg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization v ∈ [--..--] +[value:initial-state] creating variable S_tb with imprecise size (type int [10][a]) tests/value/not_ct_array_arg.i:9:[value] warning: during initialization of variable 'tb', size of type 'int [a]' cannot be computed (Array with non-constant length.) tests/value/not_ct_array_arg.i:10:[value] warning: out of bounds write. assert \valid((int *)tb); -[value] DUMPING STATE of file tests/value/not_ct_array_arg.i line 11 +tests/value/not_ct_array_arg.i:11:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] a ∈ [--..--] tb ∈ {{ (int (*)[a])&S_tb }} @@ -16,9 +17,10 @@ tests/value/not_ct_array_arg.i:10:[value] warning: out of bounds write. assert \ S_tc[0..1][0..9] ∈ [--..--] S_tb[bits 0 to 31] ∈ {1} [bits 32 to ..] ∈ [--..--] or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/not_ct_array_arg.i:12:[value] warning: out of bounds write. assert \valid(&(*(tb + 9))[100]); -[value] DUMPING STATE of file tests/value/not_ct_array_arg.i line 13 +tests/value/not_ct_array_arg.i:13:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] a ∈ [--..--] tb ∈ {{ (int (*)[a])&S_tb }} @@ -30,7 +32,7 @@ tests/value/not_ct_array_arg.i:12:[value] warning: out of bounds write. assert \ [bits 32 to ..] ∈ {{ garbled mix of &{tb} (origin: Misaligned {tests/value/not_ct_array_arg.i:12}) }} or UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/not_ct_array_arg.i:14:[value] warning: out of bounds write. assert \valid(&(*(tc + 1))[1]); tests/value/not_ct_array_arg.i:16:[value] warning: accessing out of bounds index. assert 16 < 10; tests/value/not_ct_array_arg.i:16:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. diff --git a/tests/value/oracle/null_lt_valid.res.oracle b/tests/value/oracle/null_lt_valid.res.oracle index 5464cd2a2dea7de121b7295f234916464a6afed5..ba887feb939d2860df07b174283bcaf8392d7d52 100644 --- a/tests/value/oracle/null_lt_valid.res.oracle +++ b/tests/value/oracle/null_lt_valid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/null_lt_valid.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/offset_misaligned.res.oracle b/tests/value/oracle/offset_misaligned.res.oracle index a07eb1e81c3bdce24d53187b5f8c416ec117ec6c..cffefc52c2454dc5cbaaabae8f0cdd2477282670 100644 --- a/tests/value/oracle/offset_misaligned.res.oracle +++ b/tests/value/oracle/offset_misaligned.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/offset_misaligned.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/offset_neg.res.oracle b/tests/value/oracle/offset_neg.res.oracle index e72e49070ee960d12e11008434cf3538df863d70..c941bdd72b1d6cb17cff093f0dbc56f12e9eee82 100644 --- a/tests/value/oracle/offset_neg.res.oracle +++ b/tests/value/oracle/offset_neg.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/offset_neg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,13 +7,14 @@ addr ∈ {{ &mem[0] }} off ∈ {18446744073709551615} G[0..4] ∈ {0} -[value] DUMPING STATE of file tests/value/offset_neg.i line 8 +tests/value/offset_neg.i:8:[value] Frama_C_dump_each: + # Cvalue domain: mem[0] ∈ {0} addr ∈ {{ &mem + {18446744073709551616} }} off ∈ {18446744073709551615} G[0..4] ∈ {0} __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/offset_neg.i:9:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(-1); tests/value/offset_neg.i:9:[value] warning: accessing out of bounds index. assert (int)(-1) < 5; tests/value/offset_neg.i:9:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. diff --git a/tests/value/oracle/offset_top.res.oracle b/tests/value/oracle/offset_top.res.oracle index e4d179ee2915894dba5cf160c19fd24c1bf47172..7f9d6844f2886e06e3f6339fbf2ee180eac2a649 100644 --- a/tests/value/oracle/offset_top.res.oracle +++ b/tests/value/oracle/offset_top.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/offset_top.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/offsetmap.err.oracle b/tests/value/oracle/offsetmap.err.oracle new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/value/oracle/offsetmap.res.oracle b/tests/value/oracle/offsetmap.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..354cb8775345ff1f086f2b2aa2ad4f4f312db1b1 --- /dev/null +++ b/tests/value/oracle/offsetmap.res.oracle @@ -0,0 +1,186 @@ +[kernel] Parsing tests/value/offsetmap.i (no preprocessing) +[value] Analyzing a complete application starting at main +[value] Computing initial state +[value] Initial state computed +[value:initial-state] Values of globals at initialization + TT[0] ∈ {1} + [1] ∈ {2} + [2] ∈ {3} + [3..9] ∈ {0} + T[0] ∈ {1} + [1] ∈ {2} + [2] ∈ {3} + [3..9] ∈ {0} + i ∈ {0} + a ∈ {0} + b ∈ {0} + a7 ∈ {0} + b7 ∈ {0} + O1[0..19] ∈ {0} + O2[0..19] ∈ {0} + p ∈ {0} + x2 ∈ {0} + b2 ∈ {0} + a2 ∈ {0} + s[0..9999999] ∈ {0} +[value] computing for function f <- main. + Called from tests/value/offsetmap.i:74. +tests/value/offsetmap.i:18:[value] entering loop for the first time +tests/value/offsetmap.i:28:[value] entering loop for the first time +[value] Recording results for f +[value] Done for function f +[value] computing for function g <- main. + Called from tests/value/offsetmap.i:75. +tests/value/offsetmap.i:65:[value] warning: accessing out of bounds index. assert 0 ≤ i_0; +tests/value/offsetmap.i:65:[value] warning: accessing out of bounds index. assert i_0 < 10000000; +[value] Recording results for g +tests/value/offsetmap.i:67:[kernel] more than 200(10000000) elements to enumerate. Approximating. +[value] Done for function g +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function f: + TT[0][bits 0 to 7]# ∈ [0..8]%32, bits 0 to 7 + [bits 8 to 39]# ∈ [0..8] repeated %32, bits 8 to 39 + [bits 40 to 71]# ∈ [0..8] repeated %32, bits 8 to 39 + [bits 72 to 287]# ∈ [0..8] repeated %32, bits 8 to 223 + [9] ∈ {0} + T[0][bits 0 to 7]# ∈ {1}%32, bits 0 to 7 + [0][bits 8 to 31]# ∈ {0; 1}%32, bits 8 to 31 + [1][bits 0 to 7]# ∈ {0; 2}%32, bits 0 to 7 + [1][bits 8 to 31]# ∈ {0; 2}%32, bits 8 to 31 + [2][bits 0 to 7]# ∈ {0; 3}%32, bits 0 to 7 + [2][bits 8 to 31]# ∈ {0; 3}%32, bits 8 to 31 + [3..5] ∈ {0} + [6][bits 0 to 7]# ∈ {0; 7}%32, bits 0 to 7 + [6][bits 8 to 31]# ∈ {0; 7}%32, bits 8 to 31 + [7..9] ∈ {0} + i ∈ {9} + a[bits 0 to 7] ∈ {1; 6} + [bits 8 to 31]# ∈ {6}%32, bits 8 to 31 + b[bits 0 to 7] ∈ {0; 1} + [bits 8 to 31]# ∈ {0; 6}%32, bits 8 to 31 + a7[bits 0 to 7] ∈ {1} + [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 + b7 ∈ {1} + O1[0][bits 0 to 7] ∈ {0} + [0][bits 8 to 15] ∈ {18} + [0][bits 16 to 31] ∈ {0} + [1] ∈ {17} + [2..8] ∈ {0} + [9] ∈ {1} + [10..19] ∈ {0} + O2[0][bits 0 to 7]# ∈ {10}%32, bits 0 to 7 + [0][bits 8 to 15] ∈ {11} + [0][bits 16 to 31]# ∈ {10}%32, bits 16 to 31 + [1..19] ∈ {0} + p ∈ {{ &O1[9] }} + x2 ∈ {1} + b2 ∈ {{ &x2 }} + a2 ∈ {{ (int)&x2 }} +[value:final-states] Values at end of function g: + s[0..9999999] ∈ {0; 16975879} + p_0 ∈ {{ &s + [0..39999996],0%4 }} + c1 ∈ {0; 7} + q ∈ {{ &s + [0..9999999] }} + c2 ∈ {0; 1; 3; 7; 8} +[value:final-states] Values at end of function main: + TT[0][bits 0 to 7]# ∈ [0..8]%32, bits 0 to 7 + [bits 8 to 39]# ∈ [0..8] repeated %32, bits 8 to 39 + [bits 40 to 71]# ∈ [0..8] repeated %32, bits 8 to 39 + [bits 72 to 287]# ∈ [0..8] repeated %32, bits 8 to 223 + [9] ∈ {0} + T[0][bits 0 to 7]# ∈ {1}%32, bits 0 to 7 + [0][bits 8 to 31]# ∈ {0; 1}%32, bits 8 to 31 + [1][bits 0 to 7]# ∈ {0; 2}%32, bits 0 to 7 + [1][bits 8 to 31]# ∈ {0; 2}%32, bits 8 to 31 + [2][bits 0 to 7]# ∈ {0; 3}%32, bits 0 to 7 + [2][bits 8 to 31]# ∈ {0; 3}%32, bits 8 to 31 + [3..5] ∈ {0} + [6][bits 0 to 7]# ∈ {0; 7}%32, bits 0 to 7 + [6][bits 8 to 31]# ∈ {0; 7}%32, bits 8 to 31 + [7..9] ∈ {0} + i ∈ {9} + a[bits 0 to 7] ∈ {1; 6} + [bits 8 to 31]# ∈ {6}%32, bits 8 to 31 + b[bits 0 to 7] ∈ {0; 1} + [bits 8 to 31]# ∈ {0; 6}%32, bits 8 to 31 + a7[bits 0 to 7] ∈ {1} + [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 + b7 ∈ {1} + O1[0][bits 0 to 7] ∈ {0} + [0][bits 8 to 15] ∈ {18} + [0][bits 16 to 31] ∈ {0} + [1] ∈ {17} + [2..8] ∈ {0} + [9] ∈ {1} + [10..19] ∈ {0} + O2[0][bits 0 to 7]# ∈ {10}%32, bits 0 to 7 + [0][bits 8 to 15] ∈ {11} + [0][bits 16 to 31]# ∈ {10}%32, bits 16 to 31 + [1..19] ∈ {0} + p ∈ {{ &O1[9] }} + x2 ∈ {1} + b2 ∈ {{ &x2 }} + a2 ∈ {{ (int)&x2 }} + s[0..9999999] ∈ {0; 16975879} +[from] Computing for function f +[from] Done for function f +[from] Computing for function g +[from] Done for function g +[from] Computing for function main +[from] Done for function main +[from] ====== DEPENDENCIES COMPUTED ====== + These dependencies hold at termination for the executions that terminate: +[from] Function f: + TT{[0..8]; [9][bits 0 to 7]} FROM \nothing (and SELF) + T{{[0][bits 8 to 31]; [1..5]}; {[7..8]; [9][bits 0 to 7]}} + FROM \nothing (and SELF) + [6] FROM b + i FROM \nothing + a FROM b + b FROM b (and SELF) + a7 FROM \nothing + b7 FROM \nothing + O1{[0][bits 8 to 15]; [1]; [6]; [9]} FROM \nothing + O2[0] FROM \nothing + p FROM \nothing + x2 FROM \nothing + b2 FROM \nothing + a2 FROM \nothing +[from] Function g: + s[0..9999999] FROM i_0 (and SELF) +[from] Function main: + TT{[0..8]; [9][bits 0 to 7]} FROM \nothing (and SELF) + T{{[0][bits 8 to 31]; [1..5]}; {[7..8]; [9][bits 0 to 7]}} + FROM \nothing (and SELF) + [6] FROM b + i FROM \nothing + a FROM b + b FROM b (and SELF) + a7 FROM \nothing + b7 FROM \nothing + O1{[0][bits 8 to 15]; [1]; [6]; [9]} FROM \nothing + O2[0] FROM \nothing + p FROM \nothing + x2 FROM \nothing + b2 FROM \nothing + a2 FROM \nothing + s[0..9999999] FROM i_0 (and SELF) +[from] ====== END OF DEPENDENCIES ====== +[inout] Out (internal) for function f: + TT{[0..8]; [9][bits 0 to 7]}; + T{[0][bits 8 to 31]; [1..8]; [9][bits 0 to 7]}; i; a; b; a7; b7; + O1{[0][bits 8 to 15]; [1]; [6]; [9]}; O2[0]; p; x2; b2; a2 +[inout] Inputs for function f: + i; a; b; a7; p; x2; b2; a2 +[inout] Out (internal) for function g: + s[0..9999999]; p_0; c1; q; c2 +[inout] Inputs for function g: + s{[0..9999998]; [9999999][bits 0 to 7]} +[inout] Out (internal) for function main: + TT{[0..8]; [9][bits 0 to 7]}; + T{[0][bits 8 to 31]; [1..8]; [9][bits 0 to 7]}; i; a; b; a7; b7; + O1{[0][bits 8 to 15]; [1]; [6]; [9]}; O2[0]; p; x2; b2; a2; s[0..9999999] +[inout] Inputs for function main: + i; a; b; a7; p; x2; b2; a2; s{[0..9999998]; [9999999][bits 0 to 7]} diff --git a/tests/value/oracle/origin.0.res.oracle b/tests/value/oracle/origin.0.res.oracle index cfec2a51a31c24912e1149300b9b93b20f690967..7a8bf7b51ac68fe03dd60fc65619a8cf370026a5 100644 --- a/tests/value/oracle/origin.0.res.oracle +++ b/tests/value/oracle/origin.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/origin.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -117,11 +116,8 @@ tests/value/origin.i:49:[value] warning: out of bounds write. assert \valid(pm1) Called from tests/value/origin.i:103. tests/value/origin.i:54:[value] Assigning imprecise value to qm2. The imprecision originates from Misaligned {tests/value/origin.i:54} -tests/value/origin.i:55:[value] Reading left-value qm2. - It contains a garbled mix of {a; b} because of Misaligned - {tests/value/origin.i:54}. -[value] Called Frama_C_show_each({{ garbled mix of &{a; b} - (origin: Misaligned {tests/value/origin.i:54}) }}) +tests/value/origin.i:55:[value] Frama_C_show_each: + {{ garbled mix of &{a; b} (origin: Misaligned {tests/value/origin.i:54}) }} tests/value/origin.i:56:[value] warning: out of bounds write. assert \valid(qm2); [value] Recording results for origin_misalign_2 [value] Done for function origin_misalign_2 diff --git a/tests/value/oracle/origin.1.res.oracle b/tests/value/oracle/origin.1.res.oracle index 4043ca456072cee4e88e755b204d90e22cb0135a..013d901c31daecdc402b45a10682bacf8e4dd5a8 100644 --- a/tests/value/oracle/origin.1.res.oracle +++ b/tests/value/oracle/origin.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/origin.i (no preprocessing) [value] Analyzing a complete application starting at origin [value] Computing initial state diff --git a/tests/value/oracle/output_leafs.res.oracle b/tests/value/oracle/output_leafs.res.oracle index f24b41721b9036a625bbc69ef2ad7ef10b85106c..e3042f1c99553d5930baef0fa5a795854a0c5242 100644 --- a/tests/value/oracle/output_leafs.res.oracle +++ b/tests/value/oracle/output_leafs.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/output_leafs.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/overflow.0.res.oracle b/tests/value/oracle/overflow.0.res.oracle index bd4e5fdd17f861904766e1c62f8d73acfd24eda2..1217606ec52760f7e9146c0fdedb7b02d685cdb1 100644 --- a/tests/value/oracle/overflow.0.res.oracle +++ b/tests/value/oracle/overflow.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/overflow.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/overflow.1.res.oracle b/tests/value/oracle/overflow.1.res.oracle index 070ddfea13bb1796e1a97413339088b049cfba9a..95228c90c25d80abac49caf00fa316c4d801f51a 100644 --- a/tests/value/oracle/overflow.1.res.oracle +++ b/tests/value/oracle/overflow.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/overflow.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/overflow_cast_float_int.res.oracle b/tests/value/oracle/overflow_cast_float_int.res.oracle index 0fb2fe8cb1b0eb6f5c9023e0c8bbe08c9b4c5991..7b8589f7ff56c1ae1005524343720a93d1c96d4e 100644 --- a/tests/value/oracle/overflow_cast_float_int.res.oracle +++ b/tests/value/oracle/overflow_cast_float_int.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/overflow_cast_float_int.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/packed.res.oracle b/tests/value/oracle/packed.res.oracle index 0501ffee9ce9d266da9ac438941cafec6ff1f6b0..046c4b78802b43c6f4fccc5ae0077e1386efee5f 100644 --- a/tests/value/oracle/packed.res.oracle +++ b/tests/value/oracle/packed.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/packed.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/pb.res.oracle b/tests/value/oracle/pb.res.oracle index b2d8341dd22dab7e62634ab1df6efc342a447c6f..bed2b441ce5beb7e7eed0e02e7022eb2d31d8a58 100644 --- a/tests/value/oracle/pb.res.oracle +++ b/tests/value/oracle/pb.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pb.i (no preprocessing) tests/value/pb.i:2:[kernel] warning: Calling undeclared function f. Old style K&R code? [value] Analyzing a complete application starting at main diff --git a/tests/value/oracle/period.res.oracle b/tests/value/oracle/period.res.oracle index 74ed0a3e77628d063c83956f2fbffe449363764f..8de62e8b54e273b38b8d2155cd8b6512995c3018 100644 --- a/tests/value/oracle/period.res.oracle +++ b/tests/value/oracle/period.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/period.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -31,7 +30,8 @@ Ft ∈ {0} Gt ∈ {12} Ht ∈ {0} -[value] DUMPING STATE of file tests/value/period.c line 49 +tests/value/period.c:49:[value] Frama_C_dump_each: + # Cvalue domain: g[0..9] ∈ {0} Frama_C_periodic_t_320[0] ∈ {1} [1..3] ∈ {0} @@ -76,9 +76,7 @@ Ft ∈ {2} Gt ∈ {12} Ht ∈ {1} - p ∈ UNINITIALIZED - vg ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/period.c:51:[value] Assigning imprecise value to p. The imprecision originates from Arithmetic {tests/value/period.c:51} tests/value/period.c:52:[value] warning: out of bounds write. assert \valid(p); diff --git a/tests/value/oracle/plevel.res.oracle b/tests/value/oracle/plevel.res.oracle index 2da7482ef94c3be12234a994a02575f094459861..5a7111c5ba459dce59f6e87db9e4e07dbaf3e75e 100644 --- a/tests/value/oracle/plevel.res.oracle +++ b/tests/value/oracle/plevel.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/plevel.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,9 +9,9 @@ tests/value/plevel.i:11:[value] warning: assertion got status unknown. tests/value/plevel.i:13:[value] warning: assertion got status unknown. tests/value/plevel.i:21:[kernel] more than 40(65) locations to update in array. Approximating. [value] Recording results for main +tests/value/plevel.i:21:[kernel] more than 40(65) elements to enumerate. Approximating. [value] done for function main [value] ====== VALUES COMPUTED ====== -tests/value/plevel.i:21:[kernel] more than 40(65) elements to enumerate. Approximating. [value:final-states] Values at end of function main: t[0..0xFF] ∈ {0} [0x100..0x120] ∈ {0; 1} diff --git a/tests/value/oracle/pointer.res.oracle b/tests/value/oracle/pointer.res.oracle index 14919f578754598fcb3d5da4666565364a707be1..ad4d766b36d9f9c377c33401bf920818c7e3099d 100644 --- a/tests/value/oracle/pointer.res.oracle +++ b/tests/value/oracle/pointer.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/pointer2.0.res.oracle b/tests/value/oracle/pointer2.0.res.oracle index cfd049633c58e8651afea64f8da89f810117a60d..3fee10395ca36b4130a774fb78225e99bbc691ef 100644 --- a/tests/value/oracle/pointer2.0.res.oracle +++ b/tests/value/oracle/pointer2.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer2.i (no preprocessing) [value] Analyzing a complete application starting at g [value] Computing initial state diff --git a/tests/value/oracle/pointer2.1.res.oracle b/tests/value/oracle/pointer2.1.res.oracle index 93910bf2d74e492e448434e23c676c4fe18dca98..e92ec6b9010dfdef29277c3ea2dc8bfcc475db64 100644 --- a/tests/value/oracle/pointer2.1.res.oracle +++ b/tests/value/oracle/pointer2.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer2.i (no preprocessing) [value] Analyzing a complete application starting at h [value] Computing initial state diff --git a/tests/value/oracle/pointer3.res.oracle b/tests/value/oracle/pointer3.res.oracle index 6e95cc37dd4f677c784c884418f517988b4cf17e..654a0f906c444e41b2fc5e73cdf3928a0b414823 100644 --- a/tests/value/oracle/pointer3.res.oracle +++ b/tests/value/oracle/pointer3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer3.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/pointer4.res.oracle b/tests/value/oracle/pointer4.res.oracle index 27c0418963b21e0e281933196df8571d3817dfbe..9cc4451581d8b352f83b9bc6710a56cea4448448 100644 --- a/tests/value/oracle/pointer4.res.oracle +++ b/tests/value/oracle/pointer4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer4.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/pointer_arg.res.oracle b/tests/value/oracle/pointer_arg.res.oracle index d4a748e7b4ee12f4da0895d28b1311df3c0acc39..e7114d14c893ce62a3b4ec77876743c7bf867757 100644 --- a/tests/value/oracle/pointer_arg.res.oracle +++ b/tests/value/oracle/pointer_arg.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer_arg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/pointer_comp.res.oracle b/tests/value/oracle/pointer_comp.res.oracle index 15ad90b71842c90af43f6a3a13955a3255706d51..4cf2b23969ae0593ac35b1052cd68363969f78a9 100644 --- a/tests/value/oracle/pointer_comp.res.oracle +++ b/tests/value/oracle/pointer_comp.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer_comp.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -64,10 +63,9 @@ void g(void); void main(void) { int i; - void (*p)(void); void (*tmp)(void); if (v) tmp = & f; else tmp = & g; - p = tmp; + void (*p)(void) = tmp; i = & str1 == & str2; i = & s1 == (struct s *)0; i = & s1 + 1 == (struct s *)0; diff --git a/tests/value/oracle/pointer_comparison.0.res.oracle b/tests/value/oracle/pointer_comparison.0.res.oracle index 032b23abf684c28120c8024abe300b1c47313a68..6476b845e0fb0b8afa8c8b2f1ac6d18b734b050a 100644 --- a/tests/value/oracle/pointer_comparison.0.res.oracle +++ b/tests/value/oracle/pointer_comparison.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer_comparison.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,21 +6,21 @@ x ∈ {0} y ∈ {0} p ∈ {0} -[value] Called Frama_C_show_each_1t({{ &x + {4} }}) +tests/value/pointer_comparison.c:8:[value] Frama_C_show_each_1t: {{ &x + {4} }} tests/value/pointer_comparison.c:10:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -[value] Called Frama_C_show_each_2({{ &x + {8} }}) +tests/value/pointer_comparison.c:10:[value] Frama_C_show_each_2: {{ &x + {8} }} tests/value/pointer_comparison.c:12:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -[value] Called Frama_C_show_each_3({{ &x + {12} }}) +tests/value/pointer_comparison.c:12:[value] Frama_C_show_each_3: {{ &x + {12} }} tests/value/pointer_comparison.c:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -[value] Called Frama_C_show_each_4({{ &x + {16} }}) +tests/value/pointer_comparison.c:14:[value] Frama_C_show_each_4: {{ &x + {16} }} tests/value/pointer_comparison.c:16:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -[value] Called Frama_C_show_each_5({{ &x + {16} }}) +tests/value/pointer_comparison.c:16:[value] Frama_C_show_each_5: {{ &x + {16} }} tests/value/pointer_comparison.c:18:[value] entering loop for the first time tests/value/pointer_comparison.c:18:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) -[value] Called Frama_C_show_each_6({{ &x + {20} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24; 28} }}) -[value] Called Frama_C_show_each_6({{ &x + [20..--],0%4 }}) +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24; 28} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + [20..--],0%4 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -40,11 +39,8 @@ tests/value/pointer_comparison.c:18:[value:pointer-comparison] invalid pointer c [inout] Inputs for function main: p [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- [value] Analyzing a complete application starting at main [value] Computing initial state @@ -53,27 +49,27 @@ tests/value/pointer_comparison.c:18:[value:pointer-comparison] invalid pointer c x ∈ {0} y ∈ {0} p ∈ {0} -[value] Called Frama_C_show_each_1t({{ &x + {4} }}) +tests/value/pointer_comparison.c:8:[value] Frama_C_show_each_1t: {{ &x + {4} }} tests/value/pointer_comparison.c:10:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_0, (void *)(&y)); (tmp_0 from p++) -[value] Called Frama_C_show_each_2({{ &x + {8} }}) +tests/value/pointer_comparison.c:10:[value] Frama_C_show_each_2: {{ &x + {8} }} tests/value/pointer_comparison.c:12:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_1, (void *)(&y)); (tmp_1 from p++) -[value] Called Frama_C_show_each_3({{ &x + {12} }}) +tests/value/pointer_comparison.c:12:[value] Frama_C_show_each_3: {{ &x + {12} }} tests/value/pointer_comparison.c:14:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_2, (void *)(&y)); (tmp_2 from p++) -[value] Called Frama_C_show_each_4({{ &x + {16} }}) -[value] Called Frama_C_show_each_5({{ &x + {16} }}) +tests/value/pointer_comparison.c:14:[value] Frama_C_show_each_4: {{ &x + {16} }} +tests/value/pointer_comparison.c:16:[value] Frama_C_show_each_5: {{ &x + {16} }} tests/value/pointer_comparison.c:18:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_3, (void *)(&y)); (tmp_3 from p++) -[value] Called Frama_C_show_each_6({{ &x + {20} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24; 28} }}) -[value] Called Frama_C_show_each_6({{ &x + [20..--],0%4 }}) +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24; 28} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + [20..--],0%4 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -131,28 +127,28 @@ tests/value/pointer_comparison.c:18:[value] warning: pointer comparison. x ∈ {0} y ∈ {0} p ∈ {0} -[value] Called Frama_C_show_each_1t({{ &x + {4} }}) +tests/value/pointer_comparison.c:8:[value] Frama_C_show_each_1t: {{ &x + {4} }} tests/value/pointer_comparison.c:10:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_0, (void *)(&y)); (tmp_0 from p++) -[value] Called Frama_C_show_each_2({{ &x + {8} }}) +tests/value/pointer_comparison.c:10:[value] Frama_C_show_each_2: {{ &x + {8} }} tests/value/pointer_comparison.c:12:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_1, (void *)(&y)); (tmp_1 from p++) -[value] Called Frama_C_show_each_3({{ &x + {12} }}) +tests/value/pointer_comparison.c:12:[value] Frama_C_show_each_3: {{ &x + {12} }} tests/value/pointer_comparison.c:14:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_2, (void *)(&y)); (tmp_2 from p++) -[value] Called Frama_C_show_each_4({{ &x + {16} }}) +tests/value/pointer_comparison.c:14:[value] Frama_C_show_each_4: {{ &x + {16} }} tests/value/pointer_comparison.c:16:[value] warning: pointer comparison. assert \pointer_comparable((void *)p, (void *)(&y)); -[value] Called Frama_C_show_each_5({{ &x + {16} }}) +tests/value/pointer_comparison.c:16:[value] Frama_C_show_each_5: {{ &x + {16} }} tests/value/pointer_comparison.c:18:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_3, (void *)(&y)); (tmp_3 from p++) -[value] Called Frama_C_show_each_6({{ &x + {20} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24; 28} }}) -[value] Called Frama_C_show_each_6({{ &x + [20..--],0%4 }}) +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24; 28} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + [20..--],0%4 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/pointer_comparison.1.res.oracle b/tests/value/oracle/pointer_comparison.1.res.oracle index a510ff04bb5479b384aaaa524373a466b5e062f1..75ee47cd44b671574b3fc15ac08437a6908f637b 100644 --- a/tests/value/oracle/pointer_comparison.1.res.oracle +++ b/tests/value/oracle/pointer_comparison.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer_comparison.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,35 +6,35 @@ x ∈ {0} y ∈ {0} p ∈ {0} -[value] Called Frama_C_show_each_1t({{ &x + {4} }}) +tests/value/pointer_comparison.c:8:[value] Frama_C_show_each_1t: {{ &x + {4} }} tests/value/pointer_comparison.c:10:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/pointer_comparison.c:10:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA tests/value/pointer_comparison.c:10:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -[value] Called Frama_C_show_each_2({{ &x + {8} }}) -[value] Called Frama_C_show_each_2e({{ &x + {8} }}) +tests/value/pointer_comparison.c:10:[value] Frama_C_show_each_2: {{ &x + {8} }} +tests/value/pointer_comparison.c:11:[value] Frama_C_show_each_2e: {{ &x + {8} }} tests/value/pointer_comparison.c:12:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/pointer_comparison.c:12:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA tests/value/pointer_comparison.c:12:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -[value] Called Frama_C_show_each_3({{ &x + {12} }}) -[value] Called Frama_C_show_each_3e({{ &x + {12} }}) +tests/value/pointer_comparison.c:12:[value] Frama_C_show_each_3: {{ &x + {12} }} +tests/value/pointer_comparison.c:13:[value] Frama_C_show_each_3e: {{ &x + {12} }} tests/value/pointer_comparison.c:14:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/pointer_comparison.c:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA tests/value/pointer_comparison.c:14:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -[value] Called Frama_C_show_each_4({{ &x + {16} }}) -[value] Called Frama_C_show_each_4e({{ &x + {16} }}) +tests/value/pointer_comparison.c:14:[value] Frama_C_show_each_4: {{ &x + {16} }} +tests/value/pointer_comparison.c:15:[value] Frama_C_show_each_4e: {{ &x + {16} }} tests/value/pointer_comparison.c:16:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/pointer_comparison.c:16:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA tests/value/pointer_comparison.c:16:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -[value] Called Frama_C_show_each_5({{ &x + {16} }}) -[value] Called Frama_C_show_each_5e({{ &x + {16} }}) +tests/value/pointer_comparison.c:16:[value] Frama_C_show_each_5: {{ &x + {16} }} +tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: {{ &x + {16} }} tests/value/pointer_comparison.c:18:[value] entering loop for the first time tests/value/pointer_comparison.c:18:[value:pointer-comparison] invalid pointer comparison: invalid pointer(s) tests/value/pointer_comparison.c:18:[value:pointer-comparison] evaluating condition to {0; 1} instead of {1} because of UPCPA tests/value/pointer_comparison.c:18:[value:pointer-comparison] evaluating condition to {0; 1} instead of {0} because of UPCPA -[value] Called Frama_C_show_each_6({{ &x + {20} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24; 28} }}) -[value] Called Frama_C_show_each_6({{ &x + [20..--],0%4 }}) +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24; 28} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + [20..--],0%4 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -55,11 +54,8 @@ tests/value/pointer_comparison.c:18:[value:pointer-comparison] evaluating condit [inout] Inputs for function main: p [report] Computing properties status... - --------------------------------------------------------------------------------- ---- Status Report Summary -------------------------------------------------------------------------------- - 0 Total +--- No status to report -------------------------------------------------------------------------------- [value] Analyzing a complete application starting at main [value] Computing initial state @@ -68,31 +64,31 @@ tests/value/pointer_comparison.c:18:[value:pointer-comparison] evaluating condit x ∈ {0} y ∈ {0} p ∈ {0} -[value] Called Frama_C_show_each_1t({{ &x + {4} }}) +tests/value/pointer_comparison.c:8:[value] Frama_C_show_each_1t: {{ &x + {4} }} tests/value/pointer_comparison.c:10:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_0, (void *)(&y)); (tmp_0 from p++) -[value] Called Frama_C_show_each_2({{ &x + {8} }}) -[value] Called Frama_C_show_each_2e({{ &x + {8} }}) +tests/value/pointer_comparison.c:10:[value] Frama_C_show_each_2: {{ &x + {8} }} +tests/value/pointer_comparison.c:11:[value] Frama_C_show_each_2e: {{ &x + {8} }} tests/value/pointer_comparison.c:12:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_1, (void *)(&y)); (tmp_1 from p++) -[value] Called Frama_C_show_each_3({{ &x + {12} }}) -[value] Called Frama_C_show_each_3e({{ &x + {12} }}) +tests/value/pointer_comparison.c:12:[value] Frama_C_show_each_3: {{ &x + {12} }} +tests/value/pointer_comparison.c:13:[value] Frama_C_show_each_3e: {{ &x + {12} }} tests/value/pointer_comparison.c:14:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_2, (void *)(&y)); (tmp_2 from p++) -[value] Called Frama_C_show_each_4({{ &x + {16} }}) -[value] Called Frama_C_show_each_4e({{ &x + {16} }}) -[value] Called Frama_C_show_each_5({{ &x + {16} }}) -[value] Called Frama_C_show_each_5e({{ &x + {16} }}) +tests/value/pointer_comparison.c:14:[value] Frama_C_show_each_4: {{ &x + {16} }} +tests/value/pointer_comparison.c:15:[value] Frama_C_show_each_4e: {{ &x + {16} }} +tests/value/pointer_comparison.c:16:[value] Frama_C_show_each_5: {{ &x + {16} }} +tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: {{ &x + {16} }} tests/value/pointer_comparison.c:18:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_3, (void *)(&y)); (tmp_3 from p++) -[value] Called Frama_C_show_each_6({{ &x + {20} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24; 28} }}) -[value] Called Frama_C_show_each_6({{ &x + [20..--],0%4 }}) +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24; 28} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + [20..--],0%4 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -151,32 +147,32 @@ tests/value/pointer_comparison.c:18:[value] warning: pointer comparison. x ∈ {0} y ∈ {0} p ∈ {0} -[value] Called Frama_C_show_each_1t({{ &x + {4} }}) +tests/value/pointer_comparison.c:8:[value] Frama_C_show_each_1t: {{ &x + {4} }} tests/value/pointer_comparison.c:10:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_0, (void *)(&y)); (tmp_0 from p++) -[value] Called Frama_C_show_each_2({{ &x + {8} }}) -[value] Called Frama_C_show_each_2e({{ &x + {8} }}) +tests/value/pointer_comparison.c:10:[value] Frama_C_show_each_2: {{ &x + {8} }} +tests/value/pointer_comparison.c:11:[value] Frama_C_show_each_2e: {{ &x + {8} }} tests/value/pointer_comparison.c:12:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_1, (void *)(&y)); (tmp_1 from p++) -[value] Called Frama_C_show_each_3({{ &x + {12} }}) -[value] Called Frama_C_show_each_3e({{ &x + {12} }}) +tests/value/pointer_comparison.c:12:[value] Frama_C_show_each_3: {{ &x + {12} }} +tests/value/pointer_comparison.c:13:[value] Frama_C_show_each_3e: {{ &x + {12} }} tests/value/pointer_comparison.c:14:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_2, (void *)(&y)); (tmp_2 from p++) -[value] Called Frama_C_show_each_4({{ &x + {16} }}) -[value] Called Frama_C_show_each_4e({{ &x + {16} }}) +tests/value/pointer_comparison.c:14:[value] Frama_C_show_each_4: {{ &x + {16} }} +tests/value/pointer_comparison.c:15:[value] Frama_C_show_each_4e: {{ &x + {16} }} tests/value/pointer_comparison.c:16:[value] warning: pointer comparison. assert \pointer_comparable((void *)p, (void *)(&y)); -[value] Called Frama_C_show_each_5({{ &x + {16} }}) -[value] Called Frama_C_show_each_5e({{ &x + {16} }}) +tests/value/pointer_comparison.c:16:[value] Frama_C_show_each_5: {{ &x + {16} }} +tests/value/pointer_comparison.c:17:[value] Frama_C_show_each_5e: {{ &x + {16} }} tests/value/pointer_comparison.c:18:[value] warning: pointer comparison. assert \pointer_comparable((void *)tmp_3, (void *)(&y)); (tmp_3 from p++) -[value] Called Frama_C_show_each_6({{ &x + {20} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24} }}) -[value] Called Frama_C_show_each_6({{ &x + {20; 24; 28} }}) -[value] Called Frama_C_show_each_6({{ &x + [20..--],0%4 }}) +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + {20; 24; 28} }} +tests/value/pointer_comparison.c:18:[value] Frama_C_show_each_6: {{ &x + [20..--],0%4 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/pointer_int_cast.res.oracle b/tests/value/oracle/pointer_int_cast.res.oracle index dd6b3dc307d93a632150b0223c422902d4fbd846..188f10f898b723e1802ac7af8e8a351ca8083cee 100644 --- a/tests/value/oracle/pointer_int_cast.res.oracle +++ b/tests/value/oracle/pointer_int_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer_int_cast.i (no preprocessing) [value] Analyzing a complete application starting at g [value] Computing initial state diff --git a/tests/value/oracle/pointer_loop.res.oracle b/tests/value/oracle/pointer_loop.res.oracle index 266cb1e532550ebd63915ee7097ed86e981eebf4..d021bd20fcbbd55b7226d23a0e36273d30df4c66 100644 --- a/tests/value/oracle/pointer_loop.res.oracle +++ b/tests/value/oracle/pointer_loop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pointer_loop.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/postcond_leaf.res.oracle b/tests/value/oracle/postcond_leaf.res.oracle index f1057b6de454772249ca0d682b73e450612636c5..0867c19d31b6143efac39540203744916e6f0347 100644 --- a/tests/value/oracle/postcond_leaf.res.oracle +++ b/tests/value/oracle/postcond_leaf.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/postcond_leaf.c (with preprocessing) [value] user error: no assigns specified for function 'g1', for which a builtin or the specification will be used. Potential unsoundness. diff --git a/tests/value/oracle/postcondition.res.oracle b/tests/value/oracle/postcondition.res.oracle index cd207d20b695f310e3cc995aadf93a7cf9e9c299..6550acb6729bda1070081a49e5325f248ff96883 100644 --- a/tests/value/oracle/postcondition.res.oracle +++ b/tests/value/oracle/postcondition.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/postcondition.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -17,7 +16,7 @@ [value] computing for function get_index <- main. Called from tests/value/postcondition.i:84. tests/value/postcondition.i:11:[value] function get_index: precondition got status valid. -[value] Called Frama_C_show_each_cmd({1}) +tests/value/postcondition.i:17:[value] Frama_C_show_each_cmd: {1} tests/value/postcondition.i:18:[value] entering loop for the first time [value] computing for function u <- get_index <- main. Called from tests/value/postcondition.i:20. @@ -51,7 +50,7 @@ tests/value/postcondition.i:26:[value] warning: function bound: postcondition go [value] computing for function get_index <- main. Called from tests/value/postcondition.i:87. tests/value/postcondition.i:11:[value] warning: function get_index: precondition got status unknown. -[value] Called Frama_C_show_each_cmd({4}) +tests/value/postcondition.i:17:[value] Frama_C_show_each_cmd: {4} [value] computing for function u <- get_index <- main. Called from tests/value/postcondition.i:20. [value] Done for function u diff --git a/tests/value/oracle/pragma.res.oracle b/tests/value/oracle/pragma.res.oracle index 34774ad2b4bc7d37499b96385dc8d5d1a07d310b..f30eec44f3489b1ec0e619ae4337c3adc5b03d02 100644 --- a/tests/value/oracle/pragma.res.oracle +++ b/tests/value/oracle/pragma.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pragma.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/precise_locations.res.oracle b/tests/value/oracle/precise_locations.res.oracle index b5566e72b0c1c653911e72a64d902a84adedf7ca..ab354d21fe701c5a9261ba537be328ad71ef7abd 100644 --- a/tests/value/oracle/precise_locations.res.oracle +++ b/tests/value/oracle/precise_locations.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/precise_locations.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,7 +10,8 @@ r ∈ {0} tests/value/precise_locations.i:28:[value] entering loop for the first time tests/value/precise_locations.i:29:[value] entering loop for the first time -[value] DUMPING STATE of file tests/value/precise_locations.i line 33 +tests/value/precise_locations.i:33:[value] Frama_C_dump_each: + # Cvalue domain: t{[0..48]{.f1[0..4]; .f_inter[0..4]; .f2#; .f_inter2[0..4]; .[bits 328 to 351]#}; [49].f1[0..4]} ∈ {0; 10} repeated %32 [49]{.f_inter[0..4]; .f2; .f_inter2[0..4]; .[bits 328 to 351]} ∈ {0} @@ -21,7 +21,7 @@ tests/value/precise_locations.i:29:[value] entering loop for the first time r ∈ {0} v ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/precise_locations.i:34:[value] entering loop for the first time tests/value/precise_locations.i:37:[value] entering loop for the first time tests/value/precise_locations.i:38:[value] entering loop for the first time @@ -61,7 +61,8 @@ tests/value/precise_locations.i:38:[value] entering loop for the first time Called from tests/value/precise_locations.i:39. [value] Recording results for ct [value] Done for function ct -[value] DUMPING STATE of file tests/value/precise_locations.i line 42 +tests/value/precise_locations.i:42:[value] Frama_C_dump_each: + # Cvalue domain: t[0]{.f1[0..4]; .f_inter[0..4]} ∈ {0; 10; 20} [0].f2 ∈ [--..--] [bits 328 to 831]# ∈ {0; 10; 20} repeated %32, bits 8 to 511 @@ -170,7 +171,7 @@ tests/value/precise_locations.i:38:[value] entering loop for the first time r ∈ {0} v ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/precise_locations.i:44:[value] entering loop for the first time tests/value/precise_locations.i:45:[value] entering loop for the first time [value] computing for function f <- main. @@ -213,18 +214,14 @@ tests/value/precise_locations.i:21:[value] function g: precondition got status v [value] computing for function g <- main. Called from tests/value/precise_locations.i:49. [value] Done for function g -tests/value/precise_locations.i:46:[value] warning: signed overflow. assert t[j].f1[i] + 1 ≤ 2147483647; [value] computing for function f <- main. Called from tests/value/precise_locations.i:48. tests/value/precise_locations.i:18:[value] warning: function f: precondition got status unknown. [value] Done for function f -tests/value/precise_locations.i:49:[value] warning: signed overflow. assert t[j].f1[i] + 1 ≤ 2147483647; [value] computing for function g <- main. Called from tests/value/precise_locations.i:49. tests/value/precise_locations.i:21:[value] warning: function g: precondition got status unknown. [value] Done for function g -tests/value/precise_locations.i:52:[value] warning: signed overflow. assert -2147483648 ≤ q + r; -tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + r ≤ 2147483647; [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -335,9 +332,9 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + [49]{.f_inter2[0..4]; .[bits 328 to 351]} ∈ {0} i ∈ {5} j ∈ {50} - q ∈ [--..--] - r ∈ [-2147483647..2147483647] - __retres ∈ [--..--] + q ∈ [0..255] + r ∈ [0..256] + __retres ∈ [0..511] [from] Computing for function ct [from] Done for function ct [from] Computing for function main @@ -400,14 +397,6 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + --- Properties of Function 'main' -------------------------------------------------------------------------------- -[ - ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 46) - tried with Value. -[ - ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 49) - tried with Value. -[ - ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 52) - tried with Value. -[ - ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 52) - tried with Value. [ - ] Instance of 'Pre-condition (file tests/value/precise_locations.i, line 18)' at call 'f' (file tests/value/precise_locations.i, line 48) tried with Value. @@ -420,8 +409,8 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + -------------------------------------------------------------------------------- 2 Completely validated 2 Considered valid - 8 To be validated - 12 Total + 4 To be validated + 8 Total -------------------------------------------------------------------------------- [value] Analyzing a complete application starting at main [value] Computing initial state @@ -432,7 +421,8 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + j ∈ {0} q ∈ {0} r ∈ {0} -[value] DUMPING STATE of file tests/value/precise_locations.i line 33 +tests/value/precise_locations.i:33:[value] Frama_C_dump_each: + # Cvalue domain: t[0].f1[0..4] ∈ {0; 10} [0]{.f_inter[0..4]; .f2; .f_inter2[0..4]; .[bits 328 to 351]} ∈ {0} [1].f1[0..4] ∈ {0; 10} @@ -539,7 +529,7 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + r ∈ {0} v ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] computing for function ct <- main. Called from tests/value/precise_locations.i:39. [value] Recording results for ct @@ -576,7 +566,8 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + Called from tests/value/precise_locations.i:39. [value] Recording results for ct [value] Done for function ct -[value] DUMPING STATE of file tests/value/precise_locations.i line 42 +tests/value/precise_locations.i:42:[value] Frama_C_dump_each: + # Cvalue domain: t[0].f1[0..4] ∈ {0; 10; 20} [0].f_inter[0..4] ∈ {0} [0].f2 ∈ {-99; 0} @@ -783,7 +774,7 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + r ∈ {0} v ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] computing for function f <- main. Called from tests/value/precise_locations.i:48. [value] Done for function f @@ -828,9 +819,6 @@ tests/value/precise_locations.i:52:[value] warning: signed overflow. assert q + [value] Done for function g [value] Recording results for main [value] done for function main -tests/value/precise_locations.i:46:[value] assertion 'Value,signed_overflow' got final status valid. -tests/value/precise_locations.i:49:[value] assertion 'Value,signed_overflow' got final status valid. -tests/value/precise_locations.i:52:[value] assertion 'Value,signed_overflow' got final status valid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function ct: __retres ∈ {20} @@ -1220,14 +1208,6 @@ tests/value/precise_locations.i:52:[value] assertion 'Value,signed_overflow' got --- Properties of Function 'main' -------------------------------------------------------------------------------- -[ Valid ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 46) - by Value (v2). -[ Valid ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 49) - by Value (v2). -[ Valid ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 52) - by Value (v2). -[ Valid ] Assertion 'Value,signed_overflow' (file tests/value/precise_locations.i, line 52) - by Value (v2). [ Valid ] Instance of 'Pre-condition (file tests/value/precise_locations.i, line 18)' at call 'f' (file tests/value/precise_locations.i, line 48) by Value (v2). @@ -1238,7 +1218,7 @@ tests/value/precise_locations.i:52:[value] assertion 'Value,signed_overflow' got -------------------------------------------------------------------------------- --- Status Report Summary -------------------------------------------------------------------------------- - 10 Completely validated + 6 Completely validated 2 Considered valid - 12 Total + 8 Total -------------------------------------------------------------------------------- diff --git a/tests/value/oracle/precond.res.oracle b/tests/value/oracle/precond.res.oracle index 940ed18476a745a399fd28eb4fd54bdc036fa60b..1d7083b30257aaeb6e8632f995872a6dedd4a99f 100644 --- a/tests/value/oracle/precond.res.oracle +++ b/tests/value/oracle/precond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/precond.c (with preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -115,39 +114,39 @@ tests/value/precond.c:9:[value] warning: function f: precondition got status inv [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 8)' at call 'f' (file tests/value/precond.c, line 31) - status of 'requires i + 1 ≥ 0' of f at stmt 11 + status of 'requires i + 1 ≥ 0' of f at stmt 10 by Value. [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 9)' at call 'f' (file tests/value/precond.c, line 31) - status of 'requires i ≥ 0' of f at stmt 11 + status of 'requires i ≥ 0' of f at stmt 10 by Value. [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 8)' at call 'f' (file tests/value/precond.c, line 32) - status of 'requires i + 1 ≥ 0' of f at stmt 14 + status of 'requires i + 1 ≥ 0' of f at stmt 13 by Value. [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 9)' at call 'f' (file tests/value/precond.c, line 32) - status of 'requires i ≥ 0' of f at stmt 14 + status of 'requires i ≥ 0' of f at stmt 13 by Value. [ - ] Instance of 'Pre-condition (file tests/value/precond.c, line 24)' at call 'g' (file tests/value/precond.c, line 34) - status of 'requires x ≤ 8' of g at stmt 17 + status of 'requires x ≤ 8' of g at stmt 16 tried with Value. [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 8)' at instruction (file tests/value/precond.c, line 39) - status of 'requires i + 1 ≥ 0' of f at stmt 20 + status of 'requires i + 1 ≥ 0' of f at stmt 19 by Value. [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 9)' at instruction (file tests/value/precond.c, line 39) - status of 'requires i ≥ 0' of f at stmt 20 + status of 'requires i ≥ 0' of f at stmt 19 by Value. [ Valid ] Instance of 'Pre-condition (file tests/value/precond.c, line 8)' at instruction (file tests/value/precond.c, line 40) - status of 'requires i + 1 ≥ 0' of f at stmt 21 + status of 'requires i + 1 ≥ 0' of f at stmt 20 by Value. [ Alarm ] Instance of 'Pre-condition (file tests/value/precond.c, line 9)' at instruction (file tests/value/precond.c, line 40) - status of 'requires i ≥ 0' of f at stmt 21 + status of 'requires i ≥ 0' of f at stmt 20 By Value, with pending: - Unreachable instruction (file tests/value/precond.c, line 40) diff --git a/tests/value/oracle/precond2.0.res.oracle b/tests/value/oracle/precond2.0.res.oracle index f841ee8962f9b0d5d7239e43104f713878872cdb..dbd80235c95712d820f1429f9d4877e784c46348 100644 --- a/tests/value/oracle/precond2.0.res.oracle +++ b/tests/value/oracle/precond2.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/precond2.c (with preprocessing) [rte] annotating function f [rte] annotating function main @@ -66,23 +65,23 @@ tests/value/precond2.c:16:[value] function g: precondition got status valid. --- Properties of Function 'main' -------------------------------------------------------------------------------- -[ Valid ] Pre-condition for 'pre_f' (generated) at call 'f' (file tests/value/precond2.c, line 21) +[ Valid ] Pre-condition for 'pre_f' (file tests/value/precond2.c, line 9) at call 'f' (file tests/value/precond2.c, line 21) requires 1 + 1 ≥ 0 by Value. -[ Valid ] Pre-condition for 'pre_f' (generated) at call 'f' (file tests/value/precond2.c, line 21) +[ Valid ] Pre-condition for 'pre_f' (file tests/value/precond2.c, line 10) at call 'f' (file tests/value/precond2.c, line 21) requires 1 ≥ 0 by Value. -[ Valid ] Pre-condition for 'pre_f_2' (generated) at call 'f' (file tests/value/precond2.c, line 22) +[ Valid ] Pre-condition for 'pre_f_2' (file tests/value/precond2.c, line 9) at call 'f' (file tests/value/precond2.c, line 22) requires (int)(-1) + 1 ≥ 0 by Value. -[ Alarm ] Pre-condition for 'pre_f_2' (generated) at call 'f' (file tests/value/precond2.c, line 22) +[ Alarm ] Pre-condition for 'pre_f_2' (file tests/value/precond2.c, line 10) at call 'f' (file tests/value/precond2.c, line 22) requires (int)(-1) ≥ 0 By Value, with pending: - Unreachable call 'f' (file tests/value/precond2.c, line 22) -[ Valid ] Pre-condition for 'pre_g' (generated) at call 'g' (file tests/value/precond2.c, line 24) +[ Valid ] Pre-condition for 'pre_g' (file tests/value/precond2.c, line 16) at call 'g' (file tests/value/precond2.c, line 24) requires x ≤ 8 by Value. -[ Valid ] Pre-condition for 'pre_g_2' (generated) at call 'g' (file tests/value/precond2.c, line 24) +[ Valid ] Pre-condition for 'pre_g_2' (file tests/value/precond2.c, line 16) at call 'g' (file tests/value/precond2.c, line 24) requires x ≤ 8 by Value. diff --git a/tests/value/oracle/precond2.1.res.oracle b/tests/value/oracle/precond2.1.res.oracle index d336e0f4927e15a6a04e1bdb7620f28fa9b43f87..13b9652dae98221fd02eb9e8a19e45f78fe7e117 100644 --- a/tests/value/oracle/precond2.1.res.oracle +++ b/tests/value/oracle/precond2.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/precond2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/propagate_bottom.res.oracle b/tests/value/oracle/propagate_bottom.res.oracle index 66c726ac7be2e2e5a5038ec4b737b76059bd369b..e84873f1807e336b69f53e3750e7414fe26fc14e 100644 --- a/tests/value/oracle/propagate_bottom.res.oracle +++ b/tests/value/oracle/propagate_bottom.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/propagate_bottom.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/protomain.res.oracle b/tests/value/oracle/protomain.res.oracle index 7b78ec660492046d1049b87a8b8a3e5cb8ac234c..3a9a504b8168e8d6020f74801e04eba23d569073 100644 --- a/tests/value/oracle/protomain.res.oracle +++ b/tests/value/oracle/protomain.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/protomain.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ptr_call_object.res.oracle b/tests/value/oracle/ptr_call_object.res.oracle index f7ec1314111b73d82b43016336f5e007d9e73553..cd9a4dcd5d3d7bf5e52074ffc40b88c5bf3c865a 100644 --- a/tests/value/oracle/ptr_call_object.res.oracle +++ b/tests/value/oracle/ptr_call_object.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ptr_call_object.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,19 +10,19 @@ [value] Done for function rand [value] computing for function next_0 <- main. Called from tests/value/ptr_call_object.c:34. -[value] Called Frama_C_show_each_p_in_next_0({{ &o0 }}, - .next ∈ {{ &next_0 }} - .i ∈ UNINITIALIZED) +tests/value/ptr_call_object.c:16:[value] Frama_C_show_each_p_in_next_0: + {{ &o0 }}, .next ∈ {{ &next_0 }} + .i ∈ UNINITIALIZED [value] Recording results for next_0 [value] Done for function next_0 [value] computing for function next_1 <- main. Called from tests/value/ptr_call_object.c:34. -[value] Called Frama_C_show_each_p_in_next_1({{ &o1 }}, - .next ∈ {{ &next_1 }} - .i ∈ UNINITIALIZED) +tests/value/ptr_call_object.c:11:[value] Frama_C_show_each_p_in_next_1: + {{ &o1 }}, .next ∈ {{ &next_1 }} + .i ∈ UNINITIALIZED [value] Recording results for next_1 [value] Done for function next_1 -[value] Called Frama_C_show_each_x({{ &o1 }}) +tests/value/ptr_call_object.c:35:[value] Frama_C_show_each_x: {{ &o1 }} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/ptr_relation.0.res.oracle b/tests/value/oracle/ptr_relation.0.res.oracle index bf9a6983b41688f1171d9714e3532066d3f070aa..47e445f10d0e2f9981f1254a8f428810c6000b35 100644 --- a/tests/value/oracle/ptr_relation.0.res.oracle +++ b/tests/value/oracle/ptr_relation.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ptr_relation.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ptr_relation.1.res.oracle b/tests/value/oracle/ptr_relation.1.res.oracle index 759d3c08def409dac8e1ba741e7cf5fa7f29c6fe..6cd4607d9f880f2706b4c0540a5c7600c25d42e6 100644 --- a/tests/value/oracle/ptr_relation.1.res.oracle +++ b/tests/value/oracle/ptr_relation.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ptr_relation.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state diff --git a/tests/value/oracle/ptr_relation.2.res.oracle b/tests/value/oracle/ptr_relation.2.res.oracle index 5787f168c8d0a5986a283ae05764d71a34f8073e..4f324662da34270a3738dfd30ac9639755af3ded 100644 --- a/tests/value/oracle/ptr_relation.2.res.oracle +++ b/tests/value/oracle/ptr_relation.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ptr_relation.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state diff --git a/tests/value/oracle/pure_exp.res.oracle b/tests/value/oracle/pure_exp.res.oracle index 620893074bd0d6c57d072bf11ad3b3e2f02fcf2d..53753e4157801abde076a191f51cb4a8ef56a869 100644 --- a/tests/value/oracle/pure_exp.res.oracle +++ b/tests/value/oracle/pure_exp.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/pure_exp.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/qualified_arrays.res.oracle b/tests/value/oracle/qualified_arrays.res.oracle index 0ab7ad301931d7df258a368c602e72779d600a28..62e883da5c2f267f48c7ba5e06db9140466074b7 100644 --- a/tests/value/oracle/qualified_arrays.res.oracle +++ b/tests/value/oracle/qualified_arrays.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/qualified_arrays.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/raz.res.oracle b/tests/value/oracle/raz.res.oracle index 29c816f619daeb9808f57f4aa4199fd2181638a7..87f58c7b8efed0e51945c375ad5aef2642561c15 100644 --- a/tests/value/oracle/raz.res.oracle +++ b/tests/value/oracle/raz.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/raz.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/reading_null.res.oracle b/tests/value/oracle/reading_null.res.oracle index daa447924d069582e7b14edcf9264fccad8d0e64..1101e433cb139cd30200f642e84da9b703c10cf9 100644 --- a/tests/value/oracle/reading_null.res.oracle +++ b/tests/value/oracle/reading_null.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/reading_null.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -20,10 +19,10 @@ S_0_T[0..1] ∈ [--..--] S_1_T[0..1] ∈ [--..--] tests/value/reading_null.i:24:[value] entering loop for the first time -[value] Called Frama_C_show_each_F([-2147483648..2147483647], {0}) -[value] Called Frama_C_show_each_F([-2147483648..2147483647], {0; 1}) -[value] Called Frama_C_show_each_F([-2147483648..2147483647], {0; 1; 2}) -[value] Called Frama_C_show_each_F([-2147483648..2147483647], [0..9]) +tests/value/reading_null.i:25:[value] Frama_C_show_each_F: [-2147483648..2147483647], {0} +tests/value/reading_null.i:25:[value] Frama_C_show_each_F: [-2147483648..2147483647], {0; 1} +tests/value/reading_null.i:25:[value] Frama_C_show_each_F: [-2147483648..2147483647], {0; 1; 2} +tests/value/reading_null.i:25:[value] Frama_C_show_each_F: [-2147483648..2147483647], [0..9] [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/rec.res.oracle b/tests/value/oracle/rec.res.oracle index 97eadad89320919e9b706cb0dc1619d30d8d3ea6..cfb5ba552183eeb7115aeadbd7fca323b5dc3e3c 100644 --- a/tests/value/oracle/rec.res.oracle +++ b/tests/value/oracle/rec.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/rec.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/recol.0.res.oracle b/tests/value/oracle/recol.0.res.oracle index df2bf026fc6c4a28d8c642391548ed4ecda6bf6c..d3d1e20f04d42b575da506352fc6cb3d33af893e 100644 --- a/tests/value/oracle/recol.0.res.oracle +++ b/tests/value/oracle/recol.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/recol.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/recol.1.res.oracle b/tests/value/oracle/recol.1.res.oracle index 5b0a8019647c4fb7f68ecb9fd4aeeacb6ff9f577..f1841c27fe90a75a4b9740b9372d4a7968c9d104 100644 --- a/tests/value/oracle/recol.1.res.oracle +++ b/tests/value/oracle/recol.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/recol.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/recursion.0.res.oracle b/tests/value/oracle/recursion.0.res.oracle index d775461c75ade3c1ad86cff9bd99900ec6ebda84..4fcbae62a03f4475af926c5dea70ef07229cbcc1 100644 --- a/tests/value/oracle/recursion.0.res.oracle +++ b/tests/value/oracle/recursion.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/recursion.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/recursion.1.res.oracle b/tests/value/oracle/recursion.1.res.oracle index 2a36df16032ca366af71c96558a357222fab6db7..ed73b92abe60dd544f6a168ce6daf653508e7b6e 100644 --- a/tests/value/oracle/recursion.1.res.oracle +++ b/tests/value/oracle/recursion.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/recursion.i (no preprocessing) [value] Analyzing an incomplete application starting at main [value] Computing initial state @@ -12,8 +11,89 @@ S_pg[0..1] ∈ [--..--] [value] computing for function ff <- main. Called from tests/value/recursion.i:67. -tests/value/recursion.i:8:[value] warning: recursive call during value analysis - of ff (ff <- ff :: tests/value/recursion.i:67 <- main). - Using specification of ff. -tests/value/recursion.i:8:[value] user error: Recursive call to a function. -[kernel] Plug-in value aborted: invalid user input. +tests/value/recursion.i:8:[value] user error: recursive call during value analysis + of ff (ff <- ff :: tests/value/recursion.i:67 <- main). Assuming the call has + no effect. The analysis will be unsound.] +[value] computing for function ff <- ff <- main. + Called from tests/value/recursion.i:8. +[value] using specification for function ff +[value] Done for function ff +[value] Recording results for ff +[value] Done for function ff +[value] computing for function g <- main. + Called from tests/value/recursion.i:68. +tests/value/recursion.i:39:[value] user error: recursive call during value analysis + of g (g <- g :: tests/value/recursion.i:68 <- main). Assuming the call has + no effect. The analysis will be unsound.] +[value] computing for function g <- g <- main. + Called from tests/value/recursion.i:39. +[value] using specification for function g +[value] Done for function g +[value] Recording results for g +[value] Done for function g +[value] computing for function h <- main. + Called from tests/value/recursion.i:70. +tests/value/recursion.i:44:[value] user error: recursive call during value analysis + of h (h <- h :: tests/value/recursion.i:70 <- main). Assuming the call has + no effect. The analysis will be unsound.] +[value] computing for function h <- h <- main. + Called from tests/value/recursion.i:44. +[value] using specification for function h +[value] Done for function h +[value] Recording results for h +[value] Done for function h +tests/value/recursion.i:71:[value] Frama_C_show_each: Bottom, Bottom +[value] computing for function escaping_formal <- main. + Called from tests/value/recursion.i:72. +tests/value/recursion.i:52:[value] function escaping_formal: precondition got status valid. +tests/value/recursion.i:58:[value] Frama_C_show_each: {{ &i }}, {10}, {0}, {10} +tests/value/recursion.i:59:[value] user error: recursive call during value analysis + of escaping_formal (escaping_formal <- escaping_formal :: tests/value/recursion.i:72 <- + main). + Assuming the call has no effect. The analysis will be unsound.] +tests/value/recursion.i:59:[value] user error: function 'escaping_formal' (involved in a recursive call) has a formal parameter whose address is taken. Analysis may be unsound. +[value] computing for function escaping_formal <- escaping_formal <- main. + Called from tests/value/recursion.i:59. +[value] using specification for function escaping_formal +[value] Done for function escaping_formal +tests/value/recursion.i:62:[value] Frama_C_show_each: {{ &i }}, {10}, {0}, {10} +tests/value/recursion.i:54:[value] function escaping_formal: postcondition got status valid. +[value] Recording results for escaping_formal +[value] Done for function escaping_formal +[value] computing for function f <- main. + Called from tests/value/recursion.i:73. +tests/value/recursion.i:28:[value] Frama_C_show_each: {2}, {0} +tests/value/recursion.i:30:[value] user error: recursive call during value analysis + of f (f <- f :: tests/value/recursion.i:73 <- main). Assuming the call has + no effect. The analysis will be unsound.] +[value] computing for function f <- f <- main. + Called from tests/value/recursion.i:30. +[value] using specification for function f +[value] Done for function f +tests/value/recursion.i:31:[value] Frama_C_show_each: {2}, {0} +[value] Recording results for f +[value] Done for function f +tests/value/recursion.i:74:[value] Frama_C_show_each: {2} +tests/value/recursion.i:75:[value] warning: signed overflow. assert r.f1 + 1 ≤ 2147483647; +[value] Recording results for main +[value] done for function main +[value] ====== VALUES COMPUTED ====== +[value:final-states] Values at end of function escaping_formal: + pg ∈ {0} +[value:final-states] Values at end of function f: + x ∈ {2} + s ∈ [--..--] +[value:final-states] Values at end of function ff: + __retres ∈ {5} +[value:final-states] Values at end of function g: + +[value:final-states] Values at end of function h: + +[value:final-states] Values at end of function main: + G ∈ {5} + x ∈ {2} + s ∈ [--..--] + pg ∈ {0} + r.f1 ∈ [-2147483648..2147483646] + .f2 ∈ [--..--] + __retres ∈ [-2147483647..2147483647] diff --git a/tests/value/oracle/recursion2.res.oracle b/tests/value/oracle/recursion2.res.oracle index 3f59ff1356c99ae6185d5b8d17aee9aa7ee3fed2..e22c4448a4f8b306367277e1f26dfb827e41a5a5 100644 --- a/tests/value/oracle/recursion2.res.oracle +++ b/tests/value/oracle/recursion2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/recursion2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -39,9 +38,9 @@ x; y; i; j [inout] InOut (internal) for function h1: Operational inputs: - x; i + x; y; i Operational inputs on termination: - x; i + x; y; i Sure outputs: r [inout] Out (internal) for function h2: @@ -50,9 +49,9 @@ x; y; i; j [inout] InOut (internal) for function h2: Operational inputs: - x; y; i; j + x; y; j Operational inputs on termination: - x; y; i; j + x; y; j Sure outputs: q [inout] Out (internal) for function main: @@ -61,8 +60,8 @@ x; y [inout] InOut (internal) for function main: Operational inputs: - x; y; i; j + x; y Operational inputs on termination: - x; y; i; j + x; y Sure outputs: - r; q + \nothing diff --git a/tests/value/oracle/reduce_by_valid.res.oracle b/tests/value/oracle/reduce_by_valid.res.oracle index 88b461b2edc7ac3e42caac9996e0c96ed87e230a..456366a7aa3dc9fc9ed5e80f8a499709f48d1155 100644 --- a/tests/value/oracle/reduce_by_valid.res.oracle +++ b/tests/value/oracle/reduce_by_valid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/reduce_by_valid.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -91,46 +90,47 @@ tests/value/reduce_by_valid.i:165:[value] assertion got status valid. [value] computing for function main10 <- main. Called from tests/value/reduce_by_valid.i:269. tests/value/reduce_by_valid.i:176:[value] warning: out of bounds write. assert \valid((int *)p); -[value] Called Frama_C_show_each_main10_1({{ &t_0 + [0..36] }}) +tests/value/reduce_by_valid.i:177:[value] Frama_C_show_each_main10_1: {{ &t_0 + [0..36] }} tests/value/reduce_by_valid.i:178:[value] assertion got status valid. tests/value/reduce_by_valid.i:181:[value] warning: out of bounds write. assert \valid((int *)p + 2); -[value] Called Frama_C_show_each_main10_2({{ &t_0 + [-8..28] }}) +tests/value/reduce_by_valid.i:182:[value] Frama_C_show_each_main10_2: {{ &t_0 + [-8..28] }} tests/value/reduce_by_valid.i:183:[value] assertion got status valid. tests/value/reduce_by_valid.i:186:[value] warning: out of bounds write. assert \valid((int *)(p + 2)); -[value] Called Frama_C_show_each_main10_3({{ &t_0 + [-2..34] }}) +tests/value/reduce_by_valid.i:187:[value] Frama_C_show_each_main10_3: {{ &t_0 + [-2..34] }} tests/value/reduce_by_valid.i:188:[value] assertion got status valid. tests/value/reduce_by_valid.i:197:[value] warning: out of bounds write. assert \valid(&((struct s_1 *)p)->b); -[value] Called Frama_C_show_each_main10_4({{ &t_0 + [-4..32] }}) +tests/value/reduce_by_valid.i:198:[value] Frama_C_show_each_main10_4: {{ &t_0 + [-4..32] }} tests/value/reduce_by_valid.i:200:[value] assertion got status valid. tests/value/reduce_by_valid.i:203:[value] warning: out of bounds write. assert \valid(&((struct s_1 *)p + 2)->b); -[value] Called Frama_C_show_each_main10_4({{ &t_0 + [-20..16] }}) +tests/value/reduce_by_valid.i:204:[value] Frama_C_show_each_main10_4: {{ &t_0 + [-20..16] }} tests/value/reduce_by_valid.i:206:[value] assertion got status valid. tests/value/reduce_by_valid.i:210:[value] warning: out of bounds write. assert \valid((char *)q); -[value] Called Frama_C_show_each({{ &u_0 + [0..79] }}) +tests/value/reduce_by_valid.i:211:[value] Frama_C_show_each: {{ &u_0 + [0..79] }} tests/value/reduce_by_valid.i:213:[value] assertion got status valid. tests/value/reduce_by_valid.i:216:[value] warning: out of bounds write. assert \valid((char *)q + 2); -[value] Called Frama_C_show_each({{ &u_0 + [-2..77] }}) +tests/value/reduce_by_valid.i:217:[value] Frama_C_show_each: {{ &u_0 + [-2..77] }} tests/value/reduce_by_valid.i:219:[value] assertion got status valid. [value] Recording results for main10 [value] Done for function main10 [value] computing for function main11 <- main. Called from tests/value/reduce_by_valid.i:270. tests/value/reduce_by_valid.i:228:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({{ &TC + [10..410] }}) +tests/value/reduce_by_valid.i:230:[value] Frama_C_show_each: {{ &TC + [10..410] }} tests/value/reduce_by_valid.i:231:[value] warning: assertion got status unknown. tests/value/reduce_by_valid.i:237:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({{ &TU + [40..1640],0%4 }}) +tests/value/reduce_by_valid.i:239:[value] Frama_C_show_each: {{ &TU + [40..1640],0%4 }} tests/value/reduce_by_valid.i:240:[value] warning: assertion got status unknown. tests/value/reduce_by_valid.i:245:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({{ &TU + [40..840] }}) +tests/value/reduce_by_valid.i:247:[value] Frama_C_show_each: {{ &TU + [40..840] }} tests/value/reduce_by_valid.i:248:[value] warning: assertion got status unknown. tests/value/reduce_by_valid.i:253:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each({{ &TC + [10..410],2%4 }}) +tests/value/reduce_by_valid.i:255:[value] Frama_C_show_each: {{ &TC + [10..410],2%4 }} tests/value/reduce_by_valid.i:256:[value] warning: assertion got status unknown. [value] Recording results for main11 [value] Done for function main11 [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 12 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main1: t[0..2] ∈ {0} diff --git a/tests/value/oracle/reduce_formals.res.oracle b/tests/value/oracle/reduce_formals.res.oracle index a90e671f1de152164af2f68db4a97cb9175dacb3..00af359b6a65c37486df62095f11795d220c7316 100644 --- a/tests/value/oracle/reduce_formals.res.oracle +++ b/tests/value/oracle/reduce_formals.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/reduce_formals.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -16,14 +15,15 @@ tests/value/reduce_formals.i:5:[value] entering loop for the first time [value] using specification for function main2 tests/value/reduce_formals.i:8:[value] warning: function main2: precondition got status unknown. [value] Done for function main2 -[value] DUMPING STATE of file tests/value/reduce_formals.i line 72 +tests/value/reduce_formals.i:72:[value] Frama_C_dump_each: + # Cvalue domain: g ∈ [--..--] v ∈ [--..--] w ∈ [6..2147483647] x ∈ [5..2147483647] y ∈ [--..--] z ∈ [8..2147483647] - =END OF DUMP== + ==END OF DUMP== [value] computing for function main3 <- main. Called from tests/value/reduce_formals.i:75. tests/value/reduce_formals.i:18:[value] assertion got status valid. @@ -31,7 +31,7 @@ tests/value/reduce_formals.i:18:[value] assertion got status valid. Called from tests/value/reduce_formals.i:19. [value] Recording results for f_main3 [value] Done for function f_main3 -[value] Called Frama_C_show_each({6}) +tests/value/reduce_formals.i:20:[value] Frama_C_show_each: {6} [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. @@ -41,13 +41,13 @@ tests/value/reduce_formals.i:18:[value] assertion got status valid. tests/value/reduce_formals.i:24:[value] warning: assertion got status unknown. [value] Recording results for f_main4_1 [value] Done for function f_main4_1 -[value] Called Frama_C_show_each_v({10; 11; 12; 13; 14; 15}) +tests/value/reduce_formals.i:34:[value] Frama_C_show_each_v: {10; 11; 12; 13; 14; 15} [value] computing for function f_main4_2 <- main4 <- main. Called from tests/value/reduce_formals.i:36. tests/value/reduce_formals.i:28:[value] warning: assertion got status unknown. [value] Recording results for f_main4_2 [value] Done for function f_main4_2 -[value] Called Frama_C_show_each_v({16; 17; 18; 19; 20}) +tests/value/reduce_formals.i:37:[value] Frama_C_show_each_v: {16; 17; 18; 19; 20} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. @@ -70,7 +70,7 @@ tests/value/reduce_formals.i:63:[value] warning: assertion got status unknown. tests/value/reduce_formals.i:58:[value] warning: assertion got status unknown. [value] Recording results for f_main6 [value] Done for function f_main6 -[value] Called Frama_C_show_each_6({3}) +tests/value/reduce_formals.i:65:[value] Frama_C_show_each_6: {3} [value] Recording results for main6 [value] Done for function main6 [value] Recording results for main diff --git a/tests/value/oracle/reduce_index.res.oracle b/tests/value/oracle/reduce_index.res.oracle index 788285f2d02a89002743b9f2c14a335355c43d3e..e84555262c473514b9107ade21c29739ea84406e 100644 --- a/tests/value/oracle/reduce_index.res.oracle +++ b/tests/value/oracle/reduce_index.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/reduce_index.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/reduce_valid.res.oracle b/tests/value/oracle/reduce_valid.res.oracle index 39582882be9d44c7b91eae2f441308b130b28529..6b1b7d95d280d98272b401b1be5eda6eb1208cbc 100644 --- a/tests/value/oracle/reduce_valid.res.oracle +++ b/tests/value/oracle/reduce_valid.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/reduce_valid.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -12,11 +11,11 @@ A ∈ {0} offs ∈ {0} tests/value/reduce_valid.i:9:[value] warning: out of bounds write. assert \valid(p); -[value] Called Frama_C_show_each_ici({0}) +tests/value/reduce_valid.i:16:[value] Frama_C_show_each_ici: {0} tests/value/reduce_valid.i:17:[value] warning: out of bounds write. assert \valid(q); tests/value/reduce_valid.i:17:[kernel] warning: all target addresses were invalid. This path is assumed to be dead. tests/value/reduce_valid.i:24:[value] warning: out of bounds read. assert \valid_read(r + offs); -[value] Called Frama_C_show_each_r({{ &t }}) +tests/value/reduce_valid.i:25:[value] Frama_C_show_each_r: {{ &t }} tests/value/reduce_valid.i:26:[value] warning: accessing out of bounds index. assert (int)((int)h + 1) < 2; [value] Recording results for main [value] done for function main diff --git a/tests/value/oracle/redundant_alarms.res.oracle b/tests/value/oracle/redundant_alarms.res.oracle index 7c8c11b6d251e8802f1fee9b1d4263037fd039ff..9732ca48004f5329feb1b75a5264b0a4e440874a 100644 --- a/tests/value/oracle/redundant_alarms.res.oracle +++ b/tests/value/oracle/redundant_alarms.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/redundant_alarms.c (with preprocessing) [slicing] slicing requests in progress... [value] Analyzing a complete application starting at main @@ -7,14 +6,14 @@ [value:initial-state] Values of globals at initialization v ∈ [--..--] [value] computing for function main1 <- main. - Called from tests/value/redundant_alarms.c:50. + Called from tests/value/redundant_alarms.c:62. tests/value/redundant_alarms.c:11:[value] warning: accessing uninitialized left-value. assert \initialized(p); tests/value/redundant_alarms.c:12:[value] warning: accessing uninitialized left-value. assert \initialized(p); tests/value/redundant_alarms.c:15:[value] warning: accessing uninitialized left-value. assert \initialized(p); [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/redundant_alarms.c:51. + Called from tests/value/redundant_alarms.c:63. tests/value/redundant_alarms.c:20:[value] warning: accessing out of bounds index. assert 0 ≤ i; tests/value/redundant_alarms.c:20:[value] warning: accessing out of bounds index. assert i < 10; tests/value/redundant_alarms.c:21:[value] warning: accessing uninitialized left-value. assert \initialized(&t[i]); @@ -22,7 +21,7 @@ tests/value/redundant_alarms.c:22:[value] warning: accessing uninitialized left- [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/redundant_alarms.c:52. + Called from tests/value/redundant_alarms.c:64. tests/value/redundant_alarms.c:25:[value] warning: function main3: precondition got status unknown. tests/value/redundant_alarms.c:31:[value] warning: accessing uninitialized left-value. assert \initialized(&t[i]); tests/value/redundant_alarms.c:31:[value] warning: accessing uninitialized left-value. assert \initialized(&t[j]); @@ -31,11 +30,18 @@ tests/value/redundant_alarms.c:33:[value] warning: accessing uninitialized left- [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/redundant_alarms.c:53. + Called from tests/value/redundant_alarms.c:65. tests/value/redundant_alarms.c:39:[value] entering loop for the first time tests/value/redundant_alarms.c:41:[value] warning: assertion got status unknown. [value] Recording results for main4 [value] Done for function main4 +[value] computing for function main5 <- main. + Called from tests/value/redundant_alarms.c:66. +tests/value/redundant_alarms.c:55:[value] assertion got status valid. +tests/value/redundant_alarms.c:55:[value] warning: locals {x} escaping the scope of a block of main5 through p +tests/value/redundant_alarms.c:58:[value] warning: assertion got status unknown. +[value] Recording results for main5 +[value] Done for function main5 [value] Recording results for main [value] done for function main tests/value/redundant_alarms.c:15:[value] assertion 'Value,initialisation' got final status invalid. @@ -43,7 +49,7 @@ tests/value/redundant_alarms.c:15:[value] assertion 'Value,initialisation' got f tests/value/redundant_alarms.c:12:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(p); tests/value/redundant_alarms.c:32:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(&t[j]); tests/value/redundant_alarms.c:33:[scope:rm_asserts] removing redundant assert Value: initialisation: \initialized(&t[i]); -[slicing] making slicing project 'Slicing'... +[slicing] initializing slicing ... [slicing] interpreting slicing requests from the command line... [pdg] computing for function main1 [pdg] done for function main1 @@ -62,6 +68,8 @@ tests/value/redundant_alarms.c:33:[scope:rm_asserts] removing redundant assert V [from] Computing for function main4 [from] Non-terminating function main4 (no dependencies) [from] Done for function main4 +[from] Computing for function main5 +[from] Done for function main5 [pdg] done for function main [slicing] exporting project to 'Slicing export'... [slicing] applying all slicing requests... @@ -75,17 +83,14 @@ void main1(int c) int x; int y; int t; - int *p; int *tmp; - int z; - int w; if (c) tmp = & x; else tmp = & y; - p = tmp; + int *p = tmp; *p = 1; /*@ assert Value: initialisation: \initialized(p); */ - z = *p + 1; + int z = *p + 1; /*@ assert Value: initialisation: \initialized(p); */ - w = *p + 2; + int w = *p + 2; x = t; y = t; x = t; @@ -116,9 +121,8 @@ void main3(unsigned int i, unsigned int j) /*@ assert Value: initialisation: \initialized(&t[i]); */ /*@ assert Value: initialisation: \initialized(&t[j]); */ if (t[i] < t[j]) { - int tmp; /*@ assert Value: initialisation: \initialized(&t[j]); */ - tmp = t[j]; + int tmp = t[j]; /*@ assert Value: initialisation: \initialized(&t[i]); */ t[j] = t[i]; t[i] = tmp; @@ -130,26 +134,36 @@ void main4(int i) { while (1) { { - int j; - int k; - int z; - int w; - j = 0; + int j = 0; /*@ assert i ≤ 0; */ ; - k = 0; - z = 0; - w = 0; + int k = 0; + int z = 0; + int w = 0; } } return; } +void main5(void) +{ + int *p; + { + int x; + p = & x; + *p = 1; + /*@ assert *p ≡ 1; */ ; + } + /*@ assert *p ≡ 1; */ ; + return; +} + void main(void) { if (v) main1(v); main2(v); main3((unsigned int)v,(unsigned int)v); if (v) main4(v); + main5(); return; } @@ -161,15 +175,12 @@ void main1_slice_1(int c) int x; int y; int t; - int *p; int *tmp; - int z; - int w; if (c) tmp = & x; else tmp = & y; - p = tmp; + int *p = tmp; *p = 1; - z = *p + 1; - w = *p + 2; + int z = *p + 1; + int w = *p + 2; y = t; x = t; if (v) z = *p + 2; diff --git a/tests/value/oracle/reevaluate_alarms.res.oracle b/tests/value/oracle/reevaluate_alarms.res.oracle index 0146e218244231482b6079ff523931b6e4a3b6d9..5e8172d8e5f769db9b11fb6faf47b36232d56f43 100644 --- a/tests/value/oracle/reevaluate_alarms.res.oracle +++ b/tests/value/oracle/reevaluate_alarms.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/reevaluate_alarms.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/relation_reduction.res.oracle b/tests/value/oracle/relation_reduction.res.oracle index 8db6cf854254092f7ff7bd2f9c731cf3507021cb..b224bc953e08396731ca89c5a420c1f4bbbcb792 100644 --- a/tests/value/oracle/relation_reduction.res.oracle +++ b/tests/value/oracle/relation_reduction.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/relation_reduction.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/relation_shift.res.oracle b/tests/value/oracle/relation_shift.res.oracle index c6038640a002952c198a8a64771102394150fed1..9e7df30ed1d7e63289ba466c60b493549689de27 100644 --- a/tests/value/oracle/relation_shift.res.oracle +++ b/tests/value/oracle/relation_shift.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/relation_shift.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -17,7 +16,8 @@ tests/value/relation_shift.i:15:[value] warning: signed overflow. assert x - y tests/value/relation_shift.i:16:[value] warning: signed overflow. assert -2147483648 ≤ z - y; tests/value/relation_shift.i:16:[value] warning: signed overflow. assert z - y ≤ 2147483647; tests/value/relation_shift.i:18:[value] warning: out of bounds read. assert \valid_read(q); -[value] DUMPING STATE of file tests/value/relation_shift.i line 19 +tests/value/relation_shift.i:19:[value] Frama_C_dump_each: + # Cvalue domain: r1 ∈ [--..--] r2 ∈ [--..--] r3 ∈ {3} @@ -31,7 +31,7 @@ tests/value/relation_shift.i:18:[value] warning: out of bounds read. assert \val S_q[0] ∈ {3} [1] ∈ [--..--] S_p[0..1] ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/relations.res.oracle b/tests/value/oracle/relations.res.oracle index 5f3385e1c0ded65b1356e3bc36f4cf6d6c6e7b17..8bd611ccaaffb10776b538d9fd7c95175b68df8f 100644 --- a/tests/value/oracle/relations.res.oracle +++ b/tests/value/oracle/relations.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/relations.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/relations2.res.oracle b/tests/value/oracle/relations2.res.oracle index 04b867cf9fe1e7dfc83d0fadc660b88eba198da2..aabd7046c677ba614a269f9957c9d92c0e4e22da 100644 --- a/tests/value/oracle/relations2.res.oracle +++ b/tests/value/oracle/relations2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/relations2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -17,7 +16,8 @@ Called from tests/value/relations2.i:63. tests/value/relations2.i:6:[value] warning: function bts2166: precondition got status unknown. tests/value/relations2.i:7:[value] warning: function bts2166: precondition got status unknown. -[value] DUMPING STATE of file tests/value/relations2.i line 15 +tests/value/relations2.i:15:[value] Frama_C_dump_each: + # Cvalue domain: sv ∈ [--..--] len ∈ [--..--] n ∈ [1..64] @@ -29,8 +29,8 @@ tests/value/relations2.i:7:[value] warning: function bts2166: precondition got s [4] ∈ {6} [5] ∈ {41} [6] ∈ {42} - =END OF DUMP== -[value] Called Frama_C_show_each_end([0..4294967295], [0..64]) + ==END OF DUMP== +tests/value/relations2.i:17:[value] Frama_C_show_each_end: [0..4294967295], [0..64] [value] Recording results for bts2166 [value] Done for function bts2166 [value] computing for function main2 <- main. @@ -46,14 +46,14 @@ tests/value/relations2.i:7:[value] warning: function bts2166: precondition got s Called from tests/value/relations2.i:31. [value] Done for function unsigned_interval tests/value/relations2.i:32:[value] entering loop for the first time -[value] DUMPING STATE of file tests/value/relations2.i line 33 +tests/value/relations2.i:33:[value] Frama_C_dump_each: + # Cvalue domain: sv ∈ [--..--] a[0..513] ∈ [--..--] i ∈ [1..512] t ∈ [0..511] n ∈ [0..512] s ∈ {0} - b3 ∈ UNINITIALIZED T[0] ∈ {0} [1] ∈ {1} [2] ∈ {42} @@ -61,17 +61,17 @@ tests/value/relations2.i:32:[value] entering loop for the first time [4] ∈ {6} [5] ∈ {41} [6] ∈ {42} - =END OF DUMP== + ==END OF DUMP== tests/value/relations2.i:34:[value] warning: accessing out of bounds index. assert (unsigned int)(i - (unsigned int)(t + 1)) < 514; -[value] DUMPING STATE of file tests/value/relations2.i line 33 +tests/value/relations2.i:33:[value] Frama_C_dump_each: + # Cvalue domain: sv ∈ [--..--] a[0..513] ∈ [--..--] i ∈ [1..512] t ∈ [0..511] n ∈ [0..512] s ∈ {0; 1} - b3 ∈ UNINITIALIZED T[0] ∈ {0} [1] ∈ {1} [2] ∈ {42} @@ -79,15 +79,15 @@ tests/value/relations2.i:34:[value] warning: accessing out of bounds index. [4] ∈ {6} [5] ∈ {41} [6] ∈ {42} - =END OF DUMP== -[value] DUMPING STATE of file tests/value/relations2.i line 33 + ==END OF DUMP== +tests/value/relations2.i:33:[value] Frama_C_dump_each: + # Cvalue domain: sv ∈ [--..--] a[0..513] ∈ [--..--] i ∈ [1..512] t ∈ [0..511] n ∈ [0..512] s ∈ {0; 1; 2} - b3 ∈ UNINITIALIZED T[0] ∈ {0} [1] ∈ {1} [2] ∈ {42} @@ -95,15 +95,15 @@ tests/value/relations2.i:34:[value] warning: accessing out of bounds index. [4] ∈ {6} [5] ∈ {41} [6] ∈ {42} - =END OF DUMP== -[value] DUMPING STATE of file tests/value/relations2.i line 33 + ==END OF DUMP== +tests/value/relations2.i:33:[value] Frama_C_dump_each: + # Cvalue domain: sv ∈ [--..--] a[0..513] ∈ [--..--] i ∈ [1..512] t ∈ [0..511] n ∈ [0..512] s ∈ [0..2147483647] - b3 ∈ UNINITIALIZED T[0] ∈ {0} [1] ∈ {1} [2] ∈ {42} @@ -111,16 +111,16 @@ tests/value/relations2.i:34:[value] warning: accessing out of bounds index. [4] ∈ {6} [5] ∈ {41} [6] ∈ {42} - =END OF DUMP== + ==END OF DUMP== tests/value/relations2.i:35:[value] warning: signed overflow. assert s + b3 ≤ 2147483647; [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. Called from tests/value/relations2.i:65. -[value] Called Frama_C_show_each_NO1() -[value] Called Frama_C_show_each_OK1() -[value] Called Frama_C_show_each_OK2() -[value] Called Frama_C_show_each_NO2() +tests/value/relations2.i:47:[value] Frama_C_show_each_NO1: +tests/value/relations2.i:49:[value] Frama_C_show_each_OK1: +tests/value/relations2.i:55:[value] Frama_C_show_each_OK2: +tests/value/relations2.i:57:[value] Frama_C_show_each_NO2: [value] Recording results for main3 [value] Done for function main3 [value] Recording results for main diff --git a/tests/value/oracle/relations_difficult.res.oracle b/tests/value/oracle/relations_difficult.res.oracle index 381da2843c45b43209c8809d5f3eb71d3bd30dd0..5eca070754dc3b57c13b0ba0a6131a0da59f11a5 100644 --- a/tests/value/oracle/relations_difficult.res.oracle +++ b/tests/value/oracle/relations_difficult.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/relations_difficult.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/replace_by_show_each.res.oracle b/tests/value/oracle/replace_by_show_each.res.oracle index 029ce35a2e92df6417f1c32fbd79728b67755452..6c724db45c215ff795898b5b97d29fcaa21b2cb3 100644 --- a/tests/value/oracle/replace_by_show_each.res.oracle +++ b/tests/value/oracle/replace_by_show_each.res.oracle @@ -1,12 +1,11 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/replace_by_show_each.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization x ∈ {0} -[value] Called Frama_C_show_each_2() -[value] Called Frama_C_show_each_1() +tests/value/replace_by_show_each.c:23:[value] Frama_C_show_each_2: +tests/value/replace_by_show_each.c:25:[value] Frama_C_show_each_1: [inout] warning: no assigns clauses for function Frama_C_show_each_1. Results will be imprecise. [from] warning: no assigns clauses for function Frama_C_show_each_1. Results will be diff --git a/tests/value/oracle/resolve.res.oracle b/tests/value/oracle/resolve.res.oracle index 68c01d9f27551e94c4f97701997c22099f5f96b7..1b72fe1b685cd6fcfc653e523a76e1568e984270 100644 --- a/tests/value/oracle/resolve.res.oracle +++ b/tests/value/oracle/resolve.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/resolve.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/return.res.oracle b/tests/value/oracle/return.res.oracle index 5b5e57eb3ce5f0cb94ea99448b0ce981f346a6b0..709629a4f052ad42da89aa02e86200be2198e451 100644 --- a/tests/value/oracle/return.res.oracle +++ b/tests/value/oracle/return.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/return.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/semaphore.res.oracle b/tests/value/oracle/semaphore.res.oracle index 6b2fdc02cf0d214c968540dc14196ed757f066ea..42037d35e8e966334ba66bf2b5d38189e1f7a3dc 100644 --- a/tests/value/oracle/semaphore.res.oracle +++ b/tests/value/oracle/semaphore.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/semaphore.i (no preprocessing) [value] Analyzing a complete application starting at g [value] Computing initial state diff --git a/tests/value/oracle/sep.0.res.oracle b/tests/value/oracle/sep.0.res.oracle deleted file mode 100644 index 619a6bc121b4adfa9562d0d5fe77f7bcfa6a594c..0000000000000000000000000000000000000000 --- a/tests/value/oracle/sep.0.res.oracle +++ /dev/null @@ -1,30 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/sep.i (no preprocessing) -[value] Part of a case analysis: 0 of 0..3 -[value] Analyzing an incomplete application starting at f1 -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - index ∈ [--..--] - tab[0..4] ∈ [--..--] -tests/value/sep.i:36:[value] warning: function f1: precondition got status unknown. -[value] computing for function init1 <- f1. - Called from tests/value/sep.i:41. -[value] computing for function init2 <- init1 <- f1. - Called from tests/value/sep.i:18. -tests/value/sep.i:18:[kernel] warning: No code nor implicit assigns clause for function init2, generating default assigns from the prototype -[value] using specification for function init2 -[value] Done for function init2 -tests/value/sep.i:20:[value] warning: Statement 3: only propagating for condition false -tests/value/sep.i:26:[value] warning: Statement 6: only propagating for condition false -[value] Recording results for init1 -[value] Done for function init1 -[value] Recording results for f1 -[value] done for function f1 -[value] Next case to cover in sequential order: 1 -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function init1: - res ∈ {-1} -[value:final-states] Values at end of function f1: - res ∈ {-1} - __retres ∈ {-1} diff --git a/tests/value/oracle/sep.1.res.oracle b/tests/value/oracle/sep.1.res.oracle deleted file mode 100644 index 534a63eff0e32e5d5d0ee680fa512f671fc5be63..0000000000000000000000000000000000000000 --- a/tests/value/oracle/sep.1.res.oracle +++ /dev/null @@ -1,32 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/sep.i (no preprocessing) -[value] Part of a case analysis: 1 of 0..3 -[value] Analyzing an incomplete application starting at f1 -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - index ∈ [--..--] - tab[0..4] ∈ [--..--] -tests/value/sep.i:36:[value] warning: function f1: precondition got status unknown. -[value] computing for function init1 <- f1. - Called from tests/value/sep.i:41. -[value] computing for function init2 <- init1 <- f1. - Called from tests/value/sep.i:18. -tests/value/sep.i:18:[kernel] warning: No code nor implicit assigns clause for function init2, generating default assigns from the prototype -[value] using specification for function init2 -[value] Done for function init2 -tests/value/sep.i:20:[value] warning: Statement 3: only propagating for condition false -tests/value/sep.i:26:[value] warning: Statement 6: only propagating for condition true -[value] Recording results for init1 -[value] Done for function init1 -[value] Recording results for f1 -[value] done for function f1 -[value] Next case to cover in sequential order: 2 -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function init1: - index ∈ {0} - res ∈ {0} -[value:final-states] Values at end of function f1: - index ∈ {0} - res ∈ {0} - __retres ∈ [--..--] diff --git a/tests/value/oracle/sep.2.res.oracle b/tests/value/oracle/sep.2.res.oracle deleted file mode 100644 index 880eaaba3eb19e0231b34b04c34cb281de7ec75c..0000000000000000000000000000000000000000 --- a/tests/value/oracle/sep.2.res.oracle +++ /dev/null @@ -1,31 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/sep.i (no preprocessing) -[value] Part of a case analysis: 2 of 0..3 -[value] Analyzing an incomplete application starting at f1 -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - index ∈ [--..--] - tab[0..4] ∈ [--..--] -tests/value/sep.i:36:[value] warning: function f1: precondition got status unknown. -[value] computing for function init1 <- f1. - Called from tests/value/sep.i:41. -[value] computing for function init2 <- init1 <- f1. - Called from tests/value/sep.i:18. -tests/value/sep.i:18:[kernel] warning: No code nor implicit assigns clause for function init2, generating default assigns from the prototype -[value] using specification for function init2 -[value] Done for function init2 -tests/value/sep.i:20:[value] warning: Statement 3: only propagating for condition true -[value] Recording results for init1 -[value] Done for function init1 -[value] Recording results for f1 -[value] done for function f1 -[value] This analysis covers cases 2 to 3 -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function init1: - index ∈ {0} - res ∈ {0} -[value:final-states] Values at end of function f1: - index ∈ {0} - res ∈ {0} - __retres ∈ [--..--] diff --git a/tests/value/oracle/sep.3.res.oracle b/tests/value/oracle/sep.3.res.oracle deleted file mode 100644 index 654867715f82786e534473c7b9902b5c5f82da44..0000000000000000000000000000000000000000 --- a/tests/value/oracle/sep.3.res.oracle +++ /dev/null @@ -1,31 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/sep.i (no preprocessing) -[value] Part of a case analysis: 3 of 0..3 -[value] Analyzing an incomplete application starting at f1 -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - index ∈ [--..--] - tab[0..4] ∈ [--..--] -tests/value/sep.i:36:[value] warning: function f1: precondition got status unknown. -[value] computing for function init1 <- f1. - Called from tests/value/sep.i:41. -[value] computing for function init2 <- init1 <- f1. - Called from tests/value/sep.i:18. -tests/value/sep.i:18:[kernel] warning: No code nor implicit assigns clause for function init2, generating default assigns from the prototype -[value] using specification for function init2 -[value] Done for function init2 -tests/value/sep.i:20:[value] warning: Statement 3: only propagating for condition true -[value] Recording results for init1 -[value] Done for function init1 -[value] Recording results for f1 -[value] done for function f1 -[value] This analysis covers cases 2 to 3 -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function init1: - index ∈ {0} - res ∈ {0} -[value:final-states] Values at end of function f1: - index ∈ {0} - res ∈ {0} - __retres ∈ [--..--] diff --git a/tests/value/oracle/sep.4.res.oracle b/tests/value/oracle/sep.4.res.oracle deleted file mode 100644 index 3a55f486bcdb05857e14914e86e7fd44ae0509ec..0000000000000000000000000000000000000000 --- a/tests/value/oracle/sep.4.res.oracle +++ /dev/null @@ -1,31 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/sep.i (no preprocessing) -[value] Splitting return states on: - \return(init2) == 0, 1 (auto) - \return(init1) == 0 (auto) -[value] Analyzing an incomplete application starting at f1 -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - index ∈ [--..--] - tab[0..4] ∈ [--..--] -tests/value/sep.i:36:[value] warning: function f1: precondition got status unknown. -[value] computing for function init1 <- f1. - Called from tests/value/sep.i:41. -[value] computing for function init2 <- init1 <- f1. - Called from tests/value/sep.i:18. -tests/value/sep.i:18:[kernel] warning: No code nor implicit assigns clause for function init2, generating default assigns from the prototype -[value] using specification for function init2 -[value] Done for function init2 -[value] Recording results for init1 -[value] Done for function init1 -[value] Recording results for f1 -[value] done for function f1 -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function init1: - index ∈ [--..--] - res ∈ {-1; 0} -[value:final-states] Values at end of function f1: - index ∈ [--..--] - res ∈ {-1; 0} - __retres ∈ [--..--] diff --git a/tests/value/oracle/separated.res.oracle b/tests/value/oracle/separated.res.oracle index 6b7012ec3fdc806fc4ae65ade4960a8e10e621c1..f289f9875778f961ebcd1a501ed6ba00efb15e41 100644 --- a/tests/value/oracle/separated.res.oracle +++ b/tests/value/oracle/separated.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/separated.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/shift.0.res.oracle b/tests/value/oracle/shift.0.res.oracle index 3b4988a234fdce3682888a41f3f90ef82fdd621b..3639005d8c3919798791a0411566b86ac60cddb9 100644 --- a/tests/value/oracle/shift.0.res.oracle +++ b/tests/value/oracle/shift.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/shift.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -29,15 +28,19 @@ tests/value/shift.i:32:[value] assertion got status valid. tests/value/shift.i:35:[value] warning: invalid RHS operand for shift. assert 0 ≤ 32 < 32; tests/value/shift.i:36:[value] warning: invalid RHS operand for shift. assert 0 ≤ 5555 < 32; tests/value/shift.i:40:[value] warning: invalid RHS operand for shift. assert 0 ≤ b < 32; -[value] Called Frama_C_show_each({{ "ua:%u\nub:%u\n" }}, {1401}, {1073741074}) +tests/value/shift.i:48:[value] Frama_C_show_each: {{ "ua:%u\nub:%u\n" }}, {1401}, {1073741074} +tests/value/shift.i:52:[value] warning: unsigned overflow. assert 0 ≤ (unsigned long)((char *)t) << 8; +tests/value/shift.i:52:[value] warning: unsigned overflow. assert (unsigned long)((char *)t) << 8 ≤ 4294967295; tests/value/shift.i:52:[value] Assigning imprecise value to r. The imprecision originates from Arithmetic {tests/value/shift.i:52} tests/value/shift.i:53:[value] warning: invalid LHS operand for left shift. assert 0 ≤ (long)((char *)t); +tests/value/shift.i:58:[value] warning: unsigned overflow. assert 2U << 31 ≤ 4294967295; [value] Recording results for main [value] done for function main tests/value/shift.i:35:[value] assertion 'Value,shift' got final status invalid. tests/value/shift.i:36:[value] assertion 'Value,shift' got final status invalid. tests/value/shift.i:40:[value] assertion 'Value,shift' got final status invalid. +tests/value/shift.i:58:[value] assertion 'Value,unsigned_overflow' got final status invalid. [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main: a ∈ {314; 1256; 5024} @@ -49,7 +52,7 @@ tests/value/shift.i:40:[value] assertion 'Value,shift' got final status invalid. c ∈ [--..--] z ∈ [-2147483648..2147483615] zz ∈ {0} - shl ∈ {0} + shl ∈ {1} [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== diff --git a/tests/value/oracle/shift.1.res.oracle b/tests/value/oracle/shift.1.res.oracle index 62db8414131aca231da39b036d91f28796dbf53d..72244e27a69c4d4266559d8121f8129223c477ac 100644 --- a/tests/value/oracle/shift.1.res.oracle +++ b/tests/value/oracle/shift.1.res.oracle @@ -1,5 +1,4 @@ [value] warning: New option name for -no-val-left-shift-negative-alarms is -no-val-warn-left-shift-negative -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/shift.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -29,7 +28,7 @@ tests/value/shift.i:32:[value] warning: assertion got status unknown. tests/value/shift.i:35:[value] warning: invalid RHS operand for shift. assert 0 ≤ 32 < 32; tests/value/shift.i:36:[value] warning: invalid RHS operand for shift. assert 0 ≤ 5555 < 32; tests/value/shift.i:40:[value] warning: invalid RHS operand for shift. assert 0 ≤ b < 32; -[value] Called Frama_C_show_each({{ "ua:%u\nub:%u\n" }}, {1401}, {1073741074}) +tests/value/shift.i:48:[value] Frama_C_show_each: {{ "ua:%u\nub:%u\n" }}, {1401}, {1073741074} tests/value/shift.i:52:[value] Assigning imprecise value to r. The imprecision originates from Arithmetic {tests/value/shift.i:52} tests/value/shift.i:53:[value] warning: signed overflow. assert -2147483648 ≤ (long)((char *)t) << 8; @@ -56,7 +55,7 @@ tests/value/shift.i:40:[value] assertion 'Value,shift' got final status invalid. c ∈ [--..--] z ∈ [-2147483648..2147483631] zz ∈ {0} - shl ∈ {0} + shl ∈ {0; 1} [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== diff --git a/tests/value/oracle/shift_big.res.oracle b/tests/value/oracle/shift_big.res.oracle index 13c24004659404c16a2684ba03db9ec7557b7f8f..3b007001f45b9612c9f58661cdfcae0b7433e78a 100644 --- a/tests/value/oracle/shift_big.res.oracle +++ b/tests/value/oracle/shift_big.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/shift_big.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/shift_neg.res.oracle b/tests/value/oracle/shift_neg.res.oracle index 24b7a2fd52218dfe0cababe6a962a6cf9c640986..8538acd6a59261b089a9f57d896e2a666d830abb 100644 --- a/tests/value/oracle/shift_neg.res.oracle +++ b/tests/value/oracle/shift_neg.res.oracle @@ -1,14 +1,14 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/shift_neg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] DUMPING STATE of file tests/value/shift_neg.i line 5 +tests/value/shift_neg.i:5:[value] Frama_C_dump_each: + # Cvalue domain: i ∈ {-1} j ∈ {-6} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/sign_of_bitfiled_int.0.res.oracle b/tests/value/oracle/sign_of_bitfiled_int.0.res.oracle index da491c1e4fe6927fa0bed28511525743f94240ba..96f2a3235029ed3ae2968c08293bcb75f0ae08d8 100644 --- a/tests/value/oracle/sign_of_bitfiled_int.0.res.oracle +++ b/tests/value/oracle/sign_of_bitfiled_int.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/sign_of_bitfiled_int.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/sign_of_bitfiled_int.1.res.oracle b/tests/value/oracle/sign_of_bitfiled_int.1.res.oracle index da491c1e4fe6927fa0bed28511525743f94240ba..96f2a3235029ed3ae2968c08293bcb75f0ae08d8 100644 --- a/tests/value/oracle/sign_of_bitfiled_int.1.res.oracle +++ b/tests/value/oracle/sign_of_bitfiled_int.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/sign_of_bitfiled_int.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/simple_packed.res.oracle b/tests/value/oracle/simple_packed.res.oracle index 5f036c820fd7281381e9a959db8493d55c5b9d2d..041b34289f2e92047b2e0f8143b1e6111ec8fe7b 100644 --- a/tests/value/oracle/simple_packed.res.oracle +++ b/tests/value/oracle/simple_packed.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/simple_packed.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/simple_path.res.oracle b/tests/value/oracle/simple_path.res.oracle index 941a328f3d700ca37f02a2c7e6e415b276d52aff..2c29f078e5a2e2482f538548d20dbfe6d1c51d11 100644 --- a/tests/value/oracle/simple_path.res.oracle +++ b/tests/value/oracle/simple_path.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/simple_path.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/simplify_cfg.0.res.oracle b/tests/value/oracle/simplify_cfg.0.res.oracle index f73313e89afd2cbc3a9af089eddbaddc4b46529b..00b7692acd1d6600aa8204b7d6a2eff5df9c1cb5 100644 --- a/tests/value/oracle/simplify_cfg.0.res.oracle +++ b/tests/value/oracle/simplify_cfg.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/simplify_cfg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/simplify_cfg.1.res.oracle b/tests/value/oracle/simplify_cfg.1.res.oracle index f73313e89afd2cbc3a9af089eddbaddc4b46529b..00b7692acd1d6600aa8204b7d6a2eff5df9c1cb5 100644 --- a/tests/value/oracle/simplify_cfg.1.res.oracle +++ b/tests/value/oracle/simplify_cfg.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/simplify_cfg.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/sizeof.res.oracle b/tests/value/oracle/sizeof.res.oracle index 64ac48377401d9bbaf3e96cb1a994a4d69ccb5ae..4e3a260fcc439f0a9b4c252989ff014e50dd11ad 100644 --- a/tests/value/oracle/sizeof.res.oracle +++ b/tests/value/oracle/sizeof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -33,7 +32,6 @@ tests/value/sizeof.i:34:[value] warning: out of bounds write. [value] Done for function main2 [value] Recording results for main [value] done for function main -[scope:rm_asserts] removing 2 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main1: sz_str ∈ {4} @@ -107,8 +105,7 @@ struct s s1; int volatile i; void main2(void) { - struct s *p; - p = & s1 + (int)(& s1); + struct s *p = & s1 + (int)(& s1); /*@ assert Value: index_bound: (unsigned int)(sizeof(s1.t) - (unsigned int)i) < 10; */ diff --git a/tests/value/oracle/slevel_return.res.oracle b/tests/value/oracle/slevel_return.res.oracle index b697ceee302b9620c1b5bdd67af150086d75d959..58fd0b8be71dba168602424eea24045c004e20fc 100644 --- a/tests/value/oracle/slevel_return.res.oracle +++ b/tests/value/oracle/slevel_return.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/slevel_return.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,12 +12,13 @@ tests/value/slevel_return.i:7:[value] function main1: postcondition got status v [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/slevel_return.i:45. -[value] DUMPING STATE of file tests/value/slevel_return.i line 38 +tests/value/slevel_return.i:38:[value] Frama_C_dump_each: + # Cvalue domain: x ∈ {-3} y ∈ {0; 1; 6} c ∈ [--..--] c ∈ [--..--] - =END OF DUMP== + ==END OF DUMP== tests/value/slevel_return.i:23:[value] function main2: postcondition got status valid. [value] Recording results for main2 [value] Done for function main2 diff --git a/tests/value/oracle/slevelex.res.oracle b/tests/value/oracle/slevelex.res.oracle index 47fa5ca897e8c88b6ce4add853776efc931ab524..07735bfc1ecbc17fe97c3cb1a3b57d6ba1874c9e 100644 --- a/tests/value/oracle/slevelex.res.oracle +++ b/tests/value/oracle/slevelex.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/slevelex.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,7 +5,7 @@ [value:initial-state] Values of globals at initialization c ∈ [--..--] tests/value/slevelex.i:80:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_xy({1; 2}, {1; 2}) +tests/value/slevelex.i:82:[value] Frama_C_show_each_xy: {1; 2}, {1; 2} [value] computing for function f <- main. Called from tests/value/slevelex.i:83. [value] Recording results for f @@ -15,51 +14,51 @@ tests/value/slevelex.i:84:[value] assertion got status valid. [value] computing for function gu <- main. Called from tests/value/slevelex.i:88. tests/value/slevelex.i:26:[value] assertion got status valid. -[value] Called Frama_C_show_each_u({1}) -[value] Called Frama_C_show_each_u({2}) -[value] Called Frama_C_show_each_u({3}) -[value] Called Frama_C_show_each_u({4}) -[value] Called Frama_C_show_each_u({5}) -[value] Called Frama_C_show_each_u({6}) -[value] Called Frama_C_show_each_u({7}) -[value] Called Frama_C_show_each_u({8}) -[value] Called Frama_C_show_each_u({9}) -[value] Called Frama_C_show_each_u({10}) -[value] Called Frama_C_show_each_u({11}) -[value] Called Frama_C_show_each_u({12}) -[value] Called Frama_C_show_each_u({13}) -[value] Called Frama_C_show_each_u({14}) -[value] Called Frama_C_show_each_u({15}) -[value] Called Frama_C_show_each_u({16}) -[value] Called Frama_C_show_each_u({17}) -[value] Called Frama_C_show_each_u({18}) -[value] Called Frama_C_show_each_u({19}) -[value] Called Frama_C_show_each_u({20}) +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {1} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {2} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {3} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {4} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {5} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {6} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {7} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {8} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {9} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {10} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {11} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {12} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {13} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {14} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {15} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {16} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {17} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {18} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {19} +tests/value/slevelex.i:40:[value] Frama_C_show_each_u: {20} [value] Recording results for gu [value] Done for function gu [value] computing for function ginc <- main. Called from tests/value/slevelex.i:89. tests/value/slevelex.i:49:[value] assertion got status valid. -[value] Called Frama_C_show_each_inc({4}) -[value] Called Frama_C_show_each_inc({8}) -[value] Called Frama_C_show_each_inc({12}) -[value] Called Frama_C_show_each_inc({16}) -[value] Called Frama_C_show_each_inc({20}) -[value] Called Frama_C_show_each_inc({24}) -[value] Called Frama_C_show_each_inc({28}) -[value] Called Frama_C_show_each_inc({32}) -[value] Called Frama_C_show_each_inc({36}) -[value] Called Frama_C_show_each_inc({40}) -[value] Called Frama_C_show_each_inc({44}) -[value] Called Frama_C_show_each_inc({48}) -[value] Called Frama_C_show_each_inc({52}) -[value] Called Frama_C_show_each_inc({56}) -[value] Called Frama_C_show_each_inc({60}) -[value] Called Frama_C_show_each_inc({64}) -[value] Called Frama_C_show_each_inc({68}) -[value] Called Frama_C_show_each_inc({72}) -[value] Called Frama_C_show_each_inc({76}) -[value] Called Frama_C_show_each_inc({80}) +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {4} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {8} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {12} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {16} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {20} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {24} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {28} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {32} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {36} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {40} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {44} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {48} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {52} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {56} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {60} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {64} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {68} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {72} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {76} +tests/value/slevelex.i:63:[value] Frama_C_show_each_inc: {80} [value] Recording results for ginc [value] Done for function ginc [value] Recording results for main diff --git a/tests/value/oracle/small_conditionals.res.oracle b/tests/value/oracle/small_conditionals.res.oracle index 3c0ffe364133b9e865b14d5b7a5affdf3b495531..8c5cdf7a9a1b6723b0237e008e54641debdf358d 100644 --- a/tests/value/oracle/small_conditionals.res.oracle +++ b/tests/value/oracle/small_conditionals.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/small_conditionals.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/sort4.0.res.oracle b/tests/value/oracle/sort4.0.res.oracle index 6660e10aa8c9fc466a593676508cc9415d328fc0..44201e8120cde91557ef7bd260d55bec8624396f 100644 --- a/tests/value/oracle/sort4.0.res.oracle +++ b/tests/value/oracle/sort4.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/sort4.i (no preprocessing) tests/value/sort4.i:25:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [value] Analyzing an incomplete application starting at sort4_1 diff --git a/tests/value/oracle/sort4.1.res.oracle b/tests/value/oracle/sort4.1.res.oracle index bbddf42bbf98f59e1299e7c3bf0abdcfacf51aaa..4ea6ceec54ea091f6f7cb0a6c3918ce881940673 100644 --- a/tests/value/oracle/sort4.1.res.oracle +++ b/tests/value/oracle/sort4.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/sort4.i (no preprocessing) tests/value/sort4.i:25:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [value] Analyzing an incomplete application starting at sort4_4 @@ -37,6 +36,7 @@ tests/value/sort4.i:33:[value] warning: out of bounds write. assert \valid(t + 2 tests/value/sort4.i:26:[value] warning: function sort4_4: postcondition got status unknown. [value] Recording results for sort4_4 [value] done for function sort4_4 +[scope:rm_asserts] removing 13 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function sort4_4: tmp ∈ [-2147483647..2147483647] or UNINITIALIZED diff --git a/tests/value/oracle/sort4.2.res.oracle b/tests/value/oracle/sort4.2.res.oracle index a5d63e73a18d2db91d74400c543225752d1de74e..af692b933d4fb36231918dca12e1d9373acde31e 100644 --- a/tests/value/oracle/sort4.2.res.oracle +++ b/tests/value/oracle/sort4.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/sort4.i (no preprocessing) tests/value/sort4.i:25:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead. [value] Analyzing an incomplete application starting at sort4_3 diff --git a/tests/value/oracle/split_return.0.res.oracle b/tests/value/oracle/split_return.0.res.oracle index a888d1d8876b53960938ad8d6d26140f191b937c..c80f4e1ded05c51dc7ecfb0dbedc7fca46b3b529 100644 --- a/tests/value/oracle/split_return.0.res.oracle +++ b/tests/value/oracle/split_return.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/split_return.i (no preprocessing) [value] warning: ignoring non-existing function 'NON_EXISTING'. [value] Splitting return states on: @@ -17,7 +16,7 @@ v ∈ [--..--] v7 ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/split_return.i:175. + Called from tests/value/split_return.i:176. [value] computing for function init <- main1 <- main. Called from tests/value/split_return.i:17. [value] using specification for function init @@ -25,78 +24,78 @@ [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/split_return.i:176. + Called from tests/value/split_return.i:177. [value] computing for function f2 <- main2 <- main. - Called from tests/value/split_return.i:47. + Called from tests/value/split_return.i:48. [value] Recording results for f2 [value] Done for function f2 -[value] Called Frama_C_show_each_f2({5; 7}, {5}) -[value] Called Frama_C_show_each_f2({0}, {0}) -tests/value/split_return.i:50:[value] assertion got status valid. -[value] Called Frama_C_show_each_f2_2({5; 7}, {5}) -tests/value/split_return.i:53:[value] assertion got status valid. +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {5; 7}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {0}, {0} +tests/value/split_return.i:51:[value] assertion got status valid. +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {5; 7}, {5} +tests/value/split_return.i:54:[value] assertion got status valid. [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. -tests/value/split_return.i:68:[value] f3: cannot properly split on \result == -2 + Called from tests/value/split_return.i:73. +tests/value/split_return.i:69:[value] f3: cannot properly split on \result == -2 [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2; 7}, {0; 5}) -tests/value/split_return.i:75:[value] warning: assertion got status unknown. -tests/value/split_return.i:77:[value] warning: assertion got status unknown. +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2; 7}, {0; 5} +tests/value/split_return.i:76:[value] warning: assertion got status unknown. +tests/value/split_return.i:78:[value] warning: assertion got status unknown. [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4; 7}, {0; 5}) -tests/value/split_return.i:96:[value] warning: assertion got status unknown. -tests/value/split_return.i:98:[value] warning: assertion got status unknown. +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4; 7}, {0; 5} +tests/value/split_return.i:97:[value] warning: assertion got status unknown. +tests/value/split_return.i:99:[value] warning: assertion got status unknown. [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/split_return.i:179. + Called from tests/value/split_return.i:180. [value] computing for function f5 <- main5 <- main. - Called from tests/value/split_return.i:116. + Called from tests/value/split_return.i:117. [value] Recording results for f5 [value] Done for function f5 -[value] Called Frama_C_show_each_f5({7}, {5}) -[value] Called Frama_C_show_each_f5({-2}, {0}) -tests/value/split_return.i:119:[value] assertion got status valid. -tests/value/split_return.i:121:[value] assertion got status valid. +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {7}, {5} +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {-2}, {0} +tests/value/split_return.i:120:[value] assertion got status valid. +tests/value/split_return.i:122:[value] assertion got status valid. [value] Recording results for main5 [value] Done for function main5 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. -tests/value/split_return.i:129:[value] warning: assertion got status unknown. + Called from tests/value/split_return.i:135. +tests/value/split_return.i:130:[value] warning: assertion got status unknown. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({{ NULL ; &v }}, {0; 1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ NULL ; &v }}, {0; 1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1; 4}, {{ NULL ; &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1; 4}, {{ NULL ; &x }} [value] Recording results for main8 [value] Done for function main8 [value] Recording results for main @@ -292,7 +291,7 @@ tests/value/split_return.i:129:[value] warning: assertion got status unknown. [inout] Inputs for function main7: v; v7 [inout] Out (internal) for function main8: - x; pf; p + x; pf; p; tmp [inout] Inputs for function main8: v [inout] Out (internal) for function main: @@ -331,43 +330,43 @@ tests/value/split_return.i:129:[value] warning: assertion got status unknown. --- Properties of Function 'main2' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/split_return.i, line 50) +[ Valid ] Assertion (file tests/value/split_return.i, line 51) by Value. -[ Valid ] Assertion (file tests/value/split_return.i, line 53) +[ Valid ] Assertion (file tests/value/split_return.i, line 54) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'main3' -------------------------------------------------------------------------------- -[ - ] Assertion (file tests/value/split_return.i, line 75) +[ - ] Assertion (file tests/value/split_return.i, line 76) tried with Value. -[ - ] Assertion (file tests/value/split_return.i, line 77) +[ - ] Assertion (file tests/value/split_return.i, line 78) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main4' -------------------------------------------------------------------------------- -[ - ] Assertion (file tests/value/split_return.i, line 96) +[ - ] Assertion (file tests/value/split_return.i, line 97) tried with Value. -[ - ] Assertion (file tests/value/split_return.i, line 98) +[ - ] Assertion (file tests/value/split_return.i, line 99) tried with Value. -------------------------------------------------------------------------------- --- Properties of Function 'main5' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/split_return.i, line 119) +[ Valid ] Assertion (file tests/value/split_return.i, line 120) by Value. -[ Valid ] Assertion (file tests/value/split_return.i, line 121) +[ Valid ] Assertion (file tests/value/split_return.i, line 122) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'f6' -------------------------------------------------------------------------------- -[ - ] Assertion (file tests/value/split_return.i, line 129) +[ - ] Assertion (file tests/value/split_return.i, line 130) tried with Value. -------------------------------------------------------------------------------- diff --git a/tests/value/oracle/split_return.1.res.oracle b/tests/value/oracle/split_return.1.res.oracle index c77f10d1d3db297927903bdc2e8f30a0710db4b9..91cf5233ad30b496a02f73c294df9be32411cab5 100644 --- a/tests/value/oracle/split_return.1.res.oracle +++ b/tests/value/oracle/split_return.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/split_return.i (no preprocessing) [value] Splitting return states on: \return(f7) == 0, 3 (user) @@ -20,7 +19,7 @@ v ∈ [--..--] v7 ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/split_return.i:175. + Called from tests/value/split_return.i:176. [value] computing for function init <- main1 <- main. Called from tests/value/split_return.i:17. [value] using specification for function init @@ -28,82 +27,82 @@ [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/split_return.i:176. + Called from tests/value/split_return.i:177. [value] computing for function f2 <- main2 <- main. - Called from tests/value/split_return.i:47. + Called from tests/value/split_return.i:48. [value] Recording results for f2 [value] Done for function f2 -[value] Called Frama_C_show_each_f2({5; 7}, {5}) -[value] Called Frama_C_show_each_f2({0}, {0}) -tests/value/split_return.i:50:[value] assertion got status valid. -[value] Called Frama_C_show_each_f2_2({5; 7}, {5}) -tests/value/split_return.i:53:[value] assertion got status valid. +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {5; 7}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {0}, {0} +tests/value/split_return.i:51:[value] assertion got status valid. +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {5; 7}, {5} +tests/value/split_return.i:54:[value] assertion got status valid. [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({7}, {5}) -[value] Called Frama_C_show_each_f3({-2}, {0}) -tests/value/split_return.i:75:[value] assertion got status valid. -tests/value/split_return.i:77:[value] assertion got status valid. +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} +tests/value/split_return.i:76:[value] assertion got status valid. +tests/value/split_return.i:78:[value] assertion got status valid. [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({7}, {5}) -[value] Called Frama_C_show_each_f4({4}, {0}) -tests/value/split_return.i:96:[value] assertion got status valid. -tests/value/split_return.i:98:[value] assertion got status valid. +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} +tests/value/split_return.i:97:[value] assertion got status valid. +tests/value/split_return.i:99:[value] assertion got status valid. [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/split_return.i:179. + Called from tests/value/split_return.i:180. [value] computing for function f5 <- main5 <- main. - Called from tests/value/split_return.i:116. + Called from tests/value/split_return.i:117. [value] Recording results for f5 [value] Done for function f5 -[value] Called Frama_C_show_each_f5({7}, {5}) -[value] Called Frama_C_show_each_f5({-2}, {0}) -tests/value/split_return.i:119:[value] assertion got status valid. -tests/value/split_return.i:121:[value] assertion got status valid. +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {7}, {5} +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {-2}, {0} +tests/value/split_return.i:120:[value] assertion got status valid. +tests/value/split_return.i:122:[value] assertion got status valid. [value] Recording results for main5 [value] Done for function main5 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. -tests/value/split_return.i:129:[value] warning: assertion got status unknown. -tests/value/split_return.i:130:[value] f6: cannot properly split on \result == 0 + Called from tests/value/split_return.i:135. +tests/value/split_return.i:130:[value] warning: assertion got status unknown. +tests/value/split_return.i:131:[value] f6: cannot properly split on \result == 0 [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) -[value] Called Frama_C_show_each_then8({-1}, {0}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] Recording results for main @@ -299,7 +298,7 @@ tests/value/split_return.i:130:[value] f6: cannot properly split on \result == 0 [inout] Inputs for function main7: v; v7 [inout] Out (internal) for function main8: - x; pf; p + x; pf; p; tmp [inout] Inputs for function main8: v [inout] Out (internal) for function main: @@ -338,43 +337,43 @@ tests/value/split_return.i:130:[value] f6: cannot properly split on \result == 0 --- Properties of Function 'main2' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/split_return.i, line 50) +[ Valid ] Assertion (file tests/value/split_return.i, line 51) by Value. -[ Valid ] Assertion (file tests/value/split_return.i, line 53) +[ Valid ] Assertion (file tests/value/split_return.i, line 54) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'main3' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/split_return.i, line 75) +[ Valid ] Assertion (file tests/value/split_return.i, line 76) by Value. -[ Valid ] Assertion (file tests/value/split_return.i, line 77) +[ Valid ] Assertion (file tests/value/split_return.i, line 78) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'main4' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/split_return.i, line 96) +[ Valid ] Assertion (file tests/value/split_return.i, line 97) by Value. -[ Valid ] Assertion (file tests/value/split_return.i, line 98) +[ Valid ] Assertion (file tests/value/split_return.i, line 99) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'main5' -------------------------------------------------------------------------------- -[ Valid ] Assertion (file tests/value/split_return.i, line 119) +[ Valid ] Assertion (file tests/value/split_return.i, line 120) by Value. -[ Valid ] Assertion (file tests/value/split_return.i, line 121) +[ Valid ] Assertion (file tests/value/split_return.i, line 122) by Value. -------------------------------------------------------------------------------- --- Properties of Function 'f6' -------------------------------------------------------------------------------- -[ - ] Assertion (file tests/value/split_return.i, line 129) +[ - ] Assertion (file tests/value/split_return.i, line 130) tried with Value. -------------------------------------------------------------------------------- diff --git a/tests/value/oracle/split_return.2.res.oracle b/tests/value/oracle/split_return.2.res.oracle index 6ed663c953ebadf13b436d72ddd061756103b93e..6bc7f765059ae4597f648976025c0595f7595120 100644 --- a/tests/value/oracle/split_return.2.res.oracle +++ b/tests/value/oracle/split_return.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/split_return.i (no preprocessing) [value] user error: incorrect argument for option -slevel-function (no function 'NON_EXISTING'). [kernel] Plug-in value aborted: invalid user input. diff --git a/tests/value/oracle/split_return.3.res.oracle b/tests/value/oracle/split_return.3.res.oracle index 43644b2c8fc98756a5501e392e00c6c26bcc8c3a..17885c2c0682f9d800f25367ce430767c1c6403b 100644 --- a/tests/value/oracle/split_return.3.res.oracle +++ b/tests/value/oracle/split_return.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/split_return.i (no preprocessing) [value] Splitting return states on: \full_split(@all) @@ -13,7 +12,7 @@ v ∈ [--..--] v7 ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/split_return.i:175. + Called from tests/value/split_return.i:176. [value] computing for function init <- main1 <- main. Called from tests/value/split_return.i:17. [value] using specification for function init @@ -21,171 +20,171 @@ [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/split_return.i:176. + Called from tests/value/split_return.i:177. [value] computing for function f2 <- main2 <- main. - Called from tests/value/split_return.i:47. + Called from tests/value/split_return.i:48. [value] Recording results for f2 [value] Done for function f2 -[value] Called Frama_C_show_each_f2({5}, {5}) -[value] Called Frama_C_show_each_f2({0}, {0}) -[value] Called Frama_C_show_each_f2({7}, {5}) -tests/value/split_return.i:50:[value] assertion got status valid. -[value] Called Frama_C_show_each_f2_2({5}, {5}) -[value] Called Frama_C_show_each_f2_2({7}, {5}) -tests/value/split_return.i:53:[value] assertion got status valid. +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {5}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {7}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {0}, {0} +tests/value/split_return.i:51:[value] assertion got status valid. +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {5}, {5} +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {7}, {5} +tests/value/split_return.i:54:[value] assertion got status valid. [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2}, {0}) -[value] Called Frama_C_show_each_f3({7}, {5}) -tests/value/split_return.i:75:[value] assertion got status valid. -tests/value/split_return.i:77:[value] assertion got status valid. +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} +tests/value/split_return.i:76:[value] assertion got status valid. +tests/value/split_return.i:78:[value] assertion got status valid. [value] Recording results for main3 [value] Done for function main3 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2}, {0}) -[value] Called Frama_C_show_each_f3({7}, {5}) +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) -tests/value/split_return.i:96:[value] assertion got status valid. -tests/value/split_return.i:98:[value] assertion got status valid. +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} +tests/value/split_return.i:97:[value] assertion got status valid. +tests/value/split_return.i:99:[value] assertion got status valid. [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/split_return.i:179. + Called from tests/value/split_return.i:180. [value] computing for function f5 <- main5 <- main. - Called from tests/value/split_return.i:116. + Called from tests/value/split_return.i:117. [value] Recording results for f5 [value] Done for function f5 -[value] Called Frama_C_show_each_f5({7}, {5}) -[value] Called Frama_C_show_each_f5({-2}, {0}) -tests/value/split_return.i:119:[value] assertion got status valid. -tests/value/split_return.i:121:[value] assertion got status valid. +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {7}, {5} +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {-2}, {0} +tests/value/split_return.i:120:[value] assertion got status valid. +tests/value/split_return.i:122:[value] assertion got status valid. [value] Recording results for main5 [value] Done for function main5 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. -tests/value/split_return.i:129:[value] warning: assertion got status unknown. + Called from tests/value/split_return.i:135. +tests/value/split_return.i:130:[value] warning: assertion got status unknown. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. + Called from tests/value/split_return.i:135. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] Recording results for main @@ -381,7 +380,7 @@ tests/value/split_return.i:129:[value] warning: assertion got status unknown. [inout] Inputs for function main7: v; v7 [inout] Out (internal) for function main8: - x; pf; p + x; pf; p; tmp [inout] Inputs for function main8: v [inout] Out (internal) for function main: diff --git a/tests/value/oracle/split_return.4.res.oracle b/tests/value/oracle/split_return.4.res.oracle index 69d4272998e0046d6eb307e6151856cd05f564e2..3e9a06d0e07ff9a1e0d2bbc4d53209c3ae30212e 100644 --- a/tests/value/oracle/split_return.4.res.oracle +++ b/tests/value/oracle/split_return.4.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/split_return.i (no preprocessing) [value] Splitting return states on: \full_split(f2) @@ -16,7 +15,7 @@ v ∈ [--..--] v7 ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/split_return.i:175. + Called from tests/value/split_return.i:176. [value] computing for function init <- main1 <- main. Called from tests/value/split_return.i:17. [value] using specification for function init @@ -24,171 +23,171 @@ [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/split_return.i:176. + Called from tests/value/split_return.i:177. [value] computing for function f2 <- main2 <- main. - Called from tests/value/split_return.i:47. + Called from tests/value/split_return.i:48. [value] Recording results for f2 [value] Done for function f2 -[value] Called Frama_C_show_each_f2({5}, {5}) -[value] Called Frama_C_show_each_f2({0}, {0}) -[value] Called Frama_C_show_each_f2({7}, {5}) -tests/value/split_return.i:50:[value] assertion got status valid. -[value] Called Frama_C_show_each_f2_2({5}, {5}) -[value] Called Frama_C_show_each_f2_2({7}, {5}) -tests/value/split_return.i:53:[value] assertion got status valid. +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {5}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {7}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {0}, {0} +tests/value/split_return.i:51:[value] assertion got status valid. +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {5}, {5} +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {7}, {5} +tests/value/split_return.i:54:[value] assertion got status valid. [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2}, {0}) -[value] Called Frama_C_show_each_f3({7}, {5}) -tests/value/split_return.i:75:[value] assertion got status valid. -tests/value/split_return.i:77:[value] assertion got status valid. +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} +tests/value/split_return.i:76:[value] assertion got status valid. +tests/value/split_return.i:78:[value] assertion got status valid. [value] Recording results for main3 [value] Done for function main3 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2}, {0}) -[value] Called Frama_C_show_each_f3({7}, {5}) +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) -tests/value/split_return.i:96:[value] assertion got status valid. -tests/value/split_return.i:98:[value] assertion got status valid. +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} +tests/value/split_return.i:97:[value] assertion got status valid. +tests/value/split_return.i:99:[value] assertion got status valid. [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/split_return.i:179. + Called from tests/value/split_return.i:180. [value] computing for function f5 <- main5 <- main. - Called from tests/value/split_return.i:116. + Called from tests/value/split_return.i:117. [value] Recording results for f5 [value] Done for function f5 -[value] Called Frama_C_show_each_f5({7}, {5}) -[value] Called Frama_C_show_each_f5({-2}, {0}) -tests/value/split_return.i:119:[value] assertion got status valid. -tests/value/split_return.i:121:[value] assertion got status valid. +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {7}, {5} +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {-2}, {0} +tests/value/split_return.i:120:[value] assertion got status valid. +tests/value/split_return.i:122:[value] assertion got status valid. [value] Recording results for main5 [value] Done for function main5 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. -tests/value/split_return.i:129:[value] warning: assertion got status unknown. + Called from tests/value/split_return.i:135. +tests/value/split_return.i:130:[value] warning: assertion got status unknown. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. + Called from tests/value/split_return.i:135. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] Recording results for main @@ -384,7 +383,7 @@ tests/value/split_return.i:129:[value] warning: assertion got status unknown. [inout] Inputs for function main7: v; v7 [inout] Out (internal) for function main8: - x; pf; p + x; pf; p; tmp [inout] Inputs for function main8: v [inout] Out (internal) for function main: @@ -409,167 +408,167 @@ tests/value/split_return.i:129:[value] warning: assertion got status unknown. v ∈ [--..--] v7 ∈ {0} [value] computing for function main1 <- main. - Called from tests/value/split_return.i:175. + Called from tests/value/split_return.i:176. [value] computing for function init <- main1 <- main. Called from tests/value/split_return.i:17. [value] Done for function init [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/split_return.i:176. + Called from tests/value/split_return.i:177. [value] computing for function f2 <- main2 <- main. - Called from tests/value/split_return.i:47. + Called from tests/value/split_return.i:48. [value] Recording results for f2 [value] Done for function f2 -[value] Called Frama_C_show_each_f2({5; 7}, {5}) -[value] Called Frama_C_show_each_f2({0}, {0}) -[value] Called Frama_C_show_each_f2_2({5; 7}, {5}) +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {5; 7}, {5} +tests/value/split_return.i:49:[value] Frama_C_show_each_f2: {0}, {0} +tests/value/split_return.i:53:[value] Frama_C_show_each_f2_2: {5; 7}, {5} [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2}, {0}) -[value] Called Frama_C_show_each_f3({7}, {5}) +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} [value] Recording results for main3 [value] Done for function main3 [value] computing for function main3 <- main. - Called from tests/value/split_return.i:177. + Called from tests/value/split_return.i:178. [value] computing for function f3 <- main3 <- main. - Called from tests/value/split_return.i:72. + Called from tests/value/split_return.i:73. [value] Recording results for f3 [value] Done for function f3 -[value] Called Frama_C_show_each_f3({-2}, {0}) -[value] Called Frama_C_show_each_f3({7}, {5}) +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {7}, {5} +tests/value/split_return.i:74:[value] Frama_C_show_each_f3: {-2}, {0} [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main4 <- main. - Called from tests/value/split_return.i:178. + Called from tests/value/split_return.i:179. [value] computing for function f4 <- main4 <- main. - Called from tests/value/split_return.i:93. + Called from tests/value/split_return.i:94. [value] Recording results for f4 [value] Done for function f4 -[value] Called Frama_C_show_each_f4({4}, {0}) -[value] Called Frama_C_show_each_f4({7}, {5}) +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {7}, {5} +tests/value/split_return.i:95:[value] Frama_C_show_each_f4: {4}, {0} [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/split_return.i:179. + Called from tests/value/split_return.i:180. [value] computing for function f5 <- main5 <- main. - Called from tests/value/split_return.i:116. + Called from tests/value/split_return.i:117. [value] Recording results for f5 [value] Done for function f5 -[value] Called Frama_C_show_each_f5({7}, {5}) -[value] Called Frama_C_show_each_f5({-2}, {0}) +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {7}, {5} +tests/value/split_return.i:118:[value] Frama_C_show_each_f5: {-2}, {0} [value] Recording results for main5 [value] Done for function main5 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. + Called from tests/value/split_return.i:135. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main6 <- main. - Called from tests/value/split_return.i:180. + Called from tests/value/split_return.i:181. [value] computing for function f6 <- main6 <- main. - Called from tests/value/split_return.i:134. + Called from tests/value/split_return.i:135. [value] Recording results for f6 [value] Done for function f6 [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main7 <- main. - Called from tests/value/split_return.i:181. + Called from tests/value/split_return.i:182. [value] computing for function f7 <- main7 <- main. - Called from tests/value/split_return.i:147. + Called from tests/value/split_return.i:148. [value] Recording results for f7 [value] Done for function f7 -[value] Called Frama_C_show_each_NULL({0}, {0}) -[value] Called Frama_C_show_each_NULL({{ &v }}, {1}) +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {0}, {0} +tests/value/split_return.i:153:[value] Frama_C_show_each_NULL: {{ &v }}, {1} [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] computing for function main8 <- main. - Called from tests/value/split_return.i:182. + Called from tests/value/split_return.i:183. [value] computing for function f8 <- main8 <- main. - Called from tests/value/split_return.i:170. + Called from tests/value/split_return.i:171. [value] Recording results for f8 [value] Done for function f8 -[value] Called Frama_C_show_each_then8({-1}, {0}) -[value] Called Frama_C_show_each_then8({4}, {{ &x }}) +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {4}, {{ &x }} +tests/value/split_return.i:172:[value] Frama_C_show_each_then8: {-1}, {0} [value] Recording results for main8 [value] Done for function main8 [value] Recording results for main @@ -765,7 +764,7 @@ tests/value/split_return.i:129:[value] warning: assertion got status unknown. [inout] Inputs for function main7: v; v7 [inout] Out (internal) for function main8: - x; pf; p + x; pf; p; tmp [inout] Inputs for function main8: v [inout] Out (internal) for function main: diff --git a/tests/value/oracle/statement_contract.res.oracle b/tests/value/oracle/statement_contract.res.oracle index 2b445e7768115eab733f05abe9e97a2d89eb1173..529e61ca5b7e400965b8dfc48af2a75acb47e986 100644 --- a/tests/value/oracle/statement_contract.res.oracle +++ b/tests/value/oracle/statement_contract.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/statement_contract.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/static.res.oracle b/tests/value/oracle/static.res.oracle index 2723ec3004a0059a24af438ebc3622a34fa8666f..7b0a5df56783f4caa47286d5898e245aef30e1af 100644 --- a/tests/value/oracle/static.res.oracle +++ b/tests/value/oracle/static.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/static.i (no preprocessing) tests/value/static.i:21:[kernel] Dropping side-effect in sizeof. Nothing to worry, this is by the book. [value] Analyzing a complete application starting at main diff --git a/tests/value/oracle/strange.res.oracle b/tests/value/oracle/strange.res.oracle index ee8fb385778b6e91add923f7e7a65ab0faf50f5a..b33ff3187d4400f0794223d310012ae45407fd46 100644 --- a/tests/value/oracle/strange.res.oracle +++ b/tests/value/oracle/strange.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strange.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/strings.0.res.oracle b/tests/value/oracle/strings.0.res.oracle index a534e2b7c8c072858b12144a458f25f2ceeb57a5..c441a2b9c3845da8581e30076209d8cd1b9904f4 100644 --- a/tests/value/oracle/strings.0.res.oracle +++ b/tests/value/oracle/strings.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strings.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state @@ -55,7 +54,6 @@ tests/value/strings.i:42:[value] warning: out of bounds read. assert \valid_read Called from tests/value/strings.i:48. [value] Done for function u tests/value/strings.i:48:[value] warning: out of bounds read. assert \valid_read(p - 4); -[value] Call to builtin bzero(({{ (unsigned char *)&a }},{10})) [value] computing for function u <- main1. Called from tests/value/strings.i:53. [value] Done for function u @@ -109,13 +107,9 @@ tests/value/strings.i:42:[value] assertion 'Value,mem_access' got final status i [from] Computing for function main1 [from] Computing for function u <-main1 [from] Done for function u -[from] Computing for function Frama_C_bzero <-main1 -[from] Done for function Frama_C_bzero [from] Done for function main1 [from] ====== DEPENDENCIES COMPUTED ====== These dependencies hold at termination for the executions that terminate: -[from] Function Frama_C_bzero: - a[0..9] FROM \nothing [from] Function strcpy: NON TERMINATING - NO EFFECTS [from] Function strlen: diff --git a/tests/value/oracle/strings.1.res.oracle b/tests/value/oracle/strings.1.res.oracle index 25595865d34307fd1e68fcd3ef2c91c9e51f7d9a..8f8e8220c85e49582b6d53d26ef930105465b41b 100644 --- a/tests/value/oracle/strings.1.res.oracle +++ b/tests/value/oracle/strings.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strings.i (no preprocessing) [value] Analyzing a complete application starting at main6 [value] Computing initial state diff --git a/tests/value/oracle/strings.2.res.oracle b/tests/value/oracle/strings.2.res.oracle index d2aa62662d7d0e684b378415935f31fb375e8fdb..4f7d542bc486a1938bee1bf421a4d71251c32a54 100644 --- a/tests/value/oracle/strings.2.res.oracle +++ b/tests/value/oracle/strings.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strings.i (no preprocessing) [value] Analyzing a complete application starting at main7 [value] Computing initial state diff --git a/tests/value/oracle/strings.3.res.oracle b/tests/value/oracle/strings.3.res.oracle index aaf122890dd5c283869aa6e6074bbaa7a7a86033..85a9410d3571b1485b8950a0c55aeb45eacd15c4 100644 --- a/tests/value/oracle/strings.3.res.oracle +++ b/tests/value/oracle/strings.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strings.i (no preprocessing) [value] Analyzing a complete application starting at main8 [value] Computing initial state @@ -41,7 +40,7 @@ [value] computing for function assigns <- main8. Called from tests/value/strings.i:127. [value] using specification for function assigns -tests/value/strings.i:121:[value] warning: no \from part for clause 'assigns *(p + (0 .. s - 1));' of function assigns +tests/value/strings.i:121:[value] warning: no \from part for clause 'assigns *(p + (0 .. s - 1));' [value] Done for function assigns [value] computing for function strcmp <- main8. Called from tests/value/strings.i:128. diff --git a/tests/value/oracle/strings_cond.res.oracle b/tests/value/oracle/strings_cond.res.oracle index 5d19d6adb6608160aa0a427b342b0a5c7dd38a42..aac9a93ef0012c35cea08eca7ea83b8f582db77e 100644 --- a/tests/value/oracle/strings_cond.res.oracle +++ b/tests/value/oracle/strings_cond.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strings_cond.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,13 +6,14 @@ [value] computing for function foo <- main. Called from tests/value/strings_cond.i:8. -[value] DUMPING STATE of file tests/value/strings_cond.i line 3 +tests/value/strings_cond.i:3:[value] Frama_C_dump_each: + # Cvalue domain: s ∈ {{ "Bla" }} - =END OF DUMP== + ==END OF DUMP== tests/value/strings_cond.i:4:[value] entering loop for the first time -[value] Called Frama_C_show_each_s({{ "Bla" }}) -[value] Called Frama_C_show_each_s({{ "Bla" + {0; 1} }}) -[value] Called Frama_C_show_each_s({{ "Bla" + {0; 1; 2} }}) +tests/value/strings_cond.i:4:[value] Frama_C_show_each_s: {{ "Bla" }} +tests/value/strings_cond.i:4:[value] Frama_C_show_each_s: {{ "Bla" + {0; 1} }} +tests/value/strings_cond.i:4:[value] Frama_C_show_each_s: {{ "Bla" + {0; 1; 2} }} [value] Recording results for foo [value] Done for function foo [value] Recording results for main diff --git a/tests/value/oracle/struct.res.oracle b/tests/value/oracle/struct.res.oracle index 6e031276c712a14ab20a6b8c946c10e5c25887e1..1ba2b727641c772b3312a0c6200688dfd8282a8b 100644 --- a/tests/value/oracle/struct.res.oracle +++ b/tests/value/oracle/struct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/struct2.res.oracle b/tests/value/oracle/struct2.res.oracle index a84ca7f350e251056a2a5533ba092e9e21e33cb5..a51a9ecd4722d64a88decab7e9d629e5e5faf3d3 100644 --- a/tests/value/oracle/struct2.res.oracle +++ b/tests/value/oracle/struct2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct2.i (no preprocessing) [value] Analyzing a complete application starting at f_precis [value] Computing initial state @@ -74,6 +73,7 @@ tests/value/struct2.i:185:[value] warning: signed overflow. assert tab3[l] + m [value] done for function f_precis tests/value/struct2.i:124:[value] assertion 'Value,mem_access' got final status invalid. tests/value/struct2.i:130:[value] assertion 'Value,mem_access' got final status invalid. +[scope:rm_asserts] removing 2 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function f_precis: NULL[rbits 32768 to 32799] ∈ {{ NULL + [--..--] ; (? *)&a }} diff --git a/tests/value/oracle/struct3.res.oracle b/tests/value/oracle/struct3.res.oracle index 67c893770a50dfadfd6a2381bfb5a82458cc744d..ad21b94e32f3cb6baa088a6bf89c0fc640ede311 100644 --- a/tests/value/oracle/struct3.res.oracle +++ b/tests/value/oracle/struct3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct3.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/struct_array.res.oracle b/tests/value/oracle/struct_array.res.oracle index ac41a79c2a408aa71e3b22681285d5af2f80fe5d..836bb791a43a7ff50f04b4bfeb427fcaf3394c1d 100644 --- a/tests/value/oracle/struct_array.res.oracle +++ b/tests/value/oracle/struct_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct_array.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -50,47 +49,50 @@ tests/value/struct_array.i:36:[value] warning: out of bounds write. assert \vali [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/struct_array.i:57. -[value] Called Frama_C_show_each(.a ∈ {1} - .t[0] ∈ {2} - .t[1] ∈ {3} - .t[2] ∈ {4} - .t[3] ∈ {5} - .t[4] ∈ {6} - .t[5] ∈ {7} - .t[6] ∈ {8} - .b ∈ {9}) +tests/value/struct_array.i:41:[value] Frama_C_show_each: + .a ∈ {1} + .t[0] ∈ {2} + .t[1] ∈ {3} + .t[2] ∈ {4} + .t[3] ∈ {5} + .t[4] ∈ {6} + .t[5] ∈ {7} + .t[6] ∈ {8} + .b ∈ {9} [value] computing for function f1 <- main2 <- main. Called from tests/value/struct_array.i:42. [value] using specification for function f1 [value] Done for function f1 -[value] Called Frama_C_show_each(.a ∈ {1} - .t[0] ∈ {2} - .t[1] ∈ {3} - .t[2] ∈ {4} - .t[3] ∈ {5} - .t[4] ∈ {6} - .t[5..6] ∈ [--..--] - .b ∈ {9}) +tests/value/struct_array.i:43:[value] Frama_C_show_each: + .a ∈ {1} + .t[0] ∈ {2} + .t[1] ∈ {3} + .t[2] ∈ {4} + .t[3] ∈ {5} + .t[4] ∈ {6} + .t[5..6] ∈ [--..--] + .b ∈ {9} [value] computing for function f2 <- main2 <- main. Called from tests/value/struct_array.i:44. [value] using specification for function f2 [value] Done for function f2 -[value] Called Frama_C_show_each(.a ∈ {1} - .t[0..2] ∈ [--..--] - .t[3] ∈ {5} - .t[4] ∈ {6} - .t[5] ∈ {7} - .t[6] ∈ {8} - .b ∈ {9}) +tests/value/struct_array.i:45:[value] Frama_C_show_each: + .a ∈ {1} + .t[0..2] ∈ [--..--] + .t[3] ∈ {5} + .t[4] ∈ {6} + .t[5] ∈ {7} + .t[6] ∈ {8} + .b ∈ {9} [value] computing for function f3 <- main2 <- main. Called from tests/value/struct_array.i:46. [value] using specification for function f3 [value] Done for function f3 -[value] Called Frama_C_show_each(.a ∈ {1} - .t[0..6] ∈ [--..--] - .b ∈ {9}) +tests/value/struct_array.i:47:[value] Frama_C_show_each: .a ∈ {1} + .t[0..6] ∈ [--..--] + .b ∈ {9} tests/value/struct_array.i:50:[value] assertion got status valid. -[value] Called Frama_C_show_each_reach() +tests/value/struct_array.i:51:[value] Frama_C_show_each_reach: [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main @@ -272,38 +274,41 @@ tests/value/struct_array.i:36:[value] warning: out of bounds write. assert \vali [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/struct_array.i:57. -[value] Called Frama_C_show_each(.a ∈ {1} - .t[0] ∈ {2} - .t[1] ∈ {3} - .t[2] ∈ {4} - .t[3] ∈ {5} - .t[4] ∈ {6} - .t[5] ∈ {7} - .t[6] ∈ {8} - .b ∈ {9}) +tests/value/struct_array.i:41:[value] Frama_C_show_each: + .a ∈ {1} + .t[0] ∈ {2} + .t[1] ∈ {3} + .t[2] ∈ {4} + .t[3] ∈ {5} + .t[4] ∈ {6} + .t[5] ∈ {7} + .t[6] ∈ {8} + .b ∈ {9} [value] computing for function f1 <- main2 <- main. Called from tests/value/struct_array.i:42. [value] Done for function f1 -[value] Called Frama_C_show_each(.a ∈ {1} - .t[0] ∈ {2} - .t[1] ∈ {3} - .t[2] ∈ {4} - .t[3] ∈ {5} - .t[4] ∈ {6} - {.t[5..6]; .b} ∈ [--..--]) +tests/value/struct_array.i:43:[value] Frama_C_show_each: + .a ∈ {1} + .t[0] ∈ {2} + .t[1] ∈ {3} + .t[2] ∈ {4} + .t[3] ∈ {5} + .t[4] ∈ {6} + {.t[5..6]; .b} ∈ [--..--] [value] computing for function f2 <- main2 <- main. Called from tests/value/struct_array.i:44. [value] Done for function f2 -[value] Called Frama_C_show_each({.a; .t[0..2]} ∈ [--..--] - .t[3] ∈ {5} - .t[4] ∈ {6} - .t[5] ∈ {7} - .t[6] ∈ {8} - .b ∈ {9}) +tests/value/struct_array.i:45:[value] Frama_C_show_each: + {.a; .t[0..2]} ∈ [--..--] + .t[3] ∈ {5} + .t[4] ∈ {6} + .t[5] ∈ {7} + .t[6] ∈ {8} + .b ∈ {9} [value] computing for function f3 <- main2 <- main. Called from tests/value/struct_array.i:46. [value] Done for function f3 -[value] Called Frama_C_show_each([--..--]) +tests/value/struct_array.i:47:[value] Frama_C_show_each: [--..--] tests/value/struct_array.i:50:[value] warning: assertion got status invalid (stopping propagation). [value] Recording results for main2 [value] Done for function main2 diff --git a/tests/value/oracle/struct_call.0.res.oracle b/tests/value/oracle/struct_call.0.res.oracle index ec54366f262ddd844781b4d9ec8d894eb6923959..24604a23af69a699077c417fa3b903b779cb8cbd 100644 --- a/tests/value/oracle/struct_call.0.res.oracle +++ b/tests/value/oracle/struct_call.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct_call.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -15,26 +14,26 @@ Called from tests/value/struct_call.i:46. [value] computing for function g <- main1 <- main. Called from tests/value/struct_call.i:33. -[value] Called Frama_C_show_each_G({0}) +tests/value/struct_call.i:16:[value] Frama_C_show_each_G: {0} [value] Recording results for g [value] Done for function g [value] computing for function create_A <- main1 <- main. Called from tests/value/struct_call.i:34. -[value] Called Frama_C_show_each_GG(.x ∈ {1} - .y ∈ {0}) +tests/value/struct_call.i:25:[value] Frama_C_show_each_GG: .x ∈ {1} + .y ∈ {0} [value] Recording results for create_A [value] Done for function create_A [value] computing for function g <- main1 <- main. Called from tests/value/struct_call.i:35. -[value] Called Frama_C_show_each_G(.x ∈ {0} - .y ∈ {77}) +tests/value/struct_call.i:16:[value] Frama_C_show_each_G: .x ∈ {0} + .y ∈ {77} [value] Recording results for g [value] Done for function g [value] Recording results for main1 [value] Done for function main1 [value] computing for function h <- main. Called from tests/value/struct_call.i:47. -[value] Called Frama_C_show_each([-32768..32767], {{ NULL ; &S_c2_C }}) +tests/value/struct_call.i:42:[value] Frama_C_show_each: [-32768..32767], {{ NULL ; &S_c2_C }} [value] Recording results for h [value] Done for function h [value] Recording results for main diff --git a/tests/value/oracle/struct_call.1.res.oracle b/tests/value/oracle/struct_call.1.res.oracle index ec54366f262ddd844781b4d9ec8d894eb6923959..24604a23af69a699077c417fa3b903b779cb8cbd 100644 --- a/tests/value/oracle/struct_call.1.res.oracle +++ b/tests/value/oracle/struct_call.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct_call.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -15,26 +14,26 @@ Called from tests/value/struct_call.i:46. [value] computing for function g <- main1 <- main. Called from tests/value/struct_call.i:33. -[value] Called Frama_C_show_each_G({0}) +tests/value/struct_call.i:16:[value] Frama_C_show_each_G: {0} [value] Recording results for g [value] Done for function g [value] computing for function create_A <- main1 <- main. Called from tests/value/struct_call.i:34. -[value] Called Frama_C_show_each_GG(.x ∈ {1} - .y ∈ {0}) +tests/value/struct_call.i:25:[value] Frama_C_show_each_GG: .x ∈ {1} + .y ∈ {0} [value] Recording results for create_A [value] Done for function create_A [value] computing for function g <- main1 <- main. Called from tests/value/struct_call.i:35. -[value] Called Frama_C_show_each_G(.x ∈ {0} - .y ∈ {77}) +tests/value/struct_call.i:16:[value] Frama_C_show_each_G: .x ∈ {0} + .y ∈ {77} [value] Recording results for g [value] Done for function g [value] Recording results for main1 [value] Done for function main1 [value] computing for function h <- main. Called from tests/value/struct_call.i:47. -[value] Called Frama_C_show_each([-32768..32767], {{ NULL ; &S_c2_C }}) +tests/value/struct_call.i:42:[value] Frama_C_show_each: [-32768..32767], {{ NULL ; &S_c2_C }} [value] Recording results for h [value] Done for function h [value] Recording results for main diff --git a/tests/value/oracle/struct_deps.res.oracle b/tests/value/oracle/struct_deps.res.oracle index 21741aa1499b737619dbbd76e6a64a843fd8915e..26db1ff98aee0c69a8af4cf96864caaf4812dd4c 100644 --- a/tests/value/oracle/struct_deps.res.oracle +++ b/tests/value/oracle/struct_deps.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct_deps.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/struct_incl.res.oracle b/tests/value/oracle/struct_incl.res.oracle index affe82066006918928f26a69b662278998c943f7..9b781f824b28cf8d85a00a4586168a6868ffe7dc 100644 --- a/tests/value/oracle/struct_incl.res.oracle +++ b/tests/value/oracle/struct_incl.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct_incl.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/struct_p_call.res.oracle b/tests/value/oracle/struct_p_call.res.oracle index a9803dc40076f5fbc55ab7c5468fe8e1d3e92999..7289373f3d8403c709f6826c43560c72c4951270 100644 --- a/tests/value/oracle/struct_p_call.res.oracle +++ b/tests/value/oracle/struct_p_call.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/struct_p_call.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/strucval.res.oracle b/tests/value/oracle/strucval.res.oracle index ba10a1bd5d5dd71e8c7eebc5aebc6ac60ee0d585..12a605c64ac6b4203173c54dc1df07a287bc440f 100644 --- a/tests/value/oracle/strucval.res.oracle +++ b/tests/value/oracle/strucval.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/strucval.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/subset.res.oracle b/tests/value/oracle/subset.res.oracle index af58a40bdec0891c86232fbedd566eecaa0a7d4e..66ea0e2c6f7a735997f3bb75a2246f3e3534828e 100644 --- a/tests/value/oracle/subset.res.oracle +++ b/tests/value/oracle/subset.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/subset.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -57,6 +56,7 @@ tests/value/subset.c:66:[value] warning: assertion 'KO' got status unknown. [value] Done for function main4 [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 3 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function main1: p ∈ {{ NULL ; &__fc_fopen + [0..4088],0%8 }} diff --git a/tests/value/oracle/switch.0.res.oracle b/tests/value/oracle/switch.0.res.oracle index e1d86a710152b9161d67c9a7458febf4fbe38489..9b9f249ebc6a00d48fb7b98df25a5a3890aa42e5 100644 --- a/tests/value/oracle/switch.0.res.oracle +++ b/tests/value/oracle/switch.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/switch.i (no preprocessing) tests/value/switch.i:52:[kernel] Case label 0xFFFFFFFF exceeds range of long for switch expression. Nothing to worry. [value] Analyzing a complete application starting at main @@ -10,7 +9,7 @@ tests/value/switch.i:52:[kernel] Case label 0xFFFFFFFF exceeds range of long for result4 ∈ {0} result2 ∈ {7} d2 ∈ {0} -[value] Called Frama_C_show_each_F({0}) +tests/value/switch.i:29:[value] Frama_C_show_each_F: {0} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/switch.1.res.oracle b/tests/value/oracle/switch.1.res.oracle index e1d86a710152b9161d67c9a7458febf4fbe38489..9b9f249ebc6a00d48fb7b98df25a5a3890aa42e5 100644 --- a/tests/value/oracle/switch.1.res.oracle +++ b/tests/value/oracle/switch.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/switch.i (no preprocessing) tests/value/switch.i:52:[kernel] Case label 0xFFFFFFFF exceeds range of long for switch expression. Nothing to worry. [value] Analyzing a complete application starting at main @@ -10,7 +9,7 @@ tests/value/switch.i:52:[kernel] Case label 0xFFFFFFFF exceeds range of long for result4 ∈ {0} result2 ∈ {7} d2 ∈ {0} -[value] Called Frama_C_show_each_F({0}) +tests/value/switch.i:29:[value] Frama_C_show_each_F: {0} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/switch2.res.oracle b/tests/value/oracle/switch2.res.oracle index deaff769f40cb38fe2fdefb14bbd25d6ad0f9f60..c2d33f42a8c5fa4cfab347e51aa36a513ed93570 100644 --- a/tests/value/oracle/switch2.res.oracle +++ b/tests/value/oracle/switch2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/switch2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/switch_cast.res.oracle b/tests/value/oracle/switch_cast.res.oracle index 93fb10f6519005caa63ec9f4b15c172b6af74d8d..63a2c562541b649edac0589d0326346eb3181847 100644 --- a/tests/value/oracle/switch_cast.res.oracle +++ b/tests/value/oracle/switch_cast.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/switch_cast.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -6,8 +5,8 @@ [value:initial-state] Values of globals at initialization x ∈ [--..--] [value] computing for function g <- main. - Called from tests/value/switch_cast.i:70. -[value] Called Frama_C_show_each([1..241],1%2) + Called from tests/value/switch_cast.i:71. +tests/value/switch_cast.i:67:[value] Frama_C_show_each: [1..241],1%2 [value] Recording results for g [value] Done for function g [value] Recording results for main diff --git a/tests/value/oracle/symbolic_locs.res.oracle b/tests/value/oracle/symbolic_locs.res.oracle index 3cc3e4520978ba0731d19692cbeacf90244f8be3..b06339e3868bf25b6f70599000969013f4e6e6fa 100644 --- a/tests/value/oracle/symbolic_locs.res.oracle +++ b/tests/value/oracle/symbolic_locs.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/symbolic_locs.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,16 +7,18 @@ t[0..9] ∈ {0} u[0..9] ∈ [--..--] [value] computing for function main2_kill_direct <- main. - Called from tests/value/symbolic_locs.i:72. + Called from tests/value/symbolic_locs.i:119. tests/value/symbolic_locs.i:29:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 32 +tests/value/symbolic_locs.i:32:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..8] ∈ {0; 4} [9] ∈ {0} u[0..9] ∈ [--..--] i ∈ [0..8] - =END OF DUMP== -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 34 + ==END OF DUMP== +tests/value/symbolic_locs.i:34:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..1] ∈ {0; 4} [2] ∈ {1} @@ -25,13 +26,14 @@ tests/value/symbolic_locs.i:29:[value] warning: assertion got status unknown. [9] ∈ {0} u[0..9] ∈ [--..--] i ∈ [0..8] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main2_kill_direct [value] Done for function main2_kill_direct [value] computing for function main3_kill_indirect <- main. - Called from tests/value/symbolic_locs.i:73. + Called from tests/value/symbolic_locs.i:120. tests/value/symbolic_locs.i:41:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 44 +tests/value/symbolic_locs.i:44:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..1] ∈ {0; 4} [2] ∈ {0; 1; 4} @@ -39,8 +41,9 @@ tests/value/symbolic_locs.i:41:[value] warning: assertion got status unknown. [9] ∈ {0} u[0..9] ∈ [--..--] i ∈ [0..8] - =END OF DUMP== -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 46 + ==END OF DUMP== +tests/value/symbolic_locs.i:46:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..1] ∈ {0; 4} [2] ∈ {0; 1; 4} @@ -48,13 +51,14 @@ tests/value/symbolic_locs.i:41:[value] warning: assertion got status unknown. [9] ∈ {0} u[0..9] ∈ [--..--] i ∈ {8} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main3_kill_indirect [value] Done for function main3_kill_indirect [value] computing for function main4_scope_right <- main. - Called from tests/value/symbolic_locs.i:74. + Called from tests/value/symbolic_locs.i:121. tests/value/symbolic_locs.i:51:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 55 +tests/value/symbolic_locs.i:55:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..1] ∈ {{ NULL + {0; 4} ; (int)&x }} [2] ∈ {{ NULL + {0; 1; 4} ; (int)&x }} @@ -63,9 +67,10 @@ tests/value/symbolic_locs.i:51:[value] warning: assertion got status unknown. u[0..9] ∈ [--..--] i ∈ [0..8] x ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== tests/value/symbolic_locs.i:55:[value] warning: locals {x} escaping the scope of a block of main4_scope_right through t -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 57 +tests/value/symbolic_locs.i:57:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..1] ∈ {0; 4} or ESCAPINGADDR [2] ∈ {0; 1; 4} or ESCAPINGADDR @@ -73,35 +78,60 @@ tests/value/symbolic_locs.i:55:[value] warning: locals {x} escaping the scope of [9] ∈ {0} u[0..9] ∈ [--..--] i ∈ [0..8] - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main4_scope_right [value] Done for function main4_scope_right [value] computing for function main5_scope_lv <- main. - Called from tests/value/symbolic_locs.i:75. + Called from tests/value/symbolic_locs.i:122. tests/value/symbolic_locs.i:63:[value] warning: assertion got status unknown. -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 65 +tests/value/symbolic_locs.i:65:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..8] ∈ {0; 1; 4} or ESCAPINGADDR [9] ∈ {0} u[0..9] ∈ [--..--] z ∈ {1} i ∈ [0..8] - =END OF DUMP== -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 67 + ==END OF DUMP== +tests/value/symbolic_locs.i:67:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..8] ∈ {0; 1; 4} or ESCAPINGADDR [9] ∈ {0} u[0..9] ∈ [--..--] z ∈ {1} - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main5_scope_lv [value] Done for function main5_scope_lv -[value] DUMPING STATE of file tests/value/symbolic_locs.i line 76 +[value] computing for function main6_ghost_dep <- main. + Called from tests/value/symbolic_locs.i:123. +tests/value/symbolic_locs.i:83:[value] warning: assertion got status unknown. +tests/value/symbolic_locs.i:86:[value] warning: assertion got status unknown. +tests/value/symbolic_locs.i:98:[value] Frama_C_dump_each: + # Cvalue domain: v ∈ [--..--] t[0..8] ∈ {0; 1; 4} or ESCAPINGADDR [9] ∈ {0} u[0..9] ∈ [--..--] - =END OF DUMP== + x ∈ [--..--] + ==END OF DUMP== +tests/value/symbolic_locs.i:93:[value] entering loop for the first time +[value] Recording results for main6_ghost_dep +[value] Done for function main6_ghost_dep +[value] computing for function main7_widening <- main. + Called from tests/value/symbolic_locs.i:124. +tests/value/symbolic_locs.i:110:[value] entering loop for the first time +tests/value/symbolic_locs.i:111:[value] warning: signed overflow. assert *p + 1 ≤ 2147483647; +tests/value/symbolic_locs.i:113:[value] Frama_C_show_each: [0..2147483647] +[value] Recording results for main7_widening +[value] Done for function main7_widening +tests/value/symbolic_locs.i:125:[value] Frama_C_dump_each: + # Cvalue domain: + v ∈ [--..--] + t[0..8] ∈ {0; 1; 4} or ESCAPINGADDR + [9] ∈ {0} + u[0..9] ∈ [--..--] + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -127,6 +157,12 @@ tests/value/symbolic_locs.i:63:[value] warning: assertion got status unknown. t[0..8] ∈ {0; 1; 4} or ESCAPINGADDR [9] ∈ {0} z ∈ {1} +[value:final-states] Values at end of function main6_ghost_dep: + x ∈ {1} +[value:final-states] Values at end of function main7_widening: + b ∈ [0..2147483647] + c ∈ [0..2147483647] + p ∈ {{ &b ; &c }} [value:final-states] Values at end of function main: t[0..8] ∈ {0; 1; 4} or ESCAPINGADDR [9] ∈ {0} @@ -140,6 +176,10 @@ tests/value/symbolic_locs.i:63:[value] warning: assertion got status unknown. [from] Done for function main4_scope_right [from] Computing for function main5_scope_lv [from] Done for function main5_scope_lv +[from] Computing for function main6_ghost_dep +[from] Done for function main6_ghost_dep +[from] Computing for function main7_widening +[from] Done for function main7_widening [from] Computing for function main [from] Done for function main [from] ====== DEPENDENCIES COMPUTED ====== @@ -153,6 +193,10 @@ tests/value/symbolic_locs.i:63:[value] warning: assertion got status unknown. t[0..8] FROM v (and SELF) [from] Function main5_scope_lv: t[0..8] FROM v (and SELF) +[from] Function main6_ghost_dep: + NO EFFECTS +[from] Function main7_widening: + NO EFFECTS [from] Function main: t[0..8] FROM v (and SELF) [from] ====== END OF DEPENDENCIES ====== @@ -172,6 +216,14 @@ tests/value/symbolic_locs.i:63:[value] warning: assertion got status unknown. t[0..8]; z; i [inout] Inputs for function main5_scope_lv: v +[inout] Out (internal) for function main6_ghost_dep: + x; y; z; k; p; tmp; tmp_0 +[inout] Inputs for function main6_ghost_dep: + v +[inout] Out (internal) for function main7_widening: + b; c; p; tmp +[inout] Inputs for function main7_widening: + v [inout] Out (internal) for function main: t[0..8] [inout] Inputs for function main: diff --git a/tests/value/oracle/tab.res.oracle b/tests/value/oracle/tab.res.oracle index 999fa3165dc9f5e762dfc1f142ff5dbfb9d40ba8..c29238e4ebeb4f91a41ed198aae2806ab9e595b9 100644 --- a/tests/value/oracle/tab.res.oracle +++ b/tests/value/oracle/tab.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/tab.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/tab1.res.oracle b/tests/value/oracle/tab1.res.oracle index 62889f2ca347bfc74e0089f2b5c62a887440474d..db1bd978d6fa30ddbbd59dd2cd44559b66904de8 100644 --- a/tests/value/oracle/tab1.res.oracle +++ b/tests/value/oracle/tab1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/tab1.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/termination.res.oracle b/tests/value/oracle/termination.res.oracle index f5ffd38d230517f93a84d6eac4d6ab14cded2f91..1f0cb8ba8b9502a67838cca30fd10f899929eba0 100644 --- a/tests/value/oracle/termination.res.oracle +++ b/tests/value/oracle/termination.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/termination.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/test.0.res.oracle b/tests/value/oracle/test.0.res.oracle index 3e8deef496269e6bac58e207ae84d8ba4b6693e3..fe8bc4f81d29f74193ee8dd852ad88d2b33a977c 100644 --- a/tests/value/oracle/test.0.res.oracle +++ b/tests/value/oracle/test.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/test.i (no preprocessing) [value] Analyzing a complete application starting at inst_F6 [value] Computing initial state @@ -15,6 +14,7 @@ tests/value/test.i:14:[value] warning: out of bounds write. assert \valid(v + (i tests/value/test.i:11:[value] warning: signed overflow. assert j + ecart ≤ 2147483647; [value] Recording results for inst_F6 [value] done for function inst_F6 +[scope:rm_asserts] removing 1 assertion(s) [value] ====== VALUES COMPUTED ====== [value:final-states] Values at end of function inst_F6: t[0] ∈ UNINITIALIZED diff --git a/tests/value/oracle/test.1.res.oracle b/tests/value/oracle/test.1.res.oracle index 47c92be4ea919c0cd2b32277eabe707e494b6b93..c75263f64ad3e5951d6066d47d31504505c0194e 100644 --- a/tests/value/oracle/test.1.res.oracle +++ b/tests/value/oracle/test.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/test.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/test_arith.res.oracle b/tests/value/oracle/test_arith.res.oracle index 557a979bda69595e1ecc3cabbd0271ae156175bf..95438a422c69b54de01d5427862ab6a878116e5b 100644 --- a/tests/value/oracle/test_arith.res.oracle +++ b/tests/value/oracle/test_arith.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/test_arith.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/threat_array.res.oracle b/tests/value/oracle/threat_array.res.oracle index a0bade4a940ddb142ffcf595bf333857b1bb2dd9..3d322ce0c30ee57081613c2b848a7aaa6a63e30b 100644 --- a/tests/value/oracle/threat_array.res.oracle +++ b/tests/value/oracle/threat_array.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/threat_array.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/threat_if.res.oracle b/tests/value/oracle/threat_if.res.oracle index 3639406f041a388cd77984bf7c8a5f55aea8e5a1..ca1c6054d8b0f5853868b5b473c715da0f12c0bd 100644 --- a/tests/value/oracle/threat_if.res.oracle +++ b/tests/value/oracle/threat_if.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/threat_if.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -10,7 +9,7 @@ i ∈ {0} X ∈ {-992} tests/value/threat_if.i:14:[value] warning: out of bounds write. assert \valid(p); -[value] Called Frama_C_show_each({-126}) +tests/value/threat_if.i:18:[value] Frama_C_show_each: {-126} [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/threat_redundant.res.oracle b/tests/value/oracle/threat_redundant.res.oracle index b402b5bc8535fe23a07b6f1556117330b96f0fd0..5509063aeeb056b8844bc036a3409c98647979cd 100644 --- a/tests/value/oracle/threat_redundant.res.oracle +++ b/tests/value/oracle/threat_redundant.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/threat_redundant.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -16,9 +15,9 @@ [9] ∈ {98} x ∈ {0} [value] computing for function strchr <- main. - Called from tests/value/threat_redundant.c:16. -tests/value/threat_redundant.c:5:[value] entering loop for the first time -tests/value/threat_redundant.c:5:[value] warning: out of bounds read. assert \valid_read(s); + Called from tests/value/threat_redundant.c:19. +tests/value/threat_redundant.c:8:[value] entering loop for the first time +tests/value/threat_redundant.c:8:[value] warning: out of bounds read. assert \valid_read(s); [value] Recording results for strchr [value] Done for function strchr [value] Recording results for main diff --git a/tests/value/oracle/tricky_logic.res.oracle b/tests/value/oracle/tricky_logic.res.oracle index d98cd34abb12eff15415e1856985695ac1719de0..5eebc8b672a77ecec2898b1f35b7c7be604e54a2 100644 --- a/tests/value/oracle/tricky_logic.res.oracle +++ b/tests/value/oracle/tricky_logic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/tricky_logic.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/typedef_function.res.oracle b/tests/value/oracle/typedef_function.res.oracle index 7fd50995db902aa7627d95c14ed33f9aa2faf716..16f76d10902fbf4a34fc1ed8fccadf9d70238f55 100644 --- a/tests/value/oracle/typedef_function.res.oracle +++ b/tests/value/oracle/typedef_function.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/typedef_function.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/typeof.res.oracle b/tests/value/oracle/typeof.res.oracle index ff60b8908db42c83c71f5cf5cb57701052e30a0f..4488ddde3cebd62407f2bf4ec9ab2d4cc3f23af5 100644 --- a/tests/value/oracle/typeof.res.oracle +++ b/tests/value/oracle/typeof.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/typeof.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ulongvslonglong.0.res.oracle b/tests/value/oracle/ulongvslonglong.0.res.oracle index 753e7a96cea2b497f6d59dc72671c891c89e377e..a5bfa4190aa0da2c4d68e117e34983bb37464f6b 100644 --- a/tests/value/oracle/ulongvslonglong.0.res.oracle +++ b/tests/value/oracle/ulongvslonglong.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ulongvslonglong.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/ulongvslonglong.1.res.oracle b/tests/value/oracle/ulongvslonglong.1.res.oracle index 27a5c6db901a412c8cc4f8881a0ac5da51eda818..d93da0c5af0e930290b0affdaf2c84794d4a2849 100644 --- a/tests/value/oracle/ulongvslonglong.1.res.oracle +++ b/tests/value/oracle/ulongvslonglong.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/ulongvslonglong.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/undef_behavior_bts1059.res.oracle b/tests/value/oracle/undef_behavior_bts1059.res.oracle index c33b3c9af03c298d48260a161e9cc79504a6b9e7..ce291f2f82bc94bdca1ef303029cf595c3c0b95d 100644 --- a/tests/value/oracle/undef_behavior_bts1059.res.oracle +++ b/tests/value/oracle/undef_behavior_bts1059.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/undef_behavior_bts1059.i (no preprocessing) tests/value/undef_behavior_bts1059.i:15:[kernel] warning: Unspecified sequence with side effect: /* a <- diff --git a/tests/value/oracle/undef_fct.res.oracle b/tests/value/oracle/undef_fct.res.oracle index ce6a8721c6814728c0a135f72e0cb21879d452c5..5a6b3fee7342c7aa93e3180c123f2d27ffe18e82 100644 --- a/tests/value/oracle/undef_fct.res.oracle +++ b/tests/value/oracle/undef_fct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/undef_fct.i (no preprocessing) tests/value/undef_fct.i:3:[kernel] warning: Calling undeclared function f. Old style K&R code? [value] Analyzing a complete application starting at main diff --git a/tests/value/oracle/undefined_sequence.0.res.oracle b/tests/value/oracle/undefined_sequence.0.res.oracle index bd46cdffa0086e096cd6b2f87aecc660d43c5aee..014b832bd43d4a68b44914d090f0e0f4642dfb7d 100644 --- a/tests/value/oracle/undefined_sequence.0.res.oracle +++ b/tests/value/oracle/undefined_sequence.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/undefined_sequence.i (no preprocessing) tests/value/undefined_sequence.i:16:[kernel] warning: Unspecified sequence with side effect: /* <- */ @@ -49,10 +48,8 @@ tests/value/undefined_sequence.i:51:[kernel] warning: Unspecified sequence with G[tmp_7] += G[i]; tests/value/undefined_sequence.i:53:[kernel] warning: Unspecified sequence with side effect: /* <- x */ - { /* sequence */ - tmp_8 = g(3); - - } + tmp_8 = g(3); + tmp_9 = f(tmp_8 + x); /* <- */ tmp_10 = x; diff --git a/tests/value/oracle/undefined_sequence.1.res.oracle b/tests/value/oracle/undefined_sequence.1.res.oracle index d2d186fb0306eb64782a409b20075e4ba4e56823..5cc5cec3890cdf64758f98cc8cc4beda6465b7e7 100644 --- a/tests/value/oracle/undefined_sequence.1.res.oracle +++ b/tests/value/oracle/undefined_sequence.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/undefined_sequence.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/undefined_sequence2.res.oracle b/tests/value/oracle/undefined_sequence2.res.oracle index 08dde457e62a8ae7dd253a966b6e54243bac1b7d..99e65dc00af34a9b30233a8929394d48681d0176 100644 --- a/tests/value/oracle/undefined_sequence2.res.oracle +++ b/tests/value/oracle/undefined_sequence2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/undefined_sequence2.i (no preprocessing) tests/value/undefined_sequence2.i:11:[kernel] warning: Unspecified sequence with side effect: /* *x <- x */ @@ -58,7 +57,7 @@ tests/value/undefined_sequence2.i:26:[value] warning: undefined multiple accesse Called from tests/value/undefined_sequence2.i:62. [value] Recording results for multiple_update_unsafe [value] Done for function multiple_update_unsafe -[value] Called Frama_C_show_each_passed4() +tests/value/undefined_sequence2.i:62:[value] Frama_C_show_each_passed4: [value] computing for function multiple_update_unsafe <- main. Called from tests/value/undefined_sequence2.i:64. tests/value/undefined_sequence2.i:34:[value] warning: undefined multiple accesses in expression. assert \separated(x, y); @@ -68,12 +67,12 @@ tests/value/undefined_sequence2.i:34:[value] warning: undefined multiple accesse Called from tests/value/undefined_sequence2.i:66. [value] Recording results for multiple_update_safe [value] Done for function multiple_update_safe -[value] Called Frama_C_show_each_passed6() +tests/value/undefined_sequence2.i:66:[value] Frama_C_show_each_passed6: [value] computing for function multiple_update_safe <- main. Called from tests/value/undefined_sequence2.i:68. [value] Recording results for multiple_update_safe [value] Done for function multiple_update_safe -[value] Called Frama_C_show_each_passed7() +tests/value/undefined_sequence2.i:68:[value] Frama_C_show_each_passed7: [value] Recording results for main [value] done for function main tests/value/undefined_sequence2.i:11:[value] assertion 'Value,separation' got final status invalid. diff --git a/tests/value/oracle/uninit.res.oracle b/tests/value/oracle/uninit.res.oracle index da1ab7708a6421434d841a6c3b023ec8e05a17cf..c944152de4bdb1a11dda26490e3444c64be37263 100644 --- a/tests/value/oracle/uninit.res.oracle +++ b/tests/value/oracle/uninit.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/uninit.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/uninit_callstack.res.oracle b/tests/value/oracle/uninit_callstack.res.oracle index d5f336736e39b3e48b7fbdc76626680a47bade67..5b307a44f032b1c56a722c5527587142b26915a4 100644 --- a/tests/value/oracle/uninit_callstack.res.oracle +++ b/tests/value/oracle/uninit_callstack.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/uninit_callstack.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/uninitialized_gnubody.res.oracle b/tests/value/oracle/uninitialized_gnubody.res.oracle index 2717771a2104a033b655dc1d2f22aee934993098..b32b6c55b448512a960efdf5fc4e70dfe0ffd970 100644 --- a/tests/value/oracle/uninitialized_gnubody.res.oracle +++ b/tests/value/oracle/uninitialized_gnubody.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/uninitialized_gnubody.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/unknown_sizeof.0.res.oracle b/tests/value/oracle/unknown_sizeof.0.res.oracle index a4aed5a6d9772441982ab7b802b98835eb7b2ae7..75e8a38561d3fc78343820703df9048b52e113c8 100644 --- a/tests/value/oracle/unknown_sizeof.0.res.oracle +++ b/tests/value/oracle/unknown_sizeof.0.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/unknown_sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main1 [value] Computing initial state tests/value/unknown_sizeof.i:8:[value] warning: during initialization of variable 's', size of type 'struct s' cannot be computed (abstract type 'struct s') -tests/value/unknown_sizeof.i:8:[kernel] imprecise size for variable s (abstract type 'struct s') [value] Initial state computed [value:initial-state] Values of globals at initialization s.[bits 0 to ..] ∈ {0} or UNINITIALIZED diff --git a/tests/value/oracle/unknown_sizeof.1.res.oracle b/tests/value/oracle/unknown_sizeof.1.res.oracle index 1d4daa6051915c0c196db897f45576db23e4481d..e56ae9cffb213b3758397b6c5a16d68362f46fc7 100644 --- a/tests/value/oracle/unknown_sizeof.1.res.oracle +++ b/tests/value/oracle/unknown_sizeof.1.res.oracle @@ -1,10 +1,8 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/unknown_sizeof.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state tests/value/unknown_sizeof.i:8:[value] warning: during initialization of variable 's', size of type 'struct s' cannot be computed (abstract type 'struct s') -tests/value/unknown_sizeof.i:8:[kernel] imprecise size for variable s (abstract type 'struct s') [value] Initial state computed [value:initial-state] Values of globals at initialization s.[bits 0 to ..] ∈ {0} or UNINITIALIZED diff --git a/tests/value/oracle/unop.res.oracle b/tests/value/oracle/unop.res.oracle index ecffc6d3670ff987828fc36d639500f490462501..c7935c59e802246046f47f5a9915b3d002eaa341 100644 --- a/tests/value/oracle/unop.res.oracle +++ b/tests/value/oracle/unop.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/unop.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -7,17 +6,17 @@ v ∈ [--..--] [value] computing for function main1 <- main. Called from tests/value/unop.c:22. -[value] Called Frama_C_show_each_1([-2147483648. .. 2147483648.]) -[value] Called Frama_C_show_each_1_then([-2147483648. .. -3.]) -[value] Called Frama_C_show_each_1_else([-2.99999976158 .. 2147483648.]) +tests/value/unop.c:2:[value] Frama_C_show_each_1: [-2147483648. .. 2147483648.] +tests/value/unop.c:4:[value] Frama_C_show_each_1_then: [-2147483648. .. -3.] +tests/value/unop.c:6:[value] Frama_C_show_each_1_else: [-2.99999976158 .. 2147483648.] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/unop.c:23. -[value] Called Frama_C_show_each_2([-2147483648..2147483647]) +tests/value/unop.c:11:[value] Frama_C_show_each_2: [-2147483648..2147483647] tests/value/unop.c:12:[value] warning: signed overflow. assert -i ≤ 2147483647; -[value] Called Frama_C_show_each_2_then([-2147483647..-3]) -[value] Called Frama_C_show_each_2_else([-2..2147483647]) +tests/value/unop.c:13:[value] Frama_C_show_each_2_then: [-2147483647..-3] +tests/value/unop.c:15:[value] Frama_C_show_each_2_else: [-2..2147483647] [value] Recording results for main2 [value] Done for function main2 [value] Recording results for main diff --git a/tests/value/oracle/unroll.res.oracle b/tests/value/oracle/unroll.res.oracle index e6acca23db811e1b0b92c92d158671c65eab62ca..6d60be30fa49272c4b6fcec0093541cd5b7667e7 100644 --- a/tests/value/oracle/unroll.res.oracle +++ b/tests/value/oracle/unroll.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/unroll.i (no preprocessing) tests/value/unroll.i:49:[kernel] warning: ignoring unrolling directive (not an understood constant expression) tests/value/unroll.i:54:[kernel] warning: ignoring invalid unrolling directive diff --git a/tests/value/oracle/unroll_simple.res.oracle b/tests/value/oracle/unroll_simple.res.oracle index 98913d1f55e8f637d21721ec0c3124dc000c34df..a9102b5f1f354570aeface50a5fc1221723b80b2 100644 --- a/tests/value/oracle/unroll_simple.res.oracle +++ b/tests/value/oracle/unroll_simple.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/unroll_simple.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/unsigned_overflow.res.oracle b/tests/value/oracle/unsigned_overflow.res.oracle index 2f31b9939501b89a2d00c19f3c556e66bda88221..89cce1184f18e6dc0ddc0ecd19af9f0e10d0a8f2 100644 --- a/tests/value/oracle/unsigned_overflow.res.oracle +++ b/tests/value/oracle/unsigned_overflow.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/unsigned_overflow.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -8,7 +7,7 @@ i2 ∈ [--..--] tests/value/unsigned_overflow.c:4:[value] warning: assertion got status unknown. tests/value/unsigned_overflow.c:5:[value] warning: assertion got status unknown. -[value] Called Frama_C_show_each_dead() +tests/value/unsigned_overflow.c:10:[value] Frama_C_show_each_dead: [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/use_spec.0.res.oracle b/tests/value/oracle/use_spec.0.res.oracle index 9f0f9f2875660f87b558d7dbee5629b6ca94312b..ead08409e8a7dd35530e46698429675fcb45020f 100644 --- a/tests/value/oracle/use_spec.0.res.oracle +++ b/tests/value/oracle/use_spec.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/use_spec.i (no preprocessing) [value] user error: no assigns specified for function 'f', for which a builtin or the specification will be used. Potential unsoundness. diff --git a/tests/value/oracle/use_spec.1.res.oracle b/tests/value/oracle/use_spec.1.res.oracle index 725230618d432c989bcfac6218c76300ef30f7aa..8cc2584f27473552c7f84b5a95addacf04091213 100644 --- a/tests/value/oracle/use_spec.1.res.oracle +++ b/tests/value/oracle/use_spec.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/use_spec.i (no preprocessing) [value] user error: no assigns specified for function 'f', for which a builtin or the specification will be used. Potential unsoundness. diff --git a/tests/value/oracle/user_assertion_uninit_var.res.oracle b/tests/value/oracle/user_assertion_uninit_var.res.oracle index 27ab202184fcfbc900d3080b6ea636cb58ad7877..ce72e551bd64096533d0c5339264dc22715907f7 100644 --- a/tests/value/oracle/user_assertion_uninit_var.res.oracle +++ b/tests/value/oracle/user_assertion_uninit_var.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/user_assertion_uninit_var.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/usp.res.oracle b/tests/value/oracle/usp.res.oracle index 10b186036e67c0456efed1fe1cd59211e4e559a6..011e2cef5394403f3ff7952106bd6255624684c3 100644 --- a/tests/value/oracle/usp.res.oracle +++ b/tests/value/oracle/usp.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/usp.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -12,8 +11,9 @@ Y ∈ {0} Z ∈ {0} T ∈ {0} -[value] Called Frama_C_show_each({-1; 5}) -[value] DUMPING STATE of file tests/value/usp.i line 18 +tests/value/usp.i:17:[value] Frama_C_show_each: {-1; 5} +tests/value/usp.i:18:[value] Frama_C_dump_each: + # Cvalue domain: a ∈ {-12} b ∈ {5; 4294967295} p ∈ {{ (unsigned int *)&a }} @@ -24,7 +24,7 @@ T ∈ {0; 5} c ∈ [--..--] __retres ∈ UNINITIALIZED - =END OF DUMP== + ==END OF DUMP== [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== diff --git a/tests/value/oracle/va_list.res.oracle b/tests/value/oracle/va_list.res.oracle index d6f3bb72220fce6057a6ef6cbed739a4bc79894b..bdb1cf5c6b96f7001e67ef74ef4bba2788213d16 100644 --- a/tests/value/oracle/va_list.res.oracle +++ b/tests/value/oracle/va_list.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/va_list.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/va_list2.res.oracle b/tests/value/oracle/va_list2.res.oracle index 4d2c3649824f56d541c1d10e2b5a6bde46e812f6..c20d4c02d0fd68a607d268f65b0f4789a5216121 100644 --- a/tests/value/oracle/va_list2.res.oracle +++ b/tests/value/oracle/va_list2.res.oracle @@ -1,25 +1,25 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/va_list2.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state [value] Initial state computed [value:initial-state] Values of globals at initialization +tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype tests/value/va_list2.c:8:[value] entering loop for the first time tests/value/va_list2.c:8:[value] warning: out of bounds read. assert \valid_read(fmt); -[value] Called Frama_C_show_each_i([-2147483648..2147483647]) +tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype +tests/value/va_list2.c:12:[value] Frama_C_show_each_i: [-2147483648..2147483647] tests/value/va_list2.c:16:[value] warning: non-finite float value. assert \is_finite(tmp_0); (tmp_0 from vararg) -[value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) +tests/value/va_list2.c:17:[value] Frama_C_show_each_f: [-3.40282346639e+38 .. 3.40282346639e+38] tests/value/va_list2.c:9:[value] warning: out of bounds read. assert \valid_read(fmt); -[value] Called Frama_C_show_each_i([-2147483648..2147483647]) -[value] Called Frama_C_show_each_f([-3.40282346639e+38 .. 3.40282346639e+38]) +tests/value/va_list2.c:12:[value] Frama_C_show_each_i: [-2147483648..2147483647] +tests/value/va_list2.c:17:[value] Frama_C_show_each_f: [-3.40282346639e+38 .. 3.40282346639e+38] +tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype [value] Recording results for main [value] done for function main +[scope:rm_asserts] removing 1 assertion(s) [value] ====== VALUES COMPUTED ====== -tests/value/va_list2.c:7:[kernel] warning: Neither code nor specification for function __builtin_va_start, generating default assigns from the prototype -tests/value/va_list2.c:11:[kernel] warning: Neither code nor specification for function __builtin_va_arg, generating default assigns from the prototype -tests/value/va_list2.c:24:[kernel] warning: Neither code nor specification for function __builtin_va_end, generating default assigns from the prototype [value:final-states] Values at end of function main: fmt ∈ {{ &S_fmt{[0], [1]} }} [from] Computing for function main diff --git a/tests/value/oracle/val6.0.res.oracle b/tests/value/oracle/val6.0.res.oracle index 3262fad2cca2c94cdde76a3030610404c31531fc..3d11fb5aff3f22f76e51e5bde9cc72886b871636 100644 --- a/tests/value/oracle/val6.0.res.oracle +++ b/tests/value/oracle/val6.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val6.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/val6.1.res.oracle b/tests/value/oracle/val6.1.res.oracle index d9ca6d75461050a1524d870760c570e83d5a7122..a5585c51e20c235f2a2fecc44c402fd7f2e91f3a 100644 --- a/tests/value/oracle/val6.1.res.oracle +++ b/tests/value/oracle/val6.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val6.i (no preprocessing) [value] Analyzing a complete application starting at f1 [value] Computing initial state diff --git a/tests/value/oracle/val9.res.oracle b/tests/value/oracle/val9.res.oracle deleted file mode 100644 index 32f7f2939c4e00b9f5b261cc74c5e8d6a147e7d6..0000000000000000000000000000000000000000 --- a/tests/value/oracle/val9.res.oracle +++ /dev/null @@ -1,96 +0,0 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) -[kernel] Parsing tests/value/val9.i (no preprocessing) -[value] Analyzing a complete application starting at f -[value] Computing initial state -[value] Initial state computed -[value:initial-state] Values of globals at initialization - TT[0] ∈ {1} - [1] ∈ {2} - [2] ∈ {3} - [3..9] ∈ {0} - T[0] ∈ {1} - [1] ∈ {2} - [2] ∈ {3} - [3..9] ∈ {0} - i ∈ {0} - a ∈ {0} - b ∈ {0} - a7 ∈ {0} - b7 ∈ {0} - O1[0..19] ∈ {0} - O2[0..19] ∈ {0} - p ∈ {0} - x2 ∈ {0} - b2 ∈ {0} - a2 ∈ {0} -tests/value/val9.i:17:[value] entering loop for the first time -tests/value/val9.i:27:[value] entering loop for the first time -[value] Recording results for f -[value] done for function f -[value] ====== VALUES COMPUTED ====== -[value:final-states] Values at end of function f: - TT[0][bits 0 to 7]# ∈ [0..8]%32, bits 0 to 7 - [bits 8 to 39]# ∈ [0..8] repeated %32, bits 8 to 39 - [bits 40 to 71]# ∈ [0..8] repeated %32, bits 8 to 39 - [bits 72 to 287]# ∈ [0..8] repeated %32, bits 8 to 223 - [9] ∈ {0} - T[0][bits 0 to 7]# ∈ {1}%32, bits 0 to 7 - [0][bits 8 to 31]# ∈ {0; 1}%32, bits 8 to 31 - [1][bits 0 to 7]# ∈ {0; 2}%32, bits 0 to 7 - [1][bits 8 to 31]# ∈ {0; 2}%32, bits 8 to 31 - [2][bits 0 to 7]# ∈ {0; 3}%32, bits 0 to 7 - [2][bits 8 to 31]# ∈ {0; 3}%32, bits 8 to 31 - [3..5] ∈ {0} - [6][bits 0 to 7]# ∈ {0; 7}%32, bits 0 to 7 - [6][bits 8 to 31]# ∈ {0; 7}%32, bits 8 to 31 - [7..9] ∈ {0} - i ∈ {9} - a[bits 0 to 7] ∈ {1; 6} - [bits 8 to 31]# ∈ {6}%32, bits 8 to 31 - b[bits 0 to 7] ∈ {0; 1} - [bits 8 to 31]# ∈ {0; 6}%32, bits 8 to 31 - a7[bits 0 to 7] ∈ {1} - [bits 8 to 31]# ∈ {97}%32, bits 8 to 31 - b7 ∈ {1} - O1[0][bits 0 to 7] ∈ {0} - [0][bits 8 to 15] ∈ {18} - [0][bits 16 to 31] ∈ {0} - [1] ∈ {17} - [2..8] ∈ {0} - [9] ∈ {1} - [10..19] ∈ {0} - O2[0][bits 0 to 7]# ∈ {10}%32, bits 0 to 7 - [0][bits 8 to 15] ∈ {11} - [0][bits 16 to 31]# ∈ {10}%32, bits 16 to 31 - [1..19] ∈ {0} - p ∈ {{ &O1[9] }} - x2 ∈ {1} - b2 ∈ {{ &x2 }} - a2 ∈ {{ (int)&x2 }} -[from] Computing for function f -[from] Done for function f -[from] ====== DEPENDENCIES COMPUTED ====== - These dependencies hold at termination for the executions that terminate: -[from] Function f: - TT{[0..8]; [9][bits 0 to 7]} FROM \nothing (and SELF) - T{{[0][bits 8 to 31]; [1..5]}; {[7..8]; [9][bits 0 to 7]}} - FROM \nothing (and SELF) - [6] FROM b - i FROM \nothing - a FROM b - b FROM b (and SELF) - a7 FROM \nothing - b7 FROM \nothing - O1{[0][bits 8 to 15]; [1]; [6]; [9]} FROM \nothing - O2[0] FROM \nothing - p FROM \nothing - x2 FROM \nothing - b2 FROM \nothing - a2 FROM \nothing -[from] ====== END OF DEPENDENCIES ====== -[inout] Out (internal) for function f: - TT{[0..8]; [9][bits 0 to 7]}; - T{[0][bits 8 to 31]; [1..8]; [9][bits 0 to 7]}; i; a; b; a7; b7; - O1{[0][bits 8 to 15]; [1]; [6]; [9]}; O2[0]; p; x2; b2; a2 -[inout] Inputs for function f: - i; a; b; a7; p; x2; b2; a2 diff --git a/tests/value/oracle/val_if.0.res.oracle b/tests/value/oracle/val_if.0.res.oracle index 3a1c55686bb02cb6ce191dcc2aa015127b20e291..8ff97ab62066c7da9f2c7d14f189b9c9e491606a 100644 --- a/tests/value/oracle/val_if.0.res.oracle +++ b/tests/value/oracle/val_if.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_if.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/val_if.1.res.oracle b/tests/value/oracle/val_if.1.res.oracle index 70cfaa9902b380d6ce5963e1f7e919638813efa2..6d4f82ccfe534632786f0da0ca0982d7f6996c04 100644 --- a/tests/value/oracle/val_if.1.res.oracle +++ b/tests/value/oracle/val_if.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_if.i (no preprocessing) [value] Analyzing a complete application starting at f1 [value] Computing initial state diff --git a/tests/value/oracle/val_if.2.res.oracle b/tests/value/oracle/val_if.2.res.oracle index 7d6ba2c202e1ede5995844f361836541702af135..719159170c370fdb434c10b9b597f90a54a606de 100644 --- a/tests/value/oracle/val_if.2.res.oracle +++ b/tests/value/oracle/val_if.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_if.i (no preprocessing) [value] Analyzing a complete application starting at f2 [value] Computing initial state diff --git a/tests/value/oracle/val_ptr.0.res.oracle b/tests/value/oracle/val_ptr.0.res.oracle index 50a153e1e4bdce53da911e61dd216d1bfbf3e68f..15daf9e5c94b000c69e667c3013ac0a769101532 100644 --- a/tests/value/oracle/val_ptr.0.res.oracle +++ b/tests/value/oracle/val_ptr.0.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_ptr.i (no preprocessing) [value] Analyzing a complete application starting at f [value] Computing initial state diff --git a/tests/value/oracle/val_ptr.1.res.oracle b/tests/value/oracle/val_ptr.1.res.oracle index 00f301fee3be461eb6e7493257f29fc9ed50f9ee..26014943667c79a2b50381c01424c0b5ada5c1f4 100644 --- a/tests/value/oracle/val_ptr.1.res.oracle +++ b/tests/value/oracle/val_ptr.1.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_ptr.i (no preprocessing) [value] Analyzing a complete application starting at f1 [value] Computing initial state diff --git a/tests/value/oracle/val_ptr.2.res.oracle b/tests/value/oracle/val_ptr.2.res.oracle index 13cf01efc9f4ba2a058d9f3006ab3172ea4f698b..4add64a234fbe4114737ee3e351abd4befb4c798 100644 --- a/tests/value/oracle/val_ptr.2.res.oracle +++ b/tests/value/oracle/val_ptr.2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_ptr.i (no preprocessing) [value] Analyzing a complete application starting at f3 [value] Computing initial state diff --git a/tests/value/oracle/val_ptr.3.res.oracle b/tests/value/oracle/val_ptr.3.res.oracle index 0f93b59a677ec4e1fb04f1490512cb43d431a5b5..63febbd7e40775cf9f1e056e132b0d96e3855a69 100644 --- a/tests/value/oracle/val_ptr.3.res.oracle +++ b/tests/value/oracle/val_ptr.3.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/val_ptr.i (no preprocessing) [value] Analyzing a complete application starting at f2 [value] Computing initial state diff --git a/tests/value/oracle/video_detect.res.oracle b/tests/value/oracle/video_detect.res.oracle index e4376bd1dd141717510b297f8d3502564beca6ac..bf4998bf6d275f287b7d58d7fa629d3ad9c3dfec 100644 --- a/tests/value/oracle/video_detect.res.oracle +++ b/tests/value/oracle/video_detect.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/video_detect.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/volatile.res.oracle b/tests/value/oracle/volatile.res.oracle index 8f5f27f9da4a54621a540ca61ff6d583c4ba6552..15dc53ed9dda48e0f5794386a467512811e8d4dd 100644 --- a/tests/value/oracle/volatile.res.oracle +++ b/tests/value/oracle/volatile.res.oracle @@ -1,10 +1,9 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/volatile.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state -tests/value/volatile.c:5:[value] warning: global initialization of volatile zone G ignored +tests/value/volatile.c:5:[value] warning: global initialization of volatile variable G ignored tests/value/volatile.c:11:[value] warning: global initialization of volatile zone s2.b ignored -tests/value/volatile.c:15:[value] warning: global initialization of volatile zone sv2 ignored +tests/value/volatile.c:15:[value] warning: global initialization of volatile variable sv2 ignored tests/value/volatile.c:17:[value] warning: global initialization of volatile zone sv3.b ignored tests/value/volatile.c:18:[value] warning: global initialization of volatile zone sv4.b ignored tests/value/volatile.c:33:[value] warning: global initialization of volatile zone nested.__anonCompField1.b ignored @@ -56,8 +55,8 @@ tests/value/volatile.c:33:[value] warning: global initialization of volatile zon Called from tests/value/volatile.c:151. [value] computing for function fn1 <- main1 <- main. Called from tests/value/volatile.c:39. -[value] Called Frama_C_show_each_1([-2147483648..2147483647]) -[value] Called Frama_C_show_each_2([-2147483648..2147483647]) +tests/value/volatile.c:24:[value] Frama_C_show_each_1: [-2147483648..2147483647] +tests/value/volatile.c:25:[value] Frama_C_show_each_2: [-2147483648..2147483647] tests/value/volatile.c:26:[value] warning: signed overflow. assert -2147483648 ≤ x_0 + y_0; tests/value/volatile.c:26:[value] warning: signed overflow. assert x_0 + y_0 ≤ 2147483647; [value] Recording results for fn1 @@ -67,7 +66,7 @@ tests/value/volatile.c:26:[value] warning: signed overflow. assert x_0 + y_0 ≤ tests/value/volatile.c:40:[kernel] warning: Neither code nor specification for function fn2, generating default assigns from the prototype [value] using specification for function fn2 [value] Done for function fn2 -[value] Called Frama_C_show_each_d([-2147483648..2147483647]) +tests/value/volatile.c:41:[value] Frama_C_show_each_d: [-2147483648..2147483647] tests/value/volatile.c:52:[value] warning: signed overflow. assert -2147483648 ≤ b - c; tests/value/volatile.c:52:[value] warning: signed overflow. assert b - c ≤ 2147483647; tests/value/volatile.c:53:[value] warning: signed overflow. assert -2147483648 ≤ F - F; @@ -88,181 +87,148 @@ tests/value/volatile.c:59:[value] warning: signed overflow. assert m - l ≤ 214 [value] Done for function main2 [value] computing for function main3 <- main. Called from tests/value/volatile.c:153. +tests/value/volatile.c:113:[value] warning: initialization of volatile variable v ignored tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:114:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(v + 1); tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert (int)(v + 1) < 1; tests/value/volatile.c:114:[value] warning: signed overflow. assert v + 1 ≤ 2147483647; -tests/value/volatile.c:114:[value] warning: signed overflow. assert v + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:114:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert a_0[v] < 1; -tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; -tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:114:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[v] - 1); tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert (int)(a_0[v] - 1) < 1; -tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; -tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:114:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert 0 ≤ v; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert v < 2; tests/value/volatile.c:114:[value] warning: accessing out of bounds index. assert a_0[v] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:114:[value] Frama_C_show_each_av: [-2147483648..2147483647] tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:118:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(*v_ptr + 1); tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert (int)(*v_ptr + 1) < 1; tests/value/volatile.c:118:[value] warning: signed overflow. assert *v_ptr + 1 ≤ 2147483647; -tests/value/volatile.c:118:[value] warning: signed overflow. assert *v_ptr + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:118:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert a_0[*v_ptr] < 1; -tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; -tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:118:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[*v_ptr] - 1); tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert (int)(a_0[*v_ptr] - 1) < 1; -tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; -tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:118:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert 0 ≤ *v_ptr; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert *v_ptr < 2; tests/value/volatile.c:118:[value] warning: accessing out of bounds index. assert a_0[*v_ptr] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:118:[value] Frama_C_show_each_av: [-2147483648..2147483647] tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:125:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(svol.f[0] + 1); tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert (int)(svol.f[0] + 1) < 1; tests/value/volatile.c:125:[value] warning: signed overflow. assert svol.f[0] + 1 ≤ 2147483647; -tests/value/volatile.c:125:[value] warning: signed overflow. assert svol.f[0] + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:125:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert a_0[svol.f[0]] < 1; -tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; -tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:125:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[svol.f[0]] - 1); tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert (int)(a_0[svol.f[0]] - 1) < 1; -tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; -tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:125:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert 0 ≤ svol.f[0]; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert svol.f[0] < 2; tests/value/volatile.c:125:[value] warning: accessing out of bounds index. assert a_0[svol.f[0]] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:125:[value] Frama_C_show_each_av: [-2147483648..2147483647] tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:129:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(svol_ptr->f[0] + 1); tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert (int)(svol_ptr->f[0] + 1) < 1; tests/value/volatile.c:129:[value] warning: signed overflow. assert svol_ptr->f[0] + 1 ≤ 2147483647; -tests/value/volatile.c:129:[value] warning: signed overflow. assert svol_ptr->f[0] + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:129:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert a_0[svol_ptr->f[0]] < 1; -tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; -tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:129:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[svol_ptr->f[0]] - 1); tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert (int)(a_0[svol_ptr->f[0]] - 1) < 1; -tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; -tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:129:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert 0 ≤ svol_ptr->f[0]; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert svol_ptr->f[0] < 2; tests/value/volatile.c:129:[value] warning: accessing out of bounds index. assert a_0[svol_ptr->f[0]] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:129:[value] Frama_C_show_each_av: [-2147483648..2147483647] tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:136:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(sdeepvol.g[0] + 1); tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert (int)(sdeepvol.g[0] + 1) < 1; tests/value/volatile.c:136:[value] warning: signed overflow. assert sdeepvol.g[0] + 1 ≤ 2147483647; -tests/value/volatile.c:136:[value] warning: signed overflow. assert sdeepvol.g[0] + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:136:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert a_0[sdeepvol.g[0]] < 1; -tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; -tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:136:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[sdeepvol.g[0]] - 1); tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert (int)(a_0[sdeepvol.g[0]] - 1) < 1; -tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; -tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:136:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert 0 ≤ sdeepvol.g[0]; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert sdeepvol.g[0] < 2; tests/value/volatile.c:136:[value] warning: accessing out of bounds index. assert a_0[sdeepvol.g[0]] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:136:[value] Frama_C_show_each_av: [-2147483648..2147483647] +tests/value/volatile.c:139:[value] warning: initialization of volatile variable volt ignored tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:140:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(volt[0].f[0] + 1); tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert (int)(volt[0].f[0] + 1) < 1; tests/value/volatile.c:140:[value] warning: signed overflow. assert volt[0].f[0] + 1 ≤ 2147483647; -tests/value/volatile.c:140:[value] warning: signed overflow. assert volt[0].f[0] + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:140:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert a_0[volt[0].f[0]] < 1; -tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; -tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:140:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[volt[0].f[0]] - 1); tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert (int)(a_0[volt[0].f[0]] - 1) < 1; -tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; -tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:140:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert 0 ≤ volt[0].f[0]; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert volt[0].f[0] < 2; tests/value/volatile.c:140:[value] warning: accessing out of bounds index. assert a_0[volt[0].f[0]] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:140:[value] Frama_C_show_each_av: [-2147483648..2147483647] tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 1; -[value] Called Frama_C_show_each_v([-2147483648..2147483647]) +tests/value/volatile.c:144:[value] Frama_C_show_each_v: [-2147483648..2147483647] tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(deepvolt[0].g[0] + 1); tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert (int)(deepvolt[0].g[0] + 1) < 1; tests/value/volatile.c:144:[value] warning: signed overflow. assert deepvolt[0].g[0] + 1 ≤ 2147483647; -tests/value/volatile.c:144:[value] warning: signed overflow. assert deepvolt[0].g[0] + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_v_plus([-2147483647..2147483647]) +tests/value/volatile.c:144:[value] Frama_C_show_each_v_plus: [-2147483647..2147483647] tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert a_0[deepvolt[0].g[0]] < 1; -tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; -tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; -[value] Called Frama_C_show_each_a({0; 1}) +tests/value/volatile.c:144:[value] Frama_C_show_each_a: {0; 1} tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ (int)(a_0[deepvolt[0].g[0]] - 1); tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert (int)(a_0[deepvolt[0].g[0]] - 1) < 1; -tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; -tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; -[value] Called Frama_C_show_each_a_minus({-1; 0}) +tests/value/volatile.c:144:[value] Frama_C_show_each_a_minus: {-1; 0} tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert 0 ≤ deepvolt[0].g[0]; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert deepvolt[0].g[0] < 2; tests/value/volatile.c:144:[value] warning: accessing out of bounds index. assert a_0[deepvolt[0].g[0]] < 1; -[value] Called Frama_C_show_each_av([-2147483648..2147483647]) +tests/value/volatile.c:144:[value] Frama_C_show_each_av: [-2147483648..2147483647] [value] Recording results for main3 [value] Done for function main3 [value] Recording results for main @@ -299,7 +265,7 @@ tests/value/volatile.c:144:[value] warning: accessing out of bounds index. asser p1 ∈ {{ NULL + [--..--] ; &X + [--..--] }} p2 ∈ {{ &X + [--..--] }} p3 ∈ {{ NULL + [--..--] ; &X + [--..--] }} - __retres ∈ {{ NULL + [--..--] ; &X + [--..--] }} + __retres ∈ {{ NULL ; &X }} [value:final-states] Values at end of function main3: t[0] ∈ {0} a_0[0] ∈ {0} diff --git a/tests/value/oracle/volatile2.res.oracle b/tests/value/oracle/volatile2.res.oracle index 133522c9f8777278c884cdad39044e2b736e678b..05c97ef1a96a1adee7d7786d20b7a7fa9808e40c 100644 --- a/tests/value/oracle/volatile2.res.oracle +++ b/tests/value/oracle/volatile2.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/volatile2.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -11,8 +10,11 @@ ps ∈ {{ &s }} v ∈ [--..--] BITF ∈ [--..--] + S9 ∈ [--..--] + u9[0..9] ∈ [--..--] [value] computing for function main1 <- main. - Called from tests/value/volatile2.i:123. + Called from tests/value/volatile2.i:136. +tests/value/volatile2.i:13:[value] warning: initialization of volatile variable c ignored tests/value/volatile2.i:23:[value] warning: signed overflow. assert (int)c << 8 ≤ 32767; tests/value/volatile2.i:24:[value] warning: signed overflow. assert (int)*p << 8 ≤ 32767; tests/value/volatile2.i:25:[value] warning: signed overflow. assert (int)t[1] << 8 ≤ 32767; @@ -20,11 +22,11 @@ tests/value/volatile2.i:26:[value] warning: signed overflow. assert (int)u.f1 << [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. - Called from tests/value/volatile2.i:124. + Called from tests/value/volatile2.i:137. [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. - Called from tests/value/volatile2.i:125. + Called from tests/value/volatile2.i:138. tests/value/volatile2.i:47:[value] warning: assertion got status invalid (stopping propagation). tests/value/volatile2.i:52:[value] assertion got status valid. tests/value/volatile2.i:55:[value] warning: assertion got status unknown. @@ -33,11 +35,14 @@ tests/value/volatile2.i:59:[value] assertion got status valid. [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. - Called from tests/value/volatile2.i:126. + Called from tests/value/volatile2.i:139. +tests/value/volatile2.i:67:[value] warning: initialization of volatile variable p2 ignored [value] Recording results for main4 [value] Done for function main4 [value] computing for function main5 <- main. - Called from tests/value/volatile2.i:127. + Called from tests/value/volatile2.i:140. +tests/value/volatile2.i:74:[value] warning: initialization of volatile variable i ignored +tests/value/volatile2.i:75:[value] warning: initialization of volatile variable j ignored tests/value/volatile2.i:76:[value] warning: signed overflow. assert i + 1 ≤ 32767; tests/value/volatile2.i:76:[value] warning: signed overflow. assert j + 1 ≤ 32767; tests/value/volatile2.i:76:[value] warning: signed overflow. @@ -49,7 +54,8 @@ tests/value/volatile2.i:78:[value] warning: signed overflow. assert i + 1 ≤ 32 tests/value/volatile2.i:78:[value] warning: signed overflow. assert j + 1 ≤ 32767; tests/value/volatile2.i:78:[value] warning: signed overflow. assert -32768 ≤ i + j; tests/value/volatile2.i:78:[value] warning: signed overflow. assert i + j ≤ 32767; -[value] DUMPING STATE of file tests/value/volatile2.i line 80 +tests/value/volatile2.i:80:[value] Frama_C_dump_each: + # Cvalue domain: t[0..9] ∈ [--..--] u ∈ [--..--] pu ∈ {{ &u }} @@ -63,22 +69,41 @@ tests/value/volatile2.i:78:[value] warning: signed overflow. assert i + j ≤ 32 tmp_0 ∈ [--..--] l ∈ [--..--] BITF ∈ [--..--] - =END OF DUMP== + S9 ∈ [--..--] + u9[0..9] ∈ [--..--] + ==END OF DUMP== [value] Recording results for main5 [value] Done for function main5 [value] computing for function main6 <- main. - Called from tests/value/volatile2.i:128. + Called from tests/value/volatile2.i:141. [value] Recording results for main6 [value] Done for function main6 [value] computing for function main7 <- main. - Called from tests/value/volatile2.i:129. + Called from tests/value/volatile2.i:142. [value] Recording results for main7 [value] Done for function main7 [value] computing for function main8 <- main. - Called from tests/value/volatile2.i:130. -[value] Called Frama_C_show_each([--..--], [--..--], [--..--], [--..--], [--..--]) + Called from tests/value/volatile2.i:143. +tests/value/volatile2.i:114:[value] warning: initialization of volatile variable a ignored +tests/value/volatile2.i:115:[value] warning: initialization of volatile variable b ignored +tests/value/volatile2.i:116:[value] warning: initialization of volatile variable c ignored +tests/value/volatile2.i:117:[value] warning: initialization of volatile variable d ignored +tests/value/volatile2.i:118:[value] warning: initialization of volatile variable e ignored +tests/value/volatile2.i:119:[value] Frama_C_show_each: [--..--], [--..--], [--..--], [--..--], [--..--] [value] Recording results for main8 [value] Done for function main8 +[value] computing for function main9 <- main. + Called from tests/value/volatile2.i:144. +tests/value/volatile2.i:129:[value] warning: accessing out of bounds index. assert 0 ≤ S9.i1; +tests/value/volatile2.i:129:[value] warning: accessing out of bounds index. assert S9.i1 < 10; +tests/value/volatile2.i:130:[value] warning: accessing out of bounds index. assert 0 ≤ S9.i1; +tests/value/volatile2.i:130:[value] warning: accessing out of bounds index. assert S9.i1 < 10; +tests/value/volatile2.i:131:[value] warning: accessing out of bounds index. assert 0 ≤ u9[1]; +tests/value/volatile2.i:131:[value] warning: accessing out of bounds index. assert u9[1] < 10; +tests/value/volatile2.i:132:[value] warning: accessing out of bounds index. assert 0 ≤ u9[1]; +tests/value/volatile2.i:132:[value] warning: accessing out of bounds index. assert u9[1] < 10; +[value] Recording results for main9 +[value] Done for function main9 [value] Recording results for main [value] done for function main [value] ====== VALUES COMPUTED ====== @@ -98,7 +123,7 @@ tests/value/volatile2.i:78:[value] warning: signed overflow. assert i + j ≤ 32 [value:final-states] Values at end of function main4: p1 ∈ {{ &i }} - p2 ∈ {{ &i + [--..--] }} + p2 ∈ [--..--] [value:final-states] Values at end of function main5: i ∈ [--..--] j ∈ [--..--] @@ -116,6 +141,8 @@ tests/value/volatile2.i:78:[value] warning: signed overflow. assert i + j ≤ 32 c ∈ [--..--] d ∈ [--..--] e ∈ [--..--] +[value:final-states] Values at end of function main9: + t9[0..9] ∈ {1; 2; 3; 4} or UNINITIALIZED [value:final-states] Values at end of function main: /* Generated by Frama-C */ @@ -145,29 +172,26 @@ union __anonunion_U_3 { }; typedef union __anonunion_U_3 U; typedef U volatile vU; +struct __anonstruct_S9_4 { + int volatile i1 ; + int i2 ; +}; unsigned char volatile t[10]; struct u volatile u; struct u *pu = (struct u *)(& u); void main1(void) { - unsigned char volatile c; - int x; - unsigned char volatile *p; - unsigned int i; - unsigned int j; - unsigned int k; - unsigned int l; - c = (unsigned char)1; - x = 1; - p = (unsigned char volatile *)(& x); + unsigned char volatile c = (unsigned char)1; + int x = 1; + unsigned char volatile *p = (unsigned char volatile *)(& x); /*@ assert Value: signed_overflow: (int)c << 8 ≤ 32767; */ - i = (unsigned int)(((int)c << 8) + (int)c); + unsigned int i = (unsigned int)(((int)c << 8) + (int)c); /*@ assert Value: signed_overflow: (int)*p << 8 ≤ 32767; */ - j = (unsigned int)(((int)*p << 8) + (int)*p); + unsigned int j = (unsigned int)(((int)*p << 8) + (int)*p); /*@ assert Value: signed_overflow: (int)t[1] << 8 ≤ 32767; */ - k = (unsigned int)(((int)t[1] << 8) + (int)t[2]); + unsigned int k = (unsigned int)(((int)t[1] << 8) + (int)t[2]); /*@ assert Value: signed_overflow: (int)u.f1 << 8 ≤ 32767; */ - l = (unsigned int)(((int)u.f1 << 8) + (int)u.f2); + unsigned int l = (unsigned int)(((int)u.f1 << 8) + (int)u.f2); return; } @@ -175,12 +199,9 @@ struct s s; struct s volatile *ps = (struct s volatile *)(& s); void main2(void) { - int i; - int j; - int k; - i = (int)ps->i1; - j = (int)u.f1; - k = (int)t[1]; + int i = (int)ps->i1; + int j = (int)u.f1; + int k = (int)t[1]; return; } @@ -201,10 +222,8 @@ void main3(void) void main4(void) { int volatile i; - int volatile *p1; - int volatile * volatile p2; - p1 = & i; - p2 = & i; + int volatile *p1 = & i; + int volatile * volatile p2 = & i; return; } @@ -214,55 +233,42 @@ extern int ( /* missing proto */ Frama_C_dump_each)(); void main5(void) { - int volatile i; - int volatile j; - int k; int tmp; int tmp_0; - int l; - i = 0; - j = 0; - { /* sequence */ - tmp = i; - /*@ assert Value: signed_overflow: i + 1 ≤ 32767; */ - i ++; - tmp_0 = j; - /*@ assert Value: signed_overflow: j + 1 ≤ 32767; */ - j ++; - ; - } + int volatile i = 0; + int volatile j = 0; + tmp = i; + /*@ assert Value: signed_overflow: i + 1 ≤ 32767; */ + i ++; + tmp_0 = j; + /*@ assert Value: signed_overflow: j + 1 ≤ 32767; */ + j ++; /*@ assert Value: signed_overflow: -32768 ≤ tmp + tmp_0; */ /*@ assert Value: signed_overflow: tmp + tmp_0 ≤ 32767; */ - k = tmp + tmp_0; - { /* sequence */ - /*@ assert Value: signed_overflow: i + 1 ≤ 32767; */ - i ++; - /*@ assert Value: signed_overflow: j + 1 ≤ 32767; */ - j ++; - } + int k = tmp + tmp_0; + /*@ assert Value: signed_overflow: i + 1 ≤ 32767; */ + i ++; + /*@ assert Value: signed_overflow: j + 1 ≤ 32767; */ + j ++; /*@ assert Value: signed_overflow: -32768 ≤ i + j; */ /*@ assert Value: signed_overflow: i + j ≤ 32767; */ - l = i + j; + int l = i + j; Frama_C_dump_each(); return; } void main6(void) { - int i; - int j; - i = 1; - j = i; + int i = 1; + int j = i; return; } struct bitf volatile BITF; void main7(void) { - int i; - int k; - i = (int)BITF.i + 1; - k = (int)BITF.j + 1; + int i = (int)BITF.i + 1; + int k = (int)BITF.j + 1; return; } @@ -272,20 +278,36 @@ extern int ( /* missing proto */ Frama_C_show_each)(); void main8(void) { - S volatile a; - vS b; - vS2 c; - U volatile d; - vU e; - a.field = 0; - b.field = 0; - c.field = 0; - d.field = 0; - e.field = 0; + S volatile a = {.field = 0}; + vS b = {.field = 0}; + vS2 c = {.field = 0}; + U volatile d = {.field = 0}; + vU e = {.field = 0}; Frama_C_show_each(a,b,c,d,e); return; } +extern struct __anonstruct_S9_4 S9; + +int volatile u9[10]; +void main9(void) +{ + int t9[10]; + /*@ assert Value: index_bound: 0 ≤ S9.i1; */ + /*@ assert Value: index_bound: S9.i1 < 10; */ + t9[S9.i1] = 1; + /*@ assert Value: index_bound: 0 ≤ S9.i1; */ + /*@ assert Value: index_bound: S9.i1 < 10; */ + t9[S9.i1] = 2; + /*@ assert Value: index_bound: 0 ≤ u9[1]; */ + /*@ assert Value: index_bound: u9[1] < 10; */ + t9[u9[1]] = 3; + /*@ assert Value: index_bound: 0 ≤ u9[1]; */ + /*@ assert Value: index_bound: u9[1] < 10; */ + t9[u9[1]] = 4; + return; +} + void main(void) { main1(); @@ -296,6 +318,7 @@ void main(void) main6(); main7(); main8(); + main9(); return; } diff --git a/tests/value/oracle/volatilestruct.res.oracle b/tests/value/oracle/volatilestruct.res.oracle index 5c0fdefefa4b98fc67b01aa9f2d02fe0a15dc3b7..1d5e0c05daa14bc7e8b4e76d4d78c09243a9b7a6 100644 --- a/tests/value/oracle/volatilestruct.res.oracle +++ b/tests/value/oracle/volatilestruct.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/volatilestruct.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/wide_string.res.oracle b/tests/value/oracle/wide_string.res.oracle index 113a1efa48978a79466d93ddb1f192d39319b593..ee9807d8c310b6008b9281437c8284370252a795 100644 --- a/tests/value/oracle/wide_string.res.oracle +++ b/tests/value/oracle/wide_string.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/wide_string.c (with preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/oracle/widen_non_constant.res.oracle b/tests/value/oracle/widen_non_constant.res.oracle index 60df630fe7ce6653c39bd413091c7cb56184587f..df575c00e5266615baf59e3ed7962991277ea5b0 100644 --- a/tests/value/oracle/widen_non_constant.res.oracle +++ b/tests/value/oracle/widen_non_constant.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/widen_non_constant.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state @@ -13,61 +12,61 @@ [value] computing for function main1 <- main. Called from tests/value/widen_non_constant.i:84. tests/value/widen_non_constant.i:10:[value] entering loop for the first time -[value] Called Frama_C_show_each_out({0}) +tests/value/widen_non_constant.i:11:[value] Frama_C_show_each_out: {0} tests/value/widen_non_constant.i:12:[value] entering loop for the first time -[value] Called Frama_C_show_each_in({0}, {1}) -[value] Called Frama_C_show_each_in({0}, {1; 2}) -[value] Called Frama_C_show_each_in({0}, {1; 2; 3}) -[value] Called Frama_C_show_each_in({0}, [1..23]) -[value] Called Frama_C_show_each_out({0; 1}) -[value] Called Frama_C_show_each_in({0; 1}, [1..23]) -[value] Called Frama_C_show_each_out({0; 1; 2}) -[value] Called Frama_C_show_each_in({0; 1; 2}, [1..23]) -[value] Called Frama_C_show_each_out([0..22]) -[value] Called Frama_C_show_each_in([0..23], [1..23]) +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: {0}, {1} +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: {0}, {1; 2} +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: {0}, {1; 2; 3} +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: {0}, [1..23] +tests/value/widen_non_constant.i:11:[value] Frama_C_show_each_out: {0; 1} +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: {0; 1}, [1..23] +tests/value/widen_non_constant.i:11:[value] Frama_C_show_each_out: {0; 1; 2} +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: {0; 1; 2}, [1..23] +tests/value/widen_non_constant.i:11:[value] Frama_C_show_each_out: [0..22] +tests/value/widen_non_constant.i:13:[value] Frama_C_show_each_in: [0..23], [1..23] [value] Recording results for main1 [value] Done for function main1 [value] computing for function main2 <- main. Called from tests/value/widen_non_constant.i:85. tests/value/widen_non_constant.i:26:[value] entering loop for the first time -[value] Called Frama_C_show_each_out({0}) +tests/value/widen_non_constant.i:27:[value] Frama_C_show_each_out: {0} tests/value/widen_non_constant.i:28:[value] entering loop for the first time -[value] Called Frama_C_show_each_in({0}, {1}) -[value] Called Frama_C_show_each_in({0}, {1; 2}) -[value] Called Frama_C_show_each_in({0}, {1; 2; 3}) -[value] Called Frama_C_show_each_in({0}, [1..23]) -[value] Called Frama_C_show_each_out({0; 1}) -[value] Called Frama_C_show_each_in({0; 1}, [1..23]) -[value] Called Frama_C_show_each_out({0; 1; 2}) -[value] Called Frama_C_show_each_in([0..25], [1..23]) -[value] Called Frama_C_show_each_out([0..22]) +tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: {0}, {1} +tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: {0}, {1; 2} +tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: {0}, {1; 2; 3} +tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: {0}, [1..23] +tests/value/widen_non_constant.i:27:[value] Frama_C_show_each_out: {0; 1} +tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: {0; 1}, [1..23] +tests/value/widen_non_constant.i:27:[value] Frama_C_show_each_out: {0; 1; 2} +tests/value/widen_non_constant.i:29:[value] Frama_C_show_each_in: [0..25], [1..23] +tests/value/widen_non_constant.i:27:[value] Frama_C_show_each_out: [0..22] [value] Recording results for main2 [value] Done for function main2 [value] computing for function main3 <- main. Called from tests/value/widen_non_constant.i:86. tests/value/widen_non_constant.i:45:[value] entering loop for the first time -[value] Called Frama_C_show_each_out({0}) +tests/value/widen_non_constant.i:46:[value] Frama_C_show_each_out: {0} tests/value/widen_non_constant.i:47:[value] entering loop for the first time -[value] Called Frama_C_show_each_in({0}, {1}) -[value] Called Frama_C_show_each_in({0}, {1; 2}) -[value] Called Frama_C_show_each_in({0}, {1; 2; 3}) -[value] Called Frama_C_show_each_in({0}, [1..23]) -[value] Called Frama_C_show_each_out({0; 1}) -[value] Called Frama_C_show_each_in({0; 1}, [1..23]) -[value] Called Frama_C_show_each_out({0; 1; 2}) -[value] Called Frama_C_show_each_in([0..2147483647], [1..23]) +tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: {0}, {1} +tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: {0}, {1; 2} +tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: {0}, {1; 2; 3} +tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: {0}, [1..23] +tests/value/widen_non_constant.i:46:[value] Frama_C_show_each_out: {0; 1} +tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: {0; 1}, [1..23] +tests/value/widen_non_constant.i:46:[value] Frama_C_show_each_out: {0; 1; 2} +tests/value/widen_non_constant.i:48:[value] Frama_C_show_each_in: [0..2147483647], [1..23] tests/value/widen_non_constant.i:49:[value] warning: out of bounds read. assert \valid_read(p + j); tests/value/widen_non_constant.i:45:[value] warning: signed overflow. assert j + 1 ≤ 2147483647; -[value] Called Frama_C_show_each_out([0..22]) +tests/value/widen_non_constant.i:46:[value] Frama_C_show_each_out: [0..22] [value] Recording results for main3 [value] Done for function main3 [value] computing for function main4 <- main. Called from tests/value/widen_non_constant.i:87. tests/value/widen_non_constant.i:63:[value] entering loop for the first time tests/value/widen_non_constant.i:69:[value] entering loop for the first time -[value] Called Frama_C_show_each({43}) +tests/value/widen_non_constant.i:72:[value] Frama_C_show_each: {43} tests/value/widen_non_constant.i:75:[value] entering loop for the first time -[value] Called Frama_C_show_each({35; 36; 37; 38; 39; 40; 41; 42}) +tests/value/widen_non_constant.i:78:[value] Frama_C_show_each: {35; 36; 37; 38; 39; 40; 41; 42} [value] Recording results for main4 [value] Done for function main4 [value] Recording results for main diff --git a/tests/value/oracle/widen_on_non_monotonic.res.oracle b/tests/value/oracle/widen_on_non_monotonic.res.oracle index 457872df35e06e67284bca20690b85a3c45a1dfb..c40b9869b45f0c6f158d954e280feaa65c8f0892 100644 --- a/tests/value/oracle/widen_on_non_monotonic.res.oracle +++ b/tests/value/oracle/widen_on_non_monotonic.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/widen_on_non_monotonic.i (no preprocessing) tests/value/widen_on_non_monotonic.i:57:[kernel] warning: Calling undeclared function fn1. Old style K&R code? tests/value/widen_on_non_monotonic.i:58:[kernel] warning: Calling undeclared function fn2. Old style K&R code? @@ -19,6 +18,7 @@ tests/value/widen_on_non_monotonic.i:58:[kernel] warning: Calling undeclared fun Called from tests/value/widen_on_non_monotonic.i:71. tests/value/widen_on_non_monotonic.i:25:[value] entering loop for the first time tests/value/widen_on_non_monotonic.i:23:[value] entering loop for the first time +tests/value/widen_on_non_monotonic.i:26:[value] entering loop for the first time tests/value/widen_on_non_monotonic.i:27:[value] warning: signed overflow. assert -2147483648 ≤ b - 1; [value] Recording results for main1 [value] Done for function main1 diff --git a/tests/value/oracle/widen_overflow.res.oracle b/tests/value/oracle/widen_overflow.res.oracle index c1036e883e7237aa4f130f9173f1dadf21ff110c..b93f9070b2920cc3c40d1227eef1b8550c5b0b78 100644 --- a/tests/value/oracle/widen_overflow.res.oracle +++ b/tests/value/oracle/widen_overflow.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/widen_overflow.i (no preprocessing) tests/value/widen_overflow.i:9:[kernel] warning: Calling undeclared function u. Old style K&R code? [value] Analyzing a complete application starting at main @@ -6,7 +5,7 @@ tests/value/widen_overflow.i:9:[kernel] warning: Calling undeclared function u. [value] Initial state computed [value:initial-state] Values of globals at initialization -[value] Called Frama_C_show_each({4}) +tests/value/widen_overflow.i:6:[value] Frama_C_show_each: {4} tests/value/widen_overflow.i:9:[value] entering loop for the first time [value] computing for function u <- main. Called from tests/value/widen_overflow.i:9. diff --git a/tests/value/oracle/with_comment.res.oracle b/tests/value/oracle/with_comment.res.oracle index f2194ee3322eff610dd9d5adefa8a8d9b299d203..e7e5f0fb12a6e8f19690659ea9825ac2bafa2dc2 100644 --- a/tests/value/oracle/with_comment.res.oracle +++ b/tests/value/oracle/with_comment.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/with_comment.i (no preprocessing) [value] Analyzing a complete application starting at main2 [value] Computing initial state diff --git a/tests/value/oracle/zerolengtharrays.res.oracle b/tests/value/oracle/zerolengtharrays.res.oracle index ed1d3c08ae1a9ac3bb411d4ce8bc98a3fb4a2248..7f6d70f5016eaf096a698305c6b352454d6c050c 100644 --- a/tests/value/oracle/zerolengtharrays.res.oracle +++ b/tests/value/oracle/zerolengtharrays.res.oracle @@ -1,4 +1,3 @@ -[kernel] Parsing share/libc/__fc_builtin_for_normalization.i (no preprocessing) [kernel] Parsing tests/value/zerolengtharrays.i (no preprocessing) [value] Analyzing a complete application starting at main [value] Computing initial state diff --git a/tests/value/overflow.i b/tests/value/overflow.i index 8fe93d7b64e69eb126493e2512ccf5b7d9078a62..ed696c8d5384ed4a1131ecc5a05f6c1207b997c9 100644 --- a/tests/value/overflow.i +++ b/tests/value/overflow.i @@ -3,7 +3,7 @@ STDOPT: #"-no-warn-signed-overflow" */ extern int printf (__const char *__restrict __format, ...); -/* L'analyseur déborde et dit i=-1 */ +/* L'analyseur déborde et dit i=-1 */ int main (int c) { unsigned long long i = 0xFFFFFFFFFFFFFFFFULL; unsigned long j = 0xFFFFFFFFUL; diff --git a/tests/value/postcond_leaf.c b/tests/value/postcond_leaf.c index 7b814273ab102817601d6b9b2082821494b0811e..05e54193f386841460c7f539e3a38fa4aff81237 100644 --- a/tests/value/postcond_leaf.c +++ b/tests/value/postcond_leaf.c @@ -1,5 +1,5 @@ /* run.config* -OPT: -no-autoload-plugins -load-module value,inout,report -no-val-show-progress -val -val-use-spec g1,g2,g3 -then -report +OPT: -no-autoload-plugins @VALUECONFIG@ -load-module value,inout,report -no-val-show-progress -val -val-use-spec g1,g2,g3 -then -report */ /* Test what is printed when Value evaluates a post-condition: diff --git a/tests/value/protomain.i b/tests/value/protomain.i index 61b493cadf53da6aee679d26402927b120d69b94..4d3e2a636d186efa5aba822556b27657b473bbb7 100644 --- a/tests/value/protomain.i +++ b/tests/value/protomain.i @@ -1,4 +1,4 @@ /* run.config* - OPT: -no-autoload-plugins -load-module inout,value -val @VALUECONFIG@ -inout-callwise + OPT: -no-autoload-plugins -load-module inout,value -val @VALUECONFIG@ */ int main(int c, char **); diff --git a/tests/value/recol.c b/tests/value/recol.c index ddf9898b5bdcbd791768507a769bc32b1479d387..f4496e47867287c0a1fa1b63896735393308770d 100644 --- a/tests/value/recol.c +++ b/tests/value/recol.c @@ -50,7 +50,7 @@ int main(void) #ifndef PTEST printf("s_int: %d col_ones: %d col_123:%d\n", s_int, col_ones, col_123); #endif - /* résultat attendu, avec int 32-bits : + /* résultat attendu, avec int 32-bits : little endian: s_int = -833811464 big_endian : s_int: -1480071902 col_ones: 825307442 col_123:825373236 */ diff --git a/tests/value/recursion.i b/tests/value/recursion.i index e42d82b4106e193cdd01b3fb8988604e60410bfc..b39759115e428819500fd0e6d83a7a01c29c56ca 100644 --- a/tests/value/recursion.i +++ b/tests/value/recursion.i @@ -39,7 +39,7 @@ void g() { g(); } -// Infer assigns clause that overwrite *p1 and *p2 +// Infer assigns clause that overwrite *p1 and *p2. Currently unsound void h(int *p1, int *p2) { h(p1, p2); } @@ -48,7 +48,7 @@ void h(int *p1, int *p2) { int *pg; /* &i escapes. The precondition is true on all calls, but could be computed - false if one overwrites the value of i naively at each call */ + false if one overwrites the value of i naively at each call. Currently unsound */ /*@ requires stage > 0 ==> *pg == i-5; assigns *pg \from \nothing; ensures stage > 0 ==> *pg == 8; diff --git a/tests/value/redundant_alarms.c b/tests/value/redundant_alarms.c index 56b8b6850f32cafc28f8fa34f3bc60b0ff619e78..d1594158504fcbfefe28af689c67128e1cc2cd0b 100644 --- a/tests/value/redundant_alarms.c +++ b/tests/value/redundant_alarms.c @@ -45,10 +45,23 @@ void main4(int i) { } } +void main5() { + int *p; + + { + int x; + p = &x; + *p = 1; + //@ assert *p == 1; + } + + //@ assert *p == 1; // Should *not* be proven +} void main() { if (v) main1(v); main2(v); main3(v, v); if (v) main4(v); + main5(); } diff --git a/tests/value/replace_by_show_each.c b/tests/value/replace_by_show_each.c index 0a4b5538caebd16326e3bb662af73c4a6462b02b..64f32b34d894ce5a5a7d02202f2fd09538d68ecd 100644 --- a/tests/value/replace_by_show_each.c +++ b/tests/value/replace_by_show_each.c @@ -1,5 +1,5 @@ /* run.config* - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -inout-callwise -inout -calldeps + OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -inout -calldeps */ #define show_each_1 Frama_C_show_each_1 diff --git a/tests/value/sep.i b/tests/value/sep.i deleted file mode 100644 index 266cf96a6abdd0645b5f981de94a7c1a1f61bc9c..0000000000000000000000000000000000000000 --- a/tests/value/sep.i +++ /dev/null @@ -1,46 +0,0 @@ -/* run.config* - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -slevel 10 -lib-entry -main f1 -separate-n 0 -separate-of 3 - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -slevel 10 -lib-entry -main f1 -separate-n 1 -separate-of 3 - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -slevel 10 -lib-entry -main f1 -separate-n 2 -separate-of 3 - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -slevel 10 -lib-entry -main f1 -separate-n 3 -separate-of 3 - OPT: -no-autoload-plugins -load-module from,inout,value -val @VALUECONFIG@ -slevel 10 -lib-entry -main f1 -val-split-return auto -*/ -int index; -int tab[5]; - -//@ ensures \result==0 || \result==-1 || \result==1 ; -extern int init2(void); - -int init1(void) -{ - int res; - - res = init2(); - - if (res == 0) - { - index=0; - } - else - { - if (res == 1) - { - res = 0; - index = 0; - } - } - - return res; -} - -//@ requires 0<=n<5; -int f1(int n) -{ - int res; - - res = init1(); - - if (res == 0) - return tab[index+n]; - return -1; -} diff --git a/tests/value/shift.i b/tests/value/shift.i index 22777ca620521f984329b6283e4e2409f9dd67c6..fced5cbaabbeb3cf734022610c8a12bcc84a98f5 100644 --- a/tests/value/shift.i +++ b/tests/value/shift.i @@ -53,7 +53,10 @@ int main(int c, int z, int zz) { r += (long)t << 8; } - unsigned int shl = 2U << 31; // "Unsigned overflow." + unsigned int shl = 1; + if (v) { + shl = 2U << 31; // "Unsigned overflow." + } return b; } diff --git a/tests/value/split_return.i b/tests/value/split_return.i index fc28f497b945b45f4c0a696f22fdf9ab009d58d9..c18a489069b387646b59ea63468e984457f798a0 100644 --- a/tests/value/split_return.i +++ b/tests/value/split_return.i @@ -1,10 +1,10 @@ /* run.config* STDOPT: +"-deterministic -slevel-function init:3,main1:3,f2:4,main2:4,f4:3,main5:3 -val-split-return-function f2:0,f3:-2:-4,f4:4,f5:-2,NON_EXISTING:4 -permissive -then -load-module report -report" - STDOPT: +"-deterministic -val @VALUECONFIG@ -journal-disable -out -input -deps -slevel 6 -val-split-return auto -val-split-return-function f7:0:3 -then -load-module report -report" + STDOPT: +"-deterministic -val -journal-disable -out -input -deps -slevel 6 -val-split-return auto -val-split-return-function f7:0:3 -then -load-module report -report" COMMENT: below command must fail, as -permissive is not set - STDOPT: +"-deterministic -val @VALUECONFIG@ -slevel-function NON_EXISTING:4" - STDOPT: +"-deterministic -val @VALUECONFIG@ -journal-disable -out -input -deps -slevel 6 -val-split-return full" - STDOPT: +"-deterministic -val @VALUECONFIG@ -journal-disable -out -input -deps -slevel 6 -val-split-return full -val-split-return-function f7:0:3 -val-split-return-function f2:full -then -val-split-return-function f2:auto" + STDOPT: +"-deterministic -val -slevel-function NON_EXISTING:4" + STDOPT: +"-deterministic -val -journal-disable -out -input -deps -slevel 6 -val-split-return full" + STDOPT: +"-deterministic -val -journal-disable -out -input -deps -slevel 6 -val-split-return full -val-split-return-function f7:0:3 -val-split-return-function f2:full -then -val-split-return-function f2:auto" */ /*@ assigns \result \from \nothing; @@ -25,6 +25,7 @@ unsigned int main1() { break; default: //@ assert \false; + break; } return x; } diff --git a/tests/value/strings.i b/tests/value/strings.i index fe30499c816b080cc8115a6a0393613ca376feac..88171af011bd82f1c7a5a3c43a3db13a5b3c27bd 100644 --- a/tests/value/strings.i +++ b/tests/value/strings.i @@ -1,9 +1,9 @@ /* run.config* GCC: - STDOPT: #"-main main1" - STDOPT: #"-main main6" - STDOPT: #"-main main7" - STDOPT: #"-main main8 -slevel-function strcmp:50" + STDOPT: #"-main main1 -no-val-builtins-auto" + STDOPT: #"-main main6 -no-val-builtins-auto" + STDOPT: #"-main main7 -no-val-builtins-auto" + STDOPT: #"-main main8 -slevel-function strcmp:50 -no-val-builtins-auto" */ char s1[]="hello\000 world"; char s2[]="hello"; diff --git a/tests/value/switch_cast.i b/tests/value/switch_cast.i index 7ed8bca1a1a44c21bb57bb716d7f1e31c0eeaa37..57e8a7a3de4b95c027de8035804fb4d524edadb6 100644 --- a/tests/value/switch_cast.i +++ b/tests/value/switch_cast.i @@ -61,6 +61,7 @@ void g() { y = x * 18; break; default: + break; } y += 1; Frama_C_show_each(y); diff --git a/tests/value/symbolic_locs.i b/tests/value/symbolic_locs.i index 51c309a3ceee2e9ed7acff14ec29a315c76ef9fa..4c08673fa22f0300bbd44408673c1fc65eb993a2 100644 --- a/tests/value/symbolic_locs.i +++ b/tests/value/symbolic_locs.i @@ -67,11 +67,60 @@ void main5_scope_lv() { Frama_C_dump_each(); // Should be empty, i out-of-scope } + +// This function checks that we remove 'stale' dependencies in some weird cases +void main6_ghost_dep() { + int x = v; + { + int y = v, z = v, k = v; + int *p = v ? &x : (v ? &y : &z); + + // Learn something about *p. Depends on p, x, y, z + *p = v; + + /* Drop dependency on x. The domain does not learn this information, and + *p still depends on x. */ + //@ assert p != &x; + + // Restrict k so that we have a precise interval to constrain *p to + //@ assert k <= 100; + + if (*p == k) { + /* We have learnt something on *p through the valuation. The dependencies + are now v, y, z. x must have been dropped, everywhere */ + goto L; + } else { + while (1); + } + } + L: + // y and z have left scope, so the information on *p should have been removed + Frama_C_dump_each(); + // if *p was erroneously considered as depending on x, we get a crash here + x = 1; +} + +void main7_widening() { + int b = 0; + int c = 0; + int *p = v ? &b : &c; + + *p = 0; + + while (*p <= 10000) { + *p += 1; + } + Frama_C_show_each(*p); +} + + void main() { // if (v) main1(); if (v) main2_kill_direct(); if (v) main3_kill_indirect(); if (v) main4_scope_right(); if (v) main5_scope_lv(); + if (v) main6_ghost_dep(); + if (v) main7_widening(); Frama_C_dump_each(); // empty } diff --git a/tests/value/threat_redundant.c b/tests/value/threat_redundant.c index 5ff15a6d91d000b2800bc17e3ab6b8dcdc99dee3..3bc247833a80b4eba4ffe7f37112aa2cdf4eaaab 100644 --- a/tests/value/threat_redundant.c +++ b/tests/value/threat_redundant.c @@ -1,8 +1,11 @@ +/*run.config* + STDOPT: +"-no-val-builtins-auto" +*/ + #define NULL ((void*)0) char * strchr(const char * s, int c) -{ - for(; *s != (char) c; ++s) +{ for(; *s != (char) c; ++s) if (*s == '\0') return NULL; return (char *) s; diff --git a/tests/value/use_spec.i b/tests/value/use_spec.i index 165f5cd3484f8742b30499c0f5845aa4faa92392..9fe6d60910cd2b18962a1ef694c63aa1af4dead6 100644 --- a/tests/value/use_spec.i +++ b/tests/value/use_spec.i @@ -1,6 +1,6 @@ /* run.config* - OPT: -no-autoload-plugins -load-module from,inout,value -val-use-spec f,h -val @VALUECONFIG@ -inout -inout-callwise -calldeps - OPT: -no-autoload-plugins -load-module from,inout,value -val-use-spec f,h -val @VALUECONFIG@ -inout -inout-callwise -calldeps -show-indirect-deps + OPT: -no-autoload-plugins -load-module from,inout,value -val-use-spec f,h -val @VALUECONFIG@ -inout -calldeps + OPT: -no-autoload-plugins -load-module from,inout,value -val-use-spec f,h -val @VALUECONFIG@ -inout -calldeps -show-indirect-deps */ diff --git a/tests/value/val9.i b/tests/value/val9.i deleted file mode 100644 index 11d6dea328d6229488741f86d9267912e4ccf601..0000000000000000000000000000000000000000 --- a/tests/value/val9.i +++ /dev/null @@ -1,59 +0,0 @@ -/* run.config* - GCC: - STDOPT: #"-main f -val-warn-copy-indeterminate=-f" -*/ -int TT[10]={1,2,3}; -int T[10]={1,2,3}; -int i,a,b; -int a7, b7; - -int O1[20]; -int O2[20]; -int *p; - -int x2,*b2,a2; - -void f() { - for (i = 0; i <= 8; i++) { - TT[i] = i; - *((int*)((char*)&(TT[i]) + 1)) = 0; - } - - a = 1; - if (b) i=5; else i=6; - a=3; - if (i>=2) { a = i ; T[i] = 7 ; } - - for (i = 0; i <= 8; i++) { - *(char *) &a = 1; -b = a; - - *((int*)(((char*)&(T[i])) + 1)) = 0; - } - - - - - a7 = 'a'; - *(char *) &a7 = 1; - b7 = (char)a7; - - - ((int*)O1)[1]=17; - ((char*)O1)[1]=18; - - - ((int*)O2)[0]=10; - ((char*)O2)[1]=11; - - O1[6]=0; - p=O1+9; - *p=1; - - - x2 = 777; - a2 = (int)&x2; - b2 = (int*) a2; - *((int*)a2) = 0; - *b2=*b2+1; -} diff --git a/tests/value/volatile2.i b/tests/value/volatile2.i index a9d769d276c05a36bd39d685912c0c45ca51e0bd..a3644e564bab02a4c70423d913dea2df97eacfdc 100644 --- a/tests/value/volatile2.i +++ b/tests/value/volatile2.i @@ -119,6 +119,19 @@ void main8() { // Test that volatile qualifiers hidden inside typedefs are taken Frama_C_show_each(a, b, c, d, e); } +extern struct { volatile int i1; int i2; } S9; +volatile int u9[10]; + +// Check that remove-redundant-alarms does not propagate information +// about predicates that involve volatile memory zones +void main9 () { + int t9[10]; + t9[S9.i1] = 1; + t9[S9.i1] = 2; + t9[u9[1]] = 3; + t9[u9[1]] = 4; +} + void main() { main1(); main2(); @@ -128,4 +141,5 @@ void main() { main6(); main7(); main8(); + main9(); }